source: abuse/trunk/src/compiled.cpp @ 481

Last change on this file since 481 was 481, checked in by Sam Hocevar, 7 years ago

Fuck the history, I'm renaming all .hpp files to .h for my own sanity.

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