Alchemy
Loading...
Searching...
No Matches

palbuf.h

Go to the documentation of this file.
1#ifndef ALCHEMY_PALBUF_H
2#define ALCHEMY_PALBUF_H
3
4/// @file
5/// Palette fades, the battle effect palette buffers and the colour channel
6/// curves.
7
8#include "edition.h"
9#include "types.h"
10#include "static_assert.h"
11
12/// A colour buffer for all 512 palette colours: the source palette, the shown
13/// and target colour channels, their steps, and two pages of packed colours.
15 /// The source palette, RGB555: 256 BG colours, then 256 OBJ colours.
17 /// The shown colours, as B, G and R channels shifted up 10 bits, three a
18 /// colour.
19 u16 current[0x600];
20 u16 target[0x600]; ///< the colours current moves toward, as current
21 u16 delta[0x600]; ///< added to each current channel each frame
22 /// Two pages of RGB555 colours: one is built while the other is queued.
23 u16 packed[2][512];
24 u8 page; ///< the packed page queued this frame
25 s8 duration; ///< frames; 0 when the colours are not moving
26 u8 step; ///< frames
27 u8 padding3003; ///< never named
28};
29
30STATIC_ASSERT(sizeof(struct PaletteFade) == 0x3004);
31STATIC_ASSERT(offsetof(struct PaletteFade, current) == 0x400);
32STATIC_ASSERT(offsetof(struct PaletteFade, target) == 0x1000);
33STATIC_ASSERT(offsetof(struct PaletteFade, delta) == 0x1c00);
34STATIC_ASSERT(offsetof(struct PaletteFade, packed) == 0x2800);
35STATIC_ASSERT(offsetof(struct PaletteFade, page) == 0x3000);
36
37/// The colour buffer (heap block 32) that fades the BG and OBJ palettes: the
38/// source palette, the shown and target colour channels, their per-frame
39/// steps, and two pages of packed RGB555 colours queued each frame.
41 /// The source palette, RGB555: 224 BG colours, then 224 OBJ colours;
42 /// palette[0] is the backdrop.
43 u16 palette[0x1c0];
44 /// The shown colours, as B, G and R channels shifted up 10 bits, three a
45 /// colour.
46 u16 current[0x540];
47 u16 target[0x540]; ///< the colours current moves toward, as current
48 u16 delta[0x540]; ///< added to each current channel each frame
49 /// Two pages of RGB555 colours: one is built while the other is queued.
50 u16 packed[2][0x1c0];
51 u8 page; ///< the packed page queued this frame
52 s8 duration; ///< frames; 0 when the colours are not moving
53 s8 step; ///< frames
54 u8 padding2a03; ///< never named
55};
56
57STATIC_ASSERT(sizeof(struct BattleEffectBuffers) == 0x2a04);
58STATIC_ASSERT(offsetof(struct BattleEffectBuffers, current) == 0x380);
59STATIC_ASSERT(offsetof(struct BattleEffectBuffers, target) == 0xe00);
60STATIC_ASSERT(offsetof(struct BattleEffectBuffers, delta) == 0x1880);
61STATIC_ASSERT(offsetof(struct BattleEffectBuffers, packed) == 0x2300);
63
64extern u16 gPalette_ChannelCurve[32];
67
68/// A colour buffer's build mode: below 0x8000 one RGB555 colour for all.
70 /// The backdrop colour (palette RAM's first colour) for all.
72 PALETTE_TRANSFORM_PLAIN = 0x10000, ///< each colour unchanged
73 PALETTE_TRANSFORM_GREY = 0x10001, ///< grey of brightness (2R + 4G + B) / 7
79 PALETTE_TRANSFORM_WARM2 = 0x10007, ///< half R + 6, two thirds G + 4, B - 6
80 /// From here the TINT, BLEND and SPLIT bits are tested, TINT and BLEND
81 /// carrying an RGB555 colour in the low 15 bits; any other value is the
82 /// address of a ready buffer to copy.
84 /// The brightness (2R + 4G + B) times the colour carried.
86 /// The brightness R + G + B shared out in the proportions of the colour
87 /// carried.
89 PALETTE_TRANSFORM_SPLIT = 0x800000 ///< each colour unchanged
90};
91
92#endif
The edition's language, for C to compare (LANGUAGE == LANGUAGE_GERMAN).
u16 gPalette_ChannelCurve[32]
Maps a channel (0..31) to a component (0..31 << 10).
Definition intro.c:1089
u16 gPalette_ChannelCurveLight[32]
A brighter curve.
Definition intro.c:1097
u16 gPalette_ChannelCurveContrast[32]
A high-contrast curve (25 and above are full).
Definition intro.c:1105
PaletteTransform
A colour buffer's build mode: below 0x8000 one RGB555 colour for all.
Definition palbuf.h:69
@ PALETTE_TRANSFORM_GREY
grey of brightness (2R + 4G + B) / 7
Definition palbuf.h:73
@ PALETTE_TRANSFORM_MUTED
Definition palbuf.h:76
@ PALETTE_TRANSFORM_BLEND
The brightness R + G + B shared out in the proportions of the colour carried.
Definition palbuf.h:88
@ PALETTE_TRANSFORM_PLAIN
each colour unchanged
Definition palbuf.h:72
@ PALETTE_TRANSFORM_PALE
Definition palbuf.h:77
@ PALETTE_TRANSFORM_FROM_SOURCE
The backdrop colour (palette RAM's first colour) for all.
Definition palbuf.h:71
@ PALETTE_TRANSFORM_WARM
Definition palbuf.h:75
@ PALETTE_TRANSFORM_SEPIA
Definition palbuf.h:74
@ PALETTE_TRANSFORM_SPLIT
each colour unchanged
Definition palbuf.h:89
@ PALETTE_TRANSFORM_WARM2
half R + 6, two thirds G + 4, B - 6
Definition palbuf.h:79
@ PALETTE_TRANSFORM_FLAGS
From here the TINT, BLEND and SPLIT bits are tested, TINT and BLEND carrying an RGB555 colour in the ...
Definition palbuf.h:83
@ PALETTE_TRANSFORM_RED
Definition palbuf.h:78
@ PALETTE_TRANSFORM_TINT
The brightness (2R + 4G + B) times the colour carried.
Definition palbuf.h:85
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
The colour buffer (heap block 32) that fades the BG and OBJ palettes: the source palette,...
Definition palbuf.h:40
u16 current[0x540]
The shown colours, as B, G and R channels shifted up 10 bits, three a colour.
Definition palbuf.h:46
u16 target[0x540]
the colours current moves toward, as current
Definition palbuf.h:47
u8 padding2a03
never named
Definition palbuf.h:54
u16 packed[2][0x1c0]
Two pages of RGB555 colours: one is built while the other is queued.
Definition palbuf.h:50
s8 step
frames
Definition palbuf.h:53
u8 page
the packed page queued this frame
Definition palbuf.h:51
s8 duration
frames; 0 when the colours are not moving
Definition palbuf.h:52
u16 palette[0x1c0]
The source palette, RGB555: 224 BG colours, then 224 OBJ colours; palette[0] is the backdrop.
Definition palbuf.h:43
u16 delta[0x540]
added to each current channel each frame
Definition palbuf.h:48
A colour buffer for all 512 palette colours: the source palette, the shown and target colour channels...
Definition palbuf.h:14
u8 padding3003
never named
Definition palbuf.h:27
u16 delta[0x600]
added to each current channel each frame
Definition palbuf.h:21
u8 step
frames
Definition palbuf.h:26
u16 palette[512]
The source palette, RGB555: 256 BG colours, then 256 OBJ colours.
Definition palbuf.h:16
u16 current[0x600]
The shown colours, as B, G and R channels shifted up 10 bits, three a colour.
Definition palbuf.h:19
s8 duration
frames; 0 when the colours are not moving
Definition palbuf.h:25
u16 target[0x600]
the colours current moves toward, as current
Definition palbuf.h:20
u16 packed[2][512]
Two pages of RGB555 colours: one is built while the other is queued.
Definition palbuf.h:23
u8 page
the packed page queued this frame
Definition palbuf.h:24
The integer types, TRUE, UNUSED and the fixed-address macros.
signed char s8
Definition types.h:10
unsigned short u16
Definition types.h:13
unsigned char u8
Definition types.h:11