refactor: Streamline Overworld Editor by Removing Legacy Functions
- Removed the DrawTileSelector function, transitioning to an individual card system for tile selection. - Eliminated unused functions related to custom background color and overlay editing, simplifying the codebase. - Updated header file to reflect the removal of obsolete methods and constants, enhancing clarity and maintainability. - Improved overall organization of the OverworldEditor class for better readability and performance.
This commit is contained in:
@@ -27,10 +27,8 @@
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/editor_layout.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "app/gui/input.h"
|
||||
#include "app/gui/style.h"
|
||||
#include "app/gui/ui_helpers.h"
|
||||
#include "app/gui/widgets/widget_id_registry.h"
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/common.h"
|
||||
#include "app/zelda3/overworld/overworld.h"
|
||||
@@ -1244,34 +1242,7 @@ absl::Status OverworldEditor::DrawAreaGraphics() {
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
absl::Status OverworldEditor::DrawTileSelector() {
|
||||
// Modern tabbed selector with icons
|
||||
if (BeginTabBar(kTileSelectorTab.data(),
|
||||
ImGuiTabBarFlags_FittingPolicyScroll)) {
|
||||
if (gui::EditorTabItem(ICON_MD_GRID_3X3, "Tile16")) {
|
||||
status_ = DrawTile16Selector();
|
||||
EndTabItem();
|
||||
}
|
||||
if (gui::EditorTabItem(ICON_MD_GRID_4X4, "Tile8")) {
|
||||
gui::BeginPadding(3);
|
||||
gui::BeginChildWithScrollbar("##Tile8SelectorScrollRegion");
|
||||
DrawTile8Selector();
|
||||
EndChild();
|
||||
gui::EndNoPadding();
|
||||
EndTabItem();
|
||||
}
|
||||
if (gui::EditorTabItem(ICON_MD_IMAGE, "Area GFX")) {
|
||||
status_ = DrawAreaGraphics();
|
||||
EndTabItem();
|
||||
}
|
||||
if (gui::EditorTabItem(ICON_MD_BRUSH, "Scratch")) {
|
||||
status_ = DrawScratchSpace();
|
||||
EndTabItem();
|
||||
}
|
||||
EndTabBar();
|
||||
}
|
||||
return absl::OkStatus();
|
||||
}
|
||||
// DrawTileSelector() removed - replaced by individual card system in Update()
|
||||
|
||||
void OverworldEditor::DrawOverworldEntrances(ImVec2 canvas_p0, ImVec2 scrolling) {
|
||||
int i = 0;
|
||||
@@ -2218,374 +2189,6 @@ absl::Status OverworldEditor::RefreshTile16Blockset() {
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
void OverworldEditor::DrawCustomBackgroundColorEditor() {
|
||||
static uint8_t asm_version =
|
||||
(*rom_)[zelda3::OverworldCustomASMHasBeenApplied];
|
||||
|
||||
if (asm_version < 2 || asm_version == 0xFF) {
|
||||
Text(
|
||||
"Custom background colors are only available in ZSCustomOverworld v2+");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if area-specific background colors are enabled
|
||||
bool bg_enabled =
|
||||
(*rom_)[zelda3::OverworldCustomAreaSpecificBGEnabled] != 0x00;
|
||||
if (Checkbox("Enable Area-Specific Background Colors", &bg_enabled)) {
|
||||
(*rom_)[zelda3::OverworldCustomAreaSpecificBGEnabled] =
|
||||
bg_enabled ? 0x01 : 0x00;
|
||||
}
|
||||
|
||||
if (!bg_enabled) {
|
||||
Text("Area-specific background colors are disabled.");
|
||||
return;
|
||||
}
|
||||
|
||||
Separator();
|
||||
|
||||
// Display current map's background color
|
||||
Text("Current Map: %d (0x%02X)", current_map_, current_map_);
|
||||
|
||||
// Get current background color
|
||||
uint16_t current_bg_color =
|
||||
(*rom_)[zelda3::OverworldCustomAreaSpecificBGPalette +
|
||||
(current_map_ * 2)] |
|
||||
((*rom_)[zelda3::OverworldCustomAreaSpecificBGPalette +
|
||||
(current_map_ * 2) + 1]
|
||||
<< 8);
|
||||
|
||||
// Convert SNES color to ImVec4
|
||||
ImVec4 current_color =
|
||||
ImVec4(((current_bg_color & 0x1F) * 8) / 255.0f,
|
||||
(((current_bg_color >> 5) & 0x1F) * 8) / 255.0f,
|
||||
(((current_bg_color >> 10) & 0x1F) * 8) / 255.0f, 1.0f);
|
||||
|
||||
// Color picker
|
||||
if (ColorPicker4(
|
||||
"Background Color", (float*)¤t_color,
|
||||
ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_InputRGB)) {
|
||||
// Convert ImVec4 back to SNES color
|
||||
uint16_t new_color =
|
||||
(static_cast<uint16_t>(current_color.x * 31) & 0x1F) |
|
||||
((static_cast<uint16_t>(current_color.y * 31) & 0x1F) << 5) |
|
||||
((static_cast<uint16_t>(current_color.z * 31) & 0x1F) << 10);
|
||||
|
||||
// Write to ROM
|
||||
(*rom_)[zelda3::OverworldCustomAreaSpecificBGPalette + (current_map_ * 2)] =
|
||||
new_color & 0xFF;
|
||||
(*rom_)[zelda3::OverworldCustomAreaSpecificBGPalette + (current_map_ * 2) +
|
||||
1] = (new_color >> 8) & 0xFF;
|
||||
|
||||
// Update the overworld map
|
||||
overworld_.mutable_overworld_map(current_map_)
|
||||
->set_area_specific_bg_color(new_color);
|
||||
|
||||
// Refresh the map
|
||||
RefreshOverworldMap();
|
||||
}
|
||||
|
||||
Separator();
|
||||
|
||||
// Show color preview
|
||||
Text("Color Preview:");
|
||||
ImGui::ColorButton("##bg_preview", current_color,
|
||||
ImGuiColorEditFlags_NoTooltip, ImVec2(100, 50));
|
||||
|
||||
SameLine();
|
||||
Text("SNES Color: 0x%04X", current_bg_color);
|
||||
}
|
||||
|
||||
void OverworldEditor::DrawOverlayEditor() {
|
||||
static uint8_t asm_version =
|
||||
(*rom_)[zelda3::OverworldCustomASMHasBeenApplied];
|
||||
|
||||
// Handle vanilla ROMs
|
||||
if (asm_version == 0xFF) {
|
||||
Text("Vanilla ROM - Overlay Information:");
|
||||
Separator();
|
||||
|
||||
Text("Current Map: %d (0x%02X)", current_map_, current_map_);
|
||||
|
||||
// Show vanilla subscreen overlay information
|
||||
Text("Vanilla ROM - Subscreen Overlays:");
|
||||
Text("Subscreen overlays in vanilla ROMs reference special area maps");
|
||||
Text("(0x80-0x9F) for visual effects like fog, rain, backgrounds.");
|
||||
|
||||
Separator();
|
||||
if (Checkbox("Show Subscreen Overlay Preview", &show_overlay_preview_)) {
|
||||
// Toggle subscreen overlay preview
|
||||
}
|
||||
|
||||
if (show_overlay_preview_) {
|
||||
DrawOverlayPreview();
|
||||
}
|
||||
|
||||
Separator();
|
||||
Text(
|
||||
"Note: Vanilla subscreen overlays are read-only. Use ZSCustomOverworld "
|
||||
"v1+ for "
|
||||
"editable subscreen overlays.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Subscreen overlays are available for all versions for LW and DW maps
|
||||
// Check if subscreen overlays are enabled (for custom overworld ROMs)
|
||||
if (asm_version != 0xFF) {
|
||||
bool overlay_enabled =
|
||||
(*rom_)[zelda3::OverworldCustomSubscreenOverlayEnabled] != 0x00;
|
||||
if (Checkbox("Enable Subscreen Overlays", &overlay_enabled)) {
|
||||
(*rom_)[zelda3::OverworldCustomSubscreenOverlayEnabled] =
|
||||
overlay_enabled ? 0x01 : 0x00;
|
||||
}
|
||||
|
||||
if (!overlay_enabled) {
|
||||
Text("Subscreen overlays are disabled.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Separator();
|
||||
|
||||
// Display current map's subscreen overlay
|
||||
Text("Current Map: %d (0x%02X)", current_map_, current_map_);
|
||||
|
||||
// Get current subscreen overlay ID
|
||||
uint16_t current_overlay =
|
||||
(*rom_)[zelda3::OverworldCustomSubscreenOverlayArray +
|
||||
(current_map_ * 2)] |
|
||||
((*rom_)[zelda3::OverworldCustomSubscreenOverlayArray +
|
||||
(current_map_ * 2) + 1]
|
||||
<< 8);
|
||||
|
||||
// Subscreen overlay ID input
|
||||
if (gui::InputHexWord("Subscreen Overlay ID", ¤t_overlay, 100)) {
|
||||
// Write to ROM
|
||||
(*rom_)[zelda3::OverworldCustomSubscreenOverlayArray + (current_map_ * 2)] =
|
||||
current_overlay & 0xFF;
|
||||
(*rom_)[zelda3::OverworldCustomSubscreenOverlayArray + (current_map_ * 2) +
|
||||
1] = (current_overlay >> 8) & 0xFF;
|
||||
|
||||
// Update the overworld map
|
||||
overworld_.mutable_overworld_map(current_map_)
|
||||
->set_subscreen_overlay(current_overlay);
|
||||
|
||||
// Refresh the map
|
||||
RefreshOverworldMap();
|
||||
}
|
||||
|
||||
Separator();
|
||||
|
||||
// Show subscreen overlay information
|
||||
Text("Subscreen Overlay Information:");
|
||||
Text("ID: 0x%04X", current_overlay);
|
||||
|
||||
if (current_overlay == 0x00FF) {
|
||||
Text("No overlay");
|
||||
} else if (current_overlay == 0x0093) {
|
||||
Text("Triforce Room Curtain");
|
||||
} else if (current_overlay == 0x0094) {
|
||||
Text("Under the Bridge");
|
||||
} else if (current_overlay == 0x0095) {
|
||||
Text("Sky Background (LW Death Mountain)");
|
||||
} else if (current_overlay == 0x0096) {
|
||||
Text("Pyramid Background");
|
||||
} else if (current_overlay == 0x0097) {
|
||||
Text("First Fog Overlay (Master Sword Area)");
|
||||
} else if (current_overlay == 0x009C) {
|
||||
Text("Lava Background (DW Death Mountain)");
|
||||
} else if (current_overlay == 0x009D) {
|
||||
Text("Second Fog Overlay (Lost Woods/Skull Woods)");
|
||||
} else if (current_overlay == 0x009E) {
|
||||
Text("Tree Canopy (Forest)");
|
||||
} else if (current_overlay == 0x009F) {
|
||||
Text("Rain Effect (Misery Mire)");
|
||||
} else {
|
||||
Text("Custom overlay");
|
||||
}
|
||||
}
|
||||
|
||||
void OverworldEditor::DrawOverlayPreview() {
|
||||
if (!show_overlay_preview_)
|
||||
return;
|
||||
|
||||
Text("Subscreen Overlay Preview:");
|
||||
Separator();
|
||||
|
||||
// Get the subscreen overlay ID from the current map
|
||||
uint16_t overlay_id =
|
||||
overworld_.overworld_map(current_map_)->subscreen_overlay();
|
||||
|
||||
// Show subscreen overlay information
|
||||
Text("Subscreen Overlay ID: 0x%04X", overlay_id);
|
||||
|
||||
// Show subscreen overlay description based on common overlay IDs
|
||||
std::string overlay_desc = "";
|
||||
if (overlay_id == 0x0093) {
|
||||
overlay_desc = "Triforce Room Curtain";
|
||||
} else if (overlay_id == 0x0094) {
|
||||
overlay_desc = "Under the Bridge";
|
||||
} else if (overlay_id == 0x0095) {
|
||||
overlay_desc = "Sky Background (LW Death Mountain)";
|
||||
} else if (overlay_id == 0x0096) {
|
||||
overlay_desc = "Pyramid Background";
|
||||
} else if (overlay_id == 0x0097) {
|
||||
overlay_desc = "First Fog Overlay (Master Sword Area)";
|
||||
} else if (overlay_id == 0x009C) {
|
||||
overlay_desc = "Lava Background (DW Death Mountain)";
|
||||
} else if (overlay_id == 0x009D) {
|
||||
overlay_desc = "Second Fog Overlay (Lost Woods/Skull Woods)";
|
||||
} else if (overlay_id == 0x009E) {
|
||||
overlay_desc = "Tree Canopy (Forest)";
|
||||
} else if (overlay_id == 0x009F) {
|
||||
overlay_desc = "Rain Effect (Misery Mire)";
|
||||
} else if (overlay_id == 0x00FF) {
|
||||
overlay_desc = "No Subscreen Overlay";
|
||||
} else {
|
||||
overlay_desc = "Custom subscreen overlay effect";
|
||||
}
|
||||
Text("Description: %s", overlay_desc.c_str());
|
||||
|
||||
Separator();
|
||||
|
||||
// Map subscreen overlay ID to special area map for preview
|
||||
int overlay_map_index = -1;
|
||||
if (overlay_id >= 0x80 && overlay_id < 0xA0) {
|
||||
overlay_map_index = overlay_id;
|
||||
}
|
||||
|
||||
if (overlay_map_index >= 0 && overlay_map_index < zelda3::kNumOverworldMaps) {
|
||||
Text("Subscreen Overlay Source Map: %d (0x%02X)", overlay_map_index,
|
||||
overlay_map_index);
|
||||
|
||||
// Get the subscreen overlay map's bitmap
|
||||
const auto& overlay_bitmap = maps_bmp_[overlay_map_index];
|
||||
|
||||
if (overlay_bitmap.is_active()) {
|
||||
// Display the subscreen overlay map bitmap
|
||||
ImVec2 image_size(256, 256); // Scale down for preview
|
||||
ImGui::Image((ImTextureID)(intptr_t)overlay_bitmap.texture(), image_size);
|
||||
|
||||
Separator();
|
||||
Text("This subscreen overlay would be displayed semi-transparently");
|
||||
Text("on top of the current map when active.");
|
||||
|
||||
// Show drawing order info
|
||||
if (overlay_id == 0x0095 || overlay_id == 0x0096 ||
|
||||
overlay_id == 0x009C) {
|
||||
Text("Note: This subscreen overlay is drawn as a background");
|
||||
Text("(behind the main map tiles).");
|
||||
} else {
|
||||
Text("Note: This subscreen overlay is drawn on top of");
|
||||
Text("the main map tiles.");
|
||||
}
|
||||
} else {
|
||||
Text("Subscreen overlay map bitmap not available");
|
||||
}
|
||||
} else {
|
||||
Text("Unknown subscreen overlay ID: 0x%04X", overlay_id);
|
||||
Text("Could not determine subscreen overlay source map");
|
||||
}
|
||||
}
|
||||
|
||||
void OverworldEditor::DrawMapLockControls() {
|
||||
if (current_map_lock_) {
|
||||
gui::LockIndicator(true, absl::StrFormat("Map %d (0x%02X)", current_map_, current_map_).c_str());
|
||||
|
||||
if (gui::IconButton(ICON_MD_LOCK_OPEN, "Unlock Map")) {
|
||||
current_map_lock_ = false;
|
||||
}
|
||||
} else {
|
||||
gui::LockIndicator(false, absl::StrFormat("Map %d (0x%02X)", current_map_, current_map_).c_str());
|
||||
|
||||
if (gui::IconButton(ICON_MD_LOCK, "Lock Map")) {
|
||||
current_map_lock_ = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OverworldEditor::DrawOverworldContextMenu() {
|
||||
// Get the current map from mouse position
|
||||
auto mouse_position = ow_map_canvas_.drawn_tile_position();
|
||||
int map_x = mouse_position.x / kOverworldMapSize;
|
||||
int map_y = mouse_position.y / kOverworldMapSize;
|
||||
int hovered_map = map_x + map_y * 8;
|
||||
if (current_world_ == 1) {
|
||||
hovered_map += 0x40;
|
||||
} else if (current_world_ == 2) {
|
||||
hovered_map += 0x80;
|
||||
}
|
||||
|
||||
// Only show context menu if we're hovering over a valid map
|
||||
if (hovered_map >= 0 && hovered_map < 0xA0) {
|
||||
if (ImGui::BeginPopupContextWindow("OverworldMapContext")) {
|
||||
Text("Map %d (0x%02X)", hovered_map, hovered_map);
|
||||
Separator();
|
||||
|
||||
// Map lock controls
|
||||
if (current_map_lock_ && current_map_ == hovered_map) {
|
||||
PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.5f, 0.0f, 1.0f));
|
||||
Text("Currently Locked");
|
||||
PopStyleColor();
|
||||
if (MenuItem("Unlock Map")) {
|
||||
current_map_lock_ = false;
|
||||
}
|
||||
} else {
|
||||
if (MenuItem("Lock to This Map")) {
|
||||
current_map_lock_ = true;
|
||||
current_map_ = hovered_map;
|
||||
}
|
||||
}
|
||||
|
||||
Separator();
|
||||
|
||||
// Quick access to area configuration
|
||||
if (MenuItem(ICON_MD_TUNE " Area Configuration")) {
|
||||
show_map_properties_panel_ = true;
|
||||
current_map_ = hovered_map;
|
||||
}
|
||||
|
||||
// Custom overworld features
|
||||
static uint8_t asm_version =
|
||||
(*rom_)[zelda3::OverworldCustomASMHasBeenApplied];
|
||||
if (asm_version >= 3 && asm_version != 0xFF) {
|
||||
if (MenuItem("Custom Background Color")) {
|
||||
show_custom_bg_color_editor_ = true;
|
||||
current_map_ = hovered_map;
|
||||
}
|
||||
|
||||
if (MenuItem("Subscreen Overlay Settings")) {
|
||||
show_overlay_editor_ = true;
|
||||
current_map_ = hovered_map;
|
||||
}
|
||||
} else if (asm_version == 0xFF) {
|
||||
// Show vanilla subscreen overlay information for LW and DW maps only
|
||||
bool is_special_overworld_map =
|
||||
(hovered_map >= 0x80 && hovered_map < 0xA0);
|
||||
if (!is_special_overworld_map) {
|
||||
if (MenuItem("View Subscreen Overlay")) {
|
||||
show_overlay_editor_ = true;
|
||||
current_map_ = hovered_map;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Separator();
|
||||
|
||||
// Canvas controls
|
||||
if (MenuItem("Reset Canvas Position")) {
|
||||
ow_map_canvas_.set_scrolling(ImVec2(0, 0));
|
||||
}
|
||||
|
||||
if (MenuItem("Zoom to Fit")) {
|
||||
ow_map_canvas_.set_global_scale(1.0f);
|
||||
ow_map_canvas_.set_scrolling(ImVec2(0, 0));
|
||||
}
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OverworldEditor::HandleMapInteraction() {
|
||||
// Handle middle-click for map interaction instead of right-click
|
||||
if (ImGui::IsMouseClicked(ImGuiMouseButton_Middle) &&
|
||||
@@ -2621,294 +2224,6 @@ void OverworldEditor::HandleMapInteraction() {
|
||||
}
|
||||
}
|
||||
|
||||
void OverworldEditor::DrawMapPropertiesPanel() {
|
||||
if (!overworld_.is_loaded()) {
|
||||
Text("No overworld loaded");
|
||||
return;
|
||||
}
|
||||
|
||||
// Header with map info and lock status
|
||||
ImGui::BeginGroup();
|
||||
gui::LockIndicator(current_map_lock_,
|
||||
absl::StrFormat("Map %d (0x%02X)", current_map_, current_map_).c_str());
|
||||
|
||||
SameLine();
|
||||
if (gui::ToggleIconButton(ICON_MD_LOCK_OPEN, ICON_MD_LOCK,
|
||||
¤t_map_lock_,
|
||||
current_map_lock_ ? "Unlock Map" : "Lock Map")) {
|
||||
// Toggle handled by helper
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
|
||||
Separator();
|
||||
|
||||
// Create tabs for different property categories
|
||||
if (BeginTabBar("MapPropertiesTabs", ImGuiTabBarFlags_FittingPolicyScroll)) {
|
||||
// Basic Properties Tab
|
||||
if (BeginTabItem("Basic Properties")) {
|
||||
if (BeginTable(
|
||||
"BasicProperties", 2,
|
||||
ImGuiTableFlags_Borders | ImGuiTableFlags_SizingFixedFit)) {
|
||||
ImGui::TableSetupColumn("Property", ImGuiTableColumnFlags_WidthFixed,
|
||||
150);
|
||||
ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch);
|
||||
|
||||
TableNextColumn();
|
||||
Text("World");
|
||||
TableNextColumn();
|
||||
ImGui::SetNextItemWidth(100.f);
|
||||
ImGui::Combo("##world", ¤t_world_, kWorldList.data(), 3);
|
||||
|
||||
TableNextColumn();
|
||||
Text("Area Graphics");
|
||||
TableNextColumn();
|
||||
if (gui::InputHexByte("##AreaGfx",
|
||||
overworld_.mutable_overworld_map(current_map_)
|
||||
->mutable_area_graphics(),
|
||||
kInputFieldSize)) {
|
||||
RefreshMapProperties();
|
||||
RefreshOverworldMap();
|
||||
}
|
||||
|
||||
TableNextColumn();
|
||||
Text("Area Palette");
|
||||
TableNextColumn();
|
||||
if (gui::InputHexByte("##AreaPal",
|
||||
overworld_.mutable_overworld_map(current_map_)
|
||||
->mutable_area_palette(),
|
||||
kInputFieldSize)) {
|
||||
RefreshMapProperties();
|
||||
status_ = RefreshMapPalette();
|
||||
RefreshOverworldMap();
|
||||
}
|
||||
|
||||
TableNextColumn();
|
||||
Text("Message ID");
|
||||
TableNextColumn();
|
||||
if (gui::InputHexWord("##MsgId",
|
||||
overworld_.mutable_overworld_map(current_map_)
|
||||
->mutable_message_id(),
|
||||
kInputFieldSize + 20)) {
|
||||
RefreshMapProperties();
|
||||
RefreshOverworldMap();
|
||||
}
|
||||
|
||||
TableNextColumn();
|
||||
Text("Mosaic Effect");
|
||||
TableNextColumn();
|
||||
if (ImGui::Checkbox("##mosaic",
|
||||
overworld_.mutable_overworld_map(current_map_)
|
||||
->mutable_mosaic())) {
|
||||
RefreshMapProperties();
|
||||
RefreshOverworldMap();
|
||||
}
|
||||
HOVER_HINT("Enable Mosaic effect for the current map");
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
EndTabItem();
|
||||
}
|
||||
|
||||
// Sprite Properties Tab
|
||||
if (BeginTabItem("Sprite Properties")) {
|
||||
if (BeginTable(
|
||||
"SpriteProperties", 2,
|
||||
ImGuiTableFlags_Borders | ImGuiTableFlags_SizingFixedFit)) {
|
||||
ImGui::TableSetupColumn("Property", ImGuiTableColumnFlags_WidthFixed,
|
||||
150);
|
||||
ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch);
|
||||
|
||||
TableNextColumn();
|
||||
Text("Game State");
|
||||
TableNextColumn();
|
||||
ImGui::SetNextItemWidth(100.f);
|
||||
if (ImGui::Combo("##GameState", &game_state_,
|
||||
kGamePartComboString.data(), 3)) {
|
||||
RefreshMapProperties();
|
||||
RefreshOverworldMap();
|
||||
}
|
||||
|
||||
TableNextColumn();
|
||||
Text("Sprite Graphics 1");
|
||||
TableNextColumn();
|
||||
if (gui::InputHexByte("##SprGfx1",
|
||||
overworld_.mutable_overworld_map(current_map_)
|
||||
->mutable_sprite_graphics(1),
|
||||
kInputFieldSize)) {
|
||||
RefreshMapProperties();
|
||||
RefreshOverworldMap();
|
||||
}
|
||||
|
||||
TableNextColumn();
|
||||
Text("Sprite Graphics 2");
|
||||
TableNextColumn();
|
||||
if (gui::InputHexByte("##SprGfx2",
|
||||
overworld_.mutable_overworld_map(current_map_)
|
||||
->mutable_sprite_graphics(2),
|
||||
kInputFieldSize)) {
|
||||
RefreshMapProperties();
|
||||
RefreshOverworldMap();
|
||||
}
|
||||
|
||||
TableNextColumn();
|
||||
Text("Sprite Palette 1");
|
||||
TableNextColumn();
|
||||
if (gui::InputHexByte("##SprPal1",
|
||||
overworld_.mutable_overworld_map(current_map_)
|
||||
->mutable_sprite_palette(1),
|
||||
kInputFieldSize)) {
|
||||
RefreshMapProperties();
|
||||
RefreshOverworldMap();
|
||||
}
|
||||
|
||||
TableNextColumn();
|
||||
Text("Sprite Palette 2");
|
||||
TableNextColumn();
|
||||
if (gui::InputHexByte("##SprPal2",
|
||||
overworld_.mutable_overworld_map(current_map_)
|
||||
->mutable_sprite_palette(2),
|
||||
kInputFieldSize)) {
|
||||
RefreshMapProperties();
|
||||
RefreshOverworldMap();
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
EndTabItem();
|
||||
}
|
||||
|
||||
// Custom Overworld Features Tab
|
||||
static uint8_t asm_version =
|
||||
(*rom_)[zelda3::OverworldCustomASMHasBeenApplied];
|
||||
if (asm_version != 0xFF && BeginTabItem("Custom Features")) {
|
||||
if (BeginTable(
|
||||
"CustomFeatures", 2,
|
||||
ImGuiTableFlags_Borders | ImGuiTableFlags_SizingFixedFit)) {
|
||||
ImGui::TableSetupColumn("Property", ImGuiTableColumnFlags_WidthFixed,
|
||||
150);
|
||||
ImGui::TableSetupColumn("Value", ImGuiTableColumnFlags_WidthStretch);
|
||||
|
||||
TableNextColumn();
|
||||
Text("Area Size");
|
||||
TableNextColumn();
|
||||
static const char* area_size_names[] = {"Small (1x1)", "Large (2x2)",
|
||||
"Wide (2x1)", "Tall (1x2)"};
|
||||
int current_area_size = static_cast<int>(
|
||||
overworld_.overworld_map(current_map_)->area_size());
|
||||
ImGui::SetNextItemWidth(120.f);
|
||||
if (ImGui::Combo("##AreaSize", ¤t_area_size, area_size_names,
|
||||
4)) {
|
||||
overworld_.mutable_overworld_map(current_map_)
|
||||
->SetAreaSize(
|
||||
static_cast<zelda3::AreaSizeEnum>(current_area_size));
|
||||
RefreshOverworldMap();
|
||||
}
|
||||
|
||||
if (asm_version >= 2) {
|
||||
TableNextColumn();
|
||||
Text("Main Palette");
|
||||
TableNextColumn();
|
||||
if (gui::InputHexByte("##MainPal",
|
||||
overworld_.mutable_overworld_map(current_map_)
|
||||
->mutable_main_palette(),
|
||||
kInputFieldSize)) {
|
||||
RefreshMapProperties();
|
||||
status_ = RefreshMapPalette();
|
||||
RefreshOverworldMap();
|
||||
}
|
||||
}
|
||||
|
||||
if (asm_version >= 3) {
|
||||
TableNextColumn();
|
||||
Text("Animated GFX");
|
||||
TableNextColumn();
|
||||
if (gui::InputHexByte("##AnimGfx",
|
||||
overworld_.mutable_overworld_map(current_map_)
|
||||
->mutable_animated_gfx(),
|
||||
kInputFieldSize)) {
|
||||
RefreshMapProperties();
|
||||
RefreshOverworldMap();
|
||||
}
|
||||
|
||||
TableNextColumn();
|
||||
Text("Subscreen Overlay");
|
||||
TableNextColumn();
|
||||
if (gui::InputHexWord("##SubOverlay",
|
||||
overworld_.mutable_overworld_map(current_map_)
|
||||
->mutable_subscreen_overlay(),
|
||||
kInputFieldSize + 20)) {
|
||||
RefreshMapProperties();
|
||||
RefreshOverworldMap();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
Separator();
|
||||
|
||||
// Quick action buttons
|
||||
ImGui::BeginGroup();
|
||||
if (Button("Custom Background Color")) {
|
||||
show_custom_bg_color_editor_ = !show_custom_bg_color_editor_;
|
||||
}
|
||||
SameLine();
|
||||
if (Button("Overlay Settings")) {
|
||||
show_overlay_editor_ = !show_overlay_editor_;
|
||||
}
|
||||
ImGui::EndGroup();
|
||||
|
||||
EndTabItem();
|
||||
}
|
||||
|
||||
// Tile Graphics Tab
|
||||
if (BeginTabItem("Tile Graphics")) {
|
||||
Text("Custom Tile Graphics (8 sheets per map):");
|
||||
Separator();
|
||||
|
||||
if (BeginTable(
|
||||
"TileGraphics", 4,
|
||||
ImGuiTableFlags_Borders | ImGuiTableFlags_SizingFixedFit)) {
|
||||
ImGui::TableSetupColumn("Sheet", ImGuiTableColumnFlags_WidthFixed, 80);
|
||||
ImGui::TableSetupColumn("GFX ID", ImGuiTableColumnFlags_WidthFixed,
|
||||
120);
|
||||
ImGui::TableSetupColumn("Sheet", ImGuiTableColumnFlags_WidthFixed, 80);
|
||||
ImGui::TableSetupColumn("GFX ID", ImGuiTableColumnFlags_WidthFixed,
|
||||
120);
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
TableNextColumn();
|
||||
Text("Sheet %d", i);
|
||||
TableNextColumn();
|
||||
if (gui::InputHexByte(absl::StrFormat("Sheet %d GFX", i).c_str(),
|
||||
overworld_.mutable_overworld_map(current_map_)
|
||||
->mutable_custom_tileset(i),
|
||||
100.f)) {
|
||||
RefreshMapProperties();
|
||||
RefreshOverworldMap();
|
||||
}
|
||||
|
||||
TableNextColumn();
|
||||
Text("Sheet %d", i + 4);
|
||||
TableNextColumn();
|
||||
if (gui::InputHexByte(absl::StrFormat("Sheet %d GFX", i + 4).c_str(),
|
||||
overworld_.mutable_overworld_map(current_map_)
|
||||
->mutable_custom_tileset(i + 4),
|
||||
100.f)) {
|
||||
RefreshMapProperties();
|
||||
RefreshOverworldMap();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
EndTabItem();
|
||||
}
|
||||
|
||||
EndTabBar();
|
||||
}
|
||||
}
|
||||
|
||||
void OverworldEditor::SetupOverworldCanvasContextMenu() {
|
||||
// Clear any existing context menu items
|
||||
ow_map_canvas_.ClearContextMenuItems();
|
||||
@@ -3137,7 +2452,9 @@ void OverworldEditor::DrawOverworldProperties() {
|
||||
}
|
||||
|
||||
absl::Status OverworldEditor::UpdateUsageStats() {
|
||||
if (BeginTable("UsageStatsTable", 3, kOWEditFlags, ImVec2(0, 0))) {
|
||||
if (BeginTable("UsageStatsTable", 3,
|
||||
ImGuiTableFlags_Resizable | ImGuiTableFlags_BordersOuter,
|
||||
ImVec2(0, 0))) {
|
||||
TableSetupColumn("Entrances");
|
||||
TableSetupColumn("Grid", ImGuiTableColumnFlags_WidthStretch,
|
||||
ImGui::GetContentRegionAvail().x);
|
||||
|
||||
@@ -35,27 +35,12 @@ constexpr ImVec2 kGraphicsBinCanvasSize(0x100 + 1, kNumSheetsToLoad * 0x40 + 1);
|
||||
constexpr ImGuiTableFlags kOWMapFlags =
|
||||
ImGuiTableFlags_Borders | ImGuiTableFlags_Resizable |
|
||||
ImGuiTableFlags_RowBg | ImGuiTableFlags_SizingStretchProp;
|
||||
constexpr ImGuiTableFlags kToolsetTableFlags = ImGuiTableFlags_SizingFixedFit;
|
||||
constexpr ImGuiTableFlags kOWEditFlags =
|
||||
ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable |
|
||||
ImGuiTableFlags_Hideable | ImGuiTableFlags_BordersOuter |
|
||||
ImGuiTableFlags_BordersV;
|
||||
|
||||
static constexpr absl::string_view kToolsetColumnNames[] = {
|
||||
"#undoTool", "#redoTool", "#separator2", "#zoomOutTool",
|
||||
"#zoomInTool", "#separator", "#drawTool", "#history",
|
||||
"#entranceTool", "#exitTool", "#itemTool", "#spriteTool",
|
||||
"#transportTool", "#musicTool", "#separator3", "#tilemapTool",
|
||||
"propertiesTool", "#separator4", "#experimentalTool", "#properties",
|
||||
"#separator5"};
|
||||
|
||||
constexpr absl::string_view kWorldList =
|
||||
"Light World\0Dark World\0Extra World\0";
|
||||
|
||||
constexpr absl::string_view kGamePartComboString = "Part 0\0Part 1\0Part 2\0";
|
||||
|
||||
constexpr absl::string_view kTileSelectorTab = "##TileSelectorTabBar";
|
||||
constexpr absl::string_view kOWEditTable = "##OWEditTable";
|
||||
constexpr absl::string_view kOWMapTable = "#MapSettingsTable";
|
||||
|
||||
/**
|
||||
@@ -178,7 +163,6 @@ class OverworldEditor : public Editor, public gfx::GfxContext {
|
||||
absl::Status DrawTile16Selector();
|
||||
void DrawTile8Selector();
|
||||
absl::Status DrawAreaGraphics();
|
||||
absl::Status DrawTileSelector();
|
||||
|
||||
absl::Status LoadSpriteGraphics();
|
||||
|
||||
@@ -200,14 +184,6 @@ class OverworldEditor : public Editor, public gfx::GfxContext {
|
||||
void EnsureMapTexture(int map_index);
|
||||
|
||||
void DrawOverworldProperties();
|
||||
void DrawCustomBackgroundColorEditor();
|
||||
void DrawOverlayEditor();
|
||||
void DrawMapLockControls();
|
||||
void DrawOverlayPreview();
|
||||
void DrawOverlayPreviewOnMap();
|
||||
void DrawOverworldContextMenu();
|
||||
void DrawSimplifiedMapSettings();
|
||||
void DrawMapPropertiesPanel();
|
||||
void HandleMapInteraction();
|
||||
void SetupOverworldCanvasContextMenu();
|
||||
|
||||
@@ -365,7 +341,6 @@ class OverworldEditor : public Editor, public gfx::GfxContext {
|
||||
gui::Canvas properties_canvas_;
|
||||
gui::Canvas scratch_canvas_{"ScratchSpace", ImVec2(320, 480), gui::CanvasGridSize::k32x32};
|
||||
|
||||
gui::Table toolset_table_{"##ToolsetTable0", 12, kToolsetTableFlags};
|
||||
gui::Table map_settings_table_{kOWMapTable.data(), 8, kOWMapFlags,
|
||||
ImVec2(0, 0)};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user