include/field/curve.h
The ground height of a map metatile from its shape's height samples, one function for each kind of slope, and the tables they read.
Included by field_terrain.c and map_grid_data.c.
Enumerations
| Name | Description | |
|---|---|---|
enum | anonymous enum { CURVE_VALUE_SHIFT, CURVE_HALF_STEPS, CURVE_FULL_STEPS } |
Functions
| Name | Description | |
|---|---|---|
FIXED | fdTerrainGetFlatHeight (const Sint8 *samples) | The ground height functions (MapGridTerrainHeightFunctions): each takes a metatile's height samples after its kind byte and a pixel (x, y) within the 16x16 metatile, and returns the ground height there in 16.16 pixels. |
FIXED | fdTerrainGetSlopeXHeight (const Sint8 *samples, Sint32 pos) | The height of a slope across x at position (0 to 15 of the metatile): a straight line from samples[0] to samples[1]. |
FIXED | fdTerrainGetSlopeYHeight (const Sint8 *samples, Sint32 unused, Sint32 pos) | A slope along y: from sample 0 at the top to sample 1 at the bottom. |
FIXED | fdTerrainGetStepSumDiagonalHeight (const Sint8 *samples, Sint32 start, Sint32 end) | A step across the diagonal x + y = 15: sample 0 before it, sample 1 after it and the higher of the two on it. |
FIXED | fdTerrainGetSampleTableHeight (const Sint8 *samples, Uint32 pos, Uint32 row) | The sample TerrainSampleIndexTable picks for (x, y): a byte per pixel of the metatile, row by row. |
Variables
| Name | Description | |
|---|---|---|
extern Uint8 | TerrainRoundedSquareMask [] | A rounded square, a byte per pixel of a 16-pixel metatile, row by row: 1 where the square stands (fdTerrainGetRoundedSquareHeight takes the second height there) and 0 in its four cut corners. |
extern Uint8 | TerrainSampleIndexTable [] | The sample fdTerrainGetSampleTableHeight reads at each position: 0, 1 or 2, split along two diagonals. |
Description
The ground height of a map metatile from its shape's height samples, one function for each kind of slope, and the tables they read.
Enumerations in detail
anonymous enum
enum { CURVE_VALUE_SHIFT, CURVE_HALF_STEPS, CURVE_FULL_STEPS }
| Enumerator | Value | Description |
|---|---|---|
CURVE_VALUE_SHIFT | 19 | converts an 8-pixel height sample into 16.16 fixed-point pixels |
CURVE_HALF_STEPS | 8 | pixels to the middle of a 16-pixel metatile |
CURVE_FULL_STEPS | 16 | pixels across a metatile |
Definition at line 15 of file curve.h.