struct FIELD_STATE
A field scene's state: fdEngineRun allocates it in heap slot HEAP_SLOT_FIELD, zeroes it and frees it on the way out, and the field engine, the script commands and the scene overlays all reach it through FieldStateWork.
Declared in field_state.h.
Fields
| Name | Description | |
|---|---|---|
struct ACTOR_PLACE * | tables [4] | The actor placement tables placed so far, recorded by fdScriptSpawnActorPlacements. |
const struct CUE * | cues | The scene's cue table. |
struct ACTOR * | actors [ACTOR_ID_COUNT] | The actors by actor id: 0 to 7 the party's characters, 8 on the placed actors. |
TREASURE_SPOT | treasureSpots [10] | The map's treasure spots (TREASURE_SPOT_MAX). |
Sint16 | stepCue | A step cue (1 to 239) for fdRunStepCueOrExit. |
Sint16 | pushMetatile | A metatile behavior (252 to 254) for fdRunPushMetatile. |
Sint16 | exit | The exit taken, which ends the scene. |
Sint16 | fieldMenu | Open the field menu. |
Sint16 | aButton | The A button: a talk, an examine or the field menu, by what is ahead. |
Sint16 | pauseMenu | The Start button: open the Pause menu. |
Uint16 | talk | An actor's talk cue, as actor id | 0x1000. |
Sint16 | examineMetatile | A metatile's metatile behavior, for fdExamineMetatile. |
Sint16 | encounter | The formation of a random encounter. |
Sint16 | psynergy | A field Psynergy to use, as FIELD_PSYNERGY makes it. |
Sint16 | item | An item to use, packed as fdUseItem reads it. |
Sint16 | raisedCue | A raised cue's number for fdRunRaisedCue, or an enum FIELD_RAISED_CUE. |
Sint16 | fallenCount | The characters who fell this step. |
Sint16 | survivorCount | 0 when the whole party fell. |
Sint16 | fallenOwners [9] | The characters who fell, from the active party. |
Sint16 | itemSlot | The inventory slot fdUseItem receives. |
Sint16 | blockedSteps | Ticks the leader has pushed against something, counted by the player controls; step cues and push metatiles need more than 12. |
Sint16 | mode | An ACTOR_SYSTEM_MODE. |
Uint8 | encounterZones [8] | Encounter zone for each kind of ground. |
Sint32 | encounterBias | Randomized distance adjustment between battles. |
FIXED | encounterThreshold | Encounter steps before a battle; toFIXED(16). |
FIXED | walkingDistanceScale | Scales the leader's speed into walkingDistance, in 16.16 fixed point: toFIXED(1) / 160 on entry, 0 in a town. |
FIXED | walkingDistance | Distance walked toward the next toFIXED(1), at which the party regains PP, Djinn recover and poison hurts (fdUpdateWalking). |
struct MAP_GRID_METATILE * | currentMetatile | The metatile the leader last stepped onto. |
struct MAP_GRID_METATILE * | prevMetatile | The metatile before it. |
Sint32 | transition | SCENE_TRANSITION(style, |
Uint16 | unused | variant); (1, 0) on entry. |
Uint16 | transitionActive | Set once the opening transition has started. |
Sint32 | transitionFrame | Ticks; MAP_TRANSITION_TICKS on entry and at each script. |
Sint32 | fastForward | Debug: skip timed script |
Uint8 | unusedAfterFastForward [8] | waits and actor messages. |
Sint16 | msg | The next message, advanced as each window opens. |
Uint16 | unusedAfterMsg | Set to 0xffff by fdScriptStart at each script; nothing reads it. |
Sint16 | unusedBeforeCamera [2] | Both set to -1 by fdScriptStart at each script; nothing reads them. |
struct ACTOR * | camera | The actor the map view |
Uint8 | unusedAfterCamera [16] | follows, which has no actor id. |
Sint32 | speaker | The actor speaking; the leader at each script. |
Sint32 | msgWindow | The open message window, 0 for none. |
Sint32 | sideWindow | The speaker's portrait window. |
Uint8 | leaderPlacements [48] | The leader's two-row actor placement table (its row and an end row), which fdActorResetForLeader builds through its offset. |
struct WINDOW * | areaNameWindow | The area name notice's window (mnAreaNameWindowShow); it may since have closed. |
Uint16 | areaNameCountdown | Ticks left to show the area name. |
Uint16 | savedFadeTarget [448 * 3] | The palette a field Psynergy's tint fades back to, as a palette fade's target (BG half, then sprite half), saved as the tint starts. |
Uint16 | busy | Set while a raised or step cue runs; fdScriptStart then resets the effect counter. |
Sint16 | revealActive | Nonzero while Reveal is active. |
Sint16 | revealFrame | The ticks Reveal has left, REVEAL_TICKS as cast. |
Sint16 | revealCenterX | Where Reveal was |
Sint16 | revealCenterY | cast, in pixels. |
Sint16 | effectTimerRunning | Nonzero lets the Reveal countdown advance; menus and other effects pause it. |
Sint16 | choiceMsg | The first of the two names the next yes/no choice shows in place of Yes and No (mnYesNoMenuRun), 0 for those. |
Sint16 | choiceWidth | The choice window's width, 0 for the default. |
Sint8 | psynergyActing | Set while Psynergy takes effect. |
Sint8 | castStarted | Set once a cast has been announced. |
Sint16 | queuedSound | A sound fdPlayQueuedMusic plays; -1 for none. |
Sint8 | menuOpen | Set while the field menu is open (mnFieldMenuRun), which pauses Reveal's sparkles; only the German, Spanish, French and Italian editions keep it. |
Description
A field scene's state: fdEngineRun allocates it in heap slot HEAP_SLOT_FIELD,
zeroes it and frees it on the way out, and the field engine, the script
commands and the scene overlays all reach it through FieldStateWork.
struct FIELD_STATE
Referenced by fdActorClearAll(), fdActorClearOutOfBounds(), fdActorFindBySprite(), fdActorFindLastActiveId(), fdActorGetCueMetatileAheadOfCurrent(), fdActorGetSlotAddress(), fdActorGetSpriteById(), fdActorLookup(), fdActorReleaseAtIndex(), fdActorReleaseById(), fdActorResetForLeader(), fdActorRespawn(), fdActorRestore(), fdActorSnapshot(), fdCameraFollow(), fdCameraFollowActor(), fdCameraGetActor(), fdCameraMoveToActorById(), fdCameraMoveWithinMapBounds(), fdCameraSetSpeedParams(), fdCameraWaitForArrival(), fdCameraWorldToScreen(), fdCheckConfiguredKeys(), fdCheckExitRegions(), fdClearRequests(), fdCountRequests(), fdDjinnJoinParty(), fdEncounterCountStepsAndSelectFormation(), fdEncounterSelectMapZones(), fdEndBusyAndReveal(), fdEngineRun(), fdExamineMetatile(), fdFindCue(), fdFindItemCue(), fdFindPsynergyCue(), fdGetCollisionAheadOfLeader(), fdIsRevealActive(), fdItemDisplayShowItemInFront(), fdMapScreenShow(), fdMessageShowAtActor(), fdPartyInventoryGiveItem(), fdPlaceTreasureSpots(), fdPsynergyCheckCloakTile(), fdPsynergyDispatch(), fdPsynergyEnd(), fdPsynergyEndReveal(), fdPsynergyFadeFromCastColor(), fdPsynergyFadeToCastColor(), fdPsynergyLoadResources(), fdPsynergyReveal() and 168 more.
Definition at line 64 of file field_state.h.
Fields in detail
tables
struct ACTOR_PLACE *tables[4]
The actor placement tables placed so
far, recorded by
fdScriptSpawnActorPlacements.
cues
const struct CUE *cues
The scene's cue table.
actors
struct ACTOR *actors[ACTOR_ID_COUNT]
The actors by actor id: 0 to 7 the party's characters, 8 on the placed actors.
treasureSpots
TREASURE_SPOT treasureSpots[10]
The map's treasure
spots
(TREASURE_SPOT_MAX).
stepCue
Sint16 stepCue
A step cue (1 to 239)
for fdRunStepCueOrExit.
pushMetatile
Sint16 pushMetatile
A metatile behavior (252
to 254) for
fdRunPushMetatile.
exit
Sint16 exit
The exit taken, which ends the scene.
fieldMenu
Sint16 fieldMenu
Open the field menu.
aButton
Sint16 aButton
The A button: a talk, an examine or the field menu, by what is ahead.
pauseMenu
Sint16 pauseMenu
The Start button: open the Pause menu.
talk
Uint16 talk
An actor's talk cue, as actor id | 0x1000.
examineMetatile
Sint16 examineMetatile
A metatile's metatile
behavior, for
fdExamineMetatile.
encounter
Sint16 encounter
The formation of a random encounter.
psynergy
Sint16 psynergy
A field Psynergy to use,
as FIELD_PSYNERGY makes
it.
item
Sint16 item
An item to use, packed
as fdUseItem reads it.
raisedCue
Sint16 raisedCue
A raised cue's number
for fdRunRaisedCue, or
an enum
FIELD_RAISED_CUE.
fallenCount
Sint16 fallenCount
The characters who fell this step.
survivorCount
Sint16 survivorCount
0 when the whole party fell.
fallenOwners
Sint16 fallenOwners[9]
The characters who fell, from the active party.
itemSlot
Sint16 itemSlot
The inventory slot
fdUseItem receives.
blockedSteps
Sint16 blockedSteps
Ticks the leader has pushed against something, counted by the player controls; step cues and push metatiles need more than 12.
mode
Sint16 mode
encounterZones
Uint8 encounterZones[8]
Encounter zone for each kind of ground.
encounterBias
Sint32 encounterBias
Randomized distance adjustment between battles.
encounterThreshold
FIXED encounterThreshold
Encounter steps before a
battle; toFIXED(16).
walkingDistanceScale
FIXED walkingDistanceScale
Scales the leader's
speed into
walkingDistance, in
16.16 fixed point:
toFIXED(1) / 160 on
entry, 0 in a town.
walkingDistance
FIXED walkingDistance
Distance walked toward
the next toFIXED(1), at
which the party regains
PP, Djinn recover and
poison hurts
(fdUpdateWalking).
currentMetatile
struct MAP_GRID_METATILE *currentMetatile
The metatile the leader last stepped onto.
prevMetatile
struct MAP_GRID_METATILE *prevMetatile
The metatile before it.
transition
Sint32 transition
SCENE_TRANSITION(style,
unused
Uint16 unused
variant); (1, 0) on entry.
transitionActive
Uint16 transitionActive
Set once the opening transition has started.
transitionFrame
Sint32 transitionFrame
Ticks;
MAP_TRANSITION_TICKS on
entry and at each
script.
fastForward
Sint32 fastForward
Debug: skip timed script
unusedAfterFastForward
Uint8 unusedAfterFastForward[8]
waits and actor messages.
msg
Sint16 msg
The next message, advanced as each window opens.
unusedAfterMsg
Uint16 unusedAfterMsg
Set to 0xffff by
fdScriptStart at each
script; nothing reads
it.
unusedBeforeCamera
Sint16 unusedBeforeCamera[2]
Both set to -1 by
fdScriptStart at each
script; nothing reads
them.
camera
struct ACTOR *camera
The actor the map view
unusedAfterCamera
Uint8 unusedAfterCamera[16]
follows, which has no actor id.
speaker
Sint32 speaker
The actor speaking; the leader at each script.
msgWindow
Sint32 msgWindow
The open message window, 0 for none.
sideWindow
Sint32 sideWindow
The speaker's portrait window.
leaderPlacements
Uint8 leaderPlacements[48]
The leader's two-row
actor placement table
(its row and an end
row), which
fdActorResetForLeader
builds through its
offset.
areaNameWindow
struct WINDOW *areaNameWindow
The area name notice's
window
(mnAreaNameWindowShow);
it may since have
closed.
areaNameCountdown
Uint16 areaNameCountdown
Ticks left to show the area name.
savedFadeTarget
Uint16 savedFadeTarget[448 * 3]
The palette a field Psynergy's tint fades back to, as a palette fade's target (BG half, then sprite half), saved as the tint starts.
busy
Uint16 busy
Set while a raised or
step cue runs;
fdScriptStart then
resets the effect
counter.
revealActive
Sint16 revealActive
Nonzero while Reveal is active.
revealFrame
Sint16 revealFrame
The ticks Reveal has
left, REVEAL_TICKS as
cast.
revealCenterX
Sint16 revealCenterX
Where Reveal was
revealCenterY
Sint16 revealCenterY
cast, in pixels.
effectTimerRunning
Sint16 effectTimerRunning
Nonzero lets the Reveal countdown advance; menus and other effects pause it.
choiceMsg
Sint16 choiceMsg
The first of the two
names the next yes/no
choice shows in place
of Yes and No
(mnYesNoMenuRun), 0
for those.
choiceWidth
Sint16 choiceWidth
The choice window's width, 0 for the default.
psynergyActing
Sint8 psynergyActing
Set while Psynergy takes effect.
castStarted
Sint8 castStarted
Set once a cast has been announced.
queuedSound
Sint16 queuedSound
A sound
fdPlayQueuedMusic
plays; -1 for none.
menuOpen
Sint8 menuOpen
Set while the field
menu is open
(mnFieldMenuRun),
which pauses Reveal's
sparkles; only the
German, Spanish,
French and Italian
editions keep it.