Porytiles
Loading...
Searching...
No Matches
porytiles::ProjectTilesetMetadata Class Reference

Represents raw parsed metadata from a tileset struct in headers.h. More...

#include <project_tileset_metadata.hpp>

Public Member Functions

 ProjectTilesetMetadata (std::string name, bool is_secondary, std::string tiles_var, std::string palettes_var, std::string metatiles_var, std::string metatile_attributes_var, std::optional< std::string > callback_func)
 Constructs a TilesetMetadata from parsed struct fields.
 
const std::string & name () const
 Returns the tileset name.
 
bool is_secondary () const
 Returns whether this is a secondary tileset.
 
const std::string & tiles_var () const
 Returns the tiles variable name.
 
const std::string & palettes_var () const
 Returns the palettes variable name.
 
const std::string & metatiles_var () const
 Returns the metatiles variable name.
 
const std::string & metatile_attributes_var () const
 Returns the metatile attributes variable name.
 
const std::optional< std::string > & callback_func () const
 Returns the animation callback function name, if present.
 
bool has_animations () const
 Checks if this tileset has animations.
 

Detailed Description

Represents raw parsed metadata from a tileset struct in headers.h.

ProjectTilesetMetadata captures the key fields from a pokeemerald tileset struct definition:

const struct Tileset gTileset_General = {
.isCompressed = TRUE,
.isSecondary = FALSE,
.tiles = gTilesetTiles_General,
.palettes = gTilesetPalettes_General,
.metatiles = gMetatiles_General,
.metatileAttributes = gMetatileAttributes_General,
.callback = InitTilesetAnim_General,
};
A complete tileset containing both Porytiles and Porymap components.
Definition tileset.hpp:14

This model contains only the raw field values from the struct:

  • Whether a tileset is primary or secondary (via is_secondary())
  • The variable names referenced for tiles, palettes, metatiles, etc.
  • Whether the tileset has animations (via has_animations())
  • The callback function name if present

The variable names can then be used by ProjectTilesetArtifactKeyProvider to look up INCBIN declarations and resolve actual file paths.

Invariant
name_ is always a valid TilesetName
tiles_var_, palettes_var_, metatiles_var_, metatile_attributes_var_ are never empty

Definition at line 37 of file project_tileset_metadata.hpp.

Constructor & Destructor Documentation

◆ ProjectTilesetMetadata()

porytiles::ProjectTilesetMetadata::ProjectTilesetMetadata ( std::string  name,
bool  is_secondary,
std::string  tiles_var,
std::string  palettes_var,
std::string  metatiles_var,
std::string  metatile_attributes_var,
std::optional< std::string >  callback_func 
)
inline

Constructs a TilesetMetadata from parsed struct fields.

Parameters
nameThe tileset name (e.g., gTileset_General)
is_secondaryTrue if this is a secondary tileset, false for primary
tiles_varThe variable name for tiles (e.g., gTilesetTiles_General)
palettes_varThe variable name for palettes (e.g., gTilesetPalettes_General)
metatiles_varThe variable name for metatiles (e.g., gMetatiles_General)
metatile_attributes_varThe variable name for attributes (e.g., gMetatileAttributes_General)
callback_funcThe callback function name if animations exist, or nullopt if none

Definition at line 50 of file project_tileset_metadata.hpp.

Member Function Documentation

◆ callback_func()

const std::optional< std::string > & porytiles::ProjectTilesetMetadata::callback_func ( ) const
inline

Returns the animation callback function name, if present.

Returns
The function name (e.g., "InitTilesetAnim_General") or nullopt if no animations

Definition at line 129 of file project_tileset_metadata.hpp.

◆ has_animations()

bool porytiles::ProjectTilesetMetadata::has_animations ( ) const
inline

Checks if this tileset has animations.

A tileset has animations if its callback field is set to a non-NULL function name.

Returns
True if callback_func is present and not "NULL"

Definition at line 142 of file project_tileset_metadata.hpp.

◆ is_secondary()

bool porytiles::ProjectTilesetMetadata::is_secondary ( ) const
inline

Returns whether this is a secondary tileset.

Returns
True for secondary tilesets, false for primary

Definition at line 79 of file project_tileset_metadata.hpp.

◆ metatile_attributes_var()

const std::string & porytiles::ProjectTilesetMetadata::metatile_attributes_var ( ) const
inline

Returns the metatile attributes variable name.

Returns
The variable name (e.g., "gMetatileAttributes_General")

Definition at line 119 of file project_tileset_metadata.hpp.

◆ metatiles_var()

const std::string & porytiles::ProjectTilesetMetadata::metatiles_var ( ) const
inline

Returns the metatiles variable name.

Returns
The variable name (e.g., "gMetatiles_General")

Definition at line 109 of file project_tileset_metadata.hpp.

◆ name()

const std::string & porytiles::ProjectTilesetMetadata::name ( ) const
inline

Returns the tileset name.

Returns
A const reference to the TilesetName

Definition at line 69 of file project_tileset_metadata.hpp.

◆ palettes_var()

const std::string & porytiles::ProjectTilesetMetadata::palettes_var ( ) const
inline

Returns the palettes variable name.

Returns
The variable name (e.g., "gTilesetPalettes_General")

Definition at line 99 of file project_tileset_metadata.hpp.

◆ tiles_var()

const std::string & porytiles::ProjectTilesetMetadata::tiles_var ( ) const
inline

Returns the tiles variable name.

Returns
The variable name (e.g., "gTilesetTiles_General")

Definition at line 89 of file project_tileset_metadata.hpp.


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