1 | ;; Copyright 1995 Crack dot Com, All Rights reserved
|
---|
2 | ;; See licensing information for more details on usage rights
|
---|
3 |
|
---|
4 | (setq bright_tint (def_tint "art/tints/cop/bright.spe")) ;; used when the player fires a weapon
|
---|
5 | (setq player_tints (make-array 8 :initial-contents (list
|
---|
6 | 0 ; 0 this is not used
|
---|
7 | (def_tint "art/tints/cop/blue.spe") ; 1 bright blue
|
---|
8 | (def_tint "art/tints/cop/yellow.spe") ; 2 yellow
|
---|
9 | (def_tint "art/tints/cop/fire.spe") ; 3 red-yellow
|
---|
10 | (def_tint "art/tints/cop/olive.spe") ; 4 green
|
---|
11 | (def_tint "art/tints/cop/pinkish.spe") ; 5 pink
|
---|
12 | (def_tint "art/tints/cop/darkblue.spe") ; 6 darkblue
|
---|
13 | (def_tint "art/tints/cop/purple.spe") ; 7 purple
|
---|
14 |
|
---|
15 | )))
|
---|
16 |
|
---|
17 | (setq player_text_color (make-array 8 :initial-contents (list
|
---|
18 | 43 ; 0 brown
|
---|
19 | 216 ; 1 blue
|
---|
20 | 76 ; 2 yellow
|
---|
21 | 82 ; 3 orange
|
---|
22 | 148 ; 4 green2
|
---|
23 | 90 ; 5 red
|
---|
24 | 231 ; 6 darkblue
|
---|
25 | 192))) ; 7 purple
|
---|
26 |
|
---|
27 | (setq cop_dead_parts (make-array (* 4 3) :initial-contents
|
---|
28 | ; head arm leg
|
---|
29 | '((CP_1 "4dha") (CP_2 "4daa") (CP_3 "4dba") ; disapear
|
---|
30 | (CP_4 "4dhf") (CP_5 "4daf") (CP_6 "4dbf") ; flaming
|
---|
31 | (CP_7 "4dae") (CP_8 "4dle") (CP_9 "4dbe") ; electrical
|
---|
32 | (CP_10 "4dhn") (CP_11 "4dan") (CP_12 "4dbn")))) ; normal
|
---|
33 |
|
---|
34 |
|
---|
35 | (do ((i 0 (setq i (+ i 1))))
|
---|
36 | ((>= i 12) nil)
|
---|
37 | (setq (aref cop_dead_parts i)
|
---|
38 | (make_dead_part (car (aref cop_dead_parts i))
|
---|
39 | (car (cdr (aref cop_dead_parts i))) 4 "art/cop.spe" 'dead_cop_part_draw)))
|
---|
40 |
|
---|
41 |
|
---|
42 |
|
---|
43 |
|
---|
44 |
|
---|
45 | (setf fast_image (def_image "art/misc.spe" "fast_image"))
|
---|
46 | (setf fly_image (def_image "art/misc.spe" "fly_image"))
|
---|
47 | (setf sneaky_image (def_image "art/misc.spe" "sneaky_image"))
|
---|
48 | (setf health_image (def_image "art/misc.spe" "b_check_image"))
|
---|
49 | (setf shlamp_image (def_image "addon/aliens/aliens.spe" "slmp_img"))
|
---|
50 |
|
---|
51 |
|
---|
52 |
|
---|
53 | (defun give_player_health (amount)
|
---|
54 | (let ((h_amount (select difficulty
|
---|
55 | ('easy amount)
|
---|
56 | ('medium (/ (* amount 3) 4))
|
---|
57 | ('hard (/ amount 2))
|
---|
58 | ('extreme (/ amount 5))))
|
---|
59 | (h_max (if (eq special_power HEALTH_POWER)
|
---|
60 | 200
|
---|
61 | 100)))
|
---|
62 | (if (eq (hp) h_max)
|
---|
63 | nil
|
---|
64 | (progn
|
---|
65 | (if (<= (+ (hp) h_amount) h_max)
|
---|
66 | (add_hp h_amount)
|
---|
67 | (add_hp (- h_max (hp))))
|
---|
68 | (setq b_ramp (+ b_ramp (* h_amount 2)))
|
---|
69 |
|
---|
70 | T)))
|
---|
71 | )
|
---|
72 |
|
---|
73 |
|
---|
74 |
|
---|
75 | (defun pressing_action_key ()
|
---|
76 | (> (player_y_suggest) 0))
|
---|
77 |
|
---|
78 |
|
---|
79 | ; signals for user function
|
---|
80 | (enum 'SET_SNEAKY_TIME
|
---|
81 | 'SET_VISOR_TIME
|
---|
82 | 'SET_FAST_TIME
|
---|
83 | 'SET_FADE_COUNT
|
---|
84 | )
|
---|
85 |
|
---|
86 |
|
---|
87 | ; states for cop
|
---|
88 | (enum 'JUST_START
|
---|
89 | 'NORMAL_PLAY)
|
---|
90 |
|
---|
91 |
|
---|
92 | (enum 'NO_POWER
|
---|
93 | 'FAST_POWER
|
---|
94 | 'FLY_POWER
|
---|
95 | 'SNEAKY_POWER
|
---|
96 | 'HEALTH_POWER
|
---|
97 | 'SHLAMP)
|
---|
98 |
|
---|
99 | ; this is called by the engine when a level is loaded with no player_info in it
|
---|
100 | ; i.e. not for savegames
|
---|
101 | ; this function is called once for each player object
|
---|
102 | (defun set_player_defaults ()
|
---|
103 | (set_ambient_light (me) 35)
|
---|
104 | (set_aistate 0)
|
---|
105 | (set_fade_count 0)
|
---|
106 | (setq in_climbing_area 0)
|
---|
107 | (setq disable_top_draw 0)
|
---|
108 | (setq just_hit 0)
|
---|
109 | (setq used_special_power 0)
|
---|
110 | (setq has_saved_this_level 0)
|
---|
111 | (setq r_ramp 0)
|
---|
112 | (setq g_ramp 0)
|
---|
113 | (setq b_ramp 0)
|
---|
114 | (setq is_teleporting 0)
|
---|
115 | (setq just_fired 0)
|
---|
116 | (setq has_compass 0)
|
---|
117 | (setq special_power NO_POWER))
|
---|
118 |
|
---|
119 |
|
---|
120 |
|
---|
121 | (defun cop_ufun (signal value)
|
---|
122 | (if (< (total_objects) 1) ; make sure upper body is there
|
---|
123 | nil
|
---|
124 | (select signal
|
---|
125 | (SET_SNEAKY_TIME
|
---|
126 | (progn
|
---|
127 | (set_sneaky_time value)
|
---|
128 | (with_obj0 (set_sneaky_time value))))
|
---|
129 | (SET_VISOR_TIME (set_visor_time value))
|
---|
130 | (SET_FAST_TIME
|
---|
131 | (progn
|
---|
132 | (set_fast_time value)
|
---|
133 | (with_obj0 (set_fast_time value))))
|
---|
134 | (SET_FADE_COUNT (set_fade_count value)
|
---|
135 | (with_obj0 (set_fade_count value)))
|
---|
136 |
|
---|
137 | )))
|
---|
138 |
|
---|
139 |
|
---|
140 | (defun cop_adjust_top (return)
|
---|
141 | (if (< (total_objects) 1) ;; should be here
|
---|
142 | (let ((me (me)))
|
---|
143 | (link_object (add_object_after MGUN_TOP (x) (y)))
|
---|
144 | (with_obj0 (link_object me))
|
---|
145 | ))
|
---|
146 | return
|
---|
147 | )
|
---|
148 |
|
---|
149 | (defun climb_off_handler ()
|
---|
150 | (if (next_picture)
|
---|
151 | (progn
|
---|
152 | (view_push_down 4)
|
---|
153 | 0)
|
---|
154 | (progn
|
---|
155 | (set_y (- (y) 28))
|
---|
156 | (set_state stopped)
|
---|
157 | 0)))
|
---|
158 |
|
---|
159 | (defun climb_handler (xm ym but)
|
---|
160 | (let ((yd in_climbing_area))
|
---|
161 | (setq in_climbing_area 0)
|
---|
162 | (if (eq (state) climb_off)
|
---|
163 | (climb_off_handler)
|
---|
164 | (if (eq (state) climbing)
|
---|
165 | (progn
|
---|
166 | (if (> ym 0)
|
---|
167 | (progn
|
---|
168 | (if (eq (current_frame) 0) (set_current_frame 9)
|
---|
169 | (set_current_frame (- (current_frame) 1)))
|
---|
170 | (set_y (+ (y) 3)))
|
---|
171 | (if (< ym 0)
|
---|
172 | (progn
|
---|
173 | (if (< yd 32)
|
---|
174 | (set_state climb_off)
|
---|
175 | (progn
|
---|
176 | (if (not (next_picture)) (set_state climbing))
|
---|
177 | (set_y (- (y) 3)))))))
|
---|
178 | (if (not (eq xm 0))
|
---|
179 | (if (can_see (x) (- (y) 20) (x) (y) nil)
|
---|
180 | (if (eq ym 0)
|
---|
181 | (progn
|
---|
182 | (set_state run_jump_fall)
|
---|
183 | (set_gravity 1))
|
---|
184 | (progn
|
---|
185 | (set_state run_jump)
|
---|
186 | (set_yvel (get_ability jump_yvel))
|
---|
187 | (set_gravity 1)
|
---|
188 | ))))
|
---|
189 |
|
---|
190 | 0)
|
---|
191 | (if (and (>= (yvel) 0) (or (> ym 0)
|
---|
192 | (and (< ym 0) (> yd 8))))
|
---|
193 | (progn
|
---|
194 | (set_state climbing)
|
---|
195 | (set_gravity 0)
|
---|
196 | (set_xvel 0)
|
---|
197 | (set_yvel 0)
|
---|
198 | (set_xacel 0)
|
---|
199 | (set_yacel 0)
|
---|
200 | 0)
|
---|
201 | (progn
|
---|
202 | (next_picture)
|
---|
203 | (cop_adjust_top (mover xm ym but))))
|
---|
204 | ))))
|
---|
205 |
|
---|
206 |
|
---|
207 | (defun undo_special_power (xm ym but)
|
---|
208 | (select special_power
|
---|
209 | (FAST_POWER (setq used_special_power 0))
|
---|
210 | (SNEAKY_POWER (if (> used_special_power 0)
|
---|
211 | (setq used_special_power (- used_special_power 1))))))
|
---|
212 |
|
---|
213 | (defun do_special_power (xm ym but)
|
---|
214 | (select special_power
|
---|
215 | (FLY_POWER
|
---|
216 | (add_object CLOUD (+ (+ (x) (* (direction) -10)) (random 5)) (+ (y) (random 5)))
|
---|
217 | (set_state run_jump)
|
---|
218 | (set_gravity 1)
|
---|
219 | (set_yacel 0)
|
---|
220 | (if (> (yvel) 0) (set_yvel (/ (yvel) 2)))
|
---|
221 | (set_yvel (- (yvel) 2))
|
---|
222 | (if (< ym 0)
|
---|
223 | (set_yvel (- (yvel) 1)))
|
---|
224 | )
|
---|
225 |
|
---|
226 |
|
---|
227 | (FAST_POWER
|
---|
228 | (setq used_special_power 1)
|
---|
229 | (setq last1_x (x))
|
---|
230 | (setq last1_y (y))
|
---|
231 | (if (> (total_objects) 0)
|
---|
232 | (with_obj0
|
---|
233 | (if (> fire_delay1 0)
|
---|
234 | (setq fire_delay1 (- fire_delay1 1)))))
|
---|
235 |
|
---|
236 |
|
---|
237 | (let ((in_area in_climbing_area)
|
---|
238 | (old_yvel (yvel)))
|
---|
239 | (player_move xm ym but)
|
---|
240 | (setq in_climbing_area in_area)
|
---|
241 | (if (and (< ym 0) (eq old_yvel 0) (< (yvel) 0))
|
---|
242 | (set_yvel (+ (yvel) (/ (yvel) 3))))
|
---|
243 |
|
---|
244 | )
|
---|
245 |
|
---|
246 | (setq last2_x (x))
|
---|
247 | (setq last2_y (y)))
|
---|
248 |
|
---|
249 | (SNEAKY_POWER (if (<= used_special_power 15)
|
---|
250 | (setq used_special_power (+ used_special_power 1))))
|
---|
251 | ))
|
---|
252 |
|
---|
253 | (defun player_move (xm ym but)
|
---|
254 | (if (eq in_climbing_area 0)
|
---|
255 | (progn
|
---|
256 | (if (eq (state) climbing)
|
---|
257 | (progn
|
---|
258 | (set_gravity 1)
|
---|
259 | (set_state run_jump_fall)))
|
---|
260 | (next_picture)
|
---|
261 | (cop_adjust_top (mover xm ym but)))
|
---|
262 | (climb_handler xm ym but)))
|
---|
263 |
|
---|
264 | /*(defun cop_mover (xm ym but)
|
---|
265 | (if (> (yvel) 10)
|
---|
266 | (progn
|
---|
267 | (set_yacel 0)
|
---|
268 | (set_yvel (- (yvel) 1)))) ;; terminal velocity
|
---|
269 | (select (aistate)
|
---|
270 | (JUST_START
|
---|
271 | (if (eq but 0) ; wait till user lets go of button before moving
|
---|
272 | (progn
|
---|
273 | (set_aistate NORMAL_PLAY)
|
---|
274 | (mover xm ym but))
|
---|
275 | (cop_adjust_top (tick))))
|
---|
276 | (NORMAL_PLAY
|
---|
277 | (if (or (<= (hp) 0) (eq (state) dieing) (eq (state) dead)) ; are we dead?
|
---|
278 | (progn
|
---|
279 | (if (not (eq (state) dead))
|
---|
280 | (if (not (eq (state) dieing))
|
---|
281 | (progn
|
---|
282 | (set_state dieing)
|
---|
283 | (set_xvel 0)
|
---|
284 | (set_yvel 0)
|
---|
285 | (set_xacel 0)
|
---|
286 | (set_yacel 0))
|
---|
287 | (if (not (next_picture))
|
---|
288 | (set_state dead) nil))
|
---|
289 | (if (not (eq but 0)) ; wait till dead and pressing but, then reset
|
---|
290 | (progn
|
---|
291 | (restart_player)
|
---|
292 | (set_aistate JUST_START))
|
---|
293 | (cop_adjust_top (tick))))
|
---|
294 | 0)
|
---|
295 |
|
---|
296 | ; normal play code
|
---|
297 | (progn
|
---|
298 | ; check to see if player is firing
|
---|
299 | (if (equal (bit-and but 1) 1)
|
---|
300 | (do_special_power xm ym but)
|
---|
301 | (undo_special_power xm ym but))
|
---|
302 |
|
---|
303 | (let ((ret (player_move xm ym but))
|
---|
304 | (other (me)))
|
---|
305 | (with_obj0
|
---|
306 | (progn
|
---|
307 | (set_x (with_object other (x)))
|
---|
308 | (set_y (- (- (with_object other (y)) -29)
|
---|
309 | (with_object other (picture_height))))
|
---|
310 | ))
|
---|
311 | (if (and (equal (bit-and but 2) 2)
|
---|
312 | (not (eq (state) dead)) (not (eq (state) dieing)))
|
---|
313 | (let ((ammo (ammo_total (current_weapon_type))))
|
---|
314 | (add_ammo (current_weapon_type) (with_obj0
|
---|
315 | (user_fun 'FIRE ammo)))
|
---|
316 | nil))
|
---|
317 | ret)
|
---|
318 | )))))
|
---|
319 |
|
---|
320 | )*/
|
---|
321 |
|
---|
322 | ;;(defun normal_bottom_mover () ;; just runs around
|
---|
323 |
|
---|
324 | (defun dead_cop_part_draw ()
|
---|
325 | (if (eq (aitype) 0)
|
---|
326 | (draw)
|
---|
327 | (draw_tint (aref player_tints (aitype)))))
|
---|
328 |
|
---|
329 | (defun bottom_damage (amount from hitx hity push_xvel push_yvel) ; transfer damage to lower half
|
---|
330 | (if (eq is_teleporting 1)
|
---|
331 | nil
|
---|
332 | (let ((amount (select difficulty;; reduce damage according to difficulty
|
---|
333 | ('easy (/ amount 2))
|
---|
334 | ('medium (/ (* amount 3) 4))
|
---|
335 | ('hard amount)
|
---|
336 | ('extreme (* amount 3))
|
---|
337 | )))
|
---|
338 |
|
---|
339 |
|
---|
340 | (select (aistate)
|
---|
341 | (NORMAL_PLAY (if (and (not (eq (state) dieing)) (not (eq (state) dead)))
|
---|
342 | (progn
|
---|
343 | (if (eq (random 2) 0)
|
---|
344 | (set_state flinch_up)
|
---|
345 | (set_state flinch_down))
|
---|
346 | (if (local_player)
|
---|
347 | (progn
|
---|
348 | (setq r_ramp (+ r_ramp (* amount 7)))
|
---|
349 | (setq g_ramp (- g_ramp (* amount 14)))
|
---|
350 | (setq b_ramp (- b_ramp (* amount 14)))
|
---|
351 | (if (> r_ramp 120) (setq r_ramp 120))
|
---|
352 | (if (< g_ramp 0) (setq g_ramp 0))
|
---|
353 | (if (< b_ramp 0) (setq b_ramp 0))))
|
---|
354 |
|
---|
355 | (damage_fun amount from hitx hity (/ push_xvel 2) (/ push_yvel 2))
|
---|
356 | (if (eq (hp) 0)
|
---|
357 | (progn
|
---|
358 | (if (and (time_for_next_level) (nth current_net_level net_levels))
|
---|
359 | (progn
|
---|
360 | (show_kills)
|
---|
361 | (reset_kills)
|
---|
362 | (setq current_net_level (+ current_net_level 1))
|
---|
363 | (if (not (nth current_net_level net_levels))
|
---|
364 | (setq current_net_level 0))
|
---|
365 |
|
---|
366 | ;; save the level we are so joining clients know which one to load
|
---|
367 | (if (not (am_a_client))
|
---|
368 | (open_file "addon/deathmat/cur_lev.lsp" "wb"
|
---|
369 | (print `(setq current_net_level ,current_net_level))))
|
---|
370 |
|
---|
371 | (request_level_load (nth current_net_level net_levels))))
|
---|
372 |
|
---|
373 | (create_dead_parts cop_dead_parts (* (get_dead_part from) 3) (player_number))
|
---|
374 | (play_sound (aref PLAYER_DEATH (random 4)) 127 (x) (y)))
|
---|
375 | (if (> amount 8)
|
---|
376 | (play_sound (aref PLAYER_PAIN (random 4)) 127 (x) (y)))))))
|
---|
377 |
|
---|
378 |
|
---|
379 | )))
|
---|
380 | )
|
---|
381 |
|
---|
382 | (defun should_draw_top? (mode)
|
---|
383 | (select mode
|
---|
384 | (JUST_START T)
|
---|
385 | (NORMAL_PLAY T)))
|
---|
386 |
|
---|
387 | (defun change_mode (new_mode)
|
---|
388 | (setq disable_top_draw (if (should_draw_top? new_mode) 0 1))
|
---|
389 | (set_aistate new_mode))
|
---|
390 |
|
---|
391 | (defun draw_fast ()
|
---|
392 | (if (local_player)
|
---|
393 | (put_image (- (view_x2) 20) (+ (view_y1) 5) fast_image))
|
---|
394 | (if (eq used_special_power 1)
|
---|
395 | (if (> (total_objects) 0)
|
---|
396 | (let ((nowx (x))
|
---|
397 | (nowy (y))
|
---|
398 | (l2x last2_x)
|
---|
399 | (l2y last2_y)
|
---|
400 | (l1x last1_x)
|
---|
401 | (l1y last1_y)
|
---|
402 | (td (top_draw_state (state)))
|
---|
403 | (h (picture_height)))
|
---|
404 |
|
---|
405 | (set_x l2x)
|
---|
406 | (set_y l2y)
|
---|
407 | (draw_transparent 5 16)
|
---|
408 | (if td (with_obj0 (progn (set_x l2x)
|
---|
409 | (set_y (- (- l2y -29) h))
|
---|
410 | (draw_transparent 5 16))))
|
---|
411 | (set_x last1_x)
|
---|
412 | (set_y last1_y)
|
---|
413 | (draw_transparent 10 16)
|
---|
414 |
|
---|
415 | (if td (with_obj0 (progn (set_x l1x)
|
---|
416 | (set_y (- (- l1y -29) h))
|
---|
417 | (draw_transparent 10 16)
|
---|
418 | (set_x nowx)
|
---|
419 | (set_y nowy)
|
---|
420 | )))
|
---|
421 |
|
---|
422 | (set_x nowx)
|
---|
423 | (set_y nowy)))))
|
---|
424 |
|
---|
425 | (defun sneaky_draw (count num)
|
---|
426 | (print count)
|
---|
427 | (if (eq count 0)
|
---|
428 | (player_draw num)
|
---|
429 | (if (> count 15)
|
---|
430 | (draw_predator)
|
---|
431 | (draw_transparent count 16))))
|
---|
432 |
|
---|
433 | (defun player_draw (num)
|
---|
434 | (if (eq num 0)
|
---|
435 | (if (eq just_fired 1) ;; if they just fired a weapon, draw them lite up.. use the bright tint
|
---|
436 | (progn
|
---|
437 | (draw_tint bright_tint)
|
---|
438 | (setq just_fired 0)) ;; ok to change this in the draw function only if it is not accessed anywhere else!
|
---|
439 | (draw)
|
---|
440 | ; (draw_tint (aref player_tints (aitype)))
|
---|
441 | )
|
---|
442 | (if (eq just_fired 1)
|
---|
443 | (progn
|
---|
444 | (draw_double_tint (aref player_tints num) bright_tint)
|
---|
445 | (setq just_fired 0)) ;; ok to change this in the draw function only if it is not accessed anywhere else!
|
---|
446 | (draw_tint (aref player_tints num)))))
|
---|
447 |
|
---|
448 | /* (defun bottom_draw ()
|
---|
449 | (if (not (and (eq r_ramp 0) ;; need to draw red palette
|
---|
450 | (eq g_ramp 0)
|
---|
451 | (eq b_ramp 0)))
|
---|
452 | (progn
|
---|
453 | (if (> r_ramp 7)
|
---|
454 | (setq r_ramp (- r_ramp 7))
|
---|
455 | (if (< r_ramp -7)
|
---|
456 | (setq r_ramp (+ r_ramp 7))
|
---|
457 | (setq r_ramp 0)))
|
---|
458 |
|
---|
459 | (if (> g_ramp 7)
|
---|
460 | (setq g_ramp (- g_ramp 7))
|
---|
461 | (if (< g_ramp -7)
|
---|
462 | (setq g_ramp (+ g_ramp 7))
|
---|
463 | (setq g_ramp 0)))
|
---|
464 |
|
---|
465 | (if (> b_ramp 7)
|
---|
466 | (setq b_ramp (- b_ramp 7))
|
---|
467 | (if (< b_ramp -7)
|
---|
468 | (setq b_ramp (+ b_ramp 7))
|
---|
469 | (setq b_ramp 0)))
|
---|
470 |
|
---|
471 | (if (local_player)
|
---|
472 | (tint_palette r_ramp g_ramp b_ramp))))
|
---|
473 |
|
---|
474 |
|
---|
475 | (select (aistate)
|
---|
476 | (JUST_START (player_draw (player_number)))
|
---|
477 | (NORMAL_PLAY
|
---|
478 | (select special_power
|
---|
479 | (NO_POWER (player_draw (player_number)))
|
---|
480 | (HEALTH_POWER (player_draw (player_number))
|
---|
481 | (if (local_player)
|
---|
482 | (put_image (- (view_x2) 20) (+ (view_y1) 5) health_image)))
|
---|
483 | (FAST_POWER (draw_fast) (player_draw (player_number)))
|
---|
484 | (FLY_POWER (player_draw (player_number))
|
---|
485 | (if (local_player)
|
---|
486 | (put_image (- (view_x2) 20) (+ (view_y1) 5) fly_image)))
|
---|
487 | (SNEAKY_POWER
|
---|
488 | (if (local_player)
|
---|
489 | (put_image (- (view_x2) 20) (+ (view_y1) 5) sneaky_image))
|
---|
490 | (sneaky_draw used_special_power (player_number)))
|
---|
491 | (SHLAMP (player_draw (bottom_draw (player_number)))
|
---|
492 | (if (local_player)
|
---|
493 | (put_image (- (view_x2) 20) (+ (view_y1) 5) shlamp_image)))
|
---|
494 | ))))
|
---|
495 | )))) */
|
---|
496 |
|
---|
497 | (defun new_bottom_draw()
|
---|
498 | (if (eq special_power SHLAMP)
|
---|
499 | (progn
|
---|
500 | (setq special_power NO_POWER)
|
---|
501 | (bottom_draw)
|
---|
502 | (setq special_power SHLAMP)
|
---|
503 | )
|
---|
504 | (bottom_draw)
|
---|
505 | )
|
---|
506 | )
|
---|
507 |
|
---|
508 | (defun restart_player ()
|
---|
509 | (setq special_power 0)
|
---|
510 | (setq has_compass 0)
|
---|
511 | (if (and (local_player) (not (and (eq r_ramp 0)
|
---|
512 | (eq g_ramp 0)
|
---|
513 | (eq b_ramp 0))))
|
---|
514 | (progn
|
---|
515 | (setq r_ramp 0)
|
---|
516 | (setq g_ramp 0)
|
---|
517 | (setq b_ramp 0)
|
---|
518 | (tint_palette 0 0 0)))
|
---|
519 |
|
---|
520 | (if (eq (total_players) 1) ;; is this a single player game?
|
---|
521 | (request_level_load (if (eq has_saved_this_level 0)
|
---|
522 | (progn
|
---|
523 | (set_hp 100)
|
---|
524 | (level_name))
|
---|
525 | (concatenate 'string "save" (digstr has_saved_this_level 4) ".spe")))
|
---|
526 | (reset_player)
|
---|
527 |
|
---|
528 | ))
|
---|
529 |
|
---|
530 |
|
---|
531 |
|
---|
532 | (defun start_cache (type)
|
---|
533 | `((,DARNEL) nil))
|
---|
534 |
|
---|
535 | (def_char START
|
---|
536 | (funs (ai_fun do_nothing)
|
---|
537 | (get_cache_list_fun start_cache)
|
---|
538 | (draw_fun dev_draw))
|
---|
539 | (range 0 0)
|
---|
540 | (states "art/misc.spe" (stopped "start_image")))
|
---|
541 |
|
---|
542 |
|
---|
543 | (defun cop_cache (type)
|
---|
544 | `(() (,bright_tint)))
|
---|
545 |
|
---|
546 | (defun p_compass_draw (player)
|
---|
547 | (if player
|
---|
548 | (with_object player
|
---|
549 | (if (or (not (eq special_power SNEAKY_POWER)) (local_player))
|
---|
550 | (let ((spot (game_to_mouse (x) (y))))
|
---|
551 | (draw_rect (- (first spot) 1)
|
---|
552 | (- (second spot) 1)
|
---|
553 | (+ (first spot) 1)
|
---|
554 | (+ (second spot) 1)
|
---|
555 | (aref player_text_color (player_number)))))
|
---|
556 | (p_compass_draw (next_focus player)))))
|
---|
557 |
|
---|
558 |
|
---|
559 | (defun compass_draw ()
|
---|
560 | (if (and (local_player) (eq (mod (game_tick) 2) 0))
|
---|
561 | (if (eq has_compass 1)
|
---|
562 | (p_compass_draw (first_focus))
|
---|
563 | (let ((spot (game_to_mouse (x) (y))))
|
---|
564 | (draw_rect (- (first spot) 1)
|
---|
565 | (- (second spot) 1)
|
---|
566 | (+ (first spot) 1)
|
---|
567 | (+ (second spot) 1)
|
---|
568 | (aref player_text_color (player_number)))))))
|
---|
569 |
|
---|
570 |
|
---|
571 | (def_char DARNEL
|
---|
572 | (vars in_climbing_area
|
---|
573 | disable_top_draw
|
---|
574 | just_hit
|
---|
575 | ship_pan_x
|
---|
576 | special_power
|
---|
577 | used_special_power
|
---|
578 | last1_x last1_y
|
---|
579 | last2_x last2_y
|
---|
580 | has_saved_this_level
|
---|
581 | r_ramp g_ramp b_ramp
|
---|
582 | is_teleporting
|
---|
583 | just_fired
|
---|
584 | has_compass
|
---|
585 | )
|
---|
586 | (range 50 50)
|
---|
587 | (abilities (walk_top_speed 3)
|
---|
588 | (jump_yvel -15)
|
---|
589 | (run_top_speed 9)
|
---|
590 | (jump_top_speed 10)
|
---|
591 | (jump_xvel 9)
|
---|
592 | (stop_accel 9)
|
---|
593 | (start_accel 8)
|
---|
594 | (start_hp 100)
|
---|
595 | (hamper_xrange 80)
|
---|
596 | (push_xrange 9))
|
---|
597 |
|
---|
598 | (flags (hurtable T)
|
---|
599 | (unlistable T))
|
---|
600 |
|
---|
601 | (funs (move_fun cop_mover)
|
---|
602 | (damage_fun bottom_damage)
|
---|
603 | (draw_fun new_bottom_draw)
|
---|
604 | (map_draw_fun compass_draw)
|
---|
605 | (get_cache_list_fun cop_cache)
|
---|
606 | (user_fun cop_ufun))
|
---|
607 |
|
---|
608 | (states "art/cop.spe"
|
---|
609 | (stopped (seq "stopped" 1 6))
|
---|
610 | (running (seq "4wlk" 1 10))
|
---|
611 |
|
---|
612 | (fast_running (seq "4fst" 1 10))
|
---|
613 | (fly_running (seq "4fly" 1 10))
|
---|
614 |
|
---|
615 | (fast_stopped (seq "bot2" 7 12))
|
---|
616 | (fly_stopped (seq "bot2" 1 6))
|
---|
617 |
|
---|
618 | (dead "dead")
|
---|
619 |
|
---|
620 | (start_run_jump "jump_up")
|
---|
621 | (run_jump "jump_up")
|
---|
622 | (run_jump_fall "jump_down")
|
---|
623 | (end_run_jump (seq "4jmp" 3 5))
|
---|
624 |
|
---|
625 | (fly_start_run_jump "4flj0002.pcx")
|
---|
626 | (fly_run_jump "4flj0002.pcx")
|
---|
627 | (fly_run_jump_fall "4flj0003.pcx")
|
---|
628 | (fly_end_run_jump (seq "4flj" 4 6))
|
---|
629 |
|
---|
630 | (fast_start_run_jump "4fjp0002.pcx")
|
---|
631 | (fast_run_jump "4fjp0002.pcx")
|
---|
632 | (fast_run_jump_fall "4fjp0003.pcx")
|
---|
633 | (fast_end_run_jump (seq "4fjp" 4 6))
|
---|
634 |
|
---|
635 |
|
---|
636 | (flinch_up (rep "4flh0002.pcx" 4))
|
---|
637 | (flinch_down (rep "4flh0003.pcx" 4))
|
---|
638 |
|
---|
639 | (climbing (seq "4lad" 1 10))
|
---|
640 | (climb_off (seq "4off" 1 8))
|
---|
641 | (climb_on (seq "4off" 8 1))
|
---|
642 | ))
|
---|
643 |
|
---|
644 |
|
---|
645 | (defun clone_ai ()
|
---|
646 | (if (and (< (state_time) 200) (not (eq (state) dead)))
|
---|
647 | (progn
|
---|
648 | (select (direction)
|
---|
649 | (1 (if (blocked_right (move 1 0 0))
|
---|
650 | (set_direction -1)
|
---|
651 | nil))
|
---|
652 | (-1 (if (blocked_left (move -1 0 0))
|
---|
653 | (set_direction 1)
|
---|
654 | nil)))
|
---|
655 | (if (or (> (state_time) 185) (eq (state) dieing))
|
---|
656 | (set_fade_count (+ (fade_count) 1))
|
---|
657 | nil)
|
---|
658 | T)
|
---|
659 | nil))
|
---|
660 |
|
---|
661 |
|
---|
662 |
|
---|
663 |
|
---|
664 | (defun top_draw_state (state)
|
---|
665 |
|
---|
666 | (or (eq state stopped) (eq state running)
|
---|
667 | (eq state run_jump) (eq state run_jump_fall)
|
---|
668 | (eq state end_run_jump)))
|
---|
669 |
|
---|
670 | /*(defun top_draw ()
|
---|
671 | (if (> (total_objects) 0)
|
---|
672 | (let ((other (get_object 0)))
|
---|
673 | (if (or (with_object other (morphing))
|
---|
674 | (eq (with_object other disable_top_draw) 1)
|
---|
675 | (not (top_draw_state (with_object other (state)))))
|
---|
676 | nil
|
---|
677 | (progn
|
---|
678 | (if (eq (with_object other special_power) SNEAKY_POWER)
|
---|
679 | (sneaky_draw (with_object other used_special_power)
|
---|
680 | (with_object other (player_number)))
|
---|
681 | (let ((nowx (x))
|
---|
682 | (nowy (y)))
|
---|
683 | (set_x (with_object other (if (> (direction) 0) (x) (+ (x) 2))))
|
---|
684 | (set_y (- (- (with_object other (y)) -29) (with_object other (picture_height))))
|
---|
685 | (player_draw (with_object other (player_number)))
|
---|
686 | (set_x nowx)
|
---|
687 | (set_y nowy))
|
---|
688 | ))))))
|
---|
689 | */
|
---|
690 |
|
---|
691 | (defun ammo_type ()
|
---|
692 | (select (otype)
|
---|
693 | (GRENADE_TOP 2)
|
---|
694 | (MGUN_TOP 10)
|
---|
695 | (FIREBOMB_TOP 5)
|
---|
696 | (ROCKET_TOP 3)
|
---|
697 | (PGUN_TOP 4)
|
---|
698 | (LSABER_TOP 5)
|
---|
699 | (DFIRS_TOP 6)
|
---|
700 | ))
|
---|
701 |
|
---|
702 | (defun ammo_delay ()
|
---|
703 | 0)
|
---|
704 |
|
---|
705 |
|
---|
706 | (defun player_angle_suggestion ()
|
---|
707 | (atan2 (- (y) (player_pointer_y) 16)
|
---|
708 | (- (player_pointer_x) (x))))
|
---|
709 |
|
---|
710 |
|
---|
711 | (defun player_fire_weapon (type target)
|
---|
712 | (let ((angle (with_obj0 (player_angle_suggestion))))
|
---|
713 |
|
---|
714 | (let ((firex (+ (x) (* (cos angle) 17) (xvel)))
|
---|
715 | (firey (+ (- (y) (* (sin angle) 16) 20) (yvel))))
|
---|
716 | (if (can_see (x) (- (y) 16) firex firey nil)
|
---|
717 | (progn
|
---|
718 | (fire_object (get_object 0) type firex firey angle target)
|
---|
719 | T)
|
---|
720 | nil))))
|
---|
721 |
|
---|
722 | /* (defun top_ai ()
|
---|
723 | (if (> (total_objects) 0)
|
---|
724 | (let ((myself (get_object 0)))
|
---|
725 |
|
---|
726 | (set_state rotate)
|
---|
727 | (let ((angle (with_object myself
|
---|
728 | (if (> (direction) 0)
|
---|
729 | (player_angle_suggestion)
|
---|
730 | (if (> (player_angle_suggestion) 180)
|
---|
731 | (- (player_angle_suggestion) 180)
|
---|
732 | (+ 180 (player_angle_suggestion)))))))
|
---|
733 | (setq point_angle angle)
|
---|
734 | (set_frame_angle 0 359 angle))
|
---|
735 | (if (not (eq fire_delay1 0))
|
---|
736 | (setq fire_delay1 (- fire_delay1 1)))
|
---|
737 | (if (eq (with_object myself (weapon_to_type (current_weapon_type))) (otype))
|
---|
738 | (select (aistate)
|
---|
739 | (2 ; start fire up
|
---|
740 | (progn
|
---|
741 | (set_state rotate_fire)
|
---|
742 | (set_frame_angle 0 359 (with_object myself
|
---|
743 | (if (> (direction) 0)
|
---|
744 | (player_angle_suggestion)
|
---|
745 | (if (> (player_angle_suggestion) 180)
|
---|
746 | (- (player_angle_suggestion) 180)
|
---|
747 | (+ 180 (player_angle_suggestion))))))
|
---|
748 | ;; (set_state weapon_fire)
|
---|
749 | ;; (set_fire_delay1 3)
|
---|
750 |
|
---|
751 | ;; (let ((otype (otype)))
|
---|
752 | ;; (with_object myself (add_ammo otype -1)))
|
---|
753 | ;; (with_object (add_object (ammo_type) (x) (- (y) 16) 1)
|
---|
754 | ;; (user_fun myself))
|
---|
755 | (set_aistate 3)))
|
---|
756 | (1 ; special power
|
---|
757 | (progn (set_state weapon_fire_up)
|
---|
758 | (let ((otype (otype)))
|
---|
759 | (with_object myself (add_ammo weapon_type -1)))
|
---|
760 | (with_object (add_object (ammo_type) (x) (- (y) 20) 2)
|
---|
761 | (user_fun myself))
|
---|
762 | (set_aistate 3)))
|
---|
763 | (3 (if (eq fire_delay1 0) ;; (user_fun 'RESET_FIRE_OK nil)
|
---|
764 | (set_aistate 0)
|
---|
765 | (progn
|
---|
766 | (user_fun 'CONTINUE_FIRE nil)
|
---|
767 | (setq fire_delay1 (- fire_delay1 1)))
|
---|
768 | )))
|
---|
769 | (set_otype (with_object myself (weapon_to_type (current_weapon_type)))))))
|
---|
770 | (move 0 0 0)
|
---|
771 | T)
|
---|
772 |
|
---|
773 | ;(defun top_damage (amount from hitx hity push_xvel push_yvel) ; transfer damage to lower half
|
---|
774 | ; (with_obj0 (damage_fun amount from hitx hity push_xvel push_yvel)))
|
---|
775 |
|
---|
776 |
|
---|
777 | (defun laser_ufun (signal value)
|
---|
778 | (select signal
|
---|
779 | ('FIRE (if (eq (aistate) 0) ;; not already firing
|
---|
780 | (if (> value 0) ;; have ammo
|
---|
781 | (progn
|
---|
782 | (setq fire_delay1 3)
|
---|
783 | (set_aistate 2)
|
---|
784 | (if (player_fire_weapon (ammo_type) nil)
|
---|
785 | -1
|
---|
786 | 0))
|
---|
787 | (progn
|
---|
788 | (setq fire_delay1 7)
|
---|
789 | (set_aistate 2)
|
---|
790 | (player_fire_weapon (ammo_type) nil)
|
---|
791 |
|
---|
792 | 0))
|
---|
793 | 0))
|
---|
794 | ('RESET_FIRE_OK (>= (state_time) fire_delay1))))
|
---|
795 |
|
---|
796 | (defun top_ufun (signal value)
|
---|
797 | (select signal
|
---|
798 | ('FIRE (if (and (> value 0) (eq (aistate) 0)) ;; have ammo and not already firing
|
---|
799 | (progn
|
---|
800 | (setq fire_delay1 12)
|
---|
801 | (set_aistate 2)
|
---|
802 | (if (player_fire_weapon (ammo_type) nil)
|
---|
803 | -1
|
---|
804 | 0))
|
---|
805 | 0))
|
---|
806 | ('RESET_FIRE_OK (>= (state_time) fire_delay1))))
|
---|
807 |
|
---|
808 |
|
---|
809 |
|
---|
810 | (defun plaser_ufun (signal value)
|
---|
811 | (select signal
|
---|
812 | ('FIRE (if (and (> value 0) (eq (aistate) 0)) ;; have ammo and not already firing
|
---|
813 | (progn
|
---|
814 | (setq fire_delay1 2)
|
---|
815 | (set_aistate 2)
|
---|
816 | (if (player_fire_weapon (ammo_type) nil)
|
---|
817 | -1 0))
|
---|
818 | 0))
|
---|
819 |
|
---|
820 | ('RESET_FIRE_OK (>= (state_time) fire_delay1))))
|
---|
821 |
|
---|
822 |
|
---|
823 |
|
---|
824 | (defun player_rocket_ufun (signal value)
|
---|
825 | (select signal
|
---|
826 | ('FIRE (if (and (> value 0) (eq (aistate) 0)) ;; have ammo and not already firing
|
---|
827 | (progn
|
---|
828 | (setq fire_delay1 12)
|
---|
829 | (set_aistate 2)
|
---|
830 | (if (player_fire_weapon (ammo_type)
|
---|
831 | (with_obj0 (find_object_in_area
|
---|
832 | (- (x) 160) (- (y) 160)
|
---|
833 | (+ (x) 160) (+ (y) 160)
|
---|
834 | bad_guy_list)))
|
---|
835 | -1 0))
|
---|
836 | 0))
|
---|
837 | ('RESET_FIRE_OK (>= (state_time) fire_delay1)))) */
|
---|
838 |
|
---|
839 |
|
---|
840 |
|
---|
841 |
|
---|
842 | (defun top_cache (type)
|
---|
843 | (list
|
---|
844 | (select type
|
---|
845 | (MGUN_TOP (list SHOTGUN_BULLET))
|
---|
846 | (GRENADE_TOP (list GRENADE))
|
---|
847 | (ROCKET_TOP (list ROCKET))
|
---|
848 | (FIREBOMB_TOP (list FIREBOMB))
|
---|
849 | (PGUN_TOP (list PLASMAGUN_BULLET))
|
---|
850 | (LIGHT_SABER (list LSABER_BULLET))
|
---|
851 | (DFRIS_TOP (list DFRIS_BULLET))
|
---|
852 | nil)))
|
---|
853 |
|
---|
854 |
|
---|
855 | (defun make_top_char (symbol base ufun dfun)
|
---|
856 | (eval (list 'def_char symbol
|
---|
857 | `(funs (ai_fun top_ai)
|
---|
858 | (get_cache_list_fun top_cache)
|
---|
859 | (draw_fun ,dfun)
|
---|
860 | (user_fun ,ufun))
|
---|
861 | '(flags (add_front T)
|
---|
862 | (is_weapon T)
|
---|
863 | (unlistable T))
|
---|
864 | '(vars point_angle fire_delay1 just_fired)
|
---|
865 | `(states "art/coptop.spe"
|
---|
866 | (stopped (seq ,base 1 24))))))
|
---|
867 |
|
---|
868 |
|
---|
869 |
|
---|
870 | (make_top_char 'MGUN_TOP "4gma" 'laser_ufun 'top_draw)
|
---|
871 | (make_top_char 'GRENADE_TOP "4gre" 'top_ufun 'top_draw)
|
---|
872 | (make_top_char 'ROCKET_TOP "4gro" 'player_rocket_ufun 'top_draw)
|
---|
873 | (make_top_char 'FIREBOMB_TOP "4gfi" 'top_ufun 'top_draw)
|
---|
874 |
|
---|
875 |
|
---|
876 |
|
---|
877 |
|
---|
878 | (defun restart_ai ()
|
---|
879 | (if (eq (total_players) 1) ;; only allow saving in single player games
|
---|
880 | (select (aistate)
|
---|
881 | (0 (next_picture)
|
---|
882 | (if (and (touching_bg) (with_object (bg) (pressing_action_key)))
|
---|
883 | (set_aistate 2)))
|
---|
884 | (1 (next_picture);; wait for save (actived state)
|
---|
885 | (if (and (touching_bg) (with_object (bg) (pressing_action_key)))
|
---|
886 | (set_aistate 2)))
|
---|
887 | (2 (set_state running)
|
---|
888 | (set_aistate 3))
|
---|
889 | (3 (set_aistate 4))
|
---|
890 | (4
|
---|
891 | (let ((spot (get_save_slot)))
|
---|
892 | (set_state stopped)
|
---|
893 | (set_aistate 1)
|
---|
894 | (if (not (eq spot 0));; did they escape ?
|
---|
895 | (progn
|
---|
896 | (show_help (concatenate 'string Station (num2str (xvel)) secured))
|
---|
897 | (with_object (bg)
|
---|
898 | (progn
|
---|
899 | (let ((old_hp (hp)))
|
---|
900 | (if (not (eq difficulty 'extreme))
|
---|
901 | (set_hp 100));; save the player with 100 health, unless on extreme
|
---|
902 | (play_sound SAVE_SND 127 (x) (y))
|
---|
903 | (setq has_saved_this_level spot)
|
---|
904 | (save_game (concatenate 'string "save" (digstr spot 4) ".spe"))
|
---|
905 | (set_hp old_hp)
|
---|
906 | ))))))
|
---|
907 |
|
---|
908 | )))
|
---|
909 | T)
|
---|
910 |
|
---|
911 |
|
---|
912 | (def_char RESTART_POSITION
|
---|
913 | (funs (ai_fun restart_ai)
|
---|
914 | (reload_fun lower_reload))
|
---|
915 | (fields ("xvel" restart_station))
|
---|
916 | (states "art/misc.spe"
|
---|
917 | (stopped (app (rep "console" 3) (rep "console2" 3)))
|
---|
918 | (running (rep "console_on" 2))))
|
---|
919 |
|
---|
920 | (defun next_level_ai ()
|
---|
921 | (if (and (touching_bg) (with_object (bg) (pressing_action_key)))
|
---|
922 | (if (eq (aistate) end_level)
|
---|
923 | (request_end_game)
|
---|
924 | (progn
|
---|
925 | (show_stats)
|
---|
926 | (request_level_load (concatenate 'string "levels/level" (digstr (aistate) 2) ".spe")))))
|
---|
927 | T)
|
---|
928 |
|
---|
929 |
|
---|
930 | (def_char NEXT_LEVEL
|
---|
931 | (funs (ai_fun next_level_ai))
|
---|
932 | (flags (can_block T))
|
---|
933 | (fields ("aistate" next_level))
|
---|
934 | (states "art/misc.spe"
|
---|
935 | (stopped "end_port2")))
|
---|
936 |
|
---|
937 | (defun next_level_top_ai ()
|
---|
938 | (shift_rand_table 80)
|
---|
939 | (let ((oldy (y)))
|
---|
940 | (try_move 0 100)
|
---|
941 | (setq floor_yoff (- (y) oldy))
|
---|
942 | (set_y oldy))
|
---|
943 | T)
|
---|
944 |
|
---|
945 | (def_char NEXT_LEVEL_TOP
|
---|
946 | (funs (ai_fun next_level_top_ai))
|
---|
947 | (vars floor_yoff)
|
---|
948 | (draw_range 50 100)
|
---|
949 | (fields ("aistate" next_level))
|
---|
950 | (states "art/misc.spe"
|
---|
951 | (stopped "end_port1")))
|
---|
952 |
|
---|
953 | (defun tele_beam_ai ()
|
---|
954 | (next_picture)
|
---|
955 | (if (> (direction) 0)
|
---|
956 | (if (eq (fade_count) 12)
|
---|
957 | (progn
|
---|
958 | (play_sound APPEAR_SND 100 (x) (y))
|
---|
959 | (set_direction -1))
|
---|
960 | (set_fade_count (+ (fade_count) 1)))
|
---|
961 | (if (eq (fade_count) 5)
|
---|
962 | (progn
|
---|
963 | (play_sound APPEAR_SND 100 (x) (y))
|
---|
964 | (set_direction 1))
|
---|
965 | (set_fade_count (- (fade_count) 1)))))
|
---|
966 |
|
---|
967 |
|
---|
968 | (def_char TELE_BEAM
|
---|
969 | (funs (ai_fun tele_beam_ai))
|
---|
970 | (states "art/chars/teleport.spe" (stopped (seq "beam" 1 5))))
|
---|
971 |
|
---|
972 | (def_char END_OF_S
|
---|
973 | (funs (ai_fun do_nothing))
|
---|
974 | (states "art/misc.spe" (stopped "eos")))
|
---|
975 |
|
---|
976 | (setq load_warn nil)
|
---|
977 | (if (load "register/people.lsp")
|
---|
978 | (setq end_level 99)
|
---|
979 | (setq end_level 4))
|
---|
980 | (setq load_warn T)
|
---|
981 |
|
---|
982 |
|
---|
983 |
|
---|
984 |
|
---|
985 |
|
---|