'$DYNAMIC 'current library; DIRESTUF.QLB DEFINT A-Z DECLARE SUB menu (menuset() AS STRING, menuc%, visrows%, menux%, menuy%, menup%, skip%, csrcol%, txtcol) DECLARE FUNCTION LARGE% (n1%, n2%) DECLARE FUNCTION SMALL% (n1%, n2%) DECLARE SUB eventitem (dia(), sayx(), sayy(), sayw(), sayl(), font, ivname$(), ivpic(), ivpal(), ivset(), ivcon(), ivuse$(), plot(), kp(), rate!, vpage, placer(), bobpal()) DECLARE SUB itemscon (plot(), itset(), picset(), iactive(), mx, my) DECLARE SUB checkcon (plot(), ickcon(), mx, my, picset()) DECLARE SUB bossmeter (boss(), chp(), ap(), hp(), dpage) DECLARE SUB fontset (font, font()) DECLARE SUB bigsprite (buffer(), nice(), boss()) DECLARE SUB debugest (code(), code$, plot(), seed(), store, boss(), debug, nice(), picset(), bobpal(), x(), y(), hp(), cmax, target(), allitems, inft#(), pict()) DECLARE SUB buyit (ptr, cmax, ptr3, seed(), price(), hp(), liup(), chp(), scure(), chup(), plot(), infplot(), inftemp(), sset1(), sset2(), inft#(), inftime()) DECLARE SUB drawbox (sayx(), sayy(), sayw(), sayl(), dia(), dctr, dest, arg) DECLARE SUB clock (rtime$) DECLARE SUB allsprite (vframe(), d(), af(), aframe(), picset(), order(), boss(), btog(), bobpal(), pale(), x(), y(), placer(), ty(), dpage) DECLARE SUB setmodex () DECLARE SUB copypage (BYVAL page1, BYVAL page2) DECLARE SUB setvispage (BYVAL page) DECLARE SUB drawsprite (pic(), pal(), BYVAL po, BYVAL x, BYVAL y, BYVAL page) DECLARE SUB loadsprite (pic(), BYVAL x, BYVAL y, BYVAL w, BYVAL h, BYVAL page) DECLARE SUB stosprite (pic(), BYVAL x, BYVAL y, BYVAL page) DECLARE SUB fadeto (palbuff(), BYVAL red, BYVAL green, BYVAL blue) DECLARE SUB fadetopal (pal(), palbuff()) DECLARE SUB setpal (pal()) DECLARE SUB clearpage (BYVAL page) DECLARE SUB loadpage (buf(), fil$, BYVAL p) DECLARE SUB setkeys () DECLARE SUB setfont (F()) DECLARE SUB printstr (s$, BYVAL x, BYVAL y, BYVAL p) DECLARE SUB textcolor (BYVAL F, BYVAL b) DECLARE SUB setitup (fil$, buff(), BYVAL p) DECLARE SUB resetdsp DECLARE SUB playsnd (BYVAL n, BYVAL F) DECLARE SUB closefile DECLARE SUB setpicstuf (buf(), BYVAL b, BYVAL p) DECLARE SUB loadset (fil$, BYVAL i, BYVAL l) DECLARE SUB storeset (fil$, BYVAL i, BYVAL l) DECLARE SUB setwait (b(), BYVAL t) DECLARE FUNCTION Keyseg () DECLARE FUNCTION keyoff () DECLARE FUNCTION keyval (BYVAL a) DECLARE FUNCTION getkey () TYPE Regtype ax AS INTEGER bx AS INTEGER cx AS INTEGER dx AS INTEGER bp AS INTEGER si AS INTEGER di AS INTEGER flags AS INTEGER ds AS INTEGER es AS INTEGER END TYPE DIM SHARED regs AS Regtype regs.ax = &H3509: CALL interruptx(&H21, regs, regs) off9 = regs.bx: seg9 = regs.es DIM voice(16385), game(1000), rowpal(2304), rowpic(2304), mainpal(767), tile(2000), tilex(2000), tiley(2000) DIM SHARED placer(250), blocker(200), chroma(16 * 30), bobpal(16 * 99), buffer(8000), mapset(512), rowpas(2504), doorx(500), doory(500), exitx(500), exity(500), font(1024), ickloc(1536), ickcon(3200), order(16) DIM SHARED x(16), y(16), pict(16), pale(16), aspeed(16), picset(16), aframe(16), vframe(16), acounter(16), plot(400), whosay(1536), wsay(400), sayx(400), sayy(400), sayl(400), sayw(400), saypx(400), saypy(400), big(1250), fade(1536), item(4300) DIM SHARED boss(16), ic1(16), ic2(16), ic3(16), ic4(16), push(16), timef(16), nice(16), hp(16), chp(16), ap(16), defence(16), anim(16), ty(16), name$(16), seed(16), speed(16), stemp(16), kspeed(16), number(16), af(6), nbhp(16), nba(16) DIM SHARED itset(4400), ptemp(12), code(16), xtemp(12), ytemp(12), ltemp(12), beat(180), targ(1600), d(16), range(16), homing(16), knock(16), muser(16), boomer(16), inuse(16), absorb(16), passall(16), fuser(16), story!(2000), plotos(512) DIM SHARED iname$(30), ipic(30), ipal(30), ipicset(30), wnum(30), apic(30), apal(30), apicset(30), maim(30), guard(30), nitel(30), niteh(30), iflee(30), smaim(30), armsp(30), inice(30), conptr(30), rtime$, cmax, dpage, vpage, charge#, pal$, needf, _ hnb, day$, fcol, leap(10), dbefore(12) DIM SHARED week$(7), x, y, ptr, stock, product$(10), spict(10), spale(10), spicset(10), scure(10), chup(10), liup(10), sset1(10), sset2(10), inum(10), shx(10), shy(10), apear1(10), apear2(10), dia(20), dctr, arg, ptr3, price(10), noise(10), allitems _ , target(16), xyc(16) DIM SHARED ai1(16), swim(4), chase(4), rand(4), atack(4), inert(4), mimic(4), flee(4), eitem(4), itemp(4), seedp(4), xper(16), spin(16), weapon(4), nbe(4), iactive(16), mx, my, store, debug, index$(30), scribe$(8), wbig, presp, conv, btog(8), inft#( _ 10), inflict(8), infprob(10) DIM SHARED infplot(10), inftime(10), drain, pois#, font, csr2, levelup(4), csr(3), arm$(30), ix(40), iy(40), weps, arm, doom(150), take, inftemp(10), tempchp(4), descr$(20), ptr2, xaim(16), yaim(16), targx(10), targy(10), htarg(10), cant, look, o, _ cfull2, cfull3, tempc, tempe DIM SHARED boomf(10), r(10), code$, ivname$(40), ivuse$(40), ivpic(40), ivpal(40), ivcon(40), ivset(40), ranaset, ranapic, ranatemp, kp(15), kp$, rananice, begin$(250), cred, cred#, spinctr(4), fulpow(30), say(16), rate! REM $STATIC SUB allsprite (vframe(), d(), af(), aframe(), picset(), order(), boss(), btog(), bobpal(), pale(), x(), y(), placer(), ty(), dpage) FOR i = 1 TO 4 vframe(i) = ((d(i) - 1) * 1250) + (af(aframe(i)) * 250) NEXT FOR i = 5 TO 8 vframe(i) = ((d(i) - 1) * 500) + (af(aframe(i)) * 250) NEXT FOR i = 9 TO 12 vframe(i) = (af(aframe(i)) * 250) NEXT l = 0: FOR i = 1 TO 12 IF picset(i) > 0 THEN l = l + 1: order(l) = i NEXT IF l > 1 THEN FOR j = 1 TO l - 1 FOR i = 2 TO l + 1 - j IF y(order(i)) < y(order(i - 1)) THEN SWAP order(i), order(i - 1) NEXT: NEXT END IF FOR j = 1 TO l i = order(j) IF boss(i) > 0 THEN loadsprite big(), btog(i) * 1250, (i - 1) * 8, 50, 50, 3: drawsprite big(), bobpal(), pale(i) * 16, x(i) - 12, y(i) - 25, dpage: GOTO dsp loadsprite placer(), vframe(i), ty(i), 20, 25, 3 drawsprite placer(), bobpal(), pale(i) * 16, x(i), y(i) - 5, dpage dsp: NEXT END SUB SUB bigsprite (buffer(), nice(), boss()) setpicstuf buffer(), 2500, 3 FOR u = 1 TO 4 wbig = nice(u): IF wbig = 0 THEN wbig = wbig + boss(u) IF wbig = 0 THEN GOTO bg1 loadset "data\big.mxs" + CHR$(0), wbig - 1, (u - 1) * 8 bg1: NEXT u END SUB SUB bossmeter (boss(), chp(), ap(), hp(), dpage) FOR j = 2 TO 4 IF boss(j) > 0 AND chp(j) > 0 AND ap(j) > 1 THEN divis = INT(hp(j) / 19) + 1 textcolor 62, 0 FOR i = 1 TO INT((chp(j) - 1) / divis) + 1: IF i = INT((chp(j) - 1) / divis) + 1 AND ((chp(j) / divis) <> INT(chp(j) / divis)) THEN textcolor 52 + (((chp(j) / divis) - INT(chp(j) / divis)) * 10), 0 printstr CHR$(6), (j - 2) * 10, 20 + (9 * i), dpage NEXT END IF NEXT END SUB SUB buyit (ptr, cmax, ptr3, seed(), price(), hp(), liup(), chp(), scure(), chup(), plot(), infplot(), inftemp(), sset1(), sset2(), inft#(), inftime()) seed(1) = seed(1) - price(ptr) hp(1) = hp(1) + liup(ptr): hp(1) = SMALL(hp(1), 300) chp(1) = chp(1) + scure(ptr): chp(1) = SMALL(hp(1), chp(1)) cmax = cmax + chup(ptr): cmax = SMALL(cmax, 20) FOR j = 1 TO 6: IF plot(infplot(j)) = 1 THEN inftemp(j) = 1 NEXT j IF sset1(ptr) > 0 THEN plot(ABS(sset1(ptr))) = 1 IF sset1(ptr) < 0 THEN plot(ABS(sset1(ptr))) = 0 IF sset2(ptr) > 0 THEN plot(ABS(sset2(ptr))) = 1 IF sset2(ptr) < 0 THEN plot(ABS(sset2(ptr))) = 0 ptr3 = 0 FOR j = 1 TO 6 IF plot(infplot(j)) = 1 AND inftemp(j) = 0 THEN inft#(j) = TIMER IF plot(infplot(j)) = 0 AND inftemp(j) = 1 THEN inft#(j) = TIMER - inftime(j): plot(infplot(j)) = 1: IF j = 2 THEN plot(infplot(2)) = 0 inftemp(j) = 0: NEXT j END SUB SUB checkcon (plot(), ickcon(), mx, my, picset()) tmcur = ((my * 16) + mx) IF ickcon((tmcur * 6) + 0) > 0 THEN IF plot(ABS(ickcon((tmcur * 6) + 0))) = 0 THEN picset(2) = 0 IF ickcon((tmcur * 6) + 1) > 0 THEN IF plot(ABS(ickcon((tmcur * 6) + 1))) = 0 THEN picset(3) = 0 IF ickcon((tmcur * 6) + 2) > 0 THEN IF plot(ABS(ickcon((tmcur * 6) + 2))) = 0 THEN picset(4) = 0 IF ickcon((tmcur * 6) + 3) > 0 THEN IF plot(ABS(ickcon((tmcur * 6) + 3))) = 0 THEN picset(2) = 0 IF ickcon((tmcur * 6) + 4) > 0 THEN IF plot(ABS(ickcon((tmcur * 6) + 4))) = 0 THEN picset(3) = 0 IF ickcon((tmcur * 6) + 5) > 0 THEN IF plot(ABS(ickcon((tmcur * 6) + 5))) = 0 THEN picset(4) = 0 IF ickcon((tmcur * 6) + 0) < 0 THEN IF plot(ABS(ickcon((tmcur * 6) + 0))) = 1 THEN picset(2) = 0 IF ickcon((tmcur * 6) + 1) < 0 THEN IF plot(ABS(ickcon((tmcur * 6) + 1))) = 1 THEN picset(3) = 0 IF ickcon((tmcur * 6) + 2) < 0 THEN IF plot(ABS(ickcon((tmcur * 6) + 2))) = 1 THEN picset(4) = 0 IF ickcon((tmcur * 6) + 3) < 0 THEN IF plot(ABS(ickcon((tmcur * 6) + 3))) = 1 THEN picset(2) = 0 IF ickcon((tmcur * 6) + 4) < 0 THEN IF plot(ABS(ickcon((tmcur * 6) + 4))) = 1 THEN picset(3) = 0 IF ickcon((tmcur * 6) + 5) < 0 THEN IF plot(ABS(ickcon((tmcur * 6) + 5))) = 1 THEN picset(4) = 0 END SUB SUB clock (rtime$) IF VAL(MID$(TIME$, 1, 2)) > 11 THEN t1$ = "PM" ELSE t1$ = "AM" t2 = VAL(MID$(TIME$, 1, 2)): IF t2 > 11 THEN t2 = t2 - 12 IF t2 = 0 THEN t2 = 12 t2$ = STR$(t2) t3$ = MID$(TIME$, 4, 2) rtime$ = t2$ + ":" + t3$ + t1$ END SUB SUB debugest (code(), code$, plot(), seed(), store, boss(), debug, nice(), picset(), bobpal(), x(), y(), hp(), cmax, target(), allitems, inft#(), pict()) IF keyval(0) > 1 AND keyval(0) < 58 THEN code(0) = keyval(0) IF code(0) = code(1) THEN EXIT SUB code$ = MID$(CHR$(code(0) + 30) + code$, 1, 16) FOR k = 16 TO 1 STEP -1 code(k) = code(k - 1): NEXT k plot(174) = 0: IF plot(51) = 1 THEN plot(174) = 1 IF MID$(code$, 1, 6) = "0PW3<7" THEN seed(1) = 100: plot(51) = 1 IF MID$(code$, 1, 8) = "25W>O07=" THEN store = 1 IF MID$(code$, 1, 13) = "<02W?6W267=W<" THEN FOR i = 41 TO 51: plot(i) = 1: NEXT: FOR i = 73 TO 78: plot(i) = 1: NEXT: plot(171) = 1: plot(173) = 1 IF MID$(code$, 1, 13) = "20@>5PW=4L15L" THEN boss(1) = boss(1) XOR 1 IF MID$(code$, 1, 11) = "146?W10NP4O" THEN debug = debug XOR 1: plot(51) = 1 IF MID$(code$, 1, 12) = "0PW10A26NW<3" THEN FOR k = 2 TO 4 IF boss(k) = 0 AND nice(k) = 0 AND picset(k) > 0 THEN picset(k) = 0: drawsprite beat(), bobpal(), 32, x(k) - 2, y(k) + 8, 2 NEXT k: plot(51) = 1 END IF IF MID$(code$, 1, 10) = "4162=0P6AL" THEN IF hp(1) < 200 THEN hp(1) = 200: plot(51) = 1 IF MID$(code$, 1, 15) = "24612W0A2WALO47" THEN IF cmax < 12 THEN cmax = 12: plot(51) = 1 IF MID$(code$, 1, 13) = "06?W025P=W06?" THEN plot(51) = 1 FOR k = 2 TO 4 db1: randnum = INT(RND * 4) IF randnum + 1 = k THEN GOTO db1 target(k) = randnum IF picset(target(k) + 1) = 0 THEN GOTO db1 NEXT k END IF IF MID$(code$, 1, 14) = "O/62W0=16AW0O6" THEN allitems = allitems XOR 1 IF MID$(code$, 1, 11) = "@O6=W107<01" THEN plot(61) = 1: inft#(2) = TIMER - 200 IF MID$(code$, 1, 11) = "7<1W 0 THEN j = j - 1: ivmax = ivmax - 1: skip = skip + 1 j = j + 1: LOOP UNTIL j > ivmax IF ecsr < ivmax THEN GOSUB ei1 setkeys DO: setkeys copypage 3, dpage IF keyval(kp(1)) > 1 AND ecsr > 0 THEN playsnd 48, rate!: ecsr = ecsr - 1: fontb = font: font = 4: CALL fontset(font, font()): font = fontb: textcolor 15, 0: CALL drawbox(sayx(), sayy(), sayw(), sayl(), dia(), dctr, 3, arg): textcolor 17, 0: CALL _ fontset(font, font()): IF ecsr < ivmax THEN GOSUB ei1 IF keyval(kp(2)) > 1 AND ecsr < ivmax THEN playsnd 48, rate!: ecsr = ecsr + 1: fontb = font: font = 4: CALL fontset(font, font()): font = fontb: textcolor 15, 0: CALL drawbox(sayx(), sayy(), sayw(), sayl(), dia(), dctr, 3, arg): textcolor 17, 0: _ CALL fontset(font, font()): IF ecsr < ivmax THEN GOSUB ei1 IF (keyval(kp(12)) > 1 OR keyval(kp(13)) > 1) AND ecsr = ivmax THEN playsnd 49, rate!: EXIT SUB IF keyval(kp(15)) > 1 THEN EXIT SUB IF ecsr > 1 THEN printstr ivname$(ecsr - 2), 18, 16, 3 IF ecsr > 0 THEN printstr ivname$(ecsr - 1), 18, 24, 3 printstr ivname$(ecsr), 18, 32, 3: textcolor 2, 0 printstr ivname$(ecsr), 19, 33, 3: textcolor 17, 0 IF ecsr < ivmax THEN printstr ivname$(ecsr + 1), 18, 40, 3 IF ecsr < ivmax - 1 THEN printstr ivname$(ecsr + 2), 18, 48, 3 textcolor 1, 0: printstr ivuse$(ecsr), 18, 62, 3: textcolor 17, 0 LOOP ei1: loadpage buffer(), "data\item" + MID$(STR$(ivset(ecsr)), 2, LEN(STR$(ivset(ecsr))) - 1) + ".mxs" + CHR$(0), vpage loadsprite placer(), (ivpic(ecsr) + 1) * 500, 0, 20, 25, vpage drawsprite placer(), bobpal(), ivpal(ecsr) * 16, 230, 25, 3 RETURN END SUB SUB fontset (font, font()) DEF SEG = VARSEG(font(0)): BLOAD "data\font" + MID$(STR$(font), 2, LEN(STR$(font)) - 1) + ".bob", VARPTR(font(0)) setfont font() END SUB SUB itemscon (plot(), itset(), picset(), iactive(), mx, my) tmcur = ((my * 16) + mx) DEF SEG = VARSEG(itset(0)): BLOAD "data\itemcon.dat", VARPTR(itset(0)) IF itset((tmcur * 8) + 0) > 0 THEN IF plot(ABS(itset((tmcur * 8) + 0))) = 0 THEN picset(9) = 0 IF itset((tmcur * 8) + 1) > 0 THEN IF plot(ABS(itset((tmcur * 8) + 1))) = 0 THEN picset(10) = 0 IF itset((tmcur * 8) + 2) > 0 THEN IF plot(ABS(itset((tmcur * 8) + 2))) = 0 THEN picset(11) = 0 IF itset((tmcur * 8) + 3) > 0 THEN IF plot(ABS(itset((tmcur * 8) + 3))) = 0 THEN picset(12) = 0 IF itset((tmcur * 8) + 4) > 0 THEN IF plot(ABS(itset((tmcur * 8) + 4))) = 0 THEN picset(9) = 0 IF itset((tmcur * 8) + 5) > 0 THEN IF plot(ABS(itset((tmcur * 8) + 5))) = 0 THEN picset(10) = 0 IF itset((tmcur * 8) + 6) > 0 THEN IF plot(ABS(itset((tmcur * 8) + 6))) = 0 THEN picset(11) = 0 IF itset((tmcur * 8) + 7) > 0 THEN IF plot(ABS(itset((tmcur * 8) + 7))) = 0 THEN picset(12) = 0 IF itset((tmcur * 8) + 0) < 0 THEN IF plot(ABS(itset((tmcur * 8) + 0))) = 1 THEN picset(9) = 0 IF itset((tmcur * 8) + 1) < 0 THEN IF plot(ABS(itset((tmcur * 8) + 1))) = 1 THEN picset(10) = 0 IF itset((tmcur * 8) + 2) < 0 THEN IF plot(ABS(itset((tmcur * 8) + 2))) = 1 THEN picset(11) = 0 IF itset((tmcur * 8) + 3) < 0 THEN IF plot(ABS(itset((tmcur * 8) + 3))) = 1 THEN picset(12) = 0 IF itset((tmcur * 8) + 4) < 0 THEN IF plot(ABS(itset((tmcur * 8) + 4))) = 1 THEN picset(9) = 0 IF itset((tmcur * 8) + 5) < 0 THEN IF plot(ABS(itset((tmcur * 8) + 5))) = 1 THEN picset(10) = 0 IF itset((tmcur * 8) + 6) < 0 THEN IF plot(ABS(itset((tmcur * 8) + 6))) = 1 THEN picset(11) = 0 IF itset((tmcur * 8) + 7) < 0 THEN IF plot(ABS(itset((tmcur * 8) + 7))) = 1 THEN picset(12) = 0 DEF SEG = VARSEG(itset(0)): BLOAD "data\itemset.dat", VARPTR(itset(0)) FOR i = 1 TO 4 IF iactive(i) = 1 THEN picset(i + 8) = 0 NEXT END SUB FUNCTION LARGE (n1, n2) LARGE = n1 IF n2 > n1 THEN LARGE = n2 END FUNCTION SUB menu (menuset() AS STRING, menuc, visrows, menux, menuy, menup, skip, csrcol, txtcol) textcolor txtcol, 0 ulim = LARGE(0, menuc - (visrows - 1)) FOR i = 0 TO visrows - 1 textcolor txtcol, 0 printstr menuset(i + ulim), menux, menuy + (i * skip), menup textcolor csrcol, 0 IF menuc = i + ulim THEN printstr ">", menux - 10, menuy + (i * skip), menup NEXT i textcolor txtcol, 0 END SUB FUNCTION SMALL (n1, n2) SMALL = n1 IF n2 < n1 THEN SMALL = n2 END FUNCTION