src/field/field_engine_walking.c
Field requests and each tick of the leader's walking: exits, encounters, damage. More…
Included by field_engine.c.
Macros
| Name | Description | |
|---|---|---|
#define | HEAVY_DAMAGE 10 | Damage past this plays SE_HEAVY_IMPACT rather than SE_IMPACT. |
#define | POISON_HP_PARTS 20 | The share of maximum HP poison and deadly poison take each time, as one part in this many. |
#define | VENOM_HP_PARTS 10 |
Functions
| Name | Description | |
|---|---|---|
void | fdClearRequests (void) | Clears the field's twelve pending requests (see FIELD_STATE). |
Sint32 | fdCountRequests (void) | Returns the sum of the field's twelve pending requests (counting the talk request twice): non-zero while any request is pending. |
Sint32 | fdGetCollisionAheadOfLeader (void) | Returns the metatile behavior of the map metatile 16 pixels ahead of the party leader (a World Map metatile's tiles on the World Map), or 0 without a leader. |
void | fdCheckExitRegions (FIXED posX, FIXED posY, FIXED posZ) | Takes the exit of the first of the scene's exit regions that contains the position (x, y, z), in 16.16 pixels, and whose condition holds: records the region's exit value for fdEngineRun, plays the exit sound and starts leaving the scene. |
void | fdUpdateWalking (Sint32 layer, FIXED x, FIXED y, FIXED z) | Handles one tick of the party leader's walking onto the metatile at (x, y, z) of map grid layer: records step cues and push metatiles, takes exits, and while walking advances the encounter counter, regenerates PP, hurts the party with poison and hazardous ground, and wears Avoid off. |
void | fdPartyAddPp (Sint32 amount, Sint32 unused) | Gives each character in the party amount PP (PP regenerates as the party walks). |
void | fdPartyAddHp (Sint32 amount, Sint32 percent) | Changes each party member's HP by amount, or by that percentage of maximum HP when percent is set. |
Sint32 | fdPartyApplyPoisonDamage (void) | Hurts each poisoned character in the party: poison takes a twentieth of their maximum HP and deadly poison a tenth, rounded to the nearest and at least 1. |
void | fdWorldMapFreeze (void) | Before a script or menu on the World Map: ends any screen transition in progress, stops the camera and holds the view as a still image. |
void | fdWorldMapUnfreeze (void) | Ends what fdWorldMapFreeze started: on the World Map, reloads the area's graphics and lets the camera move again. |
Description
Field requests and each tick of the leader's walking: exits, encounters,
damage. Part of field_engine.c.
Macros in detail
HEAVY_DAMAGE
#define HEAVY_DAMAGE 10
Damage past this plays SE_HEAVY_IMPACT rather than SE_IMPACT.
Referenced by fdPartyAddHp().
Definition at line 373 of file field_engine_walking.c.
POISON_HP_PARTS
#define POISON_HP_PARTS 20
The share of maximum HP poison and deadly poison take each time, as one part in this many.
Referenced by fdPartyApplyPoisonDamage().
Definition at line 425 of file field_engine_walking.c.
VENOM_HP_PARTS
#define VENOM_HP_PARTS 10
Referenced by fdPartyApplyPoisonDamage().
Definition at line 426 of file field_engine_walking.c.
Functions in detail
fdClearRequests
void fdClearRequests(void)
Clears the field's twelve pending requests (see FIELD_STATE).
References state.
Referenced by fdEngineRun().
Definition at line 7 of file field_engine_walking.c.
fdCountRequests
Sint32 fdCountRequests(void)
Returns the sum of the field's twelve pending requests (counting the talk request twice): non-zero while any request is pending.
Referenced by fdEngineRun().
Definition at line 27 of file field_engine_walking.c.
fdGetCollisionAheadOfLeader
Sint32 fdGetCollisionAheadOfLeader(void)
Returns the metatile behavior of the map metatile 16 pixels ahead of the party leader (a World Map metatile's tiles on the World Map), or 0 without a leader.
References MainRoutineStateWork, MetatileTiles, Sint32, state and syVectorAddPolarOffset().
Referenced by fdFindItemCue() and fdFindPsynergyCue().
Definition at line 54 of file field_engine_walking.c.
fdCheckExitRegions
void fdCheckExitRegions(FIXED posX, FIXED posY, FIXED posZ)
Takes the exit of the first of the scene's exit regions that contains the
position (x, y, z), in 16.16 pixels, and whose condition holds: records the
region's exit value for fdEngineRun, plays the exit sound and starts leaving
the scene.
References fdGameFlagIsConditionActive(), fdLeaderStopMoving(), OverlayArea, Sint32, state and sySoundPlayStub().
Referenced by fdUpdateWalking().
Definition at line 114 of file field_engine_walking.c.
fdUpdateWalking
void fdUpdateWalking(Sint32 layer, FIXED x, FIXED y, FIXED z)
Handles one tick of the party leader's walking onto the metatile at (x, y, z) of map grid layer: records step cues and push metatiles, takes exits, and while walking advances the encounter counter, regenerates PP, hurts the party with poison and hazardous ground, and wears Avoid off.
References btDjinnRecoveryCountDownStub(), fdCheckExitRegions(), fdEffectSetAttached(), fdEncounterRollMapStep(), fdEncounterRollWorldMap(), fdPartyAddHp(), fdPartyAddPp(), fdPartyApplyPoisonDamage(), fdPartyClearUnusableShortcuts(), gmFlagGetStub(), gmPartyCountMembersStub(), gmUnitGetStub(), MainRoutineStateWork, MapGridMetatileBuffer, Sint32, state, syMulFX() and sySoundPlayStub().
Referenced by fdEngineRun().
Definition at line 167 of file field_engine_walking.c.
fdPartyAddPp
void fdPartyAddPp(Sint32 amount, Sint32 unused)
Gives each character in the party amount PP (PP regenerates as the party walks).
References gmPartyCountMembersStub(), gmUnitAddPpStub(), MainRoutineStateWork and Sint32.
Referenced by fdExamineMetatile(), fdUpdateWalking() and scValePlazaUsePsynergyStone().
Definition at line 363 of file field_engine_walking.c.
fdPartyAddHp
void fdPartyAddHp(Sint32 amount, Sint32 percent)
Changes each party member's HP by amount, or by that percentage of maximum HP when percent is set.
References fdPaletteFadeSetSource(), fdPaletteFadeStartInterpolation(), gmPartyCountMembersStub(), gmUnitAddHpStub(), gmUnitGetStub(), MainRoutineStateWork, Sint32 and sySoundPlayStub().
Referenced by fdUpdateWalking().
Definition at line 377 of file field_engine_walking.c.
fdPartyApplyPoisonDamage
Sint32 fdPartyApplyPoisonDamage(void)
Hurts each poisoned character in the party: poison takes a twentieth of their maximum HP and deadly poison a tenth, rounded to the nearest and at least 1.
References fdPaletteFadeSetSource(), fdPaletteFadeStartInterpolation(), gmPartyCountMembersStub(), gmUnitAddHpStub(), gmUnitGetStub(), MainRoutineStateWork, Sint32 and sySoundPlayStub().
Referenced by fdUpdateWalking().
Definition at line 430 of file field_engine_walking.c.
fdWorldMapFreeze
void fdWorldMapFreeze(void)
Before a script or menu on the World Map: ends any screen transition in progress, stops the camera and holds the view as a still image.
References fdWorldMapStartStillImageStub(), state and syHeapSlotAllocateEWRAM().
Referenced by fdDjinnJoinParty(), fdEngineRun(), scWorldMapBoardBunzasWagon(), scWorldMapExplainSettingDjinn(), scWorldMapIodemCallsIsaacBack(), scWorldMapMeetFlint(), scWorldMapRunBlackOrbScript(), scWorldMapSearchWreckage(), scWorldMapShowEndingScript(), scWorldMapShowHammetsCaravan() and scWorldMapUseBlackOrb().
Definition at line 476 of file field_engine_walking.c.
fdWorldMapUnfreeze
void fdWorldMapUnfreeze(void)
Ends what fdWorldMapFreeze started: on the World Map, reloads the area's
graphics and lets the camera move again.
References fdWorldMapLoadAreaGraphicsStub(), state and syHeapSlotAllocateEWRAM().
Referenced by fdDjinnJoinParty(), fdEngineRun(), scWorldMapExplainSettingDjinn(), scWorldMapIodemCallsIsaacBack(), scWorldMapMeetFlint(), scWorldMapRunBlackOrbScript(), scWorldMapSearchWreckage(), scWorldMapShowHammetsCaravan() and scWorldMapUseBlackOrb().
Definition at line 500 of file field_engine_walking.c.