source: abuse/trunk/data/lisp/ant.lsp @ 669

Last change on this file since 669 was 590, checked in by Sam Hocevar, 12 years ago

data: merge registered data into the main data directory.

File size: 19.5 KB
Line 
1;; Copyright 1995 Crack dot Com,  All Rights reserved
2;; See licensing information for more details on usage rights
3
4(setq ant_tints (make-array 13 :initial-contents (list
5                                                (def_tint "art/tints/ant/green.spe")
6                                                (def_tint "art/tints/ant/blue.spe")
7                                                (def_tint "art/tints/ant/brown.spe")
8                                                (def_tint "art/tints/ant/egg.spe")
9                                                (def_tint "art/tints/ant/yellow.spe")
10                                                (def_tint "art/tints/ant/mustard.spe")
11                                                (def_tint "art/tints/ant/orange.spe")
12                                                (def_tint "art/tints/ant/gray.spe")
13                                                (def_tint "art/tints/guns/green.spe")
14                                                (def_tint "art/tints/ant/darkblue.spe")
15                                                normal_tint
16                                                normal_tint
17                                                normal_tint
18                                                )))
19
20/*
21------ this code has been compiled --------
22(defun no_fall_move (xm ym but)
23  (move xm ym but))
24  (if (not (eq (gravity) 0))         ;; if we are in the air don't check for no fall
25      (move xm ym but)
26    (let ((oldx (x))
27          (oldy (y))
28          (ret (move xm ym but)))
29      (if (try_move 0 5)
30          (progn
31            (set_x oldx)
32            (set_y oldy)
33            (set_xacel 0)
34            (set_state stopped)
35            (set_xv 0)
36            (set_gravity 0)
37            0)
38        ret))))
39
40
41(defun will_fall_if_jump ()
42  nil)
43  (let ((dist (* (abs (get_ability jump_yvel)) (get_ability jump_xvel)))
44        (oldx (x))
45        (oldy (y))
46        )
47    (if (> (direction) 0)
48        (set_x (+ (x) dist))
49      (set_x (- (x) dist)))
50    (if (try_move 0 5)
51        (progn
52          (set_x oldx)
53          (set_y oldy)
54          T)
55      (progn
56        (set_x oldx)
57          (set_y oldy)
58        nil))))
59^^^^^^ this code has been compiled ^^^^^^^^
60*/
61
62
63(defun strait_rocket_ai ()
64  (set_course (aistate)
65              (select difficulty
66                      ('easy    12)
67                      ('medium  15)
68                      ('hard    17)
69                      ('extreme 22) ))
70  (set_frame_angle 0 359 (aistate))
71  (let ((stat (bmove nil)))
72    (if (eq stat T)
73        T
74    (progn
75      (if (not (eq stat nil))
76          (progn
77            (add_object EXPLODE3 (+ (x) (random 5)) (+ (y) (random 5)) 0)
78            (add_object EXPLODE2 (+ (x) (random 5)) (+ (y) (random 5)) 2)
79            (add_object EXPLODE3 (- (x) (random 5)) (- (y) (random 5)) 1)
80            (add_object EXPLODE3 (- (x) (random 5)) (- (y) (random 5)) 2)
81            (hurt_radius (x) (+ (y) 20) 25 15 nil 10)
82            )
83        (let ((myself (me)))
84          (with_object (add_object EG_EXPLO (x) (y)) (user_fun myself (car stat)))))
85      nil))))
86
87
88(def_char STRAIT_ROCKET
89  (funs (ai_fun strait_rocket_ai))
90  (range 10000 10000)
91  (flags (unlistable T))
92  (states "art/missle.spe" (stopped    (seq "b32r" 1 32))))
93
94(defun animate_ai () (next_picture))
95
96(defun eg_explo_ufun (creator block_flags)
97  (set_direction (with_object creator (direction)))
98  (if block_flags
99      (if (or (blocked_left block_flags) (blocked_right block_flags))
100          (set_state blocking))))
101
102(def_char EG_EXPLO
103  (funs (ai_fun   animate_ai)
104        (user_fun eg_explo_ufun))
105  (range 10000 10000)
106  (flags (unlistable T))
107  (states "art/missle.spe"
108          (stopped  (seq "bifl" 1 4))
109          (blocking (seq "bilw" 1 4))))
110
111/*
112------ this code has been compiled --------
113(defun alien_wait_time ()
114  (select difficulty
115          ('easy    6)
116          ('medium  4)
117          ('hard    2)
118          ('extreme 1)))
119
120(defun can_hit_player ()
121  (let ((firex (+ (x) (* (direction) 15)) )
122        (firey (- (y) 15))
123        (playerx (with_object (bg) (x)))
124        (playery (- (with_object (bg) (y)) 15)))
125    (can_see firex firey playerx playery nil)))
126
127(defun not_ant_congestion ()
128  (if (> (direction) 0)
129      (if (find_object_in_area (+ (x) 23) (- (y) 20) (+ (x) 30) (+ (y) 20) (list ANT_ROOF))
130          nil
131        T)
132    (if (find_object_in_area (- (x) 30) (- (y) 20) (- (x) 23) (+ (y) 20) (list ANT_ROOF))
133        nil
134      T)))
135
136
137(defun roof_above () (not (can_see (x) (y) (x) (- (y) 120) nil)))
138
139(defun fire_at_player ()
140  (let ((firex (+ (x) (* (direction) 15)) )
141        (firey (- (y) 15))
142        (playerx (+ (with_object (bg) (x)) (with_object (bg) (* (xvel) 8))))
143        (playery (+ (- (with_object (bg) (y)) 15) (with_object (bg) (* (yvel) 2)))))
144
145    (if (and (can_see (x) (y) firex firey nil) (can_see firex firey playerx playery nil))
146        (progn
147          (let ((angle (atan2 (- firey playery)
148                              (- playerx firex))))
149            (fire_object (me) (aitype) firex firey angle (bg))
150            (set_state weapon_fire))
151
152          ))))
153
154(defun ant_dodge ()
155  (if (eq need_to_dodge 1)
156      (progn
157        (setq need_to_dodge 0)
158        (if (eq (random 2) 1)
159            (progn
160              (set_state stopped)
161              (go_state 6))         ;; jump at player
162          (if (roof_above)
163              (progn
164                (set_yvel -17)  ;; jump up
165                (set_xvel 0)
166                (go_state 12))
167            (progn
168              (set_yvel -12)  ;; long jump
169              (set_xvel (* (direction) 20))
170              (set_aistate 6))))
171        T
172    nil)))
173
174(defun scream_check ()
175  (if (can_see (x) (y) (with_object (bg) (x)) (with_object (bg) (y)) nil)
176      (progn
177        (if (or (eq no_see_time 0) (> no_see_time 20))
178          (play_sound ASCREAM_SND 127 (x) (y)))
179        (setq no_see_time 1))
180    (setq no_see_time (+ no_see_time 1))))
181
182(defun ant_ai ()
183      (push_char 30 20)
184      (if (or (eq (state) flinch_up) (eq (state) flinch_down))
185          (progn (next_picture) T)
186        (progn
187
188          (select (aistate)
189                  (0   (set_state hanging)
190                       (if (eq hide_flag 0)
191                           (set_aistate 15)
192                         (set_aistate 16)))
193
194                  (15 ;; hanging on the roof waiting for the main character
195                   (if (next_picture) T (set_state hanging))
196                   (if (if (eq (total_objects) 0);; no sensor, wait for guy
197                           (and (< (distx) 130) (< (y) (with_object (bg) (y))))
198                         (not (eq (with_object (get_object 0) (aistate)) 0)))
199                       (progn
200                         (set_state fall_start)                  (set_direction (toward))
201                         (set_aistate 1))))
202
203                  (16 ;; hiding
204                   (set_state hiding)
205                   (if (if (eq (total_objects) 0);; no sensor, wait for guy
206                           (and (< (distx) 130) (< (y) (with_object (bg) (y))))
207                         (not (eq (with_object (get_object 0) (aistate)) 0)))
208                       (progn
209                         (set_state fall_start)                  (set_direction (toward))
210                         (set_aistate 1))))
211
212                  (1 ;; falling down
213                   (set_state falling)
214                   (scream_check)
215                   (if (blocked_down (move 0 0 0))
216                       (progn
217                         (set_state landing)
218                         (play_sound ALAND_SND 127 (x) (y))
219                         (set_aistate 9))))
220
221                  (9 ;; landing / turn around (gerneal finish animation state)
222                   (if (next_picture) T
223                     (if (try_move 0 2)
224                         (progn
225                           (set_gravity 1)
226                           (set_aistate 1))
227                       (progn (set_state stopped)
228                              (go_state 2)))))  ;; running
229
230                  (2 ;; running
231                   (scream_check)
232                   (if (eq (random 20) 0) (setq need_to_dodge 1))
233                   (if (not (ant_dodge))
234                     (if (eq (facing) (toward))
235                         (progn
236                           (next_picture)
237                           (if (and (eq (random 5) 0) (< (distx) 180) (< (disty) 100) (can_hit_player))
238                               (progn
239                                 (set_state weapon_fire)
240                                 (set_aistate 8))  ;; fire at player
241                             (if (and (< (distx) 100) (> (distx) 10) (eq (random 5) 0))
242                                 (set_aistate 4)  ;; wait for pounce
243
244                               (if (and (> (distx) 140)
245                                        (not_ant_congestion)
246                                        (not (will_fall_if_jump)))
247                                   (set_aistate 6)
248
249                                 (if (> (direction) 0)
250                                     (if (and (not_ant_congestion) (blocked_right (no_fall_move 1 0 0)))
251                                         (set_direction -1))
252                                   (if (and (not_ant_congestion) (blocked_left (no_fall_move -1 0 0)))
253                                       (set_direction 1)))))))
254                           (progn
255                             (set_direction (toward))
256                             (set_state turn_around)
257                             (set_aistate 9)))))
258
259                  (4 ;; wait for pounce
260                   (if (ant_dodge) T
261                     (progn
262                       (set_state pounce_wait)
263                       (move 0 0 0)
264                       (if (> (state_time) (alien_wait_time))
265                           (progn
266                             (play_sound ASLASH_SND 127 (x) (y))
267                             (set_state stopped)
268                             (go_state 6))))))
269
270                  (6 ;; jump
271                   (setq need_to_dodge 0)
272                   (if (blocked_down (move (direction) -1 0))
273                       (progn
274                         (set_aistate 2))))
275
276                  (8 ;; fire at player
277                   (if (ant_dodge) T
278                     (if (eq (state) fire_wait)
279                         (if (next_picture)
280                             T
281                           (progn
282                             (fire_at_player)
283                             (set_state stopped)
284                             (set_aistate 2)))
285                       (set_state fire_wait))))
286
287                  (12 ;; jump to roof
288                   (setq need_to_dodge 0)
289                   (set_state jump_up)
290                   (set_yvel (+ (yvel) 1))
291                   (set_xacel 0)
292                   (let ((top (- (y) 31))
293                         (old_yvel (yvel))
294                         (new_top (+ (- (y) 31) (yvel))))
295                     (let ((y2 (car (cdr (see_dist (x) top (x) new_top)))))
296                       (try_move 0 (- y2 top) nil)
297                       (if (not (eq y2 new_top))
298                           (if (> old_yvel 0)
299                             (progn
300                               (set_state stopped)
301                               (set_aistate 2))
302                           (progn
303                             (set_state top_walk)
304                             (set_aistate 13)))))))
305
306                  (13 ;; roof walking
307                   (scream_check)
308                   (if (or (and (< (y) (with_object (bg) (y)))
309                                (< (distx) 10) (eq (random 8) 0))
310                           (eq need_to_dodge 1))  ;; shooting at us, fall down
311                       (progn
312                         (set_gravity 1)
313                         (set_state run_jump)
314                         (go_state 6))
315                     (progn
316                       (if (not (eq (facing) (toward)))        ;; run toward player
317                           (set_direction (- 0 (direction))))
318                       (if (and (< (distx) 120) (eq (random 5) 0))
319                           (progn
320                             (set_state ceil_fire)
321                             (go_state 14))
322                         (let ((xspeed (if (> (direction) 0) (get_ability run_top_speed)
323                                         (- 0 (get_ability run_top_speed)))))
324                           (if (and (can_see (x) (- (y) 31) (+ (x) xspeed) (- (y) 31) nil)
325                                    (not (can_see (+ (x) xspeed) (- (y) 31)
326                                                  (+ (x) xspeed) (- (y) 32) nil)))
327                               (progn
328                                 (set_x (+ (x) xspeed))
329                                 (if (not (next_picture))
330                                     (set_state top_walk)))
331                             (set_aistate 1)))))))
332
333
334                  (14 ;; cieling shoot
335                   (if (next_picture)
336                       T
337                     (progn
338                       (fire_at_player)
339                       (set_state top_walk)
340                       (set_aistate 13))))
341
342                  )))
343
344      T)
345*/
346
347
348(defun create_dead_parts (array part_num type)
349  (let ((dir  (direction))
350        (rand (rand_on)))
351    (with_object (add_object (aref array part_num) (x) (y))
352               (progn (set_aitype type)
353                      (set_xvel (* dir (random 10)))
354                      (set_yvel (- 0 (random 25)))))
355    (with_object (add_object (aref array (+ part_num 1)) (x) (y))
356               (progn (set_aitype type)
357                      (set_xvel (* dir (random 10)))
358                      (set_yvel (- 0 (random 25)))))
359    (with_object (add_object (aref array (+ part_num 2)) (x) (y))
360               (progn (set_aitype type)
361                      (next_picture)                        ;; unsync the animations
362                      (set_xvel (* dir (random 10)))
363                      (set_yvel (- 0 (random 25)))))
364    (with_object (add_object (aref array (+ part_num 2)) (x) (y))
365               (progn (set_aitype type)
366                      (next_picture)
367                      (next_picture)
368                      (set_xvel (* dir (random 10)))
369                      (set_yvel (- 0 (random 25)))))
370    (with_object (add_object (aref array (+ part_num 2)) (x) (y))
371               (progn (set_aitype type)
372                      (next_picture)
373                      (next_picture)
374                      (next_picture)
375                      (set_xvel (* dir (random 10)))
376                      (set_yvel (- 0 (random 25)))))
377    (set_rand_on rand)))   ;; restore random table, in case this didn't get called because of frame panic
378
379
380(enum 'decay_part
381      'flaming_part
382      'electric_part
383      'normal_part)
384
385(defun get_dead_part (from)
386  (if from
387      (let ((type (with_object from (otype))))
388        (if (or (eq type GRENADE) (eq type ROCKET) (eq type FIREBOMB))
389            flaming_part
390          (if (or (eq type PLASMAGUN_BULLET) (eq type LSABER_BULLET))
391              electric_part
392            normal_part)))
393    normal_part)
394
395)
396
397
398(defun ant_damage (amount from hitx hity push_xvel push_yvel)  ; transfer damage to lower half
399
400  (if (and (not (eq (state) dead))
401           (or (not from)
402               (with_object from (if (eq (total_objects) 0)
403                                     (not (eq (otype) ANT_ROOF))
404                                   (with_object (get_object 0) (not (eq (otype) ANT_ROOF)))))))
405      (if (not (eq (aistate) 15))
406          (progn
407            (if (eq (random 2) 0)
408                (set_state flinch_up)
409              (set_state flinch_down))
410            (damage_fun amount from hitx hity push_xvel push_yvel)
411            (play_sound APAIN_SND 127 (x) (y))
412            (setq need_to_dodge 1)
413            (if (<= (hp) 0)
414                (progn
415                  (if (eq (aitype) 0)
416                      (play_sound (aref ASML_DEATH (random 2)) 127 (x) (y))
417                    (play_sound (aref ALRG_DEATH (random 3)) 127 (x) (y)))
418
419                  (set_state dead)
420                  (if (eq (random (select difficulty
421                                          ('easy 2)
422                                          ('medium 5)
423                                          ('hard   8)
424                                          ('extreme 20))) 0)
425                      (if (eq (random 4) 0)
426                          (add_object (aitype_to_ammo (+ (aitype) 1)) (x) (y)))
427                    (add_object (aitype_to_ammo (aitype)) (x) (y)))
428                  (create_dead_parts ant_dead_parts (* (get_dead_part from) 3) (aitype)))
429                  )))))
430
431(defun ant_cons ()
432  (set_state hanging)
433  (setq no_see_time 300))
434
435(defun ant_ct ()
436  (select (aitype)
437          (0 (set_hp 15))
438          (1 (set_hp 50))
439          (2 (set_hp 25))
440          (3 (set_hp 35))
441          (4 (set_hp 35))
442          (5 (set_hp 20))
443
444          ))
445
446
447;; XXX: Mac Abuse reimplements this in C++
448(defun ant_draw ()
449  (if (eq 0 (aitype))
450      (draw)
451    (draw_tint (aref ant_tints (aitype)))))
452
453(def_char ANT_ROOF
454  (vars need_to_dodge
455        no_see_time
456        hide_flag)
457  (fields
458          ("hide_flag"    ant_hide)
459          ("fade_count"   ai_fade)
460          ("aitype"       ai_type)
461          ("hp"           ai_health)
462          ("aistate"      ai_state))
463  (range 250 20)
464  (draw_range 40 40)
465  (funs (ai_fun     ant_ai)
466        (draw_fun   ant_draw)
467        (constructor ant_cons)
468        (type_change_fun ant_ct)
469        (get_cache_list_fun ant_cache)
470        (damage_fun ant_damage))
471
472  (abilities (run_top_speed   7)
473             (start_hp       20)
474             (stop_acel      20)
475             (start_acel     20)
476             (jump_yvel      -4)
477             (jump_xvel      20)
478             (push_xrange     1)
479             (jump_top_speed 20))
480
481  (flags (hurtable  T)
482         (force_health T))
483
484  (states "art/ant.spe"
485          (hanging (rep "ant" 2))
486
487          (fall_start "affc0001.pcx")
488          (falling    "affc0002.pcx")
489
490          (stopped "awlk0001.pcx")
491          (running (seq "awlk" 1 10))
492          (landing (seq "acff" 1 4))
493          (pounce_wait "acff0001.pcx")
494          (turn_around (seq "atrn" 1 5))
495
496          (run_jump "dive")
497          (run_jump_fall "dive")
498          (start_run_jump "dive")
499          (fire_wait (seq "wait" 1 3))
500
501          (ceil_fire (seq "cfire" 1 3))
502          (top_walk  (seq "awkc" 1 10))
503          (flinch_up (rep "afh10001.pcx" 2))
504          (flinch_down (rep "afh20001.pcx" 2))
505          (blown_back_dead     "adib0009.pcx")
506          (jump_up            "ajmp.pcx")
507          (hiding             "hidden")
508          (dead             "hidden")
509          (weapon_fire  (seq "asht" 2 5))))
510
511
512(def_char HIDDEN_ANT
513  (funs (ai_fun     ant_ai)
514        (draw_fun   dev_draw))
515  (flags (unlistable T))
516  (vars need_to_dodge
517        no_see_time
518        hide_flag)
519  (states "art/ant.spe" (stopped "hidden")))
520
521
522
523
524(defun crack_ai ()
525  (if (eq (aistate) 0)
526      (if (if (eq (total_objects) 0)
527              (and (< (distx) 50) (< (disty) 70))
528            (with_object (get_object 0) (not (eq (aistate) 0))))
529          (set_aistate 1))
530    (select (current_frame)
531            (4 nil)
532            (3
533             (let ((d (direction))
534                   (type (aitype)))
535               (if (or (eq create_total 0) (eq create_total 1))
536                   (set_current_frame 4)
537                 (progn
538                   (setq create_total (- create_total 1))
539                   (set_current_frame 0)))
540               (with_object (add_object_after ANT_ROOF (+ (x) (* (direction) 20)) (y))
541                            (progn
542                              (set_aitype type)
543                              (set_direction d)
544                              (set_xvel (* d 20))
545                              (set_state run_jump)
546                              (set_aistate 6)))
547               ))
548            (0 (next_picture))
549            (1 (next_picture))
550            (2 (next_picture))))
551  T)
552
553
554(defun crack_cons ()
555  (setq create_total 1)
556  (set_aitype 1))
557
558
559(def_char ANT_CRACK
560  (funs (ai_fun crack_ai)
561        (draw_fun ant_draw)
562        (get_cache_list_fun ant_cache)
563        (constructor crack_cons))
564  (range 250 0)
565  (vars create_total)
566  (fields ("create_total"  ant_total)
567          ("aitype"        ant_type))
568  (states "art/ant.spe"
569          (stopped (seq "aisw" 2 6))))
570
571
572(defun head_ai ()
573  (select (aistate)
574          (0 ;; falling
575           (next_picture)
576           (set_yvel (+ (yvel) 3))
577           (bounce_move T T T '(progn (set_state dieing) (set_aistate 1)) T)
578           (or (< (state_time) 15)
579               (not (frame_panic))))
580          (1 ;; hit the ground
581           nil)
582          ))
583
584(setq ant_dead_parts (make-array (* 3 4) :initial-contents
585                             '((AD_1  "adbn") (AD_2  "adha") (AD_3  "adla")     ; disapear
586                               (AD_4  "adaf") (AD_5  "adah") (AD_6  "adlf")     ; flaming
587                               (AD_7  "adbe") (AD_8  "adhe") (AD_9  "adle")     ; electrical
588                               (AD_10 "adan") (AD_11 "adhn") (AD_12 "adln"))))  ; normal
589
590
591(defun ant_cache (type)  ;; cache in the ant (from crack) and the dead body parts and the ant tints
592  (list
593   (list ANT_ROOF AD_1 AD_2 AD_3 AD_4 AD_5 AD_6 AD_7 AD_8 AD_9 AD_10 AD_11 AD_12)
594   (list (aref ant_tints 0) (aref ant_tints 1) (aref ant_tints 2) (aref ant_tints 3)
595         (aref ant_tints 4) (aref ant_tints 5) (aref ant_tints 6) (aref ant_tints 7)
596         (aref ant_tints 8) (aref ant_tints 9) (aref ant_tints 10))))
597
598
599
600(defun make_dead_part (sym base frames filename draw)
601  (eval `(def_char ,sym
602           (range 100 100)
603           (funs (ai_fun    head_ai)
604                 (draw_fun  ,draw))
605           (flags (unlistable T)
606                  (add_front T))
607           (states filename
608                  (stopped (seq base 1 ,frames))))))
609
610
611(do ((i 0 (setq i (+ i 1))))
612           ((>= i 12) nil)
613           (setq (aref ant_dead_parts i)
614                 (make_dead_part (car (aref ant_dead_parts i))
615                                 (car (cdr (aref ant_dead_parts i))) 4 "art/ant.spe" 'ant_draw)))
616
617
618
619(defun boss_damage (amount from hitx hity push_xvel push_yvel)
620  (if (and (eq (fade_count) 0) (not (eq (aistate) 0)) (< (aitype) 6))
621      (progn
622        (damage_fun amount from hitx hity push_xvel push_yvel)
623        (if (eq (hp) 0)
624            (progn
625              (set_hp 1)
626              (set_aitype (+ (aitype) 1))
627              (if (eq (aitype) 6)         ;; go to next alien type
628                  (set_aistate 10)        ;; end game
629                (set_aistate 5)))))))         ;; fade out
630
631(defun boss_cons ()
632  (set_hp 1)
633  (setq taunt_time 20))
634
635(defun boss_fire ()
636  (let ((firex (+ (x) (* (direction) 17)) )
637        (firey (- (y) 25))
638        (playerx (+ (with_object (bg) (x)) (with_object (bg) (* (xvel) 8))))
639        (playery (+ (- (with_object (bg) (y)) 15) (with_object (bg) (* (yvel) 2)))))
640
641    (if (and (can_see (x) (y) firex firey nil) (can_see firex firey playerx playery nil))
642        (progn
643          (let ((angle (atan2 (- firey playery)
644                              (- playerx firex))))
645            (fire_object (me) (aitype) firex firey angle (bg))
646            (set_state weapon_fire))
647
648          ))))
649
650
651(defun boss_ai ()
652  (if (total_objects)
653
654      (if (eq (aistate) 11)
655          nil
656        (progn
657          (select (aistate)
658                  (0;; wait for turn on
659                   (set_state hiding);; can't see us
660                   (set_targetable nil)
661                   (if (activated)
662                       (set_aistate 1)))
663                  (1;; taunt for a while
664                   (set_targetable nil)
665                   (if (eq taunt_time 0)
666                       (progn
667                         (set_fade_count 14)
668                         (set_state stopped)
669                         (play_sound APPEAR_SND 127 (x) (y))
670                         (set_aistate 2)));; fade in
671                   (progn
672                     (setq taunt_time (- taunt_time 1))
673                     (if (eq (mod taunt_time 25) 0)
674                         (play_sound TAUNT_SND 127 (x) (y)))))
675
676                  (2;; fade in
677                   (set_direction (toward))
678                   (if (eq (fade_count) 0)
679                       (progn
680                         (set_state weapon_fire)
681                         (go_state 3))
682                     (set_fade_count (- (fade_count) 2))))
683
684                  (3;; wait to fire
685                   (set_targetable T)
686                   (if (next_picture) T
687                     (go_state 4)))
688
689                  (4;; fire1
690                   (boss_fire)
691                   (set_aistate 5)
692                   (set_state weapon_fire))
693
694                  (5;; wait to fire
695                   (set_targetable T)
696                   (if (next_picture) T
697                     (go_state 6)))
698
699                  (6;; fire1
700                   (boss_fire)
701                   (set_aistate 7)
702                   (set_state stopped))
703
704                  (7;; fade out
705                   (set_targetable nil)
706                   (set_fade_count (+ (fade_count) 2))
707                   (if (eq (fade_count) 14)
708                       (progn
709                         (set_state hiding)
710                         (let ((to_object (get_object (random (total_objects)))))
711                           (set_x (with_object to_object (x)))
712                           (set_y (with_object to_object (y))))
713                         (setq taunt_time (- 30 (* (aitype) 2)))
714                         (go_state 0))))
715
716                  (10;; game over
717                   (set_state hiding)
718                   (set_targetable nil)
719                   (if (eq (state_time) 60)
720                       (go_state 11))
721                   (if (not (eq (state_time) 0))
722                       (progn
723                         (if (eq (mod (state_time) 8) 0)
724                             (play_sound GRENADE_SND 127 (x) (y)))
725                         (add_object EXPLODE1 (+ (x) (random (* (state_time) 2))) (+ (random (state_time)) (y)))
726                         (add_object EXPLODE1 (- (x) (random (* (state_time) 2))) (- (y) (random (state_time)))))))
727                  )
728
729          T))))
730
731
732
733(def_char BOSS_ANT
734  (funs (ai_fun boss_ai)
735        (draw_fun ant_draw)
736        (damage_fun boss_damage))
737  (vars taunt_time)
738  (flags (hurtable T)
739         (unlistable T))
740  (fields ("taunt_time" "taunt_tint")
741         ("aistate" "aistate"))
742  (states  "art/boss.spe"
743   (stopped "awlk0001.pcx")
744   (hiding  "hidden")
745   (weapon_fire  (seq "asht" 2 5))))
746
Note: See TracBrowser for help on using the repository browser.