Skip to Content
The Alchemy Project

src/battle_effect/battle_effect_starfield_fall.c

Summon formations, the impact burst, Meteor and Outer Space. More…

Included by battle_effect.c.

Macros

NameDescription
#defineFORMATION_GRID_COLUMNS 3The formations' sizes: Thor's 3 by 3 grid and its spacing in pixels, Nereid's twelve, and Cybele's and Tiamat's eight.
#defineFORMATION_GRID_SPACING 32
#defineFORMATION_NEREID_SPRITES 12
#defineFORMATION_CYBELE_SPRITES 8
#defineFORMATION_TIAMAT_SPRITES 8
#defineIMPACT_BURST_FRAGMENT_PICTURES 23000Where the fragment pictures, four of 12x24, begin in the sheet, in bytes, after the flash.
#defineIMPACT_BURST_FRAGMENT_WIDTH 12each fragment picture's width
#defineIMPACT_BURST_FRAGMENT_HEIGHT 24
#defineIMPACT_BURST_TICKS 72
#defineIMPACT_BURST_FRAGMENTS 3fragments, state->particles 61 to 63
#defineIMPACT_BURST_DRAWN_LARGE 30large sparks drawn
#defineIMPACT_BURST_DRAWN_SMALL 60small sparks drawn
#defineIMPACT_BURST_LARGE_SPARKS 64large sparks thrown
#defineIMPACT_BURST_SMALL_SPARKS 64small sparks thrown
#defineIMPACT_BURST_FIRST_FRAGMENT 61the first fragment in state->particles
#defineIMPACT_BURST_FRAGMENT_SPEED 32The fragments' speed apart.
#defineIMPACT_BURST_LIFE_PER_SIZE 16A spark's life left per size of its mote: a spark shrinks one size every IMPACT_BURST_LIFE_PER_SIZE ticks.
#defineSTARFIELD_FALL_FALL_TICKS 192ticks of the fall
#defineSTARFIELD_FALL_BURST_TICKS 54ticks of the burst
#defineSTARFIELD_FALL_FLAME_SIZE 32The pictures in the flame sprite sheet (ResourceIdFlameSheetB), each starting where the one before ends: six flames, then three large and three small glows, each glow brighter at its centre than the one before.
#defineSTARFIELD_FALL_LARGE_GLOW_SIZE 24
#defineSTARFIELD_FALL_SMALL_GLOW_SIZE 8
#defineSTARFIELD_FALL_FLASHES 128The burst's flashes in PARTICLES, then its embers, and how many of each it draws.
#defineSTARFIELD_FALL_EMBER_COUNT 512
#defineSTARFIELD_FALL_EMBERS (&PARTICLES[STARFIELD_FALL_FLASHES])
#defineSTARFIELD_FALL_FLASHES_DRAWN 64
#defineSTARFIELD_FALL_EMBERS_DRAWN 64
#defineSTARFIELD_FALL_FLAME_COUNT 32The fall's flames, from state->particles[0], and its landings after them.
#defineSTARFIELD_FALL_LANDINGS 16
#defineSTARFIELD_FALL_MOTES_DRAWN 64The burst's rising motes, one at each of the 64 state->particles: the flames', which it sets out, the landings', drawn where they were left, and 16 this effect never places, which rise from wherever an earlier effect left them.
#defineSTARFIELD_FALL_STARS 256The starfield's stars.
#defineSTARFIELD_FALL_RAGGED_EDGE 64How far down each column's ragged edge starts: the dissolve sweeps the picture's rows and this many more.
#defineSTARFIELD_FALL_GLOW_BLUE_LEVEL 32The backdrop's glow turns blue, and later green, once its level passes these.
#defineSTARFIELD_FALL_GLOW_GREEN_LEVEL 80
#defineSTARFIELD_FALL_FLASH_TICK 16The burst's flashes rise from this tick on, three more a tick, and the background brightens from STARFIELD_FALL_BRIGHTEN_DELAY ticks after it.
#defineSTARFIELD_FALL_BRIGHTEN_DELAY 20
#defineSTARFIELD_FALL_FLASH_PICTURES 7The blast sprite sheet's flash pictures, each shown two ticks.
#defineSTARFIELD_FALL_EMBER_SIZE_MAX 9An ember is drawn at size STARFIELD_FALL_EMBER_SIZE_MAX at MOTE_DEPTH_NEAR or nearer, one size smaller every MOTE_DEPTH_STEP farther.
#defineSTARFIELD_FALL_SCROLL_PRIORITY EVENT_PASS_VBLANK_FIRSTThe fall's own VBlank events run first in the pass, ahead of the image copy: the starfield's scroll, then the backdrop's HBlank DMA, so that both are set before the tick's first line.
#defineSTARFIELD_FALL_BACKDROP_PRIORITY (EVENT_PASS_VBLANK_FIRST - 1)
#defineSTARFIELD_FALL_MOTE_PICTURES (16 * 16 + 32 * 32 + 5 * 48 * 48)The mote pictures in the blast sprite sheet, after its seven blast pictures (BLAST_PICTURE_SIZES): two sets, MOTE_SET_BYTES apart.

Enumerations

NameDescription
enumSTARFIELD_FALL_MODE { STARFIELD_FALL_METEOR, STARFIELD_FALL_OUTER_SPACE }The starfield fall's modes (btEffectRunStarfieldFall).
enumFLAME_SHEET_B_PICTURE { STARFIELD_FALL_FLAMES, STARFIELD_FALL_LARGE_GLOW, STARFIELD_ … }Where each picture begins in the flame sprite sheet, in bytes.

Functions

NameDescription
voidbtEffectPlaceFormationSprites (Sint32 formation, FIXED x, FIXED z)Places a summon's figure, the sprites in state->sprites, in its formation; x and z are its origin in 16.16 pixels.
voidbtEffectRunImpactBurst (Sint32 formation, Sint32 x, FIXED y)Ends a summon: a flash opens where its figure stands and scatters sparks and three fragments, the figure holding its formation for the first 36 ticks.
voidbtPaletteBrightenBgEntries (Sint32 blueStep, Sint32 greenStep, Sint32 redStep)Brightens background colours 1 to 63 by a step in each channel.
voidbtEffectArmPaletteHBlankDMA (void)Streams the fall's backdrop colours into colour 0, one each line.
voidbtEffectRunMeteor (BATTLE_EFFECT_PARM *args)The battle dissolves into a starfield and a meteor falls through it in flames among falling fireballs, then bursts in embers and flashes.
voidbtEffectRunOuterSpace (BATTLE_EFFECT_PARM *args)The Fusion Dragon leaps out of sight and falls back through a starfield in flames, then bursts in embers and flashes, all in the lightning bolt's colours.
voidbtEffectRunStarfieldFall (BATTLE_EFFECT_PARM *args, Sint32 mode)Meteor and Outer Space: the fall through the starfield, then the burst.

Description

Summon formations, the impact burst, Meteor and Outer Space. Part of battle_effect.c.

Macros in detail

FORMATION_GRID_COLUMNS

#define FORMATION_GRID_COLUMNS 3

The formations' sizes: Thor's 3 by 3 grid and its spacing in pixels, Nereid's twelve, and Cybele's and Tiamat's eight.

Referenced by btEffectPlaceFormationSprites().

Definition at line 6 of file battle_effect_starfield_fall.c.

FORMATION_GRID_SPACING

#define FORMATION_GRID_SPACING 32

Referenced by btEffectPlaceFormationSprites().

Definition at line 7 of file battle_effect_starfield_fall.c.

FORMATION_NEREID_SPRITES

#define FORMATION_NEREID_SPRITES 12

Referenced by btEffectPlaceFormationSprites().

Definition at line 8 of file battle_effect_starfield_fall.c.

FORMATION_CYBELE_SPRITES

#define FORMATION_CYBELE_SPRITES 8

Referenced by btEffectPlaceFormationSprites().

Definition at line 9 of file battle_effect_starfield_fall.c.

FORMATION_TIAMAT_SPRITES

#define FORMATION_TIAMAT_SPRITES 8

Referenced by btEffectPlaceFormationSprites().

Definition at line 10 of file battle_effect_starfield_fall.c.

IMPACT_BURST_FRAGMENT_PICTURES

#define IMPACT_BURST_FRAGMENT_PICTURES 23000

Where the fragment pictures, four of 12x24, begin in the sheet, in bytes, after the flash.

Referenced by btEffectRunImpactBurst().

Definition at line 76 of file battle_effect_starfield_fall.c.

IMPACT_BURST_FRAGMENT_WIDTH

#define IMPACT_BURST_FRAGMENT_WIDTH 12

each fragment picture's width

Referenced by btEffectRunImpactBurst().

Definition at line 78 of file battle_effect_starfield_fall.c.

IMPACT_BURST_FRAGMENT_HEIGHT

#define IMPACT_BURST_FRAGMENT_HEIGHT 24

Referenced by btEffectRunImpactBurst().

Definition at line 79 of file battle_effect_starfield_fall.c.

IMPACT_BURST_TICKS

#define IMPACT_BURST_TICKS 72

Referenced by btEffectRunImpactBurst().

Definition at line 80 of file battle_effect_starfield_fall.c.

IMPACT_BURST_FRAGMENTS

#define IMPACT_BURST_FRAGMENTS 3

fragments, state->particles 61 to 63

Referenced by btEffectRunImpactBurst().

Definition at line 82 of file battle_effect_starfield_fall.c.

IMPACT_BURST_DRAWN_LARGE

#define IMPACT_BURST_DRAWN_LARGE 30

large sparks drawn

Referenced by btEffectRunImpactBurst().

Definition at line 84 of file battle_effect_starfield_fall.c.

IMPACT_BURST_DRAWN_SMALL

#define IMPACT_BURST_DRAWN_SMALL 60

small sparks drawn

Referenced by btEffectRunImpactBurst().

Definition at line 86 of file battle_effect_starfield_fall.c.

IMPACT_BURST_LARGE_SPARKS

#define IMPACT_BURST_LARGE_SPARKS 64

large sparks thrown

Referenced by btEffectRunImpactBurst().

Definition at line 88 of file battle_effect_starfield_fall.c.

IMPACT_BURST_SMALL_SPARKS

#define IMPACT_BURST_SMALL_SPARKS 64

small sparks thrown

Referenced by btEffectRunImpactBurst().

Definition at line 90 of file battle_effect_starfield_fall.c.

IMPACT_BURST_FIRST_FRAGMENT

#define IMPACT_BURST_FIRST_FRAGMENT 61

the first fragment in state->particles

Referenced by btEffectRunImpactBurst().

Definition at line 93 of file battle_effect_starfield_fall.c.

IMPACT_BURST_FRAGMENT_SPEED

#define IMPACT_BURST_FRAGMENT_SPEED 32

The fragments' speed apart.

Referenced by btEffectRunImpactBurst().

Definition at line 96 of file battle_effect_starfield_fall.c.

IMPACT_BURST_LIFE_PER_SIZE

#define IMPACT_BURST_LIFE_PER_SIZE 16

A spark's life left per size of its mote: a spark shrinks one size every IMPACT_BURST_LIFE_PER_SIZE ticks.

Referenced by btEffectRunImpactBurst().

Definition at line 100 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_FALL_TICKS

#define STARFIELD_FALL_FALL_TICKS 192

ticks of the fall

Referenced by btEffectRunStarfieldFall().

Definition at line 292 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_BURST_TICKS

#define STARFIELD_FALL_BURST_TICKS 54

ticks of the burst

Referenced by btEffectRunStarfieldFall().

Definition at line 293 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_FLAME_SIZE

#define STARFIELD_FALL_FLAME_SIZE 32

The pictures in the flame sprite sheet (ResourceIdFlameSheetB), each starting where the one before ends: six flames, then three large and three small glows, each glow brighter at its centre than the one before. The fall draws only the six and the brightest glow of each size.

Referenced by btEffectRunStarfieldFall().

Definition at line 307 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_LARGE_GLOW_SIZE

#define STARFIELD_FALL_LARGE_GLOW_SIZE 24

Referenced by btEffectRunStarfieldFall().

Definition at line 308 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_SMALL_GLOW_SIZE

#define STARFIELD_FALL_SMALL_GLOW_SIZE 8

Referenced by btEffectRunStarfieldFall().

Definition at line 309 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_FLASHES

#define STARFIELD_FALL_FLASHES 128

The burst's flashes in PARTICLES, then its embers, and how many of each it draws.

Referenced by btEffectRunStarfieldFall().

Definition at line 392 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_EMBER_COUNT

#define STARFIELD_FALL_EMBER_COUNT 512

Referenced by btEffectRunStarfieldFall().

Definition at line 393 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_EMBERS

#define STARFIELD_FALL_EMBERS (&PARTICLES[STARFIELD_FALL_FLASHES])

Referenced by btEffectRunStarfieldFall().

Definition at line 394 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_FLASHES_DRAWN

#define STARFIELD_FALL_FLASHES_DRAWN 64

Referenced by btEffectRunStarfieldFall().

Definition at line 395 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_EMBERS_DRAWN

#define STARFIELD_FALL_EMBERS_DRAWN 64

Referenced by btEffectRunStarfieldFall().

Definition at line 396 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_FLAME_COUNT

#define STARFIELD_FALL_FLAME_COUNT 32

The fall's flames, from state->particles[0], and its landings after them.

Referenced by btEffectRunStarfieldFall().

Definition at line 398 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_LANDINGS

#define STARFIELD_FALL_LANDINGS 16

Referenced by btEffectRunStarfieldFall().

Definition at line 399 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_MOTES_DRAWN

#define STARFIELD_FALL_MOTES_DRAWN 64

The burst's rising motes, one at each of the 64 state->particles: the flames', which it sets out, the landings', drawn where they were left, and 16 this effect never places, which rise from wherever an earlier effect left them.

Referenced by btEffectRunStarfieldFall().

Definition at line 404 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_STARS

#define STARFIELD_FALL_STARS 256

The starfield's stars.

Referenced by btEffectRunStarfieldFall().

Definition at line 406 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_RAGGED_EDGE

#define STARFIELD_FALL_RAGGED_EDGE 64

How far down each column's ragged edge starts: the dissolve sweeps the picture's rows and this many more.

Referenced by btEffectRunStarfieldFall().

Definition at line 409 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_GLOW_BLUE_LEVEL

#define STARFIELD_FALL_GLOW_BLUE_LEVEL 32

The backdrop's glow turns blue, and later green, once its level passes these.

Referenced by btEffectRunStarfieldFall().

Definition at line 411 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_GLOW_GREEN_LEVEL

#define STARFIELD_FALL_GLOW_GREEN_LEVEL 80

Referenced by btEffectRunStarfieldFall().

Definition at line 412 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_FLASH_TICK

#define STARFIELD_FALL_FLASH_TICK 16

The burst's flashes rise from this tick on, three more a tick, and the background brightens from STARFIELD_FALL_BRIGHTEN_DELAY ticks after it.

Referenced by btEffectRunStarfieldFall().

Definition at line 415 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_BRIGHTEN_DELAY

#define STARFIELD_FALL_BRIGHTEN_DELAY 20

Referenced by btEffectRunStarfieldFall().

Definition at line 416 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_FLASH_PICTURES

#define STARFIELD_FALL_FLASH_PICTURES 7

The blast sprite sheet's flash pictures, each shown two ticks.

Referenced by btEffectRunStarfieldFall().

Definition at line 418 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_EMBER_SIZE_MAX

#define STARFIELD_FALL_EMBER_SIZE_MAX 9

An ember is drawn at size STARFIELD_FALL_EMBER_SIZE_MAX at MOTE_DEPTH_NEAR or nearer, one size smaller every MOTE_DEPTH_STEP farther.

Referenced by btEffectRunStarfieldFall().

Definition at line 421 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_SCROLL_PRIORITY

#define STARFIELD_FALL_SCROLL_PRIORITY EVENT_PASS_VBLANK_FIRST

The fall's own VBlank events run first in the pass, ahead of the image copy: the starfield's scroll, then the backdrop's HBlank DMA, so that both are set before the tick's first line.

Referenced by btEffectRunStarfieldFall().

Definition at line 425 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_BACKDROP_PRIORITY

#define STARFIELD_FALL_BACKDROP_PRIORITY (EVENT_PASS_VBLANK_FIRST - 1)

Referenced by btEffectRunStarfieldFall().

Definition at line 426 of file battle_effect_starfield_fall.c.

STARFIELD_FALL_MOTE_PICTURES

#define STARFIELD_FALL_MOTE_PICTURES (16 * 16 + 32 * 32 + 5 * 48 * 48)

The mote pictures in the blast sprite sheet, after its seven blast pictures (BLAST_PICTURE_SIZES): two sets, MOTE_SET_BYTES apart.

Referenced by btEffectRunStarfieldFall().

Definition at line 430 of file battle_effect_starfield_fall.c.

Enumerations in detail

STARFIELD_FALL_MODE

enum STARFIELD_FALL_MODE

The starfield fall's modes (btEffectRunStarfieldFall).

EnumeratorValueDescription
STARFIELD_FALL_METEORone spawned sprite falls
STARFIELD_FALL_OUTER_SPACEthe user leaps, and two animated sprites fall in the lightning bolt's colours

Definition at line 296 of file battle_effect_starfield_fall.c.

FLAME_SHEET_B_PICTURE

enum FLAME_SHEET_B_PICTURE

Where each picture begins in the flame sprite sheet, in bytes.

EnumeratorValueDescription
STARFIELD_FALL_FLAMES0The six 32x32 flames, in a row
STARFIELD_FALL_LARGE_GLOWSTARFIELD_FALL_FLAMES + 6 * STARFIELD_FALL_FLAME_SIZE * STARFIELD_FALL_FLAME_SIZE + 2 * STARFIELD_FALL_LARGE_GLOW_SIZE * STARFIELD_FALL_LARGE_GLOW_SIZEThe brightest 24x24 glow
STARFIELD_FALL_SMALL_GLOWSTARFIELD_FALL_LARGE_GLOW + STARFIELD_FALL_LARGE_GLOW_SIZE * STARFIELD_FALL_LARGE_GLOW_SIZE + 2 * STARFIELD_FALL_SMALL_GLOW_SIZE * STARFIELD_FALL_SMALL_GLOW_SIZEThe brightest 8x8 glow
STARFIELD_FALL_BACKDROP_LINESSTARFIELD_FALL_SMALL_GLOW + STARFIELD_FALL_SMALL_GLOW_SIZE * STARFIELD_FALL_SMALL_GLOW_SIZEPast the sprite sheet's end: the backdrop's 160 colours, one a line, that the fall writes there.

Definition at line 312 of file battle_effect_starfield_fall.c.

Functions in detail

btEffectPlaceFormationSprites

void btEffectPlaceFormationSprites(Sint32 formation, FIXED x, FIXED z)

Places a summon's figure, the sprites in state->sprites, in its formation; x and z are its origin in 16.16 pixels.

References fdRenderApplyProjectedPlacementStub(), Sint32, state, SummonFormationCybeleX, SummonFormationCybeleZ, SummonFormationNereidX, SummonFormationNereidZ, SummonFormationTiamatX and SummonFormationTiamatZ.

Referenced by btEffectRunCybele(), btEffectRunDragonFire(), btEffectRunImpactBurst(), btEffectRunNereid() and btEffectRunThor().

Definition at line 14 of file battle_effect_starfield_fall.c.

btEffectRunImpactBurst

void btEffectRunImpactBurst(Sint32 formation, Sint32 x, FIXED y)

Ends a summon: a flash opens where its figure stands and scatters sparks and three fragments, the figure holding its formation for the first 36 ticks.

References btEffectPlaceFormationSprites(), btEffectTransferCanvas(), btParticleAdvanceWithGravity2D(), btResourceLoadAndDecompress(), HeapSlots, ImpactBurstPictureHeights, ImpactBurstPictures, ImpactBurstPictureWidths, Sint32, state, syCloseEvent(), syCos(), syRandom(), sySin(), sySoundPlayStub(), syWordsClear() and width.

Referenced by btEffectRunCybele(), btEffectRunDragonFire(), btEffectRunNereid() and btEffectRunThor().

Definition at line 104 of file battle_effect_starfield_fall.c.

btPaletteBrightenBgEntries

void btPaletteBrightenBgEntries(Sint32 blueStep, Sint32 greenStep, Sint32 redStep)

Brightens background colours 1 to 63 by a step in each channel.

References Sint32.

Referenced by btEffectRunDragonFire() and btEffectRunStarfieldFall().

Definition at line 333 of file battle_effect_starfield_fall.c.

btEffectArmPaletteHBlankDMA

void btEffectArmPaletteHBlankDMA(void)

Streams the fall's backdrop colours into colour 0, one each line.

References btDMAStop(), state and syDMAXCopy().

Referenced by btEffectRunStarfieldFall().

Definition at line 360 of file battle_effect_starfield_fall.c.

btEffectRunMeteor

void btEffectRunMeteor(BATTLE_EFFECT_PARM *args)

The battle dissolves into a starfield and a meteor falls through it in flames among falling fireballs, then bursts in embers and flashes.

Abilities: Meteor.

References btEffectRunStarfieldFall().

Referenced by btEffectRunSummon().

Definition at line 375 of file battle_effect_starfield_fall.c.

btEffectRunOuterSpace

void btEffectRunOuterSpace(BATTLE_EFFECT_PARM *args)

The Fusion Dragon leaps out of sight and falls back through a starfield in flames, then bursts in embers and flashes, all in the lightning bolt's colours.

Abilities: Outer Space, the Fusion Dragon's.

References btEffectRunStarfieldFall().

Referenced by BattleEffectHandlers.

Definition at line 385 of file battle_effect_starfield_fall.c.

btEffectRunStarfieldFall

void btEffectRunStarfieldFall(BATTLE_EFFECT_PARM *args, Sint32 mode)

Meteor and Outer Space: the fall through the starfield, then the burst.

References BattleEffectMotePictures, BgScrollWork, btCameraShake(), btEffectAdvanceBg2OnInterval(), btEffectArmPaletteHBlankDMA(), btEffectBuildBlitter(), btEffectConfigureEffectDisplay(), btEffectCreateSprites(), btEffectEndCanvasLayer(), btEffectSetupBlendedDisplay(), btEffectShowLivingTargets(), btEffectTintBattler(), btEffectTransferCanvas(), btEffectTransferFullScreenImage(), btEffectWipeCanvas(), btObjectGetStub(), btObjectPutStub(), btPaletteBrightenBgEntries(), btParticleAdvanceWithGravity3D(), btProjectionPoint(), btResourceLoadAndDecompress(), fdRenderApplyProjectedPlacementStub(), fdScreenPointCoordinates(), fdSpriteCreateStub(), fdSpriteDestroyStub(), fdSpriteStartAnimationStub(), line, PerRepeat, ProjectionWork, Sint32, StarfieldFallFireballPoints, StarfieldFallFlashPictures, StarfieldFallFlashSizes, StarfieldFallOrbitPoints, state, syCloseEvent(), syCos(), syHeapSlotRelease(), syInitMatrix(), syMatrixTranslateVector(), syRandom(), syResourceGetTableEntry(), syRotY(), syRotZ(), sySetEvent(), sySin(), sySoundPlayStub(), sySynch() and syWordsCopy().

Referenced by btEffectRunMeteor() and btEffectRunOuterSpace().

Definition at line 433 of file battle_effect_starfield_fall.c.