-+-+-+-+-+-+-+-+ START OF PART 6 -+-+-+-+-+-+-+-+ X to specify the numeric keypad for movement controll. X X/SEGMENT= X This is used to select what character will be used as the segment of the X worm. The default is a lowercase "o". Usage is shroom/segment=`7Bcharac Vter`7D X `20 X Again, enclose the character in quotes. X X/MUSHROOM= X This is used to select what character will be used as the mushroom. The X default is "@". Usage is shroom/mushroom=`7Bcharacter`7D. X X Again, use quotes around the character. X X/WALL= X This is used to select what character will be used as the mushroom. The X default is "`7C". Usage is shroom/wall=`7Bcharacter`7D. X X Again, enclose the character in quotes. X`20 X/DIRECTORY= X This feature allows you to specify the directory without modifying any X of the code. This will overide the value of PREFIXD (declared as a const Vant) X in the header of shroom. All levels and other files (high score, save fi Vle) X will be stored in this directory as well. X X*****************************levelr help file******************************* V* X X/DIRECTORY= X This is to set the directory of where the levels will be stored. Of cour Vse, X you must you the same directory for both shroom and levelr. You can chan Vge X the default directory by editing the source code: You will need to chang Ve X the constant PREFIXD (default prefix for the directory). X X/WALL= X This is to set the character for the WALL, the default is "`7C". Usage i Vs X levelr/wall=`7Bcharacter`7D NOTE be sure to inclose the character in quo Vtes, X since all letters are converted to uppercase if they are not enclosed. X X/BRIGHT X This is a simple qualifier. When you cut and paste, you can either speci Vfy X a border to surround the characters to be moved, or them to be highligted V. X `20 X/NOBACKUP X This is used to specify that you DON'T want a backup files created. Othe Vr- X wise a backup file will be created automatically every time you swith to` V20 X edit another level. This is to prevent loss of work if the system crashe Vs X like it does here all the time. All backup files will be automatically`2 V0 X deleted after you exit from editing a level, by either Quiting or Saving. X X Backups are created every minute, so you may loose some work, although X the amount lost will be somewhat trivial. X X X If you have any questions, please mail me. X X Thank you, X Rich Wicks X MASRICH@UBVMS, masrich@ubvms.cc.buffalo.edu $ CALL UNPACK README.TXT;1 341152214 $ create 'f' X!************************************SHROOM********************************* V**** Xdefine verb SHROOM X image DISK$USERDISK1:`5BMAS0.MASLIB.GAMES.SHROOM`5DSHROOM.EXE X qualifier MAPKEY X nonnegatable X value (default="kljh") X qualifier MUSHROOM X nonnegatable X value (default="@") X qualifier SEGMENT X nonnegatable X value (default="o") X qualifier WALL X nonnegatable X value (default="#") X qualifier DIRECTORY X nonnegatable X value (default="DISK$USERDISK1:`5BMAS0.MASLIB.GAMES.SHROOM`5D") $ CALL UNPACK SHROOM.CLD;1 572599928 $ create 'f' X`7B This program was written by Richard Wicks of the University of Buffalo ` V7D X`7B permission to copy, duplicate, spindle or mutilate this program is ` V7D X`7B hereby explicitly granted provided that this header remains intact. ` V7D X`7B Any other use constitutes copy right infiringement an will be dealt ` V7D X`7B in accordance with the full extent of the law. ` V7D X X`7B questions, comments, etc. should be directed to either: ` V7D X`7B V128LL9E @ UBVMS.CC.BUFFALO.EDU *or* MASRICH @ UBVMS.CC.BUFFALO.EDU ` V7D X X`5Binherit ('sys$library:starlet')`5D X Xprogram SHROOM (input, output); X Xconst X swidth = 78; `7Bmax 78`7D X sheight = 21; `7Bmax 21`7D X middle = round (swidth/2); `7Bfor status display`7D X rights = swidth+2; `7Bfor status display`7D X buf = 300; X lastlev = 21; `7Bthis is the last level + 1 if you want more, change this V #`7D X prefixd = 'disk$userdisk1:`5Bmas0.maslib.games.shroom`5D'; X `7Bthis is the directory all files are kept in, change it if yo Vu `7D X `7Bdon't want to have to use the /directory qualifier all the t Vime!`7D`20 X Xtype X`7Bforeign variable types`7D X $UBYTE = `5BBYTE`5D 0..255; X $UWORD = `5BWORD`5D 0..65535; X X`7Blocal variable types`7D X long = packed array `5B1..30`5D of char; X short = packed array `5B1..4`5D of char; X screen = array `5B0..23`5D of boolean; X string = varying `5B80`5D of char; X packed12 = packed array `5B1..12`5D of char; X packed30 = packed array `5B1..30`5D of char; X X rstore = record X user : `5Bkey(0)`5D packed12; X level : integer; X score : integer; X lives : integer; X x : integer; `7Bx of head of worm`7D X y : integer; `7By of head of worm`7D X mushx : integer; `7Bx of shroom location`7D X mushy : integer; `7By of shroom location`7D X cur : integer; `7Bcurrent mushroom`7D X point : integer; `7Bpointer for stack of histx, and histy, points to tai Vl`7D X last : char; `7Bonly used when saving, uses l,r,u,d for direction`7D X lengw : integer; `7Blength of worm`7D X histx : array `5B1..buf`5D of integer;`7Ball the x segments of the worm V on screen`7D X histy : array `5B1..buf`5D of integer;`7Ball the y segments of the worm V on screen`7D X end; X Xvar X`7Bbogus variables`7D X seed : unsigned; `7Bfor random number generation`7D X randomn : real; X show : boolean; `7Bto control showing of title, only want once per lev Vel`7D X stored : boolean; `7Bfor control when getting back old game`7D X datestr : string; X loop : integer; X loop2 : integer; X X`7Bvariables needed for the screen`7D X keyboard : unsigned; X pasty : unsigned; X display : unsigned; X stat : unsigned; X X`7Boption variables`7D X mapkey : packed array `5B1..4`5D of char; `7Bused for retrieving directi Vonal keys`7D X clistat : unsigned; `7Bfor the verb`7D X wormseg : char; `7Bcharacter of wormsegments, def o`7D X wallseg : char; `7Bcharacter of walls, def `7C`7D X mushseg : char; `7Bcharacter of shrooms, def @`7D X prefix : varying `5B100`5D of char; `7Bthe directory everything is kept V in`7D X high : varying `5B100`5D of char; `7Bhighscore filename`7D X s_game : varying `5B100`5D of char; `7Bfile name for save file of games` V7D X X`7Bmovement variables, defined from mapkey`7D X up : integer; `7Bhold ordinal numbers of direction keys`7D X down : integer; X left : integer; X right : integer; X X`7Breal variables`7D X filename : varying `5B100`5D of char; `7Bfilename of current level`7D X DEAD : boolean; `7Btell if you were killed in action`7D X temp : `5Bword`5D 0..65535; `7Bcontains the last key hit`7D X lastkey : `5Bword`5D 0..65535; `7Bcontains the last direction key hit`7D X X`7Bimportant variables`7D X w : rstore; `7Bcontains everything needed to save a game, and to pl Vay`7D X wf : file of rstore; `7Bfor saving all these goodies`7D X muno : integer; `7Borriginal number of mushrooms`7D X bump : array `5B0..79`5D of screen; `7Bused to let program know what a Vreas safe`7D X X`7Bforeign functions and routines begin`7D X X`5BASYNCHRONOUS`5D FUNCTION smg$create_pasteboard ( X`09VAR pasteboard_id : `5BVOLATILE`5D UNSIGNED; X`09output_device : `5BCLASS_S`5D PACKED ARRAY `5B$l2..$u2:INTEGER`5D OF CHAR V := %IMMED 0; X`09VAR number_of_pasteboard_rows : `5BVOLATILE`5D INTEGER := %IMMED 0; X`09VAR number_of_pasteboard_columns : `5BVOLATILE`5D INTEGER := %IMMED 0; X`09flags : UNSIGNED := %IMMED 0; X`09VAR type_of_terminal : `5BVOLATILE`5D UNSIGNED := %IMMED 0) : INTEGER; EX VTERNAL; X X`5BASYNCHRONOUS`5D FUNCTION smg$create_virtual_keyboard ( X`09VAR keyboard_id : `5BVOLATILE`5D UNSIGNED; X`09input_device : `5BCLASS_S`5D PACKED ARRAY `5B$l2..$u2:INTEGER`5D OF CHAR V := %IMMED 0; X`09default_filespec : `5BCLASS_S`5D PACKED ARRAY `5B$l3..$u3:INTEGER`5D OF C VHAR := %IMMED 0; X`09VAR resultant_filespec : `5BCLASS_S,VOLATILE`5D PACKED ARRAY `5B$l4..$u4: VINTEGER`5D OF CHAR := %IMMED 0; X`09recall_size : $UBYTE := %IMMED 0) : INTEGER; EXTERNAL; X X`5BASYNCHRONOUS`5D FUNCTION smg$erase_chars ( X`09display_id : UNSIGNED; X`09number_of_characters : INTEGER; X`09start_row : INTEGER; X`09start_column : INTEGER) : INTEGER; EXTERNAL; X X`5BASYNCHRONOUS`5D FUNCTION smg$erase_display ( X`09display_id : UNSIGNED; X`09start_row : INTEGER := %IMMED 0; X`09start_column : INTEGER := %IMMED 0; X`09end_row : INTEGER := %IMMED 0; X`09end_column : INTEGER := %IMMED 0) : INTEGER; EXTERNAL; X X`5BASYNCHRONOUS`5D FUNCTION smg$repaint_screen ( X`09pasteboard_id : UNSIGNED) : INTEGER; EXTERNAL; X X`5BASYNCHRONOUS`5D FUNCTION smg$begin_pasteboard_update ( X`09pasteboard_id : UNSIGNED) : INTEGER; EXTERNAL; X X`5BASYNCHRONOUS`5D FUNCTION smg$create_virtual_display ( X`09number_of_rows : INTEGER; X`09number_of_columns : INTEGER; X`09VAR display_id : `5BVOLATILE`5D UNSIGNED; X`09display_attributes : UNSIGNED := %IMMED 0; X`09video_attributes : UNSIGNED := %IMMED 0; X`09character_set : UNSIGNED := %IMMED 0) : INTEGER; EXTERNAL; X X`5BASYNCHRONOUS`5D FUNCTION smg$delete_virtual_display ( X`09display_id : UNSIGNED) : INTEGER; EXTERNAL; X X`5BASYNCHRONOUS`5D FUNCTION smg$draw_rectangle ( X`09display_id : UNSIGNED; X`09start_row : INTEGER; X`09start_column : INTEGER; X`09end_row : INTEGER; X`09end_column : INTEGER; X`09rendition_set : UNSIGNED := %IMMED 0; X`09rendition_complement : UNSIGNED := %IMMED 0) : INTEGER; EXTERNAL; X X`5BASYNCHRONOUS`5D FUNCTION smg$end_pasteboard_update ( X`09pasteboard_id : UNSIGNED) : INTEGER; EXTERNAL; X X`5BASYNCHRONOUS`5D FUNCTION smg$label_border ( X`09display_id : UNSIGNED; X`09text : `5BCLASS_S`5D PACKED ARRAY `5B$l2..$u2:INTEGER`5D OF CHAR := %IMME VD 0; X`09position_code : UNSIGNED := %IMMED 0; X`09units : INTEGER := %IMMED 0; X`09rendition_set : UNSIGNED := %IMMED 0; X`09rendition_complement : UNSIGNED := %IMMED 0; X`09character_set : UNSIGNED := %IMMED 0) : INTEGER; EXTERNAL; X X`5BASYNCHRONOUS`5D FUNCTION smg$paste_virtual_display ( X`09display_id : UNSIGNED; X`09pasteboard_id : UNSIGNED; X`09pasteboard_row : INTEGER; X`09pasteboard_column : INTEGER; X`09top_display_id : UNSIGNED := %IMMED 0) : INTEGER; EXTERNAL; X X`5BASYNCHRONOUS`5D FUNCTION smg$put_chars ( X`09display_id : UNSIGNED; X`09text : `5BCLASS_S`5D PACKED ARRAY `5B$l2..$u2:INTEGER`5D OF CHAR; X`09start_row : INTEGER := %IMMED 0; X`09start_column : INTEGER := %IMMED 0; X`09flags : UNSIGNED := %IMMED 0; X`09rendition_set : UNSIGNED := %IMMED 0; X`09rendition_complement : UNSIGNED := %IMMED 0; X`09character_set : UNSIGNED := %IMMED 0) : INTEGER; EXTERNAL; X X`5BASYNCHRONOUS`5D FUNCTION smg$put_line ( X`09display_id : UNSIGNED; X`09text : `5BCLASS_S`5D PACKED ARRAY `5B$l2..$u2:INTEGER`5D OF CHAR; X`09line_advance : INTEGER := %IMMED 0; X`09rendition_set : UNSIGNED := %IMMED 0; X`09rendition_complement : UNSIGNED := %IMMED 0; X`09flags : UNSIGNED := %IMMED 0; X`09character_set : UNSIGNED := %IMMED 0; X`09direction : UNSIGNED := %IMMED 0) : INTEGER; EXTERNAL; X X`5BASYNCHRONOUS`5D FUNCTION smg$read_keystroke ( X`09keyboard_id : UNSIGNED; X`09VAR word_terminator_code : `5BVOLATILE`5D $UWORD; X`09prompt_string : `5BCLASS_S`5D PACKED ARRAY `5B$l3..$u3:INTEGER`5D OF CHAR V := %IMMED 0; X`09timeout : INTEGER := %IMMED 0; X`09display_id : UNSIGNED := %IMMED 0; X`09rendition_set : UNSIGNED := %IMMED 0; X`09rendition_complement : UNSIGNED := %IMMED 0) : INTEGER; EXTERNAL; X X`5BASYNCHRONOUS`5D FUNCTION smg$set_cursor_abs ( X`09display_id : UNSIGNED; X`09start_row : INTEGER := %IMMED 0; X`09start_column : INTEGER := %IMMED 0) : INTEGER; EXTERNAL; X X`5BASYNCHRONOUS`5D FUNCTION lib$date_time ( X`09VAR date_time_string : `5BCLASS_S,VOLATILE`5D PACKED ARRAY `5B$l1..$u1:IN VTEGER`5D OF CHAR) : INTEGER; EXTERNAL; X X`5BASYNCHRONOUS`5D FUNCTION lib$getjpi ( X`09item_code : INTEGER; X`09VAR process_id : `5BVOLATILE`5D UNSIGNED := %IMMED 0; X`09process_name : `5BCLASS_S`5D PACKED ARRAY `5B$l3..$u3:INTEGER`5D OF CHAR V := %IMMED 0; X`09%REF resultant_value : `5BVOLATILE,UNSAFE`5D ARRAY `5B$l4..$u4:INTEGER`5D V OF $UBYTE := %IMMED 0; X`09VAR resultant_string : `5BCLASS_S,VOLATILE`5D PACKED ARRAY `5B$l5..$u5:IN VTEGER`5D OF CHAR := %IMMED 0; X`09VAR resultant_length : `5BVOLATILE`5D $UWORD := %IMMED 0) : INTEGER; EXTE VRNAL; X X`5BASYNCHRONOUS`5D FUNCTION lib$wait ( X`09seconds : SINGLE) : INTEGER; EXTERNAL; X X`5BASYNCHRONOUS`5D FUNCTION mth$random ( X`09VAR seed : `5BVOLATILE`5D UNSIGNED) : SINGLE; EXTERNAL; X X`7Bforeign functions and routines end`7D X X`7Bverb garbage begin`7D X X`5Basynchronous,external`5D Xfunction cli$present ( X inval: `5Bclass_s,volatile`5D packed array `5B$l1..$u1:integer`5D of V char): Xunsigned; external; X`20 X`5Basynchronous,external`5D Xfunction cli$get_value ( X inval: `5Bclass_s,volatile`5D packed array `5B$l1..$u1:integer`5D of V char; X var outval: `5Bclass_s`5D char; X var outlen: unsigned := %immed 0): Xunsigned; external; X X`7Bverb garbage end`7D X Xfunction strint (b:string:= '0'):integer; X Xvar X a : integer; X Xbegin X a := 0; X for loop := length (b) downto 1 do X a := a+((ord(b`5Bloop`5D)-48)*(10**(length(b)-loop))); X strint := a; Xend; X Xfunction intstr (a:integer):short; `7Bgood only form numbers less than 10000 V`7D X Xvar X res : integer; X resc : short; X Xbegin X resc := ' '; X if a <= 0 then X begin X a := 0; X loop2 := 1; X end X else X loop2 := trunc (ln(a)/ln(10))+1; X X for loop := loop2 downto 1 do X begin X res := (a mod (10**loop))-(a mod (10**(loop-1))); X res := res div (10**(loop-1)); X resc`5B4-loop+1`5D := chr (48+res); X end; X intstr := resc Xend; X Xprocedure win; X Xvar X windis : unsigned; X Xbegin X smg$create_virtual_display(2,23,windis,smg$m_border); X smg$label_border(windis,'DUDE!'); X smg$paste_virtual_display(windis,pasty,2,round(swidth/2)-11); X smg$put_line(windis,' Cool, you won,',,smg$m_bold+smg$m_blink); X smg$put_line(windis,'bonus = #lives left * 100'); X lib$wait (5); X smg$delete_virtual_display(windis); Xend; X Xprocedure instruct; X Xvar +-+-+-+-+-+-+-+- END OF PART 6 +-+-+-+-+-+-+-+-