A rouge-like rpg, heavily inspired on the binding of isaac. Running on a FRDM-K64F Mbed board. C++.
Dependencies: mbed MotionSensor
main.h@61:901871a7c6ff, 2019-05-09 (annotated)
- Committer:
- el17sm
- Date:
- Thu May 09 14:56:46 2019 +0000
- Revision:
- 61:901871a7c6ff
- Parent:
- 57:1c12361b6e3d
Final Submission. I have read and agreed with Statement of Academic Integrity.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17sm | 46:f09711580d4a | 1 | #ifndef MAIN_H |
el17sm | 46:f09711580d4a | 2 | #define MAIN_H |
el17sm | 46:f09711580d4a | 3 | |
el17sm | 46:f09711580d4a | 4 | // Pre-Processor |
el17sm | 46:f09711580d4a | 5 | #include "mbed.h" |
el17sm | 46:f09711580d4a | 6 | #include "Gamepad.h" |
el17sm | 46:f09711580d4a | 7 | #include "N5110.h" |
el17sm | 46:f09711580d4a | 8 | #include "math.h" |
el17sm | 46:f09711580d4a | 9 | #include "sprites.h" |
el17sm | 46:f09711580d4a | 10 | #include "Entity.h" |
el17sm | 46:f09711580d4a | 11 | #include "Player.h" |
el17sm | 46:f09711580d4a | 12 | #include "Headless.h" |
el17sm | 46:f09711580d4a | 13 | #include "Snake.h" |
el17sm | 46:f09711580d4a | 14 | #include "RoomEngine.h" |
el17sm | 46:f09711580d4a | 15 | #include "Title.h" |
el17sm | 46:f09711580d4a | 16 | |
el17sm | 46:f09711580d4a | 17 | #define INSIDE 4 |
el17sm | 46:f09711580d4a | 18 | |
el17sm | 46:f09711580d4a | 19 | // Variables |
el17sm | 46:f09711580d4a | 20 | float global_contrast = 0.5; |
el17sm | 57:1c12361b6e3d | 21 | int boss_room_counter = 0; // Counter of how mnay rooms have been explored/spawned |
el17sm | 57:1c12361b6e3d | 22 | int boss_room_number; // Number of rooms that must be explored for a boss room to spawn |
el17sm | 57:1c12361b6e3d | 23 | bool boss_room_exist; // Wether or not boss room has been spawned |
el17sm | 57:1c12361b6e3d | 24 | int number_of_enemies_killed; // For scoring, no of kills |
el17sm | 57:1c12361b6e3d | 25 | int total_time; // For scoring, time of which the game was played (without pause, without minimap, without room transitions) |
el17sm | 57:1c12361b6e3d | 26 | int no_of_doorways; // For room generation, number of doorways that room should have |
el17sm | 57:1c12361b6e3d | 27 | int room_x = MAX_ROOMS_MAP_X; // Room x-coordinate |
el17sm | 57:1c12361b6e3d | 28 | int room_y = MAX_ROOMS_MAP_Y; // Room y-coordinate |
el17sm | 57:1c12361b6e3d | 29 | bool have_to[4] = {false, false, false, false}; // Array of which doorways must exist (index order = NESW) |
el17sm | 57:1c12361b6e3d | 30 | bool cannot[4] = {false, false, false, false}; // Array of which doorways must not exist (index order = NESW) |
el17sm | 46:f09711580d4a | 31 | Player *player; |
el17sm | 46:f09711580d4a | 32 | Room *rooms[MAX_ROOMS_MAP_Y][MAX_ROOMS_MAP_X]; |
el17sm | 46:f09711580d4a | 33 | bool valid_rooms[MAX_ROOMS_MAP_Y][MAX_ROOMS_MAP_X]; |
el17sm | 46:f09711580d4a | 34 | RoomEngine *room_engine; |
el17sm | 46:f09711580d4a | 35 | |
el17sm | 46:f09711580d4a | 36 | // Objects |
el17sm | 46:f09711580d4a | 37 | N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); |
el17sm | 46:f09711580d4a | 38 | Gamepad gamepad; |
el17sm | 46:f09711580d4a | 39 | Title title; |
el17sm | 46:f09711580d4a | 40 | |
el17sm | 46:f09711580d4a | 41 | // Prototypes |
el17sm | 46:f09711580d4a | 42 | void init(); |
el17sm | 46:f09711580d4a | 43 | void game_loop(); |
el17sm | 48:f7d9ae3e554d | 44 | |
el17sm | 48:f7d9ae3e554d | 45 | void room_entrance(); |
el17sm | 48:f7d9ae3e554d | 46 | void room_exit(); |
el17sm | 48:f7d9ae3e554d | 47 | void generate_room(); |
el17sm | 48:f7d9ae3e554d | 48 | void update_room_coords(); |
el17sm | 48:f7d9ae3e554d | 49 | void minimap_detection(); |
el17sm | 50:2c5cb92a5361 | 50 | void draw_minimap(int j, int i); |
el17sm | 48:f7d9ae3e554d | 51 | |
el17sm | 46:f09711580d4a | 52 | void game_over(); |
el17sm | 47:6e31b195ce3c | 53 | void win(); |
el17sm | 47:6e31b195ce3c | 54 | void display_stats(); |
el17sm | 48:f7d9ae3e554d | 55 | void game_unload(); |
el17sm | 46:f09711580d4a | 56 | |
el17sm | 46:f09711580d4a | 57 | int opposite(int value); |
el17sm | 46:f09711580d4a | 58 | int count_doorways(); |
el17sm | 46:f09711580d4a | 59 | void update_definite_doorways(); |
el17sm | 49:3f83ed62d123 | 60 | void update_definite_doorways_up(); |
el17sm | 49:3f83ed62d123 | 61 | void update_definite_doorways_right(); |
el17sm | 49:3f83ed62d123 | 62 | void update_definite_doorways_down(); |
el17sm | 49:3f83ed62d123 | 63 | void update_definite_doorways_left(); |
el17sm | 49:3f83ed62d123 | 64 | |
el17sm | 46:f09711580d4a | 65 | int available_boss_room(); |
el17sm | 49:3f83ed62d123 | 66 | void set_boss_room(int room_y, int room_x, int side); |
el17sm | 46:f09711580d4a | 67 | |
el17sm | 46:f09711580d4a | 68 | #endif |