Alchemy
Loading...
Searching...
No Matches

scroll.h

Go to the documentation of this file.
1#ifndef ALCHEMY_SCROLL_H
2#define ALCHEMY_SCROLL_H
3
4/// @file
5/// The display scroll work, the HBlank scroll work and its wave.
6
7#include "map_scroll.h"
8#include "static_assert.h"
9
10/// The wavy background's work: two pages of BG1 to BG3 scroll offsets for each
11/// of the 160 scanlines, and the sine wave that bends them on each axis.
13 struct BgScroll rows[2][160][3]; ///< per page and scanline: BG3, BG2, BG1
14 u8 page; ///< the page the HBlank DMA shows; the other is built
15 u8 mode; ///< set at the start; not read by name
16 u16 frame; ///< frames built so far, added to BG3's y for the wave's phase
17 u8 unkf04[4]; ///< not named by TBS code
18 s32 freqX; ///< phase per frame and per BG3 row, 16.16 wave table entries
19 s32 freqY; ///< phase per frame and per BG3 row, 16.16 wave table entries
20 s32 stepX; ///< 16.16 wave table entries a scanline, 256 a cycle
21 s32 stepY; ///< 16.16 wave table entries a scanline, 256 a cycle
22 s32 ampX; ///< 16.16 scale on the sine entry, which is then divided by 256
23 s32 ampY; ///< 16.16 scale on the sine entry, which is then divided by 256
24};
25
26STATIC_ASSERT(sizeof(struct DisplayScrollWork) == 0xf20);
28STATIC_ASSERT(offsetof(struct DisplayScrollWork, freqX) == 0xf08);
29
31extern const s16 gDisplayScroll_WaveSine[];
32
33#endif
const s16 gDisplayScroll_WaveSine[256]
Sine times 4096, 256 steps to a turn.
Definition fxdata.c:347
The map layers' scroll work and the background scroll values.
struct DisplayScrollWork * gHBlankScrollWork
STATIC_ASSERT, a compile-time check that emits nothing.
#define STATIC_ASSERT(condition)
C89 permits repeated extern declarations of the same array.
#define offsetof(type, member)
Definition stddef.h:19
A background's hardware scroll offsets.
Definition map_scroll.h:64
The wavy background's work: two pages of BG1 to BG3 scroll offsets for each of the 160 scanlines,...
Definition scroll.h:12
u8 mode
set at the start; not read by name
Definition scroll.h:15
struct BgScroll rows[2][160][3]
per page and scanline: BG3, BG2, BG1
Definition scroll.h:13
s32 freqX
phase per frame and per BG3 row, 16.16 wave table entries
Definition scroll.h:18
u8 page
the page the HBlank DMA shows; the other is built
Definition scroll.h:14
s32 stepY
16.16 wave table entries a scanline, 256 a cycle
Definition scroll.h:21
u8 unkf04[4]
not named by TBS code
Definition scroll.h:17
s32 ampX
16.16 scale on the sine entry, which is then divided by 256
Definition scroll.h:22
u16 frame
frames built so far, added to BG3's y for the wave's phase
Definition scroll.h:16
s32 ampY
16.16 scale on the sine entry, which is then divided by 256
Definition scroll.h:23
s32 freqY
phase per frame and per BG3 row, 16.16 wave table entries
Definition scroll.h:19
s32 stepX
16.16 wave table entries a scanline, 256 a cycle
Definition scroll.h:20
signed int s32
Definition types.h:14
signed short s16
Definition types.h:12
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11