Skip to Content
The Alchemy Project

src/scene/shared/mercury_lighthouse_column.c

Mercury Lighthouse and its entrance, once Ply has been cast on the goddess: standing on the pool's heart (METATILE_BEHAVIOR_MERCURY_LIGHTHOUSE_POOL_HEART) gives the leader three lights, shown as a column of light over them. More…

Included by mercury_lighthouse.c and mercury_lighthouse_entrance.c.

Macros

NameDescription
#defineMERCURY_LIGHTHOUSE_MAX_LIGHTS 3The lights the heart gives.
#defineSPARK_RISE_TICKS 32A charging spark rises a pixel a tick for this many ticks, its scale following half a turn of sine.

Functions

NameDescription
static BoolscMercuryLighthouseRiseSpark (ACTOR *effect)An actor script call for a charging spark: it rises with the leader, swelling and shrinking, and is released after SPARK_RISE_TICKS.
static BoolscMercuryLighthouseGrowLight (ACTOR *actor)An actor script call for the light that flies ahead to a hop's landing metatile: it grows to three quarters of its size over 16 ticks.
static BoolscMercuryLighthouseSwellLightOut (ACTOR *actor)An actor script call for a light that goes out: it swells to half as large again over 16 ticks before its script releases it.
static Sint32scMercuryLighthouseFollowLeader (ACTOR *actor)An actor script call for the column of light: it glides after the leader, an eighth of the way each tick up to 2 pixels, and flickers white every two ticks.
static voidscMercuryLighthouseSpawnSparkPair (void)A pair of charging sparks rises around the leader, one in front and one behind, with SE_PSYNERGY_START.
voidscMercuryLighthouseChargeLights (void)METATILE_BEHAVIOR_MERCURY_LIGHTHOUSE_POOL_HEART, the pool's heart: the column of light appears over the leader if it is not there, and grows a stage with each pair of sparks, half a second apart, up to MERCURY_LIGHTHOUSE_MAX_LIGHTS.
voidscMercuryLighthouseLoseLights (void)METATILE_BEHAVIOR_MERCURY_LIGHTHOUSE_POOL_STEP: the leader loses their lights, and the column swells and fades away.
voidscMercuryLighthouseHopAcrossPool (void)Pushing against the pool's edge (METATILE_BEHAVIOR_MERCURY_LIGHTHOUSE_POOL_HEART, METATILE_BEHAVIOR_MERCURY_LIGHTHOUSE_POOL_WATER and METATILE_BEHAVIOR_MERCURY_LIGHTHOUSE_POOL_STEP): the leader hops two metatiles the way the pad points, unless the hop leads into the pool without a light or is blocked.
voidscMercuryLighthouseRippleAroundLeader (void)METATILE_BEHAVIOR_MERCURY_LIGHTHOUSE_POOL_WATER: while the leader stands there, a blue ripple spreads from them every 10 to 39 ticks.
static voidscMercuryLighthouseRemoveColumnOnRetreat (void)Retreat (PSYNERGY_ANYWHERE(ABILITY_RETREAT, PSYNERGY_PHASE_BEFORE_CAST)): remove the column of light.

Description

Mercury Lighthouse and its entrance, once Ply has been cast on the goddess: standing on the pool's heart (METATILE_BEHAVIOR_MERCURY_LIGHTHOUSE_POOL_HEART) gives the leader three lights, shown as a column of light over them. Each hop out onto the water (the floor's poolBehavior) spends one, and a light flies ahead to hold the leader up where they land. A hop into the water with no light left sinks the leader, who is put back at the heart. A stepping square (METATILE_BEHAVIOR_MERCURY_LIGHTHOUSE_POOL_STEP) takes the lights away, and Retreat removes the column.

Macros in detail

MERCURY_LIGHTHOUSE_MAX_LIGHTS

#define MERCURY_LIGHTHOUSE_MAX_LIGHTS 3

The lights the heart gives.

Referenced by scMercuryLighthouseChargeLights().

Definition at line 12 of file mercury_lighthouse_column.c.

SPARK_RISE_TICKS

#define SPARK_RISE_TICKS 32

A charging spark rises a pixel a tick for this many ticks, its scale following half a turn of sine.

Referenced by scMercuryLighthouseRiseSpark().

Definition at line 16 of file mercury_lighthouse_column.c.

Functions in detail

scMercuryLighthouseRiseSpark

static Bool scMercuryLighthouseRiseSpark(ACTOR *effect)

An actor script call for a charging spark: it rises with the leader, swelling and shrinking, and is released after SPARK_RISE_TICKS.

References sySin().

Referenced by MercuryLighthouseSparkScript.

Definition at line 20 of file mercury_lighthouse_column.c.

scMercuryLighthouseGrowLight

static Bool scMercuryLighthouseGrowLight(ACTOR *actor)

An actor script call for the light that flies ahead to a hop's landing metatile: it grows to three quarters of its size over 16 ticks.

Referenced by MercuryLighthouseGrowLightScript.

Definition at line 42 of file mercury_lighthouse_column.c.

scMercuryLighthouseSwellLightOut

static Bool scMercuryLighthouseSwellLightOut(ACTOR *actor)

An actor script call for a light that goes out: it swells to half as large again over 16 ticks before its script releases it.

Referenced by MercuryLighthouseLightOutScript.

Definition at line 58 of file mercury_lighthouse_column.c.

scMercuryLighthouseFollowLeader

static Sint32 scMercuryLighthouseFollowLeader(ACTOR *actor)

An actor script call for the column of light: it glides after the leader, an eighth of the way each tick up to 2 pixels, and flickers white every two ticks.

References Sint32, syDivFX(), syMulFX(), sySquartFX(), sySquartIWRAM() and TickCount.

Referenced by MercuryLighthouseColumnScript.

Definition at line 75 of file mercury_lighthouse_column.c.

scMercuryLighthouseSpawnSparkPair

static void scMercuryLighthouseSpawnSparkPair(void)

A pair of charging sparks rises around the leader, one in front and one behind, with SE_PSYNERGY_START.

References fdActorStartScript(), fdSpriteStartAnimation(), MainRoutineStateWork, MercuryLighthouseSparkScript, scFieldActorCreate() and sySoundPlay().

Referenced by scMercuryLighthouseChargeLights().

Definition at line 136 of file mercury_lighthouse_column.c.

scMercuryLighthouseChargeLights

void scMercuryLighthouseChargeLights(void)

METATILE_BEHAVIOR_MERCURY_LIGHTHOUSE_POOL_HEART, the pool's heart: the column of light appears over the leader if it is not there, and grows a stage with each pair of sparks, half a second apart, up to MERCURY_LIGHTHOUSE_MAX_LIGHTS. The column's metatile is where a sinking leader comes back to; FLAG_NO_ENCOUNTERS_IN_AREA is set while the leader has lights.

References fdActorSelectAnimation(), fdActorStartScript(), fdScriptEnd(), fdScriptStart(), gmFlagSet(), MainRoutineStateWork, MercuryLighthouseColumnScript, scFieldActorCreate(), scMercuryLighthouseSpawnSparkPair(), Sint32, state and sySynch().

Referenced by scMercuryLighthouseChargeLightsOnLower() and scMercuryLighthouseEntranceChargeLights().

Definition at line 186 of file mercury_lighthouse_column.c.

scMercuryLighthouseLoseLights

void scMercuryLighthouseLoseLights(void)

METATILE_BEHAVIOR_MERCURY_LIGHTHOUSE_POOL_STEP: the leader loses their lights, and the column swells and fades away.

References fdActorSelectAnimation(), fdActorStartScript(), gmFlagClear(), MercuryLighthouseLightOutScript and state.

Referenced by scMercuryLighthouseEntranceLoseLights() and scMercuryLighthouseLoseLightsOnLower().

Definition at line 248 of file mercury_lighthouse_column.c.

scMercuryLighthouseHopAcrossPool

void scMercuryLighthouseHopAcrossPool(void)

Pushing against the pool's edge (METATILE_BEHAVIOR_MERCURY_LIGHTHOUSE_POOL_HEART, METATILE_BEHAVIOR_MERCURY_LIGHTHOUSE_POOL_WATER and METATILE_BEHAVIOR_MERCURY_LIGHTHOUSE_POOL_STEP): the leader hops two metatiles the way the pad points, unless the hop leads into the pool without a light or is blocked. A hop into the pool spends a light, which flies ahead to the landing metatile; the column shrinks a stage, or goes with the last light. Landing in the pool with no light under them, the leader sinks until a key is pressed after half a second, and is put back at the heart.

References fdActorMoveToAndWaitById(), fdActorRelease(), fdActorSelectAnimation(), fdActorSetSpriteFlags(), fdActorStartScript(), fdScriptEnd(), fdScriptStart(), fdSpriteStartAnimation(), gmFlagClear(), MainRoutineStateWork, MercuryLighthouseGrowLightScript, MercuryLighthouseLightOutScript, MercuryLighthouseMoveAngles, PerData, PerPush, scFieldActorCheckMovementCollision(), scFieldActorCreate(), scFieldActorSetMoveTargetFX(), scMercuryLighthouseSpawnRipple(), Sint32, state, syMulFX(), sySoundPlay(), sySynch() and syVectorAddPolarOffset().

Referenced by scMercuryLighthouseEntranceHopAcrossPool() and scMercuryLighthouseHopAcrossPoolOnLower().

Definition at line 282 of file mercury_lighthouse_column.c.

scMercuryLighthouseRippleAroundLeader

void scMercuryLighthouseRippleAroundLeader(void)

METATILE_BEHAVIOR_MERCURY_LIGHTHOUSE_POOL_WATER: while the leader stands there, a blue ripple spreads from them every 10 to 39 ticks.

References MainRoutineStateWork, scMercuryLighthouseSpawnRipple() and state.

Referenced by scMercuryLighthouseEntranceRippleAroundLeader() and scMercuryLighthouseRippleWhileInPool().

Definition at line 419 of file mercury_lighthouse_column.c.

scMercuryLighthouseRemoveColumnOnRetreat

static void scMercuryLighthouseRemoveColumnOnRetreat(void)

Retreat (PSYNERGY_ANYWHERE(ABILITY_RETREAT, PSYNERGY_PHASE_BEFORE_CAST)): remove the column of light.

References fdActorRelease(), state and syHeapSlotAllocateEWRAM().

Referenced by MercuryLighthouseEntranceCues, MercuryLighthouseExteriorCues, MercuryLighthouseLowerCues, MercuryLighthouseMiddleCues and MercuryLighthouseUpperCues.

Definition at line 440 of file mercury_lighthouse_column.c.