Skip to Content
The Alchemy Project

src/field/field_engine_item_display.c

Showing a found item, and Reveal's sparkles on hidden things. More…

Included by field_engine.c.

Macros

NameDescription
#defineSPAWN_SPARKLE_NEAR (source)Spawns a sparkle within 16 pixels of source, in a random direction: the sparkling a found item's picture and a Reveal marker share.

Functions

NameDescription
voidfdTreasureSpotMoveLeaderAway (void)Unused: only the stub table refers to it.
static inline voidfdActorInitSparkle (ACTOR *actor)Starts the particle script and its first animation at priority 1, if the spawn succeeded.
voidfdItemDisplayEmitSparkles (ACTOR *emitter)Each tick of a found item's picture: one time in ten, a sparkle appears within 16 pixels of it.
BoolfdIsRevealActive (ACTOR *interpreter)Returns 1 while Reveal is active, else 0.
voidfdRevealEmitSparkles (ACTOR *src)Each tick of a Reveal marker: one time in ten, a sparkle appears within 16 pixels of it, as around a found item's picture (SPAWN_SPARKLE_NEAR).
ACTOR *fdItemDisplayShowItemInFront (Sint32 actorId, Sint32 item)Shows the picture of item 16 pixels above actor actorId, or for the leader at the centre of the metatile 16 pixels in front of them: it rises a little and hangs there, sparkling.
voidfdActorReleaseIfPresent (ACTOR *actor)Releases actor unless it is NULL.
voidfdItemDisplayUnused (void)Unused: an empty function between the item display's own, which nothing calls; The Broken Seal has none here.
voidfdItemDisplayRaiseAboveLeader (ACTOR *actor)Raises a found item's picture to 36 pixels above the party leader, who holds it up (ANIM_LEADER_ARMS_RAISED) facing the screen.
voidfdItemDisplayShowPicture (ACTOR *actor, Sint32 flags)Shows a found item's picture as flags choose (ITEM_DISPLAY_FLAG), with waits of 60 and 80 ticks around its raising when both are set.
voidfdItemDisplayShowItem (Sint32 item, Sint32 flags)Shows the picture of item 36 pixels above the party leader for 80 ticks, as flags choose (ITEM_DISPLAY_FLAG).
voidfdEffectSpawnRevealMarkers (void)Places Reveal's markers from the scene's item rows (a type, a script id, a flag and a pad): for each of the treasure spots' rows whose flag is clear and whose script has not run, a sparkle marker goes at its actor, or at the map metatile of a tile script, when that point is on screen.

Description

Showing a found item, and Reveal's sparkles on hidden things. Part of field_engine.c.

Macros in detail

SPAWN_SPARKLE_NEAR

#define SPAWN_SPARKLE_NEAR(source)

Spawns a sparkle within 16 pixels of source, in a random direction: the sparkling a found item's picture and a Reveal marker share.

Referenced by fdItemDisplayEmitSparkles() and fdRevealEmitSparkles().

Definition at line 54 of file field_engine_item_display.c.

Functions in detail

fdTreasureSpotMoveLeaderAway

void fdTreasureSpotMoveLeaderAway(void)

Unused: only the stub table refers to it. Keeps the party leader off the treasure spots: a leader within 16 pixels of a treasure spot's actor is moved 20 pixels from it, in the direction it stood, and loses its move target.

References fdActorLookup(), fdPartyGetLeaderActor(), Sint32, syAtan() and syVectorAddPolarOffset().

Definition at line 11 of file field_engine_item_display.c.

fdActorInitSparkle

static inline void fdActorInitSparkle(ACTOR *actor)

Starts the particle script and its first animation at priority 1, if the spawn succeeded. Allocation failure leaves the sparkle absent.

References fdActorSelectAnimationStub(), fdActorStartScriptStub(), ItemDisplaySparkleScript and Sint32.

Definition at line 42 of file field_engine_item_display.c.

fdItemDisplayEmitSparkles

void fdItemDisplayEmitSparkles(ACTOR *emitter)

Each tick of a found item's picture: one time in ten, a sparkle appears within 16 pixels of it.

References syRandom().

Referenced by fdItemDisplayShowItem(), fdItemDisplayShowItemInFront(), fdItemDisplayShowPicture() and fdTalkToActor().

Definition at line 72 of file field_engine_item_display.c.

fdIsRevealActive

Bool fdIsRevealActive(ACTOR *interpreter)

Returns 1 while Reveal is active, else 0.

Referenced by RevealMarkerScript.

Definition at line 89 of file field_engine_item_display.c.

fdRevealEmitSparkles

void fdRevealEmitSparkles(ACTOR *src)

void fdRevealEmitSparkles(ACTOR *actor)

Each tick of a Reveal marker: one time in ten, a sparkle appears within 16 pixels of it, as around a found item's picture (SPAWN_SPARKLE_NEAR).

References syRandom().

Referenced by fdItemDisplayShowItemInFront().

Definition at lines 101 and 300 of file field_engine_item_display.c.

fdItemDisplayShowItemInFront

ACTOR *fdItemDisplayShowItemInFront(Sint32 actorId, Sint32 item)

Shows the picture of item 16 pixels above actor actorId, or for the leader at the centre of the metatile 16 pixels in front of them: it rises a little and hangs there, sparkling. While Reveal is active it first releases Reveal's sparkles, and then its mark on the picture's metatile.

References fdActorCreateStub(), fdActorReleaseStub(), fdActorStartScriptStub(), fdItemDisplayEmitSparkles(), fdPartyGetLeaderActor(), fdRevealEmitSparkles(), ItemDisplayGrowInScript, ItemDisplaySparkleScript, mnIconDrawItemStub(), RevealMarkerScript, Sint32, syHeapSlotAllocate(), syHeapSlotRelease(), sySynch(), syVectorAddPolarOffset() and syVRAMCacheLoad().

Referenced by fdChestOpenAndShowItem() and fdTalkToActor().

Definition at line 107 of file field_engine_item_display.c.

fdActorReleaseIfPresent

void fdActorReleaseIfPresent(ACTOR *actor)

Releases actor unless it is NULL.

References fdActorReleaseStub().

Referenced by fdTalkToActor().

Definition at line 194 of file field_engine_item_display.c.

fdItemDisplayUnused

void fdItemDisplayUnused(void)

Unused: an empty function between the item display's own, which nothing calls; The Broken Seal has none here.

Definition at line 202 of file field_engine_item_display.c.

fdItemDisplayRaiseAboveLeader

void fdItemDisplayRaiseAboveLeader(ACTOR *actor)

Raises a found item's picture to 36 pixels above the party leader, who holds it up (ANIM_LEADER_ARMS_RAISED) facing the screen.

References fdActorLookup(), fdActorSelectAnimationStub(), fdActorSetSpritePriorityDirectStub(), fdActorStartScriptStub(), fdPartyGetLeaderActor(), ItemDisplayPulseScript and sySynch().

Referenced by fdItemDisplayShowItem(), fdItemDisplayShowPicture() and fdTalkToActor().

Definition at line 208 of file field_engine_item_display.c.

fdItemDisplayShowPicture

void fdItemDisplayShowPicture(ACTOR *actor, Sint32 flags)

Shows a found item's picture as flags choose (ITEM_DISPLAY_FLAG), with waits of 60 and 80 ticks around its raising when both are set.

References fdActorLookup(), fdActorSelectAnimationStub(), fdActorSetSpriteFlagsStub(), fdActorStartScriptStub(), fdItemDisplayEmitSparkles(), fdItemDisplayRaiseAboveLeader(), fdPartyGetLeaderActor(), ItemDisplayGrowInScript, Sint32 and sySynch().

Referenced by scDailaRoomsTakeSeaGodsTear(), scDehkanPlateauTakePoundCube() and scKandoreanTempleReceiveLash().

Definition at line 236 of file field_engine_item_display.c.

fdItemDisplayShowItem

void fdItemDisplayShowItem(Sint32 item, Sint32 flags)

Shows the picture of item 36 pixels above the party leader for 80 ticks, as flags choose (ITEM_DISPLAY_FLAG).

References fdActorCreateStub(), fdActorLookup(), fdActorReleaseStub(), fdActorSelectAnimationStub(), fdItemDisplayEmitSparkles(), fdItemDisplayRaiseAboveLeader(), fdPartyGetLeaderActor(), mnIconDrawItemStub(), Sint32, syHeapSlotAllocate(), syHeapSlotRelease(), sySynch() and syVRAMCacheLoad().

Referenced by dbShopTestTalkToSunshinesWife(), fdScriptPickUpItem(), scAlhafraFindGoldCoins(), scContigoInitLuckyDice(), scLemuriaSpringGivePrize(), scMadraMeetKarst(), scMagmaRockInsideExamineEmberStone(), scSettlementsCatchApple() and scYallamRoomsTalkToSunshinesWife().

Definition at line 263 of file field_engine_item_display.c.

fdEffectSpawnRevealMarkers

void fdEffectSpawnRevealMarkers(void)

Places Reveal's markers from the scene's item rows (a type, a script id, a flag and a pad): for each of the treasure spots' rows whose flag is clear and whose script has not run, a sparkle marker goes at its actor, or at the map metatile of a tile script, when that point is on screen.

References fdActorCreateStub(), fdActorSelectAnimationStub(), fdActorSetSpriteFlagsStub(), fdActorStartScriptStub(), fdMapGridGetTerrainHeightStub(), fdMapStateView(), fdSceneItemFindPos(), fdSceneItemGetRows(), fdTreasureSpotGetActor(), RevealMarkerScript, Sint32 and syGameFlagGet().

Referenced by fdPsynergyReveal().

Definition at line 312 of file field_engine_item_display.c.