AnimaEngine  1.0.0
Nintendo DS Pokemon Black, White, Black 2, and White 2 sprite extraction and preview toolchain
Data Structures | Macros | Typedefs | Functions
nanr.h File Reference

Nintendo Animation Resource (.NANR) structure parsing. More...

#include "common.h"

Go to the source code of this file.

Data Structures

struct  NanrFrame
 Represents a single keyframe in an animation timeline. More...
 
struct  NanrAnimation
 Animation timeline sequence block containing multiple frames. More...
 
struct  NanrFile
 Unpacked representation of a complete .NANR resource file. More...
 

Macros

#define NANR_SCALE_ONE   4096
 
#define NANR_ROTATION_FULL   65536.0
 

Typedefs

typedef struct NanrFrame NanrFrame
 Represents a single keyframe in an animation timeline. More...
 
typedef struct NanrAnimation NanrAnimation
 Animation timeline sequence block containing multiple frames. More...
 
typedef struct NanrFile NanrFile
 Unpacked representation of a complete .NANR resource file. More...
 

Functions

int Nanr_Parse (const u8 *data, size_t size, NanrFile *out_nanr)
 Parses an unpacked .NANR resource block from raw bytes. More...
 
void Nanr_Free (NanrFile *nanr)
 Deallocates all resources held inside a NanrFile structure. More...
 
int Nanr_GetResolvedCellId (const NanrFile *nanr, int animation_index, int frame_index, NanrFrame *out_frame)
 Retrieves information for a specific keyframe in a timeline sequence. More...
 
int Nanr_GetResolvedCellIdAtTick (const NanrFile *nanr, int animation_index, int tick, NanrFrame *out_frame)
 Resolves keyframe attributes at a specific tick timing step. More...
 
void Nanr_PrintInfo (const NanrFile *nanr)
 Debug printing routine to write parsed .NANR layout contents to stdout. More...
 

Detailed Description

Nintendo Animation Resource (.NANR) structure parsing.

Macro Definition Documentation

◆ NANR_ROTATION_FULL

#define NANR_ROTATION_FULL   65536.0

Fixed-point representation of a full 360 degree rotation.

◆ NANR_SCALE_ONE

#define NANR_SCALE_ONE   4096

Fixed-point scale representation of 1.0.

Typedef Documentation

◆ NanrAnimation

typedef struct NanrAnimation NanrAnimation

Animation timeline sequence block containing multiple frames.

◆ NanrFile

typedef struct NanrFile NanrFile

Unpacked representation of a complete .NANR resource file.

◆ NanrFrame

typedef struct NanrFrame NanrFrame

Represents a single keyframe in an animation timeline.

Function Documentation

◆ Nanr_Free()

void Nanr_Free ( NanrFile nanr)

Deallocates all resources held inside a NanrFile structure.

Parameters
nanrPointer to structure to clear.

◆ Nanr_GetResolvedCellId()

int Nanr_GetResolvedCellId ( const NanrFile nanr,
int  animation_index,
int  frame_index,
NanrFrame out_frame 
)

Retrieves information for a specific keyframe in a timeline sequence.

Parameters
nanrPointer to parsed .NANR resource structure.
animation_indexTarget animation sequence index.
frame_indexFrame index inside animation sequence.
out_frameDestination NanrFrame container to write results.
Returns
0 on success; negative value on out-of-bounds index requests.

◆ Nanr_GetResolvedCellIdAtTick()

int Nanr_GetResolvedCellIdAtTick ( const NanrFile nanr,
int  animation_index,
int  tick,
NanrFrame out_frame 
)

Resolves keyframe attributes at a specific tick timing step.

Parameters
nanrPointer to parsed .NANR resource structure.
animation_indexTarget animation sequence index.
tickTiming offset tick inside the timeline loop.
out_frameDestination NanrFrame container to write results.
Returns
0 on success; negative value on out-of-bounds animation index.

◆ Nanr_Parse()

int Nanr_Parse ( const u8 data,
size_t  size,
NanrFile out_nanr 
)

Parses an unpacked .NANR resource block from raw bytes.

Parameters
dataPointer to binary file data buffer.
sizeBuffer size in bytes.
out_nanrDestination NanrFile structure.
Returns
0 on success; negative value on invalid magic/formatting errors.

◆ Nanr_PrintInfo()

void Nanr_PrintInfo ( const NanrFile nanr)

Debug printing routine to write parsed .NANR layout contents to stdout.

Parameters
nanrPointer to parsed .NANR resource.