Alchemy

djinn_attacks.c

The Mercury, Jupiter, Venus and Mars Djinn attacks.

games/tbs/src/effect/parts/djinn_attacks.c on GitHub

The Mercury, Jupiter, Venus and Mars Djinn attacks. Part of effect.c, the battle effect object, compiled only through it.

Functions

Graphics_TransposeCopy

void Graphics_TransposeCopy(const u8 *src, u8 *dst, s32 w, s32 h)

Copies a w x h byte picture into an h x w one turned 90 degrees clockwise: the top row of src becomes the right column of dst.

Called twice by BattleFx_RunMercury, to lay its blue flames on their side. Writes only dst.

Used by BattleFx_RunMercury.

Line 12

BattleFx_RunMercury

void BattleFx_RunMercury(struct BattleEffectArgument *effect)

Mercury Djinni flames: the small Mercury Djinni spirals around (96, 60) and fires five blue flames to the left; each flame shatters into 32 motes after 5 frames, hitting every target.

Abilities: Mercury (kind 251).

work->particles 0 to 4 hold the flames, variant -1 until launched and then counting the frames since; Ram_MapCellBuffer takes the blue flame sheet before it is turned. Sets work->shakeFrames as each flame shatters, and ends with the transfer callback removed, the blitters freed and the canvas layer closed.

effect: the targets.

Used by gBattleFx_EffectHandlers.

Line 78

BattleFx_RunJupiter

void BattleFx_RunJupiter(struct BattleEffectArgument *effect)

Jupiter Djinni fall: the small Jupiter Djinni spirals while eight flameballs fall from the top right to the bottom left, 4 frames apart; each shatters into 32 motes below line 95, hitting every target.

Abilities: Jupiter (kind 253).

work->particles holds the flameballs. Copies the Djinni's palette over the first 128 bytes of BG palette RAM, writes REG_BLDALPHA, sets work->shakeFrames as each ball lands, and ends with the transfer callback removed, the blitters freed and the canvas layer closed.

effect: the targets.

Used by gBattleFx_EffectHandlers.

Line 220

Resource_LoadAndDecompress

void Resource_LoadAndDecompress(s32 id, void *dst, s32 skipPalette, s32 copyPalette)

Decompresses a resource whose first 128 bytes may be a palette.

Called by nearly every effect to load its pictures. Writes dst and, with copyPalette, the first 128 bytes of BG palette RAM.

id: the resource. dst: receives the decompressed data. skipPalette: the resource starts with a palette to skip. copyPalette: copy that palette to the start of background palette RAM.

Used by BattleFx_RunAnnihilation, BattleFx_RunAtalanta, BattleFx_RunBeamSequence, BattleFx_RunBladeRain, BattleFx_RunBolt, BattleFx_RunBoreas, BattleFx_RunBreak, BattleFx_RunBurstScene, BattleFx_RunBurstShower, BattleFx_RunCastingImpact, BattleFx_RunCybele, BattleFx_RunDeathPlunge, BattleFx_RunDjinnHeal, BattleFx_RunDjinniEntrance, BattleFx_RunDouse, BattleFx_RunDragonCloud, BattleFx_RunDrain, BattleFx_RunElementBurst, BattleFx_RunElementPillar, BattleFx_RunEruption, BattleFx_RunFire, BattleFx_RunFlare, BattleFx_RunFlashingStrike, BattleFx_RunFrost, BattleFx_RunGaia, BattleFx_RunGround, BattleFx_RunGrowingColumns, BattleFx_RunHail, BattleFx_RunHealingMotes, BattleFx_RunHelmSplitter, BattleFx_RunIce, BattleFx_RunImpactBurst, BattleFx_RunJudgment, BattleFx_RunJupiter, BattleFx_RunKirin, BattleFx_RunMars, BattleFx_RunMercury, BattleFx_RunMoteFountain, BattleFx_RunNeptune, BattleFx_RunParticleStreams and 30 more.

Line 337

BattleFx_RunVenus

void BattleFx_RunVenus(struct BattleEffectArgument *effect)

Venus Djinni columns: the small Venus Djinni sways while ten columns of flame in its colours rise from the ground one after another, each bursting into motes and hitting every target.

Abilities: Venus (kind 250).

work->particles holds the columns. Copies the Djinni's palette over the first 128 bytes of BG palette RAM, writes REG_BLDALPHA, sets work->shakeFrames as each column appears, and ends with the transfer callback removed, the blitters freed and the canvas layer closed.

effect: the targets.

Used by gBattleFx_EffectHandlers.

Line 366

BattleFx_RunMars

void BattleFx_RunMars(struct BattleEffectArgument *effect)

Mars Djinni flames: a glowing orb flares, the small Mars Djinni dives to the ground, and nine flames erupt in a row while embers rise.

Abilities: Mars (kind 252).

The scene runs for 112 frames:

  0 to 23    the orb flares
  20 to 31   the Djinni appears, then dives from frame 24
  32         it strikes: the screen shakes and the flames start erupting
  38         every target is hit
  40 on      the embers rise, 16 more every 2 frames

work->particles holds the nine flames, PARTICLES their 144 embers. The BG palette's first 128 bytes change three times: the glow orb's at the start, the Djinni's on frame 20 and the ember streak's on frame 32, when the streak sheet replaces the Djinni in work->sheet. Sets work->shakeFrames on the strike, and ends with the transfer callback removed, the blitters freed and the canvas layer closed.

effect: the targets.

Used by gBattleFx_EffectHandlers.

Line 499

Macros

DJINN_ATTACKS_FLAME2_CELLS

#define DJINN_ATTACKS_FLAME2_CELLS (17 * 104)

The blue flame sheet holds a 17x104 flame, then a 34x65 one; Mercury turns both on their side after its Djinni, Venus draws the second.

Used by BattleFx_RunMercury.

Line 49

MERCURY_TALL_FLAME_CELLS

#define MERCURY_TALL_FLAME_CELLS 0x2a8

The first flame turned, 104x17, after the 20x34 Djinni; never drawn.

Used by BattleFx_RunMercury.

Line 51

MERCURY_MOTE_SLOTS

#define MERCURY_MOTE_SLOTS 256

The mote slots Mercury walks: room for more than MERCURY_FLAMES * DJINN_ATTACKS_MOTES_PER_FLAME.

Used by BattleFx_RunMercury.

Line 56

VENUS_FLAME_SHEET

#define VENUS_FLAME_SHEET 0x2f8

The blue flame sheet, after the 20x38 Djinni, and its second flame.

Used by BattleFx_RunVenus.

Line 351

Also, macros without a comment: MERCURY_FRAMES, MERCURY_FLAME_CELLS, MERCURY_FLAMES, DJINN_ATTACKS_MOTES_PER_FLAME, DJINN_ATTACKS_MOTE_SLOTS, JUPITER_FRAMES, JUPITER_FLAMEBALLS, JUPITER_GROUND_Y, JUPITER_FLAMEBALL_CELLS, VENUS_FRAMES, VENUS_COLUMNS, VENUS_COLUMN_CELLS, MARS_FRAMES, MARS_STRIKE_FRAME, MARS_FLAMES, MARS_EMBERS_PER_FLAME, MARS_ORB_CELLS.

On this page