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:
20 EditorDungeonState(Rom* rom, GameData* game_data) : rom_(rom), game_data_(game_data) {}
21
22 // Chest State
23 bool IsChestOpen(int room_id, int chest_index) const override {
24 auto it = chest_states_.find({room_id, chest_index});
25 if (it != chest_states_.end()) {
26 return it->second;
27 }
28 return false; // Default closed
29 }
30
31 void SetChestOpen(int room_id, int chest_index, bool open) {
32 chest_states_[{room_id, chest_index}] = open;
33 }
34
35 bool IsBigChestOpen() const override { return big_chest_open_; }
36 void SetBigChestOpen(bool open) { big_chest_open_ = open; }
37
38 // Door State
39 bool IsDoorOpen(int room_id, int door_index) const override {
40 auto it = door_states_.find({room_id, door_index});
41 if (it != door_states_.end()) {
42 return it->second;
43 }
44 return false; // Default closed
45 }
46
47 void SetDoorOpen(int room_id, int door_index, bool open) {
48 door_states_[{room_id, door_index}] = open;
49 }
50
51 bool IsDoorSwitchActive(int room_id) const override {
52 auto it = door_switch_states_.find(room_id);
53 if (it != door_switch_states_.end()) {
54 return it->second;
55 }
56 return false; // Default inactive
57 }
58
59 void SetDoorSwitchActive(int room_id, bool active) {
60 door_switch_states_[room_id] = active;
61 }
62
63 // Object State
64 bool IsWallMoved(int room_id) const override {
65 auto it = wall_moved_states_.find(room_id);
66 if (it != wall_moved_states_.end()) {
67 return it->second;
68 }
69 return false; // Default not moved
70 }
71
72 void SetWallMoved(int room_id, bool moved) {
73 wall_moved_states_[room_id] = moved;
74 }
75
76 bool IsFloorBombable(int room_id) const override {
77 auto it = floor_bombable_states_.find(room_id);
78 if (it != floor_bombable_states_.end()) {
79 return it->second;
80 }
81 return false; // Default solid
82 }
83
84 void SetFloorBombable(int room_id, bool bombed) {
85 floor_bombable_states_[room_id] = bombed;
86 }
87
88 bool IsRupeeFloorActive(int room_id) const override {
89 auto it = rupee_floor_states_.find(room_id);
90 if (it != rupee_floor_states_.end()) {
91 return it->second;
92 }
93 return false; // Default hidden/inactive
94 }
95
96 void SetRupeeFloorActive(int room_id, bool active) {
97 rupee_floor_states_[room_id] = active;
98 }
99
100 // General Flags
101 bool IsCrystalSwitchBlue() const override { return crystal_switch_blue_; }
102 void SetCrystalSwitchBlue(bool blue) { crystal_switch_blue_ = blue; }
103
104 // Reset all state
105 void Reset() {
106 chest_states_.clear();
107 big_chest_open_ = false;
108 door_states_.clear();
109 door_switch_states_.clear();
110 wall_moved_states_.clear();
112 rupee_floor_states_.clear();
113 crystal_switch_blue_ = true; // Default blue
114 }
115
116 private:
119
120 // State storage
121 std::map<std::pair<int, int>, bool> chest_states_;
122 bool big_chest_open_ = false;
123
124 std::map<std::pair<int, int>, bool> door_states_;
125 std::map<int, bool> door_switch_states_;
126
127 std::map<int, bool> wall_moved_states_;
128 std::map<int, bool> floor_bombable_states_;
129 std::map<int, bool> rupee_floor_states_;
130
132};
133
134} // namespace zelda3
135} // namespace yaze
136
137#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:24
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 IsWallMoved(int room_id) const override
bool IsFloorBombable(int room_id) const override
std::map< std::pair< int, int >, bool > chest_states_
EditorDungeonState(Rom *rom, GameData *game_data)
void SetDoorOpen(int room_id, int door_index, bool open)
void SetRupeeFloorActive(int room_id, bool active)
void SetChestOpen(int room_id, int chest_index, bool open)
bool IsDoorSwitchActive(int room_id) const override
void SetWallMoved(int room_id, bool moved)
std::map< int, bool > floor_bombable_states_
bool IsRupeeFloorActive(int room_id) const override
void SetDoorSwitchActive(int room_id, bool active)
bool IsDoorOpen(int room_id, int door_index) const override
std::map< std::pair< int, int >, bool > door_states_