src/field/field_psynergy_scoop.c
Scoop: the giant hand digging, the actor dropped from it and the item dug up. More…
Included by field_psynergy.c.
Macros
| Name | Description | |
|---|---|---|
#define | SCOOP_DRAWN_DUST 18 | A dig at nothing draws the first SCOOP_DRAWN_DUST of the particles of dust and sparkles Scoop throws up, a dig on a target the first SCOOP_DRAWN_TARGET_DUST. |
#define | SCOOP_DRAWN_TARGET_DUST 20 | |
#define | SCOOP_SPARKLES 16 | The sparkles the hand bursts into when it cannot dig. |
#define | SCOOP_FIND_CHANCE (toFIXED(1) / 16) | A dig at nothing turns something up when syRandom() falls below this, one time in sixteen; what turns up is an item below SCOOP_ITEM_CHANCE, three times in four, and coins otherwise. |
#define | SCOOP_ITEM_CHANCE (toFIXED(3) / 4) | |
#define | NEXT_PHASE (state) ((state)->phase++, (state)->timer = -1) | Moves the state on to its next phase, its timer restarted. |
Enumerations
| Name | Description | |
|---|---|---|
enum | SCOOP_MODE { SCOOP_EARTH, SCOOP_FINDS, SCOOP_TARGET, SCOOP_SPARKLE } | The kinds of dig (SCOOP_STATE.mode). |
enum | SCOOP_PHASE { SCOOP_DIGS, SCOOP_HAND_RISES, SCOOP_SETTLES } | The stages of a dig (SCOOP_STATE.phase). |
enum | SCOOP_FAILURE { SCOOP_CAN_DIG, SCOOP_ACTOR_IN_WAY, SCOOP_OUT_OF_REACH, SCOOP … } | Why the hand cannot dig. |
Functions
| Name | Description | |
|---|---|---|
void | fdScoopUpdate (void) | Event of the Scoop: the hand digs and rises, then the earth, sparkles or dust it threw up show, each kind of dig at its own pace. |
void | fdPsynergyScoopOnTarget (void) | Scoop cast on a target: runs fdPsynergyScoop. |
Sint32 | fdMapGridCanScoop (Sint32 x, Sint32 z, Sint32 layer) | Whether the Scoop can dig at (x, z): on the world map, sand; elsewhere not on a Cyclone metatile, water or raised ground, and then on sand, or on a MAP_METATILE_SCOOP metatile (any other, where FIELD_STATE.sceneAttributeLow is set). |
void | fdScoopDigUpItem (void) | SCOOPED_ITEM_ACTOR at the hand, fetched or spawned (SPRITE_UNSEEN_MARKER), shows what Scoop dug up: three times in four one of ScoopDugItems's sixteen items (a coin when there is no room for it), else coins up to twice the leader's level; it then drops (fdScoopDropFromHand). |
void | fdPsynergyScoop (void) | Scoop ("Dig in soft ground."): a giant hand rises before the caster and digs the metatile 16 pixels ahead. |
void | fdScoopDropFromHand (Sint32 id) | Drops an actor from Scoop's hand (if there is one) to fall to the ground, waits 50 ticks, then asks for its talk, which opens it without its "checked the ..." message (FIELD_TALK_SILENT). |
Variables
| Name | Description | |
|---|---|---|
extern const Uint16 | ScoopDugItems [16] | What fdScoopDigUpItem can find, one of the 16 at random. |
Description
Scoop: the giant hand digging, the actor dropped from it and the item dug up.
Part of field_psynergy.c.
Macros in detail
SCOOP_DRAWN_DUST
#define SCOOP_DRAWN_DUST 18
A dig at nothing draws the first SCOOP_DRAWN_DUST of the particles of dust
and sparkles Scoop throws up, a dig on a target the first
SCOOP_DRAWN_TARGET_DUST.
Referenced by fdScoopUpdate().
Definition at line 7 of file field_psynergy_scoop.c.
SCOOP_DRAWN_TARGET_DUST
#define SCOOP_DRAWN_TARGET_DUST 20
Referenced by fdScoopUpdate().
Definition at line 8 of file field_psynergy_scoop.c.
SCOOP_SPARKLES
#define SCOOP_SPARKLES 16
The sparkles the hand bursts into when it cannot dig.
Referenced by fdPsynergyScoop().
Definition at line 10 of file field_psynergy_scoop.c.
SCOOP_FIND_CHANCE
#define SCOOP_FIND_CHANCE (toFIXED(1) / 16)
A dig at nothing turns something up when syRandom() falls below this, one
time in sixteen; what turns up is an item below SCOOP_ITEM_CHANCE, three
times in four, and coins otherwise.
Referenced by fdPsynergyScoop().
Definition at line 14 of file field_psynergy_scoop.c.
SCOOP_ITEM_CHANCE
#define SCOOP_ITEM_CHANCE (toFIXED(3) / 4)
Referenced by fdScoopDigUpItem().
Definition at line 15 of file field_psynergy_scoop.c.
NEXT_PHASE
#define NEXT_PHASE(state) ((state)->phase++, (state)->timer = -1)
Moves the state on to its next phase, its timer restarted.
Referenced by fdScoopUpdate().
Definition at line 45 of file field_psynergy_scoop.c.
Enumerations in detail
SCOOP_MODE
enum SCOOP_MODE
The kinds of dig (SCOOP_STATE.mode).
| Enumerator | Value | Description |
|---|---|---|
SCOOP_EARTH | 0 | at nothing: earth is thrown up |
SCOOP_FINDS | 1 | at nothing, one time in sixteen: something turns up |
SCOOP_TARGET | 2 | on a target: the place's Scoop script runs |
SCOOP_SPARKLE | 3 | at nothing where lit: sparkles rise |
Definition at line 18 of file field_psynergy_scoop.c.
SCOOP_PHASE
enum SCOOP_PHASE
The stages of a dig (SCOOP_STATE.phase).
| Enumerator | Value | Description |
|---|---|---|
SCOOP_DIGS | 0 | |
SCOOP_HAND_RISES | 1 | |
SCOOP_SETTLES | 2 | what was dug up shows, then the dig ends |
Definition at line 27 of file field_psynergy_scoop.c.
SCOOP_FAILURE
enum SCOOP_FAILURE
Why the hand cannot dig.
| Enumerator | Value | Description |
|---|---|---|
SCOOP_CAN_DIG | 0 | |
SCOOP_ACTOR_IN_WAY | 1 | |
SCOOP_OUT_OF_REACH | 2 | |
SCOOP_HARD_GROUND | 3 | |
SCOOP_WALL | 4 |
Definition at line 35 of file field_psynergy_scoop.c.
Functions in detail
fdScoopUpdate
void fdScoopUpdate(void)
Event of the Scoop: the hand digs and rises, then the earth, sparkles or dust it threw up show, each kind of dig at its own pace.
References fdActorSelectAnimationStub(), fdEffectSpriteDraw(), fdEffectSpriteDrawAtWorldPos(), fdPictureShiftColumnsByWave(), fdScoopDustUpdateGrain(), Sint32 and syRandom().
Referenced by fdPsynergyScoop().
Definition at line 49 of file field_psynergy_scoop.c.
fdPsynergyScoopOnTarget
void fdPsynergyScoopOnTarget(void)
Scoop cast on a target: runs fdPsynergyScoop.
References fdPsynergyScoop().
Referenced by fdPsynergyDispatch().
Definition at line 213 of file field_psynergy_scoop.c.
fdScoopDigUpItem
void fdScoopDigUpItem(void)
SCOOPED_ITEM_ACTOR at the hand, fetched or spawned (SPRITE_UNSEEN_MARKER),
shows what Scoop dug up: three times in four one of ScoopDugItems's sixteen
items (a coin when there is no room for it), else coins up to twice the
leader's level; it then drops (fdScoopDropFromHand).
References fdActorCreateStub(), fdActorGetById(), fdActorShowItemIconById(), fdScoopDropFromHand(), gmPartyInventoryFindRoomStub(), gmUnitGet(), MainRoutineStateWork, ScoopDugItems, Sint32 and syRandom().
Referenced by fdPsynergyScoop().
Definition at lines 219 and 583 of file field_psynergy_scoop.c.
fdPsynergyScoop
void fdPsynergyScoop(void)
Scoop ("Dig in soft ground."): a giant hand rises before the caster and digs the metatile 16 pixels ahead. With an actor in the way, out of reach or on ground that cannot be dug it stops with the error sound; else earth (or, in a lit place, sparkles) is thrown up and the place's Scoop script runs.
References fdActorGetSpriteDepth(), fdActorGetSpriteIdStub(), fdActorGetSpritePriority(), fdActorReleaseStub(), fdActorSelectAnimationStub(), fdActorSetSpriteColorModeStub(), fdActorSpawn(), fdBattleEffectSpawnScatterParticle(), fdCameraWorldToScreen(), fdEffectSpriteInit(), fdFindPsynergyCue(), fdMapGridCanScoop(), fdMapGridGetMetatileBehavior(), fdMeasurePsynergyHeight(), fdPsynergyCheckOverlap(), fdPsynergyFadeFromCastColor(), fdPsynergyFadeToCastColor(), fdPsynergyGrowFromCaster(), fdPsynergyShrinkToCaster(), fdPsynergyStartSceneSprite(), fdRunPsynergyScript(), fdScoopDigUpItem(), fdScoopUpdate(), fdSelectPsynergyTarget(), Sint32, syCloseEvent(), syDecompressTaggedLZ(), syHeapSlotAllocate(), syHeapSlotRelease(), syRandom(), syResourceGetTableEntry(), sySetEvent(), sySoundPlayStub(), sySynch(), syVectorAddPolarOffset(), syVRAMCacheFindFreeEntry(), syVRAMCacheFreeEntry() and syVRAMCacheLoad().
Referenced by fdPsynergyRun() and fdPsynergyScoopOnTarget().
Definition at line 225 of file field_psynergy_scoop.c.
fdScoopDropFromHand
void fdScoopDropFromHand(Sint32 id)
Drops an actor from Scoop's hand (if there is one) to fall to the ground,
waits 50 ticks, then asks for its talk, which opens it without its "checked
the ..." message (FIELD_TALK_SILENT).
References fdActorGetById(), Sint32 and sySynch().
Referenced by fdActorReturnHome() and fdScoopDigUpItem().
Definition at line 551 of file field_psynergy_scoop.c.