source: abuse/trunk/data/addon/claudio/oldclaud.lsp @ 590

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

data: remove exact duplicate Lisp files, merge all main space Lisp files,
and move most frabs addons to the main data directory.

File size: 50.3 KB
Line 
1/******************************************************************************************
2*                                                                                         *
3* New characters and tiles by                                                             *
4* Claudio Bolzoni, version 1.5,    claudio.bolzoni@mbox300.swipnet.se                     *
5*                                                                                         *
6* NOTE: This and all other files by Claudio Bolzoni contained in the archive              *
7* claudio(1.5).zip  can be used and modified freely for non-commercial purposes,          *
8* but credits must be given to the author.                                                *
9* If you intend to distribute any file, however, contact Claudio Bolzoni.                 *
10* If you want to use work done by other people than Claudio Bolzoni, contact the author   *
11* of that work (credits are given to those authors in this file).                         *
12*                                                                                         *
13*                                                                                         *
14*                                                                                         *
15******************************************************************************************/
16
17
18
19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
20;;                                                                                       ;;
21;; SOUNDS                                                                                ;;
22;;                                                                                       ;;
23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
24
25
26(def_sound 'DROIDMOV_SND    (sfxdir "Apain01.wav"))
27(def_sound 'TREX1_SND    "addon/claudio/trex1.wav")
28(def_sound 'STOMP_SND    (sfxdir "poof06.wav"))
29(def_sound 'TREX2_SND    "addon/claudio/trex2.wav")
30(def_sound 'TREX3_SND    (sfxdir "Adie03.wav"))
31(def_sound 'FIRE_SND    "addon/claudio/fire.wav")
32(def_sound 'SWISH_SND    "addon/claudio/spaceo.wav")
33(def_sound 'SEWER1_SND    "addon/claudio/sewers.wav")
34(def_sound 'GLASS1_SND    "addon/claudio/glass1.wav")
35(def_sound 'UNHEALTH_UP_SND    "addon/claudio/unhealth.wav")
36(def_sound 'WFALL_SND    "addon/claudio/wfall.wav")
37(def_sound 'DRILL_SND    "addon/claudio/drill.wav")
38(def_sound 'SKULL_SND    "addon/claudio/skull.wav")
39(def_sound 'ASHIP_SND    "addon/claudio/aship.wav")
40
41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
42;;                                                                                       ;;
43;; CHAR 1: droid - jugger version                                                        ;;
44;;                                                                                       ;;
45;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
46
47(defun droidjug_ai ()
48  (if (<= (hp) 0);;*
49      (if (eq (state) dieing)
50          (next_picture)
51          (set_state dieing)
52      )
53       (if (activated);; **
54             (progn       ;; ***
55               (set_targetable T)
56               (push_char 35 40)
57               (select (aistate)
58
59                    (0 ;; prepare to walk toward player
60                       (if (eq stationary 0)
61                         (progn
62                              (set_state running)
63                              (go_state 1)
64                     )
65                         (if (> (state_time) (aitype))
66                              (progn
67                                 (set_state weapon_fire)
68                                 (set_aistate 2)
69                         )
70                     )
71                   )
72                 );;end aistate 0
73
74                  (1 ;; walk toward player
75                   (if (eq stationary 0)
76                     (progn
77                         (set_direction (toward))
78                       (let (
79                         (curx (x));; save position in case we fall off a cliff
80                               (cury (y))
81                        )
82                       (if (next_picture)
83                            (if (eq (current_frame) 8)
84                                  (play_sound DROIDMOV_SND 127 (x) (y))
85                      )
86                            (progn
87                               (play_sound DROIDMOV_SND 127 (x) (y))
88                               (set_state weapon_fire)
89                               (set_aistate 2)
90                      )
91                   )
92                       (if (can_see (x) (y) (x) (+ (y) 5) nil)
93                           (progn
94                                 (set_x curx)
95                                 (set_y cury)
96                                 (try_move 0 10)
97                     )
98                   )
99                 )
100                )
101                    (if (> (state_time) (aitype))
102                         (progn
103                           (set_state weapon_fire)
104                           (set_aistate 2)
105                   )
106                 )
107               )
108              );; end aistate 1
109
110                  (2 ;; start fire
111                   (if (> (state_time) 3)
112                       (let (
113                        (myself (me))
114                              (xspeed (* throw_xvel (direction)))
115                              (yspeed throw_yvel)
116                         )
117                         (with_object
118                        (add_object GRENADE (+ (x) (* (direction) 16)) (- (y) 24) 1)
119                                (progn
120                                (user_fun myself)
121                                  (set_xvel xspeed)
122                                  (set_yvel yspeed)
123                        )
124                   )
125                         (go_state 3)
126               )
127                   (next_picture)
128               )
129             );; end aistate 2
130
131             (3 ;; wait for fire animation
132                   (if (next_picture) nil (set_aistate 0))
133              );; end aistate 3
134           );; end select
135          T);; end *** progn
136      (progn (set_targetable nil)
137        T)
138);; end ** if
139);; end * if
140);; end droidjug_ai ()
141
142(defun jug_cons ()
143  (setq throw_xvel 13)
144  (setq throw_yvel -10)
145  (set_aitype 10))
146
147(defun explo_damage_cache (type)
148  (list (list EXPLODE6) nil))
149
150(def_char DROID_JUGGER
151  (range 200 0)
152  (funs (ai_fun     droidjug_ai)
153        (constructor jug_cons)
154        (get_cache_list_fun explo_damage_cache)
155        (damage_fun explo_damage))
156  (flags (hurtable T)(unactive_shield T))
157  (abilities (start_hp    50)
158             (push_xrange 1))
159  (vars throw_xvel throw_yvel stationary)
160  (fields ("hp"            ai_health)
161          ("aitype"        jug_throw_spd)
162          ("throw_xvel"    jug_throw_xv)
163          ("throw_yvel"    jug_throw_yv)
164          ("stationary"    jug_stat)
165          ("aistate"       ai_state))
166
167  (states "addon/claudio/droid.spe"
168          (stopped "ds0002.pcx")
169          (running (seq "d" 1 4))
170          (weapon_fire (seq "df" 1 10))
171          (dieing (seq "dd" 1 8))))
172
173;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
174;;                                                                                       ;;
175;; CHAR 2: droid - walking version                                                       ;;
176;;                                                                                       ;;
177;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
178
179(defun burst_fire (firex firey angle)
180
181  (if (> fire_time 0);; if we need to wait till next burst
182      (progn
183        (setq fire_time (- fire_time 1))
184        (if (eq fire_time 0)
185            (progn
186              (setq burst_left burst_total)
187              (setq burst_wait 0))))
188    (if (eq burst_wait 0)
189        (progn
190          (if (or (eq burst_left 1) (eq burst_left 0))
191              (setq fire_time fire_delay)
192            (setq burst_left (- burst_left 1)))
193          (setq burst_wait burst_delay)
194          (fire_object (me) (aitype) firex firey angle (bg)))
195      (setq burst_wait (- burst_wait 1)))))
196
197(defun wrob_cons ()
198  (setq fire_delay 4)
199  (setq burst_delay 1)
200  (setq max_xvel 10)
201  (setq max_yvel 5)
202  (set_aitype 0)
203  ;;(set_hp 70)
204  (setq burst_total 5)
205);; end wrob_cons
206
207(defun droid_ai ()
208  (if (<= (hp) 0) ;; *
209
210      (if (eq (state) dieing)
211          (next_picture)
212          (set_state dieing)
213       )
214
215       (if (activated)         ;; **
216          (progn                  ;;***
217               (set_targetable T)
218               (push_char 35 40)
219             (select (aistate)
220                  (0;; walk toward player
221                    (if (or  (> (distx) 120) (or (<(disty) -5)(>(disty) 20)) (not (eq (direction) (toward))))
222                         (progn
223                          (if (eq (mod (state_time) 6) 0)        ;; play sound every 6 ticks
224                            (play_sound DROIDMOV_SND 127 (x) (y))
225                        )
226                            (move (toward) 0 0)
227                            (next_picture)
228                     )
229                         (progn
230                            (set_state stopped)
231                            (set_aistate 1)
232                     )
233                  )
234                 );; end aistate 0
235
236                  (1;; stop and fire
237                     (burst_fire  (+ (x) (* (direction) 16)) (- (y) 22)
238                            (if (> (direction) 0)
239                                (mod (- 375 (/ (* burst_left 30) burst_total)) 360)
240                              (+ 165 (/ (* burst_left 30) burst_total))
241                       )
242                    )
243                      (if (not (eq fire_time 0))
244                            (set_aistate 0)
245                    )
246                );; end aistate 1
247             );; end select
248
249               (if (<= (hp) 0)                        ;; are we dead, if so blow up
250                   (progn
251                        (add_object EXPLODE6 (+ (x) 5) (- (y) 10)     0)
252                        (add_object EXPLODE6 (+ (x) -5) (- (y) 15)    2)  ;; wait 2 frames before appearing
253                        (add_object EXPLODE6 (+ (x) 10) (- (y) 2)     1)
254                        (add_object EXPLODE6 (+ (x) -10) (- (y) 20)   3)
255                        (add_object EXPLODE6 (+ (x) 20) (- (y) 27)    4)
256                        (add_object EXPLODE6 (+ (x) -25) (- (y) 30)   2)
257                        (add_object EXPLODE6 (+ (x) 20) (- (y) 5)     4)
258                        (add_object EXPLODE6 (+ (x) -3) (- (y) 1)     5)
259                        (set_aistate 0)
260                  )
261             )
262
263      T);; end of *** progn
264    T);; end of ** if activated
265  );; end of * if
266);; end of ai
267
268(def_char DROID
269
270  (funs (ai_fun droid_ai)
271          (constructor wrob_cons)
272          (get_cache_list_fun explo_damage_cache)
273        (damage_fun explo_damage)
274  );; end funs
275
276  (abilities (run_top_speed 8)
277             (start_hp 70)
278  );; end abilities
279
280  (flags (hurtable T)
281         (can_block T)
282         (unactive_shield T)
283  );; end flags
284
285  (range 300 100)
286
287  (vars fire_delay
288        burst_delay
289        burst_total
290        burst_wait
291        burst_left
292          max_xvel
293        max_yvel
294        smoke_time
295        fire_time
296  );; end vars
297
298  (fields ("fire_delay"   wrob_fdelay)
299          ("burst_delay"  wrob_bdelay)
300          ("burst_total"  wrob_btotal)
301          ("max_xvel"     wrob_mxv)
302          ("max_yvel"     wrob_myv)
303          ("hp"           ai_health)
304          ("aitype"       ai_type)
305          ("aistate"      ai_state)
306  );; end fields
307
308  (states "addon/claudio/droid.spe"
309          (stopped "ds0001.pcx")
310          (running (seq "d" 1 10))
311          (start_run_jump "d0001.pcx")
312          (flinch_up      "ds0002.pcx")
313          (run_jump       "d0003.pcx")
314          (dieing (seq "dd" 1 8))
315  );; end states
316
317);; end def_char DROID
318
319;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
320;;                                                                                       ;;
321;; CHAR 3: Tyrannosaurus Rex                                                              ;;
322;;                                                                                       ;;
323;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
324
325(defun trex_ai ()
326  (if (<= (hp) 0) ;; *
327
328      (if (eq (state) dieing)
329        (progn
330             (next_picture)
331             (play_sound TREX3_SND 127 (x) (y))
332        )
333          (set_state dieing)
334
335       )
336
337       (if (activated)         ;; **
338          (progn                  ;;***
339               (set_targetable T)
340             (if (and (touching_bg) (eq (mod (state_time) 20) 0))
341                (do_damage 10 (bg)))
342             (select (aistate)
343                  (0;; walk toward player
344                     (if  (or (< (disty) -5) (> (disty) 5) (< (distx) -10) (> (distx) 10) (not (eq (direction) (toward))) )
345                       (progn
346                          (if (eq (mod (state_time) 6) 0) ;; play sound every 6 ticks
347                            (play_sound JSTOMP_SND 60 (x) (y))
348                        )
349                          (if (eq (mod (state_time) 235) 0)        ;; play sound every 235 ticks
350                            (play_sound TREX1_SND 127 (x) (y))
351                        )
352                              (move (toward) 0 0)
353                              (next_picture)
354                       )
355                         ;; (progn
356                            (set_aistate 1)
357                   ;;   )
358                     )
359                 );; end aistate 0
360
361                  (1;; stop and eat
362                    (if  (or (< (disty) -5) (> (disty) 5) (< (distx) -10) (> (distx) 10) (not (eq (direction) (toward))) )
363                       (set_aistate 0)
364                       (progn
365                          (set_state eating)
366                          (if (eq (mod (state_time) 66) 0)     ;; play sound every 66 ticks
367                              (play_sound TREX2_SND  127 (x) (y))
368                          )
369                        )
370                      )
371                    (with_object (bg)
372                      (if (< (hp)0)
373                            (set_state stopped)
374                      )
375                     )
376                );; end aistate 1
377             );; end select
378      T);; end of *** progn
379    T);; end of ** if activated
380  );; end of * if
381);; end of ai
382
383(def_char T_REX
384
385  (funs (ai_fun trex_ai)
386        ;;  (constructor wrob_cons)
387        ;;  (get_cache_list_fun explo_damage_cache)
388      ;;  (damage_fun explo_damage)
389  );; end funs
390
391  (abilities (run_top_speed 8)
392             (start_hp 70)
393  );; end abilities
394
395  (flags (hurtable T)
396         (can_block T)
397         (unactive_shield T)
398  );; end flags
399
400  (range 300 100)
401
402  (vars fire_delay
403        burst_delay
404        burst_total
405        burst_wait
406        burst_left
407          max_xvel
408        max_yvel
409        smoke_time
410        fire_time
411  );; end vars
412
413  (fields
414          ("hp"           ai_health)
415          ("aistate"      ai_state)
416  );; end fields
417
418  (states "addon/claudio/trex1.spe"
419          (stopped "stand")
420          (running (seq "w" 1 10))
421          (start_run_jump "jumpflitch")
422          (flinch_up      "jumpflitch")
423          (run_jump       "jumpflitch")
424        (blocking (seq "w" 1 5)"jumpflitch")
425        (eating  (seq "e" 2 10))
426          (dieing (seq "d" 1 5))
427  );; end states
428
429);; end def_char T_REX
430
431;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
432;;                                                                                       ;;
433;; CHAR 4: Big walking robot                                                             ;;
434;;                                                                                       ;;
435;; this char comes in three versions which can be shifted between by                     ;;
436;; activating/deactivating code sections in wrob_ai and in the char                      ;;
437;; definition (def_char WALK_ROB), by putting and removing ";;" before code lines        ;;
438;; --- version 1: exploding and disappearing when dead                                   ;;
439;; --- version 2: burned debris left when dead (not blocking)                            ;;
440;; --- version 2: as in version 2, but the debris are will block the player              ;;
441;;                                                                                       ;;
442;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
443
444(defun wrob_ai ()
445  (if (<= (hp) 0) ;; *
446
447       nil   ;; inactivate this "nil" and activate the following if-section when using versions 2 and 3
448
449    ;; if (eq (state) dieing)
450    ;;   (next_picture)
451    ;;   (set_aistate 0)
452    ;; )
453
454       (if (activated)         ;; **
455          (progn                  ;;***
456               (set_targetable T)
457               (push_char 35 40)
458             (select (aistate)
459                  (0;; walk toward player
460                    (if (or  (> (distx) 120) (or (<(disty) -5)(>(disty) 20)) (not (eq (direction) (toward))))
461                         (progn
462                          (if (eq (mod (state_time) 6) 0)        ;; play sound every 6 ticks
463                            (play_sound STOMP_SND 127 (x) (y))
464                        )
465                            (move (toward) 0 0)
466                            (next_picture)
467                     )
468                         (progn
469                            (set_state stopped)
470                            (set_aistate 1)
471                     )
472                  )
473                 );; end aistate 0
474
475                  (1;; stop and fire
476                     (burst_fire  (+ (x) (* (direction) 16)) (- (y) 22)
477                            (if (> (direction) 0)
478                                (mod (- 375 (/ (* burst_left 30) burst_total)) 360)
479                              (+ 165 (/ (* burst_left 30) burst_total))
480                       )
481                    )
482                      (if (not (eq fire_time 0))
483                            (set_aistate 0)
484                    )
485                );; end aistate 1
486                (2 ;; dead robot
487                   (set_state dieing)
488                   (set_aistate 0)
489                );; end aistate 2
490             );; end select
491
492               (if (<= (hp) 0)                        ;; are we dead, if so blow up
493                   (progn
494                        (add_object EXPLODE6 (+ (x) 5) (- (y) 10)     0)
495                        (add_object EXPLODE6 (+ (x) -5) (- (y) 15)    2)  ;; wait 2 frames before appearing
496                        (add_object EXPLODE6 (+ (x) 10) (- (y) 2)     1)
497                        (add_object EXPLODE6 (+ (x) -10) (- (y) 20)   3)
498                        (add_object EXPLODE6 (+ (x) 20) (- (y) 27)    4)
499                        (add_object EXPLODE6 (+ (x) -25) (- (y) 30)   2)
500                        (add_object EXPLODE6 (+ (x) 20) (- (y) 5)     4)
501                        (add_object EXPLODE6 (+ (x) -3) (- (y) 1)     5)
502                        (set_aistate 0)
503                  )
504             )
505
506      T);; end of *** progn
507    T);; end of ** if activated
508  );; end of * if
509);; end of ai
510
511(def_char WALK_ROB
512
513  (funs (ai_fun wrob_ai)
514          (constructor wrob_cons)
515          (get_cache_list_fun explo_damage_cache)
516        (damage_fun explo_damage)
517  );; end funs
518
519  (abilities (run_top_speed 6)
520             (start_hp 70)
521  );; end abilities
522
523  (flags (hurtable T)
524         (can_block T)
525         (unactive_shield T)
526  );; end flags
527
528  (range 300 100)
529
530  (vars fire_delay
531        burst_delay
532        burst_total
533        burst_wait
534        burst_left
535          max_xvel
536        max_yvel
537        smoke_time
538        fire_time
539   );; end vars
540
541  (fields ("fire_delay"   wrob_fdelay)
542          ("burst_delay"  wrob_bdelay)
543          ("burst_total"  wrob_btotal)
544          ("max_xvel"     wrob_mxv)
545          ("max_yvel"     wrob_myv)
546          ("hp"           ai_health)
547        ("aitype"       ai_type)
548          ("aistate"      ai_state)
549
550  );; end fields
551
552  (states "addon/claudio/rob2.spe"
553          (stopped "wwlk0001.pcx")
554          (running (seq "wwlk" 1 10))
555          (start_run_jump "wstart_jump")
556          (flinch_up      "wflinch")
557        ;;(flinch_up      "wwflinch")  ;;<--- use this line instead of the one above when using version 2
558          (run_jump       "wwlk0009.pcx")
559        (dieing         "wflinch")
560        ;;(dieing      "wwflinch")  ;;<--- use this line instead of the one above when using version 2
561  );; end states
562
563);; end def_char WALK_ROB
564
565;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
566;;                                                                                       ;;
567;; CHAR 5 and 6: Space doors                                                                   ;;
568;;                                                                                       ;;
569;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
570
571(defun other_sdoor_opening ()
572  (if (eq (total_objects) 0)
573      nil
574    (with_object (get_object 0)
575                 (if (eq (otype) SPACE_DOOR)
576                     (if (eq is_opening 0)
577                         (if (and (< (distx) 50) (< (disty) 40))
578                             T
579                           nil)
580                       T)
581                   nil))))
582
583(defun open_spacedoor ()
584
585  (setq is_opening 1)
586  (if (eq (current_frame) 4)
587      (setq is_opening 0)
588    (progn
589      (if (eq (current_frame) 0)
590          (play_sound SWISH 70 (x) (y)))
591      (next_picture))))
592
593(defun close_spacedoor ()
594  (setq is_opening 0)
595  (if (eq (current_frame) 0)
596      nil
597    (progn
598      (if (eq (current_frame) 4)
599          (play_sound SWISH 70 (x) (y)))
600      (set_current_frame (- (current_frame) 1)))))
601
602(defun tpdspace_ai ()     ;; teleporting door ai
603  (if (or (and (< (distx) 50) (< (disty) 40))
604          (other_sdoor_opening))
605      (open_spacedoor)
606    (close_spacedoor))
607
608  (let ((player (bg)))
609    (if (has_object player)
610        (if (not (with_object player (pressing_action_key)))
611            (remove_object player))
612      (if (and (< (distx) 20) (< (disty) 30) (with_object player (pressing_action_key))
613               (> (total_objects) 0))
614          (let ((otherx (with_object (get_object 0) (x)))
615                (othery (with_object (get_object 0) (y))))
616            (with_object (get_object 0) (link_object player))
617            (with_object player (progn
618                                  (set_x otherx)
619                                  (set_y othery)))))))
620T)
621
622(def_char SPACE_DOOR_WIDE
623  (range 0 0)
624  (vars is_opening)
625  (funs (ai_fun      tpdspace_ai)
626        (constructor tp_door_cons)
627        (reload_fun lower_reload)
628        (draw_fun   tp_door_draw))
629  (fields ("xvel"   tp_amb))
630  (states "addon/claudio/spaced.spe" (stopped (seq "vv" 1 6))))
631
632(def_char SPACE_DOOR
633  (funs (ai_fun sdoor_ai)
634        (reload_fun lower_reload))
635  (flags (can_block T))
636  (range 250 60)
637  (draw_range 30 50)
638  (abilities (push_xrange 1))
639  (states "addon/claudio/spaced.spe"
640          (stopped "sp0001.pcx")
641          (running (seq "sp" 1 6))
642          (walking (seq "sp" 6 1))
643          (blocking "sp0006.pcx")))
644
645;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
646;;                                                                                       ;;
647;; CHAR 7, 8 and 9: Smart platforms                                                      ;;
648;;                                                                                       ;;
649;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
650
651(defun make_my_smart_plat (symbol off_frame on_frame snap_yoffset)
652  (eval (list 'def_char symbol
653              '(flags (can_block T))
654              `(abilities (start_accel ,snap_yoffset))
655              `(fields ("xacel" ,plat_speed)
656                       ("yacel" ,plat_2speed)
657                       ("xvel"  ,plat_pos)
658                       ("yvel"  ,plat_wait))
659              '(funs (ai_fun      platform_ai)
660                     (constructor platform_cons))
661              '(range 50 500)
662              '(draw_range 30 60)
663              `(states "addon/claudio/nplatfor.spe"
664                       (stopped   ,off_frame)
665                       (running   (list ,off_frame ,on_frame) )))))
666
667(make_my_smart_plat 'SMART_PLAT_ELEV "ele_off" "ele_on" 22)
668(make_my_smart_plat 'SMART_PLAT_MEDIUM   "med_off" "med_on" 22)
669(make_my_smart_plat 'SMART_PLAT_ELEV_SPACE   "ele1_off" "ele1_on" 26)
670
671;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
672;;                                                                                       ;;
673;; CHAR 10: Burning fire                                                                 ;;
674;;                                                                                       ;;
675;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
676
677(defun fire_ai ()
678  (if (and (touching_bg) (eq (mod (state_time) 20) 0))
679      (do_damage 20 (bg)))
680  (select (aistate)
681          (0
682
683            (if (eq (random 100) 0)
684                 (progn
685                   (play_sound FIRE_SND 127 (x) (y))
686                   (set_aistate 1)))
687             (next_picture))
688          (1
689
690           (next_picture)
691             (if (eq (state_time) 5)
692                 (progn
693                   (hurt_radius (x) (y) 20 20 nil 10)
694                   (set_aistate 0)))))
695  T)
696
697
698(def_char FIRE_C
699  (funs (ai_fun fire_ai))
700  (states  "addon/claudio/fire.spe"
701           (stopped (seq "f" 1 33))))
702
703;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
704;;                                                                                       ;;
705;; CHAR 11-15 Space objects                                                              ;;
706;;                                                                                       ;;
707;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
708
709(def_char COMP_PANELS
710  (funs (ai_fun   do_nothing))
711  (states "addon/claudio/mypanels.spe" (stopped (seq "c" 1 10))))
712
713
714(def_char COMP_SCREEN1
715  (funs (ai_fun   do_nothing))
716  (states "addon/claudio/mypanels.spe" (stopped (seq "p" 1 18))))
717
718(def_char COMP_SCREEN2
719  (funs (ai_fun   do_nothing))
720  (states "addon/claudio/mypanels.spe" (stopped (seq "s" 1 4))))
721
722(def_char COMP_SCREEN3
723  (funs (ai_fun   do_nothing))
724  (states "addon/claudio/mypanels.spe" (stopped "p0001.pcx")))
725
726(def_char COMP_CONSOLE1
727  (funs (ai_fun   do_nothing))
728  (states "addon/claudio/mypanels.spe" (stopped (seq "t" 1 2))))
729
730;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
731;;                                                                                       ;;
732;; CHAR 16-21: Water objects                                                             ;;
733;;                                                                                       ;;
734;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
735
736(defun sewer_ai ()
737
738  (select (aistate)
739          (0
740
741            (if (eq (random 100) 0)
742                 (progn
743                   (play_sound SEWER1_SND 127 (x) (y))
744                   (set_aistate 1)))
745             (next_picture))
746          (1
747
748           (next_picture)
749             (if (eq (state_time) 5)
750                 (progn
751                   (set_aistate 0)))))
752  T)
753
754(defun deepw_cons ()
755        (set_fade_count 5))
756
757(defun deepw_ai ()
758  (if (and (touching_bg) (eq (mod (state_time) 20) 0))
759      (do_damage 2 (bg)))
760  (select (aistate)
761          (0
762
763            (if (eq (random 100) 0)
764                 (progn
765                   (play_sound SEWER1_SND 127 (x) (y))
766                   (set_aistate 1)))
767             (next_picture))
768          (1
769
770           (next_picture)
771             (if (eq (state_time) 5)
772                 (progn
773                   (hurt_radius (x) (y) 20 20 nil 10)
774                   (set_aistate 0)))))
775  T)
776
777(defun wfall_ai ()
778  (select (aistate)
779          (0
780
781            (if (eq (random 100) 0)
782                 (progn
783                   (play_sound WFALL_SND 127 (x) (y))
784                   (set_aistate 1)))
785             (next_picture))
786          (1
787
788           (next_picture)
789             (if (eq (state_time) 5)
790                 (progn
791                   (hurt_radius (x) (y) 20 20 nil 10)
792                   (set_aistate 0)))))
793  T)
794
795(def_char WATER_DEEP1
796  (funs (ai_fun deepw_ai)
797        (constructor deepw_cons)
798  )
799  (states  "addon/claudio/deepw1.spe"
800           (stopped (seq "w" 1 5))))
801
802(def_char WATER_DEEP2
803  (funs (ai_fun deepw_ai)
804        (constructor deepw_cons)
805  )
806  (states  "addon/claudio/deepw1.spe"
807           (stopped (seq "wc" 1 5))))
808
809(def_char WATER_SURF1
810  (funs (ai_fun deepw_ai)
811        (constructor deepw_cons)
812  )
813  (states  "addon/claudio/deepw1.spe"
814           (stopped (seq "ws" 1 5))))
815
816(def_char WATER_SURF2
817  (funs (ai_fun deepw_ai)
818        (constructor deepw_cons)
819  )
820  (states  "addon/claudio/deepw1.spe"
821           (stopped (seq "wcs" 1 5))))
822
823(def_char WATER_FALL1 ;; This char must be used together with the foretiles contained in extiles.spe, see watert.spe for examples
824  (funs (ai_fun wfall_ai))
825  (states  "addon/claudio/deepw2.spe"
826           (stopped (seq "dw" 1 5))))
827
828(def_char SEWER_FALL_THIN ;; original art by Mike Moss
829  (funs (ai_fun   sewer_ai))
830  (states "addon/claudio/watem.spe" (stopped (seq "sf" 1 4))))
831
832;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
833;;                                                                                       ;;
834;; CHAR 22, 23 and 24: Lamps: big, small and exploding                                   ;;
835;;                                                                                       ;;
836;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
837
838
839(defun exlamp_ai ()
840  (if (<= (hp) 0)
841      (if (eq (state) dieing)
842          (next_picture)
843        (progn
844          (play_sound GLASS1_SND 127 (x) (y))
845          (set_state dieing)
846          T))
847    T))
848
849
850(def_char LAMP_EX1
851
852  (funs (ai_fun  exlamp_ai))
853  (flags (can_block T)
854         (hurtable  T))
855  (abilities (start_hp 30))
856  (states "addon/claudio/lamp.spe"
857          (stopped       "l0001.pcx")
858          (dieing        (seq "l" 1 10))))
859
860
861(defun slamp_ai ()
862(if (activated)
863 (set_state running)
864 (set_state stopped)
865)
866)
867
868
869(def_char LAMP_BIG
870  (funs (ai_fun   slamp_ai))
871  (states "addon/claudio/lamp.spe"
872     (stopped "l0002.pcx")
873     (running "l0001.pcx")
874  )
875)
876
877
878(def_char LAMP_SMALL ;; original art by Craig Redinger
879  (funs (ai_fun   slamp_ai))
880  (states "addon/craig/craig.spe"
881     (stopped "lamp_off")
882     (running "lamp_on")
883   )
884)
885
886;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
887;;                                                                                       ;;
888;; CHAR 25 and 26: materia (health) and anti-materia (unhealth)                          ;;
889;;                                                                                       ;;
890;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
891
892(defun antihp_up ()
893        (next_picture)
894
895        (if (and (touching_bg) (with_object (bg) (give_player_health -20)))
896           (progn
897             (play_sound UNHEALTH_UP_SND 127 (x) (y))
898             nil)
899          T))
900
901
902(def_char SPACE_HEALTH
903  (funs (ai_fun hp_up))
904  (flags (add_front T))
905  (range 0 0)
906  (states "addon/claudio/spaceh.spe" (stopped (seq "h" 1 2) )))
907
908(def_char SPACE_UNHEALTH
909  (funs (ai_fun antihp_up))
910  (flags (add_front T))
911  (range 0 0)
912  (states "addon/claudio/spaceh.spe" (stopped (seq "h" 1 2) )))
913
914;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
915;;                                                                                       ;;
916;; CHARS 27 and 28: Space switch and Lava burst                                          ;;
917;;                                                                                       ;;
918;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
919
920(def_char SPACE_SWITCH
921  (funs (ai_fun switcher_ai)
922        (reload_fun lower_reload))
923  (range 0 0)
924  (states "addon/claudio/sswitch.spe"
925          (stopped '("ssw0001" "ssw0002"))
926          (running '("ssw0003"  "ssw0004"))))
927
928(def_char LAVA_BURST
929  (funs (ai_fun   do_nothing))
930  (states "addon/claudio/lava2.spe" (stopped (seq "p" 1 15))))
931
932;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
933;;                                                                                       ;;
934;; CHAR 29 and 30: Ant boss v.2 and Super ant  - not working yet                         ;;
935;;                                                                                       ;;
936;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
937
938;;(load "addon/claudio/antextra.lsp")
939
940;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
941;;                                                                                       ;;
942;; CHAR 31: Death Umbrella                                                               ;;
943;;                                                                                       ;;
944;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
945
946
947(defun dumbrel_ai ()
948
949  (if (not (eq smoke_time 0))
950      (progn
951        (setq smoke_time (- smoke_time 1))
952        (if (eq (mod smoke_time 2) 0)
953            (add_object SMALL_DARK_CLOUD (x) (y)))))
954
955  (if (eq (aistate) 0)
956      (if (or (eq (total_objects) 0) (not (eq (with_object (get_object 0) (aistate)) 0)))
957          (if (next_picture) T
958            (progn
959              (set_targetable T)
960              (set_state running)
961              (set_aistate 1)))
962        (progn
963          (set_targetable nil)
964          (set_state stopped)
965          T))
966    (if (eq (hp) 0)
967        (progn
968        (play_sound GRENADE_SND 127 (x) (y))
969          (add_object EXPLODE1 (+ (x) (random 10)) (+ (+ (random 10) (y)) -20)     0)
970          (add_object EXPLODE1 (- (x) (random 10)) (+ (- (y) (random 10)) -20)     2)
971          (add_object EXPLODE1 (x) (+ (- (y) (random 20)) -20)                     4)
972          nil)
973      (progn
974        (if (eq (mod (state_time) 5) 0)
975            (play_sound DRILL_SND 127 (x) (y)))
976        (if (> (with_object (bg) (x)) (x))
977            (progn
978              (set_xvel (+ (xvel) 1))
979              (if (> (xvel) max_xvel) (set_xvel max_xvel))
980              (if (eq (direction) -1)
981                  (progn
982                    (set_direction 1)
983                    (set_state turn_around))))
984          (if (< (with_object (bg) (x)) (x))
985              (progn
986                (set_xvel (- (xvel) 1))
987                (if (< (xvel) (- 0 max_xvel)) (set_xvel (- 0 max_xvel)))
988                (if (eq (direction) 1)
989                    (progn
990                      (set_direction -1)
991                      (set_state turn_around))))))
992        (if (> (with_object (bg) (- (y) 70)) (y))
993            (if (> (yvel) max_yvel)
994                (set_yvel (- (yvel) 1))
995              (set_yvel (+ (yvel) 1)))
996
997          (if (< (with_object (bg) (- (y) 50)) (y))
998              (if (< (yvel) (- 0 max_yvel))
999                  (set_yvel (+ (yvel) 1))
1000                (set_yvel (- (yvel) 1)))))
1001
1002        (if (eq (random 5) 0)
1003            (set_xvel (+ (xvel) 1))
1004          (if (eq (random 5) 0)
1005              (set_xvel (- (xvel) 1))))
1006        (if (eq (random 5) 0)
1007            (set_yvel (+ (yvel) 1))
1008          (if (eq (random 5) 0)
1009              (set_yvel (- (yvel) 1))))
1010
1011        (if (next_picture) T (set_state running))
1012
1013        (bounce_move '(set_xvel (/ (xvel) 2)) '(set_xvel (/ (xvel) 2))
1014                     '(set_yvel (/ (yvel) 2)) '(set_yvel (/ (yvel) 2)) nil)
1015
1016        (if (> fire_time 0)              ;; if we need to wait till next burst
1017            (progn
1018              (setq fire_time (- fire_time 1))
1019              (if (eq fire_time 0)
1020                  (progn
1021                    (setq burst_left burst_total)
1022                    (setq burst_wait 0))))
1023          (if (eq burst_wait 0)
1024              (if (and (< (distx) 150) (eq (direction) (facing)))
1025                  (let ((firex (+ (x) (* (direction) 10)) )
1026                        (firey (y))
1027                        (playerx (+ (with_object (bg) (x)) (with_object (bg) (* (xvel) 4))))
1028                        (playery (+ (- (with_object (bg) (y)) 15) (with_object (bg) (* (yvel) 2)))))
1029                    (if (and (can_see (x) (y) firex firey nil) (can_see firex firey playerx playery nil))
1030                        (progn
1031                          (let ((angle (atan2 (- firey playery)
1032                                              (- playerx firex))))
1033                            (if (or (eq burst_left 1) (eq burst_left 0))
1034                                (setq fire_time fire_delay)
1035                              (setq burst_left (- burst_left 1)))
1036                            (setq burst_wait burst_delay)
1037                            (fire_object (me) (aitype) firex firey angle (bg))
1038                            )))))
1039            (setq burst_wait (- burst_wait 1))))
1040        T))))
1041
1042(defun dumbrel_damage (amount from hitx hity push_xvel push_yvel)
1043  (if (and from (with_object from (and (> (total_objects) 0)
1044                                       (with_object (get_object 0)
1045                                                    (or (eq (otype) FLYER)
1046                                                        (eq (otype) GREEN_FLYER))
1047                                                        ))))
1048      nil
1049    (if (eq (state) stopped) nil
1050      (progn
1051        (setq smoke_time 30)
1052        (set_yvel (- (yvel) 14))
1053        (set_state flinch_up)
1054        (damage_fun amount from hitx hity push_xvel push_yvel)
1055        (if (and(< (hp) 100)(>(hp) 85))
1056              (set_aitype 1)
1057      )
1058        (if (and(< (hp) 85)(>(hp) 70))
1059              (set_aitype 9)
1060      )
1061        (if (and(< (hp) 70)(>(hp) 45))
1062              (set_aitype 4)
1063      )
1064        (if (and(< (hp) 45) (>(hp)20))
1065              (set_aitype 3)
1066      )
1067        (if (and(< (hp) 20)(>(hp)0))
1068              (set_aitype 5)
1069      )
1070))))
1071
1072(defun dumbrel_cons ()
1073  (setq fire_delay 20)
1074  (setq burst_delay 5)
1075  (setq max_xvel 2)
1076  (setq max_yvel 1)
1077  (set_aitype 0)
1078  (setq burst_total 2))
1079
1080(def_char DEATH_UMBRELLA
1081
1082  (funs (ai_fun dumbrel_ai)
1083          (constructor dumbrel_cons)
1084          (get_cache_list_fun explo_damage_cache)
1085        (damage_fun dumbrel_damage)
1086  );; end funs
1087
1088  (abilities (start_hp 100)
1089  );; end abilities
1090
1091  (flags (hurtable T)
1092         (can_block T)
1093         (unactive_shield T)
1094  );; end flags
1095
1096  (range 300 100)
1097
1098  (vars fire_delay
1099        burst_delay
1100        burst_total
1101        burst_wait
1102        burst_left
1103          max_xvel
1104        max_yvel
1105        smoke_time
1106        fire_time
1107   );; end vars
1108
1109  (states "addon/claudio/umbrel3.spe"
1110          (stopped "u0001.pcx")
1111          (running (seq "u" 1 4))
1112        ;;(dieing  (seq "u" 7 12))
1113  );; end states
1114
1115);; end def_char
1116
1117
1118;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1119;;                                                                                       ;;
1120;; CHAR 32: Ant Ship                                                                     ;;
1121;;                                                                                       ;;
1122;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1123
1124(defun antship_ai ()
1125
1126  (if (not (eq smoke_time 0))
1127      (progn
1128          (setq smoke_time (- smoke_time 1))
1129          (if (eq (mod smoke_time 2) 0)
1130            (add_object SMALL_DARK_CLOUD (x) (y))
1131        )
1132      )
1133  )
1134
1135  (if (eq (aistate) 0)
1136
1137      (if  (or  (eq (total_objects) 0)  (not(eq (with_object(get_object 0)(aistate))0)))
1138          (if (next_picture) T
1139            (progn
1140              (set_targetable T)
1141              (set_state running)
1142              (set_aistate 1)
1143          )
1144        )
1145          (progn
1146            (set_targetable nil)
1147            (set_state stopped)
1148          T)
1149      )
1150
1151      (if (<= (hp) 0)
1152
1153         (progn
1154
1155          (if (eq (state) dieing)
1156              (next_picture)
1157
1158              (progn
1159                (set_state dieing)
1160                (play_sound GRENADE_SND 127 (x) (y))
1161                  (add_object EXPLODE1 (+ (x) (random 10)) (+ (+ (random 10) (y)) -20)     0)
1162                  (add_object EXPLODE1 (- (x) (random 10)) (+ (- (y) (random 10)) -20)     2)
1163                  (add_object EXPLODE0 (x) (+ (- (y) (random 20)) -20)                     6)
1164              )
1165
1166          )
1167        )
1168        (progn
1169            (if (eq (mod (state_time) 5) 0)
1170              (play_sound ASHIP_SND 127 (x) (y))
1171          )
1172            (if (> (with_object (bg) (x)) (x))
1173            (progn
1174              (set_xvel (+ (xvel) 1))
1175              (if (> (xvel) max_xvel)
1176               (set_xvel max_xvel)
1177            )
1178              (if (eq (direction) -1)
1179                  (progn
1180                    (set_direction 1)
1181                    (set_state turn_around)
1182               )
1183             )
1184           )
1185             (if (< (with_object (bg) (x)) (x))
1186                (progn
1187                (set_xvel (- (xvel) 1))
1188                (if (< (xvel) (- 0 max_xvel))
1189                   (set_xvel (- 0 max_xvel))
1190                  )
1191                (if (eq (direction) 1)
1192                         (progn
1193                           (set_direction -1)
1194                           (set_state turn_around)
1195                     )
1196                  )
1197               )
1198           )
1199        )
1200
1201        (if (> (with_object (bg) (- (y) 70)) (y))
1202            (if (> (yvel) max_yvel)
1203                (set_yvel (- (yvel) 1))
1204              (set_yvel (+ (yvel) 1))
1205          )
1206            (if (< (with_object (bg) (- (y) 50)) (y))
1207              (if (< (yvel) (- 0 max_yvel))
1208                  (set_yvel (+ (yvel) 1))
1209                  (set_yvel (- (yvel) 1))
1210            )
1211          )
1212       )
1213
1214        (if (eq (random 5) 0)
1215            (set_xvel (+ (xvel) 1))
1216            (if (eq (random 5) 0)
1217              (set_xvel (- (xvel) 1))))
1218        (if (eq (random 5) 0)
1219            (set_yvel (+ (yvel) 1))
1220          (if (eq (random 5) 0)
1221              (set_yvel (- (yvel) 1))))
1222
1223        (if (next_picture) T (set_state running))
1224
1225        (bounce_move '(set_xvel (/ (xvel) 8)) '(set_xvel (/ (xvel) 8))
1226                     '(set_yvel (/ (yvel) 8)) '(set_yvel (/ (yvel) 8)) nil)
1227
1228        (if (> fire_time 0)
1229            (progn
1230              (setq fire_time (- fire_time 1))
1231              (if (eq fire_time 0)
1232                  (progn
1233                    (setq burst_left burst_total)
1234                    (setq burst_wait 0))))
1235          (if (eq burst_wait 0)
1236              (if (and (< (distx) 150) (eq (direction) (facing)))
1237                  (let ((firex (+ (x) (* (direction) 10)) )
1238                        (firey (y))
1239                        (playerx (+ (with_object (bg) (x)) (with_object (bg) (* (xvel) 4))))
1240                        (playery (+ (- (with_object (bg) (y)) 15) (with_object (bg) (* (yvel) 2)))))
1241                    (if (and (can_see (x) (y) firex firey nil) (can_see firex firey playerx playery nil))
1242                        (progn
1243                          (let ((angle (atan2 (- firey playery)
1244                                              (- playerx firex))))
1245                            (if (or (eq burst_left 1) (eq burst_left 0))
1246                                (setq fire_time fire_delay)
1247                              (setq burst_left (- burst_left 1)))
1248                            (setq burst_wait burst_delay)
1249                            (fire_object (me) (aitype) firex firey angle (bg))
1250                            )))))
1251            (setq burst_wait (- burst_wait 1))))
1252        T)))
1253
1254);; end ai
1255
1256(defun antship_damage (amount from hitx hity push_xvel push_yvel)
1257  (if (and from (with_object from (and (> (total_objects) 0)
1258                                       (with_object (get_object 0)
1259                                                    (or (eq (otype) FLYER)
1260                                                        (eq (otype) GREEN_FLYER))
1261                                                        ))))
1262      nil
1263    (if (eq (state) stopped) nil
1264      (progn
1265        (setq smoke_time 30)
1266        (set_yvel (- (yvel) 1))
1267        (set_state flinch_up)
1268        (damage_fun amount from hitx hity push_xvel push_yvel)
1269        (if (and(< (hp) 300)(>(hp) 250))
1270              (set_aitype 1)
1271      )
1272        (if (and(< (hp) 250)(>(hp) 200))
1273              (set_aitype 9)
1274      )
1275        (if (and(< (hp) 200)(>(hp) 150))
1276              (set_aitype 4)
1277      )
1278        (if (and(< (hp) 150) (>(hp)100))
1279              (set_aitype 6)
1280      )
1281        (if (and(< (hp) 100) (>(hp)50))
1282              (set_aitype 3)
1283      )
1284        (if (and(< (hp) 50)(>(hp)0))
1285              (set_aitype 5)
1286      )
1287))))
1288
1289(defun antship_cons ()
1290  (setq fire_delay 30)
1291  (setq burst_delay 8)
1292  (setq max_xvel 2)
1293  (setq max_yvel 1)
1294  (set_aitype 0)
1295  (setq burst_total 3))
1296
1297
1298(def_char ANT_SHIP  ;; original art by Steven Chan, schan@eecs.berkeley.edu
1299
1300
1301  (funs (ai_fun antship_ai)
1302          (constructor antship_cons)
1303          (get_cache_list_fun explo_damage_cache)
1304        (damage_fun antship_damage)
1305  );; end funs
1306
1307  (abilities (start_hp 300)
1308  );; end abilities
1309
1310  (flags (hurtable T)
1311         (can_block T)
1312         (unactive_shield T)
1313  );; end flags
1314
1315  (range 400 200)
1316
1317  (vars fire_delay
1318        burst_delay
1319        burst_total
1320        burst_wait
1321        burst_left
1322          max_xvel
1323        max_yvel
1324        smoke_time
1325        fire_time
1326   );; end vars
1327
1328  (states "addon/claudio/antship.spe"
1329          (stopped "s0001.pcx")
1330          (running (seq "s" 2 6))
1331        (flinch_up (seq "s" 1 6))
1332        (dieing  (seq "s" 7 12))
1333  );; end states
1334
1335);; end def_char
1336
1337
1338;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1339;;                                                                                       ;;
1340;; CHAR 33: Death Skull                                                                  ;;
1341;;                                                                                       ;;
1342;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1343
1344(defun dskull_ai ()
1345  (if (not (eq smoke_time 0))
1346      (progn
1347        (setq smoke_time (- smoke_time 1))
1348        (if (eq (mod smoke_time 2) 0)
1349         (add_object EXPLODE1 (+ (x) (random 10)) (+ (+ (random 10) (y)) -20)     0)
1350      )
1351       )
1352 )
1353
1354  (if (eq (aistate) 0)
1355      (if (or (eq (total_objects) 0) (not (eq (with_object (get_object 0) (aistate)) 0)))
1356          (if (next_picture) T
1357            (progn
1358              (set_targetable T)
1359              (set_state running)
1360              (set_aistate 1)))
1361        (progn
1362          (set_targetable nil)
1363          (set_state stopped)
1364          T))
1365    (if (eq (hp) 0)
1366        (progn
1367        (play_sound GRENADE_SND 127 (x) (y))
1368          (add_object EXPLODE1 (+ (x) (random 10)) (+ (+ (random 10) (y)) -20)     0)
1369          (add_object EXPLODE1 (- (x) (random 10)) (+ (- (y) (random 10)) -20)     2)
1370          (add_object EXPLODE1 (x) (+ (- (y) (random 20)) -20)                     4)
1371          nil)
1372      (progn
1373        (if (eq (mod (state_time) 10) 0)
1374            (play_sound SKULL_SND 127 (x) (y)))
1375        (if (> (with_object (bg) (x)) (x))
1376            (progn
1377              (set_xvel (+ (xvel) 1))
1378              (if (> (xvel) max_xvel) (set_xvel max_xvel))
1379              (if (eq (direction) -1)
1380                  (progn
1381                    (set_direction 1)
1382                    (set_state turn_around))))
1383          (if (< (with_object (bg) (x)) (x))
1384              (progn
1385                (set_xvel (- (xvel) 1))
1386                (if (< (xvel) (- 0 max_xvel)) (set_xvel (- 0 max_xvel)))
1387                (if (eq (direction) 1)
1388                    (progn
1389                      (set_direction -1)
1390                      (set_state turn_around))))))
1391        (if (> (with_object (bg) (- (y) 70)) (y))
1392            (if (> (yvel) max_yvel)
1393                (set_yvel (- (yvel) 1))
1394              (set_yvel (+ (yvel) 1)))
1395
1396          (if (< (with_object (bg) (- (y) 50)) (y))
1397              (if (< (yvel) (- 0 max_yvel))
1398                  (set_yvel (+ (yvel) 1))
1399                (set_yvel (- (yvel) 1)))))
1400
1401        (if (eq (random 5) 0)
1402            (set_xvel (+ (xvel) 1))
1403          (if (eq (random 5) 0)
1404              (set_xvel (- (xvel) 1))))
1405        (if (eq (random 5) 0)
1406            (set_yvel (+ (yvel) 1))
1407          (if (eq (random 5) 0)
1408              (set_yvel (- (yvel) 1))))
1409
1410        (if (next_picture) T (set_state running))
1411
1412        (bounce_move '(set_xvel (/ (xvel) 2)) '(set_xvel (/ (xvel) 2))
1413                     '(set_yvel (/ (yvel) 2)) '(set_yvel (/ (yvel) 2)) nil)
1414
1415        (if (> fire_time 0)
1416            (progn
1417              (setq fire_time (- fire_time 1))
1418              (if (eq fire_time 0)
1419                  (progn
1420                    (setq burst_left burst_total)
1421                    (setq burst_wait 0))))
1422          (if (eq burst_wait 0)
1423              (if (and (< (distx) 150) (eq (direction) (facing)))
1424                  (let ((firex (+ (x) (* (direction) 10)) )
1425                        (firey (y))
1426                        (playerx (+ (with_object (bg) (x)) (with_object (bg) (* (xvel) 4))))
1427                        (playery (+ (- (with_object (bg) (y)) 15) (with_object (bg) (* (yvel) 2)))))
1428                    (if (and (can_see (x) (y) firex firey nil) (can_see firex firey playerx playery nil))
1429                        (progn
1430                          (let ((angle (atan2 (- firey playery)
1431                                              (- playerx firex))))
1432                            (if (or (eq burst_left 1) (eq burst_left 0))
1433                                (setq fire_time fire_delay)
1434                              (setq burst_left (- burst_left 1)))
1435                            (setq burst_wait burst_delay)
1436                            (fire_object (me) (aitype) firex firey angle (bg))
1437                            )))))
1438            (setq burst_wait (- burst_wait 1))))
1439        T))))
1440
1441
1442(defun dskull_damage (amount from hitx hity push_xvel push_yvel)
1443  (if (and from (with_object from (and (> (total_objects) 0)
1444                                       (with_object (get_object 0)
1445                                                    (or (eq (otype) FLYER)
1446                                                        (eq (otype) GREEN_FLYER))
1447                                                        ))))
1448      nil
1449    (if (eq (state) stopped) nil
1450      (progn
1451        (setq smoke_time 30)
1452        (set_yvel (- (yvel) 14))
1453        (set_state flinch_up)
1454        (damage_fun amount from hitx hity push_xvel push_yvel)
1455        (if (and(< (hp) 100)(>(hp) 50))
1456              (set_aitype 9)
1457      )
1458        (if (and(< (hp) 50)(>(hp)0))
1459              (set_aitype 5)
1460      )
1461
1462))))
1463
1464(defun dskull_cons ()
1465  (setq fire_delay 20)
1466  (setq burst_delay 5)
1467  (setq max_xvel 2)
1468  (setq max_yvel 1)
1469  (set_aitype 9)
1470  (setq burst_total 2))
1471
1472
1473(def_char DEATH_SKULL
1474  (funs (ai_fun dskull_ai)
1475          (constructor dskull_cons)
1476          (get_cache_list_fun explo_damage_cache)
1477        (damage_fun dskull_damage)
1478  );; end funs
1479
1480  (abilities (start_hp 100)
1481  );; end abilities
1482
1483  (flags (hurtable T)
1484         (can_block T)
1485         (unactive_shield T)
1486  );; end flags
1487
1488  (range 300 100)
1489
1490  (vars fire_delay
1491        burst_delay
1492        burst_total
1493        burst_wait
1494        burst_left
1495          max_xvel
1496        max_yvel
1497        smoke_time
1498        fire_time
1499   );; end vars
1500
1501  (states "addon/claudio/skull.spe"
1502          (stopped "s0001.pcx")
1503          (running '("s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx"
1504                   "s0002.pcx" "s0002.pcx" "s0002.pcx" "s0002.pcx" "s0002.pcx" "s0002.pcx" "s0002.pcx" "s0002.pcx"
1505                   "s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx" "s0001.pcx"
1506                   "s0024.pcx" "s0024.pcx" "s0024.pcx" "s0024.pcx" "s0024.pcx" "s0024.pcx" "s0024.pcx" "s0024.pcx"))
1507        (flinch_up  (seq "s" 2 18))
1508        (turn_around (seq "s" 1 24))
1509
1510  );; end states
1511
1512);; end def_char
1513
1514(def_explo 'EXPLODE0 "addon/claudio/bigexp.spe" "fire"           7)
1515
1516
1517;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1518;;                                                                                       ;;
1519;; TILES   (foreground and background tiles)                                             ;;
1520;;                                                                                       ;;
1521;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1522
1523(load_tiles
1524          "addon/claudio/pal81.spe"    ;; space foretiles 1, numbered from 8100,  palette space1
1525            "addon/claudio/pal82.spe"    ;; space foretiles 2, numbered from 8200,  palette space2
1526            ;; "addon/claudio/pal83.spe" ;; space foretiles 3, numbered from 8300,  palette space3
1527            "addon/claudio/pal90.spe"    ;; stars backtiles 1, numbered from 9000,
1528            "addon/claudio/pal2.spe"     ;; sewers backtiles,  numbered from 2000,
1529            "addon/claudio/pal21.spe"    ;; stars backtiles 2, numbered from 2100,
1530            "addon/claudio/pal5.spe"     ;; corallo backtiles, numbered from 5000,
1531            "addon/claudio/extiles.spe"  ;; extra foretiles,   numbered from 10000, palette extra1
1532)
1533
1534;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1535;;                                                                                       ;;
1536;; Characters and Tiles by other people                                                  ;;
1537;;                                                                                       ;;
1538;; WARNING: this section assumes that you have the following files:                      ;;
1539;; - aliens.spe,                                                                         ;;
1540;; - albtiles.spe,                                                                       ;;
1541;; - alftiles.spe by Mike Moss to be put in the folder Abuse\addon\mike                  ;;
1542;; - craig.spe  by Craig to be put in the folder Abuse\addon\craig                       ;;
1543;; - justin.spe by Justin Cassidy to be put in the folder Abuse\addon\justin             ;;
1544;;                                                                                       ;;
1545;; Contact these authors if you want to get more infor about their work.                 ;;
1546;; Otherwise, deactivate                                                                 ;;
1547;; the following section as indicated below in order to use the characters               ;;
1548;; and tiles by Claudio Bolzoni only.                                                    ;;
1549;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1550
1551
1552;;  /*THIS IS LINE "A": DELETE THE ";;" AT THE BEGINNING OF THIS LINE AND OF LINE "B" BELOW TO DEACTIVATE THE FOLLOWING SECTION
1553
1554
1555/******************************************************************************************
1556* Characters and Tiles                                                                    *
1557* By Michael Moss,  mad666mike@aol.com                                                   *                          *
1558******************************************************************************************/
1559
1560(def_char SEWER_GRIND
1561  (funs (ai_fun  sewer_ai))
1562  (states "addon/mike/aliens.spe" (stopped (seq "wgrl" 1 3))))
1563
1564(def_char SEWER_FALL
1565  (funs (ai_fun   sewer_ai))
1566  (states "addon/mike/aliens.spe" (stopped (seq "wfal" 1 4))))
1567
1568(load_tiles "addon/mike/albtiles.spe"
1569            "addon/mike/alftiles.spe"
1570)
1571
1572
1573/******************************************************************************************
1574* Characters and Tiles                                                                    *
1575* By Craig Redinger,  car188@psu.edu                                                      *
1576******************************************************************************************/
1577
1578(load_tiles "addon/craig/craig.spe")
1579
1580(def_char LAMP
1581  (funs (ai_fun   do_nothing))
1582  (states "addon/craig/craig.spe" (stopped "lamp")))
1583
1584(def_char WIRES
1585  (funs (ai_fun   do_nothing))
1586  (states "addon/craig/craig.spe" (stopped "wires")))
1587
1588(def_char PIPES1
1589  (funs (ai_fun   do_nothing))
1590  (states "addon/craig/craig.spe" (stopped "pipes1")))
1591
1592(def_char PIPES2
1593  (funs (ai_fun   do_nothing))
1594  (states "addon/craig/craig.spe" (stopped "pipes2")))
1595
1596(def_char DRIP_WATER
1597  (funs (ai_fun   do_nothing))
1598  (states "addon/craig/craig.spe" (stopped (seq "drip" 1 5))))
1599
1600
1601/******************************************************************************************
1602* Characters and Tiles                                                                    *
1603* By Justin Cassidy, julie@corecom.net                                                    *
1604******************************************************************************************/
1605
1606(def_char ICE_WATER
1607  (funs (ai_fun   do_nothing))
1608  (states "addon/justin/justin.spe" (stopped "water_object")))
1609
1610
1611;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1612
1613;;  */THIS IS LINE "B": DELETE THE ";;" AT THE BEGINNING OF THIS LINE AND OF LINE "A" ABOVE TO DEACTIVATE THIS SECTION
1614
1615
1616;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1617
Note: See TracBrowser for help on using the repository browser.