Skip to Content
The Alchemy Project

src/field/script_commands_exit_animations.c

An actor's screen position, the encounter transition, and the context effects of leaving through an exit and arriving. More…

Included by script_commands.c.

Macros

NameDescription
#defineENCOUNTER_CLOSE_TICKS 16The encounter's screen closes over ENCOUNTER_CLOSE_TICKS, and its white flash then fades to black over ENCOUNTER_FADE_TICKS, ENCOUNTER_FADE_STEP levels a tick from just below RGB_LEVEL_MAX.
#defineENCOUNTER_FADE_TICKS 16
#defineENCOUNTER_FADE_STEP 2

Functions

NameDescription
Sint32fdActorGetScreenPos (Sint32 actorId, Sint32 *pos)Writes the actor's position on screen, in pixels, to position[0] and position[1]; an actor with a sprite is raised by its tick box.
voidfdStartEncounterTransition (Sint32 unused)Starts the transition into a random battle: plays the scene's battle music and the encounter sounds, closes the screen and flashes the backdrop white, fading it to black.
void *fdSpriteAddAnimationStub (void *, Sint32)Stub calls the parts make, each passing its own view of the record: fdSpriteAddAnimation and fdSpriteAnimationStart (field.c, resource_slot/) take the metadata slot state and the animation entry.
voidfdExitPrepareActorAnimation (Sint32 actorId, Sint32 side)fdExitPrepareAnimation for any actor: centres the actor on its metatile at the metatile's south edge, stops it, hides its shadow and plays ANIM_LEADER_LEAVE (side 1) or ANIM_LEADER_LEAVE_ALTERNATE over 18 ticks, its sprite gaining the doorway (SPRITE_DOORWAY) as a second part.
voidfdExitPrepareAnimation (Sint32 animation)Starts the leader's animation for leaving through an exit: centres it on its metatile, at the metatile's south edge, stops it and plays animation over 18 ticks, its sprite gaining the doorway (SPRITE_DOORWAY) as a second part.
voidfdExitStartStairsUp (void)Leaves through a stairs-up exit (ANIM_LEADER_LEAVE); FLAG_ARRIVAL_STAIRS_UP makes the next scene play the matching arrival (fdEntrancePlayArrival).
voidfdExitStartStairsDown (void)Leaves through a stairs-down exit (ANIM_LEADER_LEAVE_ALTERNATE), recorded in FLAG_ARRIVAL_STAIRS_DOWN.
voidfdEntranceEndArrivalAnimation (Sint32 animation)Plays the leader's arrival animation through an exit: centred on its metatile at the metatile's north edge, the leader plays animation for 30 ticks, loses the doorway (SPRITE_DOORWAY) and walks 8 pixels south.
Sint32fdEntrancePlayArrival (void)Plays the leader's arrival for the way the last scene was left: through a stairs-up exit (FLAG_ARRIVAL_STAIRS_UP) or a stairs-down one (FLAG_ARRIVAL_STAIRS_DOWN), or falling in from 160 pixels above (FLAG_ARRIVE_FALLING).
voidfdExitAddHiddenLeaderLayer (void)An EXIT_STYLE_HIDDEN_LAYER exit: gives the leader's sprite a second part, SPRITE_HIDDEN_LAYER, a band over the top 8 rows of its 32 by 32 picture, drawn in SPRITE_COLOR_HIDDEN.

Description

An actor's screen position, the encounter transition, and the context effects of leaving through an exit and arriving. Part of script_commands.c.

Macros in detail

ENCOUNTER_CLOSE_TICKS

#define ENCOUNTER_CLOSE_TICKS 16

The encounter's screen closes over ENCOUNTER_CLOSE_TICKS, and its white flash then fades to black over ENCOUNTER_FADE_TICKS, ENCOUNTER_FADE_STEP levels a tick from just below RGB_LEVEL_MAX.

Referenced by fdStartEncounterTransition().

Definition at line 33 of file script_commands_exit_animations.c.

ENCOUNTER_FADE_TICKS

#define ENCOUNTER_FADE_TICKS 16

Referenced by fdStartEncounterTransition().

Definition at line 34 of file script_commands_exit_animations.c.

ENCOUNTER_FADE_STEP

#define ENCOUNTER_FADE_STEP 2

Referenced by fdStartEncounterTransition().

Definition at line 35 of file script_commands_exit_animations.c.

Functions in detail

fdActorGetScreenPos

Sint32 fdActorGetScreenPos(Sint32 actorId, Sint32 *pos)

Writes the actor's position on screen, in pixels, to position[0] and position[1]; an actor with a sprite is raised by its tick box. Returns -1 when the actor does not exist.

References fdActorLookup(), fdMapStateView(), fdResourceGetMetadataRecordStubStub() and Sint32.

Referenced by fdMessageShowAtActor().

Definition at line 7 of file script_commands_exit_animations.c.

fdStartEncounterTransition

void fdStartEncounterTransition(Sint32 unused)

Starts the transition into a random battle: plays the scene's battle music and the encounter sounds, closes the screen and flashes the backdrop white, fading it to black.

References fdScreenTransitionFinish(), MainRoutineStateWork, Sint32, sySoundPlayStub() and sySynch().

Referenced by fdEngineRun().

Definition at line 40 of file script_commands_exit_animations.c.

fdExitPrepareActorAnimation

void fdExitPrepareActorAnimation(Sint32 actorId, Sint32 side)

fdExitPrepareAnimation for any actor: centres the actor on its metatile at the metatile's south edge, stops it, hides its shadow and plays ANIM_LEADER_LEAVE (side 1) or ANIM_LEADER_LEAVE_ALTERNATE over 18 ticks, its sprite gaining the doorway (SPRITE_DOORWAY) as a second part.

References fdActorLookup(), fdActorSelectAnimationStub(), fdSpriteAddAnimationStub(), Sint32 and sySynch().

Referenced by scVenusLighthouseFelixLeaves() and scVenusLighthouseGoDownStairs().

Definition at line 96 of file script_commands_exit_animations.c.

fdExitPrepareAnimation

void fdExitPrepareAnimation(Sint32 animation)

Starts the leader's animation for leaving through an exit: centres it on its metatile, at the metatile's south edge, stops it and plays animation over 18 ticks, its sprite gaining the doorway (SPRITE_DOORWAY) as a second part.

References fdActorLookup(), fdActorSelectAnimationStub(), fdSpriteAddAnimationStub(), MainRoutineStateWork, Sint32 and sySynch().

Referenced by fdExitStartStairsDown() and fdExitStartStairsUp().

Definition at line 128 of file script_commands_exit_animations.c.

fdExitStartStairsUp

void fdExitStartStairsUp(void)

Leaves through a stairs-up exit (ANIM_LEADER_LEAVE); FLAG_ARRIVAL_STAIRS_UP makes the next scene play the matching arrival (fdEntrancePlayArrival).

References fdExitPrepareAnimation() and syGameFlagSet().

Referenced by fdRunStepCueOrExit() and scTrialRoadTakeStairs().

Definition at line 159 of file script_commands_exit_animations.c.

fdExitStartStairsDown

void fdExitStartStairsDown(void)

Leaves through a stairs-down exit (ANIM_LEADER_LEAVE_ALTERNATE), recorded in FLAG_ARRIVAL_STAIRS_DOWN.

References fdExitPrepareAnimation() and syGameFlagSet().

Referenced by fdRunStepCueOrExit().

Definition at line 167 of file script_commands_exit_animations.c.

fdEntranceEndArrivalAnimation

void fdEntranceEndArrivalAnimation(Sint32 animation)

Plays the leader's arrival animation through an exit: centred on its metatile at the metatile's north edge, the leader plays animation for 30 ticks, loses the doorway (SPRITE_DOORWAY) and walks 8 pixels south.

References fdActorLookup(), fdActorSelectAnimationStub(), fdActorWaitForMoveStub(), fdSpriteAddAnimationStub(), fdSpriteAnimationClearStub(), MainRoutineStateWork, Sint32 and sySynch().

Referenced by fdEntrancePlayArrival().

Definition at line 176 of file script_commands_exit_animations.c.

fdEntrancePlayArrival

Sint32 fdEntrancePlayArrival(void)

Plays the leader's arrival for the way the last scene was left: through a stairs-up exit (FLAG_ARRIVAL_STAIRS_UP) or a stairs-down one (FLAG_ARRIVAL_STAIRS_DOWN), or falling in from 160 pixels above (FLAG_ARRIVE_FALLING). Returns the ENTRANCE_ARRIVAL it played.

References fdActorLookup(), fdActorSelectAnimationStub(), fdCameraFollowActor(), fdCameraMoveWithinMapBounds(), fdEntranceEndArrivalAnimation(), fdScriptWait(), MainRoutineStateWork, result, Sint32, syGameFlagClear(), syGameFlagGet(), sySoundPlayStub() and sySynch().

Referenced by fdEngineRun().

Definition at line 205 of file script_commands_exit_animations.c.

fdExitAddHiddenLeaderLayer

void fdExitAddHiddenLeaderLayer(void)

An EXIT_STYLE_HIDDEN_LAYER exit: gives the leader's sprite a second part, SPRITE_HIDDEN_LAYER, a band over the top 8 rows of its 32 by 32 picture, drawn in SPRITE_COLOR_HIDDEN.

References fdActorLookup(), fdSpriteAddAnimationStub() and MainRoutineStateWork.

Referenced by fdRunStepCueOrExit().

Definition at line 257 of file script_commands_exit_animations.c.