Alchemy
Loading...
Searching...
No Matches

mercury_lighthouse_palette_cycle.h

Go to the documentation of this file.
1#include "battle.h"
2#include "debug.h"
3#include "field.h"
4#include "game.h"
5#include "graphics.h"
6#include "menu.h"
7#include "minigame.h"
8#include "sound.h"
9#include "system.h"
10#include "types.h"
11#include "frame.h"
12#include "io_reg.h"
13
14// Mercury Lighthouse and its entrance: the shimmer of the pool once it is
15// woken (flag 0x875), in colours 9 to 15 of background palette 6.
16
17/// A scene callback: every fifth frame colour 9's red level steps on by 4, and
18/// each of colours 10 to 15 takes the red level of the colour below it (13 to
19/// 15 dimmed by four tenths), so the shimmer runs up the ramp; green and blue
20/// stay those of gPaletteCycleGreen and gPaletteCycleBlue.
22 /* FAKEMATCH(volatile): cur lives at sp+2, stored with strh and loaded again
23 * with ldrh for v, as the bytes show; as a plain u16, 22 of 65 instructions
24 * differ in tbs-en. */
25 volatile u16 cur;
26 u32 i;
27 s32 v;
28 s32 bits;
29 u16 *dst;
30
31 cur = 0;
32 if (gFrameCount % 5 != 0)
33 return;
35 for (i = 0; i < 6; i++) {
36 cur = BG_PLTT_COLOR(6, 14 - i) & 31;
37 v = cur;
38 if (i <= 2)
39 v -= v * 4 / 10;
40 dst = (u16 *)&BG_PLTT_COLOR(6, 15 - i);
41 bits = (gPaletteCycleBlue << 10) | (gPaletteCycleGreen << 5);
42 *dst = v | bits;
43 }
44 BG_PLTT_COLOR(6, 9) = gPaletteCycleRed | bits;
45}
46
47/// While the pool sleeps: colours 9 to 15 of background palette 6 are black.
49 u32 i;
50
51 for (i = 0; i < 7; i++)
52 BG_PLTT_COLOR(6, 15 - i) = 0;
53}
The engine calls the debug menus import, and their palette swatch tiles.
The frame loop's globals: lag counts, the CPU load display and the VBlank flags.
volatile u32 gFrameCount
Frames WaitFrames has finished.
The screen blend's globals and the graphics routines.
The hardware's I/O registers and their bits, as pret names them.
#define BG_PLTT_COLOR(palette, color)
Definition io_reg.h:158
s32 gPaletteCycleGreen
s32 gPaletteCycleRed
s32 gPaletteCycleBlue
static void MercuryLighthouse_ClearPalette(void)
While the pool sleeps: colours 9 to 15 of background palette 6 are black.
static void MercuryLighthouse_CyclePalette(void)
A scene callback: every fifth frame colour 9's red level steps on by 4, and each of colours 10 to 15 ...
The reel game's title lettering.
The system's routines and globals: interrupts, BIOS sound bias, random numbers and sleep.
The integer types, TRUE, UNUSED and the fixed-address macros.
signed int s32
Definition types.h:14
unsigned int u32
Definition types.h:15
unsigned short u16
Definition types.h:13