Add Dungeon Room and Object Selection Features

- Introduced new classes for DungeonRoomSelector and DungeonObjectSelector to enhance room and object management within the dungeon editor.
- Implemented UI components for selecting rooms and entrances, allowing users to easily navigate and manage dungeon layouts.
- Added functionality for rendering room graphics and object previews, improving the visual editing experience.
- Updated the DungeonEditor class to integrate the new selectors, streamlining the overall editing workflow.
- Enhanced error handling and validation in room and object management processes to ensure robust functionality.
This commit is contained in:
scawful
2025-09-24 23:39:50 -04:00
parent 4ae9dc9e0c
commit a71f1e02c9
11 changed files with 1819 additions and 245 deletions

View File

@@ -0,0 +1,55 @@
#ifndef YAZE_APP_EDITOR_DUNGEON_DUNGEON_ROOM_SELECTOR_H
#define YAZE_APP_EDITOR_DUNGEON_DUNGEON_ROOM_SELECTOR_H
#include "imgui/imgui.h"
#include "app/rom.h"
#include "app/gui/input.h"
#include "app/zelda3/dungeon/room_entrance.h"
#include "zelda3/dungeon/room.h"
namespace yaze {
namespace editor {
/**
* @brief Handles room and entrance selection UI
*/
class DungeonRoomSelector {
public:
explicit DungeonRoomSelector(Rom* rom = nullptr) : rom_(rom) {}
void DrawRoomSelector();
void DrawEntranceSelector();
void set_rom(Rom* rom) { rom_ = rom; }
Rom* rom() const { return rom_; }
// Room selection
void set_current_room_id(uint16_t room_id) { current_room_id_ = room_id; }
int current_room_id() const { return current_room_id_; }
void set_active_rooms(const ImVector<int>& rooms) { active_rooms_ = rooms; }
const ImVector<int>& active_rooms() const { return active_rooms_; }
ImVector<int>& mutable_active_rooms() { return active_rooms_; }
// Entrance selection
void set_current_entrance_id(int entrance_id) { current_entrance_id_ = entrance_id; }
int current_entrance_id() const { return current_entrance_id_; }
// Room data access
void set_rooms(std::array<zelda3::Room, 0x128>* rooms) { rooms_ = rooms; }
void set_entrances(std::array<zelda3::RoomEntrance, 0x8C>* entrances) { entrances_ = entrances; }
private:
Rom* rom_ = nullptr;
uint16_t current_room_id_ = 0;
int current_entrance_id_ = 0;
ImVector<int> active_rooms_;
std::array<zelda3::Room, 0x128>* rooms_ = nullptr;
std::array<zelda3::RoomEntrance, 0x8C>* entrances_ = nullptr;
};
} // namespace editor
} // namespace yaze
#endif