mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Label unknown palette functions
This commit is contained in:
parent
684f599a44
commit
ab1074e629
@ -58,15 +58,9 @@ void FillPalette(u16, u16, u16);
|
||||
void TransferPlttBuffer(void);
|
||||
u8 UpdatePaletteFade(void);
|
||||
void ResetPaletteFade(void);
|
||||
void ReadPlttIntoBuffers(void);
|
||||
bool8 BeginNormalPaletteFade(u32, s8, u8, u8, u16);
|
||||
bool8 unref_sub_8073D3C(u32, u8, u8, u8, u16);
|
||||
void unref_sub_8073D84(u8, u32 *);
|
||||
void ResetPaletteStructByUid(u16);
|
||||
void ResetPaletteStruct(u8);
|
||||
void PaletteStruct_ResetById(u16);
|
||||
void ResetPaletteFadeControl(void);
|
||||
void unref_sub_8074168(u16);
|
||||
void unref_sub_8074194(u16);
|
||||
void InvertPlttBuffer(u32);
|
||||
void TintPlttBuffer(u32, s8, s8, s8);
|
||||
void UnfadePlttBuffer(u32);
|
||||
|
@ -665,9 +665,10 @@ void sub_80A6760(struct Sprite *sprite)
|
||||
sprite->callback = sub_80A64D0;
|
||||
}
|
||||
|
||||
void sub_80A67A4(struct Sprite *sprite)
|
||||
// Unused
|
||||
static void EndUnkPaletteAnim(struct Sprite *sprite)
|
||||
{
|
||||
ResetPaletteStructByUid(sprite->data[5]);
|
||||
PaletteStruct_ResetById(sprite->data[5]);
|
||||
DestroySpriteAndMatrix(sprite);
|
||||
}
|
||||
|
||||
|
244
src/palette.c
244
src/palette.c
@ -16,36 +16,38 @@ enum
|
||||
// These are structs for some unused palette system.
|
||||
// The full functionality of this system is unknown.
|
||||
|
||||
#define NUM_PALETTE_STRUCTS 16
|
||||
|
||||
struct PaletteStructTemplate
|
||||
{
|
||||
u16 uid;
|
||||
u16 id;
|
||||
u16 *src;
|
||||
u16 pst_field_8_0:1;
|
||||
u16 pst_field_8_1:9;
|
||||
bool16 pst_field_8_0:1;
|
||||
u16 unused:9;
|
||||
u16 size:5;
|
||||
u16 pst_field_9_7:1;
|
||||
u8 pst_field_A;
|
||||
u8 time1;
|
||||
u8 srcCount:5;
|
||||
u8 pst_field_B_5:3;
|
||||
u8 pst_field_C;
|
||||
u8 state:3;
|
||||
u8 time2;
|
||||
};
|
||||
|
||||
struct PaletteStruct
|
||||
{
|
||||
const struct PaletteStructTemplate *base;
|
||||
u32 ps_field_4_0:1;
|
||||
u16 ps_field_4_1:1;
|
||||
const struct PaletteStructTemplate *template;
|
||||
bool32 active:1;
|
||||
bool32 flag:1;
|
||||
u32 baseDestOffset:9;
|
||||
u16 destOffset:10;
|
||||
u16 srcIndex:7;
|
||||
u8 ps_field_8;
|
||||
u8 ps_field_9;
|
||||
u32 destOffset:10;
|
||||
u32 srcIndex:7;
|
||||
u8 countdown1;
|
||||
u8 countdown2;
|
||||
};
|
||||
|
||||
static void unused_sub_80A1CDC(struct PaletteStruct *, u32 *);
|
||||
static void unused_sub_80A1E40(struct PaletteStruct *, u32 *);
|
||||
static void unused_sub_80A1F00(struct PaletteStruct *);
|
||||
static u8 GetPaletteNumByUid(u16);
|
||||
static void PaletteStruct_Copy(struct PaletteStruct *, u32 *);
|
||||
static void PaletteStruct_Blend(struct PaletteStruct *, u32 *);
|
||||
static void PaletteStruct_TryEnd(struct PaletteStruct *);
|
||||
static void PaletteStruct_Reset(u8);
|
||||
static u8 PaletteStruct_GetPalNum(u16);
|
||||
static u8 UpdateNormalPaletteFade(void);
|
||||
static void BeginFastPaletteFadeInternal(u8);
|
||||
static u8 UpdateFastPaletteFade(void);
|
||||
@ -58,15 +60,15 @@ static void Task_BlendPalettesGradually(u8 taskId);
|
||||
// unaligned word reads are issued in BlendPalette otherwise
|
||||
ALIGNED(4) EWRAM_DATA u16 gPlttBufferUnfaded[PLTT_BUFFER_SIZE] = {0};
|
||||
ALIGNED(4) EWRAM_DATA u16 gPlttBufferFaded[PLTT_BUFFER_SIZE] = {0};
|
||||
EWRAM_DATA struct PaletteStruct sPaletteStructs[0x10] = {0};
|
||||
EWRAM_DATA struct PaletteStruct sPaletteStructs[NUM_PALETTE_STRUCTS] = {0};
|
||||
EWRAM_DATA struct PaletteFadeControl gPaletteFade = {0};
|
||||
static EWRAM_DATA u32 sFiller = 0;
|
||||
static EWRAM_DATA u32 sPlttBufferTransferPending = 0;
|
||||
EWRAM_DATA u8 gPaletteDecompressionBuffer[PLTT_DECOMP_BUFFER_SIZE] = {0};
|
||||
|
||||
static const struct PaletteStructTemplate gDummyPaletteStructTemplate = {
|
||||
.uid = 0xFFFF,
|
||||
.pst_field_B_5 = 1
|
||||
.id = 0xFFFF,
|
||||
.state = 1
|
||||
};
|
||||
|
||||
static const u8 sRoundedDownGrayscaleMap[] = {
|
||||
@ -82,20 +84,20 @@ static const u8 sRoundedDownGrayscaleMap[] = {
|
||||
void LoadCompressedPalette(const u32 *src, u16 offset, u16 size)
|
||||
{
|
||||
LZDecompressWram(src, gPaletteDecompressionBuffer);
|
||||
CpuCopy16(gPaletteDecompressionBuffer, gPlttBufferUnfaded + offset, size);
|
||||
CpuCopy16(gPaletteDecompressionBuffer, gPlttBufferFaded + offset, size);
|
||||
CpuCopy16(gPaletteDecompressionBuffer, &gPlttBufferUnfaded[offset], size);
|
||||
CpuCopy16(gPaletteDecompressionBuffer, &gPlttBufferFaded[offset], size);
|
||||
}
|
||||
|
||||
void LoadPalette(const void *src, u16 offset, u16 size)
|
||||
{
|
||||
CpuCopy16(src, gPlttBufferUnfaded + offset, size);
|
||||
CpuCopy16(src, gPlttBufferFaded + offset, size);
|
||||
CpuCopy16(src, &gPlttBufferUnfaded[offset], size);
|
||||
CpuCopy16(src, &gPlttBufferFaded[offset], size);
|
||||
}
|
||||
|
||||
void FillPalette(u16 value, u16 offset, u16 size)
|
||||
{
|
||||
CpuFill16(value, gPlttBufferUnfaded + offset, size);
|
||||
CpuFill16(value, gPlttBufferFaded + offset, size);
|
||||
CpuFill16(value, &gPlttBufferUnfaded[offset], size);
|
||||
CpuFill16(value, &gPlttBufferFaded[offset], size);
|
||||
}
|
||||
|
||||
void TransferPlttBuffer(void)
|
||||
@ -105,7 +107,7 @@ void TransferPlttBuffer(void)
|
||||
void *src = gPlttBufferFaded;
|
||||
void *dest = (void *)PLTT;
|
||||
DmaCopy16(3, src, dest, PLTT_SIZE);
|
||||
sPlttBufferTransferPending = 0;
|
||||
sPlttBufferTransferPending = FALSE;
|
||||
if (gPaletteFade.mode == HARDWARE_FADE && gPaletteFade.active)
|
||||
UpdateBlendRegisters();
|
||||
}
|
||||
@ -135,13 +137,13 @@ void ResetPaletteFade(void)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
ResetPaletteStruct(i);
|
||||
for (i = 0; i < NUM_PALETTE_STRUCTS; i++)
|
||||
PaletteStruct_Reset(i);
|
||||
|
||||
ResetPaletteFadeControl();
|
||||
}
|
||||
|
||||
void ReadPlttIntoBuffers(void)
|
||||
static void ReadPlttIntoBuffers(void)
|
||||
{
|
||||
u16 i;
|
||||
u16 *pltt = (u16 *)PLTT;
|
||||
@ -178,7 +180,7 @@ bool8 BeginNormalPaletteFade(u32 selectedPalettes, s8 delay, u8 startY, u8 targe
|
||||
gPaletteFade.y = startY;
|
||||
gPaletteFade.targetY = targetY;
|
||||
gPaletteFade.blendColor = color;
|
||||
gPaletteFade.active = 1;
|
||||
gPaletteFade.active = TRUE;
|
||||
gPaletteFade.mode = NORMAL_FADE;
|
||||
|
||||
if (startY < targetY)
|
||||
@ -189,9 +191,9 @@ bool8 BeginNormalPaletteFade(u32 selectedPalettes, s8 delay, u8 startY, u8 targe
|
||||
UpdatePaletteFade();
|
||||
|
||||
temp = gPaletteFade.bufferTransferDisabled;
|
||||
gPaletteFade.bufferTransferDisabled = 0;
|
||||
gPaletteFade.bufferTransferDisabled = FALSE;
|
||||
CpuCopy32(gPlttBufferFaded, (void *)PLTT, PLTT_SIZE);
|
||||
sPlttBufferTransferPending = 0;
|
||||
sPlttBufferTransferPending = FALSE;
|
||||
if (gPaletteFade.mode == HARDWARE_FADE && gPaletteFade.active)
|
||||
UpdateBlendRegisters();
|
||||
gPaletteFade.bufferTransferDisabled = temp;
|
||||
@ -199,55 +201,55 @@ bool8 BeginNormalPaletteFade(u32 selectedPalettes, s8 delay, u8 startY, u8 targe
|
||||
}
|
||||
}
|
||||
|
||||
bool8 unref_sub_80A1C1C(u32 a1, u8 a2, u8 a3, u8 a4, u16 a5)
|
||||
// Unused
|
||||
static bool8 BeginPlttFade(u32 selectedPalettes, u8 delay, u8 startY, u8 targetY, u16 blendColor)
|
||||
{
|
||||
ReadPlttIntoBuffers();
|
||||
return BeginNormalPaletteFade(a1, a2, a3, a4, a5);
|
||||
return BeginNormalPaletteFade(selectedPalettes, delay, startY, targetY, blendColor);
|
||||
}
|
||||
|
||||
void unref_sub_80A1C64(u8 a1, u32 *a2)
|
||||
// Unused
|
||||
static void PaletteStruct_Run(u8 a1, u32 *unkFlags)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
for (i = 0; i < NUM_PALETTE_STRUCTS; i++)
|
||||
{
|
||||
struct PaletteStruct *palstruct = &sPaletteStructs[i];
|
||||
if (palstruct->ps_field_4_0)
|
||||
if (palstruct->active)
|
||||
{
|
||||
if (palstruct->base->pst_field_8_0 == a1)
|
||||
if (palstruct->template->pst_field_8_0 == a1)
|
||||
{
|
||||
u8 val1 = palstruct->srcIndex;
|
||||
u8 val2 = palstruct->base->srcCount;
|
||||
if (val1 == val2)
|
||||
if (palstruct->srcIndex == palstruct->template->srcCount)
|
||||
{
|
||||
unused_sub_80A1F00(palstruct);
|
||||
if (!palstruct->ps_field_4_0)
|
||||
PaletteStruct_TryEnd(palstruct);
|
||||
if (!palstruct->active)
|
||||
continue;
|
||||
}
|
||||
if (palstruct->ps_field_8 == 0)
|
||||
unused_sub_80A1CDC(palstruct, a2);
|
||||
if (palstruct->countdown1 == 0)
|
||||
PaletteStruct_Copy(palstruct, unkFlags);
|
||||
else
|
||||
palstruct->ps_field_8--;
|
||||
palstruct->countdown1--;
|
||||
|
||||
unused_sub_80A1E40(palstruct, a2);
|
||||
PaletteStruct_Blend(palstruct, unkFlags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void unused_sub_80A1CDC(struct PaletteStruct *a1, u32 *a2)
|
||||
static void PaletteStruct_Copy(struct PaletteStruct *a1, u32 *unkFlags)
|
||||
{
|
||||
s32 srcIndex;
|
||||
s32 srcCount;
|
||||
u8 i = 0;
|
||||
u16 srcOffset = a1->srcIndex * a1->base->size;
|
||||
u16 srcOffset = a1->srcIndex * a1->template->size;
|
||||
|
||||
if (!a1->base->pst_field_8_0)
|
||||
if (!a1->template->pst_field_8_0)
|
||||
{
|
||||
while (i < a1->base->size)
|
||||
while (i < a1->template->size)
|
||||
{
|
||||
gPlttBufferUnfaded[a1->destOffset] = a1->base->src[srcOffset];
|
||||
gPlttBufferFaded[a1->destOffset] = a1->base->src[srcOffset];
|
||||
gPlttBufferUnfaded[a1->destOffset] = a1->template->src[srcOffset];
|
||||
gPlttBufferFaded[a1->destOffset] = a1->template->src[srcOffset];
|
||||
i++;
|
||||
a1->destOffset++;
|
||||
srcOffset++;
|
||||
@ -255,9 +257,9 @@ static void unused_sub_80A1CDC(struct PaletteStruct *a1, u32 *a2)
|
||||
}
|
||||
else
|
||||
{
|
||||
while (i < a1->base->size)
|
||||
while (i < a1->template->size)
|
||||
{
|
||||
gPlttBufferFaded[a1->destOffset] = a1->base->src[srcOffset];
|
||||
gPlttBufferFaded[a1->destOffset] = a1->template->src[srcOffset];
|
||||
i++;
|
||||
a1->destOffset++;
|
||||
srcOffset++;
|
||||
@ -265,33 +267,33 @@ static void unused_sub_80A1CDC(struct PaletteStruct *a1, u32 *a2)
|
||||
}
|
||||
|
||||
a1->destOffset = a1->baseDestOffset;
|
||||
a1->ps_field_8 = a1->base->pst_field_A;
|
||||
a1->countdown1 = a1->template->time1;
|
||||
a1->srcIndex++;
|
||||
|
||||
srcIndex = a1->srcIndex;
|
||||
srcCount = a1->base->srcCount;
|
||||
srcCount = a1->template->srcCount;
|
||||
|
||||
if (srcIndex >= srcCount)
|
||||
{
|
||||
if (a1->ps_field_9)
|
||||
a1->ps_field_9--;
|
||||
if (a1->countdown2)
|
||||
a1->countdown2--;
|
||||
a1->srcIndex = 0;
|
||||
}
|
||||
|
||||
*a2 |= 1 << (a1->baseDestOffset >> 4);
|
||||
*unkFlags |= 1 << (a1->baseDestOffset >> 4);
|
||||
}
|
||||
|
||||
static void unused_sub_80A1E40(struct PaletteStruct *a1, u32 *a2)
|
||||
static void PaletteStruct_Blend(struct PaletteStruct *a1, u32 *unkFlags)
|
||||
{
|
||||
if (gPaletteFade.active && ((1 << (a1->baseDestOffset >> 4)) & gPaletteFade_selectedPalettes))
|
||||
{
|
||||
if (!a1->base->pst_field_8_0)
|
||||
if (!a1->template->pst_field_8_0)
|
||||
{
|
||||
if (gPaletteFade.delayCounter != gPaletteFade_delay)
|
||||
{
|
||||
BlendPalette(
|
||||
a1->baseDestOffset,
|
||||
a1->base->size,
|
||||
a1->template->size,
|
||||
gPaletteFade.y,
|
||||
gPaletteFade.blendColor);
|
||||
}
|
||||
@ -300,64 +302,64 @@ static void unused_sub_80A1E40(struct PaletteStruct *a1, u32 *a2)
|
||||
{
|
||||
if (!gPaletteFade.delayCounter)
|
||||
{
|
||||
if (a1->ps_field_8 != a1->base->pst_field_A)
|
||||
if (a1->countdown1 != a1->template->time1)
|
||||
{
|
||||
u32 srcOffset = a1->srcIndex * a1->base->size;
|
||||
u32 srcOffset = a1->srcIndex * a1->template->size;
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < a1->base->size; i++)
|
||||
gPlttBufferFaded[a1->baseDestOffset + i] = a1->base->src[srcOffset + i];
|
||||
for (i = 0; i < a1->template->size; i++)
|
||||
gPlttBufferFaded[a1->baseDestOffset + i] = a1->template->src[srcOffset + i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void unused_sub_80A1F00(struct PaletteStruct *a1)
|
||||
static void PaletteStruct_TryEnd(struct PaletteStruct *pal)
|
||||
{
|
||||
if (!a1->ps_field_9)
|
||||
if (pal->countdown2 == 0)
|
||||
{
|
||||
s32 val = a1->base->pst_field_B_5;
|
||||
s32 state = pal->template->state;
|
||||
|
||||
if (!val)
|
||||
if (state == 0)
|
||||
{
|
||||
a1->srcIndex = 0;
|
||||
a1->ps_field_8 = a1->base->pst_field_A;
|
||||
a1->ps_field_9 = a1->base->pst_field_C;
|
||||
a1->destOffset = a1->baseDestOffset;
|
||||
pal->srcIndex = 0;
|
||||
pal->countdown1 = pal->template->time1;
|
||||
pal->countdown2 = pal->template->time2;
|
||||
pal->destOffset = pal->baseDestOffset;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (val < 0)
|
||||
if (state < 0)
|
||||
return;
|
||||
if (val > 2)
|
||||
if (state > 2)
|
||||
return;
|
||||
ResetPaletteStructByUid(a1->base->uid);
|
||||
PaletteStruct_ResetById(pal->template->id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
a1->ps_field_9--;
|
||||
pal->countdown2--;
|
||||
}
|
||||
}
|
||||
|
||||
void ResetPaletteStructByUid(u16 a1)
|
||||
void PaletteStruct_ResetById(u16 id)
|
||||
{
|
||||
u8 paletteNum = GetPaletteNumByUid(a1);
|
||||
if (paletteNum != 16)
|
||||
ResetPaletteStruct(paletteNum);
|
||||
u8 paletteNum = PaletteStruct_GetPalNum(id);
|
||||
if (paletteNum != NUM_PALETTE_STRUCTS)
|
||||
PaletteStruct_Reset(paletteNum);
|
||||
}
|
||||
|
||||
void ResetPaletteStruct(u8 paletteNum)
|
||||
static void PaletteStruct_Reset(u8 paletteNum)
|
||||
{
|
||||
sPaletteStructs[paletteNum].base = &gDummyPaletteStructTemplate;
|
||||
sPaletteStructs[paletteNum].ps_field_4_0 = 0;
|
||||
sPaletteStructs[paletteNum].template = &gDummyPaletteStructTemplate;
|
||||
sPaletteStructs[paletteNum].active = FALSE;
|
||||
sPaletteStructs[paletteNum].baseDestOffset = 0;
|
||||
sPaletteStructs[paletteNum].destOffset = 0;
|
||||
sPaletteStructs[paletteNum].srcIndex = 0;
|
||||
sPaletteStructs[paletteNum].ps_field_4_1 = 0;
|
||||
sPaletteStructs[paletteNum].ps_field_8 = 0;
|
||||
sPaletteStructs[paletteNum].ps_field_9 = 0;
|
||||
sPaletteStructs[paletteNum].flag = 0;
|
||||
sPaletteStructs[paletteNum].countdown1 = 0;
|
||||
sPaletteStructs[paletteNum].countdown2 = 0;
|
||||
}
|
||||
|
||||
void ResetPaletteFadeControl(void)
|
||||
@ -368,41 +370,41 @@ void ResetPaletteFadeControl(void)
|
||||
gPaletteFade.y = 0;
|
||||
gPaletteFade.targetY = 0;
|
||||
gPaletteFade.blendColor = 0;
|
||||
gPaletteFade.active = 0;
|
||||
gPaletteFade.active = FALSE;
|
||||
gPaletteFade.multipurpose2 = 0; // assign same value twice
|
||||
gPaletteFade.yDec = 0;
|
||||
gPaletteFade.bufferTransferDisabled = 0;
|
||||
gPaletteFade.shouldResetBlendRegisters = 0;
|
||||
gPaletteFade.hardwareFadeFinishing = 0;
|
||||
gPaletteFade.softwareFadeFinishing = 0;
|
||||
gPaletteFade.bufferTransferDisabled = FALSE;
|
||||
gPaletteFade.shouldResetBlendRegisters = FALSE;
|
||||
gPaletteFade.hardwareFadeFinishing = FALSE;
|
||||
gPaletteFade.softwareFadeFinishing = FALSE;
|
||||
gPaletteFade.softwareFadeFinishingCounter = 0;
|
||||
gPaletteFade.objPaletteToggle = 0;
|
||||
gPaletteFade.deltaY = 2;
|
||||
}
|
||||
|
||||
void unref_sub_80A2048(u16 uid)
|
||||
static void PaletteStruct_SetUnusedFlag(u16 id)
|
||||
{
|
||||
u8 paletteNum = GetPaletteNumByUid(uid);
|
||||
if (paletteNum != 16)
|
||||
sPaletteStructs[paletteNum].ps_field_4_1 = 1;
|
||||
u8 paletteNum = PaletteStruct_GetPalNum(id);
|
||||
if (paletteNum != NUM_PALETTE_STRUCTS)
|
||||
sPaletteStructs[paletteNum].flag = TRUE;
|
||||
}
|
||||
|
||||
void unref_sub_80A2074(u16 uid)
|
||||
static void PaletteStruct_ClearUnusedFlag(u16 id)
|
||||
{
|
||||
u8 paletteNum = GetPaletteNumByUid(uid);
|
||||
if (paletteNum != 16)
|
||||
sPaletteStructs[paletteNum].ps_field_4_1 = 0;
|
||||
u8 paletteNum = PaletteStruct_GetPalNum(id);
|
||||
if (paletteNum != NUM_PALETTE_STRUCTS)
|
||||
sPaletteStructs[paletteNum].flag = FALSE;
|
||||
}
|
||||
|
||||
static u8 GetPaletteNumByUid(u16 uid)
|
||||
static u8 PaletteStruct_GetPalNum(u16 id)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
if (sPaletteStructs[i].base->uid == uid)
|
||||
for (i = 0; i < NUM_PALETTE_STRUCTS; i++)
|
||||
if (sPaletteStructs[i].template->id == id)
|
||||
return i;
|
||||
|
||||
return 16;
|
||||
return NUM_PALETTE_STRUCTS;
|
||||
}
|
||||
|
||||
static u8 UpdateNormalPaletteFade(void)
|
||||
@ -460,7 +462,7 @@ static u8 UpdateNormalPaletteFade(void)
|
||||
if (gPaletteFade.y == gPaletteFade.targetY)
|
||||
{
|
||||
gPaletteFade_selectedPalettes = 0;
|
||||
gPaletteFade.softwareFadeFinishing = 1;
|
||||
gPaletteFade.softwareFadeFinishing = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -557,7 +559,7 @@ static void BeginFastPaletteFadeInternal(u8 submode)
|
||||
{
|
||||
gPaletteFade.y = 31;
|
||||
gPaletteFade_submode = submode & 0x3F;
|
||||
gPaletteFade.active = 1;
|
||||
gPaletteFade.active = TRUE;
|
||||
gPaletteFade.mode = FAST_FADE;
|
||||
|
||||
if (submode == FAST_FADE_IN_FROM_BLACK)
|
||||
@ -719,7 +721,7 @@ static u8 UpdateFastPaletteFade(void)
|
||||
}
|
||||
|
||||
gPaletteFade.mode = NORMAL_FADE;
|
||||
gPaletteFade.softwareFadeFinishing = 1;
|
||||
gPaletteFade.softwareFadeFinishing = TRUE;
|
||||
}
|
||||
|
||||
// gPaletteFade.active cannot change since the last time it was checked. So this
|
||||
@ -734,10 +736,10 @@ void BeginHardwarePaletteFade(u8 blendCnt, u8 delay, u8 y, u8 targetY, u8 should
|
||||
gPaletteFade_delay = delay;
|
||||
gPaletteFade.y = y;
|
||||
gPaletteFade.targetY = targetY;
|
||||
gPaletteFade.active = 1;
|
||||
gPaletteFade.active = TRUE;
|
||||
gPaletteFade.mode = HARDWARE_FADE;
|
||||
gPaletteFade.shouldResetBlendRegisters = shouldResetBlendRegisters & 1;
|
||||
gPaletteFade.hardwareFadeFinishing = 0;
|
||||
gPaletteFade.hardwareFadeFinishing = FALSE;
|
||||
|
||||
if (y < targetY)
|
||||
gPaletteFade.yDec = 0;
|
||||
@ -784,7 +786,7 @@ static u8 UpdateHardwarePaletteFade(void)
|
||||
gPaletteFade_blendCnt = 0;
|
||||
gPaletteFade.y = 0;
|
||||
}
|
||||
gPaletteFade.shouldResetBlendRegisters = 0;
|
||||
gPaletteFade.shouldResetBlendRegisters = FALSE;
|
||||
}
|
||||
|
||||
// gPaletteFade.active cannot change since the last time it was checked. So this
|
||||
@ -798,11 +800,11 @@ static void UpdateBlendRegisters(void)
|
||||
SetGpuReg(REG_OFFSET_BLDY, gPaletteFade.y);
|
||||
if (gPaletteFade.hardwareFadeFinishing)
|
||||
{
|
||||
gPaletteFade.hardwareFadeFinishing = 0;
|
||||
gPaletteFade.hardwareFadeFinishing = FALSE;
|
||||
gPaletteFade.mode = 0;
|
||||
gPaletteFade_blendCnt = 0;
|
||||
gPaletteFade.y = 0;
|
||||
gPaletteFade.active = 0;
|
||||
gPaletteFade.active = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -812,8 +814,8 @@ static bool8 IsSoftwarePaletteFadeFinishing(void)
|
||||
{
|
||||
if (gPaletteFade.softwareFadeFinishingCounter == 4)
|
||||
{
|
||||
gPaletteFade.active = 0;
|
||||
gPaletteFade.softwareFadeFinishing = 0;
|
||||
gPaletteFade.active = FALSE;
|
||||
gPaletteFade.softwareFadeFinishing = FALSE;
|
||||
gPaletteFade.softwareFadeFinishingCounter = 0;
|
||||
}
|
||||
else
|
||||
@ -950,7 +952,7 @@ void TintPalette_CustomTone(u16 *palette, u16 count, u16 rTone, u16 gTone, u16 b
|
||||
#define tId data[8]
|
||||
|
||||
// Blend the selected palettes in a series of steps toward or away from the color.
|
||||
// Only used by the Groudon/Kyogre fight scene to flash the screen for lightning
|
||||
// Only used by the Groudon/Kyogre fight scene to flash the screen for lightning.
|
||||
// One call is used to fade the bg from white, while another fades the duo from black
|
||||
void BlendPalettesGradually(u32 selectedPalettes, s8 delay, u8 coeff, u8 coeffTarget, u16 color, u8 priority, u8 id)
|
||||
{
|
||||
@ -987,8 +989,8 @@ static bool32 IsBlendPalettesGraduallyTaskActive(u8 id)
|
||||
|
||||
for (i = 0; i < NUM_TASKS; i++)
|
||||
if ((gTasks[i].isActive == TRUE)
|
||||
&& (gTasks[i].func == Task_BlendPalettesGradually)
|
||||
&& (gTasks[i].tId == id))
|
||||
&& (gTasks[i].func == Task_BlendPalettesGradually)
|
||||
&& (gTasks[i].tId == id))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user