source: abuse/tags/pd/abuse/src/compiled.c @ 49

Last change on this file since 49 was 49, checked in by Sam Hocevar, 11 years ago
  • Imported original public domain release, for future reference.
  • Property svn:keywords set to Id
File size: 4.6 KB
Line 
1#include "lisp.hpp"
2#include "macs.hpp"
3#include "jmalloc.hpp"
4#include <string.h>
5
6extern int total_objects;
7
8uchar *bad_guy_array=NULL;    // list flaging each character saying they are a bad bug or not
9                              // mainly used by the rocket to find targets
10
11long S_fall_start,S_falling,S_landing,S_pounce_wait,
12     S_turn_around,S_fire_wait,S_ceil_fire,S_top_walk,
13     S_blown_back_dead,S_jump_up,S_hiding,S_weapon_fire,
14     S_hanging,S_blocking,S_rotate,S_climbing,S_climb_off,
15     S_fly_stopped,S_fast_stopped,S_fast_running,S_fly_running,
16     S_fly_start_run_jump,S_fly_run_jump,S_fly_run_jump_fall,S_fly_end_run_jump,
17     S_fast_start_run_jump,S_fast_run_jump,S_fast_run_jump_fall,S_fast_end_run_jump,
18     S_bright_tint,S_climb_on,
19     S_ASCREAM_SND,S_ALAND_SND,S_ASLASH_SND,S_ROCKET_TOP,S_BFG_TOP,
20     S_GRENADE_TOP,S_FIREBOMB_TOP,S_DFRIS_TOP,S_ANT_ROOF,
21     S_MGUN_TOP,S_CLOUD,S_HIDDEN_ANT,
22     S_health_image,S_fly_image,S_fast_image,
23     S_sneaky_image,S_EXPLODE3,S_EXPLODE5,S_ROCKET,S_SCARE_SND,
24     S_TRACK_GUN,S_SPRAY_GUN,S_LPING_SND,S_FLY_SND,S_SPEED_SND,S_LOW_HEALTH_SND,
25     S_BUTTON_PRESS_SND,
26     S_LINK_SND,S_DELETE_SND;
27
28int compile_error=0;
29
30long c_state(char *name)
31{
32  void *sym=find_symbol(name);
33  if (sym)
34  {
35    if (item_type(((lisp_symbol *)sym)->value)!=L_NUMBER)
36      compile_error=1;
37    else
38      return lnumber_value(((lisp_symbol *)sym)->value);
39  } else compile_error=1;
40  return 0;
41}
42
43extern int last_save_game_number;
44
45void compiled_init()
46{
47  S_fall_start=  c_state("fall_start");
48  S_falling=     c_state("falling");
49  S_landing=     c_state("landing");
50  S_pounce_wait= c_state("pounce_wait");
51  S_turn_around= c_state("turn_around");
52  S_fire_wait=   c_state("fire_wait");
53  S_ceil_fire=   c_state("ceil_fire");
54  S_top_walk=    c_state("top_walk");
55  S_jump_up=     c_state("jump_up");
56  S_rotate=      c_state("rotate");
57  S_hiding=      c_state("hiding");
58  S_weapon_fire= c_state("weapon_fire");
59  S_climbing=    c_state("climbing");
60  S_climb_off=   c_state("climb_off");
61  S_blown_back_dead=c_state("blown_back_dead");
62  S_hanging=     c_state("hanging");
63  S_blocking=     c_state("blocking");
64
65  S_fly_stopped= c_state("fly_stopped");
66  S_fast_stopped=c_state("fast_stopped");
67  S_fast_running=c_state("fast_running");
68  S_fly_running= c_state("fly_running");
69
70  S_fly_start_run_jump=     c_state("fly_start_run_jump");
71  S_fly_run_jump=           c_state("fly_run_jump");
72  S_fly_run_jump_fall=      c_state("fly_run_jump_fall");
73  S_fly_end_run_jump=       c_state("fly_end_run_jump");
74
75  S_fast_start_run_jump=    c_state("fast_start_run_jump");
76  S_fast_run_jump=          c_state("fast_run_jump");
77  S_fast_run_jump_fall=     c_state("fast_run_jump_fall");
78  S_fast_end_run_jump=      c_state("fast_end_run_jump");
79  S_bright_tint=            c_state("bright_tint");
80  S_climb_on=               c_state("climb_on");
81
82  S_ALAND_SND=   c_state("ALAND_SND");
83  S_ASCREAM_SND= c_state("ASCREAM_SND");
84  S_ASLASH_SND=  c_state("ASLASH_SND");
85  S_GRENADE_TOP= c_state("GRENADE_TOP");
86  S_FIREBOMB_TOP=c_state("FIREBOMB_TOP");
87  S_ANT_ROOF=    c_state("ANT_ROOF");
88  S_MGUN_TOP=    c_state("MGUN_TOP");
89  S_DFRIS_TOP=   c_state("DFRIS_TOP");
90  S_ROCKET_TOP=  c_state("ROCKET_TOP");
91  S_BFG_TOP=     c_state("BFG_TOP");
92  S_CLOUD=       c_state("CLOUD");
93  S_HIDDEN_ANT=  c_state("HIDDEN_ANT");
94  S_health_image=c_state("health_image");
95  S_fly_image=   c_state("fly_image");
96  S_sneaky_image=c_state("sneaky_image");
97  S_fast_image  =c_state("fast_image");
98  S_EXPLODE5=    c_state("EXPLODE5");
99  S_EXPLODE3=    c_state("EXPLODE3");
100  S_ROCKET=      c_state("ROCKET");
101  S_TRACK_GUN=   c_state("TRACK_GUN");
102  S_SPRAY_GUN=   c_state("SPRAY_GUN");
103  S_LPING_SND=   c_state("LPING_SND");
104  S_FLY_SND=     c_state("FLY_SND");
105  S_SPEED_SND=   c_state("SPEED_SND");
106  S_LOW_HEALTH_SND=c_state("LOW_HEALTH_SND");
107  S_SCARE_SND=   c_state("SCARE_SND");
108  S_BUTTON_PRESS_SND=c_state("BUTTON_PRESS_SND");
109  S_LINK_SND=    c_state("LINK_OBJECT_SND");
110  S_DELETE_SND=  c_state("DEL_OBJECT_SND");
111
112  void *b=make_find_symbol("bad_guy_list");
113  if (b && DEFINEDP(symbol_value(b)))
114  {
115    b=symbol_value(b);
116    bad_guy_array=(uchar *)jmalloc(total_objects,"bad_guy_array");
117    memset(bad_guy_array,0,total_objects);
118    while (b)
119    {
120      long x=lnumber_value(CAR(b));
121      if (x>=0 && x<total_objects)
122        bad_guy_array[x]=1;
123      else { lbreak("objetc number out of range %d\n",x); }
124      b=lcdr(b);
125    }
126  }
127
128  void *v=symbol_value(make_find_symbol("last_save_game"));
129  if (DEFINEDP(v))
130    last_save_game_number=lnumber_value(v);
131  else last_save_game_number=0;
132}
133
134
135
136
137void compiled_uninit()
138{
139  if (bad_guy_array)
140    jfree(bad_guy_array);
141}
Note: See TracBrowser for help on using the repository browser.