Lots of updates! Level 2 support, mostly. (Thanks, Tobias Glaesser)
[supertux.git] / src / gameloop.h
1 /*
2   gameloop.h
3   
4   Super Tux - Game Loop!
5   
6   by Bill Kendrick
7   bill@newbreedsoftware.com
8   http://www.newbreedsoftware.com/supertux/
9   
10   April 11, 2000 - November 7, 2001
11 */
12
13
14 /* Direction (keyboard/joystick) states: */
15
16 #define UP 0
17 #define DOWN 1
18
19
20 /* Directions: */
21
22 #define LEFT 0
23 #define RIGHT 1
24
25
26 /* Sizes: */
27
28 #define SMALL 0
29 #define BIG 1
30
31
32 /* Bounciness of distros: */
33
34 #define NO_BOUNCE 0
35 #define BOUNCE 1
36
37
38 /* One-ups... */
39
40 #define DISTROS_LIFEUP 100
41
42
43 /* Dying types: */
44
45 /* ---- NO 0 */
46 #define SQUISHED 1
47 #define FALLING 2
48
49
50 /* Enemy modes: */
51
52 #define NORMAL 0
53 #define FLAT 1
54 #define KICK 2
55
56
57 /* Hurt modes: */
58
59 #define KILL 0
60 #define SHRINK 1
61
62
63 /* Upgrade types: */
64
65 enum {
66   UPGRADE_MINTS,
67   UPGRADE_COFFEE,
68   UPGRADE_HERRING
69 };
70
71
72 /* Bad guy kinds: */
73
74 enum {
75   BAD_BSOD,
76   BAD_LAPTOP,
77   BAD_MONEY
78 };
79
80
81 /* Speed constraints: */
82
83 #define MAX_WALK_XM 16
84 #define MAX_RUN_XM 24
85 #define MAX_YM 24
86 #define MAX_JUMP_COUNT 3
87
88 #define WALK_SPEED 2
89 #define RUN_SPEED 4
90 #define JUMP_SPEED 8
91 #define BULLET_STARTING_YM 8
92 #define BULLET_XM 16
93
94 #define GRAVITY 2
95 #define YM_FOR_JUMP 40
96 #define KILL_BOUNCE_YM 8
97
98 #define SKID_XM 8
99 #define SKID_TIME 8
100
101
102 #define BOUNCY_BRICK_MAX_OFFSET 8
103 #define BOUNCY_BRICK_SPEED 4
104
105
106 /* Times: */
107
108 #define TUX_SAFE_TIME 16
109
110
111 /* Size constraints: */
112
113 #define OFFSCREEN_DISTANCE 256
114
115 #define LEVEL_WIDTH 375
116
117
118 /* Array sizes: */
119
120 #define NUM_BOUNCY_DISTROS 8
121 #define NUM_BROKEN_BRICKS 32
122 #define NUM_BOUNCY_BRICKS 4
123 #define NUM_BAD_GUYS 128
124 #define NUM_FLOATING_SCORES 6
125 #define NUM_UPGRADES 2
126 #define NUM_BULLETS 3
127
128
129 /* Scores: */
130
131 #define SCORE_BRICK 5
132 #define SCORE_DISTRO 25
133
134
135 /* Types: */
136
137 typedef struct bouncy_distro_type {
138   int alive, x, y, ym;
139 } bouncy_distro_type;
140
141 typedef struct broken_brick_type {
142   int alive, x, y, xm, ym;
143 } broken_brick_type;
144
145 typedef struct bouncy_brick_type {
146   int alive, x, y, offset, offset_m, shape;
147 } bouncy_brick_type;
148
149 typedef struct bad_guy_type {
150   int alive, mode, dying, timer, kind, seen, dir, x, y, xm, ym;
151 } bad_guy_type;
152
153 typedef struct floating_score_type {
154   int alive, timer, x, y, value;
155 } floating_score_type;
156
157 typedef struct upgrade_type {
158   int alive, kind, height, x, y, xm, ym;
159 } upgrade_type;
160
161 typedef struct bullet_type {
162   int alive, x, y, xm, ym;
163 } bullet_type;
164
165
166 /* Function prototypes: */
167
168 int gameloop(void);