include/graphics/palette_buffers.h
Palette fades: the colours a fade moves from and to, and the tints (grey, sepia, dusk and the rest) a scene or the title intro builds a target from.
Included by field_effect_tables.c and speaker.h.
Structures
| Name | Description | |
|---|---|---|
struct | TITLE_PALETTE_FADE | The title intro's palette fade, over every BG and sprite colour: the source palette, the shown and target colour channels, their steps, and two pages of packed colours. |
struct | PALETTE_FADE | The palette fade (HEAP_SLOT_PALETTE_FADE) that fades the BG and sprite palettes: the source palette, the shown and target colour channels, their per-tick steps, and two pages of packed RGB555 colours queued each tick. |
Macros
| Name | Description | |
|---|---|---|
#define | TITLE_PALETTE_FADE_CHANNELS (PLTT_COLORS * 3) | The colour channels a TITLE_PALETTE_FADE moves: B, G and R for each of the palette's colours. |
#define | PALETTE_FADE_BG_COLORS (14 * PALETTE_COLORS) | The background colours a PALETTE_FADE moves, palettes 0 to 13; as many sprite colours follow them. |
#define | PALETTE_FADE_CHANNELS (2 * PALETTE_FADE_BG_COLORS * 3) | The colour channels a PALETTE_FADE moves: B, G and R for each of its background and sprite colours. |
#define | BRIGHTNESS_RED_SHIFT (BLUE_SHIFT + 1) | The brightness 2R + 4G + B that PALETTE_TINT_GRAYSCALE and PALETTE_TINT_CUSTOM build, with each channel where a fade keeps it, in blue's place: red moved up and doubled, green moved up and doubled twice. |
#define | BRIGHTNESS_GREEN_SHIFT (BLUE_SHIFT - GREEN_SHIFT + 2) | |
#define | CUSTOM_TINT_DIVISOR 96 | PALETTE_TINT_CUSTOM gives each channel the brightness 2R + 4G + B times the tint's level over this, so white reaches full level under a tint level of 14. |
#define | SEPIA_SHADE_DIVISOR 10 | PALETTE_TINT_SEPIA's shade is a colour's R + G + B over this, 0 to 9. |
#define | SEPIA_LEVEL_MIN 8 | PALETTE_TINT_SEPIA holds each channel to these levels. |
#define | SEPIA_LEVEL_MAX 28 | |
#define | MUTED_RED_MIN 10 | PALETTE_TINT_MUTED holds each channel to its own range. |
#define | MUTED_RED_MAX 28 | |
#define | MUTED_GREEN_MIN 16 | |
#define | MUTED_GREEN_MAX 24 | |
#define | MUTED_BLUE_MIN 16 | |
#define | MUTED_BLUE_MAX 26 |
Enumerations
| Name | Description | |
|---|---|---|
enum | PALETTE_TINT { PALETTE_TINT_FROM_SOURCE, PALETTE_TINT_NONE, PALETTE_TINT_GR … } | A palette tint, a palette fade's build mode: below PALETTE_TINT_FROM_SOURCE, one RGB555 colour for all. |
enum | PALETTE_SELECTION { PALETTES_ALL, PALETTES_BG, PALETTES_SPRITES } | Which palettes mnTitlePaletteFadeBuildColors builds. |
Variables
| Name | Description | |
|---|---|---|
extern Uint16 | TitlePaletteFadeChannelCurve [32] | The title intro's own copies of the colour channel curves its tints read: each maps a 5-bit channel to a fade channel shifted up 10 bits, plain, lighter, or with more contrast. |
extern Uint16 | TitlePaletteFadeChannelCurveLight [32] | A brighter curve |
extern Uint16 | TitlePaletteFadeChannelCurveContrast [32] | A high-contrast curve (25 and above are full) |
Description
Palette fades: the colours a fade moves from and to, and the tints (grey, sepia, dusk and the rest) a scene or the title intro builds a target from.
Macros in detail
TITLE_PALETTE_FADE_CHANNELS
#define TITLE_PALETTE_FADE_CHANNELS (PLTT_COLORS * 3)
The colour channels a TITLE_PALETTE_FADE moves: B, G and R for each of the
palette's colours.
Referenced by mnTitlePaletteFadeCalculateSteps() and mnTitlePaletteFadeUpdate().
Definition at line 14 of file palette_buffers.h.
PALETTE_FADE_BG_COLORS
#define PALETTE_FADE_BG_COLORS (14 * PALETTE_COLORS)
The background colours a PALETTE_FADE moves, palettes 0 to 13; as many sprite
colours follow them.
Referenced by mnShopSaveAndTintFieldPalette(), scKolimaPaletteCapture() and scKolimaPaletteCurse().
Definition at line 18 of file palette_buffers.h.
PALETTE_FADE_CHANNELS
#define PALETTE_FADE_CHANNELS (2 * PALETTE_FADE_BG_COLORS * 3)
The colour channels a PALETTE_FADE moves: B, G and R for each of its
background and sprite colours.
Referenced by fdPaletteFadeCalculateSteps() and fdPaletteFadeUpdate().
Definition at line 21 of file palette_buffers.h.
BRIGHTNESS_RED_SHIFT
#define BRIGHTNESS_RED_SHIFT (BLUE_SHIFT + 1)
The brightness 2R + 4G + B that PALETTE_TINT_GRAYSCALE and
PALETTE_TINT_CUSTOM build, with each channel where a fade keeps it, in blue's
place: red moved up and doubled, green moved up and doubled twice.
Referenced by mnTitlePaletteFadeBuildColors().
Definition at line 156 of file palette_buffers.h.
BRIGHTNESS_GREEN_SHIFT
#define BRIGHTNESS_GREEN_SHIFT (BLUE_SHIFT - GREEN_SHIFT + 2)
Referenced by mnTitlePaletteFadeBuildColors().
Definition at line 157 of file palette_buffers.h.
CUSTOM_TINT_DIVISOR
#define CUSTOM_TINT_DIVISOR 96
PALETTE_TINT_CUSTOM gives each channel the brightness 2R + 4G + B times the
tint's level over this, so white reaches full level under a tint level of 14.
Referenced by fdPaletteFadeBuild() and mnTitlePaletteFadeBuildColors().
Definition at line 161 of file palette_buffers.h.
SEPIA_SHADE_DIVISOR
#define SEPIA_SHADE_DIVISOR 10
PALETTE_TINT_SEPIA's shade is a colour's R + G + B over this, 0 to 9.
Referenced by fdPaletteFadeBuild() and mnTitlePaletteFadeBuildColors().
Definition at line 164 of file palette_buffers.h.
SEPIA_LEVEL_MIN
#define SEPIA_LEVEL_MIN 8
PALETTE_TINT_SEPIA holds each channel to these levels.
Referenced by mnTitlePaletteFadeBuildColors().
Definition at line 166 of file palette_buffers.h.
SEPIA_LEVEL_MAX
#define SEPIA_LEVEL_MAX 28
Referenced by mnTitlePaletteFadeBuildColors().
Definition at line 167 of file palette_buffers.h.
MUTED_RED_MIN
#define MUTED_RED_MIN 10
PALETTE_TINT_MUTED holds each channel to its own range.
Referenced by mnTitlePaletteFadeBuildColors().
Definition at line 170 of file palette_buffers.h.
MUTED_RED_MAX
#define MUTED_RED_MAX 28
Referenced by mnTitlePaletteFadeBuildColors().
Definition at line 171 of file palette_buffers.h.
MUTED_GREEN_MIN
#define MUTED_GREEN_MIN 16
Referenced by mnTitlePaletteFadeBuildColors().
Definition at line 172 of file palette_buffers.h.
MUTED_GREEN_MAX
#define MUTED_GREEN_MAX 24
Referenced by mnTitlePaletteFadeBuildColors().
Definition at line 173 of file palette_buffers.h.
MUTED_BLUE_MIN
#define MUTED_BLUE_MIN 16
Referenced by mnTitlePaletteFadeBuildColors().
Definition at line 174 of file palette_buffers.h.
MUTED_BLUE_MAX
#define MUTED_BLUE_MAX 26
Referenced by mnTitlePaletteFadeBuildColors().
Definition at line 175 of file palette_buffers.h.
Enumerations in detail
PALETTE_TINT
enum PALETTE_TINT
A palette tint, a palette fade's build mode: below PALETTE_TINT_FROM_SOURCE,
one RGB555 colour for all.
| Enumerator | Value | Description |
|---|---|---|
PALETTE_TINT_FROM_SOURCE | 0x8000 | The backdrop colour (palette RAM's first colour) for all. |
PALETTE_TINT_NONE | 0x10000 | Each colour unchanged; the tints after it are numbered on from it. |
PALETTE_TINT_GRAYSCALE | Grey of brightness (2R + 4G + B) / 7. | |
PALETTE_TINT_SEPIA | Brownish grey, as when Ivan reports to Layana in Hammet Palace: the shade (R + G + B) / SEPIA_SHADE_DIVISOR, red at 4 times it plus 5, green and blue 3 times plus 5, each held to SEPIA_LEVEL_MIN to SEPIA_LEVEL_MAX. | |
PALETTE_TINT_DIM | The storm's gloom: Vale's grass and paths go a dull, dark olive while the sprites keep their colours, between the lightning's flashes and at the ending's darkened sea. Half R + 10, two thirds G + 8, B - 7; black stays black. | |
PALETTE_TINT_MUTED | The backgrounds World Map fades to as Venus Lighthouse shakes after its beacon is lit: each channel held to a narrow range (MUTED_RED_MIN to MUTED_RED_MAX and so on), then G and B + 2. | |
PALETTE_TINT_PALE | A lightning flash: the storm's backgrounds wash out almost to white. Half of each channel, plus their mean. | |
PALETTE_TINT_RED | The red Vale's eruption lightning flashes to from PALETTE_TINT_DIM: R plus an eighth of G and of B; G and B two thirds. | |
PALETTE_TINT_DIMMER | PALETTE_TINT_DIM darker: half R + 6, two thirds G + 4, B - 6. The title's intro builds PALETTE_TINT_DIM with this recipe. | |
PALETTE_TINT_FLAGS | 0x100000 | From here the TINT, BLEND and SPLIT bits are tested, TINT and BLEND carrying an RGB555 colour in the low 15 bits; any other value is the address of a ready buffer to copy. |
PALETTE_TINT_CUSTOM | 0x200000 | The brightness (2R + 4G + B) times the colour carried, over CUSTOM_TINT_DIVISOR. |
PALETTE_TINT_BLEND | 0x400000 | The brightness R + G + B shared out in the proportions of the colour carried. |
PALETTE_TINT_SPLIT | 0x800000 | Each colour unchanged. |
Definition at line 100 of file palette_buffers.h.
PALETTE_SELECTION
enum PALETTE_SELECTION
Which palettes mnTitlePaletteFadeBuildColors builds.
| Enumerator | Value | Description |
|---|---|---|
PALETTES_ALL | 0 | |
PALETTES_BG | 1 | |
PALETTES_SPRITES | 2 |
Definition at line 178 of file palette_buffers.h.