home *** CD-ROM | disk | FTP | other *** search
/ Más de 2,500 Juegos / CD1.iso / ZIPDAT / 0951 / 0951.ZIP / RANDMAN3.AT2 < prev    next >
Encoding:
Text File  |  1997-02-27  |  7.0 KB  |  255 lines

  1. ;Randman.                Ed T. Toton III   02/11/92
  2. ;
  3. ;converted to ATR2 on 02/10/97,  Improved on 02/26/97
  4.  
  5. ; define vars
  6. #def armor
  7. #def hitcheck
  8. #def hit
  9. #def accuracy
  10. #def x
  11. #def y
  12.  
  13.  
  14. ; Settings...
  15.         mov     hitcheck  50
  16.         opo     17      6       ; scan-arc width is now 6
  17.         opo     13              ; aim turret forward.       (missing operands
  18.         opo     18              ; overburn off               are assumed 0's)
  19.         call    4000
  20.         opo     11      100     ; Throttle to 100%
  21.  
  22.         mov     ax,     1
  23.         int     3               ; turn keep-shift on.
  24.  
  25.  
  26. ; Main loop...
  27.  
  28. :1
  29.  
  30.         opo     11,     100     ; Throttle to 100%
  31.  
  32.  ;Shift 19
  33.         opo     12      11      ; Rotate turret right
  34.  
  35.  ;if enemy gosub 1000
  36.         ipo     7       ax      ; Scan!
  37.         cmp     ax      5000    ; find anything?
  38.         ja      2               ; if not, continue on...
  39.         call    1000            ; if so, let's shoot it.
  40. :2
  41.  ;if hit gosub 2000
  42.         mov     hit     0       ; hit=0
  43.         call    hitcheck        
  44.         cmp     hit     0       ; have we been shot?
  45.         je      3               ; if not, let's continue...
  46.         call    4000            ; if so, let's pick a new direction.
  47. :3
  48.  ;if heat>350 gosub 8999
  49.         ipo     2       ax      ; get heat into AX
  50.         cmp     ax      200     ; are we hotter than 200?
  51.         jls     4               ; if not, skip along..
  52.         call    8999            ; otherwise, let's run cool-down routine.
  53. :4
  54.  
  55.  ;if enemy gosub 1000
  56.         ipo     7       ax      ; scan!
  57.         cmp     ax      5000    ; find anything?
  58.         ja      5               ; if not, continue...
  59.         call    1000            ; if so, shoot him!! kill! Kill!!
  60. :5
  61.  
  62.        ;Get location
  63.         int     2               ; EX,FX = X,Y
  64.  
  65.        ;Scenario 1
  66.         cmp     ex      950     ; X>=950?
  67.         jb      11              ; If not, skip.
  68.         call    4001            ; If so, call scenario1
  69. :11
  70.        ;Scenario 2
  71.         cmp     ex      50      ; X<=50?
  72.         ja      12              ; If not, skip.
  73.         call    4002            ; If so, call scenario2
  74. :12
  75.        ;Scenario 3
  76.         cmp     fx      950     ; Y>=950?
  77.         jb      13              ; If not, skip.
  78.         call    4003            ; If so, call scenario3
  79. :13
  80.        ;Scenario 4
  81.         cmp     fx      50      ; Y<=50?
  82.         ja      14              ; If not, skip.
  83.         call    4004            ; If so, call scenario4
  84. :14
  85.  
  86. ;        ipo     1,      ax      ; Get currnt throttle
  87. ;        cmp     ax,     0       ; throttle>0?
  88. ;        ja      20              ; if so, skip
  89. ;        call    2000            ; if not, let's get moving!
  90. :20
  91. jmp 1
  92.  
  93.  
  94.  
  95. ; Shooting sub-routine...
  96. :1000
  97.  
  98.  ;fire
  99.         ipo     8       accuracy        ; get scan accuracy
  100.         mpy     accuracy,      3
  101.         opo     15      accuracy        ; fire using it!
  102.  
  103.  ;if hit gosub 2000
  104.         set     hit     0       ; hit=0
  105.         gsb     hitcheck
  106.         cmp     hit     0       ; have we been hit?
  107.         je      1001            ; if not, skip along
  108.         call    2000            ; otherwise, let's do something!
  109. :1001
  110.         ipo     2,      ax      ; get heat
  111.         cmp     ax,     100     ; over 100?
  112.         ja      1002            ; if so, let's not bother scanning.
  113.  
  114.  ;if enemy goto 1000
  115.         ipo     7       ax      ; scan again.
  116.         cmp     ax      1000    ; find anything?
  117.         jls     1000            ; if so, KILL! KILL!
  118.  
  119. :1002
  120.         call    2000            ; veer off
  121.  
  122.         ret                     ; Lost 'em... let's return...
  123.  
  124.  
  125.  
  126.  
  127. ;Veer off...
  128. :2000
  129.  
  130.  ;radnspin
  131.         gsb     4000
  132.  
  133.  ;Delay 9   &  move 100
  134.         del     9               ; Delay 9
  135.         opo     11      100     ; Throttle to 100%
  136.  
  137. ret
  138.  
  139.  
  140.  
  141.  
  142. ; Cool-down subroutine...
  143. :8999
  144.  
  145.  ;if heat>100 goto 8999
  146.         ipo     2       ax      ; ax=heat
  147.         cmp     ax      50      ; heat over 50?
  148.         jgr     8999            ; if so, keep checking it.
  149.                                 ; (a quaint shutdown routine)
  150. ret
  151.  
  152.  
  153.  
  154.  
  155. ;Hitcheck
  156. :50
  157.        ;read and compare armor
  158.         ipo     6       ax      ; get armor
  159.         cmp     ax      armor   ; has it changed?
  160.  
  161.        ;if no damage then simply exit.
  162.         jeq     51              ; no damage.. let's go
  163.  
  164.        ;if hit, then say so!
  165.         set     armor   ax      ; update armor variable
  166.         set     hit     1       ; register the hit.
  167. :51
  168. ret
  169.  
  170.  
  171.  
  172.  
  173. ;Randspin
  174. :4000
  175.         ;Randspin
  176.         ipo     10      ax      ; Get random number
  177.         and     ax      0xFF    ; now it is 0-255.
  178.  
  179.        ;Get location
  180.         int     5               ; EX,FX = X,Y
  181.  
  182.        ;Scenario 1
  183.         cmp     ex      950     ; X>950?
  184.         jae     4001            ; If so, scenario1.
  185.  
  186.        ;Scenario 2
  187.         cmp     ex      50      ; X<50?
  188.         jbe     4002            ; If so, scenario2.
  189.  
  190.        ;Scenario 3
  191.         cmp     fx      950     ; Y>950?
  192.         jae     4003            ; If so, scenario3.
  193.  
  194.        ;Scenario 4
  195.         cmp     fx      50      ; Y<50?
  196.         jbe     4004            ; If so, scenario4.
  197.  
  198.        ;Last resort (not near a wall)
  199.         opo     14      ax      ; use random heading chosen above.
  200.  
  201.         delay   10
  202.         opo     11      100     ; throttle to 100%
  203.  
  204. ret
  205. ;Scenario 1
  206. :4001
  207.         ipo     10,     ax      ; random number
  208.         and     ax      0x40    ; now it is 0-63.
  209.         add     ax      0xA0    ; now it is 160-223
  210.         call    5000            ; turn to that heading.
  211.         ret
  212. ;Scenario 2
  213. :4002
  214.         ipo     10,     ax      ; random number
  215.         and     ax      0x40    ; now it is 0-63.
  216.         add     ax,     0x20    ; now it is 32-95.
  217.         call    5000            ; turn to that heading.
  218.         ret
  219. ;Scenario 3
  220. :4003
  221.         ipo     10,     ax      ; random number
  222.         and     ax      0x40    ; now it is 0-63.
  223.         add     ax,     0E0h    ; now it is 224-287.
  224.         and     ax,     255     ; now it is 224-255 or 0-31.
  225.         call    5000            ; turn to that heading.
  226.         ret
  227. ;Scenario 4
  228. :4004
  229.         ipo     10,     ax      ; random number
  230.         and     ax      0x40    ; now it is 0-63.
  231.         add     ax,     60h     ; now it is 96-159.
  232.         call    5000            ; turn to that heading.
  233.         ret
  234.  
  235.  
  236. ;course-setting subroutine
  237. ;set course to heading in AX.
  238. :5000
  239.         mov     bx,     @1      ; get current desired heading
  240.                                 ; (not actual heading)
  241.         sub     ax,     bx      ; get number of degrees to turn.
  242.         opo     14,     ax      ; turn!
  243. :5001
  244.         ipo     3,      bx      ; bx = heading
  245.         cmp     bx,     @1      ; is heading equal to desired heading?
  246.         jne     5001            ; if not, wait until it is.
  247.         opo     11,     100     ; Throttle to 100%
  248.  
  249.         ipo     6       armor   ; update armor variable.
  250.  
  251.         ret
  252.  
  253.  
  254. ; End of program!!
  255.