Finding and running a scene's events: talking, touching, searching. More...
Go to the source code of this file.
Functions | |
| struct ScenePlacement * | Scene_FindActorPlacement (s32 id) |
| Returns the placement of actor id in the scene's placement tables, or NULL: for a party character (0 to 7) the row with its sprite, and for a placed actor (8 on) the row it was created from, counting the placed rows in order. | |
| s32 | GameFlag_IsConditionActive (s32 condition) |
| Returns whether an event condition holds: -1 always holds; a condition with bit 0x1000 holds while that flag is set, any other while its flag is clear. | |
| u32 | Event_SearchIgnoresCondition (s32 flags, s32 result) |
| Returns 1 for a search event (kind 3) that holds whatever its condition: one with more flags than its kind, unless its result is a mimic battle (type 0x005 in its top 12 bits). | |
| struct EffectDescriptor * | Scene_FindEvent (s32 kind, s32 target) |
| Returns the first of the scene's events of kind for target whose condition holds, or NULL. | |
| UNUSED void | Runtime_CallWorkBlockEntry (void) |
| Nothing calls this. | |
| s32 | Scene_FindActorTalkEvent (s32 id) |
| Returns the talk event of actor id: for the actor the party has stopped, its kind 7 event if it has one. | |
| s32 | Scene_TalkToActor (s32 id) |
| Talks to actor id: shows its event's message or calls its event function, with the actor stopped and turned as its placement says. | |
| s32 | Scene_RunRaisedEvent (s32 value) |
| Runs the scene's raised event (kind 6) for value: its message or its function. | |
| s32 | Scene_RunTouchOrExit (s32 value) |
| Runs the touch event (kind 2) of what the leader touched, or else takes its exit (kind 1): plays the exit's sound (and effect) and records where it leads. | |
| s32 | Field_RunPushTileEvent (s32 collisionCode) |
| Runs the event of a tile the leader pushes against (codes 0xf9 and 0xfc to 0xfe), once it has pushed for more than 12 frames; the count then restarts. | |
| s32 | Field_SearchTile (s32 tile) |
| Searches the tile ahead with the given collision code. | |
Finding and running a scene's events: talking, touching, searching.
Part of object.c, the field object, compiled only through it.
Definition in file events.c.
| struct ScenePlacement * Scene_FindActorPlacement | ( | s32 | id | ) |
Returns the placement of actor id in the scene's placement tables, or NULL: for a party character (0 to 7) the row with its sprite, and for a placed actor (8 on) the row it was created from, counting the placed rows in order.
Called by Scene_TalkToActor for the talk facing, and by the field Psynergy effects that read an actor's placement (Mind Read, the Djinni effect, the event messages and the view).
Definition at line 14 of file events.c.
Referenced by BattleFx_CopyLinkedObjectPosition(), Djinn_ResolvePendingEvent(), Event_AskYesNoWithActorAnimation(), FieldEvent_ShowMessageAndWait(), FieldFx_UpdateMindReadWave(), FieldObject_PlaceSceneActors(), Scene_FindActorPlacement(), and Scene_TalkToActor().
Returns whether an event condition holds: -1 always holds; a condition with bit 0x1000 holds while that flag is set, any other while its flag is clear.
Used for every condition column of a scene's tables: events (Scene_FindEvent, Field_SearchTile), placements (Event_SpawnObjectTable), exit regions (Field_CheckExitRegions) and item events.
Definition at line 65 of file events.c.
Referenced by BattleFx_FindMatchingEvent(), Event_SpawnObjectTable(), Field_CheckExitRegions(), Field_FindItemEvent(), Field_SearchTile(), GameFlag_IsConditionActive(), and Scene_FindEvent().
Returns 1 for a search event (kind 3) that holds whatever its condition: one with more flags than its kind, unless its result is a mimic battle (type 0x005 in its top 12 bits).
Called by Scene_FindEvent. Field_SearchTile tests such an event's condition itself (a chest's flag is set once it is opened), so the event is found either way and the leader still checks the spot; a mimic is found only while its condition holds.
Definition at line 86 of file events.c.
Referenced by Event_SearchIgnoresCondition(), and Scene_FindEvent().
| struct EffectDescriptor * Scene_FindEvent | ( | s32 | kind, |
| s32 | target ) |
Returns the first of the scene's events of kind for target whose condition holds, or NULL.
Flag 0x200 also needs the leader to have pushed against it for more than 12 frames (2 with flag 0x800); flag 0x400 needs the leader to face within an eighth of a turn of the direction in the top four bits.
Called by every lookup of a scene's events in this part and by Object_GetTriggerTileAheadOfCurrent. Changes nothing.
Definition at line 111 of file events.c.
Referenced by Field_SearchTile(), Object_GetTriggerTileAheadOfCurrent(), Scene_FindActorTalkEvent(), Scene_FindEvent(), Scene_RunRaisedEvent(), Scene_RunTouchOrExit(), and Scene_TalkToActor().
| UNUSED void Runtime_CallWorkBlockEntry | ( | void | ) |
Nothing calls this.
Definition at line 168 of file events.c.
Referenced by Runtime_CallWorkBlockEntry().
Returns the talk event of actor id: for the actor the party has stopped, its kind 7 event if it has one.
Called by Field_RunScene for the A button, to choose between talking and searching, and by the field Psynergy dispatch.
Definition at line 175 of file events.c.
Referenced by BattleFx_Run(), Field_RunScene(), and Scene_FindActorTalkEvent().
Talks to actor id: shows its event's message or calls its event function, with the actor stopped and turned as its placement says.
For the actor the party has stopped, its kind 7 event comes first; without one, a talk event that is a function gives a random line from MsgPonderEllipsis ("...") instead. Returns 0 when an event ran, -1 when there was none.
Called by Field_RunScene for its talk request (work->descriptor). Resumes the stopped actor and sets gGameState.pausedObject back to -1 afterwards.
Definition at line 197 of file events.c.
Referenced by Field_RunScene(), and Scene_TalkToActor().
Runs the scene's raised event (kind 6) for value: its message or its function.
Returns 0 when an event ran, -1 when there was none.
Called by Field_RunScene for a positive event request (work->event).
Definition at line 301 of file events.c.
Referenced by Field_RunScene(), and Scene_RunRaisedEvent().
Runs the touch event (kind 2) of what the leader touched, or else takes its exit (kind 1): plays the exit's sound (and effect) and records where it leads.
Returns 0 when something ran, -1 when there was nothing.
Called by Field_RunScene for its step request (work->action), which Field_ProcessStep raises for collision codes 1 to 239. Sets work->exit for an exit, and clears work->blockedSteps after a touch that needs pushing.
Definition at line 333 of file events.c.
Referenced by Field_RunScene(), and Scene_RunTouchOrExit().
Runs the event of a tile the leader pushes against (codes 0xf9 and 0xfc to 0xfe), once it has pushed for more than 12 frames; the count then restarts.
Called by Field_RunScene for its push request (work->input), which Field_ProcessStep raises for codes 252 to 254; nothing raises 0xf9 there. Clears work->blockedSteps when it acts.
Definition at line 389 of file events.c.
Referenced by Field_RunPushTileEvent(), and Field_RunScene().
Searches the tile ahead with the given collision code.
Codes 242 to 247 show their two messages. Otherwise the scene's search event for the tile runs: a function, a message, or a chest holding a Psynergy stone, a mimic, coins or an item; with no event, "checked the ground" and "found nothing".
Called by Field_RunScene for its search request (work->tile). Opening a chest sets its condition flag, and it may raise a mimic battle (work->battle), give coins or an item, or restore all PP.
Definition at line 429 of file events.c.
Referenced by Field_RunScene(), and Field_SearchTile().