source: abuse-frabs/trunk/register/weapons.lsp @ 44

Last change on this file since 44 was 44, checked in by Sam Hocevar, 15 years ago
  • Importing abuse-frabs 2.10.
File size: 3.2 KB
Line 
1;; Copyright 1995 Crack dot Com,  All Rights reserved
2;; See licencing information for more details on usage rights
3
4(make_ammo_icon 'PLASMA_ICON20 "plasma_small"     20)
5(make_ammo_icon 'PLASMA_ICON50 "plasma_large"     50)
6
7(make_ammo_icon 'LSABER_ICON50  "lsaber_small"    50)
8(make_ammo_icon 'LSABER_ICON100 "lsaber_large"   100)
9
10(make_ammo_icon 'DFRIS_ICON4  "dfris_small"      4)
11(make_ammo_icon 'DFRIS_ICON10 "dfris_large"     10)
12
13
14(defun pgun_draw ()
15  (let ((c (- 255 (* (state_time) 40))))
16    (scatter_line sgb_lastx sgb_lasty (x) (y) (find_rgb c (/ c 2) c) (state_time))
17    (scatter_line sgb_lastx sgb_lasty (x) (y) (find_rgb c (/ c 2) c) 0)
18    ))
19
20
21
22(defun pgun_ai ()
23  (select (state_time)
24          (0 T)
25          (1 T)
26          (2 T)
27          (3 T)
28          (4 T)
29          (5 nil)))
30
31(def_char PLASMAGUN_BULLET
32  (vars sgb_angle sgb_lastx sgb_lasty)
33  (funs (ai_fun   pgun_ai)
34        (draw_fun pgun_draw))
35  (range 10000 10000)
36  (flags (unlistable T)
37         (add_front T))
38  (states "art/misc.spe" (stopped  "sgun_bullet")))
39
40
41(defun lsaber_ai ()
42  (shift_rand_table (random 80))
43  nil)
44
45
46(defun lsaber_draw ()
47  (let ((c1 (find_rgb 255 255 255))
48        (c2 (find_rgb 70 59 67))
49        (c3 (find_rgb 147 155 195)))
50
51
52    (scatter_line sgb_lastx sgb_lasty (x) (y) c1 0)
53    (scatter_line sgb_lastx sgb_lasty (x) (y) c3 2)
54    (ascatter_line sgb_lastx sgb_lasty (x) (y) c1 c2 1)
55  ))
56
57
58
59(def_char LSABER_BULLET
60  (vars sgb_angle sgb_lastx sgb_lasty)
61  (funs (ai_fun   lsaber_ai)
62        (draw_fun lsaber_draw))
63  (range 10000 10000)
64  (flags (unlistable T)
65         (add_front T))
66  (states "art/misc.spe" (stopped  "sgun_bullet")))
67
68
69(defun angle_diff (a1 a2)
70  (if (< (abs (- a2 a1)) 180)
71      (- a2 a1)
72    (if (< a1 a2)
73        (+ (- a1 a2) 180)
74      (- (- a1 a2) 180))))
75
76
77(defun get_fris_angle ()
78  (let ((px (with_object (get_object 0) (player_pointer_x)))
79        (py (with_object (get_object 0) (player_pointer_y))))
80    (atan2 (- (y) py 4)
81           (- px (x)))))
82
83(defun dfris_ai ()
84  (if (and (eq 0 (mod (game_tick) 2)) (not (frame_panic)))
85      (let ((rand (rand_on)))
86        (with_object (add_object SMALL_LIGHT_CLOUD (+ (x) (random 3))
87                                 (- (y) (random 3) (/ (picture_height) 2)))
88                     (set_fade_count 11))
89        (set_rand_on rand)))
90  (set_course (aistate) 12)
91  (if (or (not (eq (bmove (if (> (total_objects) 0) (get_object 0) nil)) T))
92          (< (total_objects) 1)
93          (let ((mex (x))
94                (mey (y)))
95            (with_object (get_object 0) (find_object_in_area (- mex 7)
96                                                             (- mey 7)
97                                                             (+ mex 7)
98                                                             (+ mey 7) bad_guy_list))))
99      (progn   
100        (do_white_explo 40 45)
101        nil)
102    (progn
103      (next_picture)
104      (if (> (with_object (get_object 0) (total_objects)) 0)
105          (let ((player_angle (get_fris_angle)))
106            (let ((angle_change (angle_diff (aistate) player_angle)))
107              (if (< (abs angle_change) 35)
108                  (set_aistate (mod (+ (aistate) angle_change 360) 360))
109                (if (>= angle_change 0)
110                    (set_aistate (mod (+ (aistate) 35) 360))
111                  (set_aistate (mod (+ (aistate) 325 ) 360)))))))
112      T))   
113)
114
115
116
117(defun dfris_cache (type)
118  (list (list EXPLODE8 EXP_LIGHT)
119        (list GRENADE_SND)))
120
121(def_char DFRIS_BULLET
122  (funs (ai_fun   dfris_ai)
123        (get_cache_list_fun dfris_cache))
124  (range 10000 10000)
125  (flags (unlistable T)
126         (add_front T))
127  (states "art/misc.spe" (stopped  "dfris_bullet")))
128
Note: See TracBrowser for help on using the repository browser.