display.c
Display, scroll and window HBlank DMA helpers.
games/tbs/src/effect/parts/display.c on GitHub
Display, scroll and window HBlank DMA helpers. Part of effect.c, the battle effect object, compiled only through it.
Functions
BattleFx_ConfigureEffectDisplay
void BattleFx_ConfigureEffectDisplay(void)
Puts the battle screen back into the display state every effect starts from and ends with: no blending, window 0 and window 1 both covering the battle view (lines 16 to 135), and the effect display mode queued.
Called at the start and end of the handlers that change the display themselves: Ice and Douse (falling.c), the beam sequence, and the summons and scenes from Boreas to Judgment. Writes BLDCNT, BLDALPHA, the window registers and WININ and WINOUT, queues DISPCNT for two frames later and waits one frame.
Used by BattleFx_RunAtalanta, BattleFx_RunBeamSequence, BattleFx_RunBoreas, BattleFx_RunDouse, BattleFx_RunIce, BattleFx_RunJudgment, BattleFx_RunKirin, BattleFx_RunNeptune, BattleFx_RunParticleStreams, BattleFx_RunRamses, BattleFx_RunThor.
BattleFx_AdvanceScrollOnInterval
void BattleFx_AdvanceScrollOnInterval(void)
Scrolls BG1 by (scrollStepX, scrollStepY) once every scrollInterval frames.
Runs each frame as a scheduler callback added by BattleFx_RunAtalanta and BattleFx_RunThor, which set the work block's scroll fields first and remove it before they return. Counts work->scrollTimer and moves gBgScroll[1].
Used by BattleFx_RunAtalanta, BattleFx_RunThor.
BattleFx_AdvanceBg2OnInterval
void BattleFx_AdvanceBg2OnInterval(void)
Slides the affine BG2 in steps: once every scrollInterval frames, writes the work block's reference point (bg2x, bg2y) to BG2X and BG2Y, then moves it by (scrollStepX, scrollStepY).
Runs each frame as a scheduler callback added by BattleFx_RunParticleStreams, which removes it before it returns. Counts work->scrollTimer.
Used by BattleFx_RunParticleStreams.
BattleFx_ArmWin0HBlankDma
void BattleFx_ArmWin0HBlankDma(void)
Restarts DMA 0 as an HBlank transfer of one WIN0H value a line from PARTICLES (Ram_MapCellBuffer), so window 0's edges follow the per-line table the effect drew there.
Runs each frame as a scheduler callback added by BattleFx_RunIce and BattleFx_RunDouse, which remove it before they return. Stopping the channel first makes each frame's transfer start again from the table's first line.
Used by BattleFx_RunDouse, BattleFx_RunIce.