Alchemy
Loading...
Searching...
No Matches

sprites.c File Reference

Battle sprites: enemy sprite slots and the party's weapon sprites. More...

Go to the source code of this file.

Macros

#define ENEMY_SPRITE_SLOTS   6
 The battle has six enemy sprite slots; a large enemy takes two side by side, a small one (BattleClass_IsSmall) one.
#define WEAPON_ITEM_MASK   0x1ff
#define WEAPON_KIND_SHIFT   9
#define WEAPON_KIND_NONE   6

Functions

void BattleObjPut (void)
 Readies the sprite of every unit in the battle (releasing those of units that left) and sets each one's display mode and motion afresh.
void BattleParty_ListAllUnitsAndSubmit (void)
 Readies the sprite of every unit in the battle (releasing those of units that left), keeping their modes and motions.
s32 BattleMotion_GetSlotPalette (s32 id)
 Returns the palette of unit id's battle object.
s32 EnemyCheck (s32 classId)
 Returns 1 if an enemy of class classId would find room among the enemy sprite slots: one free slot for a small enemy, two free side by side for a large one.
s32 SummonSlot_RegisterActorSprites (s32 unitId)
 Loads an enemy unit's battle sprite into the first free enemy sprite slots (one for a small enemy, two side by side for a large one) and records the unit as their owner.
s32 BattleMotion_ReleaseObjectSlotByValue (s32 unitId)
 Frees every enemy sprite slot unit unitId holds, unloading its sprite.
s32 BattleUnit_GetWeaponKind (s32 itemId)
 Returns the kind of the weapon whose item id is itemId (0 to 5), which picks a party member's attack animation, or WEAPON_KIND_NONE for an item the list lacks.
s32 BattleUnit_LookupWeaponValueByClass (s32 unitId)
 Returns the weapon sprite a party member's attack shows for the kind of weapon they have equipped (gBattleUnit_WeaponAnimsClass*), or 0 for no weapon, for Felix, or for a unit that is no party member.

Detailed Description

Battle sprites: enemy sprite slots and the party's weapon sprites.

Part of battle.c, the battle object, compiled only through it.

Definition in file sprites.c.

Macro Definition Documentation

◆ ENEMY_SPRITE_SLOTS

#define ENEMY_SPRITE_SLOTS   6

The battle has six enemy sprite slots; a large enemy takes two side by side, a small one (BattleClass_IsSmall) one.

Definition at line 36 of file sprites.c.

Referenced by BattleMotion_ReleaseObjectSlotByValue(), EnemyCheck(), and SummonSlot_RegisterActorSprites().

◆ WEAPON_ITEM_MASK

#define WEAPON_ITEM_MASK   0x1ff

Definition at line 156 of file sprites.c.

Referenced by BattleUnit_GetWeaponKind(), and BattleUnit_LookupWeaponValueByClass().

◆ WEAPON_KIND_SHIFT

#define WEAPON_KIND_SHIFT   9

Definition at line 157 of file sprites.c.

Referenced by BattleUnit_GetWeaponKind().

◆ WEAPON_KIND_NONE

#define WEAPON_KIND_NONE   6

Definition at line 158 of file sprites.c.

Referenced by BattleUnit_GetWeaponKind().

Function Documentation

◆ BattleObjPut()

void BattleObjPut ( void )

Readies the sprite of every unit in the battle (releasing those of units that left) and sets each one's display mode and motion afresh.

Called by Battle_RunEncounter as the battle is set up, by BattlePresentation_DispatchAction, BattlePresentation_RunUnitTransition, the auto battle and BattleTargetExec after a call for help, and through the far stub BattleActor_CommitPlacementFar by BattleFx_RunParticleStreams.

Definition at line 13 of file sprites.c.

Referenced by Battle_RunEncounter(), BattleObjPut(), BattlePresentation_DispatchAction(), BattlePresentation_RunPairedUnitTransition(), BattlePresentation_RunUnitTransition(), and BattleTargetExec().

◆ BattleParty_ListAllUnitsAndSubmit()

void BattleParty_ListAllUnitsAndSubmit ( void )

Readies the sprite of every unit in the battle (releasing those of units that left), keeping their modes and motions.

Called by BattlePres_RunAttack.

Definition at line 22 of file sprites.c.

Referenced by BattleParty_ListAllUnitsAndSubmit(), and BattlePres_RunAttack().

◆ BattleMotion_GetSlotPalette()

s32 BattleMotion_GetSlotPalette ( s32 id)

Returns the palette of unit id's battle object.

Called by BattleEvent_Playback and BattleMotion_FlashHit, and through its far stub by the effect dispatcher (effect/parts/dispatch.c).

Definition at line 32 of file sprites.c.

Referenced by BattleEvent_Playback(), BattleMotion_FlashHit(), and BattleMotion_GetSlotPalette().

◆ EnemyCheck()

s32 EnemyCheck ( s32 classId)

Returns 1 if an enemy of class classId would find room among the enemy sprite slots: one free slot for a small enemy, two free side by side for a large one.

Called by BattleTargetExec before an enemy calls for help.

Definition at line 41 of file sprites.c.

Referenced by BattleTargetExec(), and EnemyCheck().

◆ SummonSlot_RegisterActorSprites()

s32 SummonSlot_RegisterActorSprites ( s32 unitId)

Loads an enemy unit's battle sprite into the first free enemy sprite slots (one for a small enemy, two side by side for a large one) and records the unit as their owner.

Two sprites take a second part, loaded the same way into further slots. Returns the first slot and the sprite as (slot << 12) | sprite, or 0 for a party member's unit or when a load fails. Called by BattleObjMake. Writes gBattleWork->spriteSlots and the slots' 16 KB sprite buffers at Ram_ActorSpriteSlots.

Definition at line 67 of file sprites.c.

Referenced by BattleObjMake(), and SummonSlot_RegisterActorSprites().

◆ BattleMotion_ReleaseObjectSlotByValue()

s32 BattleMotion_ReleaseObjectSlotByValue ( s32 unitId)

Frees every enemy sprite slot unit unitId holds, unloading its sprite.

Called by BattleObj_MarkForRelease. Clears those gBattleWork->spriteSlots.

Definition at line 141 of file sprites.c.

Referenced by BattleMotion_ReleaseObjectSlotByValue(), and BattleObj_MarkForRelease().

◆ BattleUnit_GetWeaponKind()

s32 BattleUnit_GetWeaponKind ( s32 itemId)

Returns the kind of the weapon whose item id is itemId (0 to 5), which picks a party member's attack animation, or WEAPON_KIND_NONE for an item the list lacks.

Called by BattleUnit_LookupWeaponValueByClass.

gResource_SlotAssignments seen as volatile, for the FAKEMATCH below.

< bits: 15..9 weapon kind | 8..0 item id

Definition at line 163 of file sprites.c.

Referenced by BattleUnit_GetWeaponKind(), and BattleUnit_LookupWeaponValueByClass().

◆ BattleUnit_LookupWeaponValueByClass()

s32 BattleUnit_LookupWeaponValueByClass ( s32 unitId)

Returns the weapon sprite a party member's attack shows for the kind of weapon they have equipped (gBattleUnit_WeaponAnimsClass*), or 0 for no weapon, for Felix, or for a unit that is no party member.

Called by BattleObjMake.

Definition at line 197 of file sprites.c.

Referenced by BattleObjMake(), and BattleUnit_LookupWeaponValueByClass().