Skip to Content
The Alchemy Project

src/field/field_engine_treasure_spots.c

The map's treasure spots: chests and Psynergy Stones. More…

Included by field_engine.c.

Enumerations

NameDescription
enumanonymous enum { TREASURE_SPOT_CHEST_SPRITE, TREASURE_SPOT_PSYNERGY_STONE_SPR … }The sprites of the actors a map's treasure spots place.
enumanonymous enum { TREASURE_SPOT_CHEST_OPEN, TREASURE_SPOT_CHEST_OPENING, TREAS … }The chest sprite's animations.

Functions

NameDescription
voidfdActorSnapToTerrain (void *object)Sets an actor's y and groundHeight to the map's height at its x and z.
voidfdPlaceTreasureSpots (void)Places an actor at each of the map's treasure spots (ids 100 to 239) that the scene has a script for, up to ten: a chest for a chest script, shown open once its flag is set and gone once its mimic was beaten, and a Psynergy Stone for an examine cue giving one, until it is taken.
Sint32fdTreasureSpotFindSlot (Sint32 id)Returns the treasure spot slot (below TREASURE_SPOT_MAX) whose script cue is id, or -1.
voidfdTreasureSpotReservedNoOperation (void)Unused: empty.
static __inline__ voidfdSetMarkerAnimationAndPlaySound (Sint32 id, Sint32 animation, Sint32 sound)Gives the actor of treasure spot id animation, plays sound and waits 12 ticks.
voidfdTreasureSpotCloseChest (Sint32 id)Closes the chest of treasure spot id again (its item could not be carried), with SE_CHEST_CLOSE.
voidfdTreasureSpotLaunchMimic (Sint32 id)Makes the chest of treasure spot id jump up as a mimic: after 18 ticks it turns into the mimic with a cry (SE_ENEMY_CRY) and leaps up at 8 pixels a tick, its shadow showing.
voidfdTreasureSpotOpenChest (Sint32 id)Opens the chest of treasure spot id with SE_CHEST_OPEN, and waits 12 ticks.
voidfdTreasureSpotShowOpened (Sint32 id)Shows the chest of treasure spot id open, with no sound.
ACTOR *fdTreasureSpotGetActor (Sint32 id)Returns the actor of treasure spot id, or NULL when no slot has it.
voidfdTreasureSpotHide (Sint32 id)Hides the actor of treasure spot id; the actor stays in its slot.
voidfdTreasureSpotSetActorPos (Sint32 id, FIXED x, FIXED z)Moves the actor of treasure spot id to (x, z) on the ground; -1 keeps the centre of its metatile on that axis.

Description

The map's treasure spots: chests and Psynergy Stones. Part of field_engine.c.

Enumerations in detail

anonymous enum

enum { TREASURE_SPOT_CHEST_SPRITE, TREASURE_SPOT_PSYNERGY_STONE_SPRITE }

The sprites of the actors a map's treasure spots place.

EnumeratorValueDescription
TREASURE_SPOT_CHEST_SPRITESPRITE_CHEST
TREASURE_SPOT_PSYNERGY_STONE_SPRITESPRITE_PSYNERGY_STONE

Definition at line 18 of file field_engine_treasure_spots.c.

anonymous enum

enum { TREASURE_SPOT_CHEST_OPEN, TREASURE_SPOT_CHEST_OPENING, TREASURE_SPOT_CHEST_CLOSING, TREASURE_SPOT_CHEST_MIMIC }

The chest sprite's animations.

EnumeratorValueDescription
TREASURE_SPOT_CHEST_OPEN2standing open
TREASURE_SPOT_CHEST_OPENING4
TREASURE_SPOT_CHEST_CLOSING5closing again on what nobody could carry
TREASURE_SPOT_CHEST_MIMIC7jumping up as a mimic

Definition at line 25 of file field_engine_treasure_spots.c.

Functions in detail

fdActorSnapToTerrain

void fdActorSnapToTerrain(void *object)

Sets an actor's y and groundHeight to the map's height at its x and z.

References fdMapGridGetTerrainHeightStub() and Sint32.

Referenced by fdPlaceTreasureSpots().

Definition at line 6 of file field_engine_treasure_spots.c.

fdPlaceTreasureSpots

void fdPlaceTreasureSpots(void)

Places an actor at each of the map's treasure spots (ids 100 to 239) that the scene has a script for, up to ten: a chest for a chest script, shown open once its flag is set and gone once its mimic was beaten, and a Psynergy Stone for an examine cue giving one, until it is taken.

References fdActorCreateStub(), fdActorReleaseStub(), fdActorSelectAnimationStub(), fdActorSetSpriteFlagsStub(), fdActorSnapToTerrain(), fdActorStartIdleStub(), gmFlagGetStub(), OverlayArea, Sint32 and state.

Referenced by fdEngineRun().

Definition at line 37 of file field_engine_treasure_spots.c.

fdTreasureSpotFindSlot

Sint32 fdTreasureSpotFindSlot(Sint32 id)

Returns the treasure spot slot (below TREASURE_SPOT_MAX) whose script cue is id, or -1.

References Sint32.

Referenced by fdSetMarkerAnimationAndPlaySound(), fdTreasureSpotGetActor(), fdTreasureSpotHide(), fdTreasureSpotLaunchMimic(), fdTreasureSpotSetActorPos() and fdTreasureSpotShowOpened().

Definition at line 158 of file field_engine_treasure_spots.c.

fdTreasureSpotReservedNoOperation

void fdTreasureSpotReservedNoOperation(void)

Unused: empty.

Definition at line 179 of file field_engine_treasure_spots.c.

fdSetMarkerAnimationAndPlaySound

static __inline__ void fdSetMarkerAnimationAndPlaySound(Sint32 id, Sint32 animation, Sint32 sound)

Gives the actor of treasure spot id animation, plays sound and waits 12 ticks.

References fdActorSelectAnimationStub(), fdTreasureSpotFindSlot(), Sint32, sySoundPlayStub() and sySynch().

Referenced by fdTreasureSpotCloseChest() and fdTreasureSpotOpenChest().

Definition at line 185 of file field_engine_treasure_spots.c.

fdTreasureSpotCloseChest

void fdTreasureSpotCloseChest(Sint32 id)

Closes the chest of treasure spot id again (its item could not be carried), with SE_CHEST_CLOSE.

References fdSetMarkerAnimationAndPlaySound() and Sint32.

Referenced by fdExamineMetatile().

Definition at line 206 of file field_engine_treasure_spots.c.

fdTreasureSpotLaunchMimic

void fdTreasureSpotLaunchMimic(Sint32 id)

Makes the chest of treasure spot id jump up as a mimic: after 18 ticks it turns into the mimic with a cry (SE_ENEMY_CRY) and leaps up at 8 pixels a tick, its shadow showing.

References fdActorSelectAnimationStub(), fdActorSetSpriteFlagsStub(), fdTreasureSpotFindSlot(), Sint32, sySoundPlayStub() and sySynch().

Referenced by fdExamineMetatile().

Definition at line 215 of file field_engine_treasure_spots.c.

fdTreasureSpotOpenChest

void fdTreasureSpotOpenChest(Sint32 id)

Opens the chest of treasure spot id with SE_CHEST_OPEN, and waits 12 ticks.

References fdSetMarkerAnimationAndPlaySound() and Sint32.

Referenced by fdExamineMetatile().

Definition at line 239 of file field_engine_treasure_spots.c.

fdTreasureSpotShowOpened

void fdTreasureSpotShowOpened(Sint32 id)

Shows the chest of treasure spot id open, with no sound.

References fdActorSelectAnimationStub(), fdTreasureSpotFindSlot() and Sint32.

Referenced by fdExamineMetatile().

Definition at line 246 of file field_engine_treasure_spots.c.

fdTreasureSpotGetActor

ACTOR *fdTreasureSpotGetActor(Sint32 id)

Returns the actor of treasure spot id, or NULL when no slot has it.

References fdTreasureSpotFindSlot() and Sint32.

Referenced by fdEffectSpawnRevealMarkers() and fdExamineMetatile().

Definition at line 263 of file field_engine_treasure_spots.c.

fdTreasureSpotHide

void fdTreasureSpotHide(Sint32 id)

Hides the actor of treasure spot id; the actor stays in its slot.

References fdTreasureSpotFindSlot() and Sint32.

Referenced by fdExamineMetatile().

Definition at line 275 of file field_engine_treasure_spots.c.

fdTreasureSpotSetActorPos

void fdTreasureSpotSetActorPos(Sint32 id, FIXED x, FIXED z)

Moves the actor of treasure spot id to (x, z) on the ground; -1 keeps the centre of its metatile on that axis. Positions are 16.16.

References fdMapGridGetTerrainHeightStub(), fdTreasureSpotFindSlot() and Sint32.

Referenced by fdTreasureSpotSetPos(), scCrossboneIsleKeysPlaceDemonAxeChestCue(), scLamaTempleHideChest() and scRevealHideSecrets().

Definition at line 293 of file field_engine_treasure_spots.c.