Refactor OverworldMap: update ProcessGraphicsBuffer to accept graphics buffer as parameter

This commit is contained in:
scawful
2025-04-05 13:46:42 -04:00
parent 26fc39dad0
commit a76fbe1c8c
2 changed files with 7 additions and 9 deletions

View File

@@ -672,9 +672,9 @@ absl::Status OverworldMap::LoadPalette() {
}
void OverworldMap::ProcessGraphicsBuffer(int index, int static_graphics_offset,
int size) {
int size, uint8_t *all_gfx) {
for (int i = 0; i < size; i++) {
auto byte = all_gfx_[i + (static_graphics_offset * size)];
auto byte = all_gfx[i + (static_graphics_offset * size)];
switch (index) {
case 0:
case 3:
@@ -688,13 +688,11 @@ void OverworldMap::ProcessGraphicsBuffer(int index, int static_graphics_offset,
}
absl::Status OverworldMap::BuildTileset() {
all_gfx_ = rom_.graphics_buffer();
if (current_gfx_.size() == 0) current_gfx_.resize(0x10000, 0x00);
for (int i = 0; i < 0x10; i++) {
ProcessGraphicsBuffer(i, static_graphics_[i], 0x1000);
ProcessGraphicsBuffer(i, static_graphics_[i], 0x1000,
rom_.graphics_buffer().data());
}
return absl::OkStatus();
}

View File

@@ -110,7 +110,7 @@ class OverworldMap : public gfx::GfxContext {
auto static_graphics(int i) const { return static_graphics_[i]; }
auto large_index() const { return large_index_; }
auto mutable_current_graphics() { return &current_gfx_; }
auto mutable_current_graphics() { return &current_gfx_; }
auto mutable_area_graphics() { return &area_graphics_; }
auto mutable_area_palette() { return &area_palette_; }
auto mutable_sprite_graphics(int i) { return &sprite_graphics_[i]; }
@@ -161,7 +161,8 @@ class OverworldMap : public gfx::GfxContext {
void LoadAreaGraphicsBlocksets();
void LoadDeathMountainGFX();
void ProcessGraphicsBuffer(int index, int static_graphics_offset, int size);
void ProcessGraphicsBuffer(int index, int static_graphics_offset, int size,
uint8_t* all_gfx);
absl::StatusOr<gfx::SnesPalette> GetPalette(const gfx::PaletteGroup& group,
int index, int previous_index,
int limit);
@@ -192,7 +193,6 @@ class OverworldMap : public gfx::GfxContext {
std::array<uint8_t, 4> area_music_;
std::array<uint8_t, 16> static_graphics_;
std::vector<uint8_t> all_gfx_;
std::vector<uint8_t> current_blockset_;
std::vector<uint8_t> current_gfx_;
std::vector<uint8_t> bitmap_data_;