yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::zelda3::DungeonEditorSystem Class Reference

Core dungeon editing system. More...

#include <dungeon_editor_system.h>

Collaboration diagram for yaze::zelda3::DungeonEditorSystem:

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< RoomGetRoom (int room_id)
 
std::shared_ptr< DungeonObjectEditorGetObjectEditor ()
 
absl::Status Undo ()
 
absl::Status Redo ()
 
bool CanUndo () const
 
bool CanRedo () const
 
void ClearHistory ()
 
void SetRoomChangedCallback (RoomChangedCallback callback)
 
EditorState GetEditorState () const
 
RomGetROM () 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 ()
 
RoomGetManagedRoom (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

Romrom_
 
GameDatagame_data_ = nullptr
 
std::shared_ptr< DungeonObjectEditorobject_editor_
 
Roomexternal_room_ = nullptr
 
EditorState editor_state_
 
std::unordered_map< int, Roomrooms_
 
RoomChangedCallback room_changed_callback_
 
std::vector< UndoPointundo_history_
 
std::vector< UndoPointredo_history_
 

Static Private Attributes

static constexpr size_t kMaxUndoHistory = 100
 

Detailed Description

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.

Member Typedef Documentation

◆ RoomChangedCallback

using yaze::zelda3::DungeonEditorSystem::RoomChangedCallback = std::function<void(int room_id)>

Definition at line 70 of file dungeon_editor_system.h.

Constructor & Destructor Documentation

◆ DungeonEditorSystem()

yaze::zelda3::DungeonEditorSystem::DungeonEditorSystem ( Rom * rom,
GameData * game_data = nullptr )
explicit

Definition at line 42 of file dungeon_editor_system.cc.

◆ ~DungeonEditorSystem()

yaze::zelda3::DungeonEditorSystem::~DungeonEditorSystem ( )

Definition at line 45 of file dungeon_editor_system.cc.

References external_room_, and object_editor_.

Member Function Documentation

◆ SetGameData()

void yaze::zelda3::DungeonEditorSystem::SetGameData ( GameData * game_data)
inline

Definition at line 45 of file dungeon_editor_system.h.

References game_data_.

◆ Initialize()

absl::Status yaze::zelda3::DungeonEditorSystem::Initialize ( )

Definition at line 52 of file dungeon_editor_system.cc.

References object_editor_, RETURN_IF_ERROR, and rom_.

◆ LoadDungeon()

◆ SaveDungeon()

◆ SaveRoom()

absl::Status yaze::zelda3::DungeonEditorSystem::SaveRoom ( int room_id)

Definition at line 121 of file dungeon_editor_system.cc.

References SaveRoomData().

Here is the call graph for this function:

◆ ReloadRoom()

absl::Status yaze::zelda3::DungeonEditorSystem::ReloadRoom ( int room_id)

Definition at line 125 of file dungeon_editor_system.cc.

References LoadRoomData().

Here is the call graph for this function:

◆ SetCurrentRoom()

absl::Status yaze::zelda3::DungeonEditorSystem::SetCurrentRoom ( int room_id)

◆ GetCurrentRoom()

int yaze::zelda3::DungeonEditorSystem::GetCurrentRoom ( ) const

◆ GetRoom()

◆ GetObjectEditor()

std::shared_ptr< DungeonObjectEditor > yaze::zelda3::DungeonEditorSystem::GetObjectEditor ( )

Definition at line 153 of file dungeon_editor_system.cc.

References BindObjectEditorToCurrentRoom(), object_editor_, and rom_.

Here is the call graph for this function:

◆ Undo()

absl::Status yaze::zelda3::DungeonEditorSystem::Undo ( )

Definition at line 162 of file dungeon_editor_system.cc.

References CanUndo(), and object_editor_.

Here is the call graph for this function:

◆ Redo()

absl::Status yaze::zelda3::DungeonEditorSystem::Redo ( )

Definition at line 174 of file dungeon_editor_system.cc.

References CanRedo(), and object_editor_.

Here is the call graph for this function:

◆ CanUndo()

bool yaze::zelda3::DungeonEditorSystem::CanUndo ( ) const

Definition at line 186 of file dungeon_editor_system.cc.

References undo_history_.

Referenced by Undo().

◆ CanRedo()

bool yaze::zelda3::DungeonEditorSystem::CanRedo ( ) const

Definition at line 190 of file dungeon_editor_system.cc.

References redo_history_.

Referenced by Redo().

◆ ClearHistory()

void yaze::zelda3::DungeonEditorSystem::ClearHistory ( )

Definition at line 194 of file dungeon_editor_system.cc.

References redo_history_, and undo_history_.

Referenced by RefreshRomBackedState().

◆ SetRoomChangedCallback()

void yaze::zelda3::DungeonEditorSystem::SetRoomChangedCallback ( RoomChangedCallback callback)

Definition at line 199 of file dungeon_editor_system.cc.

References room_changed_callback_.

◆ GetEditorState()

DungeonEditorSystem::EditorState yaze::zelda3::DungeonEditorSystem::GetEditorState ( ) const

Definition at line 203 of file dungeon_editor_system.cc.

References editor_state_.

◆ GetROM()

Rom * yaze::zelda3::DungeonEditorSystem::GetROM ( ) const

Definition at line 207 of file dungeon_editor_system.cc.

References rom_.

◆ IsDirty()

bool yaze::zelda3::DungeonEditorSystem::IsDirty ( ) const

◆ SetROM()

void yaze::zelda3::DungeonEditorSystem::SetROM ( Rom * rom)

Definition at line 215 of file dungeon_editor_system.cc.

References BindObjectEditorToCurrentRoom(), object_editor_, and rom_.

Here is the call graph for this function:

◆ SetExternalRoom()

void yaze::zelda3::DungeonEditorSystem::SetExternalRoom ( Room * room)

Definition at line 223 of file dungeon_editor_system.cc.

References BindObjectEditorToCurrentRoom(), external_room_, and object_editor_.

Here is the call graph for this function:

◆ RefreshRomBackedState()

absl::Status yaze::zelda3::DungeonEditorSystem::RefreshRomBackedState ( Room * external_room,
int current_room_id )

◆ BindObjectEditorToCurrentRoom()

absl::Status yaze::zelda3::DungeonEditorSystem::BindObjectEditorToCurrentRoom ( )
private

◆ GetManagedRoom()

Room * yaze::zelda3::DungeonEditorSystem::GetManagedRoom ( int room_id)
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().

Here is the call graph for this function:

◆ SaveManagedRoom()

absl::Status yaze::zelda3::DungeonEditorSystem::SaveManagedRoom ( Room & room)
private

Definition at line 287 of file dungeon_editor_system.cc.

References rom_.

Referenced by SaveRoomData().

◆ InitializeObjectEditor()

absl::Status yaze::zelda3::DungeonEditorSystem::InitializeObjectEditor ( )
private

Definition at line 291 of file dungeon_editor_system.cc.

References BindObjectEditorToCurrentRoom(), object_editor_, RETURN_IF_ERROR, and rom_.

Here is the call graph for this function:

◆ LoadRoomData()

◆ SaveRoomData()

absl::Status yaze::zelda3::DungeonEditorSystem::SaveRoomData ( int room_id)
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().

Here is the call graph for this function:

Member Data Documentation

◆ rom_

Rom* yaze::zelda3::DungeonEditorSystem::rom_
private

◆ game_data_

GameData* yaze::zelda3::DungeonEditorSystem::game_data_ = nullptr
private

Definition at line 94 of file dungeon_editor_system.h.

Referenced by GetRoom(), and SetGameData().

◆ object_editor_

std::shared_ptr<DungeonObjectEditor> yaze::zelda3::DungeonEditorSystem::object_editor_
private

◆ external_room_

Room* yaze::zelda3::DungeonEditorSystem::external_room_ = nullptr
private

◆ editor_state_

EditorState yaze::zelda3::DungeonEditorSystem::editor_state_
private

◆ rooms_

std::unordered_map<int, Room> yaze::zelda3::DungeonEditorSystem::rooms_
private

◆ room_changed_callback_

RoomChangedCallback yaze::zelda3::DungeonEditorSystem::room_changed_callback_
private

Definition at line 104 of file dungeon_editor_system.h.

Referenced by SetRoomChangedCallback().

◆ undo_history_

std::vector<UndoPoint> yaze::zelda3::DungeonEditorSystem::undo_history_
private

Definition at line 113 of file dungeon_editor_system.h.

Referenced by CanUndo(), and ClearHistory().

◆ redo_history_

std::vector<UndoPoint> yaze::zelda3::DungeonEditorSystem::redo_history_
private

Definition at line 114 of file dungeon_editor_system.h.

Referenced by CanRedo(), and ClearHistory().

◆ kMaxUndoHistory

constexpr size_t yaze::zelda3::DungeonEditorSystem::kMaxUndoHistory = 100
staticconstexprprivate

Definition at line 115 of file dungeon_editor_system.h.


The documentation for this class was generated from the following files: