Refactor ROM handling and update Overworld methods

Updated MessageEditor, RoomEntrance, and Overworld classes to use WriteByte instead of Write for byte values. Refactored ROM class by removing Write and toint16 methods, moving constants, and updating operator[]. Modified Overworld methods to return absl::Status and handle errors. Updated Inventory and OverworldMap methods to use ReadWord instead of toint16.
This commit is contained in:
Justin Scofield
2025-01-05 21:19:53 -05:00
parent 510581ad1f
commit 88198323b3
8 changed files with 116 additions and 116 deletions

View File

@@ -71,7 +71,13 @@ void OverworldMap::LoadAreaInfo() {
}
}
message_id_ = rom_.toint16(kOverworldMessageIds + (parent_ * 2));
auto message_id = rom_.ReadWord(kOverworldMessageIds + (parent_ * 2));
if (message_id.ok()) {
message_id_ = message_id.value();
} else {
message_id_ = 0;
core::logf("Error reading message id for map %d", parent_);
}
if (index_ < kDarkWorldMapIdStart) {
area_graphics_ = rom_[kAreaGfxIdPtr + parent_];