cleanup sprite pal and overworld editor

This commit is contained in:
scawful
2024-07-22 19:26:15 -04:00
parent b887771593
commit 90933517c4
6 changed files with 77 additions and 96 deletions

View File

@@ -335,79 +335,59 @@ void DungeonEditor::DrawRoomSelector() {
}
}
using ImGui::Separator;
void DungeonEditor::DrawEntranceSelector() {
if (rom()->is_loaded()) {
gui::InputHexWord("Entrance ID",
&entrances_[current_entrance_id_].entrance_id_);
gui::InputHexWord("Room ID", &entrances_[current_entrance_id_].room_, 50.f,
true);
SameLine();
gui::InputHexByte("Dungeon ID",
&entrances_[current_entrance_id_].dungeon_id_, 50.f,
true);
gui::InputHexByte("Blockset", &entrances_[current_entrance_id_].blockset_,
50.f, true);
auto current_entrance = entrances_[current_entrance_id_];
gui::InputHexWord("Entrance ID", &current_entrance.entrance_id_);
gui::InputHexWord("Room ID", &current_entrance.room_, 50.f, true);
SameLine();
gui::InputHexByte("Music", &entrances_[current_entrance_id_].music_, 50.f,
true);
gui::InputHexByte("Dungeon ID", &current_entrance.dungeon_id_, 50.f, true);
gui::InputHexByte("Blockset", &current_entrance.blockset_, 50.f, true);
SameLine();
gui::InputHexByte("Floor", &entrances_[current_entrance_id_].floor_);
ImGui::Separator();
gui::InputHexWord("Player X ",
&entrances_[current_entrance_id_].x_position_);
gui::InputHexByte("Music", &current_entrance.music_, 50.f, true);
SameLine();
gui::InputHexWord("Player Y ",
&entrances_[current_entrance_id_].y_position_);
gui::InputHexByte("Floor", &current_entrance.floor_);
Separator();
gui::InputHexWord("Camera X",
&entrances_[current_entrance_id_].camera_trigger_x_);
gui::InputHexWord("Player X ", &current_entrance.x_position_);
SameLine();
gui::InputHexWord("Camera Y",
&entrances_[current_entrance_id_].camera_trigger_y_);
gui::InputHexWord("Player Y ", &current_entrance.y_position_);
gui::InputHexWord("Scroll X ",
&entrances_[current_entrance_id_].camera_x_);
gui::InputHexWord("Camera X", &current_entrance.camera_trigger_x_);
SameLine();
gui::InputHexWord("Scroll Y ",
&entrances_[current_entrance_id_].camera_y_);
gui::InputHexWord("Camera Y", &current_entrance.camera_trigger_y_);
gui::InputHexWord("Exit", &entrances_[current_entrance_id_].exit_, 50.f,
true);
gui::InputHexWord("Scroll X ", &current_entrance.camera_x_);
SameLine();
gui::InputHexWord("Scroll Y ", &current_entrance.camera_y_);
ImGui::Separator();
gui::InputHexWord("Exit", &current_entrance.exit_, 50.f, true);
Separator();
Text("Camera Boundaries");
ImGui::Separator();
Separator();
Text("\t\t\t\t\tNorth East South West");
gui::InputHexByte("Quadrant",
&entrances_[current_entrance_id_].camera_boundary_qn_,
50.f, true);
gui::InputHexByte("Quadrant", &current_entrance.camera_boundary_qn_, 50.f,
true);
SameLine();
gui::InputHexByte("", &entrances_[current_entrance_id_].camera_boundary_qe_,
50.f, true);
gui::InputHexByte("", &current_entrance.camera_boundary_qe_, 50.f, true);
SameLine();
gui::InputHexByte("", &entrances_[current_entrance_id_].camera_boundary_qs_,
50.f, true);
gui::InputHexByte("", &current_entrance.camera_boundary_qs_, 50.f, true);
SameLine();
gui::InputHexByte("", &entrances_[current_entrance_id_].camera_boundary_qw_,
50.f, true);
gui::InputHexByte("", &current_entrance.camera_boundary_qw_, 50.f, true);
gui::InputHexByte("Full room",
&entrances_[current_entrance_id_].camera_boundary_fn_,
50.f, true);
gui::InputHexByte("Full room", &current_entrance.camera_boundary_fn_, 50.f,
true);
SameLine();
gui::InputHexByte("", &entrances_[current_entrance_id_].camera_boundary_fe_,
50.f, true);
gui::InputHexByte("", &current_entrance.camera_boundary_fe_, 50.f, true);
SameLine();
gui::InputHexByte("", &entrances_[current_entrance_id_].camera_boundary_fs_,
50.f, true);
gui::InputHexByte("", &current_entrance.camera_boundary_fs_, 50.f, true);
SameLine();
gui::InputHexByte("", &entrances_[current_entrance_id_].camera_boundary_fw_,
50.f, true);
gui::InputHexByte("", &current_entrance.camera_boundary_fw_, 50.f, true);
if (BeginChild("EntranceSelector", ImVec2(0, 0), true,
ImGuiWindowFlags_AlwaysVerticalScrollbar)) {
@@ -465,7 +445,7 @@ void DungeonEditor::DrawDungeonTabView() {
EndTabBar();
}
ImGui::Separator();
Separator();
}
void DungeonEditor::DrawDungeonCanvas(int room_id) {
@@ -504,7 +484,8 @@ void DungeonEditor::DrawDungeonCanvas(int room_id) {
void DungeonEditor::DrawRoomGraphics() {
const auto height = 0x40;
room_gfx_canvas_.DrawBackground(ImVec2(0x100 + 1, 0x10 * 0x40 + 1));
const int num_sheets = 0x10;
room_gfx_canvas_.DrawBackground(ImVec2(0x100 + 1, num_sheets * height + 1));
room_gfx_canvas_.DrawContextMenu();
room_gfx_canvas_.DrawTileSelector(32);
if (is_loaded_) {

View File

@@ -376,7 +376,6 @@ bool DrawItemEditorPopup(zelda3::overworld::OverworldItem &item) {
const ImGuiTableSortSpecs *SpriteItem::s_current_sort_specs = nullptr;
void DrawSpriteTable(std::function<void(int)> onSpriteSelect) {
static ImGuiTextFilter filter;
static int selected_id = 0;
@@ -432,8 +431,7 @@ void DrawSpriteInserterPopup() {
Text("Add Sprite");
BeginChild("ScrollRegion", ImVec2(250, 250), true,
ImGuiWindowFlags_AlwaysVerticalScrollbar);
DrawSpriteTable(
[](int selected_id) { new_sprite_id = selected_id; });
DrawSpriteTable([](int selected_id) { new_sprite_id = selected_id; });
EndChild();
if (Button(ICON_MD_DONE)) {
@@ -461,7 +459,7 @@ bool DrawSpriteEditorPopup(zelda3::Sprite &sprite) {
BeginChild("ScrollRegion", ImVec2(350, 350), true,
ImGuiWindowFlags_AlwaysVerticalScrollbar);
ImGui::BeginGroup();
Text("%s", sprite.Name().c_str());
Text("%s", sprite.name().c_str());
DrawSpriteTable([&sprite](int selected_id) {
sprite.set_id(selected_id);
@@ -487,7 +485,6 @@ bool DrawSpriteEditorPopup(zelda3::Sprite &sprite) {
return set_done;
}
} // namespace editor
} // namespace app
} // namespace yaze

View File

@@ -947,7 +947,7 @@ void OverworldEditor::DrawOverworldSprites() {
}
}
ow_map_canvas_.DrawText(absl::StrFormat("%s", sprite.Name()), map_x,
ow_map_canvas_.DrawText(absl::StrFormat("%s", sprite.name()), map_x,
map_y);
}
i++;
@@ -1028,9 +1028,9 @@ absl::Status OverworldEditor::LoadGraphics() {
maps_bmp_[i], palette));
}
// if (flags()->overworld.kDrawOverworldSprites) {
// RETURN_IF_ERROR(LoadSpriteGraphics());
// }
if (flags()->overworld.kDrawOverworldSprites) {
RETURN_IF_ERROR(LoadSpriteGraphics());
}
return absl::OkStatus();
}

View File

@@ -25,8 +25,8 @@ struct OamTile {
bool s, uint8_t p)
: x(x),
y(y),
mirrorX(mx),
mirrorY(my),
mirror_x(mx),
mirror_y(my),
id(id),
palette(pal),
size(s),
@@ -34,8 +34,8 @@ struct OamTile {
uint8_t x;
uint8_t y;
bool mirrorX;
bool mirrorY;
bool mirror_x;
bool mirror_y;
uint16_t id;
uint8_t palette;
bool size;
@@ -254,12 +254,12 @@ struct ZSprite {
fs.write(
reinterpret_cast<const char*>(&editor.Frames[i].Tiles[j].palette),
sizeof(uint8_t));
fs.write(
reinterpret_cast<const char*>(&editor.Frames[i].Tiles[j].mirrorX),
sizeof(bool));
fs.write(
reinterpret_cast<const char*>(&editor.Frames[i].Tiles[j].mirrorY),
sizeof(bool));
fs.write(reinterpret_cast<const char*>(
&editor.Frames[i].Tiles[j].mirror_x),
sizeof(bool));
fs.write(reinterpret_cast<const char*>(
&editor.Frames[i].Tiles[j].mirror_y),
sizeof(bool));
fs.write(reinterpret_cast<const char*>(
&editor.Frames[i].Tiles[j].priority),
sizeof(uint8_t));

View File

@@ -372,7 +372,6 @@ class OverworldEntrance : public OverworldEntity {
constexpr int kCompressedAllMap32PointersHigh = 0x1794D;
constexpr int kCompressedAllMap32PointersLow = 0x17B2D;
constexpr int overworldgfxGroups = 0x05D97;
constexpr int overworldPalGroup1 = 0xDE6C8;
constexpr int overworldPalGroup2 = 0xDE86C;
constexpr int overworldPalGroup3 = 0xDE604;
@@ -433,33 +432,37 @@ constexpr int transition_target_west = 0x13F62;
constexpr int overworldCustomMosaicASM = 0x1301D0;
constexpr int overworldCustomMosaicArray = 0x1301F0;
constexpr int OverworldCustomASMHasBeenApplied =
0x140145; // 1 byte, not 0 if enabled
// 1 byte, not 0 if enabled
constexpr int OverworldCustomASMHasBeenApplied = 0x140145;
constexpr int OverworldCustomAreaSpecificBGPalette =
0x140000; // 2 bytes for each overworld area (0x140)
constexpr int OverworldCustomAreaSpecificBGEnabled =
0x140140; // 1 byte, not 0 if enabled
// 2 bytes for each overworld area (0x140)
constexpr int OverworldCustomAreaSpecificBGPalette = 0x140000;
constexpr int OverworldCustomMainPaletteArray =
0x140160; // 1 byte for each overworld area (0xA0)
constexpr int OverworldCustomMainPaletteEnabled =
0x140141; // 1 byte, not 0 if enabled
// 1 byte, not 0 if enabled
constexpr int OverworldCustomAreaSpecificBGEnabled = 0x140140;
constexpr int OverworldCustomMosaicArray =
0x140200; // 1 byte for each overworld area (0xA0)
constexpr int OverworldCustomMosaicEnabled =
0x140142; // 1 byte, not 0 if enabled
// 1 byte for each overworld area (0xA0)
constexpr int OverworldCustomMainPaletteArray = 0x140160;
// 1 byte, not 0 if enabled
constexpr int OverworldCustomMainPaletteEnabled = 0x140141;
constexpr int OverworldCustomAnimatedGFXArray =
0x1402A0; // 1 byte for each overworld area (0xA0)
constexpr int OverworldCustomAnimatedGFXEnabled =
0x140143; // 1 byte, not 0 if enabled
// 1 byte for each overworld area (0xA0)
constexpr int OverworldCustomMosaicArray = 0x140200;
constexpr int OverworldCustomSubscreenOverlayArray =
0x140340; // 2 bytes for each overworld area (0x140)
constexpr int OverworldCustomSubscreenOverlayEnabled =
0x140144; // 1 byte, not 0 if enabled
// 1 byte, not 0 if enabled
constexpr int OverworldCustomMosaicEnabled = 0x140142;
// 1 byte for each overworld area (0xA0)
constexpr int OverworldCustomAnimatedGFXArray = 0x1402A0;
// 1 byte, not 0 if enabled
constexpr int OverworldCustomAnimatedGFXEnabled = 0x140143;
// 2 bytes for each overworld area (0x140)
constexpr int OverworldCustomSubscreenOverlayArray = 0x140340;
// 1 byte, not 0 if enabled
constexpr int OverworldCustomSubscreenOverlayEnabled = 0x140144;
constexpr int kMap16Tiles = 0x78000;
constexpr int kNumOverworldMaps = 160;

View File

@@ -59,7 +59,7 @@ class Sprite : public OverworldEntity {
auto Width() const { return bounding_box_.w; }
auto Height() const { return bounding_box_.h; }
std::string& Name() { return name_; }
auto name() { return name_; }
auto deleted() const { return deleted_; }
auto set_deleted(bool deleted) { deleted_ = deleted; }