Add some missing palette macro use

This commit is contained in:
GriffinR 2023-05-23 13:16:18 -04:00
parent 8c537ccd72
commit 14f7e49099
67 changed files with 270 additions and 294 deletions

View File

@ -1600,7 +1600,7 @@ u8 LoadSpritePalette(const struct SpritePalette *palette)
else
{
sSpritePaletteTags[index] = palette->tag;
DoLoadSpritePalette(palette->data, index * 16);
DoLoadSpritePalette(palette->data, PLTT_ID(index));
return index;
}
}

View File

@ -28,13 +28,11 @@
#define IWRAM_END (IWRAM_START + 0x8000)
#define PLTT 0x5000000
#define PLTT_SIZE 0x400
#define BG_PLTT PLTT
#define BG_PLTT_SIZE 0x200
#define OBJ_PLTT (PLTT + 0x200)
#define OBJ_PLTT (PLTT + BG_PLTT_SIZE)
#define OBJ_PLTT_SIZE 0x200
#define PLTT_SIZE (BG_PLTT_SIZE + OBJ_PLTT_SIZE)
#define VRAM 0x6000000
#define VRAM_SIZE 0x18000

View File

@ -6,8 +6,7 @@
#define gPaletteFade_delay (gPaletteFade.multipurpose2) // normal and hardware fade
#define gPaletteFade_submode (gPaletteFade.multipurpose2) // fast fade
#define PLTT_BUFFER_SIZE 0x200
#define PLTT_DECOMP_BUFFER_SIZE (PLTT_BUFFER_SIZE * 2)
#define PLTT_BUFFER_SIZE (PLTT_SIZE / sizeof(u16))
#define PALETTE_FADE_STATUS_DELAY 2
#define PALETTE_FADE_STATUS_ACTIVE 1

View File

@ -824,27 +824,15 @@ static void Task_UpdateMonBg(u8 taskId)
if (!gTasks[taskId].t2_InBg2)
{
u16 *src;
u16 *dst;
gBattle_BG1_X = x + gTasks[taskId].t2_BgX;
gBattle_BG1_Y = y + gTasks[taskId].t2_BgY;
src = &gPlttBufferFaded[0x100 + battlerId * 16];
dst = &gPlttBufferFaded[0x100 + animBg.paletteId * 16 - 256];
CpuCopy32(src, dst, 32);
CpuCopy32(&gPlttBufferFaded[OBJ_PLTT_ID(battlerId)], &gPlttBufferFaded[BG_PLTT_ID(animBg.paletteId)], PLTT_SIZE_4BPP);
}
else
{
u16 *src;
u16 *dst;
gBattle_BG2_X = x + gTasks[taskId].t2_BgX;
gBattle_BG2_Y = y + gTasks[taskId].t2_BgY;
src = &gPlttBufferFaded[0x100 + battlerId * 16];
dst = &gPlttBufferFaded[0x100 - 112];
CpuCopy32(src, dst, 32);
CpuCopy32(&gPlttBufferFaded[OBJ_PLTT_ID(battlerId)], &gPlttBufferFaded[BG_PLTT_ID(9)], PLTT_SIZE_4BPP);
}
}

View File

@ -3963,7 +3963,7 @@ static void AnimProtect(struct Sprite *sprite)
sprite->oam.priority = GetBattlerSpriteBGPriority(gBattleAnimAttacker);
sprite->data[0] = gBattleAnimArgs[2];
sprite->data[2] = (IndexOfSpritePaletteTag(ANIM_TAG_PROTECT) << 4) + 0x100;
sprite->data[2] = OBJ_PLTT_ID(IndexOfSpritePaletteTag(ANIM_TAG_PROTECT));
sprite->data[7] = 16;
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16 - sprite->data[7], sprite->data[7]));
@ -5251,7 +5251,7 @@ void AnimTask_MusicNotesRainbowBlend(u8 taskId)
index = IndexOfSpritePaletteTag(gParticlesColorBlendTable[0][0]);
if (index != 0xFF)
{
index = (index << 4) + 0x100;
index = OBJ_PLTT_ID(index);
for (i = 1; i < ARRAY_COUNT(gParticlesColorBlendTable[0]); i++)
gPlttBufferFaded[index + i] = gParticlesColorBlendTable[0][i];
}
@ -5261,7 +5261,7 @@ void AnimTask_MusicNotesRainbowBlend(u8 taskId)
index = AllocSpritePalette(gParticlesColorBlendTable[j][0]);
if (index != 0xFF)
{
index = (index << 4) + 0x100;
index = OBJ_PLTT_ID(index);
for (i = 1; i < ARRAY_COUNT(gParticlesColorBlendTable[0]); i++)
gPlttBufferFaded[index + i] = gParticlesColorBlendTable[j][i];
}

View File

@ -1751,7 +1751,7 @@ void AnimTask_AirCutterProjectile(u8 taskId)
static void AnimVoidLines(struct Sprite *sprite)
{
InitSpritePosToAnimAttacker(sprite, FALSE);
sprite->data[0] = 0x100 + (IndexOfSpritePaletteTag(sVoidLinesSpriteTemplate.paletteTag) << 4);
sprite->data[0] = OBJ_PLTT_ID(IndexOfSpritePaletteTag(sVoidLinesSpriteTemplate.paletteTag));
sprite->callback = AnimVoidLines_Step;
}

View File

@ -1383,11 +1383,11 @@ static void SetPsychicBackground_Step(u8 taskId)
if (++gTasks[taskId].data[5] == 4)
{
lastColor = gPlttBufferFaded[paletteIndex * 16 + 11];
lastColor = gPlttBufferFaded[BG_PLTT_ID(paletteIndex) + 11];
for (i = 10; i > 0; i--)
gPlttBufferFaded[paletteIndex * 16 + i + 1] = gPlttBufferFaded[paletteIndex * 16 + i];
gPlttBufferFaded[BG_PLTT_ID(paletteIndex) + i + 1] = gPlttBufferFaded[BG_PLTT_ID(paletteIndex) + i];
gPlttBufferFaded[paletteIndex * 16 + 1] = lastColor;
gPlttBufferFaded[BG_PLTT_ID(paletteIndex) + 1] = lastColor;
gTasks[taskId].data[5] = 0;
}
@ -1409,15 +1409,15 @@ static void FadeScreenToWhite_Step(u8 taskId)
if (++gTasks[taskId].data[5] == 4)
{
lastColor = gPlttBufferFaded[paletteIndex * 16 + 11];
lastColor = gPlttBufferFaded[BG_PLTT_ID(paletteIndex) + 11];
for (i = 10; i > 0; i--)
gPlttBufferFaded[paletteIndex * 16 + i + 1] = gPlttBufferFaded[paletteIndex * 16 + i];
gPlttBufferFaded[paletteIndex * 16 + 1] = lastColor;
gPlttBufferFaded[BG_PLTT_ID(paletteIndex) + i + 1] = gPlttBufferFaded[BG_PLTT_ID(paletteIndex) + i];
gPlttBufferFaded[BG_PLTT_ID(paletteIndex) + 1] = lastColor;
lastColor = gPlttBufferUnfaded[paletteIndex * 16 + 11];
lastColor = gPlttBufferUnfaded[BG_PLTT_ID(paletteIndex) + 11];
for (i = 10; i > 0; i--)
gPlttBufferUnfaded[paletteIndex * 16 + i + 1] = gPlttBufferUnfaded[paletteIndex * 16 + i];
gPlttBufferUnfaded[paletteIndex * 16 + 1] = lastColor;
gPlttBufferUnfaded[BG_PLTT_ID(paletteIndex) + i + 1] = gPlttBufferUnfaded[BG_PLTT_ID(paletteIndex) + i];
gPlttBufferUnfaded[BG_PLTT_ID(paletteIndex) + 1] = lastColor;
gTasks[taskId].data[5] = 0;
}

View File

@ -388,17 +388,17 @@ static void AnimTask_AnimateGustTornadoPalette_Step(u8 taskId)
{
gTasks[taskId].data[10] = 0;
data2 = gTasks[taskId].data[2];
temp = gPlttBufferFaded[16 * data2 + 0x108];
temp = gPlttBufferFaded[OBJ_PLTT_ID(data2) + 8];
i = 7;
base = data2 * 16;
base = PLTT_ID(data2);
do
{
gPlttBufferFaded[base + 0x101 + i] = gPlttBufferFaded[base + 0x100 + i];
gPlttBufferFaded[base + OBJ_PLTT_OFFSET + 1 + i] = gPlttBufferFaded[base + OBJ_PLTT_OFFSET + i];
i--;
} while (i > 0);
gPlttBufferFaded[base + 0x101] = temp;
gPlttBufferFaded[base + OBJ_PLTT_OFFSET + 1] = temp;
}
if (--gTasks[taskId].data[0] == 0)

View File

@ -627,7 +627,7 @@ static void AnimTask_SpiteTargetShadow_Step1(u8 taskId)
task->data[2] = 0;
task->data[3] = 16;
task->data[13] = GetAnimBattlerSpriteId(ANIM_TARGET);
task->data[4] = (gSprites[task->data[13]].oam.paletteNum + 16) * 16;
task->data[4] = OBJ_PLTT_ID2(gSprites[task->data[13]].oam.paletteNum);
if (position == 1) {
u16 mask = DISPCNT_BG1_ON;
mask2 = mask;

View File

@ -1382,18 +1382,17 @@ void SetGrayscaleOrOriginalPalette(u16 paletteNum, bool8 restoreOriginalColor)
struct PlttData *originalColor;
struct PlttData *destColor;
u16 average;
paletteNum *= 16;
u16 paletteOffset = PLTT_ID(paletteNum);
if (!restoreOriginalColor)
{
for (i = 0; i < 16; i++)
{
originalColor = (struct PlttData *)&gPlttBufferUnfaded[paletteNum + i];
originalColor = (struct PlttData *)&gPlttBufferUnfaded[paletteOffset + i];
average = originalColor->r + originalColor->g + originalColor->b;
average /= 3;
destColor = (struct PlttData *)&gPlttBufferFaded[paletteNum + i];
destColor = (struct PlttData *)&gPlttBufferFaded[paletteOffset + i];
destColor->r = average;
destColor->g = average;
destColor->b = average;
@ -1401,7 +1400,7 @@ void SetGrayscaleOrOriginalPalette(u16 paletteNum, bool8 restoreOriginalColor)
}
else
{
CpuCopy32(&gPlttBufferUnfaded[paletteNum], &gPlttBufferFaded[paletteNum], 32);
CpuCopy32(&gPlttBufferUnfaded[paletteOffset], &gPlttBufferFaded[paletteOffset], PLTT_SIZE_4BPP);
}
}

View File

@ -468,7 +468,7 @@ static void AnimDefensiveWall(struct Sprite *sprite)
sprite->y = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y) + gBattleAnimArgs[1];
}
sprite->data[0] = 256 + IndexOfSpritePaletteTag(gBattleAnimArgs[2]) * 16;
sprite->data[0] = OBJ_PLTT_ID(IndexOfSpritePaletteTag(gBattleAnimArgs[2]));
if (isContest)
{

View File

@ -424,10 +424,10 @@ static void AnimTask_FrozenIceCube_Step2(u8 taskId)
{
u16 temp;
temp = gPlttBufferFaded[0x100 + palIndex * 16 + 13];
gPlttBufferFaded[0x100 + palIndex * 16 + 13] = gPlttBufferFaded[0x100 + palIndex * 16 + 14];
gPlttBufferFaded[0x100 + palIndex * 16 + 14] = gPlttBufferFaded[0x100 + palIndex * 16 + 15];
gPlttBufferFaded[0x100 + palIndex * 16 + 15] = temp;
temp = gPlttBufferFaded[OBJ_PLTT_ID(palIndex) + 13];
gPlttBufferFaded[OBJ_PLTT_ID(palIndex) + 13] = gPlttBufferFaded[OBJ_PLTT_ID(palIndex) + 14];
gPlttBufferFaded[OBJ_PLTT_ID(palIndex) + 14] = gPlttBufferFaded[OBJ_PLTT_ID(palIndex) + 15];
gPlttBufferFaded[OBJ_PLTT_ID(palIndex) + 15] = temp;
gTasks[taskId].data[2] = 0;
gTasks[taskId].data[3]++;

View File

@ -663,7 +663,7 @@ static void SetPalettesToColor(u32 selectedPalettes, u16 color)
{
if (selectedPalettes & 1)
{
u16 curOffset = i * 16;
u16 curOffset = PLTT_ID(i);
u16 paletteOffset = curOffset;
while (curOffset < paletteOffset + 16)
{
@ -932,7 +932,7 @@ void AnimTask_CopyPalUnfadedToBackup(u8 taskId)
paletteIndex = gBattleAnimTarget + 16;
}
memcpy(&gMonSpritesGfxPtr->buffer[gBattleAnimArgs[1] * 16], &gPlttBufferUnfaded[paletteIndex * 16], 32);
memcpy(&gMonSpritesGfxPtr->buffer[gBattleAnimArgs[1] * 16], &gPlttBufferUnfaded[PLTT_ID(paletteIndex)], PLTT_SIZE_4BPP);
DestroyAnimVisualTask(taskId);
}
@ -959,7 +959,7 @@ void AnimTask_CopyPalUnfadedFromBackup(u8 taskId)
paletteIndex = gBattleAnimTarget + 16;
}
memcpy(&gPlttBufferUnfaded[paletteIndex * 16], &gMonSpritesGfxPtr->buffer[gBattleAnimArgs[1] * 16], 32);
memcpy(&gPlttBufferUnfaded[PLTT_ID(paletteIndex)], &gMonSpritesGfxPtr->buffer[gBattleAnimArgs[1] * 16], PLTT_SIZE_4BPP);
DestroyAnimVisualTask(taskId);
}
@ -986,7 +986,7 @@ void AnimTask_CopyPalFadedToUnfaded(u8 taskId)
paletteIndex = gBattleAnimTarget + 16;
}
memcpy(&gPlttBufferUnfaded[paletteIndex * 16], &gPlttBufferFaded[paletteIndex * 16], 32);
memcpy(&gPlttBufferUnfaded[PLTT_ID(paletteIndex)], &gPlttBufferFaded[PLTT_ID(paletteIndex)], PLTT_SIZE_4BPP);
DestroyAnimVisualTask(taskId);
}

View File

@ -619,7 +619,7 @@ static void AnimAuroraBeamRings_Step(struct Sprite *sprite)
void AnimTask_RotateAuroraRingColors(u8 taskId)
{
gTasks[taskId].data[0] = gBattleAnimArgs[0];
gTasks[taskId].data[2] = IndexOfSpritePaletteTag(ANIM_TAG_RAINBOW_RINGS) * 16 + 256;
gTasks[taskId].data[2] = OBJ_PLTT_ID(IndexOfSpritePaletteTag(ANIM_TAG_RAINBOW_RINGS));
gTasks[taskId].func = AnimTask_RotateAuroraRingColors_Step;
}
@ -887,12 +887,12 @@ static void AnimTask_CreateSurfWave_Step1(u8 taskId)
gTasks[taskId].data[2] += gTasks[taskId].data[1];
if (++gTasks[taskId].data[5] == 4)
{
rgbBuffer = gPlttBufferFaded[animBg.paletteId * 16 + 7];
rgbBuffer = gPlttBufferFaded[BG_PLTT_ID(animBg.paletteId) + 7];
for (i = 6; i != 0; i--)
{
gPlttBufferFaded[animBg.paletteId * 16 + 1 + i] = gPlttBufferFaded[animBg.paletteId * 16 + 1 + i - 1]; // 1 + i - 1 is needed to match for some bizarre reason
gPlttBufferFaded[BG_PLTT_ID(animBg.paletteId) + 1 + i] = gPlttBufferFaded[BG_PLTT_ID(animBg.paletteId) + 1 + i - 1]; // 1 + i - 1 is needed to match for some bizarre reason
}
gPlttBufferFaded[animBg.paletteId * 16 + 1] = rgbBuffer;
gPlttBufferFaded[BG_PLTT_ID(animBg.paletteId) + 1] = rgbBuffer;
gTasks[taskId].data[5] = 0;
}
if (++gTasks[taskId].data[6] > 1)

View File

@ -21,6 +21,7 @@
#include "trig.h"
#include "window.h"
#include "constants/map_types.h"
#include "constants/rgb.h"
#include "constants/songs.h"
#include "constants/trainers.h"
@ -1071,7 +1072,7 @@ void InitLinkBattleVsScreen(u8 taskId)
break;
case 1:
palId = AllocSpritePalette(TAG_VS_LETTERS);
gPlttBufferUnfaded[palId * 16 + 0x10F] = gPlttBufferFaded[palId * 16 + 0x10F] = 0x7FFF;
gPlttBufferUnfaded[OBJ_PLTT_ID(palId) + 15] = gPlttBufferFaded[OBJ_PLTT_ID(palId) + 15] = RGB_WHITE;
gBattleStruct->linkBattleVsSpriteId_V = CreateSprite(&sVsLetter_V_SpriteTemplate, 111, 80, 0);
gBattleStruct->linkBattleVsSpriteId_S = CreateSprite(&sVsLetter_S_SpriteTemplate, 129, 80, 0);
gSprites[gBattleStruct->linkBattleVsSpriteId_V].invisible = TRUE;

View File

@ -1183,7 +1183,7 @@ static void CB2_InitSelectScreen(void)
#else
if (sFactorySelectScreen->fromSummaryScreen == TRUE)
#endif
gPlttBufferUnfaded[228] = sFactorySelectScreen->speciesNameColorBackup;
gPlttBufferUnfaded[BG_PLTT_ID(14) + 4] = sFactorySelectScreen->speciesNameColorBackup;
LoadPalette(sMonPicBg_Pal, BG_PLTT_ID(2), PLTT_SIZEOF(2));
gMain.state++;
break;
@ -1449,7 +1449,7 @@ static void Select_Task_OpenSummaryScreen(u8 taskId)
switch (gTasks[taskId].tState)
{
case STATE_SUMMARY_FADE:
gPlttBufferUnfaded[228] = gPlttBufferFaded[228];
gPlttBufferUnfaded[BG_PLTT_ID(14) + 4] = gPlttBufferFaded[BG_PLTT_ID(14) + 4];
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK);
gTasks[taskId].tState = STATE_SUMMARY_CLEAN;
break;
@ -1468,7 +1468,7 @@ static void Select_Task_OpenSummaryScreen(u8 taskId)
}
break;
case STATE_SUMMARY_SHOW:
sFactorySelectScreen->speciesNameColorBackup = gPlttBufferUnfaded[228];
sFactorySelectScreen->speciesNameColorBackup = gPlttBufferUnfaded[BG_PLTT_ID(14) + 4];
DestroyTask(taskId);
sFactorySelectScreen->fromSummaryScreen = TRUE;
currMonId = sFactorySelectScreen->cursorPos;
@ -1641,8 +1641,8 @@ static void Select_Task_HandleMenu(u8 taskId)
{
if (sFactorySelectScreen->fromSummaryScreen == TRUE)
{
gPlttBufferFaded[228] = sFactorySelectScreen->speciesNameColorBackup;
gPlttBufferUnfaded[228] = gPlttBufferUnfaded[244];
gPlttBufferFaded[BG_PLTT_ID(14) + 4] = sFactorySelectScreen->speciesNameColorBackup;
gPlttBufferUnfaded[BG_PLTT_ID(14) + 4] = gPlttBufferUnfaded[BG_PLTT_ID(15) + 4];
}
sFactorySelectScreen->fromSummaryScreen = FALSE;
gTasks[taskId].tState = STATE_MENU_HANDLE_INPUT;
@ -2388,7 +2388,7 @@ static void Swap_Task_OpenSummaryScreen(u8 taskId)
case STATE_SUMMARY_SHOW:
DestroyTask(taskId);
sFactorySwapScreen->fromSummaryScreen = TRUE;
sFactorySwapScreen->speciesNameColorBackup = gPlttBufferUnfaded[244];
sFactorySwapScreen->speciesNameColorBackup = gPlttBufferUnfaded[BG_PLTT_ID(15) + 4];
ShowPokemonSummaryScreen(SUMMARY_MODE_NORMAL, gPlayerParty, sFactorySwapScreen->cursorPos, FRONTIER_PARTY_SIZE - 1, CB2_InitSwapScreen);
break;
}
@ -2761,7 +2761,7 @@ static void Swap_Task_FadeOutSpeciesName(u8 taskId)
if (sFactorySwapScreen->fadeSpeciesNameCoeffDelay > 3)
{
sFactorySwapScreen->fadeSpeciesNameCoeffDelay = 0;
gPlttBufferUnfaded[244] = gPlttBufferFaded[228];
gPlttBufferUnfaded[BG_PLTT_ID(15) + 4] = gPlttBufferFaded[BG_PLTT_ID(14) + 4];
sFactorySwapScreen->fadeSpeciesNameCoeff++;
}
BlendPalettes(0x4000, sFactorySwapScreen->fadeSpeciesNameCoeff, 0);
@ -3125,7 +3125,7 @@ static void Swap_Task_ScreenInfoTransitionIn(u8 taskId)
if (gTasks[taskId].tSlideFinishedPkmn == TRUE
&& gTasks[taskId].tSlideFinishedCancel == TRUE)
{
gPlttBufferFaded[226] = sPokeballGray_Pal[37];
gPlttBufferFaded[BG_PLTT_ID(14) + 2] = sPokeballGray_Pal[37];
Swap_PrintActionStrings();
PutWindowTilemap(SWAP_WIN_ACTION_FADE);
gTasks[taskId].tState++;
@ -3864,7 +3864,7 @@ static void Swap_PrintMonSpeciesAtFade(void)
CpuCopy16(sSwapText_Pal, pal, 8);
if (!sFactorySwapScreen->fromSummaryScreen)
pal[4] = gPlttBufferFaded[228];
pal[4] = gPlttBufferFaded[BG_PLTT_ID(14) + 4];
else
pal[4] = sFactorySwapScreen->speciesNameColorBackup;
LoadPalette(pal, BG_PLTT_ID(15), sizeof(sSwapText_Pal));

View File

@ -598,7 +598,7 @@ void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE)
{
BlendPalette(paletteOffset, 16, 6, RGB_WHITE);
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, PLTT_SIZEOF(16));
CpuCopy32(&gPlttBufferFaded[paletteOffset], &gPlttBufferUnfaded[paletteOffset], PLTT_SIZEOF(16));
}
}
@ -661,7 +661,7 @@ void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE)
{
BlendPalette(paletteOffset, 16, 6, RGB_WHITE);
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, PLTT_SIZEOF(16));
CpuCopy32(&gPlttBufferFaded[paletteOffset], &gPlttBufferUnfaded[paletteOffset], PLTT_SIZEOF(16));
}
}
@ -909,7 +909,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 castform)
if (gBattleSpritesDataPtr->battlerData[battlerAtk].transformSpecies != SPECIES_NONE)
{
BlendPalette(paletteOffset, 16, 6, RGB_WHITE);
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, PLTT_SIZEOF(16));
CpuCopy32(&gPlttBufferFaded[paletteOffset], &gPlttBufferUnfaded[paletteOffset], PLTT_SIZEOF(16));
}
gSprites[gBattlerSpriteIds[battlerAtk]].y = GetBattlerSpriteDefault_Y(battlerAtk);
}
@ -978,7 +978,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 castform)
}
BlendPalette(paletteOffset, 16, 6, RGB_WHITE);
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, PLTT_SIZEOF(16));
CpuCopy32(&gPlttBufferFaded[paletteOffset], &gPlttBufferUnfaded[paletteOffset], PLTT_SIZEOF(16));
if (!IsContest())
{

View File

@ -2059,7 +2059,7 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
pltAdder += battlerId + 12;
FillPalette(sStatusIconColors[statusPalId], OBJ_PLTT_OFFSET + pltAdder, PLTT_SIZEOF(1));
CpuCopy16(gPlttBufferUnfaded + OBJ_PLTT_OFFSET + pltAdder, (u16 *)OBJ_PLTT + pltAdder, PLTT_SIZEOF(1));
CpuCopy16(&gPlttBufferUnfaded[OBJ_PLTT_OFFSET + pltAdder], (u16 *)OBJ_PLTT + pltAdder, PLTT_SIZEOF(1));
CpuCopy32(statusGfxPtr, (void *)(OBJ_VRAM0 + (gSprites[healthboxSpriteId].oam.tileNum + tileNumAdder) * TILE_SIZE_4BPP), 96);
if (IsDoubleBattle() == TRUE || GetBattlerSide(battlerId) == B_SIDE_OPPONENT)
{

View File

@ -3025,11 +3025,11 @@ void SetPpNumbersPaletteInMoveSelection(void)
u8 var = GetCurrentPpToMaxPpState(chooseMoveStruct->currentPp[gMoveSelectionCursor[gActiveBattler]],
chooseMoveStruct->maxPp[gMoveSelectionCursor[gActiveBattler]]);
gPlttBufferUnfaded[92] = palPtr[(var * 2) + 0];
gPlttBufferUnfaded[91] = palPtr[(var * 2) + 1];
gPlttBufferUnfaded[BG_PLTT_ID(5) + 12] = palPtr[(var * 2) + 0];
gPlttBufferUnfaded[BG_PLTT_ID(5) + 11] = palPtr[(var * 2) + 1];
CpuCopy16(&gPlttBufferUnfaded[92], &gPlttBufferFaded[92], sizeof(u16));
CpuCopy16(&gPlttBufferUnfaded[91], &gPlttBufferFaded[91], sizeof(u16));
CpuCopy16(&gPlttBufferUnfaded[BG_PLTT_ID(5) + 12], &gPlttBufferFaded[BG_PLTT_ID(5) + 12], PLTT_SIZEOF(1));
CpuCopy16(&gPlttBufferUnfaded[BG_PLTT_ID(5) + 11], &gPlttBufferFaded[BG_PLTT_ID(5) + 11], PLTT_SIZEOF(1));
}
u8 GetCurrentPpToMaxPpState(u8 currentPp, u8 maxPp)

View File

@ -1185,7 +1185,7 @@ static void Task_SetPyramidFloorPalette(u8 taskId)
{
if (gPaletteFade.active)
{
CpuCopy16(gBattlePyramidFloor_Pal[gSaveBlock2Ptr->frontier.curChallengeBattleNum], &gPlttBufferUnfaded[96], 32);
CpuCopy16(gBattlePyramidFloor_Pal[gSaveBlock2Ptr->frontier.curChallengeBattleNum], &gPlttBufferUnfaded[BG_PLTT_ID(6)], PLTT_SIZE_4BPP);
DestroyTask(taskId);
}
}

View File

@ -444,7 +444,7 @@ static void LoadTrainerHillRecordsWindowGfx(u8 bgId)
{
LoadBgTiles(bgId, sTrainerHillWindowTileset, sizeof(sTrainerHillWindowTileset), 0);
CopyToBgTilemapBufferRect(bgId, sTrainerHillWindowTilemap, 0, 0, 0x20, 0x20);
LoadPalette(sTrainerHillWindowPalette, BG_PLTT_ID(0), PLTT_SIZE_4BPP);
LoadPalette(sTrainerHillWindowPalette, BG_PLTT_ID(0), sizeof(sTrainerHillWindowPalette));
}
static void VblankCB_TrainerHillRecords(void)

View File

@ -6013,7 +6013,7 @@ static void InitLevelUpBanner(void)
gBattle_BG2_Y = 0;
gBattle_BG2_X = LEVEL_UP_BANNER_START;
LoadPalette(sLevelUpBanner_Pal, BG_PLTT_ID(6), PLTT_SIZE_4BPP);
LoadPalette(sLevelUpBanner_Pal, BG_PLTT_ID(6), sizeof(sLevelUpBanner_Pal));
CopyToWindowPixelBuffer(B_WIN_LEVEL_UP_BANNER, sLevelUpBanner_Gfx, 0, 0);
PutWindowTilemap(B_WIN_LEVEL_UP_BANNER);
CopyWindowToVram(B_WIN_LEVEL_UP_BANNER, COPYWIN_FULL);

View File

@ -1069,7 +1069,7 @@ static void Task_BattleTransition(u8 taskId)
static bool8 Transition_StartIntro(struct Task *task)
{
SetWeatherScreenFadeOut();
CpuCopy32(gPlttBufferFaded, gPlttBufferUnfaded, sizeof(gPlttBufferUnfaded));
CpuCopy32(gPlttBufferFaded, gPlttBufferUnfaded, PLTT_SIZE);
if (sTasks_Intro[task->tTransitionId] != NULL)
{
CreateTask(sTasks_Intro[task->tTransitionId], 4);
@ -4498,7 +4498,7 @@ static bool8 FrontierSquares_Shrink(struct Task *task)
switch (task->tShrinkState)
{
case 0:
for (i = 250; i < 255; i++)
for (i = BG_PLTT_ID(15) + 10; i < BG_PLTT_ID(15) + 15; i++)
{
gPlttBufferUnfaded[i] = RGB_BLACK;
gPlttBufferFaded[i] = RGB_BLACK;

View File

@ -1033,11 +1033,12 @@ static void InitBerryBlenderWindows(void)
s32 i;
DeactivateAllTextPrinters();
for (i = 0; i < 5; i++)
// Initialize only the main text windows (player names and message box; excludes results screen)
for (i = 0; i < WIN_RESULTS; i++)
FillWindowPixelBuffer(i, PIXEL_FILL(0));
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
Menu_LoadStdPalAt(0xE0);
Menu_LoadStdPalAt(BG_PLTT_ID(14));
}
}

View File

@ -367,7 +367,7 @@ static void HandleInitWindows(void)
InitWindows(sWindowTemplates);
DeactivateAllTextPrinters();
LoadPalette(sFontPalette, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
LoadPalette(sFontPalette, BG_PLTT_ID(15), sizeof(sFontPalette));
for (i = 0; i < ARRAY_COUNT(sWindowTemplates) - 1; i++)
PutWindowTilemap(i);
ScheduleBgCopyTilemapToVram(0);

View File

@ -1076,10 +1076,10 @@ static void LoadContestPalettes(void)
{
s32 i;
LoadPalette(sText_Pal, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
LoadPalette(sText_Pal, BG_PLTT_ID(15), sizeof(sText_Pal));
SetBackdropFromColor(RGB_BLACK);
for (i = 10; i < 14; i++)
LoadPalette(gPlttBufferUnfaded + BG_PLTT_ID(15) + 1, BG_PLTT_ID(15) + i, PLTT_SIZEOF(1));
LoadPalette(&gPlttBufferUnfaded[BG_PLTT_ID(15) + 1], BG_PLTT_ID(15) + i, PLTT_SIZEOF(1));
FillPalette(RGB(31, 17, 31), BG_PLTT_ID(15) + 3, PLTT_SIZEOF(1));
}
@ -1331,10 +1331,10 @@ static bool8 SetupContestGraphics(u8 *stateVar)
break;
case 5:
LoadCompressedPalette(gContestInterfaceAudiencePalette, BG_PLTT_OFFSET, BG_PLTT_SIZE);
CpuCopy32(gPlttBufferUnfaded + BG_PLTT_ID(8), tempPalette1, PLTT_SIZE_4BPP);
CpuCopy32(gPlttBufferUnfaded + BG_PLTT_ID(5 + gContestPlayerMonIndex), tempPalette2, PLTT_SIZE_4BPP);
CpuCopy32(tempPalette2, gPlttBufferUnfaded + BG_PLTT_ID(8), PLTT_SIZE_4BPP);
CpuCopy32(tempPalette1, gPlttBufferUnfaded + BG_PLTT_ID(5 + gContestPlayerMonIndex), PLTT_SIZE_4BPP);
CpuCopy32(&gPlttBufferUnfaded[BG_PLTT_ID(8)], tempPalette1, PLTT_SIZE_4BPP);
CpuCopy32(&gPlttBufferUnfaded[BG_PLTT_ID(5 + gContestPlayerMonIndex)], tempPalette2, PLTT_SIZE_4BPP);
CpuCopy32(tempPalette2, &gPlttBufferUnfaded[BG_PLTT_ID(8)], PLTT_SIZE_4BPP);
CpuCopy32(tempPalette1, &gPlttBufferUnfaded[BG_PLTT_ID(5 + gContestPlayerMonIndex)], PLTT_SIZE_4BPP);
DmaCopy32Defvars(3, gPlttBufferUnfaded, eContestTempSave.cachedWindowPalettes, sizeof(eContestTempSave.cachedWindowPalettes));
LoadContestPalettes();
break;
@ -1475,7 +1475,7 @@ static void Task_DisplayAppealNumberText(u8 taskId)
gBattle_BG0_Y = 0;
gBattle_BG2_Y = 0;
ContestDebugDoPrint();
DmaCopy32Defvars(3, gPlttBufferUnfaded, eContestTempSave.cachedPlttBufferUnfaded, PLTT_BUFFER_SIZE * 2);
DmaCopy32Defvars(3, gPlttBufferUnfaded, eContestTempSave.cachedPlttBufferUnfaded, PLTT_SIZE);
ConvertIntToDecimalStringN(gStringVar1, eContest.appealNumber + 1, STR_CONV_MODE_LEFT_ALIGN, 1);
if (!Contest_IsMonsTurnDisabled(gContestPlayerMonIndex))
StringCopy(gDisplayedStringBattle, gText_AppealNumWhichMoveWillBePlayed);
@ -1674,8 +1674,8 @@ static void Task_HideMoveSelectScreen(u8 taskId)
}
Contest_SetBgCopyFlags(0);
// This seems to be a bug; it should have just copied PLTT_BUFFER_SIZE.
DmaCopy32Defvars(3, gPlttBufferFaded, eContestTempSave.cachedPlttBufferFaded, PLTT_BUFFER_SIZE * 2);
LoadPalette(eContestTempSave.cachedPlttBufferUnfaded, 0, PLTT_BUFFER_SIZE * 2);
DmaCopy32Defvars(3, gPlttBufferFaded, eContestTempSave.cachedPlttBufferFaded, PLTT_SIZE);
LoadPalette(eContestTempSave.cachedPlttBufferUnfaded, 0, PLTT_SIZE);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 0;
gTasks[taskId].func = Task_HideApplauseMeterForAppealStart;
@ -2561,7 +2561,7 @@ static void Task_WaitForHeartSliders(u8 taskId)
static void Task_RestorePlttBufferUnfaded(u8 taskId)
{
DmaCopy32Defvars(3, eContestTempSave.cachedPlttBufferUnfaded, gPlttBufferUnfaded, PLTT_BUFFER_SIZE * 2);
DmaCopy32Defvars(3, eContestTempSave.cachedPlttBufferUnfaded, gPlttBufferUnfaded, PLTT_SIZE);
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = 2;
gTasks[taskId].func = Task_WaitPrintRoundResult;
@ -4068,14 +4068,14 @@ static void UpdateBlendTaskContestantData(u8 contestant)
palOffset1 = contestant + 5;
DmaCopy16Defvars(3,
gPlttBufferUnfaded + palOffset1 * 16 + 10,
gPlttBufferFaded + palOffset1 * 16 + 10,
2);
palOffset2 = (contestant + 5) * 16 + 12 + contestant;
&gPlttBufferUnfaded[PLTT_ID(palOffset1) + 10],
&gPlttBufferFaded[PLTT_ID(palOffset1) + 10],
PLTT_SIZEOF(1));
palOffset2 = PLTT_ID(contestant + 5) + 12 + contestant;
DmaCopy16Defvars(3,
gPlttBufferUnfaded + palOffset2,
gPlttBufferFaded + palOffset2,
2);
&gPlttBufferUnfaded[palOffset2],
&gPlttBufferFaded[palOffset2],
PLTT_SIZEOF(1));
}
// See comments on CreateUnusedBlendTask

View File

@ -456,7 +456,7 @@ static void LoadContestResultsBgGfx(void)
CopyToBgTilemapBuffer(2, gContestResults_Interface_Tilemap, 0, 0);
CopyToBgTilemapBuffer(0, gContestResults_WinnerBanner_Tilemap, 0, 0);
LoadContestResultsTitleBarTilemaps();
LoadCompressedPalette(gContestResults_Pal, BG_PLTT_ID(0), 16 * PLTT_SIZE_4BPP);
LoadCompressedPalette(gContestResults_Pal, BG_PLTT_OFFSET, BG_PLTT_SIZE);
LoadPalette(sResultsTextWindow_Pal, BG_PLTT_ID(15), sizeof(sResultsTextWindow_Pal));
for (i = 0; i < CONTESTANT_COUNT; i++)

View File

@ -688,7 +688,7 @@ static void ReturnToDecorationActionsAfterInvalidSelection(u8 taskId)
static void SecretBasePC_PrepMenuForSelectingStoredDecors(u8 taskId)
{
LoadPalette(sDecorationMenuPalette, BG_PLTT_ID(13), PLTT_SIZE_4BPP);
LoadPalette(sDecorationMenuPalette, BG_PLTT_ID(13), sizeof(sDecorationMenuPalette));
ClearDialogWindowAndFrame(0, FALSE);
RemoveDecorationWindow(WINDOW_MAIN_MENU);
InitDecorationCategoriesWindow(taskId);
@ -834,7 +834,7 @@ static void ReturnToActionsMenuFromCategories(u8 taskId)
void ShowDecorationCategoriesWindow(u8 taskId)
{
LoadPalette(sDecorationMenuPalette, BG_PLTT_ID(13), PLTT_SIZE_4BPP);
LoadPalette(sDecorationMenuPalette, BG_PLTT_ID(13), sizeof(sDecorationMenuPalette));
ClearDialogWindowAndFrame(0, FALSE);
gTasks[taskId].tDecorationMenuCommand = DECOR_MENU_TRADE;
sCurDecorationCategory = DECORCAT_DESK;

View File

@ -72,7 +72,7 @@ void CB2_ShowDiploma(void)
ResetSpriteData();
ResetPaletteFade();
FreeAllSpritePalettes();
LoadPalette(sDiplomaPalettes, BG_PLTT_ID(0), 2 * PLTT_SIZE_4BPP);
LoadPalette(sDiplomaPalettes, BG_PLTT_ID(0), sizeof(sDiplomaPalettes));
sDiplomaTilemapPtr = Alloc(0x1000);
InitDiplomaBg();
InitDiplomaWindow();

View File

@ -3930,12 +3930,12 @@ static void LoadEasyChatPalettes(void)
{
ResetPaletteFade();
LoadPalette(gEasyChatMode_Pal, BG_PLTT_ID(0), PLTT_SIZE_4BPP);
LoadPalette(sTextInputFrameOrange_Pal, BG_PLTT_ID(1), PLTT_SIZE_4BPP);
LoadPalette(sTextInputFrameGreen_Pal, BG_PLTT_ID(4), PLTT_SIZE_4BPP);
LoadPalette(sTitleText_Pal, BG_PLTT_ID(10), PLTT_SIZEOF(4));
LoadPalette(sText_Pal, BG_PLTT_ID(11), PLTT_SIZEOF(6));
LoadPalette(sText_Pal, BG_PLTT_ID(15), PLTT_SIZEOF(6));
LoadPalette(sText_Pal, BG_PLTT_ID(3), PLTT_SIZEOF(6));
LoadPalette(sTextInputFrameOrange_Pal, BG_PLTT_ID(1), sizeof(sTextInputFrameOrange_Pal));
LoadPalette(sTextInputFrameGreen_Pal, BG_PLTT_ID(4), sizeof(sTextInputFrameGreen_Pal));
LoadPalette(sTitleText_Pal, BG_PLTT_ID(10), sizeof(sTitleText_Pal));
LoadPalette(sText_Pal, BG_PLTT_ID(11), sizeof(sText_Pal));
LoadPalette(sText_Pal, BG_PLTT_ID(15), sizeof(sText_Pal));
LoadPalette(sText_Pal, BG_PLTT_ID(3), sizeof(sText_Pal));
}
static void PrintTitle(void)

View File

@ -409,7 +409,7 @@ static void Task_Sparkles_SprayAndFlash_Init(u8 taskId)
{
SetEvoSparklesMatrices();
gTasks[taskId].tTimer = 0;
CpuSet(&gPlttBufferFaded[0x20], &gPlttBufferUnfaded[0x20], 0x30);
CpuCopy16(&gPlttBufferFaded[BG_PLTT_ID(2)], &gPlttBufferUnfaded[BG_PLTT_ID(2)], 3 * PLTT_SIZE_4BPP);
BeginNormalPaletteFade(0xFFF9041C, 0, 0, 0x10, RGB_WHITE); // was 0xFFF9001C in R/S
gTasks[taskId].func = Task_Sparkles_SprayAndFlash;
PlaySE(SE_M_PETAL_DANCE);
@ -458,7 +458,7 @@ static void Task_Sparkles_SprayAndFlashTrade_Init(u8 taskId)
{
SetEvoSparklesMatrices();
gTasks[taskId].tTimer = 0;
CpuSet(&gPlttBufferFaded[0x20], &gPlttBufferUnfaded[0x20], 0x30);
CpuCopy16(&gPlttBufferFaded[BG_PLTT_ID(2)], &gPlttBufferUnfaded[BG_PLTT_ID(2)], 3 * PLTT_SIZE_4BPP);
BeginNormalPaletteFade(0xFFF90400, 0, 0, 0x10, RGB_WHITE); // was 0xFFFF0001 in R/S
gTasks[taskId].func = Task_Sparkles_SprayAndFlashTrade;
PlaySE(SE_M_PETAL_DANCE);
@ -536,13 +536,13 @@ u8 CycleEvolutionMonSprite(u8 preEvoSpriteId, u8 postEvoSpriteId)
gSprites[preEvoSpriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL;
gSprites[preEvoSpriteId].oam.matrixNum = MATRIX_PRE_EVO;
gSprites[preEvoSpriteId].invisible = FALSE;
CpuSet(monPalette, &gPlttBufferFaded[0x100 + (gSprites[preEvoSpriteId].oam.paletteNum * 16)], 16);
CpuSet(monPalette, &gPlttBufferFaded[OBJ_PLTT_ID(gSprites[preEvoSpriteId].oam.paletteNum)], 16);
gSprites[postEvoSpriteId].callback = SpriteCB_EvolutionMonSprite;
gSprites[postEvoSpriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL;
gSprites[postEvoSpriteId].oam.matrixNum = MATRIX_POST_EVO;
gSprites[postEvoSpriteId].invisible = FALSE;
CpuSet(monPalette, &gPlttBufferFaded[0x100 + (gSprites[postEvoSpriteId].oam.paletteNum * 16)], 16);
CpuSet(monPalette, &gPlttBufferFaded[OBJ_PLTT_ID(gSprites[postEvoSpriteId].oam.paletteNum)], 16);
gTasks[taskId].tEvoStopped = FALSE;
return taskId;

View File

@ -298,7 +298,7 @@ void EvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, bool8 canStopEvo, u
gTasks[id].tEvoWasStopped = FALSE;
gTasks[id].tPartyId = partyId;
memcpy(&sEvoStructPtr->savedPalette, &gPlttBufferUnfaded[0x20], sizeof(sEvoStructPtr->savedPalette));
memcpy(&sEvoStructPtr->savedPalette, &gPlttBufferUnfaded[BG_PLTT_ID(2)], sizeof(sEvoStructPtr->savedPalette));
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_1D_MAP);
@ -741,7 +741,7 @@ static void Task_EvolutionScene(u8 taskId)
if (IsSEPlaying())
{
m4aMPlayAllStop();
memcpy(&gPlttBufferUnfaded[0x20], sEvoStructPtr->savedPalette, sizeof(sEvoStructPtr->savedPalette));
memcpy(&gPlttBufferUnfaded[BG_PLTT_ID(2)], sEvoStructPtr->savedPalette, sizeof(sEvoStructPtr->savedPalette));
RestoreBgAfterAnim();
BeginNormalPaletteFade(0x1C, 0, 0x10, 0, RGB_BLACK);
gTasks[taskId].tState++;
@ -1170,7 +1170,7 @@ static void Task_TradeEvolutionScene(u8 taskId)
// Restore bg, do mon anim/cry
Free(sBgAnimPal);
EvoScene_DoMonAnimAndCry(sEvoStructPtr->postEvoSpriteId, gTasks[taskId].tPostEvoSpecies);
memcpy(&gPlttBufferUnfaded[0x20], sEvoStructPtr->savedPalette, sizeof(sEvoStructPtr->savedPalette));
memcpy(&gPlttBufferUnfaded[BG_PLTT_ID(2)], sEvoStructPtr->savedPalette, sizeof(sEvoStructPtr->savedPalette));
gTasks[taskId].tState++;
}
break;

View File

@ -900,7 +900,8 @@ u8 CreateTrainerSprite(u8 trainerSpriteID, s16 x, s16 y, u8 subpriority, u8 *buf
return CreateSprite(&spriteTemplate, x, y, subpriority);
}
void LoadTrainerGfx_TrainerCard(u8 gender, u16 palOffset, u8 *dest)
// Unused
static void LoadTrainerGfx_TrainerCard(u8 gender, u16 palOffset, u8 *dest)
{
LZDecompressVram(gTrainerFrontPicTable[gender].data, dest);
LoadCompressedPalette(gTrainerFrontPicPaletteTable[gender].data, palOffset, PLTT_SIZE_4BPP);
@ -1190,14 +1191,14 @@ static void PokeballGlowEffect_Flash1(struct Sprite *sprite)
sprite->data[3]++;
}
phase = (sprite->sCounter + 3) & 3;
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x108, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
MultiplyInvertedPaletteRGBComponents(OBJ_PLTT_ID(IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW)) + 8, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
phase = (sprite->sCounter + 2) & 3;
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x106, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
MultiplyInvertedPaletteRGBComponents(OBJ_PLTT_ID(IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW)) + 6, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
phase = (sprite->sCounter + 1) & 3;
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x102, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
MultiplyInvertedPaletteRGBComponents(OBJ_PLTT_ID(IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW)) + 2, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
phase = sprite->sCounter;
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x105, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x103, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
MultiplyInvertedPaletteRGBComponents(OBJ_PLTT_ID(IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW)) + 5, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
MultiplyInvertedPaletteRGBComponents(OBJ_PLTT_ID(IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW)) + 3, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
if (sprite->data[3] > 2)
{
sprite->sState++;
@ -1221,20 +1222,18 @@ static void PokeballGlowEffect_Flash2(struct Sprite *sprite)
}
}
phase = sprite->sCounter;
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x108, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x106, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x102, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x105, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW) << 4) + 0x103, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
MultiplyInvertedPaletteRGBComponents(OBJ_PLTT_ID(IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW)) + 8, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
MultiplyInvertedPaletteRGBComponents(OBJ_PLTT_ID(IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW)) + 6, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
MultiplyInvertedPaletteRGBComponents(OBJ_PLTT_ID(IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW)) + 2, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
MultiplyInvertedPaletteRGBComponents(OBJ_PLTT_ID(IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW)) + 5, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
MultiplyInvertedPaletteRGBComponents(OBJ_PLTT_ID(IndexOfSpritePaletteTag(FLDEFF_PAL_TAG_POKEBALL_GLOW)) + 3, sPokeballGlowReds[phase], sPokeballGlowGreens[phase], sPokeballGlowBlues[phase]);
}
static void PokeballGlowEffect_WaitAfterFlash(struct Sprite *sprite)
{
if ((--sprite->sTimer) == 0)
{
sprite->sState++;
}
}
static void PokeballGlowEffect_Dummy(struct Sprite *sprite)
{

View File

@ -264,7 +264,7 @@ void ExecuteTruckSequence(void)
MapGridSetMetatileIdAt(4 + MAP_OFFSET, 3 + MAP_OFFSET, METATILE_InsideOfTruck_DoorClosedFloor_Bottom);
DrawWholeMapView();
LockPlayerFieldControls();
CpuFastFill(0, gPlttBufferFaded, 0x400);
CpuFastFill(0, gPlttBufferFaded, PLTT_SIZE);
CreateTask(Task_HandleTruckSequence, 0xA);
}

View File

@ -156,7 +156,7 @@ void StartWeather(void)
if (!FuncIsActiveTask(Task_WeatherMain))
{
u8 index = AllocSpritePalette(PALTAG_WEATHER);
CpuCopy32(gFogPalette, &gPlttBufferUnfaded[0x100 + index * 16], 32);
CpuCopy32(gFogPalette, &gPlttBufferUnfaded[OBJ_PLTT_ID(index)], PLTT_SIZE_4BPP);
BuildColorMaps();
gWeatherPtr->contrastColorMapSpritePalIndex = index;
gWeatherPtr->weatherPicSpritePalIndex = AllocSpritePalette(PALTAG_WEATHER_2);
@ -471,7 +471,7 @@ static void ApplyColorMap(u8 startPalIndex, u8 numPalettes, s8 colorMapIndex)
if (colorMapIndex > 0)
{
colorMapIndex--;
palOffset = startPalIndex * 16;
palOffset = PLTT_ID(startPalIndex);
numPalettes += startPalIndex;
curPalIndex = startPalIndex;
@ -481,7 +481,7 @@ static void ApplyColorMap(u8 startPalIndex, u8 numPalettes, s8 colorMapIndex)
if (sPaletteColorMapTypes[curPalIndex] == COLOR_MAP_NONE)
{
// No palette change.
CpuFastCopy(gPlttBufferUnfaded + palOffset, gPlttBufferFaded + palOffset, 16 * sizeof(u16));
CpuFastCopy(&gPlttBufferUnfaded[palOffset], &gPlttBufferFaded[palOffset], PLTT_SIZE_4BPP);
palOffset += 16;
}
else
@ -511,7 +511,7 @@ static void ApplyColorMap(u8 startPalIndex, u8 numPalettes, s8 colorMapIndex)
{
// A negative gammIndex value means that the blending will come from the special Drought weather's palette tables.
colorMapIndex = -colorMapIndex - 1;
palOffset = startPalIndex * 16;
palOffset = PLTT_ID(startPalIndex);
numPalettes += startPalIndex;
curPalIndex = startPalIndex;
@ -520,7 +520,7 @@ static void ApplyColorMap(u8 startPalIndex, u8 numPalettes, s8 colorMapIndex)
if (sPaletteColorMapTypes[curPalIndex] == COLOR_MAP_NONE)
{
// No palette change.
CpuFastCopy(gPlttBufferUnfaded + palOffset, gPlttBufferFaded + palOffset, 16 * sizeof(u16));
CpuFastCopy(&gPlttBufferUnfaded[palOffset], &gPlttBufferFaded[palOffset], PLTT_SIZE_4BPP);
palOffset += 16;
}
else
@ -538,7 +538,7 @@ static void ApplyColorMap(u8 startPalIndex, u8 numPalettes, s8 colorMapIndex)
else
{
// No palette blending.
CpuFastCopy(gPlttBufferUnfaded + startPalIndex * 16, gPlttBufferFaded + startPalIndex * 16, numPalettes * 16 * sizeof(u16));
CpuFastCopy(&gPlttBufferUnfaded[PLTT_ID(startPalIndex)], &gPlttBufferFaded[PLTT_ID(startPalIndex)], numPalettes * PLTT_SIZE_4BPP);
}
}
@ -552,7 +552,7 @@ static void ApplyColorMapWithBlend(u8 startPalIndex, u8 numPalettes, s8 colorMap
u8 gBlend = color.g;
u8 bBlend = color.b;
palOffset = BG_PLTT_ID(startPalIndex);
palOffset = PLTT_ID(startPalIndex);
numPalettes += startPalIndex;
colorMapIndex--;
curPalIndex = startPalIndex;
@ -666,8 +666,8 @@ static void ApplyFogBlend(u8 blendCoeff, u16 blendColor)
{
if (LightenSpritePaletteInFog(curPalIndex))
{
u16 palEnd = (curPalIndex + 1) * 16;
u16 palOffset = curPalIndex * 16;
u16 palEnd = PLTT_ID(curPalIndex + 1);
u16 palOffset = PLTT_ID(curPalIndex);
while (palOffset < palEnd)
{
@ -786,7 +786,7 @@ void FadeScreen(u8 mode, s8 delay)
if (fadeOut)
{
if (useWeatherPal)
CpuFastCopy(gPlttBufferFaded, gPlttBufferUnfaded, PLTT_BUFFER_SIZE * 2);
CpuFastCopy(gPlttBufferFaded, gPlttBufferUnfaded, PLTT_SIZE);
BeginNormalPaletteFade(PALETTES_ALL, delay, 0, 16, fadeColor);
gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_OUT;
@ -824,14 +824,14 @@ void UpdateSpritePaletteWithWeather(u8 spritePaletteIndex)
{
if (gWeatherPtr->currWeather == WEATHER_FOG_HORIZONTAL)
MarkFogSpritePalToLighten(paletteIndex);
paletteIndex *= 16;
paletteIndex = PLTT_ID(paletteIndex);
for (i = 0; i < 16; i++)
gPlttBufferFaded[paletteIndex + i] = gWeatherPtr->fadeDestColor;
}
break;
case WEATHER_PAL_STATE_SCREEN_FADING_OUT:
paletteIndex = PLTT_ID(paletteIndex);
CpuFastCopy(gPlttBufferFaded + paletteIndex, gPlttBufferUnfaded + paletteIndex, PLTT_SIZE_4BPP);
CpuFastCopy(&gPlttBufferFaded[paletteIndex], &gPlttBufferUnfaded[paletteIndex], PLTT_SIZE_4BPP);
BlendPalette(paletteIndex, 16, gPaletteFade.y, gPaletteFade.blendColor);
break;
// WEATHER_PAL_STATE_CHANGING_WEATHER

View File

@ -871,7 +871,7 @@ static void ApplyGlobalTintToPaletteSlot(u8 slot, u8 count)
}
void LoadTilesetPalette(struct Tileset const *tileset, u16 destOffset, u16 size)
static void LoadTilesetPalette(struct Tileset const *tileset, u16 destOffset, u16 size)
{
u16 black = RGB_BLACK;

View File

@ -270,7 +270,7 @@ static void Task_ExitCaveTransition4(u8 taskId)
if (count < 8)
{
gTasks[taskId].data[2]++;
LoadPalette(&sCaveTransitionPalette_Exit[count], BG_PLTT_ID(14), PLTT_SIZEOF(8) - PLTT_SIZEOF(count));
LoadPalette(&sCaveTransitionPalette_Exit[count], BG_PLTT_ID(14), sizeof(sCaveTransitionPalette_Exit) - PLTT_SIZEOF(count));
}
else
{

View File

@ -52,8 +52,8 @@ static void StartSweetScentFieldEffect(void)
u8 taskId;
PlaySE(SE_M_SWEET_SCENT);
CpuFastSet(gPlttBufferUnfaded, gPaletteDecompressionBuffer, 0x100);
CpuFastSet(gPlttBufferFaded, gPlttBufferUnfaded, 0x100);
CpuFastCopy(gPlttBufferUnfaded, gPaletteDecompressionBuffer, PLTT_SIZE);
CpuFastCopy(gPlttBufferFaded, gPlttBufferUnfaded, PLTT_SIZE);
BeginNormalPaletteFade(~(1 << (gSprites[GetPlayerAvatarSpriteId()].oam.paletteNum + 16)), 4, 0, 8, RGB_RED);
taskId = CreateTask(TrySweetScentEncounter, 0);
gTasks[taskId].data[0] = 0;
@ -91,7 +91,7 @@ static void FailSweetScentEncounter(u8 taskId)
{
if (!gPaletteFade.active)
{
CpuFastSet(gPaletteDecompressionBuffer, gPlttBufferUnfaded, 0x100);
CpuFastCopy(gPaletteDecompressionBuffer, gPlttBufferUnfaded, PLTT_SIZE);
SetWeatherPalStateIdle();
ScriptContext_SetupScript(EventScript_FailSweetScent);
DestroyTask(taskId);

View File

@ -740,7 +740,7 @@ static void Task_Hof_ExitOnKeyPressed(u8 taskId)
static void Task_Hof_HandlePaletteOnExit(u8 taskId)
{
CpuCopy16(gPlttBufferFaded, gPlttBufferUnfaded, 0x400);
CpuCopy16(gPlttBufferFaded, gPlttBufferUnfaded, PLTT_SIZE);
BeginNormalPaletteFade(PALETTES_ALL, 8, 0, 0x10, RGB_BLACK);
gTasks[taskId].func = Task_Hof_HandleExit;
}
@ -1044,7 +1044,7 @@ static void Task_HofPC_HandlePaletteOnExit(u8 taskId)
{
struct HallofFameTeam *fameTeam;
CpuCopy16(gPlttBufferFaded, gPlttBufferUnfaded, 0x400);
CpuCopy16(gPlttBufferFaded, gPlttBufferUnfaded, PLTT_SIZE);
fameTeam = (struct HallofFameTeam *)(gDecompressionBuffer);
fameTeam->mon[0] = sDummyFameMon;
ComputerScreenCloseEffect(0, 0, 0);
@ -1269,7 +1269,7 @@ static void ClearVramOamPltt_LoadHofPal(void)
DmaFill16(3, 0, plttOffset, plttSize);
ResetPaletteFade();
LoadPalette(sHallOfFame_Pal, BG_PLTT_ID(0), PLTT_SIZE_4BPP);
LoadPalette(sHallOfFame_Pal, BG_PLTT_ID(0), sizeof(sHallOfFame_Pal));
}
static void LoadHofGfx(void)

View File

@ -1188,13 +1188,13 @@ static void Task_Scene1_Load(u8 taskId)
LoadSpritePalettes(sSpritePalettes_Intro1);
LoadCompressedSpriteSheet(sSpriteSheet_Sparkle);
LoadSpritePalettes(sSpritePalette_Sparkle);
CpuCopy16(&gPlttBufferUnfaded[0x100], &gPlttBufferUnfaded[0x1F0], 0x20);
CpuCopy16(&gPlttBufferUnfaded[0x100], &gPlttBufferUnfaded[0x1E1], 0x1E);
CpuCopy16(&gPlttBufferUnfaded[0x100], &gPlttBufferUnfaded[0x1D2], 0x1C);
CpuCopy16(&gPlttBufferUnfaded[0x100], &gPlttBufferUnfaded[0x1C3], 0x1A);
CpuCopy16(&gPlttBufferUnfaded[0x100], &gPlttBufferUnfaded[0x1B4], 0x18);
CpuCopy16(&gPlttBufferUnfaded[0x100], &gPlttBufferUnfaded[0x1A5], 0x16);
CpuCopy16(&gPlttBufferUnfaded[0x100], &gPlttBufferUnfaded[0x196], 0x14);
CpuCopy16(&gPlttBufferUnfaded[OBJ_PLTT_ID(0)], &gPlttBufferUnfaded[OBJ_PLTT_ID(15) + 0], PLTT_SIZEOF(16 - 0));
CpuCopy16(&gPlttBufferUnfaded[OBJ_PLTT_ID(0)], &gPlttBufferUnfaded[OBJ_PLTT_ID(14) + 1], PLTT_SIZEOF(16 - 1) + 1); // Copying an extra half color?
CpuCopy16(&gPlttBufferUnfaded[OBJ_PLTT_ID(0)], &gPlttBufferUnfaded[OBJ_PLTT_ID(13) + 2], PLTT_SIZEOF(16 - 2));
CpuCopy16(&gPlttBufferUnfaded[OBJ_PLTT_ID(0)], &gPlttBufferUnfaded[OBJ_PLTT_ID(12) + 3], PLTT_SIZEOF(16 - 3));
CpuCopy16(&gPlttBufferUnfaded[OBJ_PLTT_ID(0)], &gPlttBufferUnfaded[OBJ_PLTT_ID(11) + 4], PLTT_SIZEOF(16 - 4));
CpuCopy16(&gPlttBufferUnfaded[OBJ_PLTT_ID(0)], &gPlttBufferUnfaded[OBJ_PLTT_ID(10) + 5], PLTT_SIZEOF(16 - 5));
CpuCopy16(&gPlttBufferUnfaded[OBJ_PLTT_ID(0)], &gPlttBufferUnfaded[OBJ_PLTT_ID( 9) + 6], PLTT_SIZEOF(16 - 6));
CreateGameFreakLogoSprites(120, 80, 0);
gTasks[taskId].sBigDropSpriteId = CreateWaterDrop(236, -14, 0x200, 1, 0x78, FALSE);
gTasks[taskId].func = Task_Scene1_FadeIn;
@ -1884,7 +1884,7 @@ static void Task_Scene3_Groudon(u8 taskId)
if (--tDelay == 0)
{
tDelay = 2;
CpuCopy16(&gIntro3Bg_Pal[tPalIdx], &gPlttBufferFaded[31], sizeof(u16));
CpuCopy16(&gIntro3Bg_Pal[tPalIdx], &gPlttBufferFaded[BG_PLTT_ID(1) + 15], PLTT_SIZEOF(1));
tPalIdx += 2;
if (tPalIdx == 0x1EC)
tState++;
@ -1901,7 +1901,7 @@ static void Task_Scene3_Groudon(u8 taskId)
if (--tDelay == 0)
{
tDelay = 2;
CpuCopy16(&gIntro3Bg_Pal[tPalIdx], &gPlttBufferFaded[31], sizeof(u16));
CpuCopy16(&gIntro3Bg_Pal[tPalIdx], &gPlttBufferFaded[BG_PLTT_ID(1) + 15], PLTT_SIZEOF(1));
tPalIdx -= 2;
if (tPalIdx == 0x1E0)
{
@ -2143,7 +2143,7 @@ static void Task_Scene3_Kyogre(u8 taskId)
if (--tDelay == 0)
{
tDelay = 4;
CpuCopy16(&gIntro3Bg_Pal[tPalIdx], &gPlttBufferFaded[47], sizeof(u16));
CpuCopy16(&gIntro3Bg_Pal[tPalIdx], &gPlttBufferFaded[BG_PLTT_ID(2) + 15], PLTT_SIZEOF(1));
tPalIdx -= 2;
if (tPalIdx == 0x1E0)
tState++;
@ -2161,7 +2161,7 @@ static void Task_Scene3_Kyogre(u8 taskId)
if (--tDelay == 0)
{
tDelay = 4;
CpuCopy16(&gIntro3Bg_Pal[tPalIdx], &gPlttBufferFaded[47], sizeof(u16));
CpuCopy16(&gIntro3Bg_Pal[tPalIdx], &gPlttBufferFaded[BG_PLTT_ID(2) + 15], PLTT_SIZEOF(1));
tPalIdx += 2;
if (tPalIdx == 0x1EE)
{
@ -2492,7 +2492,7 @@ static void SpriteCB_Lightning(struct Sprite *sprite)
sprite->sPalIdx = 0x1C2;
sprite->sState++;
case 1:
CpuCopy16(&gIntro3Bg_Pal[sprite->sPalIdx], &gPlttBufferFaded[93], 2);
CpuCopy16(&gIntro3Bg_Pal[sprite->sPalIdx], &gPlttBufferFaded[BG_PLTT_ID(5) + 13], PLTT_SIZEOF(1));
sprite->sPalIdx += 2;
if (sprite->sPalIdx != 0x1CE)
break;
@ -2503,7 +2503,7 @@ static void SpriteCB_Lightning(struct Sprite *sprite)
if (--sprite->sDelay == 0)
{
sprite->sDelay = 4;
CpuCopy16(&gIntro3Bg_Pal[sprite->sPalIdx], &gPlttBufferFaded[93], 2);
CpuCopy16(&gIntro3Bg_Pal[sprite->sPalIdx], &gPlttBufferFaded[BG_PLTT_ID(5) + 13], PLTT_SIZEOF(1));
sprite->sPalIdx -= 2;
if (sprite->sPalIdx == 0x1C0)
DestroySprite(sprite);
@ -2606,7 +2606,7 @@ static void Task_RayquazaAttack(u8 taskId)
case 0:
if ((data[2] & 1) != 0)
{
CpuCopy16(&gIntro3Bg_Pal[0x1A2 + data[1] * 2], &gPlttBufferFaded[94], 2);
CpuCopy16(&gIntro3Bg_Pal[0x1A2 + data[1] * 2], &gPlttBufferFaded[BG_PLTT_ID(5) + 14], PLTT_SIZEOF(1));
data[1]++;
}
if (data[1] == 6)
@ -2621,7 +2621,7 @@ static void Task_RayquazaAttack(u8 taskId)
{
if ((data[2] & 1) != 0)
{
CpuCopy16(&gIntro3Bg_Pal[0x1A2 + data[1] * 2], &gPlttBufferFaded[88], 2);
CpuCopy16(&gIntro3Bg_Pal[0x1A2 + data[1] * 2], &gPlttBufferFaded[BG_PLTT_ID(5) + 8], PLTT_SIZEOF(1));
data[1]++;
}
if (data[1] == 6)
@ -2640,7 +2640,7 @@ static void Task_RayquazaAttack(u8 taskId)
{
if ((data[2] & 1) != 0)
{
CpuCopy16(&gIntro3Bg_Pal[0x182 + data[1] * 2], &gPlttBufferFaded[92], 2);
CpuCopy16(&gIntro3Bg_Pal[0x182 + data[1] * 2], &gPlttBufferFaded[BG_PLTT_ID(5) + 12], PLTT_SIZEOF(1));
data[1]++;
}
if (data[1] == 6)
@ -3197,16 +3197,16 @@ static void SpriteCB_LogoLetter(struct Sprite *sprite)
sprite->sColorDelay = 2;
if (sprite->sTimer != 0)
{
CpuCopy16(&gIntroGameFreakTextFade_Pal[sprite->sTimer], &gPlttBufferFaded[0x11F], 2);
CpuCopy16(&gIntroGameFreakTextFade_Pal[sprite->sTimer + 16], &gPlttBufferFaded[0x114], 2);
CpuCopy16(&gIntroGameFreakTextFade_Pal[sprite->sTimer + 32], &gPlttBufferFaded[0x11A], 2);
CpuCopy16(&gIntroGameFreakTextFade_Pal[sprite->sTimer], &gPlttBufferFaded[OBJ_PLTT_ID(1) + 15], PLTT_SIZEOF(1));
CpuCopy16(&gIntroGameFreakTextFade_Pal[sprite->sTimer + 16], &gPlttBufferFaded[OBJ_PLTT_ID(1) + 4], PLTT_SIZEOF(1));
CpuCopy16(&gIntroGameFreakTextFade_Pal[sprite->sTimer + 32], &gPlttBufferFaded[OBJ_PLTT_ID(1) + 10], PLTT_SIZEOF(1));
sprite->sTimer--;
}
else
{
CpuCopy16(&gIntroGameFreakTextFade_Pal[sprite->sTimer], &gPlttBufferFaded[0x11F], 2);
CpuCopy16(&gIntroGameFreakTextFade_Pal[sprite->sTimer + 16], &gPlttBufferFaded[0x114], 2);
CpuCopy16(&gIntroGameFreakTextFade_Pal[sprite->sTimer + 32], &gPlttBufferFaded[0x11A], 2);
CpuCopy16(&gIntroGameFreakTextFade_Pal[sprite->sTimer], &gPlttBufferFaded[OBJ_PLTT_ID(1) + 15], PLTT_SIZEOF(1));
CpuCopy16(&gIntroGameFreakTextFade_Pal[sprite->sTimer + 16], &gPlttBufferFaded[OBJ_PLTT_ID(1) + 4], PLTT_SIZEOF(1));
CpuCopy16(&gIntroGameFreakTextFade_Pal[sprite->sTimer + 32], &gPlttBufferFaded[OBJ_PLTT_ID(1) + 10], PLTT_SIZEOF(1));
sprite->sState++;
}
}
@ -3226,9 +3226,9 @@ static void SpriteCB_LogoLetter(struct Sprite *sprite)
sprite->sColorDelay = 2;
if (sprite->sTimer <= COLOR_CHANGES)
{
CpuCopy16(&gIntroGameFreakTextFade_Pal[sprite->sTimer], &gPlttBufferFaded[0x11F], 2);
CpuCopy16(&gIntroGameFreakTextFade_Pal[sprite->sTimer + 16], &gPlttBufferFaded[0x114], 2);
CpuCopy16(&gIntroGameFreakTextFade_Pal[sprite->sTimer + 32], &gPlttBufferFaded[0x11A], 2);
CpuCopy16(&gIntroGameFreakTextFade_Pal[sprite->sTimer], &gPlttBufferFaded[OBJ_PLTT_ID(1) + 15], PLTT_SIZEOF(1));
CpuCopy16(&gIntroGameFreakTextFade_Pal[sprite->sTimer + 16], &gPlttBufferFaded[OBJ_PLTT_ID(1) + 4], PLTT_SIZEOF(1));
CpuCopy16(&gIntroGameFreakTextFade_Pal[sprite->sTimer + 32], &gPlttBufferFaded[OBJ_PLTT_ID(1) + 10], PLTT_SIZEOF(1));
sprite->sTimer++;
}
else

View File

@ -998,13 +998,13 @@ void CycleSceneryPalette(u8 mode)
break;
if (gMain.vblankCounter1 & 4)
{
x = gPlttBufferUnfaded[9];
y = gPlttBufferUnfaded[10];
x = gPlttBufferUnfaded[BG_PLTT_ID(0) + 9];
y = gPlttBufferUnfaded[BG_PLTT_ID(0) + 10];
}
else
{
x = gPlttBufferUnfaded[10];
y = gPlttBufferUnfaded[9];
x = gPlttBufferUnfaded[BG_PLTT_ID(0) + 10];
y = gPlttBufferUnfaded[BG_PLTT_ID(0) + 9];
}
LoadPalette(&x, BG_PLTT_ID(0) + 9, sizeof(x));
LoadPalette(&y, BG_PLTT_ID(0) + 10, sizeof(y));

View File

@ -1650,7 +1650,7 @@ static void ErrorMsg_MoveCloserToPartner(void)
DecompressAndLoadBgGfxUsingHeap(1, sWirelessLinkDisplayGfx, FALSE, 0, 0);
CopyToBgTilemapBuffer(1, sWirelessLinkDisplayTilemap, 0, 0);
CopyBgTilemapBufferToVram(1);
LoadPalette(sWirelessLinkDisplayPal, 0, 0x20);
LoadPalette(sWirelessLinkDisplayPal, BG_PLTT_ID(0), sizeof(sWirelessLinkDisplayPal));
FillWindowPixelBuffer(WIN_LINK_ERROR_TOP, PIXEL_FILL(0));
FillWindowPixelBuffer(WIN_LINK_ERROR_BOTTOM, PIXEL_FILL(0));
AddTextPrinterParameterized3(WIN_LINK_ERROR_TOP, FONT_SHORT_COPY_1, 2, 6, sTextColors, 0, gText_CommErrorEllipsis);

View File

@ -316,7 +316,7 @@ static void ListMenuDummyTask(u8 taskId)
}
s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 drawMode, u16 tileNum, u16 palNum)
s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const struct ListMenuTemplate *listMenuTemplate, u8 drawMode, u16 tileNum, u16 palOffset)
{
switch (sMysteryGiftLinkMenu.state)
{
@ -326,9 +326,9 @@ s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const str
switch (drawMode)
{
case 2:
LoadUserWindowBorderGfx(sMysteryGiftLinkMenu.windowId, tileNum, palNum);
LoadUserWindowBorderGfx(sMysteryGiftLinkMenu.windowId, tileNum, palOffset);
case 1:
DrawTextBorderOuter(sMysteryGiftLinkMenu.windowId, tileNum, palNum / 16);
DrawTextBorderOuter(sMysteryGiftLinkMenu.windowId, tileNum, palOffset / 16);
break;
}
gMultiuseListMenuTemplate = *listMenuTemplate;

View File

@ -551,9 +551,7 @@ static bool8 MailReadBuildGraphics(void)
break;
case 9:
if (FreeTempTileDataBuffersIfPossible())
{
return FALSE;
}
break;
case 10:
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
@ -567,23 +565,20 @@ static bool8 MailReadBuildGraphics(void)
break;
case 12:
LoadPalette(GetOverworldTextboxPalettePtr(), BG_PLTT_ID(15), PLTT_SIZE_4BPP);
gPlttBufferUnfaded[BG_PLTT_ID(15) + 10] = sMailGraphics[sMailRead->mailType].textColor;
gPlttBufferFaded[BG_PLTT_ID(15) + 10] = sMailGraphics[sMailRead->mailType].textColor;
gPlttBufferUnfaded[BG_PLTT_ID(15) + 11] = sMailGraphics[sMailRead->mailType].textShadow;
gPlttBufferFaded[BG_PLTT_ID(15) + 11] = sMailGraphics[sMailRead->mailType].textShadow;
gPlttBufferUnfaded[250] = sMailGraphics[sMailRead->mailType].textColor;
gPlttBufferFaded[250] = sMailGraphics[sMailRead->mailType].textColor;
gPlttBufferUnfaded[251] = sMailGraphics[sMailRead->mailType].textShadow;
gPlttBufferFaded[251] = sMailGraphics[sMailRead->mailType].textShadow;
LoadPalette(sMailGraphics[sMailRead->mailType].palette, BG_PLTT_ID(0), PLTT_SIZE_4BPP);
gPlttBufferUnfaded[10] = sBgColors[gSaveBlock2Ptr->playerGender][0];
gPlttBufferFaded[10] = sBgColors[gSaveBlock2Ptr->playerGender][0];
gPlttBufferUnfaded[11] = sBgColors[gSaveBlock2Ptr->playerGender][1];
gPlttBufferFaded[11] = sBgColors[gSaveBlock2Ptr->playerGender][1];
gPlttBufferUnfaded[BG_PLTT_ID(0) + 10] = sBgColors[gSaveBlock2Ptr->playerGender][0];
gPlttBufferFaded[BG_PLTT_ID(0) + 10] = sBgColors[gSaveBlock2Ptr->playerGender][0];
gPlttBufferUnfaded[BG_PLTT_ID(0) + 11] = sBgColors[gSaveBlock2Ptr->playerGender][1];
gPlttBufferFaded[BG_PLTT_ID(0) + 11] = sBgColors[gSaveBlock2Ptr->playerGender][1];
break;
case 13:
if (sMailRead->hasText)
{
BufferMailText();
}
break;
case 14:
if (sMailRead->hasText)

View File

@ -1086,8 +1086,8 @@ static void Task_HandleMainMenuAPressed(u8 taskId)
case ACTION_INVALID:
gTasks[taskId].tCurrItem = 0;
gTasks[taskId].func = Task_DisplayMainMenuInvalidActionError;
gPlttBufferUnfaded[0xF1] = RGB_WHITE;
gPlttBufferFaded[0xF1] = RGB_WHITE;
gPlttBufferUnfaded[BG_PLTT_ID(15) + 1] = RGB_WHITE;
gPlttBufferFaded[BG_PLTT_ID(15) + 1] = RGB_WHITE;
SetGpuReg(REG_OFFSET_BG2HOFS, 0);
SetGpuReg(REG_OFFSET_BG2VOFS, 0);
SetGpuReg(REG_OFFSET_BG1HOFS, 0);

View File

@ -8,6 +8,7 @@
#include "gpu_regs.h"
#include "menu.h"
#include "random.h"
#include "palette.h"
#include "palette_util.h"
#include "script.h"
#include "sound.h"
@ -163,7 +164,7 @@ static const struct SpriteTemplate sSpriteTemplate_FallingFossil =
const struct PulseBlendSettings gMirageTowerPulseBlendSettings = {
.blendColor = RGB(27, 25, 16),
.paletteOffset = 0x61,
.paletteOffset = BG_PLTT_ID(6) + 1,
.numColors = 15,
.delay = 5,
.numFadeCycles = -1,

View File

@ -978,10 +978,10 @@ static u16 GetButtonPalOffset(u8 button)
{
const u16 palOffsets[BUTTON_COUNT + 1] =
{
[BUTTON_PAGE] = IndexOfSpritePaletteTag(PALTAG_PAGE_SWAP) * 16 + 0x10E,
[BUTTON_BACK] = IndexOfSpritePaletteTag(PALTAG_BACK_BUTTON) * 16 + 0x10E,
[BUTTON_OK] = IndexOfSpritePaletteTag(PALTAG_OK_BUTTON) * 16 + 0x10E,
[BUTTON_COUNT] = IndexOfSpritePaletteTag(PALTAG_OK_BUTTON) * 16 + 0x101,
[BUTTON_PAGE] = OBJ_PLTT_ID(IndexOfSpritePaletteTag(PALTAG_PAGE_SWAP)) + 14,
[BUTTON_BACK] = OBJ_PLTT_ID(IndexOfSpritePaletteTag(PALTAG_BACK_BUTTON)) + 14,
[BUTTON_OK] = OBJ_PLTT_ID(IndexOfSpritePaletteTag(PALTAG_OK_BUTTON)) + 14,
[BUTTON_COUNT] = OBJ_PLTT_ID(IndexOfSpritePaletteTag(PALTAG_OK_BUTTON)) + 1,
};
return palOffsets[button];
@ -1051,7 +1051,7 @@ static void SpriteCB_Cursor(struct Sprite *sprite)
{
s8 gb = sprite->sColor;
s8 r = sprite->sColor >> 1;
u16 index = IndexOfSpritePaletteTag(PALTAG_CURSOR) * 16 + 0x0101;
u16 index = OBJ_PLTT_ID(IndexOfSpritePaletteTag(PALTAG_CURSOR)) + 1;
MultiplyInvertedPaletteRGBComponents(index, r, gb, gb);
}

View File

@ -64,7 +64,7 @@ static 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};
EWRAM_DATA u8 gPaletteDecompressionBuffer[PLTT_SIZE] = {0};
static const struct PaletteStructTemplate sDummyPaletteStructTemplate = {
.id = 0xFFFF,
@ -148,7 +148,7 @@ static void ReadPlttIntoBuffers(void)
u16 i;
u16 *pltt = (u16 *)PLTT;
for (i = 0; i < PLTT_SIZE / 2; i++)
for (i = 0; i < PLTT_BUFFER_SIZE; i++)
{
gPlttBufferUnfaded[i] = pltt[i];
gPlttBufferFaded[i] = pltt[i];
@ -592,13 +592,13 @@ static u8 UpdateFastPaletteFade(void)
if (gPaletteFade.objPaletteToggle)
{
paletteOffsetStart = 256;
paletteOffsetEnd = 512;
paletteOffsetStart = OBJ_PLTT_OFFSET;
paletteOffsetEnd = PLTT_BUFFER_SIZE;
}
else
{
paletteOffsetStart = 0;
paletteOffsetEnd = 256;
paletteOffsetEnd = OBJ_PLTT_OFFSET;
}
switch (gPaletteFade_submode)

View File

@ -776,11 +776,11 @@ static bool8 AllocPartyMenuBgGfx(void)
return FALSE;
}
static void PartyPaletteBufferCopy(u8 offset)
static void PartyPaletteBufferCopy(u8 palNum)
{
offset *= 16;
CpuCopy16(&gPlttBufferUnfaded[0x30], &gPlttBufferUnfaded[offset], 32);
CpuCopy16(&gPlttBufferUnfaded[0x30], &gPlttBufferFaded[offset], 32);
u8 offset = PLTT_ID(palNum);
CpuCopy16(&gPlttBufferUnfaded[BG_PLTT_ID(3)], &gPlttBufferUnfaded[offset], PLTT_SIZE_4BPP);
CpuCopy16(&gPlttBufferUnfaded[BG_PLTT_ID(3)], &gPlttBufferFaded[offset], PLTT_SIZE_4BPP);
}
static void FreePartyPointers(void)
@ -2197,14 +2197,14 @@ static void DrawEmptySlot(u8 windowId)
#define LOAD_PARTY_BOX_PAL(paletteIds, paletteOffsets) \
{ \
LoadPalette(GetPartyMenuPalBufferPtr(paletteIds[0]), paletteOffsets[0] + palNum, PLTT_SIZEOF(1)); \
LoadPalette(GetPartyMenuPalBufferPtr(paletteIds[1]), paletteOffsets[1] + palNum, PLTT_SIZEOF(1)); \
LoadPalette(GetPartyMenuPalBufferPtr(paletteIds[2]), paletteOffsets[2] + palNum, PLTT_SIZEOF(1)); \
LoadPalette(GetPartyMenuPalBufferPtr(paletteIds[0]), paletteOffsets[0] + palOffset, PLTT_SIZEOF(1)); \
LoadPalette(GetPartyMenuPalBufferPtr(paletteIds[1]), paletteOffsets[1] + palOffset, PLTT_SIZEOF(1)); \
LoadPalette(GetPartyMenuPalBufferPtr(paletteIds[2]), paletteOffsets[2] + palOffset, PLTT_SIZEOF(1)); \
}
static void LoadPartyBoxPalette(struct PartyMenuBox *menuBox, u8 palFlags)
{
u8 palNum = GetWindowAttribute(menuBox->windowId, WINDOW_PALETTE_NUM) * 16;
u8 palOffset = BG_PLTT_ID(GetWindowAttribute(menuBox->windowId, WINDOW_PALETTE_NUM));
if (palFlags & PARTY_PAL_NO_MON)
{
@ -2332,7 +2332,7 @@ static void DisplayPartyPokemonGenderNidoranCheck(struct Pokemon *mon, struct Pa
static void DisplayPartyPokemonGender(u8 gender, u16 species, u8 *nickname, struct PartyMenuBox *menuBox)
{
u8 palNum = GetWindowAttribute(menuBox->windowId, WINDOW_PALETTE_NUM) * 16;
u8 palOffset = BG_PLTT_ID(GetWindowAttribute(menuBox->windowId, WINDOW_PALETTE_NUM));
if (species == SPECIES_NONE)
return;
@ -2341,13 +2341,13 @@ static void DisplayPartyPokemonGender(u8 gender, u16 species, u8 *nickname, stru
switch (gender)
{
case MON_MALE:
LoadPalette(GetPartyMenuPalBufferPtr(sGenderMalePalIds[0]), sGenderPalOffsets[0] + palNum, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sGenderMalePalIds[1]), sGenderPalOffsets[1] + palNum, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sGenderMalePalIds[0]), sGenderPalOffsets[0] + palOffset, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sGenderMalePalIds[1]), sGenderPalOffsets[1] + palOffset, PLTT_SIZEOF(1));
DisplayPartyPokemonBarDetail(menuBox->windowId, gText_MaleSymbol, 2, &menuBox->infoRects->dimensions[8]);
break;
case MON_FEMALE:
LoadPalette(GetPartyMenuPalBufferPtr(sGenderFemalePalIds[0]), sGenderPalOffsets[0] + palNum, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sGenderFemalePalIds[1]), sGenderPalOffsets[1] + palNum, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sGenderFemalePalIds[0]), sGenderPalOffsets[0] + palOffset, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sGenderFemalePalIds[1]), sGenderPalOffsets[1] + palOffset, PLTT_SIZEOF(1));
DisplayPartyPokemonBarDetail(menuBox->windowId, gText_FemaleSymbol, 2, &menuBox->infoRects->dimensions[8]);
break;
}
@ -2401,23 +2401,23 @@ static void DisplayPartyPokemonHPBarCheck(struct Pokemon *mon, struct PartyMenuB
static void DisplayPartyPokemonHPBar(u16 hp, u16 maxhp, struct PartyMenuBox *menuBox)
{
u8 palNum = GetWindowAttribute(menuBox->windowId, WINDOW_PALETTE_NUM) * 16;
u8 palOffset = BG_PLTT_ID(GetWindowAttribute(menuBox->windowId, WINDOW_PALETTE_NUM));
u8 hpFraction;
switch (GetHPBarLevel(hp, maxhp))
{
case HP_BAR_GREEN:
case HP_BAR_FULL:
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarGreenPalIds[0]), sHPBarPalOffsets[0] + palNum, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarGreenPalIds[1]), sHPBarPalOffsets[1] + palNum, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarGreenPalIds[0]), sHPBarPalOffsets[0] + palOffset, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarGreenPalIds[1]), sHPBarPalOffsets[1] + palOffset, PLTT_SIZEOF(1));
break;
case HP_BAR_YELLOW:
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarYellowPalIds[0]), sHPBarPalOffsets[0] + palNum, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarYellowPalIds[1]), sHPBarPalOffsets[1] + palNum, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarYellowPalIds[0]), sHPBarPalOffsets[0] + palOffset, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarYellowPalIds[1]), sHPBarPalOffsets[1] + palOffset, PLTT_SIZEOF(1));
break;
default:
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarRedPalIds[0]), sHPBarPalOffsets[0] + palNum, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarRedPalIds[1]), sHPBarPalOffsets[1] + palNum, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarRedPalIds[0]), sHPBarPalOffsets[0] + palOffset, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarRedPalIds[1]), sHPBarPalOffsets[1] + palOffset, PLTT_SIZEOF(1));
break;
}

View File

@ -3264,7 +3264,7 @@ static void Task_LoadInfoScreen(u8 taskId)
case 4:
PrintMonInfo(sPokedexListItem->dexNum, sPokedexView->dexMode == DEX_MODE_HOENN ? FALSE : TRUE, sPokedexListItem->owned, 0);
if (!sPokedexListItem->owned)
LoadPalette(gPlttBufferUnfaded + 1, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(16 - 1));
LoadPalette(&gPlttBufferUnfaded[BG_PLTT_ID(0) + 1], BG_PLTT_ID(3) + 1, PLTT_SIZEOF(16 - 1));
CopyWindowToVram(WIN_INFO, COPYWIN_FULL);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2);

View File

@ -41,7 +41,7 @@ void LoadPokedexAreaMapGfx(const struct PokedexAreaMapTemplate *template)
ChangeBgX(template->bg, 0, BG_COORD_SET);
ChangeBgY(template->bg, 0, BG_COORD_SET);
SetBgAttribute(template->bg, BG_ATTR_PALETTEMODE, 1);
CpuCopy32(sPokedexAreaMap_Pal, &gPlttBufferUnfaded[0x70], sizeof(sPokedexAreaMap_Pal));
CpuCopy32(sPokedexAreaMap_Pal, &gPlttBufferUnfaded[BG_PLTT_ID(7)], sizeof(sPokedexAreaMap_Pal));
*sPokedexAreaMapBgNum = template->bg;
}

View File

@ -224,7 +224,7 @@ static bool8 DrawAreaGlow(void)
case 3:
if (!FreeTempTileDataBuffersIfPossible())
{
CpuCopy32(sAreaGlow_Pal, &gPlttBufferUnfaded[GLOW_PALETTE * 16], sizeof(sAreaGlow_Pal));
CpuCopy32(sAreaGlow_Pal, &gPlttBufferUnfaded[BG_PLTT_ID(GLOW_PALETTE)], sizeof(sAreaGlow_Pal));
sPokedexAreaScreen->drawAreaGlowState++;
}
return TRUE;

View File

@ -1199,16 +1199,12 @@ const u8 *GetMonIconTiles(u16 species, bool32 handleDeoxys)
void TryLoadAllMonIconPalettesAtOffset(u16 offset)
{
s32 i;
const struct SpritePalette* monIconPalettePtr;
if (offset <= BG_PLTT_ID(10))
if (offset <= BG_PLTT_ID(16 - ARRAY_COUNT(gMonIconPaletteTable)))
{
monIconPalettePtr = gMonIconPaletteTable;
for (i = ARRAY_COUNT(gMonIconPaletteTable) - 1; i >= 0; i--)
for (i = 0; i < (int)ARRAY_COUNT(gMonIconPaletteTable); i++)
{
LoadPalette(monIconPalettePtr->data, offset, PLTT_SIZE_4BPP);
offset += 0x10;
monIconPalettePtr++;
LoadPalette(gMonIconPaletteTable[i].data, offset, PLTT_SIZE_4BPP);
offset += 16;
}
}
}

View File

@ -5490,7 +5490,7 @@ static void InitBoxTitle(u8 boxId)
tagIndex = IndexOfSpritePaletteTag(PALTAG_BOX_TITLE);
sStorage->boxTitlePalOffset = OBJ_PLTT_ID(tagIndex) + 14;
sStorage->wallpaperPalBits |= 0x10000 << tagIndex;
sStorage->wallpaperPalBits |= (1 << 16) << tagIndex;
// The below seems intended to have separately tracked
// the incoming wallpaper title's palette, but as they now
@ -5498,7 +5498,7 @@ static void InitBoxTitle(u8 boxId)
// this is redundant along with the use of boxTitleAltPalOffset
tagIndex = IndexOfSpritePaletteTag(PALTAG_BOX_TITLE);
sStorage->boxTitleAltPalOffset = OBJ_PLTT_ID(tagIndex) + 14;
sStorage->wallpaperPalBits |= 0x10000 << tagIndex;
sStorage->wallpaperPalBits |= (1 << 16) << tagIndex;
StringCopyPadded(sStorage->boxTitleText, GetBoxNamePtr(boxId), 0, BOX_NAME_LENGTH);
DrawTextWindowAndBufferTiles(sStorage->boxTitleText, sStorage->boxTitleTiles, 0, 0, 2);
@ -5616,9 +5616,9 @@ static void CycleBoxTitleColor(void)
u8 boxId = StorageGetCurrentBox();
u8 wallpaperId = GetBoxWallpaper(boxId);
if (sStorage->boxTitleCycleId == 0)
CpuCopy16(sBoxTitleColors[wallpaperId], gPlttBufferUnfaded + sStorage->boxTitlePalOffset, 4);
CpuCopy16(sBoxTitleColors[wallpaperId], &gPlttBufferUnfaded[sStorage->boxTitlePalOffset], PLTT_SIZEOF(2));
else
CpuCopy16(sBoxTitleColors[wallpaperId], gPlttBufferUnfaded + sStorage->boxTitleAltPalOffset, 4);
CpuCopy16(sBoxTitleColors[wallpaperId], &gPlttBufferUnfaded[sStorage->boxTitleAltPalOffset], PLTT_SIZEOF(2));
}
static s16 GetBoxTitleBaseX(const u8 *string)
@ -8746,8 +8746,7 @@ static void CreateItemIconSprites(void)
LoadCompressedSpriteSheet(&spriteSheet);
sStorage->itemIcons[i].tiles = GetSpriteTileStartByTag(spriteSheet.tag) * TILE_SIZE_4BPP + (void *)(OBJ_VRAM0);
sStorage->itemIcons[i].palIndex = AllocSpritePalette(PALTAG_ITEM_ICON_0 + i);
sStorage->itemIcons[i].palIndex *= 16;
sStorage->itemIcons[i].palIndex += 0x100;
sStorage->itemIcons[i].palIndex = OBJ_PLTT_ID(sStorage->itemIcons[i].palIndex);
spriteTemplate.tileTag = GFXTAG_ITEM_ICON_0 + i;
spriteTemplate.paletteTag = PALTAG_ITEM_ICON_0 + i;
spriteId = CreateSprite(&spriteTemplate, 0, 0, 11);

View File

@ -432,7 +432,7 @@ static u32 LoopedTask_OpenConditionSearchResults(s32 state)
SetBgTilemapBuffer(1, gfx->buff);
CopyToBgTilemapBuffer(1, sConditionSearchResultTilemap, 0, 0);
CopyBgTilemapBufferToVram(1);
CopyPaletteIntoBufferUnfaded(sConditionSearchResultFramePal, BG_PLTT_ID(1), PLTT_SIZE_4BPP);
CopyPaletteIntoBufferUnfaded(sConditionSearchResultFramePal, BG_PLTT_ID(1), sizeof(sConditionSearchResultFramePal));
CopyBgTilemapBufferToVram(1);
return LT_INC_AND_PAUSE;
case 1:
@ -444,7 +444,7 @@ static u32 LoopedTask_OpenConditionSearchResults(s32 state)
case 2:
if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE;
CopyPaletteIntoBufferUnfaded(sListBg_Pal, BG_PLTT_ID(2), PLTT_SIZE_4BPP);
CopyPaletteIntoBufferUnfaded(sListBg_Pal, BG_PLTT_ID(2), sizeof(sListBg_Pal));
CreateSearchResultsList();
return LT_INC_AND_PAUSE;
case 3:

View File

@ -443,7 +443,7 @@ static u32 LoopedTask_SlideMenuHeaderDown(s32 state)
void CopyPaletteIntoBufferUnfaded(const u16 *palette, u32 bufferOffset, u32 size)
{
CpuCopy16(palette, gPlttBufferUnfaded + bufferOffset, size);
CpuCopy16(palette, &gPlttBufferUnfaded[bufferOffset], size);
}
void Pokenav_AllocAndLoadPalettes(const struct SpritePalette *palettes)
@ -468,7 +468,7 @@ void Pokenav_AllocAndLoadPalettes(const struct SpritePalette *palettes)
void PokenavFillPalette(u32 palIndex, u16 fillValue)
{
CpuFill16(fillValue, gPlttBufferFaded + 0x100 + (palIndex * 16), 16 * sizeof(u16));
CpuFill16(fillValue, &gPlttBufferFaded[OBJ_PLTT_ID(palIndex)], PLTT_SIZE_4BPP);
}
void PokenavCopyPalette(const u16 *src, const u16 *dest, int size, int a3, int a4, u16 *palette)

View File

@ -333,7 +333,7 @@ static u32 LoopedTask_OpenMatchCall(s32 state)
SetBgTilemapBuffer(2, gfx->bgTilemapBuffer2);
CopyToBgTilemapBuffer(2, sMatchCallUI_Tilemap, 0, 0);
CopyBgTilemapBufferToVram(2);
CopyPaletteIntoBufferUnfaded(sMatchCallUI_Pal, BG_PLTT_ID(2), PLTT_SIZE_4BPP);
CopyPaletteIntoBufferUnfaded(sMatchCallUI_Pal, BG_PLTT_ID(2), sizeof(sMatchCallUI_Pal));
CopyBgTilemapBufferToVram(2);
return LT_INC_AND_PAUSE;
case 1:
@ -343,7 +343,7 @@ static u32 LoopedTask_OpenMatchCall(s32 state)
BgDmaFill(1, 0, 0, 1);
SetBgTilemapBuffer(1, gfx->bgTilemapBuffer1);
FillBgTilemapBufferRect_Palette0(1, 0x1000, 0, 0, 32, 20);
CopyPaletteIntoBufferUnfaded(sCallWindow_Pal, BG_PLTT_ID(1), PLTT_SIZE_4BPP);
CopyPaletteIntoBufferUnfaded(sCallWindow_Pal, BG_PLTT_ID(1), sizeof(sCallWindow_Pal));
CopyBgTilemapBufferToVram(1);
return LT_INC_AND_PAUSE;
case 2:
@ -352,7 +352,7 @@ static u32 LoopedTask_OpenMatchCall(s32 state)
LoadCallWindowAndFade(gfx);
DecompressAndCopyTileDataToVram(3, sPokeball_Gfx, 0, 0, 0);
CopyPaletteIntoBufferUnfaded(sListWindow_Pal, BG_PLTT_ID(3), PLTT_SIZE_4BPP);
CopyPaletteIntoBufferUnfaded(sListWindow_Pal, BG_PLTT_ID(3), sizeof(sListWindow_Pal));
CopyPaletteIntoBufferUnfaded(sPokeball_Pal, BG_PLTT_ID(5), PLTT_SIZE_4BPP);
return LT_INC_AND_PAUSE;
case 3:
@ -913,9 +913,9 @@ static void Task_FlashPokeballIcons(u8 taskId)
tSinIdx += 4;
tSinIdx &= 0x7F;
tSinVal = gSineTable[tSinIdx] >> 4;
PokenavCopyPalette(sPokeball_Pal, &sPokeball_Pal[0x10], 0x10, 0x10, tSinVal, &gPlttBufferUnfaded[0x50]);
PokenavCopyPalette(sPokeball_Pal, &sPokeball_Pal[0x10], 0x10, 0x10, tSinVal, &gPlttBufferUnfaded[BG_PLTT_ID(5)]);
if (!gPaletteFade.active)
CpuCopy32(&gPlttBufferUnfaded[0x50], &gPlttBufferFaded[0x50], 0x20);
CpuCopy32(&gPlttBufferUnfaded[BG_PLTT_ID(5)], &gPlttBufferFaded[BG_PLTT_ID(5)], PLTT_SIZE_4BPP);
}
}

View File

@ -470,14 +470,14 @@ static u32 LoopedTask_OpenMenu(s32 state)
return LT_PAUSE;
DecompressAndCopyTileDataToVram(2, sPokenavDeviceBgTiles, 0, 0, 0);
DecompressAndCopyTileDataToVram(2, sPokenavDeviceBgTilemap, 0, 0, 1);
CopyPaletteIntoBufferUnfaded(sPokenavDeviceBgPal, BG_PLTT_ID(2), PLTT_SIZE_4BPP);
CopyPaletteIntoBufferUnfaded(sPokenavDeviceBgPal, BG_PLTT_ID(2), sizeof(sPokenavDeviceBgPal));
return LT_INC_AND_PAUSE;
case 2:
if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE;
DecompressAndCopyTileDataToVram(3, sPokenavBgDotsTiles, 0, 0, 0);
DecompressAndCopyTileDataToVram(3, sPokenavBgDotsTilemap, 0, 0, 1);
CopyPaletteIntoBufferUnfaded(sPokenavBgDotsPal, BG_PLTT_ID(3), PLTT_SIZE_4BPP);
CopyPaletteIntoBufferUnfaded(sPokenavBgDotsPal, BG_PLTT_ID(3), sizeof(sPokenavBgDotsPal));
if (GetPokenavMenuType() == POKENAV_MENU_TYPE_CONDITION || GetPokenavMenuType() == POKENAV_MENU_TYPE_CONDITION_SEARCH)
ChangeBgDotsColorToPurple();
return LT_INC_AND_PAUSE;

View File

@ -515,7 +515,7 @@ static void LoadPokenavRegionMapGfx(struct Pokenav_RegionMapGfx *state)
FillWindowPixelBuffer(state->infoWindowId, PIXEL_FILL(1));
PutWindowTilemap(state->infoWindowId);
CopyWindowToVram(state->infoWindowId, COPYWIN_FULL);
CopyPaletteIntoBufferUnfaded(sMapSecInfoWindow_Pal, BG_PLTT_ID(1), PLTT_SIZE_4BPP);
CopyPaletteIntoBufferUnfaded(sMapSecInfoWindow_Pal, BG_PLTT_ID(1), sizeof(sMapSecInfoWindow_Pal));
CopyPaletteIntoBufferUnfaded(gRegionMapCityZoomTiles_Pal, BG_PLTT_ID(3), PLTT_SIZE_4BPP);
if (!IsRegionMapZoomed())
ChangeBgY(1, -0x6000, BG_COORD_SET);

View File

@ -432,7 +432,7 @@ static u32 LoopedTask_OpenRibbonsMonList(s32 state)
DecompressAndCopyTileDataToVram(1, sMonRibbonListFrameTiles, 0, 0, 0);
SetBgTilemapBuffer(1, menu->buff);
CopyToBgTilemapBuffer(1, sMonRibbonListFrameTilemap, 0, 0);
CopyPaletteIntoBufferUnfaded(sMonRibbonListFramePal, BG_PLTT_ID(1), PLTT_SIZE_4BPP);
CopyPaletteIntoBufferUnfaded(sMonRibbonListFramePal, BG_PLTT_ID(1), sizeof(sMonRibbonListFramePal));
CopyBgTilemapBufferToVram(1);
return LT_INC_AND_PAUSE;
case 1:
@ -447,7 +447,7 @@ static u32 LoopedTask_OpenRibbonsMonList(s32 state)
case 2:
if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE;
CopyPaletteIntoBufferUnfaded(sMonRibbonListUi_Pal, BG_PLTT_ID(2), PLTT_SIZE_4BPP);
CopyPaletteIntoBufferUnfaded(sMonRibbonListUi_Pal, BG_PLTT_ID(2), sizeof(sMonRibbonListUi_Pal));
CreateRibbonMonsList();
return LT_INC_AND_PAUSE;
case 3:

View File

@ -584,7 +584,7 @@ static u32 LoopedTask_OpenRibbonsSummaryMenu(s32 state)
SetBgTilemapBuffer(1, menu->tilemapBuffers[1]);
FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 32, 20);
CopyPaletteIntoBufferUnfaded(sRibbonIcons1_Pal, BG_PLTT_ID(2), 5 * PLTT_SIZE_4BPP);
CopyPaletteIntoBufferUnfaded(sMonInfo_Pal, BG_PLTT_ID(10), PLTT_SIZE_4BPP);
CopyPaletteIntoBufferUnfaded(sMonInfo_Pal, BG_PLTT_ID(10), sizeof(sMonInfo_Pal));
CopyBgTilemapBufferToVram(1);
return LT_INC_AND_PAUSE;
}

View File

@ -621,7 +621,7 @@ bool8 LoadRegionMapGfx(void)
void BlendRegionMap(u16 color, u32 coeff)
{
BlendPalettes(0x380, coeff, color);
CpuCopy16(gPlttBufferFaded + 0x70, gPlttBufferUnfaded + 0x70, 0x60);
CpuCopy16(&gPlttBufferFaded[BG_PLTT_ID(7)], &gPlttBufferUnfaded[BG_PLTT_ID(7)], 3 * PLTT_SIZE_4BPP);
}
void FreeRegionMapIconResources(void)

View File

@ -860,7 +860,7 @@ static const struct RouletteFlashSettings sFlashData_Colors[NUM_ROULETTE_SLOTS +
{
{ // F_FLASH_COLOR_O_WYNAUT
.color = FLASHUTIL_USE_EXISTING_COLOR,
.paletteOffset = 0x5,
.paletteOffset = BG_PLTT_ID(0) + 5,
.numColors = 1,
.delay = 1,
.unk6 = -1,
@ -870,7 +870,7 @@ static const struct RouletteFlashSettings sFlashData_Colors[NUM_ROULETTE_SLOTS +
},
{ // F_FLASH_COLOR_G_AZURILL
.color = FLASHUTIL_USE_EXISTING_COLOR,
.paletteOffset = 0xA,
.paletteOffset = BG_PLTT_ID(0) + 10,
.numColors = 1,
.delay = 1,
.unk6 = -1,
@ -880,7 +880,7 @@ static const struct RouletteFlashSettings sFlashData_Colors[NUM_ROULETTE_SLOTS +
},
{ // F_FLASH_COLOR_P_SKITTY
.color = FLASHUTIL_USE_EXISTING_COLOR,
.paletteOffset = 0x15,
.paletteOffset = BG_PLTT_ID(1) + 5,
.numColors = 1,
.delay = 1,
.unk6 = -1,
@ -890,7 +890,7 @@ static const struct RouletteFlashSettings sFlashData_Colors[NUM_ROULETTE_SLOTS +
},
{ // F_FLASH_COLOR_O_MAKUHITA
.color = FLASHUTIL_USE_EXISTING_COLOR,
.paletteOffset = 0x55,
.paletteOffset = BG_PLTT_ID(5) + 5,
.numColors = 1,
.delay = 1,
.unk6 = -1,
@ -900,7 +900,7 @@ static const struct RouletteFlashSettings sFlashData_Colors[NUM_ROULETTE_SLOTS +
},
{ // F_FLASH_COLOR_G_WYNAUT
.color = FLASHUTIL_USE_EXISTING_COLOR,
.paletteOffset = 0x5A,
.paletteOffset = BG_PLTT_ID(5) + 10,
.numColors = 1,
.delay = 1,
.unk6 = -1,
@ -910,7 +910,7 @@ static const struct RouletteFlashSettings sFlashData_Colors[NUM_ROULETTE_SLOTS +
},
{ // F_FLASH_COLOR_P_AZURILL
.color = FLASHUTIL_USE_EXISTING_COLOR,
.paletteOffset = 0x65,
.paletteOffset = BG_PLTT_ID(6) + 5,
.numColors = 1,
.delay = 1,
.unk6 = -1,
@ -920,7 +920,7 @@ static const struct RouletteFlashSettings sFlashData_Colors[NUM_ROULETTE_SLOTS +
},
{ // F_FLASH_COLOR_O_SKITTY
.color = FLASHUTIL_USE_EXISTING_COLOR,
.paletteOffset = 0x75,
.paletteOffset = BG_PLTT_ID(7) + 5,
.numColors = 1,
.delay = 1,
.unk6 = -1,
@ -930,7 +930,7 @@ static const struct RouletteFlashSettings sFlashData_Colors[NUM_ROULETTE_SLOTS +
},
{ // F_FLASH_COLOR_G_MAKUHITA
.color = FLASHUTIL_USE_EXISTING_COLOR,
.paletteOffset = 0x7A,
.paletteOffset = BG_PLTT_ID(7) + 10,
.numColors = 1,
.delay = 1,
.unk6 = -1,
@ -940,7 +940,7 @@ static const struct RouletteFlashSettings sFlashData_Colors[NUM_ROULETTE_SLOTS +
},
{ // F_FLASH_COLOR_P_WYNAUT
.color = FLASHUTIL_USE_EXISTING_COLOR,
.paletteOffset = 0x85,
.paletteOffset = BG_PLTT_ID(8) + 5,
.numColors = 1,
.delay = 1,
.unk6 = -1,
@ -950,7 +950,7 @@ static const struct RouletteFlashSettings sFlashData_Colors[NUM_ROULETTE_SLOTS +
},
{ // F_FLASH_COLOR_O_AZURILL
.color = FLASHUTIL_USE_EXISTING_COLOR,
.paletteOffset = 0x95,
.paletteOffset = BG_PLTT_ID(9) + 5,
.numColors = 1,
.delay = 1,
.unk6 = -1,
@ -960,7 +960,7 @@ static const struct RouletteFlashSettings sFlashData_Colors[NUM_ROULETTE_SLOTS +
},
{ // F_FLASH_COLOR_G_SKITTY
.color = FLASHUTIL_USE_EXISTING_COLOR,
.paletteOffset = 0x9A,
.paletteOffset = BG_PLTT_ID(9) + 10,
.numColors = 1,
.delay = 1,
.unk6 = -1,
@ -970,7 +970,7 @@ static const struct RouletteFlashSettings sFlashData_Colors[NUM_ROULETTE_SLOTS +
},
{ // F_FLASH_COLOR_P_MAKUHITA
.color = FLASHUTIL_USE_EXISTING_COLOR,
.paletteOffset = 0xA5,
.paletteOffset = BG_PLTT_ID(10) + 5,
.numColors = 1,
.delay = 1,
.unk6 = -1,
@ -980,7 +980,7 @@ static const struct RouletteFlashSettings sFlashData_Colors[NUM_ROULETTE_SLOTS +
},
{ // F_FLASH_OUTER_EDGES
.color = RGB(22, 30, 29),
.paletteOffset = 0x28,
.paletteOffset = BG_PLTT_ID(2) + 8,
.numColors = 2,
.delay = 10,
.unk6 = -1,
@ -996,7 +996,7 @@ static const struct RouletteFlashSettings sFlashData_PokeIcons[NUM_BOARD_COLORS]
{
[GET_ROW_IDX(ROW_ORANGE)] = {
.color = RGB(31, 31, 20),
.paletteOffset = 0x101,
.paletteOffset = OBJ_PLTT_ID(0) + 1,
.numColors = 5,
.delay = 30,
.unk6 = -1,
@ -1006,7 +1006,7 @@ static const struct RouletteFlashSettings sFlashData_PokeIcons[NUM_BOARD_COLORS]
},
[GET_ROW_IDX(ROW_GREEN)] = {
.color = RGB(27, 31, 31),
.paletteOffset = 0x106,
.paletteOffset = OBJ_PLTT_ID(0) + 6,
.numColors = 5,
.delay = 30,
.unk6 = -1,
@ -1016,7 +1016,7 @@ static const struct RouletteFlashSettings sFlashData_PokeIcons[NUM_BOARD_COLORS]
},
[GET_ROW_IDX(ROW_PURPLE)] = {
.color = RGB(31, 27, 31),
.paletteOffset = 0x10B,
.paletteOffset = OBJ_PLTT_ID(0) + 11,
.numColors = 5,
.delay = 30,
.unk6 = -1,
@ -1129,9 +1129,9 @@ static void InitRouletteTableData(void)
// Left table (with min bet of 1) has red background, other table has green
if (sRoulette->minBet == 1)
gPlttBufferUnfaded[0] = gPlttBufferUnfaded[0x51] = gPlttBufferFaded[0] = gPlttBufferFaded[0x51] = bgColors[0];
gPlttBufferUnfaded[BG_PLTT_ID(0)] = gPlttBufferUnfaded[BG_PLTT_ID(5) + 1] = gPlttBufferFaded[BG_PLTT_ID(0)] = gPlttBufferFaded[BG_PLTT_ID(5) + 1] = bgColors[0];
else
gPlttBufferUnfaded[0] = gPlttBufferUnfaded[0x51] = gPlttBufferFaded[0] = gPlttBufferFaded[0x51] = bgColors[1];
gPlttBufferUnfaded[BG_PLTT_ID(0)] = gPlttBufferUnfaded[BG_PLTT_ID(5) + 1] = gPlttBufferFaded[BG_PLTT_ID(0)] = gPlttBufferFaded[BG_PLTT_ID(5) + 1] = bgColors[1];
RouletteFlash_Reset(&sRoulette->flashUtil);

View File

@ -649,12 +649,12 @@ bool8 ScrCmd_fadescreenswapbuffers(struct ScriptContext *ctx)
case FADE_TO_BLACK:
case FADE_TO_WHITE:
default:
CpuCopy32(gPlttBufferUnfaded, gPaletteDecompressionBuffer, PLTT_DECOMP_BUFFER_SIZE);
CpuCopy32(gPlttBufferUnfaded, gPaletteDecompressionBuffer, PLTT_SIZE);
FadeScreen(mode, 0);
break;
case FADE_FROM_BLACK:
case FADE_FROM_WHITE:
CpuCopy32(gPaletteDecompressionBuffer, gPlttBufferUnfaded, PLTT_DECOMP_BUFFER_SIZE);
CpuCopy32(gPaletteDecompressionBuffer, gPlttBufferUnfaded, PLTT_SIZE);
FadeScreen(mode, 0);
break;
}

View File

@ -4427,7 +4427,7 @@ static void SpriteCB_ReelTimePikachuAura(struct Sprite *sprite)
u8 colors[] = {16, 0};
if (sprite->sFlashPal && --sprite->sDelayTimer <= 0)
{
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(PALTAG_PIKA_AURA) << 4) + 0x103, colors[sprite->sColorIdx], colors[sprite->sColorIdx], colors[sprite->sColorIdx]);
MultiplyInvertedPaletteRGBComponents(OBJ_PLTT_ID(IndexOfSpritePaletteTag(PALTAG_PIKA_AURA)) + 3, colors[sprite->sColorIdx], colors[sprite->sColorIdx], colors[sprite->sColorIdx]);
++sprite->sColorIdx;
sprite->sColorIdx &= 1;
sprite->sDelayTimer = sprite->sDelay;
@ -4442,7 +4442,7 @@ static void SetReelTimePikachuAuraFlashDelay(s16 delay)
static void DestroyReelTimePikachuAuraSprites(void)
{
u8 i;
MultiplyInvertedPaletteRGBComponents((IndexOfSpritePaletteTag(PALTAG_PIKA_AURA) << 4) + 0x103, 0, 0, 0);
MultiplyInvertedPaletteRGBComponents(OBJ_PLTT_ID(IndexOfSpritePaletteTag(PALTAG_PIKA_AURA)) + 3, 0, 0, 0);
for (i = 0; i < ARRAY_COUNT(sSlotMachine->reelTimePikachuAuraSpriteIds); i++)
DestroySprite(&gSprites[sSlotMachine->reelTimePikachuAuraSpriteIds[i]]);
}

View File

@ -1167,7 +1167,7 @@ static void QueueAnimTiles_BattlePyramid_StatueShadow(u16 timer)
static void BlendAnimPalette_BattleDome_FloorLights(u16 timer)
{
CpuCopy16(sTilesetAnims_BattleDomeFloorLightPals[timer % ARRAY_COUNT(sTilesetAnims_BattleDomeFloorLightPals)], &gPlttBufferUnfaded[0x80], 32);
CpuCopy16(sTilesetAnims_BattleDomeFloorLightPals[timer % ARRAY_COUNT(sTilesetAnims_BattleDomeFloorLightPals)], &gPlttBufferUnfaded[BG_PLTT_ID(8)], PLTT_SIZE_4BPP);
BlendPalette(BG_PLTT_ID(8), 16, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF);
if ((u8)FindTaskIdByFunc(Task_BattleTransition_Intro) != TASK_NONE)
{
@ -1178,7 +1178,7 @@ static void BlendAnimPalette_BattleDome_FloorLights(u16 timer)
static void BlendAnimPalette_BattleDome_FloorLightsNoBlend(u16 timer)
{
CpuCopy16(sTilesetAnims_BattleDomeFloorLightPals[timer % ARRAY_COUNT(sTilesetAnims_BattleDomeFloorLightPals)], &gPlttBufferUnfaded[0x80], 32);
CpuCopy16(sTilesetAnims_BattleDomeFloorLightPals[timer % ARRAY_COUNT(sTilesetAnims_BattleDomeFloorLightPals)], &gPlttBufferUnfaded[BG_PLTT_ID(8)], PLTT_SIZE_4BPP);
if ((u8)FindTaskIdByFunc(Task_BattleTransition_Intro) == TASK_NONE)
{
BlendPalette(BG_PLTT_ID(8), 16, gPaletteFade.y, gPaletteFade.blendColor & 0x7FFF);

View File

@ -222,7 +222,7 @@ static void CB2_InitWirelessCommunicationScreen(void)
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
LoadPalette(sPalettes, BG_PLTT_ID(0), PLTT_SIZE_4BPP);
Menu_LoadStdPalAt(0xF0);
Menu_LoadStdPalAt(BG_PLTT_ID(15));
DynamicPlaceholderTextUtil_Reset();
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 15);
CopyBgTilemapBufferToVram(1);