pokeemerald/include/palette.h

78 lines
2.6 KiB
C
Raw Normal View History

#ifndef GUARD_PALETTE_H
#define GUARD_PALETTE_H
#define gPaletteFade_selectedPalettes (gPaletteFade.multipurpose1) // normal and fast fade
#define gPaletteFade_blendCnt (gPaletteFade.multipurpose1) // hardware fade
#define gPaletteFade_delay (gPaletteFade.multipurpose2) // normal and hardware fade
#define gPaletteFade_submode (gPaletteFade.multipurpose2) // fast fade
2017-10-12 09:06:19 +02:00
#define PLTT_BUFFER_SIZE 0x200
#define PLTT_DECOMP_BUFFER_SIZE (PLTT_BUFFER_SIZE * 2)
#define PALETTE_FADE_STATUS_DELAY 2
#define PALETTE_FADE_STATUS_ACTIVE 1
#define PALETTE_FADE_STATUS_DONE 0
#define PALETTE_FADE_STATUS_LOADING 0xFF
2021-02-24 17:01:02 +01:00
#define PALETTES_BG 0x0000FFFF
#define PALETTES_OBJECTS 0xFFFF0000
#define PALETTES_ALL (PALETTES_BG | PALETTES_OBJECTS)
enum
{
FAST_FADE_IN_FROM_WHITE,
FAST_FADE_OUT_TO_WHITE,
FAST_FADE_IN_FROM_BLACK,
FAST_FADE_OUT_TO_BLACK,
};
struct PaletteFadeControl
{
u32 multipurpose1;
u8 delayCounter:6;
u16 y:5; // blend coefficient
u16 targetY:5; // target blend coefficient
u16 blendColor:15;
2018-07-15 13:23:38 +02:00
bool16 active:1;
u16 multipurpose2:6;
2018-07-15 13:23:38 +02:00
bool16 yDec:1; // whether blend coefficient is decreasing
bool16 bufferTransferDisabled:1;
u16 mode:2;
2018-07-15 13:23:38 +02:00
bool16 shouldResetBlendRegisters:1;
bool16 hardwareFadeFinishing:1;
u16 softwareFadeFinishingCounter:5;
2018-07-15 13:23:38 +02:00
bool16 softwareFadeFinishing:1;
bool16 objPaletteToggle:1;
u8 deltaY:4; // rate of change of blend coefficient
};
extern struct PaletteFadeControl gPaletteFade;
extern u32 gPlttBufferTransferPending;
extern u8 gPaletteDecompressionBuffer[];
2021-10-29 17:56:06 +02:00
extern u16 gPlttBufferUnfaded[PLTT_BUFFER_SIZE];
extern u16 gPlttBufferFaded[PLTT_BUFFER_SIZE];
2018-12-19 03:15:59 +01:00
void LoadCompressedPalette(const u32 *, u16, u16);
void LoadPalette(const void *, u16, u16);
void FillPalette(u16, u16, u16);
void TransferPlttBuffer(void);
u8 UpdatePaletteFade(void);
void ResetPaletteFade(void);
bool8 BeginNormalPaletteFade(u32, s8, u8, u8, u16);
2021-11-01 17:01:51 +01:00
void PaletteStruct_ResetById(u16);
void ResetPaletteFadeControl(void);
void InvertPlttBuffer(u32);
void TintPlttBuffer(u32, s8, s8, s8);
void UnfadePlttBuffer(u32);
void BeginFastPaletteFade(u8);
void BeginHardwarePaletteFade(u8, u8, u8, u8, u8);
void BlendPalettes(u32 selectedPalettes, u8 coeff, u16 color);
void BlendPalettesUnfaded(u32, u8, u16);
2020-08-26 22:31:37 +02:00
void BlendPalettesGradually(u32 selectedPalettes, s8 delay, u8 coeff, u8 coeffTarget, u16 color, u8 priority, u8 id);
2019-01-20 18:24:35 +01:00
void TintPalette_GrayScale(u16 *palette, u16 count);
void TintPalette_GrayScale2(u16 *palette, u16 count);
void TintPalette_SepiaTone(u16 *palette, u16 count);
void TintPalette_CustomTone(u16 *palette, u16 count, u16 rTone, u16 gTone, u16 bTone);
#endif // GUARD_PALETTE_H