Skip to Content
The Alchemy Project

src/field/field_psynergy_hover.c

Hover: its glow, the cast and its end. More…

Included by field_psynergy.c.

Structures

NameDescription
structHOVER_STATEHover's state (heap slot HEAP_SLOT_BATTLE_EFFECT): the glowing ring under the hovering leader, its scale, tile and stage.

Macros

NameDescription
#defineHOVER_GLOW_WAVE_LENGTH 96The levels in HoverGlowLevels's cycle, and the steps of the glow's colours.
#defineHOVER_GLOW_STEPS 24
#defineHOVER_GLOW_NEUTRAL_LEVEL 7The brightness level at which fdHoverGlowGetColor leaves the wave as it is.
#defineHOVER_GLOW_PALETTE ((Uint16 *)&OBJ_PLTT_COLOR(CANVAS_PALETTE, 0))The glow's colours: sprite palette CANVAS_PALETTE.
#defineGLOW_FULL 112The glow's strength, in ticks: full at 112, and it fades out a tick at a time once the player leaves the place that feeds it.
#defineGLOW_RISING 100The glow's strength set as the ring grows, before the glow is held.
#defineGLOW_SPENT_SOUND (ABILITY_HOVER | ACT_PACKED)The field Psynergy the glow asks for when it runs out: Hover, without paying PP.
#defineHOVER_RING_GROW_TICKS 32The ticks the ring under the leader takes to grow, or to shrink away.

Functions

NameDescription
Sint32fdHoverGlowGetColor (Sint32 counter, Sint32 level)The colour of Hover's glow (fdHoverGlowUpdate) for a step of its 24-step cycle and a brightness level (HOVER_GLOW_NEUTRAL_LEVEL leaves it as it is): three channels of the wave, each raised or lowered by the level and held to 0..31, packed as RGB555.
Sint32fdMapGridIsHoverMetatile (Sint32 x, Sint32 z, Sint32 layer)Whether Hover holds up over the metatile at (x, z): the overhead layer's collision code is METATILE_BEHAVIOR_HOVER, whatever layer is passed.
voidfdHoverGlowUpdate (void)Hover's tick callback: keeps the glow's strength full while the player stands where fdMapGridIsHoverMetatile allows, and runs it down otherwise (once it is fading, the glow shrinks with it and the script takes its sound when it is spent).
voidfdPsynergyHoverOnTarget (void)Hover cast on a target: runs fdPsynergyHover.
voidfdPsynergyHover (void)Hover: a glowing ring grows under the leader, who rises and floats (LEADER_MOVEMENT_HOVER) while fdHoverGlowUpdate holds the glow up.
voidfdPsynergyEndHover (void)Ends Hover: the leader drops back to the ground with a splash and the ring is freed.

Variables

NameDescription
extern const Uint8HoverGlowLevels []A cycle of 96 colour levels (31 down to 0, 32 at 0, then 0 up to 31), read a third of a turn apart for red, green and blue.

Description

Hover: its glow, the cast and its end. Part of field_psynergy.c.

Macros in detail

HOVER_GLOW_WAVE_LENGTH

#define HOVER_GLOW_WAVE_LENGTH 96

The levels in HoverGlowLevels's cycle, and the steps of the glow's colours.

Referenced by fdHoverGlowGetColor().

Definition at line 4 of file field_psynergy_hover.c.

HOVER_GLOW_STEPS

#define HOVER_GLOW_STEPS 24

Referenced by fdHoverGlowGetColor() and fdHoverGlowUpdate().

Definition at line 5 of file field_psynergy_hover.c.

HOVER_GLOW_NEUTRAL_LEVEL

#define HOVER_GLOW_NEUTRAL_LEVEL 7

The brightness level at which fdHoverGlowGetColor leaves the wave as it is.

Referenced by fdHoverGlowGetColor().

Definition at line 7 of file field_psynergy_hover.c.

HOVER_GLOW_PALETTE

#define HOVER_GLOW_PALETTE ((Uint16 *)&OBJ_PLTT_COLOR(CANVAS_PALETTE, 0))

The glow's colours: sprite palette CANVAS_PALETTE.

Referenced by fdHoverGlowUpdate().

Definition at line 55 of file field_psynergy_hover.c.

GLOW_FULL

#define GLOW_FULL 112

The glow's strength, in ticks: full at 112, and it fades out a tick at a time once the player leaves the place that feeds it.

Referenced by fdHoverGlowUpdate() and fdPsynergyHover().

Definition at line 59 of file field_psynergy_hover.c.

GLOW_RISING

#define GLOW_RISING 100

The glow's strength set as the ring grows, before the glow is held.

Referenced by fdPsynergyHover().

Definition at line 61 of file field_psynergy_hover.c.

GLOW_SPENT_SOUND

#define GLOW_SPENT_SOUND (ABILITY_HOVER | ACT_PACKED)

The field Psynergy the glow asks for when it runs out: Hover, without paying PP.

Referenced by fdHoverGlowUpdate().

Definition at line 64 of file field_psynergy_hover.c.

HOVER_RING_GROW_TICKS

#define HOVER_RING_GROW_TICKS 32

The ticks the ring under the leader takes to grow, or to shrink away.

Referenced by fdPsynergyHover().

Definition at line 66 of file field_psynergy_hover.c.

Functions in detail

fdHoverGlowGetColor

Sint32 fdHoverGlowGetColor(Sint32 counter, Sint32 level)

The colour of Hover's glow (fdHoverGlowUpdate) for a step of its 24-step cycle and a brightness level (HOVER_GLOW_NEUTRAL_LEVEL leaves it as it is): three channels of the wave, each raised or lowered by the level and held to 0..31, packed as RGB555.

References HoverGlowLevels and Sint32.

Referenced by fdHoverGlowUpdate().

Definition at line 17 of file field_psynergy_hover.c.

fdHoverGlowUpdate

void fdHoverGlowUpdate(void)

Hover's tick callback: keeps the glow's strength full while the player stands where fdMapGridIsHoverMetatile allows, and runs it down otherwise (once it is fading, the glow shrinks with it and the script takes its sound when it is spent). It cycles HOVER_GLOW_PALETTE through fdHoverGlowGetColor's colours, flickers between two pictures every other tick, and draws the glow under the player, flattened to three quarters of its height.

References fdActorGetSpriteDepth(), fdActorGetSpritePriority(), fdActorLookup(), fdCameraWorldToScreen(), fdEffectSpriteDraw(), fdHoverGlowGetColor(), fdMapGridIsHoverMetatile(), fdPartyGetLeaderActor(), Sint32 and TickCount.

Referenced by fdPsynergyEndHover() and fdPsynergyHover().

Definition at line 92 of file field_psynergy_hover.c.

fdPsynergyHoverOnTarget

void fdPsynergyHoverOnTarget(void)

Hover cast on a target: runs fdPsynergyHover.

References fdPsynergyHover().

Referenced by fdPsynergyDispatch().

Definition at line 160 of file field_psynergy_hover.c.

fdPsynergyHover

void fdPsynergyHover(void)

Hover: a glowing ring grows under the leader, who rises and floats (LEADER_MOVEMENT_HOVER) while fdHoverGlowUpdate holds the glow up. Where it cannot hover (off a hover metatile, or touching a solid actor) the ring shrinks away and the place's Hover script runs instead.

References fdActorSelectAnimationStub(), fdActorSetPosAndResetMotionStub(), fdBattleEffectSetObjectUpdateMode(), fdEffectSpriteInit(), fdFindPsynergyCue(), fdHoverGlowUpdate(), fdMapGridIsHoverMetatile(), fdPsynergyCheckOverlap(), fdRunPsynergyScript(), fdSelectPsynergyTarget(), MainRoutineStateWork, Sint32, syCloseEvent(), syDecompressTaggedLZ(), syHeapSlotAllocate(), syHeapSlotRelease(), syResourceGetTableEntry(), sySetEvent(), sySoundPlayStub(), sySynch(), syVRAMCacheFindFreeEntry(), syVRAMCacheFreeEntry() and syVRAMCacheLoad().

Referenced by fdPsynergyHoverOnTarget() and fdPsynergyRun().

Definition at line 172 of file field_psynergy_hover.c.

fdPsynergyEndHover

void fdPsynergyEndHover(void)

Ends Hover: the leader drops back to the ground with a splash and the ring is freed.

References fdActorGetById(), fdActorSetPosAndResetMotionStub(), fdHoverGlowUpdate(), fdPartyGetLeaderActor(), MainRoutineStateWork, Sint32, syCloseEvent(), syHeapSlotRelease(), sySoundPlayStub(), sySynch() and syVRAMCacheFreeEntry().

Referenced by fdPsynergyRunEnd().

Definition at line 305 of file field_psynergy_hover.c.