Skip to Content
The Alchemy Project

src/field/script_commands_field_psynergy_state.c

A field Psynergy's state: setting it up, its caster and target, cleaning up. More…

Included by script_commands.c.

Macros

NameDescription
#defineEND_ARC_WAIT_TICKS 30The ticks fdPsynergyEnd waits at most for the swelling arcs to end.
#defineANIM_CAST_PSYNERGY_START 20The caster's casting animations on the party's sprite sheets: ANIM_CAST_PSYNERGY's first two pictures, held on the second, and from the second to its last, held on the last.
#defineANIM_CAST_PSYNERGY_END 21
#defineFADE_HALF_COLORS 224A PALETTE_FADE half's colours, the BG's and then the sprites', three channels each.
#defineFADE_HALF_CHANNELS (FADE_HALF_COLORS * 3)

Functions

NameDescription
voidfdEffectUpdateAllEffectSlots (void)Event: updates the field Psynergy sprites.
voidfdPsynergyLoadResources (Sint32 abilityId, Sint32 mode)Prepares the state of the field Psynergy for abilityId (HEAP_SLOT_FIELD_EFFECT) and loads its spark tiles; mode is where it runs, an ACTOR_SYSTEM_MODE.
voidfdPsynergySetupActorPair (Sint32 userId, Sint32 targetId)Records the caster and the target of a field Psynergy, and where it takes place: on the target, or 16 pixels in front of the caster with none.
voidfdPsynergyStopCasterUpdate (void)Stops the caster's update function and restores its colours, then waits a tick.
voidfdPsynergyEnd (void)Ends a field Psynergy: frees the field effect sprites still in use and, unless another is being resolved, waits (at most END_ARC_WAIT_TICKS) for the swelling arcs to end, stops the slot event, releases its tiles, restores the map's shake, plays the queued sound and releases its state.
voidfdPsynergyStartCast (void)Starts casting: the caster raises its hand (ANIM_CAST_PSYNERGY_START) and stops; with FLAG_PLAY_PSYNERGY_CAST it goes on to ANIM_CAST_PSYNERGY_END.
voidfdPsynergyFadeToCastColor (void)Saves the palettes for the Psynergy and fades them toward one of the eight cast colours (FieldPsynergyCastColors), picked by the tick counter or forced by FLAG_PSYNERGY_TINT(0) to (7), over 8 ticks.
voidfdPsynergyFadeFromCastColor (void)Fades the palettes back from a cast's colours to the saved ones over 8 ticks; while Reveal is active the BG half fades to Reveal's grey instead (PALETTE_TINT_GRAYSCALE).
voidfdCameraWorldToScreen (VECTOR3 *pos)Converts a world position (16.16 pixels) to the screen: x and z receive the screen's x and y and y becomes 0.

Description

A field Psynergy's state: setting it up, its caster and target, cleaning up. Part of script_commands.c.

Macros in detail

END_ARC_WAIT_TICKS

#define END_ARC_WAIT_TICKS 30

The ticks fdPsynergyEnd waits at most for the swelling arcs to end.

Referenced by fdPsynergyEnd().

Definition at line 7 of file script_commands_field_psynergy_state.c.

ANIM_CAST_PSYNERGY_START

#define ANIM_CAST_PSYNERGY_START 20

The caster's casting animations on the party's sprite sheets: ANIM_CAST_PSYNERGY's first two pictures, held on the second, and from the second to its last, held on the last.

Referenced by fdPsynergyStartCast().

Definition at line 12 of file script_commands_field_psynergy_state.c.

ANIM_CAST_PSYNERGY_END

#define ANIM_CAST_PSYNERGY_END 21

Referenced by fdPsynergyStartCast().

Definition at line 13 of file script_commands_field_psynergy_state.c.

FADE_HALF_COLORS

#define FADE_HALF_COLORS 224

A PALETTE_FADE half's colours, the BG's and then the sprites', three channels each.

Definition at line 17 of file script_commands_field_psynergy_state.c.

FADE_HALF_CHANNELS

#define FADE_HALF_CHANNELS (FADE_HALF_COLORS * 3)

Referenced by fdPsynergyFadeToCastColor().

Definition at line 18 of file script_commands_field_psynergy_state.c.

Functions in detail

fdEffectUpdateAllEffectSlots

void fdEffectUpdateAllEffectSlots(void)

Event: updates the field Psynergy sprites.

References fdEffectUpdateEffectSlots().

Referenced by fdPsynergyEnd() and fdPsynergyLoadResources().

Definition at line 21 of file script_commands_field_psynergy_state.c.

fdPsynergyLoadResources

void fdPsynergyLoadResources(Sint32 abilityId, Sint32 mode)

Prepares the state of the field Psynergy for abilityId (HEAP_SLOT_FIELD_EFFECT) and loads its spark tiles; mode is where it runs, an ACTOR_SYSTEM_MODE.

References fdEffectUpdateAllEffectSlots(), fdPsynergySetupActorPair(), fdVRAMCacheCountFreeBlocks(), FieldEffectSparkTiles, gmAbilityGetDefinitionStub(), MainRoutineStateWork, Sint32, state, syHeapSlotAllocate(), sySetEvent(), syVRAMCacheFindFreeEntry() and syVRAMCacheLoad().

Referenced by fdRunPsynergyEndScripts(), fdUseItem(), fdUsePsynergy(), scAltinPeakBeastFreezesSecondPuddle(), scAltmillerCaveRestoreBabiAndInviteParty(), scCottageRoomsBDemonstrateCatch(), scFuchinTempleStartMindReadDemonstration(), scGomaCaveEntranceWhirlwindOnStumpIvy(), scImilMiaCastsPlyOnOldMan(), scLunpaLeaderSneaksOut(), scMercuryLighthouseAerieUnusedAlexCastsPly(), scMercuryLighthouseMiaCastsPlyOnEntrance(), scStartMindRead(), scStartScriptPsynergy() and scWorldMapMeetFlint().

Definition at line 29 of file script_commands_field_psynergy_state.c.

fdPsynergySetupActorPair

void fdPsynergySetupActorPair(Sint32 userId, Sint32 targetId)

Records the caster and the target of a field Psynergy, and where it takes place: on the target, or 16 pixels in front of the caster with none.

References fdActorLookup(), Sint32 and syVectorAddPolarOffset().

Referenced by fdPsynergyLoadResources(), fdPsynergyRun(), fdRunPsynergyEndScripts(), fdUsePsynergy(), scAltinPeakBeastFreezesSecondPuddle(), scAltmillerCaveRestoreBabiAndInviteParty(), scCottageRoomsBDemonstrateCatch(), scFuchinTempleStartMindReadDemonstration(), scGomaCaveEntranceWhirlwindOnStumpIvy(), scImilMiaCastsPlyOnOldMan(), scLunpaLeaderSneaksOut(), scMercuryLighthouseAerieUnusedAlexCastsPly(), scMercuryLighthouseMiaCastsPlyOnEntrance() and scStartMindRead().

Definition at line 79 of file script_commands_field_psynergy_state.c.

fdPsynergyStopCasterUpdate

void fdPsynergyStopCasterUpdate(void)

Stops the caster's update function and restores its colours, then waits a tick.

References fdActorSetSpriteColorModeStub() and sySynch().

Referenced by fdPsynergyPlyOnTarget(), fdPsynergyStartCast(), fdPsynergySteerPushedTarget(), fdRunPsynergyEndScripts(), fdUsePsynergy(), scAltinPeakBeastFreezesSecondPuddle(), scAltmillerCaveRestoreBabiAndInviteParty(), scCottageRoomsBDemonstrateCatch(), scEndMindRead(), scFuchinTempleFinishMindReadDemonstration(), scGomaCaveEntranceWhirlwindOnStumpIvy(), scImilMiaCastsPlyOnOldMan(), scLunpaLeaderSneaksOut(), scMercuryLighthouseAerieUnusedAlexCastsPly() and scMercuryLighthouseMiaCastsPlyOnEntrance().

Definition at line 119 of file script_commands_field_psynergy_state.c.

fdPsynergyEnd

void fdPsynergyEnd(void)

Ends a field Psynergy: frees the field effect sprites still in use and, unless another is being resolved, waits (at most END_ARC_WAIT_TICKS) for the swelling arcs to end, stops the slot event, releases its tiles, restores the map's shake, plays the queued sound and releases its state.

References fdEffectUpdateAllEffectSlots(), fdEffectUpdateScaledArcActorA(), fdEffectUpdateScaledArcActorB(), fdParticleFree(), fdPlayQueuedMusic(), Sint32, state, syCloseEvent(), syHeapSlotRelease(), sySynch() and syVRAMCacheFreeEntry().

Referenced by fdRunPsynergyEndScripts(), fdUseItem(), fdUsePsynergy(), scAltinPeakBeastFreezesSecondPuddle(), scCottageRoomsBDemonstrateCatch(), scEndMindRead(), scEndScriptPsynergy(), scImilMiaCastsPlyOnOldMan(), scMercuryLighthouseAerieUnusedAlexCastsPly() and scWorldMapMeetFlint().

Definition at line 133 of file script_commands_field_psynergy_state.c.

fdPsynergyStartCast

void fdPsynergyStartCast(void)

Starts casting: the caster raises its hand (ANIM_CAST_PSYNERGY_START) and stops; with FLAG_PLAY_PSYNERGY_CAST it goes on to ANIM_CAST_PSYNERGY_END.

References fdActorSelectAnimationStub(), fdActorSetOthersPaused(), fdEffectCycleActorAndSpawnArcs(), fdEffectFlickerActorAndSpawnArcs(), fdPsynergyStopCasterUpdate(), gmFlagGetStub(), mnFieldMessageShowStub(), mnMessageArgumentPushStub(), Sint32, state and sySoundPlayStub().

Referenced by fdUsePsynergy(), scAltinPeakBeastFreezesSecondPuddle(), scAltmillerCaveRestoreBabiAndInviteParty(), scCottageRoomsBDemonstrateCatch(), scFuchinTempleStartMindReadDemonstration(), scGomaCaveEntranceWhirlwindOnStumpIvy(), scImilMiaCastsPlyOnOldMan(), scLunpaLeaderSneaksOut(), scMercuryLighthouseAerieUnusedAlexCastsPly(), scMercuryLighthouseMiaCastsPlyOnEntrance() and scStartMindRead().

Definition at line 201 of file script_commands_field_psynergy_state.c.

fdPsynergyFadeToCastColor

void fdPsynergyFadeToCastColor(void)

Saves the palettes for the Psynergy and fades them toward one of the eight cast colours (FieldPsynergyCastColors), picked by the tick counter or forced by FLAG_PSYNERGY_TINT(0) to (7), over 8 ticks.

References fdPaletteFadeSetTarget(), fdPaletteFadeStartInterpolation(), FieldPsynergyCastColors, gmFlagGetStub(), Sint32, state, syDMAXCopy() and TickCount.

Referenced by fdEffectSpawnBurstParticleField(), fdPsynergyCatch(), fdPsynergyDouse(), fdPsynergyForce(), fdPsynergyFrost(), fdPsynergyHalt(), fdPsynergyLiftOnTarget(), fdPsynergyMove(), fdPsynergyPly(), fdPsynergyRetreat(), fdPsynergyStartMindReadWave(), fdPsynergySteerLiftedTarget(), fdPsynergySteerPushedTarget() and fdPsynergyWhirlwind().

Definition at line 255 of file script_commands_field_psynergy_state.c.

fdPsynergyFadeFromCastColor

void fdPsynergyFadeFromCastColor(void)

Fades the palettes back from a cast's colours to the saved ones over 8 ticks; while Reveal is active the BG half fades to Reveal's grey instead (PALETTE_TINT_GRAYSCALE).

References fdPaletteFadeSetTarget(), fdPaletteFadeStartInterpolation(), Sint32 and state.

Referenced by fdPsynergyCatch(), fdPsynergyDouse(), fdPsynergyForce(), fdPsynergyFrost(), fdPsynergyGrowth(), fdPsynergyGrowthOnTarget(), fdPsynergyHalt(), fdPsynergyLiftOnTarget(), fdPsynergyMove(), fdPsynergyPly(), fdPsynergyRetreat(), fdPsynergySteerLiftedTarget(), fdPsynergySteerPushedTarget(), fdPsynergyStopMindReadWave() and fdPsynergyWhirlwind().

Definition at line 304 of file script_commands_field_psynergy_state.c.

fdCameraWorldToScreen

void fdCameraWorldToScreen(VECTOR3 *pos)

Converts a world position (16.16 pixels) to the screen: x and z receive the screen's x and y and y becomes 0.

References Sint32, state and syConvert3Dto2D().

Referenced by fdDjinnRunJupiterJoinEffect(), fdDjinnRunMarsJoinEffect(), fdDjinnRunMercuryJoinEffect(), fdDjinnRunVenusJoinEffect(), fdEffectRunAngledApproachPhases(), fdEffectUpdateHaltParticle(), fdEffectUpdateMarsSpark(), fdEffectUpdateRadialBurst(), fdEffectUpdateRadialSpread(), fdEffectUpdateRandomTargetParticle(), fdPsynergyForce(), fdPsynergyHalt(), fdPsynergyRetreat(), fdRetreatUpdateSpark() and scAltmillerCaveReleaseWallBurst().

Definition at line 323 of file script_commands_field_psynergy_state.c.