src/field/world_map_lines.c
The World Map's tilt: each line of the screen draws the flat map at its own scale and turn, so the ground seems to stretch away to a horizon. More…
#include "types.h"#include "fixed_math.h"#include "system/mul_fx.h"#include "system/globals.h"#include "field/world_map_affine.h"#include "system/asm.h"
Macros
| Name | Description | |
|---|---|---|
#define | FIXEDtoQ_8_8 (value) ((value) / (toFIXED(1) / Q_8_8(1))) | A 16.16 value in the 8.8 fixed point of the affine registers, rounded toward zero, and an 8.8 value back in 16.16. |
#define | Q_8_8toFIXED (value) ((value) * (toFIXED(1) / Q_8_8(1))) |
Functions
| Name | Description | |
|---|---|---|
Sint32 | fdMatrixCallInThumb (Sint32 x, Sint32 y) | Calls the Thumb function whose address is in ip with (x, y) from this ARM code and returns its result: here the stub table's arctangent, for the camera's yaw, called from the asm below by name. |
void | fdWorldMapUpdateAffineLines (VECTOR3 *eye, VECTOR3 *target, WORLD_MAP_SCANLINE *line, WORLD_MAP_AFFINE_LINE *affine) | Builds the world map's per-scanline affine table for one tick: the ground plane seen from eye towards target. line points at the 160 scanlines' ground terms, whose rotation terms stay cached while the yaw (ScanlineAngle) is unchanged; affine receives each line's parameters twice, for BG2 and then BG3, as the HBlank DMA writes both. |
Description
The World Map's tilt: each line of the screen draws the flat map at its own
scale and turn, so the ground seems to stretch away to a horizon. An ARM
function, as The Broken Seal's fdWorldMapUpdateAffineLines: its caller copies
the function from fdWorldMapUpdateAffineLinesCode (field_arm_entries.s) into
a heap slot and enters it in Thumb from there, so its stub
fdMatrixCallInThumb (field_arm_entries.s) travels with it.
Macros in detail
FIXEDtoQ_8_8
#define FIXEDtoQ_8_8(value) ((value) / (toFIXED(1) / Q_8_8(1)))
A 16.16 value in the 8.8 fixed point of the affine registers, rounded toward zero, and an 8.8 value back in 16.16.
Referenced by fdWorldMapUpdateAffineLines().
Definition at line 17 of file world_map_lines.c.
Q_8_8toFIXED
#define Q_8_8toFIXED(value) ((value) * (toFIXED(1) / Q_8_8(1)))
Referenced by fdWorldMapUpdateAffineLines().
Definition at line 18 of file world_map_lines.c.
Functions in detail
fdMatrixCallInThumb
Sint32 fdMatrixCallInThumb(Sint32 x, Sint32 y)
Calls the Thumb function whose address is in ip with (x, y) from this ARM code and returns its result: here the stub table's arctangent, for the camera's yaw, called from the asm below by name.
Definition at line 23 of file world_map_lines.c.
fdWorldMapUpdateAffineLines
void fdWorldMapUpdateAffineLines(VECTOR3 *eye, VECTOR3 *target, WORLD_MAP_SCANLINE *line, WORLD_MAP_AFFINE_LINE *affine)
Builds the world map's per-scanline affine table for one tick: the ground
plane seen from eye towards target. line points at the 160 scanlines' ground
terms, whose rotation terms stay cached while the yaw (ScanlineAngle) is
unchanged; affine receives each line's parameters twice, for BG2 and then
BG3, as the HBlank DMA writes both.
References ProjectionWork, ScanlineAngle, Sint32, StubsSystem, syMulFXArm() and TickCount.
Definition at line 30 of file world_map_lines.c.