field_runtime.h
games/tbs/include/field_runtime.h on GitHub
Structures
SceneRecord
struct SceneRecord
A scene's row in gField_SceneTable: its overlay's resource, its group (the place it belongs to), a variant and its map.
| Field | Declared as | |
|---|---|---|
resourceId | s16 resourceId | |
group | s8 group | |
variant | s8 variant | copied to gGameState.sceneVariant; 2 sets flag 0x123 |
mapIndex | u16 mapIndex | |
reserved | u16 reserved | 0 in every row; not read |
Used by Game_ResetForNewGame, Scene_LoadOverlay, gField_SceneTable.
SceneRegion
struct SceneRegion
A scene's exit region: the box that, while its condition holds, takes the party leader out through its exit.
| Field | Declared as | |
|---|---|---|
minX, minY, minZ | s16 minX, minY, minZ | pixels, inclusive; minX -1 ends the table |
maxX, maxY, maxZ | s16 maxX, maxY, maxZ | pixels, exclusive |
condition | s16 condition | -1 always, a flag | 0x1000 set, else the flag clear |
value | s16 value | the exit kind, stored in FieldWork's exit |
Used by AltmillerCave_GetRegions, BabiPalace_GetRegions, BilibinCave_GetRegions, BilibinInteriors_GetRegions, Bilibin_GetRegions, ColosseumEntrance_GetRegions, ColossoLog_GetRegions, ColossoRiver_GetRegions, Field_CheckExitRegions, ImilFuchinFalls_GetRegions, Imil_GetRegions, KalayInteriors_GetRegions, KalayTolbiDocks_GetRegions, Kalay_GetRegions, KolimaForestBend_GetRegions, KolimaForestBridge_GetRegions, KolimaForestClearing_GetRegions, KolimaForestRiver_GetRegions, KolimaForestTree_GetRegions, KolimaInteriors_GetRegions, Kolima_GetRegions, LaliveroInteriors_GetRegions, Lalivero_GetRegions, LamakanDesert_GetRegions, LemurianShip_GetRegions, MercuryLighthouseAerie_GetRegions, MercuryLighthouse_GetRegions, MogallForest_GetRegions, SceneData_ReturnZero, Scene_GetRegions, SolSanctumElementalStarRoom_GetRegions, SolSanctumEntrance_GetRegions, SolSanctumEruption_GetRegions, SolSanctumLunaSolRooms_GetRegions, SolSanctumStatue_GetRegions, TolbiInteriors_GetRegions, TolbiShipDeck_GetRegions, TolbiShipInteriors_GetRegions, TolbiShipMast_GetRegions, TolbiSpring_GetRegions and 26 more.
SceneEntries
struct SceneEntries
The entry table at the start of each scene overlay: its initialize function and the functions returning its entrances, exits, placements, events and regions, each behind a veneer word.
| Field | Declared as | |
|---|---|---|
initializeVeneer | u32 initializeVeneer | |
initialize | s32 (*initialize)(void) | |
entrancesVeneer | u32 entrancesVeneer | |
entrances | const struct SceneEntrance *(*entrances)(void) | |
exitsVeneer | u32 exitsVeneer | |
exits | const u32 *(*exits)(void) | |
placementsVeneer | u32 placementsVeneer | |
placements | const struct ScenePlacement *(*placements)(void) | |
eventsVeneer | u32 eventsVeneer | |
events | const struct SceneEvent *(*events)(void) | |
regionsVeneer | u32 regionsVeneer | |
regions | const struct SceneRegion *(*regions)(void) |
Used by gOverlayArea.
MarkerSlot
struct MarkerSlot
A map marker placed as an actor: a chest or a Psynergy stone.
| Field | Declared as | |
|---|---|---|
object | struct ObjectRuntime *object | |
id | u8 id | the trigger of its scene event |
unk05 | u8 unk05 | cleared with the slot; not named by TBS code |
column | u8 column | its 16-pixel cell |
row | u8 row |
Used by Field_PlaceMapMarkers, Marker_FindSlot, Marker_GetActor, Marker_Hide, Marker_LaunchMimic, Marker_MoveLeaderAway, Marker_SetActorPosition, Marker_ShowOpened, SetMarkerAnimationAndPlaySound.
FieldWork
struct FieldWork
Full event work allocated by Field_RunScene (heap slot 27). The twelve requests from action to event are handled by the field loop.
| Field | Declared as | |
|---|---|---|
tables | struct ScenePlacement *tables[4] | The placement tables placed so far, recorded by Event_SpawnObjectTable. |
events | const struct SceneEvent *events | the scene's event table |
actors | struct FieldActor *actors[66] | The actors by id: 0 to 7 the party's characters, 8 on the placed actors. |
markers | struct MarkerSlot markers[10] | the map's markers (MARKER_MAX) |
action | s16 action | The twelve requests: each nonzero value asks the field loop for one thing; Field_ClearRequests clears them and Field_CountRequests sums them. @{ a step event (1 to 239) for Scene_RunTouchOrExit |
input | s16 input | a tile code (252 to 254) for Field_RunPushTileEvent |
exit | s16 exit | the exit taken, which ends the scene |
menu | s16 menu | open the main menu |
examine | s16 examine | the A button: examine what is ahead |
start | s16 start | the Start button: open the pause menu |
descriptor | u16 descriptor | an actor's event, as actor | 0x1000 |
tile | s16 tile | a tile's collision code, for Field_SearchTile |
battle | s16 battle | the enemy group of a random encounter |
command | s16 command | a field Psynergy to use, as owner << 10 | Psynergy |
item | s16 item | an item to use, packed as Field_UseItem reads it |
event | s16 event | A raised event for Scene_RunRaisedEvent, or -1 when characters fell to poison or hazard damage, -888 the world map, -889 a visibility change. |
fallenCount | s16 fallenCount | @} the characters who fell this step |
survivorCount | s16 survivorCount | 0 when the whole party fell |
fallenOwners | s16 fallenOwners[9] | the characters who fell, from the active party |
itemArgument | s16 itemArgument | the inventory slot Field_UseItem receives |
blockedSteps | s16 blockedSteps | Frames the leader has pushed against something, counted by the player controls; touch events and push tiles need more than 12. |
mode | s16 mode | MODE_WORLD_MAP (3) on the world map |
encounterGroups | u8 encounterGroups[8] | encounter zone for each kind of ground |
encounterBias | s32 encounterBias | randomized distance adjustment between battles |
encounterThreshold | s32 encounterThreshold | encounter steps before a battle; 0x100000 |
walkingDistanceScale | s32 walkingDistanceScale | scales movement for PP and status updates |
walkingDistance | s32 walkingDistance | accumulated 16.16 distance awaiting an update |
currentTile | struct MapCell *currentTile | the cell the leader last stepped onto |
previousTile | struct MapCell *previousTile | the cell before it |
transition | s32 transition | SCENE_TRANSITION(style, variant); 0x100 on entry |
unk1c4 | u16 unk1c4 | not named by TBS code |
transitionActive | u16 transitionActive | set once the opening transition has started |
transitionFrames | s32 transitionFrames | frames; 16 on entry and at each event |
fastForward | s32 fastForward | debug: skip timed event waits and actor messages |
unk1d0 | u8 unk1d0[8] | not named by TBS code |
message | s16 message | the next message, advanced as each window opens |
unk1da | u16 unk1da | set to 0xffff by FieldEvent_Begin; not read by name |
unk1dc | s16 unk1dc | set to -1 by FieldEvent_Begin; not read by name |
unk1de | s16 unk1de | set to -1 by FieldEvent_Begin; not read by name |
camera | struct ObjectRuntime *camera | the object the map view follows |
unk1e4 | u8 unk1e4[0x10] | not named by TBS code |
speaker | s32 speaker | the actor speaking; the leader at each event |
messageWindow | s32 messageWindow | the open message window, 0 for none |
sideWindow | s32 sideWindow | the speaker's portrait window |
unk200 | u8 unk200[0xab6] | ObjectTable_ResetForObject builds the leader's two-row placement table at its start; nothing else names it. |
busy | u16 busy | Set while a raised or touch event runs; FieldEvent_Begin then resets the effect counter. |
revealActive | s16 revealActive | nonzero while Reveal is active |
revealFrames | s16 revealFrames | the frames Reveal has left |
revealCenterX | s16 revealCenterX | where Reveal was cast, in pixels |
revealCenterY | s16 revealCenterY | |
effectTimerRunning | s16 effectTimerRunning | Nonzero lets the Reveal countdown advance; menus and other effects pause it. |
nameMessage | s16 nameMessage | first message of the menu's name window (0: none) |
nameWidth | s16 nameWidth | width of the name window (0: the default) |
resolvingAction | s8 resolvingAction | set while Psynergy takes effect |
castStarted | s8 castStarted | set once a cast has been announced |
queuedSound | s16 queuedSound | a sound BattleFx_PlayQueuedSound plays; -1 for none |
Used by AltmillerCave_SetFadeLevel, BattleEffect_CleanupSceneObjects, BattleEffect_ClearAllObjects, BattleEffect_ClearOutOfBoundsObjects, BattleEffect_InitializeSharedScene, BattleFx_ClearRandomParticles, BattleFx_DispatchRequestKind, BattleFx_FindMatchingEvent, BattleFx_LoadActionEffectResources, BattleFx_PlayQueuedSound, BattleFx_PrepareBufferInterpolation, BattleFx_Run, BattleFx_RunVisibilityTransition, BattleFx_SetQueuedSoundAndPlay, BattleFx_StartRandomParticleEmitter, Battle_ResetEffectCounter, Battle_ShowPairedUnitWorkAndWait, Camera_FollowActor, Camera_FollowObject, Camera_GetEventObject, Camera_MoveWithinMapBounds, Camera_SetSpeedParameters, Camera_WaitForArrival, ColossoWall_RollLogToCell, CrossboneIslePillarRooms_UpdateActorPriority, Djinn_JoinParty, Encounter_RollTerrain, Encounter_SelectEnemyGroup, Encounter_SelectSceneZones, EventObject_Initialize, Event_AskYesNoWithActorAnimation, Event_CloakFades, Event_EnterDoor, Event_FinishScreenTransition, Event_FlipFirstSwitch, Event_FlipSecondSwitch, Event_PushPipeworksBlock, Event_ReadLeftGuardsThoughts, Event_RequestDestination, Event_RollLongLog and 85 more.
FieldPosition
struct FieldPosition
A position on the field.
| Field | Declared as | |
|---|---|---|
x, y, z | s32 x, y, z | 16.16 fixed-point pixels |
Used by AltmillerCave_CheckFrostTargetCollision, AltmillerCave_HopSelectedActor, BabiLighthouse_FindActorAhead, BattleFx_CheckRaisedTargetCollision, BattleFx_SteerPushedTarget, ColossoLog_PushActorAhead, ColossoRiver_PushObjectAhead, ColossoWall_PushAdjacentObstacle, Colosso_FindActorAhead, CrossboneIslePillarRooms_TryJumpAcrossPillar, Event_HopEast, Event_HopNorth, Event_HopSouth, Event_HopSouthOrPushBlocks, Event_HopWest, Event_JumpAcrossGap, Event_JumpAcrossRoofGap, Event_JumpGapWest, Event_JumpToNextPillar, Event_PushActorAhead, Event_PushBlock, Event_PushOrClimbDown, FieldFx_RunForce, FieldObject_CheckMovementCollision, FieldObject_UpdatePlayerControl, FieldVector_AddPolarOffset, Field_ClimbDown, Field_ClimbUp, Field_TryJumpForward, Imil_RunIceSlide, Imil_SlideActorAcrossIce, Kalay_PushTunnelBlock, KolimaForest_HopEast, Map_CheckObjectStep, Map_UpdateWorldMapMarkers, MeetSandMonster, MercuryLighthouseAerie_JumpToPlatform, MercuryLighthouse_HopAcrossPool, MogallForest_FirstArea_JumpNorth, MogallForest_FirstArea_JumpSouth and 23 more.
Globals, without a comment: gField_SceneTable, gOverlayArea.