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

Generates C header code for tileset animations. More...

#include <anim_code_generator.hpp>

Public Member Functions

ChainableResult< std::string > generate (const std::string &tileset_name, const std::filesystem::path &tileset_path_from_project_root, const std::map< DynamicCasedName, AnimParams > &animations, bool is_primary) const
 Generates the complete generated_anim_code.h content.
 

Detailed Description

Generates C header code for tileset animations.

AnimCodeGenerator produces the generated_anim_code.h header file that contains all the C code needed for tileset animations to work in a pokeemerald project. This includes:

  • INCBIN statements for each animation frame's .4bpp file
  • Frame pointer arrays that define the animation sequence
  • QueueAnimTiles functions for each animation
  • A main TilesetAnim driver function that calls all Queue functions at appropriate intervals
  • An InitTilesetAnim function to initialize the animation system

The generated code follows the pattern used by vanilla pokeemerald animations, making it compatible with the existing tileset animation infrastructure.

Usage:

auto result = generator.generate(
"PorytilesAnimExample",
"data/tilesets/primary/porytiles_anim_example",
animations,
TilesetType::primary);
Generates C header code for tileset animations.
ChainableResult< std::string > generate(const std::string &tileset_name, const std::filesystem::path &tileset_path_from_project_root, const std::map< DynamicCasedName, AnimParams > &animations, bool is_primary) const
Generates the complete generated_anim_code.h content.

Definition at line 38 of file anim_code_generator.hpp.

Member Function Documentation

◆ generate()

ChainableResult< std::string > porytiles::AnimCodeGenerator::generate ( const std::string &  tileset_name,
const std::filesystem::path &  tileset_path_from_project_root,
const std::map< DynamicCasedName, AnimParams > &  animations,
bool  is_primary 
) const

Generates the complete generated_anim_code.h content.

Produces a complete C header file containing all animation code for a tileset. The generated code includes proper include guards, INCBIN macro definitions (if not already defined), and all animation functions.

Parameters
tileset_nameThe name of the tileset (e.g., "PorytilesAnimExample")
tileset_path_from_project_rootRelative path from project root to tileset directory
animationsMap of animation names to their parameters
is_primaryTrue if this is a primary tileset, false for secondary
Returns
The generated C header code as a string, or error if generation fails

Definition at line 183 of file anim_code_generator.cpp.


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