yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
project_graphics_import.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_OVERWORLD_PROJECT_GRAPHICS_IMPORT_H_
2#define YAZE_APP_EDITOR_OVERWORLD_PROJECT_GRAPHICS_IMPORT_H_
3
4#include <array>
5#include <cstdint>
6#include <filesystem>
7#include <optional>
8#include <string>
9#include <vector>
10
11#include "absl/status/statusor.h"
17
18namespace yaze::editor {
19
20// Logical source art only. Neither IDs nor palette names allocate destinations.
22 std::string id;
23 std::array<std::optional<uint16_t>, 16> colors;
24 std::vector<uint8_t> characters; // Native 4bpp, 32 bytes per logical CHR.
25};
27 bool transparent = true;
28 std::string palette;
29 int character = 0;
30 bool hflip = false;
31 bool vflip = false;
32};
34 std::array<ProjectImportQuadrant, 4> quadrants;
35};
37 int width = 0; // Tile16 cells.
38 int height = 0;
39 std::vector<ProjectImportPalette> palettes;
40 std::vector<ProjectImportTile16> cells; // Row-major, complete rectangle.
41 std::string source_sha256;
42};
43
44// These ranges must already be owned by the caller. Unreferenced is not free.
46 std::string palette;
47 int bg_row = -1;
49 int owned_character_count = 0; // Includes exact-background alpha variants.
50};
52 std::vector<uint8_t> target_resource;
54 std::vector<ProjectImportPaletteBinding> palettes;
55 int first_tile16 = -1;
57 int anchor_x = 0; // Tile16 coordinates in context.grid.
58 int anchor_y = 0;
59};
60
61// Snapshot built from the actual resolved map, including unsaved source art.
62// owner must remain alive and belongs to the active caller session.
64 const zelda3::GameData* owner = nullptr;
65 std::vector<zelda3::Tile8PixelData> characters;
66 std::array<uint16_t, 128> palette{};
68 std::vector<gfx::Tile16> definitions;
69 int grid_width = 0;
70 int grid_height = 0;
71 std::vector<uint16_t> grid; // Row-major current Tile16 IDs.
72};
79 std::string source_sha256;
80 std::vector<uint8_t> resource_before;
81 std::vector<uint8_t> resource_after;
82 std::vector<gfx::PaletteColorChange> palette_changes;
83 std::vector<Tile16Commit> definitions;
84 TileBrush stamp; // Fully transparent cells retain their current Tile16 IDs.
85 std::vector<ProjectImportReplacement> replacements;
86 std::vector<std::string> notes;
87};
88
89// Reads a logical pack and its relative V2 catalog; verifies hashes and shapes.
90// It never writes an asset, ROM, document, history, or project.
91absl::StatusOr<ProjectGraphicsImportAsset> LoadProjectGraphicsImport(
92 const std::filesystem::path& logical_pack);
93
94absl::StatusOr<ProjectGraphicsImportContext>
96 const std::vector<gfx::Tile16>& definitions,
97 const std::vector<uint16_t>& grid,
98 int width, int height);
99
100// Pure planning. Partial alpha is composed against the resolved current tile;
101// exact background colors may use unused logical indices except 0/8. Refuses
102// when palette/range capacity is insufficient or a placed consumer changes.
103absl::StatusOr<ProjectGraphicsImportPlan> PlanProjectGraphicsImport(
104 const ProjectGraphicsImportAsset& asset,
105 const ProjectGraphicsImportBindings& bindings,
106 const ProjectGraphicsImportContext& context);
107
108} // namespace yaze::editor
109
110#endif // YAZE_APP_EDITOR_OVERWORLD_PROJECT_GRAPHICS_IMPORT_H_
Represents a single Overworld map screen.
Editors are the view controllers for the application.
absl::StatusOr< ProjectGraphicsImportAsset > LoadProjectGraphicsImport(const std::filesystem::path &logical_pack)
absl::StatusOr< ProjectGraphicsImportContext > CaptureProjectGraphicsImportContext(const zelda3::OverworldMap &map, const std::vector< gfx::Tile16 > &definitions, const std::vector< uint16_t > &grid, int width, int height)
absl::StatusOr< ProjectGraphicsImportPlan > PlanProjectGraphicsImport(const ProjectGraphicsImportAsset &asset, const ProjectGraphicsImportBindings &bindings, const ProjectGraphicsImportContext &context)
std::array< std::optional< PaletteColorAddress >, 128 > PaletteAddressMap
std::vector< ProjectImportPalette > palettes
std::vector< ProjectImportTile16 > cells
std::vector< ProjectImportPaletteBinding > palettes
std::vector< zelda3::Tile8PixelData > characters
std::vector< ProjectImportReplacement > replacements
std::vector< gfx::PaletteColorChange > palette_changes
std::array< std::optional< uint16_t >, 16 > colors
std::array< ProjectImportQuadrant, 4 > quadrants