scroll.h
games/tbs/include/scroll.h on GitHub
Structures
DisplayScrollWork
struct DisplayScrollWork
The wavy background's work: two pages of BG1 to BG3 scroll offsets for each of the 160 scanlines, and the sine wave that bends them on each axis.
| Field | Declared as | |
|---|---|---|
rows | struct BgScroll rows[2][160][3] | per page and scanline: BG3, BG2, BG1 |
page | u8 page | the page the HBlank DMA shows; the other is built |
mode | u8 mode | set at the start; not read by name |
frame | u16 frame | frames built so far, added to BG3's y for the wave's phase |
unkf04 | u8 unkf04[4] | not named by TBS code |
freqX | s32 freqX | phase per frame and per BG3 row, 16.16 wave table entries |
freqY | s32 freqY | phase per frame and per BG3 row, 16.16 wave table entries |
stepX | s32 stepX | 16.16 wave table entries a scanline, 256 a cycle |
stepY | s32 stepY | 16.16 wave table entries a scanline, 256 a cycle |
ampX | s32 ampX | 16.16 scale on the sine entry, which is then divided by 256 |
ampY | s32 ampY | 16.16 scale on the sine entry, which is then divided by 256 |
Used by DisplayScroll_ArmHBlankDma, DisplayScroll_BuildAndSwapHBlankPage, DisplayScroll_InitializeHBlankDma, gHBlankScrollWork.
Globals, without a comment: gHBlankScrollWork, gDisplayScroll_WaveSine.