Refactor dungeon background enum and update related usages for consistency

This commit is contained in:
scawful
2024-11-10 22:05:19 -05:00
parent 089dc4017c
commit c640c0af66
4 changed files with 25 additions and 63 deletions

View File

@@ -31,12 +31,12 @@ void Room::LoadHeader() {
auto header_location = core::SnesToPc(address);
bg2_ = (Background2)((rom()->data()[header_location] >> 5) & 0x07);
bg2_ = (z3_dungeon_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_ = Background2::DarkRoom;
bg2_ = z3_dungeon_background2::DarkRoom;
}
palette = ((rom()->data()[header_location + 1] & 0x3F));

View File

@@ -159,19 +159,19 @@ class Room : public SharedRom {
int64_t room_size_pointer_;
std::array<uint8_t, 16> blocks_;
std::array<uchar, 16> chest_list_;
std::array<gfx::Bitmap, 3> background_bmps_;
std::vector<zelda3::Sprite> sprites_;
std::vector<z3_staircase> staircase_rooms_vec_;
Background2 bg2_;
z3_dungeon_background2 bg2_;
z3_dungeon_destination pits_;
z3_dungeon_destination stair1_;
z3_dungeon_destination stair2_;
z3_dungeon_destination stair3_;
z3_dungeon_destination stair4_;
std::array<uchar, 16> chest_list_;
std::vector<z3_chest_data> chests_in_room_;
std::vector<RoomObject> tile_objects_;

View File

@@ -28,18 +28,6 @@ SubtypeInfo FetchSubtypeInfo(uint16_t object_id);
enum class SpecialObjectType { Chest, BigChest, InterroomStairs };
enum Background2 {
Off,
Parallax,
Dark,
OnTop,
Translucent,
Addition,
Normal,
Transparent,
DarkRoom
};
enum Sorting {
All = 0,
Wall = 1,
@@ -87,34 +75,7 @@ class RoomObject : public SharedRom {
ox_(x),
oy_(y),
width_(16),
height_(16),
unique_id_(0) {}
void GetObjectSize() {
previous_size_ = size_;
size_ = 1;
GetBaseSize();
UpdateSize();
size_ = 2;
GetSizeSized();
UpdateSize();
size_ = previous_size_;
}
void GetBaseSize() {
base_width_ = width_;
base_height_ = height_;
}
void GetSizeSized() {
size_height_ = height_ - base_height_;
size_width_ = width_ - base_width_;
}
void UpdateSize() {
width_ = 8;
height_ = 8;
}
height_(16) {}
void AddTiles(int nbr, int pos) {
for (int i = 0; i < nbr; i++) {
@@ -135,10 +96,6 @@ class RoomObject : public SharedRom {
protected:
bool all_bgs_ = false;
bool lit_ = false;
bool deleted_ = false;
bool show_rectangle_ = false;
bool diagonal_fix_ = false;
bool selected_ = false;
int16_t id_;
uint8_t x_;
@@ -153,15 +110,8 @@ class RoomObject : public SharedRom {
int width_;
int height_;
int base_width_;
int base_height_;
int size_width_;
int size_height_;
int tile_index_ = 0;
int offset_x_ = 0;
int offset_y_ = 0;
int preview_id_ = 0;
int unique_id_ = 0;
std::string name_;

View File

@@ -18,8 +18,8 @@ struct z3_object_door {
struct z3_dungeon_destination {
uint8_t index;
uint8_t target = 0;
uint8_t target_layer = 0;
uint8_t target;
uint8_t target_layer;
};
struct z3_staircase {
@@ -29,18 +29,30 @@ struct z3_staircase {
};
struct z3_chest {
uint8_t x = 0;
uint8_t y = 0;
uint8_t item = 0;
bool picker = false;
bool big_chest = false;
uint8_t x;
uint8_t y;
uint8_t item;
bool picker;
bool big_chest;
};
struct z3_chest_data {
uchar id;
uint8_t id;
bool size;
};
enum z3_dungeon_background2 {
Off,
Parallax,
Dark,
OnTop,
Translucent,
Addition,
Normal,
Transparent,
DarkRoom
};
#ifdef __cplusplus
}
#endif