Refactor OverworldMap: update ProcessGraphicsBuffer to accept graphics buffer as parameter
This commit is contained in:
@@ -672,9 +672,9 @@ absl::Status OverworldMap::LoadPalette() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OverworldMap::ProcessGraphicsBuffer(int index, int static_graphics_offset,
|
void OverworldMap::ProcessGraphicsBuffer(int index, int static_graphics_offset,
|
||||||
int size) {
|
int size, uint8_t *all_gfx) {
|
||||||
for (int i = 0; i < size; i++) {
|
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) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
case 3:
|
case 3:
|
||||||
@@ -688,13 +688,11 @@ void OverworldMap::ProcessGraphicsBuffer(int index, int static_graphics_offset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
absl::Status OverworldMap::BuildTileset() {
|
absl::Status OverworldMap::BuildTileset() {
|
||||||
all_gfx_ = rom_.graphics_buffer();
|
|
||||||
if (current_gfx_.size() == 0) current_gfx_.resize(0x10000, 0x00);
|
if (current_gfx_.size() == 0) current_gfx_.resize(0x10000, 0x00);
|
||||||
|
|
||||||
for (int i = 0; i < 0x10; i++) {
|
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();
|
return absl::OkStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class OverworldMap : public gfx::GfxContext {
|
|||||||
auto static_graphics(int i) const { return static_graphics_[i]; }
|
auto static_graphics(int i) const { return static_graphics_[i]; }
|
||||||
auto large_index() const { return large_index_; }
|
auto large_index() const { return large_index_; }
|
||||||
|
|
||||||
auto mutable_current_graphics() { return ¤t_gfx_; }
|
auto mutable_current_graphics() { return ¤t_gfx_; }
|
||||||
auto mutable_area_graphics() { return &area_graphics_; }
|
auto mutable_area_graphics() { return &area_graphics_; }
|
||||||
auto mutable_area_palette() { return &area_palette_; }
|
auto mutable_area_palette() { return &area_palette_; }
|
||||||
auto mutable_sprite_graphics(int i) { return &sprite_graphics_[i]; }
|
auto mutable_sprite_graphics(int i) { return &sprite_graphics_[i]; }
|
||||||
@@ -161,7 +161,8 @@ class OverworldMap : public gfx::GfxContext {
|
|||||||
void LoadAreaGraphicsBlocksets();
|
void LoadAreaGraphicsBlocksets();
|
||||||
void LoadDeathMountainGFX();
|
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,
|
absl::StatusOr<gfx::SnesPalette> GetPalette(const gfx::PaletteGroup& group,
|
||||||
int index, int previous_index,
|
int index, int previous_index,
|
||||||
int limit);
|
int limit);
|
||||||
@@ -192,7 +193,6 @@ class OverworldMap : public gfx::GfxContext {
|
|||||||
std::array<uint8_t, 4> area_music_;
|
std::array<uint8_t, 4> area_music_;
|
||||||
std::array<uint8_t, 16> static_graphics_;
|
std::array<uint8_t, 16> static_graphics_;
|
||||||
|
|
||||||
std::vector<uint8_t> all_gfx_;
|
|
||||||
std::vector<uint8_t> current_blockset_;
|
std::vector<uint8_t> current_blockset_;
|
||||||
std::vector<uint8_t> current_gfx_;
|
std::vector<uint8_t> current_gfx_;
|
||||||
std::vector<uint8_t> bitmap_data_;
|
std::vector<uint8_t> bitmap_data_;
|
||||||
|
|||||||
Reference in New Issue
Block a user