Skip to Content
The Alchemy Project

src/field/field_map_grid.c

Layered maps: loading, drawing and scrolling, and copying metatiles. More…

Included by field.c.

Structures

NameDescription
structMAP_LAYEROne background layer's setup in a layout's header: its origin, its parallax and drift, and where it wraps.
structMAP_HEADERA layout's header: the camera's bounds, the layers' priorities, tile bases and setup, and the offsets from the header's start of its packed tiles, shapes, tilemap, tileset animation, blend script and treasure spots (packed for syDecompressTaggedLZ, except markers which are read in place).
structMAP_GRID_TILE_POSThe top left of a layer's visible area, in metatiles.
structMAP_EDIT_STEPOne step of a map edit, such as a door drawn opening a frame at a time: the rectangle of metatiles to copy from, in metatiles, and the ticks to wait after the copy.

Macros

NameDescription
#defineMAPGRID_ATTRIBUTE_MASK 0xfffff000A metatile word's attributes, the bits above the number of its metatile tiles (MAPGRID_METATILE_TILES_ID_MASK).
#defineMAPGRID_METATILE_TILES_SHIFT 20The shift that leaves a metatile word's metatile tiles number on top, its attributes shifted out.
#defineMAPGRID_METATILE_WORDS ((Uint32 *)RamMapGridMetatileBuffer)The map's 128 by 128 metatiles, each read whole as its word (a struct MAP_GRID_METATILE's four bytes).
#defineMAPGRID_VISIBLE_WIDTH 16A layer's visible area in metatiles: the screen's 15 by 10, and the row and column partly scrolled in.
#defineMAPGRID_VISIBLE_HEIGHT 12
#defineMAPGRID_LAYER_SCREEN_BYTES 2048The bytes between one layer's BG map and the next, from screen block 5.
#defineMAPGRID_SCREEN_METATILES 16A layer's BG map in metatiles, 16 by 16 (32 by 32 tiles), and the bytes of one row of its tiles.
#defineMAPGRID_SCREEN_ROW_BYTES 64
#defineMAPGRID_SCREEN_TILE_MASK (BG_SCREEN_WIDTH - 2)A metatile's top tile row or left tile column in a layer's BG map, even, wrapping at the map's 32; its row as tile entries from the map's start.
#defineMAPGRID_SCREEN_ROW_MASK (MAPGRID_SCREEN_TILE_MASK * BG_SCREEN_WIDTH)
#defineMAPGRID_COLUMN_METATILES 11The metatile tiles drawn down a column as the view scrolls sideways: the screen's 10 rows of metatiles and the one partly scrolled in.
#defineMAPGRID_BYTE_PLANES_BYTES (2 * MAPGRID_SIZE * MAPGRID_SIZE)A map's metatiles as they are decoded: two planes of a byte a metatile, the metatiles' attribute bytes, then a plane of the numbers of their metatile tiles, a halfword a metatile.
#defineMAP_PALETTE_BYTES (14 * PALETTE_COLORS * sizeof(Uint16))A map's palette: the first 14 of the 16 BG palettes, 224 colours.
#defineMAPGRID_RESOURCE (offset)One of a layout's resources, from its row of MapsWork.
#defineMAPGRID_REDRAW_COPIED_METATILE (metatileX, metatileY)The redraw the three metatile copies below share, for the metatile at (metatileX, metatileY) just copied: the first layer whose visible area (16 by 12 metatiles from its scroll position) holds it, and that one only, has the metatile's top two tile entries and its bottom two (a tile row, 64 bytes, further on) written to its BG map.

Typedefs

NameDescription
typedef void (*TILEMAP_CONVERT_FN )(void *dest, const void *src, const void *saved);

Functions

NameDescription
voidfdSpriteColorRemapPixels (Uint8 *bytes, Sint32 byteCount)Remaps byteCount bytes in place through SpriteColorGreyTable.
voidfdTileMapDecodeStagedBuffer (Sint32 size)Unpacks the staged metatile tiles into MetatileTiles.
voidfdTileMapNumberPlaceholderMetatileTiles (void)Unused: gives each map metatile whose metatile tiles are number 0xfff (a placeholder) a number of its own, counting up from 0 in map order.
voidfdTileMapConvertBuffer (void)Joins a decoded map's planes in place into its metatile words, with fdTileConvertMapGrid copied to RAM, which reads the byte planes from a copy.
static __inline__ voidfdMapGridCopyMetatileTilesHalfColumn (Uint32 *metatile, Uint8 *screenMap, Uint32 screenRowOffset, Uint32 screenColumnOffset, Uint32 tileHalf)Copies one tile column of a metatile's tiles into a BG map: its top and bottom tile entries, choosing the left or right half with tileHalf.
static __inline__ voidfdMapGridCopyMetatileTilesToScreen (Uint32 *metatile, Uint8 *screenMap, Uint32 screenRowOffset, Uint32 screenColumnOffset)Copies all four of a metatile's tiles into a BG map: its top two tile entries and its bottom two, a map row (64 bytes) below.
Sint32fdMapGridLoadMap (Sint32 index)Loads layout index from MapsWork: its metatile tiles, shapes, metatiles, tileset animations, blend script and treasure spots; sets up the three background layers' origins, parallax and wrap from the layout header; loads the palette and tile graphics unless FLAG_KEEP_LAYER_GRAPHICS says they are loaded; and starts the layer scrolling.
voidfdMapGridCenterOnFollowedPoint (void)Centres the camera on the point the map follows (origin: x, height, z), or on (0, 0) when there is none, and scrolls the layers there.
voidfdMapGridRenderMetatileTilesRow (Uint32 layer, Sint32 tileX, Sint32 tileY)Draws the metatile tiles of a row of 16 of a layer's metatiles (32 tiles) into its BG map (screen block 5 + layer), starting at tile (tileX, tileY); the BG map wraps every 32 tiles.
voidfdMapGridRenderMetatileTilesColumn (Uint32 layer, Sint32 tileX, Sint32 tileY)Draws the metatile tiles of a column of 11 of a layer's metatiles, one tile wide, into its BG map, starting at tile (tileX, tileY).
voidfdMapGridUpdateLayerScroll (void)Each tick on a layered map: centres the view on the point the map follows (origin), clamped to the map's bounds and shaken by any decaying screen shake; then scrolls each of the three layers by its parallax scale and automatic scroll (wrapping at its period), draws the column or row of metatile tiles that scrolls into view, and sets its BG scroll.
voidfdMapGridSetCameraCenter (FIXED x, FIXED y)Centres the view on (x, y) in 16.16 pixels, clamped to the map's bounds, and redraws every enabled layer's BG map around it.
voidfdMapGridCopyMetatileTilesRect (Sint32 srcX, Sint32 srcY, Uint32 destX, Uint32 destY, Uint32 width, Uint32 height)Copies what a rectangle of metatiles shows (each one's tiles id) from (srcX, srcY) to (destX, destY), width by height metatiles, keeping each destination's attributes, and redraws the copied metatiles that are on screen.
voidfdMapGridPlayMapEdit (Uint16 *steps, Sint32 destX, Uint32 destY)Plays a map edit (MAP_EDIT_STEP entries, ended by a source x of MAP_EDIT_STEPS_END): copies what each entry's rectangle of metatiles shows to (destX, destY) and waits its delay in ticks.
voidfdMapGridCopyMetatileRect (Sint32 srcX, Sint32 srcY, Sint32 width, Sint32 height, Sint32 destX, Sint32 destY)Copies a rectangle of metatiles (16x16 pixels each) as they are, from (srcX, srcY) to (destX, destY), width by height metatiles.
voidfdMapGridCopyMetatileAttributeRect (Sint32 srcX, Sint32 srcY, Sint32 width, Sint32 height, Sint32 destX, Sint32 destY)Copies only the attributes of a rectangle of metatiles, from (srcX, srcY) to (destX, destY), width by height metatiles, keeping each destination metatile's metatile tiles number.
voidfdMapGridCopyMetatileIndexRect (Sint32 srcX, Sint32 srcY, Sint32 width, Sint32 height, Sint32 destX, Sint32 destY)Copies only the metatile tiles numbers of a rectangle of metatiles, from (srcX, srcY) to (destX, destY), width by height metatiles, keeping each destination metatile's attributes; metatiles in a visible area update the BG maps too.
voidfdMapGridSetShownLayers (Uint32 layerFlags)Sets which of BG1-BG3 the map shows (bits 9-11 of its display flags, as in REG_DISPCNT) from layerFlags, keeping its other flags.

Description

Layered maps: loading, drawing and scrolling, and copying metatiles. Part of field.c.

Macros in detail

MAPGRID_ATTRIBUTE_MASK

#define MAPGRID_ATTRIBUTE_MASK 0xfffff000

A metatile word's attributes, the bits above the number of its metatile tiles (MAPGRID_METATILE_TILES_ID_MASK).

Referenced by fdMapGridCopyMetatileAttributeRect(), fdMapGridCopyMetatileIndexRect() and fdMapGridCopyMetatileTilesRect().

Definition at line 8 of file field_map_grid.c.

MAPGRID_METATILE_TILES_SHIFT

#define MAPGRID_METATILE_TILES_SHIFT 20

The shift that leaves a metatile word's metatile tiles number on top, its attributes shifted out. Shifted back down by one less it is the number times 2, the metatile tiles' offset in words in MetatileTiles (a word for each of its two rows of 2 tiles); by two less, times 4, its offset in halfwords.

Referenced by fdMapGridCopyMetatileTilesHalfColumn() and fdMapGridCopyMetatileTilesToScreen().

Definition at line 13 of file field_map_grid.c.

MAPGRID_METATILE_WORDS

#define MAPGRID_METATILE_WORDS ((Uint32 *)RamMapGridMetatileBuffer)

The map's 128 by 128 metatiles, each read whole as its word (a struct MAP_GRID_METATILE's four bytes).

Referenced by fdMapGridCopyMetatileAttributeRect(), fdMapGridCopyMetatileIndexRect(), fdMapGridCopyMetatileRect(), fdMapGridCopyMetatileTilesRect(), fdMapGridRenderMetatileTilesColumn(), fdMapGridRenderMetatileTilesRow() and fdMapGridSetCameraCenter().

Definition at line 16 of file field_map_grid.c.

MAPGRID_VISIBLE_WIDTH

#define MAPGRID_VISIBLE_WIDTH 16

A layer's visible area in metatiles: the screen's 15 by 10, and the row and column partly scrolled in.

Definition at line 19 of file field_map_grid.c.

MAPGRID_VISIBLE_HEIGHT

#define MAPGRID_VISIBLE_HEIGHT 12

Definition at line 20 of file field_map_grid.c.

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 fdMapGridRenderMetatileTilesColumn(), fdMapGridRenderMetatileTilesRow() and fdMapGridSetCameraCenter().

Definition at line 22 of file field_map_grid.c.

MAPGRID_SCREEN_METATILES

#define MAPGRID_SCREEN_METATILES 16

A layer's BG map in metatiles, 16 by 16 (32 by 32 tiles), and the bytes of one row of its tiles.

Referenced by fdMapGridCopyMetatileIndexRect(), fdMapGridCopyMetatileRect(), fdMapGridCopyMetatileTilesRect(), fdMapGridRenderMetatileTilesRow() and fdMapGridSetCameraCenter().

Definition at line 25 of file field_map_grid.c.

MAPGRID_SCREEN_ROW_BYTES

#define MAPGRID_SCREEN_ROW_BYTES 64

Referenced by fdMapGridCopyMetatileTilesHalfColumn() and fdMapGridCopyMetatileTilesToScreen().

Definition at line 26 of file field_map_grid.c.

MAPGRID_SCREEN_TILE_MASK

#define MAPGRID_SCREEN_TILE_MASK (BG_SCREEN_WIDTH - 2)

A metatile's top tile row or left tile column in a layer's BG map, even, wrapping at the map's 32; its row as tile entries from the map's start.

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

Definition at line 29 of file field_map_grid.c.

MAPGRID_SCREEN_ROW_MASK

#define MAPGRID_SCREEN_ROW_MASK (MAPGRID_SCREEN_TILE_MASK * BG_SCREEN_WIDTH)

Referenced by fdMapGridRenderMetatileTilesColumn() and fdMapGridSetCameraCenter().

Definition at line 30 of file field_map_grid.c.

MAPGRID_COLUMN_METATILES

#define MAPGRID_COLUMN_METATILES 11

The metatile tiles drawn down a column as the view scrolls sideways: the screen's 10 rows of metatiles and the one partly scrolled in.

Referenced by fdMapGridRenderMetatileTilesColumn() and fdMapGridSetCameraCenter().

Definition at line 33 of file field_map_grid.c.

MAPGRID_BYTE_PLANES_BYTES

#define MAPGRID_BYTE_PLANES_BYTES (2 * MAPGRID_SIZE * MAPGRID_SIZE)

A map's metatiles as they are decoded: two planes of a byte a metatile, the metatiles' attribute bytes, then a plane of the numbers of their metatile tiles, a halfword a metatile.

Referenced by fdTileMapConvertBuffer().

Definition at line 37 of file field_map_grid.c.

MAP_PALETTE_BYTES

#define MAP_PALETTE_BYTES (14 * PALETTE_COLORS * sizeof(Uint16))

A map's palette: the first 14 of the 16 BG palettes, 224 colours.

Referenced by fdMapGridLoadMap().

Definition at line 39 of file field_map_grid.c.

MAPGRID_RESOURCE

#define MAPGRID_RESOURCE(offset)

One of a layout's resources, from its row of MapsWork.

Referenced by fdMapGridLoadMap().

Definition at line 234 of file field_map_grid.c.

MAPGRID_REDRAW_COPIED_METATILE

#define MAPGRID_REDRAW_COPIED_METATILE(metatileX, metatileY)

The redraw the three metatile copies below share, for the metatile at (metatileX, metatileY) just copied: the first layer whose visible area (16 by 12 metatiles from its scroll position) holds it, and that one only, has the metatile's top two tile entries and its bottom two (a tile row, 64 bytes, further on) written to its BG map. The layers' BG maps follow each other, 2,048 bytes apart, from screen block 5, and in each a row of metatiles is 128 bytes and a metatile 4. It uses the copy's own locals: row and column (the metatile's place in the BG map), metatileTilesId, visibleLayers and the scratch place, offset, bytes, i and visibleLayer.

Referenced by fdMapGridCopyMetatileIndexRect(), fdMapGridCopyMetatileRect() and fdMapGridCopyMetatileTilesRect().

Definition at line 690 of file field_map_grid.c.

Typedefs in detail

TILEMAP_CONVERT_FN

typedef void (*TILEMAP_CONVERT_FN)(void *dest, const void *src, const void *saved);

Referenced by fdTileMapConvertBuffer().

Definition at line 105 of file field_map_grid.c.

Functions in detail

fdSpriteColorRemapPixels

void fdSpriteColorRemapPixels(Uint8 *bytes, Sint32 byteCount)

Remaps byteCount bytes in place through SpriteColorGreyTable.

References Sint32 and SpriteColorGreyTable.

Definition at line 42 of file field_map_grid.c.

fdTileMapDecodeStagedBuffer

void fdTileMapDecodeStagedBuffer(Sint32 size)

Unpacks the staged metatile tiles into MetatileTiles.

References MapGridMetatileBuffer, MetatileTiles and Sint32.

Referenced by fdMapGridLoadMap().

Definition at line 54 of file field_map_grid.c.

fdTileMapNumberPlaceholderMetatileTiles

void fdTileMapNumberPlaceholderMetatileTiles(void)

Unused: gives each map metatile whose metatile tiles are number 0xfff (a placeholder) a number of its own, counting up from 0 in map order.

References MapGridMetatileBuffer and Sint32.

Definition at line 111 of file field_map_grid.c.

fdTileMapConvertBuffer

void fdTileMapConvertBuffer(void)

Joins a decoded map's planes in place into its metatile words, with fdTileConvertMapGrid copied to RAM, which reads the byte planes from a copy.

References fdTileConvertMapGrid, fdTileConvertMapGridCodeSize, MapGridMetatileBuffer, syHeapAllocateEWRAM(), syHeapRelease() and syWordsCopy().

Referenced by fdMapGridLoadMap().

Definition at line 135 of file field_map_grid.c.

fdMapGridCopyMetatileTilesHalfColumn

static __inline__ void fdMapGridCopyMetatileTilesHalfColumn(Uint32 *metatile, Uint8 *screenMap, Uint32 screenRowOffset, Uint32 screenColumnOffset, Uint32 tileHalf)

Copies one tile column of a metatile's tiles into a BG map: its top and bottom tile entries, choosing the left or right half with tileHalf.

Referenced by fdMapGridRenderMetatileTilesColumn().

Definition at line 154 of file field_map_grid.c.

fdMapGridCopyMetatileTilesToScreen

static __inline__ void fdMapGridCopyMetatileTilesToScreen(Uint32 *metatile, Uint8 *screenMap, Uint32 screenRowOffset, Uint32 screenColumnOffset)

Copies all four of a metatile's tiles into a BG map: its top two tile entries and its bottom two, a map row (64 bytes) below.

Referenced by fdMapGridRenderMetatileTilesRow() and fdMapGridSetCameraCenter().

Definition at line 177 of file field_map_grid.c.

fdMapGridLoadMap

Sint32 fdMapGridLoadMap(Sint32 index)

Loads layout index from MapsWork: its metatile tiles, shapes, metatiles, tileset animations, blend script and treasure spots; sets up the three background layers' origins, parallax and wrap from the layout header; loads the palette and tile graphics unless FLAG_KEEP_LAYER_GRAPHICS says they are loaded; and starts the layer scrolling. It returns 2, which its caller does not read.

References fdBlendScriptStart(), fdMapGridUpdateLayerScroll(), fdTileMapConvertBuffer(), fdTileMapDecodeStagedBuffer(), fdTilesetAnimationStartAll(), gmFlagClearStub(), gmFlagGetStub(), MapGridAnimationTiles, MapsWork, Sint32, syDecompressMoveToFrontLZ(), syDecompressTaggedLZ(), syHeapAllocate(), syHeapRelease(), syHeapSlotAllocateEWRAM(), syMulFX(), syScreenFadeFromBlack(), sySetEvent() and syWordsClear().

Definition at line 243 of file field_map_grid.c.

fdMapGridCenterOnFollowedPoint

void fdMapGridCenterOnFollowedPoint(void)

Centres the camera on the point the map follows (origin: x, height, z), or on (0, 0) when there is none, and scrolls the layers there.

References fdMapGridSetCameraCenter(), fdMapGridUpdateLayerScroll() and Sint32.

Referenced by fdMapGridRedraw(), scAltinApplyWaterLevel(), scAltinPeakDrainAfterSecondBeast(), scAltinPeakDrainAfterThirdBeast(), scAltinPeakRestoreFallingRocksRoom(), scAltinPeakSettleSpritzRoomPillar(), scBabiLighthouseFallToExit(), scBabiLighthouseLandWithParticles(), scBattleArenaDrawThreeDigitValue(), scBilibinSetUpTreasury(), scCottageRoomsBDoraWakesIsaac(), scCrossboneIsleSteppingStonesAnimateWaterLevel(), scHammetPalaceHammetsHomecoming(), scHammetPalaceIvanReportsToLayana(), scHammetPalaceSetUpEntrance(), scInit(), scKalayHammetReturnsToPalace(), scKalayPrepareTunnelPassage(), scKolimaForestEntranceWitnessForestCurse(), scKolimaForestFloodgateFlipFloodgateSwitch(), scKolimaRestoreBridgeState(), scKolimaWitnessForestCurse(), scLogRoomsADefeatThieves(), scLogRoomsADiscussMindReading(), scLogRoomsAFightThievesAgain(), scLogRoomsALoseToThieves(), scLunpaFortressInitGroundFloor(), scLunpaFortressInitUpperFloor(), scMcCoyPalaceAudienceWithMcCoy(), scMcCoyPalaceGroundsGuardsArrestParty(), scMcCoyPalaceMcCoyRewardsParty(), scMcCoyPalacePresentRewardChests(), scMercuryLighthouseAerieAlexAppears(), scMercuryLighthouseAerieCallLift(), scMercuryLighthouseAeriePartyArrives(), scMercuryLighthouseAerieRaiseLift(), scMercuryLighthouseRideLift(), scShipRoomsMoveCameraAndWaitFX(), scSolSanctumElementalStarRoomAlexTakesStars(), scSolSanctumElementalStarRoomBagJupiterStar(), scSolSanctumElementalStarRoomBagMercuryStar(), scSolSanctumElementalStarRoomBagVenusStar(), scSolSanctumElementalStarRoomDemandElementalStars(), scSolSanctumElementalStarRoomEnterStarRoom(), scSolSanctumElementalStarRoomFelixRemovesMask(), scSolSanctumElementalStarRoomOfferHostageGuarantee(), scSolSanctumEntranceRestoreInteriorState(), scSolSanctumEntranceSetFirstSmallJewel(), scSolSanctumEntranceSetSecondSmallJewel(), scSolSanctumEruptionDrawFirstCollapseTiles() and 32 more.

Definition at line 404 of file field_map_grid.c.

fdMapGridRenderMetatileTilesRow

void fdMapGridRenderMetatileTilesRow(Uint32 layer, Sint32 tileX, Sint32 tileY)

Draws the metatile tiles of a row of 16 of a layer's metatiles (32 tiles) into its BG map (screen block 5 + layer), starting at tile (tileX, tileY); the BG map wraps every 32 tiles.

References fdMapGridCopyMetatileTilesToScreen() and Sint32.

Referenced by fdMapGridUpdateLayerScroll().

Definition at line 429 of file field_map_grid.c.

fdMapGridRenderMetatileTilesColumn

void fdMapGridRenderMetatileTilesColumn(Uint32 layer, Sint32 tileX, Sint32 tileY)

Draws the metatile tiles of a column of 11 of a layer's metatiles, one tile wide, into its BG map, starting at tile (tileX, tileY).

References fdMapGridCopyMetatileTilesHalfColumn() and Sint32.

Referenced by fdMapGridUpdateLayerScroll().

Definition at line 457 of file field_map_grid.c.

fdMapGridUpdateLayerScroll

void fdMapGridUpdateLayerScroll(void)

Each tick on a layered map: centres the view on the point the map follows (origin), clamped to the map's bounds and shaken by any decaying screen shake; then scrolls each of the three layers by its parallax scale and automatic scroll (wrapping at its period), draws the column or row of metatile tiles that scrolls into view, and sets its BG scroll.

References BgScrollWork, fdMapGridRenderMetatileTilesColumn(), fdMapGridRenderMetatileTilesRow(), Sint32, syMulFX() and syRandom().

Referenced by fdMapGridCenterOnFollowedPoint() and fdMapGridLoadMap().

Definition at line 492 of file field_map_grid.c.

fdMapGridSetCameraCenter

void fdMapGridSetCameraCenter(FIXED x, FIXED y)

Centres the view on (x, y) in 16.16 pixels, clamped to the map's bounds, and redraws every enabled layer's BG map around it.

References fdMapGridCopyMetatileTilesToScreen() and syMulFX().

Referenced by fdMapGridCenterOnFollowedPoint().

Definition at line 597 of file field_map_grid.c.

fdMapGridCopyMetatileTilesRect

void fdMapGridCopyMetatileTilesRect(Sint32 srcX, Sint32 srcY, Uint32 destX, Uint32 destY, Uint32 width, Uint32 height)

Copies what a rectangle of metatiles shows (each one's tiles id) from (srcX, srcY) to (destX, destY), width by height metatiles, keeping each destination's attributes, and redraws the copied metatiles that are on screen.

References Sint32 and width.

Referenced by fdMapGridCopyMetatilesTo(), fdMapGridPlayMapEdit() and scMercuryLighthouseRestoreNorthJetTiles().

Definition at line 726 of file field_map_grid.c.

fdMapGridPlayMapEdit

void fdMapGridPlayMapEdit(Uint16 *steps, Sint32 destX, Uint32 destY)

Plays a map edit (MAP_EDIT_STEP entries, ended by a source x of MAP_EDIT_STEPS_END): copies what each entry's rectangle of metatiles shows to (destX, destY) and waits its delay in ticks.

References fdMapGridCopyMetatileTilesRect(), Sint32, sySynch() and width.

Referenced by fdMapGridAnimateMetatiles(), scBilibinOpenDoorAndLeave(), scCrossboneIsleOpenEastDoor(), scCrossboneIsleOpenWestDoor(), scImilOpenDoorAndExit(), scImilTalkToOldMan(), scKolimaEnterDoor(), scMcCoyPalaceGroundsOpenDoor(), scMercuryLighthouseMiaOpensEntranceWithPly(), scMercuryLighthouseOpenGateWithMovedStatue(), scMercuryLighthouseOpenUpperGateWithMovedStatue(), scMercuryLighthousePressGateFloorSwitch(), scMercuryLighthousePressUpperGateFloorSwitch(), scSolSanctumElementalStarRoomBagJupiterStar(), scSolSanctumElementalStarRoomBagMercuryStar(), scSolSanctumElementalStarRoomBagVenusStar(), scValeEnterIsaacsHouse(), scValeKradensCottageEnterCottage(), scValePrologueEnterGaretsHouse(), scValePrologueEnterIsaacsHouse(), scValePrologueEnterJennasGrandparentsHouse(), scValePrologueEnterSouthHouse(), scValePrologueUnusedOpenSanctumDoor(), scVaultEnterChildsHouse(), scVaultEnterGemOwnersHouse(), scVaultEnterInn(), scVaultEnterItemShop(), scVaultEnterJail(), scVaultEnterMayorsHouse(), scVaultEnterWeaponAndArmorShop(), scVenusLighthouseMoveGatePillar(), scVenusLighthouseMoveSwitchPillar() and scXianOpenDoorAndLeave().

Definition at line 787 of file field_map_grid.c.

fdMapGridCopyMetatileRect

void fdMapGridCopyMetatileRect(Sint32 srcX, Sint32 srcY, Sint32 width, Sint32 height, Sint32 destX, Sint32 destY)

Copies a rectangle of metatiles (16x16 pixels each) as they are, from (srcX, srcY) to (destX, destY), width by height metatiles.

References Sint32 and width.

Referenced by fdMapGridCopyMetatiles().

Definition at line 807 of file field_map_grid.c.

fdMapGridCopyMetatileAttributeRect

void fdMapGridCopyMetatileAttributeRect(Sint32 srcX, Sint32 srcY, Sint32 width, Sint32 height, Sint32 destX, Sint32 destY)

Copies only the attributes of a rectangle of metatiles, from (srcX, srcY) to (destX, destY), width by height metatiles, keeping each destination metatile's metatile tiles number.

References Sint32 and width.

Referenced by fdMapGridCopyMetatileAttributes(), scColosseumNavampaMatchUpdateWallWedge(), scCrossboneIsleRideLogBNorth(), scCrossboneIsleRideLogBSouth(), scCrossboneIsleRideLogGEast(), scCrossboneIsleRideLogGWest(), scCrossboneIsleRideLogIEast(), scCrossboneIsleRideLogIWest(), scCrossboneIsleRideLogKNorth(), scCrossboneIsleRideLogKSouth(), scCrossboneIsleRideLogLEast(), scCrossboneIsleRideLogLWest(), scInit(), scLunpaFortressOpenGroundFloorDoor(), scPushedActorBlockFootprint(), scPushedActorRoll(), scRevealHideSecrets() and scTunnelRuinsSettleBalance().

Definition at line 857 of file field_map_grid.c.

fdMapGridCopyMetatileIndexRect

void fdMapGridCopyMetatileIndexRect(Sint32 srcX, Sint32 srcY, Sint32 width, Sint32 height, Sint32 destX, Sint32 destY)

Copies only the metatile tiles numbers of a rectangle of metatiles, from (srcX, srcY) to (destX, destY), width by height metatiles, keeping each destination metatile's attributes; metatiles in a visible area update the BG maps too.

The same copy as fdMapGridCopyMetatileTilesRect with the size before the destination and signed metatiles: the game has both, and scripts call each.

References Sint32 and width.

Referenced by fdMapGridCopyMetatilesLayered().

Definition at line 894 of file field_map_grid.c.

fdMapGridSetShownLayers

void fdMapGridSetShownLayers(Uint32 layerFlags)

Sets which of BG1-BG3 the map shows (bits 9-11 of its display flags, as in REG_DISPCNT) from layerFlags, keeping its other flags.

Referenced by scInit(), scLunpaFortressInitCave(), scLunpaFortressInitGroundFloor() and scLunpaFortressInitUpperFloor().

Definition at line 943 of file field_map_grid.c.