Skip to Content
The Alchemy Project

src/field/field_engine_items.c

Using an item on the field. More…

Included by field_engine.c.

Typedefs

NameDescription
typedef Sint32 (*ITEM_CUE_CALLBACK )(Sint32 item, Sint32 actorId, Sint32 slot);The function a scene's item cue may name instead of a message, called with the item, its user and its inventory slot; its result is not read.

Functions

NameDescription
const CUE *fdFindItemCue (Sint32 item)Returns the scene's item cue (CUE_ITEM) for item that applies to what the leader faces, or 0 (item 0 matches any item).
Sint32fdUseItem (Sint32 packedItem, Sint32 slot)Uses an item on the field. packedItem holds the item (bits 0 to 9) and the character using it (bits 10 to 13; UNIT_NONE for whoever holds it in the most inventory slots); slot is its inventory slot.
void *fdFindPsynergyCue (Sint32 eventFlags, Sint32 group, Sint32 *target)Returns the scene's Psynergy cue (CUE_PSYNERGY) for Psynergy of the given group that applies to what the leader faces, or NULL; stores the actor the Psynergy would target in *target. eventFlags gives the script's phase and kind (PSYNERGY_CUE_ANY for any phase).
Sint32fdRunPsynergyEndScripts (Sint32 packed)Runs the scene's scripts for Psynergy without paying its PP or showing its usual effect (PSYNERGY_PHASE_BEFORE_END and PSYNERGY_PHASE_AFTER_END, around the kind's ending), as for a Psynergy that ends by itself: packed holds the Psynergy (bits 0 to 9) and its user (bits 10 to 13).

Description

Using an item on the field. Part of field_engine.c.

Typedefs in detail

ITEM_CUE_CALLBACK

typedef Sint32 (*ITEM_CUE_CALLBACK)(Sint32 item, Sint32 actorId, Sint32 slot);

The function a scene's item cue may name instead of a message, called with the item, its user and its inventory slot; its result is not read.

Referenced by fdUseItem().

Definition at line 7 of file field_engine_items.c.

Functions in detail

fdFindItemCue

const CUE *fdFindItemCue(Sint32 item)

Returns the scene's item cue (CUE_ITEM) for item that applies to what the leader faces, or 0 (item 0 matches any item).

References fdActorLookup(), fdFindNearbyTalkTarget(), fdGameFlagIsConditionActive(), fdGetCollisionAheadOfLeader(), MainRoutineStateWork, Sint32 and state.

Referenced by fdHasItemCue() and fdUseItem().

Definition at line 11 of file field_engine_items.c.

fdUseItem

Sint32 fdUseItem(Sint32 packedItem, Sint32 slot)

Uses an item on the field. packedItem holds the item (bits 0 to 9) and the character using it (bits 10 to 13; UNIT_NONE for whoever holds it in the most inventory slots); slot is its inventory slot.

References fdFindItemCue(), fdFindNearbyTalkTarget(), fdPsynergyEnd(), fdPsynergyLoadResources(), fdPsynergyRun(), fdScriptEnd(), fdScriptSetMessageId(), fdScriptShowMessageAndWait(), fdScriptStart(), fdYesNoAsk(), gmFlagClearStub(), gmFlagGetStub(), gmFlagSetStub(), gmInventoryRemoveStub(), gmItemGetDefinitionStub(), gmPartyCountMembersStub(), gmUnitGetStub(), MainRoutineStateWork, mnFieldMessageShowStub(), mnMessageArgumentPushStub(), mnMessageCloseFinishedWindowsStub(), Sint32 and state.

Referenced by fdEngineRun().

Definition at line 61 of file field_engine_items.c.

fdFindPsynergyCue

void *fdFindPsynergyCue(Sint32 eventFlags, Sint32 group, Sint32 *target)

Returns the scene's Psynergy cue (CUE_PSYNERGY) for Psynergy of the given group that applies to what the leader faces, or NULL; stores the actor the Psynergy would target in *target. eventFlags gives the script's phase and kind (PSYNERGY_CUE_ANY for any phase).

References fdActorLookup(), fdFindNearbyPsynergyTarget(), fdGameFlagIsConditionActive(), fdGetCollisionAheadOfLeader(), gmAbilityGetDefinitionStub(), MainRoutineStateWork, Sint32 and state.

Referenced by fdHasPsynergyCue(), fdPsynergyEndReveal(), fdPsynergyForce(), fdPsynergyFrost(), fdPsynergyReveal(), fdRunPsynergyEndScripts() and fdUsePsynergy().

Definition at line 226 of file field_engine_items.c.

fdRunPsynergyEndScripts

Sint32 fdRunPsynergyEndScripts(Sint32 packed)

Runs the scene's scripts for Psynergy without paying its PP or showing its usual effect (PSYNERGY_PHASE_BEFORE_END and PSYNERGY_PHASE_AFTER_END, around the kind's ending), as for a Psynergy that ends by itself: packed holds the Psynergy (bits 0 to 9) and its user (bits 10 to 13).

References fdActorLookup(), fdFindPsynergyCue(), fdPsynergyEnd(), fdPsynergyLoadResources(), fdPsynergyRunEnd(), fdPsynergySetupActorPair(), fdPsynergyStopCasterUpdate(), fdRunPsynergyScript(), gmAbilityGetDefinitionStub(), MainRoutineStateWork and Sint32.

Referenced by fdEndBusyAndReveal() and fdUsePsynergy().

Definition at line 283 of file field_engine_items.c.