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
54 std::vector<size_t> objects;
55 std::vector<SelectedEntity> entities;
57 // Rigid pixel displacement, including paste relative to clipboard positions.
60};
61
70
71DungeonSelectionEditState CaptureDungeonSelectionEditState(
72 const zelda3::Room& room);
73
74uint8_t ChangedDungeonSelectionDomains(const DungeonSelectionEditState& before,
75 const DungeonSelectionEditState& after);
76
77// Pure planning: failed validation never changes room data, selection or history.
78// Stream allocation and global chest-table preflight belong to the editor's
79// existing persistence boundary; this planner does not write ROM bytes.
80absl::StatusOr<DungeonSelectionEditPlan> PlanDungeonSelectionEdit(
81 const zelda3::Room& room, const DungeonSelectionEditRequest& request);
82
83absl::StatusOr<DungeonSelectionClipboard> CopyDungeonSelection(
84 const zelda3::Room& room, const std::vector<size_t>& objects,
85 const std::vector<SelectedEntity>& entities);
86
87// Publish all requested data planes before the caller invalidates any renderer.
88// Restoring history intentionally permits legacy values retained in snapshots.
90 const DungeonSelectionEditState& state,
91 uint8_t domains);
92
93} // namespace yaze::editor
94
95#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)
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