hail.c
Hail and Ground.
games/tbs/src/effect/parts/hail.c on GitHub
Hail and Ground. Part of effect.c, the battle effect object, compiled only through it.
Functions
BattleFx_RunHail
void BattleFx_RunHail(struct BattleEffectArgument *effect)
Water burst: after a Mercury Djinni enters, ice chips burst out of the first target and waves rise along the bottom of the screen; the canvas fades out over the last 16 of its 64 frames.
Abilities: Hail (kind 207).
The 64 chips start together and are let go four a frame from frame 4, alternately mirrored; the battle shows the damage on frame 8. The chips live in PARTICLES, since work holds the waves' sheet.
The Djinni entrance plays whatever the prelude. Writes REG_BLDALPHA and the first 128 bytes of BG palette RAM (the water spray's, then the ice chips' on frame 1), sets work->shakeFrames on frame 8, and ends with the transfer callback removed, the blitters freed and the canvas layer closed.
effect: the user and the targets; prelude 1 keeps the Djinni circling.
Used by gBattleFx_EffectHandlers.
BattleFx_RunGround
void BattleFx_RunGround(struct BattleEffectArgument *effect)
Venus Djinni rock toss: after a Venus Djinni enters, six rocks rise from the user shedding chips, swirl, and home in on the first target, each hitting it as it lands.
Abilities: Ground (kind 203).
A rock's variant is 1 while it flies and 0 once it has hit; the chips are particles 32 to 63, four for each rock, each with its picture in velocityX and its blitter flags in velocityY. The Djinni entrance plays whatever the prelude. From frame 17 the BG palette steps towards the portal sheet's (BattleFx_StepPaletteToResource). Writes REG_BLDALPHA, sets work->shakeFrames on each hit, and ends with the transfer callback removed, the blitter freed and the canvas layer closed.
effect: the user and the targets; prelude 1 keeps the Djinni circling.
Used by gBattleFx_EffectHandlers.
Camera_ApplyShake
void Camera_ApplyShake(s32 rangeX, u32 rangeY)
Shakes the battle view while gBattleFxWork's shakeFrames lasts, moving BG1 and the projection centre by a random offset; once the shake runs out, BG1 returns to its saved position and the centre to (120, 120). It takes two random numbers each shaking frame, x first.
Called once a frame by nearly every effect, before it presents the frame. Writes gBgScroll[1] and gProjection.centerX and centerY, and counts down work->shakeFrames. The x offset is centred on half of rangeY too, so with rangeX smaller (Hail's 4 and 8) the x offset is never positive.
rangeX: the horizontal range, a power of two.
rangeY: the vertical range, a power of two; both offsets are centred on
half of it.Used by BattleFx_RunAnnihilation, BattleFx_RunAstralBlast, BattleFx_RunAtalanta, BattleFx_RunBladeRain, BattleFx_RunBolt, BattleFx_RunBoreas, BattleFx_RunBurstScene, BattleFx_RunBurstShower, BattleFx_RunCastingImpact, BattleFx_RunCybele, BattleFx_RunDeathPlunge, BattleFx_RunDragonCloud, BattleFx_RunEruption, BattleFx_RunFire, BattleFx_RunFlashingStrike, BattleFx_RunFroth, BattleFx_RunGaia, BattleFx_RunGround, BattleFx_RunGrowingColumns, BattleFx_RunHail, BattleFx_RunHelmSplitter, BattleFx_RunIce, BattleFx_RunJupiter, BattleFx_RunKirin, BattleFx_RunLobbedShells, BattleFx_RunMars, BattleFx_RunMercury, BattleFx_RunMirroredWall, BattleFx_RunNeptune, BattleFx_RunPaletteParticles, BattleFx_RunParticleStreams, BattleFx_RunPlanetDiver, BattleFx_RunPlasma, BattleFx_RunPrism, BattleFx_RunProjectileVolley, BattleFx_RunQuake, BattleFx_RunRagnarok, BattleFx_RunRamses, BattleFx_RunRay, BattleFx_RunRushingStrike and 15 more.
Macros
GROUND_DJINNI_CELLS
#define GROUND_DJINNI_CELLS 0x65c0
The small Venus Djinni in the rock toss's sheet.
Used by BattleFx_RunGround.
Also, macros without a comment: HAIL_CHIP_COUNT, HAIL_CHIP_CELLS, HAIL_DJINNI_CELLS, HAIL_FRAMES, GROUND_FRAMES, GROUND_LAUNCHED, GROUND_CHIPS, GROUND_ROCKS, GROUND_CHIPS_PER_ROCK.