yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
dungeon_room_transfer.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_DUNGEON_DUNGEON_ROOM_TRANSFER_H_
2#define YAZE_APP_EDITOR_DUNGEON_DUNGEON_ROOM_TRANSFER_H_
3
4#include <cstdint>
5#include <optional>
6#include <string>
7
8#include "absl/status/statusor.h"
11
12namespace yaze::editor {
13
14inline constexpr uint16_t kTransferObjects = 1;
15inline constexpr uint16_t kTransferDoors = 2;
16inline constexpr uint16_t kTransferSprites = 4;
17inline constexpr uint16_t kTransferItems = 8;
18inline constexpr uint16_t kTransferMetadata = 16;
19inline constexpr uint16_t kTransferCollision = 32;
20inline constexpr uint16_t kTransferWater = 64;
21inline constexpr uint16_t kTransferCore = 31;
22inline constexpr uint16_t kTransferAll = 127;
23inline constexpr size_t kMaxDungeonRoomDocumentBytes = 1024 * 1024;
24// Interchange resource bounds, not permission to author this many entities.
25// The object cap permits existing oversized rooms while bounding JSON/model
26// allocation; the independent 1 MiB serialized-document cap still applies.
27inline constexpr size_t kMaxDungeonRoomDocumentObjects = 4096;
28// A room may retain residual records from the entire fixed shared chest table.
29inline constexpr size_t kMaxDungeonRoomDocumentChestRecords =
31// UI recovery is keyed by a status payload, not localized error text.
32inline constexpr char kRoomTransferSharedHeaderPayload[] =
33 "yaze.room-transfer.shared-header";
34
37 bool copy_destinations = false;
38 bool operator==(const DungeonRoomTransferOptions&) const = default;
39};
40
41// Authored room fields, not a ROM image. Graphics/layout/message references
42// retain numeric IDs; their project-owned assets and incoming links are not
43// included. Selection, caches, raw reserved header bits and sprite sort mode
44// are not interchange data.
52
63
65// Compares authored fields only, ignoring provenance room ID and selection.
67 const DungeonRoomDocument& b);
68absl::Status ValidateDungeonRoomDocument(const DungeonRoomDocument& document);
69// Preserve oversized object lists and residual chest records in interchange.
70// Replacement still requires the stricter authoring validation in the planner.
72 const DungeonRoomDocument& document);
73absl::StatusOr<std::string> SerializeDungeonRoomDocument(
74 const DungeonRoomDocument& document);
75absl::StatusOr<DungeonRoomDocument> ParseDungeonRoomDocument(
76 const std::string& json);
77
78// Pure planning. Allocation, global table capacity and project write policy
79// require the editor's detached persistence preflight before publication.
80// Existing oversized object lists may remain the same size or shrink. An exact
81// object/chest no-op preserves legacy mappings and target block identities;
82// any changed replacement must satisfy the six-slot chest/lock authoring rules.
83absl::StatusOr<DungeonRoomTransferPlan> PlanDungeonRoomTransfer(
84 const zelda3::Room& target, const DungeonRoomDocument& source,
85 DungeonRoomTransferOptions options = {});
86// History restore deliberately accepts prior legacy fields. Publishes changed
87// domains only; callers own preflight, history and view invalidation.
89 const DungeonRoomDocument& document);
90
91} // namespace yaze::editor
92
93#endif // YAZE_APP_EDITOR_DUNGEON_DUNGEON_ROOM_TRANSFER_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:49
Editors are the view controllers for the application.
constexpr uint16_t kTransferMetadata
constexpr uint16_t kTransferAll
constexpr uint16_t kTransferItems
absl::Status ValidateDungeonRoomDocument(const DungeonRoomDocument &document)
constexpr uint16_t kTransferDoors
constexpr uint16_t kTransferCollision
constexpr uint16_t kTransferSprites
absl::StatusOr< DungeonRoomTransferPlan > PlanDungeonRoomTransfer(const zelda3::Room &target, const DungeonRoomDocument &source, DungeonRoomTransferOptions options)
constexpr size_t kMaxDungeonRoomDocumentObjects
bool SameDungeonRoomDocument(const DungeonRoomDocument &a, const DungeonRoomDocument &b)
constexpr char kRoomTransferSharedHeaderPayload[]
absl::Status ValidateDungeonRoomDocumentForInterchange(const DungeonRoomDocument &document)
constexpr uint16_t kTransferCore
absl::StatusOr< std::string > SerializeDungeonRoomDocument(const DungeonRoomDocument &document)
constexpr uint16_t kTransferWater
void ApplyDungeonRoomDocument(zelda3::Room &room, const DungeonRoomDocument &document)
absl::StatusOr< DungeonRoomDocument > ParseDungeonRoomDocument(const std::string &json)
DungeonRoomDocument CaptureDungeonRoomDocument(const zelda3::Room &room)
constexpr uint16_t kTransferObjects
constexpr size_t kMaxDungeonRoomDocumentChestRecords
constexpr size_t kMaxDungeonRoomDocumentBytes
constexpr int kChestTableCapacityRecords
zelda3::CustomCollisionMap collision
zelda3::Room::MetadataSnapshot metadata
bool operator==(const DungeonRoomTransferOptions &) const =default
std::optional< DungeonRoomDocument > clone_source_before