Alchemy

projectiles.c

Projectile volleys (Slash, Shuriken, Wing Flutter, Blizzard ...).

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

Projectile volleys (Slash, Shuriken, Wing Flutter, Blizzard ...). Part of effect.c, the battle effect object, compiled only through it.

Functions

BattleFx_RunDjinniEntrance

void BattleFx_RunDjinniEntrance(struct BattleEffectArgument *effect, s32 mode, s32 side, s32 anchor, s32 *outX, s32 *outY)

Djinni entrance: sparks swirl around a point that travels from the user to the goal and gather into the Djinni, which sways for 16 frames and bursts into motes. Leaves the canvas cleared for the effect that follows.

The prelude of the stat boosts, the projectile volleys, the healing motes, the Djinn beams, the burst scenes, Bind, Hail, Ground, Torch and Vine, called with the work block they then use. Opens the canvas layer but does not close it: it removes the transfer and palette fade callbacks, frees both blitters, clears the canvas and its VRAM, and sets REG_BLDALPHA back to 16/16. Copies the Djinni's palette over the first 128 bytes of BG palette RAM, starts a 24-frame backdrop fade (work->fadeFrames), and uses PARTICLES 0 to 63 for the sparks and work->particles for the motes.

effect: the user and the targets.
mode: the Djinni: 0 Venus, 1 Mercury, 2 Mars, 3 Jupiter; 4 to 7 the same
      over 84 frames instead of 64.
side: 1 mirrors the pictures.
anchor: where the Djinni appears: 0 over the first target, 1 at the
        first target's x at depth 0, 2 over the user, 3 at the user's x
        at depth 0, 4 in the centre of the field.
outX, outY: receive the Djinni's last screen position.

Used by BattleFx_RunBind, BattleFx_RunBurstScene, BattleFx_RunDjinnBeams, BattleFx_RunGround, BattleFx_RunHail, BattleFx_RunHealingMotes, BattleFx_RunKite, BattleFx_RunProjectileVolley, BattleFx_RunStatBoost, BattleFx_RunTorch, BattleFx_RunVine.

Line 29

BattleFx_RunSlash

void BattleFx_RunSlash(struct BattleEffectArgument *effect)

Six comets fly at each target, three frames apart, and burst into a flash and sparks; the effect's variant picks one of three comets.

Abilities: Slash, Wind Slash, Sonic Slash (kind 19).

Used by gBattleFx_EffectHandlers.

Line 268

BattleFx_RunShuriken

void BattleFx_RunShuriken(struct BattleEffectArgument *effect)

Four spinning shurikens fly at each target, five frames apart, and vanish once past it.

Abilities: Shuriken (kind 54).

Used by gBattleFx_EffectHandlers.

Line 275

BattleFx_RunCrazyVoice

void BattleFx_RunCrazyVoice(struct BattleEffectArgument *effect)

Ten pellets fly slowly at each target and bounce off it, up or down at random.

Abilities: Crazy Voice (kind 303).

Used by gBattleFx_EffectHandlers.

Line 282

BattleFx_RunWingFlutter

void BattleFx_RunWingFlutter(struct BattleEffectArgument *effect)

Five yellow sparks fly level at each target, five frames apart.

Abilities: Wing Flutter (kind 307).

Used by gBattleFx_EffectHandlers.

Line 288

BattleFx_RunWingStroke

void BattleFx_RunWingStroke(struct BattleEffectArgument *effect)

Ten large yellow sparks stream level at each target, one a frame, spread up and down.

Abilities: Wing Stroke (kind 381).

Used by gBattleFx_EffectHandlers.

Line 295

BattleFx_RunWingBeat

void BattleFx_RunWingBeat(struct BattleEffectArgument *effect)

Ten small yellow sparks stream level at each target, one a frame.

Abilities: Wing Beat (kind 306).

Used by gBattleFx_EffectHandlers.

Line 301

BattleFx_RunVolleyWithAction

static inline void BattleFx_RunVolleyWithAction(struct BattleEffectArgument *effect, s32 mode)

Puts the user into its action pose (2) and fires the volley in this mode while its animation runs fast.

Called by Cutting Edge, Heat Wave and Blizzard. Leaves the user in its action pose, its animation back at the usual speed.

Used by BattleFx_RunBlizzard, BattleFx_RunCuttingEdge, BattleFx_RunHeatWave.

Line 309

BattleFx_RunCuttingEdge

void BattleFx_RunCuttingEdge(struct BattleEffectArgument *effect)

From the user's action pose, one large comet in ice colours flies at each target and bursts into 80 sparks.

Abilities: Cutting Edge (kind 57).

Used by gBattleFx_EffectHandlers.

Line 326

BattleFx_RunHeatWave

void BattleFx_RunHeatWave(struct BattleEffectArgument *effect)

From the user's action pose, seven fireballs trailing embers fly at each target, two frames apart, each bursting into 40 sparks.

Abilities: Heat Wave (kind 59).

Used by gBattleFx_EffectHandlers.

Line 333

BattleFx_RunSleet

void BattleFx_RunSleet(struct BattleEffectArgument *effect)

Thirty ice chips fall from high above the user onto each target, without shaking the screen or knocking the target back; the battle shows the damage on frame 48.

Abilities: Sleet (kind 205).

Used by gBattleFx_EffectHandlers.

Line 341

BattleFx_RunIceBlessing

void BattleFx_RunIceBlessing(struct BattleEffectArgument *effect)

Sixty ice chips stream at each target, one a frame, without knocking it back.

Abilities: Ice Blessing (kind 402).

Used by gBattleFx_EffectHandlers.

Line 348

BattleFx_RunBlizzard

void BattleFx_RunBlizzard(struct BattleEffectArgument *effect)

From the user's action pose, sixty ice chips stream at each target, one a frame, scattered up and down, without knocking it back.

Abilities: Blizzard (kind 63).

Used by gBattleFx_EffectHandlers.

Line 355

BattleFx_RunProjectileVolley

void BattleFx_RunProjectileVolley(struct BattleEffectArgument *effect, s32 mode)

Projectile volley: shots fly from the user to each target and burst into a flash and sparks when they pass it. The hit sound plays at most once every 8 frames.

Called by the eleven wrappers above, and by casting impacts 15 (mode 9) and 26 (mode 8, which no wrapper uses) once their prelude ends. With more than 63 shots in all it fires at the first target only, writing work->effect->count. Writes REG_BLDCNT in mode 1 and the first 128 bytes of BG palette RAM in modes 2 and 5; sets work->shakeFrames on each hit but in mode 7. Ends with the transfer callback removed, the blitter freed and the canvas layer closed; the second blitter is built and freed for each picture that needs it.

effect: the user and the targets. variant picks the comet in mode 0
        (mode 5 always uses comet 2, mode 8 comet 0); with prelude 1 a
        Mercury Djinni enters first.
mode: the shot and its flight (0 to 11): 0, 5 and 8 comets (5 in the
      ice palette), 1 shurikens, 2 bouncing pellets, 3, 4 and 11
      yellow sparks, 6 fireballs with trails, 7, 9 and 10 ice chips.

Used by BattleFx_RunCastingImpact, BattleFx_RunCrazyVoice, BattleFx_RunIceBlessing, BattleFx_RunShuriken, BattleFx_RunSlash, BattleFx_RunSleet, BattleFx_RunVolleyWithAction, BattleFx_RunWingBeat, BattleFx_RunWingFlutter, BattleFx_RunWingStroke.

Line 404

BattleFx_InitializeRisingObject

UNUSED void BattleFx_InitializeRisingObject(s32 id)

Sends a battler back to its place (its anchor) with a hop.

Nothing calls it; ObjMotRst (battle/motion.c) sets the same motion without the hop. Sets the battler's motion object to move at up to 8 pixels a frame, jumping at 4 pixels a frame under the usual gravity, and selects its animation 1.

Line 959

BattleFx_SetApproachMotion

void BattleFx_SetApproachMotion(s32 id, s32 targetId, s32 frames)

Moves a battler 80% of the way to another one over a number of frames, in its action pose. The speed is that distance over the frames; the distance is taken in 1/256 pixels so its square fits in 32 bits.

Called by BattleFx_RunRushingStrike. Sets the battler's acceleration, speed limit and gravity, turns it to face its motion, starts it moving on the ground towards that point and selects its animation 2.

Used by BattleFx_RunRushingStrike.

Line 983

Enumerations

VolleyField

enum VolleyField

The bytes of a gProjectiles_Modes row.

Value=
PROJECTILE_VOLLEY_SHOTSshots at each target
PROJECTILE_VOLLEY_STEPSframes a shot takes to reach its target
PROJECTILE_VOLLEY_STAGGERframes between shots
PROJECTILE_VOLLEY_DELAYframes between targets
PROJECTILE_VOLLEY_SPARKSsparks thrown on each hit

Line 364

Macros

PROJECTILE_VOLLEY_ANIMATION_STEP_NORMAL

#define PROJECTILE_VOLLEY_ANIMATION_STEP_NORMAL 0x10

The user's animation step after the volley: the usual speed.

Used by BattleFx_RunVolleyWithAction.

Line 262

PROJECTILE_VOLLEY_PARTICLE_COUNT

#define PROJECTILE_VOLLEY_PARTICLE_COUNT 1024

PARTICLES holds the hit flashes from 0, the sparks from 100 and the fireball trails from 512.

Used by BattleFx_RunProjectileVolley.

Line 361

PROJECTILE_VOLLEY_FLASH_TURNED

#define PROJECTILE_VOLLEY_FLASH_TURNED 0x128a

The hit flashes turned on their side, after the upright ones.

Used by BattleFx_RunProjectileVolley.

Line 376

PROJECTILE_VOLLEY_MEDIUM_SPARK_CELLS

#define PROJECTILE_VOLLEY_MEDIUM_SPARK_CELLS (12 * 8)

The yellow spark sheet: the small spark (12x8) first, then the medium one (18x13), then the large one.

Used by BattleFx_RunProjectileVolley.

Line 379

Also, macros without a comment: PROJECTILE_VOLLEY_ANIMATION_STEP_FAST, PROJECTILE_VOLLEY_COMET_CELLS, PROJECTILE_VOLLEY_STREAK_CELLS, PROJECTILE_VOLLEY_LARGE_SPARK_CELLS, PROJECTILE_VOLLEY_DJINNI_CELLS, PROJECTILE_VOLLEY_FIRST_SPARK, PROJECTILE_VOLLEY_FIRST_TRAIL.

On this page