1 | #include "ant.hpp" |
---|
2 | #include "lisp.hpp" |
---|
3 | #include "game.hpp" |
---|
4 | #include "jrand.hpp" |
---|
5 | #include "dev.hpp" |
---|
6 | #include "pcxread.hpp" |
---|
7 | #include "menu.hpp" |
---|
8 | #include "dprint.hpp" |
---|
9 | #include "clisp.hpp" |
---|
10 | #include "chars.hpp" |
---|
11 | #include "lisp_gc.hpp" |
---|
12 | #include "cop.hpp" |
---|
13 | #include "loadgame.hpp" |
---|
14 | #include "nfserver.hpp" |
---|
15 | #include "joy.hpp" |
---|
16 | #include "demo.hpp" |
---|
17 | #include "chat.hpp" |
---|
18 | #include "text_gui.hpp" |
---|
19 | #include "jdir.hpp" |
---|
20 | #include "netcfg.hpp" |
---|
21 | |
---|
22 | #ifdef __WATCOMC__ |
---|
23 | #include <direct.h> |
---|
24 | #endif |
---|
25 | |
---|
26 | extern uchar major_version; |
---|
27 | extern uchar minor_version; |
---|
28 | extern int has_joystick; |
---|
29 | |
---|
30 | void *l_change_on_pickup,*l_MBULLET_ICON5,*l_MBULLET_ICON20,*l_GRENADE_ICON2,*l_GRENADE_ICON10,*l_ROCKET_ICON2,*l_ROCKET_ICON5, |
---|
31 | *l_FBOMB_ICON1,*l_FBOMB_ICON5,*l_PLASMA_ICON20,*l_PLASMA_ICON50,*l_LSABER_ICON100,*l_DFRIS_ICON4,*l_DFRIS_ICON10,*l_LSABER_ICON50, |
---|
32 | *l_TELEPORTER_SND,*l_gun_tints,*l_ant_tints; |
---|
33 | |
---|
34 | // the following are references to lisp symbols |
---|
35 | void *l_difficulty,*l_easy,*l_hard,*l_medium,*l_main_menu,*l_extreme, |
---|
36 | *l_logo,*l_state_art,*l_abilities,*l_state_sfx, |
---|
37 | *l_song_list,*l_filename,*l_sfx_directory,*l_max_hp,*l_default_font, |
---|
38 | *l_morph,*l_max_power,*l_default_abilities,*l_default_ai_function, |
---|
39 | *l_tile_files,*l_empty_cache,*l_range,*l_hurt_all,*l_death_handler, |
---|
40 | *l_title_screen,*l_console_font,*l_fields,*l_dist,*l_pushx,*l_pushy, |
---|
41 | *l_object,*l_tile,*l_fire_object,*l_FIRE,*l_cop_dead_parts,*l_restart_player, |
---|
42 | *l_help_screens,*l_player_draw,*l_sneaky_draw,*l_health_image,*l_fly_image, |
---|
43 | *l_sneaky_image,*l_draw_fast,*l_player_tints,*l_save_order,*l_next_song, |
---|
44 | *l_level_load_start, |
---|
45 | *l_level_load_end, *l_cdc_logo, |
---|
46 | *l_keep_backup, |
---|
47 | *l_switch_to_powerful, |
---|
48 | *l_mouse_can_switch, |
---|
49 | *l_ask_save_slot, |
---|
50 | *l_get_local_input, |
---|
51 | *l_post_render, |
---|
52 | *l_chat_input, |
---|
53 | *l_player_text_color, |
---|
54 | *l_level_loaded, // called when a new level is loaded |
---|
55 | *l_ammo_snd, |
---|
56 | |
---|
57 | *l_up_key, |
---|
58 | *l_down_key, |
---|
59 | *l_left_key, |
---|
60 | *l_right_key, |
---|
61 | *l_weapon_left_key, |
---|
62 | *l_weapon_right_key, |
---|
63 | *l_special_key; |
---|
64 | |
---|
65 | char game_name[50]; |
---|
66 | void *sensor_ai(); |
---|
67 | |
---|
68 | // variables for the status bar |
---|
69 | void *l_statbar_ammo_x,*l_statbar_ammo_y, |
---|
70 | *l_statbar_ammo_w,*l_statbar_ammo_h, |
---|
71 | *l_statbar_ammo_bg_color, |
---|
72 | |
---|
73 | *l_statbar_health_x,*l_statbar_health_y, |
---|
74 | *l_statbar_health_w,*l_statbar_health_h, |
---|
75 | *l_statbar_health_bg_color, |
---|
76 | |
---|
77 | *l_statbar_logo_x,*l_statbar_logo_y; |
---|
78 | uchar chatting_enabled=0; |
---|
79 | |
---|
80 | extern void scatter_line(int x1, int y1, int x2, int y2, int c, int s); |
---|
81 | extern void ascatter_line(int x1, int y1, int x2, int y2, int c1, int c2, int s); |
---|
82 | extern void show_end(); |
---|
83 | |
---|
84 | extern int registered; |
---|
85 | |
---|
86 | view *lget_view(void *arg, char *msg) |
---|
87 | { |
---|
88 | game_object *o=(game_object *)lpointer_value(arg); |
---|
89 | view *c=o->controller(); |
---|
90 | if (!c) |
---|
91 | { |
---|
92 | dprintf("%s : object does not have a view\n",msg); |
---|
93 | lbreak(""); |
---|
94 | exit(0); |
---|
95 | } |
---|
96 | return c; |
---|
97 | } |
---|
98 | |
---|
99 | extern int get_option(char *name); |
---|
100 | extern void set_login(char *name); |
---|
101 | |
---|
102 | |
---|
103 | |
---|
104 | long cli_1(void *args) { return abs(current_object->x-current_level->attacker(current_object)->x); } |
---|
105 | long cli_2(void *args) { return abs(current_object->y-current_level->attacker(current_object)->y); } |
---|
106 | long cli_3(void *args) |
---|
107 | { |
---|
108 | if (!current_object->controller()) |
---|
109 | lbreak("object is not a player, cannot determine keypresses"); |
---|
110 | else |
---|
111 | return current_object->controller()->key_down(lnumber_value(CAR(args))); |
---|
112 | return 0; |
---|
113 | } |
---|
114 | |
---|
115 | long cli_4(void *args) |
---|
116 | { return the_game->key_down(lnumber_value(CAR(args))); } |
---|
117 | |
---|
118 | long cli_5(void *args) |
---|
119 | { return current_level->attacker(current_object)->state; } |
---|
120 | |
---|
121 | long cli_6(void *args) |
---|
122 | { return current_object->aitype(); } |
---|
123 | |
---|
124 | long cli_7(void *args) |
---|
125 | { |
---|
126 | if (!current_object->keep_ai_info()) |
---|
127 | current_object->set_aistate(0); |
---|
128 | return current_object->aistate(); |
---|
129 | } |
---|
130 | |
---|
131 | long cli_8(void *args) |
---|
132 | { |
---|
133 | int ns=lnumber_value(CAR(args)); |
---|
134 | current_object->set_aistate_time(0); |
---|
135 | current_object->set_aistate(ns); return 1; |
---|
136 | } |
---|
137 | |
---|
138 | long cli_9(void *args) |
---|
139 | { return jrandom(lnumber_value(CAR(args))); } |
---|
140 | |
---|
141 | long cli_10(void *args) |
---|
142 | { return current_object->aistate_time(); } |
---|
143 | |
---|
144 | long cli_11(void *args) |
---|
145 | { return current_object->state; } |
---|
146 | |
---|
147 | long cli_12(void *args) |
---|
148 | { if (current_level->attacker(current_object)->x>current_object->x) return 1; else return -1; } |
---|
149 | |
---|
150 | long cli_13(void *args) |
---|
151 | { return current_object->move(lnumber_value(CAR(args)),lnumber_value(CAR(CDR(args))), |
---|
152 | lnumber_value(CAR(CDR(CDR(args))))); |
---|
153 | } |
---|
154 | |
---|
155 | long cli_14(void *args) |
---|
156 | { if (current_object->direction>0) return 1; else return -1; } |
---|
157 | |
---|
158 | long cli_15(void *args) |
---|
159 | { return current_object->otype; } |
---|
160 | |
---|
161 | long cli_16(void *args) |
---|
162 | { return current_object->next_picture(); } |
---|
163 | |
---|
164 | long cli_17(void *args) |
---|
165 | { current_object->set_fade_dir(lnumber_value(CAR(args))); return 1; } |
---|
166 | |
---|
167 | long cli_18(void *args) |
---|
168 | { |
---|
169 | int cx=lnumber_value(CAR(args)); |
---|
170 | args=CDR(args); |
---|
171 | int cy=lnumber_value(CAR(args)); |
---|
172 | args=CDR(args); |
---|
173 | int but=lnumber_value(CAR(args)); |
---|
174 | return current_object->mover(cx,cy,but); |
---|
175 | } |
---|
176 | |
---|
177 | long cli_19(void *args) |
---|
178 | { current_object->set_fade_count(lnumber_value(CAR(args))); return 1; } |
---|
179 | |
---|
180 | long cli_20(void *args) |
---|
181 | { return current_object->fade_count(); } |
---|
182 | |
---|
183 | long cli_21(void *args) |
---|
184 | { return current_object->fade_dir(); } |
---|
185 | |
---|
186 | long cli_22(void *args) |
---|
187 | { |
---|
188 | long x1,y1,x2,y2,xp1,yp1,xp2,yp2; |
---|
189 | current_level->attacker(current_object)->picture_space(x1,y1,x2,y2); |
---|
190 | current_object->picture_space(xp1,yp1,xp2,yp2); |
---|
191 | if (xp1>x2 || xp2<x1 || yp1>y2 || yp2<y1) return 0; |
---|
192 | else return 1; |
---|
193 | } |
---|
194 | |
---|
195 | long cli_23(void *args) |
---|
196 | { |
---|
197 | current_object->add_power(lnumber_value(CAR(args))); |
---|
198 | return 0; |
---|
199 | } |
---|
200 | |
---|
201 | long cli_24(void *args) |
---|
202 | { current_object->add_hp(lnumber_value(CAR(args))); return 0; } |
---|
203 | |
---|
204 | long cli_27(void *args) |
---|
205 | { current_object->drawer(); return 1; } |
---|
206 | |
---|
207 | long cli_28(void *args) |
---|
208 | { return (dev & EDIT_MODE); } |
---|
209 | |
---|
210 | long cli_29(void *args) |
---|
211 | { current_object->draw_above(current_view); return 1; } |
---|
212 | |
---|
213 | long cli_30(void *args) |
---|
214 | { return current_object->x; } |
---|
215 | |
---|
216 | long cli_31(void *args) |
---|
217 | { return current_object->y; } |
---|
218 | |
---|
219 | long cli_32(void *args) |
---|
220 | { |
---|
221 | long v=lnumber_value(CAR(args)); |
---|
222 | current_object->x=v; |
---|
223 | return 1; |
---|
224 | } |
---|
225 | |
---|
226 | long cli_33(void *args) |
---|
227 | { |
---|
228 | long v=lnumber_value(CAR(args)); |
---|
229 | current_object->y=v; |
---|
230 | return 1; |
---|
231 | } |
---|
232 | |
---|
233 | long cli_34(void *args) |
---|
234 | { |
---|
235 | return current_level->push_characters(current_object,lnumber_value(CAR(args)), |
---|
236 | lnumber_value(CAR(CDR(args)))); |
---|
237 | } |
---|
238 | |
---|
239 | long cli_37(void *args) |
---|
240 | { |
---|
241 | long s=lnumber_value(CAR(args)); |
---|
242 | current_object->set_state((character_state)s); |
---|
243 | return (s==current_object->state); |
---|
244 | } |
---|
245 | |
---|
246 | long cli_38(void *args) |
---|
247 | { return current_level->attacker(current_object)->x;} |
---|
248 | |
---|
249 | long cli_39(void *args) |
---|
250 | { return current_level->attacker(current_object)->y; } |
---|
251 | |
---|
252 | long cli_40(void *args) |
---|
253 | { current_object->change_aitype(lnumber_value(CAR(args))); return 1; } |
---|
254 | |
---|
255 | |
---|
256 | long cli_42(void *args) |
---|
257 | { return current_object->xvel(); } |
---|
258 | |
---|
259 | long cli_43(void *args) |
---|
260 | { return current_object->yvel(); } |
---|
261 | |
---|
262 | long cli_44(void *args) |
---|
263 | { current_object->set_xvel(lnumber_value(CAR(args))); return 1; } |
---|
264 | |
---|
265 | long cli_45(void *args) |
---|
266 | { current_object->set_yvel(lnumber_value(CAR(args))); return 1; } |
---|
267 | |
---|
268 | long cli_46(void *args) |
---|
269 | { if (current_level->attacker(current_object)->x>current_object->x) return -1; |
---|
270 | else return 1; |
---|
271 | } |
---|
272 | |
---|
273 | long cli_47(void *args) |
---|
274 | { return lnumber_value(CAR(args))&BLOCKED_LEFT; } |
---|
275 | |
---|
276 | long cli_48(void *args) |
---|
277 | { return lnumber_value(CAR(args))&BLOCKED_RIGHT; } |
---|
278 | |
---|
279 | long cli_50(void *args) |
---|
280 | { dev_cont->add_palette(args); return 1;} |
---|
281 | |
---|
282 | long cli_51(void *args) |
---|
283 | { write_PCX(screen,pal,lstring_value(CAR(args))); return 1;} |
---|
284 | |
---|
285 | long cli_52(void *args) |
---|
286 | { the_game->zoom=lnumber_value(CAR(args)); the_game->draw(); return 1;} |
---|
287 | |
---|
288 | long cli_55(void *args) |
---|
289 | { the_game->show_help(lstring_value(CAR(args))); return 1; } |
---|
290 | |
---|
291 | |
---|
292 | long cli_56(void *args) |
---|
293 | { return current_object->direction; } |
---|
294 | |
---|
295 | long cli_57(void *args) |
---|
296 | { current_object->direction=lnumber_value(CAR(args)); return 1; } |
---|
297 | |
---|
298 | long cli_58(void *args) |
---|
299 | { |
---|
300 | int x1=lnumber_value(CAR(args)); |
---|
301 | if (!current_object->controller()) |
---|
302 | { lbreak("set_freeze_time : object is not a focus\n"); } |
---|
303 | else current_object->controller()->freeze_time=x1; |
---|
304 | return 1; |
---|
305 | } |
---|
306 | |
---|
307 | long cli_59(void *args) |
---|
308 | { return menu(args,big_font); } |
---|
309 | |
---|
310 | long cli_60(void *args) |
---|
311 | { event ev; dev_cont->do_command(lstring_value(CAR(args)),ev); return 1; } |
---|
312 | |
---|
313 | long cli_61(void *args) |
---|
314 | { the_game->set_state(lnumber_value(CAR(args))); return 0; } |
---|
315 | |
---|
316 | long cli_62(void *args) |
---|
317 | { |
---|
318 | int x1=lnumber_value(CAR(args)); args=CDR(args); |
---|
319 | int y1=lnumber_value(CAR(args)); args=CDR(args); |
---|
320 | int x2=lnumber_value(CAR(args)); args=CDR(args); |
---|
321 | int y2=lnumber_value(CAR(args)); |
---|
322 | scene_director.set_text_region(x1,y1,x2,y2); return 0; |
---|
323 | } |
---|
324 | |
---|
325 | long cli_63(void *args) |
---|
326 | { scene_director.set_frame_speed(lnumber_value(CAR(args))); return 1; } |
---|
327 | |
---|
328 | long cli_64(void *args) |
---|
329 | { scene_director.set_scroll_speed(lnumber_value(CAR(args))); return 1; } |
---|
330 | |
---|
331 | long cli_65(void *args) |
---|
332 | { scene_director.set_pan_speed(lnumber_value(CAR(args))); return 1; } |
---|
333 | |
---|
334 | long cli_66(void *args) |
---|
335 | { scene_director.scroll_text(lstring_value(CAR(args))); return 1; } |
---|
336 | |
---|
337 | long cli_67(void *args) |
---|
338 | { |
---|
339 | scene_director.set_pan(lnumber_value(CAR(args)), |
---|
340 | lnumber_value(CAR(CDR(args))), |
---|
341 | lnumber_value(CAR(CDR(CDR(args))))); |
---|
342 | return 1; |
---|
343 | } |
---|
344 | |
---|
345 | long cli_68(void *args) |
---|
346 | { scene_director.wait(CAR(args)); return 1; } |
---|
347 | |
---|
348 | |
---|
349 | long cli_73(void *args) |
---|
350 | { |
---|
351 | the_game->set_level(new level(lnumber_value(CAR(args)), |
---|
352 | lnumber_value(CAR(CDR(args))), |
---|
353 | lstring_value(CAR(CDR(CDR(args)))))); |
---|
354 | return 1; |
---|
355 | } |
---|
356 | |
---|
357 | long cli_74(void *args) |
---|
358 | { |
---|
359 | if (current_level) delete current_level; |
---|
360 | current_level=new level(100,100,"new_level"); return 0; |
---|
361 | } |
---|
362 | |
---|
363 | long cli_75(void *args) |
---|
364 | { |
---|
365 | int amount=lnumber_value(CAR(args)); args=CDR(args); |
---|
366 | game_object *o=((game_object *)lpointer_value(CAR(args))); args=CDR(args); |
---|
367 | int xv=0,yv=0; |
---|
368 | if (args) |
---|
369 | { |
---|
370 | xv=lnumber_value(CAR(args)); args=CDR(args); |
---|
371 | yv=lnumber_value(CAR(args)); |
---|
372 | } |
---|
373 | o->do_damage(amount,current_object,current_object->x,current_object->y,xv,yv); |
---|
374 | return 0; |
---|
375 | } |
---|
376 | |
---|
377 | long cli_76(void *args) |
---|
378 | { return current_object->hp(); } |
---|
379 | |
---|
380 | long cli_77(void *args) |
---|
381 | { |
---|
382 | game_object *o=(game_object *)lpointer_value(CAR(args)); |
---|
383 | if (!o->controller()) |
---|
384 | dprintf("set shift : object is not a focus\n"); |
---|
385 | else o->controller()->shift_down=lnumber_value(CAR(CDR(args))); return 1; |
---|
386 | } |
---|
387 | |
---|
388 | long cli_78(void *args) |
---|
389 | { |
---|
390 | game_object *o=(game_object *)lpointer_value(CAR(args)); |
---|
391 | if (!o->controller()) |
---|
392 | dprintf("set shift : object is not a focus\n"); |
---|
393 | else o->controller()->shift_right=lnumber_value(CAR(CDR(args))); return 1; |
---|
394 | } |
---|
395 | |
---|
396 | long cli_79(void *args) |
---|
397 | { current_object->set_gravity(lnumber_value(CAR(args))); return 1; } |
---|
398 | |
---|
399 | long cli_80(void *args) |
---|
400 | { return current_object->tick(); } |
---|
401 | |
---|
402 | long cli_81(void *args) |
---|
403 | { current_object->set_xacel((lnumber_value(CAR(args)))); return 1; } |
---|
404 | |
---|
405 | long cli_82(void *args) |
---|
406 | { current_object->set_yacel((lnumber_value(CAR(args)))); return 1; } |
---|
407 | |
---|
408 | |
---|
409 | long cli_84(void *args) |
---|
410 | { set_local_players(lnumber_value(CAR(args))); return 1; } |
---|
411 | |
---|
412 | long cli_85(void *args) |
---|
413 | { return total_local_players(); } |
---|
414 | |
---|
415 | long cli_86(void *args) |
---|
416 | { light_detail=lnumber_value(CAR(args)); return 1; } |
---|
417 | |
---|
418 | long cli_87(void *args) |
---|
419 | { return light_detail; } |
---|
420 | |
---|
421 | long cli_88(void *args) |
---|
422 | { morph_detail=lnumber_value(CAR(args)); return 1; } |
---|
423 | |
---|
424 | long cli_89(void *args) |
---|
425 | { return morph_detail; } |
---|
426 | |
---|
427 | long cli_90(void *args) |
---|
428 | { |
---|
429 | current_object->morph_into(lnumber_value(CAR(args)),NULL, |
---|
430 | lnumber_value(CAR(CDR(args))), |
---|
431 | lnumber_value(CAR(CDR(CDR(args))))); return 1; |
---|
432 | } |
---|
433 | |
---|
434 | long cli_91(void *args) |
---|
435 | { current_object->add_object((game_object *)lpointer_value(CAR(args))); return 1; } |
---|
436 | |
---|
437 | long cli_92(void *args) |
---|
438 | { |
---|
439 | long cx1,x1=lnumber_value(CAR(args)); args=lcdr(args); |
---|
440 | long cy1,y1=lnumber_value(CAR(args)); args=lcdr(args); |
---|
441 | long cx2,x2=lnumber_value(CAR(args)); args=lcdr(args); |
---|
442 | long cy2,y2=lnumber_value(CAR(args)); args=lcdr(args); |
---|
443 | long c=lnumber_value(CAR(args)); |
---|
444 | the_game->game_to_mouse(x1,y1,current_view,cx1,cy1); |
---|
445 | the_game->game_to_mouse(x2,y2,current_view,cx2,cy2); |
---|
446 | screen->line(cx1,cy1,cx2,cy2,c); |
---|
447 | return 1; |
---|
448 | } |
---|
449 | |
---|
450 | long cli_93(void *args) |
---|
451 | { return eh->dark_color(); } |
---|
452 | |
---|
453 | long cli_94(void *args) |
---|
454 | { return eh->medium_color(); } |
---|
455 | |
---|
456 | long cli_95(void *args) |
---|
457 | { return eh->bright_color(); } |
---|
458 | |
---|
459 | long cli_99(void *args) |
---|
460 | { current_object->remove_object((game_object *)lpointer_value(CAR(args))); return 1; } |
---|
461 | |
---|
462 | long cli_100(void *args) |
---|
463 | { current_object->add_light((light_source *)lpointer_value(CAR(args))); return 1; } |
---|
464 | |
---|
465 | long cli_101(void *args) |
---|
466 | { current_object->remove_light((light_source *)lpointer_value(CAR(args))); return 1; } |
---|
467 | |
---|
468 | long cli_102(void *args) |
---|
469 | { return current_object->total_objects(); } |
---|
470 | |
---|
471 | long cli_103(void *args) |
---|
472 | { return current_object->total_lights(); } |
---|
473 | |
---|
474 | long cli_104(void *args) |
---|
475 | { |
---|
476 | light_source *l=(light_source *)lpointer_value(CAR(args)); |
---|
477 | long x=lnumber_value(CAR(CDR(args))); |
---|
478 | if (x>=1) |
---|
479 | l->inner_radius=x; |
---|
480 | l->calc_range(); |
---|
481 | return 1; |
---|
482 | } |
---|
483 | |
---|
484 | long cli_105(void *args) |
---|
485 | { |
---|
486 | light_source *l=(light_source *)lpointer_value(CAR(args)); |
---|
487 | long x=lnumber_value(CAR(CDR(args))); |
---|
488 | if (x>l->inner_radius) |
---|
489 | l->outer_radius=x; |
---|
490 | l->calc_range(); |
---|
491 | return 1; |
---|
492 | } |
---|
493 | |
---|
494 | long cli_106(void *args) |
---|
495 | { |
---|
496 | light_source *l=(light_source *)lpointer_value(CAR(args)); |
---|
497 | l->x=lnumber_value(CAR(CDR(args))); |
---|
498 | l->calc_range(); |
---|
499 | return 1; |
---|
500 | } |
---|
501 | |
---|
502 | long cli_107(void *args) |
---|
503 | { |
---|
504 | light_source *l=(light_source *)lpointer_value(CAR(args)); |
---|
505 | l->y=lnumber_value(CAR(CDR(args))); |
---|
506 | l->calc_range(); |
---|
507 | return 1; |
---|
508 | } |
---|
509 | |
---|
510 | long cli_108(void *args) |
---|
511 | { |
---|
512 | light_source *l=(light_source *)lpointer_value(CAR(args)); |
---|
513 | l->xshift=lnumber_value(CAR(CDR(args))); |
---|
514 | l->calc_range(); |
---|
515 | return 1; |
---|
516 | } |
---|
517 | |
---|
518 | long cli_109(void *args) |
---|
519 | { |
---|
520 | light_source *l=(light_source *)lpointer_value(CAR(args)); |
---|
521 | l->yshift=lnumber_value(CAR(CDR(args))); |
---|
522 | l->calc_range(); |
---|
523 | return 1; |
---|
524 | } |
---|
525 | |
---|
526 | long cli_110(void *args) |
---|
527 | { return ((light_source *)lpointer_value(CAR(args)))->inner_radius; } |
---|
528 | |
---|
529 | long cli_111(void *args) |
---|
530 | { return ((light_source *)lpointer_value(CAR(args)))->outer_radius; } |
---|
531 | |
---|
532 | long cli_112(void *args) |
---|
533 | { return ((light_source *)lpointer_value(CAR(args)))->x; } |
---|
534 | |
---|
535 | long cli_113(void *args) |
---|
536 | { return ((light_source *)lpointer_value(CAR(args)))->y; } |
---|
537 | |
---|
538 | long cli_114(void *args) |
---|
539 | { return ((light_source *)lpointer_value(CAR(args)))->xshift; } |
---|
540 | |
---|
541 | long cli_115(void *args) |
---|
542 | { return ((light_source *)lpointer_value(CAR(args)))->yshift; } |
---|
543 | |
---|
544 | long cli_116(void *args) |
---|
545 | { return current_object->xacel(); } |
---|
546 | |
---|
547 | long cli_117(void *args) |
---|
548 | { return current_object->yacel(); } |
---|
549 | |
---|
550 | long cli_118(void *args) |
---|
551 | { current_level->remove_light((light_source *)lpointer_value(CAR(args))); return 1; } |
---|
552 | |
---|
553 | long cli_119(void *args) |
---|
554 | { current_object->set_fx(lnumber_value(CAR(args))); return 1; } |
---|
555 | |
---|
556 | long cli_120(void *args) |
---|
557 | { current_object->set_fy(lnumber_value(CAR(args))); return 1; } |
---|
558 | |
---|
559 | long cli_121(void *args) |
---|
560 | { current_object->set_fxvel(lnumber_value(CAR(args))); return 1; } |
---|
561 | |
---|
562 | long cli_122(void *args) |
---|
563 | { current_object->set_fyvel(lnumber_value(CAR(args))); return 1; } |
---|
564 | |
---|
565 | long cli_123(void *args) |
---|
566 | { current_object->set_fxacel(lnumber_value(CAR(args))); return 1; } |
---|
567 | |
---|
568 | long cli_124(void *args) |
---|
569 | { current_object->set_fyacel(lnumber_value(CAR(args))); return 1; } |
---|
570 | |
---|
571 | long cli_125(void *args) |
---|
572 | { return current_object->picture()->width(); } |
---|
573 | |
---|
574 | long cli_126(void *args) |
---|
575 | { return current_object->picture()->height(); } |
---|
576 | |
---|
577 | long cli_127(void *args) |
---|
578 | { dprintf("trap\n"); return 0; } // I use this to set gdb break points |
---|
579 | |
---|
580 | long cli_128(void *args) |
---|
581 | { return current_level->platform_push(current_object,lnumber_value(CAR(args)), |
---|
582 | lnumber_value(CAR(CDR(args)))); |
---|
583 | } |
---|
584 | |
---|
585 | long cli_133(void *args) // def_sound |
---|
586 | { |
---|
587 | lisp_symbol *sym=NULL; |
---|
588 | if (CDR(args)) |
---|
589 | { |
---|
590 | sym=(lisp_symbol *)lcar(args); |
---|
591 | if (item_type(sym)!=L_SYMBOL) |
---|
592 | { |
---|
593 | lbreak("expecting first arg to def-character to be a symbol!\n"); |
---|
594 | exit(0); |
---|
595 | } |
---|
596 | args=CDR(args); |
---|
597 | } |
---|
598 | |
---|
599 | int sp=current_space; |
---|
600 | current_space=PERM_SPACE; |
---|
601 | int id=cash.reg(lstring_value(lcar(args)),NULL,SPEC_EXTERN_SFX,1); |
---|
602 | if (sym) |
---|
603 | set_symbol_number(sym,id); // set the symbol value to sfx id |
---|
604 | current_space=sp; |
---|
605 | return id; |
---|
606 | } |
---|
607 | |
---|
608 | long cli_134(void *args) // play_sound |
---|
609 | { |
---|
610 | void *a=args; |
---|
611 | p_ref r1(a); |
---|
612 | int id=lnumber_value(lcar(a)); |
---|
613 | if (id<0) return 0; |
---|
614 | a=CDR(a); |
---|
615 | if (!a) |
---|
616 | cash.sfx(id)->play(127); |
---|
617 | else |
---|
618 | { |
---|
619 | int vol=lnumber_value(lcar(a)); a=CDR(a); |
---|
620 | if (a) |
---|
621 | { |
---|
622 | long x=lnumber_value(lcar(a)); a=CDR(a); |
---|
623 | if (!a) |
---|
624 | { |
---|
625 | lprint(args); |
---|
626 | lbreak("expecting y after x in play_sound\n"); |
---|
627 | exit(1); |
---|
628 | } |
---|
629 | long y=lnumber_value(lcar(a)); |
---|
630 | the_game->play_sound(id,vol,x,y); |
---|
631 | } else cash.sfx(id)->play(vol); |
---|
632 | } return 0; |
---|
633 | } |
---|
634 | |
---|
635 | |
---|
636 | long cli_142(void *args) |
---|
637 | { |
---|
638 | long x=lnumber_value(CAR(args)); args=CDR(args); |
---|
639 | if (x<0 || x>=total_weapons) |
---|
640 | { |
---|
641 | lbreak("weapon out of range (%d)\n",x); |
---|
642 | exit(0); |
---|
643 | } |
---|
644 | return weapon_types[x]; |
---|
645 | } |
---|
646 | |
---|
647 | long cli_143(void *args) |
---|
648 | { |
---|
649 | long x=lnumber_value(CAR(args)); args=CDR(args); |
---|
650 | long y=lnumber_value(CAR(args)); args=CDR(args); |
---|
651 | long r=lnumber_value(CAR(args)); args=CDR(args); |
---|
652 | long m=lnumber_value(CAR(args)); args=CDR(args); |
---|
653 | game_object *o=(game_object *)lpointer_value(CAR(args)); args=CDR(args); |
---|
654 | long mp=lnumber_value(CAR(args)); |
---|
655 | current_level->hurt_radius(x,y,r,m,current_object,o,mp); return 0; |
---|
656 | } |
---|
657 | |
---|
658 | long cli_144(void *args) |
---|
659 | { |
---|
660 | view *v=current_object->controller(); |
---|
661 | if (!v) dprintf("Can't add weapons for non-players\n"); |
---|
662 | else |
---|
663 | { |
---|
664 | long x=lnumber_value(CAR(args)); args=CDR(args); |
---|
665 | long y=lnumber_value(CAR(args)); args=CDR(args); |
---|
666 | if (x<0 || x>=total_weapons) |
---|
667 | { lbreak("weapon out of range (%d)\n",x); exit(0); } |
---|
668 | v->add_ammo(x,y); |
---|
669 | } return 0; |
---|
670 | } |
---|
671 | |
---|
672 | long cli_145(void *args) |
---|
673 | { |
---|
674 | view *v=current_object->controller(); |
---|
675 | if (!v) return 0; |
---|
676 | else return v->weapon_total(lnumber_value(CAR(args))); |
---|
677 | } |
---|
678 | |
---|
679 | long cli_146(void *args) |
---|
680 | { |
---|
681 | view *v=current_object->controller(); |
---|
682 | if (!v) return 0; else return v->current_weapon; |
---|
683 | } |
---|
684 | |
---|
685 | long cli_147(void *args) |
---|
686 | { |
---|
687 | view *v=current_object->controller(); |
---|
688 | if (!v) { lbreak("current_weapon_type : object cannot hold weapons\n"); |
---|
689 | return 0; } |
---|
690 | else return v->current_weapon; |
---|
691 | } |
---|
692 | |
---|
693 | long cli_148(void *args) |
---|
694 | { return lnumber_value(CAR(args))&BLOCKED_UP; } |
---|
695 | |
---|
696 | long cli_149(void *args) |
---|
697 | { return lnumber_value(CAR(args))&BLOCKED_DOWN; } |
---|
698 | |
---|
699 | long cli_150(void *args) |
---|
700 | { |
---|
701 | view *v=current_object->controller(); |
---|
702 | int x=lnumber_value(CAR(args)); |
---|
703 | if (x<0 || x>=total_weapons) |
---|
704 | { lbreak("weapon out of range (%d)\n",x); exit(0); } |
---|
705 | if (v) v->give_weapon(x); return 0; |
---|
706 | } |
---|
707 | |
---|
708 | long cli_151(void *args) |
---|
709 | { |
---|
710 | int a=lnumber_value(CAR(args)); |
---|
711 | if (a<0 || a>=TOTAL_ABILITIES) |
---|
712 | { |
---|
713 | lprint(args); |
---|
714 | lbreak("bad ability number for get_ability, should be 0..%d, not %d\n", |
---|
715 | TOTAL_ABILITIES,a); |
---|
716 | exit(0); |
---|
717 | } |
---|
718 | return get_ability(current_object->otype,(ability)a); |
---|
719 | } |
---|
720 | |
---|
721 | long cli_152(void *args) |
---|
722 | { |
---|
723 | view *v=current_object->controller(); |
---|
724 | if (!v) dprintf("Can't use reset_player on non-players\n"); |
---|
725 | else |
---|
726 | v->reset_player(); |
---|
727 | return 0; |
---|
728 | } |
---|
729 | |
---|
730 | long cli_153(void *args) |
---|
731 | { |
---|
732 | game_object *o=(game_object *)lpointer_value(CAR(args)); |
---|
733 | long x=o->x-current_object->x, |
---|
734 | y=-(o->y-o->picture()->height()/2-(current_object->y-(current_object->picture()->height()/2))); |
---|
735 | return lisp_atan2(y,x); |
---|
736 | } |
---|
737 | |
---|
738 | long cli_154(void *args) |
---|
739 | { |
---|
740 | long ang=lnumber_value(CAR(args)); args=CDR(args); |
---|
741 | long mag=lfixed_point_value(CAR(args)); |
---|
742 | long xvel=(lisp_cos(ang)>>8)*(mag>>8); |
---|
743 | current_object->set_xvel(xvel>>16); |
---|
744 | current_object->set_fxvel((xvel&0xffff)>>8); |
---|
745 | long yvel=-(lisp_sin(ang)>>8)*(mag>>8); |
---|
746 | current_object->set_yvel(yvel>>16); |
---|
747 | current_object->set_fyvel((yvel&0xffff)>>8); return 0; |
---|
748 | } |
---|
749 | |
---|
750 | long cli_155(void *args) |
---|
751 | { |
---|
752 | int tframes=current_object->total_frames(),f; |
---|
753 | |
---|
754 | long ang1=lnumber_value(CAR(args)); args=CDR(args); |
---|
755 | if (ang1<0) ang1=(ang1%360)+360; |
---|
756 | else if (ang1>=360) ang1=ang1%360; |
---|
757 | long ang2=lnumber_value(CAR(args)); args=CDR(args); |
---|
758 | if (ang2<0) ang2=(ang2%360)+360; |
---|
759 | else if (ang2>=360) ang2=ang2%360; |
---|
760 | |
---|
761 | long ang=(lnumber_value(CAR(args))+90/tframes)%360; |
---|
762 | if (ang1>ang2) |
---|
763 | { |
---|
764 | if (ang<ang1 && ang>ang2) |
---|
765 | return 0; |
---|
766 | else if (ang>=ang1) |
---|
767 | f=(ang-ang1)*tframes/(359-ang1+ang2+1); |
---|
768 | else |
---|
769 | f=(359-ang1+ang)*tframes/(359-ang1+ang2+1); |
---|
770 | } else if (ang<ang1 || ang>ang2) |
---|
771 | return 0; |
---|
772 | else f=(ang-ang1)*tframes/(ang2-ang1+1); |
---|
773 | if (current_object->direction>0) |
---|
774 | current_object->current_frame=f; |
---|
775 | else |
---|
776 | current_object->current_frame=tframes-f-1; |
---|
777 | return 1; |
---|
778 | } |
---|
779 | |
---|
780 | long cli_156(void *args) |
---|
781 | { |
---|
782 | int x=current_object->current_frame; |
---|
783 | current_object->set_state((character_state)lnumber_value(CAR(args))); |
---|
784 | current_object->current_frame=x; return 0; |
---|
785 | } |
---|
786 | |
---|
787 | |
---|
788 | long cli_168(void *args) |
---|
789 | { if (current_object->morph_status()) return 1; else return 0; } |
---|
790 | |
---|
791 | long cli_169(void *args) |
---|
792 | { |
---|
793 | long am=lnumber_value(CAR(args)); args=CDR(args); |
---|
794 | game_object *from=(game_object *)lpointer_value(CAR(args)); args=CDR(args); |
---|
795 | long hitx=lnumber_value(CAR(args)); args=CDR(args); |
---|
796 | long hity=lnumber_value(CAR(args)); args=CDR(args); |
---|
797 | long px=lnumber_value(CAR(args)); args=CDR(args); |
---|
798 | long py=lnumber_value(CAR(args)); args=CDR(args); |
---|
799 | current_object->damage_fun(am,from,hitx,hity,px,py); |
---|
800 | return 1; |
---|
801 | } |
---|
802 | |
---|
803 | long cli_170(void *args) |
---|
804 | { return current_object->gravity(); } |
---|
805 | |
---|
806 | long cli_171(void *args) |
---|
807 | { |
---|
808 | view *v=current_object->controller(); |
---|
809 | if (!v) dprintf("make_view_solid : object has no view\n"); |
---|
810 | else |
---|
811 | v->draw_solid=lnumber_value(CAR(args)); |
---|
812 | return 1; |
---|
813 | } |
---|
814 | |
---|
815 | long cli_172(void *args) |
---|
816 | { |
---|
817 | void *a=args; |
---|
818 | int r=lnumber_value(CAR(a)); a=CDR(a); |
---|
819 | int g=lnumber_value(CAR(a)); a=CDR(a); |
---|
820 | int b=lnumber_value(CAR(a)); |
---|
821 | if (r<0 || b<0 || g<0 || r>255 || g>255 || b>255) |
---|
822 | { |
---|
823 | lprint(args); |
---|
824 | lbreak("color out of range (0..255) in color lookup\n"); |
---|
825 | exit(0); |
---|
826 | } |
---|
827 | return color_table->lookup_color(r>>3,g>>3,b>>3); |
---|
828 | } |
---|
829 | |
---|
830 | long cli_173(void *args) |
---|
831 | { |
---|
832 | view *v=current_object->controller(); |
---|
833 | if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); } |
---|
834 | else return v->x_suggestion; return 0; |
---|
835 | } |
---|
836 | |
---|
837 | long cli_174(void *args) |
---|
838 | { |
---|
839 | view *v=current_object->controller(); |
---|
840 | if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); } |
---|
841 | else return v->y_suggestion; return 0; |
---|
842 | } |
---|
843 | |
---|
844 | long cli_175(void *args) |
---|
845 | { |
---|
846 | view *v=current_object->controller(); |
---|
847 | if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); } |
---|
848 | else return v->b1_suggestion; return 0; |
---|
849 | } |
---|
850 | |
---|
851 | long cli_176(void *args) |
---|
852 | { |
---|
853 | view *v=current_object->controller(); |
---|
854 | if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); } |
---|
855 | else return v->b2_suggestion; return 0; |
---|
856 | } |
---|
857 | |
---|
858 | long cli_177(void *args) |
---|
859 | { |
---|
860 | view *v=current_object->controller(); |
---|
861 | if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); } |
---|
862 | else return v->b3_suggestion; return 0; |
---|
863 | } |
---|
864 | |
---|
865 | long cli_178(void *args) |
---|
866 | { |
---|
867 | bg_xmul=lnumber_value(CAR(args)); args=CDR(args); |
---|
868 | bg_xdiv=lnumber_value(CAR(args)); args=CDR(args); |
---|
869 | bg_ymul=lnumber_value(CAR(args)); args=CDR(args); |
---|
870 | bg_ydiv=lnumber_value(CAR(args)); |
---|
871 | if (bg_xdiv==0) { bg_xdiv=1; lprint(args); dprintf("bg_set_scroll : cannot set xdiv to 0\n"); } |
---|
872 | if (bg_ydiv==0) { bg_ydiv=1; lprint(args); dprintf("bg_set_scroll : cannot set ydiv to 0\n"); } |
---|
873 | return 1; |
---|
874 | } |
---|
875 | |
---|
876 | long cli_179(void *args) |
---|
877 | { |
---|
878 | view *v=lget_view(CAR(args),"set_ambient_light"); args=CDR(args); |
---|
879 | long x=lnumber_value(CAR(args)); |
---|
880 | if (x>=0 && x<64) v->ambient=x; |
---|
881 | return 1; |
---|
882 | } |
---|
883 | |
---|
884 | long cli_180(void *args) |
---|
885 | { return lget_view(CAR(args),"ambient_light")->ambient; } |
---|
886 | |
---|
887 | long cli_181(void *args) |
---|
888 | { |
---|
889 | int x=current_object->total_objects(); |
---|
890 | game_object *who=(game_object *)lpointer_value(CAR(args)); |
---|
891 | for (int i=0;i<x;i++) |
---|
892 | if (current_object->get_object(i)==who) return 1; |
---|
893 | return 0; |
---|
894 | } |
---|
895 | |
---|
896 | long cli_182(void *args) |
---|
897 | { |
---|
898 | current_object->change_type(lnumber_value(CAR(args))); |
---|
899 | return 1; |
---|
900 | } |
---|
901 | |
---|
902 | long cli_184(void *args) |
---|
903 | { return current_object->current_frame; } |
---|
904 | |
---|
905 | long cli_185(void *args) |
---|
906 | { return current_object->fx(); } |
---|
907 | |
---|
908 | long cli_186(void *args) |
---|
909 | { return current_object->fy(); } |
---|
910 | |
---|
911 | long cli_187(void *args) |
---|
912 | { return current_object->fxvel(); } |
---|
913 | |
---|
914 | long cli_188(void *args) |
---|
915 | { return current_object->fyvel(); } |
---|
916 | |
---|
917 | long cli_189(void *args) |
---|
918 | { return current_object->fxacel(); } |
---|
919 | |
---|
920 | long cli_190(void *args) |
---|
921 | { return current_object->fyacel(); } |
---|
922 | |
---|
923 | |
---|
924 | long cli_191(void *args) |
---|
925 | { |
---|
926 | char *fn=lstring_value(CAR(args)); args=CDR(args); |
---|
927 | // stat_bar=cash.reg_object(fn,CAR(args),SPEC_IMAGE,1); |
---|
928 | return 0; |
---|
929 | } |
---|
930 | |
---|
931 | long cli_192(void *args) |
---|
932 | { |
---|
933 | long x=lnumber_value(CAR(args)); args=CDR(args); |
---|
934 | long y=lnumber_value(CAR(args)); args=CDR(args); |
---|
935 | long type=lnumber_value(CAR(args)); |
---|
936 | if (x<0 || y<0 || x>=current_level->foreground_width() || y>=current_level->foreground_width()) |
---|
937 | lbreak("%d %d is out of range of fg map",x,y); |
---|
938 | else |
---|
939 | current_level->put_fg(x,y,type); |
---|
940 | return 1; |
---|
941 | } |
---|
942 | |
---|
943 | long cli_193(void *args) |
---|
944 | { |
---|
945 | long x=lnumber_value(CAR(args)); args=CDR(args); |
---|
946 | long y=lnumber_value(CAR(args)); |
---|
947 | if (x<0 || y<0 || x>=current_level->foreground_width() || y>=current_level->foreground_width()) |
---|
948 | lbreak("%d %d is out of range of fg map",x,y); |
---|
949 | else return current_level->get_fg(x,y); |
---|
950 | return 0; |
---|
951 | } |
---|
952 | |
---|
953 | long cli_194(void *args) |
---|
954 | { |
---|
955 | long x=lnumber_value(CAR(args)); args=CDR(args); |
---|
956 | long y=lnumber_value(CAR(args)); args=CDR(args); |
---|
957 | long type=lnumber_value(CAR(args)); |
---|
958 | if (x<0 || y<0 || x>=current_level->background_width() || y>=current_level->background_width()) |
---|
959 | lbreak("%d %d is out of range of fg map",x,y); |
---|
960 | else |
---|
961 | current_level->put_bg(x,y,type); |
---|
962 | return 1; |
---|
963 | } |
---|
964 | |
---|
965 | long cli_195(void *args) |
---|
966 | { |
---|
967 | long x=lnumber_value(CAR(args)); args=CDR(args); |
---|
968 | long y=lnumber_value(CAR(args)); |
---|
969 | if (x<0 || y<0 || x>=current_level->background_width() || y>=current_level->background_width()) |
---|
970 | lbreak("%d %d is out of range of fg map",x,y); |
---|
971 | else return current_level->get_bg(x,y); |
---|
972 | return 0; |
---|
973 | } |
---|
974 | |
---|
975 | long cli_196(void *args) |
---|
976 | { load_tiles(args); return 1 ; } |
---|
977 | |
---|
978 | long cli_197(void *args) |
---|
979 | { |
---|
980 | bFILE *fp=open_file(lstring_value(CAR(args)),"rb"); |
---|
981 | if (fp->open_failure()) |
---|
982 | { |
---|
983 | delete fp; |
---|
984 | lbreak("load_palette : could not open file %s for reading",lstring_value(CAR(args))); |
---|
985 | exit(1); |
---|
986 | } else |
---|
987 | { |
---|
988 | spec_directory sd(fp); |
---|
989 | spec_entry *se=sd.find(SPEC_PALETTE); |
---|
990 | if (!se) lbreak("File %s has no palette!\n",lstring_value(CAR(args))); |
---|
991 | else |
---|
992 | { |
---|
993 | if (pal) delete pal; |
---|
994 | pal=new palette(se,fp); |
---|
995 | } |
---|
996 | delete fp; |
---|
997 | } |
---|
998 | return 0; |
---|
999 | } |
---|
1000 | |
---|
1001 | long cli_198(void *args) |
---|
1002 | { |
---|
1003 | bFILE *fp=open_file(lstring_value(CAR(args)),"rb"); |
---|
1004 | if (fp->open_failure()) |
---|
1005 | { |
---|
1006 | delete fp; |
---|
1007 | lbreak("load_color_filter : could not open file %s for reading",lstring_value(CAR(args))); |
---|
1008 | exit(1); |
---|
1009 | } else |
---|
1010 | { |
---|
1011 | spec_directory sd(fp); |
---|
1012 | spec_entry *se=sd.find(SPEC_COLOR_TABLE); |
---|
1013 | if (!se) lbreak("File %s has no color filter!",lstring_value(CAR(args))); |
---|
1014 | else |
---|
1015 | { |
---|
1016 | if (color_table) delete color_table; |
---|
1017 | color_table=new color_filter(se,fp); |
---|
1018 | } |
---|
1019 | delete fp; |
---|
1020 | } |
---|
1021 | return 0; |
---|
1022 | } |
---|
1023 | |
---|
1024 | long cli_199(void *args) |
---|
1025 | { |
---|
1026 | current_start_type=lnumber_value(CAR(args)); |
---|
1027 | set_local_players(1); |
---|
1028 | return 1; |
---|
1029 | } |
---|
1030 | |
---|
1031 | long cli_200(void *args) |
---|
1032 | { |
---|
1033 | long xv=lnumber_value(CAR(args)); args=CDR(args); |
---|
1034 | long yv=lnumber_value(CAR(args)); args=CDR(args); |
---|
1035 | int top=2; |
---|
1036 | if (args) |
---|
1037 | if (!CAR(args)) top=0; |
---|
1038 | |
---|
1039 | long oxv=xv,oyv=yv; |
---|
1040 | current_object->try_move(current_object->x,current_object->y,xv,yv,1|top); |
---|
1041 | current_object->x+=xv; |
---|
1042 | current_object->y+=yv; |
---|
1043 | return (oxv==xv && oyv==yv); |
---|
1044 | } |
---|
1045 | |
---|
1046 | long cli_201(void *args) |
---|
1047 | { |
---|
1048 | long x=lnumber_value(CAR(args)); |
---|
1049 | return figures[current_object->otype]->get_sequence((character_state)x)->length(); |
---|
1050 | } |
---|
1051 | |
---|
1052 | long cli_202(void *args) |
---|
1053 | { |
---|
1054 | long x1=lnumber_value(CAR(args)); args=CDR(args); |
---|
1055 | long y1=lnumber_value(CAR(args)); args=CDR(args); |
---|
1056 | long x2=lnumber_value(CAR(args)); args=CDR(args); |
---|
1057 | long y2=lnumber_value(CAR(args)); args=CDR(args); |
---|
1058 | void *block_all=CAR(args); |
---|
1059 | long nx2=x2,ny2=y2; |
---|
1060 | if (x2==x1) |
---|
1061 | current_level->vforeground_intersect(x1,y1,y2); |
---|
1062 | else |
---|
1063 | current_level->foreground_intersect(x1,y1,x2,y2); |
---|
1064 | if (x2!=nx2 || y2!=ny2) return 0; |
---|
1065 | |
---|
1066 | if (block_all) |
---|
1067 | current_level->all_boundary_setback(current_object,x1,y1,x2,y2); |
---|
1068 | else |
---|
1069 | current_level->boundary_setback(current_object,x1,y1,x2,y2); |
---|
1070 | return (x2==nx2 && y2==ny2); |
---|
1071 | |
---|
1072 | } |
---|
1073 | |
---|
1074 | long cli_203(void *args) |
---|
1075 | { |
---|
1076 | char *fn=lstring_value(CAR(args)); args=CDR(args); |
---|
1077 | char *name=lstring_value(CAR(args)); |
---|
1078 | big_font_pict=cash.reg(fn,name,SPEC_IMAGE,1); |
---|
1079 | return 1; |
---|
1080 | } |
---|
1081 | |
---|
1082 | long cli_204(void *args) |
---|
1083 | { |
---|
1084 | char *fn=lstring_value(CAR(args)); args=CDR(args); |
---|
1085 | char *name=lstring_value(CAR(args)); |
---|
1086 | small_font_pict=cash.reg(fn,name,SPEC_IMAGE,1); |
---|
1087 | return 1; |
---|
1088 | } |
---|
1089 | |
---|
1090 | long cli_205(void *args) |
---|
1091 | { |
---|
1092 | char *fn=lstring_value(CAR(args)); args=CDR(args); |
---|
1093 | char *name=lstring_value(CAR(args)); |
---|
1094 | console_font_pict=cash.reg(fn,name,SPEC_IMAGE,1); |
---|
1095 | return 1; |
---|
1096 | } |
---|
1097 | |
---|
1098 | long cli_206(void *args) |
---|
1099 | { |
---|
1100 | long x=lnumber_value(CAR(args)); |
---|
1101 | if (x<current_object->total_frames()) |
---|
1102 | current_object->current_frame=x; |
---|
1103 | else |
---|
1104 | lbreak("%d out of range for set_current_frame",x); |
---|
1105 | return 1; |
---|
1106 | } |
---|
1107 | |
---|
1108 | long cli_208(void *args) |
---|
1109 | { |
---|
1110 | current_object->draw_trans(lnumber_value(CAR(args)),lnumber_value(CAR(CDR(args)))); |
---|
1111 | return 1; |
---|
1112 | } |
---|
1113 | |
---|
1114 | long cli_209(void *args) |
---|
1115 | { |
---|
1116 | current_object->draw_tint(lnumber_value(CAR(args))); |
---|
1117 | return 1; |
---|
1118 | } |
---|
1119 | |
---|
1120 | long cli_210(void *args) |
---|
1121 | { |
---|
1122 | current_object->draw_predator(); |
---|
1123 | return 1; |
---|
1124 | } |
---|
1125 | |
---|
1126 | long cli_211(void *args) |
---|
1127 | { return lget_view(CAR(args),"shift_down")->shift_right; return 1; } |
---|
1128 | |
---|
1129 | long cli_212(void *args) |
---|
1130 | { return lget_view(CAR(args),"shift_right")->shift_down; return 1; } |
---|
1131 | |
---|
1132 | long cli_213(void *args) |
---|
1133 | { |
---|
1134 | view *v=lget_view(CAR(args),"set_no_scroll_range"); args=CDR(args); |
---|
1135 | v->no_xleft=lnumber_value(CAR(args)); args=CDR(args); |
---|
1136 | v->no_ytop=lnumber_value(CAR(args)); args=CDR(args); |
---|
1137 | v->no_xright=lnumber_value(CAR(args)); args=CDR(args); |
---|
1138 | v->no_ybottom=lnumber_value(CAR(args)); |
---|
1139 | return 0; |
---|
1140 | } |
---|
1141 | |
---|
1142 | long cli_215(void *args) |
---|
1143 | { |
---|
1144 | char *fn=lstring_value(CAR(args)); args=CDR(args); |
---|
1145 | char *name=lstring_value(CAR(args)); args=CDR(args); |
---|
1146 | return cash.reg(fn,name,SPEC_IMAGE,1); |
---|
1147 | } |
---|
1148 | |
---|
1149 | long cli_216(void *args) |
---|
1150 | { |
---|
1151 | long x1=lnumber_value(CAR(args)); args=lcdr(args); |
---|
1152 | long y1=lnumber_value(CAR(args)); args=lcdr(args); |
---|
1153 | long id=lnumber_value(CAR(args)); |
---|
1154 | cash.img(id)->put_image(screen,x1,y1,1); |
---|
1155 | return 1; |
---|
1156 | } |
---|
1157 | |
---|
1158 | long cli_217(void *args) |
---|
1159 | { |
---|
1160 | view *v=current_object->controller(); |
---|
1161 | if (!v) lbreak("object has no view : view_x1"); |
---|
1162 | else return v->cx1; |
---|
1163 | return 0; |
---|
1164 | } |
---|
1165 | |
---|
1166 | long cli_218(void *args) |
---|
1167 | { |
---|
1168 | view *v=current_object->controller(); |
---|
1169 | if (!v) lbreak("object has no view : view_x1"); |
---|
1170 | else return v->cy1; |
---|
1171 | return 0; |
---|
1172 | } |
---|
1173 | |
---|
1174 | |
---|
1175 | long cli_219(void *args) |
---|
1176 | { |
---|
1177 | view *v=current_object->controller(); |
---|
1178 | if (!v) lbreak("object has no view : view_x1"); |
---|
1179 | else return v->cx2; |
---|
1180 | return 0; |
---|
1181 | } |
---|
1182 | |
---|
1183 | long cli_220(void *args) |
---|
1184 | { |
---|
1185 | view *v=current_object->controller(); |
---|
1186 | if (!v) lbreak("object has no view : view_x1"); |
---|
1187 | else return v->cy2; |
---|
1188 | return 0; |
---|
1189 | } |
---|
1190 | |
---|
1191 | long cli_221(void *args) |
---|
1192 | { |
---|
1193 | view *v=current_object->controller(); |
---|
1194 | if (!v) lbreak("object has no view : view_push_down"); |
---|
1195 | else v->last_y-=lnumber_value(CAR(args)); |
---|
1196 | return 1; |
---|
1197 | } |
---|
1198 | |
---|
1199 | long cli_222(void *args) |
---|
1200 | { |
---|
1201 | view *v=current_object->controller(); |
---|
1202 | if (!v) lbreak("object has no view : local_player"); |
---|
1203 | else return v->local_player(); |
---|
1204 | return 0; |
---|
1205 | } |
---|
1206 | |
---|
1207 | long cli_223(void *args) |
---|
1208 | { |
---|
1209 | char *fn=lstring_value(CAR(args)); |
---|
1210 | current_level->save(fn,1); |
---|
1211 | return 1; |
---|
1212 | } |
---|
1213 | |
---|
1214 | long cli_224(void *args) |
---|
1215 | { |
---|
1216 | current_object->set_hp(lnumber_value(CAR(args))); |
---|
1217 | return 1; |
---|
1218 | } |
---|
1219 | |
---|
1220 | long cli_225(void *args) |
---|
1221 | { |
---|
1222 | char *fn=lstring_value(CAR(args)); |
---|
1223 | the_game->request_level_load(fn); |
---|
1224 | return 1; |
---|
1225 | } |
---|
1226 | |
---|
1227 | long cli_226(void *args) |
---|
1228 | { |
---|
1229 | strcpy(level_file,lstring_value(CAR(args))); |
---|
1230 | return 1; |
---|
1231 | } |
---|
1232 | |
---|
1233 | long cli_227(void *args) |
---|
1234 | { |
---|
1235 | return cash.reg(lstring_value(CAR(args)),"palette",SPEC_PALETTE,1); |
---|
1236 | } |
---|
1237 | |
---|
1238 | long cli_228(void *args) |
---|
1239 | { |
---|
1240 | palette *p=pal->copy(); |
---|
1241 | uchar *addr=(uchar *)p->addr(); |
---|
1242 | int r,g,b; |
---|
1243 | int ra=lnumber_value(CAR(args)); args=CDR(args); |
---|
1244 | int ga=lnumber_value(CAR(args)); args=CDR(args); |
---|
1245 | int ba=lnumber_value(CAR(args)); |
---|
1246 | for (int i=0;i<256;i++) |
---|
1247 | { |
---|
1248 | r=(int)*addr+ra; if (r>255) r=255; else if (r<0) r=0; *addr=(uchar)r; addr++; |
---|
1249 | g=(int)*addr+ga; if (g>255) g=255; else if (g<0) g=0; *addr=(uchar)g; addr++; |
---|
1250 | b=(int)*addr+ba; if (b>255) b=255; else if (b<0) b=0; *addr=(uchar)b; addr++; |
---|
1251 | } |
---|
1252 | p->load(); |
---|
1253 | delete p; |
---|
1254 | return 0; |
---|
1255 | } |
---|
1256 | |
---|
1257 | long cli_229(void *args) |
---|
1258 | { |
---|
1259 | view *v=current_object->controller(); |
---|
1260 | if (!v) lbreak("object has no view : local_player"); |
---|
1261 | else return v->player_number; |
---|
1262 | return 0; |
---|
1263 | } |
---|
1264 | |
---|
1265 | long cli_230(void *args) |
---|
1266 | { |
---|
1267 | view *v=current_object->controller(); |
---|
1268 | if (!v) lbreak("object has no view : local_player"); |
---|
1269 | else |
---|
1270 | { |
---|
1271 | long x=lnumber_value(CAR(args)); |
---|
1272 | if (x<0 || x>=total_weapons) |
---|
1273 | { lbreak("weapon out of range (%d)\n",x); exit(0); } |
---|
1274 | v->current_weapon=x; |
---|
1275 | } |
---|
1276 | return 1; |
---|
1277 | } |
---|
1278 | |
---|
1279 | long cli_231(void *args) |
---|
1280 | { |
---|
1281 | view *v=current_object->controller(); |
---|
1282 | if (!v) lbreak("object has no view : local_player"); |
---|
1283 | else return v->has_weapon(lnumber_value(CAR(args))); |
---|
1284 | return 0; |
---|
1285 | } |
---|
1286 | |
---|
1287 | long cli_232(void *args) |
---|
1288 | { |
---|
1289 | ambient_ramp+=lnumber_value(CAR(args)); |
---|
1290 | return 1; |
---|
1291 | } |
---|
1292 | |
---|
1293 | long cli_233(void *args) |
---|
1294 | { int x=0; view *v=player_list; for (;v;v=v->next,x++); return x; } |
---|
1295 | |
---|
1296 | |
---|
1297 | long cli_234(void *args) |
---|
1298 | { |
---|
1299 | long cx1,x1=lnumber_value(CAR(args)); args=lcdr(args); |
---|
1300 | long cy1,y1=lnumber_value(CAR(args)); args=lcdr(args); |
---|
1301 | long cx2,x2=lnumber_value(CAR(args)); args=lcdr(args); |
---|
1302 | long cy2,y2=lnumber_value(CAR(args)); args=lcdr(args); |
---|
1303 | long c=lnumber_value(CAR(args)); args=lcdr(args); |
---|
1304 | long s=lnumber_value(CAR(args)); |
---|
1305 | the_game->game_to_mouse(x1,y1,current_view,cx1,cy1); |
---|
1306 | the_game->game_to_mouse(x2,y2,current_view,cx2,cy2); |
---|
1307 | scatter_line(cx1,cy1,cx2,cy2,c,s); |
---|
1308 | return 1; |
---|
1309 | |
---|
1310 | } |
---|
1311 | |
---|
1312 | long cli_235(void *args) |
---|
1313 | { |
---|
1314 | if (current_level) return current_level->tick_counter(); |
---|
1315 | else return 0; |
---|
1316 | } |
---|
1317 | |
---|
1318 | long cli_236(void *args) |
---|
1319 | { |
---|
1320 | return current_object->controller()!=NULL; |
---|
1321 | } |
---|
1322 | |
---|
1323 | long cli_237(void *args) |
---|
1324 | { |
---|
1325 | rand_on+=lnumber_value(CAR(args)); return 1; |
---|
1326 | } |
---|
1327 | |
---|
1328 | long cli_238(void *args) |
---|
1329 | { |
---|
1330 | return current_object->total_frames(); |
---|
1331 | } |
---|
1332 | |
---|
1333 | long cli_239(void *args) |
---|
1334 | { |
---|
1335 | current_level->to_front(current_object); |
---|
1336 | return 1; |
---|
1337 | } |
---|
1338 | |
---|
1339 | long cli_240(void *args) |
---|
1340 | { |
---|
1341 | current_level->to_back(current_object); |
---|
1342 | return 1; |
---|
1343 | } |
---|
1344 | |
---|
1345 | long cli_241(void *args) |
---|
1346 | { |
---|
1347 | view *v=current_object->controller(); |
---|
1348 | if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); } |
---|
1349 | else return v->pointer_x; |
---|
1350 | return 0; |
---|
1351 | } |
---|
1352 | |
---|
1353 | long cli_242(void *args) |
---|
1354 | { |
---|
1355 | view *v=current_object->controller(); |
---|
1356 | if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); } |
---|
1357 | else return v->pointer_y; |
---|
1358 | return 0; |
---|
1359 | } |
---|
1360 | |
---|
1361 | long cli_243(void *args) |
---|
1362 | { |
---|
1363 | if (player_list->next || demo_man.current_state()!=demo_manager::NORMAL) |
---|
1364 | return 0; |
---|
1365 | else |
---|
1366 | return (frame_panic>10); |
---|
1367 | } |
---|
1368 | |
---|
1369 | long cli_244(void *args) |
---|
1370 | { |
---|
1371 | long cx1,x1=lnumber_value(CAR(args)); args=lcdr(args); |
---|
1372 | long cy1,y1=lnumber_value(CAR(args)); args=lcdr(args); |
---|
1373 | long cx2,x2=lnumber_value(CAR(args)); args=lcdr(args); |
---|
1374 | long cy2,y2=lnumber_value(CAR(args)); args=lcdr(args); |
---|
1375 | long c1=lnumber_value(CAR(args)); args=lcdr(args); |
---|
1376 | long c2=lnumber_value(CAR(args)); args=lcdr(args); |
---|
1377 | long s=lnumber_value(CAR(args)); |
---|
1378 | the_game->game_to_mouse(x1,y1,current_view,cx1,cy1); |
---|
1379 | the_game->game_to_mouse(x2,y2,current_view,cx2,cy2); |
---|
1380 | ascatter_line(cx1,cy1,cx2,cy2,c1,c2,s); |
---|
1381 | return 1; |
---|
1382 | |
---|
1383 | } |
---|
1384 | |
---|
1385 | long cli_245(void *args) |
---|
1386 | { |
---|
1387 | return rand_on; |
---|
1388 | } |
---|
1389 | |
---|
1390 | long cli_246(void *args) |
---|
1391 | { |
---|
1392 | rand_on=lnumber_value(CAR(args)); |
---|
1393 | return 1; |
---|
1394 | } |
---|
1395 | |
---|
1396 | long cli_247(void *args) |
---|
1397 | { |
---|
1398 | long cx1=lnumber_value(CAR(args)); args=lcdr(args); |
---|
1399 | long cy1=lnumber_value(CAR(args)); args=lcdr(args); |
---|
1400 | long cx2=lnumber_value(CAR(args)); args=lcdr(args); |
---|
1401 | long cy2=lnumber_value(CAR(args)); args=lcdr(args); |
---|
1402 | long c1=lnumber_value(CAR(args)); args=lcdr(args); |
---|
1403 | screen->bar(cx1,cy1,cx2,cy2,c1); |
---|
1404 | return 1; |
---|
1405 | } |
---|
1406 | |
---|
1407 | long cli_248(void *args) |
---|
1408 | { |
---|
1409 | return start_argc; |
---|
1410 | } |
---|
1411 | |
---|
1412 | long cli_249(void *args) |
---|
1413 | { |
---|
1414 | if ((sound_avail&MUSIC_INITIALIZED)) |
---|
1415 | { |
---|
1416 | char *fn=lstring_value(CAR(args)); |
---|
1417 | if (current_song) |
---|
1418 | { |
---|
1419 | if (current_song->playing()) |
---|
1420 | current_song->stop(); |
---|
1421 | delete current_song; |
---|
1422 | } |
---|
1423 | current_song=new song(fn); |
---|
1424 | current_song->play(music_volume); |
---|
1425 | dprintf("Playing %s at volume %d\n",fn,music_volume); |
---|
1426 | } |
---|
1427 | return 1; |
---|
1428 | } |
---|
1429 | |
---|
1430 | long cli_250(void *args) |
---|
1431 | { |
---|
1432 | if (current_song && current_song->playing()) |
---|
1433 | current_song->stop(); |
---|
1434 | delete current_song; |
---|
1435 | current_song=NULL; |
---|
1436 | return 1; |
---|
1437 | } |
---|
1438 | |
---|
1439 | long cli_251(void *args) |
---|
1440 | { return current_object->targetable(); } |
---|
1441 | |
---|
1442 | long cli_252(void *args) |
---|
1443 | { current_object->set_targetable( CAR(args)==NULL ? 0 : 1); return 1; } |
---|
1444 | |
---|
1445 | long cli_253(void *args) |
---|
1446 | { show_stats(); return 1; } |
---|
1447 | |
---|
1448 | long cli_254(void *args) |
---|
1449 | { |
---|
1450 | view *v=current_object->controller(); |
---|
1451 | if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); } |
---|
1452 | else return v->kills; |
---|
1453 | return 0; |
---|
1454 | } |
---|
1455 | |
---|
1456 | long cli_255(void *args) |
---|
1457 | { |
---|
1458 | view *v=current_object->controller(); |
---|
1459 | if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); } |
---|
1460 | else return v->tkills; |
---|
1461 | return 0; |
---|
1462 | } |
---|
1463 | |
---|
1464 | long cli_256(void *args) |
---|
1465 | { |
---|
1466 | view *v=current_object->controller(); |
---|
1467 | if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); } |
---|
1468 | else return v->secrets; |
---|
1469 | return 0; |
---|
1470 | } |
---|
1471 | |
---|
1472 | long cli_257(void *args) |
---|
1473 | { |
---|
1474 | view *v=current_object->controller(); |
---|
1475 | if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); } |
---|
1476 | else return v->tsecrets; |
---|
1477 | return 0; |
---|
1478 | } |
---|
1479 | |
---|
1480 | long cli_258(void *args) |
---|
1481 | { |
---|
1482 | view *v=current_object->controller(); |
---|
1483 | if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); } |
---|
1484 | else v->kills=lnumber_value(CAR(args)); |
---|
1485 | return 1; |
---|
1486 | } |
---|
1487 | |
---|
1488 | long cli_259(void *args) |
---|
1489 | { |
---|
1490 | view *v=current_object->controller(); |
---|
1491 | if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); } |
---|
1492 | else v->tkills=lnumber_value(CAR(args)); |
---|
1493 | return 1; |
---|
1494 | } |
---|
1495 | |
---|
1496 | long cli_260(void *args) |
---|
1497 | { |
---|
1498 | view *v=current_object->controller(); |
---|
1499 | if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); } |
---|
1500 | else v->secrets=lnumber_value(CAR(args)); |
---|
1501 | return 1; |
---|
1502 | } |
---|
1503 | |
---|
1504 | long cli_261(void *args) |
---|
1505 | { |
---|
1506 | view *v=current_object->controller(); |
---|
1507 | if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); } |
---|
1508 | else v->tsecrets=lnumber_value(CAR(args)); |
---|
1509 | return 1; |
---|
1510 | } |
---|
1511 | |
---|
1512 | long cli_262(void *args) |
---|
1513 | { |
---|
1514 | the_game->request_end(); |
---|
1515 | return 1; |
---|
1516 | } |
---|
1517 | |
---|
1518 | long cli_263(void *args) |
---|
1519 | { |
---|
1520 | the_game->reset_keymap(); |
---|
1521 | return load_game(1,symbol_str("SAVE")); //get_save_spot(); shit |
---|
1522 | } |
---|
1523 | |
---|
1524 | long cli_264(void *args) |
---|
1525 | { |
---|
1526 | mem_report("mem.rep"); |
---|
1527 | return 1; |
---|
1528 | } |
---|
1529 | |
---|
1530 | long cli_265(void *args) |
---|
1531 | { |
---|
1532 | return major_version; |
---|
1533 | } |
---|
1534 | |
---|
1535 | long cli_266(void *args) |
---|
1536 | { |
---|
1537 | return minor_version; |
---|
1538 | } |
---|
1539 | |
---|
1540 | long cli_267(void *args) |
---|
1541 | { |
---|
1542 | current_object->draw_double_tint(lnumber_value(CAR(args)),lnumber_value(CAR(CDR(args)))); |
---|
1543 | return 1; |
---|
1544 | } |
---|
1545 | |
---|
1546 | long cli_268(void *args) |
---|
1547 | { |
---|
1548 | return cash.img(lnumber_value(CAR(args)))->width(); |
---|
1549 | } |
---|
1550 | |
---|
1551 | long cli_269(void *args) |
---|
1552 | { |
---|
1553 | return cash.img(lnumber_value(CAR(args)))->height(); |
---|
1554 | } |
---|
1555 | |
---|
1556 | long cli_270(void *args) |
---|
1557 | { |
---|
1558 | return current_level->foreground_width(); |
---|
1559 | } |
---|
1560 | |
---|
1561 | long cli_271(void *args) |
---|
1562 | { |
---|
1563 | return current_level->foreground_height(); |
---|
1564 | } |
---|
1565 | |
---|
1566 | long cli_272(void *args) |
---|
1567 | { |
---|
1568 | return current_level->background_width(); |
---|
1569 | } |
---|
1570 | |
---|
1571 | long cli_273(void *args) |
---|
1572 | { |
---|
1573 | return current_level->background_height(); |
---|
1574 | } |
---|
1575 | |
---|
1576 | long cli_274(void *args) |
---|
1577 | { |
---|
1578 | return get_keycode(lstring_value(CAR(args))); |
---|
1579 | } |
---|
1580 | |
---|
1581 | long cli_275(void *args) |
---|
1582 | { |
---|
1583 | int id=lnumber_value(CAR(args)); args=CDR(args); |
---|
1584 | int x=lnumber_value(CAR(args)); args=CDR(args); |
---|
1585 | int y=lnumber_value(CAR(args)); |
---|
1586 | c_target=id; |
---|
1587 | if (screen) |
---|
1588 | eh->set_mouse_shape(cash.img(c_target)->copy(),x,y); |
---|
1589 | return 0; |
---|
1590 | } |
---|
1591 | |
---|
1592 | long cli_276(void *args) |
---|
1593 | { |
---|
1594 | if (!main_net_cfg) return 0; |
---|
1595 | return become_server(game_name); |
---|
1596 | } |
---|
1597 | |
---|
1598 | long cli_277(void *args) |
---|
1599 | { |
---|
1600 | JCFont *fnt=(JCFont *)lpointer_value(CAR(args)); args=CDR(args); |
---|
1601 | long x=lnumber_value(CAR(args)); args=CDR(args); |
---|
1602 | long y=lnumber_value(CAR(args)); args=CDR(args); |
---|
1603 | char *st=lstring_value(CAR(args)); args=CDR(args); |
---|
1604 | int color=-1; |
---|
1605 | if (args) |
---|
1606 | color=lnumber_value(CAR(args)); |
---|
1607 | fnt->put_string(screen,x,y,st,color); |
---|
1608 | return 0; |
---|
1609 | } |
---|
1610 | |
---|
1611 | long cli_278(void *args) |
---|
1612 | { return ((JCFont *)lpointer_value(CAR(args)))->width(); } |
---|
1613 | |
---|
1614 | long cli_279(void *args) |
---|
1615 | { return ((JCFont *)lpointer_value(CAR(args)))->height(); } |
---|
1616 | |
---|
1617 | long cli_280(void *args) |
---|
1618 | { if (chat) chat->put_all(lstring_value(CAR(args))); return 1; } |
---|
1619 | |
---|
1620 | long cli_281(void *args) |
---|
1621 | { |
---|
1622 | view *v=current_object->controller(); |
---|
1623 | if (!v) { lbreak("get_player_name : object has no view!\n"); } |
---|
1624 | else strcpy(v->name,lstring_value(CAR(args))); |
---|
1625 | return 1; |
---|
1626 | } |
---|
1627 | |
---|
1628 | long cli_282(void *args) |
---|
1629 | { |
---|
1630 | long x1=lnumber_value(CAR(args)); args=CDR(args); |
---|
1631 | long y1=lnumber_value(CAR(args)); args=CDR(args); |
---|
1632 | long x2=lnumber_value(CAR(args)); args=CDR(args); |
---|
1633 | long y2=lnumber_value(CAR(args)); args=CDR(args); |
---|
1634 | long c=lnumber_value(CAR(args)); |
---|
1635 | screen->bar(x1,y1,x2,y2,c); |
---|
1636 | return 0; |
---|
1637 | } |
---|
1638 | |
---|
1639 | long cli_283(void *args) |
---|
1640 | { |
---|
1641 | long x1=lnumber_value(CAR(args)); args=CDR(args); |
---|
1642 | long y1=lnumber_value(CAR(args)); args=CDR(args); |
---|
1643 | long x2=lnumber_value(CAR(args)); args=CDR(args); |
---|
1644 | long y2=lnumber_value(CAR(args)); args=CDR(args); |
---|
1645 | long c=lnumber_value(CAR(args)); |
---|
1646 | screen->rectangle(x1,y1,x2,y2,c); |
---|
1647 | return 0; |
---|
1648 | } |
---|
1649 | |
---|
1650 | long cli_284(void *args) |
---|
1651 | { |
---|
1652 | if (get_option(lstring_value(CAR(args)))) |
---|
1653 | return 1; |
---|
1654 | else return 0; |
---|
1655 | } |
---|
1656 | |
---|
1657 | long cli_285(void *args) |
---|
1658 | { |
---|
1659 | char cd[100]; |
---|
1660 | getcwd(cd,100); |
---|
1661 | int t=change_dir(lstring_value(CAR(args))); |
---|
1662 | change_dir(cd); |
---|
1663 | return t; |
---|
1664 | } |
---|
1665 | |
---|
1666 | long cli_286(void *args) |
---|
1667 | { |
---|
1668 | if (change_dir(lstring_value(CAR(args)))) |
---|
1669 | return 1; |
---|
1670 | else return 0; |
---|
1671 | } |
---|
1672 | |
---|
1673 | long cli_287(void *args) |
---|
1674 | { |
---|
1675 | void *title=CAR(args); args=CDR(args); |
---|
1676 | void *source=CAR(args); args=CDR(args); |
---|
1677 | void *dest=CAR(args); args=CDR(args); |
---|
1678 | |
---|
1679 | return nice_copy(lstring_value(title),lstring_value(source),lstring_value(dest)); |
---|
1680 | } |
---|
1681 | |
---|
1682 | long cli_288(void *args) |
---|
1683 | { |
---|
1684 | if (CAR(args)) the_game->set_delay(1); else the_game->set_delay(0); |
---|
1685 | return 1; |
---|
1686 | } |
---|
1687 | |
---|
1688 | long cli_289(void *args) |
---|
1689 | { |
---|
1690 | set_login(lstring_value(CAR(args))); |
---|
1691 | return 1; |
---|
1692 | } |
---|
1693 | |
---|
1694 | long cli_290(void *args) |
---|
1695 | { |
---|
1696 | chatting_enabled=1; |
---|
1697 | return 1; |
---|
1698 | } |
---|
1699 | |
---|
1700 | long cli_291(void *args) |
---|
1701 | { |
---|
1702 | demo_start=1; |
---|
1703 | return 1; |
---|
1704 | } |
---|
1705 | |
---|
1706 | long cli_292(void *args) |
---|
1707 | { |
---|
1708 | if (main_net_cfg && main_net_cfg->state==net_configuration::CLIENT) |
---|
1709 | return 1; |
---|
1710 | else return 0; |
---|
1711 | } |
---|
1712 | |
---|
1713 | long cli_293(void *args) |
---|
1714 | { |
---|
1715 | if (main_net_cfg && (main_net_cfg->state==net_configuration::CLIENT || main_net_cfg->state==net_configuration::SERVER)) |
---|
1716 | { |
---|
1717 | view *v=player_list; |
---|
1718 | for (;v;v=v->next) |
---|
1719 | if (v->kills>=main_net_cfg->kills) |
---|
1720 | return 1; |
---|
1721 | |
---|
1722 | |
---|
1723 | } |
---|
1724 | return 0; |
---|
1725 | } |
---|
1726 | |
---|
1727 | long cli_294(void *args) |
---|
1728 | { |
---|
1729 | view *v=player_list; |
---|
1730 | for (;v;v=v->next) |
---|
1731 | { |
---|
1732 | v->tkills+=v->kills; |
---|
1733 | |
---|
1734 | v->kills=0; |
---|
1735 | game_object *o=current_object; |
---|
1736 | current_object=v->focus; |
---|
1737 | |
---|
1738 | eval_function((lisp_symbol *)l_restart_player,NULL); |
---|
1739 | v->reset_player(); |
---|
1740 | v->focus->set_aistate(0); |
---|
1741 | current_object=o; |
---|
1742 | } |
---|
1743 | return 1; |
---|
1744 | } |
---|
1745 | |
---|
1746 | long cli_295(void *args) |
---|
1747 | { |
---|
1748 | strncpy(game_name,lstring_value(CAR(args)),sizeof(game_name)); |
---|
1749 | game_name[sizeof(game_name)-1]=0; |
---|
1750 | return 1; |
---|
1751 | } |
---|
1752 | |
---|
1753 | long cli_296(void *args) |
---|
1754 | { |
---|
1755 | if (main_net_cfg) |
---|
1756 | main_net_cfg->min_players=lnumber_value(CAR(args)); |
---|
1757 | return 0; |
---|
1758 | } |
---|
1759 | |
---|
1760 | long cli_297(void *args) // expire cache item |
---|
1761 | { |
---|
1762 | cash.expire(lnumber_value(CAR(args))); |
---|
1763 | return 0; |
---|
1764 | } |
---|
1765 | |
---|
1766 | #define add_c_function(st,mn,mx,num) add_c_function(st,mn,mx,cli_##num) |
---|
1767 | #define add_c_bool_fun(st,mn,mx,num) add_c_bool_fun(st,mn,mx,cli_##num) |
---|
1768 | |
---|
1769 | |
---|
1770 | void clisp_init() // call by lisp_init, defines symbols and functions |
---|
1771 | // to irnterface with c |
---|
1772 | { |
---|
1773 | l_easy=make_find_symbol("easy"); |
---|
1774 | l_medium=make_find_symbol("medium"); |
---|
1775 | l_hard=make_find_symbol("hard"); |
---|
1776 | l_extreme=make_find_symbol("extreme"); |
---|
1777 | |
---|
1778 | l_logo=make_find_symbol("logo"); |
---|
1779 | l_morph=make_find_symbol("morph"); |
---|
1780 | |
---|
1781 | l_pushx=make_find_symbol("pushx"); |
---|
1782 | l_pushy=make_find_symbol("pushy"); |
---|
1783 | |
---|
1784 | l_dist=make_find_symbol("dist"); |
---|
1785 | l_state_art=make_find_symbol("state_art"); |
---|
1786 | l_abilities=make_find_symbol("abilities"); |
---|
1787 | l_default_abilities=make_find_symbol("default_abilities"); |
---|
1788 | l_state_sfx=make_find_symbol("state_sfx"); |
---|
1789 | l_filename=make_find_symbol("filename"); |
---|
1790 | l_sfx_directory=make_find_symbol("sfx_directory"); |
---|
1791 | l_default_font=make_find_symbol("default_font"); |
---|
1792 | l_console_font=make_find_symbol("console_font"); |
---|
1793 | l_default_ai_function=make_find_symbol("default_ai"); |
---|
1794 | l_tile_files=make_find_symbol("tile_files"); |
---|
1795 | l_empty_cache=make_find_symbol("empty_cache"); |
---|
1796 | l_range=make_find_symbol("range"); |
---|
1797 | l_difficulty=make_find_symbol("difficulty"); |
---|
1798 | l_death_handler=make_find_symbol("death_handler"); |
---|
1799 | l_title_screen=make_find_symbol("title_screen"); |
---|
1800 | l_fields=make_find_symbol("fields"); |
---|
1801 | l_FIRE=make_find_symbol("FIRE"); |
---|
1802 | l_fire_object=make_find_symbol("fire_object"); |
---|
1803 | l_fire_object=make_find_symbol("fire_object"); |
---|
1804 | l_cop_dead_parts=make_find_symbol("cop_dead_parts"); |
---|
1805 | l_restart_player=make_find_symbol("restart_player"); |
---|
1806 | l_help_screens=make_find_symbol("help_screens"); |
---|
1807 | l_save_order=make_find_symbol("save_order"); |
---|
1808 | l_next_song=make_find_symbol("next_song"); |
---|
1809 | l_player_draw=make_find_symbol("player_draw"); |
---|
1810 | l_sneaky_draw=make_find_symbol("sneaky_draw"); |
---|
1811 | l_keep_backup=make_find_symbol("keep_backup"); |
---|
1812 | l_level_loaded=make_find_symbol("level_loaded"); |
---|
1813 | |
---|
1814 | l_draw_fast=make_find_symbol("draw_fast"); |
---|
1815 | l_player_tints=make_find_symbol("player_tints"); |
---|
1816 | l_ant_tints=make_find_symbol("ant_tints"); |
---|
1817 | |
---|
1818 | l_max_hp=make_find_symbol("max_hp"); |
---|
1819 | set_symbol_number(l_max_hp,200); |
---|
1820 | l_max_power=make_find_symbol("max_power"); |
---|
1821 | l_main_menu=make_find_symbol("main_menu"); |
---|
1822 | set_symbol_number(l_max_power,999); |
---|
1823 | |
---|
1824 | set_symbol_number(make_find_symbol("run_state"),RUN_STATE); |
---|
1825 | set_symbol_number(make_find_symbol("pause_state"),PAUSE_STATE); |
---|
1826 | set_symbol_number(make_find_symbol("menu_state"),MENU_STATE); |
---|
1827 | set_symbol_number(make_find_symbol("scene_state"),SCENE_STATE); |
---|
1828 | |
---|
1829 | l_statbar_ammo_x=make_find_symbol("statbar_ammo_x"); |
---|
1830 | l_statbar_ammo_y=make_find_symbol("statbar_ammo_y"); |
---|
1831 | l_statbar_ammo_w=make_find_symbol("statbar_ammo_w"); |
---|
1832 | l_statbar_ammo_h=make_find_symbol("statbar_ammo_h"); |
---|
1833 | l_statbar_ammo_bg_color=make_find_symbol("statbar_ammo_bg_color"); |
---|
1834 | |
---|
1835 | l_statbar_health_x=make_find_symbol("statbar_health_x"); |
---|
1836 | l_statbar_health_y=make_find_symbol("statbar_health_y"); |
---|
1837 | l_statbar_health_w=make_find_symbol("statbar_health_w"); |
---|
1838 | l_statbar_health_h=make_find_symbol("statbar_health_h"); |
---|
1839 | l_statbar_health_bg_color=make_find_symbol("statbar_health_bg_color"); |
---|
1840 | |
---|
1841 | l_statbar_logo_x=make_find_symbol("statbar_logo_x"); |
---|
1842 | l_statbar_logo_y=make_find_symbol("statbar_logo_y"); |
---|
1843 | l_object=make_find_symbol("object"); |
---|
1844 | l_tile=make_find_symbol("tile"); |
---|
1845 | l_cdc_logo=make_find_symbol("logo"); |
---|
1846 | |
---|
1847 | l_switch_to_powerful=make_find_symbol("switch_to_powerful"); |
---|
1848 | l_mouse_can_switch=make_find_symbol("mouse_can_switch"); |
---|
1849 | l_ask_save_slot=make_find_symbol("ask_save_slot"); |
---|
1850 | |
---|
1851 | l_level_load_start=make_find_symbol("level_load_start"); |
---|
1852 | l_level_load_end=make_find_symbol("level_load_end"); |
---|
1853 | l_get_local_input=make_find_symbol("get_local_input"); |
---|
1854 | l_chat_input=make_find_symbol("chat_input"); |
---|
1855 | l_player_text_color=make_find_symbol("player_text_color"); |
---|
1856 | |
---|
1857 | |
---|
1858 | l_change_on_pickup=make_find_symbol("change_on_pickup"); |
---|
1859 | l_MBULLET_ICON5=make_find_symbol("MBULLET_ICON5"); |
---|
1860 | l_MBULLET_ICON20=make_find_symbol("MBULLET_ICON20"); |
---|
1861 | l_GRENADE_ICON2=make_find_symbol("GRENADE_ICON2"); |
---|
1862 | l_GRENADE_ICON10=make_find_symbol("GRENADE_ICON10"); |
---|
1863 | |
---|
1864 | |
---|
1865 | l_ROCKET_ICON2=make_find_symbol("ROCKET_ICON2"); |
---|
1866 | l_ROCKET_ICON5=make_find_symbol("ROCKET_ICON5"); |
---|
1867 | |
---|
1868 | |
---|
1869 | l_FBOMB_ICON1=make_find_symbol("FBOMB_ICON1"); |
---|
1870 | l_FBOMB_ICON5=make_find_symbol("FBOMB_ICON5"); |
---|
1871 | |
---|
1872 | l_PLASMA_ICON20=make_find_symbol("PLASMA_ICON20"); |
---|
1873 | l_PLASMA_ICON50=make_find_symbol("PLASMA_ICON50"); |
---|
1874 | |
---|
1875 | l_LSABER_ICON50=make_find_symbol("LSABER_ICON50"); |
---|
1876 | l_LSABER_ICON100=make_find_symbol("LSABER_ICON100"); |
---|
1877 | |
---|
1878 | l_DFRIS_ICON4=make_find_symbol("DFRIS_ICON4"); |
---|
1879 | l_DFRIS_ICON10=make_find_symbol("DFRIS_ICON10"); |
---|
1880 | |
---|
1881 | l_TELEPORTER_SND=make_find_symbol("TELEPORTER_SND"); |
---|
1882 | l_gun_tints=make_find_symbol("gun_tints"); |
---|
1883 | |
---|
1884 | |
---|
1885 | l_ammo_snd=make_find_symbol("AMMO_SND"); |
---|
1886 | |
---|
1887 | l_up_key = make_find_symbol("up_key"); |
---|
1888 | set_symbol_number(l_up_key,JK_UP); |
---|
1889 | |
---|
1890 | l_down_key = make_find_symbol("down_key"); |
---|
1891 | set_symbol_number(l_down_key,JK_DOWN); |
---|
1892 | |
---|
1893 | l_left_key = make_find_symbol("left_key"); |
---|
1894 | set_symbol_number(l_left_key,JK_LEFT); |
---|
1895 | |
---|
1896 | l_right_key = make_find_symbol("right_key"); |
---|
1897 | set_symbol_number(l_right_key,JK_RIGHT); |
---|
1898 | |
---|
1899 | l_weapon_left_key = make_find_symbol("weapon_left_key"); |
---|
1900 | set_symbol_number(l_weapon_left_key,JK_CTRL_R); |
---|
1901 | |
---|
1902 | l_weapon_right_key = make_find_symbol("weapon_right_key"); |
---|
1903 | set_symbol_number(l_weapon_right_key,JK_INSERT); |
---|
1904 | |
---|
1905 | l_special_key = make_find_symbol("special_key"); |
---|
1906 | set_symbol_number(l_special_key,JK_END); |
---|
1907 | |
---|
1908 | |
---|
1909 | int i; |
---|
1910 | for (i=0;i<MAX_STATE;i++) |
---|
1911 | set_symbol_number(make_find_symbol(state_names[i]),i); |
---|
1912 | for (i=0;i<TOTAL_ABILITIES;i++) |
---|
1913 | set_symbol_number(make_find_symbol(ability_names[i]),i); |
---|
1914 | for (i=0;i<TOTAL_CFLAGS;i++) |
---|
1915 | set_symbol_number(make_find_symbol(cflag_names[i]),i); |
---|
1916 | |
---|
1917 | l_song_list=make_find_symbol("song_list"); |
---|
1918 | l_post_render=make_find_symbol("post_render"); |
---|
1919 | |
---|
1920 | add_c_function("distx",0,0, 1); |
---|
1921 | add_c_function("disty",0,0, 2); |
---|
1922 | add_c_bool_fun("key_pressed",1,1, 3); |
---|
1923 | add_c_bool_fun("local_key_pressed",1,1, 4); |
---|
1924 | |
---|
1925 | add_c_function("bg_state",0,0, 5); |
---|
1926 | add_c_function("aitype",0,0, 6); |
---|
1927 | add_c_function("aistate",0,0, 7); |
---|
1928 | add_c_function("set_aistate",1,1, 8); |
---|
1929 | add_c_function("random",1,1, 9); |
---|
1930 | add_c_function("state_time",0,0, 10); |
---|
1931 | add_c_function("state",0,0, 11); |
---|
1932 | add_c_function("toward",0,0, 12); |
---|
1933 | add_c_function("move",3,3, 13); |
---|
1934 | add_c_function("facing",0,0, 14); |
---|
1935 | add_c_function("otype",0,0, 15); |
---|
1936 | add_c_bool_fun("next_picture",0,0, 16); |
---|
1937 | add_c_bool_fun("set_fade_dir",1,1, 17); |
---|
1938 | add_c_function("mover",3,3, 18); |
---|
1939 | add_c_bool_fun("set_fade_count",1,1, 19); |
---|
1940 | add_c_function("fade_count",0,0, 20); |
---|
1941 | add_c_function("fade_dir",0,0, 21); |
---|
1942 | add_c_bool_fun("touching_bg",0,0, 22); |
---|
1943 | add_c_function("add_power",1,1, 23); |
---|
1944 | add_c_function("add_hp",1,1, 24); |
---|
1945 | |
---|
1946 | add_c_bool_fun("draw",0,0, 27); |
---|
1947 | add_c_bool_fun("edit_mode",0,0, 28); |
---|
1948 | add_c_bool_fun("draw_above",0,0, 29); |
---|
1949 | add_c_function("x",0,0, 30); |
---|
1950 | add_c_function("y",0,0, 31); |
---|
1951 | add_c_bool_fun("set_x",1,1, 32); |
---|
1952 | add_c_bool_fun("set_y",1,1, 33); |
---|
1953 | add_c_bool_fun("push_characters",2,2, 34); |
---|
1954 | |
---|
1955 | |
---|
1956 | |
---|
1957 | add_c_bool_fun("set_state",1,1, 37); |
---|
1958 | add_c_function("bg_x",0,0, 38); |
---|
1959 | add_c_function("bg_y",0,0, 39); |
---|
1960 | add_c_bool_fun("set_aitype",1,1, 40); |
---|
1961 | |
---|
1962 | add_c_function("xvel",0,0, 42); |
---|
1963 | add_c_function("yvel",0,0, 43); |
---|
1964 | add_c_bool_fun("set_xvel",1,1, 44); |
---|
1965 | add_c_bool_fun("set_yvel",1,1, 45); |
---|
1966 | add_c_function("away",0,0, 46); |
---|
1967 | add_c_bool_fun("blocked_left",1,1, 47); |
---|
1968 | add_c_bool_fun("blocked_right",1,1, 48); |
---|
1969 | |
---|
1970 | add_c_function("add_palette",1,-1, 50); // name, w,h,x,y,scale, tiles |
---|
1971 | add_c_bool_fun("screen_shot",1,1, 51); // filename |
---|
1972 | |
---|
1973 | add_c_bool_fun("set_zoom",1,1, 52); |
---|
1974 | add_c_function("show_help",1,1, 55); // type, x,y |
---|
1975 | add_c_function("direction",0,0, 56); |
---|
1976 | add_c_function("set_direction",1,1, 57); |
---|
1977 | |
---|
1978 | add_c_bool_fun("freeze_player",1,1, 58); // freeze time |
---|
1979 | |
---|
1980 | add_c_function("menu",1,-1, 59); |
---|
1981 | add_c_bool_fun("do_command",1,1, 60); // command string |
---|
1982 | add_c_bool_fun("set_game_state",1,1, 61); |
---|
1983 | |
---|
1984 | |
---|
1985 | // scene control functions, game must first be set to scene mode. |
---|
1986 | add_c_bool_fun("scene:set_text_region",4,4, 62); |
---|
1987 | add_c_bool_fun("scene:set_frame_speed",1,1, 63); |
---|
1988 | add_c_bool_fun("scene:set_scroll_speed",1,1, 64); |
---|
1989 | add_c_bool_fun("scene:set_pan_speed",1,1, 65); |
---|
1990 | add_c_bool_fun("scene:scroll_text",1,1, 66); |
---|
1991 | add_c_bool_fun("scene:pan",3,3, 67); |
---|
1992 | add_c_bool_fun("scene:wait",1,1, 68); |
---|
1993 | |
---|
1994 | add_c_bool_fun("level:new",3,3, 74); // width, height, name |
---|
1995 | |
---|
1996 | add_c_bool_fun("do_damage",2,4, 75); // amount, to_object, [pushx pushy] |
---|
1997 | add_c_function("hp",0,0, 76); |
---|
1998 | add_c_bool_fun("set_shift_down",2,2, 77); |
---|
1999 | add_c_bool_fun("set_shift_right",2,2, 78); |
---|
2000 | add_c_bool_fun("set_gravity",1,1, 79); |
---|
2001 | add_c_function("tick",0,0, 80); |
---|
2002 | |
---|
2003 | add_c_bool_fun("set_xacel",1,1, 81); |
---|
2004 | add_c_bool_fun("set_yacel",1,1, 82); |
---|
2005 | add_c_bool_fun("set_local_players",1,1, 84); // set # of players on this machine, unsupported? |
---|
2006 | add_c_function("local_players",0,0, 85); |
---|
2007 | |
---|
2008 | add_c_bool_fun("set_light_detail",1,1, 86); |
---|
2009 | add_c_function("light_detail",0,0, 87); |
---|
2010 | add_c_bool_fun("set_morph_detail",1,1, 88); |
---|
2011 | add_c_function("morph_detail",0,0, 89); |
---|
2012 | add_c_bool_fun("morph_into",3,3, 90); // type aneal frames |
---|
2013 | add_c_bool_fun("link_object",1,1, 91); |
---|
2014 | |
---|
2015 | add_c_bool_fun("draw_line",5,5, 92); |
---|
2016 | add_c_function("dark_color",0,0, 93); |
---|
2017 | add_c_function("medium_color",0,0, 94); |
---|
2018 | add_c_function("bright_color",0,0, 95); |
---|
2019 | |
---|
2020 | add_c_bool_fun("remove_object",1,1, 99); |
---|
2021 | add_c_bool_fun("link_light",1,1, 100); |
---|
2022 | add_c_bool_fun("remove_light",1,1, 101); |
---|
2023 | add_c_function("total_objects",0,0, 102); |
---|
2024 | add_c_function("total_lights",0,0, 103); |
---|
2025 | |
---|
2026 | add_c_bool_fun("set_light_r1",2,2, 104); |
---|
2027 | add_c_bool_fun("set_light_r2",2,2, 105); |
---|
2028 | add_c_bool_fun("set_light_x",2,2, 106); |
---|
2029 | add_c_bool_fun("set_light_y",2,2, 107); |
---|
2030 | add_c_bool_fun("set_light_xshift",2,2, 108); |
---|
2031 | add_c_bool_fun("set_light_yshift",2,2, 109); |
---|
2032 | |
---|
2033 | add_c_function("light_r1",1,1, 110); |
---|
2034 | add_c_function("light_r2",1,1, 111); |
---|
2035 | add_c_function("light_x",1,1, 112); |
---|
2036 | add_c_function("light_y",1,1, 113); |
---|
2037 | add_c_function("light_xshift",1,1, 114); |
---|
2038 | add_c_function("light_yshift",1,1, 115); |
---|
2039 | |
---|
2040 | add_c_function("xacel",0,0, 116); |
---|
2041 | add_c_function("yacel",0,0, 117); |
---|
2042 | add_c_bool_fun("delete_light",1,1, 118); |
---|
2043 | |
---|
2044 | add_c_bool_fun("set_fx",1,1, 119); |
---|
2045 | add_c_bool_fun("set_fy",1,1, 120); |
---|
2046 | add_c_bool_fun("set_fxvel",1,1, 121); |
---|
2047 | add_c_bool_fun("set_fyvel",1,1, 122); |
---|
2048 | add_c_bool_fun("set_fxacel",1,1, 123); |
---|
2049 | add_c_bool_fun("set_fyacel",1,1, 124); |
---|
2050 | add_c_function("picture_width",0,0, 125); |
---|
2051 | add_c_function("picture_height",0,0, 126); |
---|
2052 | add_c_bool_fun("trap",0,0, 127); |
---|
2053 | add_c_bool_fun("platform_push",2,2, 128); |
---|
2054 | |
---|
2055 | add_c_function("def_sound",1,2, 133); // symbol, filename [ or just filenmae] |
---|
2056 | add_c_bool_fun("play_sound",1,4, 134); |
---|
2057 | |
---|
2058 | add_c_function("weapon_to_type",1,1, 142); // returns total for type weapon |
---|
2059 | add_c_bool_fun("hurt_radius",6,6, 143); // x y radius max_damage exclude_object max_push |
---|
2060 | |
---|
2061 | add_c_bool_fun("add_ammo",2,2, 144); // weapon_type, amount |
---|
2062 | add_c_function("ammo_total",1,1, 145); // returns total for type weapon |
---|
2063 | add_c_function("current_weapon",0,0, 146); // weapon_type, amount |
---|
2064 | add_c_function("current_weapon_type",0,0, 147); // returns total for type weapon |
---|
2065 | |
---|
2066 | add_c_bool_fun("blocked_up",1,1, 148); |
---|
2067 | add_c_bool_fun("blocked_down",1,1, 149); |
---|
2068 | add_c_bool_fun("give_weapon",1,1, 150); // type |
---|
2069 | add_c_function("get_ability",1,1, 151); |
---|
2070 | add_c_bool_fun("reset_player",0,0, 152); |
---|
2071 | add_c_function("site_angle",1,1, 153); |
---|
2072 | add_c_bool_fun("set_course",2,2, 154); // angle, magnitude |
---|
2073 | add_c_bool_fun("set_frame_angle",3,3, 155); // ang1,ang2, ang |
---|
2074 | add_c_bool_fun("jump_state",1,1, 156); // don't reset current_frame |
---|
2075 | |
---|
2076 | add_c_bool_fun("morphing",0,0, 168); |
---|
2077 | add_c_bool_fun("damage_fun",6,6, 169); |
---|
2078 | add_c_bool_fun("gravity",0,0, 170); |
---|
2079 | add_c_bool_fun("make_view_solid",1,1, 171); |
---|
2080 | add_c_function("find_rgb",3,3, 172); |
---|
2081 | |
---|
2082 | add_c_function("player_x_suggest",0,0, 173); // return player "joystick" x |
---|
2083 | add_c_function("player_y_suggest",0,0, 174); |
---|
2084 | add_c_function("player_b1_suggest",0,0, 175); |
---|
2085 | add_c_function("player_b2_suggest",0,0, 176); |
---|
2086 | add_c_function("player_b3_suggest",0,0, 177); |
---|
2087 | |
---|
2088 | add_c_bool_fun("set_bg_scroll",4,4, 178); // xmul xdiv ymul ydiv |
---|
2089 | add_c_bool_fun("set_ambient_light",2,2, 179); // player, 0..63 (out of bounds ignored) |
---|
2090 | add_c_function("ambient_light",1,1, 180); // player |
---|
2091 | add_c_bool_fun("has_object",1,1, 181); // true if linked with object x |
---|
2092 | add_c_bool_fun("set_otype",1,1, 182); // otype |
---|
2093 | |
---|
2094 | add_c_function("current_frame",0,0, 184); |
---|
2095 | add_c_function("fx",0,0, 185); |
---|
2096 | add_c_function("fy",0,0, 186); |
---|
2097 | add_c_function("fxvel",0,0, 187); |
---|
2098 | add_c_function("fyvel",0,0, 188); |
---|
2099 | add_c_function("fxacel",0,0, 189); |
---|
2100 | add_c_function("fyacel",0,0, 190); |
---|
2101 | add_c_bool_fun("set_stat_bar",2,2, 191); // filename, object |
---|
2102 | add_c_bool_fun("set_fg_tile",3,3, 192); // x,y, tile # |
---|
2103 | add_c_function("fg_tile",2,2, 193); // x,y |
---|
2104 | add_c_bool_fun("set_bg_tile",3,3, 194); // x,y, tile # |
---|
2105 | add_c_function("bg_tile",2,2, 195); // x,y |
---|
2106 | add_c_bool_fun("load_tiles",1,-1, 196); // filename1, filename2... |
---|
2107 | add_c_bool_fun("load_palette",1,1, 197); // filename |
---|
2108 | add_c_bool_fun("load_color_filter",1,1, 198); // filename |
---|
2109 | add_c_bool_fun("create_players",1,1, 199); // player type, returns true if game is networked |
---|
2110 | add_c_bool_fun("try_move",2,3, 200); // xv yv (check_top=t) -> returns T if not blocked |
---|
2111 | add_c_function("sequence_length",1,1, 201); // sequence number |
---|
2112 | add_c_bool_fun("can_see",5,5, 202); // x1,y1, x2,y2, chars_block |
---|
2113 | add_c_function("load_big_font",2,2, 203); // filename, name |
---|
2114 | add_c_function("load_small_font",2,2, 204); // filename, name |
---|
2115 | add_c_function("load_console_font",2,2, 205); // filename, name |
---|
2116 | add_c_function("set_current_frame",1,1, 206); |
---|
2117 | |
---|
2118 | add_c_bool_fun("draw_transparent",2,2, 208); // count, max |
---|
2119 | add_c_bool_fun("draw_tint",1,1, 209); // tint id number |
---|
2120 | add_c_bool_fun("draw_predator",0,0, 210); // tint_number |
---|
2121 | |
---|
2122 | add_c_function("shift_down",1,1, 211); // player |
---|
2123 | add_c_function("shift_right",1,1, 212); // player |
---|
2124 | add_c_bool_fun("set_no_scroll_range",5,5, 213); // player, x1,y1,x2,y2 |
---|
2125 | |
---|
2126 | add_c_function("def_image",2,2, 215); // filename,name |
---|
2127 | add_c_bool_fun("put_image",3,3, 216); // x,y,id |
---|
2128 | add_c_function("view_x1",0,0, 217); |
---|
2129 | add_c_function("view_y1",0,0, 218); |
---|
2130 | add_c_function("view_x2",0,0, 219); |
---|
2131 | add_c_function("view_y2",0,0, 220); |
---|
2132 | add_c_function("view_push_down",1,1, 221); |
---|
2133 | add_c_bool_fun("local_player",0,0, 222); |
---|
2134 | add_c_bool_fun("save_game",1,1, 223); // filename |
---|
2135 | add_c_bool_fun("set_hp",1,1, 224); |
---|
2136 | add_c_bool_fun("request_level_load",1,1, 225); // filename |
---|
2137 | add_c_bool_fun("set_first_level",1,1, 226); // filename |
---|
2138 | add_c_function("def_tint",1,1, 227); // filename |
---|
2139 | add_c_function("tint_palette",3,3, 228); // radd,gadd,badd |
---|
2140 | add_c_function("player_number",0,0, 229); |
---|
2141 | add_c_bool_fun("set_current_weapon",1,1, 230); // type |
---|
2142 | add_c_bool_fun("has_weapon",1,1, 231); // type |
---|
2143 | add_c_bool_fun("ambient_ramp",1,1, 232); |
---|
2144 | add_c_function("total_players",0,0, 233); |
---|
2145 | add_c_bool_fun("scatter_line",6,6, 234); // x1,y1,x2,y2, color, scatter value |
---|
2146 | add_c_function("game_tick",0,0, 235); |
---|
2147 | add_c_bool_fun("isa_player",0,0, 236); |
---|
2148 | add_c_bool_fun("shift_rand_table",1,1, 237); // amount |
---|
2149 | add_c_function("total_frames",0,0, 238); |
---|
2150 | add_c_function("raise",0,0, 239); // call only from reload constructor! |
---|
2151 | add_c_function("lower",0,0, 240); // call only from reload constructor! |
---|
2152 | |
---|
2153 | add_c_function("player_pointer_x",0,0, 241); |
---|
2154 | add_c_function("player_pointer_y",0,0, 242); |
---|
2155 | add_c_bool_fun("frame_panic",0,0, 243); |
---|
2156 | add_c_bool_fun("ascatter_line",7,7, 244); // x1,y1,x2,y2, color1, color2, scatter value |
---|
2157 | add_c_function("rand_on",0,0, 245); |
---|
2158 | add_c_function("set_rand_on",1,1, 246); |
---|
2159 | add_c_function("bar",5,5, 247); |
---|
2160 | add_c_function("argc",0,0, 248); |
---|
2161 | add_c_bool_fun("play_song",1,1, 249); // filename |
---|
2162 | add_c_bool_fun("stop_song",0,0, 250); |
---|
2163 | add_c_bool_fun("targetable",0,0, 251); |
---|
2164 | add_c_bool_fun("set_targetable",1,1, 252); // T or nil |
---|
2165 | add_c_bool_fun("show_stats",0,0, 253); |
---|
2166 | |
---|
2167 | add_c_function("kills",0,0, 254); |
---|
2168 | add_c_function("tkills",0,0, 255); |
---|
2169 | add_c_function("secrets",0,0, 256); |
---|
2170 | add_c_function("tsecrets",0,0, 257); |
---|
2171 | |
---|
2172 | add_c_bool_fun("set_kills",1,1, 258); |
---|
2173 | add_c_bool_fun("set_tkills",1,1, 259); |
---|
2174 | add_c_bool_fun("set_secrets",1,1, 260); |
---|
2175 | add_c_bool_fun("set_tsecrets",1,1, 261); |
---|
2176 | add_c_bool_fun("request_end_game",0,0, 262); |
---|
2177 | add_c_function("get_save_slot",0,0, 263); |
---|
2178 | add_c_bool_fun("mem_report",0,0, 264); |
---|
2179 | add_c_function("major_version",0,0, 265); |
---|
2180 | add_c_function("minor_version",0,0, 266); |
---|
2181 | add_c_bool_fun("draw_double_tint",2,2, 267); // tint1 id number, tint 2 id number |
---|
2182 | add_c_function("image_width",1,1, 268); // image number |
---|
2183 | add_c_function("image_height",1,1, 269); // image number |
---|
2184 | add_c_function("foreground_width",0,0, 270); |
---|
2185 | add_c_function("foreground_height",0,0, 271); |
---|
2186 | add_c_function("background_width",0,0, 272); |
---|
2187 | add_c_function("background_height",0,0, 273); |
---|
2188 | add_c_function("get_key_code",1,1, 274); // name of key, returns code that can be used with keypressed |
---|
2189 | add_c_bool_fun("set_cursor_shape",3,3, 275); // image id, x hot, y hot |
---|
2190 | add_c_bool_fun("start_server",0,0, 276); |
---|
2191 | add_c_bool_fun("put_string",4,5, 277); // font,x,y,string, [color] |
---|
2192 | add_c_function("font_width",1,1, 278); // font |
---|
2193 | add_c_function("font_height",1,1, 279); // font |
---|
2194 | add_c_bool_fun("chat_print",1,1, 280); // chat string |
---|
2195 | add_c_bool_fun("set_player_name",1,1, 281); // name |
---|
2196 | add_c_bool_fun("draw_bar",5,5, 282); // x1,y1,x2,y2,color |
---|
2197 | add_c_bool_fun("draw_rect",5,5, 283); // x1,y1,x2,y2,color |
---|
2198 | add_c_bool_fun("get_option",1,1, 284); |
---|
2199 | add_c_bool_fun("dir_exsist",1,1, 285); |
---|
2200 | add_c_bool_fun("chdir",1,1, 286); |
---|
2201 | add_c_bool_fun("nice_copy",3,3, 287); // source file, dest file |
---|
2202 | add_c_bool_fun("set_delay_on",1,1, 288); // T or nil |
---|
2203 | add_c_bool_fun("set_login",1,1, 289); // name |
---|
2204 | add_c_bool_fun("enable_chatting",0,0, 290); |
---|
2205 | add_c_bool_fun("demo_break_enable",0,0, 291); |
---|
2206 | add_c_bool_fun("am_a_client",0,0, 292); |
---|
2207 | add_c_bool_fun("time_for_next_level",0,0, 293); |
---|
2208 | add_c_bool_fun("reset_kills",0,0, 294); |
---|
2209 | add_c_bool_fun("set_game_name",1,1, 295); // name |
---|
2210 | add_c_bool_fun("set_net_min_players",1,1, 296); |
---|
2211 | add_c_bool_fun("expire_cache_item",1,1, 297); |
---|
2212 | |
---|
2213 | add_lisp_function("go_state",1,1, 0); |
---|
2214 | add_lisp_function("with_object",2,-1, 1); |
---|
2215 | add_lisp_function("bmove",0,1, 2); // returns true=unblocked, nil=block, or object |
---|
2216 | add_lisp_function("me",0,0, 3); |
---|
2217 | add_lisp_function("bg",0,0, 4); |
---|
2218 | add_lisp_function("find_closest",1,1, 5); |
---|
2219 | add_lisp_function("find_xclosest",1,1, 6); |
---|
2220 | add_lisp_function("find_xrange",2,2, 7); |
---|
2221 | add_lisp_function("add_object",3,4, 8); // type, x,y (type) |
---|
2222 | add_lisp_function("first_focus",0,0, 9); |
---|
2223 | add_lisp_function("next_focus",1,1, 10); |
---|
2224 | add_lisp_function("get_object",1,1, 11); |
---|
2225 | add_lisp_function("get_light",1,1, 12); |
---|
2226 | add_lisp_function("with_objects",1,1, 13); |
---|
2227 | add_lisp_function("add_light",7,7, 14); // type, x, y, r1, r2, xshift, yshift |
---|
2228 | add_lisp_function("find_enemy",1,1, 15); // exclude |
---|
2229 | add_lisp_function("user_fun",0,-1, 16); // calls anobject's user function |
---|
2230 | add_lisp_function("time",2,2, 17); // returns a fixed point (times and operation) |
---|
2231 | add_lisp_function("name",0,0, 18); // returns current object's name (for debugin) |
---|
2232 | add_lisp_function("float_tick",0,0, 19); |
---|
2233 | add_lisp_function("find_object_in_area",5,5, 20); // x1, y1, x2, y2 type_list |
---|
2234 | add_lisp_function("find_object_in_angle",3,3, 21); // start_angle end_angle type_list |
---|
2235 | add_lisp_function("add_object_after",3,4, 22); // type, x,y (type) |
---|
2236 | add_lisp_function("def_char",2,-1, 23); // needs at least 2 parms |
---|
2237 | add_lisp_function("see_dist",4,4, 24); // returns longest unblocked path from x1,y1,x2,y2 |
---|
2238 | add_lisp_function("platform",0,0, 25); |
---|
2239 | add_lisp_function("level_name",0,0, 26); |
---|
2240 | add_lisp_function("ant_ai",0,0, 27); |
---|
2241 | add_lisp_function("sensor_ai",0,0, 28); |
---|
2242 | add_lisp_function("dev_draw",0,0, 29); |
---|
2243 | add_lisp_function("top_ai",0,0, 30); |
---|
2244 | add_lisp_function("laser_ufun",2,2, 31); |
---|
2245 | add_lisp_function("top_ufun",2,2, 32); |
---|
2246 | |
---|
2247 | add_lisp_function("player_rocket_ufun",2,2, 34); |
---|
2248 | |
---|
2249 | if (registered) |
---|
2250 | { |
---|
2251 | add_lisp_function("plaser_ufun",2,2, 33); |
---|
2252 | add_lisp_function("lsaber_ufun",2,2, 35); |
---|
2253 | } |
---|
2254 | |
---|
2255 | |
---|
2256 | add_lisp_function("cop_mover",3,3, 36); |
---|
2257 | add_lisp_function("latter_ai",0,0, 37); |
---|
2258 | add_lisp_function("with_obj0",-1,-1, 38); |
---|
2259 | add_lisp_function("activated",0,0, 39); |
---|
2260 | add_lisp_function("top_draw",0,0, 40); |
---|
2261 | add_lisp_function("bottom_draw",0,0, 41); |
---|
2262 | add_lisp_function("mover_ai",0,0, 42); |
---|
2263 | add_lisp_function("sgun_ai",0,0, 43); |
---|
2264 | add_lisp_function("last_savegame_name",0,0, 44); |
---|
2265 | add_lisp_function("next_savegame_name",0,0, 45); |
---|
2266 | add_lisp_function("argv",1,1, 46); |
---|
2267 | add_lisp_function("joy_stat",0,0, 47); // xm ym b1 b2 b3 |
---|
2268 | add_lisp_function("mouse_stat",0,0, 48); // mx my b1 b2 b3 |
---|
2269 | add_lisp_function("mouse_to_game",2,2, 49); // pass in x,y -> x,y |
---|
2270 | add_lisp_function("game_to_mouse",2,2, 50); // pass in x,y -> x,y |
---|
2271 | add_lisp_function("get_main_font",0,0, 51); |
---|
2272 | add_lisp_function("player_name",0,0, 52); |
---|
2273 | add_lisp_function("nice_input",3,3, 53); // title, prompt, default -> returns input |
---|
2274 | add_lisp_function("get_cwd",0,0, 54); |
---|
2275 | add_lisp_function("system",1,1, 55); |
---|
2276 | add_lisp_function("convert_slashes",2,2, 56); |
---|
2277 | add_lisp_function("show_yes_no",4,4, 57); |
---|
2278 | add_lisp_function("get_directory",1,1, 58); // path |
---|
2279 | add_lisp_function("nice_menu",3,3, 59); // title, menu_title, list -> return selection number |
---|
2280 | add_lisp_function("respawn_ai",0,0, 60); |
---|
2281 | |
---|
2282 | add_lisp_function("score_draw",0,0, 61); |
---|
2283 | add_lisp_function("show_kills",0,0, 62); |
---|
2284 | add_lisp_function("mkptr",1,1, 63); |
---|
2285 | add_lisp_function("seq",3,3, 64); |
---|
2286 | add_lisp_function("weapon_icon_ai",0,0, 65); |
---|
2287 | add_lisp_function("on_draw",0,0, 66); |
---|
2288 | add_lisp_function("tp2_ai",0,0, 67); |
---|
2289 | add_lisp_function("push_char",2,2, 68); |
---|
2290 | add_lisp_function("gun_draw",0,0, 69); |
---|
2291 | add_lisp_function("ant_draw",0,0, 70); |
---|
2292 | add_lisp_function("middle_draw",0,0, 71); |
---|
2293 | add_lisp_function("exp_draw",0,0, 72); |
---|
2294 | add_lisp_function("exp_ai",0,0, 73); |
---|
2295 | } |
---|
2296 | |
---|
2297 | |
---|
2298 | // Note : args for l_caller have not been evaluated yet! |
---|
2299 | void *l_caller(long number, void *args) |
---|
2300 | { |
---|
2301 | p_ref r1(args); |
---|
2302 | switch (number) |
---|
2303 | { |
---|
2304 | case 0 : |
---|
2305 | { |
---|
2306 | current_object->set_aistate(lnumber_value(eval(CAR(args)))); |
---|
2307 | current_object->set_aistate_time(0); |
---|
2308 | void *ai=figures[current_object->otype]->get_fun(OFUN_AI); |
---|
2309 | if (!ai) |
---|
2310 | { |
---|
2311 | lbreak("hrump... call to go_state, and no ai function defined?\n" |
---|
2312 | "Are you calling from move function (not mover)?\n"); |
---|
2313 | exit(0); |
---|
2314 | } |
---|
2315 | return eval_function((lisp_symbol *)ai,NULL); |
---|
2316 | } break; |
---|
2317 | case 1 : |
---|
2318 | { |
---|
2319 | game_object *old_cur=current_object; |
---|
2320 | current_object=(game_object *)lpointer_value(eval(CAR(args))); |
---|
2321 | void *ret=eval_block(CDR(args)); |
---|
2322 | current_object=old_cur; |
---|
2323 | return ret; |
---|
2324 | } break; |
---|
2325 | |
---|
2326 | |
---|
2327 | case 2 : |
---|
2328 | { |
---|
2329 | int whit; |
---|
2330 | game_object *o; |
---|
2331 | if (args) |
---|
2332 | o=(game_object *)lpointer_value(eval(CAR(args))); |
---|
2333 | else o=current_object; |
---|
2334 | game_object *hit=current_object->bmove(whit,o); |
---|
2335 | if (hit) |
---|
2336 | return new_lisp_pointer(hit); |
---|
2337 | else if (whit) return NULL; |
---|
2338 | else return true_symbol; |
---|
2339 | } break; |
---|
2340 | |
---|
2341 | case 3 : return new_lisp_pointer(current_object); break; |
---|
2342 | case 4 : |
---|
2343 | { if (player_list->next) |
---|
2344 | return new_lisp_pointer(current_level->attacker(current_object)); |
---|
2345 | else return new_lisp_pointer(player_list->focus); } break; |
---|
2346 | case 5 : return new_lisp_pointer(current_level->find_closest(current_object->x, |
---|
2347 | current_object->y, |
---|
2348 | lnumber_value(eval(CAR(args))), |
---|
2349 | current_object)); break; |
---|
2350 | case 6 : return new_lisp_pointer(current_level->find_xclosest(current_object->x, |
---|
2351 | current_object->y, |
---|
2352 | lnumber_value(eval(CAR(args))), |
---|
2353 | current_object |
---|
2354 | )); break; |
---|
2355 | case 7 : |
---|
2356 | { |
---|
2357 | long n1=lnumber_value(eval(CAR(args))); |
---|
2358 | long n2=lnumber_value(eval(CAR(CDR(args)))); |
---|
2359 | return new_lisp_pointer(current_level->find_xrange(current_object->x, |
---|
2360 | current_object->y, |
---|
2361 | n1, |
---|
2362 | n2 |
---|
2363 | )); |
---|
2364 | } break; |
---|
2365 | case 8 : |
---|
2366 | { |
---|
2367 | int type=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2368 | long x=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2369 | long y=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2370 | game_object *o; |
---|
2371 | if (args) |
---|
2372 | o=create(type,x,y,0,lnumber_value(eval(CAR(args)))); |
---|
2373 | else |
---|
2374 | o=create(type,x,y); |
---|
2375 | if (current_level) |
---|
2376 | current_level->add_object(o); |
---|
2377 | return new_lisp_pointer(o); |
---|
2378 | } break; |
---|
2379 | case 22 : |
---|
2380 | { |
---|
2381 | int type=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2382 | long x=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2383 | long y=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2384 | game_object *o; |
---|
2385 | if (args) |
---|
2386 | o=create(type,x,y,0,lnumber_value(eval(CAR(args)))); |
---|
2387 | else |
---|
2388 | o=create(type,x,y); |
---|
2389 | if (current_level) |
---|
2390 | current_level->add_object_after(o,current_object); |
---|
2391 | return new_lisp_pointer(o); |
---|
2392 | } break; |
---|
2393 | |
---|
2394 | case 9 : return new_lisp_pointer(the_game->first_view->focus); break; |
---|
2395 | case 10 : |
---|
2396 | { |
---|
2397 | view *v=((game_object *)lpointer_value(eval(CAR(args))))->controller()->next; |
---|
2398 | if (v) |
---|
2399 | return new_lisp_pointer(v->focus); |
---|
2400 | else return NULL; |
---|
2401 | } break; |
---|
2402 | case 11 : |
---|
2403 | { |
---|
2404 | return new_lisp_pointer |
---|
2405 | ((void *)current_object->get_object(lnumber_value(eval(CAR(args))))); |
---|
2406 | } break; |
---|
2407 | case 12 : |
---|
2408 | { |
---|
2409 | return new_lisp_pointer |
---|
2410 | ((void *)current_object->get_light(lnumber_value(eval(CAR(args))))); |
---|
2411 | } break; |
---|
2412 | case 13 : |
---|
2413 | { |
---|
2414 | game_object *old_cur=current_object; |
---|
2415 | void *ret=NULL; |
---|
2416 | for (int i=0;i<old_cur->total_objects();i++) |
---|
2417 | { |
---|
2418 | current_object=old_cur->get_object(i); |
---|
2419 | ret=eval(CAR(args)); |
---|
2420 | } |
---|
2421 | current_object=old_cur; |
---|
2422 | return ret; |
---|
2423 | } break; |
---|
2424 | case 14 : |
---|
2425 | { |
---|
2426 | int t=lnumber_value(eval(CAR(args))); args=lcdr(args); |
---|
2427 | int x=lnumber_value(eval(CAR(args))); args=lcdr(args); |
---|
2428 | int y=lnumber_value(eval(CAR(args))); args=lcdr(args); |
---|
2429 | int r1=lnumber_value(eval(CAR(args))); args=lcdr(args); |
---|
2430 | int r2=lnumber_value(eval(CAR(args))); args=lcdr(args); |
---|
2431 | int xs=lnumber_value(eval(CAR(args))); args=lcdr(args); |
---|
2432 | int ys=lnumber_value(eval(CAR(args))); |
---|
2433 | return new_lisp_pointer(add_light_source(t,x,y,r1,r2,xs,ys)); |
---|
2434 | } break; |
---|
2435 | case 15 : |
---|
2436 | { |
---|
2437 | // return current_lev shit |
---|
2438 | } break; |
---|
2439 | case 16 : |
---|
2440 | { |
---|
2441 | void *f=figures[current_object->otype]->get_fun(OFUN_USER_FUN); |
---|
2442 | if (!f) return NULL; |
---|
2443 | return eval_function((lisp_symbol *)f,args); |
---|
2444 | } break; |
---|
2445 | case 17 : |
---|
2446 | { |
---|
2447 | long trials=lnumber_value(eval(CAR(args))); |
---|
2448 | args=CDR(args); |
---|
2449 | time_marker start; |
---|
2450 | for (int x=0;x<trials;x++) |
---|
2451 | { |
---|
2452 | clear_tmp(); |
---|
2453 | eval(CAR(args)); |
---|
2454 | } |
---|
2455 | time_marker end; |
---|
2456 | return new_lisp_fixed_point((long)(end.diff_time(&start)*(1<<16))); |
---|
2457 | } break; |
---|
2458 | case 18 : |
---|
2459 | { return new_lisp_string(object_names[current_object->otype]); } break; |
---|
2460 | case 19 : |
---|
2461 | { return current_object->float_tick(); } break; |
---|
2462 | case 20 : |
---|
2463 | { |
---|
2464 | long x1=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2465 | long y1=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2466 | long x2=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2467 | long y2=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2468 | |
---|
2469 | void *list=eval(CAR(args)); |
---|
2470 | game_object *find=current_level->find_object_in_area(current_object->x, |
---|
2471 | current_object->y, |
---|
2472 | x1,y1,x2,y2,list,current_object); |
---|
2473 | if (find) return new_lisp_pointer(find); |
---|
2474 | else return NULL; |
---|
2475 | } break; |
---|
2476 | |
---|
2477 | case 21 : |
---|
2478 | { |
---|
2479 | long a1=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2480 | long a2=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2481 | |
---|
2482 | void *list=eval(CAR(args)); |
---|
2483 | p_ref r1(list); |
---|
2484 | game_object *find=current_level->find_object_in_angle(current_object->x, |
---|
2485 | current_object->y, |
---|
2486 | a1,a2,list,current_object); |
---|
2487 | if (find) return new_lisp_pointer(find); |
---|
2488 | else return NULL; |
---|
2489 | } break; |
---|
2490 | case 23 : // def_character |
---|
2491 | { |
---|
2492 | lisp_symbol *sym=(lisp_symbol *)lcar(args); |
---|
2493 | if (item_type(sym)!=L_SYMBOL) |
---|
2494 | { |
---|
2495 | lbreak("expecting first arg to def-character to be a symbol!\n"); |
---|
2496 | exit(0); |
---|
2497 | } |
---|
2498 | int sp=current_space; |
---|
2499 | current_space=PERM_SPACE; |
---|
2500 | set_symbol_number(sym,total_objects); // set the symbol value to the object number |
---|
2501 | current_space=sp; |
---|
2502 | if (!total_objects) |
---|
2503 | { |
---|
2504 | object_names=(char **)jmalloc(sizeof(char *)*(total_objects+1),"object name list"); |
---|
2505 | figures=(character_type **)jmalloc(sizeof(character_type *)*(total_objects+1),"character types"); |
---|
2506 | } |
---|
2507 | else |
---|
2508 | { |
---|
2509 | object_names=(char **)jrealloc(object_names,sizeof(char *)*(total_objects+1), |
---|
2510 | "object name list"); |
---|
2511 | figures=(character_type **)jrealloc(figures,sizeof(character_type *)*(total_objects+1), |
---|
2512 | "character types"); |
---|
2513 | } |
---|
2514 | |
---|
2515 | object_names[total_objects]=strcpy( |
---|
2516 | (char *)jmalloc(strlen(lstring_value(symbol_name(sym)))+1,"object name"), |
---|
2517 | lstring_value(symbol_name(sym))); |
---|
2518 | figures[total_objects]=new character_type(CDR(args),sym); |
---|
2519 | total_objects++; |
---|
2520 | return new_lisp_number(total_objects-1); |
---|
2521 | } break; |
---|
2522 | case 24 : |
---|
2523 | { |
---|
2524 | long x1=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2525 | long y1=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2526 | long x2=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2527 | long y2=lnumber_value(eval(CAR(args))); |
---|
2528 | current_level->foreground_intersect(x1,y1,x2,y2); |
---|
2529 | void *ret=NULL; |
---|
2530 | push_onto_list(new_lisp_number(y2),ret); |
---|
2531 | push_onto_list(new_lisp_number(x2),ret); |
---|
2532 | return ret; |
---|
2533 | } break; |
---|
2534 | case 25 : |
---|
2535 | { |
---|
2536 | #ifdef __WATCOMC__ |
---|
2537 | return make_find_symbol("WATCOM"); |
---|
2538 | #endif |
---|
2539 | #ifdef __linux__ |
---|
2540 | return make_find_symbol("LINUX"); |
---|
2541 | #endif |
---|
2542 | |
---|
2543 | #ifdef __sgi |
---|
2544 | return make_find_symbol("IRIX"); |
---|
2545 | #endif |
---|
2546 | |
---|
2547 | #ifdef __MAC__ |
---|
2548 | return make_find_symbol("MAC"); |
---|
2549 | #endif |
---|
2550 | |
---|
2551 | } break; |
---|
2552 | case 26 : |
---|
2553 | { |
---|
2554 | return new_lisp_string(current_level->name()); |
---|
2555 | } break; |
---|
2556 | case 27 : return ant_ai(); break; |
---|
2557 | case 28 : return sensor_ai(); break; |
---|
2558 | case 29 : if (dev&EDIT_MODE) current_object->drawer(); break; |
---|
2559 | case 30 : return top_ai(); break; |
---|
2560 | case 31 : return laser_ufun(args); break; |
---|
2561 | case 32 : return top_ufun(args); break; |
---|
2562 | case 33 : return plaser_ufun(args); break; |
---|
2563 | case 34 : return player_rocket_ufun(args); break; |
---|
2564 | case 35 : return lsaber_ufun(args); break; |
---|
2565 | case 36 : |
---|
2566 | { |
---|
2567 | |
---|
2568 | long xm,ym,but; |
---|
2569 | xm=lnumber_value(CAR(args)); args=CDR(args); |
---|
2570 | ym=lnumber_value(CAR(args)); args=CDR(args); |
---|
2571 | but=lnumber_value(CAR(args)); |
---|
2572 | return cop_mover(xm,ym,but); |
---|
2573 | } break; |
---|
2574 | case 37 : return ladder_ai(); break; |
---|
2575 | case 38 : |
---|
2576 | { |
---|
2577 | game_object *old_cur=current_object; |
---|
2578 | current_object=current_object->get_object(0); |
---|
2579 | void *ret=eval_block(args); |
---|
2580 | current_object=old_cur; |
---|
2581 | return ret; |
---|
2582 | } break; |
---|
2583 | case 39 : |
---|
2584 | { |
---|
2585 | if (current_object->total_objects()==0) |
---|
2586 | return true_symbol; |
---|
2587 | else if (current_object->get_object(0)->aistate()) |
---|
2588 | return true_symbol; |
---|
2589 | else return NULL; |
---|
2590 | } break; |
---|
2591 | case 40 : top_draw(); break; |
---|
2592 | case 41 : bottom_draw(); break; |
---|
2593 | case 42 : return mover_ai(); break; |
---|
2594 | case 43 : return sgun_ai(); |
---|
2595 | case 44 : |
---|
2596 | { |
---|
2597 | char nm[50]; |
---|
2598 | last_savegame_name(nm); |
---|
2599 | return new_lisp_string(nm); |
---|
2600 | } break; |
---|
2601 | case 45 : |
---|
2602 | { |
---|
2603 | char nm[50]; |
---|
2604 | sprintf(nm,"save%04d.pcx",load_game(1,symbol_str("LOAD"))); |
---|
2605 | // get_savegame_name(nm); |
---|
2606 | the_game->reset_keymap(); |
---|
2607 | return new_lisp_string(nm); |
---|
2608 | } break; |
---|
2609 | case 46 : |
---|
2610 | { |
---|
2611 | return new_lisp_string(start_argv[lnumber_value(eval(CAR(args)))]); |
---|
2612 | } break; |
---|
2613 | case 47 : |
---|
2614 | { |
---|
2615 | int xv,yv,b1,b2,b3; |
---|
2616 | if (has_joystick) |
---|
2617 | joy_status(b1,b2,b3,xv,yv); |
---|
2618 | else b1=b2=b3=xv=yv=0; |
---|
2619 | |
---|
2620 | void *ret=NULL; |
---|
2621 | p_ref r1(ret); |
---|
2622 | push_onto_list(new_lisp_number(b3),ret); |
---|
2623 | push_onto_list(new_lisp_number(b2),ret); |
---|
2624 | push_onto_list(new_lisp_number(b1),ret); |
---|
2625 | push_onto_list(new_lisp_number(yv),ret); |
---|
2626 | push_onto_list(new_lisp_number(xv),ret); |
---|
2627 | return ret; |
---|
2628 | } break; |
---|
2629 | case 48 : |
---|
2630 | { |
---|
2631 | void *ret=NULL; |
---|
2632 | { |
---|
2633 | p_ref r1(ret); |
---|
2634 | push_onto_list(new_lisp_number((last_demo_mbut&4)==4),ret); |
---|
2635 | push_onto_list(new_lisp_number((last_demo_mbut&2)==2),ret); |
---|
2636 | push_onto_list(new_lisp_number((last_demo_mbut&1)==1),ret); |
---|
2637 | push_onto_list(new_lisp_number(last_demo_my),ret); |
---|
2638 | push_onto_list(new_lisp_number(last_demo_mx),ret); |
---|
2639 | } |
---|
2640 | return ret; |
---|
2641 | } break; |
---|
2642 | case 49 : |
---|
2643 | { |
---|
2644 | long x=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2645 | long y=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2646 | |
---|
2647 | long rx,ry; |
---|
2648 | the_game->mouse_to_game(x,y,rx,ry); |
---|
2649 | void *ret=NULL; |
---|
2650 | { |
---|
2651 | p_ref r1(ret); |
---|
2652 | push_onto_list(new_lisp_number(ry),ret); |
---|
2653 | push_onto_list(new_lisp_number(rx),ret); |
---|
2654 | } |
---|
2655 | return ret; |
---|
2656 | } break; |
---|
2657 | case 50 : |
---|
2658 | { |
---|
2659 | long x=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2660 | long y=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2661 | |
---|
2662 | long rx,ry; |
---|
2663 | the_game->game_to_mouse(x,y,current_view,rx,ry); |
---|
2664 | void *ret=NULL; |
---|
2665 | { |
---|
2666 | p_ref r1(ret); |
---|
2667 | push_onto_list(new_lisp_number(ry),ret); |
---|
2668 | push_onto_list(new_lisp_number(rx),ret); |
---|
2669 | } |
---|
2670 | return ret; |
---|
2671 | } break; |
---|
2672 | case 51 : return new_lisp_pointer(eh->font()); break; |
---|
2673 | case 52 : |
---|
2674 | { |
---|
2675 | view *c=current_object->controller(); |
---|
2676 | if (!c) |
---|
2677 | lbreak("object is not a player, cannot return name"); |
---|
2678 | else |
---|
2679 | return new_lisp_string(c->name); |
---|
2680 | } break; |
---|
2681 | case 53 : |
---|
2682 | { |
---|
2683 | char tit[100],prompt[100],def[100]; |
---|
2684 | strcpy(tit,lstring_value(eval(CAR(args)))); args=CDR(args); |
---|
2685 | strcpy(prompt,lstring_value(eval(CAR(args)))); args=CDR(args); |
---|
2686 | strcpy(def,lstring_value(eval(CAR(args)))); args=CDR(args); |
---|
2687 | return nice_input(tit,prompt,def); |
---|
2688 | } break; |
---|
2689 | case 54 : |
---|
2690 | { |
---|
2691 | char cd[150]; |
---|
2692 | getcwd(cd,100); |
---|
2693 | return new_lisp_string(cd); |
---|
2694 | } break; |
---|
2695 | case 55 : |
---|
2696 | { system(lstring_value(eval(CAR(args)))); } break; |
---|
2697 | case 56 : |
---|
2698 | { |
---|
2699 | void *fn=eval(CAR(args)); args=CDR(args); |
---|
2700 | char tmp[200]; |
---|
2701 | { |
---|
2702 | p_ref r1(fn); |
---|
2703 | char *slash=lstring_value(eval(CAR(args))); |
---|
2704 | char *filename=lstring_value(fn); |
---|
2705 | |
---|
2706 | char *s=filename,*tp; |
---|
2707 | |
---|
2708 | for (tp=tmp;*s;s++,tp++) |
---|
2709 | { |
---|
2710 | if (*s=='/' || *s=='\\') |
---|
2711 | *tp=*slash; |
---|
2712 | else *tp=*s; |
---|
2713 | } |
---|
2714 | *tp=0; |
---|
2715 | } |
---|
2716 | return new_lisp_string(tmp); |
---|
2717 | } break; |
---|
2718 | case 57 : |
---|
2719 | { |
---|
2720 | return show_yes_no(CAR(args),CAR(CDR(args)),CAR(CDR(CDR(args))),CAR(CDR(CDR(CDR(args))))); |
---|
2721 | } break; |
---|
2722 | case 58 : |
---|
2723 | { |
---|
2724 | char **files,**dirs; |
---|
2725 | int tfiles,tdirs,i; |
---|
2726 | |
---|
2727 | get_directory(lstring_value(eval(CAR(args))),files,tfiles,dirs,tdirs); |
---|
2728 | void *fl=NULL,*dl=NULL,*rl=NULL; |
---|
2729 | { |
---|
2730 | p_ref r1(fl),r2(dl); |
---|
2731 | |
---|
2732 | for (i=tfiles-1;i>=0;i--) { push_onto_list(new_lisp_string(files[i]),fl); jfree(files[i]); } |
---|
2733 | jfree(files); |
---|
2734 | |
---|
2735 | for (i=tdirs-1;i>=0;i--) { push_onto_list(new_lisp_string(dirs[i]),dl); jfree(dirs[i]); } |
---|
2736 | jfree(dirs); |
---|
2737 | |
---|
2738 | push_onto_list(dl,rl); |
---|
2739 | push_onto_list(fl,rl); |
---|
2740 | } |
---|
2741 | |
---|
2742 | return rl; |
---|
2743 | } break; |
---|
2744 | case 59 : |
---|
2745 | { |
---|
2746 | return nice_menu(CAR(args),CAR(CDR(args)),CAR(CDR(CDR(args)))); |
---|
2747 | } break; |
---|
2748 | case 60 : return respawn_ai(); break; |
---|
2749 | case 61 : return score_draw(); break; |
---|
2750 | case 62 : return show_kills(); break; |
---|
2751 | case 63 : |
---|
2752 | { |
---|
2753 | long x; |
---|
2754 | sscanf(lstring_value(eval(CAR(args))),"%x",&x); |
---|
2755 | return new_lisp_pointer((void *)x); |
---|
2756 | } break; |
---|
2757 | case 64 : |
---|
2758 | { |
---|
2759 | char name[256],name2[256]; |
---|
2760 | strcpy(name,lstring_value(eval(CAR(args)))); args=CDR(args); |
---|
2761 | long first=lnumber_value(eval(CAR(args))); args=CDR(args); |
---|
2762 | long last=lnumber_value(eval(CAR(args))); |
---|
2763 | long i; |
---|
2764 | void *ret=NULL; |
---|
2765 | p_ref r1(ret); |
---|
2766 | |
---|
2767 | if (last>=first) |
---|
2768 | { |
---|
2769 | for (i=last;i>=first;i--) |
---|
2770 | { |
---|
2771 | sprintf(name2,"%s%04d.pcx",name,i); |
---|
2772 | push_onto_list(new_lisp_string(name2),ret); |
---|
2773 | } |
---|
2774 | } else |
---|
2775 | { |
---|
2776 | for (i=last;i<=first;i++) |
---|
2777 | { |
---|
2778 | sprintf(name2,"%s%04d.pcx",name,i); |
---|
2779 | push_onto_list(new_lisp_string(name2),ret); |
---|
2780 | } |
---|
2781 | } |
---|
2782 | return ret; |
---|
2783 | } break; |
---|
2784 | case 65 : |
---|
2785 | { return weapon_icon_ai(); } break; |
---|
2786 | case 66 : |
---|
2787 | { return on_draw(); } break; |
---|
2788 | case 67 : |
---|
2789 | { return tp2_ai(); } break; |
---|
2790 | case 68 : |
---|
2791 | { return push_char(args); } break; |
---|
2792 | case 69 : |
---|
2793 | { return gun_draw(); } break; |
---|
2794 | case 70 : |
---|
2795 | { return ant_draw(); } break; |
---|
2796 | case 71 : |
---|
2797 | { return middle_draw(); } break; |
---|
2798 | case 72 : |
---|
2799 | { return exp_draw(); } break; |
---|
2800 | case 73 : |
---|
2801 | { return exp_ai(); } break; |
---|
2802 | } |
---|
2803 | return NULL; |
---|
2804 | } |
---|
2805 | |
---|
2806 | //extern bFILE *rcheck,*rcheck_lp; |
---|
2807 | |
---|
2808 | |
---|
2809 | int get_lprop_number(void *symbol, int def) // returns def if symbol undefined or not number type |
---|
2810 | { |
---|
2811 | void *v=symbol_value(symbol); |
---|
2812 | if (v) |
---|
2813 | { |
---|
2814 | switch (item_type(v)) |
---|
2815 | { |
---|
2816 | case L_FIXED_POINT : |
---|
2817 | case L_NUMBER : |
---|
2818 | { return lnumber_value(v); } break; |
---|
2819 | default : return def; |
---|
2820 | } |
---|
2821 | } else return def; |
---|
2822 | } |
---|
2823 | |
---|
2824 | |
---|
2825 | |
---|
2826 | |
---|
2827 | |
---|