25 api->SetTileQueryCallback(
35 if (x < 0 || y < 0 || x >= 512 || y >= 512) {
48 if (!tile_data.empty()) {
50 ImVec2(
static_cast<float>(x * 16),
static_cast<float>(y * 16)),
64 if (x < 0 || y < 0 || x >= 512 || y >= 512) {
83 "HandleEntityInsertion: queued type='%s' at pos=(%.0f,%.0f)",
94 LOG_ERROR(
"OverworldEditor",
"Cannot insert entity: overworld not loaded");
103 "ProcessPendingEntityInsertion: type='%s' at pos=(%.0f,%.0f) map=%d",
104 entity_type.c_str(), mouse_pos.x, mouse_pos.y,
current_map_);
106 if (entity_type ==
"entrance") {
116 LOG_DEBUG(
"OverworldEditor",
"Entrance inserted successfully at map=%d",
120 "Cannot insert entrance: " + std::string(result.status().message());
121 ImGui::OpenPopup(
"Entity Insert Error");
122 LOG_ERROR(
"OverworldEditor",
"Failed to insert entrance: %s",
123 result.status().message().data());
126 }
else if (entity_type ==
"hole") {
136 LOG_DEBUG(
"OverworldEditor",
"Hole inserted successfully at map=%d",
140 "Cannot insert hole: " + std::string(result.status().message());
141 ImGui::OpenPopup(
"Entity Insert Error");
142 LOG_ERROR(
"OverworldEditor",
"Failed to insert hole: %s",
143 result.status().message().data());
146 }
else if (entity_type ==
"exit") {
156 LOG_DEBUG(
"OverworldEditor",
"Exit inserted successfully at map=%d",
160 "Cannot insert exit: " + std::string(result.status().message());
161 ImGui::OpenPopup(
"Entity Insert Error");
162 LOG_ERROR(
"OverworldEditor",
"Failed to insert exit: %s",
163 result.status().message().data());
166 }
else if (entity_type ==
"item") {
176 LOG_DEBUG(
"OverworldEditor",
"Item inserted successfully at map=%d",
180 "Cannot insert item: " + std::string(result.status().message());
181 ImGui::OpenPopup(
"Entity Insert Error");
182 LOG_ERROR(
"OverworldEditor",
"Failed to insert item: %s",
183 result.status().message().data());
186 }
else if (entity_type ==
"sprite") {
197 LOG_DEBUG(
"OverworldEditor",
"Sprite inserted successfully at map=%d",
201 "Cannot insert sprite: " + std::string(result.status().message());
202 ImGui::OpenPopup(
"Entity Insert Error");
203 LOG_ERROR(
"OverworldEditor",
"Failed to insert sprite: %s",
204 result.status().message().data());
208 LOG_WARN(
"OverworldEditor",
"Unknown entity type: %s", entity_type.c_str());
217 LOG_ERROR(
"OverworldEditor",
"Cannot edit tile16: overworld or blockset not loaded");
void set_dirty(bool dirty)
EditorDependencies dependencies_
zelda3::OverworldItem current_item_
bool map_blockset_loaded_
zelda3::OverworldEntrance current_entrance_
void HandleTile16Edit()
Handle tile16 editing from context menu (MOUSE mode) Gets the tile16 under the cursor and opens the T...
zelda3::Sprite current_sprite_
std::string entity_insert_error_message_
gfx::Tilemap tile16_blockset_
void ProcessPendingEntityInsertion()
Process any pending entity insertion request Called from Update() - needed because ImGui::OpenPopup()...
gui::Canvas ow_map_canvas_
void HandleEntityInsertion(const std::string &entity_type)
Handle entity insertion from context menu.
zelda3::OverworldExit current_exit_
void RenderUpdatedMapBitmap(const ImVec2 &click_position, const std::vector< uint8_t > &tile_data)
std::string pending_entity_insert_type_
void SetupCanvasAutomation()
bool AutomationSetTile(int x, int y, int tile_id)
ImVec2 pending_entity_insert_pos_
zelda3::Overworld overworld_
zelda3::GameEntity * current_entity_
int AutomationGetTile(int x, int y)
bool ShowPanel(size_t session_id, const std::string &base_card_id)
void SetTilePaintCallback(TilePaintCallback callback)
CanvasAutomationAPI * GetAutomationAPI()
auto hover_mouse_pos() const
void set_current_world(int world)
void set_current_map(int i)
uint16_t GetTile(int x, int y) const
void SetTile(int x, int y, uint16_t tile_id)
#define LOG_DEBUG(category, format,...)
#define LOG_ERROR(category, format,...)
#define LOG_WARN(category, format,...)
absl::StatusOr< zelda3::OverworldItem * > InsertItem(zelda3::Overworld *overworld, ImVec2 mouse_pos, int current_map, uint8_t item_id)
Insert a new item at the specified position.
absl::StatusOr< zelda3::OverworldEntrance * > InsertEntrance(zelda3::Overworld *overworld, ImVec2 mouse_pos, int current_map, bool is_hole)
Flat helper functions for entity insertion/manipulation.
absl::StatusOr< zelda3::OverworldExit * > InsertExit(zelda3::Overworld *overworld, ImVec2 mouse_pos, int current_map)
Insert a new exit at the specified position.
absl::StatusOr< zelda3::Sprite * > InsertSprite(zelda3::Overworld *overworld, ImVec2 mouse_pos, int current_map, int game_state, uint8_t sprite_id)
Insert a new sprite at the specified position.
std::vector< uint8_t > GetTilemapData(Tilemap &tilemap, int tile_id)
constexpr const char * kOverworld
std::string MakePopupId(size_t session_id, const std::string &editor_name, const std::string &popup_name)
Generate session-aware popup IDs to prevent conflicts in multi-editor layouts.
PanelManager * panel_manager
static constexpr const char * kTile16Editor