forked from protoman/rockbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
game.h
400 lines (349 loc) · 7.43 KB
/
game.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
#ifndef GAME_H
#define GAME_H
#include <map>
#include <vector>
#include <sstream>
#include <string>
class classPlayer;
class classnpc;
#include "character/classplayer.h"
#include "character/classnpc.h"
#include "sceneslib.h"
#include "stage.h"
#include "objects/object.h"
#include "class_config.h"
#include "scenes/dialogs.h"
#ifdef PSP
#include "ports/psp/psp_ram.h"
#endif
/**
* @brief
*
*/
class game
{
public:
/**
* @brief
*
*/
game();
/**
* @brief
*
*/
~game();
/**
* @brief
*
*/
void initGame();
/**
* @brief
*
* @return bool
*/
bool showIntro();
/**
* @brief
*
*/
void quick_load_game();
void update_stage_scrolling();
void showGame(bool can_characters_move=true);
/**
* @brief
*
* @param st_position
* @return int
*/
Uint8 getMapPointLock(struct st_position);
/**
* @brief
*
* @return st_position
*/
st_position checkScrolling();
/**
* @brief
*
*/
void fps_count();
/**
* @brief
*
* @param direction
* @param is_door
* @param tileX
* @param tileY
*/
void horizontal_screen_move(short direction, bool is_door, short tileX, short tileY);
/**
* @brief
*
*/
void got_weapon();
/**
* @brief
*
*/
void leave_stage();
/**
* @brief
*
*/
void game_over();
/**
* @brief
*
*/
void show_ending(st_position boss_pos);
/**
* @brief
*
* @param centerX
* @param centerY
* @param show_players
*/
void draw_explosion(short int centerX, short int centerY, bool show_players);
/**
* @brief
*
* @param centerX
* @param centerY
*/
void draw_implosion(short int centerX, short int centerY);
// PLAYER methods
/**
* @brief
*
* @param player_n
*/
void show_player(Uint8 player_n);
/**
* @brief
*
* @param pos
* @param player_n
*/
void set_player_position(st_position pos, Uint8 player_n);
/**
* @brief
*
* @param xinc
* @param yinc
* @param player_n
*/
void change_player_position(short xinc, short yinc, short player_n);
/**
* @brief
*
* @param anim_type
* @param player_n
*/
void set_player_anim_type(ANIM_TYPE anim_type, Uint8 player_n);
/**
* @brief
*
* @param player_n
* @return st_position
*/
st_position get_player_position(Uint8 player_n);
/**
* @brief
*
* @param player_n
* @return st_size
*/
st_size get_player_size(Uint8 player_n);
/**
* @brief
*
* @param direction
* @param player_n
*/
void set_player_direction(Uint8 direction, Uint8 player_n);
/**
* @brief
*
* @param player_n
*/
void player_fall(Uint8 player_n);
/**
* @brief
*
* @param show_dialog
*/
void map_present_boss(bool show_dialog);
character* get_player();
/**
* @brief
*
* @return object
*/
object* get_player_platform();
/**
* @brief
*
*/
void check_player_return_teleport(); // if player is inside a teleporter, killing a boss makes him teleport out
/**
* @brief
*
* @return bool
*/
bool must_show_boss_hp() const;
/**
* @brief
*
*/
void fill_boss_hp_bar() const;
void fill_player_weapon(short weapon_n);
/**
* @brief
*
*/
void reset_stage_maps() const;
/**
* @brief
*
*/
void remove_all_projectiles();
void reset_beam_objects();
void remove_players_slide();
/**
* @brief
*
*/
void show_map() const;
/**
* @brief
*
* @param int
*/
void set_current_map(int);
/**
* @brief
*
* @param n
* @return classPlayer
*/
classPlayer* get_player(Uint8 n);
/**
* @brief
*
* @return st_position
*/
st_position get_current_stage_scroll() const;
/**
* @brief
*
*/
void reset_scroll() const;
/**
* @brief
*
* @param type
* @return short
*/
short get_drop_item_id(short type) const;
/**
* @brief
*
*/
void get_drop_item_ids();
/**
* @brief
*
* @param finished_stage
*/
bool show_config(short finished_stage);
void unload_stage();
void show_savegame_error();
void showGotArmorDialog(e_ARMOR_PIECES armor_type);
void object_teleport_boss(st_position dest_pos, Uint8 dest_map, Uint8 teleporter_id);
void remove_current_teleporter_from_list(); // used when player dies
std::string select_game_screen();
private:
void exit_game();
/**
* @brief
*
* @param test_player
* @return bool
*/
bool test_teleport(classPlayer *test_player);
/**
* @brief
*
*/
void start_stage();
void show_ready() const;
/**
* @brief
*
*/
void restart_stage();
//void load_game_objects();
/**
* @brief
*
* @param type
* @param map_n
* @param adjust_x
* @param pObj
*/
void transitionScreen(Uint8 type, Uint8 map_n, short int adjust_x, classPlayer *pObj);
/**
* @brief
*
* @return short
*/
Uint8 get_current_map() const;
/**
* @brief
*
* @param char_obj
* @param pos_x
*/
void walk_character_to_screen_point_x(character* char_obj, short pos_x); // keeps walking (and jumping obstacles) until reaching a given point in screen (not in map, that should have its own function for that)
/**
* @brief
*
* @param set_teleport_n
* @param set_player_pos
*/
void set_player_teleporter(short set_teleport_n, st_position set_player_pos, bool is_object);
bool is_player_on_teleporter() const;
void finish_player_teleporter();
void show_stage(int wait_time, bool move_npcs);
bool subboss_alive_on_left(short tileX);
public:
Uint8 currentStage; /**< TODO */
bool is_showing_boss_intro; /**< TODO */
private:
stage* loaded_stage; /**< TODO */
std::vector<classPlayer> players; /**< TODO */
scenesLib scenes; /**< TODO */
unsigned int fps_timer; /**< TODO */
int fps_counter; /**< TODO */
std::stringstream fps_msg; /**< TODO */
char _fps_buffer[128]; /**< TODO */
struct CURRENT_FILE_FORMAT::st_game_config config; /**< TODO */
st_position selected_stage; /**< TODO */
class_config config_manager; /**< TODO */
dialogs game_dialogs; /**< TODO */
// framerate timers
float _frame_duration; /**< TODO */
std::map<short, bool> _last_stage_used_teleporters; // list of used teleportes (they do not work anymore after added to this list) /**< TODO */
used_teleporter _player_teleporter;
bool _show_boss_hp; // after set to true, will keep showing the boss HP bar on screen right side /**< TODO */
short _drop_item_list[DROP_ITEM_COUNT];
bool invencible_old_value; // used to store flag value in order we don't loose it when setting to true due to temporary "got weapon" invencibility /**< TODO */
bool _dark_mode; // on dark mode we only show animation and projectiles
#ifdef PSP
psp_ram _ram_counter;
//std::cout << "unload_stage::RAM::BF='" << ram_counter.ramAvailable() << "'" << std::endl;
#endif
};
#endif // GAME_H