Battle events: a downed unit's reset, waiting for the player, and the event queue, filled by BattleEvPush and played at once by BattleEv_DispatchQueued. More...
Go to the source code of this file.
Data Structures | |
| struct | AdvanceSprite |
| One OAM entry for Runtime_PushSlotEntry. More... | |
Macros | |
| #define | ADVANCE_ARROW_ATTR0 0xa400 |
| The advance arrow's attribute 0: a 256-colour, semi-transparent tall sprite; with attribute 1's size 0 it is 8 by 16 pixels. | |
| #define | EVENT_FLAG_DJINN_BONUS 1 |
| BattleEventState.flags bit 0: a Djinni struck a weakness, so enemies that fall pay the Djinn bonus (BattleEnemy_RecordDefeat). | |
Functions | |
| s32 | BattleActor_ResetRuntimeFields (s32 unitId) |
| Clears every ailment and stat change of a unit that goes down, recalculates its stats and rebuilds its status icons. | |
| s32 | BattlePresentation_WaitForAdvance (void) |
| Shows the bobbing arrow at the message window and waits for the player to go on (B, or one of KEY_ADVANCE), then plays the cursor sound. | |
| s32 | BattlePresentation_WaitForPromptAt (s32 x, s32 y) |
| Shows the cursor bobbing at (x, y) and waits for one of KEY_ADVANCE. | |
| void | BattleEv_MarkDisplay (void) |
| Sets gBattleDisplayWork->marked, which the next message reads, as BATTLE_EVENT_MARK does. | |
| s32 | BattleActor_DestroyTemporaryObject (s32 unitId) |
| Takes an enemy out of the battle at once (one that leaves rather than falls): its HP to 0, out of the lists, and its object released. | |
| void | BattleEv_GrantDjinnBonus (struct BattleEventState *runtime, u32 operand) |
| The BATTLE_EVENT_DJINN_BONUS event: grants the Djinn bonus for the rest of the action. | |
| u32 | BattleEv_DispatchQueued (void) |
| Plays the queued battle events at once, in order (BattleEvent_Playback plays them over frames instead): the messages with their arguments, the hit flashes, the downed units, the redraws. | |
| u32 | BattleEvPush (u32 opcode, u32 operand) |
| Queues one battle event (enum BattleEventOpcode) with its operand, and returns the opcode. | |
Battle events: a downed unit's reset, waiting for the player, and the event queue, filled by BattleEvPush and played at once by BattleEv_DispatchQueued.
Part of battle.c, the battle object, compiled only through it.
Definition in file events.c.
| #define ADVANCE_ARROW_ATTR0 0xa400 |
The advance arrow's attribute 0: a 256-colour, semi-transparent tall sprite; with attribute 1's size 0 it is 8 by 16 pixels.
Definition at line 76 of file events.c.
Referenced by BattlePresentation_WaitForAdvance().
| #define EVENT_FLAG_DJINN_BONUS 1 |
BattleEventState.flags bit 0: a Djinni struck a weakness, so enemies that fall pay the Djinn bonus (BattleEnemy_RecordDefeat).
Definition at line 219 of file events.c.
Referenced by BattleEv_GrantDjinnBonus().
Clears every ailment and stat change of a unit that goes down, recalculates its stats and rebuilds its status icons.
Reached through the BATTLE_EVENT_DEFEAT event, from BattleEv_DispatchQueued and BattleEvent_Playback. Clears the unit's element levels, poison, stat stages and their turns, every status, its equipment bonuses, ready, immobile and challenge; UnitCalcFar then recomputes its stats, and BattleUnit_BuildStatusFlags its battle object's status flags.
Definition at line 19 of file events.c.
Referenced by BattleActor_ResetRuntimeFields(), BattleEv_DispatchQueued(), and BattleEvent_Playback().
| s32 BattlePresentation_WaitForAdvance | ( | void | ) |
Shows the bobbing arrow at the message window and waits for the player to go on (B, or one of KEY_ADVANCE), then plays the cursor sound.
Called after a message by BattlePresentation_DispatchAction and the staging runners, BattleCommand_BuildPlan (a flight), BattleIntro_AnnounceEncounter, the round's end (turn_end.c), and BattleEv_DispatchQueued for each BATTLE_EVENT_MESSAGE. Waits for the message window first. Takes a 128-byte VRAM cache entry for the arrow's tiles and frees it; each frame queues the WINOUT writes, sets REG_BLDALPHA and pushes the arrow sprite.
Definition at line 90 of file events.c.
Referenced by Battle_AwardSpoils(), Battle_ProcessRoundEnd(), Battle_RunEncounter(), BattleCommand_BuildPlan(), BattleEv_DispatchQueued(), BattleIntro_AnnounceEncounter(), BattlePres_RunActorEntries(), BattlePres_RunEscape(), BattlePresentation_DispatchAction(), and BattlePresentation_WaitForAdvance().
Shows the cursor bobbing at (x, y) and waits for one of KEY_ADVANCE.
Called by Battle_RunEncounter under the Djinn tutorial's standby message, and by Menu_RunCommandRow through BattlePresentation_WaitForPromptAtFar. Waits for the message window first; takes a 128-byte VRAM cache entry for the cursor's tiles and frees it, and each frame queues the WINOUT writes, sets REG_BLDALPHA and pushes the cursor sprite. x, y : in pixels
Definition at line 152 of file events.c.
Referenced by Battle_RunEncounter(), and BattlePresentation_WaitForPromptAt().
| void BattleEv_MarkDisplay | ( | void | ) |
Sets gBattleDisplayWork->marked, which the next message reads, as BATTLE_EVENT_MARK does.
Called by BattleCommand_BuildPlan between a weapon's two unleash messages.
Definition at line 189 of file events.c.
Referenced by BattleCommand_BuildPlan(), and BattleEv_MarkDisplay().
Takes an enemy out of the battle at once (one that leaves rather than falls): its HP to 0, out of the lists, and its object released.
Reached through the BATTLE_EVENT_REMOVE_UNIT event, which BattleTargetExec queues for a self-destructing actor, from BattleEv_DispatchQueued and BattleEvent_Playback. A party unit is left as it is. Clears the battle object's object and active and releases its dispatch object.
Definition at line 200 of file events.c.
Referenced by BattleActor_DestroyTemporaryObject(), BattleEv_DispatchQueued(), and BattleEvent_Playback().
| void BattleEv_GrantDjinnBonus | ( | struct BattleEventState * | runtime, |
| u32 | operand ) |
The BATTLE_EVENT_DJINN_BONUS event: grants the Djinn bonus for the rest of the action.
Its operand is ignored. Called for the event by BattleEv_DispatchQueued and BattleEvent_Playback; BattleTargetExec queues it. Sets EVENT_FLAG_DJINN_BONUS in runtime->flags, which BattleEventRuntime_Reset clears.
Definition at line 226 of file events.c.
Referenced by BattleEv_DispatchQueued(), BattleEv_GrantDjinnBonus(), and BattleEvent_Playback().
| u32 BattleEv_DispatchQueued | ( | void | ) |
Plays the queued battle events at once, in order (BattleEvent_Playback plays them over frames instead): the messages with their arguments, the hit flashes, the downed units, the redraws.
Then empties the queue. Called where an outcome is shown outside an effect: by the staging runners (a blocked cast, a dodge, a broken item, a plan's targets one by one), BattleCommand_BuildPlan's debug defeat, and the turn's end (turn_end.c). Each message, flash and fall waits its frames here. Ends with BattleEventRuntime_Reset.
Definition at line 241 of file events.c.
Referenced by BattleCommand_BuildPlan(), BattleEv_DispatchQueued(), BattlePres_RunActorEntries(), BattlePres_RunAttack(), BattlePres_RunItem(), BattlePres_RunPlainAttack(), BattlePres_RunPsynergyCast(), BattlePresentation_RunUnitTransition(), and BattleUnit_ProcessTurnEnd().
Queues one battle event (enum BattleEventOpcode) with its operand, and returns the opcode.
Called, directly or through PUSH_MESSAGE, by BattleTargetExec for each step of an outcome, and by staging.c, plan.c and turn_end.c. Appends to gBattleWork->events.queue with no test against BATTLE_EVENT_CAPACITY.
Definition at line 321 of file events.c.
Referenced by Battle_ProcessRoundEnd(), BattleCommand_BuildPlan(), BattleEvPush(), BattlePres_RunAttack(), BattlePres_RunItem(), BattlePres_RunPsynergyCast(), BattlePresentation_RunUnitTransition(), BattleTargetExec(), and BattleUnit_ProcessTurnEnd().