Rev 5243 | Rev 5298 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5243 | Rev 5291 | ||
---|---|---|---|
Line 106... | Line 106... | ||
106 | void soundbuf_sin(rs_soundbuf_t *snd, float freq); |
106 | void soundbuf_sin(rs_soundbuf_t *snd, float freq); |
107 | void soundbuf_sin_fade(rs_soundbuf_t *snd, float freq); |
107 | void soundbuf_sin_fade(rs_soundbuf_t *snd, float freq); |
108 | void soundbuf_play(rs_soundbuf_t *snd); |
108 | void soundbuf_play(rs_soundbuf_t *snd); |
109 | void soundbuf_stop(rs_soundbuf_t *snd); |
109 | void soundbuf_stop(rs_soundbuf_t *snd); |
Line -... | Line 110... | ||
- | 110 | ||
- | 111 | // Game Objects |
|
- | 112 | ||
- | 113 | #define GAME_OBJS_MAX_COUNT 1024 |
|
- | 114 | ||
- | 115 | #define OBJ_PLAYER 0 |
|
- | 116 | #define OBJ_BULLET 1 |
|
- | 117 | #define OBJ_EXPLOSION 2 |
|
- | 118 | #define OBJ_ROCK 3 |
|
- | 119 | #define OBJ_MINIROCK 4 |
|
- | 120 | #define OBJ_TURRET 5 |
|
- | 121 | #define OBJ_RED_BULLET 6 |
|
- | 122 | ||
- | 123 | typedef struct game_obj_t { |
|
- | 124 | int obj_type; |
|
- | 125 | int flags; |
|
- | 126 | int tag; |
|
- | 127 | int radius; |
|
- | 128 | ||
- | 129 | float x; |
|
- | 130 | float y; |
|
- | 131 | int t; |
|
- | 132 | float f; |
|
- | 133 | ||
- | 134 | // int health; |
|
- | 135 | // int reserved0; |
|
- | 136 | // int reserved1; |
|
- | 137 | // int reserved2; |
|
- | 138 | } game_obj_t; |
|
- | 139 | ||
- | 140 | #define OBJ_FLAG_DESTROYED 0x01 |
|
- | 141 | #define OBJ_FLAG_ENEMY 0x02 |
|
- | 142 | #define OBJ_FLAG_SIN 0x04 |
|
- | 143 | #define OBJ_FLAG_BOSS 0x08 // draw health-bar above |
|
- | 144 | ||
- | 145 | game_obj_t game_obj(int obj_type, int flags, int tag, int radius, float x, float y, int t, float f); |
|
- | 146 | ||
- | 147 | int game_obj_add(game_obj_t obj); |
|
- | 148 | void game_obj_remove(int index); |
|
- | 149 | ||
- | 150 | ||
110 | 151 | ||
Line 111... | Line 152... | ||
111 | // Game Registry |
152 | // Game Registry |
- | 153 | ||
112 | 154 | #define ROCKS_COUNT 8 |
|
- | 155 | #define MINIROCKS_COUNT ROCKS_COUNT // must equal |
|
- | 156 | #define FONTS_COUNT 4 |
|
Line 113... | Line 157... | ||
113 | #define ROCKS_COUNT 3 |
157 | #define EXPLOSIONS_COUNT 8 |
114 | #define FONTS_COUNT 4 |
158 | #define EXPLOSION_RADIUS 16 |
115 | 159 | ||
Line 122... | Line 166... | ||
122 | #define RS_ARROW_DOWN_MASK 0x02 |
166 | #define RS_ARROW_DOWN_MASK 0x02 |
123 | #define RS_ARROW_UP_MASK 0x04 |
167 | #define RS_ARROW_UP_MASK 0x04 |
124 | #define RS_ARROW_RIGHT_MASK 0x08 |
168 | #define RS_ARROW_RIGHT_MASK 0x08 |
125 | #define RS_ATTACK_KEY_MASK 0x10 |
169 | #define RS_ATTACK_KEY_MASK 0x10 |
Line 126... | Line 170... | ||
126 | 170 | ||
Line 127... | Line 171... | ||
127 | #define BULLETS_COUNT 8 |
171 | //#define BULLETS_COUNT 8 |
Line -... | Line 172... | ||
- | 172 | ||
- | 173 | #define GAME_SHOOT_PERIOD 3 |
|
128 | 174 | ||
129 | #define GAME_SHOOT_PERIOD 3 |
175 | #define GAME_FLAG_BOSS_DESTROYED 0x01 |
130 | 176 | ||
Line 131... | Line 177... | ||
131 | typedef struct rs_game_t { |
177 | typedef struct rs_game_t { |
Line 137... | Line 183... | ||
137 | rs_texture_t tex_clouds; |
183 | rs_texture_t tex_clouds; |
138 | rs_texture_t tex_ground; |
184 | rs_texture_t tex_ground; |
Line 139... | Line 185... | ||
139 | 185 | ||
140 | rs_texture_t tex_ship[4]; |
186 | rs_texture_t tex_ship[4]; |
- | 187 | rs_texture_t tex_rocks[ROCKS_COUNT]; |
|
- | 188 | rs_texture_t tex_minirocks[MINIROCKS_COUNT]; |
|
- | 189 | ||
Line 141... | Line 190... | ||
141 | rs_texture_t tex_rocks[ROCKS_COUNT]; |
190 | rs_texture_t tex_explosions[EXPLOSIONS_COUNT]; |
Line 142... | Line 191... | ||
142 | 191 | ||
Line 148... | Line 197... | ||
148 | rs_soundbuf_t sound_test1; |
197 | rs_soundbuf_t sound_test1; |
149 | rs_soundbuf_t sound_test2; |
198 | rs_soundbuf_t sound_test2; |
150 | rs_soundbuf_t sound_test3; |
199 | rs_soundbuf_t sound_test3; |
Line 151... | Line 200... | ||
151 | 200 | ||
- | 201 | int status; |
|
Line 152... | Line 202... | ||
152 | int status; |
202 | int flags; |
Line 153... | Line 203... | ||
153 | 203 | ||
154 | unsigned int keyboard_state; |
204 | unsigned int keyboard_state; |
Line 155... | Line 205... | ||
155 | 205 | ||
Line 156... | Line 206... | ||
156 | int menu_index; |
206 | int menu_index; |
157 | int menu_item_index; |
207 | int menu_item_index; |
158 | 208 | ||
Line -... | Line 209... | ||
- | 209 | int window_scale; |
|
- | 210 | ||
- | 211 | // int tx1; |
|
- | 212 | // int ty1; |
|
159 | int window_scale; |
213 | int tz; |
160 | 214 | ||
161 | int tx; |
215 | int player_x; |
162 | int ty; |
216 | int player_y; |
163 | int tz; |
217 | // int player_z; |
- | 218 | ||
- | 219 | // int bullet_x[BULLETS_COUNT]; |
|
- | 220 | // int bullet_y[BULLETS_COUNT]; |
|
- | 221 | // int bullet_index; |
|
- | 222 | int shoot_delay; |
|
- | 223 | int shoot_keypressed; |
|
- | 224 | int shoot_restore_delay; |
|
- | 225 | ||
- | 226 | int health; |
|
- | 227 | int ammo; |
|
- | 228 | int score; |
|
- | 229 | ||
- | 230 | // int ammo_max; |
|
Line 164... | Line 231... | ||
164 | 231 | ||
Line -... | Line 232... | ||
- | 232 | int stage; |
|
- | 233 | int stage_timer; |
|
- | 234 | ||
165 | int bullet_x[BULLETS_COUNT]; |
235 | game_obj_t *objs; |
166 | int bullet_y[BULLETS_COUNT]; |
236 | int objs_count; |
Line 167... | Line 237... | ||
167 | int bullet_index; |
237 | |
168 | int shoot_delay; |
238 | } rs_game_t; |
169 | int shoot_keypressed; |
239 | |
170 | 240 | #define GAME_HEALTH_MAX 8 |
|
171 | } rs_game_t; |
241 | #define GAME_AMMO_MAX 24 |
172 | 242 | ||
Line 173... | Line -... | ||
173 | extern rs_game_t game; |
- | |
Line 174... | Line 243... | ||
174 | void game_reg_init(); |
243 | extern rs_game_t game; |
Line 175... | Line 244... | ||
175 | 244 | void game_reg_init(); |
|
176 | /* __ |
245 | |
Line 193... | Line 262... | ||
193 | void GameMouseDown(int x, int y); |
262 | void GameMouseDown(int x, int y); |
194 | void GameMouseUp(int x, int y); |
263 | void GameMouseUp(int x, int y); |
Line 195... | Line 264... | ||
195 | 264 | ||
Line -... | Line 265... | ||
- | 265 | void game_change_window_scale(int d); |
|
- | 266 | ||
- | 267 | int is_key_pressed(int mask); |
|
196 | void game_change_window_scale(int d); |
268 | unsigned short rs_rand(); |