Skip to Content
The Alchemy Project

struct FIELD_STATE

A field scene's state: fdEngineRun allocates it in 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 RamHeapSlots->fieldState.

Declared in field_state.h.

Fields

NameDescription
const ACTOR_PLACE *tables [4]The actor placement tables placed so far, recorded by fdScriptSpawnActorTable.
const CUE_VIEW *cuesThe scene's cue table.
struct ACTOR *actors [FIELD_ACTOR_COUNT]The actors by actor id: 0 to 7 the party's characters, 8 on the placed actors, FIELD_TREASURE_ACTOR on the treasure spots.
Sint16stepCueA step cue (1 to 230) for fdRunStepCueOrExit.
Sint16pushMetatileA metatile's attributes for fdRunPushMetatile.
Sint16exitThe exit taken, which ends the scene; EXIT_KEEP_DESTINATION for a warp.
Sint16fieldMenuOpen the field menu.
Sint16aButtonThe A button: a talk, an examine or the field menu, by what is ahead.
Sint16pauseMenuThe Start button: open the Pause menu.
Sint16talkAn actor's talk, as actor id | FIELD_TALK_REQUEST.
Sint16examineMetatileA metatile's metatile behavior, for fdExamineMetatile.
Sint16encounterThe enemy group of a random encounter.
Sint16psynergyA field Psynergy to use, as unit << 10 | Psynergy.
Sint16itemAn item to use, packed as fdUseItem reads it.
Sint16raisedCueA raised cue's number for fdRunRaisedCue, or an enum FIELD_RAISED_CUE.
Sint16fallenCountThe characters who fell this step.
Sint16survivorCount0 when the whole party fell.
Sint16fallenOwners [9]The characters who fell, from the active party.
Sint16itemSlotThe inventory slot fdUseItem receives.
Sint16blockedStepsTicks the leader has pushed against something, counted by the player controls; step cues and push metatiles need more than FIELD_PUSH_TICKS.
Uint16heldKeysThe keys held: a ledge (KEY_DOWN) and a climb (KEY_UP or KEY_DOWN) read them, and they are kept when a rope or tightrope was raised.
Uint8unusedAfterHeldKeys [2]No code names it.
Sint8modeAn ACTOR_SYSTEM_MODE.
Sint8areaGraphicsPendingThe area's graphics are to be reloaded on the World Map (fdWorldMapFreeze, fdWorldMapReloadPendingAreaGraphics).
Uint8encounterZones [8]Encounter zone for each kind of ground.
Sint32encounterBiasRandomized distance adjustment between battles.
FIXEDencounterThresholdEncounter steps before a battle; toFIXED(16).
FIXEDwalkingDistanceScaleScales the leader's speed into walkingDistance, in 16.16 fixed point: 409 on entry, 0 in a town.
FIXEDwalkingDistanceDistance walked toward the next toFIXED(1), at which the party regains PP, Djinn recover and poison hurts (fdUpdateWalking).
struct MAP_METATILE *currentMetatileThe metatile the leader last stepped onto.
struct MAP_METATILE *prevMetatileThe metatile before it.
Sint32transitionA SCENE_TRANSITION(style,
Uint16unusedvariant): a TRANSITION_BACKDROP_FADE on entry.
Uint16transitionActiveSet once the opening transition has started.
Sint32transitionFrameThe transition's ticks: MAP_TRANSITION_TICKS on entry and at each script.
Sint32fastForwardDebug: skip timed script
Uint8unusedAfterFastForward [8]waits and actor messages.
Sint16msgThe next message, advanced as each window opens.
Uint16unusedAfterMsgSet to 0xffff by fdScriptStart at each script; nothing reads it.
Sint16unusedBeforeCamera [2]Both set to -1 by fdScriptStart at each script; nothing reads them.
struct ACTOR *cameraThe actor the map view
Uint8unusedAfterCamera [16]follows.
Sint32speakerThe actor speaking; the leader at each script.
struct WINDOW *msgWindowThe open message window, NULL for none.
struct WINDOW *sideWindowThe speaker's portrait window.
ACTOR_PLACEleaderPlacements [2]The leader's two-row actor placement table (its row and an end row), which fdActorResetForLeader builds.
struct WINDOW *noticeWindowA scene's timed notice.
Uint16noticeFrame
Uint16savedFadeTarget [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.
Sint16busySet while a raised or step cue runs; fdScriptStart then ends the lasting Psynergy.
Sint8revealActiveNonzero while Reveal is active.
Sint8effectTimerRunningLets the Reveal countdown advance.
Sint16revealFrameThe ticks Reveal has left.
Sint16revealCenterXWhere Reveal was cast, in
Sint16revealCenterYpixels.
Sint8ringActiveFIELD_PSYNERGY_RING's ring is shown (fdPsynergyRing); A, Select, Start or a shortcut ends it.
Sint8ringTimerRunningOff while another field Psynergy is cast.
Sint16ringFrameTicks left of the ring; 0 ends it.
Sint16choiceMsgThe first of the two names the next yes/no choice shows in place of Yes and No (mnYesNoMenuRun), 0 for those.
Sint16choiceWidthThe choice window's width, 0 for the default.
Sint16choiceSelectionThe answer the choice starts on.
Sint8psynergyActingSet while Psynergy takes effect.
Sint8castStartedSet once a cast has been announced.
Sint16queuedSoundA sound fdPlayQueuedMusic plays; -1 for none.
Uint8unusedAfterQueuedSound [2]No code names it.
struct ACTOR *movedBlockThe block fdActorLiftTargetBlock lifted, for fdActorPlaceMovedBlock.
Sint16psynergyMetatiles [56]The metatiles a Psynergy touches, as metatile coordinates, ended by -1.
Sint8psynergyHitObject
Sint8targetX
Sint8targetY
Sint8targetZ
Sint16scoopedItemThe item Scoop dug up (or its coins, SCOOPED_COINS | count), given when the leader examines it (SCOOPED_ITEM_ACTOR).
Sint8sceneAttributeLow
Sint8sceneAttributeHigh
Sint8blazeLongSpray
Sint8hoverReadyA party member knows Hover and the ship flies.
Sint8terrainKindAn SHIP_TERRAIN_KIND.
Sint8climbing
Sint16cycloneCarryXThe centre of the Cyclone teleporter
Sint16cycloneCarryZmetatile (kind 2) beside the caster, in pixels, that the Cyclone carries the leader to; -1 for none.
Sint16cycloneLiftXThe centre of the Cyclone lift metatile (kind 3) beside the caster, in pixels, that the Cyclone lifts the leader onto; -1 for none.
Sint16cycloneLiftZ
Sint16glow
Sint16glowHeld
Sint16standing
Uint16sandTrailPriority
Uint16psynergyDrawFlags
Uint8padding [2]

Description

A field scene's state: fdEngineRun allocates it in 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 RamHeapSlots->fieldState.

struct FIELD_STATE

Referenced by dbIncreaseItemAndLevelRequestExit(), fdActorCheckBlocked(), fdActorCrossRope(), fdActorCrossTightrope(), fdActorFindAtMetatile(), fdActorFindBySprite(), fdActorFindLastActiveId(), fdActorFlyOnWorldMap(), fdActorGetCueMetatileAheadOfCurrent(), fdActorGetSpriteById(), fdActorLiftTargetBlock(), fdActorLookup(), fdActorMoveAsSand(), fdActorMoveAsSandOnWorldMap(), fdActorMoveByKeys(), fdActorMoveOnWorldMap(), fdActorReleaseAtIndex(), fdActorReleaseById(), fdActorResetForLeader(), fdActorSailOnMap(), fdActorSailOnWorldMap(), fdActorTableClear(), fdActorUpdateHoverControl(), fdActorUpdatePlayerControl(), fdActorUpdateWalkingControl(), fdApplyEntrance(), fdBlazeUpdateSpray(), fdCameraFollow(), fdCameraFollowActor(), fdCameraGetActor(), fdCameraMoveWithinMapBounds(), fdCameraSetSpeedParams(), fdCameraWaitForArrival(), fdCameraWorldToScreen(), fdCheckConfiguredKeys(), fdCheckExitRegions(), fdClearRequests(), fdCountRequests(), fdCycloneCopyTouchedMetatiles(), fdEffectCheckCloakTile(), fdEncounterCountStepsAndSelectFormation(), fdEncounterSelectMapZones(), fdEngineRun(), fdFindCue(), fdFindItemCue(), fdFindPsynergyCue(), fdFlagBlockApplyFlags(), fdGetCollisionAheadOfLeader(), fdGetCollisionUnderLeader(), fdGetPartyActor() and 307 more.

Definition at line 119 of file field_state.h.

Fields in detail

tables

const ACTOR_PLACE *tables[4]

The actor placement tables placed so far, recorded by fdScriptSpawnActorTable.

cues

const CUE_VIEW *cues

The scene's cue table.

actors

struct ACTOR *actors[FIELD_ACTOR_COUNT]

The actors by actor id: 0 to 7 the party's characters, 8 on the placed actors, FIELD_TREASURE_ACTOR on the treasure spots.

stepCue

Sint16 stepCue

A step cue (1 to 230) for fdRunStepCueOrExit.

pushMetatile

Sint16 pushMetatile

A metatile's attributes for fdRunPushMetatile.

exit

Sint16 exit

The exit taken, which ends the scene; EXIT_KEEP_DESTINATION for a warp.

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

Sint16 talk

An actor's talk, as actor id | FIELD_TALK_REQUEST.

examineMetatile

Sint16 examineMetatile

A metatile's metatile behavior, for fdExamineMetatile.

encounter

Sint16 encounter

The enemy group of a random encounter.

psynergy

Sint16 psynergy

A field Psynergy to use, as unit << 10 | Psynergy.

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 FIELD_PUSH_TICKS.

heldKeys

Uint16 heldKeys

The keys held: a ledge (KEY_DOWN) and a climb (KEY_UP or KEY_DOWN) read them, and they are kept when a rope or tightrope was raised.

unusedAfterHeldKeys

Uint8 unusedAfterHeldKeys[2]

No code names it.

mode

Sint8 mode

An ACTOR_SYSTEM_MODE.

areaGraphicsPending

Sint8 areaGraphicsPending

The area's graphics are to be reloaded on the World Map (fdWorldMapFreeze, fdWorldMapReloadPendingAreaGraphics).

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: 409 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_METATILE *currentMetatile

The metatile the leader last stepped onto.

prevMetatile

struct MAP_METATILE *prevMetatile

The metatile before it.

transition

Sint32 transition

A SCENE_TRANSITION(style,

unused

Uint16 unused

variant): a TRANSITION_BACKDROP_FADE on entry.

transitionActive

Uint16 transitionActive

Set once the opening transition has started.

transitionFrame

Sint32 transitionFrame

The transition's 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.

speaker

Sint32 speaker

The actor speaking; the leader at each script.

msgWindow

struct WINDOW *msgWindow

The open message window, NULL for none.

sideWindow

struct WINDOW *sideWindow

The speaker's portrait window.

leaderPlacements

ACTOR_PLACE leaderPlacements[2]

The leader's two-row actor placement table (its row and an end row), which fdActorResetForLeader builds.

noticeWindow

struct WINDOW *noticeWindow

A scene's timed notice.

noticeFrame

Uint16 noticeFrame

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

Sint16 busy

Set while a raised or step cue runs; fdScriptStart then ends the lasting Psynergy.

revealActive

Sint8 revealActive

Nonzero while Reveal is active.

effectTimerRunning

Sint8 effectTimerRunning

Lets the Reveal countdown advance.

revealFrame

Sint16 revealFrame

The ticks Reveal has left.

revealCenterX

Sint16 revealCenterX

Where Reveal was cast, in

revealCenterY

Sint16 revealCenterY

pixels.

ringActive

Sint8 ringActive

FIELD_PSYNERGY_RING's ring is shown (fdPsynergyRing); A, Select, Start or a shortcut ends it.

ringTimerRunning

Sint8 ringTimerRunning

Off while another field Psynergy is cast.

ringFrame

Sint16 ringFrame

Ticks left of the ring; 0 ends 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.

choiceSelection

Sint16 choiceSelection

The answer the choice starts on.

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.

unusedAfterQueuedSound

Uint8 unusedAfterQueuedSound[2]

No code names it.

movedBlock

struct ACTOR *movedBlock

The block fdActorLiftTargetBlock lifted, for fdActorPlaceMovedBlock.

psynergyMetatiles

Sint16 psynergyMetatiles[56]

The metatiles a Psynergy touches, as metatile coordinates, ended by -1.

psynergyHitObject

Sint8 psynergyHitObject

targetX

Sint8 targetX

targetY

Sint8 targetY

targetZ

Sint8 targetZ

scoopedItem

Sint16 scoopedItem

The item Scoop dug up (or its coins, SCOOPED_COINS | count), given when the leader examines it (SCOOPED_ITEM_ACTOR).

sceneAttributeLow

Sint8 sceneAttributeLow

sceneAttributeHigh

Sint8 sceneAttributeHigh

blazeLongSpray

Sint8 blazeLongSpray

hoverReady

Sint8 hoverReady

A party member knows Hover and the ship flies.

terrainKind

Sint8 terrainKind

An SHIP_TERRAIN_KIND.

climbing

Sint8 climbing

cycloneCarryX

Sint16 cycloneCarryX

The centre of the Cyclone teleporter

cycloneCarryZ

Sint16 cycloneCarryZ

metatile (kind 2) beside the caster, in pixels, that the Cyclone carries the leader to; -1 for none.

cycloneLiftX

Sint16 cycloneLiftX

The centre of the Cyclone lift metatile (kind 3) beside the caster, in pixels, that the Cyclone lifts the leader onto; -1 for none.

cycloneLiftZ

Sint16 cycloneLiftZ

glow

Sint16 glow

glowHeld

Sint16 glowHeld

standing

Sint16 standing

sandTrailPriority

Uint16 sandTrailPriority

psynergyDrawFlags

Uint16 psynergyDrawFlags

padding

Uint8 padding[2]