1 enum deathtypes {
2   INSIDE, PIT, TOUCH, CRASHU, CRASHR, CRASHD, CRASHL,
3   BOMBED, COLLECT, INFECT
4 };
5 
6 enum colors {
7   RED, PINK, PURPLE, BLUE, AQUA, SKY, GREEN, GRYELLOW,
8   YELLOW, WHITE, BROWN, GRAY, ORANGE, TRANSPARENT, NOCOLOR
9 };
10 
11 enum sounds {
12   SND_KNOCK=0, SND_CLINK=3, SND_STEP=8, SND_JUMP=11,
13   SND_COLLECT=16, SND_BOOM=22, SND_TICK=25,
14   SND_HOP=28, SND_INFECT=31,
15   SND_SWITCHGR=34, SND_SWITCHRD=37, SND_SWITCHGV=40,
16   SND_CHOICEBERET=49, SND_CHOICEOBJECT=52,
17   SND_TURRET=55, SND_PLATFORM=58, SND_STICK=61, SND_ANTIMATTER=62,
18   SND_FAKE=65, SND_POP=69, SND_CRUNCH=72, SND_SQUELCH=75, SND_REGEN=78, SND_REGENINIT=79,
19   SND_MEDW, SND_MEDO, SND_MEDB, SND_MEDR, SND_MEDG, SND_MEDP, SND_CORNER,
20   SOUND_MAX
21 };
22 
23 enum types {
24   NOTYPE, BERET, WOODBLOCK, ICEBLOCK, STONEBLOCK, SMWOODBLOCK, SMICEBLOCK,
25   SMSTONEBLOCK, WHITEDIE, BLACKDIE, BIGBLOCK, GRAVITYBLOCK, ANNOYINGBLOCK,
26   TELEBLOCK, LINKBLOCK, INFECTLING, WEIGHT, BOMB, STICKYBOMB,
27   DOOR, FINISHDOOR, SIGN, READSIGN,
28   MEDALFRAGMENT, MEDALCORNER, WHITEMEDAL,
29   TELESEEKER, ROBOT, SPIKEBALL, HOPPER, CARRIER, VSIGN,
30   SOLIDSWITCH, SOLIDBLOCK, PLATFORM, FLOATBLOCK, GHOSTBLOCK,
31   FAKEBLOCK, AURADROP, STONEY, GRAVITYSWITCH, TURRET, GHOST,
32   REINCARNATOR, ANTIMATTER, FAKEBOMB, BLOCKSTER, MATTERLY,
33   ANTISEEKER, ANTIFECTLING, TOPHAT, SHIELDGEN,
34   TYPEMAX, BOMBHELPER, AURAHELPER, FIREBALL, SPIKEBLOCK,
35   MATTERFRAG, TOPHATSHIELD
36 };
37 
38 typedef struct thing {
39   float x, y, vx, vy, stickx, sticky, startx, starty;
40   int speed, jump, jumpdelay, teledelay;
41   int width, height;
42   int dir;
43   int timer, status;
44   int link, islinked;
45   float anim;
46 
47   int telething, ontele;
48   int dead;
49   int collide[4];
50   int colltarget[4];
51 
52   int type, subtype;
53   int pickup, icy, gravmod, floating, solid, deathtouch, crashspeed;
54   int nomove, nohmove, novmove, infront, inback, animate;
55 } Thing;
56 
57 typedef struct thingnode {
58   Thing* thing;
59   struct thingnode *next;
60   int thingindex;
61 } ThingNode;
62 
63 typedef struct particle {
64   float x, y, vx, vy;
65   int color, time;
66 } Particle;
67 
68 int get_jumpgrace(void);
69 void set_jumpgrace(int);
70 int get_runmargin(void);
71 void set_runmargin(int);
72 
73 void initialize_thingnodes();
74 
75 void handle_key_input(int, int, int, Thing*, int [500][500][3],
76                       Thing [250], int, int, int*, int*, int, int);
77 
78 void draw_thing(Thing*, int [6]);
79 
80 void make_thing(int, int, int, int, int, int, Thing [250]);
81 
82 void make_beret(Thing*, int, int, int, int, int, Thing [250]);
83 
84 void destroy_thing(Thing*, int, Thing [250], int);
85 
86 void update_thing(Thing*, int [500][500][3], Thing [250],
87                   Thing*, int, int, int, int*, int*, int);
88 
89 void update_particles(Particle [2500], int);
90 
91 void thing_collision(Thing*, Thing*, int, int, int, int*, Thing [250], int*, int);
92 
93 void tile_collision(Thing*, Thing [250], int [500][500][3], int, int, int, int);
94 
95 void check_crash(Thing*, Thing*, int, float, int, Thing [250], int*, int*, int, int);
96 
97 float cap_val(float, float);
98 
99 int copy_thing(Thing*, Thing [250], int);
100 
101 int find_empty(Thing [250]);
102 
103 int subtype_count(int);
104 
105 int get_param(int, int, int);
106 
107 void make_expl(int, int, float, float, int, int, int);
108 
109 int* get_bossvars(void);
110 
111 float abs_f(float);
112 
113 int rand_to(int);
114