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

Dependencies:   mbed MotionSensor

Committer:
el17sm
Date:
Thu May 09 04:24:30 2019 +0000
Revision:
49:3f83ed62d123
Parent:
48:f7d9ae3e554d
Child:
50:2c5cb92a5361
test doxygen

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el17sm 0:8e92b66a0755 1 /*
el17sm 0:8e92b66a0755 2 ELEC2645 Embedded Systems Project
el17sm 0:8e92b66a0755 3 School of Electronic & Electrical Engineering
el17sm 0:8e92b66a0755 4 University of Leeds
el17sm 0:8e92b66a0755 5 Name: Steven Mahasin
el17sm 0:8e92b66a0755 6 Username: el17sm
el17sm 0:8e92b66a0755 7 Student ID Number: 201192939
el17sm 0:8e92b66a0755 8 Date: 11/04/2019
el17sm 1:1fa7ecca8dfb 9 */
el17sm 46:f09711580d4a 10 #include "main.h"
el17sm 10:1a3499f6b583 11
el17sm 1:1fa7ecca8dfb 12 int main()
el17sm 1:1fa7ecca8dfb 13 {
el17sm 29:6b8411bb040a 14 // Initialize
el17sm 46:f09711580d4a 15 init();
el17sm 28:98848e6a77a2 16
el17sm 29:6b8411bb040a 17 while(1) { // Gameloop
el17sm 46:f09711580d4a 18 boss_room_exist = false;
el17sm 47:6e31b195ce3c 19 number_of_enemies_killed = 0;
el17sm 47:6e31b195ce3c 20 total_time = 0;
el17sm 47:6e31b195ce3c 21
el17sm 32:fe6359ef9916 22 title.main(lcd, gamepad, global_contrast);
el17sm 32:fe6359ef9916 23 srand(title.get_seed());
el17sm 31:ab24d028ddfd 24 player = new Player(39, 27);
el17sm 41:0697508a28ba 25 room_engine = new RoomEngine(global_contrast);
el17sm 31:ab24d028ddfd 26
el17sm 31:ab24d028ddfd 27 game_loop();
el17sm 48:f7d9ae3e554d 28 game_unload();
el17sm 31:ab24d028ddfd 29 }
el17sm 31:ab24d028ddfd 30 }
el17sm 31:ab24d028ddfd 31
el17sm 46:f09711580d4a 32 void init()
el17sm 46:f09711580d4a 33 {
el17sm 46:f09711580d4a 34 lcd.init();
el17sm 46:f09711580d4a 35 lcd.setContrast(global_contrast);
el17sm 46:f09711580d4a 36 gamepad.init();
el17sm 46:f09711580d4a 37 for (int j = 0; j < MAX_ROOMS_MAP_Y; j++){
el17sm 46:f09711580d4a 38 for (int i = 0; i < MAX_ROOMS_MAP_X; i++){
el17sm 46:f09711580d4a 39 valid_rooms[j][i] = false;
el17sm 46:f09711580d4a 40 }
el17sm 46:f09711580d4a 41 }
el17sm 46:f09711580d4a 42 }
el17sm 46:f09711580d4a 43
el17sm 31:ab24d028ddfd 44 void game_loop()
el17sm 31:ab24d028ddfd 45 {
el17sm 31:ab24d028ddfd 46 while(1) { // Floor Loop
el17sm 46:f09711580d4a 47 boss_room_number = 5 + rand() % 4; // Boss room appears after travelling 5-8 rooms
el17sm 46:f09711580d4a 48 boss_room_counter = 0;
el17sm 46:f09711580d4a 49 while(1) { // Room Loop
el17sm 48:f7d9ae3e554d 50 room_entrance();
el17sm 48:f7d9ae3e554d 51 while(room_engine->check_player_room_position() == INSIDE) { // actions inside the Room
el17sm 31:ab24d028ddfd 52 room_engine->read_input(gamepad);
el17sm 47:6e31b195ce3c 53 room_engine->update(number_of_enemies_killed);
el17sm 31:ab24d028ddfd 54 room_engine->render(lcd, gamepad);
el17sm 46:f09711580d4a 55 minimap_detection();
el17sm 47:6e31b195ce3c 56 total_time++;
el17sm 48:f7d9ae3e554d 57 if (player->get_hp() <= 0) {goto gameover;} // gameover if player health depleted
el17sm 48:f7d9ae3e554d 58 if ((rooms[room_y][room_x]->get_room_type() == 10) && !(rooms[room_y][room_x]->enemies_exist())){goto winner;} // wins game if room is a boss room, and the boss is dead
el17sm 29:6b8411bb040a 59 }
el17sm 48:f7d9ae3e554d 60 room_exit();
el17sm 31:ab24d028ddfd 61 }
el17sm 31:ab24d028ddfd 62 }
el17sm 48:f7d9ae3e554d 63 gameover : { game_over(); goto displaystats;}
el17sm 48:f7d9ae3e554d 64 winner : { win(); goto displaystats;}
el17sm 48:f7d9ae3e554d 65 displaystats : { display_stats();}
el17sm 48:f7d9ae3e554d 66 }
el17sm 48:f7d9ae3e554d 67
el17sm 48:f7d9ae3e554d 68 void room_entrance()
el17sm 48:f7d9ae3e554d 69 {
el17sm 48:f7d9ae3e554d 70 update_room_coords();
el17sm 48:f7d9ae3e554d 71 if (!valid_rooms[room_y][room_x]){generate_room();} // generate a new room if player enters a nonexistent room
el17sm 48:f7d9ae3e554d 72 room_engine->load(player, rooms[room_y][room_x]);
el17sm 48:f7d9ae3e554d 73 room_engine->entrance_scene(lcd, gamepad);
el17sm 48:f7d9ae3e554d 74 }
el17sm 48:f7d9ae3e554d 75
el17sm 48:f7d9ae3e554d 76 void room_exit()
el17sm 48:f7d9ae3e554d 77 {
el17sm 48:f7d9ae3e554d 78 room_engine->exit_scene(lcd, gamepad);
el17sm 48:f7d9ae3e554d 79 rooms[room_y][room_x]->unload();
el17sm 48:f7d9ae3e554d 80 player->delete_bullets();
el17sm 48:f7d9ae3e554d 81 room_engine->update_current_room();
el17sm 31:ab24d028ddfd 82 }
el17sm 29:6b8411bb040a 83
el17sm 46:f09711580d4a 84 void generate_room()
el17sm 46:f09711580d4a 85 {
el17sm 46:f09711580d4a 86 valid_rooms[room_y][room_x] = true;
el17sm 46:f09711580d4a 87 if (boss_room_counter == 0) {
el17sm 46:f09711580d4a 88 rooms[room_y][room_x] = new Room(0, 0);
el17sm 46:f09711580d4a 89 rooms[room_y][room_x]->set_doorway(0, true);
el17sm 46:f09711580d4a 90 } else {
el17sm 46:f09711580d4a 91 rooms[room_y][room_x] = new Room(rand() % 4, 0);
el17sm 46:f09711580d4a 92 if (boss_room_counter < boss_room_number) {no_of_doorways = 2 + (rand() % 100 < 10) + (rand() % 100 < 10);} // 20% chance of adding doorways
el17sm 49:3f83ed62d123 93 else {no_of_doorways = 0;}
el17sm 46:f09711580d4a 94 while (count_doorways() < no_of_doorways) {
el17sm 46:f09711580d4a 95 rooms[room_y][room_x]->set_doorway(rand() % 4, true); // Setting random doorways until number of desired doorways
el17sm 46:f09711580d4a 96 }
el17sm 46:f09711580d4a 97 update_definite_doorways();
el17sm 46:f09711580d4a 98 for (int i = 0; i < 4; i++) {
el17sm 46:f09711580d4a 99 if (cannot[i]){rooms[room_y][room_x]->set_doorway(i, false);}
el17sm 46:f09711580d4a 100 if (have_to[i]){rooms[room_y][room_x]->set_doorway(i, true);}
el17sm 46:f09711580d4a 101 }
el17sm 46:f09711580d4a 102 if ((boss_room_counter >= boss_room_number) && (!boss_room_exist)) {
el17sm 46:f09711580d4a 103 rooms[room_y][room_x]->set_boss_doorway(available_boss_room());
el17sm 46:f09711580d4a 104 boss_room_exist = true;
el17sm 46:f09711580d4a 105 }
el17sm 46:f09711580d4a 106 }
el17sm 46:f09711580d4a 107 boss_room_counter++;
el17sm 46:f09711580d4a 108 }
el17sm 46:f09711580d4a 109
el17sm 46:f09711580d4a 110 void update_room_coords()
el17sm 46:f09711580d4a 111 {
el17sm 46:f09711580d4a 112 prev_room_x = room_x;
el17sm 46:f09711580d4a 113 prev_room_y = room_y;
el17sm 46:f09711580d4a 114 room_y = room_engine->get_room_y();
el17sm 46:f09711580d4a 115 room_x = room_engine->get_room_x();
el17sm 46:f09711580d4a 116 }
el17sm 46:f09711580d4a 117
el17sm 48:f7d9ae3e554d 118 void minimap_detection()
el17sm 48:f7d9ae3e554d 119 {
el17sm 49:3f83ed62d123 120 while(gamepad.check_event(Gamepad::R_PRESSED)) {
el17sm 48:f7d9ae3e554d 121 lcd.clear();
el17sm 48:f7d9ae3e554d 122 for (int j = 0; j < MAX_ROOMS_MAP_Y; j++) {
el17sm 48:f7d9ae3e554d 123 for (int i = 0; i < MAX_ROOMS_MAP_X; i++) {
el17sm 48:f7d9ae3e554d 124 if (valid_rooms[j][i]) {
el17sm 48:f7d9ae3e554d 125 lcd.drawSprite(33 + (i-room_x)*20, 17 + (j-room_y)*15, 15, 20, (char *)minimap_sprite[0]);
el17sm 48:f7d9ae3e554d 126 if (rooms[j][i]->get_room_type() == 10) {
el17sm 48:f7d9ae3e554d 127 lcd.drawSprite(33 + (i-room_x)*20, 17 + (j-room_y)*15, 15, 20, (char *)minimap_sprite[2]);
el17sm 48:f7d9ae3e554d 128 } else if (rooms[j][i]->enemies_exist()) {
el17sm 48:f7d9ae3e554d 129 lcd.drawSprite(33 + (i-room_x)*20, 17 + (j-room_y)*15, 15, 20, (char *)minimap_sprite[1]);
el17sm 48:f7d9ae3e554d 130 }
el17sm 48:f7d9ae3e554d 131 if (rooms[j][i]->get_doorway(0)) {
el17sm 48:f7d9ae3e554d 132 lcd.drawLine(42 + (i-room_x)*20, 17 + (j-room_y)*15, 43 + (i-room_x)*20, 17 + (j-room_y)*15, 1);
el17sm 48:f7d9ae3e554d 133 }
el17sm 48:f7d9ae3e554d 134 if (rooms[j][i]->get_doorway(1)) {
el17sm 48:f7d9ae3e554d 135 lcd.drawLine(52 + (i-room_x)*20, 23 + (j-room_y)*15, 52 + (i-room_x)*20, 24 + (j-room_y)*15, 1);
el17sm 48:f7d9ae3e554d 136 }
el17sm 48:f7d9ae3e554d 137 if (rooms[j][i]->get_doorway(2)) {
el17sm 48:f7d9ae3e554d 138 lcd.drawLine(42 + (i-room_x)*20, 31 + (j-room_y)*15, 43 + (i-room_x)*20, 31 + (j-room_y)*15, 1);
el17sm 48:f7d9ae3e554d 139 }
el17sm 48:f7d9ae3e554d 140 if (rooms[j][i]->get_doorway(3)) {
el17sm 48:f7d9ae3e554d 141 lcd.drawLine(33 + (i-room_x)*20, 23 + (j-room_y)*15, 33 + (i-room_x)*20, 24 + (j-room_y)*15, 1);
el17sm 48:f7d9ae3e554d 142 }
el17sm 48:f7d9ae3e554d 143 }
el17sm 48:f7d9ae3e554d 144 }
el17sm 48:f7d9ae3e554d 145 }
el17sm 48:f7d9ae3e554d 146 lcd.drawSpriteTransparent(33, 17, 15, 20, (char *)minimap_sprite[3]);
el17sm 48:f7d9ae3e554d 147 lcd.refresh();
el17sm 48:f7d9ae3e554d 148 wait_ms(1000/40);
el17sm 48:f7d9ae3e554d 149 };
el17sm 48:f7d9ae3e554d 150 }
el17sm 48:f7d9ae3e554d 151
el17sm 48:f7d9ae3e554d 152 void game_over()
el17sm 48:f7d9ae3e554d 153 {
el17sm 48:f7d9ae3e554d 154 lcd.clear();
el17sm 48:f7d9ae3e554d 155 lcd.setContrast(global_contrast);
el17sm 49:3f83ed62d123 156 lcd.printString("Game Over", 0, 0);
el17sm 48:f7d9ae3e554d 157 }
el17sm 48:f7d9ae3e554d 158
el17sm 48:f7d9ae3e554d 159 void win()
el17sm 48:f7d9ae3e554d 160 {
el17sm 48:f7d9ae3e554d 161 lcd.clear();
el17sm 48:f7d9ae3e554d 162 lcd.setContrast(global_contrast);
el17sm 49:3f83ed62d123 163 lcd.printString("You won!", 0, 0);
el17sm 48:f7d9ae3e554d 164 }
el17sm 48:f7d9ae3e554d 165
el17sm 48:f7d9ae3e554d 166 void display_stats()
el17sm 48:f7d9ae3e554d 167 {
el17sm 49:3f83ed62d123 168 lcd.printString("Restart?", 0, 1);
el17sm 48:f7d9ae3e554d 169 lcd.printString("Enemies Killed:", 0, 2);
el17sm 48:f7d9ae3e554d 170 char kills[10];
el17sm 48:f7d9ae3e554d 171 sprintf(kills, "%d enemies", number_of_enemies_killed);
el17sm 48:f7d9ae3e554d 172 lcd.printString(kills, 0, 3);
el17sm 48:f7d9ae3e554d 173 lcd.printString("Time:", 0, 4);
el17sm 48:f7d9ae3e554d 174 char total_duration[10];
el17sm 48:f7d9ae3e554d 175 sprintf(total_duration, "%d seconds", (total_time/40));
el17sm 48:f7d9ae3e554d 176 lcd.printString(total_duration, 0, 5);
el17sm 48:f7d9ae3e554d 177 lcd.refresh();
el17sm 48:f7d9ae3e554d 178 while(gamepad.check_event(Gamepad::A_PRESSED)) {
el17sm 48:f7d9ae3e554d 179 }
el17sm 48:f7d9ae3e554d 180 wait(0.05);
el17sm 48:f7d9ae3e554d 181 while(!gamepad.check_event(Gamepad::A_PRESSED)) {
el17sm 48:f7d9ae3e554d 182 }
el17sm 48:f7d9ae3e554d 183 wait(0.05);
el17sm 48:f7d9ae3e554d 184 while(gamepad.check_event(Gamepad::A_PRESSED)) {
el17sm 48:f7d9ae3e554d 185 }
el17sm 48:f7d9ae3e554d 186 }
el17sm 48:f7d9ae3e554d 187
el17sm 48:f7d9ae3e554d 188 int available_boss_room()
el17sm 48:f7d9ae3e554d 189 {
el17sm 48:f7d9ae3e554d 190 if (!valid_rooms[room_y - 1][room_x]){
el17sm 48:f7d9ae3e554d 191 rooms[room_y][room_x]->set_doorway(0, true);
el17sm 49:3f83ed62d123 192 set_boss_room(room_y - 1, room_x, 0);
el17sm 48:f7d9ae3e554d 193 return 0;
el17sm 48:f7d9ae3e554d 194 } else if (!valid_rooms[room_y][room_x + 1]){
el17sm 48:f7d9ae3e554d 195 rooms[room_y][room_x]->set_doorway(1, true);
el17sm 49:3f83ed62d123 196 set_boss_room(room_y, room_x + 1, 1);
el17sm 48:f7d9ae3e554d 197 return 1;
el17sm 48:f7d9ae3e554d 198 } else if (!valid_rooms[room_y + 1][room_x]){
el17sm 48:f7d9ae3e554d 199 rooms[room_y][room_x]->set_doorway(2, true);
el17sm 49:3f83ed62d123 200 set_boss_room(room_y + 1, room_x, 2);
el17sm 48:f7d9ae3e554d 201 return 2;
el17sm 48:f7d9ae3e554d 202 } else if (!valid_rooms[room_y][room_x - 1]){
el17sm 48:f7d9ae3e554d 203 rooms[room_y][room_x]->set_doorway(3, true);
el17sm 49:3f83ed62d123 204 set_boss_room(room_y, room_x - 1, 3);
el17sm 49:3f83ed62d123 205 return 3; }
el17sm 48:f7d9ae3e554d 206 delete rooms[room_y - 1][room_x];
el17sm 49:3f83ed62d123 207 rooms[room_y][room_x]->set_doorway(3, true);
el17sm 49:3f83ed62d123 208 set_boss_room(room_y - 1, room_x, 0);
el17sm 48:f7d9ae3e554d 209 return 0;
el17sm 48:f7d9ae3e554d 210 }
el17sm 48:f7d9ae3e554d 211
el17sm 49:3f83ed62d123 212 void set_boss_room(int room_y, int room_x, int side)
el17sm 49:3f83ed62d123 213 {
el17sm 49:3f83ed62d123 214 valid_rooms[room_y][room_x] = true;
el17sm 49:3f83ed62d123 215 rooms[room_y][room_x] = new Room(0, 10);
el17sm 49:3f83ed62d123 216 rooms[room_y][room_x]->set_doorway(opposite(side), true);
el17sm 49:3f83ed62d123 217 if ((opposite(side) != 0) && (valid_rooms[room_y - 1][room_x])){
el17sm 49:3f83ed62d123 218 if (rooms[room_y - 1][room_x]->get_doorway(2)){
el17sm 49:3f83ed62d123 219 rooms[room_y - 1][room_x]->set_doorway(2, false);
el17sm 49:3f83ed62d123 220 }}
el17sm 49:3f83ed62d123 221 if ((opposite(side) != 1) && (valid_rooms[room_y][room_x + 1])){
el17sm 49:3f83ed62d123 222 if (rooms[room_y][room_x + 1]->get_doorway(3)){
el17sm 49:3f83ed62d123 223 rooms[room_y][room_x + 1]->set_doorway(3, false);
el17sm 49:3f83ed62d123 224 }}
el17sm 49:3f83ed62d123 225 if ((opposite(side) != 2) && (valid_rooms[room_y + 1][room_x])){
el17sm 49:3f83ed62d123 226 if (rooms[room_y + 1][room_x]->get_doorway(0)){
el17sm 49:3f83ed62d123 227 rooms[room_y + 1][room_x]->set_doorway(0, false);
el17sm 49:3f83ed62d123 228 }}
el17sm 49:3f83ed62d123 229 if ((opposite(side) != 3) && (valid_rooms[room_y][room_x - 1])){
el17sm 49:3f83ed62d123 230 if (rooms[room_y][room_x - 1]->get_doorway(1)){
el17sm 49:3f83ed62d123 231 rooms[room_y][room_x - 1]->set_doorway(1, false);
el17sm 49:3f83ed62d123 232 }}
el17sm 49:3f83ed62d123 233 }
el17sm 49:3f83ed62d123 234
el17sm 48:f7d9ae3e554d 235 void game_unload()
el17sm 48:f7d9ae3e554d 236 {
el17sm 48:f7d9ae3e554d 237 for (int i = 0; i < MAX_ROOMS_MAP_X; i++) {
el17sm 48:f7d9ae3e554d 238 for (int j = 0; j < MAX_ROOMS_MAP_Y; j++) {
el17sm 48:f7d9ae3e554d 239 if (valid_rooms[j][j]){
el17sm 48:f7d9ae3e554d 240 delete rooms[j][i];
el17sm 48:f7d9ae3e554d 241 valid_rooms[i][j] = false;
el17sm 48:f7d9ae3e554d 242 }
el17sm 48:f7d9ae3e554d 243 }
el17sm 48:f7d9ae3e554d 244 }
el17sm 48:f7d9ae3e554d 245 delete room_engine;
el17sm 48:f7d9ae3e554d 246 delete player;
el17sm 48:f7d9ae3e554d 247 }
el17sm 48:f7d9ae3e554d 248
el17sm 48:f7d9ae3e554d 249 // Functions
el17sm 46:f09711580d4a 250 int opposite(int value)
el17sm 46:f09711580d4a 251 {
el17sm 46:f09711580d4a 252 if (value <= 1) {
el17sm 46:f09711580d4a 253 return value + 2;
el17sm 46:f09711580d4a 254 } else {
el17sm 46:f09711580d4a 255 return value - 2;
el17sm 46:f09711580d4a 256 }
el17sm 46:f09711580d4a 257 }
el17sm 46:f09711580d4a 258
el17sm 46:f09711580d4a 259 int count_doorways() // counts number of exisisting doorways
el17sm 46:f09711580d4a 260 {
el17sm 46:f09711580d4a 261 int count = 0;
el17sm 46:f09711580d4a 262 for (int i = 0; i < 4; i++){
el17sm 46:f09711580d4a 263 if (rooms[room_y][room_x]->get_doorway(i)) {
el17sm 46:f09711580d4a 264 count++;
el17sm 46:f09711580d4a 265 }
el17sm 46:f09711580d4a 266 }
el17sm 46:f09711580d4a 267 return count;
el17sm 46:f09711580d4a 268 }
el17sm 46:f09711580d4a 269
el17sm 46:f09711580d4a 270 void update_definite_doorways()
el17sm 46:f09711580d4a 271 {
el17sm 49:3f83ed62d123 272 update_definite_doorways_up();
el17sm 49:3f83ed62d123 273 update_definite_doorways_right();
el17sm 49:3f83ed62d123 274 update_definite_doorways_down();
el17sm 49:3f83ed62d123 275 update_definite_doorways_left();
el17sm 49:3f83ed62d123 276 }
el17sm 49:3f83ed62d123 277
el17sm 49:3f83ed62d123 278 void update_definite_doorways_up()
el17sm 49:3f83ed62d123 279 {
el17sm 49:3f83ed62d123 280 if (room_y == 1) { // if room to be generated is on the border, then doorway cannot exist
el17sm 46:f09711580d4a 281 cannot[0] = true;
el17sm 46:f09711580d4a 282 have_to[0] = false;
el17sm 49:3f83ed62d123 283 } else if (valid_rooms[room_y - 1][room_x]){ // if room to be generated is on the border, then doorway cannot exist
el17sm 46:f09711580d4a 284 if (rooms[room_y - 1][room_x]->get_doorway(2)){
el17sm 46:f09711580d4a 285 have_to[0] = true;
el17sm 46:f09711580d4a 286 cannot[0] = false;
el17sm 46:f09711580d4a 287 } else {
el17sm 46:f09711580d4a 288 have_to[0] = false;
el17sm 46:f09711580d4a 289 cannot[0] = true;
el17sm 46:f09711580d4a 290 }
el17sm 46:f09711580d4a 291 } else {
el17sm 46:f09711580d4a 292 have_to[0] = false;
el17sm 46:f09711580d4a 293 cannot[0] = false;
el17sm 46:f09711580d4a 294 }
el17sm 49:3f83ed62d123 295 }
el17sm 49:3f83ed62d123 296 void update_definite_doorways_right()
el17sm 49:3f83ed62d123 297 {
el17sm 46:f09711580d4a 298 if (room_x == 10) {
el17sm 46:f09711580d4a 299 cannot[1] = true;
el17sm 46:f09711580d4a 300 have_to[1] = false;
el17sm 46:f09711580d4a 301 } else if (valid_rooms[room_y][room_x + 1]){
el17sm 46:f09711580d4a 302 if (rooms[room_y][room_x + 1]->get_doorway(3)){
el17sm 46:f09711580d4a 303 have_to[1] = true;
el17sm 46:f09711580d4a 304 cannot[1] = false;
el17sm 46:f09711580d4a 305 } else {
el17sm 46:f09711580d4a 306 have_to[1] = false;
el17sm 46:f09711580d4a 307 cannot[1] = true;
el17sm 46:f09711580d4a 308 }
el17sm 46:f09711580d4a 309 } else {
el17sm 46:f09711580d4a 310 have_to[1] = false;
el17sm 46:f09711580d4a 311 cannot[1] = false;
el17sm 46:f09711580d4a 312 }
el17sm 49:3f83ed62d123 313 }
el17sm 49:3f83ed62d123 314
el17sm 49:3f83ed62d123 315 void update_definite_doorways_down()
el17sm 49:3f83ed62d123 316 {
el17sm 46:f09711580d4a 317 if (room_y == 10) {
el17sm 46:f09711580d4a 318 cannot[2] = true;
el17sm 46:f09711580d4a 319 have_to[2] = false;
el17sm 46:f09711580d4a 320 } else if (valid_rooms[room_y + 1][room_x]){
el17sm 46:f09711580d4a 321 if (rooms[room_y + 1][room_x]->get_doorway(0)){
el17sm 46:f09711580d4a 322 have_to[2] = true;
el17sm 46:f09711580d4a 323 cannot[2] = false;
el17sm 46:f09711580d4a 324 } else {
el17sm 46:f09711580d4a 325 have_to[2] = false;
el17sm 46:f09711580d4a 326 cannot[2] = true;
el17sm 46:f09711580d4a 327 }
el17sm 46:f09711580d4a 328 } else {
el17sm 46:f09711580d4a 329 have_to[2] = false;
el17sm 46:f09711580d4a 330 cannot[2] = false;
el17sm 46:f09711580d4a 331 }
el17sm 49:3f83ed62d123 332 }
el17sm 49:3f83ed62d123 333
el17sm 49:3f83ed62d123 334 void update_definite_doorways_left()
el17sm 49:3f83ed62d123 335 {
el17sm 46:f09711580d4a 336 if (room_x == 1) {
el17sm 46:f09711580d4a 337 cannot[3] = true;
el17sm 46:f09711580d4a 338 have_to[3] = false;
el17sm 46:f09711580d4a 339 } else if (valid_rooms[room_y][room_x - 1]){
el17sm 46:f09711580d4a 340 if (rooms[room_y][room_x - 1]->get_doorway(1)){
el17sm 46:f09711580d4a 341 have_to[3] = true;
el17sm 46:f09711580d4a 342 cannot[3] = false;
el17sm 46:f09711580d4a 343 } else {
el17sm 46:f09711580d4a 344 have_to[3] = false;
el17sm 46:f09711580d4a 345 cannot[3] = true;
el17sm 46:f09711580d4a 346 }
el17sm 46:f09711580d4a 347 } else {
el17sm 46:f09711580d4a 348 have_to[3] = false;
el17sm 46:f09711580d4a 349 cannot[3] = false;
el17sm 46:f09711580d4a 350 }
el17sm 48:f7d9ae3e554d 351 }