Skip to Content
The Alchemy Project

src/battle_effect/battle_effect_star_mine.c

Star Mine, the enemies' Rising Dragon and the backdrop it scrolls, then the entry points of the rushing strikes. More…

Included by battle_effect.c.

Structures

NameDescription
structCORNER_ROWTwo corners of a row of the strip.

Macros

NameDescription
#defineSTAR_MINE_TICKS 144
#defineSTAR_MINE_STARS 6
#defineSTAR_MINE_FLASH_BURSTS 48The flash bursts' slots in state->particles after the stars, eight for each star, and the sparks', in PARTICLES.
#defineSTAR_MINE_SPARKS 192
#defineSTAR_MINE_PULL (distance) ((distance) >> 10)What a star's speed gains toward its target each tick: 1/1024 of the distance between them.
#defineSTAR_MINE_STAR_PICTURES 4608Where the two stars are built in the effect's pictures, each a 24 by 48 picture mirrored from one half of BlueCrescentSheet's.
#defineSTAR_WIDTH 24
#defineSTAR_HEIGHT 48
#defineSTAR_HALF (PICTURE_BYTES(STAR) / 2)The bytes of a star's source in BlueCrescentSheet, 24 by 24: each row's even pixels are the right half of the star's row, its odd ones the left.
#defineSTAR_BURST_FLASH_BURSTS 4The flash bursts and the sparks each star bursts into.
#defineSTAR_BURST_SPARKS (STAR_MINE_SPARKS / STAR_MINE_STARS)
#defineSTAR_MINE_FLASH_BURST_PICTURES 16384Where FlashBurstSheet is decoded in the effect's pictures.
#defineFLASH_BURST_PICTURE_TICKS 4A flash burst plays FlashBurstSheet's pictures, a flash turning to a fireball that burns out, FLASH_BURST_PICTURE_TICKS ticks apiece; its first two ticks are not drawn.
#defineBACKDROP_FIRST_TILE 512The battle background's image in BG1's flat map: BACKDROP_ROWS rows of BG_SCREEN_WIDTH tiles from BACKDROP_FIRST_TILE.
#defineBACKDROP_ROWS 15
#defineBACKDROP_RIGHT_HALF (BACKDROP_FIRST_TILE + BG_SCREEN_WIDTH / 2)The first tile of the picture's right half.
#defineRISING_DRAGON_ENEMY_VERTICES 4096The dragon's buffers in the map cell buffer: its strip's corners, their transformed vertices, the strip mesh, and the sparks, in EXTRA_PARTICLES: the first half thrown up at the start, the second the trail behind the dragon, and all of them scattered from its top at tick 134.
#defineRISING_DRAGON_ENEMY_STRIP 8192
#defineRISING_DRAGON_ENEMY_SPARK_COUNT 256
#defineTRAIL_SPARKS (RISING_DRAGON_ENEMY_SPARK_COUNT / 2)
#defineRISING_DRAGON_ENEMY_SEGMENTS 33The dragon's body: a strip of RISING_DRAGON_ENEMY_SEGMENTS rows, RISING_DRAGON_ENEMY_BODY_WIDTH across, each row swaying RISING_DRAGON_ENEMY_ROW_PHASE further along than the one before, the sway turning a 64th of a turn a tick; the strip is drawn at RISING_DRAGON_ENEMY_BODY_SCALE.
#defineRISING_DRAGON_ENEMY_BODY_WIDTH 20
#defineRISING_DRAGON_ENEMY_ROW_PHASE 2018
#defineRISING_DRAGON_ENEMY_BODY_SCALE toFIXED(2.09156)
#defineRISING_DRAGON_ENEMY_SWAY_STEP (TRIG_TURN / 64)
#defineRISING_DRAGON_ENEMY_FLASH_BURST_PICTURES 2048Where FlashBurstSheet is decoded in the effect's pictures.
#defineRISING_DRAGON_ENEMY_FLAME_DRAGON_HEAD_PICTURES 16384Where ClawSlashSheet, a dragon's head of flame, is decoded in the effect's pictures.
#defineRISING_DRAGON_ENEMY_BURST_TICKS 8The flash bursts at the top of the dragon from tick 134: RISING_DRAGON_ENEMY_BURSTS_A_TICK a tick for RISING_DRAGON_ENEMY_BURST_TICKS.
#defineRISING_DRAGON_ENEMY_BURSTS_A_TICK 4
#defineRISING_DRAGON_ENEMY_FLASH_BURSTS
#defineRISING_DRAGON_ENEMY_HAZE_SPEED 8How many lines a tick the sky scrolls past as the dragon climbs.
#defineRISING_DRAGON_ENEMY_FLASH_LEVEL 32The level the canvas is cleared to each tick of the whitening from tick 152, until its last five ticks turn it CANVAS_LEVEL_BRIGHTEST.
#defineRISING_DRAGON_ENEMY_TICKS 186

Functions

NameDescription
voidbtEffectRunStarMine (BATTLE_EFFECT_PARM *args)Six twinkling stars (a 24 by 48 picture mirrored both ways from the sprite sheet's two halves) are thrown up from the caster, each at a target in turn; from tick 8 * i + 11 each is pulled toward its target and bursts once it has passed it, into four flash bursts and 32 sparks, knocking the target back.
voidbtEffectBuildRepeatingTilemap (void)Lays BG1's map with the right half of the battle background's image, 16 tiles by BACKDROP_ROWS, twice across and twice down, so that the backdrop scrolls on without end.
voidbtEffectRunRisingDragonEnemy (BATTLE_EFFECT_PARM *args)A dragon of flame bursts up under the target in a shower of sparks and carries it off in its jaws, into a teal sky (the red haze, its colours turned) that scrolls past as it climbs, swaying.

Description

Star Mine, the enemies' Rising Dragon and the backdrop it scrolls, then the entry points of the rushing strikes. Part of battle_effect.c.

Macros in detail

STAR_MINE_TICKS

#define STAR_MINE_TICKS 144

Referenced by btEffectRunStarMine().

Definition at line 4 of file battle_effect_star_mine.c.

STAR_MINE_STARS

#define STAR_MINE_STARS 6

Referenced by btEffectRunStarMine().

Definition at line 5 of file battle_effect_star_mine.c.

STAR_MINE_FLASH_BURSTS

#define STAR_MINE_FLASH_BURSTS 48

The flash bursts' slots in state->particles after the stars, eight for each star, and the sparks', in PARTICLES.

Referenced by btEffectRunStarMine().

Definition at line 8 of file battle_effect_star_mine.c.

STAR_MINE_SPARKS

#define STAR_MINE_SPARKS 192

Referenced by btEffectRunStarMine().

Definition at line 9 of file battle_effect_star_mine.c.

STAR_MINE_PULL

#define STAR_MINE_PULL(distance) ((distance) >> 10)

What a star's speed gains toward its target each tick: 1/1024 of the distance between them.

Referenced by btEffectRunStarMine().

Definition at line 12 of file battle_effect_star_mine.c.

STAR_MINE_STAR_PICTURES

#define STAR_MINE_STAR_PICTURES 4608

Where the two stars are built in the effect's pictures, each a 24 by 48 picture mirrored from one half of BlueCrescentSheet's.

Referenced by btEffectRunStarMine().

Definition at line 16 of file battle_effect_star_mine.c.

STAR_WIDTH

#define STAR_WIDTH 24

Referenced by btEffectRunStarMine().

Definition at line 17 of file battle_effect_star_mine.c.

STAR_HEIGHT

#define STAR_HEIGHT 48

Referenced by btEffectRunStarMine().

Definition at line 18 of file battle_effect_star_mine.c.

STAR_HALF

#define STAR_HALF (PICTURE_BYTES(STAR) / 2)

The bytes of a star's source in BlueCrescentSheet, 24 by 24: each row's even pixels are the right half of the star's row, its odd ones the left.

Referenced by btEffectRunStarMine().

Definition at line 21 of file battle_effect_star_mine.c.

STAR_BURST_FLASH_BURSTS

#define STAR_BURST_FLASH_BURSTS 4

The flash bursts and the sparks each star bursts into.

Referenced by btEffectRunStarMine().

Definition at line 23 of file battle_effect_star_mine.c.

STAR_BURST_SPARKS

#define STAR_BURST_SPARKS (STAR_MINE_SPARKS / STAR_MINE_STARS)

Referenced by btEffectRunStarMine().

Definition at line 24 of file battle_effect_star_mine.c.

STAR_MINE_FLASH_BURST_PICTURES

#define STAR_MINE_FLASH_BURST_PICTURES 16384

Where FlashBurstSheet is decoded in the effect's pictures.

Referenced by btEffectRunStarMine().

Definition at line 26 of file battle_effect_star_mine.c.

FLASH_BURST_PICTURE_TICKS

#define FLASH_BURST_PICTURE_TICKS 4

A flash burst plays FlashBurstSheet's pictures, a flash turning to a fireball that burns out, FLASH_BURST_PICTURE_TICKS ticks apiece; its first two ticks are not drawn.

Referenced by btEffectRunRisingDragonEnemy() and btEffectRunStarMine().

Definition at line 30 of file battle_effect_star_mine.c.

BACKDROP_FIRST_TILE

#define BACKDROP_FIRST_TILE 512

The battle background's image in BG1's flat map: BACKDROP_ROWS rows of BG_SCREEN_WIDTH tiles from BACKDROP_FIRST_TILE.

Definition at line 286 of file battle_effect_star_mine.c.

BACKDROP_ROWS

#define BACKDROP_ROWS 15

Referenced by btEffectBuildRepeatingTilemap().

Definition at line 287 of file battle_effect_star_mine.c.

BACKDROP_RIGHT_HALF

#define BACKDROP_RIGHT_HALF (BACKDROP_FIRST_TILE + BG_SCREEN_WIDTH / 2)

The first tile of the picture's right half.

Referenced by btEffectBuildRepeatingTilemap().

Definition at line 289 of file battle_effect_star_mine.c.

RISING_DRAGON_ENEMY_VERTICES

#define RISING_DRAGON_ENEMY_VERTICES 4096

The dragon's buffers in the map cell buffer: its strip's corners, their transformed vertices, the strip mesh, and the sparks, in EXTRA_PARTICLES: the first half thrown up at the start, the second the trail behind the dragon, and all of them scattered from its top at tick 134.

Referenced by btEffectRunRisingDragonEnemy().

Definition at line 326 of file battle_effect_star_mine.c.

RISING_DRAGON_ENEMY_STRIP

#define RISING_DRAGON_ENEMY_STRIP 8192

Referenced by btEffectRunRisingDragonEnemy().

Definition at line 327 of file battle_effect_star_mine.c.

RISING_DRAGON_ENEMY_SPARK_COUNT

#define RISING_DRAGON_ENEMY_SPARK_COUNT 256

Referenced by btEffectRunRisingDragonEnemy().

Definition at line 328 of file battle_effect_star_mine.c.

TRAIL_SPARKS

#define TRAIL_SPARKS (RISING_DRAGON_ENEMY_SPARK_COUNT / 2)

Referenced by btEffectRunRisingDragonEnemy().

Definition at line 329 of file battle_effect_star_mine.c.

RISING_DRAGON_ENEMY_SEGMENTS

#define RISING_DRAGON_ENEMY_SEGMENTS 33

The dragon's body: a strip of RISING_DRAGON_ENEMY_SEGMENTS rows, RISING_DRAGON_ENEMY_BODY_WIDTH across, each row swaying RISING_DRAGON_ENEMY_ROW_PHASE further along than the one before, the sway turning a 64th of a turn a tick; the strip is drawn at RISING_DRAGON_ENEMY_BODY_SCALE.

Referenced by btEffectRunRisingDragonEnemy().

Definition at line 336 of file battle_effect_star_mine.c.

RISING_DRAGON_ENEMY_BODY_WIDTH

#define RISING_DRAGON_ENEMY_BODY_WIDTH 20

Referenced by btEffectRunRisingDragonEnemy().

Definition at line 337 of file battle_effect_star_mine.c.

RISING_DRAGON_ENEMY_ROW_PHASE

#define RISING_DRAGON_ENEMY_ROW_PHASE 2018

Referenced by btEffectRunRisingDragonEnemy().

Definition at line 338 of file battle_effect_star_mine.c.

RISING_DRAGON_ENEMY_BODY_SCALE

#define RISING_DRAGON_ENEMY_BODY_SCALE toFIXED(2.09156)

Referenced by btEffectRunRisingDragonEnemy().

Definition at line 339 of file battle_effect_star_mine.c.

RISING_DRAGON_ENEMY_SWAY_STEP

#define RISING_DRAGON_ENEMY_SWAY_STEP (TRIG_TURN / 64)

Referenced by btEffectRunRisingDragonEnemy().

Definition at line 340 of file battle_effect_star_mine.c.

RISING_DRAGON_ENEMY_FLASH_BURST_PICTURES

#define RISING_DRAGON_ENEMY_FLASH_BURST_PICTURES 2048

Where FlashBurstSheet is decoded in the effect's pictures.

Referenced by btEffectRunRisingDragonEnemy().

Definition at line 343 of file battle_effect_star_mine.c.

RISING_DRAGON_ENEMY_FLAME_DRAGON_HEAD_PICTURES

#define RISING_DRAGON_ENEMY_FLAME_DRAGON_HEAD_PICTURES 16384

Where ClawSlashSheet, a dragon's head of flame, is decoded in the effect's pictures.

Referenced by btEffectRunRisingDragonEnemy().

Definition at line 346 of file battle_effect_star_mine.c.

RISING_DRAGON_ENEMY_BURST_TICKS

#define RISING_DRAGON_ENEMY_BURST_TICKS 8

The flash bursts at the top of the dragon from tick 134: RISING_DRAGON_ENEMY_BURSTS_A_TICK a tick for RISING_DRAGON_ENEMY_BURST_TICKS.

Referenced by btEffectRunRisingDragonEnemy().

Definition at line 349 of file battle_effect_star_mine.c.

RISING_DRAGON_ENEMY_BURSTS_A_TICK

#define RISING_DRAGON_ENEMY_BURSTS_A_TICK 4

Referenced by btEffectRunRisingDragonEnemy().

Definition at line 350 of file battle_effect_star_mine.c.

RISING_DRAGON_ENEMY_FLASH_BURSTS

#define RISING_DRAGON_ENEMY_FLASH_BURSTS

Referenced by btEffectRunRisingDragonEnemy().

Definition at line 351 of file battle_effect_star_mine.c.

RISING_DRAGON_ENEMY_HAZE_SPEED

#define RISING_DRAGON_ENEMY_HAZE_SPEED 8

How many lines a tick the sky scrolls past as the dragon climbs.

Referenced by btEffectRunRisingDragonEnemy().

Definition at line 354 of file battle_effect_star_mine.c.

RISING_DRAGON_ENEMY_FLASH_LEVEL

#define RISING_DRAGON_ENEMY_FLASH_LEVEL 32

The level the canvas is cleared to each tick of the whitening from tick 152, until its last five ticks turn it CANVAS_LEVEL_BRIGHTEST.

Referenced by btEffectRunRisingDragonEnemy().

Definition at line 357 of file battle_effect_star_mine.c.

RISING_DRAGON_ENEMY_TICKS

#define RISING_DRAGON_ENEMY_TICKS 186

Referenced by btEffectRunRisingDragonEnemy().

Definition at line 359 of file battle_effect_star_mine.c.

Functions in detail

btEffectRunStarMine

void btEffectRunStarMine(BATTLE_EFFECT_PARM *args)

Six twinkling stars (a 24 by 48 picture mirrored both ways from the sprite sheet's two halves) are thrown up from the caster, each at a target in turn; from tick 8 * i + 11 each is pulled toward its target and bursts once it has passed it, into four flash bursts and 32 sparks, knocking the target back.

Abilities: Star Mine.

References BattleEffectMotePictures, btCameraShake(), btEffectBuildCanvasBlitters(), btEffectPosProjectPoint(), btEffectStartActorMotion(), btEffectStartCanvasLayer(), btEffectTintBattler(), btObjectGetStub(), btParticleAdvanceWithGravity2D(), btParticleAdvanceWithGravity3D(), btResourceLoadAndDecompress(), btUnitGetEffectHeightStub(), Sint32, syCos(), syRandom(), syResourceGetTableEntry(), sySin() and sySoundPlayStub().

Referenced by BattleEffectHandlers.

Definition at line 38 of file battle_effect_star_mine.c.

btEffectBuildRepeatingTilemap

void btEffectBuildRepeatingTilemap(void)

Lays BG1's map with the right half of the battle background's image, 16 tiles by BACKDROP_ROWS, twice across and twice down, so that the backdrop scrolls on without end.

References Sint32.

Referenced by btEffectRunMegiddo(), btEffectRunOdyssey() and btEffectRunRisingDragonEnemy().

Definition at line 294 of file battle_effect_star_mine.c.

btEffectRunRisingDragonEnemy

void btEffectRunRisingDragonEnemy(BATTLE_EFFECT_PARM *args)

A dragon of flame bursts up under the target in a shower of sparks and carries it off in its jaws, into a teal sky (the red haze, its colours turned) that scrolls past as it climbs, swaying. At tick 134 the dragon's top bursts into flashes and sparks, and from tick 152 the screen whitens; at tick 166 the battle's own background is back and the target drops to the field, landing at 179.

Abilities: Rising Dragon (the enemies').

References BattleEffectMotePictures, BattleEffectSquareCorners, BattleEffectSquareMesh, BgScrollWork, btBackgroundLoadStub(), btCameraShake(), btEffectBuildRepeatingTilemap(), btEffectConfigureEffectDisplay(), btEffectCountDownBattlerTints(), btEffectEndCanvasLayer(), btEffectPosProjectBattler(), btEffectStartCanvasLayer(), btEffectTintBattler(), btEffectTransferCanvas(), btObjectGetStub(), btPaletteBrightenBgEntries(), btParticleAdvanceWithGravity2D(), btRenderAllocateModelList(), btRenderBuildQuadStrip(), btRenderDrawModelList(), btRenderTransformVertices(), btResourceLoadAndDecompress(), ProjectionWork, Sint32, syCloseEvent(), syCos(), syHeapRelease(), syHeapSlotRelease(), syInitMatrix(), syMatrixScaleUniform(), syPopMatrix(), syPushMatrix(), syRandom(), syResourceGetTableEntry(), syRotY(), syRotZ(), syScale(), sySin(), sySoundPlayStub() and syTranslate().

Referenced by BattleEffectHandlers.

Definition at line 369 of file battle_effect_star_mine.c.