yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
resolved_graphics_context.h
Go to the documentation of this file.
1#ifndef YAZE_ZELDA3_GRAPHICS_RESOLVED_GRAPHICS_CONTEXT_H_
2#define YAZE_ZELDA3_GRAPHICS_RESOLVED_GRAPHICS_CONTEXT_H_
3
4#include <array>
5#include <cstdint>
6#include <optional>
7#include <string>
8#include <vector>
9
10#include "absl/status/statusor.h"
12
13namespace yaze {
14namespace core {
15class TerrainCatalog;
16} // namespace core
17
18namespace zelda3 {
19
20class OverworldMap;
21class Room;
22struct GameData;
23
24// Model addresses recorded by the palette loaders, not CGRAM or ROM offsets.
25// HUD and animated palette frames have no writable mapping in this slice.
33using PaletteAddressMap = std::array<std::optional<PaletteColorAddress>, 128>;
35absl::StatusOr<gfx::SnesColor> ReadPaletteColor(
36 const GameData& owner, const PaletteColorAddress& address);
37
38// Caller-supplied project facts. Sheet and palette facts come from the loader.
43
44// One of the 16 slots a map or room actually loaded.
46 int slot = 0;
47 std::string role;
48 std::string palette_group;
49 int sheet_id = 0;
50 std::string source;
52 bool loader_agrees = false;
53 uint64_t store_revision = 0;
54 int width = 0;
55 int height = 0;
56 bool composite = false;
60};
61
63 std::string name;
64 std::string source;
65 int selector = -1;
66 bool inherited = false;
67};
68
69// A palette context that applies beside the loaded one, or an explicit gap.
71 std::string name;
72 std::string state;
73 std::string detail;
74};
75
76// Read-only graphics facts for one overworld map or one dungeon room.
78 std::string schema = "yaze.graphics_context.v1";
79 std::string surface;
80 bool graphics_loaded = false;
81 int id = -1;
82 int parent_id = -1;
83 std::string project_name;
84 std::string rom_sha256;
85 uint64_t graphics_revision = 0;
87 std::string terrain_catalog = "not_attached";
90 bool loader_agrees = false;
91 std::vector<ResolvedGraphicsSlot> slots;
92 std::vector<ResolvedPaletteSource> palettes;
93 std::vector<ResolvedAlternateContext> alternates;
94
95 std::string ToJson() const;
96};
97
98// Requires LoadAreaGraphics() on this map. LoadPalette() fills palette colors.
100 const OverworldMap& map, const GraphicsContextIdentity& identity = {});
101
102// Requires LoadRoomGraphics() on this room.
103ResolvedGraphicsContext DescribeDungeonGraphicsContext(
104 const Room& room, const GraphicsContextIdentity& identity = {});
105
106} // namespace zelda3
107} // namespace yaze
108
109#endif // YAZE_ZELDA3_GRAPHICS_RESOLVED_GRAPHICS_CONTEXT_H_
Represents a single Overworld map screen.
ResolvedGraphicsContext DescribeDungeonGraphicsContext(const Room &room, const GraphicsContextIdentity &identity)
const char * PaletteAddressGroupName(PaletteAddressGroup group)
ResolvedGraphicsContext DescribeOverworldGraphicsContext(const OverworldMap &map, const GraphicsContextIdentity &identity)
absl::StatusOr< gfx::SnesColor > ReadPaletteColor(const GameData &owner, const PaletteColorAddress &address)
std::array< std::optional< PaletteColorAddress >, 128 > PaletteAddressMap
bool operator==(const PaletteColorAddress &) const =default
std::vector< ResolvedPaletteSource > palettes
std::vector< ResolvedAlternateContext > alternates
std::vector< ResolvedGraphicsSlot > slots