yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
editor_dungeon_state.h
Go to the documentation of this file.
1#ifndef YAZE_ZELDA3_DUNGEON_EDITOR_DUNGEON_STATE_H
2#define YAZE_ZELDA3_DUNGEON_EDITOR_DUNGEON_STATE_H
3
4#include <map>
6
7namespace yaze {
8class Rom;
9namespace zelda3 {
10struct GameData;
11
19 public:
21 : rom_(rom), game_data_(game_data) {}
22
23 // Chest State
24 bool IsChestOpen(int room_id, int chest_index) const override {
25 auto it = chest_states_.find({room_id, chest_index});
26 if (it != chest_states_.end()) {
27 return it->second;
28 }
29 return false; // Default closed
30 }
31
32 void SetChestOpen(int room_id, int chest_index, bool open) {
33 chest_states_[{room_id, chest_index}] = open;
34 }
35
36 bool IsBigChestOpen() const override { return big_chest_open_; }
37 bool IsBigChestOpen(int room_id, int chest_index) const override {
38 return IsChestOpen(room_id, chest_index) || big_chest_open_;
39 }
40 void SetBigChestOpen(bool open) { big_chest_open_ = open; }
41
42 // Door State
43 bool IsDoorOpen(int room_id, int door_index) const override {
44 auto it = door_states_.find({room_id, door_index});
45 if (it != door_states_.end()) {
46 return it->second;
47 }
48 return false; // Default closed
49 }
50
51 void SetDoorOpen(int room_id, int door_index, bool open) {
52 door_states_[{room_id, door_index}] = open;
53 }
54
55 bool IsDoorSwitchActive(int room_id) const override {
56 auto it = door_switch_states_.find(room_id);
57 if (it != door_switch_states_.end()) {
58 return it->second;
59 }
60 return false; // Default inactive
61 }
62
63 void SetDoorSwitchActive(int room_id, bool active) {
64 door_switch_states_[room_id] = active;
65 }
66
67 bool IsWaterFaceActive(int room_id) const override {
68 auto it = water_face_active_states_.find(room_id);
69 if (it != water_face_active_states_.end()) {
70 return it->second;
71 }
72 return false;
73 }
74
75 void SetWaterFaceActive(int room_id, bool active) {
76 water_face_active_states_[room_id] = active;
77 }
78
79 bool IsDamFloodgateOpen(int room_id) const override {
80 auto it = dam_floodgate_open_states_.find(room_id);
81 if (it != dam_floodgate_open_states_.end()) {
82 return it->second;
83 }
84 return false;
85 }
86
87 void SetDamFloodgateOpen(int room_id, bool open) {
88 dam_floodgate_open_states_[room_id] = open;
89 }
90
91 // Object State
92 bool IsWallMoved(int room_id) const override {
93 auto it = wall_moved_states_.find(room_id);
94 if (it != wall_moved_states_.end()) {
95 return it->second;
96 }
97 return false; // Default not moved
98 }
99
100 void SetWallMoved(int room_id, bool moved) {
101 wall_moved_states_[room_id] = moved;
102 }
103
104 bool IsFloorBombable(int room_id) const override {
105 auto it = floor_bombable_states_.find(room_id);
106 if (it != floor_bombable_states_.end()) {
107 return it->second;
108 }
109 return false; // Default solid
110 }
111
112 void SetFloorBombable(int room_id, bool bombed) {
113 floor_bombable_states_[room_id] = bombed;
114 }
115
116 bool IsRupeeFloorCleared(int room_id) const override {
117 auto it = rupee_floor_cleared_states_.find(room_id);
118 if (it != rupee_floor_cleared_states_.end()) {
119 return it->second;
120 }
121 return false; // Default visible/uncollected
122 }
123
124 void SetRupeeFloorCleared(int room_id, bool cleared) {
125 rupee_floor_cleared_states_[room_id] = cleared;
126 }
127
128 // General Flags
129 bool IsCrystalSwitchBlue() const override { return crystal_switch_blue_; }
130 void SetCrystalSwitchBlue(bool blue) { crystal_switch_blue_ = blue; }
131
132 // Reset all state
133 void Reset() {
134 chest_states_.clear();
135 big_chest_open_ = false;
136 door_states_.clear();
137 door_switch_states_.clear();
140 wall_moved_states_.clear();
143 crystal_switch_blue_ = true; // Default blue
144 }
145
146 private:
149
150 // State storage
151 std::map<std::pair<int, int>, bool> chest_states_;
152 bool big_chest_open_ = false;
153
154 std::map<std::pair<int, int>, bool> door_states_;
155 std::map<int, bool> door_switch_states_;
156 std::map<int, bool> water_face_active_states_;
157 std::map<int, bool> dam_floodgate_open_states_;
158
159 std::map<int, bool> wall_moved_states_;
160 std::map<int, bool> floor_bombable_states_;
161 std::map<int, bool> rupee_floor_cleared_states_;
162
164};
165
166} // namespace zelda3
167} // namespace yaze
168
169#endif // YAZE_ZELDA3_DUNGEON_EDITOR_DUNGEON_STATE_H
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:28
Interface for accessing dungeon game state.
Editor implementation of DungeonState.
void SetFloorBombable(int room_id, bool bombed)
bool IsChestOpen(int room_id, int chest_index) const override
bool IsDamFloodgateOpen(int room_id) const override
bool IsRupeeFloorCleared(int room_id) const override
bool IsWallMoved(int room_id) const override
void SetWaterFaceActive(int room_id, bool active)
bool IsFloorBombable(int room_id) const override
bool IsWaterFaceActive(int room_id) const override
std::map< std::pair< int, int >, bool > chest_states_
EditorDungeonState(Rom *rom, GameData *game_data)
std::map< int, bool > rupee_floor_cleared_states_
void SetDoorOpen(int room_id, int door_index, bool open)
void SetChestOpen(int room_id, int chest_index, bool open)
void SetDamFloodgateOpen(int room_id, bool open)
bool IsDoorSwitchActive(int room_id) const override
void SetWallMoved(int room_id, bool moved)
std::map< int, bool > floor_bombable_states_
bool IsBigChestOpen(int room_id, int chest_index) const override
std::map< int, bool > water_face_active_states_
void SetDoorSwitchActive(int room_id, bool active)
bool IsDoorOpen(int room_id, int door_index) const override
std::map< int, bool > dam_floodgate_open_states_
std::map< std::pair< int, int >, bool > door_states_
void SetRupeeFloorCleared(int room_id, bool cleared)