Alchemy
Loading...
Searching...
No Matches

context.c File Reference

An actor's screen position, the encounter transition, context effects. More...

Go to the source code of this file.

Functions

s32 Object_GetScreenPosition (s32 objectId, s32 *position)
 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.
UNUSED void ObjectEffect_ReservedNoOp941DC (void)
s32 Field_StartEncounterTransition (s32 unused)
 Starts the transition into a random battle: plays the scene's battle cue and the encounter sounds, closes the screen and flashes the backdrop white, fading it to black over 16 frames.
void ObjectEffect_PrepareContextEffect (s32 animation)
 Starts the leader's animation for leaving through an exit: centres it on its tile, at the tile's south edge, stops it and plays animation over 18 frames.
void ObjectEffect_BeginContextEffect26 (void)
 Leaves through an exit of kind 0x20 (animation 26); flag 0x120 makes the next scene play the matching arrival (ObjectEffect_RunPendingFlagEvent).
void ObjectEffect_BeginContextEffect25 (void)
 Leaves through an exit of kind 0x30 (animation 25), recorded in flag 0x121.
void ObjectEffect_EndContextEffect (s32 animation)
 Plays the leader's arrival animation through an exit: centred on its tile at the tile's north edge, the leader plays animation for 30 frames, loses the extra sprite part and walks 8 pixels south.
s32 ObjectEffect_RunPendingFlagEvent (void)
 Plays the leader's arrival for the way the last scene was left: through an exit of kind 0x20 (flag 0x120, animation 24, returns 1) or 0x30 (flag 0x121, animation 23, returns 2), or falling in from 160 pixels above (flag 0x122, returns 3).

Detailed Description

An actor's screen position, the encounter transition, context effects.

Part of psynergy_effects.c, compiled only through it.

Definition in file context.c.

Function Documentation

◆ Object_GetScreenPosition()

s32 Object_GetScreenPosition ( s32 objectId,
s32 * position )

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.

Returns 0, or -1 if there is no such actor. Called by the message window code in messages.c to place a speaker's bubble, and through Object_GetScreenPositionFar by the window frames to open a message window above or below the leader.

Definition at line 12 of file context.c.

Referenced by Event_ShowSpeakerMessage(), Object_GetScreenPosition(), and UiText_OpenMessageAtObject().

◆ ObjectEffect_ReservedNoOp941DC()

UNUSED void ObjectEffect_ReservedNoOp941DC ( void )

Definition at line 51 of file context.c.

Referenced by ObjectEffect_ReservedNoOp941DC().

◆ Field_StartEncounterTransition()

s32 Field_StartEncounterTransition ( s32 unused)

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

Called by Field_RunScene when it handles work->battle; clears work->transitionActive once the screen is closed.

Definition at line 62 of file context.c.

Referenced by Field_RunScene(), and Field_StartEncounterTransition().

◆ ObjectEffect_PrepareContextEffect()

void ObjectEffect_PrepareContextEffect ( s32 animation)

Starts the leader's animation for leaving through an exit: centres it on its tile, at the tile's south edge, stops it and plays animation over 18 frames.

The leader's sprite gains a second part (metadata 27) for it. Called by the two ObjectEffect_BeginContextEffect functions below.

Definition at line 101 of file context.c.

Referenced by ObjectEffect_BeginContextEffect25(), ObjectEffect_BeginContextEffect26(), and ObjectEffect_PrepareContextEffect().

◆ ObjectEffect_BeginContextEffect26()

void ObjectEffect_BeginContextEffect26 ( void )

Leaves through an exit of kind 0x20 (animation 26); flag 0x120 makes the next scene play the matching arrival (ObjectEffect_RunPendingFlagEvent).

Called by the exit handling in events.c, after it plays SE_128.

Definition at line 131 of file context.c.

Referenced by ObjectEffect_BeginContextEffect26(), and Scene_RunTouchOrExit().

◆ ObjectEffect_BeginContextEffect25()

void ObjectEffect_BeginContextEffect25 ( void )

Leaves through an exit of kind 0x30 (animation 25), recorded in flag 0x121.

Called by the exit handling in events.c, after it plays SE_129.

Definition at line 138 of file context.c.

Referenced by ObjectEffect_BeginContextEffect25(), and Scene_RunTouchOrExit().

◆ ObjectEffect_EndContextEffect()

void ObjectEffect_EndContextEffect ( s32 animation)

Plays the leader's arrival animation through an exit: centred on its tile at the tile's north edge, the leader plays animation for 30 frames, loses the extra sprite part and walks 8 pixels south.

Called by ObjectEffect_RunPendingFlagEvent; frees the sprite part ObjectEffect_PrepareContextEffect registered.

Definition at line 148 of file context.c.

Referenced by ObjectEffect_EndContextEffect(), and ObjectEffect_RunPendingFlagEvent().

◆ ObjectEffect_RunPendingFlagEvent()

s32 ObjectEffect_RunPendingFlagEvent ( void )

Plays the leader's arrival for the way the last scene was left: through an exit of kind 0x20 (flag 0x120, animation 24, returns 1) or 0x30 (flag 0x121, animation 23, returns 2), or falling in from 160 pixels above (flag 0x122, returns 3).

Returns 0 when there is nothing to play. Called by Field_RunScene as the scene fades in, which waits out the fade itself only when this returns 0. Clears the flag it acts on.

Definition at line 181 of file context.c.

Referenced by Field_RunScene(), and ObjectEffect_RunPendingFlagEvent().