Skip to Content
The Alchemy Project

src/field/script_commands_exit_animations.c

An actor's screen position, the encounter transition, and the leader 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)Finds where an actor is on screen: position[0] and position[1] receive its x and y in pixels, y at the top of its sprite.
voidfdExitNoOperation (void)
UNREAD_RESULTfdStartEncounterTransition (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.
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.
voidfdExitStartStairsUp (void)Leaves through an EXIT_STYLE_STAIRS_UP exit (ANIM_LEADER_LEAVE); FLAG_ARRIVAL_STAIRS_UP makes the next scene play the matching arrival (fdEntrancePlayArrival).
voidfdExitStartStairsDown (void)Leaves through an EXIT_STYLE_STAIRS_DOWN exit (ANIM_LEADER_LEAVE_ALTERNATE), recorded in FLAG_ARRIVAL_STAIRS_DOWN.
voidfdEntrancePlayArrivalAnimation (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 hidden doorway part and walks 8 pixels south.
Sint32fdEntrancePlayArrival (void)Plays the leader's arrival for the way the last scene was left: through a EXIT_STYLE_STAIRS_UP exit (FLAG_ARRIVAL_STAIRS_UP, ANIM_LEADER_ARRIVE, returns 1) or a EXIT_STYLE_STAIRS_DOWN one (FLAG_ARRIVAL_STAIRS_DOWN, ANIM_LEADER_ARRIVE_ALTERNATE, returns 2), or falling in from 160 pixels above (FLAG_ARRIVE_FALLING, returns 3).

Description

An actor's screen position, the encounter transition, and the leader 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 40 of file script_commands_exit_animations.c.

ENCOUNTER_FADE_TICKS

#define ENCOUNTER_FADE_TICKS 16

Referenced by fdStartEncounterTransition().

Definition at line 41 of file script_commands_exit_animations.c.

ENCOUNTER_FADE_STEP

#define ENCOUNTER_FADE_STEP 2

Referenced by fdStartEncounterTransition().

Definition at line 42 of file script_commands_exit_animations.c.

Functions in detail

fdActorGetScreenPos

Sint32 fdActorGetScreenPos(Sint32 actorId, Sint32 *pos)

Finds where an actor is on screen: position[0] and position[1] receive its x and y in pixels, y at the top of its sprite.

References fdActorLookup(), fdMapGridScrollStateView(), Sint32 and syResourceGetMetadataRecordStub().

Referenced by fdMessageShowAtActor() and fdScriptShowSpeakerMessage().

Definition at line 8 of file script_commands_exit_animations.c.

fdExitNoOperation

void fdExitNoOperation(void)

Definition at line 33 of file script_commands_exit_animations.c.

fdStartEncounterTransition

UNREAD_RESULT 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, state, sySoundPlayStub() and sySynch().

Referenced by fdEngineRun().

Definition at line 47 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.

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

Referenced by fdExitStartStairsDown() and fdExitStartStairsUp().

Definition at line 100 of file script_commands_exit_animations.c.

fdExitStartStairsUp

void fdExitStartStairsUp(void)

Leaves through an EXIT_STYLE_STAIRS_UP exit (ANIM_LEADER_LEAVE); FLAG_ARRIVAL_STAIRS_UP makes the next scene play the matching arrival (fdEntrancePlayArrival).

References fdExitPrepareAnimation() and gmFlagSetStub().

Referenced by fdRunStepCueOrExit().

Definition at line 132 of file script_commands_exit_animations.c.

fdExitStartStairsDown

void fdExitStartStairsDown(void)

Leaves through an EXIT_STYLE_STAIRS_DOWN exit (ANIM_LEADER_LEAVE_ALTERNATE), recorded in FLAG_ARRIVAL_STAIRS_DOWN.

References fdExitPrepareAnimation() and gmFlagSetStub().

Referenced by fdRunStepCueOrExit().

Definition at line 140 of file script_commands_exit_animations.c.

fdEntrancePlayArrivalAnimation

void fdEntrancePlayArrivalAnimation(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 hidden doorway part and walks 8 pixels south.

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

Referenced by fdEntrancePlayArrival().

Definition at line 149 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 EXIT_STYLE_STAIRS_UP exit (FLAG_ARRIVAL_STAIRS_UP, ANIM_LEADER_ARRIVE, returns 1) or a EXIT_STYLE_STAIRS_DOWN one (FLAG_ARRIVAL_STAIRS_DOWN, ANIM_LEADER_ARRIVE_ALTERNATE, returns 2), or falling in from 160 pixels above (FLAG_ARRIVE_FALLING, returns 3).

References fdActorLookup(), fdActorSelectAnimationStub(), fdCameraFollowActor(), fdCameraMoveWithinMapBounds(), fdEntrancePlayArrivalAnimation(), fdScriptWait(), gmFlagClearStub(), gmFlagGetStub(), MainRoutineStateWork, Sint32, sySoundPlayStub() and sySynch().

Referenced by fdEngineRun().

Definition at line 179 of file script_commands_exit_animations.c.