AnimaEngine  1.0.0
Nintendo DS Pokemon Black, White, Black 2, and White 2 sprite extraction and preview toolchain
Functions
nanr.c File Reference
#include "nanr.h"
#include "file_util.h"
#include "nitro_util.h"

Functions

static void NanrFrame_SetIdentityTransform (NanrFrame *frame)
 
static void Nanr_ReadFrameElement (const u8 *element, int frame_type, NanrFrame *frame)
 
static u32 Nanr_FrameElementSizeForType (int frame_type)
 
static int CompareU32 (const void *a, const void *b)
 
static int Nanr_FrameDuration (const NanrFrame *frame)
 
static int Nanr_FrameDurationRange (const NanrAnimation *animation, int start_frame, int end_frame, int step)
 
static int Nanr_SelectFrameInRange (const NanrAnimation *animation, int start_frame, int end_frame, int step, int tick)
 
static int Nanr_SelectFrameForward (const NanrAnimation *animation, int tick, int loop)
 
static int Nanr_SelectFramePingPong (const NanrAnimation *animation, int tick, int loop)
 
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...
 

Function Documentation

◆ CompareU32()

static int CompareU32 ( const void *  a,
const void *  b 
)
static

◆ Nanr_FrameDuration()

static int Nanr_FrameDuration ( const NanrFrame frame)
static

◆ Nanr_FrameDurationRange()

static int Nanr_FrameDurationRange ( const NanrAnimation animation,
int  start_frame,
int  end_frame,
int  step 
)
static

◆ Nanr_FrameElementSizeForType()

static u32 Nanr_FrameElementSizeForType ( int  frame_type)
static

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

◆ Nanr_ReadFrameElement()

static void Nanr_ReadFrameElement ( const u8 element,
int  frame_type,
NanrFrame frame 
)
static

◆ Nanr_SelectFrameForward()

static int Nanr_SelectFrameForward ( const NanrAnimation animation,
int  tick,
int  loop 
)
static

◆ Nanr_SelectFrameInRange()

static int Nanr_SelectFrameInRange ( const NanrAnimation animation,
int  start_frame,
int  end_frame,
int  step,
int  tick 
)
static

◆ Nanr_SelectFramePingPong()

static int Nanr_SelectFramePingPong ( const NanrAnimation animation,
int  tick,
int  loop 
)
static

◆ NanrFrame_SetIdentityTransform()

static void NanrFrame_SetIdentityTransform ( NanrFrame frame)
static