Skip to Content
The Alchemy Project

src/field/field_engine_cues.c

Finding and running a scene's cues: talking, step cues, examine cues. More…

Included by field_engine.c.

Macros

NameDescription
#defineEXAMINE_TARGET (kind) (((kind) >> 4) & 0x1f)EXAMINE_CUE() packs it into.
#definePSYNERGY_STONE_PP 1999The PP a Psynergy Stone gives each party member, enough to fill it: "The party's PP is fully restored!"
#defineANIM_PSYNERGY_STONE_SHATTER 2The Psynergy Stone sprite's animation once it is used: it breaks into pieces that scatter as sparkles, then is gone (psynergy_stone.png's pictures 7 to 10).
#defineENCOUNTER_ZONE_MIMIC 104The encounter zone whose slots hold the Mimics' formations; Mimics past its ENCOUNTER_ZONE_SLOTS go on in the next zone.
#defineENCOUNTER_ZONE_SLOTS 8

Functions

NameDescription
ACTION_DESCRIPTOR *fdFindActorPlacement (Sint32 id)Finds actor id's row in the scene's four actor placement tables, or NULL: an id below ACTOR_FIRST_PLACED is the row of that sprite, a later one the row of that place among the placed actors' rows, counted in order.
Sint32fdGameFlagIsConditionActive (Sint32 condition)Returns whether a script condition holds: -1 always holds; a condition with CONDITION_FLAG_SET holds while that flag is set, any other while its flag is clear.
CUE_VIEW *fdFindCue (Sint32 kind, Sint32 target)Returns the first of the scene's cues of kind for target whose condition holds and whose push (STEP_CUE_FLAG_WALKING) and facing (CUE_FLAG_FACING) requirements are met, or NULL.
voidfdOverlayCallInit (void)Unused: runs the loaded overlay's initialize entry; nothing calls it.
void *fdFindActorTalkCue (Sint32 id)Returns the talk cue of actor id, or NULL: for the actor Halt has stopped (MainRoutineStateWork.haltedActor), its CUE_TALK_HALTED cue if it has one, the script for talking to it while it is stopped.
Sint32fdSpeakerGetHaltedLines (Sint32 id)Returns SPEAKER_DEFINITION.haltedLines of actor id's sprite: the pair of lines fdTalkToActor gives it while Halted, or SPEAKER_HALTED_LINES_NONE when Halt passes it over (fdPsynergyFilterHaltTarget).
Sint32fdTalkToActor (Sint32 id)Talks to actor id.
Sint32fdRunRaisedCue (Sint32 id)Runs the scene's raised cue (CUE_RAISED) for id: its message or its function.
Sint32fdRunStepCueOrExit (Sint32 value)Runs the step cue of what the leader touched, or else takes its exit: plays the exit's sound (and effect) and records where it leads.
Sint32fdRunPushMetatile (Sint32 attributes)Runs the push metatile the leader pushes against (attributes, its metatile's attribute bits) once it has pushed for more than FIELD_PUSH_TICKS, idle while MainRoutineStateWork.sandActive is set: a MAP_METATILE_LEDGE with KEY_DOWN held jumps down it, a MAP_METATILE_JUMP jumps forward, a MAP_METATILE_CLIMBABLE climbs down or up by the key held, and a MAP_METATILE_PUSH pushes the actor ahead, running the scene's CUE_PUSH cue for it and CUE_PUSHED for the metatile.
Sint32fdExamineMetatile (Sint32 id)The search command.

Description

Finding and running a scene's cues: talking, step cues, examine cues. Part of field_engine.c.

Macros in detail

EXAMINE_TARGET

#define EXAMINE_TARGET(kind) (((kind) >> 4) & 0x1f)

EXAMINE_CUE() packs it into.

Referenced by fdExamineMetatile().

Definition at line 10 of file field_engine_cues.c.

PSYNERGY_STONE_PP

#define PSYNERGY_STONE_PP 1999

The PP a Psynergy Stone gives each party member, enough to fill it: "The party's PP is fully restored!"

Referenced by fdTalkToActor().

Definition at line 13 of file field_engine_cues.c.

ANIM_PSYNERGY_STONE_SHATTER

#define ANIM_PSYNERGY_STONE_SHATTER 2

The Psynergy Stone sprite's animation once it is used: it breaks into pieces that scatter as sparkles, then is gone (psynergy_stone.png's pictures 7 to 10).

Referenced by fdTalkToActor().

Definition at line 17 of file field_engine_cues.c.

ENCOUNTER_ZONE_MIMIC

#define ENCOUNTER_ZONE_MIMIC 104

The encounter zone whose slots hold the Mimics' formations; Mimics past its ENCOUNTER_ZONE_SLOTS go on in the next zone.

Referenced by fdTalkToActor().

Definition at line 21 of file field_engine_cues.c.

ENCOUNTER_ZONE_SLOTS

#define ENCOUNTER_ZONE_SLOTS 8

Referenced by fdTalkToActor().

Definition at line 22 of file field_engine_cues.c.

Functions in detail

fdFindActorPlacement

ACTION_DESCRIPTOR *fdFindActorPlacement(Sint32 id)

Finds actor id's row in the scene's four actor placement tables, or NULL: an id below ACTOR_FIRST_PLACED is the row of that sprite, a later one the row of that place among the placed actors' rows, counted in order.

References Sint32.

Referenced by fdDjinnResolvePending(), fdDjinnRestoreActorAfterBattle(), fdEffectCopyWatchedActorPos(), fdMessageShowAtActorAndWait(), fdPsynergyUpdateMindReadWave(), fdScriptAskYesNoWithActorAnimation() and fdTalkToActor().

Definition at line 27 of file field_engine_cues.c.

fdGameFlagIsConditionActive

Sint32 fdGameFlagIsConditionActive(Sint32 condition)

Returns whether a script condition holds: -1 always holds; a condition with CONDITION_FLAG_SET holds while that flag is set, any other while its flag is clear.

References Sint32 and syGameFlagGet().

Referenced by fdCheckExitRegions(), fdExamineMetatile(), fdFindCue(), fdFindItemCue(), fdFindPsynergyCue(), fdScriptSpawnActorTable(), fdSelectPsynergyTarget() and fdTalkToActor().

Definition at line 68 of file field_engine_cues.c.

fdFindCue

CUE_VIEW *fdFindCue(Sint32 kind, Sint32 target)

Returns the first of the scene's cues of kind for target whose condition holds and whose push (STEP_CUE_FLAG_WALKING) and facing (CUE_FLAG_FACING) requirements are met, or NULL. CUE_PUSH and CUE_PUSHED, the cues fdRunPushMetatile runs for an actor pushed and for the metatile pushed against, answer any target; the facing test alone is skipped while MainRoutineStateWork.movementMode is LEADER_MOVEMENT_KEYS.

References fdActorLookup(), fdGameFlagIsConditionActive(), MainRoutineStateWork and Sint32.

Referenced by fdActorGetCueMetatileAheadOfCurrent(), fdExamineMetatile(), fdFindActorTalkCue(), fdRunPushMetatile(), fdRunRaisedCue(), fdRunStepCueOrExit() and fdTalkToActor().

Definition at line 90 of file field_engine_cues.c.

fdOverlayCallInit

void fdOverlayCallInit(void)

Unused: runs the loaded overlay's initialize entry; nothing calls it.

Definition at line 157 of file field_engine_cues.c.

fdFindActorTalkCue

void *fdFindActorTalkCue(Sint32 id)

Returns the talk cue of actor id, or NULL: for the actor Halt has stopped (MainRoutineStateWork.haltedActor), its CUE_TALK_HALTED cue if it has one, the script for talking to it while it is stopped.

References fdFindCue(), MainRoutineStateWork and Sint32.

Referenced by fdEngineRun() and fdPsynergyRun().

Definition at line 165 of file field_engine_cues.c.

fdTalkToActor

Sint32 fdTalkToActor(Sint32 id)

Talks to actor id. A container (actors from FIELD_TREASURE_ACTOR, and the Scoop spot, SCOOPED_ITEM_ACTOR) is checked instead: a chest gives what it holds, a Mimic starts its battle, a Psynergy Stone restores the party's PP and a stone tablet teaches its summon. Any other actor shows its script's message or calls its script function, stopped and turned as its placement says; the actor Halt has stopped answers its CUE_TALK_HALTED cue first.

References ActorFaceWatchedScript, ActorStepAngleScript, fdActorGetById(), fdActorGetSpriteShape(), fdActorReleaseIfPresent(), fdActorReleaseStub(), fdActorSelectAnimationStub(), fdActorSetAnimationSpeedStub(), fdActorSetMovementType(), fdActorSetPosAndResetMotionStub(), fdActorStartScriptStub(), fdActorTurnToFaceEachOther(), fdEncounterGetFormationAtSlot(), fdEncounterSelectBattleMusic(), fdFindActorPlacement(), fdFindCue(), fdGameFlagIsConditionActive(), fdItemDisplayEmitSparkles(), fdItemDisplayRaiseAboveLeader(), fdItemDisplayShowItemInFront(), fdLeaderStopMoving(), fdPartyAddPp(), fdPsynergyResumeHaltedActor(), fdSceneItemGetRows(), fdScriptEnd(), fdScriptEndLastingPsynergy(), fdScriptRunMessage(), fdScriptStart(), fdScriptWait(), fdSpeakerGetHaltedLines(), fdSummonTabletPlayRunes(), fdTreasureSpotCloseChest(), fdTreasureSpotGetActor(), fdTreasureSpotLaunchMimic(), fdTreasureSpotOpenChest(), fdTreasureSpotOpenEmptyChest(), fdTreasureSpotRemove(), fdTreasureSpotShowOpened(), gmPartyAdjustCoinsStub(), gmPartyCountMembersStub(), gmPartyFindOwnerWithActionStub(), gmPartyInventoryAddStub(), gmSummonLearnStub(), MainRoutineStateWork, mnFieldMessageShowStub(), mnMessageArgumentPushStub(), mnMessageSetDecodeFlagsStub(), mnPartyStatusCloseStub(), mnPartyStatusCreateWindowStub(), mnSummonShowLearnedMessageStub() and 6 more.

Referenced by fdEngineRun(), scGabombaCatacombsTalkToStatue(), scGaiaRockCheckAltar(), scGaiaRockInsideFindCloudBrand() and scWorldMapGazeIntoPond().

Definition at line 192 of file field_engine_cues.c.

fdRunRaisedCue

Sint32 fdRunRaisedCue(Sint32 id)

Runs the scene's raised cue (CUE_RAISED) for id: its message or its function. Returns 0 when a script ran, -1 when there was none.

References fdFindCue(), fdScriptRunMessage(), result and Sint32.

Referenced by fdEngineRun().

Definition at line 581 of file field_engine_cues.c.

fdRunStepCueOrExit

Sint32 fdRunStepCueOrExit(Sint32 value)

Runs the step cue of what the leader touched, or else takes its exit: plays the exit's sound (and effect) and records where it leads. Returns 0 when something ran, -1 when there was nothing.

References fdExitAddHiddenLeaderLayer(), fdExitStartStairsDown(), fdExitStartStairsUp(), fdFindCue(), fdScriptRunMessage(), Sint32 and sySoundPlayStub().

Referenced by fdEngineRun().

Definition at line 605 of file field_engine_cues.c.

fdRunPushMetatile

Sint32 fdRunPushMetatile(Sint32 attributes)

Runs the push metatile the leader pushes against (attributes, its metatile's attribute bits) once it has pushed for more than FIELD_PUSH_TICKS, idle while MainRoutineStateWork.sandActive is set: a MAP_METATILE_LEDGE with KEY_DOWN held jumps down it, a MAP_METATILE_JUMP jumps forward, a MAP_METATILE_CLIMBABLE climbs down or up by the key held, and a MAP_METATILE_PUSH pushes the actor ahead, running the scene's CUE_PUSH cue for it and CUE_PUSHED for the metatile. Always returns 0.

References fdActorJumpDownLedge(), fdClimbDown(), fdClimbUp(), fdFindCue(), fdFindNearbyTalkTarget(), fdLeaderCanPushObjectAhead(), fdLeaderPushObjectAhead(), fdScriptRunMessage(), fdTryJumpForward(), MainRoutineStateWork, result and Sint32.

Referenced by fdEngineRun().

Definition at line 664 of file field_engine_cues.c.

fdExamineMetatile

Sint32 fdExamineMetatile(Sint32 id)

The search command. METATILE_BEHAVIOR_JAR to METATILE_BEHAVIOR_WELL show their pair of messages from FieldExamineCueMessageOffsets; otherwise the examine cue of the metatile runs: its "checked the ..." message, then its message or callback, or the matching "found nothing" message. MsgTileChecked is the base of the "X checked the Y..." lines, MsgTileResult the base of the "found nothing" lines.

References fdFindCue(), fdGameFlagIsConditionActive(), fdLeaderStopMoving(), FieldExamineCueMessageOffsets, MainRoutineStateWork, mnFieldMessageShowStub(), result, Sint32, syGameFlagClear(), syGameFlagGet() and syGameFlagSet().

Referenced by fdEngineRun().

Definition at line 741 of file field_engine_cues.c.