Alchemy
Loading...
Searching...
No Matches

mapdata.c File Reference

Map terrain: the height curve of each cell kind and the world map's terrain behaviour. More...

Go to the source code of this file.

Variables

const TerrainHeightFn gMap_TerrainHeightFunctions [16]
 Terrain height functions, chosen by the low four bits of a cell's first collision byte and called with (the remaining samples, x within the cell, y within the cell).
const u8 gWorldMap_TerrainBehaviorTable [48]
 World map terrain behaviour, indexed by the collision value plus 0x10 when the block word's top bit is set, or plus 0x20 (whatever that bit) for terrain kind 21.
const s8 gWorldMap_DirectionOffsets [8][2]
 The eight compass directions as (x, y) offsets of radius 40.
const u32 gWorldMap_UnitScale [2]
 Two 1.0s (Q16).

Detailed Description

Map terrain: the height curve of each cell kind and the world map's terrain behaviour.

Definition in file mapdata.c.

Variable Documentation

◆ gMap_TerrainHeightFunctions

const TerrainHeightFn gMap_TerrainHeightFunctions[16]
Initial value:
= {
}
s32 Curve_LerpTwoSamplesByTable(const u8 *heightBytes, s32 x, s32 y)
A raised or sunken rounded square: sample 1 where gCurve_LerpWeightTable is 1, sample 0 in the corner...
Definition terrain.c:188
s32 Curve_LerpTwoSamplesB(const u8 *heightBytes, s32 pixelX, s32 pixelY)
A slope along y: from sample 0 at y = 0 towards sample 1 at y = 16.
Definition terrain.c:44
s32 Curve_GetFirstSampleB(const u8 *heightBytes, s32 pixelX, s32 pixelY)
Flat, as Curve_GetFirstSampleA. Kind 14.
Definition terrain.c:323
s32 Curve_LookupSampleByTableReversed(const u8 *heightBytes, s32 pixelX, s32 pixelY)
The same, with the table mirrored left to right.
Definition terrain.c:311
s32 Curve_StepAtSummedPosition(const u8 *heightBytes, s32 x, s32 y)
A step across the diagonal x + y = 15: sample 0 before it, sample 1 after it and the higher of the tw...
Definition terrain.c:61
s32 Curve_GetFirstSampleC(const u8 *heightBytes, s32 pixelX, s32 pixelY)
Flat, as Curve_GetFirstSampleA. Kind 15.
Definition terrain.c:329
s32 Curve_LerpTwoSamples(const u8 *heightBytes, s32 pixelX, s32 pixelY)
A slope along x: from sample 0 at x = 0 towards sample 1 at x = 16.
Definition terrain.c:28
s32 Curve_StepAtHalfB(const u8 *heightBytes, s32 pixelX, s32 pixelY)
A step along y: sample 0 for y < 8, sample 1 from y = 8.
Definition terrain.c:214
s32 Curve_LookupSampleByTable(const u8 *heightBytes, s32 pixelX, s32 pixelY)
The sample gCurve_SampleIndexTable picks for (x, y).
Definition terrain.c:300
s32 Curve_GetFirstSampleA(const u8 *heightBytes, s32 pixelX, s32 pixelY)
The terrain height functions (gMap_TerrainHeightFunctions): each takes a cell's height samples after ...
Definition terrain.c:21
s32 Curve_LerpThreeSamplesAtHalf(const u8 *heightBytes, s32 pixelX, s32 pixelY)
A slope along x that bends at the middle: sample 0 at x = 0, sample 1 at x = 8, towards sample 2 at x...
Definition terrain.c:228
s32 Curve_StepAtHalf(const u8 *heightBytes, s32 pixelX, s32 pixelY)
A step along x: sample 0 for x < 8, sample 1 from x = 8.
Definition terrain.c:201
s32 Curve_StepAtDifferencePosition(const u8 *heightBytes, s32 x, s32 y)
A step across the diagonal x = y: sample 0 where y < x, sample 1 where y > x and the higher of the tw...
Definition terrain.c:88
s32 Curve_LerpThreeSamplesAtDifference(const u8 *heightBytes, s32 x, s32 y)
A slope that bends on the diagonal x = y: from sample 0 at the top right corner to sample 1 on the di...
Definition terrain.c:149
s32 Curve_LerpThreeSamplesByRatio(const u8 *heightBytes, s32 x, s32 y)
A slope that bends on the diagonal x + y = 15: from sample 0 at the top left corner to sample 1 on th...
Definition terrain.c:118
s32 Curve_LerpThreeSamplesAtHalfB(const u8 *heightBytes, s32 pixelX, s32 pixelY)
A slope along y that bends at the middle, as kind 10 does along x.
Definition terrain.c:266

Terrain height functions, chosen by the low four bits of a cell's first collision byte and called with (the remaining samples, x within the cell, y within the cell).

Each reads only the arguments it needs. Read by Map_GetTerrainHeight and Map_CheckObjectStep (terrain.c).

Definition at line 14 of file mapdata.c.

Referenced by Map_CheckObjectStep(), and Map_GetTerrainHeight().

◆ gWorldMap_TerrainBehaviorTable

const u8 gWorldMap_TerrainBehaviorTable[48]
Initial value:
= {
0, 0, 0, 0, 0, 1, 7, 1, 1, 2, 1, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 4, 7, 1, 1, 6, 1, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 5, 5, 5, 5, 6, 5, 5, 5, 5, 0, 0,
}

World map terrain behaviour, indexed by the collision value plus 0x10 when the block word's top bit is set, or plus 0x20 (whatever that bit) for terrain kind 21.

Read only by GetWorldMapTerrainBehavior.

Definition at line 37 of file mapdata.c.

Referenced by GetWorldMapTerrainBehavior().

◆ gWorldMap_DirectionOffsets

const s8 gWorldMap_DirectionOffsets[8][2]
Initial value:
= {
{0, -40}, {28, -28}, {40, 0}, {28, 28},
{0, 40}, {-28, 28}, {-40, 0}, {-28, -28},
}

The eight compass directions as (x, y) offsets of radius 40.

No code in The Broken Seal names it.

Definition at line 46 of file mapdata.c.

◆ gWorldMap_UnitScale

const u32 gWorldMap_UnitScale[2]
Initial value:
= {
0x10000,
0x10000,
}

Two 1.0s (Q16).

No code in The Broken Seal names it; The Lost Age's battle effects read its copy as a unit scale.

Definition at line 53 of file mapdata.c.