Add CalculateRoomSize to Room

This commit is contained in:
scawful
2025-01-02 08:37:48 -05:00
parent df67e6aaf7
commit 3cbcb61222
2 changed files with 5 additions and 4 deletions

View File

@@ -53,6 +53,10 @@ void Room::LoadHeader() {
staircase_rooms_[2] = (rom()->data()[header_location + 12]);
staircase_rooms_[3] = (rom()->data()[header_location + 13]);
CalculateRoomSize();
}
void Room::CalculateRoomSize() {
// Calculate the size of the room based on how many objects are used per room
// Some notes from hacker Zarby89
// vanilla rooms are using in average ~0x80 bytes
@@ -119,7 +123,6 @@ void Room::LoadHeader() {
}
void Room::LoadRoomFromROM() {
// Load dungeon header
auto rom_data = rom()->vector();
int header_pointer = core::SnesToPc(kRoomHeaderPointer);

View File

@@ -118,6 +118,7 @@ class Room : public SharedRom {
~Room() = default;
void LoadHeader();
void CalculateRoomSize();
void LoadRoomFromROM();
void LoadRoomGraphics(uchar entrance_blockset = 0xFF);
@@ -161,9 +162,6 @@ class Room : public SharedRom {
int room_id_;
int animated_frame_;
uchar tag1_;
uchar tag2_;
uint8_t staircase_plane_[4];
uint8_t staircase_rooms_[4];