source: abuse/branches/win32/Abuse32/LISP/PEOPLE.LSP @ 100

Last change on this file since 100 was 100, checked in by Sam Hocevar, 15 years ago
  • Importing an old Win32 port by Jeremy "Marauder" Scott.
File size: 22.0 KB
Line 
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 10 :initial-contents (list
6                                                    (def_tint "art/ball.spe")              ; 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                                        (def_tint "art/tints/cop/africa.spe")    ; 8 fire variant
15                                        (def_tint "art/tints/cop/land.spe")  ; 9 green variant
16)))
17
18;---------------------------------------------------------------------------------
19(setq player_text_color (make-array 10 :initial-contents (list
20                                                         43       ; 0 brown
21                                                         216      ; 1 blue
22                                                         76       ; 2 yellow
23                                                         82       ; 3 orange
24                                                         148      ; 4 green2
25                                                         90       ; 5 red
26                                                         220      ; 6 darkblue
27                                                         192      ; 7 purple
28                                           79      ; 8 fire variant
29                                           140   )))   ; 9 green variant
30
31;---------------------------------------------------------------------------------
32(setq cop_dead_parts (make-array (* 4 3) :initial-contents
33                               ;       head           arm            leg
34                             '((CP_1  "4dha") (CP_2  "4daa") (CP_3  "4dba")     ; disappear
35                               (CP_4  "4dhf") (CP_5  "4daf") (CP_6  "4dbf")     ; flaming
36                               (CP_7  "4dae") (CP_8  "4dle") (CP_9  "4dbe")     ; electrical
37                               (CP_10 "4dhn") (CP_11 "4dan") (CP_12 "4dbn"))))  ; normal
38
39
40(do ((i 0 (setq i (+ i 1))))
41           ((>= i 12) nil)
42           (setq (aref cop_dead_parts i)
43                 (make_dead_part (car (aref cop_dead_parts i))           
44                                 (car (cdr (aref cop_dead_parts i))) 4 "art/cop.spe" 'dead_cop_part_draw)))
45
46
47
48;---------------------------------------------------------------------------------
49(setf fast_image   (def_image "art/misc.spe" "fast_image"))
50(setf fly_image    (def_image "art/misc.spe" "fly_image"))
51(setf sneaky_image (def_image "art/misc.spe" "sneaky_image"))
52(setf health_image (def_image "art/misc.spe" "b_check_image"))
53
54                                 
55
56;---------------------------------------------------------------------------------
57(defun give_player_health (amount)
58  (let ((h_amount  (select difficulty
59                           ('easy    amount)
60                           ('medium  (/ (* amount 3) 4))
61                           ('hard    (/ amount 2))
62                           ('extreme (/ amount 5))))
63        (h_max (if (eq special_power HEALTH_POWER)
64                   200
65                 100)))
66    (if (eq (hp) h_max)
67        nil
68      (progn
69        (if (<= (+ (hp) h_amount) h_max)
70            (add_hp h_amount)
71          (add_hp (- h_max (hp))))
72        (setq b_ramp (+ b_ramp (* h_amount 2)))
73
74        T)))
75)
76   
77
78
79;---------------------------------------------------------------------------------
80(defun pressing_action_key ()
81  (> (player_y_suggest) 0))
82
83
84;---------------------------------------------------------------------------------
85; signals for user function
86(enum 'SET_SNEAKY_TIME
87      'SET_VISOR_TIME
88      'SET_FAST_TIME
89      'SET_FADE_COUNT
90)
91
92
93;---------------------------------------------------------------------------------
94; states for cop
95(enum 'JUST_START
96      'NORMAL_PLAY)
97
98
99;---------------------------------------------------------------------------------
100(enum 'NO_POWER
101      'FAST_POWER
102      'FLY_POWER
103      'SNEAKY_POWER
104      'HEALTH_POWER)
105
106;---------------------------------------------------------------------------------
107; this is called by the engine when a level is loaded with no player_info in it
108; i.e. not for savegames
109; this function is called once for each player object
110;---------------------------------------------------------------------------------
111(defun set_player_defaults ()
112        (set_ambient_light (me) 35)
113        (set_aistate 0)
114        (set_fade_count 0)
115        (setq in_climbing_area 0)
116        (setq disable_top_draw 0)
117        (setq just_hit 0)
118        (setq used_special_power 0)
119        (setq has_saved_this_level 0)
120        (setq r_ramp 0)
121        (setq g_ramp 0)
122        (setq b_ramp 0)
123        (setq is_teleporting 0)
124        (setq just_fired 0)
125        (setq has_compass 0)
126        (setq special_power NO_POWER)
127        (if (eq (get_object_tint) -1)
128                (set_object_tint (player_number))
129        )
130;       (set_object_team -1)
131;  (setq team -1)
132;  (setq tint (player_number))
133)
134
135;---------------------------------------------------------------------------------
136
137(defun cop_ufun (signal value)
138  (if (< (total_objects) 1)    ; make sure upper body is there
139      nil
140    (select signal
141            (SET_SNEAKY_TIME
142             (progn
143               (set_sneaky_time value)
144               (with_obj0 (set_sneaky_time value))))
145            (SET_VISOR_TIME (set_visor_time value))
146            (SET_FAST_TIME
147             (progn
148               (set_fast_time value)
149               (with_obj0 (set_fast_time value))))
150            (SET_FADE_COUNT (set_fade_count value)
151                            (with_obj0 (set_fade_count value)))
152             
153            )))
154                   
155
156;---------------------------------------------------------------------------------
157(defun cop_adjust_top (return)
158        (if (< (total_objects) 1)        ;; should be here
159                (let ((me (me)))
160                        (link_object (add_object_after MGUN_TOP (x) (y)))
161                        (with_obj0 (link_object me))
162                )
163        )
164        return
165)
166
167;---------------------------------------------------------------------------------
168(defun climb_off_handler ()
169  (if (next_picture)
170      (progn
171        (view_push_down 4)
172        0)
173    (progn
174      (set_y (- (y) 28))
175      (set_state stopped)
176      0)))
177
178;---------------------------------------------------------------------------------
179(defun climb_handler (xm ym but)
180  (let ((yd in_climbing_area))
181    (setq in_climbing_area 0)
182    (if (eq (state) climb_off)
183        (climb_off_handler)
184      (if (eq (state) climbing)
185          (progn
186            (if (> ym 0)
187                (progn
188                  (if (eq (current_frame) 0) (set_current_frame 9)
189                    (set_current_frame (- (current_frame) 1)))
190                  (set_y (+ (y) 3)))
191              (if (< ym 0)
192                  (progn
193                    (if (< yd 32)
194                        (set_state climb_off)
195                      (progn
196                        (if (not (next_picture)) (set_state climbing))
197                        (set_y (- (y) 3)))))))
198            (if (not (eq xm 0))
199                (if (can_see (x) (- (y) 20) (x) (y) nil)
200                    (if (eq ym 0)
201                        (progn
202                          (set_state run_jump_fall)
203                          (set_gravity 1))
204                      (progn
205                        (set_state run_jump)
206                        (set_yvel (get_ability jump_yvel))
207                        (set_gravity 1)
208                        ))))
209
210            0)
211        (if (and (>= (yvel) 0) (or (> ym 0)
212                                   (and (< ym 0) (> yd 8))))
213            (progn
214              (set_state climbing)
215              (set_gravity 0)
216              (set_xvel 0)
217              (set_yvel 0)
218              (set_xacel 0)
219              (set_yacel 0)
220              0)
221          (progn
222            (next_picture)
223            (cop_adjust_top (mover xm ym but))))
224        ))))
225     
226     
227;---------------------------------------------------------------------------------
228(defun undo_special_power (xm ym but)
229  (select special_power
230          (FAST_POWER   (setq used_special_power 0))
231          (SNEAKY_POWER (if (> used_special_power 0)
232                            (setq used_special_power (- used_special_power 1))))))
233
234;---------------------------------------------------------------------------------
235(defun do_special_power (xm ym but)
236  (select special_power
237          (FLY_POWER
238           (add_object CLOUD (+ (+ (x) (* (direction) -10)) (random 5)) (+ (y) (random 5)))
239           (set_state run_jump)
240           (set_gravity 1)
241           (set_yacel 0)
242           (if (> (yvel) 0) (set_yvel (/ (yvel) 2)))
243           (set_yvel (- (yvel) 2))
244           (if (< ym 0)
245               (set_yvel (- (yvel) 1)))
246           )
247         
248
249          (FAST_POWER
250           (setq used_special_power 1)
251           (setq last1_x (x))
252           (setq last1_y (y))
253           (if (> (total_objects) 0)
254               (with_obj0
255                            (if (> fire_delay1 0)
256                                (setq fire_delay1 (- fire_delay1 1)))))
257
258           
259           (let ((in_area in_climbing_area)
260                 (old_yvel (yvel)))
261             (player_move xm ym but)
262             (setq in_climbing_area in_area)
263             (if (and (< ym 0) (eq old_yvel 0) (< (yvel) 0))
264                 (set_yvel (+ (yvel) (/ (yvel) 3))))
265                 
266             )
267
268           (setq last2_x (x))
269           (setq last2_y (y)))
270
271          (SNEAKY_POWER (if (<= used_special_power 15)                     
272                            (setq used_special_power (+ used_special_power 1))))
273          ))
274
275;---------------------------------------------------------------------------------
276(defun player_move (xm ym but)
277  (if (eq in_climbing_area 0)
278      (progn
279        (if (eq (state) climbing)
280            (progn
281              (set_gravity 1)
282              (set_state run_jump_fall)))
283        (next_picture)
284        (cop_adjust_top (mover xm ym but)))
285    (climb_handler xm ym but)))
286
287
288;---------------------------------------------------------------------------------
289(defun dead_cop_part_draw ()
290  (if (eq (aitype) 0)
291      (draw)
292    (draw_tint (aref player_tints (aitype)))))
293
294;---------------------------------------------------------------------------------
295(defun bottom_damage (amount from hitx hity push_xvel push_yvel)  ; transfer damage to lower half
296  (if (eq is_teleporting 1)
297      nil
298    (let ((amount (select difficulty;; reduce damage according to difficulty
299                          ('easy   (/ amount 2))
300                          ('medium (/ (* amount 3) 4))
301                          ('hard    amount)
302                          ('extreme (* amount 3))
303                          )))
304
305
306      (select (aistate)
307              (NORMAL_PLAY (if (and (not (eq (state) dieing)) (not (eq (state) dead)))
308                               (progn
309                                 (if (eq (random 2) 0)
310                                     (set_state flinch_up)
311                                   (set_state flinch_down))
312                                 (if (local_player)
313                                     (progn
314                                       (setq r_ramp (+ r_ramp (* amount 7)))
315                                       (setq g_ramp (- g_ramp (* amount 14)))
316                                       (setq b_ramp (- b_ramp (* amount 14)))
317                                       (if (> r_ramp 120) (setq r_ramp 120))
318                                       (if (< g_ramp 0) (setq g_ramp 0))
319                                       (if (< b_ramp 0) (setq b_ramp 0))))
320
321                                 (damage_fun amount from hitx hity (/ push_xvel 2) (/ push_yvel 2))
322                                 (if (eq (hp) 0)
323                                     (progn
324                                       (if (and (time_for_next_level) (nth current_net_level net_levels))
325                                           (progn
326                                             (show_kills)
327                                             (reset_kills)
328                                             (setq current_net_level (+ current_net_level 1))
329                                             (if (not (nth current_net_level net_levels))
330                                                 (setq current_net_level 0))
331
332                                             ;; save the level we are so joining clients know which one to load
333                                             (if (not (am_a_client))
334                                                 (open_file "addon/deathmat/cur_lev.lsp" "wb"
335                                                            (print `(setq current_net_level ,current_net_level))))
336
337                                             (request_level_load (nth current_net_level net_levels))))
338
339                                       (create_dead_parts cop_dead_parts (* (get_dead_part from) 3) (get_object_tint))
340                                       (play_sound (aref PLAYER_DEATH (random 4)) 127 (x) (y)))
341                                   (if (> amount 8)
342                                       (play_sound (aref PLAYER_PAIN (random 4)) 127 (x) (y)))))))
343
344
345              )))
346  )
347
348;---------------------------------------------------------------------------------
349(defun should_draw_top? (mode)
350  (select mode
351          (JUST_START T)
352          (NORMAL_PLAY T)))
353             
354;---------------------------------------------------------------------------------
355(defun change_mode (new_mode)
356  (setq disable_top_draw (if (should_draw_top? new_mode) 0 1))
357  (set_aistate new_mode))
358
359;---------------------------------------------------------------------------------
360(defun draw_fast ()
361  (if  (local_player)
362      (put_image (- (view_x2) 20) (+ (view_y1) 5) fast_image))
363                       (if (eq used_special_power 1)
364                           (if (> (total_objects) 0)                   
365                               (let ((nowx (x))
366                                     (nowy (y))
367                                     (l2x last2_x)
368                                     (l2y last2_y)
369                                     (l1x last1_x)
370                                     (l1y last1_y)
371                                     (td (top_draw_state (state)))
372                                     (h   (picture_height)))
373
374                                 (set_x l2x)
375                                 (set_y l2y)
376                                 (draw_transparent 5 16)
377                                 (if td (with_obj0 (progn (set_x l2x)
378                                                                    (set_y (- (- l2y -29) h))
379                                                                    (draw_transparent 5 16))))
380                                 (set_x last1_x)
381                                 (set_y last1_y)
382                                 (draw_transparent 10 16)
383
384                                 (if td (with_obj0 (progn (set_x l1x)
385                                                                    (set_y (- (- l1y -29) h))
386                                                                    (draw_transparent 10 16)
387                                                                    (set_x nowx)
388                                                                    (set_y nowy)
389                                                                    )))
390
391                                 (set_x nowx)
392                                 (set_y nowy)))))
393
394;---------------------------------------------------------------------------------
395(defun sneaky_draw (count num)
396  (print count)
397  (if (eq count 0)
398      (player_draw num)
399    (if (> count 15)
400        (draw_predator)
401      (draw_transparent count 16))))
402
403;---------------------------------------------------------------------------------
404(defun player_draw (num)
405        (if (eq just_fired 1)   
406                (progn
407                        (draw_double_tint (aref player_tints num) bright_tint)
408                        (setq just_fired 0)
409                )                               ;; ok to change this in the draw function only if it is not accessed anywhere else!     
410                (draw_tint (aref player_tints (get_object_tint)))
411        )
412)
413
414;---------------------------------------------------------------------------------
415(defun restart_player ()
416  (setq special_power 0)
417  (setq has_compass 0)
418  (if (and (local_player) (not (and (eq r_ramp 0)
419                                    (eq g_ramp 0)
420                                    (eq b_ramp 0))))
421      (progn
422        (setq r_ramp 0)
423        (setq g_ramp 0)
424        (setq b_ramp 0)
425        (tint_palette 0 0 0)))
426
427  (if (eq (total_players) 1)     ;; is this a single player game?
428      (request_level_load  (if (eq has_saved_this_level 0)
429                               (progn
430                                 (set_hp 100)
431                                 (level_name))
432                             (concatenate 'string "save" (digstr has_saved_this_level 4) ".spe")))
433    (reset_player)
434
435    ))
436
437
438
439;---------------------------------------------------------------------------------
440(defun start_cache (type)
441  `((,DARNEL) nil))
442
443;---------------------------------------------------------------------------------
444(def_char START
445  (funs (ai_fun   do_nothing)
446        (get_cache_list_fun start_cache)
447        (draw_fun dev_draw))
448  (range 0 0)
449  (states "art/misc.spe" (stopped "start_image")))
450
451
452;---------------------------------------------------------------------------------
453(defun cop_cache (type)
454  `(() (,bright_tint)))
455
456;---------------------------------------------------------------------------------
457(defun p_compass_draw (player)
458  (if player
459      (with_object player
460                   (if (or (not (eq special_power SNEAKY_POWER)) (local_player))
461                       (let ((spot (game_to_mouse (x) (y))))
462                         (draw_rect (- (first spot) 1)
463                                    (- (second spot) 1)
464                                    (+ (first spot) 1)
465                                    (+ (second spot) 1)
466                                    (aref player_text_color (get_object_tint)))))
467                   (p_compass_draw (next_focus player)))))
468 
469;---------------------------------------------------------------------------------
470(defun compass_draw ()
471  (if (and (local_player) (eq (mod (game_tick) 2) 0))
472      (if (eq has_compass 1)
473          (p_compass_draw (first_focus))
474        (let ((spot (game_to_mouse (x) (y))))
475          (draw_rect (- (first spot) 1)
476                     (- (second spot) 1)
477                     (+ (first spot) 1)
478                     (+ (second spot) 1)
479                     (aref player_text_color (get_object_tint)))))))
480
481
482;---------------------------------------------------------------------------------
483(def_char DARNEL
484        (vars
485                in_climbing_area
486                disable_top_draw
487                just_hit
488                ship_pan_x
489                special_power
490                used_special_power
491                last1_x
492                last1_y
493                last2_x
494                last2_y
495                has_saved_this_level
496                r_ramp
497                g_ramp
498                b_ramp
499                is_teleporting
500                just_fired
501                has_compass
502                team
503                tint
504        )
505        (range 50 50)
506        (abilities
507                (walk_top_speed    3)
508            (jump_yvel       -15)
509            (run_top_speed     9)
510            (jump_top_speed   10)
511            (jump_xvel         9)
512            (stop_accel        9)
513            (start_accel       8)
514            (start_hp        100)
515            (hamper_xrange    80)
516            (push_xrange       9)
517        )
518
519        (flags
520                (hurtable          T)
521            (unlistable        T)
522        )
523
524        (funs
525                (move_fun           cop_mover)
526                (damage_fun         bottom_damage)
527                (draw_fun           bottom_draw)
528                (map_draw_fun       compass_draw)
529                (get_cache_list_fun cop_cache)
530        (user_fun           cop_ufun)
531        )
532
533        (states "art/cop.spe"
534                (stopped            (seq "stopped" 1 6))
535                (running            (seq "4wlk" 1 10))
536
537                (fast_running       (seq "4fst" 1 10))
538                (fly_running        (seq "4fly" 1 10))
539
540                (fast_stopped       (seq "bot2" 7 12))
541                (fly_stopped        (seq "bot2" 1 6))
542
543                (dead               "dead")
544
545                (start_run_jump     "jump_up")
546                (run_jump           "jump_up")
547                (run_jump_fall      "jump_down")
548                (end_run_jump       (seq "4jmp" 3 5))
549
550                (fly_start_run_jump     "4flj0002.pcx")
551                (fly_run_jump           "4flj0002.pcx")
552                (fly_run_jump_fall      "4flj0003.pcx")
553                (fly_end_run_jump       (seq "4flj" 4 6))
554
555                (fast_start_run_jump     "4fjp0002.pcx")
556                (fast_run_jump           "4fjp0002.pcx")
557                (fast_run_jump_fall      "4fjp0003.pcx")
558                (fast_end_run_jump       (seq "4fjp" 4 6))
559
560
561                (flinch_up           (rep "4flh0002.pcx" 4))
562                (flinch_down         (rep "4flh0003.pcx" 4))
563
564                (climbing             (seq "4lad" 1 10))
565                (climb_off            (seq "4off" 1 8))
566                (climb_on            (seq "4off" 8 1))
567        )
568)
569
570 
571(defun clone_ai ()
572        (if (and (< (state_time) 200) (not (eq (state) dead)))
573                (progn
574                        (select (direction)
575                                (1 (if (blocked_right (move 1 0 0))
576                                                (set_direction -1)
577                                                nil
578                                        )
579                                )
580                                (-1 (if (blocked_left (move -1 0 0))
581                                                (set_direction 1)
582                                                nil
583                                        )
584                                )
585                        )
586                        (if (or (> (state_time) 185) (eq (state) dieing))
587                                (set_fade_count (+ (fade_count) 1))
588                                nil
589                        )           
590                        T
591                )
592                nil
593        )
594)
595
596
597(defun top_draw_state (state)
598
599  (or (eq state stopped) (eq state running)
600                        (eq state run_jump) (eq state run_jump_fall)
601                        (eq state end_run_jump)))
602
603
604(defun ammo_type ()
605  (select (otype)
606          (GRENADE_TOP  2)
607          (MGUN_TOP     10)
608          (FIREBOMB_TOP 5)
609          (ROCKET_TOP   3)
610          (PGUN_TOP     4)
611          (LSABER_TOP   5)
612          (DFIRS_TOP    6)
613          ))
614
615(defun ammo_delay ()
616  0)
617
618
619(defun player_angle_suggestion ()
620  (atan2 (- (y) (player_pointer_y) 16)
621         (- (player_pointer_x) (x))))
622
623
624(defun player_fire_weapon (type target)
625  (let ((angle (with_obj0 (player_angle_suggestion))))
626                           
627    (let ((firex (+ (x) (* (cos angle) 17) (xvel)))
628          (firey (+ (- (y) (* (sin angle) 16) 20) (yvel))))
629      (if (can_see (x) (- (y) 16) firex firey nil)     
630          (progn
631            (fire_object  (get_object 0) type firex firey angle target)
632            T)
633        nil))))
634
635
636(defun top_cache (type)
637  (list
638   (select type
639           (MGUN_TOP      (list SHOTGUN_BULLET))
640           (GRENADE_TOP   (list GRENADE))
641           (ROCKET_TOP    (list ROCKET))
642           (FIREBOMB_TOP  (list FIREBOMB))
643           (PGUN_TOP      (list PLASMAGUN_BULLET))
644           (LIGHT_SABER   (list LSABER_BULLET))
645           (DFRIS_TOP     (list DFRIS_BULLET))
646   nil)))
647           
648
649(defun make_top_char (symbol base ufun dfun)
650  (eval (list 'def_char symbol
651              `(funs (ai_fun    top_ai)
652                     (get_cache_list_fun top_cache)
653                     (draw_fun  ,dfun)
654                     (user_fun  ,ufun))
655              '(flags (add_front  T)
656                      (is_weapon  T)
657                      (unlistable T))
658              '(vars point_angle fire_delay1 just_fired)
659              `(states "art/coptop.spe"
660                       (stopped        (seq ,base 1 24))))))
661
662             
663
664(make_top_char 'MGUN_TOP     "4gma" 'laser_ufun         'top_draw)
665(make_top_char 'GRENADE_TOP  "4gre" 'top_ufun           'top_draw)
666(make_top_char 'ROCKET_TOP   "4gro" 'player_rocket_ufun 'top_draw)
667(make_top_char 'FIREBOMB_TOP "4gfi" 'top_ufun           'top_draw)
668
669
670
671
672(defun restart_ai ()
673  (if (eq (total_players) 1)       ;; only allow saving in single player games
674      (select (aistate)
675              (0 (next_picture)
676                 (if (and (touching_bg) (with_object (bg) (pressing_action_key)))
677                     (set_aistate 2)))
678              (1 (next_picture);; wait for save (actived state)
679                 (if (and (touching_bg) (with_object (bg) (pressing_action_key)))
680                     (set_aistate 2)))
681              (2 (set_state running)       
682                 (set_aistate 3))
683              (3 (set_aistate 4))           
684              (4
685               (let ((spot (get_save_slot)))
686                 (set_state stopped)
687                 (set_aistate 1)
688                 (if (not (eq spot 0));; did they escape ?
689                     (progn
690                       (show_help (concatenate 'string Station (num2str (xvel)) secured))
691                       (with_object (bg)
692                                    (progn
693                                      (let ((old_hp (hp)))
694                                        (if (not (eq difficulty 'extreme))
695                                            (set_hp 100));; save the player with 100 health, unless on extreme
696                                        (play_sound SAVE_SND 127 (x) (y))
697                                        (setq has_saved_this_level spot)
698                                        (save_game (concatenate 'string "save" (digstr spot 4) ".spe"))
699                                        (set_hp old_hp)
700                                        ))))))
701
702               )))
703  T)
704         
705
706(def_char RESTART_POSITION
707  (funs (ai_fun restart_ai)
708        (reload_fun lower_reload))
709  (fields ("xvel"  restart_station))
710  (states "art/misc.spe"
711          (stopped (app (rep "console" 3) (rep "console2" 3)))
712          (running (rep "console_on" 2))))
713
714(defun next_level_ai ()
715  (if (and (touching_bg) (with_object (bg) (pressing_action_key)))
716      (if (eq (aistate) end_level)
717          (request_end_game)
718        (progn
719          (show_stats)
720          (request_level_load (concatenate 'string "levels/level" (digstr (aistate) 2) ".spe")))))
721  T)
722       
723
724(def_char NEXT_LEVEL
725  (funs (ai_fun next_level_ai))
726  (flags (can_block T))
727  (fields ("aistate" next_level))
728  (states "art/misc.spe"
729          (stopped "end_port2")))
730
731(defun next_level_top_ai ()
732  (shift_rand_table 80)
733  (let ((oldy (y)))
734    (try_move 0 100)
735    (setq floor_yoff (- (y) oldy))
736    (set_y oldy))
737  T)
738
739(def_char NEXT_LEVEL_TOP
740  (funs (ai_fun next_level_top_ai))
741  (vars floor_yoff)
742  (draw_range 50 100)
743  (fields ("aistate" next_level))
744  (states "art/misc.spe"
745          (stopped "end_port1")))
746
747(defun tele_beam_ai ()
748  (next_picture)
749  (if (> (direction) 0)
750      (if (eq (fade_count) 12)
751          (progn
752            (play_sound APPEAR_SND 100 (x) (y))
753            (set_direction -1))
754        (set_fade_count (+ (fade_count) 1)))
755    (if (eq (fade_count) 5)
756        (progn
757          (play_sound APPEAR_SND 100 (x) (y))
758          (set_direction 1))
759      (set_fade_count (- (fade_count) 1)))))
760   
761                     
762(def_char TELE_BEAM
763  (funs (ai_fun tele_beam_ai))
764  (states "art/chars/teleport.spe" (stopped (seq "beam" 1 5))))
765
766(def_char END_OF_S
767  (funs (ai_fun do_nothing))
768  (states "art/misc.spe" (stopped "eos")))
769
770(setq load_warn nil)
771(if (load "register/people.lsp")
772    (setq end_level 22)
773  (setq end_level 4))
774(setq load_warn T)
775
776
777
778
779
Note: See TracBrowser for help on using the repository browser.