Core dungeon editing system. More...
#include <dungeon_editor_system.h>

Classes | |
| struct | EditorState |
| struct | UndoPoint |
Public Types | |
| using | RoomChangedCallback = std::function<void(int room_id)> |
Public Member Functions | |
| DungeonEditorSystem (Rom *rom, GameData *game_data=nullptr) | |
| ~DungeonEditorSystem () | |
| void | SetGameData (GameData *game_data) |
| absl::Status | Initialize () |
| absl::Status | LoadDungeon (int dungeon_id) |
| absl::Status | SaveDungeon () |
| absl::Status | SaveRoom (int room_id) |
| absl::Status | ReloadRoom (int room_id) |
| absl::Status | SetCurrentRoom (int room_id) |
| int | GetCurrentRoom () const |
| absl::StatusOr< Room > | GetRoom (int room_id) |
| std::shared_ptr< DungeonObjectEditor > | GetObjectEditor () |
| absl::Status | Undo () |
| absl::Status | Redo () |
| bool | CanUndo () const |
| bool | CanRedo () const |
| void | ClearHistory () |
| void | SetRoomChangedCallback (RoomChangedCallback callback) |
| EditorState | GetEditorState () const |
| Rom * | GetROM () const |
| bool | IsDirty () const |
| void | SetROM (Rom *rom) |
| void | SetExternalRoom (Room *room) |
| absl::Status | RefreshRomBackedState (Room *external_room, int current_room_id) |
Private Member Functions | |
| absl::Status | BindObjectEditorToCurrentRoom () |
| Room * | GetManagedRoom (int room_id) |
| absl::Status | SaveManagedRoom (Room &room) |
| absl::Status | InitializeObjectEditor () |
| absl::Status | LoadRoomData (int room_id) |
| absl::Status | SaveRoomData (int room_id) |
Private Attributes | |
| Rom * | rom_ |
| GameData * | game_data_ = nullptr |
| std::shared_ptr< DungeonObjectEditor > | object_editor_ |
| Room * | external_room_ = nullptr |
| EditorState | editor_state_ |
| std::unordered_map< int, Room > | rooms_ |
| RoomChangedCallback | room_changed_callback_ |
| std::vector< UndoPoint > | undo_history_ |
| std::vector< UndoPoint > | redo_history_ |
Static Private Attributes | |
| static constexpr size_t | kMaxUndoHistory = 100 |
Core dungeon editing system.
Provides dungeon editing functionality focused on:
Note: Sprite, item, door, chest, and entrance editing is handled directly by the Room class and UI panels, not by this system.
Definition at line 33 of file dungeon_editor_system.h.
| using yaze::zelda3::DungeonEditorSystem::RoomChangedCallback = std::function<void(int room_id)> |
Definition at line 70 of file dungeon_editor_system.h.
|
explicit |
Definition at line 42 of file dungeon_editor_system.cc.
| yaze::zelda3::DungeonEditorSystem::~DungeonEditorSystem | ( | ) |
Definition at line 45 of file dungeon_editor_system.cc.
References external_room_, and object_editor_.
|
inline |
Definition at line 45 of file dungeon_editor_system.h.
References game_data_.
| absl::Status yaze::zelda3::DungeonEditorSystem::Initialize | ( | ) |
Definition at line 52 of file dungeon_editor_system.cc.
References object_editor_, RETURN_IF_ERROR, and rom_.
| absl::Status yaze::zelda3::DungeonEditorSystem::LoadDungeon | ( | int | dungeon_id | ) |
| absl::Status yaze::zelda3::DungeonEditorSystem::SaveDungeon | ( | ) |
Definition at line 71 of file dungeon_editor_system.cc.
References editor_state_, external_room_, GetManagedRoom(), yaze::zelda3::Room::id(), yaze::zelda3::DungeonEditorSystem::EditorState::is_dirty, yaze::zelda3::Room::IsLoaded(), yaze::zelda3::kNumberOfRooms, yaze::zelda3::DungeonEditorSystem::EditorState::last_save_time, LoadRoomData(), RETURN_IF_ERROR, rom_, rooms_, yaze::zelda3::SaveAllChests(), yaze::zelda3::SaveAllCollision(), yaze::zelda3::SaveAllPotItems(), yaze::zelda3::SaveAllTorches(), yaze::zelda3::Room::SaveObjects(), yaze::zelda3::Room::SaveObjectStreamHeader(), yaze::zelda3::Room::SaveRoomHeader(), and yaze::zelda3::Room::SaveSprites().
| absl::Status yaze::zelda3::DungeonEditorSystem::SaveRoom | ( | int | room_id | ) |
Definition at line 121 of file dungeon_editor_system.cc.
References SaveRoomData().

| absl::Status yaze::zelda3::DungeonEditorSystem::ReloadRoom | ( | int | room_id | ) |
Definition at line 125 of file dungeon_editor_system.cc.
References LoadRoomData().

| absl::Status yaze::zelda3::DungeonEditorSystem::SetCurrentRoom | ( | int | room_id | ) |
Definition at line 129 of file dungeon_editor_system.cc.
References BindObjectEditorToCurrentRoom(), yaze::zelda3::DungeonEditorSystem::EditorState::current_room_id, editor_state_, external_room_, yaze::zelda3::kNumberOfRooms, LoadRoomData(), and RETURN_IF_ERROR.

| int yaze::zelda3::DungeonEditorSystem::GetCurrentRoom | ( | ) | const |
Definition at line 141 of file dungeon_editor_system.cc.
References yaze::zelda3::DungeonEditorSystem::EditorState::current_room_id, and editor_state_.
| absl::StatusOr< Room > yaze::zelda3::DungeonEditorSystem::GetRoom | ( | int | room_id | ) |
Definition at line 145 of file dungeon_editor_system.cc.
References game_data_, yaze::zelda3::kNumberOfRooms, and rom_.
Referenced by yaze::cli::handlers::DungeonExportRoomCommandHandler::Execute(), yaze::cli::handlers::DungeonListObjectsCommandHandler::Execute(), and yaze::cli::handlers::DungeonGetRoomTilesCommandHandler::Execute().
| std::shared_ptr< DungeonObjectEditor > yaze::zelda3::DungeonEditorSystem::GetObjectEditor | ( | ) |
Definition at line 153 of file dungeon_editor_system.cc.
References BindObjectEditorToCurrentRoom(), object_editor_, and rom_.

| absl::Status yaze::zelda3::DungeonEditorSystem::Undo | ( | ) |
Definition at line 162 of file dungeon_editor_system.cc.
References CanUndo(), and object_editor_.

| absl::Status yaze::zelda3::DungeonEditorSystem::Redo | ( | ) |
Definition at line 174 of file dungeon_editor_system.cc.
References CanRedo(), and object_editor_.

| bool yaze::zelda3::DungeonEditorSystem::CanUndo | ( | ) | const |
Definition at line 186 of file dungeon_editor_system.cc.
References undo_history_.
Referenced by Undo().
| bool yaze::zelda3::DungeonEditorSystem::CanRedo | ( | ) | const |
Definition at line 190 of file dungeon_editor_system.cc.
References redo_history_.
Referenced by Redo().
| void yaze::zelda3::DungeonEditorSystem::ClearHistory | ( | ) |
Definition at line 194 of file dungeon_editor_system.cc.
References redo_history_, and undo_history_.
Referenced by RefreshRomBackedState().
| void yaze::zelda3::DungeonEditorSystem::SetRoomChangedCallback | ( | RoomChangedCallback | callback | ) |
Definition at line 199 of file dungeon_editor_system.cc.
References room_changed_callback_.
| DungeonEditorSystem::EditorState yaze::zelda3::DungeonEditorSystem::GetEditorState | ( | ) | const |
Definition at line 203 of file dungeon_editor_system.cc.
References editor_state_.
| Rom * yaze::zelda3::DungeonEditorSystem::GetROM | ( | ) | const |
Definition at line 207 of file dungeon_editor_system.cc.
References rom_.
| bool yaze::zelda3::DungeonEditorSystem::IsDirty | ( | ) | const |
Definition at line 211 of file dungeon_editor_system.cc.
References editor_state_, and yaze::zelda3::DungeonEditorSystem::EditorState::is_dirty.
| void yaze::zelda3::DungeonEditorSystem::SetROM | ( | Rom * | rom | ) |
Definition at line 215 of file dungeon_editor_system.cc.
References BindObjectEditorToCurrentRoom(), object_editor_, and rom_.

| void yaze::zelda3::DungeonEditorSystem::SetExternalRoom | ( | Room * | room | ) |
Definition at line 223 of file dungeon_editor_system.cc.
References BindObjectEditorToCurrentRoom(), external_room_, and object_editor_.

| absl::Status yaze::zelda3::DungeonEditorSystem::RefreshRomBackedState | ( | Room * | external_room, |
| int | current_room_id ) |
Definition at line 230 of file dungeon_editor_system.cc.
References BindObjectEditorToCurrentRoom(), ClearHistory(), yaze::zelda3::DungeonEditorSystem::EditorState::current_room_id, editor_state_, external_room_, yaze::zelda3::DungeonEditorSystem::EditorState::is_dirty, yaze::zelda3::kNumberOfRooms, LoadRoomData(), object_editor_, and rooms_.

|
private |
Definition at line 255 of file dungeon_editor_system.cc.
References yaze::zelda3::DungeonEditorSystem::EditorState::current_room_id, editor_state_, external_room_, GetManagedRoom(), LoadRoomData(), object_editor_, and RETURN_IF_ERROR.
Referenced by GetObjectEditor(), InitializeObjectEditor(), LoadRoomData(), RefreshRomBackedState(), SetCurrentRoom(), SetExternalRoom(), and SetROM().

|
private |
Definition at line 276 of file dungeon_editor_system.cc.
References external_room_, yaze::zelda3::Room::id(), and rooms_.
Referenced by BindObjectEditorToCurrentRoom(), SaveDungeon(), and SaveRoomData().

|
private |
Definition at line 287 of file dungeon_editor_system.cc.
References rom_.
Referenced by SaveRoomData().
|
private |
Definition at line 291 of file dungeon_editor_system.cc.
References BindObjectEditorToCurrentRoom(), object_editor_, RETURN_IF_ERROR, and rom_.

|
private |
Definition at line 299 of file dungeon_editor_system.cc.
References BindObjectEditorToCurrentRoom(), yaze::zelda3::DungeonEditorSystem::EditorState::current_room_id, editor_state_, external_room_, yaze::zelda3::Room::id(), yaze::zelda3::kNumberOfRooms, yaze::zelda3::LoadRoomFromRom(), RETURN_IF_ERROR, rom_, and rooms_.
Referenced by BindObjectEditorToCurrentRoom(), RefreshRomBackedState(), ReloadRoom(), SaveDungeon(), SaveRoomData(), and SetCurrentRoom().

|
private |
Definition at line 319 of file dungeon_editor_system.cc.
References GetManagedRoom(), yaze::zelda3::Room::IsLoaded(), yaze::zelda3::kNumberOfRooms, LoadRoomData(), RETURN_IF_ERROR, rom_, and SaveManagedRoom().
Referenced by SaveRoom().

|
private |
Definition at line 93 of file dungeon_editor_system.h.
Referenced by GetObjectEditor(), GetROM(), GetRoom(), Initialize(), InitializeObjectEditor(), LoadRoomData(), SaveDungeon(), SaveManagedRoom(), SaveRoomData(), and SetROM().
|
private |
Definition at line 94 of file dungeon_editor_system.h.
Referenced by GetRoom(), and SetGameData().
|
private |
Definition at line 95 of file dungeon_editor_system.h.
Referenced by BindObjectEditorToCurrentRoom(), GetObjectEditor(), Initialize(), InitializeObjectEditor(), Redo(), RefreshRomBackedState(), SetExternalRoom(), SetROM(), Undo(), and ~DungeonEditorSystem().
|
private |
Definition at line 96 of file dungeon_editor_system.h.
Referenced by BindObjectEditorToCurrentRoom(), GetManagedRoom(), LoadRoomData(), RefreshRomBackedState(), SaveDungeon(), SetCurrentRoom(), SetExternalRoom(), and ~DungeonEditorSystem().
|
private |
Definition at line 98 of file dungeon_editor_system.h.
Referenced by BindObjectEditorToCurrentRoom(), GetCurrentRoom(), GetEditorState(), IsDirty(), LoadDungeon(), LoadRoomData(), RefreshRomBackedState(), SaveDungeon(), and SetCurrentRoom().
|
private |
Definition at line 101 of file dungeon_editor_system.h.
Referenced by GetManagedRoom(), LoadRoomData(), RefreshRomBackedState(), and SaveDungeon().
|
private |
Definition at line 104 of file dungeon_editor_system.h.
Referenced by SetRoomChangedCallback().
|
private |
Definition at line 113 of file dungeon_editor_system.h.
Referenced by CanUndo(), and ClearHistory().
|
private |
Definition at line 114 of file dungeon_editor_system.h.
Referenced by CanRedo(), and ClearHistory().
|
staticconstexprprivate |
Definition at line 115 of file dungeon_editor_system.h.