A rouge-like rpg, heavily inspired on the binding of isaac. Running on a FRDM-K64F Mbed board. C++.

Dependencies:   mbed MotionSensor

Revision:
58:c8d90bb7404a
Parent:
51:4d0cd75e7ed3
Child:
59:fd4669864b67
--- a/RoomEngine/Room/Room.h	Thu May 09 09:50:19 2019 +0000
+++ b/RoomEngine/Room/Room.h	Thu May 09 14:43:45 2019 +0000
@@ -12,66 +12,212 @@
 #include "N5110.h"
 
 #define MAX_ENEMIES 10
-
+/**Room Class
+@author Steven Mahasin
+@brief Create a Room which holds the enemies, collectibles and doorways
+@date May 2019
+*/
 class Room // contains the type of room, number of enemies inside it, the doorways existing in the room, functions to spawn enemies
 {
 private:
+    /**
+    *   @brief an array that dictates which side of the wall has a doorway
+    */
     bool _doorways[4];
+    /**
+    *   @brief states the type of room (boss, normal, walled)
+    */
     int _room_type;
+    /**
+    *   @brief the coordinates of enemies to be spawned
+    */
     int _enemy_coord[MAX_ENEMIES][2]; //  _enemy_coord[EnemyID][x/y]
+    /**
+    *   @brief the status of the walls, used to construct a wall at any x, y, width and height
+    */
     char _wall_stat[2][4]; // _wall_coord[WallID][x/y/width/height]
+    /**
+    *   @brief the special boss doorway is held in this member variable (0-3); if no boss doorway, it is default to 4
+    */
     int _before_boss_room;
+    /**
+    *   @brief a counter integer to increment through the spawn points in the spawn_area array and id each point
+    */
     short int _spawn_point_counter;
+    /**
+    *   @brief a variable to hold the decided randomised spawn point id to spawn an enemy
+    */
     short int _spawn_point_coord;
     
     // Functions
+    /**
+    *   @brief initialisation of boss room
+    */
     void init_boss_room();
+    /**
+    *   @brief initialisation of normal rooms
+    */
     void init_normal_room();
+    /**
+    *   @brief initialisation of middle walled rooms (not used in this version, in progress)
+    */
     void init_middle_walled_room();
+    /**
+    *   @brief initialisation of side walled rooms (not used in this version, in progress)
+    */
     void init_side_walled_room();
     
+    /**
+    *   @brief set the _enemy_coord of index id to a random valid spawn area x and y
+    *   @param id @details the index of the enemy to be given a random coord
+    */
     void rand_enemy_coordinate(int id);
     
+    /**
+    *   @brief draws the doorways that are behind the player
+    *   @param lcd @details the screen where the doorway is drawn
+    */
     void draw_doorways(N5110 &lcd);
+    /**
+    *   @brief draws overlayed doorways, these doorways are in front of the player
+    *   @param lcd @details the screen where the doorway_overlay is drawn
+    */
     void draw_doorways_overlay(N5110 &lcd);
+    /**
+    *   @brief draws enemies onto the screen
+    *   @param lcd @details the screen where the enemies are drawn
+    *   @param j @details the current y-position of entities that are being drawn
+    */
     void draw_enemies(N5110 &lcd, int j);
+    /**
+    *   @brief draws collectibles onto the screen
+    *   @param lcd @details the screen where the collectibles is drawn
+    *   @param j @details the current y-position of entities that are being drawn
+    */
     void draw_collectibles(N5110 &lcd, int j);
+    /**
+    *   @brief draws walls entity onto the screen
+    *   @param lcd @details the screen where the walls is drawn
+    *   @param j @details the current y-position of entities that are being drawn
+    */
     void draw_walls(N5110 &lcd, int j);
     
     
 public:
-    // Constructors
+    /** Constructors
+    *   @brief create a room with a set number of enemies and a set room type
+    *   @param no_of_enemies @details the number of enemies to be spawned in the room
+    *   @param room_type @details the type of room to be initialised with
+    */
     Room(int no_of_enemies, int room_type);
-    // Deconstructors
+    /** Destructors */
     ~Room();
     
     // Mutators
+    /**
+    *   @brief sets _doorway at index "index" with the value of "doorway_value"
+    *   @param index @details the index of the mutated doorway
+    *   @param doorway_value @details the value of the mutated doorway
+    */
     void set_doorway(int index, bool doorway_value);
+    /**
+    *   @brief sets the position of boss doorway on this room
+    *   @param before_boss_room @details the side in which boss doorway exists (0-3 = sides, 4 = doesn't exist)
+    */
     void set_boss_doorway(int before_boss_room);
     
     // Accessors
+    /**
+    *   @brief get the 2d map array that dictates where there are walls or empty space
+    *   @return the char pointer array of the 2d level map
+    */
     char * get_current_map_2d();
+    /**
+    *   @brief get the doorways of the room
+    *   @return boolean pointer array of the _doorways member variable
+    */
     bool * get_doorways();
+    /**
+    *   @brief get the doorway status of the room at index "index"
+    *   @return _doorway[index]
+    */
     bool get_doorway(int index);
+    /**
+    *   @brief get the type of room
+    *   @return _room_type
+    */
     char get_room_type();
+    /**
+    *   @brief get the boss doorway status
+    *   @return _before_boss_room
+    */
     int get_boss_doorway();
     
     // Functions
+    /**
+    *   @brief loads all the entities in the room
+    */
     void load();
+    /**
+    *   @brief deletes all entities in the room
+    */
     void unload();
+    /**
+    *   @brief close all doorways if the room is a boss room
+    */
     void update_doorways();
+    /**
+    *   @brief draws the room including enemies
+    *   @param lcd @details the screen in which the room is being drawn in
+    *   @param j @details the current y-position of entities that are being drawn
+    */
     void draw(N5110 &lcd, int j);    
+    /**
+    *   @brief draws the room
+    *   @param lcd @details the screen in which the room is being drawn in
+    */
     void draw_room(N5110 &lcd);
+    /**
+    *   @brief draws the room_overlay
+    *   @param lcd @details the screen in which the room_overlay is being drawn in
+    */
     void draw_room_overlay(N5110 &lcd);
+    
+    /**
+    *   @brief checks if there is any valid enemies in the room
+    *   @return true if there is any valid enemies in the room
+    */
     bool enemies_exist();
     
     // Variables
+    /**
+    *   @brief A pointer to an array of Entities where all the possible enemies in the room are stored
+    */
     Entity *enemies[MAX_ENEMIES];
+    /**
+    *   @brief A boolean array to dictate which enemies exist
+    */
     bool valid_enemies[MAX_ENEMIES];
+    /**
+    *   @brief A pointer to an array of Entities where all the possible collectibles in the room are stored
+    */
     Entity *collectibles[MAX_ENEMIES];
+    /**
+    *   @brief A boolean array to dictate which collectibles exist
+    */
     bool valid_collectibles[MAX_ENEMIES];
+    /**
+    *   @brief A pointer to an array of Entities where all the possible walls in the room are stored
+    */
     Entity *walls[2];
+    /**
+    *   @brief A boolean array to dictate which walls exist
+    */
     bool valid_walls[2];
+    /**
+    *   @brief An array of enemy types for each enemy in the room
+    *   @note currently only snake and headless
+    */
     int enemies_type[MAX_ENEMIES];
 };