Pawn_Initialize
void Pawn_Initialize(
Pawn* pawn,
const Pawn_Sprite* sprtList,
u8 sprtNum,
u8 sprtID,
const Pawn_Action* actList
)

Initialize a game pawn.

Parameters
pawn
Pawn*

Address of game pawn structure to initialize. This is he structure to be used for all other functions.

sprtList
const Pawn_Sprite*

Array of all sprite layers used to display the pawn. See <Pawn_Sprite> for details.

sprtNum
u8

Size of the 'sprtList' table (in entries number).

sprtID
u8

First srite index to use for the pawn. The pawn will use all sprite indexes from 'sprtID' to 'sprtID + sprtNum - 1'.  If <PAWN_ID_PER_LAYER> compile option is activated, this parmeter is not used as each sprit layer define it's own sprite index.

actList
const Pawn_Action*

Array of pawn action. Needed to use Pawn_SetAction function.

Pawn_SetPosition
void Pawn_SetPosition(
Pawn* pawn,
PAWN_POS x,
PAWN_POS y
)

Set game pawn position. Force movement even if collision is activated.

Parameters
pawn
Pawn*

Address of game pawn structure to move.

x
PAWN_POS

New X coordinate (in pixels).

y
PAWN_POS

New Y coordinate (in pixels).

Pawn_GetPositionX
inline PAWN_POS Pawn_GetPositionX(
Pawn* pawn
)

Get the X coordinate of the pawn's position.

Parameters
pawn
Pawn*

Pointer to pawn structure.

Return

X coordinate of the pawn's position.

Pawn_GetPositionY
inline PAWN_POS Pawn_GetPositionY(
Pawn* pawn
)

Get the Y coordinate of the pawn's position.

Parameters
pawn
Pawn*

Pointer to pawn structure.

Return

Y coordinate of the pawn's position.

Pawn_ForceSetAction
void Pawn_ForceSetAction(
Pawn* pawn,
u8 id
)

Force to set game pawn action id.

Parameters
pawn
Pawn*

Address of game pawn structure to setup.

id
u8

New action index.

Pawn_SetAction
void Pawn_SetAction(
Pawn* pawn,
u8 id
)

Set game pawn current action index.

Parameters
pawn
Pawn*

Address of game pawn structure to setup.

id
u8

New action index.

Pawn_RestartAction
inline void Pawn_RestartAction(
Game_Pawn* pawn
)

Restart the current action.

Parameters
pawn
Game_Pawn*

Address of game pawn structure to setup.

Pawn_GetAction
inline u8 Pawn_GetAction(
Pawn* pawn
)

Get the current action ID of the pawn.

Parameters
pawn
Pawn*

Pointer to pawn structure.

Return

Current action ID of the pawn.

Pawn_SetTileMap
inline void Pawn_SetTileMap(
const u8* map
)

Set the tile map to be used for collision.  Available only when PAWN_TILEMAP_SRC is set to PAWN_TILEMAP_SRC_RAM.

Parameters
map
const u8*

Pointer to RAM buffer with the tile map. Size must be PAWN_TILEMAP_WIDTH * PAWN_TILEMAP_HEIGHT.

Pawn_SetEnable
void Pawn_SetEnable(
Pawn* pawn,
bool enable
)

Set if pawn is enable or disable. Disabled pawn will not be updated nor drawn.

Parameters
pawn
Pawn*

Address of game pawn structure to update (move, collision, etc.).

enable
bool

TRUE to enable the pawn, FALSE to disable it.

Pawn_Disable
inline void Pawn_Disable(
Pawn* pawn
)

Disable a pawn. Disabled pawn will not be updated nor drawn.

Parameters
pawn
Pawn*

Address of game pawn structure to update (move, collision, etc.).

Pawn_Enable
inline void Pawn_Enable(
Pawn* pawn
)

Enable a pawn. Enabled pawn will be updated and drawn.

Parameters
pawn
Pawn*

Address of game pawn structure to update (move, collision, etc.).

Pawn_Update
void Pawn_Update(
Pawn* pawn
)

Update animation of the game pawn. Must be called once a frame.

Parameters
pawn
Pawn*

Address of game pawn structure to update (move, collision, etc.).

Pawn_SetDirty
inline void Pawn_SetDirty(
Pawn* pawn
)

Mark the pawn as dirty. This will force the pawn to be redrawn.

Parameters
pawn
Pawn*

Address of game pawn structure to update (move, collision, etc.).

Pawn_SetColorBlend
inline void Pawn_SetColorBlend(
Pawn* pawn,
bool enable
)

Enable or disable sprite color blending effect.

Parameters
pawn
Pawn*

Address of game pawn structure to update (move, collision, etc.).

enable
bool

TRUE to enable color blending, FALSE to disable it.

Pawn_Draw
void Pawn_Draw(
Pawn* pawn
)

Update rendering of the game pawn. Must be called once a frame.

Parameters
pawn
Pawn*

Address of game pawn structure to draw.

Pawn_SetPatternAddress
inline void Pawn_SetPatternAddress(
Pawn* pawn,
const voidaddr
)

Set the base address of the sprite pattern data.  Only available if PAWN_USE_RT_LOAD compile option is set to TRUE.

Parameters
pawn
Pawn*

Address of game pawn structure to initialize.

addr
const void*

Base address of the sprite pattern data.

Pawn_SetSpriteFX
inline void Pawn_SetSpriteFX(
Pawn* pawn,
u8 fx
)

Set sprite effect.  Only available if PAWN_USE_RT_LOAD and PAWN_USE_SPRT_FX compile options are set to TRUE.

Parameters
pawn
Pawn*

Address of game pawn structure to initialize.

fx
u8

Sprite effect (crop, flip, mask, rotate).

Physics
Pawn_SetMovement
void Pawn_SetMovement(
Pawn* pawn,
i8 dx,
i8 dy
)

Set pawn relative movement. Collision can prevent part of the movement.  Only available if PAWN_USE_PHYSICS compile option is set to TRUE.

Parameters
pawn
Pawn*

Address of game pawn structure to move.

x

New X movement (in pixels).

y

New Y movement (in pixels).

Pawn_SetTargetPosition
inline void Pawn_SetTargetPosition(
Pawn* pawn,
PAWN_POS x,
PAWN_POS y
)

Set pawn absolute movement. Collision can prevent part of the movement.  Only available if PAWN_USE_PHYSICS compile option is set to TRUE.

Parameters
pawn
Pawn*

Address of game pawn structure to move.

x
PAWN_POS

New X coordinate (in pixels).

y
PAWN_POS

New Y coordinate (in pixels).

Pawn_SetPhysicsCallback

Set pawn physics callback Only available if PAWN_USE_PHYSICS compile option is set to TRUE.

Parameters
pawn

Address of game pawn structure to initialize.

pcb

Callback function to be called when physics events occurs.

ccb

Callback function to be called when collision events occurs.

boundX

Bounding box X extend (in pixels, from the pawn's origin).

boundY

Bounding box Y extend (in pixels, from the pawn's origin).

Pawn_GetPhysicsState
inline u8 Pawn_GetPhysicsState(
Pawn* pawn
)

Get pawn physics state.  Only available if PAWN_USE_PHYSICS compile option is set to TRUE.

Parameters
pawn
Pawn*

Pointer to pawn structure.

Return

Pawn's physics state.

Pawn_GetCallbackCellX
inline const u8 Pawn_GetCallbackCellX()

Get the X coordinate of the cell that triggered a callback.  The value is only valid within a callback.  Only available if PAWN_USE_PHYSICS compile option is set to TRUE.

Return

X coordinate of the current cell.

Pawn_GetCallbackCellY
inline const u8 Pawn_GetCallbackCellY()

Get the Y coordinate of the cell that triggered a callback.  The value is only valid within a callback.  Only available if PAWN_USE_PHYSICS compile option is set to TRUE.

Return

Y coordinate of the current cell.