-+-+-+-+-+-+-+-+ START OF PART 2 -+-+-+-+-+-+-+-+ X end; `7Bfunction botsthere in hero_dead in play`7D X X procedure blast; X var i,j,n:integer; X begin `7Bprocedure blast in hero_dead in play`7D X if not blasted then X begin X for i := -1 to 1 do X for j := -1 to 1 do X for n := 1 to numbots do X if robx`5Bn`5D>0 then X if (robx`5Bn`5D=x+i) and (roby`5Bn`5D=y+j) X then begin X robx`5Bn`5D := 0; X grid`5Bx+i,y+j`5D := nothing; X botscount := botscount - 1; X gotoxy(xmax+16,6); writeln (botscount:3); X end; X made_a_move := true; X blasted := true; X gotoxy(xmax+9,15); writeln (' '); X end; X end; `7Bprocedure blast in hero_dead in play`7D X X procedure teleport; X begin `7Bprocedure teleport in hero_dead in play`7D X repeat X x := trunc(mth$random(seed)*xmax)+1; X y := trunc(mth$random(seed)*ymax)+1; X until (grid`5Bx,y`5D = nothing);`7B and (not botsthere);`7D X made_a_move := true; X end; `7Bprocedure teleport in hero_dead in play`7D X X procedure last_stand; X begin `7Blast stand (wait) in hero_dead in play`7D X rval := 2; X made_a_move := true; X while (not botsthere) and (not (botscount=0)) do X botsleft; X end; `7B last stand (wait) in hero_dead in play`7D X X begin `7Bhero_dead in play`7D X ox := x; oy := y; X h_dead := false; X made_a_move := false; X repeat X read_keystroke(kb_id,tc,chr(0)); X c:=chr(tc mod 256); X if (c='1')or(c='4')or(c='7')or(tc=276)then x:= x-1; X if (c='3')or(c='6')or(c='9')or(tc=277)then x:= x+1; X if (c='1')or(c='2')or(c='3')or(tc=275)then y:= y+1; X if (c='7')or(c='8')or(c='9')or(tc=274)then y:= y-1; X if (c='r')or(c='r') then redraw; X if (c='5')or(c='i') then made_a_move := true; X if (c='w')or(c='w') then last_stand; X if (c='b')or(c='b') then blast; X if x<1 then x := 1; X if x>xmax then x := xmax; X if y<1 then y := 1; X if y>ymax then y := ymax; X if botsthere or not (grid`5Bx,y`5D=nothing) then begin x := ox; y := V oy end; X if (x<>ox) or (y<>oy) then made_a_move := true; X if (c='t')or(c='t') then teleport; X gotoxy(xmax+13,20); if safeway(x,y) then writeln ('e') else writeln V ('o'); X until made_a_move; X grid`5Box,oy`5D := nothing; X gridxy(ox,oy); writeln (' '); X grid`5Bx,y`5D := the_hero; X gridxy(x,y); writeln ('+'); X h_dead:=botsthere; X hero_dead:=h_dead; X end; `7Bend hero_dead in play`7D X Xbegin `7Bprocedure play`7D X initialize; X border; X showcommands; X repeat X init_array(numbots); X repeat until hero_dead or not botsleft; X numbots := numbots + 5; X if numbots>maxbots then numbots := maxbots; X until h_dead; X gridxy(x,y); X writeln(chr(27),'`5B1mX',chr(27),'`5B0m'); Xend; `7Bprocedure play`7D X Xprocedure read_hi; X var i:integer; X begin `7Bprocedure read_hi`7D X open (high,hsfile,history := old, sharing := readwrite); X reset (high); X for i := 1 to hsmax do X begin X highscore`5Bi`5D.uname := ''; X highscore`5Bi`5D.score := 0; X end; X for i := 1 to hsmax do X if not eof(high) then X begin X highscore`5Bi`5D := high`5E; X get(high); X end; X close(high); X end; `7Bprocedure read_hi`7D X Xprocedure write_hi; X var i:integer; X begin `7Bprocedure write_hi`7D X open(high,hsfile,history := old, sharing := readwrite); X rewrite (high); X for i := 1 to hsmax do X begin X high`5E := highscore`5Bi`5D; X put(high); X end; X close(high); X end; `7Bprocedure write_hi`7D X Xprocedure checkhi; X var i,p,old:integer; X name:string; X older:oldaray; X X procedure untriche(score:integer; name:string); X var i:integer; X procedure revbump(x:integer); X begin X if xhighscore`5Bi`5D.score then p := i; X if (p0) then untriche(old,name); X bump(p); X highscore`5Bp`5D.score := score; X highscore`5Bp`5D.uname := name; X write_hi; X end; X end; `7Bprocedure checkhi`7D X Xprocedure show_hi; X var i:integer; X X function highestof(h:hscore):boolean; X var i,x:integer; X begin X for i := hsmax downto 1 do X if highscore`5Bi`5D.uname=h.uname then x := i; X highestof := (h.score>0) and (h.score=highscore`5Bx`5D.score); X end; X X function lowestof(h:hscore):boolean; X var i,x:integer; X begin X for i := 1 to hsmax do X if highscore`5Bi`5D.uname=h.uname then x := i; X lowestof := (h.score>0) and (h.score=highscore`5Bx`5D.score); X end; X X begin `7Bprocedure show_hi`7D X read_hi; X clearscreen; X gotoxy(28,1); X writeln (''(27),'`5B1m High Scorers at DERAN ',''(27),'`5B0m'); X for i := 1 to 20 do X begin X if (score>0) and (highscore`5Bi`5D.score=score) then write (chr(27), V'`5B1m'); X gotoxy (1,i+1); X if highestof(highscore`5Bi`5D) X then writeln (' #',i:2,':+',highscore`5Bi`5D.uname) X else if lowestof(highscore`5Bi`5D) X then writeln (' #',i:2,':-',highscore`5Bi`5D.uname) X else writeln (' #',i:2,': ',highscore`5Bi`5D.uname); X gotoxy(17,i+1); writeln (highscore`5Bi`5D.score:4); X writeln (chr(27),'`5B0m'); X end; X for i := 21 to 40 do X begin X if (score>0) and (highscore`5Bi`5D.score=score) then write (chr(27), V'`5B1m'); X gotoxy (26,i-19); X if highestof(highscore`5Bi`5D) X then writeln (' #',i:2,':+',highscore`5Bi`5D.uname) X else if lowestof(highscore`5Bi`5D) X then writeln (' #',i:2,':-',highscore`5Bi`5D.uname) X else writeln (' #',i:2,': ',highscore`5Bi`5D.uname); X gotoxy(43,i-19); writeln (highscore`5Bi`5D.score:4); X writeln (chr(27),'`5B0m'); X end; X for i := 41 to 60 do X begin X if (score>0) and (highscore`5Bi`5D.score=score) then write (chr(27), V'`5B1m'); X gotoxy (52,i-39); X if highestof(highscore`5Bi`5D) X then writeln (' #',i:2,':+',highscore`5Bi`5D.uname) X else if lowestof(highscore`5Bi`5D) X then writeln (' #',i:2,':-',highscore`5Bi`5D.uname) X else writeln (' #',i:2,': ',highscore`5Bi`5D.uname); X gotoxy(69,i-39); writeln (highscore`5Bi`5D.score:4); X writeln (chr(27),'`5B0m'); X end; X writeln; X prompt:='Press ''P'' to play or ''Q'' to quit '; X if not may_play then prompt := 'Sorry, Deran may not be played during pe Vak hours. ->'; X end; `7Bprocedure showhi`7D X Xbegin `7Bmain program`7D X write (chr(27),'>'); X create_virtual_keyboard(kb_id,'SYS$COMMAND'); X read_hi; X repeat X may_play := true; X show_hi; X repeat X if may_play then X begin X read_keystroke(kb_id,tc,prompt); X c:=chr(tc mod 256); X end X else X begin X read_keystroke(kb_id,tc,prompt); X c := 'Q'; X end; X until ((c in `5B'p','P','q','Q'`5D) or (not may_play)); X if (c in `5B'p','P'`5D) and (may_play) X then begin X clearscreen; X play; X checkhi X end; X until (c in `5B'q','Q'`5D) or (not may_play); X delete_virtual_keyboard(kb_id); X clearscreen; X writeln (chr(27),'`5BH'); Xend. `7Bmain program`7D $ CALL UNPACK DERAN.PAS;1 1580691355 $ create 'f' X`08`00V053PFYW.`07`00`00 X`08`00V026LTR5g`05`00`00 X`08`00V077L5LXv`04`00`00 X`08`00V2316BSW_`04`00`00 X`08`00V119MATC!`04`00`00 X`08`00V105P7UJ`E5`03`00`00 X`08`00V077L5LX`8C`03`00`00 X`08`00V026LTR5R`03`00`00 X`08`00V026LTR5H`03`00`00 X`06`00MASDOCMY3`03`00`00 X`08`00MASMUMMY/`03`00`00 X`08`00V026LTR5`1F`03`00`00 X`08`00V077L5LX`10`03`00`00 X`08`00V096KDUZ`0E`03`00`00 X`08`00V2316BSW`F9`02`00`00 X`08`00V026LTR5`F4`02`00`00 X`08`00MASMUMMY`F1`02`00`00 X`08`00V105P7UJ`E8`02`00`00 X`08`00V077L5LX`DD`02`00`00 X`08`00V077L5LX`C9`02`00`00 X`06`00MASDAN9E`C1`02`00`00 X`08`00V2316BSW`C1`02`00`00 X`08`00V128LL9E`AF`02`00`00 X`08`00V128LL9E`A8`02`00`00 X`08`00V128LL9E`A7`02`00`00 X`08`00V128LL9E`A2`02`00`00 X`08`00V128LL9E`9C`02`00`00 X`08`00V105P7UJ`9C`02`00`00 X`08`00V105P7UJ`97`02`00`00 X`08`00MASMUMMY`92`02`00`00 X`08`00V105P7UJ`86`02`00`00 X`06`00MASDANH4`85`02`00`00 X`08`00V063J3H4w`02`00`00 X`08`00MASMUMMYk`02`00`00 X`08`00V131PYDSg`02`00`00 X`08`00V077PW3W`5E`02`00`00 X`08`00V077PW3WW`02`00`00 X`08`00V073PZUYM`02`00`00 X`08`00V119MATCM`02`00`00 X`08`00V622AG66I`02`00`00 X`08`00V096KDUZC`02`00`00 X`06`00MASDANUJ;`02`00`00 X`08`00MASMUMMY3`02`00`00 X`06`00MASDANUJ`1B`02`00`00 X`08`00V096KDUZ`17`02`00`00 X`07`00MASGREG5`04`02`00`00 X`08`00V2316BSW`03`02`00`00 X`08`00V077PW3W`FA`01`00`00 X`06`00MASDANUZ`EF`01`00`00 X`08`00V096KDUZ`ED`01`00`00 X`06`00MASDOCG5`DF`01`00`00 X`07`00MASGREG5`DE`01`00`00 X`08`00V077PW3W`DE`01`00`00 X`08`00V096KDUZ`D9`01`00`00 X`08`00V096QGCM`D6`01`00`00 X`06`00MASDOCWV`D6`01`00`00 X`08`00V525JDWV`CD`01`00`00 X`08`00V2316BSW`CD`01`00`00 X`08`00V119MATC`B6`01`00`00 X`08`00V077PW3W`AF`01`00`00 $ CALL UNPACK DERANHGH.DAT;1 248188003 $ create 'f' X`5Binherit ('sys$library:starlet')`5D X`20 Xmodule guts(input,output); X`20 Xconst X SHORT_WAIT = 0.1; X LONG_WAIT = 0.2; X maxcycle = 15; `7B attempting to fine tune nextkey `7D X`20 Xtype X`09$UBYTE = `5BBYTE`5D 0..255; X $uword = `5Bword`5D 0 .. 65535; X`09$UQUAD = `5BQUAD,UNSAFE`5D RECORD X`09`09L0,L1:UNSIGNED; END; X string = varying`5B80`5D of char; X ident = packed array`5B1..12`5D of char; X`20 X iosb_type = record X cond: $uword; X trans: $uword; X junk: unsigned; `7Blongword`7D X end; X`20 X il3 = record X buflen : $uword; X itm : $uword; X baddr : unsigned; X laddr : unsigned; X end; X`20 X`20 Xvar X pbrd_id: unsigned; `7B pasteboard id `7D X kbrd_id: unsigned; X pbrd_volatile: `5Bvolatile`5D unsigned; X mbx: `5Bvolatile`5D packed array`5B1..132`5D of char; X mbx_in, `7B channels for input and V `7D X mbx_out: `5Bvolatile`5D $uword; `7B output to the subpro Vcess `7D X pid: integer; X iosb: `5Bvolatile`5D iosb_type; `7B i/o status block V `7D X status: `5Bvolatile`5D unsigned; X save_dcl_ctrl: unsigned; X trap_flag: `5Bglobal,volatile`5D boolean; X trap_msg: `5Bglobal,volatile`5D string; X out_chan: $uword; X vaxid: `5Bglobal`5D packed array`5B1..12`5D of char; X advise: `5Bexternal`5D string; X line: `5Bglobal`5D string; X old_prompt: `5Bglobal`5D string; X`20 X seed: integer; X`20 X user,uname:varying`5B31`5D of char; X sts:integer; X il:array`5B1..2`5D of il3; X key:$uword; X`20 X userident: `5Bglobal`5D ident; X`20 X`20 X`5Basynchronous, external (lib$signal)`5D Xfunction lib$signal ( X %ref status : `5Bunsafe`5D unsigned) : unsigned; external; X`20 X`5Basynchronous, external (str$trim)`5D Xfunction str$trim ( X destination_string : `5Bclass_s`5D packed array `5B$l1..$u1:integer`5D of V char; X source_string : `5Bclass_s`5D packed array `5B$l2..$u2:integer`5D of char V; X %ref resultant_length : $uword) : unsigned; external; X`20 X`5Basynchronous, external (smg$read_keystroke)`5D Xfunction smg$read_keystroke ( X %ref keyboard_id : unsigned; X %ref word_integer_terminator_code : $uword; X prompt_string : `5Bclass_s`5D packed array `5B$l3..$u3:integer`5D of cha Vr := %immed X0; X %ref timeout : unsigned := %immed 0; X %ref display_id : unsigned := %immed 0; X %ref rendition_set : unsigned := %immed 0; X %ref rendition_complement : unsigned := %immed 0) : unsigned; external; X`20 X`5Basynchronous, external (smg$create_virtual_keyboard)`5D Xfunction smg$create_virtual_keyboard ( X %ref keyboard_id : unsigned; X filespec : `5Bclass_s`5D packed array `5B$l2..$u2:integer`5D of char := V %immed 0; X default_filespec : `5Bclass_s`5D packed array `5B$l3..$u3:integer`5D of V char := %immed 0; X resultant_filespec : `5Bclass_s`5D X packed array `5B$l4..$u4:integer`5D of char := %immed 0) : unsigned; ext Vernal; X`20 +-+-+-+-+-+-+-+- END OF PART 2 +-+-+-+-+-+-+-+-