13using ImGui::BeginTable;
14using ImGui::TableNextColumn;
20 bool scratch_has_data,
Rom* rom,
22 if (!overworld || !overworld->
is_loaded() || !window_manager)
26 {{ImGuiStyleVar_FramePadding, ImVec2(6.0f, 5.0f)},
27 {ImGuiStyleVar_CellPadding, ImVec2(6.0f, 5.0f)}});
30 if (BeginTable(
"CanvasToolbar", 8,
31 ImGuiTableFlags_Borders | ImGuiTableFlags_SizingStretchProp,
33 ImGui::TableSetupColumn(
"World", ImGuiTableColumnFlags_WidthFixed,
35 ImGui::TableSetupColumn(
"Map", ImGuiTableColumnFlags_WidthFixed,
37 ImGui::TableSetupColumn(
"Area Size", ImGuiTableColumnFlags_WidthFixed,
39 ImGui::TableSetupColumn(
"Lock", ImGuiTableColumnFlags_WidthFixed,
41 ImGui::TableSetupColumn(
"Mode", ImGuiTableColumnFlags_WidthFixed,
43 ImGui::TableSetupColumn(
"Context", ImGuiTableColumnFlags_WidthStretch);
44 ImGui::TableSetupColumn(
"Panels", ImGuiTableColumnFlags_WidthStretch);
45 ImGui::TableSetupColumn(
"Sidebar", ImGuiTableColumnFlags_WidthFixed, 44.0f);
49 int selected_world = current_world;
50 if (ImGui::Combo(
"##world", &selected_world,
kWorldNames, 3)) {
51 current_world = selected_world;
55 current_map = selected_world * 0x40 + (current_map & 0x3F);
60 ImGui::Text(
"%d (0x%02X)", current_map, current_map);
67 int current_area_size =
68 static_cast<int>(overworld->
overworld_map(current_map)->area_size());
73 if (ImGui::Combo(
"##AreaSize", ¤t_area_size,
kAreaSizeNames, 4)) {
85 const char* limited_names[] = {
"Small (1x1)",
"Large (2x2)"};
86 int limited_size = (current_area_size == 0 || current_area_size == 1)
90 if (ImGui::Combo(
"##AreaSize", &limited_size, limited_names, 2)) {
105 HOVER_HINT(
"Small (1x1) and Large (2x2) maps. Wide/Tall require v3+");
112 current_map_lock ?
"Unlock Map" :
"Lock Map")) {
113 current_map_lock = !current_map_lock;
121 "Mouse Mode (1)\nNavigate, pan, and manage entities",
126 ImGui::SameLine(0, 2);
129 "Brush Mode (2/B)\nDraw tiles on the map\nRight-click or I to "
130 "sample tile16 under cursor",
135 ImGui::SameLine(0, 2);
138 "Fill Screen Mode (F)\nFill the 32x32 screen under the cursor "
139 "with the selected tile\nRight-click or I to sample tile16 under "
150 const float context_width = ImGui::GetContentRegionAvail().x;
151 const bool show_map_summary = map !=
nullptr && context_width >= 188.0f;
152 const bool show_overlay_toggle = context_width >= 132.0f;
155 const char* entity_icon =
"";
156 const char* entity_label =
"";
157 switch (entity_edit_mode) {
160 entity_label =
"Entrances";
164 entity_label =
"Exits";
168 entity_label =
"Items";
172 entity_label =
"Sprites";
176 entity_label =
"Transports";
180 entity_label =
"Music";
185 ImGui::TextColored(theme.selection_secondary,
"%s %s", entity_icon,
189 const char* version_label =
"Vanilla";
190 ImVec4 version_color = theme.status_inactive;
191 bool show_upgrade =
false;
193 switch (rom_version) {
195 version_label =
"Vanilla";
196 version_color = theme.text_warning_yellow;
200 version_label =
"ZSC v1";
201 version_color = theme.status_active;
204 version_label =
"ZSC v2";
205 version_color = theme.status_active;
208 version_label =
"ZSC v3";
209 version_color = theme.status_success;
215 ImGui::TextColored(version_color,
ICON_MD_INFO " %s", version_label);
216 if (ImGui::IsItemHovered()) {
218 "ROM version determines available overworld features.\n"
219 "v2+: Custom BG colors, main palettes\n"
220 "v3+: Wide/Tall maps, custom tile GFX, animated GFX");
229 "Upgrade ROM to ZSCustomOverworld v3\n"
230 "Enables all advanced features");
234 if (show_map_summary) {
235 ImGui::TextDisabled(
"Parent %02X Pal %02X Msg %04X", map->
parent(),
242 overlay_preview_enabled ?
"Hide overlay preview"
243 :
"Show overlay preview",
244 overlay_preview_enabled)) {
252 const float panel_width = ImGui::GetContentRegionAvail().x;
253 const bool compact_panel_controls = panel_width < 320.0f;
254 const auto toggle_window = [&](
const char* panel_id) {
257 const auto popup_toggle_item =
258 [&](
const char* label,
const char* panel_id,
const char* shortcut =
nullptr) {
259 const bool open = window_manager->
IsWindowOpen(panel_id);
260 if (ImGui::MenuItem(label, shortcut, open)) {
261 toggle_window(panel_id);
268 if (compact_panel_controls) {
270 "Overworld Windows\nOpen panel toggle menu")) {
271 ImGui::OpenPopup(
"OverworldWindowsPopup");
274 if (ImGui::BeginPopup(
"OverworldWindowsPopup")) {
284 popup_toggle_item(
"Scratch Workspace",
334 "Overworld Item List (Ctrl+Shift+I)\nFilter/select items and use "
335 "duplicate/nudge shortcuts",
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Central registry for all editor cards with session awareness and dependency injection.
size_t GetActiveSessionId() const
bool IsWindowOpen(size_t session_id, const std::string &base_window_id) const
bool ToggleWindow(size_t session_id, const std::string &base_window_id)
RAII guard for ImGui style vars.
Represents a single Overworld map screen.
auto area_palette() const
static OverworldVersion GetVersion(const Rom &rom)
Detect ROM version from ASM marker byte.
static bool SupportsAreaEnum(OverworldVersion version)
Check if ROM supports area enum system (v3+ only)
Represents the full Overworld data, light and dark world.
auto overworld_map(int i) const
absl::Status ConfigureMultiAreaMap(int parent_index, AreaSizeEnum size)
Configure a multi-area map structure (Large/Wide/Tall)
#define ICON_MD_GRID_VIEW
#define ICON_MD_LOCK_OPEN
#define ICON_MD_VISIBILITY
#define ICON_MD_FORMAT_COLOR_FILL
#define ICON_MD_DOOR_BACK
#define ICON_MD_AUTO_FIX_HIGH
#define ICON_MD_MUSIC_NOTE
#define ICON_MD_DOOR_FRONT
#define ICON_MD_ADD_LOCATION
#define ICON_MD_PEST_CONTROL_RODENT
#define ICON_MD_ANALYTICS
#define HOVER_HINT(string)
const AgentUITheme & GetTheme()
Editors are the view controllers for the application.
constexpr const char * kAreaSizeNames[]
constexpr float kTableColumnWorld
constexpr const char * kWorldNames[]
constexpr float kComboWorldWidth
constexpr float kTableColumnMap
constexpr float kTableColumnAreaSize
constexpr float kComboAreaSizeWidth
constexpr float kTableColumnLock
bool PrimaryButton(const char *label, const ImVec2 &size, const char *panel_id, const char *anim_id)
Draw a primary action button (accented color).
bool ToolbarIconButton(const char *icon, const char *tooltip, bool is_active)
Convenience wrapper for toolbar-sized icon buttons.
AreaSizeEnum
Area size enumeration for v3+ ROMs.
@ kZSCustomV2
Parent system, BG colors, main palettes.
@ kZSCustomV1
Basic features, expanded pointers.
@ kVanilla
0xFF in ROM, no ZScream ASM applied
@ kZSCustomV3
Area enum, wide/tall areas, all features.
static constexpr const char * kMapProperties
static constexpr const char * kTile8Selector
static constexpr const char * kAreaGraphics
static constexpr const char * kItemList
static constexpr const char * kScratchSpace
static constexpr const char * kTile16Editor
static constexpr const char * kTile16Selector
static constexpr const char * kGfxGroups
static constexpr const char * kUsageStats