Enhance Overworld Editor and Map Properties System
- Updated the DrawOverworldEntrancePopup to include new options for deleting entrances and improved UI labels for better clarity. - Integrated new UI constants for consistent styling across the editor. - Refactored MapPropertiesSystem to support additional toolset functionalities, including editing tools and view controls. - Improved overlay handling in OverworldMap, consolidating vanilla and custom overlay loading logic. - Enhanced user interaction with new buttons and streamlined layout for better usability in the editor.
This commit is contained in:
@@ -126,50 +126,70 @@ bool DrawEntranceInserterPopup() {
|
||||
return set_done;
|
||||
}
|
||||
|
||||
// TODO: Implement deleting OverworldEntrance objects, currently only hides them
|
||||
bool DrawOverworldEntrancePopup(zelda3::OverworldEntrance &entrance) {
|
||||
static bool set_done = false;
|
||||
if (set_done) {
|
||||
set_done = false;
|
||||
return true;
|
||||
}
|
||||
if (ImGui::BeginPopupModal("Entrance editor", NULL,
|
||||
|
||||
if (ImGui::BeginPopupModal("Entrance Editor", NULL,
|
||||
ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||
ImGui::Text("Entrance ID: %d", entrance.entrance_id_);
|
||||
ImGui::Separator();
|
||||
|
||||
gui::InputHexWord("Map ID", &entrance.map_id_);
|
||||
gui::InputHexByte("Entrance ID", &entrance.entrance_id_,
|
||||
kInputFieldSize + 20);
|
||||
gui::InputHex("X", &entrance.x_);
|
||||
gui::InputHex("Y", &entrance.y_);
|
||||
|
||||
if (Button(ICON_MD_DONE)) {
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
SameLine();
|
||||
if (Button(ICON_MD_CANCEL)) {
|
||||
gui::InputHex("X Position", &entrance.x_);
|
||||
gui::InputHex("Y Position", &entrance.y_);
|
||||
|
||||
ImGui::Checkbox("Is Hole", &entrance.is_hole_);
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
if (Button("Save")) {
|
||||
set_done = true;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
SameLine();
|
||||
if (Button(ICON_MD_DELETE)) {
|
||||
ImGui::SameLine();
|
||||
if (Button("Delete")) {
|
||||
entrance.deleted = true;
|
||||
set_done = true;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (Button("Cancel")) {
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
return set_done;
|
||||
}
|
||||
|
||||
// TODO: Implement deleting OverworldExit objects
|
||||
void DrawExitInserterPopup() {
|
||||
if (ImGui::BeginPopup("Exit Inserter")) {
|
||||
static int exit_id = 0;
|
||||
static int room_id = 0;
|
||||
static int x_pos = 0;
|
||||
static int y_pos = 0;
|
||||
|
||||
ImGui::Text("Insert New Exit");
|
||||
ImGui::Separator();
|
||||
|
||||
gui::InputHex("Exit ID", &exit_id);
|
||||
gui::InputHex("Room ID", &room_id);
|
||||
gui::InputHex("X Position", &x_pos);
|
||||
gui::InputHex("Y Position", &y_pos);
|
||||
|
||||
if (Button(ICON_MD_DONE)) {
|
||||
if (Button("Create Exit")) {
|
||||
// This would need to be connected to the overworld editor to actually create the exit
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
||||
SameLine();
|
||||
if (Button(ICON_MD_CANCEL)) {
|
||||
if (Button("Cancel")) {
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
||||
@@ -424,30 +444,35 @@ void DrawSpriteTable(std::function<void(int)> onSpriteSelect) {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Implement deleting OverworldSprite objects
|
||||
void DrawSpriteInserterPopup() {
|
||||
if (ImGui::BeginPopup("Sprite Inserter")) {
|
||||
static int new_sprite_id = 0;
|
||||
Text("Add Sprite");
|
||||
BeginChild("ScrollRegion", ImVec2(250, 250), true,
|
||||
static int x_pos = 0;
|
||||
static int y_pos = 0;
|
||||
|
||||
ImGui::Text("Add New Sprite");
|
||||
ImGui::Separator();
|
||||
|
||||
BeginChild("ScrollRegion", ImVec2(250, 200), true,
|
||||
ImGuiWindowFlags_AlwaysVerticalScrollbar);
|
||||
DrawSpriteTable([](int selected_id) { new_sprite_id = selected_id; });
|
||||
EndChild();
|
||||
|
||||
ImGui::Separator();
|
||||
ImGui::Text("Position:");
|
||||
gui::InputHex("X Position", &x_pos);
|
||||
gui::InputHex("Y Position", &y_pos);
|
||||
|
||||
if (Button(ICON_MD_DONE)) {
|
||||
// Add the new item to the overworld
|
||||
if (Button("Add Sprite")) {
|
||||
// This would need to be connected to the overworld editor to actually create the sprite
|
||||
new_sprite_id = 0;
|
||||
x_pos = 0;
|
||||
y_pos = 0;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
SameLine();
|
||||
|
||||
if (Button(ICON_MD_DELETE)) {
|
||||
new_sprite_id = -1;
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
SameLine();
|
||||
|
||||
if (Button(ICON_MD_CANCEL)) {
|
||||
if (Button("Cancel")) {
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user