Alchemy
Loading...
Searching...
No Matches

casting_impact.c File Reference

The casting impact scene and its image helpers. More...

Go to the source code of this file.

Macros

#define CASTING_IMPACT_ORB_CELLS   0x5100
 The impact orb, 20x48 pictures packed at half width.
#define CASTING_IMPACT_DJINNI_CELLS   0x3c56
 The Djinni pictures, 20x40, in Ram_MapCellBuffer after the impact's own.
#define CASTING_IMPACT_GATHER_FRAMES   32
 frames the sparks gather
#define CASTING_IMPACT_SPARKS   64
 sparks in work->particles
#define CASTING_IMPACT_IMPACT_PARTICLES   ((struct EffectStep *)(Ram_MapCellBuffer + 0x4000))
 The impact pictures' particles, in Ram_MapCellBuffer after the Djinni.
#define CASTING_IMPACT_IMPACT_PARTICLE_COUNT   64
#define CASTING_IMPACT_IMAGE_X(side, image)
 gCastingImpact_ImageX has seven pictures for each side.

Enumerations

enum  CastingImpact {
  CASTING_IMPACT_IMPACT_BANE = 0 , CASTING_IMPACT_IMPACT_SMOG , CASTING_IMPACT_IMPACT_MIST , CASTING_IMPACT_IMPACT_FEVER ,
  CASTING_IMPACT_IMPACT_FLINT , CASTING_IMPACT_IMPACT_SCORCH , CASTING_IMPACT_IMPACT_SQUALL , CASTING_IMPACT_IMPACT_SAP ,
  CASTING_IMPACT_IMPACT_TERRA_STRIKE , CASTING_IMPACT_IMPACT_POISON_CLOUD , CASTING_IMPACT_IMPACT_DEADLY_POISON , CASTING_IMPACT_IMPACT_MORTAL_DANGER ,
  CASTING_IMPACT_IMPACT_BAD_OMEN , CASTING_IMPACT_IMPACT_LIFE_NOURISH , CASTING_IMPACT_IMPACT_AQUA_SOCK , CASTING_IMPACT_IMPACT_15 ,
  CASTING_IMPACT_IMPACT_FROST_BITE , CASTING_IMPACT_IMPACT_17 , CASTING_IMPACT_IMPACT_LIFE_LEECH , CASTING_IMPACT_IMPACT_PSY_LEECH ,
  CASTING_IMPACT_IMPACT_BROIL , CASTING_IMPACT_IMPACT_MELTDOWN , CASTING_IMPACT_IMPACT_HEAT_MIRAGE , CASTING_IMPACT_IMPACT_BARRAGE ,
  CASTING_IMPACT_IMPACT_24 , CASTING_IMPACT_IMPACT_ACID_BATH , CASTING_IMPACT_IMPACT_26 , CASTING_IMPACT_IMPACT_STUN_VOLTAGE ,
  CASTING_IMPACT_IMPACT_BLINDING_SMOG , CASTING_IMPACT_IMPACT_MURK , CASTING_IMPACT_IMPACT_CYCLONE_SLASH , CASTING_IMPACT_IMPACT_PSYPHON_SEAL ,
  CASTING_IMPACT_IMPACT_ASURA , CASTING_IMPACT_IMPACT_FORCIBLE_ARM , CASTING_IMPACT_IMPACT_TRUNCHEON_FIST , CASTING_IMPACT_IMPACT_SEVERE_BLOW
}
 The casting impacts, by kind - 100: each is named for the first ability whose gBattle_ActionFlags entry selects it; the four no ability selects keep their numbers. More...

Functions

void BattleFx_StepPaletteToResource (s32 resourceId)
 Moves each RGB555 channel of background colours 0 to 63 one level towards the resource palette.
static void CastingImpact_LoadResource (const void *id, void *dest, s32 skip, s32 copy)
 Loads one of the impact's pictures (Resource_LoadAndDecompress).
static void CastingImpact_PackRows (void *src, void *dest, s32 width, s32 height)
 Packs a casting impact's picture rows (Graphics_PackTileRows).
static void CastingImpact_DrawImage (void *canvas, const void *pixels, s32 x, s32 y, s32 width, s32 height, DrawRectangle *draw)
 Draws one casting impact image with the given blitter.
static void CastingImpact_DrawTallImage (void *canvas, const void *pixels, s32 x, s32 y, s32 width, DrawRectangle *draw)
 Draws a casting-impact image whose height is twice its width.
static void CastingImpact_DrawScrolledImage (void *canvas, const void *pixels, s32 x, s32 y, s32 width, s32 height, s32 scroll, DrawRectangle *draw)
 Draws only the unscrolled height of a casting-impact image.
static void CastingImpact_DrawCroppedImage (void *canvas, const void *pixels, s32 x, s32 y, s32 width, DrawRectangle *draw)
 Draws a casting-impact image cropped to 91 pixels high.
static void CastingImpact_EndPrelude (struct BattleEffectWork *work, void *canvas)
 Clears the prelude image, stops its callbacks and releases its blitters before the next effect takes over.
void BattleFx_RunCastingImpact (struct BattleEffectArgument *effect, s32 mode)
 Gathers sparks around the caster, launches the Djinni and draws the impact on the first target.

Detailed Description

The casting impact scene and its image helpers.

Part of effect.c, the battle effect object, compiled only through it.

Definition in file casting_impact.c.

Macro Definition Documentation

◆ CASTING_IMPACT_ORB_CELLS

#define CASTING_IMPACT_ORB_CELLS   0x5100

The impact orb, 20x48 pictures packed at half width.

Definition at line 174 of file casting_impact.c.

Referenced by BattleFx_RunCastingImpact().

◆ CASTING_IMPACT_DJINNI_CELLS

#define CASTING_IMPACT_DJINNI_CELLS   0x3c56

The Djinni pictures, 20x40, in Ram_MapCellBuffer after the impact's own.

Definition at line 176 of file casting_impact.c.

Referenced by BattleFx_RunCastingImpact().

◆ CASTING_IMPACT_GATHER_FRAMES

#define CASTING_IMPACT_GATHER_FRAMES   32

frames the sparks gather

Definition at line 177 of file casting_impact.c.

Referenced by BattleFx_RunCastingImpact().

◆ CASTING_IMPACT_SPARKS

#define CASTING_IMPACT_SPARKS   64

sparks in work->particles

Definition at line 178 of file casting_impact.c.

Referenced by BattleFx_RunCastingImpact().

◆ CASTING_IMPACT_IMPACT_PARTICLES

#define CASTING_IMPACT_IMPACT_PARTICLES   ((struct EffectStep *)(Ram_MapCellBuffer + 0x4000))

The impact pictures' particles, in Ram_MapCellBuffer after the Djinni.

Definition at line 180 of file casting_impact.c.

Referenced by BattleFx_RunCastingImpact().

◆ CASTING_IMPACT_IMPACT_PARTICLE_COUNT

#define CASTING_IMPACT_IMPACT_PARTICLE_COUNT   64

Definition at line 182 of file casting_impact.c.

Referenced by BattleFx_RunCastingImpact().

◆ CASTING_IMPACT_IMAGE_X

#define CASTING_IMPACT_IMAGE_X ( side,
image )
Value:
gCastingImpact_ImageX[(side)][(image)]
u8 gCastingImpact_ImageX[][7]

gCastingImpact_ImageX has seven pictures for each side.

Definition at line 185 of file casting_impact.c.

Referenced by BattleFx_RunCastingImpact().

Enumeration Type Documentation

◆ CastingImpact

The casting impacts, by kind - 100: each is named for the first ability whose gBattle_ActionFlags entry selects it; the four no ability selects keep their numbers.

The trailing comments give each impact's own animation, drawn over the target after the orb and sparks. Most animations use the 64 particles at Ram_MapCellBuffer + 0x4000, which start at the target; their pictures are in Ram_MapCellBuffer. "Smoke" is puffs of smoke rising from the target; "hands off" impacts stop after gathering and hand the canvas to another effect.

Enumerator
CASTING_IMPACT_IMPACT_BANE 

smoke

CASTING_IMPACT_IMPACT_SMOG 

smoke

CASTING_IMPACT_IMPACT_MIST 

smoke

CASTING_IMPACT_IMPACT_FEVER 

smoke

CASTING_IMPACT_IMPACT_FLINT 

nothing

CASTING_IMPACT_IMPACT_SCORCH 

flash bursts rise from the target

CASTING_IMPACT_IMPACT_SQUALL 

two bolts strike among glints

CASTING_IMPACT_IMPACT_SAP 

motes fly back to the caster

CASTING_IMPACT_IMPACT_TERRA_STRIKE 

a rock spire grows and sinks

CASTING_IMPACT_IMPACT_POISON_CLOUD 

smoke

CASTING_IMPACT_IMPACT_DEADLY_POISON 

smoke

CASTING_IMPACT_IMPACT_MORTAL_DANGER 

also Death Size; a large picture rises and breaks

CASTING_IMPACT_IMPACT_BAD_OMEN 

skulls rise from the target

CASTING_IMPACT_IMPACT_LIFE_NOURISH 

motes fly back to the caster

CASTING_IMPACT_IMPACT_AQUA_SOCK 

a blue flame column falls onto the target

CASTING_IMPACT_IMPACT_15 

hands off

CASTING_IMPACT_IMPACT_FROST_BITE 

ice chips converge on the target

CASTING_IMPACT_IMPACT_17 

hands off

CASTING_IMPACT_IMPACT_LIFE_LEECH 

motes fly back to the caster

CASTING_IMPACT_IMPACT_PSY_LEECH 

motes fly back to the caster

CASTING_IMPACT_IMPACT_BROIL 

ember streaks spread sideways

CASTING_IMPACT_IMPACT_MELTDOWN 

nothing; hands to the stat reduction

CASTING_IMPACT_IMPACT_HEAT_MIRAGE 

also Heat Flash; smoke

CASTING_IMPACT_IMPACT_BARRAGE 

flash bursts rise from the target

CASTING_IMPACT_IMPACT_24 

hands off

CASTING_IMPACT_IMPACT_ACID_BATH 

smoke

CASTING_IMPACT_IMPACT_26 

hands off

CASTING_IMPACT_IMPACT_STUN_VOLTAGE 

two bolts strike among glints

CASTING_IMPACT_IMPACT_BLINDING_SMOG 

smoke

CASTING_IMPACT_IMPACT_MURK 

smoke

CASTING_IMPACT_IMPACT_CYCLONE_SLASH 

a tornado stands over the target

CASTING_IMPACT_IMPACT_PSYPHON_SEAL 

a rune opens over the target

CASTING_IMPACT_IMPACT_ASURA 

a beast scrolls across and breaks

CASTING_IMPACT_IMPACT_FORCIBLE_ARM 

a flame falls diagonally

CASTING_IMPACT_IMPACT_TRUNCHEON_FIST 

a flame falls diagonally

CASTING_IMPACT_IMPACT_SEVERE_BLOW 

hands off

Definition at line 132 of file casting_impact.c.

Function Documentation

◆ BattleFx_StepPaletteToResource()

void BattleFx_StepPaletteToResource ( s32 resourceId)

Moves each RGB555 channel of background colours 0 to 63 one level towards the resource palette.

Colour 0 always goes towards black, whatever the resource holds.

Called once a frame, so a palette arrives in at most 31 frames: by the casting impacts, Ragnarok, the Titan Blade and Ground (hail.c). Reads and rewrites background palette RAM.

Definition at line 17 of file casting_impact.c.

Referenced by BattleFx_RunCastingImpact(), BattleFx_RunGround(), BattleFx_RunRagnarok(), BattleFx_RunTitanBlade(), and BattleFx_StepPaletteToResource().

◆ CastingImpact_LoadResource()

void CastingImpact_LoadResource ( const void * id,
void * dest,
s32 skip,
s32 copy )
inlinestatic

Loads one of the impact's pictures (Resource_LoadAndDecompress).

Definition at line 50 of file casting_impact.c.

Referenced by BattleFx_RunCastingImpact(), and CastingImpact_LoadResource().

◆ CastingImpact_PackRows()

void CastingImpact_PackRows ( void * src,
void * dest,
s32 width,
s32 height )
inlinestatic

Packs a casting impact's picture rows (Graphics_PackTileRows).

Definition at line 59 of file casting_impact.c.

Referenced by BattleFx_RunCastingImpact(), and CastingImpact_PackRows().

◆ CastingImpact_DrawImage()

void CastingImpact_DrawImage ( void * canvas,
const void * pixels,
s32 x,
s32 y,
s32 width,
s32 height,
DrawRectangle * draw )
inlinestatic

Draws one casting impact image with the given blitter.

Definition at line 67 of file casting_impact.c.

Referenced by BattleFx_RunCastingImpact(), and CastingImpact_DrawImage().

◆ CastingImpact_DrawTallImage()

void CastingImpact_DrawTallImage ( void * canvas,
const void * pixels,
s32 x,
s32 y,
s32 width,
DrawRectangle * draw )
inlinestatic

Draws a casting-impact image whose height is twice its width.

Definition at line 76 of file casting_impact.c.

Referenced by BattleFx_RunCastingImpact(), and CastingImpact_DrawTallImage().

◆ CastingImpact_DrawScrolledImage()

void CastingImpact_DrawScrolledImage ( void * canvas,
const void * pixels,
s32 x,
s32 y,
s32 width,
s32 height,
s32 scroll,
DrawRectangle * draw )
inlinestatic

Draws only the unscrolled height of a casting-impact image.

Definition at line 85 of file casting_impact.c.

Referenced by BattleFx_RunCastingImpact(), and CastingImpact_DrawScrolledImage().

◆ CastingImpact_DrawCroppedImage()

void CastingImpact_DrawCroppedImage ( void * canvas,
const void * pixels,
s32 x,
s32 y,
s32 width,
DrawRectangle * draw )
inlinestatic

Draws a casting-impact image cropped to 91 pixels high.

Definition at line 96 of file casting_impact.c.

Referenced by BattleFx_RunCastingImpact(), and CastingImpact_DrawCroppedImage().

◆ CastingImpact_EndPrelude()

void CastingImpact_EndPrelude ( struct BattleEffectWork * work,
void * canvas )
inlinestatic

Clears the prelude image, stops its callbacks and releases its blitters before the next effect takes over.

Called by BattleFx_RunCastingImpact for the impacts that hand off after the gathering (15, 17, 24, 26 and Severe Blow); Meltdown's end does the same inline. Clears the canvas and its VRAM (character block 1) and work->effect->prelude, removes Palette_StepFadeTransfer and the canvas transfer, and frees both blitters.

Definition at line 113 of file casting_impact.c.

Referenced by BattleFx_RunCastingImpact(), and CastingImpact_EndPrelude().

◆ BattleFx_RunCastingImpact()

void BattleFx_RunCastingImpact ( struct BattleEffectArgument * effect,
s32 mode )

Gathers sparks around the caster, launches the Djinni and draws the impact on the first target.

Called only by BattleFx_DispatchByIdRange (positions.c), for effect kinds 100 to 135. The phases, the hand-offs and the particle ranges are in the folder README under "Effect families". Opens the canvas layer (tiled for Terra Strike, Mortal Danger and Asura), writes the background palette, BG2's scale and reference and REG_BLDALPHA, holds the caster still while the sparks gather, and adds BattleFx_ArmBg2AffineHBlankDma for the waving impacts; it releases all of them before it returns, or hands them on.

mode: the impact, an enum CastingImpact (the kind less 100). The tests on mode 100 never hold, as the dispatcher passes 0 to 35.

Definition at line 201 of file casting_impact.c.

Referenced by BattleFx_DispatchByIdRange(), and BattleFx_RunCastingImpact().