Alchemy

field

games/tbs/include/field on GitHub

a9_motion.h

games/tbs/include/field/a9_motion.h

animspr.h

games/tbs/include/field/animspr.h

Structures

AnimationEntry

struct AnimationEntry

One animation layer of a sprite: its animation id, frames, running script and timer.

FieldDeclared as
animIds16 animIdthe sprite id whose metadata and frames it uses
timeru16 timerTime left on the current frame in sixteenths of a frame, read signed: each timed command adds its argument times 16, each frame takes off step.
kindu8 kindThe facing table its frames follow (from the metadata, or ANIM_CMD_SET_KIND); zero marks a free layer record.
paramu8 paramSpriteColorMode its pixels are drawn with; 0 when taken
priorityu8 prioritydrawing order 0 to 3 among the layers; above 3 not drawn
modeu8 modeframe codec: 1 type-01, 3 LZ, anything else raw
framesvoid **framesframe pointers, from the metadata or a resource slot
scriptsu8 **scriptsthe metadata's command scripts, one per animation number
scriptu8 *scriptthe running script; null when stopped (ANIM_CMD_END)
posu8 posbyte offset of the next command in script
stepu8 steptaken off timer each frame; 16 is normal speed
frameu8 frameframe shown, frameBase plus the facing offset; 255 none
frameBaseu8 frameBaseframe the script chose, before facing; 255 blank

Used by AnimationObject_Allocate, AnimationObjects_SelectAnimation, AnimationObjects_SetActiveFrameTimers, AnimationObjects_SetActiveTimerSteps, Animation_ApplyChildPalette, Animation_InitWorkFromMetadata, Animation_InitializeObjects, Animation_SetWorkEntry, BattleActor_SpawnObjectsForList, BattleEffect_PauseObject, BattleEvent_Playback, BattleMotion_SetMode5AndActivateSlot, BattleMotion_SetRecordChildValues, BattleMotion_ShowDowned, BattleMotion_SpawnSlotEffectAndWait, BattleStatusIcon_Cycle, FieldFx_BlinkAvoidCaster, FieldFx_EndCloak, FieldFx_RunAvoid, FieldFx_StartCloak, MercuryLighthouse_FollowLeader, ObjectDispatch_ApplyValueToKind200Children, ObjectGroup_ApplyIndexedChildValue, ObjectGroup_ApplyRandomChildValues, ObjectGroup_SetChildValue, ObjectGroup_SetChildValueUnlessFifteen, ObjectGroup_UpdateMembers, ObjectSystem_Configure, ObjectTable_ResetForObject, ResourceMetadata_ClearRecord, ResourceMetadata_Register, ResourceMetadata_ReleaseSlot, ResourceMetadata_Unregister, ResourceObject_Release, Sprite_ComposeAnimationFrame, Storm_SetActorFrameMode, TolbiSpring_SetActorAppearance, Ui_FillGridColumnFromMetadata, Ui_SetGridColumnNumber, gAnimationObjects.

Line 37

ResourceSlot

struct ResourceSlot

A resource slot: the tag of the animation loaded into it (slot number and animation id) and the buffer holding its frames.

FieldDeclared as
tags32 tag(slot << 12) | animation id
buffervoid *bufferthe decoded frames, their offsets made pointers

Used by Animation_LookupValueByKey, ResourceSlot_Load.

Line 59

ObjectSystemWork

struct ObjectSystemWork

The object system's work: the flag that suspends sprite projection, the outline's edge and fill colours, and the resource slots. Heap slot 6.

FieldDeclared as
usedu16 usedsprite pixel bytes composed since the camera reset it
unk02u8 unk02[2]not named by TBS code
suspendeds16 suspendednonzero while a menu has suspended sprite projection
edgeu8 edgeoutline edge colour; 15 when the field sets up
fillu8 filloutline fill colour; 0 when the field sets up
unk08u8 unk08[0x10]the sprite group tables, taken in turn by count
counts32 countsprite group tables taken from unk08
slotsstruct ResourceSlot slots[8]

Used by Colosso_FadeInCompetitor, Colosso_RestoreCompetitor, ItemMenu_Run, Map_ShowWorldMap, ObjectSystem_Initialize, ObjectSystem_UpdateCamera, ObjectSystem_UpdateCameraFixed, PsynergyMenu_Run, ResourceSlot_Load, Sprite_ComposeAnimationFrame, StatusMenu_Run, gMenuCtrlWork.

Line 66

AnimationSpritePart

struct AnimationSpritePart

The hardware sprite attributes one part of an animated sprite (its image or its shadow) is drawn with.

FieldDeclared as
unk00u8 unk00[4]The link to the next part queued in the same depth slot this frame (Runtime_PushSlotEntry).
yu16 y : 8The OAM entry's attributes 0 to 2. @{ screen pixels
affineu16 affine : 20 plain, 1 affine, 3 affine at double size
objectModeu16 objectMode : 2
mosaicu16 mosaic : 1
fullColoru16 fullColor : 1256 colours; set for both parts when created
shapeu16 shape : 2
xu16 x : 9screen pixels
affineIndexu16 affineIndex : 5affine matrix, or 8 for a mirrored plain sprite
sizeu16 size : 2
tileu16 tile : 10first sprite tile in VRAM
priorityu16 priority : 22 when created
paletteu16 palette : 4
unk0au8 unk0a[2]@} zero when created; not named by TBS code

Used by Colosso_UpdateLettering, Curtain_Close, FadeOverlay_DrawMarks, Map_UpdateWorldMapMarkers, Render_ApplyProjectedPlacement, Render_PlaceProjectedSprite, Render_PlaceSpritePartPair, ResourceObject_Create, SolSanctumStatue_UpdateScrollingSprites, sCurtainSprites.

Line 84

AnimationObject

struct AnimationObject

An animated sprite: its image and shadow, scale, rotation, size and up to four animation layers.

FieldDeclared as
imagestruct AnimationSpritePart image
shadowstruct AnimationSpritePart shadow
scales32 scale16.16 fixed point, 0x10000 full size
slotu8 slotVRAM cache entry holding its tiles
retainCacheEntryu8 retainCacheEntry : 1Keeps the VRAM cache entry when it is released or off screen.
useOwnScaleu8 useOwnScale : 1Drawn at its own scale, not scaled by distance (fixed camera).
unk1d2u8 unk1d2 : 6not named by TBS code
rotationu16 rotation1/65536 turns
widthu8 widthpixels; zero marks a free sprite
heightu8 heightpixels
offsetXs8 offsetXpixels
offsetYs8 offsetYpixels
lastNou8 lastNoThe animation number last selected, which selecting again skips.
dirtyu8 dirtynonzero redraws its pixels into VRAM when next drawn
flagsu8 flagsbits: 1 outlined in ObjectSystemWork's edge and fill colours | 0 shadow drawn (set when created)
countu8 countlayers in use, up to the last one present
entriesstruct AnimationEntry *entries[4]its layers; empty ones null

Used by Actor_WaitForAnimationEnd, AnimationObjects_SelectAnimation, AnimationObjects_SetActiveFrameTimers, AnimationObjects_SetActiveTimerSteps, Animation_ApplyChildPalette, Animation_InitializeObjects, Animation_SetIndexAndInitObjects, BabiLighthouse_MatchLeaderPriority, BabiPalace_ApplyEntryState, BattleActor_SpawnObjectsForList, BattleActor_UpdateSpritePriorities, BattleEffect_UpdatePhasedRadialParticle, BattleEvent_Playback, BattleFx_DrawScaledObject, BattleFx_RunGaia, BattleFx_RunJudgment, BattleFx_RunKirin, BattleFx_RunMercuryDjinnCapture, BattleFx_RunParticleStreams, BattleFx_RunRamses, BattleFx_SetupObjectPair, BattleFx_SpawnDescendingArcParticles, BattleFx_SpawnItemBreakMode3, BattleFx_SpawnObjects, BattleFx_SpawnScaledArcObjects, BattleFx_StartEffectObject22, BattleFx_StartRandomParticleEmitter, BattleMotion_ProjectConditionalPosition, BattleMotion_ProjectPosition, BattleMotion_ProjectScaledPosition, BattleMotion_SetMode5AndActivateSlot, BattleMotion_SetRecordChildValues, BattleMotion_ShowDowned, BattlePres_RunAttack, BattlePres_RunItem, BattlePres_RunPlainAttack, BattlePres_RunPsynergyCast, BattlePres_RunUnitAction, BattlePresentation_RunUnitTransition, BattleStatusIcon_Cycle and 144 more.

Line 108

Enumerations

SpriteColorMode

enum SpriteColorMode

AnimationEntry.param: how Render_DecodeFrame colours a layer's pixels. Modes 1 to 6 and 9 to 11 run them through a 256-byte table (the five gResourceSlot_ConversionTables, then the four gRuntime_ByteRemapTable ones); the solid modes paint every drawn pixel one colour of the basic sprite palette. Mode 8 is a second white and mode 12 reads past the tables.

Value=
SPRITE_COLOR_NORMAL0
SPRITE_COLOR_GRB1red and green swapped
SPRITE_COLOR_RBG2green and blue swapped
SPRITE_COLOR_BGR3red and blue swapped
SPRITE_COLOR_GBR4red to blue, green to red, blue to green
SPRITE_COLOR_BRG5red to green, green to blue, blue to red
SPRITE_COLOR_GREY6greyscale
SPRITE_COLOR_WHITE7solid colour 15, white
SPRITE_COLOR_BLUE_TINT9blue raised to full
SPRITE_COLOR_RED_TINT10red raised to full
SPRITE_COLOR_GREEN_TINT11green raised to full
SPRITE_COLOR_FILL13solid gDecodeFillByte
SPRITE_COLOR_BLACK14solid colour 1, black
SPRITE_COLOR_HIDDEN15solid colour 0, transparent

Line 18

colosso_gauge.h

games/tbs/include/field/colosso_gauge.h

Structures

ColossoGaugeSprite

struct ColossoGaugeSprite

One sprite of the race gauge's list: a link word, its position and shape attributes, and its tile.

FieldDeclared as
links32 linkwritten 0; Runtime_PushSlotEntry links the queue through it
attrs32 attrOAM attributes 0 and 1: y | x << 16 | shape and size bits
tiles32 tileOAM attribute 2: the tile, with palette 14 and priority 1

Used by Colosso_DrawGauge.

Line 16

ColossoGaugeWork

struct ColossoGaugeWork

The Colosso race gauge's work at the start of the race's heap slot (HEAP_SLOT_COLOSSO_RACE): its sprites, how far it has slid down, the racers and the finish.

FieldDeclared as
spritesstruct ColossoGaugeSprite sprites[18]The bar, its ends and the racers' marks: 2 * segments + 6 sprites, all 18 for the Colosso Log's six segments.
vramBlocks16 vramBlockThe VRAM cache entry holding the gauge's tiles: released while the gauge is hidden, and loaded again when it slides back down.
levels16 level0 hidden to 2 fully down, stepping up while FLAG_MENU_OPEN is clear and down while it is set; the bar's y is level * 6 - 8.
holds16 holdNonzero keeps the gauge down (level 2); only the unused Colosso_SetGaugeHold sets it.
playerActors16 playerActorthe actor id drawn as the player's marker
rivalActors16 rivalActorThe actor id drawn as the rival's marker, and the actor that runs the recorded path.
finishItemActorAu16 finishItemActorAThe first finisher's prize: the actor raised over that finisher, who stops at finishZ minus 16 pixels.
finishItemActorBu16 finishItemActorBThe second finisher's prize; that finisher stops at finishZ plus 16 pixels.
segmentss16 segments16-pixel bar pieces either side of the centre: 6 in the Colosso Log, 4 in the River and 5 in the Wall.
finishXs32 finishX16.16 fixed-point pixels: the rival starts opposite Isaac across it and runs its path mirrored across it.
finishZs32 finishZ16.16 fixed-point pixels

Used by ColossoLog_CollectFinishEquipment, ColossoRiver_CollectFinishItem, ColossoWall_ApproachFinishAndTakeItem, Colosso_DrawGauge, Colosso_SetGaugeHold.

Line 25

Macros

HEAP_SLOT_COLOSSO_RACE

#define HEAP_SLOT_COLOSSO_RACE 59

The heap slot of the Colosso finals' race work (struct ColossoRaceWork), which gColossoWork reads by its own name.

Used by ColossoWall_ApproachFinishAndTakeItem, ColossoWall_StartRivalPath, Colosso_SetGaugeHold, Colosso_StartRaceGauge, FieldScene_BuildDescriptorAndInstallTask.

Line 12

effect_step.h

games/tbs/include/field/effect_step.h

Functions, without a comment: EffectStep_Coordinates, EffectPosition_Coordinates.

Structures

EffectStep

struct EffectStep

A moving point of an effect: its position, its velocity and a value each effect uses its own way (a size, a timer, -1 for idle).

FieldDeclared as
x, y, z, coordinatesunion { struct { s32 x; ///< 16.16 fixed-point pixels s32 y; ///< 16.16 fixed-point pixels s32 z; ///< 16.16 fixed-point pixels }; s32 coordinates[3]; }
xs32 x16.16 fixed-point pixels
ys32 y16.16 fixed-point pixels
zs32 z
velocityXs32 velocityX16.16 fixed-point pixels per frame
velocityYs32 velocityY16.16 fixed-point pixels per frame
velocityZs32 velocityZ16.16 fixed-point pixels per frame
variants32 varianteach effect's own: a size, a countdown, -1 for idle

Used by BattleFx_RunAnnihilation, BattleFx_RunAstralBlast, BattleFx_RunAtalanta, BattleFx_RunBeamSequence, BattleFx_RunBind, BattleFx_RunBladeRain, BattleFx_RunBolt, BattleFx_RunBoreas, BattleFx_RunBreak, BattleFx_RunBurstScene, BattleFx_RunBurstShower, BattleFx_RunCastingImpact, BattleFx_RunCybele, BattleFx_RunDjinnBeams, BattleFx_RunDjinnHeal, BattleFx_RunDjinniEntrance, BattleFx_RunDouse, BattleFx_RunDragonCloud, BattleFx_RunDrain, BattleFx_RunElementBurst, BattleFx_RunElementPillar, BattleFx_RunEruption, BattleFx_RunFire, BattleFx_RunFlare, BattleFx_RunFrost, BattleFx_RunFroth, BattleFx_RunGaia, BattleFx_RunGatheringLights, BattleFx_RunGround, BattleFx_RunGrowingColumns, BattleFx_RunHail, BattleFx_RunHaunt, BattleFx_RunHealingMotes, BattleFx_RunHelmSplitter, BattleFx_RunIce, BattleFx_RunImpactBurst, BattleFx_RunJudgment, BattleFx_RunJupiter, BattleFx_RunKirin, BattleFx_RunLobbedShells and 47 more.

Line 13

EffectPosition

struct EffectPosition

A point projected onto the screen, with its depth.

FieldDeclared as
x, y, depth, coordinatesunion { struct { s32 x; ///< screen pixels s32 y; ///< screen pixels s32 depth; ///< projected depth, larger further away }; s32 coordinates[3]; }Projection writes three coordinates; effects read their named components.
xs32 xscreen pixels
ys32 yscreen pixels
depths32 depth

Used by BattleFx_DrawStreaks, BattleFx_RunAnnihilation, BattleFx_RunAstralBlast, BattleFx_RunAtalanta, BattleFx_RunBeamSequence, BattleFx_RunBind, BattleFx_RunBladeRain, BattleFx_RunBolt, BattleFx_RunBreak, BattleFx_RunBurstScene, BattleFx_RunBurstShower, BattleFx_RunCastingImpact, BattleFx_RunCondemn, BattleFx_RunCybele, BattleFx_RunDeathPlunge, BattleFx_RunDjinnBeams, BattleFx_RunDjinnHeal, BattleFx_RunDjinniEntrance, BattleFx_RunDragonCloud, BattleFx_RunDrain, BattleFx_RunElementBurst, BattleFx_RunElementPillar, BattleFx_RunEruption, BattleFx_RunFire, BattleFx_RunFrost, BattleFx_RunFroth, BattleFx_RunGatheringLights, BattleFx_RunGround, BattleFx_RunHail, BattleFx_RunHaunt, BattleFx_RunHealingMotes, BattleFx_RunHelmSplitter, BattleFx_RunJudgment, BattleFx_RunKirin, BattleFx_RunLobbedShells, BattleFx_RunMirroredWall, BattleFx_RunMoteFountain, BattleFx_RunNeptune, BattleFx_RunOrbitingSkulls, BattleFx_RunOrbitingSpirals and 36 more.

Line 46

event_work.h

games/tbs/include/field/event_work.h

Structures

EventWork

struct EventWork

The running scene's event work: its placement and event tables, its actors, the triggers and exit it has hit, encounters, transitions and the message on show. It is struct FieldWork (heap slot 27) as the scenes see it, through gEventWork; each field is the FieldWork field at its offset.

FieldDeclared as
tablesstruct ScenePlacement *tables[4]the placement tables placed so far
eventsstruct SceneEvent *eventsthe scene's event table
actorsstruct FieldActor *actors[8]the party's characters, ids 0 to 7
placedActorsstruct FieldActor *placedActors[58]the placed actors, from id 8
unk11cu8 unk11c[0x50]FieldWork's markers; not named by TBS code
touchedTriggers16 touchedTriggerthe step event a touch or exit event answers
unk16eu8 unk16e[2]FieldWork's input request; not named by TBS code
requestedExitu16 requestedExitthe exit kind taken, which ends the scene
unk172u16 unk172FieldWork's menu request; scenes set it to 1
unk174u8 unk174[6]FieldWork's examine, start and descriptor
facingTriggers16 facingTriggerthe collision code ahead, which a search answers
encounterEnemyGroupu16 encounterEnemyGroupthe next battle's enemy group, 0 for none
psynergyRequests16 psynergyRequesta field Psynergy to use, as owner << 10 | Psynergy
unk180u8 unk180[2]FieldWork's item request; not named by TBS code
raisedTriggers16 raisedTriggera raised event for Scene_RunRaisedEvent
unk184u8 unk184[0x18]FieldWork's fallen characters and item slot
blockedStepss16 blockedStepsframes the leader has pushed against something
modes16 modeMODE_WORLD_MAP (3) on the world map
encounterGroupsu8 encounterGroups[8]encounter zone for each kind of ground
encounterBiass32 encounterBiasrandomized distance adjustment between battles
encounterThresholds32 encounterThresholdencounter steps before a battle
unk1b0u8 unk1b0[0x10]FieldWork's walking distance and tiles
startTransitions32 startTransitionSCENE_TRANSITION(style, variant)
unk1c4u8 unk1c4[4]FieldWork's unk1c4 and transitionActive
transitionFramess32 transitionFramesframes
unk1ccu8 unk1cc[0x0c]FieldWork's fastForward and unk1d0
messageu16 messagethe next message, advanced as each window opens
unk1dau8 unk1da[6]FieldWork's unk1da to unk1de
viewCenterstruct FieldActor *viewCenterthe object the map view follows
unk1e4u8 unk1e4[0xade]not named by TBS code through this view
choiceMessageu16 choiceMessageMessage containing the choices.
unkcc4u16 unkcc4FieldWork's nameWidth; Colosso sets it to 4

Used by AltmillerCave_InitializeDarkness, BabiPalace_LeaveThroughDoor, BabiPalace_WakeAfterFinals, ColossoLogRollingStage_SceneTask, ColossoLog_RunCompetitorTalk, ColossoWall_RollLogToCell, Colosso_AskDoneCheering, Colosso_RaiseTakePlaceOnPsynergy, Colosso_TakePlaceForMatch, Event_AskAboutJourney, Event_AskWhetherMaskedManWasFelix, Event_DepartForQuest, Event_DoraWakesIsaac, Event_EnterDoor, Event_EnterSparklingPassage, Event_EnterWideDoor, Event_FightFirstMonster, Event_FightFourthMonster, Event_FightSecondMonster, Event_FightThirdMonster, Event_HurryToThePlaza, Event_InspectSecondMinotaurRelief, Event_LeaveByExit, Event_LeaveThroughDoor, Event_LeaveThroughEntrance, Event_MeetCorona, Event_MeetHail, Event_MeetVine, Event_OpenDoorAndLeave, Event_PushPipeworksBlock, Event_PushWestPillar, Event_ReadCorneredSuspectsMinds, Event_ReadRelief, Event_ReturnFromMtAleph, Event_RideMovingSidewalk, Event_RollLongLog, Event_TakeTouchedExit, Event_TalkToWallWedgeAttendant, Event_TravelersLeaveAfterBattle, Event_UnlockColumnRoomDoor and 68 more.

Line 20

facing_object.h

games/tbs/include/field/facing_object.h

Structures

FacingObject

struct FacingObject

A field object seen as one that turns toward its facing target: its facing, its ground position and the target.

FieldDeclared as
unk00u8 unk00[6]
facingu16 facing1/65536 turns
positionXs32 positionX16.16 fixed-point pixels
unk0cu8 unk0c[4]
positionZs32 positionZ16.16 fixed-point pixels
unk14u8 unk14[0x46]
facingFlagsu8 facingFlagsThe steering flags (SW_STEERING); bit 0, turning toward its velocity, is cleared while it turns toward its target.
unk5bu8 unk5b[9]
unk64s16 unk64work value 0x23 (actionParameter); not read through this view
facingTargetstruct FacingObject *facingTargetThe linked object (work value 0x25), or null.

Used by FacingObject_TurnPairToFaceEachOther, Scene_TurnTowardTarget.

Line 12

field.h

games/tbs/include/field/field.h

Structures

Flags35

struct Flags35

An actor seen only as its priority flags at 0x23 (enum ActorPriorityFlag).

FieldDeclared as
padu8 pad[35]
flagsu8 flags

Line 57

OverlayActorPosition

struct OverlayActorPosition

An actor seen only as the coordinate at 0x08, which Goma Cave's stump reads in 16-pixel map cells.

FieldDeclared as
pad00u8 pad00[8]
depthFixeds32 depthFixed16.16 fixed-point pixels

Line 63

OverlayActorState

struct OverlayActorState

An actor seen only as its priority flags at 0x23 (enum ActorPriorityFlag).

FieldDeclared as
pad00u8 pad00[35]
flagsu8 flags

Line 68

PathRecorder

struct PathRecorder

The Colosso rival's path player in the scene state: its mode (1 playing, 2 recording, 9 finished), whether it mirrors the path, the actor, its place in the path and how long the actor has stood still.

FieldDeclared as
modes16 mode
mirrors16 mirror
actors16 actor
posu16 pos
stills16 stillframes

Used by ColossoLog_MarkRivalFinished, ColossoLog_WaitForRivalToFinish, ColossoWall_MarkRivalFinished, ColossoWall_StartRivalPath, ColossoWall_WaitForRivalFinish, Colosso_StartRival, Colosso_UpdatePathRival.

Line 75

SwitchCell

struct SwitchCell

A Venus Lighthouse switch or pillar socket's map cell.

FieldDeclared as
xu32 x16-pixel map cells
zu32 z16-pixel map cells

Used by gVenusPillarCells, gVenusSwitchCells.

Line 89

TileRun

struct TileRun

A log in Kolima Forest lying across four map cells, from its first cell across or, when vertical, down.

FieldDeclared as
ids16 id
xs16 xmap cells
ys16 ymap cells
verticals16 vertical
unused08s16 unused08
unused0as16 unused0a

Line 99

Also, structures without a comment: Slot, T.

Globals, without a comment: gIwram_Data1, gIwram_Data2, gObjectDispatch_DefaultScript, gWorldMap_TerrainBehaviorTable, Render_DecodeFrameCodeSize, gRuntime_ByteRemapTable, gAltinPeak_PaletteHold, gAltinPeak_PaletteStep, gBattleFx_BurstParticleScriptA, gBattleFx_BurstParticleScriptB, gWorldMap_GraphicsResources, gObjectMotion_WaitScript, gFieldFx_SparkleTiles, gField_TileMessageOffsets, gFieldFx_MoteTiles, gFourObjectMotion_ResourceIds, gTolbiShipInteriors_ShakeTimer, gKolimaForestBendLayout, gKolimaForestBendRecords, gKolimaForestBendReturned, gObjectSlots, gScanlineAngle, gScanlinePitch, gBabiPalace_Events2AfterColosso, gWorldMapPackedFrames, gWorldMapPackedTiles, gWorldMapPalettes, gKalay_DanceStep, gKolimaForestBend_ShakeChance, gKolimaForestBend_ShakeScroll, gKolimaPalette_First, gKolimaPalette_Second, gColosso_CompetitorStartAngle, gColosso_CompetitorStartX, gColosso_CompetitorStartZ, gColosso_GaugePalette, gColosso_MarkerOam, gColosso_ModeBlendDuration, gColosso_ModeBlendStart, gColosso_ModeBlendStep, gColosso_ModeBlendTarget, gColosso_ModeMoveStart, gColosso_ModeMoveStep, gColosso_ModeScaleDuration, gColosso_ModeScaleStart, gColosso_ModeScaleStep, gColosso_ModeScaleTarget, gColosso_LetteringSprites, gVaultInteriors_StopTimer, Object_UpdateAllCodeSize, gObjectGroup_BlinkChildValues, gObjectMotion_ActionKind1Script, gObjectMotion_ActionKind2Script, gObjectMotion_ActionKind3Script, gObjectMotion_ActionKind4Script, gObjectMotion_LaunchScript, gObjectMotion_MoveTowardTargetScript, gObjectMotion_ResetActionScript, gObjectMotion_StepAngleScript, gObjectMotion_TurnTowardLinkedScript, gObjectMotion_VariantScripts, gLamakanDesert_SandEffectTiles, gLamakanDesert_SandPalette, gLamakanDesert_SandPhase, gLamakanDesert_SandTileBuffer, gLamakanDesert_SandVramSlot, gLamakanDesert_SandWork, Render_DecodeFrame, gSolSanctumStatue_SpriteRowsGfx, gStagedActor_FootprintKinds, TileMap_DrawRows, TileMap_DrawRowsCodeSize, Transform_UpdateVerticesSize, gWorldMap_FootprintActions, gWorldMap_KeyHeadings.

Declarations, without a comment: CalculateFacingAngle, Engine_ActorFollow, Engine_EventClearInvalidPackedValues, Engine_PartyRemoveItem, FarCall_BlankLoadTable, FarCall_BlankRunTable, FieldScene_PrepareActors, GameFlag_IsSet, WorldMap_BeginStillView, Math_Atan2, Object_Destroy, ScenePlacement_ClipToView, SceneTable_Prepare.

field_coordinate.h

games/tbs/include/field/field_coordinate.h

Unions

FieldCoordinate

union FieldCoordinate

A field coordinate, read whole or as its fraction and its whole pixels.

FieldDeclared as
fixeds32 fixed16.16 fixed-point pixels
fraction, pixel, partstruct { u16 fraction; ///< 1/65536 pixels s16 pixel; ///< pixels } part

Used by AltmillerCave_HopSelectedActor, Field_ClimbDown, Field_ClimbUp, Field_TryJumpForward, Map_CheckObjectStep, MercuryLighthouseAerie_FlickerBeacon, MercuryLighthouse_HopAcrossPool, ObjectMotion_CenterOnColumn, StagedActor_RunStepEffect, VaultInteriors_TryJumpTo, offsetof.

Line 11

Globals, without a comment: offsetof.

mapcopy.h

games/tbs/include/field/mapcopy.h

objdisp.h

games/tbs/include/field/objdisp.h

perspective.h

games/tbs/include/field/perspective.h

Structures

PerspectiveWork

struct PerspectiveWork

The world map's perspective view: the followed position, screen shake, view position, window, pitch and yaw, tile ids and zoom. Heap slot 8.

FieldDeclared as
origins32 *originthe followed point, as in MapScrollWork
shakeX, shakeY, shakeDecays32 shakeX, shakeY, shakeDecaythe screen shake, as in MapScrollWork
scriptu8 *scriptNULL at load
fadeu16 fadeMapScrollWork's flags: REG_DISPCNT bits, 0x1f00 at load
fadeStepu8 fadeStepMapScrollWork's wideTiles, 0x80 at load
unk017u8 unk017[0xe4 - 0x17]as MapScrollWork: tile animations, blend script
viewXs32 viewX16.16 fixed-point pixels
viewYs32 viewY16.16 fixed-point pixels
scaleXs32 scaleX0x200000 at load
scaleYs32 scaleY0x400000 at load
limitXs32 limitX0x1fe00000 at load
limitYs32 limitY0x1fe00000 at load
animationActives8 animationActiveSet by WorldMap_BeginStillView while BG1 shows the drawn map; the tile animations are then neither suspended nor resumed.
unk0fdu8 unk0fd[3]not named by TBS code
windowTopu16 windowTopScreen rows, 0 and 159 at load and 200 and 255 from WorldMap_BeginStillView; each frame copies them to shownTop and shownBottom and picks BG mode 2 or 0 from them. @{
windowBottomu16 windowBottom
shownTopu16 shownTop@} windowTop as the frame update last applied it
shownBottomu16 shownBottomwindowBottom as the frame update last applied it
windowPendingu16 windowPendingcleared by the frame update; not set by name
unk10au8 unk10a[6]not named by TBS code
tilesvoid *tilesThe world map's tile offsets (ResourceId_PerspectiveDataA), each tile LZ-compressed.
unk114u8 unk114[4]not named by TBS code
pitchu16 pitch1/65536 turns
yawu16 yaw1/65536 turns
resourcesu32 *resourcesa row of gWorldMap_GraphicsResources, by terrain
unk120u8 unk120[0x18]not named by TBS code
tileIdsu16 tileIds[256]the world map tile in each of 16 by 16 cells
quarterTilesu16 quarterTiles[8]The tile each quarter of each layer's block buffer shows, so an unchanged quarter is not decoded again.
farPlanes32 farPlane0x1fe0000 at load
distances32 distancefarPlane scaled by the zoom
previousZooms32 previousZoomthe zoom a transition starts from
zooms32 zoom16.16 fixed point, 0x10000 full size
zoomTransitionFramesu16 zoomTransitionFramesa zoom transition's length; 0 when none
zoomTransitionSteps16 zoomTransitionStepframes of the transition done

Used by Map_WriteLayerCellTile, Object_MoveOnWorldMap.

Line 12

script.h

games/tbs/include/field/script.h

Structures

ScriptInterpreter

struct ScriptInterpreter

The prefix that command handlers read from a field object's 0x70-byte slot.

FieldDeclared as
scriptconst s32 *scriptthe running script; SC_END sets gScript_MainScript
cursors16 cursorthe word index of the next command in script
padding06u8 padding06[0x4e]the object's own fields; not read by the commands
spriteStorageKindu8 spriteStorageKindFieldActor's spriteStorageKind: SC_B54_ON sets 1, one sprite drawn, and SC_B54_OFF sets 0, which hides the object's sprites.
padding55u8 padding55[2]the object's own fields; not read by the commands
conditionResultu8 conditionResultthe last flag test, read by SC_IF and SC_IFNOT
padding58u8 padding58[5]the object's own fields; not read by the commands
repeatCountu8 repeatCountSC_LOOP's count of jumps so far
waits16 waitFrames left of SC_WAIT (n - 1 when it starts); the update loops count it down, and Script_FindLabel clears it.
refusedu8 refusedFrames in a row a solid object has refused the object's move (ScriptMotionObject.refused); SC_SYNC stops waiting after 60 and clears it.

Used by Actor_DrawBehindScenery, BilibinCave_ClearScriptedActorSpriteFlags, Camera_FollowLeaderInBounds, ColossoLogRollingStage_AdvanceParticleMotion, ColossoLogRollingStage_RaiseLinkedSceneEffect, ColossoLog_ShowActivatedSidewalkLayer, ColossoRiver_PlaceFinishItemAboveActor, ColossoWall_RaiseLinkedSceneEffect, CrossboneIslePillarRooms_SetChildValueFromTimer, Event_MovePillarSwitchBlock, Event_MoveSwitchBlock, FieldObject_UpdatePlayerControl, Field_CheckConfiguredKeysAndCount, Field_IsRevealActive, FuchinTemple_ClearScriptedActorSpriteFlags, Fuchin_SetDustPalette, Garet_StepOnDeck, GomaCavePillar_FinishFragment, Imil_UpdateShiver, Ivan_StepOnDeck, Kalay_UpdateTouristFidget, KolimaForestBridge_BurstOnBarrier, KolimaForestBridge_FlashHitBarriers, KolimaForestBridge_TwinkleGroundSparkle, Kolima_ApplyPendingPose, Kolima_FlickerCurseDust, Kolima_TriggerRegionScript, Kolima_UpdateFallingDebris, Kolima_UpdateTimedAppearance, Leader_StepOnDeck, Maid_Sigh, MercuryLighthouseEntrance_PlayStepSound, MercuryLighthouse_FollowLeader, MercuryLighthouse_StartStatueSpray, Mia_StepOnDeck, MogallForest_ClearActorSpriteFlags, MogallForest_CopyTimerToChild, ObjectDispatch_WaitForValue16, Object_ApproachLinkedObject, Object_MoveByKeys and 75 more.

Line 16

ScriptOperands

struct ScriptOperands

The whole 0x70-byte slot as SC_SET, SC_ADD and SC_CMP see it: each field is one work value (enum ScriptWork in objcmd.h), reached through gScript_OperandHandlerTable, and named for what the engine keeps there. The types are the widths the handlers read, not the engine's own.

FieldDeclared as
scriptAddressu32 scriptAddressSW_SCRIPT; an add steps it by whole words
cursoru16 cursorSW_CURSOR, compared as signed
facingu16 facingSW_FACING, and work values 2 and 4
xu32 xSW_X, 16.16 fixed-point pixels
yu32 ySW_Y
zu32 zSW_Z
terrainHeightu32 terrainHeightSW_GROUND
scaleXu32 scaleXSW_SCALE_X, 16.16 fixed point
scaleYu32 scaleYSW_SCALE_Y, and work value 0x0b
radiusu16 radiusSW_RADIUS, in pixels; compared as signed
padding22u8 padding22[2]the layer and priority flags; no work value
velocityXu32 velocityXSW_VELOCITY_X, 16.16 fixed-point pixels per frame
velocityYu32 velocityYSW_VELOCITY_Y
velocityZu32 velocityZSW_VELOCITY_Z
speedLimitu32 speedLimitSW_SPEED
accelerationu32 accelerationSW_ACCEL
targetXu32 targetXSW_TARGET_X; 0x80000000 when unset
targetYu32 targetYSW_TARGET_Y
targetZu32 targetZSW_TARGET_Z
bounceu32 bounceSW_BOUNCE, or a floating object's phase
gravityu32 gravitySW_GRAVITY
sceneWordu32 sceneWordWork value 0x17: the word FieldObject_Create zeroes and only scene code reads.
spriteu32 spritework value 0x18: the sprite, or its list of four
spriteStorageKindu8 spriteStorageKindwork value 0x19: 0 hidden, 1 one, 2 a group
motionFlagsu8 motionFlagsSW_MOTION, ActorMotionFlag bits
arrivalAxisu8 arrivalAxisSW_ARRIVAL
conditionResultu8 conditionResultSW_RESULT, the last test; every compare sets it
snapToTargetu8 snapToTargetSW_SNAP
collisionFlagsu8 collisionFlagsSW_COLLISION
steeringFlagsu8 steeringFlagsSW_STEERING
pausedu8 pausedSW_PAUSED
byte5cu8 byte5ckeeps the sprite's VRAM; no work value
repeatCountu8 repeatCountSW_REPEAT, SC_LOOP's count
waitu16 waitSW_WAIT, compared as signed
refusedu8 refusedScriptInterpreter.refused; no work value
frozenu8 frozenScriptMotionObject.frozen; no work value
sceneByte62u8 sceneByte62work value 0x27, kept by scene code
sceneByte63u8 sceneByte63work value 0x28, kept by scene code
actionParameters16 actionParameterwork value 0x23, what its action script reads
footprintSides16 footprintSidework value 0x24, or scene scratch
linkedObjectu32 linkedObjectwork value 0x25, the object it follows or faces
hooku32 hookSW_HOOK, the routine run each frame

Used by Script_ApplyOperandAdd, Script_ApplyOperandCommand, Script_ApplyOperandCompare, Script_ApplyOperandSet, Script_SetOrCompareCursor, Script_SetOrCompareHalfword5e, Script_SetOrCompareRadius.

Line 49

Types, without a comment: ScriptCommand.

script_object_runtime.h

games/tbs/include/field/script_object_runtime.h

Structures

ScriptObjectRuntime

struct ScriptObjectRuntime

A field object as its object script commands see it: the script and its place, position, motion toward a target, and the home it wanders around.

FieldDeclared as
scriptconst s32 *scriptnull when the object is free
scriptCursoru16 scriptCursorin words
scriptValueu16 scriptValueThe object's facing, 1/65536 turns: the heading SC_WANDER and SC_WANDER_HOME wander around, and where SC_FACE_LINK stores the angle to the linked object.
xs32 x16.16 fixed-point pixels
ys32 y16.16 fixed-point pixels
zs32 z16.16 fixed-point pixels
terrainHeights32 terrainHeight16.16 fixed-point pixels
unk18u8 unk18[0x0a]the x and y scales and the radius; not named here
terrainIdu8 terrainIdthe map layer its ground height is read from
unk23u8 unk23FieldActor.priorityFlags; not named here
velocityXs32 velocityX16.16 fixed-point pixels per frame
velocityYs32 velocityY16.16 fixed-point pixels per frame
velocityZs32 velocityZ16.16 fixed-point pixels per frame
speedLimits32 speedLimit16.16 fixed-point pixels per frame
accelerations32 acceleration16.16 fixed-point pixels per frame, per frame
targetXs32 targetX16.16 fixed-point pixels; 0x80000000 when unset
targetYs32 targetY16.16 fixed-point pixels; 0x80000000 when unset
targetZs32 targetZ16.16 fixed-point pixels; 0x80000000 when unset
unk44u8 unk44[0x0c]bounce, gravity and a spare word; not named here
animationvoid *animationits sprite, or its list of four, by animationKind
animationKindu8 animationKindlow four bits: 0 no sprite, 1 one, 2 up to four
flagsu8 flagsFieldActor.motionFlags
unk56u8 unk56[0x03]The arrival axis, the last flag test and the snap flag; not named here.
flags59u8 flags59FieldActor.collisionFlags. SC_WANDER_HOME sets bit 1 while it roams inside its home radius and clears it on heading home.
actionFlagsu8 actionFlagsFieldActor.steeringFlags
movementStateu8 movementStatenonzero skips its script and motion (paused)
unk5cu8 unk5c[0x02]The flag that keeps its sprite's VRAM, and the object script's SC_LOOP count; not named here.
turnedBacku16 turnedBackThe object script's wait, in frames (ScriptMotionObject.wait). SC_WANDER sets 1 when it turns back, to wait a frame.
callbackvoid *callbackNot named by TBS code through this struct: the refusal count, the frozen flag and two bytes scene code uses.
homeXs16 homeXIts home, in pixels: where it was created or placed. The bytes are ObjectRuntime's action and footprintSide too. @{
homeZs16 homeZ
linkedObjectstruct ScriptObjectRuntime *linkedObject@} The object SC_FACE_LINK and SC_MOVE_LINK aim at.
unk6cu8 unk6c[0x04]the update hook (FieldActor.update); not named here

Used by Event_SpawnObjectTable, FieldObject_Create, Field_PlaceMapMarkers, Object_ClearChildAndCollisionFlags, Object_Wander, ScriptObject_WanderNearHome, Script_ApplyLinkedObjectPosition, Script_ApplyLocalOffsetPosition, Script_ApplyRelativePosition, Script_StoreAngleToLinkedObject.

Line 12

On this page