Skip to Content
The Alchemy Project

src/battle/battle_sprite_slots.c

Battle sprites: every unit's sprite placed, enemy sprite slots and the party's weapon sprites. More…

Included by battle.c.

Macros

NameDescription
#defineENEMY_SPRITE_SLOTS 6The battle has six enemy sprite slots; a large enemy takes two side by side, a small one one.
#defineENEMY_SPRITE_SLOT_SIZE 16384Each enemy sprite slot owns 16 KB of the sprite buffers, ActorSpriteSlots.

Functions

NameDescription
voidbtObjectPut (void)Readies every unit's sprites, destroying those of units no longer in the battle, and sets each unit's pose again.
voidbtObjectPutKeepingPoses (void)Readies every unit's sprites, destroying those of units no longer in the battle, and leaves the poses of units that have sprites as they are.
Sint32btMotionGetSlotPalette (Sint32 id)Returns the palette of a unit's battle object.
Sint32btEnemyHasSpriteRoom (Sint32 classId)Returns 1 if an enemy of the class would find room among the enemy sprite slots, two side by side for a large one.
Sint32btEnemySpriteLoadIntoSlots (Sint32 unitId)Loads an enemy's battle sprite into the first free enemy sprite slots: one slot, or two neighbouring ones for a large enemy.
voidbtObjectReleaseSpriteSlots (Sint32 unitId)Frees every enemy sprite slot unit unitId holds, unloading its sprite.
Sint32btUnitGetWeaponKind (Sint32 itemId)Returns the kind (BATTLE_WEAPON_KIND) of the weapon whose item id is itemId, which picks a party member's weapon sprite.
Sint32btUnitGetWeaponSprite (Sint32 owner)Returns the battle sprite of a character holding its equipped weapon, from that character's table by the weapon's kind, or 0 with no weapon.

Description

Battle sprites: every unit's sprite placed, enemy sprite slots and the party's weapon sprites. Part of battle.c.

Macros in detail

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

Referenced by btEnemyHasSpriteRoom(), btEnemySpriteLoadIntoSlots(), btFormationBuildEnemyList() and btObjectReleaseSpriteSlots().

Definition at line 32 of file battle_sprite_slots.c.

ENEMY_SPRITE_SLOT_SIZE

#define ENEMY_SPRITE_SLOT_SIZE 16384

Each enemy sprite slot owns 16 KB of the sprite buffers, ActorSpriteSlots.

Referenced by btEnemySpriteLoadIntoSlots().

Definition at line 58 of file battle_sprite_slots.c.

Functions in detail

btObjectPut

void btObjectPut(void)

Readies every unit's sprites, destroying those of units no longer in the battle, and sets each unit's pose again.

References btActorSpawnObjectsForList() and btUnitListIds().

Referenced by btAbilityApplyToTarget(), btAutoBattleRunPsynergy(), btChangeEnemyForm(), btPartySwapInReserves(), btRun(), btStagingDispatchAction() and btStagingRunFullScreen().

Definition at line 6 of file battle_sprite_slots.c.

btObjectPutKeepingPoses

void btObjectPutKeepingPoses(void)

Readies every unit's sprites, destroying those of units no longer in the battle, and leaves the poses of units that have sprites as they are.

References btActorSpawnObjectsForList() and btUnitListIds().

Referenced by btStagingRunAttack().

Definition at line 16 of file battle_sprite_slots.c.

btMotionGetSlotPalette

Sint32 btMotionGetSlotPalette(Sint32 id)

Returns the palette of a unit's battle object.

References btObjectGet() and Sint32.

Referenced by btMotionFlashHit() and btPlaybackRun().

Definition at line 25 of file battle_sprite_slots.c.

btEnemyHasSpriteRoom

Sint32 btEnemyHasSpriteRoom(Sint32 classId)

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

References btSpriteIsSmall() and Sint32.

Referenced by btAbilityApplyToTarget() and btAIChooseAction().

Definition at line 36 of file battle_sprite_slots.c.

btEnemySpriteLoadIntoSlots

Sint32 btEnemySpriteLoadIntoSlots(Sint32 unitId)

Loads an enemy's battle sprite into the first free enemy sprite slots: one slot, or two neighbouring ones for a large enemy. A few sprites load a second part into the next free slots. Returns (slot << RESOURCE_SLOT_SHIFT) | sprite, or 0 when a load fails.

References ActorSpriteSlots, btSpriteGetPalette(), btSpriteGetSprite(), btSpriteIsSmall(), fdSpritePictureCacheLoadStub(), gmUnitGet(), result and Sint32.

Referenced by btMotionDismissBeast() and btObjectMake().

Definition at line 64 of file battle_sprite_slots.c.

btObjectReleaseSpriteSlots

void btObjectReleaseSpriteSlots(Sint32 unitId)

Frees every enemy sprite slot unit unitId holds, unloading its sprite. Clears those BATTLE_STATE.spriteSlots.

References fdSpritePictureCacheLoadStub() and Sint32.

Referenced by btMotionCallBeast() and btObjectMarkForRelease().

Definition at line 133 of file battle_sprite_slots.c.

btUnitGetWeaponKind

Sint32 btUnitGetWeaponKind(Sint32 itemId)

Returns the kind (BATTLE_WEAPON_KIND) of the weapon whose item id is itemId, which picks a party member's weapon sprite.

References BattleUnitWeaponKinds and Sint32.

Referenced by btUnitGetWeaponSprite().

Definition at line 150 of file battle_sprite_slots.c.

btUnitGetWeaponSprite

Sint32 btUnitGetWeaponSprite(Sint32 owner)

Returns the battle sprite of a character holding its equipped weapon, from that character's table by the weapon's kind, or 0 with no weapon.

References BattleUnitWeaponAnimationsFelix, BattleUnitWeaponAnimationsGaret, BattleUnitWeaponAnimationsIsaac, BattleUnitWeaponAnimationsIvan, BattleUnitWeaponAnimationsJenna, BattleUnitWeaponAnimationsMia, BattleUnitWeaponAnimationsPiers, BattleUnitWeaponAnimationsSheba, btUnitGetWeaponKind(), gmInventoryFindEquippedStub(), gmUnitGet(), result and Sint32.

Referenced by btObjectMake().

Definition at line 175 of file battle_sprite_slots.c.