yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
dungeon_selection_edit.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_DUNGEON_DUNGEON_SELECTION_EDIT_H_
2#define YAZE_APP_EDITOR_DUNGEON_DUNGEON_SELECTION_EDIT_H_
3
4#include <cstddef>
5#include <cstdint>
6#include <optional>
7#include <vector>
8
9#include "absl/status/statusor.h"
11
12namespace yaze::editor {
13
14// Authored fields only: snapshots never retain borrowed sprite preview buffers.
16 uint8_t id;
18 bool deleted;
19 bool operator==(const DungeonSpriteSnapshot&) const = default;
20};
21
22inline constexpr uint8_t kSelectionObjects = 1;
23inline constexpr uint8_t kSelectionDoors = 2;
24inline constexpr uint8_t kSelectionSprites = 4;
25inline constexpr uint8_t kSelectionItems = 8;
26
28 std::vector<zelda3::RoomObject> objects;
29 std::vector<chest_data> chests;
30 std::vector<zelda3::Room::Door> doors;
31 std::vector<DungeonSpriteSnapshot> sprites;
32 std::vector<zelda3::PotItem> items;
33 std::vector<size_t> selected_objects;
34 std::vector<SelectedEntity> selected_entities;
35};
36
38 std::vector<zelda3::RoomObject> objects;
39 std::vector<std::optional<chest_data>> object_chests;
40 std::vector<zelda3::Room::Door> doors;
41 std::vector<DungeonSpriteSnapshot> sprites;
42 std::vector<zelda3::PotItem> items;
45 bool empty() const {
46 return objects.empty() && doors.empty() && sprites.empty() && items.empty();
47 }
48};
49
51 kDelete,
53 kMove,
54 kPaste,
56};
57
60 std::vector<size_t> objects;
61 std::vector<SelectedEntity> entities;
63 // Rigid pixel displacement, including paste relative to clipboard positions.
66};
67
76
77DungeonSelectionEditState CaptureDungeonSelectionEditState(
78 const zelda3::Room& room);
79
80uint8_t ChangedDungeonSelectionDomains(const DungeonSelectionEditState& before,
81 const DungeonSelectionEditState& after);
82
83// Pure planning: failed validation never changes room data, selection or history.
84// Stream allocation and global chest-table preflight belong to the editor's
85// existing persistence boundary; this planner does not write ROM bytes.
86absl::StatusOr<DungeonSelectionEditPlan> PlanDungeonSelectionEdit(
87 const zelda3::Room& room, const DungeonSelectionEditRequest& request);
88
89// Complete the currently supported normal-door stone surround. Reuses exact
90// native trim records and returns the door + trim selection even for a no-op.
91// Profile opt-in and persistence preflight belong to the caller.
92absl::StatusOr<DungeonSelectionEditPlan> PlanDungeonDoorTrim(
93 const zelda3::Room& room, size_t door_index);
94
95absl::StatusOr<DungeonSelectionClipboard> CopyDungeonSelection(
96 const zelda3::Room& room, const std::vector<size_t>& objects,
97 const std::vector<SelectedEntity>& entities);
98
99// Publish all requested data planes before the caller invalidates any renderer.
100// Restoring history intentionally permits legacy values retained in snapshots.
102 const DungeonSelectionEditState& state,
103 uint8_t domains);
104
105} // namespace yaze::editor
106
107#endif // YAZE_APP_EDITOR_DUNGEON_DUNGEON_SELECTION_EDIT_H_
Editors are the view controllers for the application.
absl::StatusOr< DungeonSelectionClipboard > CopyDungeonSelection(const zelda3::Room &room, const std::vector< size_t > &objects, const std::vector< SelectedEntity > &entities)
absl::StatusOr< DungeonSelectionEditPlan > PlanDungeonSelectionEdit(const zelda3::Room &room, const DungeonSelectionEditRequest &request)
DungeonSelectionEditState CaptureDungeonSelectionEditState(const zelda3::Room &room)
absl::StatusOr< DungeonSelectionEditPlan > PlanDungeonDoorTrim(const zelda3::Room &room, size_t door_index)
constexpr uint8_t kSelectionSprites
constexpr uint8_t kSelectionObjects
uint8_t ChangedDungeonSelectionDomains(const DungeonSelectionEditState &a, const DungeonSelectionEditState &b)
constexpr uint8_t kSelectionDoors
void ApplyDungeonSelectionEditState(zelda3::Room &room, const DungeonSelectionEditState &state, uint8_t domains)
constexpr uint8_t kSelectionItems
std::vector< zelda3::Room::Door > doors
std::vector< zelda3::RoomObject > objects
std::vector< DungeonSpriteSnapshot > sprites
std::vector< std::optional< chest_data > > object_chests
const DungeonSelectionClipboard * clipboard
std::vector< SelectedEntity > selected_entities
std::vector< zelda3::Room::Door > doors
std::vector< DungeonSpriteSnapshot > sprites
std::vector< zelda3::RoomObject > objects
bool operator==(const DungeonSpriteSnapshot &) const =default