#include <lyra_terrain_document.h>

Public Types | |
| using | Map = std::array<uint16_t, kMapSize * kMapSize> |
| using | Maps = std::array<Map, kMapCount> |
Public Member Functions | |
| std::string | Serialize () const |
| const LyraTerrainProfile & | profile () const |
| const Maps & | maps () const |
| const LyraAuthoringState & | authoring () const |
| const LyraGameplayArea * | GameplayAreaForMap (int map_id) const |
| absl::Status | SetAuthoring (const LyraAuthoringState &before, const LyraAuthoringState &after) |
| absl::StatusOr< uint16_t > | tile (int global_x, int global_y) const |
| absl::StatusOr< uint16_t > | MapTile (int map_id, int x, int y) const |
| absl::Status | BeginStroke () |
| absl::Status | Paint (int global_x, int global_y, uint16_t tile_id) |
| absl::StatusOr< LyraTerrainStroke > | EndStroke () |
| void | CancelStroke () |
| bool | stroke_active () const |
| absl::Status | ApplyStroke (const LyraTerrainStroke &stroke, bool undo) |
| bool | dirty () const |
| void | MarkSaved () |
Static Public Member Functions | |
| static absl::StatusOr< LyraTerrainDocument > | Create (const LyraTerrainProfile &profile, uint16_t fill_tile=0) |
| static absl::StatusOr< LyraTerrainDocument > | Parse (std::string_view text, const LyraTerrainProfile &expected_profile) |
Static Public Attributes | |
| static constexpr int | kSchemaVersion = 5 |
| static constexpr int | kMaxEdgeConnections = 64 |
| static constexpr int | kFirstMap = 0xA0 |
| static constexpr int | kMapCount = 32 |
| static constexpr int | kColumns = 8 |
| static constexpr int | kRows = 4 |
| static constexpr int | kMapSize = 32 |
| static constexpr int | kTilePixels = 16 |
| static constexpr int | kWidth = kColumns * kMapSize |
| static constexpr int | kHeight = kRows * kMapSize |
Private Member Functions | |
| LyraTerrainDocument ()=default | |
Private Attributes | |
| LyraTerrainProfile | profile_ |
| Maps | maps_ {} |
| Maps | saved_maps_ {} |
| LyraAuthoringState | authoring_ {} |
| LyraAuthoringState | saved_authoring_ {} |
| bool | stroke_active_ = false |
| LyraTerrainStroke | active_stroke_ |
| std::unordered_map< size_t, size_t > | active_cells_ |
Definition at line 171 of file lyra_terrain_document.h.
| using yaze::core::LyraTerrainDocument::Map = std::array<uint16_t, kMapSize * kMapSize> |
Definition at line 183 of file lyra_terrain_document.h.
| using yaze::core::LyraTerrainDocument::Maps = std::array<Map, kMapCount> |
Definition at line 184 of file lyra_terrain_document.h.
|
privatedefault |
|
static |
Definition at line 492 of file lyra_terrain_document.cc.
References profile(), yaze::core::LyraTerrainProfile::tile_count, and yaze::core::LyraTerrainProfile::Validate().
Referenced by Parse().

|
static |
Definition at line 530 of file lyra_terrain_document.cc.
References yaze::core::LyraMapProperties::animated_sheet, yaze::core::LyraMapProperties::background_palette, Create(), yaze::Json::get(), yaze::core::LyraMapProperties::graphics_sheets, kColumns, kFirstMap, kMapCount, kMapSize, kMaxEdgeConnections, kRows, kSchemaVersion, kTilePixels, yaze::core::LyraMapProperties::main_palette, yaze::core::LyraGameplayArea::maps, yaze::core::LyraMapProperties::message_id, yaze::core::LyraMapProperties::music, yaze::core::LyraMapProperties::palette_set, yaze::Json::parse(), profile(), yaze::core::LyraMapProperties::sprite_graphics, yaze::core::LyraMapProperties::sprite_palettes, yaze::core::LyraTerrainProfile::tile_count, and yaze::Json::exception::what().
Referenced by yaze::cli::handlers::LyraVerifyProjectCommandHandler::Execute(), yaze::editor::EditorManager::RecordCompletedNativeSave(), and yaze::project::YazeProject::SaveAsWithLyraTerrain().
| std::string yaze::core::LyraTerrainDocument::Serialize | ( | ) | const |
Definition at line 932 of file lyra_terrain_document.cc.
References yaze::Json::array(), authoring_, yaze::core::LyraAuthoringState::edge_connections, yaze::core::LyraAuthoringState::flight_points, yaze::core::LyraAuthoringState::gameplay_areas, kColumns, kFirstMap, kMapCount, kMapSize, kRows, kTilePixels, yaze::core::LyraAuthoringState::maps, maps_, and profile_.
Referenced by yaze::editor::PublishLyraTerrainSource(), and yaze::project::YazeProject::SaveAsWithLyraTerrain().

|
inline |
Definition at line 192 of file lyra_terrain_document.h.
References profile_.
Referenced by Create(), Parse(), yaze::editor::PublishLyraTerrainSource(), and yaze::project::YazeProject::SaveAsWithLyraTerrain().
|
inline |
Definition at line 193 of file lyra_terrain_document.h.
References maps_.
|
inline |
Definition at line 194 of file lyra_terrain_document.h.
References authoring_.
Referenced by yaze::editor::LyraTerrainCanvas::Create(), and yaze::editor::LyraTerrainCanvas::Load().
| const LyraGameplayArea * yaze::core::LyraTerrainDocument::GameplayAreaForMap | ( | int | map_id | ) | const |
Definition at line 468 of file lyra_terrain_document.cc.
References authoring_, and yaze::core::LyraAuthoringState::gameplay_areas.
| absl::Status yaze::core::LyraTerrainDocument::SetAuthoring | ( | const LyraAuthoringState & | before, |
| const LyraAuthoringState & | after ) |
Definition at line 509 of file lyra_terrain_document.cc.
References authoring_, and stroke_active_.
| absl::StatusOr< uint16_t > yaze::core::LyraTerrainDocument::tile | ( | int | global_x, |
| int | global_y ) const |
Definition at line 978 of file lyra_terrain_document.cc.
References kColumns, kFirstMap, kHeight, kMapSize, kWidth, and MapTile().
Referenced by yaze::editor::OverworldEditor::InitTilePaintingManager(), Paint(), and yaze::editor::OverworldCanvasRenderer::PrepareContextMenu().

| absl::StatusOr< uint16_t > yaze::core::LyraTerrainDocument::MapTile | ( | int | map_id, |
| int | x, | ||
| int | y ) const |
| absl::Status yaze::core::LyraTerrainDocument::BeginStroke | ( | ) |
Definition at line 996 of file lyra_terrain_document.cc.
References active_cells_, active_stroke_, yaze::core::LyraTerrainStroke::changes, and stroke_active_.
| absl::Status yaze::core::LyraTerrainDocument::Paint | ( | int | global_x, |
| int | global_y, | ||
| uint16_t | tile_id ) |
Definition at line 1005 of file lyra_terrain_document.cc.
References active_cells_, active_stroke_, yaze::core::LyraTerrainStroke::changes, kColumns, kFirstMap, kMapSize, maps_, profile_, stroke_active_, tile(), and yaze::core::LyraTerrainProfile::tile_count.

| absl::StatusOr< LyraTerrainStroke > yaze::core::LyraTerrainDocument::EndStroke | ( | ) |
Definition at line 1031 of file lyra_terrain_document.cc.
References active_cells_, active_stroke_, and stroke_active_.
| void yaze::core::LyraTerrainDocument::CancelStroke | ( | ) |
Definition at line 1042 of file lyra_terrain_document.cc.
References active_cells_, active_stroke_, yaze::core::LyraTerrainStroke::changes, kFirstMap, kMapSize, maps_, and stroke_active_.
|
inline |
Definition at line 206 of file lyra_terrain_document.h.
References stroke_active_.
| absl::Status yaze::core::LyraTerrainDocument::ApplyStroke | ( | const LyraTerrainStroke & | stroke, |
| bool | undo ) |
Definition at line 1053 of file lyra_terrain_document.cc.
References yaze::core::LyraTerrainStroke::changes, kFirstMap, kMapSize, maps_, profile_, stroke_active_, and yaze::core::LyraTerrainProfile::tile_count.
|
inline |
Definition at line 210 of file lyra_terrain_document.h.
References authoring_, maps_, saved_authoring_, and saved_maps_.
|
inline |
Definition at line 213 of file lyra_terrain_document.h.
References authoring_, maps_, saved_authoring_, and saved_maps_.
|
staticconstexpr |
Definition at line 173 of file lyra_terrain_document.h.
Referenced by Parse().
|
staticconstexpr |
Definition at line 174 of file lyra_terrain_document.h.
Referenced by Parse(), and yaze::core::anonymous_namespace{lyra_terrain_document.cc}::ValidateAuthoringState().
|
staticconstexpr |
Definition at line 175 of file lyra_terrain_document.h.
Referenced by ApplyStroke(), CancelStroke(), yaze::core::anonymous_namespace{lyra_terrain_document.cc}::CellKey(), yaze::core::anonymous_namespace{lyra_terrain_document.cc}::Coordinates(), yaze::core::anonymous_namespace{lyra_terrain_document.cc}::EdgeEndpoint(), yaze::cli::handlers::LyraVerifyProjectCommandHandler::Execute(), yaze::editor::OverworldEditor::FocusLyraTerrain(), yaze::core::LyraEdgeMapsAdjacent(), yaze::core::LyraGameplayAreaFootprint(), MapTile(), Paint(), Parse(), yaze::editor::OverworldCanvasRenderer::RefreshTile16Order(), Serialize(), and tile().
|
staticconstexpr |
Definition at line 176 of file lyra_terrain_document.h.
Referenced by yaze::core::anonymous_namespace{lyra_terrain_document.cc}::Coordinates(), yaze::core::anonymous_namespace{lyra_terrain_document.cc}::EdgeEndpoint(), yaze::cli::handlers::LyraVerifyProjectCommandHandler::Execute(), yaze::core::LyraGameplayAreaFootprint(), Parse(), yaze::editor::OverworldCanvasRenderer::RefreshTile16Order(), and Serialize().
|
staticconstexpr |
Definition at line 177 of file lyra_terrain_document.h.
Referenced by yaze::core::LyraEdgeMapsAdjacent(), yaze::core::LyraGameplayAreaFootprint(), Paint(), Parse(), Serialize(), and tile().
|
staticconstexpr |
Definition at line 178 of file lyra_terrain_document.h.
Referenced by yaze::core::LyraGameplayAreaFootprint(), Parse(), and Serialize().
|
staticconstexpr |
Definition at line 179 of file lyra_terrain_document.h.
Referenced by ApplyStroke(), CancelStroke(), yaze::core::anonymous_namespace{lyra_terrain_document.cc}::CellKey(), yaze::core::anonymous_namespace{lyra_terrain_document.cc}::Coordinates(), MapTile(), Paint(), Parse(), Serialize(), tile(), and yaze::core::anonymous_namespace{lyra_terrain_document.cc}::ValidateAuthoringState().
|
staticconstexpr |
Definition at line 180 of file lyra_terrain_document.h.
Referenced by Parse(), and Serialize().
Definition at line 181 of file lyra_terrain_document.h.
Referenced by tile().
Definition at line 182 of file lyra_terrain_document.h.
Referenced by tile().
|
private |
Definition at line 220 of file lyra_terrain_document.h.
Referenced by ApplyStroke(), Paint(), profile(), and Serialize().
|
private |
Definition at line 221 of file lyra_terrain_document.h.
Referenced by ApplyStroke(), CancelStroke(), dirty(), maps(), MapTile(), MarkSaved(), Paint(), and Serialize().
|
private |
Definition at line 222 of file lyra_terrain_document.h.
Referenced by dirty(), and MarkSaved().
|
private |
Definition at line 223 of file lyra_terrain_document.h.
Referenced by authoring(), dirty(), GameplayAreaForMap(), MarkSaved(), Serialize(), and SetAuthoring().
|
private |
Definition at line 224 of file lyra_terrain_document.h.
Referenced by dirty(), and MarkSaved().
|
private |
Definition at line 225 of file lyra_terrain_document.h.
Referenced by ApplyStroke(), BeginStroke(), CancelStroke(), EndStroke(), Paint(), SetAuthoring(), and stroke_active().
|
private |
Definition at line 226 of file lyra_terrain_document.h.
Referenced by BeginStroke(), CancelStroke(), EndStroke(), and Paint().
|
private |
Definition at line 227 of file lyra_terrain_document.h.
Referenced by BeginStroke(), CancelStroke(), EndStroke(), and Paint().