diff --git a/incl/dungeon.h b/incl/dungeon.h index 202a1be5..61d9dc48 100644 --- a/incl/dungeon.h +++ b/incl/dungeon.h @@ -8,58 +8,58 @@ extern "C" { #include #include +typedef enum background2 { + Off, + Parallax, + Dark, + OnTop, + Translucent, + Addition, + Normal, + Transparent, + DarkRoom +} background2; + +typedef struct object_door { + short id; + uint8_t x; + uint8_t y; + uint8_t size; + uint8_t type; + uint8_t layer; +} object_door; + +typedef struct staircase { + uint8_t id; + uint8_t room; + const char* label; +} staircase; + +typedef struct chest { + uint8_t x; + uint8_t y; + uint8_t item; + bool picker; + bool big_chest; +} chest; + +typedef struct chest_data { + uint8_t id; + bool size; +} chest_data; + +typedef struct destination { + uint8_t index; + uint8_t target; + uint8_t target_layer; +} destination; + typedef struct z3_dungeon_room { - typedef struct object_door { - short id; - uint8_t x; - uint8_t y; - uint8_t size; - uint8_t type; - uint8_t layer; - } object_door; - object_door* doors; - - typedef struct staircase { - uint8_t id; - uint8_t room; - const char* label; - } staircase; - staircase* staircases; - - typedef struct chest { - uint8_t x; - uint8_t y; - uint8_t item; - bool picker; - bool big_chest; - } chest; - chest* chests; - - typedef struct chest_data { - uint8_t id; - bool size; - } chest_data; - chest_data* chests; - - typedef enum background2 { - Off, - Parallax, - Dark, - OnTop, - Translucent, - Addition, - Normal, - Transparent, - DarkRoom - } background2; background2 bg2; - - typedef struct destination { - uint8_t index; - uint8_t target; - uint8_t target_layer; - } destination; - + object_door* doors; + staircase* staircases; + chest* chests; + chest_data* chests_in_room; destination pits; destination stairs[4]; } z3_dungeon_room; diff --git a/src/app/zelda3/dungeon/room.cc b/src/app/zelda3/dungeon/room.cc index 112c69db..97f04f60 100644 --- a/src/app/zelda3/dungeon/room.cc +++ b/src/app/zelda3/dungeon/room.cc @@ -27,13 +27,13 @@ void Room::LoadHeader() { auto header_location = core::SnesToPc(address); - bg2_ = (z3_dungeon_room::background2)((rom()->data()[header_location] >> 5) & + bg2_ = (background2)((rom()->data()[header_location] >> 5) & 0x07); collision_ = (CollisionKey)((rom()->data()[header_location] >> 2) & 0x07); is_light_ = ((rom()->data()[header_location]) & 0x01) == 1; if (is_light_) { - bg2_ = z3_dungeon_room::background2::DarkRoom; + bg2_ = background2::DarkRoom; } palette = ((rom()->data()[header_location + 1] & 0x3F)); @@ -374,7 +374,7 @@ void Room::LoadObjects() { if (nbr_of_staircase < 4) { tile_objects_.back().set_options(ObjectOption::Stairs | tile_objects_.back().options()); - z3_staircases_.push_back(z3_dungeon_room::staircase( + z3_staircases_.push_back(staircase( posX, posY, absl::StrCat("To ", staircase_rooms_[nbr_of_staircase]) .data())); @@ -383,7 +383,7 @@ void Room::LoadObjects() { tile_objects_.back().set_options(ObjectOption::Stairs | tile_objects_.back().options()); z3_staircases_.push_back( - z3_dungeon_room::staircase(posX, posY, "To ???")); + staircase(posX, posY, "To ???")); } } } @@ -479,7 +479,7 @@ void Room::LoadChests() { } chests_in_room_.emplace_back( - z3_dungeon_room::chest_data(rom_data[cpos + (i * 3) + 2], big)); + chest_data(rom_data[cpos + (i * 3) + 2], big)); } } } diff --git a/src/app/zelda3/dungeon/room.h b/src/app/zelda3/dungeon/room.h index aad45c90..7c97befd 100644 --- a/src/app/zelda3/dungeon/room.h +++ b/src/app/zelda3/dungeon/room.h @@ -177,13 +177,13 @@ class Room : public SharedRom { int64_t room_size_pointer_; std::array blocks_; - std::array chest_list_; + std::array chest_list_; std::array background_bmps_; std::vector tile_objects_; std::vector sprites_; - std::vector z3_staircases_; - std::vector chests_in_room_; + std::vector z3_staircases_; + std::vector chests_in_room_; LayerMergeType layer_merging_; CollisionKey collision_; @@ -191,12 +191,12 @@ class Room : public SharedRom { TagKey tag1_; TagKey tag2_; - z3_dungeon_room::background2 bg2_; - z3_dungeon_room::destination pits_; - z3_dungeon_room::destination stair1_; - z3_dungeon_room::destination stair2_; - z3_dungeon_room::destination stair3_; - z3_dungeon_room::destination stair4_; + background2 bg2_; + destination pits_; + destination stair1_; + destination stair2_; + destination stair3_; + destination stair4_; }; constexpr std::string_view kRoomNames[] = {