source: abuse/trunk/data/addon/aliens/powerold.lsp @ 589

Last change on this file since 589 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: 3.9 KB
Line 
1;; Copyright 1997 Mike Moss (tfirestorm@aol.com),  All Rights reserved
2;; See read me for more details on usage rights
3;; blah blah yackety smackety
4
5;; New Power Up objects
6
7(defun shlmp_ai ()
8  (try_move 0 10)
9  (next_picture)
10  (if (touching_bg)
11        (progn
12           (with_object (bg) (make_view_solid (find_rgb 255 255 255)))
13           (with_object (bg) (setq special_power SHLAMP_POWER))
14           (with_object (add_object_after SHLMP2 (x) (y)) (link_object (bg)))
15           (with_object (add_object_after WTW (x) (y)) (link_object (bg)))
16        nil)
17    T))
18
19(def_char SHOULDER_LAMP
20  (funs (ai_fun shlmp_ai))
21  (range 20 20)
22  (states "addon/aliens/aliens.spe" (stopped "shlamp")))
23
24(defun shlmp2_ai ()
25   (if (> (total_objects) 0)
26      (progn
27        (set_x (with_object (get_object 0) (x)))
28        (set_y (with_object (get_object 0) (- (y) (/ (picture_height) 2) )))))
29   (if (eq (total_lights) 1)
30      (progn
31        (set_light_x (get_light 0) (x))
32        (set_light_y (get_light 0) (y)))
33    nil)
34  (if (not (eq (with_object (get_object 0) special_power) SHLAMP_POWER))
35        (progn
36        (if (eq (total_lights) 1)
37           (delete_light (get_light 0))) nil)
38        T))
39
40(defun slamp_cons ()
41        (link_light (add_light 0 (x) (y) 1 100 0 0)))
42
43(def_char SHLMP2
44  (range 1000 1000)
45  (flags (unlistable T))
46  (funs  (ai_fun                shlmp2_ai)
47         (constructor   slamp_cons)
48         (draw_fun              dev_draw))
49  (states "art/misc.spe"
50          (stopped           "lhold")))
51
52(def_char WTW
53  (range 1000 1000)
54  (flags (unlistable T))
55  (funs (draw_fun dev_draw))
56  (states "art/misc.spe" (stopped "marker")))
57
58;; New Power Up code
59
60(setf shlamp_image (def_image "addon/aliens/aliens.spe" "slmp_img"))
61
62(enum 'NO_POWER
63      'FAST_POWER
64      'FLY_POWER
65      'SNEAKY_POWER
66      'HEALTH_POWER
67      'SHLAMP_POWER)
68
69(defun give_player_health (amount)
70  (let ((h_amount  (select difficulty
71                           ('easy    amount)
72                           ('medium  (/ (* amount 3) 4))
73                           ('hard    (/ amount 2))
74                           ('extreme (/ amount 5))))
75        (h_max (if (or (eq special_power HEALTH_POWER))
76                   200
77                 100)))
78    (if (eq (hp) h_max)
79        nil
80      (progn
81        (if (<= (+ (hp) h_amount) h_max)
82            (add_hp h_amount)
83          (add_hp (- h_max (hp))))
84        (setq b_ramp (+ b_ramp (* h_amount 2)))
85        T))))
86
87(setq sec1 0)
88(setq sec2 0)
89(setq sec3 0)
90(setq min1 0)
91(setq min2 0)
92
93(setq ani_reg 0)
94
95(defun bottom_draw ()
96  (if (not (and (eq r_ramp 0)    ;; need to draw red palette
97                (eq g_ramp 0)
98                (eq b_ramp 0)))
99      (progn
100        (if (> r_ramp 7)
101            (setq r_ramp (- r_ramp 7))
102          (if (< r_ramp -7)
103              (setq r_ramp (+ r_ramp 7))
104            (setq r_ramp 0)))
105        (if (> g_ramp 7)
106            (setq g_ramp (- g_ramp 7))
107          (if (< g_ramp -7)
108              (setq g_ramp (+ g_ramp 7))
109            (setq g_ramp 0)))
110        (if (> b_ramp 7)
111            (setq b_ramp (- b_ramp 7))
112          (if (< b_ramp -7)
113              (setq b_ramp (+ b_ramp 7))
114            (setq b_ramp 0)))
115        (if (local_player)
116            (tint_palette r_ramp g_ramp b_ramp))))
117
118  (select (aistate)
119          (NORMAL_PLAY
120        (if (eq ani_reg 24)
121                (setq ani_reg 1)
122                (setq ani_reg (+ ani_reg 1)))
123
124        (setq sec1 (+ sec1 1))
125        (if (eq sec1 10)
126                (progn
127                (setq sec2 (+ sec2 1))
128                (setq sec1 0)))
129        (if (eq sec2 10)
130                (progn
131                (setq sec3 (+ sec3 1))
132                (setq sec2 0)))
133        (if (eq sec3 6)
134                (progn
135                (setq min1 (+ min1 1))
136                (setq sec3 0)))
137        (if (eq min1 10)
138                (progn
139                (setq min2 (+ min2 1))
140                (setq min1 0)))
141        (if (eq min2 10)
142                (setq min2 0))
143           (select special_power
144                   (NO_POWER (player_draw (player_number)))
145                   (HEALTH_POWER (player_draw (player_number))
146                                 (if (local_player)
147                                     (put_image (- (view_x2) 20) (+ (view_y1) 5) health_image)))
148                   (FAST_POWER (draw_fast) (player_draw (player_number)))
149                   (FLY_POWER  (player_draw (player_number))
150                                (if (local_player)
151                                    (put_image (- (view_x2) 20) (+ (view_y1) 5) fly_image)))
152                   (SNEAKY_POWER
153                    (if (local_player)
154                        (put_image (- (view_x2) 20) (+ (view_y1) 5) sneaky_image))
155                                 (sneaky_draw used_special_power (player_number)))
156                   (SHLAMP_POWER (player_draw (player_number))
157                                 (if (local_player)
158                                     (put_image (- (view_x2) 20) (+ (view_y1) 5) shlamp_image)))
159          ))))
Note: See TracBrowser for help on using the repository browser.