Battle events played over frames, BattleEvent_Playback. More...
Go to the source code of this file.
Macros | |
| #define | PLAY_MESSAGE 3 |
| waits for the message, then for the player | |
| #define | PLAY_ADVANCE 5 |
| shows the arrow and waits for the player | |
| #define | PLAY_HIT 10 |
| flashes the unit that was hit | |
| #define | PLAY_FELLED 11 |
| greys a fallen enemy and dissolves it | |
| #define | PLAY_MESSAGE_ADD 13 |
| waits for the message, then goes straight on | |
| #define | FELLED_FLASH 0x400 |
| PLAY_FELLED's timer from here counts the Djinn bonus's colour cycle, kept apart from the counts of the fall itself (0 to 36). | |
| #define | FELLED_FLASH_FRAMES 30 |
| The Djinn bonus's colour cycle lasts 30 frames. | |
Functions | |
| void | Dma_StopAllThenRunHook (void) |
| Sets DMA3 three times over, stopping it, then calls the IRQ return instruction's word as a routine. | |
| void | BattleEventRuntime_BeginPhase (s32 cue) |
| Starts playback of the plan's targets when the effect's blow lands. | |
| s32 | BattleEventRuntime_SchedulePhase (s32 frames) |
| Empties the event queue and schedules playback of the events queued next, with no targets to resolve. | |
| void | BattleEvent_Playback (void) |
| Plays the plan's targets one at a time: resolves the next target with BattleTargetExec, then plays the events it queued over the frames that follow, until every target is done. | |
| void | BattleEventRuntime_Reset (void) |
| Stops playback and empties the event queue. | |
| s32 | BattleEventRuntime_WaitForReady (void) |
| Waits, a frame at a time, until BattleEvent_Playback has played every target, then removes the callback and resets the events. | |
Battle events played over frames, BattleEvent_Playback.
Part of battle.c, the battle object, compiled only through it.
Definition in file playback.c.
| #define PLAY_MESSAGE 3 |
waits for the message, then for the player
Definition at line 63 of file playback.c.
Referenced by BattleEvent_Playback().
| #define PLAY_ADVANCE 5 |
shows the arrow and waits for the player
Definition at line 64 of file playback.c.
Referenced by BattleEvent_Playback().
| #define PLAY_HIT 10 |
flashes the unit that was hit
Definition at line 65 of file playback.c.
Referenced by BattleEvent_Playback().
| #define PLAY_FELLED 11 |
greys a fallen enemy and dissolves it
Definition at line 66 of file playback.c.
Referenced by BattleEvent_Playback().
| #define PLAY_MESSAGE_ADD 13 |
waits for the message, then goes straight on
Definition at line 67 of file playback.c.
Referenced by BattleEvent_Playback().
| #define FELLED_FLASH 0x400 |
PLAY_FELLED's timer from here counts the Djinn bonus's colour cycle, kept apart from the counts of the fall itself (0 to 36).
Definition at line 71 of file playback.c.
Referenced by BattleEvent_Playback().
| #define FELLED_FLASH_FRAMES 30 |
The Djinn bonus's colour cycle lasts 30 frames.
Definition at line 73 of file playback.c.
Referenced by BattleEvent_Playback().
| void Dma_StopAllThenRunHook | ( | void | ) |
Sets DMA3 three times over, stopping it, then calls the IRQ return instruction's word as a routine.
Nothing in this game calls it. XXX: _call_via_r0 is given the value of IwramIrqModeWord, the instruction orr r3, r3, #0x92 in runtime.s, not its address, so it would branch to 0xe3833092; a caller in another edition, or the same function in The Lost Age, would show what it was meant to run.
Definition at line 14 of file playback.c.
Referenced by Dma_StopAllThenRunHook().
| void BattleEventRuntime_BeginPhase | ( | s32 | cue | ) |
Starts playback of the plan's targets when the effect's blow lands.
Reached as EFFECT_SHOW_DAMAGE(hitSound), through BattleEventRuntime_BeginPhaseFar, from the effects (see the folder README). Only while playback is idle: sets the phase to BATTLE_PLAYBACK_RESOLVE_TARGET, and a nonzero cue to pendingCue. cue : the hit's sound (an SE_ id); zero keeps the one set
Definition at line 27 of file playback.c.
Referenced by BattleEventRuntime_BeginPhase().
Empties the event queue and schedules playback of the events queued next, with no targets to resolve.
Called before a Djinni is set (BattleCommand_BuildPlan) and for the Djinn the round's and a turn's end show (Battle_ProcessRoundEnd, BattleUnit_ProcessTurnEnd), each followed by BattleEventRuntime_WaitForReady. Sets the phase to BATTLE_PLAYBACK_DISPATCH and gBattleWork->plan's targetCount to 0, so playback goes to BATTLE_PLAYBACK_READY once the queue is played; adds BattleEvent_Playback as a scheduler callback and returns the scheduler's result. frames : the delay before the first event
Definition at line 49 of file playback.c.
Referenced by Battle_ProcessRoundEnd(), BattleCommand_BuildPlan(), BattleEventRuntime_SchedulePhase(), and BattleUnit_ProcessTurnEnd().
| void BattleEvent_Playback | ( | void | ) |
Plays the plan's targets one at a time: resolves the next target with BattleTargetExec, then plays the events it queued over the frames that follow, until every target is done.
Runs each frame as a scheduler callback (priority 0xc80), added by the staging runners in staging.c and by BattleEventRuntime_SchedulePhase, and removed by BattleEventRuntime_WaitForReady. Idle until BattleEventRuntime_BeginPhase or the wait starts it. Advances gBattleWork->events (phase, eventIndex, timer, queue.targetIndex, actorId, displaySource, displayEntry, flags); plays the sounds, message arguments, messages, flashes, falls and redraws as BattleEv_DispatchQueued does, without waiting. Each pass of its loop handles one phase; a phase that has to wait for a later frame returns.
Clears a sprite's tiles in OBJ VRAM, at its VRAM cache entry's offset; the last step of a fallen enemy's dissolve.
Definition at line 87 of file playback.c.
Referenced by BattleEvent_Playback(), BattleEventRuntime_SchedulePhase(), BattleEventRuntime_WaitForReady(), BattlePres_RunAttack(), BattlePres_RunItem(), BattlePres_RunPsynergyCast(), and BattlePresentation_RunUnitTransition().
| void BattleEventRuntime_Reset | ( | void | ) |
Stops playback and empties the event queue.
Called when an action is planned (BattleCommand_BuildPlan), after a queue is played (BattleEv_DispatchQueued, BattleEventRuntime_WaitForReady), and before playback is scheduled (BattleCommand_BuildPlan, turn_end.c). Sets gBattleWork->events' phase to BATTLE_PLAYBACK_IDLE, clears the queue, the event index, the timer, the target index and the flags (the Djinn bonus), and sets the hit sound back to SE_HEAVY_IMPACT.
Definition at line 437 of file playback.c.
Referenced by Battle_ProcessRoundEnd(), BattleCommand_BuildPlan(), BattleEv_DispatchQueued(), BattleEventRuntime_Reset(), BattleEventRuntime_WaitForReady(), and BattleUnit_ProcessTurnEnd().
| s32 BattleEventRuntime_WaitForReady | ( | void | ) |
Waits, a frame at a time, until BattleEvent_Playback has played every target, then removes the callback and resets the events.
Called after the effect by the staging runners in staging.c, and after a Djinn's effect by BattleCommand_BuildPlan and turn_end.c. Playback still idle (the effect never called EFFECT_SHOW_DAMAGE) is started here.
Definition at line 458 of file playback.c.
Referenced by Battle_ProcessRoundEnd(), BattleCommand_BuildPlan(), BattleEventRuntime_WaitForReady(), BattlePres_RunAttack(), BattlePres_RunItem(), BattlePres_RunPsynergyCast(), BattlePresentation_RunUnitTransition(), and BattleUnit_ProcessTurnEnd().