813a07710e459e1571cf130bee40f898acf550b7
[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 /* Dying types: */
39
40 /* ---- NO 0 */
41 #define SQUISHED 1
42 #define FALLING 2
43
44
45 /* Enemy modes: */
46
47 #define NORMAL 0
48 #define FLAT 1
49 #define KICK 2
50
51
52 /* Hurt modes: */
53
54 #define KILL 0
55 #define SHRINK 1
56
57
58 /* Upgrade types: */
59
60 enum {
61   UPGRADE_MINTS,
62   UPGRADE_COFFEE,
63   UPGRADE_HERRING
64 };
65
66
67 /* Bad guy kinds: */
68
69 enum {
70   BAD_BSOD,
71   BAD_LAPTOP,
72   BAD_MONEY
73 };
74
75
76 /* Speed constraints: */
77
78 #define MAX_WALK_XM 16
79 #define MAX_RUN_XM 24
80 #define MAX_YM 24
81 #define MAX_JUMP_COUNT 3
82
83 #define WALK_SPEED 2
84 #define RUN_SPEED 4
85 #define JUMP_SPEED 8
86 #define BULLET_STARTING_YM 8
87 #define BULLET_XM 16
88
89 #define GRAVITY 2
90 #define YM_FOR_JUMP 40
91 #define KILL_BOUNCE_YM 8
92
93 #define SKID_XM 8
94 #define SKID_TIME 8
95
96
97 #define BOUNCY_BRICK_MAX_OFFSET 8
98 #define BOUNCY_BRICK_SPEED 4
99
100
101 /* Times: */
102
103 #define TUX_SAFE_TIME 16
104
105
106 /* Size constraints: */
107
108 #define OFFSCREEN_DISTANCE 256
109
110 #define LEVEL_WIDTH 375
111
112
113 /* Array sizes: */
114
115 #define NUM_BOUNCY_DISTROS 8
116 #define NUM_BROKEN_BRICKS 32
117 #define NUM_BOUNCY_BRICKS 4
118 #define NUM_BAD_GUYS 128
119 #define NUM_FLOATING_SCORES 6
120 #define NUM_UPGRADES 2
121 #define NUM_BULLETS 3
122
123
124 /* Scores: */
125
126 #define SCORE_BRICK 5
127 #define SCORE_DISTRO 25
128
129
130 /* Types: */
131
132 typedef struct bouncy_distro_type {
133   int alive, x, y, ym;
134 } bouncy_distro_type;
135
136 typedef struct broken_brick_type {
137   int alive, x, y, xm, ym;
138 } broken_brick_type;
139
140 typedef struct bouncy_brick_type {
141   int alive, x, y, offset, offset_m, shape;
142 } bouncy_brick_type;
143
144 typedef struct bad_guy_type {
145   int alive, mode, dying, timer, kind, seen, dir, x, y, xm, ym;
146 } bad_guy_type;
147
148 typedef struct floating_score_type {
149   int alive, timer, x, y, value;
150 } floating_score_type;
151
152 typedef struct upgrade_type {
153   int alive, kind, height, x, y, xm, ym;
154 } upgrade_type;
155
156 typedef struct bullet_type {
157   int alive, x, y, xm, ym;
158 } bullet_type;
159
160
161 /* Function prototypes: */
162
163 int gameloop(void);