Alchemy
Loading...
Searching...
No Matches

mapdata.c

Go to the documentation of this file.
1/// @file
2/// Map terrain: the height curve of each cell kind and the world map's terrain
3/// behaviour.
4
6#include "unit/field/field.h"
7#include "field.h"
8#include "types.h"
9
10/// Terrain height functions, chosen by the low four bits of a cell's first
11/// collision byte and called with (the remaining samples, x within the cell,
12/// y within the cell). Each reads only the arguments it needs. Read by
13/// Map_GetTerrainHeight and Map_CheckObjectStep (terrain.c).
31};
32
33/// World map terrain behaviour, indexed by the collision value plus 0x10 when
34/// the block word's top bit is set, or plus 0x20 (whatever that bit) for
35/// terrain kind 21. Read only by GetWorldMapTerrainBehavior.
36// clang-format off
38 0, 0, 0, 0, 0, 1, 7, 1, 1, 2, 1, 1, 1, 1, 0, 0,
39 0, 0, 0, 0, 0, 4, 7, 1, 1, 6, 1, 1, 1, 1, 0, 0, // 0x10
40 0, 0, 0, 0, 0, 5, 5, 5, 5, 6, 5, 5, 5, 5, 0, 0, // 0x20: terrain kind 21
41};
42// clang-format on
43
44/// The eight compass directions as (x, y) offsets of radius 40. No code in
45/// The Broken Seal names it.
47 {0, -40}, {28, -28}, {40, 0}, {28, 28},
48 {0, 40}, {-28, 28}, {-40, 0}, {-28, -28},
49};
50
51/// Two 1.0s (Q16). No code in The Broken Seal names it; The Lost Age's
52/// battle effects read its copy as a unit scale.
54 0x10000,
55 0x10000,
56};
const TerrainHeightFn gMap_TerrainHeightFunctions[16]
Terrain height functions, chosen by the low four bits of a cell's first collision byte and called wit...
Definition mapdata.c:14
const u32 gWorldMap_UnitScale[2]
Two 1.0s (Q16).
Definition mapdata.c:53
const s8 gWorldMap_DirectionOffsets[8][2]
The eight compass directions as (x, y) offsets of radius 40.
Definition mapdata.c:46
const u8 gWorldMap_TerrainBehaviorTable[48]
World map terrain behaviour, indexed by the collision value plus 0x10 when the block word's top bit i...
Definition mapdata.c:37
s32(*) TerrainHeightFn(const u8 *heightBytes, s32 pixelX, s32 pixelY)
Height samples and pixel coordinates within a 16x16 terrain cell.
Definition mapdata.h:7
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
The integer types, TRUE, UNUSED and the fixed-address macros.
unsigned int u32
Definition types.h:15
signed char s8
Definition types.h:10
unsigned char u8
Definition types.h:11