Skip to Content
The Alchemy Project

src/field/script_commands_mind_read.c

Mind Read: its wave, ripple, tint, crescents and caster colour cycle. More…

Included by script_commands.c.

Macros

NameDescription
#defineMIND_READ_WAVE_OFFSET (phase) (sySin(((phase) << 16) / 160) >> 14)A line's offset in Mind Read's wave at a phase: a sine 4 pixels either way, a turn every 160 phase steps.
#defineMIND_READ_CYCLE_LAST 60The wave's cycle runs to this count and starts again, 61 ticks; at counts 0, 8 and 16 a particle flies from the target to the caster.
#defineMIND_READ_PARTICLE_GAP 8

Functions

NameDescription
voidfdPsynergyUpdateMindReadWave (void)Mind Read's wave each tick: once its delay has run out, writes the next page of line offsets, steps the colour fade and the hue every other tick, keeps the caster's colours lit, and three times a cycle sends a particle (SPRITE_CRESCENT) from the target to the caster, with SE_PSYNERGY_START.
voidfdMindReadStartRipple (void)Sets Mind Read's ripple going at each VBlank: HBlank DMA 0 gives BG0 the page of line offsets last written, a line at a time.
Sint32fdEffectHueChannelRamp (Sint16 hue)One colour channel's level (0 to 31) at a hue in degrees: rising from 0 to 60, full from 60 to 180, falling from 180 to 240, else 0.
voidfdMindReadAdvanceTint (void)Turns Mind Read's tint four degrees round the colour wheel, and takes the tint's colour, each channel dimmed to 4 to 11, from the hue before.
voidfdMindReadUpdateCrescent (ACTOR *target)A Mind Read crescent's update: once it has reached the caster, it goes.
voidfdActorSetLayersColorMode (void *object, Sint32 value)Gives an actor's sprite colour mode value - 1 (SPR_COL_MODE), or for LAYER_COLOR_CYCLING the next of MindReadCasterColorCycle's swapped colours, a step every 2 ticks, as Mind Read's wave does to its caster.

Description

Mind Read: its wave, ripple, tint, crescents and caster colour cycle. Part of script_commands.c.

Macros in detail

MIND_READ_WAVE_OFFSET

#define MIND_READ_WAVE_OFFSET(phase) (sySin(((phase) << 16) / 160) >> 14)

A line's offset in Mind Read's wave at a phase: a sine 4 pixels either way, a turn every 160 phase steps.

Referenced by fdPsynergyUpdateMindReadWave().

Definition at line 6 of file script_commands_mind_read.c.

MIND_READ_CYCLE_LAST

#define MIND_READ_CYCLE_LAST 60

The wave's cycle runs to this count and starts again, 61 ticks; at counts 0, 8 and 16 a particle flies from the target to the caster.

Referenced by fdPsynergyUpdateMindReadWave().

Definition at line 9 of file script_commands_mind_read.c.

MIND_READ_PARTICLE_GAP

#define MIND_READ_PARTICLE_GAP 8

Referenced by fdPsynergyUpdateMindReadWave().

Definition at line 10 of file script_commands_mind_read.c.

Functions in detail

fdPsynergyUpdateMindReadWave

void fdPsynergyUpdateMindReadWave(void)

Mind Read's wave each tick: once its delay has run out, writes the next page of line offsets, steps the colour fade and the hue every other tick, keeps the caster's colours lit, and three times a cycle sends a particle (SPRITE_CRESCENT) from the target to the caster, with SE_PSYNERGY_START.

References fdActorCreateStub(), fdActorGetById(), fdActorSetLayersColorMode(), fdFindActorPlacement(), fdMindReadAdvanceTint(), fdMindReadUpdateCrescent(), fdPaletteFadeSetTarget(), fdPaletteFadeStartInterpolation(), fdResourceGetMetadataRecordStubStub(), Sint32, syAtan() and sySoundPlayStub().

Referenced by fdPsynergyStartMindReadWave() and fdPsynergyStopMindReadWave().

Definition at line 16 of file script_commands_mind_read.c.

fdMindReadStartRipple

void fdMindReadStartRipple(void)

Sets Mind Read's ripple going at each VBlank: HBlank DMA 0 gives BG0 the page of line offsets last written, a line at a time.

References syDMAXCopy().

Referenced by fdPsynergyGreyMindReadPalette() and fdPsynergyRestoreMindReadPalette().

Definition at line 121 of file script_commands_mind_read.c.

fdEffectHueChannelRamp

Sint32 fdEffectHueChannelRamp(Sint16 hue)

One colour channel's level (0 to 31) at a hue in degrees: rising from 0 to 60, full from 60 to 180, falling from 180 to 240, else 0.

References Sint32.

Referenced by fdMindReadAdvanceTint().

Definition at line 140 of file script_commands_mind_read.c.

fdMindReadAdvanceTint

void fdMindReadAdvanceTint(void)

Turns Mind Read's tint four degrees round the colour wheel, and takes the tint's colour, each channel dimmed to 4 to 11, from the hue before.

References fdEffectHueChannelRamp().

Referenced by fdPsynergyStartMindReadWave() and fdPsynergyUpdateMindReadWave().

Definition at line 164 of file script_commands_mind_read.c.

fdMindReadUpdateCrescent

void fdMindReadUpdateCrescent(ACTOR *target)

A Mind Read crescent's update: once it has reached the caster, it goes.

References fdActorStartScriptStub(), MindReadCrescentEndScript and Sint32.

Referenced by fdPsynergyUpdateMindReadWave().

Definition at line 185 of file script_commands_mind_read.c.

fdActorSetLayersColorMode

void fdActorSetLayersColorMode(void *object, Sint32 value)

Gives an actor's sprite colour mode value - 1 (SPR_COL_MODE), or for LAYER_COLOR_CYCLING the next of MindReadCasterColorCycle's swapped colours, a step every 2 ticks, as Mind Read's wave does to its caster.

References fdActorSetSpriteColorModeStub(), MindReadCasterColorCycle, Sint32 and TickCount.

Referenced by fdPsynergyStopMindReadWave() and fdPsynergyUpdateMindReadWave().

Definition at line 205 of file script_commands_mind_read.c.