first item in menu is highlighted by default now.
[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 #define MAX_LIVES 4
88
89 #define WALK_SPEED 2
90 #define RUN_SPEED 4
91 #define JUMP_SPEED 8
92 #define BULLET_STARTING_YM 8
93 #define BULLET_XM 16
94
95 #define GRAVITY 2
96 #define YM_FOR_JUMP 40
97 #define KILL_BOUNCE_YM 8
98
99 #define SKID_XM 8
100 #define SKID_TIME 8
101
102
103 #define BOUNCY_BRICK_MAX_OFFSET 8
104 #define BOUNCY_BRICK_SPEED 4
105
106
107 /* Times: */
108
109 #define TUX_SAFE_TIME 16
110 #define TUX_INVINCIBLE_TIME 200
111
112 /* Size constraints: */
113
114 #define OFFSCREEN_DISTANCE 256
115
116 #define LEVEL_WIDTH 375
117
118
119 /* Array sizes: */
120
121 #define NUM_BOUNCY_DISTROS 8
122 #define NUM_BROKEN_BRICKS 32
123 #define NUM_BOUNCY_BRICKS 4
124 #define NUM_BAD_GUYS 128
125 #define NUM_FLOATING_SCORES 6
126 #define NUM_UPGRADES 2
127 #define NUM_BULLETS 3
128
129
130 /* Scores: */
131
132 #define SCORE_BRICK 5
133 #define SCORE_DISTRO 25
134
135
136 /* Types: */
137
138 typedef struct bouncy_distro_type {
139   int alive, x, y, ym;
140 } bouncy_distro_type;
141
142 typedef struct broken_brick_type {
143   int alive, x, y, xm, ym;
144 } broken_brick_type;
145
146 typedef struct bouncy_brick_type {
147   int alive, x, y, offset, offset_m, shape;
148 } bouncy_brick_type;
149
150 typedef struct bad_guy_type {
151   int alive, mode, dying, timer, kind, seen, dir, x, y, xm, ym;
152 } bad_guy_type;
153
154 typedef struct floating_score_type {
155   int alive, timer, x, y, value;
156 } floating_score_type;
157
158 typedef struct upgrade_type {
159   int alive, kind, height, x, y, xm, ym;
160 } upgrade_type;
161
162 typedef struct bullet_type {
163   int alive, x, y, xm, ym;
164 } bullet_type;
165
166
167 /* Function prototypes: */
168
169 int gameloop(void);