Each frame's sprite priorities, the status icons, the poses and the sprites of the battle objects. More...
Go to the source code of this file.
Macros | |
| #define | UNIT_MAX 14 |
| the party's and the enemies' units together | |
| #define | ICON_POISON 0x01 |
| #define | ICON_VENOM 0x02 |
| deadly poison | |
| #define | ICON_STUN 0x04 |
| #define | ICON_PSY_SEAL 0x08 |
| #define | ICON_SLEEP 0x10 |
| #define | ICON_DELUSION 0x20 |
| #define | ICON_HAUNT 0x40 |
| #define | ICON_GRIM_REAPER 6 |
| the curse's turns left, 1 to 7, as bits 7 to 13 | |
| #define | ICON_MAX 14 |
| the kinds of icon | |
| #define | ICON_CYCLE_FRAMES 80 |
| The frames each status icon shows before the next one's turn. | |
| #define | ICON_ANIM_NARROW 340 |
| The icons' first animations, for units 32 pixels wide and for the rest. | |
| #define | ICON_ANIM_WIDE 355 |
| #define | NARROW_EFFECT_SPRITE 0x1ff |
| The sprite unit 32 pixels wide use for an effect. | |
Functions | |
| void | BattleActor_UpdateSpritePriorities (void) |
| Runs each frame of a battle: advances every unit's status icon, lifts an airborne unit's effect sprite above the others, and draws whichever side is nearer the camera in front. | |
| s32 | BattleUnit_BuildStatusFlags (s32 unitId, struct BattleObj *battleObject) |
| Builds the status icon bits of unit id's ailments into its battle object's activeConditions, which BattleStatusIcon_Cycle shows. | |
| s32 | BattleStatusIcon_Cycle (struct BattleObj *battleObject) |
| Shows a unit's status icons one after another, each for ICON_CYCLE_FRAMES frames, switching at once when the shown status ends, and removes the icon when no status is left. | |
| s32 | BattlePres_SetActorModeAndAction (s32 unitId) |
| Sets unit id's pose to match its state: held (asleep, stunned or unable to move) or down, else standing; then gives its sprites their palette row, 14 to 17 by unit. | |
| void | ReleaseBattleObjectRecords (s32 unitId) |
| Releases every sprite unitId's object holds and leaves it with none, clearing the battle object's animationEntry and effectEntry. | |
| void | BattleActor_SpawnObjectsForList (s16 *unitIds, s32 refreshPoses) |
| Readies the sprites of the units in list: releases those of every place list lacks, then creates each listed unit's sprites (body, weapon, status icon and effect; or the two parts of a two-part enemy) unless it has them, building its status icons and setting its pose. | |
| struct BattleObj * | BattleObjGet (s32 unitId) |
| Returns unitId's battle object, through its place, or null for a unit with no place. | |
| void | ResetMotionRecordGroup (void *recordGroup) |
| Detaches the scripts from the four sprite entries of one sprite. | |
| void | ResetBattleObjectRecordGroups (struct MotionObject *object) |
| Detaches the scripts from every sprite of a battle object. | |
| s32 | BattleObj_MarkForRelease (s32 unitId) |
| Frees the enemy sprite slots unitId holds and marks its object for release at the end of the round (BattleMotion_DestroyAllSlotObjects), setting its active field. | |
| void * | BattleMotion_DestroyAllSlotObjects (void) |
| Releases the object of every unit marked by BattleObj_MarkForRelease, leaving its battle object with no object. | |
| s32 | Battle_GetWorkEntryPair (s32 place, struct FixedPointPosition *position) |
| Writes the battlefield spot of place (its anchor, on the ground) to position. | |
| s32 | Camera_ApplyTransformByFlag (void) |
| Sets up the camera's view for projecting points; under FLAG_CHOOSING_COMMANDS, through the extra transform gCamera_FlagTransformWork first. | |
| s32 | BattleMotion_ProjectPosition (s32 unitId, s32 *projected) |
| Projects unit id's position onto the screen, into projected. | |
| void * | GetMotionRecord (struct MotionObject *object, s32 recordIndex) |
| Returns sprite recordIndex of an object (0 only, for a single sprite), or null when it has no such sprite. | |
| void | Camera_InitDefaultTransform (void) |
| Puts the battle camera at its default view of the battlefield's centre. | |
Each frame's sprite priorities, the status icons, the poses and the sprites of the battle objects.
Part of battle.c, the battle object, compiled only through it.
Definition in file objects.c.
| #define UNIT_MAX 14 |
the party's and the enemies' units together
Definition at line 8 of file objects.c.
Referenced by BattleActor_SpawnObjectsForList(), BattleActor_UpdateSpritePriorities(), and BattleMotion_DestroyAllSlotObjects().
| #define ICON_POISON 0x01 |
Definition at line 136 of file objects.c.
Referenced by BattleUnit_BuildStatusFlags().
| #define ICON_STUN 0x04 |
Definition at line 138 of file objects.c.
Referenced by BattleUnit_BuildStatusFlags().
| #define ICON_PSY_SEAL 0x08 |
Definition at line 139 of file objects.c.
Referenced by BattleUnit_BuildStatusFlags().
| #define ICON_SLEEP 0x10 |
Definition at line 140 of file objects.c.
Referenced by BattleUnit_BuildStatusFlags().
| #define ICON_DELUSION 0x20 |
Definition at line 141 of file objects.c.
Referenced by BattleUnit_BuildStatusFlags().
| #define ICON_HAUNT 0x40 |
Definition at line 142 of file objects.c.
Referenced by BattleUnit_BuildStatusFlags().
| #define ICON_GRIM_REAPER 6 |
the curse's turns left, 1 to 7, as bits 7 to 13
Definition at line 143 of file objects.c.
Referenced by BattleUnit_BuildStatusFlags().
| #define ICON_MAX 14 |
| #define ICON_CYCLE_FRAMES 80 |
The frames each status icon shows before the next one's turn.
Definition at line 189 of file objects.c.
Referenced by BattleStatusIcon_Cycle().
| #define ICON_ANIM_NARROW 340 |
The icons' first animations, for units 32 pixels wide and for the rest.
Definition at line 192 of file objects.c.
Referenced by BattleStatusIcon_Cycle().
| #define ICON_ANIM_WIDE 355 |
Definition at line 193 of file objects.c.
Referenced by BattleStatusIcon_Cycle().
| #define NARROW_EFFECT_SPRITE 0x1ff |
The sprite unit 32 pixels wide use for an effect.
Definition at line 345 of file objects.c.
Referenced by BattleActor_SpawnObjectsForList().
| void BattleActor_UpdateSpritePriorities | ( | void | ) |
Runs each frame of a battle: advances every unit's status icon, lifts an airborne unit's effect sprite above the others, and draws whichever side is nearer the camera in front.
Runs as a scheduler callback (priority 0xc80) that Battle_RunEncounter adds after the entry transition and removes as the battle ends. Writes each battle object's icon state and its sprites' priorities.
Definition at line 16 of file objects.c.
Referenced by Battle_RunEncounter(), and BattleActor_UpdateSpritePriorities().
Builds the status icon bits of unit id's ailments into its battle object's activeConditions, which BattleStatusIcon_Cycle shows.
Called wherever a unit's statuses may have changed: BattleEv_DispatchQueued, BattleEvent_Playback, Battle_ProcessRoundEnd, BattleActor_ResetRuntimeFields and BattleActor_SpawnObjectsForList.
Definition at line 155 of file objects.c.
Referenced by Battle_ProcessRoundEnd(), BattleActor_ResetRuntimeFields(), BattleActor_SpawnObjectsForList(), BattleEv_DispatchQueued(), BattleEvent_Playback(), and BattleUnit_BuildStatusFlags().
Shows a unit's status icons one after another, each for ICON_CYCLE_FRAMES frames, switching at once when the shown status ends, and removes the icon when no status is left.
Called each frame for every unit by BattleActor_UpdateSpritePriorities. Changes the battle object's cycleTimer, selectedCondition, animation and animationEntry, and registers or unregisters the icon on its first sprite.
Definition at line 204 of file objects.c.
Referenced by BattleActor_UpdateSpritePriorities(), and BattleStatusIcon_Cycle().
Sets unit id's pose to match its state: held (asleep, stunned or unable to move) or down, else standing; then gives its sprites their palette row, 14 to 17 by unit.
Called by BattleActor_SpawnObjectsForList, BattleEv_DispatchQueued, BattleEvent_Playback and Battle_ProcessRoundEnd.
Definition at line 294 of file objects.c.
Referenced by Battle_ProcessRoundEnd(), BattleActor_SpawnObjectsForList(), BattleEv_DispatchQueued(), BattleEvent_Playback(), and BattlePres_SetActorModeAndAction().
| void ReleaseBattleObjectRecords | ( | s32 | unitId | ) |
Releases every sprite unitId's object holds and leaves it with none, clearing the battle object's animationEntry and effectEntry.
Called by BattleActor_SpawnObjectsForList; BATTLE.S also gives it an unnamed overlay veneer, which nothing in the source calls.
Definition at line 321 of file objects.c.
Referenced by BattleActor_SpawnObjectsForList(), and ReleaseBattleObjectRecords().
Readies the sprites of the units in list: releases those of every place list lacks, then creates each listed unit's sprites (body, weapon, status icon and effect; or the two parts of a two-part enemy) unless it has them, building its status icons and setting its pose.
With refreshPoses, sets every listed unit's pose again afterwards. Called by BattleObjPut (refreshing) and BattleParty_ListAllUnitsAndSubmit, by the staging and entry transition code, and through its far stub by BattleFx_SelectLivingTargets. Writes the objects' records, their storage kind and height, and the battle objects' icon and effect entries.
Definition at line 356 of file objects.c.
Referenced by BattleActor_SpawnObjectsForList(), BattleObjPut(), BattleParty_ListAllUnitsAndSubmit(), BattlePres_RunAttack(), BattlePres_RunEntryTransition(), BattlePresentation_RunPairedUnitTransition(), and BattlePresentation_RunUnitTransition().
Returns unitId's battle object, through its place, or null for a unit with no place.
Called throughout the battle parts.
Definition at line 480 of file objects.c.
Referenced by Battle_ProcessRoundEnd(), BattleActor_DestroyTemporaryObject(), BattleActor_ResetRuntimeFields(), BattleActor_SpawnObjectsForList(), BattleActor_UpdateSpritePriorities(), BattleCommand_BuildPlan(), BattleEv_DispatchQueued(), BattleEvent_Playback(), BattleMotion_ApplyPairMidpoint(), BattleMotion_ApplyVariantMotion(), BattleMotion_ApproachTarget(), BattleMotion_DestroyAllSlotObjects(), BattleMotion_FlashHit(), BattleMotion_GetSlotPalette(), BattleMotion_InitializeObject(), BattleMotion_ProjectConditionalPosition(), BattleMotion_ProjectPosition(), BattleMotion_ProjectScaledPosition(), BattleMotion_ResetObjectAtScaledAnchor(), BattleMotion_ResetSlotObjectMode2(), BattleMotion_SetMode5AndActivateSlot(), BattleMotion_SetupEscapeObject(), BattleMotion_ShowDowned(), BattleMotion_SpawnSlotEffectAndWait(), BattleObj_MarkForRelease(), BattleObjGet(), BattleParty_ReconcileDjinnRecovery(), BattlePres_RunApproachAction(), BattlePres_RunAttack(), BattlePres_RunEntryTransition(), BattlePres_RunItem(), BattlePres_RunPlainAttack(), BattlePres_RunPsynergyCast(), BattlePres_RunUnitAction(), BattlePres_SetActorModeAndAction(), BattlePres_SetActorRecordMode(), BattlePres_SetupTransitionAtPairMidpoint(), BattlePresentation_ApplyUnitDamage(), BattlePresentation_RunPairedUnitTransition(), BattlePresentation_RunUnitTransition(), BattleTargetExec(), BattleUnit_ProcessTurnEnd(), BattleUnit_RefreshPlacement(), EnemyUpdate(), ObjMotRst(), and ReleaseBattleObjectRecords().
| void ResetMotionRecordGroup | ( | void * | recordGroup | ) |
Detaches the scripts from the four sprite entries of one sprite.
Called only by ResetBattleObjectRecordGroups.
Definition at line 497 of file objects.c.
Referenced by ResetBattleObjectRecordGroups(), and ResetMotionRecordGroup().
| void ResetBattleObjectRecordGroups | ( | struct MotionObject * | object | ) |
Detaches the scripts from every sprite of a battle object.
Nothing in the source calls it.
Definition at line 511 of file objects.c.
Referenced by ResetBattleObjectRecordGroups().
Frees the enemy sprite slots unitId holds and marks its object for release at the end of the round (BattleMotion_DestroyAllSlotObjects), setting its active field.
Called when a unit leaves the battle: by BattleEvent_Playback, BattlePres_RunEscape, BattleMotion_ShowDowned, BattleActor_DestroyTemporaryObject and the auto battle.
Definition at line 543 of file objects.c.
Referenced by BattleActor_DestroyTemporaryObject(), BattleEvent_Playback(), BattleMotion_SetMode5AndActivateSlot(), BattleMotion_ShowDowned(), BattleObj_MarkForRelease(), and BattlePres_RunEscape().
| void * BattleMotion_DestroyAllSlotObjects | ( | void | ) |
Releases the object of every unit marked by BattleObj_MarkForRelease, leaving its battle object with no object.
Called by Battle_RunEncounter at the end of each round and by BattlePresentation_DispatchAction.
Definition at line 557 of file objects.c.
Referenced by Battle_RunEncounter(), BattleMotion_DestroyAllSlotObjects(), and BattlePresentation_DispatchAction().
| s32 Battle_GetWorkEntryPair | ( | s32 | place, |
| struct FixedPointPosition * | position ) |
Writes the battlefield spot of place (its anchor, on the ground) to position.
Nothing in the source calls it.
Definition at line 581 of file objects.c.
Referenced by Battle_GetWorkEntryPair().
| s32 Camera_ApplyTransformByFlag | ( | void | ) |
Sets up the camera's view for projecting points; under FLAG_CHOOSING_COMMANDS, through the extra transform gCamera_FlagTransformWork first.
Called by the three projections, BattleMotion_ProjectPosition, BattleMotion_ProjectScaledPosition and BattleMotion_ProjectConditionalPosition. Replaces the transform state.
Definition at line 597 of file objects.c.
Referenced by BattleMotion_ProjectConditionalPosition(), BattleMotion_ProjectPosition(), BattleMotion_ProjectScaledPosition(), and Camera_ApplyTransformByFlag().
Projects unit id's position onto the screen, into projected.
Reached through its far stub from EffectPosition_ProjectBattler.
Definition at line 611 of file objects.c.
Referenced by BattleMotion_ProjectPosition().
| void * GetMotionRecord | ( | struct MotionObject * | object, |
| s32 | recordIndex ) |
Returns sprite recordIndex of an object (0 only, for a single sprite), or null when it has no such sprite.
Called throughout the battle parts.
Definition at line 628 of file objects.c.
Referenced by BattleActor_UpdateSpritePriorities(), BattleEvent_Playback(), BattleMotion_ProjectConditionalPosition(), BattleMotion_ProjectPosition(), BattleMotion_ProjectScaledPosition(), BattleMotion_SetRecordChildValues(), BattleMotion_ShowDowned(), BattlePres_RunAttack(), BattlePres_RunItem(), BattlePres_RunPlainAttack(), BattlePres_RunPsynergyCast(), BattlePresentation_RunUnitTransition(), BattleStatusIcon_Cycle(), GetMotionRecord(), and ReleaseBattleObjectRecords().
| void Camera_InitDefaultTransform | ( | void | ) |
Puts the battle camera at its default view of the battlefield's centre.
Called by Battle_RunEncounter as the battle is set up and by BattlePresentation_BuildActions. Writes the camera's yaw, pitch, distance, position and eye, and the transform state.
Definition at line 644 of file objects.c.
Referenced by Battle_RunEncounter(), BattlePresentation_BuildActions(), and Camera_InitDefaultTransform().