Skip to Content
The Alchemy Project

struct LINE_SCROLL_STATE

The line scroll's state: two pages of BG1 to BG3 scroll offsets for each of the 160 scanlines, and the sine wave that bends them on each axis.

Declared in field.h.

Fields

NameDescription
BG_SCROLLrows [2][160][3]per page and scanline: BG3, BG2, BG1
Uint8pagethe page the HBlank DMA shows; the other is built
Uint8modeset at the start; not read by name
Uint16frameticks built so far, added to BG3's y for the wave's phase
Uint8unused [4]zeroed with the block; nothing reads or writes it
FIXEDfrequencyXphase per tick and per BG3 row, 16.16 wave table entries
FIXEDfrequencyYphase per tick and per BG3 row, 16.16 wave table entries
FIXEDstepX16.16 wave table entries a scanline, 256 a cycle
FIXEDstepY16.16 wave table entries a scanline, 256 a cycle
FIXEDampX16.16 scale on the sine entry, which is then divided by 256
FIXEDampY16.16 scale on the sine entry, which is then divided by 256

Description

The line scroll's state: two pages of BG1 to BG3 scroll offsets for each of the 160 scanlines, and the sine wave that bends them on each axis.

struct LINE_SCROLL_STATE

Referenced by fdLineScrollArmDMA(), fdLineScrollBuildPage() and scLineScrollInitWave().

Definition at line 437 of file field.h.

Fields in detail

rows

BG_SCROLL rows[2][160][3]

per page and scanline: BG3, BG2, BG1

page

Uint8 page

the page the HBlank DMA shows; the other is built

mode

Uint8 mode

set at the start; not read by name

frame

Uint16 frame

ticks built so far, added to BG3's y for the wave's phase

unused

Uint8 unused[4]

zeroed with the block; nothing reads or writes it

frequencyX

FIXED frequencyX

phase per tick and per BG3 row, 16.16 wave table entries

frequencyY

FIXED frequencyY

phase per tick and per BG3 row, 16.16 wave table entries

stepX

FIXED stepX

16.16 wave table entries a scanline, 256 a cycle

stepY

FIXED stepY

16.16 wave table entries a scanline, 256 a cycle

ampX

FIXED ampX

16.16 scale on the sine entry, which is then divided by 256

ampY

FIXED ampY

16.16 scale on the sine entry, which is then divided by 256