map_scroll.h
games/tbs/include/map_scroll.h on GitHub
Structures
MapLayerScroll
struct MapLayerScroll
One background layer of the field map: its scroll position, origin, parallax against the view, drift and wrap, and its first map cell.
| Field | Declared as | |
|---|---|---|
x, y | s32 x, y | 16.16 fixed-point pixels |
offsetX, offsetY | s32 offsetX, offsetY | 16.16 fixed-point pixels |
scaleX, scaleY | s32 scaleX, scaleY | 16.16 fixed point, 0x10000 moves with the view |
speedX, speedY | s32 speedX, speedY | 16.16 fixed-point pixels per frame |
phaseX, phaseY | s32 phaseX, phaseY | 16.16 fixed-point pixels |
maskX, maskY | u16 maskX, maskY | a drifting layer's wrap mask, in 8-pixel tiles |
cells | struct MapCell *cells | the layer's first cell in the map cell buffer |
Used by Event_StepOnEastWallSwitch, Event_StepOnWallSwitch, Event_StepOnWestWallSwitch, LemurianShip_SetupScene, LunpaFortress_UpdateHallGuardDetection, LunpaFortress_UpdateOuterGuardDetection, LunpaFortress_UpdatePairedGuardDetection, Map_CopyCellIndexRect, Map_CopyMetatileCellsRect, Map_CopyMetatileIndicesRect, Map_LoadLayeredScene, Map_SetCameraCenter, Map_UpdateLayerScroll, MercuryLighthouseAerie_AlexAppears, MercuryLighthouseAerie_CallLift, MercuryLighthouseAerie_Initialize, MercuryLighthouseAerie_LowerLift, MercuryLighthouseAerie_RaiseLift, TolbiShipDeck_Initialize, TolbiShipDeck_RockDeck, TretTreeBranch_UpdateBg3ScrollSplit, TretTreeInteriors_EnterRoom.
MapScrollWork
struct MapScrollWork
The field map's work: the followed position, screen shake, tile animations, blend script, view and its bounds, and three scrolling layers. Heap slot 8.
| Field | Declared as | |
|---|---|---|
origin | s32 *origin | The followed point, read as x, height and z in 16.16 fixed-point pixels; Camera_FollowActor points it at the camera's position. |
shakeX, shakeY, shakeDecay | s32 shakeX, shakeY, shakeDecay | Screen shake amplitudes in 16.16 fixed-point pixels, and the 16.16 factor that scales them each frame. |
script | u8 *script | set from the layered scene's header; not read by name |
flags | u16 flags | REG_DISPCNT bits: objects and the BG1 to BG3 shown |
wideTiles | u8 wideTiles | nonzero: tile animations copy 64-byte tiles |
footprints | u8 footprints | nonzero: the leader leaves footprints |
anim | struct MapAnimation anim[16] | |
blend | struct BlendScriptState blend | |
viewX, viewY | s32 viewX, viewY | the view's top left, 16.16 fixed-point pixels |
minX, minY, maxX, maxY | s32 minX, minY, maxX, maxY | 16.16 fixed-point pixels |
animationActive | s8 animationActive | Set while a BG1 animation runs; the tile animations are then neither suspended nor resumed. |
unk0fd | u8 unk0fd[3] | not named by TBS code |
enabled | u8 enabled[3] | Each layer's BG priority, written into its BGCNT; zero hides the layer. |
unk103 | u8 unk103 | MapState's blendControl, the last BLDCNT the blend script set |
layers | struct MapLayerScroll layers[3] | BG3, BG2 and BG1, in that order |
Used by BattleEffect_CleanupSceneObjects, BattleFx_LoadActionEffectResources, Camera_FollowActor, Camera_FollowLeaderInBounds, Camera_MoveWithinMapBounds, Clear_LoadBackground, CrossboneIslePillarRooms_QueryFootprint, CrossboneIslePillarRooms_ReadMapCell, CrossboneIslePillarRooms_SetCellAttributes, DisplayTransition_UpdateScanlineTable, Event_DemonstratePsynergy, Event_DoraWakesIsaac, Event_StepOnEastWallSwitch, Event_StepOnWallSwitch, Event_StepOnWestWallSwitch, Event_WatchThePuppies, FadeOverlay_DrawMarks, FieldEffect_InitSparkles, FieldEffect_UpdateSparkles, FieldFx_StartGroundParticles, FieldFx_UpdateGroundParticles, FieldMotes_Start, FieldMotes_Update, FieldObject_UpdatePlayerControl, Kolima_UpdateCurseDust, LemurianShip_SetupScene, LunpaFortress_UpdateHallGuardDetection, LunpaFortress_UpdateOuterGuardDetection, LunpaFortress_UpdatePairedGuardDetection, MapAnimation_Resume, MapAnimation_Suspend, Map_CenterOnFollowedPoint, Map_CopyCellIndexRect, Map_CopyMetatileCellsRect, Map_CopyMetatileIndicesRect, Map_GetScreenRelativePosition, Map_LoadLayeredScene, Map_SetCameraCenter, Map_SetScreenShake, Map_SetViewBounds and 31 more.
BgScroll
struct BgScroll
A background's hardware scroll offsets.
| Field | Declared as | |
|---|---|---|
x, y | u16 x, y | pixels |
Used by BattlePres_AdvanceTransitionTimer, Clear_LoadBackground, gBgScroll.
Globals, without a comment: gBgScroll.