home *** CD-ROM | disk | FTP | other *** search
/ Informática Multimedia: Special Games (Alt) / INFESPGAMES.iso / dos / 3dgames / xmas / data / guardsrc.4th < prev    next >
Encoding:
Text File  |  1995-02-07  |  2.6 KB  |  80 lines

  1. 0 constant ENEMTYPE ( 0=normal 1=erratic flying 2=smooth flying )
  2. 0 constant ENEMRANGE ( 0=max attack range, 7=only when touching player )
  3.  
  4. robodata mxrobo b/robo * -1 fill ( clear data to zeros )
  5.  
  6. : waitthenhunt
  7.    begin
  8.     10 sentryorhunt
  9.    0 until ;
  10.  
  11. : randompatrol
  12.   begin
  13.    2 randomwalk
  14.   intflag robostat@ if -1 huntflag robostat! trackdown then
  15.   0 until ;
  16.  
  17. : staystanding
  18.    begin
  19.     10 standandshoot
  20.    0 until
  21. ;
  22.  
  23. ' waitthenhunt constant 'nopatrol
  24. ' randompatrol constant 'randompatrol
  25. ' staystanding constant 'staystanding
  26.  
  27. ( 0 constant rbqk       ( quickness of a robot )
  28. ( 1 constant rbt1 ( temporary storage spot )
  29. ( 2 constant rbsp ( speed of a robot )
  30. ( 6 constant rbht ( mx hit pts *256 + current hit points )
  31. ( 7 constant rbgn ( gun strength* 256 + gun skill )
  32. ( 8 constant rbql ( unused * 256 + quality of guard in general )
  33. ( 9 constant rbal  ( current alertness of guard * 256 with fractional part )
  34.  
  35. ( [orders#] -- []  Sets a guards orders to 0=sentry then hunt )
  36. (                                          1=random patrol then hunt )
  37. (                                          2=stand and shoot w/o walking )
  38. : getorders  ?dup if
  39.      1 = if 'randompatrol else 'staystanding then
  40.      else 'nopatrol
  41.      then rstrt robo[]! ;
  42.  
  43. ( [quickness value] -- []  set this guard's quickness to value 1 thru 6 )
  44. : setspeed   1 max 6 min 256 * rbtmp robo[]! ;
  45.  
  46. ( [hitpts] -- []      Set this guard's hitpts to value 1 through 63 )
  47. : sethitpts  1 max 63 min 256 * rbht rbparm! ;
  48.  
  49. ( [gun skill]  [gun strength] -- []  Set guard's gun power and accuracy )
  50. (                                   !!!!!!!!! note this word takes *2* values! )
  51. : setgun     1 max 31 min 256 * + rbgn rbparm! ;
  52.  
  53. ( [alertness value] -- []    Set this guard's initial alertness value 10-127 )
  54. : setalert   10 max 127 min 256 * rbal rbparm! ;
  55.  
  56. ( [quality] -- []  Set the guard's quality to value from 0 thru 3 )
  57. (                  !!!!!! strange:  0=dumb  1=avg  2=great 3=vegetable )
  58. : setqual    0 max 3 min rbql rbparm@ $ff00 and or rbql rbparm! ;
  59.  
  60. ( [rangecode] -- []  Set the guard's attack range to value from 0 thru 7 )
  61. ( 0=max range,  7 = only when touching player )
  62. : setrange    0 max 7 min 8 << rbql rbparm@ $ff and or rbql rbparm! ;
  63.  
  64. : setdefaults
  65. 'nopatrol rstrt robo[]!
  66. ENEMTYPE rbtyp rbparm!
  67. ENEMRANGE setrange
  68. 3 256 * rbtmp robo[]!
  69. 0 rbt1 rbparm!
  70. 230 rbtmp 4 + robo[]!
  71. 4 256 * rbht rbparm!
  72. 64 256 * 16 + rbgn rbparm!
  73. 0 setqual
  74. 50 256 * 0 + rbal rbparm!
  75. ;
  76.  
  77. ( [guard#] -- []      Make this guard# the current guard for setting params )
  78. : setguard#  b/robo * curoboff !
  79.   setdefaults ;
  80.