Refactor dungeon room structures and rename classes for consistency
This commit is contained in:
@@ -164,23 +164,23 @@ void Room::LoadRoomFromROM() {
|
||||
|
||||
b = rom_data[hpos];
|
||||
|
||||
pits_.TargetLayer = (uchar)(b & 0x03);
|
||||
stair1_.TargetLayer = (uchar)((b >> 2) & 0x03);
|
||||
stair2_.TargetLayer = (uchar)((b >> 4) & 0x03);
|
||||
stair3_.TargetLayer = (uchar)((b >> 6) & 0x03);
|
||||
pits_.target_layer = (uchar)(b & 0x03);
|
||||
stair1_.target_layer = (uchar)((b >> 2) & 0x03);
|
||||
stair2_.target_layer = (uchar)((b >> 4) & 0x03);
|
||||
stair3_.target_layer = (uchar)((b >> 6) & 0x03);
|
||||
hpos++;
|
||||
stair4_.TargetLayer = (uchar)(rom_data[hpos] & 0x03);
|
||||
stair4_.target_layer = (uchar)(rom_data[hpos] & 0x03);
|
||||
hpos++;
|
||||
|
||||
pits_.Target = rom_data[hpos];
|
||||
pits_.target = rom_data[hpos];
|
||||
hpos++;
|
||||
stair1_.Target = rom_data[hpos];
|
||||
stair1_.target = rom_data[hpos];
|
||||
hpos++;
|
||||
stair2_.Target = rom_data[hpos];
|
||||
stair2_.target = rom_data[hpos];
|
||||
hpos++;
|
||||
stair3_.Target = rom_data[hpos];
|
||||
stair3_.target = rom_data[hpos];
|
||||
hpos++;
|
||||
stair4_.Target = rom_data[hpos];
|
||||
stair4_.target = rom_data[hpos];
|
||||
hpos++;
|
||||
|
||||
// Load room objects
|
||||
@@ -375,7 +375,7 @@ void Room::LoadObjects() {
|
||||
if (nbr_of_staircase < 4) {
|
||||
tile_objects_.back().set_options(ObjectOption::Stairs |
|
||||
tile_objects_.back().options());
|
||||
staircase_rooms_vec_.push_back(StaircaseRooms(
|
||||
staircase_rooms_vec_.push_back(z3_staircase(
|
||||
posX, posY,
|
||||
absl::StrCat("To ", staircase_rooms_[nbr_of_staircase])
|
||||
.data()));
|
||||
@@ -383,8 +383,7 @@ void Room::LoadObjects() {
|
||||
} else {
|
||||
tile_objects_.back().set_options(ObjectOption::Stairs |
|
||||
tile_objects_.back().options());
|
||||
staircase_rooms_vec_.push_back(
|
||||
StaircaseRooms(posX, posY, "To ???"));
|
||||
staircase_rooms_vec_.push_back(z3_staircase(posX, posY, "To ???"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -480,7 +479,7 @@ void Room::LoadChests() {
|
||||
}
|
||||
|
||||
chests_in_room_.emplace_back(
|
||||
ChestData(rom_data[cpos + (i * 3) + 2], big));
|
||||
z3_chest_data(rom_data[cpos + (i * 3) + 2], big));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,43 +86,6 @@ constexpr int NumberOfRooms = 296;
|
||||
|
||||
constexpr ushort stairsObjects[] = {0x139, 0x138, 0x13B, 0x12E, 0x12D};
|
||||
|
||||
class DungeonDestination {
|
||||
public:
|
||||
DungeonDestination() = default;
|
||||
~DungeonDestination() = default;
|
||||
DungeonDestination(uint8_t i) : Index(i) {}
|
||||
|
||||
uint8_t Index;
|
||||
uint8_t Target = 0;
|
||||
uint8_t TargetLayer = 0;
|
||||
};
|
||||
|
||||
struct Chest {
|
||||
uint8_t x = 0;
|
||||
uint8_t y = 0;
|
||||
uint8_t item = 0;
|
||||
bool picker = false;
|
||||
bool big_chest = false;
|
||||
};
|
||||
|
||||
struct ChestData {
|
||||
ChestData() = default;
|
||||
ChestData(uchar i, bool s) : id_(i), size_(s) {};
|
||||
|
||||
uchar id_;
|
||||
bool size_;
|
||||
};
|
||||
|
||||
struct StaircaseRooms {
|
||||
StaircaseRooms() = default;
|
||||
StaircaseRooms(uchar i, uchar r, const char *label)
|
||||
: id_(i), room_(r), label_(label) {};
|
||||
|
||||
uchar id_;
|
||||
uchar room_;
|
||||
const char *label_;
|
||||
};
|
||||
|
||||
class Room : public SharedRom {
|
||||
public:
|
||||
Room() = default;
|
||||
@@ -200,16 +163,16 @@ class Room : public SharedRom {
|
||||
|
||||
std::array<gfx::Bitmap, 3> background_bmps_;
|
||||
std::vector<zelda3::Sprite> sprites_;
|
||||
std::vector<StaircaseRooms> staircase_rooms_vec_;
|
||||
std::vector<z3_staircase> staircase_rooms_vec_;
|
||||
|
||||
Background2 bg2_;
|
||||
DungeonDestination pits_;
|
||||
DungeonDestination stair1_;
|
||||
DungeonDestination stair2_;
|
||||
DungeonDestination stair3_;
|
||||
DungeonDestination stair4_;
|
||||
z3_dungeon_destination pits_;
|
||||
z3_dungeon_destination stair1_;
|
||||
z3_dungeon_destination stair2_;
|
||||
z3_dungeon_destination stair3_;
|
||||
z3_dungeon_destination stair4_;
|
||||
|
||||
std::vector<ChestData> chests_in_room_;
|
||||
std::vector<z3_chest_data> chests_in_room_;
|
||||
std::vector<RoomObject> tile_objects_;
|
||||
|
||||
std::vector<int> room_addresses_;
|
||||
|
||||
@@ -7,17 +7,38 @@ extern "C" {
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct object_door {
|
||||
object_door() = default;
|
||||
object_door(short id, uint8_t x, uint8_t y, uint8_t size, uint8_t layer)
|
||||
: id_(id), x_(x), y_(y), size_(size), layer_(layer) {}
|
||||
struct z3_object_door {
|
||||
short id;
|
||||
uint8_t x;
|
||||
uint8_t y;
|
||||
uint8_t size;
|
||||
uint8_t type;
|
||||
uint8_t layer;
|
||||
};
|
||||
|
||||
short id_;
|
||||
uint8_t x_;
|
||||
uint8_t y_;
|
||||
uint8_t size_;
|
||||
uint8_t type_;
|
||||
uint8_t layer_;
|
||||
struct z3_dungeon_destination {
|
||||
uint8_t index;
|
||||
uint8_t target = 0;
|
||||
uint8_t target_layer = 0;
|
||||
};
|
||||
|
||||
struct z3_staircase {
|
||||
uint8_t id;
|
||||
uint8_t room;
|
||||
const char *label;
|
||||
};
|
||||
|
||||
struct z3_chest {
|
||||
uint8_t x = 0;
|
||||
uint8_t y = 0;
|
||||
uint8_t item = 0;
|
||||
bool picker = false;
|
||||
bool big_chest = false;
|
||||
};
|
||||
|
||||
struct z3_chest_data {
|
||||
uchar id;
|
||||
bool size;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user