Skip to Content
The Alchemy Project

include/scene/scene_effects.h

Shared scene visual effects, particles, geysers, vents, smoke, lightning, whirlwinds, sparks and cached tile tables.

Included by scene.h.

Structures

NameDescription
structLIGHT_OAMA glow sprite queued for the OAM: the link at its depth, attributes 0 and 1 as one word, and attribute 2's fields.
structBEAM_SPARKA spark of the aerie's beam: where it is, how fast it drifts up and its age in ticks.
unionSPARK_OAMThe sprite words as one stored pair, or the attributes field by field.
structLINKED_EFFECT_STATEThe field effect state as the Golden Rings read it: the VRAM cache entry their sprites share, in bytes FIELD_EFFECT_STATE leaves unnamed.
structSPARK_STATEA spark of Venus Lighthouse's entrance: its position and velocity in 16.16 pixels, and its tick.
structVENT_ENTRYOne vent: whether it blows, the ticks to its next puff, its position and its gust's speed, in 16.16 pixels a tick.
structVENT_WORKThe vents of the room, in the inventory snapshot's spare space (VENT_STATE): their tick counter, the room's hook run each tick, its vents and the actors their puffs land on, besides the leader.

Macros

NameDescription
#defineEXPLOSION_SPARK_COUNT 96The sparks of the explosion that Loho's cannon blast and the Northern Reaches' shattered ice wall throw over the screen: how many, a spark's life in ticks (the explosion sprite sheet's eight pictures, four ticks each), the sprite palette their colours are loaded into (FieldExplosionPalette), and their depth slot among the field engine's sprites.
#defineEXPLOSION_SPARK_TICKS 32
#defineEXPLOSION_SPARK_PALETTE 15
#defineEXPLOSION_SPARK_DEPTH 100
#defineGEYSER_SPRITES 80The geysers Scoop digs up in Gondowan Cliffs and in Yampi Desert's scorpion pit (each scene's GEYSER_WORK): the most sprites btGeyserDraw queues in a tick, and the geysers a room can have.
#defineGEYSER_ENTRIES 16
#defineGEYSER_PERIOD_TICKS 360A geyser's six-second round, and the ticks of it at which it starts to rise and to fall.
#defineGEYSER_RISE_TICK 60
#defineGEYSER_FALL_TICK 240
#defineGEYSER_MAX_HEIGHT 64The pixels a geyser rises to.
#defineGEYSER_FIRST_TERRAIN (256 - GEYSER_ENTRIES)The terrain id and collision slot of the first geyser: the geysers take the last GEYSER_ENTRIES of the 256 terrain ids.
#defineGEYSER_STATEThe geysers' state (each scene's GEYSER_WORK), kept in the inventory snapshot's spare space.
#defineLIGHTNING_TILES 64The lightning bolt's picture (RESOURCE_LIGHTNING_TILES and RESOURCE_LIGHTNING_MAP), shown on BG0 for the strike: its tiles at the start of character block 0, and its map, LIGHTNING_MAP_ROWS rows of LIGHTNING_MAP_COLUMNS numbered from tile 512, on screen block LIGHTNING_SCREEN_BLOCK.
#defineLIGHTNING_MAP_ROWS 16
#defineLIGHTNING_MAP_COLUMNS 4
#defineLIGHTNING_SCREEN_BLOCK 4
#defineLEMURIAN_SHIP_PALETTE 11The Lemurian Ship's background palette, the blues of the band along its hull and the surf, in the scenes that show the ship: Atteka Inlet, Lemuria's dock and the ship's deck.
#defineHULL_BAND_FIRST_COLOR 4The runs of a background palette's colours the shore scenes turn a step at a time: 12 to 15, the surf, and on LEMURIAN_SHIP_PALETTE also 4 to 9, the blues of the band along its hull.
#defineHULL_BAND_LAST_COLOR 9
#defineSURF_FIRST_COLOR 12
#defineSURF_LAST_COLOR 15
#defineFIRST_WATER_COLOR 12The same run of four as Gondowan Cliffs (background palette 0) and SW Atteka Islet (palette 3) turn their water's colours in place (scGondowanCliffsCycleWaterColors, scSettlementsCycleWaterColors): its first colour and how many.
#defineWATER_COLORS 4
#defineSMOKE_TICKS 60The ticks a puff of smoke from a chimney or a cooking fire rises and swells before it is released: Prox's, Kalt Island's (the Settlements), Shaman Village's and Kibombo's, each scene's own copy of the same drift.
#defineRAISED_RIDE_WHIRLWIND 200The raised cue a whirlwind raises as it catches the leader, which each scene with whirlwinds answers by carrying him off on it: the Jupiter Lighthouse rooms with fdWhirlwindCarryLeader (shared/whirlwind_update.c raises it), Air's Rock with scAirsRockRideWhirlwind and its inside with scAirsRockInsideRideWhirlwind.
#defineVENT_MAX 16The vents of Aqua Rock and Taopo Swamp (VENT_WORK, shared/vent_*.c): the most vents a room has, and the most actors besides the leader their puffs land on.
#defineVENT_IDS_MAX 4
#defineVENT_STATE ((VENT_WORK *)(InventorySnapshot + INVENTORY_SNAPSHOT_SPARE …The vents' state, kept in the inventory snapshot's spare space.
#defineDIFF (a, b) ((a) - (b) >= 0 ? (a) - (b) : (b) - (a))How far apart a and b are, never negative, as a vent's thrown object tests whether it rests on another in x and z (scene/shared/actor_vent_bounce.c).
#defineVENT_TOUCHING VentIsTouchingThe names scene/shared/actor_vent_bounce.c's two functions take in both rooms' copies: whether a thrown object rests on another, and its motion.
#defineVENT_BOUNCE scVentBounce
#defineVENT_AT (state, index)Vent index's entry: state moved on by index entries and read as the first, as the vents' accessors (scVentSetBlowing, scVentSetGust) read it.

Enumerations

NameDescription
enumanonymous enum { PARTICLE_SLOW_LIFETIME, PARTICLE_QUICK_LIFETIME }How long such a particle lives before it starts again: a slow swell and the 12 ticks it stays gone after, or a quick one.

Variables

NameDescription
extern Uint8FieldChannelPieceTiles []The pictures of Gabomba Statue's channel pieces, 16 pixels square in 256 colours, one for each piece in the order of the statue's CHANNEL_PIECE (graphics/field/cached_a.png).
extern Uint8FieldPathGlowTiles []The glows of Jupiter Lighthouse's path pieces, 16 pixels square in 256 colours: the lit channel of each piece a path block carries (graphics/field/cached_b.png).
extern Uint8FieldEnergyBlockGlowTiles []The energy block's glow, 32 by 64 pixels in 256 colours (graphics/field/cached_c.png).
extern Uint8FieldCachedTilesD []Compressed tiles the Dullahan's room unpacks into the VRAM cache for its glow sprites (graphics/field/cached_d.png).
extern const Uint8FieldGroundTiles []Compressed ground tiles (graphics/field/ground_tiles.png).
extern const Uint16FieldExplosionPalette []An explosion's 16 sprite colours (graphics/field/explosion_palette.png).
extern const Uint8FieldGeyserTiles []A geyser's compressed tiles (graphics/field/geyser.png).

Description

Shared scene visual effects, particles, geysers, vents, smoke, lightning, whirlwinds, sparks and cached tile tables.

Macros in detail

EXPLOSION_SPARK_COUNT

#define EXPLOSION_SPARK_COUNT 96

The sparks of the explosion that Loho's cannon blast and the Northern Reaches' shattered ice wall throw over the screen: how many, a spark's life in ticks (the explosion sprite sheet's eight pictures, four ticks each), the sprite palette their colours are loaded into (FieldExplosionPalette), and their depth slot among the field engine's sprites.

Referenced by scLohoFireCannon() and scNorthernReachesShatterIceWall().

Definition at line 107 of file scene_effects.h.

EXPLOSION_SPARK_TICKS

#define EXPLOSION_SPARK_TICKS 32

Referenced by scLohoFireCannon() and scNorthernReachesShatterIceWall().

Definition at line 108 of file scene_effects.h.

EXPLOSION_SPARK_PALETTE

#define EXPLOSION_SPARK_PALETTE 15

Referenced by scLohoFireCannon() and scNorthernReachesShatterIceWall().

Definition at line 109 of file scene_effects.h.

EXPLOSION_SPARK_DEPTH

#define EXPLOSION_SPARK_DEPTH 100

Referenced by scLohoFireCannon() and scNorthernReachesShatterIceWall().

Definition at line 110 of file scene_effects.h.

GEYSER_SPRITES

#define GEYSER_SPRITES 80

The geysers Scoop digs up in Gondowan Cliffs and in Yampi Desert's scorpion pit (each scene's GEYSER_WORK): the most sprites btGeyserDraw queues in a tick, and the geysers a room can have.

Referenced by btGeyserDraw() and scGeyserStart().

Definition at line 118 of file scene_effects.h.

GEYSER_ENTRIES

#define GEYSER_ENTRIES 16

Referenced by btGeyserDraw() and scGeyserUpdate().

Definition at line 119 of file scene_effects.h.

GEYSER_PERIOD_TICKS

#define GEYSER_PERIOD_TICKS 360

A geyser's six-second round, and the ticks of it at which it starts to rise and to fall.

Referenced by scGeyserAdd().

Definition at line 123 of file scene_effects.h.

GEYSER_RISE_TICK

#define GEYSER_RISE_TICK 60

Referenced by scGeyserAdd().

Definition at line 124 of file scene_effects.h.

GEYSER_FALL_TICK

#define GEYSER_FALL_TICK 240

Referenced by scGeyserAdd().

Definition at line 125 of file scene_effects.h.

GEYSER_MAX_HEIGHT

#define GEYSER_MAX_HEIGHT 64

The pixels a geyser rises to.

Referenced by scInit() and scYampiDesertSetUpScorpionPit().

Definition at line 128 of file scene_effects.h.

GEYSER_FIRST_TERRAIN

#define GEYSER_FIRST_TERRAIN (256 - GEYSER_ENTRIES)

The terrain id and collision slot of the first geyser: the geysers take the last GEYSER_ENTRIES of the 256 terrain ids.

Referenced by scInit() and scYampiDesertSetUpScorpionPit().

Definition at line 132 of file scene_effects.h.

GEYSER_STATE

#define GEYSER_STATE

The geysers' state (each scene's GEYSER_WORK), kept in the inventory snapshot's spare space.

Referenced by btGeyserDraw(), scGeyserAdd(), scGeyserStart() and scGeyserUpdate().

Definition at line 136 of file scene_effects.h.

LIGHTNING_TILES

#define LIGHTNING_TILES 64

The lightning bolt's picture (RESOURCE_LIGHTNING_TILES and RESOURCE_LIGHTNING_MAP), shown on BG0 for the strike: its tiles at the start of character block 0, and its map, LIGHTNING_MAP_ROWS rows of LIGHTNING_MAP_COLUMNS numbered from tile 512, on screen block LIGHTNING_SCREEN_BLOCK.

Referenced by scAirsRockInsideWakeEntranceStatue(), scAirsRockInsideWakeHallStatue(), scAirsRockWhirlwindOpensTheTop() and scJupiterLighthouseFlashSky().

Definition at line 144 of file scene_effects.h.

LIGHTNING_MAP_ROWS

#define LIGHTNING_MAP_ROWS 16

Referenced by scAirsRockInsideWakeEntranceStatue(), scAirsRockInsideWakeHallStatue(), scAirsRockWhirlwindOpensTheTop() and scJupiterLighthouseFlashSky().

Definition at line 145 of file scene_effects.h.

LIGHTNING_MAP_COLUMNS

#define LIGHTNING_MAP_COLUMNS 4

Referenced by scAirsRockInsideWakeEntranceStatue(), scAirsRockInsideWakeHallStatue(), scAirsRockWhirlwindOpensTheTop() and scJupiterLighthouseFlashSky().

Definition at line 146 of file scene_effects.h.

LIGHTNING_SCREEN_BLOCK

#define LIGHTNING_SCREEN_BLOCK 4

Referenced by scAirsRockInsideWakeEntranceStatue(), scAirsRockInsideWakeHallStatue(), scAirsRockWhirlwindOpensTheTop() and scJupiterLighthouseFlashSky().

Definition at line 147 of file scene_effects.h.

LEMURIAN_SHIP_PALETTE

#define LEMURIAN_SHIP_PALETTE 11

The Lemurian Ship's background palette, the blues of the band along its hull and the surf, in the scenes that show the ship: Atteka Inlet, Lemuria's dock and the ship's deck.

Referenced by scAttekaInletRotateHullBandAndSurfColors() and scLemuriaDockCyclePalette().

Definition at line 152 of file scene_effects.h.

HULL_BAND_FIRST_COLOR

#define HULL_BAND_FIRST_COLOR 4

The runs of a background palette's colours the shore scenes turn a step at a time: 12 to 15, the surf, and on LEMURIAN_SHIP_PALETTE also 4 to 9, the blues of the band along its hull.

Referenced by scAttekaInletRotateHullBandAndSurfColors() and scLemuriaDockCyclePalette().

Definition at line 157 of file scene_effects.h.

HULL_BAND_LAST_COLOR

#define HULL_BAND_LAST_COLOR 9

Referenced by scAttekaInletRotateHullBandAndSurfColors() and scLemuriaDockCyclePalette().

Definition at line 158 of file scene_effects.h.

SURF_FIRST_COLOR

#define SURF_FIRST_COLOR 12

Referenced by scAttekaInletRotateHullBandAndSurfColors(), scIsletsInitSeaOfTime() and scLemuriaDockCyclePalette().

Definition at line 159 of file scene_effects.h.

SURF_LAST_COLOR

#define SURF_LAST_COLOR 15

Referenced by scAttekaInletRotateHullBandAndSurfColors() and scLemuriaDockCyclePalette().

Definition at line 160 of file scene_effects.h.

FIRST_WATER_COLOR

#define FIRST_WATER_COLOR 12

The same run of four as Gondowan Cliffs (background palette 0) and SW Atteka Islet (palette 3) turn their water's colours in place (scGondowanCliffsCycleWaterColors, scSettlementsCycleWaterColors): its first colour and how many.

Referenced by scGondowanCliffsCycleWaterColors(), scGondowanCliffsSetUpPass(), scInit() and scSettlementsCycleWaterColors().

Definition at line 166 of file scene_effects.h.

WATER_COLORS

#define WATER_COLORS 4

Referenced by GondowanCliffsSavedWaterColors, scGondowanCliffsCycleWaterColors() and scSettlementsCycleWaterColors().

Definition at line 167 of file scene_effects.h.

SMOKE_TICKS

#define SMOKE_TICKS 60

The ticks a puff of smoke from a chimney or a cooking fire rises and swells before it is released: Prox's, Kalt Island's (the Settlements), Shaman Village's and Kibombo's, each scene's own copy of the same drift.

Referenced by scKibomboRaiseSmoke(), scShamanVillageSpawnSmoke() and scSmokeSpawn().

Definition at line 172 of file scene_effects.h.

RAISED_RIDE_WHIRLWIND

#define RAISED_RIDE_WHIRLWIND 200

The raised cue a whirlwind raises as it catches the leader, which each scene with whirlwinds answers by carrying him off on it: the Jupiter Lighthouse rooms with fdWhirlwindCarryLeader (shared/whirlwind_update.c raises it), Air's Rock with scAirsRockRideWhirlwind and its inside with scAirsRockInsideRideWhirlwind.

Referenced by AirsRockCliffCues, AirsRockInsideEntranceCues, AirsRockInsideFaceVentsCues, AirsRockInsideHallCues, AirsRockInsideStatuesCues, AirsRockInsideWindStoneCues, AirsRockSummitCues, scAirsRockInsideMovePooledWhirlwind(), scAirsRockInsideMoveWhirlwind(), scAirsRockMoveWhirlwind(), SceneCues and scWhirlwindUpdate().

Definition at line 179 of file scene_effects.h.

VENT_MAX

#define VENT_MAX 16

The vents of Aqua Rock and Taopo Swamp (VENT_WORK, shared/vent_*.c): the most vents a room has, and the most actors besides the leader their puffs land on.

Referenced by scVentsStart().

Definition at line 183 of file scene_effects.h.

VENT_IDS_MAX

#define VENT_IDS_MAX 4

Referenced by scVentsStart().

Definition at line 184 of file scene_effects.h.

VENT_STATE

#define VENT_STATE ((VENT_WORK *)(InventorySnapshot + INVENTORY_SNAPSHOT_SPARE))

The vents' state, kept in the inventory snapshot's spare space.

Referenced by scVentAdvanceCounter(), scVentBounce(), scVentGetCounter(), scVentIsBlowing(), scVentSetBlowing(), scVentSetGust(), scVentSetId(), scVentsStart() and scVentUpdate().

Definition at line 210 of file scene_effects.h.

DIFF

#define DIFF(a, b) ((a) - (b) >= 0 ? (a) - (b) : (b) - (a))

How far apart a and b are, never negative, as a vent's thrown object tests whether it rests on another in x and z (scene/shared/actor_vent_bounce.c). Each is read twice.

Referenced by VentIsTouching().

Definition at line 215 of file scene_effects.h.

VENT_TOUCHING

#define VENT_TOUCHING VentIsTouching

The names scene/shared/actor_vent_bounce.c's two functions take in both rooms' copies: whether a thrown object rests on another, and its motion.

Definition at line 218 of file scene_effects.h.

VENT_BOUNCE

#define VENT_BOUNCE scVentBounce

Definition at line 219 of file scene_effects.h.

VENT_AT

#define VENT_AT(state, index)

Vent index's entry: state moved on by index entries and read as the first, as the vents' accessors (scVentSetBlowing, scVentSetGust) read it.

Referenced by scVentIsBlowing(), scVentSetBlowing() and scVentSetGust().

Definition at line 223 of file scene_effects.h.

Enumerations in detail

anonymous enum

enum { PARTICLE_SLOW_LIFETIME, PARTICLE_QUICK_LIFETIME }

How long such a particle lives before it starts again: a slow swell and the 12 ticks it stays gone after, or a quick one.

EnumeratorValueDescription
PARTICLE_SLOW_LIFETIME212
PARTICLE_QUICK_LIFETIME116

Definition at line 15 of file scene_effects.h.

Variables in detail

FieldChannelPieceTiles

extern Uint8 FieldChannelPieceTiles[]

The pictures of Gabomba Statue's channel pieces, 16 pixels square in 256 colours, one for each piece in the order of the statue's CHANNEL_PIECE (graphics/field/cached_a.png). The statue unpacks them into the VRAM cache for its raised blocks.

Referenced by scGabombaStatueLoadBlockPictures() and scLightSpritesInitChannelPieces().

Definition at line 81 of file scene_effects.h.

FieldPathGlowTiles

extern Uint8 FieldPathGlowTiles[]

The glows of Jupiter Lighthouse's path pieces, 16 pixels square in 256 colours: the lit channel of each piece a path block carries (graphics/field/cached_b.png).

Referenced by scLightSpritesInitPathGlows().

Definition at line 86 of file scene_effects.h.

FieldEnergyBlockGlowTiles

extern Uint8 FieldEnergyBlockGlowTiles[]

The energy block's glow, 32 by 64 pixels in 256 colours (graphics/field/cached_c.png).

Referenced by scLightSpritesInitEnergyBlockGlow().

Definition at line 90 of file scene_effects.h.

FieldCachedTilesD

extern Uint8 FieldCachedTilesD[]

Compressed tiles the Dullahan's room unpacks into the VRAM cache for its glow sprites (graphics/field/cached_d.png).

Referenced by scAnemosInnerSanctumDullahanStartLightSprites().

Definition at line 94 of file scene_effects.h.

FieldGroundTiles

extern const Uint8 FieldGroundTiles[]

Compressed ground tiles (graphics/field/ground_tiles.png).

Referenced by fdGroundParticlesStart().

Definition at line 97 of file scene_effects.h.

FieldExplosionPalette

extern const Uint16 FieldExplosionPalette[]

An explosion's 16 sprite colours (graphics/field/explosion_palette.png).

Referenced by scChampaCliffCavesStartFlash(), scLohoFireCannon() and scNorthernReachesShatterIceWall().

Definition at line 100 of file scene_effects.h.

FieldGeyserTiles

extern const Uint8 FieldGeyserTiles[]

A geyser's compressed tiles (graphics/field/geyser.png).

Referenced by scGeyserStart(), scTrialRoadStartFountains() and scVenusLighthouseEntranceBlastActorSkyward().

Definition at line 113 of file scene_effects.h.