Skip to Content
The Alchemy Project

include/field/map.h

The map's shapes and tile sets, the World Map's blocks, and the map routines the scenes call.

Included by field_move_by_keys.c, apojii_islands.c, aqua_rock_inside.c, gabomba_statue.c and world_map.c.

Structures

NameDescription
structWORLD_MAP_BLOCKOne 32-pixel block of the World Map, an entry of WORLD_MAP_BLOCKS: its metatile behavior and its terrain.
structWORLD_MAP_BLOCKSThe World Map's blocks, a row of 32 for each z, in the metatile tiles buffer (MetatileTiles) while the World Map is shown.

Macros

NameDescription
#defineWORLD_MAP_TILE_SET_BYTES 8192The World Map area's four tile sets, decoded one after another into BgTileBuffer and copied to the two halves of BG char blocks 2 and 3.
#defineWORLD_MAP_TILE_SET (n) (RamBgTileBuffer + (n) * WORLD_MAP_TILE_SET_BYTES)
#defineMAP_SHAPE_MARKED 120The shape a scene gives the metatiles it marks, rewriting the shape's entry with their height in its second byte: Apojii's metatile markers and Aqua Rock's spouts.
#defineMAP_SHAPE_RAISED_ALONE 121The shape a scene gives the one metatile under a pillar it raises alone, its entry rewritten as MAP_SHAPE_MARKED's: Aqua Rock's water pillar.
#defineMAP_SHAPE (shape, height0, height1, height2)A map shape entry as MapGridShapes holds it: the shape's kind and its three heights, a byte each (the rows of a map's shapes.tsv).

Functions

NameDescription
voidfdTilesetAnimationUpdate (void)The map's animation each tick: its tiles, its blend scripts and the World Map's tints and tile blocks.
voidfdWorldMapUpdateRegionTint (Sint32 region, Sint32 gradual)Tints the world map for the encounter region under the party, any region but the Sea of Time's and Kibombo's clearing the tint.
voidfdWorldMapPreloadCurrentTileBlock (void)Loads the first of the 2x2 world map tiles around the player that is not shown yet (at most one a tick), without drawing it.
Sint32fdScreenTransitionIsScanlineActiveStub (void)Whether a centre-line screen transition is running (its HBlank handler set), which the World Map waits out before it reloads an area's graphics.
Sint32fdMapShapeFindOrAddStub (Sint32 layer, Sint32 shape, Sint32 height)The index of the map's shape entry of the given shape and first height, added when there is none (fdMapShapeFindOrAdd).

Variables

NameDescription
extern const Uint8fdRenderDrawMapCode []The World Map's row drawer, its Thumb entry and ARM code (draw_map.s), copied to RAM to run.
extern Uint8fdRenderDrawMapCodeSize []The size of fdRenderDrawMapCode (draw_map.s).

Description

The map's shapes and tile sets, the World Map's blocks, and the map routines the scenes call.

Macros in detail

WORLD_MAP_TILE_SET_BYTES

#define WORLD_MAP_TILE_SET_BYTES 8192

The World Map area's four tile sets, decoded one after another into BgTileBuffer and copied to the two halves of BG char blocks 2 and 3.

Referenced by fdWorldMapEndStillImage(), fdWorldMapLoadGraphics(), fdWorldMapPreloadCurrentTileBlock() and fdWorldMapStartStillImage().

Definition at line 36 of file map.h.

WORLD_MAP_TILE_SET

#define WORLD_MAP_TILE_SET(n) (RamBgTileBuffer + (n) * WORLD_MAP_TILE_SET_BYTES)

Referenced by fdTileMapDrawRowsFromRam(), fdWorldMapLoadAreaGraphics(), fdWorldMapLoadGraphics(), fdWorldMapPreloadCurrentTileBlock() and fdWorldMapStartStillImage().

Definition at line 37 of file map.h.

MAP_SHAPE_MARKED

#define MAP_SHAPE_MARKED 120

The shape a scene gives the metatiles it marks, rewriting the shape's entry with their height in its second byte: Apojii's metatile markers and Aqua Rock's spouts.

Referenced by scApojiiIslandsAddMetatileMarkers(), scAquaRockInsideAddSpouts() and scAquaRockInsideSetPillarsHeight().

Definition at line 41 of file map.h.

MAP_SHAPE_RAISED_ALONE

#define MAP_SHAPE_RAISED_ALONE 121

The shape a scene gives the one metatile under a pillar it raises alone, its entry rewritten as MAP_SHAPE_MARKED's: Aqua Rock's water pillar.

Referenced by scAquaRockInsideSetPillarHeight().

Definition at line 44 of file map.h.

MAP_SHAPE

#define MAP_SHAPE(shape, height0, height1, height2)

A map shape entry as MapGridShapes holds it: the shape's kind and its three heights, a byte each (the rows of a map's shapes.tsv).

Referenced by GabombaStatueCogShapes, scAquaRockInsideAddSpouts(), scAquaRockInsideSetPillarHeight() and scAquaRockInsideSetPillarsHeight().

Definition at line 47 of file map.h.

Functions in detail

fdScreenTransitionIsScanlineActiveStub

Sint32 fdScreenTransitionIsScanlineActiveStub(void)

Whether a centre-line screen transition is running (its HBlank handler set), which the World Map waits out before it reloads an area's graphics.

Referenced by fdWorldMapPreloadCurrentTileBlock().

Definition at line 57 of file map.h.

fdMapShapeFindOrAddStub

Sint32 fdMapShapeFindOrAddStub(Sint32 layer, Sint32 shape, Sint32 height)

The index of the map's shape entry of the given shape and first height, added when there is none (fdMapShapeFindOrAdd).

Referenced by fdMapGridSetMetatileHeight().

Definition at line 67 of file map.h.

Variables in detail

fdRenderDrawMapCode

extern const Uint8 fdRenderDrawMapCode[]

The World Map's row drawer, its Thumb entry and ARM code (draw_map.s), copied to RAM to run.

Referenced by fdTileMapDrawRowsFromRam().

Definition at line 61 of file map.h.

fdRenderDrawMapCodeSize

extern Uint8 fdRenderDrawMapCodeSize[]

The size of fdRenderDrawMapCode (draw_map.s).

Referenced by fdTileMapDrawRowsFromRam().

Definition at line 63 of file map.h.