Skip to Content
The Alchemy Project

include/field/map_grid.h

The map grid: its layers and metatiles, the metatile behaviors and attributes the field reads, its tile animations and blend script, and the world map's collision and battle environments.

Included by field_actors.c, field_engine_internal.h, field_psynergy_internal.h, map_grid_data.c, script_commands_internal.h, world_map_encounter_rules.c, caverns.c, gaia_rock.c, magma_rock.c, mikasalla.c, naribwe.c, cracked_tile_mask.c, map_metatile_fill.c, map_metatile_fill_byte.c, map_metatile_get.c, map_metatile_set.c, world_map_objects.c, window_selection.c, map.h, ground_effects.h, mars_lighthouse_shared.h and scene.h.

Structures

NameDescription
structBLEND_SCRIPT_STATEThe map's running blend script, which sets the blend registers over time (fdBlendScriptRun, each tick from fdBlendScriptStart).
structMAP_ANIMATIONOne of a map's 16 tile animations (fdTilesetAnimationStartAll): the start of its script, where it is, the ticks left before its next step, and whether it is paused.
structMAP_METATILEOne metatile of a map layer: its metatile tiles and flags, its collision code and a second attribute byte.
structMAP_RESOURCESA row of MapsWork: a layout's resources, each counted from ResourceIdEmptyMap.
structMAP_LAYEROne background layer of the field map: its scroll position, origin, parallax against the view, drift and wrap, and its window of metatiles.
structMAP_STATEThe map grid's state (heap slot HEAP_SLOT_MAP_GRID): the point the view follows, the screen shake, the tile animations and blend script, and the view.
structMAP_VIEW_STATEA view of the map state as the screen transitions read it: the display control bits, the window edges and interrupt lines of a transition, and the map's resources.
structWORLD_POSA position on the world map, as its walkability check reads it.
structSHAPE_METATILEA metatile of the map's shape grid: one byte, the tag of the metatile's collision shape.

Macros

NameDescription
#defineMAPGRID_SIZE 128The map grid: 128 by 128 metatiles, each MAPGRID_METATILE_PIXELS square, wrapping at its edges.
#defineMAPGRID_ROW_MASK ((MAPGRID_SIZE - 1) * MAPGRID_SIZE)A layer window's row mask (MapLayer.maskY) over the whole grid, which wraps there rather than at a window of its own.
#defineMAPGRID_LAYER_SCREEN_BYTES 2048The bytes between one layer's BG map and the next, from screen block 5.
#defineMAPGRID_SHAPE_KIND_MASK 0xfThe low four bits of a shape's first byte: its kind (TERRAIN_KIND), which height function reads its samples (MapGridTerrainHeightFunctions).
#defineMETATILE_HEIGHT_STEPS (height) ((height) >> 19)A 16.16 height in the 8-pixel steps fdMapGridSetMetatileHeight and the collision tags take.
#defineMETATILE_CODE (attributes) ((attributes) >> 8)The collision code in scMapMetatileGetAttributes's halfword, above its attribute byte.
#defineMETATILE_CODE_BITS 0xff00scMapMetatileGetAttributes's halfword: the collision code over the second attribute byte (MAP_METATILE.attributeB), and the halfword built from the two.
#defineMETATILE_ATTRIBUTE_BITS 0xff
#defineMETATILE_ATTRIBUTES (code, bits) (((code) << 8) | (bits))
#defineMAPGRID_BLEND_SCRIPT (RamMapCollision + 7680)Where a layout's blend script is decoded, in the map collision buffer after the collision and the tileset animations; a scene may copy its own there.
#defineBLEND_SCRIPT_LOOP 65535A blend script's commands besides its BLDCNT values: the end, which starts it over, and a jump, its low byte the halfword pair to go on from.
#defineBLEND_SCRIPT_JUMP 0xfe00
#defineMAP_METATILE_WORD (behavior, attributes, pictureFlags)A MAP_METATILE read as one word, as code that ORs bits into a metatile writes it: its collision code (the metatile behavior), the attribute bits above it and the flags of its metatile tiles.
#defineMETATILE_DRAWS_ACTOR (priority, layer)The flags of a metatile's tiles for an actor standing on the metatile: the sprite priority it is drawn at and the map layer it takes, which the actors' placement reads (MAP_METATILE's actorPriority and actorLayer).
#defineMAPGRID_FIELD_STATE_SIZE offsetof(MAP_STATE, layers[3])The bytes of MAP_STATE a field map uses: up to its third layer, the last the field scrolls.
#defineGROUND_EFFECTS_WADING_MASK (3 << 2)MAP_STATE.groundEffects' kind of wading, its bits 3..2; none where nothing wades.
#defineGROUND_EFFECTS_WADING (effects) ((Uint32)((effects) << 28) >> 30)
#defineMAP_EDIT_STEPS_END 65535A map edit step's source column that ends the steps.

Enumerations

NameDescription
enumMAP_GRID_LAYER_INDEX { MAPGRID_LAYER_GROUND, MAPGRID_LAYER_MIDDLE, MAPGRID_LAYER_OV … }A layout's three layers, by what they hold.
enumMETATILE_BEHAVIOR { METATILE_BEHAVIOR_NORMAL, METATILE_BEHAVIOR_CUE_FIRST, METAT … }A metatile's collision code: the codes the field code reads by name.
enumMAP_METATILE_ATTR { MAP_METATILE_SCOOP, MAP_METATILE_PUSH, MAP_METATILE_SECOND_Z … }MAP_METATILE.attributeB's bits.
enumWORLD_MAP_COLLISION { WORLD_MAP_COLLISION_SEA_FIRST, WORLD_MAP_COLLISION_WATER_FIR … }The world map's collision values (fdWorldMapGetCollision), 1 to 15, the sea the ship sails among them.
enumBATTLE_ENVIRONMENT { BATTLE_ENVIRONMENT_NONE, BATTLE_ENVIRONMENT_GRASSLAND, BATTL … }A world map battle environment (WorldMapTerrainBehaviorTable, fdWorldMapGetBattleEnvironment): what its ground means for battles, named by the battle background fdBattleBackgroundSelectForEnvironment gives it.
enumCYCLONE_METATILE_KIND { CYCLONE_METATILE_NONE, CYCLONE_METATILE_BURST, CYCLONE_METAT … }What Cyclone does at a metatile (fdMapGridGetCycloneMetatileKind).

Functions

NameDescription
static inline FIXED *fdMapStateView (MAP_STATE *map)The map's view position (MAP_STATE.view): its left and its top, x then z, in 16.16 fixed-point pixels.
static inline MAP_LAYER *fdMapGridGetLayer (Sint32 layer)The map grid's background layer layer (MAP_STATE.layers), in the map state of heap slot HEAP_SLOT_MAP_GRID.
voidscMapGridFillCollisionRectangle (Sint32 layer, Sint32 x, Sint32 y, Uint32 width, Uint32 height, Sint32 value)Sets the collision code of a rectangle of one layer's map metatiles.
Sint32fdMapGetTerrainHeight (Sint32 terrain, Sint32 x, Sint32 z)The ground height of a layer at (x, z), 16.16 pixels (fdMapGridGetTerrainHeight, through the overlay's own import row).
Sint32fdMapGridIsWaterMetatile (Sint32 x, Sint32 z, Sint32 layer)Whether the metatile at (x, z) is water: MAP_METATILE_WATER, or on the world map collision WORLD_MAP_COLLISION_WATER_FIRST to WORLD_MAP_COLLISION_SEA_LAST.
Sint32fdMapGridGetCycloneMetatileKind (Sint32 x, Sint32 z, Sint32 layer)The Cyclone's kind of the metatile at (x, z), from the overhead layer's collision code (CYCLONE_METATILE_KIND).

Variables

NameDescription
extern const MAP_RESOURCESMapsWork []Every layout's resources, by map number (map/resources.s).

Description

The map grid: its layers and metatiles, the metatile behaviors and attributes the field reads, its tile animations and blend script, and the world map's collision and battle environments.

Macros in detail

MAPGRID_SIZE

#define MAPGRID_SIZE 128

The map grid: 128 by 128 metatiles, each MAPGRID_METATILE_PIXELS square, wrapping at its edges.

Referenced by fdActorGetCueMetatileAheadOfCurrent(), fdActorGetMetatileIndex(), fdActorMoveByKeys(), fdActorResetForLeader(), fdActorSetMetatileShape(), fdActorUpdatePlayerControl(), fdBlankOverlayDrawMarks(), fdClimbDown(), fdClimbUp(), fdGetCollisionAheadOfLeader(), fdGetCollisionUnderLeader(), fdHangingVineHang(), fdMapCopyMetatileAttributeRect(), fdMapCopyRawMetatilesRect(), fdMapGridCopyDrawnPicturesRect(), fdMapGridCopyMetatileTilesIndicesRect(), fdMapGridGetMetatileAt(), fdMapGridGetMetatileBehaviorAt(), fdMapGridIsWallAt(), fdMapGridLoadMap(), fdMapGridRenderMetatileTilesColumn(), fdMapGridRenderMetatileTilesRow(), fdMapGridSetCameraCenter(), fdMapGridSetMetatileBehaviorAt(), fdMapGridSetMetatileHeight(), fdPlaceTreasureSpots(), fdTryJumpForward(), fdUpdateWalking(), scActorRollAndCrumble(), scAquaRockGetMetatileAttribute(), scAquaRockInsideAdvanceStreams(), scAquaRockInsideBlockMetatileUnder(), scAquaRockInsideSetPillarHeight(), scCrackedTileFall(), scCrackedTileFind(), scGaiaRockCueWallMetatile(), scGeyserUpdate(), scHeldActorRaiseMetatile(), scInit(), scIsletsSetMetatileCollision(), scMagmaRockInsideSetMetatileShape(), scMapGridFillCollisionRectangle(), scMapMetatileSetAttributes(), scMarsLighthouseEntranceCheckCrackedFloor(), scMarsLighthouseEntranceFallIntoHole(), scMarsLighthouseTowersFreezePuddle(), scMarsLighthouseTowersMeltPuddle(), scMarsLighthouseTowersPushPipeOrJump(), scPillarLowerHeldMetatiles(), scPillarRaise() and 6 more.

Definition at line 37 of file map_grid.h.

MAPGRID_ROW_MASK

#define MAPGRID_ROW_MASK ((MAPGRID_SIZE - 1) * MAPGRID_SIZE)

A layer window's row mask (MapLayer.maskY) over the whole grid, which wraps there rather than at a window of its own.

Referenced by fdMapGridRenderMetatileTilesColumn(), fdMapGridRenderMetatileTilesRow(), fdMapGridSetCameraCenter(), scPrepareMap() and scTaopoSwampFocusMapOn().

Definition at line 40 of file map_grid.h.

MAPGRID_LAYER_SCREEN_BYTES

#define MAPGRID_LAYER_SCREEN_BYTES 2048

The bytes between one layer's BG map and the next, from screen block 5.

Referenced by fdMapGridCopyDrawnPicturesRect(), fdMapGridCopyMetatileTilesIndicesRect(), fdMapGridRenderMetatileTilesColumn(), fdMapGridRenderMetatileTilesRow() and fdMapGridSetCameraCenter().

Definition at line 42 of file map_grid.h.

MAPGRID_SHAPE_KIND_MASK

#define MAPGRID_SHAPE_KIND_MASK 0xf

The low four bits of a shape's first byte: its kind (TERRAIN_KIND), which height function reads its samples (MapGridTerrainHeightFunctions).

Referenced by fdMapGridGetTerrainKind() and fdMapGridGetTerrainKindAt().

Definition at line 45 of file map_grid.h.

METATILE_HEIGHT_STEPS

#define METATILE_HEIGHT_STEPS(height) ((height) >> 19)

A 16.16 height in the 8-pixel steps fdMapGridSetMetatileHeight and the collision tags take.

Referenced by fdActorSetMetatileShape(), fdFlagBlockApplyFlags(), scActorRaiseFromMetatile(), scAirsRockInsideSetStakeMetatiles(), scAirsRockMoveSecondPillar(), scAnkohlRuinsRaiseFirstSand(), scAnkohlRuinsRaiseSecondSand(), scCavernsFinishMovingAngaraBlock(), scCavernsPlaceAngaraBlocks(), scCavernsStartMovingAngaraBlock(), scCrumblingPillarPlace(), scCrumblingPillarPlaceWithStandIn(), scHeldActorRaiseMetatile(), scIzumoRuinsShowStakeState(), scMagmaRockInsideRaiseActorMetatiles(), scMagmaRockInsideRestoreCrumblingPillars(), scMagmaRockInsideRestorePillars(), scMagmaRockPushPillarEast(), scMagmaRockPushPillarWest(), scMagmaRockRaiseFlameTop(), scMagmaRockRestoreCrumblingPillars(), scMagmaRockSettleBlocks(), scMarsLighthouseEntranceSetIceConeMetatiles(), scPillarLowerHeldMetatiles(), scPillarRaise(), scTundariaTowerSetColumnMetatile(), scYampiDesertStepOffStakeTops() and scYampiDesertStepOntoStakeTops().

Definition at line 48 of file map_grid.h.

METATILE_CODE

#define METATILE_CODE(attributes) ((attributes) >> 8)

The collision code in scMapMetatileGetAttributes's halfword, above its attribute byte.

Referenced by scAirsRockBlowGust(), scAirsRockInsideMovePooledWhirlwind(), scAirsRockInsideMoveWhirlwind(), scAirsRockInsideOpenTabletRoomDoor(), scAirsRockInsideRestoreMetatileBehindLeader(), scAirsRockInsideRideWhirlwind(), scAirsRockInsideStepOffVanishingStone(), scAirsRockMoveWhirlwind(), scAirsRockRideWhirlwind(), scIzumoRuinsShowStakeState() and scIzumoRuinsSinkIntoSand().

Definition at line 51 of file map_grid.h.

METATILE_CODE_BITS

#define METATILE_CODE_BITS 0xff00

scMapMetatileGetAttributes's halfword: the collision code over the second attribute byte (MAP_METATILE.attributeB), and the halfword built from the two.

Referenced by scAirsRockInsideSetStakeMetatiles() and scMarsLighthouseEntranceSetIceConeMetatiles().

Definition at line 55 of file map_grid.h.

METATILE_ATTRIBUTE_BITS

#define METATILE_ATTRIBUTE_BITS 0xff

Referenced by scAirsRockMoveSecondPillar(), scIzumoRuinsFinishMovingPillar(), scIzumoRuinsShowStakeState(), scIzumoRuinsStartMovingPillar(), scMagmaRockSettleBlocks(), scMarsLighthouseEntranceSetIceConeMetatiles() and scTundariaTowerSetColumnMetatile().

Definition at line 56 of file map_grid.h.

METATILE_ATTRIBUTES

#define METATILE_ATTRIBUTES(code, bits) (((code) << 8) | (bits))

Referenced by scAirsRockInsideSetStakeMetatiles(), scAirsRockInsideVanishStone(), scAirsRockMoveSecondPillar(), scInit(), scIzumoRuinsShowStakeState(), scIzumoRuinsStartMovingPillar(), scMarsLighthouseEntranceSetIceConeMetatiles(), scTundariaTowerRefluxAppears(), scTundariaTowerRevealHiddenWay(), scTundariaTowerSetColumnMetatile() and scTundariaTowerUpdateBrownWallMetatile().

Definition at line 57 of file map_grid.h.

MAPGRID_BLEND_SCRIPT

#define MAPGRID_BLEND_SCRIPT (RamMapCollision + 7680)

Where a layout's blend script is decoded, in the map collision buffer after the collision and the tileset animations; a scene may copy its own there.

Referenced by fdMapGridLoadMap() and scPrepareMap().

Definition at line 61 of file map_grid.h.

BLEND_SCRIPT_LOOP

#define BLEND_SCRIPT_LOOP 65535

A blend script's commands besides its BLDCNT values: the end, which starts it over, and a jump, its low byte the halfword pair to go on from.

Referenced by fdBlendScriptRun() and fdBlendScriptStart().

Definition at line 64 of file map_grid.h.

BLEND_SCRIPT_JUMP

#define BLEND_SCRIPT_JUMP 0xfe00

Referenced by fdBlendScriptRun().

Definition at line 65 of file map_grid.h.

MAP_METATILE_WORD

#define MAP_METATILE_WORD(behavior, attributes, pictureFlags)

A MAP_METATILE read as one word, as code that ORs bits into a metatile writes it: its collision code (the metatile behavior), the attribute bits above it and the flags of its metatile tiles.

Definition at line 158 of file map_grid.h.

METATILE_DRAWS_ACTOR

#define METATILE_DRAWS_ACTOR(priority, layer)

The flags of a metatile's tiles for an actor standing on the metatile: the sprite priority it is drawn at and the map layer it takes, which the actors' placement reads (MAP_METATILE's actorPriority and actorLayer).

Referenced by scGabombaStatueDrawCogMetatiles().

Definition at line 163 of file map_grid.h.

MAPGRID_FIELD_STATE_SIZE

#define MAPGRID_FIELD_STATE_SIZE offsetof(MAP_STATE, layers[3])

The bytes of MAP_STATE a field map uses: up to its third layer, the last the field scrolls.

Referenced by fdMapGridLoadMap().

Definition at line 273 of file map_grid.h.

GROUND_EFFECTS_WADING_MASK

#define GROUND_EFFECTS_WADING_MASK (3 << 2)

MAP_STATE.groundEffects' kind of wading, its bits 3..2; none where nothing wades.

Referenced by fdActorUpdatePlayerControl() and fdTryJumpForward().

Definition at line 277 of file map_grid.h.

GROUND_EFFECTS_WADING

#define GROUND_EFFECTS_WADING(effects) ((Uint32)((effects) << 28) >> 30)

Referenced by fdActorUpdatePlayerControl() and fdTryJumpForward().

Definition at line 278 of file map_grid.h.

MAP_EDIT_STEPS_END

#define MAP_EDIT_STEPS_END 65535

A map edit step's source column that ends the steps.

Referenced by AlhafraDoorOpening, AlhafraNoDoor, AlhafraSecondDoorOpening, ChampaNoDoor, ChampaSanctumDoorOpening, EasternAlhafraShipDoorOpening, fdMapGridPlayMapEdit(), GarohHouseDoorOpening, GarohSanctumDoorOpening, GarohShopDoorOpening, IsletsNoOpening, IsletsSnowHutDoorOpening, LemuriaDockCabinDoorOpening, LemuriaDoorOpening, LemuriaPalaceDoorOpening, LemuriaWideDoorOpening, LemuriaWindowOpening, LohoDoorOpening, MadraCavernHomeDoorOpening, MadraDoorOpening, MikasallaDoorOpening, MikasallaThirdDoorOpening, MikasallaWideDoorOpening, NaribweDoorOpening, YallamDoorOpening, YallamSanctumDoorOpening, YallamSecondDoorOpening and YallamThirdDoorOpening.

Definition at line 408 of file map_grid.h.

Enumerations in detail

MAP_GRID_LAYER_INDEX

enum MAP_GRID_LAYER_INDEX

A layout's three layers, by what they hold. Most layouts give them priorities 3, 2 and 1.

EnumeratorValueDescription
MAPGRID_LAYER_GROUND0BG3: the ground, at the back
MAPGRID_LAYER_MIDDLE1BG2: walls and edges, under the actors
MAPGRID_LAYER_OVERHEAD2BG1: roofs and tree tops, over the actors

Definition at line 69 of file map_grid.h.

METATILE_BEHAVIOR

enum METATILE_BEHAVIOR

A metatile's collision code: the codes the field code reads by name. Cloak, Sand, the Cyclone and Hover read theirs on the overhead layer (script_commands_field_psynergy.c).

EnumeratorValueDescription
METATILE_BEHAVIOR_NORMAL0Open ground, where nothing happens.
METATILE_BEHAVIOR_CUE_FIRST11 to 230: the scene's own, each
METATILE_BEHAVIOR_CUE_LAST230the step cue it raises as the leader walks onto it (fdUpdateWalking), or as he climbs a wall drawn over it on the overhead layer (scGaiaRockCueWallMetatile); those above are the field's own.
METATILE_BEHAVIOR_CLOAK231Cloak hides the leader there.
METATILE_BEHAVIOR_SAND232Sand lets the leader move there as sand.
METATILE_BEHAVIOR_CYCLONE233A metatile the Cyclone acts on (fdMapGridGetCycloneMetatileKind's kind 1).
METATILE_BEHAVIOR_CYCLONE_CARRY234A metatile the Cyclone carries the leader to, its centre kept in FIELD_STATE.cycloneCarryX and Z (kind 2).
METATILE_BEHAVIOR_CYCLONE_LIFT235A metatile the Cyclone lifts the leader onto, its centre kept in FIELD_STATE.cycloneLiftX and Z (kind 3).
METATILE_BEHAVIOR_HOVER236Hover holds the leader up over it.
METATILE_BEHAVIOR_JAR242242 to 247: examine cues with lines of their own, the same on every map (fdExamineMetatile, FieldExamineCueMessageOffsets).
METATILE_BEHAVIOR_BARREL243
METATILE_BEHAVIOR_WOODEN_BOX244
METATILE_BEHAVIOR_GRAVE245
METATILE_BEHAVIOR_BOOKS246
METATILE_BEHAVIOR_WELL247
METATILE_BEHAVIOR_JUMP_FORWARD254Jumped across.
METATILE_BEHAVIOR_WALL255Blocks whatever the heights.

Definition at line 79 of file map_grid.h.

MAP_METATILE_ATTR

enum MAP_METATILE_ATTR

MAP_METATILE.attributeB's bits.

EnumeratorValueDescription
MAP_METATILE_SCOOP0x01Scoop digs here, or everywhere else where the scene's attributes turn it round (FIELD_STATE.sceneAttributeLow, fdMapGridCanScoop).
MAP_METATILE_PUSH0x02Pushing against the metatile pushes the actor ahead (fdRunPushMetatile).
MAP_METATILE_SECOND_ZONE0x04Random battles here roll on the scene's second encounter zone (fdUpdateWalking).
MAP_METATILE_HAZARD0x08Hazardous ground; with HAZARD_COUNT_ON_METATILES the hazard count rises by the pixels walked on it.
MAP_METATILE_WATER0x10Water (fdMapGridIsWaterMetatile).
MAP_METATILE_LEDGE0x20A ledge, jumped down by pushing KEY_DOWN.
MAP_METATILE_CLIMBABLE0x40A wall the leader can climb (fdMapGridIsClimbableMetatile, fdActorMoveByKeys).
MAP_METATILE_JUMP0x80A gap the leader jumps across, pushing forward.

Definition at line 121 of file map_grid.h.

WORLD_MAP_COLLISION

enum WORLD_MAP_COLLISION

The world map's collision values (fdWorldMapGetCollision), 1 to 15, the sea the ship sails among them.

EnumeratorValueDescription
WORLD_MAP_COLLISION_SEA_FIRST1The ship sails on WORLD_MAP_COLLISION_SEA_FIRST to WORLD_MAP_COLLISION_SEA_LAST and on shallow water (fdWorldMapIsSailable).
WORLD_MAP_COLLISION_WATER_FIRST2The first collision that is water
WORLD_MAP_COLLISION_SEA_LAST4to Scoop and Parch: the sea from here to WORLD_MAP_COLLISION_SEA_LAST, all but WORLD_MAP_COLLISION_SEA_FIRST.
WORLD_MAP_COLLISION_WALKABLE_FIRST5The party walks only on WORLD_MAP_COLLISION_WALKABLE_FIRST to WORLD_MAP_COLLISION_WALKABLE_LAST (fdWorldMapIsWalkable).
WORLD_MAP_COLLISION_SHALLOW_WATER6Shallow water: a ripple follows the leader as it walks, and the ship sails there too.
WORLD_MAP_COLLISION_DEFAULT7Where neither collision layer has a value.
WORLD_MAP_COLLISION_FOREST9Forest: the leader's sprite shows
WORLD_MAP_COLLISION_WALKABLE_LAST12its second layer and no shadow.

Definition at line 316 of file map_grid.h.

BATTLE_ENVIRONMENT

enum BATTLE_ENVIRONMENT

A world map battle environment (WorldMapTerrainBehaviorTable, fdWorldMapGetBattleEnvironment): what its ground means for battles, named by the battle background fdBattleBackgroundSelectForEnvironment gives it.

EnumeratorValueDescription
BATTLE_ENVIRONMENT_NONE0
BATTLE_ENVIRONMENT_GRASSLAND1ResourceIdGrasslandBBackdrop.
BATTLE_ENVIRONMENT_FOREST2ResourceIdDenseForestBackdrop; encounters take a region's forest zone.
BATTLE_ENVIRONMENT_DESERT3ResourceIdDesertBackdrop.
BATTLE_ENVIRONMENT_BEACH4ResourceIdRockyBeachBackdrop.
BATTLE_ENVIRONMENT_SNOWFIELD5ResourceIdSnowfieldBBackdrop.
BATTLE_ENVIRONMENT_SNOW_FOREST6ResourceIdSnowfieldBBackdrop, for the snowfield's forest.
BATTLE_ENVIRONMENT_SHALLOWS7ResourceIdRockyBeachBackdrop, for shallow water (WORLD_MAP_COLLISION_SHALLOW_WATER).
BATTLE_ENVIRONMENT_SEA8The sea the ship sails, collisions 1 to 3 outside the snowfields, where its encounters are (WorldMapShipEncounterRules); ResourceIdShipDeckBackdrop.
BATTLE_ENVIRONMENT_SNOWFIELD_SEA9All the sea of the snowfield regions, where no rule gives encounters.
BATTLE_ENVIRONMENT_SEA_LAST10WORLD_MAP_COLLISION_SEA_LAST outside the snowfields: the dark blue water of the rivers and lakes inland, between grass, sand and cliff banks, not the bright open sea. No rule gives encounters there; a battle there would take the ship deck's backdrop.
BATTLE_ENVIRONMENT_BLIZZARD11ResourceIdBlizzardBackdrop.
BATTLE_ENVIRONMENT_BLIZZARD_FOREST12ResourceIdBlizzardBackdrop, for the blizzard's forest.

Definition at line 349 of file map_grid.h.

CYCLONE_METATILE_KIND

enum CYCLONE_METATILE_KIND

What Cyclone does at a metatile (fdMapGridGetCycloneMetatileKind).

EnumeratorValueDescription
CYCLONE_METATILE_NONE0
CYCLONE_METATILE_BURST1blown away, with the particle burst
CYCLONE_METATILE_CARRY2the whirlwind carries the leader to it
CYCLONE_METATILE_LIFT3the whirlwind lifts the leader to it

Definition at line 424 of file map_grid.h.

Functions in detail

fdMapStateView

static inline FIXED *fdMapStateView(MAP_STATE *map)

The map's view position (MAP_STATE.view): its left and its top, x then z, in 16.16 fixed-point pixels.

Referenced by btGeyserDraw(), fdActorGetScreenPos(), fdActorGetSpriteDepth(), fdActorSystemPlaceSprites(), fdBlankOverlayDrawMarks(), fdEffectSpawnRevealMarkers(), fdFadeOverlayDrawMarks(), fdGroundParticlesDraw(), fdGroundParticlesUpdate(), fdHangingVineDraw(), fdMapGridGetScreenRelativePos(), fdMotesUpdate(), fdRopeDraw(), fdScreenTransitionUpdateScanlineTable(), fdTightropeDraw(), fdWeatherUpdateRain(), scAnkohlRuinsDrawSand(), scApojiiIslandsDrawMetatileMarkers(), scAquaRockDrawFallingBubbles(), scAquaRockDrawRisingBubbles(), scAquaRockInsideDrawPillars(), scAquaRockInsideDrawSplashes(), scCrackedTileUpdate(), scFlameThrowersPuff(), scGabombaStatueDrawRaisedBlocks(), scLightSpritesDraw(), scMarsLighthouseEntranceDrawHoleMask() and scTrialRoadDrawFountains().

Definition at line 259 of file map_grid.h.

fdMapGridGetLayer

static inline MAP_LAYER *fdMapGridGetLayer(Sint32 layer)

The map grid's background layer layer (MAP_STATE.layers), in the map state of heap slot HEAP_SLOT_MAP_GRID.

References Sint32.

Referenced by scAirsRockDriftFog(), scAirsRockLiftFog(), scAirsRockWhirlwindClearsFog(), scApojiiIslandsAddMetatileMarkers(), scDriftScenePrepare(), scEasternAlhafraFillWaveLines(), scGarohWavePathLayer(), scIdejimaUpdateWaveLines(), scInit(), scIsletsFillWaveLines(), scLayerTrackScroll(), scLemuriaFillRippleLines(), scLemurianShipDeckBobDeck(), scLemurianShipDeckScrollWaves(), scPrepareMap(), scSeaOfTimeAnimateSea() and scShamanVillageDriftSandLayer().

Definition at line 266 of file map_grid.h.

fdMapGetTerrainHeight

Sint32 fdMapGetTerrainHeight(Sint32 terrain, Sint32 x, Sint32 z)

The ground height of a layer at (x, z), 16.16 pixels (fdMapGridGetTerrainHeight, through the overlay's own import row).

Referenced by fdActorSetMetatileShape(), fdGroundParticlesDraw(), fdGroundParticlesStart(), fdLeaderSlideOnIce(), fdLeaderSlideOnIceAhead(), fdWhirlwindCarryLeader(), scActorPopUp(), scActorPopUpSlow(), scActorRaiseFromMetatile(), scAirsRockInsideBlowGust(), scAirsRockInsideFinishPushingPillar(), scAirsRockInsideRideWhirlwind(), scAirsRockInsideRiseOnLift(), scAirsRockInsideSetStakeMetatiles(), scAirsRockPlacePillar(), scAirsRockRideWhirlwind(), scAnemosInnerSanctumDullahanShadowByHeight(), scAquaRockDrawFallingBubbles(), scAquaRockDrawRisingBubbles(), scAquaRockFlowSparkleUpStream(), scCavernsFinishMovingAngaraBlock(), scCavernsGetLayer2Height(), scCavernsPlaceAngaraBlocks(), scCavernsStartMovingAngaraBlock(), scCrackedTileUpdate(), scCrumblingPillarPlace(), scCrumblingPillarPlaceWithStandIn(), scGondowanCliffsScoopUpGeyser(), scHeldActorRaiseMetatile(), scInit(), scIzumoRuinsShowStakeState(), scJupiterLighthouseDropEnergyBlock(), scJupiterLighthousePlacePathBlock(), scLeaderSlideOnIceFromEdge(), scMagmaRockInsideFinishPushingPillar(), scMagmaRockInsideRaiseActorMetatiles(), scMagmaRockInsideRestoreCrumblingPillars(), scMagmaRockInsideRestorePillars(), scMagmaRockLandLeader(), scMagmaRockRestoreCrumblingPillars(), scMagmaRockSettleBlocks(), scMarsLighthouseEntranceDrawHoleMask(), scMarsLighthouseEntranceSetIceConeMetatiles(), scMarsLighthouseTowersDropBlock(), scPillarLowerHeldMetatiles(), scPillarRaise(), scPrepareMap(), scTrialRoadSettleOnGround(), scTrialRoadUncoverVent(), scTundariaTowerSetColumnMetatile() and 6 more.

Definition at line 419 of file map_grid.h.

Variables in detail

MapsWork

extern const MAP_RESOURCES MapsWork[]

Every layout's resources, by map number (map/resources.s).

Referenced by fdMapCopyPalette(), fdMapGetCameraBounds(), fdMapGridLoadMap() and fdMapLoadMetatilesAndShapes().

Definition at line 177 of file map_grid.h.