yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::core::LyraTerrainDocument Class Reference

#include <lyra_terrain_document.h>

Collaboration diagram for yaze::core::LyraTerrainDocument:

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_
 

Detailed Description

Definition at line 171 of file lyra_terrain_document.h.

Member Typedef Documentation

◆ Map

using yaze::core::LyraTerrainDocument::Map = std::array<uint16_t, kMapSize * kMapSize>

Definition at line 183 of file lyra_terrain_document.h.

◆ Maps

Definition at line 184 of file lyra_terrain_document.h.

Constructor & Destructor Documentation

◆ LyraTerrainDocument()

yaze::core::LyraTerrainDocument::LyraTerrainDocument ( )
privatedefault

Member Function Documentation

◆ Create()

absl::StatusOr< LyraTerrainDocument > yaze::core::LyraTerrainDocument::Create ( const LyraTerrainProfile & profile,
uint16_t fill_tile = 0 )
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().

Here is the call graph for this function:

◆ Parse()

◆ Serialize()

◆ profile()

const LyraTerrainProfile & yaze::core::LyraTerrainDocument::profile ( ) const
inline

◆ maps()

const Maps & yaze::core::LyraTerrainDocument::maps ( ) const
inline

Definition at line 193 of file lyra_terrain_document.h.

References maps_.

◆ authoring()

const LyraAuthoringState & yaze::core::LyraTerrainDocument::authoring ( ) const
inline

◆ GameplayAreaForMap()

const LyraGameplayArea * yaze::core::LyraTerrainDocument::GameplayAreaForMap ( int map_id) const

◆ SetAuthoring()

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_.

◆ tile()

absl::StatusOr< uint16_t > yaze::core::LyraTerrainDocument::tile ( int global_x,
int global_y ) const

◆ MapTile()

absl::StatusOr< uint16_t > yaze::core::LyraTerrainDocument::MapTile ( int map_id,
int x,
int y ) const

Definition at line 989 of file lyra_terrain_document.cc.

References kFirstMap, kMapSize, and maps_.

Referenced by tile().

◆ BeginStroke()

absl::Status yaze::core::LyraTerrainDocument::BeginStroke ( )

◆ Paint()

absl::Status yaze::core::LyraTerrainDocument::Paint ( int global_x,
int global_y,
uint16_t tile_id )

◆ EndStroke()

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_.

◆ CancelStroke()

void yaze::core::LyraTerrainDocument::CancelStroke ( )

◆ stroke_active()

bool yaze::core::LyraTerrainDocument::stroke_active ( ) const
inline

Definition at line 206 of file lyra_terrain_document.h.

References stroke_active_.

◆ ApplyStroke()

absl::Status yaze::core::LyraTerrainDocument::ApplyStroke ( const LyraTerrainStroke & stroke,
bool undo )

◆ dirty()

bool yaze::core::LyraTerrainDocument::dirty ( ) const
inline

Definition at line 210 of file lyra_terrain_document.h.

References authoring_, maps_, saved_authoring_, and saved_maps_.

◆ MarkSaved()

void yaze::core::LyraTerrainDocument::MarkSaved ( )
inline

Definition at line 213 of file lyra_terrain_document.h.

References authoring_, maps_, saved_authoring_, and saved_maps_.

Member Data Documentation

◆ kSchemaVersion

constexpr int yaze::core::LyraTerrainDocument::kSchemaVersion = 5
staticconstexpr

Definition at line 173 of file lyra_terrain_document.h.

Referenced by Parse().

◆ kMaxEdgeConnections

constexpr int yaze::core::LyraTerrainDocument::kMaxEdgeConnections = 64
staticconstexpr

◆ kFirstMap

◆ kMapCount

◆ kColumns

constexpr int yaze::core::LyraTerrainDocument::kColumns = 8
staticconstexpr

◆ kRows

constexpr int yaze::core::LyraTerrainDocument::kRows = 4
staticconstexpr

◆ kMapSize

◆ kTilePixels

constexpr int yaze::core::LyraTerrainDocument::kTilePixels = 16
staticconstexpr

Definition at line 180 of file lyra_terrain_document.h.

Referenced by Parse(), and Serialize().

◆ kWidth

constexpr int yaze::core::LyraTerrainDocument::kWidth = kColumns * kMapSize
staticconstexpr

Definition at line 181 of file lyra_terrain_document.h.

Referenced by tile().

◆ kHeight

constexpr int yaze::core::LyraTerrainDocument::kHeight = kRows * kMapSize
staticconstexpr

Definition at line 182 of file lyra_terrain_document.h.

Referenced by tile().

◆ profile_

LyraTerrainProfile yaze::core::LyraTerrainDocument::profile_
private

Definition at line 220 of file lyra_terrain_document.h.

Referenced by ApplyStroke(), Paint(), profile(), and Serialize().

◆ maps_

Maps yaze::core::LyraTerrainDocument::maps_ {}
private

◆ saved_maps_

Maps yaze::core::LyraTerrainDocument::saved_maps_ {}
private

Definition at line 222 of file lyra_terrain_document.h.

Referenced by dirty(), and MarkSaved().

◆ authoring_

LyraAuthoringState yaze::core::LyraTerrainDocument::authoring_ {}
private

◆ saved_authoring_

LyraAuthoringState yaze::core::LyraTerrainDocument::saved_authoring_ {}
private

Definition at line 224 of file lyra_terrain_document.h.

Referenced by dirty(), and MarkSaved().

◆ stroke_active_

bool yaze::core::LyraTerrainDocument::stroke_active_ = false
private

◆ active_stroke_

LyraTerrainStroke yaze::core::LyraTerrainDocument::active_stroke_
private

Definition at line 226 of file lyra_terrain_document.h.

Referenced by BeginStroke(), CancelStroke(), EndStroke(), and Paint().

◆ active_cells_

std::unordered_map<size_t, size_t> yaze::core::LyraTerrainDocument::active_cells_
private

Definition at line 227 of file lyra_terrain_document.h.

Referenced by BeginStroke(), CancelStroke(), EndStroke(), and Paint().


The documentation for this class was generated from the following files: