1#ifndef YAZE_APP_EDITOR_DUNGEON_PANELS_DUNGEON_ENTRANCES_PANEL_H_
2#define YAZE_APP_EDITOR_DUNGEON_PANELS_DUNGEON_ENTRANCES_PANEL_H_
14#include "imgui/imgui.h"
35 std::array<zelda3::RoomEntrance, zelda3::kNumDungeonEntranceSlots>*
37 std::array<zelda3::DungeonSpawnPoint, zelda3::kNumDungeonSpawnPoints>*
39 int* current_entrance_id, std::function<
void(
int)> on_entrance_selected)
49 std::string
GetId()
const override {
return "dungeon.entrance_properties"; }
50 std::string
GetDisplayName()
const override {
return "Entrance Properties"; }
59 void Draw(
bool* p_open)
override {
83 if (ImGui::BeginChild(
"##EntrancesList", ImVec2(0, 0),
true,
84 ImGuiWindowFlags_AlwaysVerticalScrollbar)) {
85 for (
int i = 0; i < kTotalEntries; i++) {
86 std::string entrance_name;
87 if (i < kNumSpawnPoints) {
90 snprintf(buf,
sizeof(buf),
"Spawn Point %d", i);
94 int entrance_id = i - kNumSpawnPoints;
95 if (entrance_id < kNumEntrances) {
100 snprintf(buf,
sizeof(buf),
"Unknown %d", i);
105 const int room_id = i < kNumSpawnPoints ? (*spawn_points_)[i].room_id
106 : (*entrances_)[i].room_;
111 snprintf(label,
sizeof(label),
"[%02X] %s -> %s (%03X)", i,
112 entrance_name.c_str(), room_name.c_str(), room_id);
115 if (ImGui::Selectable(label, is_selected)) {
128 auto& spawn = (*spawn_points_)[slot_index];
129 const bool properties_editable =
131 bool changed =
false;
133 ImGui::Text(tr(
"Spawn Point %d"), slot_index);
134 if (!properties_editable) {
135 ImGui::TextWrapped(tr(
136 "Spawn point data is unavailable; reload the ROM before editing."));
138 ImGui::BeginDisabled(!properties_editable);
166 &spawn.overworld_door_tilemap, 70.f,
true);
174 &spawn.camera_scroll_controller, 50.f,
true);
177 ImGui::Text(tr(
"Camera Boundaries"));
179 ImGui::Text(tr(
"\t\t\t\t\tNorth East South West"));
183 &spawn.camera_scroll_boundaries[0], 50.f,
true);
186 "##SpawnQE", &spawn.camera_scroll_boundaries[6], 50.f,
true);
189 "##SpawnQS", &spawn.camera_scroll_boundaries[2], 50.f,
true);
192 "##SpawnQW", &spawn.camera_scroll_boundaries[4], 50.f,
true);
195 "Full room", &spawn.camera_scroll_boundaries[1], 50.f,
true);
198 "##SpawnFE", &spawn.camera_scroll_boundaries[7], 50.f,
true);
201 "##SpawnFS", &spawn.camera_scroll_boundaries[3], 50.f,
true);
204 "##SpawnFW", &spawn.camera_scroll_boundaries[5], 50.f,
true);
205 ImGui::EndDisabled();
211 auto& entrance = (*entrances_)[slot_index];
212 const bool properties_editable =
214 bool changed =
false;
216 ImGui::Text(tr(
"Entrance ID: %04X"), entrance.entrance_id_);
217 ImGui::BeginDisabled(!properties_editable);
246 ImGui::Text(tr(
"Camera Boundaries"));
248 ImGui::Text(tr(
"\t\t\t\t\tNorth East South West"));
273 ImGui::EndDisabled();
278 std::array<zelda3::RoomEntrance, zelda3::kNumDungeonEntranceSlots>*
280 std::array<zelda3::DungeonSpawnPoint, zelda3::kNumDungeonSpawnPoints>*
WindowContent for displaying and editing dungeon entrances.
DungeonEntrancesPanel(std::array< zelda3::RoomEntrance, zelda3::kNumDungeonEntranceSlots > *entrances, std::array< zelda3::DungeonSpawnPoint, zelda3::kNumDungeonSpawnPoints > *spawn_points, int *current_entrance_id, std::function< void(int)> on_entrance_selected)
void DrawSpawnPointProperties(int slot_index)
void Draw(bool *p_open) override
Draw the panel content.
std::function< void(int)> on_entrance_selected_
int GetPriority() const override
Get display priority for menu ordering.
std::array< zelda3::DungeonSpawnPoint, zelda3::kNumDungeonSpawnPoints > * spawn_points_
std::string GetDisplayName() const override
Human-readable name shown in menus and title bars.
int * current_entrance_id_
std::array< zelda3::RoomEntrance, zelda3::kNumDungeonEntranceSlots > * entrances_
std::string GetEditorCategory() const override
Editor category this panel belongs to.
std::string GetId() const override
Unique identifier for this panel.
std::string GetIcon() const override
Material Design icon for this panel.
void DrawRegularEntranceProperties(int slot_index)
Base interface for all logical window content components.
bool CanEditDungeonEntrance(int slot_index, const zelda3::RoomEntrance &entrance)
bool CanEditDungeonSpawnPoint(int slot_index, const zelda3::DungeonSpawnPoint &spawn)
bool MarkDungeonEntranceDirtyIfEditable(int slot_index, zelda3::RoomEntrance &entrance, bool properties_changed)
bool MarkDungeonSpawnPointDirtyIfEditable(int slot_index, zelda3::DungeonSpawnPoint &spawn, bool properties_changed)
bool InputHexWord(const char *label, uint16_t *data, float input_width, bool no_step)
bool InputHexByte(const char *label, uint8_t *data, float input_width, bool no_step)
std::string GetEntranceLabel(int id)
Convenience function to get an entrance label.
std::string GetRoomLabel(int id)
Convenience function to get a room label.
constexpr int kNumRegularDungeonEntrances
constexpr int kNumDungeonSpawnPoints
constexpr int kNumDungeonEntranceSlots