Refactor DungeonEditor::RefreshGraphics for improved readability and consistency
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/dungeon/object_names.h"
|
||||
#include "imgui/imgui.h"
|
||||
#include "imgui_memory_editor.h"
|
||||
#include "zelda3/dungeon/room.h"
|
||||
|
||||
namespace yaze {
|
||||
@@ -117,36 +118,24 @@ absl::Status DungeonEditor::Initialize() {
|
||||
}
|
||||
|
||||
absl::Status DungeonEditor::RefreshGraphics() {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
int block = rooms_[current_room_id_].blocks()[i];
|
||||
RETURN_IF_ERROR(graphics_bin_[block].ApplyPaletteWithTransparent(
|
||||
current_palette_group_[current_palette_id_], 0));
|
||||
Renderer::GetInstance().UpdateBitmap(&graphics_bin_[block]);
|
||||
}
|
||||
std::for_each_n(rooms_[current_room_id_].blocks().begin(), 8,
|
||||
std::for_each_n(
|
||||
rooms_[current_room_id_].blocks().begin(), 8,
|
||||
[this](int block) -> absl::Status {
|
||||
RETURN_IF_ERROR(
|
||||
graphics_bin_[block].ApplyPaletteWithTransparent(
|
||||
RETURN_IF_ERROR(graphics_bin_[block].ApplyPaletteWithTransparent(
|
||||
current_palette_group_[current_palette_id_], 0));
|
||||
Renderer::GetInstance().UpdateBitmap(&graphics_bin_[block]);
|
||||
return absl::OkStatus();
|
||||
});
|
||||
|
||||
auto sprites_aux1_pal_group = rom()->palette_group().sprites_aux1;
|
||||
std::for_each_n(rooms_[current_room_id_].blocks().begin() + 8, 8,
|
||||
std::for_each_n(
|
||||
rooms_[current_room_id_].blocks().begin() + 8, 8,
|
||||
[this, &sprites_aux1_pal_group](int block) -> absl::Status {
|
||||
RETURN_IF_ERROR(
|
||||
graphics_bin_[block].ApplyPaletteWithTransparent(
|
||||
RETURN_IF_ERROR(graphics_bin_[block].ApplyPaletteWithTransparent(
|
||||
sprites_aux1_pal_group[current_palette_id_], 0));
|
||||
Renderer::GetInstance().UpdateBitmap(&graphics_bin_[block]);
|
||||
return absl::OkStatus();
|
||||
});
|
||||
for (int i = 9; i < 16; i++) {
|
||||
int block = rooms_[current_room_id_].blocks()[i];
|
||||
RETURN_IF_ERROR(graphics_bin_[block].ApplyPaletteWithTransparent(
|
||||
sprites_aux1_pal_group[current_palette_id_], 0));
|
||||
Renderer::GetInstance().UpdateBitmap(&graphics_bin_[block]);
|
||||
}
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user