home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / games / getslide / getslid.lst < prev    next >
File List  |  1994-03-20  |  45KB  |  1,637 lines

  1. ' getslide  started on 10 nov 93
  2. ' without the editor
  3. '
  4. ' programmed by Seymour Shlien in GFA Basic 3.5 for the Atari St
  5. ' 624 Courtenay Avenue
  6. ' Ottawa, Ontario
  7. ' Canada  K2A  3B5
  8. DIM full_maze|(1500),full_maze_init|(1500)
  9. '
  10. ' The state of each cell in the maze is stored in the array full_maze.
  11. ' The initial state of the maze is stored in full_maze_init to allow
  12. ' restarting the games at a particular level. The codes for representing
  13. ' the state of a particular cell are listed below.
  14. '
  15. ' full_maze| = 0-15  free space
  16. ' full_maze| = 32-95  robot - only 64 robots are allowd.
  17. ' full_maze|=96-103 treasures
  18. ' full_maze|= 128-254 barriers
  19. ' full_maze|= 160 transparent barrier
  20. ' full_maze|= 161-170 4-cell barriers
  21. ' full_maze|=255 explorer
  22. ' free space
  23. ' 0 really free
  24. ' 1 twice only
  25. ' 2 once only
  26. ' 3 frictionless
  27. ' 4 free space - dot displayed
  28. ' 5 twice onley - dot displayed
  29. ' 6 once only - dot displayed
  30. ' 7 frictionless -dot displayed
  31. ' 14 exit
  32. ' The dot is not visible when running the maze except after the
  33. ' editor was invoked. The dots are used for indicating the solution
  34. ' in some of the difficult levels.
  35. '
  36. ' cell numbers 32 to 95 are pointers to one of the 64 robots (or bugs)
  37. ' which may be used. robot_loc% points back to the cell position
  38. ' of the robot; robot_dir% indicates the direction the robot is moving,
  39. ' robot_cell% stores the state of the cell to be restored when the
  40. ' robot leaves; robot_status% indicates how many times the robot
  41. ' will continue to move in the same direction after it has prodded;
  42. ' robot_type identifies the kind of robot (eg bird, frog, block etc.)
  43. ' robot_*_init describes the state of the robots on initialization
  44. ' of the level. robot_type_delay% indicates the length of the pause
  45. ' before the robot moves again.
  46. '
  47. DIM robot_loc%(64),robot_dir%(64),robot_cell%(64),robot_status%(64)
  48. DIM robot_loc_init%(64),robot_cell_init%(64)
  49. DIM robot_delay%(64),robot_type%(64)
  50. DIM robot_type_delay%(16)
  51. '
  52. DIM puts$(16)
  53. DIM edit_menu$(5)
  54. DIM cellpat$(70),treasures$(8),bugs$(16)
  55. DIM cell4$(12)
  56. DIM explorer$(4),explorer_shadow$(4)
  57. DIM swytch_status%(4)
  58. ' robot_loc% position in full_maze of robot
  59. ' robot_dir% current direction of robot
  60. ' robot_status% - robot alive or dead
  61. DIM screen1%(8100)
  62. DIM work_screen%(16200)
  63. DIM screen_ptr%(2)
  64. DIM deskcolors%(16)
  65. DIM difficulty$(2),help$(10)
  66. DIM mazeptr%(2)
  67. DIM tabcolor%(16),luts&(16)
  68. DIM s_mfdb%(8),d_mfdb%(8),bltpar%(8)
  69. @read_sound
  70. @dosound
  71. '
  72. ' screen management
  73. ' To allow smooth scrolling we need four frame memories. Two of the
  74. ' frames stored in work_screen hold a graphic representation of the
  75. ' entire maze. The other two screens referenced by screen_ptr% display
  76. ' the part of the maze on the screen. We need two screens so we can
  77. ' write on one while displaying the other. (To avoid flickering).
  78. '
  79. screen_ptr%(0)=VARPTR(screen1%(0))
  80. screen_ptr%(0)=(screen_ptr%(0)+256) AND &HFFFFFF00
  81. screen_ptr%(1)=XBIOS(2)
  82. mazeptr%(0)=VARPTR(work_screen%(0))
  83. mazeptr%(1)=VARPTR(work_screen%(8100))
  84. mazeptr%(0)=(mazeptr%(0)+256) AND &HFFFFFF00
  85. mazeptr%(1)=(mazeptr%(1)+256) AND &HFFFFFF00
  86. ' bitblt parameters
  87. s_mfdb%(0)=mazeptr%(0)
  88. s_mfdb%(1)=320
  89. s_mfdb%(2)=200
  90. s_mfdb%(3)=20
  91. s_mfdb%(4)=0
  92. s_mfdb%(5)=4
  93. d_mfdb%(0)=screen_ptr%(0)
  94. d_mfdb%(1)=320
  95. d_mfdb%(2)=200
  96. d_mfdb%(3)=20
  97. d_mfdb%(4)=0
  98. d_mfdb%(5)=4
  99. difficulty$(0)="Kids Level"
  100. difficulty$(1)="Regular Level"
  101. flip%=1 !screen_ptr selector initialized to xbios(2)
  102. '
  103. rez%=XBIOS(4)
  104. IF rez%<>0
  105.   ALERT 3," Please switch   to | low  resolution! ",1,"Oops",b%
  106.   STOP
  107. ENDIF
  108. @get_deskcolors
  109. ' my private colours
  110. @vsetall !set the colours
  111. '
  112. robot_type_delay%(0)=30 !frogs
  113. robot_type_delay%(1)=30
  114. robot_type_delay%(2)=30
  115. robot_type_delay%(3)=30
  116. robot_type_delay%(4)=50 !face
  117. robot_type_delay%(5)=50 !brick
  118. robot_type_delay%(6)=0 !balls
  119. robot_type_delay%(7)=0
  120. '
  121. width%=50 ! default width and height of maze
  122. height%=16
  123. window_width%=24 ! number of cells of maze displayed in the window
  124. window_height%=12
  125. celldim%=10 !each cell is 10 pixels across. Don't change it
  126. width_pixels%=window_width%*celldim%-1
  127. height_pixels%=window_height%*celldim%-1
  128. size%=width%*height%-1
  129. xleft%=celldim%
  130. ytop%=celldim%
  131. file_write%=25 !file sequence number for output
  132. file_num%=0 !file sequence number for input
  133. once_only%=0
  134. explorer_dir%=0
  135. CLS
  136. PRINT "get_slid    19 mar 94"
  137. @read_cellpat
  138. @load_help_data
  139. '
  140. @make_puts
  141. CLS
  142. DEFMOUSE 0
  143. ' The following parameters control scrolling
  144. ' The window scrolls to one of a set of points. *_ctr% define
  145. ' the extreme limits of the scrolling in both the vertical and
  146. ' horizontal directions.
  147. xleft_ctr%=window_width%/2
  148. ytop_ctr%=window_height%/2
  149. win_height4%=window_height%/4
  150. win_width4%=window_width%/4
  151. xright_ctr%=width%-window_width%/2
  152. ybot_ctr%=height%-window_height%/2
  153. shift_x%=0  !the top left coordinate of maze where scrolling goes to
  154. shift_y%=0
  155. explorer_delay%=0
  156. difficulty%=1
  157. response%=0
  158. simulation_on%=0
  159. '
  160. '
  161. REPEAT
  162.   @select_parameters
  163. UNTIL quit%=1
  164. @restore_deskcolors
  165. IF XBIOS(2)<>screen_ptr%(1)
  166.   ~XBIOS(5,L:-1,L:screen_ptr%(1),-1)
  167. ENDIF
  168. IF XBIOS(3)<>screen_ptr%(1)
  169.   ~XBIOS(5,L:screen_ptr%(1),L:-1,-1)
  170. ENDIF
  171. ~FRE(0)
  172. END
  173. '
  174. ' The maze is drawn graphically using the functions show_cell and
  175. ' show_maze. show_micro_cell and draw_minature_maze are used by the
  176. ' editor and help function key.
  177. '
  178. > PROCEDURE show_cell(index%)
  179.   ' displays an individual cell of maze on screen.
  180.   LOCAL ix%,iy%,ixc%,iyc%,num%
  181.   ixc%=(index% MOD width%)
  182.   iyc%=(index% DIV width%)
  183.   ix%=ixc%*celldim%
  184.   iy%=iyc%*celldim%
  185.   IF ix%>319
  186.     ix%=ix%-320
  187.     IF XBIOS(3)<>mazeptr%(1)
  188.       ~XBIOS(5,L:mazeptr%(1),L:-1,-1)
  189.     ENDIF
  190.   ELSE
  191.     IF XBIOS(3)<>mazeptr%(0)
  192.       ~XBIOS(5,L:mazeptr%(0),L:-1,-1)
  193.     ENDIF
  194.   ENDIF
  195.   IF ix%>=0 AND iy%>=0
  196.     SELECT full_maze|(index%)
  197.     CASE 0 TO 3
  198.       PUT ix%,iy%,puts$(full_maze|(index%))
  199.     CASE 4 TO 6
  200.       IF editor_on%=0
  201.         PUT ix%,iy%,puts$(full_maze|(index%)-3)
  202.       ELSE
  203.         PUT ix%,iy%,puts$(full_maze|(index%))
  204.       ENDIF
  205.     CASE 14
  206.       PUT ix%,iy%,exit$
  207.     CASE 15
  208.       PUT ix%,iy%,destin$
  209.     CASE 16 TO 31
  210.       IF teleport_type%(full_maze|(index%)-16)=0
  211.         PUT ix%,iy%,transpo$(0)
  212.       ELSE
  213.         PUT ix%,iy%,transpo$(1)
  214.       ENDIF
  215.     CASE 96 TO 103
  216.       num%=full_maze|(index%)
  217.       num%=num%-96
  218.       PUT ix%,iy%,treasures$(num%)
  219.     CASE 104 TO 111
  220.       num%=full_maze|(index%)
  221.       num%=num%-104
  222.       PUT ix%,iy%,swytches$(num%)
  223.     CASE 128 TO 159
  224.       PUT ix%,iy%,cellpat$(full_maze|(index%)-128)
  225.     CASE 161 TO 170
  226.       PUT ix%,iy%,cell4$(full_maze|(index%)-161)
  227.     CASE 32 TO 95
  228.       num%=full_maze|(index%)
  229.       num%=robot_type%(num%-32)
  230.       PUT ix%,iy%,bugs$(num%)
  231.     CASE 255
  232.       IF editor_on%=1
  233.         PUT ix%,iy%,explorer$(0)
  234.       ENDIF
  235.     DEFAULT
  236.       '        LOCATE 60,22
  237.       '       PRINT index%;" ";full_maze|(index%);
  238.       '        DELAY 0.5
  239.     ENDSELECT
  240.   ENDIF
  241.   IF XBIOS(3)<>screen_ptr%(flip%)
  242.     ~XBIOS(5,L:screen_ptr%(flip%),L:-1,-1)
  243.   ENDIF
  244. RETURN
  245. > PROCEDURE show_micro_cell(index%)
  246.   ' displays an individual cell of maze on screen.
  247.   LOCAL ix%,iy%
  248.   ix%=(index% MOD width%)+1
  249.   iy%=(index% DIV width%)+1
  250.   SELECT full_maze|(index%)
  251.   CASE 0 TO 13
  252.     DEFFILL 0
  253.   CASE 14
  254.     DEFFILL 2
  255.   CASE 16 TO 31
  256.     DEFFILL 2
  257.   CASE 32 TO 95
  258.     DEFFILL 9
  259.   CASE 96 TO 103
  260.     DEFFILL 6
  261.   CASE 104 TO 111
  262.     DEFFILL 8
  263.   CASE 128 TO 254
  264.     DEFFILL 3
  265.   CASE 255
  266.     DEFFILL 15
  267.   DEFAULT
  268.     DEFFILL 1
  269.   ENDSELECT
  270.   PBOX 11+ms%*ix%,11+ms%*iy%,11+ms%-1+ms%*ix%,11+ms%-1+ms%*iy%
  271. RETURN
  272. > PROCEDURE show_maze
  273.   ' displays entire maze withen display window
  274.   LOCAL i%,x%,y%
  275.   editor_on%=0
  276.   IF RANDOM(5)=0
  277.     editor_on%=1
  278.   ENDIF
  279.   FOR y%=0 TO height%-1
  280.     FOR x%=0 TO width%-1
  281.       i%=x%+y%*width%
  282.       show_cell(i%)
  283.     NEXT x%
  284.   NEXT y%
  285. RETURN
  286. > PROCEDURE draw_minature_maze
  287.   LOCAL i%
  288.   COLOR 14
  289.   BOX 10,10,14+width%*ms%,14+height%*ms%
  290.   FOR i%=0 TO size%
  291.     @show_micro_cell(i%)
  292.   NEXT i%
  293.   COLOR 1
  294. RETURN
  295. '
  296. ' To allow smooth scrolling in both the horizontal and vertical
  297. ' direction we require the following four functions. The scrolling
  298. ' attempts to keep the explorer (the car) in the center of the
  299. ' screen except when the explorer wanders near the edges of the
  300. ' maze. The function nearest_centre computes the position of
  301. ' displayed window based on the position of the explorer. First
  302. ' the window is displayed by the function slide_window, and
  303. ' then the explorer is drawn on top (using a put). The function
  304. ' slip_window gives the illusion of smooth motion.
  305. > PROCEDURE nearest_centre(i_explorer%,j_explorer%)
  306.   nearest_x%=i_explorer%
  307.   nearest_y%=j_explorer%
  308.   IF nearest_x%<xleft_ctr%
  309.     nearest_x%=xleft_ctr%
  310.   ENDIF
  311.   IF nearest_x%>xright_ctr%
  312.     nearest_x%=xright_ctr%
  313.   ENDIF
  314.   IF nearest_y%<ytop_ctr%
  315.     nearest_y%=ytop_ctr%
  316.   ENDIF
  317.   IF nearest_y%>ybot_ctr%
  318.     nearest_y%=ybot_ctr%
  319.   ENDIF
  320.   ' screen can only hold 20 squares
  321.   IF nearest_y%>14
  322.     nearest_y%=14
  323.   ENDIF
  324. RETURN
  325. > PROCEDURE slide_window(i_explorer%,j_explorer%)
  326.   ' slides window to new_x% and new_y%
  327.   @nearest_centre(i_explorer%,j_explorer%)
  328.   l_nearest_x%=nearest_x%
  329.   l_nearest_y%=nearest_y%
  330.   shift_x%=(nearest_x%-xleft_ctr%)
  331.   shift_y%=(nearest_y%-ytop_ctr%)
  332.   ixcorner%=shift_x%*celldim%
  333.   iycorner%=shift_y%*celldim%
  334.   i_ex%=(i_explorer%-nearest_x%+xleft_ctr%+1)*celldim%
  335.   j_ex%=(j_explorer%-nearest_y%+ytop_ctr%+1)*celldim%
  336.   @show_window(ixcorner%,iycorner%)
  337.   @put_explorer(i_ex%,j_ex%)
  338. slide_window_return:
  339. RETURN
  340. > PROCEDURE slip_window(i_explorer%,j_explorer%,i_last%,j_last%)
  341.   ' slides window to new_x% and new_y%
  342.   LOCAL delta_x%,delta_y%
  343.   LOCAL incx%
  344.   @nearest_centre(i_explorer%,j_explorer%)
  345.   ixcorner%=(l_nearest_x%-xleft_ctr%)*celldim%
  346.   iycorner%=(l_nearest_y%-ytop_ctr%)*celldim%
  347.   IF nearest_x%<>l_nearest_x%
  348.     delta_x%=(nearest_x%-l_nearest_x%)*celldim%
  349.     inc%=SGN(delta_x%)*2
  350.     i_ex%=(i_explorer%-nearest_x%+xleft_ctr%+1)*celldim%
  351.     j_ex%=(j_explorer%-nearest_y%+ytop_ctr%+1)*celldim%
  352.     REPEAT
  353.       ixcorner%=ixcorner%+inc%
  354.       delta_x%=delta_x%-inc%
  355.       @show_window(ixcorner%,iycorner%)
  356.       @put_explorer(i_ex%,j_ex%)
  357.     UNTIL delta_x%=0
  358.     l_nearest_x%=nearest_x%
  359.   ELSE IF nearest_y%<>l_nearest_y%
  360.     delta_y%=(nearest_y%-l_nearest_y%)*celldim%
  361.     inc%=SGN(delta_y%)*2
  362.     i_ex%=(i_explorer%-nearest_x%+xleft_ctr%+1)*celldim%
  363.     j_ex%=(j_explorer%-nearest_y%+ytop_ctr%+1)*celldim%
  364.     REPEAT
  365.       iycorner%=iycorner%+inc%
  366.       delta_y%=delta_y%-inc%
  367.       @show_window(ixcorner%,iycorner%)
  368.       @put_explorer(i_ex%,j_ex%)
  369.     UNTIL delta_y%=0
  370.     l_nearest_y%=nearest_y%
  371.   ELSE IF i_explorer%<>i_last%
  372.     delta_x%=(i_explorer%-i_last%)*celldim%
  373.     inc%=SGN(delta_x%)*2
  374.     i_ex%=(i_last%-nearest_x%+xleft_ctr%+1)*celldim%
  375.     j_ex%=(j_last%-nearest_y%+ytop_ctr%+1)*celldim%
  376.     ixcorner%=(nearest_x%-xleft_ctr%)*celldim%
  377.     iycorner%=(nearest_y%-ytop_ctr%)*celldim%
  378.     REPEAT
  379.       i_ex%=i_ex%+inc%
  380.       delta_x%=delta_x%-inc%
  381.       @show_window(ixcorner%,iycorner%)
  382.       @put_explorer(i_ex%,j_ex%)
  383.     UNTIL delta_x%=0
  384.   ELSE IF j_explorer%<>j_last%
  385.     delta_y%=(j_explorer%-j_last%)*celldim%
  386.     inc%=SGN(delta_y%)*2
  387.     i_ex%=(i_last%-nearest_x%+xleft_ctr%+1)*celldim%
  388.     j_ex%=(j_last%-nearest_y%+ytop_ctr%+1)*celldim%
  389.     ixcorner%=(nearest_x%-xleft_ctr%)*celldim%
  390.     iycorner%=(nearest_y%-ytop_ctr%)*celldim%
  391.     REPEAT
  392.       j_ex%=j_ex%+inc%
  393.       delta_y%=delta_y%-inc%
  394.       @show_window(ixcorner%,iycorner%)
  395.       @put_explorer(i_ex%,j_ex%)
  396.     UNTIL delta_y%=0
  397.   ELSE
  398.     @show_window(ixcorner%,iycorner%)
  399.     i_ex%=(i_explorer%-nearest_x%+xleft_ctr%+1)*celldim%
  400.     j_ex%=(j_explorer%-nearest_y%+ytop_ctr%+1)*celldim%
  401.     @put_explorer(i_ex%,j_ex%)
  402.   ENDIF
  403.   shift_x%=ixcorner%/celldim%
  404.   shift_y%=iycorner%/celldim%
  405. RETURN
  406. > PROCEDURE show_window(topx%,topy%)
  407.   LOCAL xleft2%
  408.   flip%=1-flip%
  409.   d_mfdb%(0)=screen_ptr%(flip%)
  410.   bltpar%(8)=3
  411.   IF topx%<319-width_pixels%
  412.     s_mfdb%(0)=mazeptr%(0)
  413.     bltpar%(0)=topx%
  414.     bltpar%(1)=topy%
  415.     bltpar%(2)=topx%+width_pixels%
  416.     bltpar%(3)=topy%+height_pixels%
  417.     bltpar%(4)=xleft%
  418.     bltpar%(5)=ytop%
  419.     bltpar%(6)=xleft%+width_pixels%
  420.     bltpar%(7)=ytop%+height_pixels%
  421.     BITBLT s_mfdb%(),d_mfdb%(),bltpar%()
  422.   ELSE IF topx%>319
  423.     topx%=topx%-320
  424.     s_mfdb%(0)=mazeptr%(1)
  425.     bltpar%(0)=topx%
  426.     bltpar%(1)=topy%
  427.     bltpar%(2)=topx%+width_pixels%
  428.     bltpar%(3)=topy%+height_pixels%
  429.     bltpar%(4)=xleft%
  430.     bltpar%(5)=ytop%
  431.     bltpar%(6)=xleft%+width_pixels%
  432.     bltpar%(7)=ytop%+height_pixels%
  433.     BITBLT s_mfdb%(),d_mfdb%(),bltpar%()
  434.   ELSE
  435.     s_mfdb%(0)=mazeptr%(0)
  436.     bltpar%(0)=topx%
  437.     bltpar%(1)=topy%
  438.     bltpar%(2)=319
  439.     bltpar%(3)=topy%+height_pixels%
  440.     bltpar%(4)=xleft%
  441.     bltpar%(5)=ytop%
  442.     bltpar%(6)=xleft%+319-topx%
  443.     bltpar%(7)=ytop%+height_pixels%
  444.     BITBLT s_mfdb%(),d_mfdb%(),bltpar%()
  445.     s_mfdb%(0)=mazeptr%(1)
  446.     bltpar%(0)=0
  447.     bltpar%(1)=topy%
  448.     bltpar%(2)=topx%+width_pixels%-319
  449.     bltpar%(3)=topy%+height_pixels%
  450.     bltpar%(4)=319-topx%+xleft%
  451.     bltpar%(5)=ytop%
  452.     bltpar%(6)=xleft%+width_pixels%
  453.     bltpar%(7)=ytop%+height_pixels%
  454.     BITBLT s_mfdb%(),d_mfdb%(),bltpar%()
  455.   ENDIF
  456.   VSYNC
  457.   IF XBIOS(2)<>screen_ptr%(flip%)
  458.     ~XBIOS(5,L:screen_ptr%(flip%),L:screen_ptr%(flip%),-1)
  459.   ENDIF
  460. RETURN
  461. '
  462. ' The game operates by calling the function shift_robots repeatedly
  463. ' until an exit condition is set. shift_robots scans all the robots
  464. ' and the explorer to see if any are ready to move. It also updates
  465. ' master_time and time_shift which ensure that everybody takes their
  466. ' turn at the right time. The function shift_robot attempts to move
  467. ' the particular robot in the specified direction.
  468. '
  469. '       3            6     7
  470. '    2     0            x          (8 to 11 move like knights in chess)
  471. '       1            5     4
  472. '
  473. ' The function move_robot creates the sound effect associated with the
  474. ' robot, checks whether the robot is able to move and moves the robot.
  475. ' If the robot hits another robot, the other robot may be prodded to
  476. ' start moving in the same direction. Some robots (like frog) reverse
  477. ' direction when they hit a barrier or change directions (like balls).
  478. '
  479. > PROCEDURE move_robot(i%,last_loc%,next_loc%)
  480.   ' moves robot from last_loc% to next_loc% in full_maze if allowed.
  481.   LOCAL bug_type%,num%,break%,pass_thru%
  482.   '  PRINT i%;"(";robot_status%(i%);") ";
  483.   bug_type%=robot_type%(i%)
  484.   IF bug_type%<5
  485.     @snd_effect(3)
  486.   ELSE IF bug_type%=5
  487.     @snd_effect(9)
  488.   ELSE IF bug_type%=6
  489.     @snd_effect(10)
  490.   ELSE IF bug_type%=7
  491.     @snd_effect(11)
  492.   ELSE IF bug_type%>7
  493.     @snd_effect(12)
  494.   ENDIF
  495.   DEC robot_status%(i%)
  496.   IF (full_maze|(next_loc%)<7)
  497.     full_maze|(last_loc%)=robot_cell%(i%)
  498.     robot_cell%(i%)=full_maze|(next_loc%)
  499.     full_maze|(next_loc%)=i%+32
  500.     @show_cell(last_loc%)
  501.     @show_cell(next_loc%)
  502.     success%=1
  503.     robot_loc%(i%)=next_loc%
  504.     robot_delay%(i%)=robot_type_delay%(bug_type%)
  505.   ELSE IF full_maze|(next_loc%)>31 AND full_maze|(next_loc%)<96 !hit robot
  506.     num%=full_maze|(next_loc%)-32
  507.     bug_type%=robot_type%(num%)
  508.     '    PRINT num%;"(";bug_type%;")  ";
  509.     SELECT bug_type%
  510.     CASE 0,1,2,3 !frog
  511.       robot_status%(num%)=4
  512.     CASE 4 !face
  513.       robot_status%(num%)=1
  514.       robot_dir%(num%)=robot_dir%(i%)
  515.     CASE 6 !red ball
  516.       robot_status%(num%)=10
  517.       robot_dir%(num%)=robot_dir%(i%)
  518.       robot_dir%(i%)=(robot_dir%(i%)+1) MOD 4
  519.       '      PRINT robot_dir%(i%);
  520.     CASE 7 !blue ball
  521.       robot_status%(num%)=10
  522.       robot_dir%(num%)=robot_dir%(i%)
  523.       robot_dir%(i%)=(robot_dir%(i%)+3) MOD 4
  524.       '     PRINT robot_dir%(i%);
  525.     CASE 8
  526.       robot_status%(num%)=2
  527.       robot_dir%(num%)=(robot_dir%(i%) MOD 4)+4
  528.     CASE 9
  529.       robot_status%(num%)=2
  530.       robot_dir%(num%)=((robot_dir%(i%)+2) MOD 4)+4
  531.     CASE 10
  532.       robot_status%(num%)=2
  533.       robot_dir%(num%)=(robot_dir%(i%) MOD 4)+8
  534.     CASE 11
  535.       robot_status%(num%)=2
  536.       robot_dir%(num%)=((robot_dir%(i%)+2) MOD 4)+8
  537.     ENDSELECT
  538.   ELSE IF full_maze|(next_loc%)>95
  539.     robot_status%(i%)=0
  540.   ENDIF
  541. RETURN
  542. > PROCEDURE shift_robot(i%)
  543.   ' shifts robot number i%
  544.   LOCAL last_loc%,next_loc%
  545.   last_loc%=robot_loc%(i%)
  546.   success%=0
  547.   SELECT robot_dir%(i%)
  548.   CASE 0
  549.     IF (last_loc% MOD width%)<width%-1
  550.       next_loc%=last_loc%+1
  551.       @move_robot(i%,last_loc%,next_loc%)
  552.     ENDIF
  553.   CASE 1
  554.     IF last_loc%<size%-width%
  555.       next_loc%=last_loc%+width%
  556.       @move_robot(i%,last_loc%,next_loc%)
  557.     ENDIF
  558.   CASE 2
  559.     IF (last_loc% MOD width%)>0
  560.       next_loc%=last_loc%-1
  561.       @move_robot(i%,last_loc%,next_loc%)
  562.     ENDIF
  563.   CASE 3
  564.     IF last_loc%>width%
  565.       next_loc%=last_loc%-width%
  566.       @move_robot(i%,last_loc%,next_loc%)
  567.     ENDIF
  568.   CASE 4
  569.     next_loc%=last_loc%+width%+1
  570.     IF next_loc%<size%
  571.       @move_robot(i%,last_loc%,next_loc%)
  572.     ENDIF
  573.   CASE 5
  574.     next_loc%=last_loc%+width%-1
  575.     IF next_loc%<size%
  576.       @move_robot(i%,last_loc%,next_loc%)
  577.     ENDIF
  578.   CASE 6
  579.     next_loc%=last_loc%-width%-1
  580.     IF next_loc%>=0
  581.       @move_robot(i%,last_loc%,next_loc%)
  582.     ENDIF
  583.   CASE 7
  584.     next_loc%=last_loc%-width%+1
  585.     IF next_loc%>=0
  586.       @move_robot(i%,last_loc%,next_loc%)
  587.     ENDIF
  588.   CASE 8
  589.     next_loc%=last_loc%+width%+2
  590.     IF next_loc%<size%
  591.       @move_robot(i%,last_loc%,next_loc%)
  592.     ENDIF
  593.   CASE 9
  594.     next_loc%=last_loc%+width%-2
  595.     IF next_loc%<size%
  596.       @move_robot(i%,last_loc%,next_loc%)
  597.     ENDIF
  598.   CASE 10
  599.     next_loc%=last_loc%-width%-2
  600.     IF next_loc%>=0
  601.       @move_robot(i%,last_loc%,next_loc%)
  602.     ENDIF
  603.   CASE 11
  604.     next_loc%=last_loc%-width%+2
  605.     IF next_loc%>=0
  606.       @move_robot(i%,last_loc%,next_loc%)
  607.     ENDIF
  608.   DEFAULT
  609.   ENDSELECT
  610.   IF success%=0 AND robot_type%(i%)<4
  611.     robot_type%(i%)=(robot_type%(i%)+2) MOD 4
  612.     robot_dir%(i%)=robot_type%(i%)
  613.   ENDIF
  614. RETURN
  615. > PROCEDURE shift_robots
  616.   ' shifts all the living robots and checks for motion of
  617.   ' explorer
  618.   LOCAL i%,robot_move%
  619.   robot_move%=0
  620.   time_shift%=TIMER-master_time%
  621.   IF time_shift%>0
  622.     master_time%=TIMER
  623.   ENDIF
  624.   FOR i%=0 TO robot%
  625.     scancode%=@stick_handler
  626.     IF explorer_delay%<=0
  627.       @shift_explorer(scancode%)
  628.     ENDIF
  629.     IF robot_status%(i%)>0 AND robot_delay%(i%)<0
  630.       @shift_robot(i%)
  631.       robot_move%=1
  632.     ELSE
  633.       robot_delay%(i%)=robot_delay%(i%)-time_shift%
  634.     ENDIF
  635.   NEXT i%
  636.   IF robot_move%=1
  637.     @show_window(ixcorner%,iycorner%)
  638.     @put_explorer(i_ex%,j_ex%)
  639.   ENDIF
  640.   explorer_delay%=explorer_delay%-time_shift%
  641.   ' time_shift% is also altered by shift_explorer
  642. RETURN
  643. '
  644. ' The function stick_handler returns the motion code from the joystick
  645. ' or keyboard. The function shift_explorer, shifts or slides the explorer
  646. ' depending on the floor type and adjacent objects. The explorer stops
  647. ' when it encounters a barrier or robot, but it may cause the robot
  648. ' to start moving. The function shift_explorer also checks for the
  649. ' help, undo, esc and F10 keys, takes care of gobbling up the treasures
  650. ' and exits the level when the X cell is encountered. Finally, the function
  651. ' also takes care of the screen updates.
  652. '
  653. > FUNCTION stick_handler
  654. ' The numbers returned by stick_handler correspond to the
  655. ' ascii codes of the arrow keys on the keyboard.
  656. LOCAL i%
  657. move%=STICK(1)
  658. SELECT move%
  659. CASE 1
  660.   RETURN 72
  661. CASE 2
  662.   RETURN 80
  663. CASE 4
  664.   RETURN 75
  665. CASE 8
  666.   RETURN 77
  667. DEFAULT
  668.   FOR i%=0 TO 3
  669.     '      IF STRIG(1)=TRUE
  670.     '     RETURN 71
  671.     '  ENDIF
  672.     t$=INKEY$
  673.     IF t$<>""
  674.       scancode%=CVI(t$)
  675.       RETURN scancode%
  676.     ENDIF
  677.   NEXT i%
  678. ENDSELECT
  679. RETURN 0
  680. ENDFUNC
  681. > PROCEDURE shift_explorer(scancode%)
  682. LOCAL i%,j%,next_loc%,teleport_mode%
  683. LOCAL i_last%,j_last%
  684. i%=explorer_loc% MOD width%
  685. j%=explorer_loc% DIV width%
  686. i_last%=i%
  687. j_last%=j%
  688. '  PRINT scancode%;" ";
  689. IF ASC(t$)=27
  690.   exit%=4
  691. ENDIF
  692. SELECT scancode%
  693. CASE 68 !F10
  694.   exit%=3
  695. CASE 72 ! up arrow
  696.   DEC j%
  697.   explorer_dir%=3
  698. CASE 75 !right arrow
  699.   DEC i%
  700.   explorer_dir%=2
  701. CASE 77
  702.   INC i%
  703.   explorer_dir%=0
  704. CASE 80
  705.   INC j%
  706.   explorer_dir%=1
  707. CASE 97 !undo key
  708.   exit%=1
  709. CASE 98 !help key
  710.   ' cheating or debugging
  711.   @draw_minature_maze
  712.   PAUSE 5
  713.   LOCATE 20,1
  714.   PRINT SPACE$(19);
  715.   LOCATE 20,1
  716.   PRINT "hit any key ";
  717.   REPEAT
  718.   UNTIL INKEY$<>""
  719.   LOCATE 20,1
  720.   PRINT SPACE$(19);
  721.   score%=score%-5
  722.   @score_status
  723. DEFAULT
  724.   GOTO shift_exit
  725. ENDSELECT
  726. IF j%>=0 AND j%<height%
  727.   IF i%>=0 AND i%<width%
  728.     next_loc%=j%*width%+i%
  729.     ' slide
  730.     inc_flag%=0
  731.     WHILE (full_maze|(next_loc%)=3 OR full_maze|(next_loc%)=6) AND j%>=0 AND j%<height% AND i%>=0 AND i%<width%
  732.       inc_flag%=1
  733.       IF (explorer_cell%=2 OR explorer_cell%=5) !once only
  734.         explorer_cell%=128+once_only%
  735.         @snd_effect(7)
  736.       ELSE IF (explorer_cell%=1 OR explorer_cell%=4) !twice only
  737.         explorer_cell%=2
  738.         @snd_effect(7)
  739.       ENDIF
  740.       full_maze|(explorer_loc%)=explorer_cell%
  741.       @show_cell(explorer_loc%)
  742.       explorer_cell%=full_maze|(next_loc%)
  743.       full_maze|(next_loc%)=255
  744.       explorer_loc%=next_loc%
  745.       @slide_window(i%,j%)
  746.       i_last%=i%
  747.       j_last%=j%
  748.       SELECT scancode%
  749.       CASE 72 ! up arrow
  750.         DEC j%
  751.       CASE 75 !right arrow
  752.         DEC i%
  753.       CASE 77
  754.         INC i%
  755.       CASE 80
  756.         INC j%
  757.       ENDSELECT
  758.       IF j%>=0 AND j%<height% AND i%>=0 AND i%<width%
  759.         next_loc%=j%*width%+i%
  760.       ENDIF
  761.     WEND
  762.     IF full_maze|(next_loc%)<128
  763.       ' treasures ------------------------
  764.       IF full_maze|(next_loc%)>95 AND full_maze|(next_loc%)<104
  765.         @snd_effect(2)
  766.         gem_type%=full_maze|(next_loc%)-96
  767.         full_maze|(next_loc%)=gem_type%
  768.         @show_cell(next_loc%)
  769.         INC gemfound%
  770.         DEC gemnum%
  771.         @gem_status
  772.         ' hit robot ------------------------
  773.         ' switches
  774.       ELSE IF full_maze|(next_loc%)>31 AND full_maze|(next_loc%)<96
  775.         '          @snd_effect(1)
  776.         robot_num%=full_maze|(next_loc%)-32
  777.         explorer_delay%=60
  778.         SELECT robot_type%(robot_num%)
  779.         CASE 0,1,2,3
  780.           robot_status%(robot_num%)=4
  781.         CASE 4,5
  782.           robot_status%(robot_num%)=1
  783.           robot_dir%(robot_num%)=explorer_dir%
  784.         CASE 6,7
  785.           robot_status%(robot_num%)=10
  786.           robot_dir%(robot_num%)=explorer_dir%
  787.         CASE 8
  788.           robot_status%(robot_num%)=1
  789.           robot_dir%(robot_num%)=explorer_dir%+4
  790.         CASE 9
  791.           robot_status%(robot_num%)=1
  792.           robot_dir%(robot_num%)=((explorer_dir%+2) MOD 4)+4
  793.         CASE 10
  794.           robot_status%(robot_num%)=1
  795.           robot_dir%(robot_num%)=explorer_dir%+8
  796.         CASE 11
  797.           robot_status%(robot_num%)=1
  798.           robot_dir%(robot_num%)=((explorer_dir%+2) MOD 4)+8
  799.         ENDSELECT
  800.         GOTO shift_exit !blocked by robot
  801.       ELSE IF full_maze|(next_loc%)=14
  802.         IF (gemnum%<3)
  803.           exit%=2
  804.           INC file_num%
  805.           IF gemnum%=0
  806.             score%=score%+20
  807.           ELSE
  808.             score%=score%+10
  809.           ENDIF
  810.           IF num_moves%<min_moves% AND gemnum%=0
  811.             score%=score%+30
  812.           ENDIF
  813.         ENDIF
  814.       ENDIF
  815.       ' shift explorer -----------------------
  816.       IF (explorer_cell%=2 OR explorer_cell%=5) !once only
  817.         explorer_cell%=128+once_only%
  818.         @snd_effect(7)
  819.       ELSE IF (explorer_cell%=1 OR explorer_cell%=4) !twice only
  820.         explorer_cell%=2
  821.         @snd_effect(7)
  822.       ENDIF
  823.       full_maze|(explorer_loc%)=explorer_cell%
  824.       INC num_moves%
  825.       @print_life_points
  826.       ' @print_mem
  827.       @show_cell(explorer_loc%)
  828.       explorer_cell%=full_maze|(next_loc%)
  829.       full_maze|(next_loc%)=255
  830.       explorer_loc%=next_loc%
  831.       @slip_window(i%,j%,i_last%,j_last%)
  832.       explorer_delay%=response%
  833.       master_time%=TIMER
  834.       time_shift%=0
  835.     ENDIF
  836.     IF inc_flag%=1
  837.       INC num_moves%
  838.       @print_life_points
  839.     ENDIF
  840.   ENDIF
  841. ENDIF
  842. shift_exit:
  843. RETURN
  844. > PROCEDURE put_explorer(ix%,iy%)
  845. VSYNC
  846. PUT ix%,iy%,explorer_shadow$(explorer_dir%),4
  847. PUT ix%,iy%,explorer$(explorer_dir%),6
  848. RETURN
  849. '
  850. '
  851. > PROCEDURE make_puts
  852. LOCAL i%
  853. nputs%=7
  854. DEFFILL 0,1 !0
  855. PBOX 0,0,13,13
  856. GET 1,1,celldim%,celldim%,puts$(0)
  857. COLOR 2
  858. FOR i%=1 TO 3
  859.   DEFFILL i%+11
  860.   PBOX 0,0,13,13
  861.   GET 1,1,celldim%,celldim%,puts$(i%)
  862.   PLOT 6,6
  863.   GET 1,1,celldim%,celldim%,puts$(i%+3)
  864. NEXT i%
  865. DEFFILL 0
  866. PBOX 0,0,13,13
  867. RETURN
  868. > PROCEDURE make_shadow(VAR a$)
  869. ' converts all the non-zero values in a put section to 15's
  870. ' to create a mask for writing on the screen using put modes
  871. ' 4 and 6. see put_explorer.
  872. LOCAL addr%,wid%,widwrd%,height%,shift%
  873. LOCAL i%
  874. addr%=VARPTR(a$)
  875. wid%=CARD{addr%}
  876. widwrd%=(wid%+16) DIV 16 ! size in 16 bit words
  877. height%=CARD{addr%+2}
  878. size%=widwrd%*8*(height%+1) !4*words*2 = size in bytes
  879. FOR i%=0 TO widwrd%*(height%+1)-1
  880.   shift%=i%*8
  881.   word%=CARD{addr%+6+shift%} ! 8 bytes for every 16 pixel group
  882.   word%=word% OR CARD{addr%+8+shift%}
  883.   word%=word% OR CARD{addr%+10+shift%}
  884.   word%=word% OR CARD{addr%+12+shift%}
  885.   CARD{addr%+6+shift%}=word%
  886.   CARD{addr%+8+shift%}=word%
  887.   CARD{addr%+10+shift%}=word%
  888.   CARD{addr%+12+shift%}=word%
  889. NEXT i%
  890. RETURN
  891. > PROCEDURE write_maze_on_disk
  892. ' records problem
  893. LOCAL i%
  894. IF name$=""
  895.   FILESELECT #"Output file","*.dat","getsl"+STR$(file_write%)+".dat",name$
  896. ELSE
  897.   FILESELECT #"Output file","*.dat",name$,name$
  898. ENDIF
  899. OPEN "o",#1,name$
  900. IF name$<>""
  901.   full_maze_init|(explorer_loc_init%)=explorer_cell_init%
  902.   PRINT #1,width%
  903.   PRINT #1,height%
  904.   PRINT #1,explorer_loc_init%
  905.   size%=width%*height%-1
  906.   BPUT #1,VARPTR(full_maze_init|(0)),size%+1
  907.   PRINT #1,robot%
  908.   FOR i%=0 TO robot%-1
  909.     PRINT #1,robot_loc_init%(i%)
  910.   NEXT i%
  911.   FOR i%=0 TO robot%-1
  912.     PRINT #1,robot_type%(i%)
  913.   NEXT i%
  914.   FOR i%=0 TO robot%-1
  915.     PRINT #1,robot_cell_init%(i%)
  916.   NEXT i%
  917.   PRINT #1,once_only%
  918.   PRINT #1,min_moves%
  919.   PRINT #1,n4cells%
  920.   FOR i%=0 TO n4cells%-1
  921.     BPUT #1,VARPTR(cell4$(i%)),326
  922.     '      PRINT #1,cell4$(i%)
  923.   NEXT i%
  924.   CLOSE #1
  925. ENDIF
  926. RETURN
  927. > PROCEDURE read_maze_from_disk(name$)
  928. LOCAL i%
  929. IF EXIST(name$)
  930.   LOCATE 1,1
  931.   PRINT "loading "+name$;
  932.   OPEN "i",#1,name$
  933.   INPUT #1,width%
  934.   INPUT #1,height%
  935.   size%=width%*height%-1
  936.   INPUT #1,explorer_loc_init%
  937.   BGET #1,VARPTR(full_maze_init|(0)),size%+1
  938.   INPUT #1,robot%
  939.   FOR i%=0 TO robot%-1
  940.     INPUT #1,robot_loc_init%(i%)
  941.   NEXT i%
  942.   FOR i%=0 TO robot%-1
  943.     INPUT #1,robot_type%(i%)
  944.   NEXT i%
  945.   FOR i%=0 TO robot%-1
  946.     INPUT #1,robot_cell_init%(i%)
  947.   NEXT i%
  948.   INPUT #1,once_only%
  949.   INPUT #1,min_moves%
  950.   INPUT #1,n4cells%
  951.   FOR i%=0 TO n4cells%-1
  952.     cell4$(i%)=INPUT$(326,#1)
  953.   NEXT i%
  954.   CLOSE #1
  955.   file_ok%=1
  956.   '    LOCATE 1,1
  957.   '    PRINT full_maze_init|(explorer_loc_init%);
  958.   explorer_cell_init%=full_maze_init|(explorer_loc_init%)
  959.   PAUSE 50
  960. ELSE
  961.   TEXT 1,8,name$+" does not exist."
  962.   @total_score
  963.   file_num%=0
  964.   file_ok%=0
  965.   robot%=1
  966. ENDIF
  967. DELAY 1
  968. RETURN
  969. > PROCEDURE restart
  970. LOCAL i%
  971. explorer_loc%=explorer_loc_init%
  972. gemnum%=0
  973. FOR i%=0 TO size%
  974.   full_maze|(i%)=full_maze_init|(i%)
  975.   IF full_maze|(i%)>95 AND full_maze|(i%)<104
  976.     INC gemnum%
  977.   ENDIF
  978. NEXT i%
  979. FOR i%=0 TO robot%-1
  980.   robot_loc%(i%)=robot_loc_init%(i%)
  981.   robot_cell%(i%)=robot_cell_init%(i%)
  982.   robot_status%(i%)=0
  983.   IF robot_type%(i%)<4
  984.     robot_dir%(i%)=robot_type%(i%)
  985.   ENDIF
  986. NEXT i%
  987. xright_ctr%=width%-window_width%/2
  988. ybot_ctr%=height%-window_height%/2
  989. explorer_cell%=full_maze_init|(explorer_loc_init%)
  990. RETURN
  991. > PROCEDURE run_maze
  992. LOCAL i%
  993. CLS
  994. editor_on%=0
  995. flip%=1
  996. ms%=2 !microcell size
  997. exit%=0
  998. score%=0
  999. REPEAT
  1000.   name$="GETSL"+STR$(file_num%)+".DAT"
  1001.   IF exit%<>1 !don't read maze if UNDO
  1002.     @read_maze_from_disk(name$)
  1003.   ENDIF
  1004.   exit%=0
  1005.   @restart
  1006.   IF file_ok%=0
  1007.     exit%=4
  1008.   ENDIF
  1009.   life_points%=100
  1010.   num_moves%=0
  1011.   CLS
  1012.   i_explorer%=explorer_loc% MOD width%
  1013.   j_explorer%=explorer_loc% DIV width%
  1014.   @nearest_centre(i_explorer%,j_explorer%)
  1015.   shift_x%=nearest_x%
  1016.   shift_y%=nearest_y%
  1017.   gemfound%=0
  1018.   IF exit%<>3
  1019.     @show_maze
  1020.     @clear_screen
  1021.     @slide_window(i_explorer%,j_explorer%)
  1022.     @show_margin
  1023.     @print_life_points
  1024.     @gem_status
  1025.     @level_status
  1026.     @score_status
  1027.   ENDIF
  1028.   master_time%=TIMER
  1029.   FOR i%=0 TO robot%-1
  1030.     robot_delay%(i%)=0
  1031.   NEXT i%
  1032.   '
  1033.   ' This is the main loop of the program
  1034.   robot_status%(robot%)=-1
  1035.   REPEAT
  1036.     @shift_robots
  1037.   UNTIL exit%<>0
  1038.   STICK (0)
  1039.   IF exit%=3
  1040.     INC file_num%
  1041.   ENDIF
  1042. UNTIL exit%=4
  1043. ~XBIOS(5,L:screen_ptr%(1),L:screen_ptr%(1),-1)
  1044. RETURN
  1045. > PROCEDURE show_margin
  1046. COLOR 9
  1047. BOX celldim%-1,celldim%-1,(window_width%+1)*celldim%,(window_height%+1)*celldim%
  1048. DEFLINE 1,3
  1049. COLOR 10
  1050. BOX celldim%-4,celldim%-3,(window_width%+1)*celldim%+3,(window_height%+1)*celldim%+2
  1051. BMOVE screen_ptr%(flip%),screen_ptr%(1-flip%),32000
  1052. DEFLINE 1,1
  1053. RETURN
  1054. '
  1055. > PROCEDURE level_status
  1056. IF simulation_on%=0
  1057.   '  ~XBIOS(5,L:screen_ptr%(flip%),L:-1,-1)
  1058.   DEFFILL 0
  1059.   DEFTEXT 1
  1060.   PBOX 130,150,200,170
  1061.   BOX 130,150,200,170
  1062.   a$="Level "
  1063.   a$=a$+STR$(file_num%)
  1064.   TEXT 133,163,a$
  1065.   BMOVE screen_ptr%(flip%),screen_ptr%(1-flip%),32000
  1066. ENDIF
  1067. RETURN
  1068. > PROCEDURE score_status
  1069. IF simulation_on%=0
  1070.   '  ~XBIOS(5,L:screen_ptr%(flip%),L:-1,-1)
  1071.   DEFFILL 0
  1072.   DEFTEXT 1
  1073.   PBOX 230,150,318,170
  1074.   BOX 230,150,318,170
  1075.   a$="Score "
  1076.   a$=a$+STR$(score%)
  1077.   TEXT 235,163,a$
  1078.   BMOVE screen_ptr%(flip%),screen_ptr%(1-flip%),32000
  1079.   ~FRE(0)
  1080. ENDIF
  1081. RETURN
  1082. > PROCEDURE clear_screen
  1083. CLS
  1084. BMOVE screen_ptr%(flip%),screen_ptr%(1-flip%),32000
  1085. RETURN
  1086. > PROCEDURE gem_status
  1087. IF simulation_on%=0
  1088.   '  ~XBIOS(5,L:screen_ptr%(flip%),L:-1,-1)
  1089.   DEFFILL 0
  1090.   DEFTEXT 1
  1091.   a$=""
  1092.   IF gemnum%>0
  1093.     PBOX 10,175,100,195
  1094.     BOX 10,175,100,195
  1095.     a$=a$+STR$(gemfound%)
  1096.     a$=a$+"/"
  1097.     a$=a$+STR$(gemnum%+gemfound%)
  1098.     a$=a$+" found"
  1099.     TEXT 12,188,a$
  1100.   ELSE
  1101.     PBOX 10,175,120,195
  1102.     BOX 10,175,240,195
  1103.     GRAPHMODE 2
  1104.     TEXT 14,188,"Go to X to get to next level"
  1105.     @snd_effect(8)
  1106.   ENDIF
  1107.   BMOVE screen_ptr%(flip%),screen_ptr%(1-flip%),32000
  1108.   ~FRE(0)
  1109. ENDIF
  1110. RETURN
  1111. > PROCEDURE print_life_points
  1112. IF simulation_on%=0
  1113.   LOCATE 32,25
  1114.   PRINT SPACE$(4);
  1115.   LOCATE 32,25
  1116.   PRINT num_moves%;"/";min_moves%;
  1117.   BMOVE screen_ptr%(flip%),screen_ptr%(1-flip%),32000
  1118.   ' hit robot ------------------------
  1119. ENDIF
  1120. RETURN
  1121. > PROCEDURE print_mem
  1122. LOCATE 32,1
  1123. PRINT SPACE$(4);
  1124. LOCATE 32,1
  1125. PRINT FRE()
  1126. BMOVE screen_ptr%(flip%),screen_ptr%(1-flip%),32000
  1127. RETURN
  1128. '
  1129. > PROCEDURE draw_minature_window
  1130. ' displays entire maze withen display window
  1131. LOCAL i%,x%,y%
  1132. FOR y%=shift_y% TO shift_y%+window_height%
  1133.   FOR x%=shift_x% TO shift_x%+window_width%
  1134.     i%=x%+y%*width%
  1135.     show_micro_cell(i%)
  1136.   NEXT x%
  1137. NEXT y%
  1138. RETURN
  1139. '
  1140. > PROCEDURE read_hex_string(VAR string$)
  1141. LOCAL i%,j%,k%,temp$
  1142. string$=""
  1143. FOR i%=0 TO 86
  1144.   j%=MOD(i%,36)+1
  1145.   IF j%=1
  1146.     READ temp$
  1147.   ENDIF
  1148.   k%=VAL("&H"+MID$(temp$,j%*2-1,2))
  1149.   string$=string$+CHR$(k%)
  1150. NEXT i%
  1151. RETURN
  1152. > PROCEDURE read_cellpat
  1153. ' the wall textures are read from data statements and put
  1154. ' into the strings for cellpat$ so that they can be painted
  1155. ' on the screen using PUT.
  1156. LOCAL num%,i%,j%,string$
  1157. RESTORE cell_data
  1158. numcells%=12
  1159. FOR j%=0 TO numcells%-1
  1160.   @read_hex_string(string$)
  1161.   cellpat$(j%)=string$
  1162. NEXT j%
  1163. FOR j%=0 TO 3
  1164.   @read_hex_string(string$)
  1165.   treasures$(j%)=string$
  1166. NEXT j%
  1167. nbugs%=12
  1168. FOR j%=0 TO nbugs%-1
  1169.   @read_hex_string(string$)
  1170.   bugs$(j%)=string$
  1171. NEXT j%
  1172. FOR j%=0 TO 3
  1173.   @read_hex_string(string$)
  1174.   explorer$(j%)=string$
  1175.   make_shadow(string$)
  1176.   explorer_shadow$(j%)=string$
  1177. NEXT j%
  1178. @read_hex_string(exit$)
  1179. ' grass 1 0
  1180. cell_data:
  1181. ' latice 1
  1182. DATA 000900090004FFC0F800FFC0FFC0C9C08800C9C0FFC0DDC08800DDC0FFC0FDC0F800FDC0
  1183. DATA FFC0DDC00000DDC0FFC0DDC00D80DDC0FFC0DDC00880DDC0FFC0C1C00080C1C0FFC0FFC0
  1184. DATA 0F80FFC0FFC0FFC00000FFC0FFC0
  1185. ' latice 2
  1186. DATA 0009000900047FC0FFC001000000A900FFC0BE0088000E40DE00FDC0000084C05F80F8C0
  1187. DATA 000088C05FC0E5C000008EC0DFC0E140800042C0DFC0F84000004CC0CEC0F38040001FC0
  1188. DATA FFC0C3800000FFC0FE4077800200
  1189. ' latice 3
  1190. DATA 000900090004FCC0CCC03CC00300FCC0CCC03CC00300FC00CC003C0003C0FC00CC003C00
  1191. DATA 03C0FFC0CFC03FC00000FFC0CFC03FC00000FFC0C0003FC00000FFC0C0003FC00000FFC0
  1192. DATA FFC000000000FFC0FFC000000000
  1193. ' latice 4
  1194. DATA 00090009000407C007C0FFC007C007C007C0FFC007C007C007C0FFC007C007C007C0FFC0
  1195. DATA 07C007C007C0FFC007C0F800F800000007C0F800F800000007C0F800F800000007C0F800
  1196. DATA F800000007C0F800F800000007C0
  1197. ' latice 5
  1198. DATA 0009000900040000FC00FFC00000C000FE00FFC0C000FC0003C003C00000FE4001C001C0
  1199. DATA 0040FF4000C000C00040FE00000001C00000F800F800C7C0C000E000E0001FC00000C000
  1200. DATA C0003FC00000C000C0003FC00000
  1201. ' latice 6
  1202. DATA 00090009000430E4CFD200DA00FA9C4EE3CE804E8058EF20F0D2E006E006F788F852F00E
  1203. DATA F01239CA3E22F82838061EC61F08FE081E148F1C0FCC7F060F08E78807D41F8E078CE3C6
  1204. DATA 83C89FDE83DEF1DEC1DECFDEC1DE
  1205. ' latice 7
  1206. DATA 000900090004002400240024FFD2001A003A000EFFCE3F0E00183F20FFD23F0600062108
  1207. DATA FFD23F0E0012210AFFE23F2800062106FFC83F080014211CFFCC3F0600083F08FFD4000E
  1208. DATA 000C0006FFC8000800080014FFCA
  1209. ' latice 8
  1210. DATA 0009000900040C24FFE40C24FFD23E1AFBFA3A0EFBCE7E0EE7D86620E7D27E06E3C66208
  1211. DATA E3D23F8EE1D2218AE1E21FA8F0C61086F0C81F08F9D4191CF9CC1C06F3C81008F3D4000E
  1212. DATA FFCC0006FFC80008FFC80014FFCA
  1213. ' latice 9
  1214. DATA 0009000900040024FFE4FFE40012E01A1E3A1FCE000EE80E1E1817E00012FC061E0603C8
  1215. DATA 00127C0EBFD283CA00223DE8FE06C3C600081DC8FE14E3DC000C09C6F608FFC800140BCE
  1216. DATA F40CFFC600080E08F1C8FFD4000A
  1217. ' lattice 10
  1218. DATA 0009000900040822000E000E210E0824001C0022370E080E000E0024001CF84600060008
  1219. DATA 0012004E0012000A0022006800060006000800480014001C3F0C0046000800082114D84E
  1220. DATA 000C00062108080800080014210A
  1221. ' lattice 11
  1222. DATA 000900090004C0003FC00000000060009FC0000000003000CFC0000000001800E7C00000
  1223. DATA 000098C0670000000000F1800E400000000073008CC0000000001E00E1C0000000000E00
  1224. DATA F1C0000000000300FCC000000000
  1225. ' lattice 12
  1226. DATA 0009000900040C000C000000F3C00C000C000000F3C0330033000000CCC0330033000000
  1227. DATA CCC0CCC0CCC000003300CCC0CCC000003300330033000000CCC0330033000000CCC00C00
  1228. DATA 0C000000F3C00C000C000000F3C0
  1229. ' ball1 (treasure)
  1230. DATA 00090009000400240024002400120C1A003A120E000E0C0E0018332000120C0600067388
  1231. DATA 00127F8E0012000A00227FA80006000600080C080014739C000C0C060008330800140C0E
  1232. DATA 000C12060008000800080014000A
  1233. ' ball2 (treasure)
  1234. DATA 00090009000400240024FFE4FFD2121A003AFFCEE1CE330E0018FFE0C0D273860006FFC8
  1235. DATA 8052000E0012FFCA806200280006FFC6804873880014FFDC804C33060008FFC8C0D4120E
  1236. DATA 000CFFC6E1C800080008FFD4FFCA
  1237. ' ball3 (treasure)
  1238. DATA 0009000900040024FFE4FFE4FFD21E1AE1FAEDCEF3CE3F0EC0D8CCE0F3D27F8680468C48
  1239. DATA F3D27F8E8052FFCA80627FA88046FFC680487F8880548C5CF3CC3F06C0C8CCC8F3D41E0E
  1240. DATA E1CCEDC6F3C80008FFC8FFD4FFCA
  1241. ' ball4 (treasure)
  1242. DATA 000900090004FFE4FFE40024FFD29EDAFFFA7F0EEDCEBFCEFFD87F20CCD2FFC6FFC67F88
  1243. DATA 8C52FFCEFFD27F8AFFE2FFE8FFC67F86FFC8FFC8FFD47F9C8C4CFFC6FFC83F08CCD4FFCE
  1244. DATA EFCC0E06FDC8FFC8FFC80014FFCA
  1245. ' robot 1 frog
  1246. DATA 0009000900040000000000000000200020000000000051805180000000000E000E000000
  1247. DATA 00000B001E00170002000B001E00170002000E000E000000000051805180000000002000
  1248. DATA 2000000000000000000000000000
  1249. ' robot 2 frog
  1250. DATA 00090009000400000000000000002100210000000000408040800000000021002D000C00
  1251. DATA 00001E001E000000000012001E000C0000001E001E000C000C002D0021000C0000002100
  1252. DATA 2100000000000000000000000000
  1253. ' robot 3 frog
  1254. DATA 0009000900040000000000000000010001000000000062806280000000001C001C000000
  1255. DATA 000034001E003A00100034001E003A0010001C001C000000000062806280000000000100
  1256. DATA 0100000000000000000000000000
  1257. ' robot 4 frog
  1258. DATA 000900090004000000000000000021002100000000002D0021000C0000001E001E000C00
  1259. DATA 0C0012001E000C0000001E001E000000000021002D000C00000040804080000000002100
  1260. DATA 2100000000000000000000000000
  1261. ' robot 5 face
  1262. DATA 000900090004FFE4002400240012805A7FBA000E000EB34E4C980020331280466D860008
  1263. DATA 1212804E6D92000A12228C68738600060008A1487F94211C210CB3467F88330833149E4E
  1264. DATA 7F8C1E061E08FFC800080014000A
  1265. ' robot 6 brick
  1266. DATA 000900090004FFC0FFC0FFC0FFC0FFC0804080408040C0C0BF4080408040C0C0A1409E40
  1267. DATA 8040C4C0A1409E408440C4C0A1409E408440C0C0A1409E408040C0C0BF4080408040FFC0
  1268. DATA 804080408040FFC0FFC0FFC0FFC0
  1269. ' robot 7 ball red
  1270. DATA 00090009000400000000000000001E001E001E001E003F002100210021007D8042804480
  1271. DATA 44807D804280448044807D804280408040807F804080408040803F002100210021001E00
  1272. DATA 1E001E001E000000000000000000
  1273. ' robot 8 ball blue
  1274. DATA 00090009000400000000000000001E00000000001E003F001E001E002100718031003100
  1275. DATA 4E8079803900390046807D803D003D0042807F803F003F0040803F005E005E0061001E00
  1276. DATA 000000001E000000000000000000
  1277. ' robot 9 bird yellow
  1278. DATA 00090009000400000000000000000000000000000000000038000000000010007C001000
  1279. DATA 000000007B00040000000000888007000000000008400780000000000780004000000500
  1280. DATA 0500050005000500050005000500
  1281. ' robot 10 bird yellow
  1282. DATA 00090009000400000000000000000000000000000000000007000000000002000F800200
  1283. DATA 000000003780080000000000444038000000000084007800000000007800800000002800
  1284. DATA 2800280028002800280028002800
  1285. ' robot 11 bird red
  1286. DATA 0009000900040022000E000E000E0024001C0022000E600E600E6024601C3006B0067008
  1287. DATA B0127C0EFC127C0AFC223F28BF063F06BF081F881F941F9C1F8C0FC60FC80FC80FD40A0E
  1288. DATA 000C00060008110800080014000A
  1289. ' robot 12 bird red
  1290. DATA 0009000900040022000E000E000E0024001C0022000E018E018E01A4019C030603460388
  1291. DATA 03520F8E0FD20F8A0FE23F283F463F063F487E087E147E1C7E0CFC06FC08FC08FC14140E
  1292. DATA 000C00060008220800080014000A
  1293. ' explorer right
  1294. DATA 0009000900040024002400240012001A003A000E000E7E0E7E187E207E1241067F067F08
  1295. DATA 7F12C18EFF92FF8AFFA2FFE8FFC6FFC6FFC8FFC8FFD4FFDCFFCC6306000863086314000E
  1296. DATA 000C00060008000800080014000A
  1297. ' explorer down
  1298. DATA 0009000900041C241C241C241C123F1A1F3A3F0E3F0E390E1F183F203F1219061F061F08
  1299. DATA 1F12190E1F121F0A1F2219281F061F061F0839081F143F1C3F0C3E061E083E083E141C0E
  1300. DATA 1C0C1C061C08180818081814180A
  1301. ' explorer left
  1302. DATA 0009000900040024002400240012001A003A000E000E1F8E1F981FA01F9220863F863F88
  1303. DATA 3F9260CE7FD27FCA7FE2FFE8FFC6FFC6FFC8FFC8FFD4FFDCFFCC3186000831883194000E
  1304. DATA 000C00060008000800080014000A
  1305. ' explorer up
  1306. DATA 00090009000406240624062406120E1A0E3A0E0E0E0E1F0E1E181F201F1227063E063F08
  1307. DATA 3F12260E3E123E0A3E2226283E063E063E0826083E143E1C3E0C27063E083F083F143F0E
  1308. DATA 3E0C3F063F080E080E080E140E0A
  1309. ' exit
  1310. DATA 0009000900040024002400240012409A40BA408E408E210E211821202112120612061208
  1311. DATA 12120C0E0C120C0A0C220C280C060C060C0812081214121C120C2106210821082114408E
  1312. DATA 408C40864088000800080014000A
  1313. RETURN
  1314. '
  1315. > PROCEDURE snd_effect(type%)
  1316. LOCAL i%,voice%,env%,form%,per%
  1317. SELECT type%
  1318. CASE 1 !hit robot
  1319.   voice%=256*16+1+2+16
  1320.   env%=2
  1321.   form%=9
  1322.   per%=500
  1323.   WAVE voice%,env%,form%,per%,2
  1324.   FOR i%=0 TO 1200
  1325.     SOUND 0,12,#334250+i%
  1326.   NEXT i%
  1327.   SOUND 0,0
  1328. CASE 2 !new gem
  1329.   voice%=1
  1330.   env%=1
  1331.   per%=1000
  1332.   SOUND 0,13,1,6,0
  1333.   WAVE voice%,env%,9,per%,0
  1334.   '    SOUND 0,0
  1335. CASE 3 !robot hit explorer
  1336.   voice%=1
  1337.   env%=1
  1338.   per%=30
  1339.   SOUND 0,10,1,7
  1340.   WAVE voice%,env%,10,per%,0
  1341.   SOUND 0,0
  1342. CASE 4 !window sliding
  1343.   voice%=256*16+1+2+16
  1344.   env%=2
  1345.   form%=9
  1346.   per%=500
  1347.   WAVE voice%,env%,form%,per%,1
  1348.   SOUND 0,12,#334250+i%
  1349.   SOUND 0,0
  1350. CASE 5  !expired life
  1351.   voice%=256*16+1+2+16
  1352.   env%=2
  1353.   form%=9
  1354.   per%=500
  1355.   WAVE voice%,env%,form%,per%,2
  1356.   FOR i%=0 TO 150
  1357.     PAUSE 1
  1358.     SOUND 0,12,#334250+i%*10
  1359.   NEXT i%
  1360.   SOUND 0,0
  1361. CASE 6 ! broken wall
  1362.   voice%=256*16+8
  1363.   env%=1
  1364.   form%=9
  1365.   per%=5000
  1366.   WAVE voice%,env%,form%,per%,30
  1367.   SOUND 0,0
  1368. CASE 7 ! woosh - once only
  1369.   voice%=256*16+8
  1370.   env%=1
  1371.   form%=12
  1372.   per%=1000
  1373.   WAVE voice%,env%,form%,per%,5
  1374.   SOUND 0,0
  1375. CASE 8
  1376.   SOUND 1,12,1,5,10
  1377.   SOUND 1,12,3,5,10
  1378.   SOUND 1,12,5,5,10
  1379.   SOUND 1,12,6,5,20
  1380.   SOUND 1,0
  1381. CASE 9! switch
  1382.   voice%=256*16+1+2+16
  1383.   env%=2
  1384.   form%=9
  1385.   per%=5000
  1386.   WAVE voice%,env%,form%,per%,1
  1387.   SOUND 0,12,#334250
  1388.   SOUND 0,0
  1389. CASE 10 ! red ball moving
  1390.   voice%=1
  1391.   env%=1
  1392.   per%=5000
  1393.   SOUND 0,13,1,6,0
  1394.   WAVE voice%,env%,9,per%,0
  1395. CASE 11 ! red ball moving
  1396.   voice%=1
  1397.   env%=1
  1398.   per%=5000
  1399.   SOUND 0,13,1,7,0
  1400.   WAVE voice%,env%,9,per%,0
  1401. CASE 12
  1402.   FOR i%=0 TO 3
  1403.     SOUND 0,12,#50+i%*5,1
  1404.   NEXT i%
  1405.   SOUND 0,0
  1406. ENDSELECT
  1407. RETURN
  1408. '
  1409. > PROCEDURE get_deskcolors
  1410. LOCAL i%
  1411. FOR i%=0 TO 15
  1412.   deskcolors%(i%)=XBIOS(7,i%,-1)
  1413. NEXT i%
  1414. RETURN
  1415. > PROCEDURE restore_deskcolors
  1416. LOCAL i%
  1417. FOR i%=0 TO 15
  1418.   SETCOLOR i%,deskcolors%(i%)
  1419. NEXT i%
  1420. RETURN
  1421. > PROCEDURE read_colorluts
  1422. LOCAL i%
  1423. RESTORE luts
  1424. FOR i%=0 TO 15
  1425.   READ luts&(i%)
  1426.   tabcolor%(i%)=i%
  1427. NEXT i%
  1428. ' note documentation error in GFA manual. Composite order is
  1429. ' BGR instead of RGB
  1430. luts:
  1431. DATA &H000,&H00c,&H08e,&H0ce,&H0ee,&H0ea,&H0e0,&H0a6
  1432. DATA &Ha80,&He00,&Ha06,&H008,&H080,&H800,&H066,&Heee
  1433. RETURN
  1434. > PROCEDURE vsetall
  1435. @read_colorluts
  1436. LOCAL i%
  1437. FOR i%=0 TO 15
  1438.   VSETCOLOR i%,luts&(tabcolor%(i%))
  1439. NEXT i%
  1440. RETURN
  1441. '
  1442. > PROCEDURE title_border
  1443. LOCAL i%,j%
  1444. titleput0%=RANDOM(12)
  1445. titleput1%=RANDOM(12)
  1446. FOR i%=0 TO 28
  1447.   FOR j%=0 TO 18
  1448.     IF j%<3 OR j%>14 OR i%<4 OR i%>24
  1449.       IF MOD(i%+j%,2)=0
  1450.         PUT celldim%*i%,celldim%*j%,cellpat$(titleput0%)
  1451.       ELSE
  1452.         PUT celldim%*i%,celldim%*j%,cellpat$(titleput1%)
  1453.       ENDIF
  1454.     ENDIF
  1455.   NEXT j%
  1456. NEXT i%
  1457. RETURN
  1458. > PROCEDURE show_parameter(num%)
  1459. ' show the current parameter in the top menu .
  1460. LOCAL xtxt%
  1461. xtxt%=90
  1462. GRAPHMODE 1
  1463. DEFFILL 0,1
  1464. SELECT num%
  1465. CASE 1
  1466.   TEXT xtxt%,(num%+4)*10,"Instructions"
  1467. CASE 3
  1468.   TEXT xtxt%+20,(num%+4)*10,"Level"
  1469.   PBOX xtxt%+65,(num%+3)*10+2,120+xtxt%,(num%+5)*10
  1470.   TEXT xtxt%+65,(num%+4)*10,STR$(file_num%)
  1471. CASE 5
  1472.   TEXT xtxt%+30,(num%+4)*10,"Start"
  1473. CASE 7
  1474.   TEXT xtxt%+30,(num%+4)*10,"Quit"
  1475. ENDSELECT
  1476. RETURN
  1477. > PROCEDURE show_all_parameters
  1478. ' display the menu with all its parameters.
  1479. LOCAL i%,x1%,y1%,r%
  1480. DEFTEXT 4,0,0,6
  1481. DEFFILL 0,1
  1482. PRBOX 0,0,319,199
  1483. @title_border
  1484. FOR i%=1 TO 7
  1485.   @show_parameter(i%)
  1486. NEXT i%
  1487. TEXT 55,135,"Please turn volume up."
  1488. RETURN
  1489. > PROCEDURE select_parameters
  1490. ' select and modify parameter using mouse.
  1491. LOCAL choice%,highlight%,key$
  1492. DEFFILL 0
  1493. ' select character height
  1494. DEFTEXT 1,0,0,6
  1495. ' clear screen
  1496. PBOX 0,0,319,199
  1497. highlight%=0
  1498. @show_all_parameters
  1499. SETMOUSE 10,185,0
  1500. REPEAT
  1501.   key$=""
  1502.   REPEAT
  1503.     key$=INKEY$
  1504.     SHOWM
  1505.     choice%=(MOUSEY-10)/10-2
  1506.     ' highlight if mouse moved to a new parameter
  1507.     IF highlight%<>choice%
  1508.       DEFTEXT 4,0
  1509.       show_parameter(highlight%)
  1510.       DEFTEXT 2,0
  1511.       show_parameter(choice%)
  1512.       highlight%=choice%
  1513.     ENDIF
  1514.     IF MOUSEK=0
  1515.       tim%=TIMER
  1516.     ENDIF
  1517.   UNTIL MOUSEK<>0 OR key$<>""
  1518.   ' left mouse button increases parameter value, right button decreases
  1519.   IF MOUSEK=1
  1520.     modify_parameter(choice%,1)
  1521.   ENDIF
  1522.   IF MOUSEK=2
  1523.     modify_parameter(choice%,-1)
  1524.   ENDIF
  1525.   IF choice%<>6
  1526.     show_parameter(choice%)
  1527.   ENDIF
  1528.   PAUSE 10
  1529.   IF key$="r"
  1530.     LOCATE 1,24
  1531.     PRINT titleput0%;" ";titleput1%;
  1532.   ENDIF
  1533. UNTIL choice%=8 OR choice%=7
  1534. DEFTEXT 1,0
  1535. RETURN
  1536. > PROCEDURE modify_parameter(num%,dir%)
  1537. ' raise or lower selected parameter withen limits.
  1538. '  LOCATE 1,1
  1539. '  PRINT num%;
  1540. SELECT num%
  1541. CASE 1
  1542.   @instructions
  1543. CASE 3
  1544.   file_num%=file_num%+dir%
  1545.   IF file_num%<0
  1546.     file_num%=0
  1547.   ENDIF
  1548. CASE 5
  1549.   @run_maze
  1550.   @show_all_parameters
  1551. CASE 7
  1552.   quit%=1
  1553. ENDSELECT
  1554. RETURN
  1555. > PROCEDURE instructions
  1556. CLS
  1557. PRINT "Collect the Gems  31-8-93"
  1558. PRINT
  1559. PRINT "Using the the joystick or"
  1560. PRINT "arrow keys, collect  the"
  1561. PRINT "gems in the maze and go to exit"
  1562. PRINT "before you run out of moves."
  1563. PRINT
  1564. PRINT "The Undo button restarts the current"
  1565. PRINT "maze. The Esc button quits the game."
  1566. PRINT "F10 goes on to the next level."
  1567. PRINT
  1568. PRINT "...Click mouse button to continue."
  1569. PAUSE 30
  1570. REPEAT
  1571. UNTIL MOUSEK<>0
  1572. CLS
  1573. PRINT
  1574. PRINT
  1575. PRINT "Programmed by Seymour Shlien"
  1576. PRINT "        624 Courtenay Avenue"
  1577. PRINT "       Ottawa, Canada K2A 3B5"
  1578. PRINT
  1579. PRINT "The program and the sources are public"
  1580. PRINT "domain."
  1581. PRINT
  1582. PRINT
  1583. PRINT "...Click mouse button to continue."
  1584. PAUSE 30
  1585. REPEAT
  1586. UNTIL MOUSEK<>0
  1587. CLS
  1588. @show_all_parameters
  1589. RETURN
  1590. > PROCEDURE load_help_data
  1591. LOCAL i%
  1592. RESTORE help_data
  1593. FOR i%=1 TO 7
  1594.   READ help$(i%)
  1595. NEXT i%
  1596. help_data:
  1597. DATA "How to play this game."
  1598. DATA "Level of difficulty."
  1599. DATA "Select starting maze."
  1600. DATA "Control joystick response."
  1601. DATA
  1602. DATA "Ready to go."
  1603. DATA "Exit to desktop."
  1604. RETURN
  1605. '
  1606. > PROCEDURE dosound
  1607. LOCAL i%
  1608. '  SPOKE &H484,PEEK(&H484) AND NOT 1
  1609. IF number_of_xbs_files%>0
  1610.   addr%=V:music_data&(0)
  1611.   ~XBIOS(32,L:addr%)
  1612. ENDIF
  1613. RETURN
  1614. > PROCEDURE read_sound
  1615. LOCAL a%,i%
  1616. IF EXIST("getslide.xbs") AND FRE(0)>100000
  1617.   OPEN "i",#1,"getslide.xbs"
  1618.   a%=LOF(#1)
  1619.   DIM music_data&(a%/2)
  1620.   BLOAD "getslide.xbs",VARPTR(music_data&(0))
  1621.   CLOSE #1
  1622.   number_of_xbs_files%=1
  1623. ELSE
  1624.   number_of_xbs_files%=0
  1625. ENDIF
  1626. RETURN
  1627. > PROCEDURE total_score
  1628. DEFFILL 3
  1629. PBOX 60,40,280,80
  1630. TEXT 70,50,"Your total score is "+STR$(score%)
  1631. TEXT 70,70,"Click mouse ..."
  1632. @dosound
  1633. STICK (0)
  1634. REPEAT
  1635. UNTIL MOUSEK<>0
  1636. RETURN
  1637.