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

#include <graphics_sheet_store.h>

Classes

class  Edit
 

Public Member Functions

const std::vector< uint8_t > & pixels () const
 
std::vector< uint8_t > & mutable_pixels ()
 For the graphics_buffer alias and the loader only.
 
bool HasSheet (uint16_t sheet) const
 True when the buffer holds all 4096 bytes of sheet.
 
absl::Span< const uint8_t > Sheet (uint16_t sheet) const
 The sheet's 4096 pixels, or an empty span when it is not held.
 
uint64_t Revision (uint16_t sheet) const
 
absl::Status WriteSheet (uint16_t sheet, absl::Span< const uint8_t > pixels, uint8_t max_index=0x0F)
 
void MarkAllSheetsChanged ()
 Call after the loader refills the buffer: bumps every revision.
 
void Clear ()
 Empties the buffer and bumps every revision.
 

Static Public Attributes

static constexpr uint16_t kSheetCount = 223
 
static constexpr size_t kSheetWidth = 128
 
static constexpr size_t kSheetHeight = 32
 
static constexpr size_t kSheetBytes = kSheetWidth * kSheetHeight
 

Private Attributes

std::vector< uint8_t > pixels_
 
std::array< uint64_t, kSheetCount > revisions_ {}
 

Detailed Description

Definition at line 33 of file graphics_sheet_store.h.

Member Function Documentation

◆ pixels()

const std::vector< uint8_t > & yaze::zelda3::GraphicsSheetStore::pixels ( ) const
inline

The whole buffer, graphics_buffer layout. May hold fewer than 223 sheets while a load is in progress or after Clear().

Definition at line 42 of file graphics_sheet_store.h.

References pixels_.

Referenced by WriteSheet().

◆ mutable_pixels()

std::vector< uint8_t > & yaze::zelda3::GraphicsSheetStore::mutable_pixels ( )
inline

For the graphics_buffer alias and the loader only.

Definition at line 44 of file graphics_sheet_store.h.

References pixels_.

◆ HasSheet()

◆ Sheet()

◆ Revision()

◆ WriteSheet()

absl::Status yaze::zelda3::GraphicsSheetStore::WriteSheet ( uint16_t sheet,
absl::Span< const uint8_t > pixels,
uint8_t max_index = 0x0F )

Replaces one sheet's pixels and bumps its revision. Refuses a sheet outside the buffer, the wrong size, or indices above max_index. Writing identical pixels changes nothing, including the revision.

Definition at line 36 of file graphics_sheet_store.cc.

References HasSheet(), kSheetBytes, kSheetWidth, pixels(), pixels_, and revisions_.

Here is the call graph for this function:

◆ MarkAllSheetsChanged()

void yaze::zelda3::GraphicsSheetStore::MarkAllSheetsChanged ( )

Call after the loader refills the buffer: bumps every revision.

Definition at line 67 of file graphics_sheet_store.cc.

References revisions_.

Referenced by Clear(), and yaze::zelda3::LoadGraphics().

◆ Clear()

void yaze::zelda3::GraphicsSheetStore::Clear ( )

Empties the buffer and bumps every revision.

Definition at line 73 of file graphics_sheet_store.cc.

References MarkAllSheetsChanged(), and pixels_.

Referenced by yaze::zelda3::GameData::Clear(), and yaze::zelda3::LoadGraphics().

Here is the call graph for this function:

Member Data Documentation

◆ kSheetCount

◆ kSheetWidth

◆ kSheetHeight

constexpr size_t yaze::zelda3::GraphicsSheetStore::kSheetHeight = 32
staticconstexpr

◆ kSheetBytes

constexpr size_t yaze::zelda3::GraphicsSheetStore::kSheetBytes = kSheetWidth * kSheetHeight
staticconstexpr

◆ pixels_

std::vector<uint8_t> yaze::zelda3::GraphicsSheetStore::pixels_
private

Definition at line 102 of file graphics_sheet_store.h.

Referenced by Clear(), HasSheet(), mutable_pixels(), pixels(), Sheet(), and WriteSheet().

◆ revisions_

std::array<uint64_t, kSheetCount> yaze::zelda3::GraphicsSheetStore::revisions_ {}
private

Definition at line 103 of file graphics_sheet_store.h.

Referenced by MarkAllSheetsChanged(), Revision(), and WriteSheet().


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