include/field/field_state.h
FIELD_STATE, the running scene's state, with the field Psynergy's state at its end.
#include "fixed_math.h"#include "types.h"#include "edition.h"#include "static_assert.h"#include "system/globals.h"#include "field/scene_tables.h"
Included by field_internal.h, lemuria_dock.c, lemuria_palace.c, lemurian_ship.c, lobby.c, naribwe.c, osenia_cliffs.c, actor_find_at_metatile.c, yallam_rooms.c, window_selection.c and field_engine_script.h.
Structures
| Name | Description | |
|---|---|---|
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. |
Macros
| Name | Description | |
|---|---|---|
#define | FIELD_ACTOR_COUNT 80 | The actor ids FIELD_STATE.actors maps: the party's eight characters, the actors a scene places, and from FIELD_TREASURE_ACTOR on the map's treasure spots. |
#define | SCOOPED_COINS 0x8000 | FIELD_STATE.scoopedItem: coins rather than an item, their count in the low bits. |
#define | SCOOPED_ITEM_ACTOR 79 | The actor that shows what Scoop dug up. |
#define | FIELD_TREASURE_ACTOR 64 | The first actor id of a treasure spot (fdPlaceTreasureSpots). |
#define | FIELD_TALK_SILENT 0x1000 | FIELD_STATE.talk and fdTalkToActor: with this bit a container is opened without its "checked the ..." message, as Scoop opens what it digs up; the actor id is in the bits under it. |
#define | FIELD_TALK_ACTOR_MASK 0xfff | fdTalkToActor's id: the actor id, under FIELD_TALK_SILENT. |
#define | FIELD_TALK_REQUEST 0x4000 | FIELD_STATE.talk: set with the actor id under it to ask for that actor's talk. |
#define | MAP_TRANSITION_TICKS 16 | The ticks of a scene's default fade in, from the backdrop colour. |
#define | FIELD_RAISED_CUE_MENUS 250 | The raised cue the menu keys pass to the scene while FLAG_MENUS_RAISE_CUE is set. |
#define | FIELD_PUSH_TICKS 12 | The ticks the leader pushes against a step cue, a ledge, a gap or a wall before it runs, jumps or climbs (FIELD_STATE.blockedSteps). |
#define | PSYNERGY_DRAW_NO_SCENE_SPRITE 0x1 | FIELD_STATE.psynergyDrawFlags, which a scene sets for Pound and Scoop to draw in its room. |
#define | PSYNERGY_DRAW_FIXED_PRIORITY | |
#define | FieldStateWork ((FIELD_STATE *)RamHeapSlots->fieldState) | The running field scene's state, in HEAP_SLOT_FIELD; fdEngineRun takes it and frees it. |
Enumerations
| Name | Description | |
|---|---|---|
enum | FIELD_RAISED_CUE { FIELD_RAISED_CUE_PARTY_FELL, FIELD_RAISED_CUE_TELEPORT, FIEL … } | The values of FIELD_STATE.raisedCue that the field engine handles itself, rather than passing them to the scene (fdRunRaisedCue). |
enum | WORLD_MAP_RAISED_CUE { WORLD_MAP_RAISED_BOARD_SHIP, WORLD_MAP_RAISED_LEAVE_SHIP, WO … } | The raised cues the world map's movement passes to its scene, whose scripts change how the party travels. |
enum | ACTOR_SYSTEM_MODE { ACTOR_SYSTEM_MAP, ACTOR_SYSTEM_WORLD_MAP, ACTOR_SYSTEM_BATTL … } | How the actors are moved and drawn (FIELD_STATE.mode, fdActorSystemInit). |
enum | SHIP_TERRAIN_KIND { SHIP_TERRAIN_SEA, SHIP_TERRAIN_SHALLOWS, SHIP_TERRAIN_SEA_LA … } | FIELD_STATE.terrainKind: the ground the ship was last over, which sets where fdWorldMapIsFlyable lets it fly. |
Description
FIELD_STATE, the running scene's state, with the field Psynergy's state at
its end.
Macros in detail
FIELD_ACTOR_COUNT
#define FIELD_ACTOR_COUNT 80
The actor ids FIELD_STATE.actors maps: the party's eight characters, the
actors a scene places, and from FIELD_TREASURE_ACTOR on the map's treasure
spots.
Referenced by fdActorFindBySprite(), fdActorLookup(), fdActorSetOthersPaused(), fdActorTableClear(), fdActorTableSnapshot(), fdBlazeUpdateSpray(), fdDjinnResolvePending(), fdDjinnRestoreActorAfterBattle(), fdFindNearbyPsynergyTarget(), fdFindNearbyTalkTarget(), fdPsynergyBlaze(), fdPsynergyHover(), fdPsynergyParch(), fdPsynergyPound(), fdPsynergyScoop(), fdPsynergyUpdateArrow(), fdViewMoveSaveNearbySprites() and scTrialRoadShowTraps().
Definition at line 23 of file field_state.h.
SCOOPED_COINS
#define SCOOPED_COINS 0x8000
FIELD_STATE.scoopedItem: coins rather than an item, their count in the low
bits.
Referenced by fdActorShowItemIconById(), fdScoopDigUpItem() and scWorldMapGazeIntoPond().
Definition at line 27 of file field_state.h.
SCOOPED_ITEM_ACTOR
#define SCOOPED_ITEM_ACTOR 79
The actor that shows what Scoop dug up.
Referenced by fdScoopDigUpItem(), fdTalkToActor() and fdTreasureSpotMoveLeaderAway().
Definition at line 29 of file field_state.h.
FIELD_TREASURE_ACTOR
#define FIELD_TREASURE_ACTOR 64
The first actor id of a treasure spot (fdPlaceTreasureSpots).
Referenced by fdActorFindAtMetatile(), fdActorFindLastActiveId(), fdEffectSpawnRevealMarkers(), fdEngineRun(), fdFindNearbyTalkTarget(), fdPlaceTreasureSpots(), fdScriptSpawnActorTable(), fdTalkToActor(), fdTreasureSpotMoveLeaderAway(), scActorFindInMetatile(), scAirsRockMoveWhirlwind(), scAnemosInnerSanctumEnterTheRoom(), scGabombaCatacombsGabombaBestowsPower(), scGabombaCatacombsTalkToStatue(), scGabombaCatacombsUncoverMint(), scGabombaStatueDrawCogMetatiles(), scGabombaStatueFindCogAhead(), scGabombaStatueFindCogUnder(), scGabombaStatuePauseCogsInMenus(), scGaiaRockCheckAltar(), scGaiaRockHideIdol(), scGaiaRockRevealIdol(), scInit(), scIzumoScatterWeedsOverFirstAntidote(), scIzumoScatterWeedsOverLuckyMedal(), scIzumoScatterWeedsOverSecondAntidote(), scJupiterLighthouseFindElevatorRiders(), scJupiterLighthouseScatterWeedsOverMint(), scLemurianShipDeckEnterCabin(), scLemurianShipOpenDoor(), scLemurianShipOpenLowerDoor(), scLemurianShipParchHold(), scLemurianShipSetUpHold(), scLemuriaPalaceMeetKingHydros(), scLohoLiftBoulder(), scLohoOpenDoorAndEnter(), scLohoScoopBoulderGolemCore(), scLohoScoopMythrilSilver(), scLohoScoopWallGolemCore(), scMadraEnterDoor(), scMagmaRockFireFromStatue(), scMagmaRockInsideFireFromStatue(), scMikasallaEnterDoor(), scNaribweEnterDoor(), scPrepareMap(), scProxScoopUpDarkMatter(), scPushTargetFindAhead(), scSettlementsEnterHouse(), scShamanVillageCaveEnterPassage(), scShrineOfTheSeaGodInitRightProng() and 6 more.
Definition at line 31 of file field_state.h.
FIELD_TALK_SILENT
#define FIELD_TALK_SILENT 0x1000
FIELD_STATE.talk and fdTalkToActor: with this bit a container is opened
without its "checked the ..." message, as Scoop opens what it digs up; the
actor id is in the bits under it.
Referenced by fdScoopDropFromHand(), fdTalkToActor(), scGabombaCatacombsTalkToStatue(), scGaiaRockCheckAltar(), scGaiaRockInsideFindCloudBrand() and scWorldMapGazeIntoPond().
Definition at line 35 of file field_state.h.
FIELD_TALK_ACTOR_MASK
#define FIELD_TALK_ACTOR_MASK 0xfff
fdTalkToActor's id: the actor id, under FIELD_TALK_SILENT.
Referenced by fdTalkToActor().
Definition at line 37 of file field_state.h.
FIELD_TALK_REQUEST
#define FIELD_TALK_REQUEST 0x4000
FIELD_STATE.talk: set with the actor id under it to ask for that actor's
talk.
Referenced by fdEngineRun().
Definition at line 40 of file field_state.h.
MAP_TRANSITION_TICKS
#define MAP_TRANSITION_TICKS 16
The ticks of a scene's default fade in, from the backdrop colour.
Referenced by fdEngineRun() and fdScriptStart().
Definition at line 42 of file field_state.h.
FIELD_RAISED_CUE_MENUS
#define FIELD_RAISED_CUE_MENUS 250
The raised cue the menu keys pass to the scene while FLAG_MENUS_RAISE_CUE is
set.
Referenced by fdEngineRun() and fdRequestShortcut().
Definition at line 66 of file field_state.h.
FIELD_PUSH_TICKS
#define FIELD_PUSH_TICKS 12
The ticks the leader pushes against a step cue, a ledge, a gap or a wall
before it runs, jumps or climbs (FIELD_STATE.blockedSteps).
Referenced by fdFindCue(), fdRunPushMetatile() and scTrialRoadPushLog().
Definition at line 100 of file field_state.h.
PSYNERGY_DRAW_NO_SCENE_SPRITE
#define PSYNERGY_DRAW_NO_SCENE_SPRITE 0x1
FIELD_STATE.psynergyDrawFlags, which a scene sets for Pound and Scoop to draw
in its room.
nor Pound's glow on the ground
Referenced by fdPsynergyPound(), fdPsynergyScoop(), scAlhafranCaveSetUpJail(), scInit() and scMadraRoomsSetUpJail().
Definition at line 321 of file field_state.h.
PSYNERGY_DRAW_FIXED_PRIORITY
#define PSYNERGY_DRAW_FIXED_PRIORITY
Referenced by fdPsynergyPound(), fdPsynergyScoop(), scAlhafranCaveSetUpJail(), scInit() and scMadraRoomsSetUpJail().
Definition at line 322 of file field_state.h.
FieldStateWork
#define FieldStateWork ((FIELD_STATE *)RamHeapSlots->fieldState)
The running field scene's state, in HEAP_SLOT_FIELD; fdEngineRun takes it and
frees it.
Referenced by fdActorGetCueMetatileAheadOfCurrent(), fdActorGetSpriteDepth(), fdActorMoveOnWorldMap(), fdActorPlaceMovedBlock(), fdActorPlaySoundInView(), fdActorReleaseAtIndex(), fdActorResetForLeader(), fdActorRestore(), fdActorSailOnMap(), fdActorSailOnWorldMap(), fdCheckConfiguredKeys(), fdClearRequests(), fdCountRequests(), fdDjinnJoinParty(), fdEncounterRollMapStep(), fdFindActorPlacement(), fdIsRevealActive(), fdLeaderStepOffRope(), fdLeaderStepOffTightrope(), fdLeaderStepOntoRope(), fdLeaderStepOntoTightrope(), fdMessageShowAtActor(), fdPaletteCycleStep(), fdPsynergyRunTouchedScripts(), fdPsynergyTeleport(), fdPsynergyWatchLeaderDistance(), fdQueueMusic(), fdRunStepCueOrExit(), fdScriptAskYesNoAndShowResponse(), fdScriptFinishScreenTransition(), fdScriptLeaveFor(), fdScriptSetDestination(), fdScriptSetExitRequest(), fdScriptSetMessageId(), fdScriptSetSceneCues(), fdScriptShowMessageAndOfferScoop(), fdScriptShowMessageAtPos(), fdScriptStartScreenTransition(), fdScriptUpdateDebugSkip(), fdScriptWait(), fdScriptWaitTransitionTicks(), fdTalkToActor(), fdUpdateWalking(), fdWorldMapZoomOutWhileLHeld(), mnAreaNameWindowHide(), mnAreaNameWindowShow(), mnAreaNameWindowUpdate(), mnInnPlaySleep(), mnShopRestoreFieldPalette(), scAirsRockInsideLandInHall() and 235 more.
Definition at line 358 of file field_state.h.
Enumerations in detail
FIELD_RAISED_CUE
enum FIELD_RAISED_CUE
The values of FIELD_STATE.raisedCue that the field engine handles itself,
rather than passing them to the scene (fdRunRaisedCue).
| Enumerator | Value | Description |
|---|---|---|
FIELD_RAISED_CUE_PARTY_FELL | -1 | Party members fell to poison or hazardous ground this step. |
FIELD_RAISED_CUE_TELEPORT | -887 | Teleport: the picture of the whole world, shown once to choose where to go (fdPsynergyTeleport). |
FIELD_RAISED_CUE_MAP_SCREEN | -888 | R on the world map: the picture of the whole world (fdMapScreenShow). |
FIELD_RAISED_CUE_WORLD_MAP_ZOOM | -889 | L on the world map: the view zooms out while L is held. |
FIELD_RAISED_CUE_ROPE_OFF | -890 | |
FIELD_RAISED_CUE_ROPE_ON | -891 | |
FIELD_RAISED_CUE_TIGHTROPE_OFF | -892 | |
FIELD_RAISED_CUE_TIGHTROPE_ON | -893 |
Definition at line 46 of file field_state.h.
WORLD_MAP_RAISED_CUE
enum WORLD_MAP_RAISED_CUE
The raised cues the world map's movement passes to its scene, whose scripts change how the party travels.
| Enumerator | Value | Description |
|---|---|---|
WORLD_MAP_RAISED_BOARD_SHIP | 251 | A on the world map: scWorldMapBoardShip, the party boards the ship where it lies. |
WORLD_MAP_RAISED_LEAVE_SHIP | 252 | A while sailing: scWorldMapLeaveShip, the party goes ashore. |
WORLD_MAP_RAISED_TAKE_OFF | 253 | A dash key while sailing, once the ship has its wings: scWorldMapSetUpFlyingShip, the ship takes off. |
WORLD_MAP_RAISED_LAND | 254 | The winged ship come down to the water: scWorldMapSetUpShip, it sails again. |
Definition at line 70 of file field_state.h.
ACTOR_SYSTEM_MODE
enum ACTOR_SYSTEM_MODE
How the actors are moved and drawn (FIELD_STATE.mode, fdActorSystemInit).
| Enumerator | Value | Description |
|---|---|---|
ACTOR_SYSTEM_MAP | 2 | A town, a dungeon or the sprite viewer: the scrolling camera. |
ACTOR_SYSTEM_WORLD_MAP | 3 | The world map: the fixed camera, which projects 3D points onto the screen. |
ACTOR_SYSTEM_BATTLE | 4 | A battle: the fixed camera, and the battle's own motion update (fdActorUpdateAllMotion). |
Definition at line 87 of file field_state.h.
SHIP_TERRAIN_KIND
enum SHIP_TERRAIN_KIND
FIELD_STATE.terrainKind: the ground the ship was last over, which sets where
fdWorldMapIsFlyable lets it fly.
| Enumerator | Value | Description |
|---|---|---|
SHIP_TERRAIN_SEA | 0 | The sea from WORLD_MAP_COLLISION_SEA_FIRST, short of WORLD_MAP_COLLISION_SEA_LAST. |
SHIP_TERRAIN_SHALLOWS | 1 | WORLD_MAP_COLLISION_WALKABLE_FIRST and shallow water. |
SHIP_TERRAIN_SEA_LAST | 2 | WORLD_MAP_COLLISION_SEA_LAST. |
SHIP_TERRAIN_GROUND | 3 | WORLD_MAP_COLLISION_DEFAULT to WORLD_MAP_COLLISION_WALKABLE_LAST, the rest of the ground the party walks on. |
Definition at line 104 of file field_state.h.