Merge pull request #1746 from mrgriffin/ui-standardize

Standardize the UI code
This commit is contained in:
GriffinR 2023-01-18 11:15:52 -05:00 committed by GitHub
commit ff3168f6cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
117 changed files with 837 additions and 823 deletions

View File

@ -1615,7 +1615,7 @@ void LoadSpritePalettes(const struct SpritePalette *palettes)
void DoLoadSpritePalette(const u16 *src, u16 paletteOffset)
{
LoadPalette(src, paletteOffset + 0x100, 32);
LoadPalette(src, OBJ_PLTT_OFFSET + paletteOffset, PLTT_SIZE_4BPP);
}
u8 AllocSpritePalette(u16 tag)

View File

@ -78,4 +78,10 @@
#define TOTAL_OBJ_TILE_COUNT 1024
#define PLTT_SIZEOF(n) ((n) * sizeof(u16))
#define PLTT_SIZE_4BPP PLTT_SIZEOF(16)
#define PLTT_SIZE_8BPP PLTT_SIZEOF(256)
#define PLTT_OFFSET_4BPP(n) ((n) * PLTT_SIZE_4BPP)
#endif // GUARD_GBA_DEFINES_H

View File

@ -18,6 +18,13 @@
#define PALETTES_OBJECTS 0xFFFF0000
#define PALETTES_ALL (PALETTES_BG | PALETTES_OBJECTS)
#define PLTT_ID(n) ((n) * 16)
#define BG_PLTT_OFFSET 0x000
#define OBJ_PLTT_OFFSET 0x100
#define BG_PLTT_ID(n) (BG_PLTT_OFFSET + PLTT_ID(n))
#define OBJ_PLTT_ID(n) (OBJ_PLTT_OFFSET + PLTT_ID(n))
#define OBJ_PLTT_ID2(n) (PLTT_ID((n) + 16))
enum
{
FAST_FADE_IN_FROM_WHITE,
@ -74,4 +81,14 @@ void TintPalette_GrayScale2(u16 *palette, u16 count);
void TintPalette_SepiaTone(u16 *palette, u16 count);
void TintPalette_CustomTone(u16 *palette, u16 count, u16 rTone, u16 gTone, u16 bTone);
static inline void SetBackdropFromColor(u16 color)
{
FillPalette(color, 0, PLTT_SIZEOF(1));
}
static inline void SetBackdropFromPalette(const u16 *palette)
{
LoadPalette(palette, 0, PLTT_SIZEOF(1));
}
#endif // GUARD_PALETTE_H

View File

@ -706,8 +706,8 @@ void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible)
SetGpuReg(REG_OFFSET_BG1HOFS, gBattle_BG1_X);
SetGpuReg(REG_OFFSET_BG1VOFS, gBattle_BG1_Y);
LoadPalette(&gPlttBufferUnfaded[0x100 + battlerId * 16], animBg.paletteId * 16, 0x20);
CpuCopy32(&gPlttBufferUnfaded[0x100 + battlerId * 16], (void *)(BG_PLTT + animBg.paletteId * 32), 0x20);
LoadPalette(&gPlttBufferUnfaded[OBJ_PLTT_ID(battlerId)], BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
CpuCopy32(&gPlttBufferUnfaded[OBJ_PLTT_ID(battlerId)], (void *)(BG_PLTT + PLTT_OFFSET_4BPP(animBg.paletteId)), PLTT_SIZE_4BPP);
if (IsContest())
battlerPosition = 0;
@ -741,8 +741,8 @@ void MoveBattlerSpriteToBG(u8 battlerId, bool8 toBG_2, bool8 setSpriteInvisible)
SetGpuReg(REG_OFFSET_BG2HOFS, gBattle_BG2_X);
SetGpuReg(REG_OFFSET_BG2VOFS, gBattle_BG2_Y);
LoadPalette(&gPlttBufferUnfaded[0x100 + battlerId * 16], 0x90, 0x20);
CpuCopy32(&gPlttBufferUnfaded[0x100 + battlerId * 16], (void *)(BG_PLTT + 0x120), 0x20);
LoadPalette(&gPlttBufferUnfaded[OBJ_PLTT_ID(battlerId)], BG_PLTT_ID(9), PLTT_SIZE_4BPP);
CpuCopy32(&gPlttBufferUnfaded[OBJ_PLTT_ID(battlerId)], (void *)(BG_PLTT + PLTT_OFFSET_4BPP(9)), PLTT_SIZE_4BPP);
DrawBattlerOnBg(2, 0, 0, GetBattlerPosition(battlerId), animBg.paletteId, animBg.bgTiles + 0x1000, animBg.bgTilemap + 0x400, animBg.tilesOffset);
}
@ -1208,13 +1208,13 @@ static void LoadMoveBg(u16 bgId)
dmaDest = (void *)BG_SCREEN_ADDR(26);
DmaCopy32(3, dmaSrc, dmaDest, 0x800);
LZDecompressVram(gBattleAnimBackgroundTable[bgId].image, (void *)BG_SCREEN_ADDR(4));
LoadCompressedPalette(gBattleAnimBackgroundTable[bgId].palette, GetBattleBgPaletteNum() * 16, 32);
LoadCompressedPalette(gBattleAnimBackgroundTable[bgId].palette, BG_PLTT_ID(GetBattleBgPaletteNum()), PLTT_SIZE_4BPP);
}
else
{
LZDecompressVram(gBattleAnimBackgroundTable[bgId].tilemap, (void *)BG_SCREEN_ADDR(26));
LZDecompressVram(gBattleAnimBackgroundTable[bgId].image, (void *)BG_CHAR_ADDR(2));
LoadCompressedPalette(gBattleAnimBackgroundTable[bgId].palette, 32, 32);
LoadCompressedPalette(gBattleAnimBackgroundTable[bgId].palette, BG_PLTT_ID(2), PLTT_SIZE_4BPP);
}
}

View File

@ -426,7 +426,7 @@ void AnimTask_MoveAttackerMementoShadow(u8 taskId)
GetBattleAnimBg1Data(&animBg);
task->data[10] = gBattle_BG1_Y;
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND | BLDCNT_TGT1_BG1);
FillPalette(RGB_BLACK, animBg.paletteId * 16, 32);
FillPalette(RGB_BLACK, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
scanlineParams.dmaDest = &REG_BG1VOFS;
var0 = WINOUT_WIN01_BG1;
if (!IsContest())
@ -436,7 +436,7 @@ void AnimTask_MoveAttackerMementoShadow(u8 taskId)
{
task->data[10] = gBattle_BG2_Y;
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND | BLDCNT_TGT1_BG2);
FillPalette(RGB_BLACK, 144, 32);
FillPalette(RGB_BLACK, BG_PLTT_ID(9), PLTT_SIZE_4BPP);
scanlineParams.dmaDest = &REG_BG2VOFS;
var0 = WINOUT_WIN01_BG2;
if (!IsContest())
@ -566,12 +566,12 @@ void AnimTask_MoveTargetMementoShadow(u8 taskId)
{
GetBattleAnimBg1Data(&animBg);
task->data[10] = gBattle_BG1_Y;
FillPalette(RGB_BLACK, animBg.paletteId * 16, 32);
FillPalette(RGB_BLACK, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
}
else
{
task->data[10] = gBattle_BG2_Y;
FillPalette(RGB_BLACK, 9 * 16, 32);
FillPalette(RGB_BLACK, BG_PLTT_ID(9), PLTT_SIZE_4BPP);
}
SetAllBattlersSpritePriority(3);
@ -863,7 +863,7 @@ void AnimTask_MetallicShine(u8 taskId)
GetBattleAnimBg1Data(&animBg);
AnimLoadCompressedBgTilemap(animBg.bgId, gMetalShineTilemap);
AnimLoadCompressedBgGfx(animBg.bgId, gMetalShineGfx, animBg.tilesOffset);
LoadCompressedPalette(gMetalShinePalette, animBg.paletteId * 16, 32);
LoadCompressedPalette(gMetalShinePalette, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
gBattle_BG1_X = -gSprites[spriteId].x + 96;
gBattle_BG1_Y = -gSprites[spriteId].y + 32;
@ -872,7 +872,7 @@ void AnimTask_MetallicShine(u8 taskId)
if (gBattleAnimArgs[1] == 0)
SetGrayscaleOrOriginalPalette(paletteNum, FALSE);
else
BlendPalette(paletteNum * 16, 16, 11, gBattleAnimArgs[2]);
BlendPalette(BG_PLTT_ID(paletteNum), 16, 11, gBattleAnimArgs[2]);
gTasks[taskId].data[0] = newSpriteId;
gTasks[taskId].data[1] = gBattleAnimArgs[0];

View File

@ -3641,8 +3641,8 @@ void AnimTask_CycleMagicalLeafPal(u8 taskId)
switch (task->data[0])
{
case 0:
task->data[8] = IndexOfSpritePaletteTag(ANIM_TAG_LEAF) * 16 + 256;
task->data[12] = IndexOfSpritePaletteTag(ANIM_TAG_RAZOR_LEAF) * 16 + 256;
task->data[8] = OBJ_PLTT_ID(IndexOfSpritePaletteTag(ANIM_TAG_LEAF));
task->data[12] = OBJ_PLTT_ID(IndexOfSpritePaletteTag(ANIM_TAG_RAZOR_LEAF));
task->data[0]++;
break;
case 1:
@ -4349,7 +4349,7 @@ static void AnimLockOnTarget_Step4(struct Sprite *sprite)
int pal;
sprite->data[2]++;
pal = sprite->oam.paletteNum;
LoadPalette(&gPlttBufferUnfaded[0x108 + pal * 16], pal * 16 | 0x101, 4);
LoadPalette(&gPlttBufferUnfaded[OBJ_PLTT_ID(pal) + 8], OBJ_PLTT_ID(pal) + 1, PLTT_SIZEOF(2));
PlaySE12WithPanning(SE_M_LEER, BattleAnimAdjustPanning(SOUND_PAN_TARGET));
}
else if (sprite->data[1] == 0)
@ -5173,8 +5173,8 @@ void AnimTask_DoubleTeam(u8 taskId)
struct Task *task = &gTasks[taskId];
task->data[0] = GetAnimBattlerSpriteId(ANIM_ATTACKER);
task->data[1] = AllocSpritePalette(ANIM_TAG_BENT_SPOON);
r3 = (task->data[1] * 16) + 0x100;
r4 = (gSprites[task->data[0]].oam.paletteNum + 16) << 4;
r3 = OBJ_PLTT_ID(task->data[1]);
r4 = OBJ_PLTT_ID2(gSprites[task->data[0]].oam.paletteNum);
for (i = 1; i < 16; i++)
gPlttBufferUnfaded[r3 + i] = gPlttBufferUnfaded[r4 + i];

View File

@ -2678,7 +2678,7 @@ static void AnimUproarRing(struct Sprite *sprite)
u8 index = IndexOfSpritePaletteTag(ANIM_TAG_THIN_RING);
if (index != 0xFF)
{
BlendPalette(((index << 20) + 0x1010000) >> 16, 15, gBattleAnimArgs[5], gBattleAnimArgs[4]);
BlendPalette((OBJ_PLTT_ID(index) + 1), 15, gBattleAnimArgs[5], gBattleAnimArgs[4]);
}
StartSpriteAffineAnim(sprite, 1);
@ -3026,7 +3026,7 @@ void AnimTask_LoadMusicNotesPals(u8 taskId)
gMonSpritesGfxPtr->buffer = AllocZeroed(0x2000);
LZDecompressWram(gBattleAnimSpritePal_MusicNotes2, gMonSpritesGfxPtr->buffer);
for (i = 0; i < NUM_MUSIC_NOTE_PAL_TAGS; i++)
LoadPalette(&gMonSpritesGfxPtr->buffer[i * 32], (u16)((paletteNums[i] << 4) + 0x100), 32);
LoadPalette(&gMonSpritesGfxPtr->buffer[i * 32], (u16)(OBJ_PLTT_ID(paletteNums[i])), PLTT_SIZE_4BPP);
FREE_AND_SET_NULL(gMonSpritesGfxPtr->buffer);
DestroyAnimVisualTask(taskId);
@ -3259,7 +3259,7 @@ void AnimTask_HeartsBackground(u8 taskId)
GetBattleAnimBg1Data(&animBg);
AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimBgImage_Attract, animBg.tilesOffset);
AnimLoadCompressedBgTilemapHandleContest(&animBg, gBattleAnimBgTilemap_Attract, FALSE);
LoadCompressedPalette(gBattleAnimBgPalette_Attract, animBg.paletteId * 16, 32);
LoadCompressedPalette(gBattleAnimBgPalette_Attract, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
gTasks[taskId].func = AnimTask_HeartsBackground_Step;
}
@ -3343,7 +3343,7 @@ void AnimTask_ScaryFace(u8 taskId)
AnimLoadCompressedBgTilemapHandleContest(&animBg, &gBattleAnimBgTilemap_ScaryFaceOpponent, FALSE);
AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimBgImage_ScaryFace, animBg.tilesOffset);
LoadCompressedPalette(gBattleAnimBgPalette_ScaryFace, animBg.paletteId * 16, 32);
LoadCompressedPalette(gBattleAnimBgPalette_ScaryFace, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
gTasks[taskId].func = AnimTask_ScaryFace_Step;
}

View File

@ -2405,7 +2405,7 @@ void AnimTask_MorningSunLightBeam(u8 taskId)
}
AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimMaskImage_LightBeam, animBg.tilesOffset);
LoadCompressedPalette(gBattleAnimMaskPalette_LightBeam, animBg.paletteId * 16, 32);
LoadCompressedPalette(gBattleAnimMaskPalette_LightBeam, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
gTasks[taskId].data[10] = gBattle_BG1_X;
gTasks[taskId].data[11] = gBattle_BG1_Y;
@ -2601,7 +2601,7 @@ void AnimTask_DoomDesireLightBeam(u8 taskId)
}
AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimMaskImage_LightBeam, animBg.tilesOffset);
LoadCompressedPalette(gBattleAnimMaskPalette_LightBeam, animBg.paletteId * 16, 32);
LoadCompressedPalette(gBattleAnimMaskPalette_LightBeam, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
gTasks[taskId].data[10] = gBattle_BG1_X;
gTasks[taskId].data[11] = gBattle_BG1_Y;
gTasks[taskId].data[0]++;
@ -3252,7 +3252,7 @@ void AnimTask_RolePlaySilhouette(u8 taskId)
gSprites[spriteId].oam.priority = priority;
gSprites[spriteId].oam.objMode = ST_OAM_OBJ_BLEND;
FillPalette(RGB_WHITE, (gSprites[spriteId].oam.paletteNum << 4) + 0x100, 32);
FillPalette(RGB_WHITE, OBJ_PLTT_ID(gSprites[spriteId].oam.paletteNum), PLTT_SIZE_4BPP);
gSprites[spriteId].oam.priority = priority;
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_ALL);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(gTasks[taskId].data[1], 16 - gTasks[taskId].data[1]));
@ -3880,7 +3880,7 @@ void AnimTask_FacadeColorBlend(u8 taskId)
gTasks[taskId].data[0] = 0;
gTasks[taskId].data[1] = gBattleAnimArgs[1];
spriteId = GetAnimBattlerSpriteId(gBattleAnimArgs[0]);
gTasks[taskId].data[2] = 0x100 + gSprites[spriteId].oam.paletteNum * 16;
gTasks[taskId].data[2] = OBJ_PLTT_ID(gSprites[spriteId].oam.paletteNum);
gTasks[taskId].func = AnimTask_FacadeColorBlend_Step;
}
@ -5145,7 +5145,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId)
spriteId2 = CreateAdditionalMonSpriteForMoveAnim(species, isBackPic, 0, x, GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y), subpriority, personality, otId, gBattleAnimAttacker, FALSE);
if (gBattleSpritesDataPtr->battlerData[gBattleAnimAttacker].transformSpecies != SPECIES_NONE)
BlendPalette((gSprites[spriteId2].oam.paletteNum * 16) | 0x100, 16, 6, RGB_WHITE);
BlendPalette(OBJ_PLTT_ID(gSprites[spriteId2].oam.paletteNum), 16, 6, RGB_WHITE);
gTasks[taskId].data[15] = spriteId2;
gTasks[taskId].data[0]++;

View File

@ -2,6 +2,7 @@
#include "battle_anim.h"
#include "constants/rgb.h"
#include "constants/songs.h"
#include "palette.h"
#include "sound.h"
#include "util.h"
#include "task.h"
@ -1329,7 +1330,7 @@ void AnimTask_BlendBackground(u8 taskId)
{
struct BattleAnimBgData animBg;
GetBattleAnimBg1Data(&animBg);
BlendPalette(animBg.paletteId * 16, 16, gBattleAnimArgs[0], gBattleAnimArgs[1]);
BlendPalette(BG_PLTT_ID(animBg.paletteId), 16, gBattleAnimArgs[0], gBattleAnimArgs[1]);
DestroyAnimVisualTask(taskId);
}

View File

@ -642,8 +642,8 @@ static void AnimTask_SpiteTargetShadow_Step1(u8 taskId)
}
break;
case 1:
task->data[14] = (task->data[14] + 16) * 16;
CpuCopy32(&gPlttBufferUnfaded[task->data[4]], &gPlttBufferFaded[task->data[14]], 32);
task->data[14] = OBJ_PLTT_ID2(task->data[14]);
CpuCopy32(&gPlttBufferUnfaded[task->data[4]], &gPlttBufferFaded[task->data[14]], PLTT_SIZE_4BPP);
BlendPalette(task->data[4], 16, 10, RGB(13, 0, 15));
task->data[15]++;
break;

View File

@ -1005,7 +1005,7 @@ void AnimTask_HazeScrollingFog(u8 taskId)
GetBattleAnimBg1Data(&animBg);
LoadBgTiles(animBg.bgId, gWeatherFogHorizontalTiles, 0x800, animBg.tilesOffset);
AnimLoadCompressedBgTilemapHandleContest(&animBg, gBattleAnimFogTilemap, FALSE);
LoadPalette(&gFogPalette, animBg.paletteId * 16, 32);
LoadPalette(&gFogPalette, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
gTasks[taskId].func = AnimTask_HazeScrollingFog_Step;
}
@ -1110,7 +1110,7 @@ void AnimTask_MistBallFog(u8 taskId)
GetBattleAnimBg1Data(&animBg);
LoadBgTiles(animBg.bgId, gWeatherFogHorizontalTiles, 0x800, animBg.tilesOffset);
AnimLoadCompressedBgTilemapHandleContest(&animBg, gBattleAnimFogTilemap, FALSE);
LoadPalette(&gFogPalette, animBg.paletteId * 16, 32);
LoadPalette(&gFogPalette, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
gTasks[taskId].data[15] = -1;
gTasks[taskId].func = AnimTask_MistBallFog_Step;

View File

@ -1726,7 +1726,7 @@ void AnimTask_BlendMonInAndOut(u8 task)
DestroyAnimVisualTask(task);
return;
}
gTasks[task].data[0] = (gSprites[spriteId].oam.paletteNum * 0x10) + 0x101;
gTasks[task].data[0] = OBJ_PLTT_ID(gSprites[spriteId].oam.paletteNum) + 1;
AnimTask_BlendPalInAndOutSetup(&gTasks[task]);
}
@ -2104,7 +2104,7 @@ u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16
gMonSpritesGfxPtr->buffer = AllocZeroed(0x2000);
if (!isBackpic)
{
LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), (palette * 0x10) + 0x100, 0x20);
LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), OBJ_PLTT_ID(palette), PLTT_SIZE_4BPP);
if (ignoreDeoxysForm == TRUE || ShouldIgnoreDeoxysForm(5, battlerId) == TRUE || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != 0)
LoadSpecialPokePic_DontHandleDeoxys(&gMonFrontPicTable[species],
gMonSpritesGfxPtr->buffer,
@ -2120,7 +2120,7 @@ u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16
}
else
{
LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), (palette * 0x10) + 0x100, 0x20);
LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, trainerId, personality), OBJ_PLTT_ID(palette), PLTT_SIZE_4BPP);
if (ignoreDeoxysForm == TRUE || ShouldIgnoreDeoxysForm(5, battlerId) == TRUE || gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != 0)
LoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[species],
gMonSpritesGfxPtr->buffer,
@ -2427,8 +2427,8 @@ void AnimTask_AttackerPunchWithTrace(u8 taskId)
task->tPaletteNum = AllocSpritePalette(ANIM_TAG_BENT_SPOON);
task->tNumTracesActive = 0;
dest = (task->tPaletteNum + 16) * 16;
src = (gSprites[task->tBattlerSpriteId].oam.paletteNum + 0x10) * 0x10;
dest = OBJ_PLTT_ID2(task->tPaletteNum);
src = OBJ_PLTT_ID2(gSprites[task->tBattlerSpriteId].oam.paletteNum);
// Set trace's priority based on battler's subpriority
task->tPriority = GetBattlerSpriteSubpriority(gBattleAnimAttacker);
@ -2437,7 +2437,7 @@ void AnimTask_AttackerPunchWithTrace(u8 taskId)
else
task->tPriority = 3;
CpuCopy32(&gPlttBufferUnfaded[src], &gPlttBufferFaded[dest], 0x20);
CpuCopy32(&gPlttBufferUnfaded[src], &gPlttBufferFaded[dest], PLTT_SIZE_4BPP);
BlendPalette(dest, 16, gBattleAnimArgs[1], gBattleAnimArgs[0]);
task->func = AnimTask_AttackerPunchWithTrace_Step;
}

View File

@ -410,7 +410,7 @@ void AnimTask_LoadSandstormBackground(u8 taskId)
GetBattleAnimBg1Data(&animBg);
AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimBgImage_Sandstorm, animBg.tilesOffset);
AnimLoadCompressedBgTilemapHandleContest(&animBg, gBattleAnimBgTilemap_Sandstorm, FALSE);
LoadCompressedPalette(gBattleAnimSpritePal_FlyingDirt, animBg.paletteId * 16, 32);
LoadCompressedPalette(gBattleAnimSpritePal_FlyingDirt, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
if (gBattleAnimArgs[0] && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER)
var0 = 1;

View File

@ -316,7 +316,7 @@ static void Task_UpdateFlashingCircleImpacts(u8 taskId)
if (gTasks[taskId].data[2] == 2)
{
gTasks[taskId].data[2] = 0;
BlendPalette(0x100 + gTasks[taskId].data[0] * 16, 16, gTasks[taskId].data[4], gTasks[taskId].data[1]);
BlendPalette(OBJ_PLTT_ID(gTasks[taskId].data[0]), 16, gTasks[taskId].data[4], gTasks[taskId].data[1]);
if (gTasks[taskId].data[5] == 0)
{
gTasks[taskId].data[4]++;

View File

@ -471,7 +471,7 @@ void AnimTask_UnusedLevelUpHealthBox(u8 taskId)
GetBattleAnimBg1Data(&animBgData);
AnimLoadCompressedBgTilemap(animBgData.bgId, UnusedLevelupAnimationTilemap);
AnimLoadCompressedBgGfx(animBgData.bgId, UnusedLevelupAnimationGfx, animBgData.tilesOffset);
LoadCompressedPalette(gCureBubblesPal, animBgData.paletteId << 4, 32);
LoadCompressedPalette(gCureBubblesPal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
gBattle_BG1_X = -gSprites[spriteId3].x + 32;
gBattle_BG1_Y = -gSprites[spriteId3].y - 32;
@ -553,10 +553,10 @@ static void LoadHealthboxPalsForLevelUp(u8 *paletteId1, u8 *paletteId2, u8 battl
*paletteId1 = AllocSpritePalette(TAG_HEALTHBOX_PALS_1);
*paletteId2 = AllocSpritePalette(TAG_HEALTHBOX_PALS_2);
offset1 = (gSprites[healthBoxSpriteId].oam.paletteNum * 16) + 0x100;
offset2 = (gSprites[spriteId2].oam.paletteNum * 16) + 0x100;
LoadPalette(&gPlttBufferUnfaded[offset1], *paletteId1 * 16 + 0x100, 0x20);
LoadPalette(&gPlttBufferUnfaded[offset2], *paletteId2 * 16 + 0x100, 0x20);
offset1 = OBJ_PLTT_ID(gSprites[healthBoxSpriteId].oam.paletteNum);
offset2 = OBJ_PLTT_ID(gSprites[spriteId2].oam.paletteNum);
LoadPalette(&gPlttBufferUnfaded[offset1], OBJ_PLTT_ID(*paletteId1), PLTT_SIZE_4BPP);
LoadPalette(&gPlttBufferUnfaded[offset2], OBJ_PLTT_ID(*paletteId2), PLTT_SIZE_4BPP);
gSprites[healthBoxSpriteId].oam.paletteNum = *paletteId1;
gSprites[spriteId1].oam.paletteNum = *paletteId1;
@ -620,7 +620,7 @@ static void AnimTask_FlashHealthboxOnLevelUp_Step(u8 taskId)
if (gTasks[taskId].data[2] > 16)
gTasks[taskId].data[2] = 16;
paletteOffset = paletteNum * 16 + 0x100;
paletteOffset = OBJ_PLTT_ID(paletteNum);
BlendPalette(paletteOffset + colorOffset, 1, gTasks[taskId].data[2], RGB(20, 27, 31));
if (gTasks[taskId].data[2] == 16)
gTasks[taskId].data[1]++;
@ -630,7 +630,7 @@ static void AnimTask_FlashHealthboxOnLevelUp_Step(u8 taskId)
if (gTasks[taskId].data[2] < 0)
gTasks[taskId].data[2] = 0;
paletteOffset = paletteNum * 16 + 0x100;
paletteOffset = OBJ_PLTT_ID(paletteNum);
BlendPalette(paletteOffset + colorOffset, 1, gTasks[taskId].data[2], RGB(20, 27, 31));
if (gTasks[taskId].data[2] == 0)
DestroyAnimVisualTask(taskId);
@ -2030,12 +2030,12 @@ u8 LaunchBallFadeMonTask(bool8 unfadeLater, u8 spritePalNum, u32 selectedPalette
if (!unfadeLater)
{
BlendPalette(spritePalNum * 16 + 0x100, 16, 0, gBallOpenFadeColors[ballId]);
BlendPalette(OBJ_PLTT_ID(spritePalNum), 16, 0, gBallOpenFadeColors[ballId]);
gTasks[taskId].tdCoeff = 1;
}
else
{
BlendPalette(spritePalNum * 16 + 0x100, 16, 16, gBallOpenFadeColors[ballId]);
BlendPalette(OBJ_PLTT_ID(spritePalNum), 16, 16, gBallOpenFadeColors[ballId]);
gTasks[taskId].tCoeff = 16;
gTasks[taskId].tdCoeff = -1;
gTasks[taskId].func = Task_FadeMon_ToNormal;
@ -2051,7 +2051,7 @@ static void Task_FadeMon_ToBallColor(u8 taskId)
if (gTasks[taskId].tTimer <= 16)
{
BlendPalette(gTasks[taskId].tPalOffset * 16 + 0x100, 16, gTasks[taskId].tCoeff, gBallOpenFadeColors[ballId]);
BlendPalette(OBJ_PLTT_ID(gTasks[taskId].tPalOffset), 16, gTasks[taskId].tCoeff, gBallOpenFadeColors[ballId]);
gTasks[taskId].tCoeff += gTasks[taskId].tdCoeff;
gTasks[taskId].tTimer++;
}
@ -2079,7 +2079,7 @@ static void Task_FadeMon_ToNormal_Step(u8 taskId)
if (gTasks[taskId].tTimer <= 16)
{
BlendPalette(gTasks[taskId].tPalOffset * 16 + 0x100, 16, gTasks[taskId].tCoeff, gBallOpenFadeColors[ballId]);
BlendPalette(OBJ_PLTT_ID(gTasks[taskId].tPalOffset), 16, gTasks[taskId].tCoeff, gBallOpenFadeColors[ballId]);
gTasks[taskId].tCoeff += gTasks[taskId].tdCoeff;
gTasks[taskId].tTimer++;
}

View File

@ -166,7 +166,7 @@ void StartBlendAnimSpriteColor(u8 taskId, u32 selectedPalettes)
static void AnimTask_BlendSpriteColor_Step2(u8 taskId)
{
u32 selectedPalettes;
u16 singlePaletteMask = 0;
u16 singlePaletteOffset = 0;
if (gTasks[taskId].data[9] == gTasks[taskId].data[2])
{
@ -175,8 +175,8 @@ static void AnimTask_BlendSpriteColor_Step2(u8 taskId)
while (selectedPalettes != 0)
{
if (selectedPalettes & 1)
BlendPalette(singlePaletteMask, 16, gTasks[taskId].data[10], gTasks[taskId].data[5]);
singlePaletteMask += 0x10;
BlendPalette(singlePaletteOffset, 16, gTasks[taskId].data[10], gTasks[taskId].data[5]);
singlePaletteOffset += 16;
selectedPalettes >>= 1;
}
@ -333,7 +333,7 @@ void AnimTask_DrawFallingWhiteLinesOnAttacker(u8 taskId)
GetBattleAnimBg1Data(&animBgData);
AnimLoadCompressedBgTilemapHandleContest(&animBgData, gBattleAnimMaskTilemap_Curse, FALSE);
AnimLoadCompressedBgGfx(animBgData.bgId, gBattleAnimMaskImage_Curse, animBgData.tilesOffset);
LoadPalette(sCurseLinesPalette, animBgData.paletteId * 16 + 1, 2);
LoadPalette(sCurseLinesPalette, BG_PLTT_ID(animBgData.paletteId) + 1, PLTT_SIZEOF(1));
gBattle_BG1_X = -gSprites[spriteId].x + 32;
gBattle_BG1_Y = -gSprites[spriteId].y + 32;
@ -478,28 +478,28 @@ static void StatsChangeAnimation_Step2(u8 taskId)
switch (sAnimStatsChangeData->data[1])
{
case 0:
LoadCompressedPalette(gBattleStatMask2_Pal, animBgData.paletteId * 16, 32);
LoadCompressedPalette(gBattleStatMask2_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
break;
case 1:
LoadCompressedPalette(gBattleStatMask1_Pal, animBgData.paletteId * 16, 32);
LoadCompressedPalette(gBattleStatMask1_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
break;
case 2:
LoadCompressedPalette(gBattleStatMask3_Pal, animBgData.paletteId * 16, 32);
LoadCompressedPalette(gBattleStatMask3_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
break;
case 3:
LoadCompressedPalette(gBattleStatMask4_Pal, animBgData.paletteId * 16, 32);
LoadCompressedPalette(gBattleStatMask4_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
break;
case 4:
LoadCompressedPalette(gBattleStatMask6_Pal, animBgData.paletteId * 16, 32);
LoadCompressedPalette(gBattleStatMask6_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
break;
case 5:
LoadCompressedPalette(gBattleStatMask7_Pal, animBgData.paletteId * 16, 32);
LoadCompressedPalette(gBattleStatMask7_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
break;
case 6:
LoadCompressedPalette(gBattleStatMask8_Pal, animBgData.paletteId * 16, 32);
LoadCompressedPalette(gBattleStatMask8_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
break;
default:
LoadCompressedPalette(gBattleStatMask5_Pal, animBgData.paletteId * 16, 32);
LoadCompressedPalette(gBattleStatMask5_Pal, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
break;
}
@ -639,16 +639,10 @@ static void AnimTask_Flash_Step(u8 taskId)
for (i = 0; i < 16; i++)
{
if ((task->data[15] >> i) & 1)
{
u16 paletteOffset = i * 16;
BlendPalette(paletteOffset, 16, task->data[2], 0xFFFF);
}
BlendPalette(BG_PLTT_ID(i), 16, task->data[2], 0xFFFF);
if ((task->data[14] >> i) & 1)
{
u16 paletteOffset = i * 16 + 0x100;
BlendPalette(paletteOffset, 16, task->data[2], 0);
}
BlendPalette(OBJ_PLTT_ID(i), 16, task->data[2], 0);
}
if (task->data[2] == 0)
@ -822,7 +816,7 @@ void StartMonScrollingBgMask(u8 taskId, int unused, u16 scrollSpeed, u8 battler,
GetBattleAnimBg1Data(&animBgData);
AnimLoadCompressedBgTilemapHandleContest(&animBgData, tilemap, FALSE);
AnimLoadCompressedBgGfx(animBgData.bgId, gfx, animBgData.tilesOffset);
LoadCompressedPalette(palette, animBgData.paletteId * 16, 32);
LoadCompressedPalette(palette, BG_PLTT_ID(animBgData.paletteId), PLTT_SIZE_4BPP);
gBattle_BG1_X = 0;
gBattle_BG1_Y = 0;

View File

@ -825,9 +825,9 @@ void AnimTask_CreateSurfWave(u8 taskId)
}
AnimLoadCompressedBgGfx(animBg.bgId, gBattleAnimBgImage_Surf, animBg.tilesOffset);
if (gBattleAnimArgs[0] == 0)
LoadCompressedPalette(gBattleAnimBgPalette_Surf, animBg.paletteId * 16, 32);
LoadCompressedPalette(gBattleAnimBgPalette_Surf, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
else
LoadCompressedPalette(gBattleAnimBackgroundImageMuddyWater_Pal, animBg.paletteId * 16, 32);
LoadCompressedPalette(gBattleAnimBackgroundImageMuddyWater_Pal, BG_PLTT_ID(animBg.paletteId), PLTT_SIZE_4BPP);
taskId2 = CreateTask(AnimTask_SurfWaveScanlineEffect, gTasks[taskId].priority + 1);
gTasks[taskId].data[15] = taskId2;
gTasks[taskId2].data[0] = 0;

View File

@ -390,7 +390,7 @@ u8 BattleArena_ShowJudgmentWindow(u8 *state)
BeginNormalPaletteFade(0x7FFFFF1C, 4, 0, 8, RGB_BLACK);
SetGpuReg(REG_OFFSET_WININ, (WININ_WIN0_ALL & ~WININ_WIN0_BG0) | WININ_WIN1_ALL);
LoadCompressedSpriteSheet(sBattleArenaJudgmentSymbolsSpriteSheet);
LoadCompressedPalette(gBattleArenaJudgmentSymbolsPalette, 0x1F0, 0x20);
LoadCompressedPalette(gBattleArenaJudgmentSymbolsPalette, OBJ_PLTT_ID(15), PLTT_SIZE_4BPP);
gBattle_WIN0H = 0xFF;
gBattle_WIN0V = 0x70;
(*state)++;

View File

@ -742,17 +742,17 @@ void InitBattleBgsVideo(void)
void LoadBattleMenuWindowGfx(void)
{
LoadUserWindowBorderGfx(2, 0x12, 0x10);
LoadUserWindowBorderGfx(2, 0x22, 0x10);
LoadCompressedPalette(gBattleWindowTextPalette, 0x50, 0x20);
LoadUserWindowBorderGfx(2, 0x12, BG_PLTT_ID(1));
LoadUserWindowBorderGfx(2, 0x22, BG_PLTT_ID(1));
LoadCompressedPalette(gBattleWindowTextPalette, BG_PLTT_ID(5), PLTT_SIZE_4BPP);
if (gBattleTypeFlags & BATTLE_TYPE_ARENA)
{
// Load graphics for the Battle Arena referee's mid-battle messages.
Menu_LoadStdPalAt(0x70);
LoadMessageBoxGfx(0, 0x30, 0x70);
gPlttBufferUnfaded[0x76] = 0;
CpuCopy16(&gPlttBufferUnfaded[0x76], &gPlttBufferFaded[0x76], 2);
Menu_LoadStdPalAt(BG_PLTT_ID(7));
LoadMessageBoxGfx(0, 0x30, BG_PLTT_ID(7));
gPlttBufferUnfaded[BG_PLTT_ID(7) + 6] = 0;
CpuCopy16(&gPlttBufferUnfaded[BG_PLTT_ID(7) + 6], &gPlttBufferFaded[BG_PLTT_ID(7) + 6], PLTT_SIZEOF(1));
}
}
@ -762,25 +762,25 @@ void DrawMainBattleBackground(void)
{
LZDecompressVram(gBattleTerrainTiles_Building, (void *)(BG_CHAR_ADDR(2)));
LZDecompressVram(gBattleTerrainTilemap_Building, (void *)(BG_SCREEN_ADDR(26)));
LoadCompressedPalette(gBattleTerrainPalette_Frontier, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_Frontier, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
}
else if (gBattleTypeFlags & BATTLE_TYPE_GROUDON)
{
LZDecompressVram(gBattleTerrainTiles_Cave, (void *)(BG_CHAR_ADDR(2)));
LZDecompressVram(gBattleTerrainTilemap_Cave, (void *)(BG_SCREEN_ADDR(26)));
LoadCompressedPalette(gBattleTerrainPalette_Groudon, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_Groudon, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
}
else if (gBattleTypeFlags & BATTLE_TYPE_KYOGRE)
{
LZDecompressVram(gBattleTerrainTiles_Water, (void *)(BG_CHAR_ADDR(2)));
LZDecompressVram(gBattleTerrainTilemap_Water, (void *)(BG_SCREEN_ADDR(26)));
LoadCompressedPalette(gBattleTerrainPalette_Kyogre, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_Kyogre, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
}
else if (gBattleTypeFlags & BATTLE_TYPE_RAYQUAZA)
{
LZDecompressVram(gBattleTerrainTiles_Rayquaza, (void *)(BG_CHAR_ADDR(2)));
LZDecompressVram(gBattleTerrainTilemap_Rayquaza, (void *)(BG_SCREEN_ADDR(26)));
LoadCompressedPalette(gBattleTerrainPalette_Rayquaza, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_Rayquaza, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
}
else
{
@ -791,14 +791,14 @@ void DrawMainBattleBackground(void)
{
LZDecompressVram(gBattleTerrainTiles_Building, (void *)(BG_CHAR_ADDR(2)));
LZDecompressVram(gBattleTerrainTilemap_Building, (void *)(BG_SCREEN_ADDR(26)));
LoadCompressedPalette(gBattleTerrainPalette_BuildingLeader, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_BuildingLeader, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
return;
}
else if (trainerClass == TRAINER_CLASS_CHAMPION)
{
LZDecompressVram(gBattleTerrainTiles_Stadium, (void *)(BG_CHAR_ADDR(2)));
LZDecompressVram(gBattleTerrainTilemap_Stadium, (void *)(BG_SCREEN_ADDR(26)));
LoadCompressedPalette(gBattleTerrainPalette_StadiumWallace, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_StadiumWallace, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
return;
}
}
@ -809,47 +809,47 @@ void DrawMainBattleBackground(void)
case MAP_BATTLE_SCENE_NORMAL:
LZDecompressVram(sBattleTerrainTable[gBattleTerrain].tileset, (void *)(BG_CHAR_ADDR(2)));
LZDecompressVram(sBattleTerrainTable[gBattleTerrain].tilemap, (void *)(BG_SCREEN_ADDR(26)));
LoadCompressedPalette(sBattleTerrainTable[gBattleTerrain].palette, 0x20, 0x60);
LoadCompressedPalette(sBattleTerrainTable[gBattleTerrain].palette, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
case MAP_BATTLE_SCENE_GYM:
LZDecompressVram(gBattleTerrainTiles_Building, (void *)(BG_CHAR_ADDR(2)));
LZDecompressVram(gBattleTerrainTilemap_Building, (void *)(BG_SCREEN_ADDR(26)));
LoadCompressedPalette(gBattleTerrainPalette_BuildingGym, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_BuildingGym, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
case MAP_BATTLE_SCENE_MAGMA:
LZDecompressVram(gBattleTerrainTiles_Stadium, (void *)(BG_CHAR_ADDR(2)));
LZDecompressVram(gBattleTerrainTilemap_Stadium, (void *)(BG_SCREEN_ADDR(26)));
LoadCompressedPalette(gBattleTerrainPalette_StadiumMagma, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_StadiumMagma, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
case MAP_BATTLE_SCENE_AQUA:
LZDecompressVram(gBattleTerrainTiles_Stadium, (void *)(BG_CHAR_ADDR(2)));
LZDecompressVram(gBattleTerrainTilemap_Stadium, (void *)(BG_SCREEN_ADDR(26)));
LoadCompressedPalette(gBattleTerrainPalette_StadiumAqua, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_StadiumAqua, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
case MAP_BATTLE_SCENE_SIDNEY:
LZDecompressVram(gBattleTerrainTiles_Stadium, (void *)(BG_CHAR_ADDR(2)));
LZDecompressVram(gBattleTerrainTilemap_Stadium, (void *)(BG_SCREEN_ADDR(26)));
LoadCompressedPalette(gBattleTerrainPalette_StadiumSidney, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_StadiumSidney, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
case MAP_BATTLE_SCENE_PHOEBE:
LZDecompressVram(gBattleTerrainTiles_Stadium, (void *)(BG_CHAR_ADDR(2)));
LZDecompressVram(gBattleTerrainTilemap_Stadium, (void *)(BG_SCREEN_ADDR(26)));
LoadCompressedPalette(gBattleTerrainPalette_StadiumPhoebe, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_StadiumPhoebe, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
case MAP_BATTLE_SCENE_GLACIA:
LZDecompressVram(gBattleTerrainTiles_Stadium, (void *)(BG_CHAR_ADDR(2)));
LZDecompressVram(gBattleTerrainTilemap_Stadium, (void *)(BG_SCREEN_ADDR(26)));
LoadCompressedPalette(gBattleTerrainPalette_StadiumGlacia, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_StadiumGlacia, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
case MAP_BATTLE_SCENE_DRAKE:
LZDecompressVram(gBattleTerrainTiles_Stadium, (void *)(BG_CHAR_ADDR(2)));
LZDecompressVram(gBattleTerrainTilemap_Stadium, (void *)(BG_SCREEN_ADDR(26)));
LoadCompressedPalette(gBattleTerrainPalette_StadiumDrake, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_StadiumDrake, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
case MAP_BATTLE_SCENE_FRONTIER:
LZDecompressVram(gBattleTerrainTiles_Building, (void *)(BG_CHAR_ADDR(2)));
LZDecompressVram(gBattleTerrainTilemap_Building, (void *)(BG_SCREEN_ADDR(26)));
LoadCompressedPalette(gBattleTerrainPalette_Frontier, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_Frontier, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
}
}
@ -860,7 +860,7 @@ void LoadBattleTextboxAndBackground(void)
LZDecompressVram(gBattleTextboxTiles, (void *)(BG_CHAR_ADDR(0)));
CopyToBgTilemapBuffer(0, gBattleTextboxTilemap, 0, 0);
CopyBgTilemapBufferToVram(0);
LoadCompressedPalette(gBattleTextboxPalette, 0, 0x40);
LoadCompressedPalette(gBattleTextboxPalette, BG_PLTT_ID(0), 2 * PLTT_SIZE_4BPP);
LoadBattleMenuWindowGfx();
DrawMainBattleBackground();
}
@ -1126,7 +1126,7 @@ void DrawBattleEntryBackground(void)
{
LZDecompressVram(gBattleVSFrame_Gfx, (void *)(BG_CHAR_ADDR(1)));
LZDecompressVram(gVsLettersGfx, (void *)OBJ_VRAM0);
LoadCompressedPalette(gBattleVSFrame_Pal, 0x60, 0x20);
LoadCompressedPalette(gBattleVSFrame_Pal, BG_PLTT_ID(6), PLTT_SIZE_4BPP);
SetBgAttribute(1, BG_ATTR_SCREENSIZE, 1);
SetGpuReg(REG_OFFSET_BG1CNT, 0x5C04);
CopyToBgTilemapBuffer(1, gBattleVSFrame_Tilemap, 0, 0);
@ -1219,7 +1219,7 @@ bool8 LoadChosenBattleElement(u8 caseId)
CopyBgTilemapBufferToVram(0);
break;
case 2:
LoadCompressedPalette(gBattleTextboxPalette, 0, 0x40);
LoadCompressedPalette(gBattleTextboxPalette, BG_PLTT_ID(0), 2 * PLTT_SIZE_4BPP);
break;
case 3:
if (gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_EREADER_TRAINER))
@ -1345,14 +1345,14 @@ bool8 LoadChosenBattleElement(u8 caseId)
case 5:
if (gBattleTypeFlags & (BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_EREADER_TRAINER))
{
LoadCompressedPalette(gBattleTerrainPalette_Frontier, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_Frontier, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
}
else if (gBattleTypeFlags & BATTLE_TYPE_KYOGRE_GROUDON)
{
if (gGameVersion == VERSION_RUBY)
LoadCompressedPalette(gBattleTerrainPalette_Groudon, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_Groudon, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
else
LoadCompressedPalette(gBattleTerrainPalette_Kyogre, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_Kyogre, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
}
else
{
@ -1361,12 +1361,12 @@ bool8 LoadChosenBattleElement(u8 caseId)
u8 trainerClass = gTrainers[gTrainerBattleOpponent_A].trainerClass;
if (trainerClass == TRAINER_CLASS_LEADER)
{
LoadCompressedPalette(gBattleTerrainPalette_BuildingLeader, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_BuildingLeader, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
}
else if (trainerClass == TRAINER_CLASS_CHAMPION)
{
LoadCompressedPalette(gBattleTerrainPalette_StadiumWallace, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_StadiumWallace, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
}
}
@ -1375,31 +1375,31 @@ bool8 LoadChosenBattleElement(u8 caseId)
{
default:
case MAP_BATTLE_SCENE_NORMAL:
LoadCompressedPalette(sBattleTerrainTable[gBattleTerrain].palette, 0x20, 0x60);
LoadCompressedPalette(sBattleTerrainTable[gBattleTerrain].palette, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
case MAP_BATTLE_SCENE_GYM:
LoadCompressedPalette(gBattleTerrainPalette_BuildingGym, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_BuildingGym, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
case MAP_BATTLE_SCENE_MAGMA:
LoadCompressedPalette(gBattleTerrainPalette_StadiumMagma, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_StadiumMagma, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
case MAP_BATTLE_SCENE_AQUA:
LoadCompressedPalette(gBattleTerrainPalette_StadiumAqua, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_StadiumAqua, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
case MAP_BATTLE_SCENE_SIDNEY:
LoadCompressedPalette(gBattleTerrainPalette_StadiumSidney, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_StadiumSidney, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
case MAP_BATTLE_SCENE_PHOEBE:
LoadCompressedPalette(gBattleTerrainPalette_StadiumPhoebe, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_StadiumPhoebe, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
case MAP_BATTLE_SCENE_GLACIA:
LoadCompressedPalette(gBattleTerrainPalette_StadiumGlacia, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_StadiumGlacia, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
case MAP_BATTLE_SCENE_DRAKE:
LoadCompressedPalette(gBattleTerrainPalette_StadiumDrake, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_StadiumDrake, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
case MAP_BATTLE_SCENE_FRONTIER:
LoadCompressedPalette(gBattleTerrainPalette_Frontier, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_Frontier, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
break;
}
}

View File

@ -1558,7 +1558,7 @@ static void LinkPartnerHandleIntroTrainerBallThrow(void)
trainerPicId = gLinkPlayers[GetBattlerMultiplayerId(gActiveBattler)].gender;
}
LoadCompressedPalette(gTrainerBackPicPaletteTable[trainerPicId].data, 0x100 + paletteNum * 16, 32);
LoadCompressedPalette(gTrainerBackPicPaletteTable[trainerPicId].data, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP);
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum;

View File

@ -2960,7 +2960,7 @@ static void PlayerHandleIntroTrainerBallThrow(void)
StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1);
paletteNum = AllocSpritePalette(0xD6F8);
LoadCompressedPalette(gTrainerBackPicPaletteTable[gSaveBlock2Ptr->playerGender].data, 0x100 + paletteNum * 16, 32);
LoadCompressedPalette(gTrainerBackPicPaletteTable[gSaveBlock2Ptr->playerGender].data, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP);
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum;
taskId = CreateTask(Task_StartSendOutAnim, 5);

View File

@ -1794,12 +1794,12 @@ static void PlayerPartnerHandleIntroTrainerBallThrow(void)
if (gPartnerTrainerId == TRAINER_STEVEN_PARTNER)
{
u8 spriteId = TRAINER_BACK_PIC_STEVEN;
LoadCompressedPalette(gTrainerBackPicPaletteTable[spriteId].data, 0x100 + paletteNum * 16, 32);
LoadCompressedPalette(gTrainerBackPicPaletteTable[spriteId].data, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP);
}
else
{
u8 spriteId = GetFrontierTrainerFrontSpriteId(gPartnerTrainerId);
LoadCompressedPalette(gTrainerFrontPicPaletteTable[spriteId].data, 0x100 + paletteNum * 16, 32);
LoadCompressedPalette(gTrainerFrontPicPaletteTable[spriteId].data, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP);
}

View File

@ -1678,7 +1678,7 @@ static void RecordedPlayerHandleIntroTrainerBallThrow(void)
else
trainerPicId = gSaveBlock2Ptr->playerGender;
LoadCompressedPalette(gTrainerBackPicPaletteTable[trainerPicId].data, 0x100 + paletteNum * 16, 32);
LoadCompressedPalette(gTrainerBackPicPaletteTable[trainerPicId].data, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP);
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum;

View File

@ -1445,7 +1445,7 @@ static void WallyHandleIntroTrainerBallThrow(void)
StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1);
paletteNum = AllocSpritePalette(0xD6F8);
LoadCompressedPalette(gTrainerBackPicPaletteTable[TRAINER_BACK_PIC_WALLY].data, 0x100 + paletteNum * 16, 32);
LoadCompressedPalette(gTrainerBackPicPaletteTable[TRAINER_BACK_PIC_WALLY].data, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP);
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum;
taskId = CreateTask(Task_StartSendOutAnim, 5);

View File

@ -3048,12 +3048,12 @@ static void Task_ShowTourneyInfoCard(u8 taskId)
DecompressAndLoadBgGfxUsingHeap(2, gDomeTourneyInfoCard_Tilemap, 0x2000, 0, 1);
DecompressAndLoadBgGfxUsingHeap(3, gDomeTourneyInfoCardBg_Tilemap, 0x800, 0, 1);
LoadCompressedSpriteSheet(sTourneyTreeButtonsSpriteSheet);
LoadCompressedPalette(gDomeTourneyTree_Pal, 0, 0x200);
LoadCompressedPalette(gDomeTourneyTreeButtons_Pal, 0x100, 0x200);
LoadCompressedPalette(gBattleWindowTextPalette, 0xF0, 0x20);
LoadCompressedPalette(gDomeTourneyTree_Pal, BG_PLTT_OFFSET, BG_PLTT_SIZE);
LoadCompressedPalette(gDomeTourneyTreeButtons_Pal, OBJ_PLTT_OFFSET, OBJ_PLTT_SIZE);
LoadCompressedPalette(gBattleWindowTextPalette, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
if (mode == INFOCARD_MATCH)
LoadCompressedPalette(gDomeTourneyMatchCardBg_Pal, 0x50, 0x20); // Changes the moving info card bg to orange when in match card mode
CpuFill32(0, gPlttBufferFaded, 0x400);
LoadCompressedPalette(gDomeTourneyMatchCardBg_Pal, BG_PLTT_ID(5), PLTT_SIZE_4BPP); // Changes the moving info card bg to orange when in match card mode
CpuFill32(0, gPlttBufferFaded, PLTT_SIZE);
ShowBg(0);
ShowBg(1);
ShowBg(2);
@ -5327,10 +5327,10 @@ static void Task_ShowTourneyTree(u8 taskId)
DecompressAndLoadBgGfxUsingHeap(2, gDomeTourneyLine_Gfx, 0x2000, 0, 0);
DecompressAndLoadBgGfxUsingHeap(2, gDomeTourneyLineDown_Tilemap, 0x2000, 0, 1);
DecompressAndLoadBgGfxUsingHeap(3, gDomeTourneyLineUp_Tilemap, 0x2000, 0, 1);
LoadCompressedPalette(gDomeTourneyTree_Pal, 0, 0x200);
LoadCompressedPalette(gDomeTourneyTreeButtons_Pal, 0x100, 0x200);
LoadCompressedPalette(gBattleWindowTextPalette, 0xF0, 0x20);
CpuFill32(0, gPlttBufferFaded, 0x400);
LoadCompressedPalette(gDomeTourneyTree_Pal, BG_PLTT_OFFSET, BG_PLTT_SIZE);
LoadCompressedPalette(gDomeTourneyTreeButtons_Pal, OBJ_PLTT_OFFSET, OBJ_PLTT_SIZE);
LoadCompressedPalette(gBattleWindowTextPalette, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
CpuFill32(0, gPlttBufferFaded, PLTT_SIZE);
ShowBg(0);
ShowBg(1);
ShowBg(2);

View File

@ -1175,16 +1175,16 @@ static void CB2_InitSelectScreen(void)
LoadBgTiles(3, sSelectMonPicBgTilesetBuffer, 0x60, 0);
CpuCopy16(gFrontierFactorySelectMenu_Tilemap, sSelectMenuTilemapBuffer, BG_SCREEN_SIZE);
LoadBgTilemap(1, sSelectMenuTilemapBuffer, BG_SCREEN_SIZE, 0);
LoadPalette(gFrontierFactorySelectMenu_Pal, 0, 0x40);
LoadPalette(sSelectText_Pal, 0xF0, 8);
LoadPalette(sSelectText_Pal, 0xE0, 10);
LoadPalette(gFrontierFactorySelectMenu_Pal, 0, 2 * PLTT_SIZE_4BPP);
LoadPalette(sSelectText_Pal, BG_PLTT_ID(15), PLTT_SIZEOF(4));
LoadPalette(sSelectText_Pal, BG_PLTT_ID(14), PLTT_SIZEOF(5));
#ifdef UBFIX
if (sFactorySelectScreen && sFactorySelectScreen->fromSummaryScreen)
#else
if (sFactorySelectScreen->fromSummaryScreen == TRUE)
#endif
gPlttBufferUnfaded[228] = sFactorySelectScreen->speciesNameColorBackup;
LoadPalette(sMonPicBg_Pal, 0x20, 4);
LoadPalette(sMonPicBg_Pal, BG_PLTT_ID(2), PLTT_SIZEOF(2));
gMain.state++;
break;
case 3:
@ -2748,7 +2748,7 @@ static void Swap_Task_FadeOutSpeciesName(u8 taskId)
gTasks[taskId].tState++;
break;
case 1:
LoadPalette(&gPlttBufferUnfaded[0xF0], 0xE0, 0xA);
LoadPalette(&gPlttBufferUnfaded[BG_PLTT_ID(15)], BG_PLTT_ID(14), PLTT_SIZEOF(5));
gTasks[taskId].tState++;
break;
case 2:
@ -2994,7 +2994,7 @@ static void Swap_Task_ScreenInfoTransitionOut(u8 taskId)
switch (gTasks[taskId].tState)
{
case 0:
LoadPalette(sSwapText_Pal, 0xE0, sizeof(sSwapText_Pal));
LoadPalette(sSwapText_Pal, BG_PLTT_ID(14), sizeof(sSwapText_Pal));
Swap_PrintActionStrings();
PutWindowTilemap(SWAP_WIN_ACTION_FADE);
gTasks[taskId].tState++;
@ -3309,10 +3309,10 @@ static void CB2_InitSwapScreen(void)
LoadBgTiles(3, sSwapMonPicBgTilesetBuffer, 0x60, 0);
CpuCopy16(gFrontierFactorySelectMenu_Tilemap, sSwapMenuTilemapBuffer, BG_SCREEN_SIZE);
LoadBgTilemap(1, sSwapMenuTilemapBuffer, BG_SCREEN_SIZE, 0);
LoadPalette(gFrontierFactorySelectMenu_Pal, 0, 0x40);
LoadPalette(sSwapText_Pal, 0xF0, sizeof(sSwapText_Pal));
LoadPalette(sSwapText_Pal, 0xE0, sizeof(sSwapText_Pal));
LoadPalette(sMonPicBg_Pal, 0x20, 4);
LoadPalette(gFrontierFactorySelectMenu_Pal, 0, 2 * PLTT_SIZE_4BPP);
LoadPalette(sSwapText_Pal, BG_PLTT_ID(15), sizeof(sSwapText_Pal));
LoadPalette(sSwapText_Pal, BG_PLTT_ID(14), sizeof(sSwapText_Pal));
LoadPalette(sMonPicBg_Pal, BG_PLTT_ID(2), PLTT_SIZEOF(2));
gMain.state++;
break;
case 3:
@ -3867,7 +3867,7 @@ static void Swap_PrintMonSpeciesAtFade(void)
pal[4] = gPlttBufferFaded[228];
else
pal[4] = sFactorySwapScreen->speciesNameColorBackup;
LoadPalette(pal, 0xF0, sizeof(sSwapText_Pal));
LoadPalette(pal, BG_PLTT_ID(15), sizeof(sSwapText_Pal));
PutWindowTilemap(SWAP_WIN_SPECIES_AT_FADE);
FillWindowPixelBuffer(SWAP_WIN_SPECIES_AT_FADE, PIXEL_FILL(0));
@ -3895,8 +3895,8 @@ static void Swap_PrintMonSpeciesForTransition(void)
u16 species;
u8 x;
LoadPalette(sSwapText_Pal, 0xE0, sizeof(sSwapText_Pal));
CpuCopy16(&gPlttBufferUnfaded[240], &gPlttBufferFaded[224], 10);
LoadPalette(sSwapText_Pal, BG_PLTT_ID(14), sizeof(sSwapText_Pal));
CpuCopy16(&gPlttBufferUnfaded[BG_PLTT_ID(15)], &gPlttBufferFaded[BG_PLTT_ID(14)], PLTT_SIZEOF(5));
if (sFactorySwapScreen->cursorPos >= FRONTIER_PARTY_SIZE)
{

View File

@ -576,7 +576,7 @@ void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
gMonSpritesGfxPtr->sprites.ptr[position],
species, currentPersonality);
paletteOffset = 0x100 + battlerId * 16;
paletteOffset = OBJ_PLTT_ID(battlerId);
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies == SPECIES_NONE)
lzPaletteData = GetMonFrontSpritePal(mon);
@ -584,21 +584,21 @@ void BattleLoadOpponentMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(species, otId, monsPersonality);
LZDecompressWram(lzPaletteData, gDecompressionBuffer);
LoadPalette(gDecompressionBuffer, paletteOffset, 0x20);
LoadPalette(gDecompressionBuffer, 0x80 + battlerId * 16, 0x20);
LoadPalette(gDecompressionBuffer, paletteOffset, PLTT_SIZE_4BPP);
LoadPalette(gDecompressionBuffer, BG_PLTT_ID(8) + BG_PLTT_ID(battlerId), PLTT_SIZE_4BPP);
if (species == SPECIES_CASTFORM)
{
paletteOffset = 0x100 + battlerId * 16;
paletteOffset = OBJ_PLTT_ID(battlerId);
LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette);
LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerId]], paletteOffset, 0x20);
LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerId]], paletteOffset, PLTT_SIZE_4BPP);
}
// transform's pink color
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE)
{
BlendPalette(paletteOffset, 16, 6, RGB_WHITE);
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32);
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, PLTT_SIZEOF(16));
}
}
@ -639,7 +639,7 @@ void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
species, currentPersonality);
}
paletteOffset = 0x100 + battlerId * 16;
paletteOffset = OBJ_PLTT_ID(battlerId);
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies == SPECIES_NONE)
lzPaletteData = GetMonFrontSpritePal(mon);
@ -647,21 +647,21 @@ void BattleLoadPlayerMonSpriteGfx(struct Pokemon *mon, u8 battlerId)
lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(species, otId, monsPersonality);
LZDecompressWram(lzPaletteData, gDecompressionBuffer);
LoadPalette(gDecompressionBuffer, paletteOffset, 0x20);
LoadPalette(gDecompressionBuffer, 0x80 + battlerId * 16, 0x20);
LoadPalette(gDecompressionBuffer, paletteOffset, PLTT_SIZE_4BPP);
LoadPalette(gDecompressionBuffer, BG_PLTT_ID(8) + BG_PLTT_ID(battlerId), PLTT_SIZE_4BPP);
if (species == SPECIES_CASTFORM)
{
paletteOffset = 0x100 + battlerId * 16;
paletteOffset = OBJ_PLTT_ID(battlerId);
LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette);
LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerId]], paletteOffset, 0x20);
LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerId]], paletteOffset, PLTT_SIZE_4BPP);
}
// transform's pink color
if (gBattleSpritesDataPtr->battlerData[battlerId].transformSpecies != SPECIES_NONE)
{
BlendPalette(paletteOffset, 16, 6, RGB_WHITE);
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32);
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, PLTT_SIZEOF(16));
}
}
@ -690,7 +690,7 @@ void DecompressTrainerBackPic(u16 backPicId, u8 battlerId)
gMonSpritesGfxPtr->sprites.ptr[position],
SPECIES_NONE);
LoadCompressedPalette(gTrainerBackPicPaletteTable[backPicId].data,
0x100 + 16 * battlerId, 0x20);
OBJ_PLTT_ID(battlerId), PLTT_SIZE_4BPP);
}
void BattleGfxSfxDummy3(u8 gender)
@ -903,13 +903,13 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 castform)
if (castform)
{
StartSpriteAnim(&gSprites[gBattlerSpriteIds[battlerAtk]], gBattleSpritesDataPtr->animationData->animArg);
paletteOffset = 0x100 + battlerAtk * 16;
LoadPalette(gBattleStruct->castformPalette[gBattleSpritesDataPtr->animationData->animArg], paletteOffset, 32);
paletteOffset = OBJ_PLTT_ID(battlerAtk);
LoadPalette(gBattleStruct->castformPalette[gBattleSpritesDataPtr->animationData->animArg], paletteOffset, PLTT_SIZE_4BPP);
gBattleMonForms[battlerAtk] = gBattleSpritesDataPtr->animationData->animArg;
if (gBattleSpritesDataPtr->battlerData[battlerAtk].transformSpecies != SPECIES_NONE)
{
BlendPalette(paletteOffset, 16, 6, RGB_WHITE);
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32);
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, PLTT_SIZEOF(16));
}
gSprites[gBattlerSpriteIds[battlerAtk]].y = GetBattlerSpriteDefault_Y(battlerAtk);
}
@ -965,20 +965,20 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 castform)
src = gMonSpritesGfxPtr->sprites.ptr[position];
dst = (void *)(OBJ_VRAM0 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32);
DmaCopy32(3, src, dst, MON_PIC_SIZE);
paletteOffset = 0x100 + battlerAtk * 16;
paletteOffset = OBJ_PLTT_ID(battlerAtk);
lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(targetSpecies, otId, personalityValue);
LZDecompressWram(lzPaletteData, gDecompressionBuffer);
LoadPalette(gDecompressionBuffer, paletteOffset, 32);
LoadPalette(gDecompressionBuffer, paletteOffset, PLTT_SIZE_4BPP);
if (targetSpecies == SPECIES_CASTFORM)
{
gSprites[gBattlerSpriteIds[battlerAtk]].anims = gMonFrontAnimsPtrTable[targetSpecies];
LZDecompressWram(lzPaletteData, gBattleStruct->castformPalette);
LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerDef]], paletteOffset, 32);
LoadPalette(gBattleStruct->castformPalette[gBattleMonForms[battlerDef]], paletteOffset, PLTT_SIZE_4BPP);
}
BlendPalette(paletteOffset, 16, 6, RGB_WHITE);
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, 32);
CpuCopy32(gPlttBufferFaded + paletteOffset, gPlttBufferUnfaded + paletteOffset, PLTT_SIZEOF(16));
if (!IsContest())
{
@ -1014,8 +1014,8 @@ void BattleLoadSubstituteOrMonSpriteGfx(u8 battlerId, bool8 loadMonSprite)
Dma3CopyLarge32_(gMonSpritesGfxPtr->sprites.ptr[position], &gMonSpritesGfxPtr->sprites.byte[position][MON_PIC_SIZE * i], MON_PIC_SIZE);
}
palOffset = (battlerId * 16) + 0x100;
LoadCompressedPalette(gSubstituteDollPal, palOffset, 32);
palOffset = OBJ_PLTT_ID(battlerId);
LoadCompressedPalette(gSubstituteDollPal, palOffset, PLTT_SIZE_4BPP);
}
else
{

View File

@ -2055,11 +2055,11 @@ static void UpdateStatusIconInHealthbox(u8 healthboxSpriteId)
return;
}
pltAdder = gSprites[healthboxSpriteId].oam.paletteNum * 16;
pltAdder = PLTT_ID(gSprites[healthboxSpriteId].oam.paletteNum);
pltAdder += battlerId + 12;
FillPalette(sStatusIconColors[statusPalId], pltAdder + 0x100, 2);
CpuCopy16(gPlttBufferUnfaded + 0x100 + pltAdder, (void *)(OBJ_PLTT + pltAdder * 2), 2);
FillPalette(sStatusIconColors[statusPalId], OBJ_PLTT_OFFSET + 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

@ -2214,7 +2214,7 @@ void CB2_InitEndLinkBattle(void)
gBattle_BG3_Y = 0;
InitBattleBgsVideo();
LoadCompressedPalette(gBattleTextboxPalette, 0, 64);
LoadCompressedPalette(gBattleTextboxPalette, BG_PLTT_ID(0), 2 * PLTT_SIZE_4BPP);
LoadBattleMenuWindowGfx();
ResetSpriteData();
ResetTasks();

View File

@ -578,7 +578,7 @@ static bool8 LoadPyramidBagGfx(void)
}
break;
case 2:
LoadCompressedPalette(gBattlePyramidBagInterface_Pal, 0, 32);
LoadCompressedPalette(gBattlePyramidBagInterface_Pal, BG_PLTT_ID(0), PLTT_SIZE_4BPP);
gPyramidBagMenu->state++;
break;
case 3:
@ -1439,9 +1439,9 @@ static void InitPyramidBagWindows(void)
InitWindows(sWindowTemplates);
DeactivateAllTextPrinters();
LoadUserWindowBorderGfx(0, 0x1, 0xE0);
LoadMessageBoxGfx(0, 0xA, 0xD0);
LoadPalette(gStandardMenuPalette, 0xF0, 0x20);
LoadUserWindowBorderGfx(0, 0x1, BG_PLTT_ID(14));
LoadMessageBoxGfx(0, 0xA, BG_PLTT_ID(13));
LoadPalette(gStandardMenuPalette, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
for (i = 0; i < ARRAY_COUNT(sWindowTemplates); i++)
FillWindowPixelBuffer(i, PIXEL_FILL(0));
@ -1537,10 +1537,10 @@ static void FreeItemIconSprite(u8 spriteArrId)
static void LoadPyramidBagPalette(void)
{
struct SpritePalette spritePalette;
u16 *palPtr = Alloc(0x40);
u16 *palPtr = Alloc(2 * PLTT_SIZE_4BPP);
LZDecompressWram(gBattlePyramidBag_Pal, palPtr);
spritePalette.data = palPtr + (gSaveBlock2Ptr->frontier.lvlMode * 16);
spritePalette.data = palPtr + PLTT_ID(gSaveBlock2Ptr->frontier.lvlMode);
spritePalette.tag = TAG_PYRAMID_BAG;
LoadSpritePalette(&spritePalette);
Free(palPtr);

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, 0, 0x20);
LoadPalette(sTrainerHillWindowPalette, BG_PLTT_ID(0), PLTT_SIZE_4BPP);
}
static void VblankCB_TrainerHillRecords(void)
@ -491,7 +491,7 @@ static void CB2_ShowTrainerHillRecords(void)
break;
case 3:
LoadTrainerHillRecordsWindowGfx(3);
LoadPalette(GetTextWindowPalette(0), 0xF0, 0x20);
LoadPalette(GetTextWindowPalette(0), BG_PLTT_ID(15), PLTT_SIZE_4BPP);
gMain.state++;
break;
case 4:

View File

@ -6013,7 +6013,7 @@ static void InitLevelUpBanner(void)
gBattle_BG2_Y = 0;
gBattle_BG2_X = LEVEL_UP_BANNER_START;
LoadPalette(sLevelUpBanner_Pal, 0x60, 0x20);
LoadPalette(sLevelUpBanner_Pal, BG_PLTT_ID(6), PLTT_SIZE_4BPP);
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

@ -1406,7 +1406,7 @@ static bool8 Aqua_Init(struct Task *task)
GetBg0TilesDst(&tilemap, &tileset);
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
LZ77UnCompVram(sTeamAqua_Tileset, tileset);
LoadPalette(sEvilTeam_Palette, 0xF0, sizeof(sEvilTeam_Palette));
LoadPalette(sEvilTeam_Palette, BG_PLTT_ID(15), sizeof(sEvilTeam_Palette));
task->tState++;
return FALSE;
@ -1421,7 +1421,7 @@ static bool8 Magma_Init(struct Task *task)
GetBg0TilesDst(&tilemap, &tileset);
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
LZ77UnCompVram(sTeamMagma_Tileset, tileset);
LoadPalette(sEvilTeam_Palette, 0xF0, sizeof(sEvilTeam_Palette));
LoadPalette(sEvilTeam_Palette, BG_PLTT_ID(15), sizeof(sEvilTeam_Palette));
task->tState++;
return FALSE;
@ -1449,7 +1449,7 @@ static bool8 BigPokeball_Init(struct Task *task)
GetBg0TilesDst(&tilemap, &tileset);
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
CpuCopy16(sBigPokeball_Tileset, tileset, sizeof(sBigPokeball_Tileset));
LoadPalette(sFieldEffectPal_Pokeball, 0xF0, sizeof(sFieldEffectPal_Pokeball));
LoadPalette(sFieldEffectPal_Pokeball, BG_PLTT_ID(15), sizeof(sFieldEffectPal_Pokeball));
task->tState++;
return FALSE;
@ -1504,7 +1504,7 @@ static bool8 Regice_SetGfx(struct Task *task)
u16 *tilemap, *tileset;
GetBg0TilesDst(&tilemap, &tileset);
LoadPalette(sRegice_Palette, 0xF0, sizeof(sRegice_Palette));
LoadPalette(sRegice_Palette, BG_PLTT_ID(15), sizeof(sRegice_Palette));
CpuCopy16(sRegice_Tilemap, tilemap, 0x500);
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
@ -1517,7 +1517,7 @@ static bool8 Registeel_SetGfx(struct Task *task)
u16 *tilemap, *tileset;
GetBg0TilesDst(&tilemap, &tileset);
LoadPalette(sRegisteel_Palette, 0xF0, sizeof(sRegisteel_Palette));
LoadPalette(sRegisteel_Palette, BG_PLTT_ID(15), sizeof(sRegisteel_Palette));
CpuCopy16(sRegisteel_Tilemap, tilemap, 0x500);
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
@ -1530,7 +1530,7 @@ static bool8 Regirock_SetGfx(struct Task *task)
u16 *tilemap, *tileset;
GetBg0TilesDst(&tilemap, &tileset);
LoadPalette(sRegirock_Palette, 0xF0, sizeof(sRegirock_Palette));
LoadPalette(sRegirock_Palette, BG_PLTT_ID(15), sizeof(sRegirock_Palette));
CpuCopy16(sRegirock_Tilemap, tilemap, 0x500);
SetSinWave(gScanlineEffectRegBuffers[0], 0, task->tSinIndex, 132, task->tAmplitude, DISPLAY_HEIGHT);
@ -1559,7 +1559,7 @@ static bool8 Kyogre_PaletteFlash(struct Task *task)
{
u16 offset = task->tTimer % 30;
offset /= 3;
LoadPalette(&sKyogre1_Palette[offset * 16], 0xF0, 0x20);
LoadPalette(&sKyogre1_Palette[offset * 16], BG_PLTT_ID(15), PLTT_SIZE_4BPP);
}
if (++task->tTimer > 58)
{
@ -1575,7 +1575,7 @@ static bool8 Kyogre_PaletteBrighten(struct Task *task)
if (task->tTimer % 5 == 0)
{
s16 offset = task->tTimer / 5;
LoadPalette(&sKyogre2_Palette[offset * 16], 0xF0, 0x20);
LoadPalette(&sKyogre2_Palette[offset * 16], BG_PLTT_ID(15), PLTT_SIZE_4BPP);
}
if (++task->tTimer > 68)
{
@ -1776,7 +1776,7 @@ static bool8 PokeballsTrail_Init(struct Task *task)
GetBg0TilesDst(&tilemap, &tileset);
CpuSet(sPokeballTrail_Tileset, tileset, 0x20);
CpuFill32(0, tilemap, BG_SCREEN_SIZE);
LoadPalette(sFieldEffectPal_Pokeball, 0xF0, sizeof(sFieldEffectPal_Pokeball));
LoadPalette(sFieldEffectPal_Pokeball, BG_PLTT_ID(15), sizeof(sFieldEffectPal_Pokeball));
task->tState++;
return FALSE;
@ -2328,8 +2328,8 @@ static bool8 Mugshot_SetGfx(struct Task *task)
mugshotsMap = sMugshotsTilemap;
GetBg0TilesDst(&tilemap, &tileset);
CpuSet(sEliteFour_Tileset, tileset, 0xF0);
LoadPalette(sOpponentMugshotsPals[task->tMugshotId], 0xF0, 0x20);
LoadPalette(sPlayerMugshotsPals[gSaveBlock2Ptr->playerGender], 0xFA, 0xC);
LoadPalette(sOpponentMugshotsPals[task->tMugshotId], BG_PLTT_ID(15), PLTT_SIZE_4BPP);
LoadPalette(sPlayerMugshotsPals[gSaveBlock2Ptr->playerGender], BG_PLTT_ID(15) + 10, PLTT_SIZEOF(6));
for (i = 0; i < 20; i++)
{
@ -3193,7 +3193,7 @@ static bool8 RectangularSpiral_Init(struct Task *task)
CpuCopy16(sShrinkingBoxTileset, tileset, 0x20);
CpuCopy16(&sShrinkingBoxTileset[0x70], &tileset[0x20], 0x20);
CpuFill16(0xF0 << 8, tilemap, BG_SCREEN_SIZE);
LoadPalette(sFieldEffectPal_Pokeball, 0xF0, sizeof(sFieldEffectPal_Pokeball));
LoadPalette(sFieldEffectPal_Pokeball, BG_PLTT_ID(15), sizeof(sFieldEffectPal_Pokeball));
task->data[3] = 1;
task->tState++;
@ -3389,7 +3389,7 @@ static bool8 Groudon_PaletteFlash(struct Task *task)
if (task->tTimer % 3 == 0)
{
u16 offset = (task->tTimer % 30) / 3;
LoadPalette(&sGroudon1_Palette[offset * 16], 0xF0, 0x20);
LoadPalette(&sGroudon1_Palette[offset * 16], BG_PLTT_ID(15), PLTT_SIZE_4BPP);
}
if (++task->tTimer > 58)
{
@ -3405,7 +3405,7 @@ static bool8 Groudon_PaletteBrighten(struct Task *task)
if (task->tTimer % 5 == 0)
{
s16 offset = task->tTimer / 5;
LoadPalette(&sGroudon2_Palette[offset * 16], 0xF0, 0x20);
LoadPalette(&sGroudon2_Palette[offset * 16], BG_PLTT_ID(15), PLTT_SIZE_4BPP);
}
if (++task->tTimer > 68)
{
@ -3448,7 +3448,7 @@ static bool8 Rayquaza_Init(struct Task *task)
sTransitionData->counter = 0;
task->tState++;
LoadPalette(&sRayquaza_Palette[0x50], 0xF0, 0x20);
LoadPalette(&sRayquaza_Palette[80], BG_PLTT_ID(15), PLTT_SIZE_4BPP);
for (i = 0; i < DISPLAY_HEIGHT; i++)
{
@ -3476,7 +3476,7 @@ static bool8 Rayquaza_PaletteFlash(struct Task *task)
{
u16 value = task->tTimer / 4;
const u16 *palPtr = &sRayquaza_Palette[(value + 5) * 16];
LoadPalette(palPtr, 0xF0, 0x20);
LoadPalette(palPtr, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
}
if (++task->tTimer > 40)
{
@ -3524,7 +3524,7 @@ static bool8 Rayquaza_TriRing(struct Task *task)
{
u16 value = task->tTimer / 3;
const u16 *palPtr = &sRayquaza_Palette[(value + 0) * 16];
LoadPalette(palPtr, 0xF0, 0x20);
LoadPalette(palPtr, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
}
if (++task->tTimer >= 40)
{
@ -3775,7 +3775,7 @@ static bool8 GridSquares_Init(struct Task *task)
GetBg0TilesDst(&tilemap, &tileset);
CpuSet(sShrinkingBoxTileset, tileset, 16);
CpuFill16(0xF0 << 8, tilemap, BG_SCREEN_SIZE);
LoadPalette(sFieldEffectPal_Pokeball, 0xF0, sizeof(sFieldEffectPal_Pokeball));
LoadPalette(sFieldEffectPal_Pokeball, BG_PLTT_ID(15), sizeof(sFieldEffectPal_Pokeball));
task->tState++;
return FALSE;
@ -4242,7 +4242,7 @@ static bool8 FrontierLogoWiggle_Init(struct Task *task)
GetBg0TilesDst(&tilemap, &tileset);
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
LZ77UnCompVram(sFrontierLogo_Tileset, tileset);
LoadPalette(sFrontierLogo_Palette, 0xF0, sizeof(sFrontierLogo_Palette));
LoadPalette(sFrontierLogo_Palette, BG_PLTT_ID(15), sizeof(sFrontierLogo_Palette));
task->tState++;
return FALSE;
@ -4304,7 +4304,7 @@ static bool8 FrontierLogoWave_Init(struct Task *task)
GetBg0TilesDst(&tilemap, &tileset);
CpuFill16(0, tilemap, BG_SCREEN_SIZE);
LZ77UnCompVram(sFrontierLogo_Tileset, tileset);
LoadPalette(sFrontierLogo_Palette, 0xF0, sizeof(sFrontierLogo_Palette));
LoadPalette(sFrontierLogo_Palette, BG_PLTT_ID(15), sizeof(sFrontierLogo_Palette));
sTransitionData->cameraY = 0;
task->tState++;
@ -4454,7 +4454,7 @@ static bool8 FrontierSquares_Init(struct Task *task)
FillBgTilemapBufferRect(0, 1, 0, 0, MARGIN_SIZE, 32, 15);
FillBgTilemapBufferRect(0, 1, 30 - MARGIN_SIZE, 0, MARGIN_SIZE, 32, 15);
CopyBgTilemapBufferToVram(0);
LoadPalette(sFrontierSquares_Palette, 0xF0, sizeof(sFrontierSquares_Palette));
LoadPalette(sFrontierSquares_Palette, BG_PLTT_ID(15), sizeof(sFrontierSquares_Palette));
task->tPosX = MARGIN_SIZE;
task->tPosY = 0;
@ -4549,9 +4549,9 @@ static bool8 FrontierSquaresSpiral_Init(struct Task *task)
FillBgTilemapBufferRect(0, 1, 0, 0, MARGIN_SIZE, 32, 15);
FillBgTilemapBufferRect(0, 1, 30 - MARGIN_SIZE, 0, MARGIN_SIZE, 32, 15);
CopyBgTilemapBufferToVram(0);
LoadPalette(sFrontierSquares_Palette, 0xE0, sizeof(sFrontierSquares_Palette));
LoadPalette(sFrontierSquares_Palette, 0xF0, sizeof(sFrontierSquares_Palette));
BlendPalette(0xE0, 16, 8, RGB_BLACK);
LoadPalette(sFrontierSquares_Palette, BG_PLTT_ID(14), sizeof(sFrontierSquares_Palette));
LoadPalette(sFrontierSquares_Palette, BG_PLTT_ID(15), sizeof(sFrontierSquares_Palette));
BlendPalette(BG_PLTT_ID(14), 16, 8, RGB_BLACK);
task->tSquareNum = NUM_SQUARES - 1;
task->tFadeFlag = 0;
@ -4581,7 +4581,7 @@ static bool8 FrontierSquaresSpiral_Outward(struct Task *task)
// set it to black so it's not revealed when the squares are removed.
static bool8 FrontierSquaresSpiral_SetBlack(struct Task *task)
{
BlendPalette(0xE0, 16, 3, RGB_BLACK);
BlendPalette(BG_PLTT_ID(14), 16, 3, RGB_BLACK);
BlendPalettes(PALETTES_ALL & ~(1 << 15 | 1 << 14), 16, RGB_BLACK);
task->tSquareNum = 0;
@ -4664,7 +4664,7 @@ static bool8 FrontierSquaresScroll_Init(struct Task *task)
LZ77UnCompVram(sFrontierSquares_FilledBg_Tileset, tileset);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32);
CopyBgTilemapBufferToVram(0);
LoadPalette(sFrontierSquares_Palette, 0xF0, sizeof(sFrontierSquares_Palette));
LoadPalette(sFrontierSquares_Palette, BG_PLTT_ID(15), sizeof(sFrontierSquares_Palette));
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;

View File

@ -226,7 +226,7 @@ static void LoadLogoGfx(void)
GetBg0TilesDst(&tilemap, &tileset);
LZ77UnCompVram(sLogoCenter_Gfx, tileset);
LZ77UnCompVram(sLogoCenter_Tilemap, tilemap);
LoadPalette(sLogo_Pal, 0xF0, sizeof(sLogo_Pal));
LoadPalette(sLogo_Pal, BG_PLTT_ID(15), sizeof(sLogo_Pal));
LoadCompressedSpriteSheet(&sSpriteSheet_LogoCircles);
LoadSpritePalette(&sSpritePalette_LogoCircles);
}

View File

@ -959,7 +959,7 @@ static bool8 LoadBerryBlenderGfx(void)
case 1:
CopyToBgTilemapBuffer(2, sBlenderCenter_Tilemap, 0x400, 0);
CopyBgTilemapBufferToVram(2);
LoadPalette(sBlenderCenter_Pal, 0, 0x100);
LoadPalette(sBlenderCenter_Pal, BG_PLTT_ID(0), 8 * PLTT_SIZE_4BPP);
sBerryBlender->loadGfxState++;
break;
case 2:
@ -984,7 +984,7 @@ static bool8 LoadBerryBlenderGfx(void)
sBerryBlender->loadGfxState++;
break;
case 7:
LoadPalette(sBlenderOuter_Pal, 0x80, 0x20);
LoadPalette(sBlenderOuter_Pal, BG_PLTT_ID(8), PLTT_SIZE_4BPP);
sBerryBlender->loadGfxState++;
break;
case 8:
@ -1065,8 +1065,8 @@ static void CB2_LoadBerryBlender(void)
InitBgsFromTemplates(1, sBgTemplates, ARRAY_COUNT(sBgTemplates));
SetBgTilemapBuffer(1, sBerryBlender->tilemapBuffers[0]);
SetBgTilemapBuffer(2, sBerryBlender->tilemapBuffers[1]);
LoadUserWindowBorderGfx(0, 1, 0xD0);
LoadMessageBoxGfx(0, 0x14, 0xF0);
LoadUserWindowBorderGfx(0, 1, BG_PLTT_ID(13));
LoadMessageBoxGfx(0, 0x14, BG_PLTT_ID(15));
InitBerryBlenderWindows();
sBerryBlender->mainState++;
@ -1502,8 +1502,8 @@ static void InitBlenderBgs(void)
SetBgTilemapBuffer(1, sBerryBlender->tilemapBuffers[0]);
SetBgTilemapBuffer(2, sBerryBlender->tilemapBuffers[1]);
LoadUserWindowBorderGfx(0, 1, 0xD0);
LoadMessageBoxGfx(0, 0x14, 0xF0);
LoadUserWindowBorderGfx(0, 1, BG_PLTT_ID(13));
LoadMessageBoxGfx(0, 0x14, BG_PLTT_ID(15));
InitBerryBlenderWindows();
sBerryBlender->unk0 = 0;

View File

@ -1235,7 +1235,7 @@ static s32 ShowGameDisplay(void)
gPaletteFade.bufferTransferDisabled = TRUE;
break;
case 7:
LoadPalette(gBerryCrush_Crusher_Pal, 0, 0x180);
LoadPalette(gBerryCrush_Crusher_Pal, BG_PLTT_ID(0), 12 * PLTT_SIZE_4BPP);
CopyToBgTilemapBuffer(1, sCrusherTop_Tilemap, 0, 0);
CopyToBgTilemapBuffer(2, sContainerCap_Tilemap, 0, 0);
CopyToBgTilemapBuffer(3, sBg_Tilemap, 0, 0);
@ -1751,7 +1751,7 @@ static bool32 OpenResultsWindow(struct BerryCrushGame *game, struct BerryCrushGa
FillWindowPixelBuffer(gfx->resultsWindowId, PIXEL_FILL(0));
break;
case 2:
LoadUserWindowBorderGfx_(gfx->resultsWindowId, 541, 208);
LoadUserWindowBorderGfx_(gfx->resultsWindowId, 541, BG_PLTT_ID(13));
DrawStdFrameWithCustomTileAndPalette(gfx->resultsWindowId, FALSE, 541, 13);
break;
case 3:
@ -1809,7 +1809,7 @@ static void Task_ShowRankings(u8 taskId)
tWindowId = AddWindow(&sWindowTemplate_Rankings);
PutWindowTilemap(tWindowId);
FillWindowPixelBuffer(tWindowId, PIXEL_FILL(0));
LoadUserWindowBorderGfx_(tWindowId, 541, 208);
LoadUserWindowBorderGfx_(tWindowId, 541, BG_PLTT_ID(13));
DrawStdFrameWithCustomTileAndPalette(tWindowId, FALSE, 541, 13);
break;
case 1:

View File

@ -4,6 +4,7 @@
#include "event_data.h"
#include "load_save.h"
#include "menu.h"
#include "palette.h"
#include "string_util.h"
#include "strings.h"
#include "text.h"
@ -228,7 +229,7 @@ void DisplayBerryPowderVendorMenu(void)
sBerryPowderVendorWindowId = AddWindow(&template);
FillWindowPixelBuffer(sBerryPowderVendorWindowId, PIXEL_FILL(0));
PutWindowTilemap(sBerryPowderVendorWindowId);
LoadUserWindowBorderGfx_(sBerryPowderVendorWindowId, 0x21D, 0xD0);
LoadUserWindowBorderGfx_(sBerryPowderVendorWindowId, 0x21D, BG_PLTT_ID(13));
DrawPlayerPowderAmount(sBerryPowderVendorWindowId, 0x21D, 13, GetBerryPowder());
}

View File

@ -346,7 +346,7 @@ static bool8 LoadBerryTagGfx(void)
sBerryTag->gfxState++;
break;
case 4:
LoadCompressedPalette(gBerryCheck_Pal, 0, 0xC0);
LoadCompressedPalette(gBerryCheck_Pal, BG_PLTT_ID(0), 6 * PLTT_SIZE_4BPP);
sBerryTag->gfxState++;
break;
case 5:
@ -367,7 +367,7 @@ static void HandleInitWindows(void)
InitWindows(sWindowTemplates);
DeactivateAllTextPrinters();
LoadPalette(sFontPalette, 0xF0, 0x20);
LoadPalette(sFontPalette, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
for (i = 0; i < ARRAY_COUNT(sWindowTemplates) - 1; i++)
PutWindowTilemap(i);
ScheduleBgCopyTilemapToVram(0);

View File

@ -307,7 +307,7 @@ static void CB2_LoadCableCar(void)
case 3:
if (!FreeTempTileDataBuffersIfPossible())
{
LoadPalette(gCableCarBg_Pal, 0, 0x80);
LoadPalette(gCableCarBg_Pal, BG_PLTT_ID(0), 4 * PLTT_SIZE_4BPP);
gMain.state++;
}
break;

View File

@ -204,6 +204,6 @@ static void InitClearSaveDataScreenWindows(void)
InitWindows(sClearSaveTextWindow);
DeactivateAllTextPrinters();
FillWindowPixelBuffer(0, PIXEL_FILL(0));
LoadWindowGfx(0, 0, 2, 224);
LoadPalette(gStandardMenuPalette, 0xF0, 0x20);
LoadWindowGfx(0, 0, 2, BG_PLTT_ID(14));
LoadPalette(gStandardMenuPalette, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
}

View File

@ -736,7 +736,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
.tilemapTop = 0,
.width = 12,
.height = 2,
.paletteNum = 0xF,
.paletteNum = 15,
.baseBlock = 0x200
},
[WIN_CONTESTANT1_NAME] = {
@ -745,7 +745,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
.tilemapTop = 5,
.width = 12,
.height = 2,
.paletteNum = 0xF,
.paletteNum = 15,
.baseBlock = 0x218
},
[WIN_CONTESTANT2_NAME] = {
@ -754,7 +754,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
.tilemapTop = 10,
.width = 12,
.height = 2,
.paletteNum = 0xF,
.paletteNum = 15,
.baseBlock = 0x230
},
[WIN_CONTESTANT3_NAME] = {
@ -763,7 +763,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
.tilemapTop = 15,
.width = 12,
.height = 2,
.paletteNum = 0xF,
.paletteNum = 15,
.baseBlock = 0x248
},
[WIN_GENERAL_TEXT] = {
@ -772,7 +772,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
.tilemapTop = 15,
.width = 17,
.height = 4,
.paletteNum = 0xF,
.paletteNum = 15,
.baseBlock = 0x260
},
[WIN_MOVE0] = {
@ -781,7 +781,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
.tilemapTop = 31,
.width = 9,
.height = 2,
.paletteNum = 0xF,
.paletteNum = 15,
.baseBlock = 0x2A4
},
[WIN_MOVE1] = {
@ -790,7 +790,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
.tilemapTop = 33,
.width = 9,
.height = 2,
.paletteNum = 0xF,
.paletteNum = 15,
.baseBlock = 0x2B6
},
[WIN_MOVE2] = {
@ -799,7 +799,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
.tilemapTop = 35,
.width = 9,
.height = 2,
.paletteNum = 0xF,
.paletteNum = 15,
.baseBlock = 0x2C8
},
[WIN_MOVE3] = {
@ -808,7 +808,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
.tilemapTop = 37,
.width = 9,
.height = 2,
.paletteNum = 0xF,
.paletteNum = 15,
.baseBlock = 0x2DA
},
[WIN_SLASH] = {
@ -817,7 +817,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
.tilemapTop = 31,
.width = 1,
.height = 2,
.paletteNum = 0xF,
.paletteNum = 15,
.baseBlock = 0x2EC
},
[WIN_MOVE_DESCRIPTION] = {
@ -826,7 +826,7 @@ static const struct WindowTemplate sContestWindowTemplates[] =
.tilemapTop = 35,
.width = 18,
.height = 4,
.paletteNum = 0xF,
.paletteNum = 15,
.baseBlock = 0x2EE
},
DUMMY_WIN_TEMPLATE
@ -1035,13 +1035,13 @@ void LoadContestBgAfterMoveAnim(void)
LZDecompressVram(gContestAudienceGfx, (void *)(BG_SCREEN_ADDR(4)));
CopyToBgTilemapBuffer(3, gContestAudienceTilemap, 0, 0);
CopyBgTilemapBufferToVram(3);
LoadCompressedPalette(gContestInterfaceAudiencePalette, 0, 0x200);
LoadCompressedPalette(gContestInterfaceAudiencePalette, BG_PLTT_OFFSET, BG_PLTT_SIZE);
LoadContestPalettes();
for (i = 0; i < CONTESTANT_COUNT; i++)
{
u32 contestantWindowId = 5 + i;
LoadPalette(eContestTempSave.cachedWindowPalettes[contestantWindowId], 16 * (5 + gContestantTurnOrder[i]), sizeof((eContestTempSave.cachedWindowPalettes[contestantWindowId])));
LoadPalette(eContestTempSave.cachedWindowPalettes[contestantWindowId], BG_PLTT_ID(5 + gContestantTurnOrder[i]), sizeof((eContestTempSave.cachedWindowPalettes[contestantWindowId])));
}
}
@ -1076,11 +1076,11 @@ static void LoadContestPalettes(void)
{
s32 i;
LoadPalette(sText_Pal, 0xf0, 0x20);
FillPalette(RGB_BLACK, 0, 2);
LoadPalette(sText_Pal, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
SetBackdropFromColor(RGB_BLACK);
for (i = 10; i < 14; i++)
LoadPalette(gPlttBufferUnfaded + 241, 240 + i, 2);
FillPalette(RGB(31, 17, 31), 0xF3, 2);
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));
}
static void InitContestResources(void)
@ -1330,11 +1330,11 @@ static bool8 SetupContestGraphics(u8 *stateVar)
DmaCopy32Defvars(3, gContestResources->contestBgTilemaps[2], eContestTempSave.savedJunk, sizeof(eContestTempSave.savedJunk));
break;
case 5:
LoadCompressedPalette(gContestInterfaceAudiencePalette, 0, 0x200);
CpuCopy32(gPlttBufferUnfaded + 128, tempPalette1, 16 * sizeof(u16));
CpuCopy32(gPlttBufferUnfaded + (5 + gContestPlayerMonIndex) * 16, tempPalette2, 16 * sizeof(u16));
CpuCopy32(tempPalette2, gPlttBufferUnfaded + 128, 16 * sizeof(u16));
CpuCopy32(tempPalette1, gPlttBufferUnfaded + (5 + gContestPlayerMonIndex) * 16, 16 * sizeof(u16));
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);
DmaCopy32Defvars(3, gPlttBufferUnfaded, eContestTempSave.cachedWindowPalettes, sizeof(eContestTempSave.cachedWindowPalettes));
LoadContestPalettes();
break;
@ -3100,7 +3100,7 @@ static u8 CreateJudgeSprite(void)
u8 spriteId;
LoadCompressedSpriteSheet(&sSpriteSheet_Judge);
LoadCompressedPalette(gContest2Pal, 0x110, 32);
LoadCompressedPalette(gContest2Pal, OBJ_PLTT_ID(1), PLTT_SIZE_4BPP);
spriteId = CreateSprite(&sSpriteTemplate_Judge, 112, 36, 30);
gSprites[spriteId].oam.paletteNum = 1;
gSprites[spriteId].callback = SpriteCallbackDummy;
@ -3129,7 +3129,7 @@ static u8 CreateContestantSprite(u16 species, u32 otId, u32 personality, u32 ind
else
HandleLoadSpecialPokePic_DontHandleDeoxys(&gMonBackPicTable[species], gMonSpritesGfxPtr->sprites.ptr[B_POSITION_PLAYER_LEFT], species, personality);
LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, otId, personality), 0x120, 0x20);
LoadCompressedPalette(GetMonSpritePalFromSpeciesAndPersonality(species, otId, personality), OBJ_PLTT_ID(2), PLTT_SIZE_4BPP);
SetMultiuseSpriteTemplateToPokemon(species, B_POSITION_PLAYER_LEFT);
spriteId = CreateSprite(&gMultiuseSpriteTemplate, 0x70, GetBattlerSpriteFinal_Y(2, species, FALSE), 30);
@ -4000,7 +4000,7 @@ static void Task_StopFlashJudgeAttentionEye(u8 taskId)
{
gTasks[eContest.judgeAttentionTaskId].data[contestant * 4 + 0] = 0xFF;
gTasks[eContest.judgeAttentionTaskId].data[contestant * 4 + 1] = 0;
BlendPalette((eContest.prevTurnOrder[contestant] + 5) * 16 + 6, 2, 0, RGB(31, 31, 18));
BlendPalette(BG_PLTT_ID(5 + eContest.prevTurnOrder[contestant]) + 6, 2, 0, RGB(31, 31, 18));
DestroyTask(taskId);
}
}
@ -4024,7 +4024,7 @@ static void Task_FlashJudgeAttentionEye(u8 taskId)
|| gTasks[taskId].data[offset + 0] == 0)
gTasks[taskId].data[offset + 1] ^= 1;
BlendPalette((eContest.prevTurnOrder[i] + 5) * 16 + 6, 2, gTasks[taskId].data[offset + 0], RGB(31, 31, 18));
BlendPalette(BG_PLTT_ID(5 + eContest.prevTurnOrder[i]) + 6, 2, gTasks[taskId].data[offset + 0], RGB(31, 31, 18));
}
}
}
@ -4103,8 +4103,8 @@ static void Task_UnusedBlend(u8 taskId)
|| gTasks[taskId].data[idx] == 0)
gTasks[taskId].data[idx + 1] ^= 1;
BlendPalette((i + 5) * 16 + 10, 1, gTasks[taskId].data[idx + 0], RGB(31, 31, 18));
BlendPalette((i + 5) * 16 + 12 + i, 1, gTasks[taskId].data[idx + 0], RGB(31, 31, 18));
BlendPalette(BG_PLTT_ID(5 + i) + 10, 1, gTasks[taskId].data[idx + 0], RGB(31, 31, 18));
BlendPalette(BG_PLTT_ID(5 + i) + 12 + i, 1, gTasks[taskId].data[idx + 0], RGB(31, 31, 18));
}
}
}
@ -4417,7 +4417,7 @@ static void DrawContestantWindows(void)
for (i = 0; i < CONTESTANT_COUNT; i++)
{
s32 windowId = i + 5;
LoadPalette(eContestTempSave.cachedWindowPalettes[windowId], (gContestantTurnOrder[i] + 5) * 16, sizeof(eContestTempSave.cachedWindowPalettes[0]));
LoadPalette(eContestTempSave.cachedWindowPalettes[windowId], BG_PLTT_ID(5 + gContestantTurnOrder[i]), sizeof(eContestTempSave.cachedWindowPalettes[0]));
}
DrawContestantWindowText();
}
@ -4772,7 +4772,7 @@ static void Task_ApplauseOverflowAnimation(u8 taskId)
else
gTasks[taskId].data[4]--;
BlendPalette(264 + gTasks[taskId].data[2] * 16, 1, gTasks[taskId].data[4], RGB_WHITE);
BlendPalette(OBJ_PLTT_ID(gTasks[taskId].data[2]) + 8, 1, gTasks[taskId].data[4], RGB_WHITE);
// At the maximum or minimum blending, switch directions.
if (gTasks[taskId].data[4] == 0 || gTasks[taskId].data[4] == 16)
@ -4782,7 +4782,7 @@ static void Task_ApplauseOverflowAnimation(u8 taskId)
// Continue the animation until the applause meter is cleared.
if (eContest.applauseLevel < 5)
{
BlendPalette(264 + gTasks[taskId].data[2] * 16, 1, 0, RGB_RED);
BlendPalette(OBJ_PLTT_ID(gTasks[taskId].data[2]) + 8, 1, 0, RGB_RED);
DestroyTask(taskId);
}
}
@ -4995,8 +4995,8 @@ static void Task_BlendAudienceBackground(u8 taskId)
else
gTasks[taskId].tBlendCoeff--;
BlendPalette(17, 1, gTasks[taskId].tBlendCoeff, gTasks[taskId].tBlendColor);
BlendPalette(26, 1, gTasks[taskId].tBlendCoeff, gTasks[taskId].tBlendColor);
BlendPalette(BG_PLTT_ID(1) + 1, 1, gTasks[taskId].tBlendCoeff, gTasks[taskId].tBlendColor);
BlendPalette(BG_PLTT_ID(1) + 10, 1, gTasks[taskId].tBlendCoeff, gTasks[taskId].tBlendColor);
if (gTasks[taskId].tBlendCoeff == gTasks[taskId].tTargetBlendCoeff)
{

View File

@ -223,7 +223,7 @@ static void ShowContestPainting(void)
break;
case 4:
PrintContestPaintingCaption(gCurContestWinnerSaveIdx, gCurContestWinnerIsForArtist);
LoadPalette(sBgPalette, 0, 1 * 2);
SetBackdropFromPalette(sBgPalette);
DmaClear32(3, PLTT, PLTT_SIZE);
BeginFastPaletteFade(2);
SetVBlankCallback(VBlankCB_ContestPainting);
@ -420,7 +420,7 @@ static void LoadContestPaintingFrame(u8 contestWinnerId, bool8 isForArtist)
{
u8 x, y;
LoadPalette(sPictureFramePalettes, 0, 0x100);
LoadPalette(sPictureFramePalettes, BG_PLTT_ID(0), 8 * PLTT_SIZE_4BPP);
if (isForArtist == TRUE)
{
// Load Artist's frame
@ -586,7 +586,7 @@ static void DoContestPaintingImageProcessing(u8 imageEffect)
ApplyImageProcessingEffects(&gImageProcessingContext);
ApplyImageProcessingQuantization(&gImageProcessingContext);
ConvertImageProcessingToGBA(&gImageProcessingContext);
LoadPalette(gContestPaintingMonPalette, 0x100, 0x200);
LoadPalette(gContestPaintingMonPalette, OBJ_PLTT_ID(0), 16 * PLTT_SIZE_4BPP);
}
static void CreateContestPaintingPicture(u8 contestWinnerId, bool8 isForArtist)

View File

@ -455,8 +455,8 @@ static void LoadContestResultsBgGfx(void)
CopyToBgTilemapBuffer(2, gContestResults_Interface_Tilemap, 0, 0);
CopyToBgTilemapBuffer(0, gContestResults_WinnerBanner_Tilemap, 0, 0);
LoadContestResultsTitleBarTilemaps();
LoadCompressedPalette(gContestResults_Pal, 0, 0x200);
LoadPalette(sResultsTextWindow_Pal, 0xF0, sizeof(sResultsTextWindow_Pal));
LoadCompressedPalette(gContestResults_Pal, BG_PLTT_ID(0), 16 * PLTT_SIZE_4BPP);
LoadPalette(sResultsTextWindow_Pal, BG_PLTT_ID(15), sizeof(sResultsTextWindow_Pal));
for (i = 0; i < CONTESTANT_COUNT; i++)
{
@ -1092,9 +1092,9 @@ static void Task_FlashStarsAndHearts(u8 taskId)
else if (gTasks[taskId].tCoeff == 0)
gTasks[taskId].tDecreasing = FALSE;
BlendPalette(0x6B, 1, gTasks[taskId].tCoeff, RGB(30, 22, 11));
BlendPalette(0x68, 1, gTasks[taskId].tCoeff, RGB_WHITE);
BlendPalette(0x6E, 1, gTasks[taskId].tCoeff, RGB(30, 29, 29));
BlendPalette(BG_PLTT_ID(6) + 11, 1, gTasks[taskId].tCoeff, RGB(30, 22, 11));
BlendPalette(BG_PLTT_ID(6) + 8, 1, gTasks[taskId].tCoeff, RGB_WHITE);
BlendPalette(BG_PLTT_ID(6) + 14, 1, gTasks[taskId].tCoeff, RGB(30, 29, 29));
}
if (gTasks[taskId].tCoeff == 0)
@ -1143,7 +1143,7 @@ static void LoadAllContestMonIconPalettes(void)
for (i = 0; i < CONTESTANT_COUNT; i++)
{
species = gContestMons[i].species;
LoadPalette(gMonIconPalettes[gMonIconPaletteIndices[GetIconSpecies(species, 0)]], i * 0x10 + 0xA0, 0x20);
LoadPalette(gMonIconPalettes[gMonIconPaletteIndices[GetIconSpecies(species, 0)]], BG_PLTT_ID(10 + i), PLTT_SIZE_4BPP);
}
}
@ -1561,7 +1561,7 @@ static void Task_HighlightWinnersBox(u8 taskId)
if (++gTasks[taskId].data[11] == 1)
{
gTasks[taskId].data[11] = 0;
BlendPalette(0x91, 1, gTasks[taskId].data[12], RGB(13, 28, 27));
BlendPalette(BG_PLTT_ID(9) + 1, 1, gTasks[taskId].data[12], RGB(13, 28, 27));
if (gTasks[taskId].data[13] == 0)
{
if (++gTasks[taskId].data[12] == 16)
@ -2525,16 +2525,16 @@ void LoadLinkContestPlayerPalettes(void)
if (version == VERSION_RUBY || version == VERSION_SAPPHIRE)
{
if (gLinkPlayers[i].gender == MALE)
LoadPalette(gObjectEventPal_RubySapphireBrendan, 0x160 + i * 0x10, 0x20);
LoadPalette(gObjectEventPal_RubySapphireBrendan, OBJ_PLTT_ID(6 + i), PLTT_SIZE_4BPP);
else
LoadPalette(gObjectEventPal_RubySapphireMay, 0x160 + i * 0x10, 0x20);
LoadPalette(gObjectEventPal_RubySapphireMay, OBJ_PLTT_ID(6 + i), PLTT_SIZE_4BPP);
}
else
{
if (gLinkPlayers[i].gender == MALE)
LoadPalette(gObjectEventPal_Brendan, 0x160 + i * 0x10, 0x20);
LoadPalette(gObjectEventPal_Brendan, OBJ_PLTT_ID(6 + i), PLTT_SIZE_4BPP);
else
LoadPalette(gObjectEventPal_May, 0x160 + i * 0x10, 0x20);
LoadPalette(gObjectEventPal_May, OBJ_PLTT_ID(6 + i), PLTT_SIZE_4BPP);
}
}
}

View File

@ -365,7 +365,7 @@ static void InitCreditsBgsAndWindows(void)
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sBackgroundTemplates, ARRAY_COUNT(sBackgroundTemplates));
SetBgTilemapBuffer(0, AllocZeroed(BG_SCREEN_SIZE));
LoadPalette(sCredits_Pal, 0x80, 64);
LoadPalette(sCredits_Pal, BG_PLTT_ID(8), 2 * PLTT_SIZE_4BPP);
InitWindows(sWindowTemplates);
DeactivateAllTextPrinters();
PutWindowTilemap(0);
@ -549,7 +549,7 @@ static void Task_LoadShowMons(u8 taskId)
gReservedSpritePaletteCount = 8;
LZ77UnCompVram(gBirchBagGrass_Gfx, (void *)VRAM);
LZ77UnCompVram(gBirchGrassTilemap, (void *)(BG_SCREEN_ADDR(7)));
LoadPalette(gBirchBagGrass_Pal + 1, 1, 31 * 2);
LoadPalette(gBirchBagGrass_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(2 * 16 - 1));
for (i = 0; i < MON_PIC_SIZE; i++)
gDecompressionBuffer[i] = 0x11;
@ -624,7 +624,7 @@ static void Task_CreditsTheEnd3(u8 taskId)
{
ResetGpuAndVram();
ResetPaletteFade();
LoadTheEndScreen(0, 0x3800, 0);
LoadTheEndScreen(0, 0x3800, BG_PLTT_ID(0));
ResetSpriteData();
FreeAllSpritePalettes();
BeginNormalPaletteFade(PALETTES_ALL, 8, 16, 0, RGB_BLACK);

View File

@ -688,7 +688,7 @@ static void ReturnToDecorationActionsAfterInvalidSelection(u8 taskId)
static void SecretBasePC_PrepMenuForSelectingStoredDecors(u8 taskId)
{
LoadPalette(sDecorationMenuPalette, 0xd0, 0x20);
LoadPalette(sDecorationMenuPalette, BG_PLTT_ID(13), PLTT_SIZE_4BPP);
ClearDialogWindowAndFrame(0, FALSE);
RemoveDecorationWindow(WINDOW_MAIN_MENU);
InitDecorationCategoriesWindow(taskId);
@ -834,7 +834,7 @@ static void ReturnToActionsMenuFromCategories(u8 taskId)
void ShowDecorationCategoriesWindow(u8 taskId)
{
LoadPalette(sDecorationMenuPalette, 0xd0, 0x20);
LoadPalette(sDecorationMenuPalette, BG_PLTT_ID(13), PLTT_SIZE_4BPP);
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, 0, 64);
LoadPalette(sDiplomaPalettes, BG_PLTT_ID(0), 2 * PLTT_SIZE_4BPP);
sDiplomaTilemapPtr = Alloc(0x1000);
InitDiplomaBg();
InitDiplomaWindow();
@ -196,7 +196,7 @@ static void InitDiplomaWindow(void)
{
InitWindows(sDiplomaWinTemplates);
DeactivateAllTextPrinters();
LoadPalette(gStandardMenuPalette, 0xF0, 0x20);
LoadPalette(gStandardMenuPalette, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
FillWindowPixelBuffer(0, PIXEL_FILL(0));
PutWindowTilemap(0);
}

View File

@ -3005,8 +3005,8 @@ static void PrintRecordsText(u8 windowId, s32 width)
recordNums[1] = gSaveBlock2Ptr->berryPick.bestScore;
recordNums[2] = gSaveBlock2Ptr->berryPick.berriesPickedInRow;
LoadUserWindowBorderGfx_(windowId, 0x21D, 0xD0);
DrawTextBorderOuter(windowId, 0x21D, 0xD);
LoadUserWindowBorderGfx_(windowId, 0x21D, BG_PLTT_ID(13));
DrawTextBorderOuter(windowId, 0x21D, 13);
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_BerryPickingRecords, GetStringCenterAlignXOffset(FONT_NORMAL, gText_BerryPickingRecords, width * 8), 1, TEXT_SKIP_DRAW, NULL);
for (i = 0; i < NUM_RECORD_TYPES; i++)
@ -4429,12 +4429,12 @@ static void ResetBerryAndStatusBarSprites(void)
static void LoadWindowFrameGfx(u8 frameId)
{
LoadBgTiles(BG_INTERFACE, GetWindowFrameTilesPal(frameId)->tiles, 0x120, 1);
LoadPalette(GetWindowFrameTilesPal(frameId)->pal, 0xA0, 0x20);
LoadPalette(GetWindowFrameTilesPal(frameId)->pal, BG_PLTT_ID(10), PLTT_SIZE_4BPP);
}
static void LoadUserWindowFrameGfx(void)
{
LoadUserWindowBorderGfx_(0, 0xA, 0xB0);
LoadUserWindowBorderGfx_(0, 0xA, BG_PLTT_ID(11));
}
static void ResetGfxState(void)
@ -5193,7 +5193,7 @@ static bool32 LoadBgGfx(void)
switch (sGfx->loadState)
{
case 0:
LoadPalette(sBg_Pal, 0, sizeof(sBg_Pal));
LoadPalette(sBg_Pal, BG_PLTT_ID(0), sizeof(sBg_Pal));
break;
case 1:
ResetTempTileDataBuffers();
@ -5209,7 +5209,7 @@ static bool32 LoadBgGfx(void)
return FALSE;
break;
case 5:
LoadPalette(GetTextWindowPalette(3), 0xD0, 0x20);
LoadPalette(GetTextWindowPalette(3), BG_PLTT_ID(13), PLTT_SIZE_4BPP);
break;
default:
sGfx->loadState = 0;

View File

@ -3917,13 +3917,13 @@ static void InitEasyChatBgs(void)
static void LoadEasyChatPalettes(void)
{
ResetPaletteFade();
LoadPalette(gEasyChatMode_Pal, 0, 32);
LoadPalette(sTextInputFrameOrange_Pal, 1 * 16, 32);
LoadPalette(sTextInputFrameGreen_Pal, 4 * 16, 32);
LoadPalette(sTitleText_Pal, 10 * 16, 8);
LoadPalette(sText_Pal, 11 * 16, 12);
LoadPalette(sText_Pal, 15 * 16, 12);
LoadPalette(sText_Pal, 3 * 16, 12);
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));
}
static void PrintTitle(void)
@ -3957,7 +3957,7 @@ static void PrintEasyChatTextWithColors(u8 windowId, u8 fontId, const u8 *str, u
static void PrintInitialInstructions(void)
{
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17);
LoadUserWindowBorderGfx(1, 1, 0xE0);
LoadUserWindowBorderGfx(1, 1, BG_PLTT_ID(14));
DrawTextBorderOuter(1, 1, 14);
PrintEasyChatStdMessage(MSG_INSTRUCTIONS);
PutWindowTilemap(1);

View File

@ -532,7 +532,7 @@ static void CB2_LoadEggHatch(void)
case 2:
DecompressAndLoadBgGfxUsingHeap(0, gBattleTextboxTiles, 0, 0, 0);
CopyToBgTilemapBuffer(0, gBattleTextboxTilemap, 0, 0);
LoadCompressedPalette(gBattleTextboxPalette, 0, 0x20);
LoadCompressedPalette(gBattleTextboxPalette, BG_PLTT_ID(0), PLTT_SIZE_4BPP);
gMain.state++;
break;
case 3:
@ -556,7 +556,7 @@ static void CB2_LoadEggHatch(void)
break;
case 7:
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
LoadPalette(gTradeGba2_Pal, 0x10, 0xA0);
LoadPalette(gTradeGba2_Pal, BG_PLTT_ID(1), 5 * PLTT_SIZE_4BPP);
LoadBgTiles(1, gTradeGba_Gfx, 0x1420, 0);
CopyToBgTilemapBuffer(1, gTradePlatform_Tilemap, 0x1000, 0);
CopyBgTilemapBufferToVram(1);
@ -678,7 +678,7 @@ static void CB2_EggHatch(void)
// Print the nickname prompt
if (!IsTextPrinterActive(sEggHatchData->windowId))
{
LoadUserWindowBorderGfx(sEggHatchData->windowId, 0x140, 0xE0);
LoadUserWindowBorderGfx(sEggHatchData->windowId, 0x140, BG_PLTT_ID(14));
CreateYesNoMenu(&sYesNoWinTemplate, 0x140, 0xE, 0);
sEggHatchData->state++;
}

View File

@ -2029,7 +2029,7 @@ void PatchObjectPalette(u16 paletteTag, u8 paletteSlot)
// paletteTag is assumed to exist in sObjectEventSpritePalettes
u8 paletteIndex = FindObjectEventPaletteIndexByTag(paletteTag);
LoadPalette(sObjectEventSpritePalettes[paletteIndex].data, 16 * paletteSlot + 0x100, 0x20);
LoadPalette(sObjectEventSpritePalettes[paletteIndex].data, OBJ_PLTT_ID(paletteSlot), PLTT_SIZE_4BPP);
}
void PatchObjectPaletteRange(const u16 *paletteTags, u8 minSlot, u8 maxSlot)

View File

@ -263,7 +263,7 @@ void EvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, bool8 canStopEvo, u
gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_LEFT],
currSpecies);
pokePal = GetMonSpritePalStructFromOtIdPersonality(currSpecies, trainerId, personality);
LoadCompressedPalette(pokePal->data, 0x110, 0x20);
LoadCompressedPalette(pokePal->data, OBJ_PLTT_ID(1), PLTT_SIZE_4BPP);
SetMultiuseSpriteTemplateToPokemon(currSpecies, B_POSITION_OPPONENT_LEFT);
gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable;
@ -278,7 +278,7 @@ void EvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, bool8 canStopEvo, u
gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_RIGHT],
postEvoSpecies);
pokePal = GetMonSpritePalStructFromOtIdPersonality(postEvoSpecies, trainerId, personality);
LoadCompressedPalette(pokePal->data, 0x120, 0x20);
LoadCompressedPalette(pokePal->data, OBJ_PLTT_ID(2), PLTT_SIZE_4BPP);
SetMultiuseSpriteTemplateToPokemon(postEvoSpecies, B_POSITION_OPPONENT_RIGHT);
gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable;
@ -356,7 +356,7 @@ static void CB2_EvolutionSceneLoadGraphics(void)
postEvoSpecies);
pokePal = GetMonSpritePalStructFromOtIdPersonality(postEvoSpecies, trainerId, personality);
LoadCompressedPalette(pokePal->data, 0x120, 0x20);
LoadCompressedPalette(pokePal->data, OBJ_PLTT_ID(2), PLTT_SIZE_4BPP);
SetMultiuseSpriteTemplateToPokemon(postEvoSpecies, B_POSITION_OPPONENT_RIGHT);
gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable;
@ -427,7 +427,7 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void)
gMonSpritesGfxPtr->sprites.ptr[B_POSITION_OPPONENT_RIGHT],
postEvoSpecies);
pokePal = GetMonSpritePalStructFromOtIdPersonality(postEvoSpecies, trainerId, personality);
LoadCompressedPalette(pokePal->data, 0x120, 0x20);
LoadCompressedPalette(pokePal->data, OBJ_PLTT_ID(2), PLTT_SIZE_4BPP);
gMain.state++;
}
break;
@ -492,7 +492,7 @@ void TradeEvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, u8 preEvoSprit
postEvoSpecies);
pokePal = GetMonSpritePalStructFromOtIdPersonality(postEvoSpecies, trainerId, personality);
LoadCompressedPalette(pokePal->data, 0x120, 0x20);
LoadCompressedPalette(pokePal->data, OBJ_PLTT_ID(2), PLTT_SIZE_4BPP);
SetMultiuseSpriteTemplateToPokemon(postEvoSpecies, B_POSITION_OPPONENT_LEFT);
gMultiuseSpriteTemplate.affineAnims = gDummySpriteAffineAnimTable;
@ -1301,7 +1301,7 @@ static void Task_TradeEvolutionScene(u8 taskId)
case T_MVSTATE_PRINT_YES_NO:
if (!IsTextPrinterActive(0) && !IsSEPlaying())
{
LoadUserWindowBorderGfx(0, 0xA8, 0xE0);
LoadUserWindowBorderGfx(0, 0xA8, BG_PLTT_ID(14));
CreateYesNoMenu(&gTradeEvolutionSceneYesNoWindowTemplate, 0xA8, 0xE, 0);
sEvoCursorPos = 0;
gTasks[taskId].tLearnMoveState++;
@ -1507,7 +1507,7 @@ static void Task_UpdateBgPalette(u8 taskId)
else
{
// Haven't reached final palette in current stage, load the current palette
LoadPalette(&sBgAnimPal[tPalStage * 16], 0xA0, 0x20);
LoadPalette(&sBgAnimPal[tPalStage * 16], BG_PLTT_ID(10), PLTT_SIZE_4BPP);
tCycleTimer = 0;
tPalStage++;
}
@ -1605,7 +1605,7 @@ static void StartBgAnimation(bool8 isLink)
else
innerBgId = 1, outerBgId = 3;
LoadPalette(sBgAnim_Intro_Pal, 0xA0, 0x20);
LoadPalette(sBgAnim_Intro_Pal, BG_PLTT_ID(10), PLTT_SIZE_4BPP);
DecompressAndLoadBgGfxUsingHeap(1, sBgAnim_Gfx, FALSE, 0, 0);
CopyToBgTilemapBuffer(innerBgId, sBgAnim_Inner_Tilemap, 0, 0);
@ -1644,7 +1644,7 @@ static void PauseBgPaletteAnim(void)
if (taskId != TASK_NONE)
gTasks[taskId].tPaused = TRUE;
FillPalette(RGB_BLACK, 0xA0, 0x20);
FillPalette(RGB_BLACK, BG_PLTT_ID(10), PLTT_SIZE_4BPP);
}
#undef tPaused
@ -1658,7 +1658,7 @@ static void StopBgAnimation(void)
if ((taskId = FindTaskIdByFunc(Task_AnimateBg)) != TASK_NONE)
DestroyTask(taskId);
FillPalette(RGB_BLACK, 0xA0, 0x20);
FillPalette(RGB_BLACK, BG_PLTT_ID(10), PLTT_SIZE_4BPP);
RestoreBgAfterAnim();
}

View File

@ -903,7 +903,7 @@ u8 CreateTrainerSprite(u8 trainerSpriteID, s16 x, s16 y, u8 subpriority, u8 *buf
void LoadTrainerGfx_TrainerCard(u8 gender, u16 palOffset, u8 *dest)
{
LZDecompressVram(gTrainerFrontPicTable[gender].data, dest);
LoadCompressedPalette(gTrainerFrontPicPaletteTable[gender].data, palOffset, 0x20);
LoadCompressedPalette(gTrainerFrontPicPaletteTable[gender].data, palOffset, PLTT_SIZE_4BPP);
}
u8 AddNewGameBirchObject(s16 x, s16 y, u8 subpriority)
@ -2630,7 +2630,7 @@ static void FieldMoveShowMonOutdoorsEffect_LoadGfx(struct Task *task)
u16 delta = ((REG_BG0CNT >> 8) << 11);
CpuCopy16(sFieldMoveStreaksOutdoors_Gfx, (void *)(VRAM + offset), 0x200);
CpuFill32(0, (void *)(VRAM + delta), 0x800);
LoadPalette(sFieldMoveStreaksOutdoors_Pal, 0xf0, sizeof(sFieldMoveStreaksOutdoors_Pal));
LoadPalette(sFieldMoveStreaksOutdoors_Pal, BG_PLTT_ID(15), sizeof(sFieldMoveStreaksOutdoors_Pal));
LoadFieldMoveOutdoorStreaksTilemap(delta);
task->tState++;
}
@ -2793,7 +2793,7 @@ static void FieldMoveShowMonIndoorsEffect_LoadGfx(struct Task *task)
task->data[12] = delta;
CpuCopy16(sFieldMoveStreaksIndoors_Gfx, (void *)(VRAM + offset), 0x80);
CpuFill32(0, (void *)(VRAM + delta), 0x800);
LoadPalette(sFieldMoveStreaksIndoors_Pal, 0xf0, sizeof(sFieldMoveStreaksIndoors_Pal));
LoadPalette(sFieldMoveStreaksIndoors_Pal, BG_PLTT_ID(15), sizeof(sFieldMoveStreaksIndoors_Pal));
task->tState++;
}
@ -3092,7 +3092,7 @@ u8 FldEff_RayquazaSpotlight(void)
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_BG1 | BLDCNT_TGT2_BG2 | BLDCNT_TGT2_BG3 | BLDCNT_TGT2_OBJ | BLDCNT_TGT2_BD);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(14, 14));
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR);
LoadPalette(sSpotlight_Pal, 0xC0, sizeof(sSpotlight_Pal));
LoadPalette(sSpotlight_Pal, BG_PLTT_ID(12), sizeof(sSpotlight_Pal));
SetGpuReg(REG_OFFSET_BG0VOFS, 120);
for (i = 3; i < 15; i++)
{

View File

@ -115,7 +115,7 @@ static void MCB2_InitRegionMapRegisters(void)
InitBgsFromTemplates(1, sFieldRegionMapBgTemplates, ARRAY_COUNT(sFieldRegionMapBgTemplates));
InitWindows(sFieldRegionMapWindowTemplates);
DeactivateAllTextPrinters();
LoadUserWindowBorderGfx(0, 0x27, 0xd0);
LoadUserWindowBorderGfx(0, 0x27, BG_PLTT_ID(13));
ClearScheduledBgCopiesToVram();
SetMainCallback2(MCB2_FieldUpdateRegionMap);
SetVBlankCallback(VBCB_FieldUpdateRegionMap);

View File

@ -1079,9 +1079,7 @@ static void LoadOrbEffectPalette(bool8 blueOrb)
color[0] = RGB_BLUE;
for (i = 0; i < 16; i++)
{
LoadPalette(color, 0xF0 + i, 2);
}
LoadPalette(color, BG_PLTT_ID(15) + i, PLTT_SIZEOF(1));
}
static bool8 UpdateOrbEffectBlend(u16 shakeDir)

View File

@ -583,16 +583,16 @@ static void LoadLinkPartnerObjectEventSpritePalette(u8 graphicsId, u8 localEvent
switch (graphicsId)
{
case OBJ_EVENT_GFX_LINK_RS_BRENDAN:
LoadPalette(gObjectEventPal_RubySapphireBrendan, 0x100 + (adjustedPaletteNum << 4), 0x20);
LoadPalette(gObjectEventPal_RubySapphireBrendan, OBJ_PLTT_ID(adjustedPaletteNum), PLTT_SIZE_4BPP);
break;
case OBJ_EVENT_GFX_LINK_RS_MAY:
LoadPalette(gObjectEventPal_RubySapphireMay, 0x100 + (adjustedPaletteNum << 4), 0x20);
LoadPalette(gObjectEventPal_RubySapphireMay, OBJ_PLTT_ID(adjustedPaletteNum), PLTT_SIZE_4BPP);
break;
case OBJ_EVENT_GFX_RIVAL_BRENDAN_NORMAL:
LoadPalette(gObjectEventPal_Brendan, 0x100 + (adjustedPaletteNum << 4), 0x20);
LoadPalette(gObjectEventPal_Brendan, OBJ_PLTT_ID(adjustedPaletteNum), PLTT_SIZE_4BPP);
break;
case OBJ_EVENT_GFX_RIVAL_MAY_NORMAL:
LoadPalette(gObjectEventPal_May, 0x100 + (adjustedPaletteNum << 4), 0x20);
LoadPalette(gObjectEventPal_May, OBJ_PLTT_ID(adjustedPaletteNum), PLTT_SIZE_4BPP);
break;
}
}
@ -3266,7 +3266,7 @@ static void Task_DeoxysRockInteraction(u8 taskId)
static void ChangeDeoxysRockLevel(u8 rockLevel)
{
u8 objectEventId;
LoadPalette(&sDeoxysRockPalettes[rockLevel], 0x1A0, 8);
LoadPalette(&sDeoxysRockPalettes[rockLevel], OBJ_PLTT_ID(10), PLTT_SIZEOF(4));
TryGetObjectEventIdByLocalIdAndMap(LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objectEventId);
if (rockLevel == 0)
@ -3314,7 +3314,7 @@ void IncrementBirthIslandRockStepCount(void)
void SetDeoxysRockPalette(void)
{
LoadPalette(&sDeoxysRockPalettes[(u8)VarGet(VAR_DEOXYS_ROCK_LEVEL)], 0x1A0, 8);
LoadPalette(&sDeoxysRockPalettes[(u8)VarGet(VAR_DEOXYS_ROCK_LEVEL)], OBJ_PLTT_ID(10), PLTT_SIZEOF(4));
BlendPalettes(0x04000000, 16, 0);
}

View File

@ -552,7 +552,7 @@ static void ApplyColorMapWithBlend(u8 startPalIndex, u8 numPalettes, s8 colorMap
u8 gBlend = color.g;
u8 bBlend = color.b;
palOffset = startPalIndex * 16;
palOffset = BG_PLTT_ID(startPalIndex);
numPalettes += startPalIndex;
colorMapIndex--;
curPalIndex = startPalIndex;
@ -656,7 +656,7 @@ static void ApplyFogBlend(u8 blendCoeff, u16 blendColor)
u8 bBlend;
u16 curPalIndex;
BlendPalette(0, 256, blendCoeff, blendColor);
BlendPalette(BG_PLTT_ID(0), 16 * 16, blendCoeff, blendColor);
color = *(struct RGBColor *)&blendColor;
rBlend = color.r;
gBlend = color.g;
@ -690,7 +690,7 @@ static void ApplyFogBlend(u8 blendCoeff, u16 blendColor)
}
else
{
BlendPalette(curPalIndex * 16, 16, blendCoeff, blendColor);
BlendPalette(PLTT_ID(curPalIndex), 16, blendCoeff, blendColor);
}
}
}
@ -830,8 +830,8 @@ void UpdateSpritePaletteWithWeather(u8 spritePaletteIndex)
}
break;
case WEATHER_PAL_STATE_SCREEN_FADING_OUT:
paletteIndex *= 16;
CpuFastCopy(gPlttBufferFaded + paletteIndex, gPlttBufferUnfaded + paletteIndex, 32);
paletteIndex = PLTT_ID(paletteIndex);
CpuFastCopy(gPlttBufferFaded + paletteIndex, gPlttBufferUnfaded + paletteIndex, PLTT_SIZE_4BPP);
BlendPalette(paletteIndex, 16, gPaletteFade.y, gPaletteFade.blendColor);
break;
// WEATHER_PAL_STATE_CHANGING_WEATHER
@ -843,7 +843,7 @@ void UpdateSpritePaletteWithWeather(u8 spritePaletteIndex)
}
else
{
paletteIndex *= 16;
paletteIndex = PLTT_ID(paletteIndex);
BlendPalette(paletteIndex, 16, 12, RGB(28, 31, 28));
}
break;
@ -866,7 +866,7 @@ static bool8 IsFirstFrameOfWeatherFadeIn(void)
void LoadCustomWeatherSpritePalette(const u16 *palette)
{
LoadPalette(palette, 0x100 + gWeatherPtr->weatherPicSpritePalIndex * 16, 32);
LoadPalette(palette, OBJ_PLTT_ID(gWeatherPtr->weatherPicSpritePalIndex), PLTT_SIZE_4BPP);
UpdateSpritePaletteWithWeather(gWeatherPtr->weatherPicSpritePalIndex);
}

View File

@ -879,9 +879,9 @@ void LoadTilesetPalette(struct Tileset const *tileset, u16 destOffset, u16 size)
{
if (tileset->isSecondary == FALSE)
{
LoadPalette(&black, destOffset, 2);
LoadPalette(tileset->palettes[0] + 1, destOffset + 1, size - 2);
ApplyGlobalTintToPaletteEntries(destOffset + 1, (size - 2) >> 1);
LoadPalette(&black, destOffset, PLTT_SIZEOF(1));
LoadPalette(tileset->palettes[0] + 1, destOffset + 1, size - PLTT_SIZEOF(1));
ApplyGlobalTintToPaletteEntries(destOffset + 1, (size - PLTT_SIZEOF(1)) >> 1);
}
else if (tileset->isSecondary == TRUE)
{
@ -913,12 +913,12 @@ void CopySecondaryTilesetToVramUsingHeap(struct MapLayout const *mapLayout)
static void LoadPrimaryTilesetPalette(struct MapLayout const *mapLayout)
{
LoadTilesetPalette(mapLayout->primaryTileset, 0, NUM_PALS_IN_PRIMARY * 16 * 2);
LoadTilesetPalette(mapLayout->primaryTileset, BG_PLTT_ID(0), NUM_PALS_IN_PRIMARY * PLTT_SIZE_4BPP);
}
void LoadSecondaryTilesetPalette(struct MapLayout const *mapLayout)
{
LoadTilesetPalette(mapLayout->secondaryTileset, NUM_PALS_IN_PRIMARY * 16, (NUM_PALS_TOTAL - NUM_PALS_IN_PRIMARY) * 16 * 2);
LoadTilesetPalette(mapLayout->secondaryTileset, BG_PLTT_ID(NUM_PALS_IN_PRIMARY), (NUM_PALS_TOTAL - NUM_PALS_IN_PRIMARY) * PLTT_SIZE_4BPP);
}
void CopyMapTilesetsToVram(struct MapLayout const *mapLayout)

View File

@ -218,8 +218,8 @@ static void Task_ExitCaveTransition2(u8 taskId)
SetGpuReg(REG_OFFSET_DISPCNT, 0);
LZ77UnCompVram(sCaveTransitionTiles, (void *)(VRAM + 0xC000));
LZ77UnCompVram(sCaveTransitionTilemap, (void *)(VRAM + 0xF800));
LoadPalette(sCaveTransitionPalette_White, 0xE0, 0x20);
LoadPalette(sCaveTransitionPalette_Exit, 0xE0, 0x10);
LoadPalette(sCaveTransitionPalette_White, BG_PLTT_ID(14), PLTT_SIZE_4BPP);
LoadPalette(sCaveTransitionPalette_Exit, BG_PLTT_ID(14), PLTT_SIZEOF(8));
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0
| BLDCNT_EFFECT_BLEND
| BLDCNT_TGT2_BG1
@ -270,11 +270,11 @@ static void Task_ExitCaveTransition4(u8 taskId)
if (count < 8)
{
gTasks[taskId].data[2]++;
LoadPalette(&sCaveTransitionPalette_Exit[count], 0xE0, 16 - 2 * count);
LoadPalette(&sCaveTransitionPalette_Exit[count], BG_PLTT_ID(14), PLTT_SIZEOF(8) - PLTT_SIZEOF(count));
}
else
{
LoadPalette(sCaveTransitionPalette_White, 0, 0x20);
LoadPalette(sCaveTransitionPalette_White, BG_PLTT_ID(0), PLTT_SIZE_4BPP);
gTasks[taskId].func = Task_ExitCaveTransition5;
gTasks[taskId].data[2] = 8;
}
@ -315,8 +315,8 @@ static void Task_EnterCaveTransition2(u8 taskId)
| DISPCNT_OBJ_1D_MAP
| DISPCNT_BG0_ON
| DISPCNT_OBJ_ON);
LoadPalette(sCaveTransitionPalette_White, 0xE0, 0x20);
LoadPalette(sCaveTransitionPalette_Black, 0, 0x20);
LoadPalette(sCaveTransitionPalette_White, BG_PLTT_ID(14), PLTT_SIZE_4BPP);
LoadPalette(sCaveTransitionPalette_Black, BG_PLTT_ID(0), PLTT_SIZE_4BPP);
gTasks[taskId].func = Task_EnterCaveTransition3;
gTasks[taskId].data[0] = 16;
gTasks[taskId].data[1] = 0;
@ -331,7 +331,7 @@ static void Task_EnterCaveTransition3(u8 taskId)
{
gTasks[taskId].data[2]++;
gTasks[taskId].data[2]++;
LoadPalette(&sCaveTransitionPalette_Enter[15 - count], 0xE0, 2 * (count + 1));
LoadPalette(&sCaveTransitionPalette_Enter[15 - count], BG_PLTT_ID(14), PLTT_SIZEOF(count + 1));
}
else
{
@ -359,7 +359,7 @@ static void Task_EnterCaveTransition4(u8 taskId)
}
else
{
LoadPalette(sCaveTransitionPalette_Black, 0, 0x20);
LoadPalette(sCaveTransitionPalette_Black, BG_PLTT_ID(0), PLTT_SIZE_4BPP);
SetMainCallback2(gMain.savedCallback);
}
}

View File

@ -768,9 +768,9 @@ static bool32 InitFrontierPass(void)
CopyBgTilemapBufferToVram(2);
break;
case 8:
LoadPalette(gFrontierPassBg_Pal[0], 0, 0x1A0);
LoadPalette(gFrontierPassBg_Pal[1 + sPassData->trainerStars], 0x10, 0x20);
LoadPalette(GetTextWindowPalette(0), 0xF0, 0x20);
LoadPalette(gFrontierPassBg_Pal[0], 0, 13 * PLTT_SIZE_4BPP);
LoadPalette(gFrontierPassBg_Pal[1 + sPassData->trainerStars], BG_PLTT_ID(1), PLTT_SIZE_4BPP);
LoadPalette(GetTextWindowPalette(0), BG_PLTT_ID(15), PLTT_SIZE_4BPP);
DrawFrontierPassBg();
UpdateAreaHighlight(sPassData->cursorArea, sPassData->previousCursorArea);
if (sPassData->areaToShow == CURSOR_AREA_MAP || sPassData->areaToShow == CURSOR_AREA_CARD)
@ -1412,8 +1412,8 @@ static bool32 InitFrontierMap(void)
case 5:
if (FreeTempTileDataBuffersIfPossible())
return FALSE;
LoadPalette(gFrontierPassBg_Pal[0], 0, 0x1A0);
LoadPalette(GetTextWindowPalette(0), 0xF0, 0x20);
LoadPalette(gFrontierPassBg_Pal[0], BG_PLTT_ID(0), 13 * PLTT_SIZE_4BPP);
LoadPalette(GetTextWindowPalette(0), BG_PLTT_ID(15), PLTT_SIZE_4BPP);
CopyToBgTilemapBuffer(2, sMapScreen_Tilemap, 0, 0);
CopyBgTilemapBufferToVram(2);
break;

View File

@ -702,8 +702,8 @@ static void Task_Hof_DisplayPlayer(u8 taskId)
ShowBg(3);
gTasks[taskId].tPlayerSpriteID = CreateTrainerPicSprite(PlayerGenderToFrontTrainerPicId_Debug(gSaveBlock2Ptr->playerGender, TRUE), TRUE, 120, 72, 6, TAG_NONE);
AddWindow(&sHof_WindowTemplate);
LoadWindowGfx(1, gSaveBlock2Ptr->optionsWindowFrameType, 0x21D, 0xD0);
LoadPalette(GetTextWindowPalette(1), 0xE0, 0x20);
LoadWindowGfx(1, gSaveBlock2Ptr->optionsWindowFrameType, 0x21D, BG_PLTT_ID(13));
LoadPalette(GetTextWindowPalette(1), BG_PLTT_ID(14), PLTT_SIZE_4BPP);
gTasks[taskId].tFrameCount = 120;
gTasks[taskId].func = Task_Hof_WaitAndPrintPlayerInfo;
}
@ -1269,7 +1269,7 @@ static void ClearVramOamPltt_LoadHofPal(void)
DmaFill16(3, 0, plttOffset, plttSize);
ResetPaletteFade();
LoadPalette(sHallOfFame_Pal, 0, 0x20);
LoadPalette(sHallOfFame_Pal, BG_PLTT_ID(0), PLTT_SIZE_4BPP);
}
static void LoadHofGfx(void)

View File

@ -1051,11 +1051,11 @@ static void MainCB2_EndIntro(void)
SetMainCallback2(CB2_InitTitleScreen);
}
static void LoadCopyrightGraphics(u16 tilesetAddress, u16 tilemapAddress, u16 paletteAddress)
static void LoadCopyrightGraphics(u16 tilesetAddress, u16 tilemapAddress, u16 paletteOffset)
{
LZ77UnCompVram(gIntroCopyright_Gfx, (void *)(VRAM + tilesetAddress));
LZ77UnCompVram(gIntroCopyright_Tilemap, (void *)(VRAM + tilemapAddress));
LoadPalette(gIntroCopyright_Pal, paletteAddress, 32);
LoadPalette(gIntroCopyright_Pal, paletteOffset, PLTT_SIZE_4BPP);
}
static void SerialCB_CopyrightScreen(void)
@ -1080,7 +1080,7 @@ static u8 SetUpCopyrightScreen(void)
CpuFill32(0, (void *)OAM, OAM_SIZE);
CpuFill16(0, (void *)(PLTT + 2), PLTT_SIZE - 2);
ResetPaletteFade();
LoadCopyrightGraphics(0, 0x3800, 0);
LoadCopyrightGraphics(0, 0x3800, BG_PLTT_ID(0));
ScanlineEffect_Stop();
ResetTasks();
ResetSpriteData();
@ -1178,7 +1178,7 @@ static void Task_Scene1_Load(u8 taskId)
DmaClear16(3, BG_SCREEN_ADDR(21), BG_SCREEN_SIZE);
LZ77UnCompVram(sIntro1Bg3_Tilemap, (void *)(BG_SCREEN_ADDR(22)));
DmaClear16(3, BG_SCREEN_ADDR(23), BG_SCREEN_SIZE);
LoadPalette(sIntro1Bg_Pal, 0, sizeof(sIntro1Bg_Pal));
LoadPalette(sIntro1Bg_Pal, BG_PLTT_ID(0), sizeof(sIntro1Bg_Pal));
SetGpuReg(REG_OFFSET_BG3CNT, BGCNT_PRIORITY(3) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(22) | BGCNT_16COLOR | BGCNT_TXT256x512);
SetGpuReg(REG_OFFSET_BG2CNT, BGCNT_PRIORITY(2) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(20) | BGCNT_16COLOR | BGCNT_TXT256x512);
SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(18) | BGCNT_16COLOR | BGCNT_TXT256x512);
@ -1717,7 +1717,7 @@ static void Task_Scene3_Load(u8 taskId)
IntroResetGpuRegs();
LZ77UnCompVram(sIntroPokeball_Gfx, (void *)VRAM);
LZ77UnCompVram(sIntroPokeball_Tilemap, (void *)(BG_CHAR_ADDR(1)));
LoadPalette(sIntroPokeball_Pal, 0, sizeof(sIntroPokeball_Pal));
LoadPalette(sIntroPokeball_Pal, BG_PLTT_ID(0), sizeof(sIntroPokeball_Pal));
gTasks[taskId].tAlpha = 0;
gTasks[taskId].tZoomDiv = 0;
gTasks[taskId].tZoomDivSpeed = 0;
@ -2663,10 +2663,10 @@ static void Task_RayquazaAttack(u8 taskId)
{
if (--data[3] != 0)
{
BlendPalette(0x50, 16, data[3], RGB(9, 10, 10));
CpuCopy16(&gIntro3Bg_Pal[0x1AC], &gPlttBufferFaded[94], 2);
CpuCopy16(&gIntro3Bg_Pal[0x1AC], &gPlttBufferFaded[88], 2);
CpuCopy16(&gIntro3Bg_Pal[0x18C], &gPlttBufferFaded[92], 2);
BlendPalette(BG_PLTT_ID(5), 16, data[3], RGB(9, 10, 10));
CpuCopy16(&gIntro3Bg_Pal[428], &gPlttBufferFaded[BG_PLTT_ID(5) + 14], PLTT_SIZEOF(1));
CpuCopy16(&gIntro3Bg_Pal[428], &gPlttBufferFaded[BG_PLTT_ID(5) + 8], PLTT_SIZEOF(1));
CpuCopy16(&gIntro3Bg_Pal[396], &gPlttBufferFaded[BG_PLTT_ID(5) + 12], PLTT_SIZEOF(1));
}
else
{

View File

@ -730,7 +730,7 @@ void LoadIntroPart2Graphics(u8 scenery)
{
LZ77UnCompVram(sGrass_Gfx, (void *)(BG_CHAR_ADDR(1)));
LZ77UnCompVram(sGrass_Tilemap, (void *)(BG_SCREEN_ADDR(15)));
LoadPalette(&sGrass_Pal, 240, sizeof(sGrass_Pal));
LoadPalette(&sGrass_Pal, BG_PLTT_ID(15), sizeof(sGrass_Pal));
switch (scenery)
{
case 0:
@ -739,17 +739,17 @@ void LoadIntroPart2Graphics(u8 scenery)
// Clouds are never used in this part of the intro
LZ77UnCompVram(sCloudsBg_Gfx, (void *)(VRAM));
LZ77UnCompVram(sCloudsBg_Tilemap, (void *)(BG_SCREEN_ADDR(6)));
LoadPalette(&sCloudsBg_Pal, 0, sizeof(sCloudsBg_Pal));
LoadPalette(&sCloudsBg_Pal, BG_PLTT_ID(0), sizeof(sCloudsBg_Pal));
LoadCompressedSpriteSheet(sSpriteSheet_Clouds);
LoadPalette(&sClouds_Pal, 256, sizeof(sClouds_Pal));
LoadPalette(&sClouds_Pal, OBJ_PLTT_ID(0), sizeof(sClouds_Pal));
CreateCloudSprites();
break;
case 1:
LZ77UnCompVram(sTrees_Gfx, (void *)(VRAM));
LZ77UnCompVram(sTrees_Tilemap, (void *)(BG_SCREEN_ADDR(6)));
LoadPalette(&sTrees_Pal, 0, sizeof(sTrees_Pal));
LoadPalette(&sTrees_Pal, BG_PLTT_ID(0), sizeof(sTrees_Pal));
LoadCompressedSpriteSheet(sSpriteSheet_TreesSmall);
LoadPalette(&sTreesSmall_Pal, 256, sizeof(sTreesSmall_Pal));
LoadPalette(&sTreesSmall_Pal, OBJ_PLTT_ID(0), sizeof(sTreesSmall_Pal));
CreateTreeSprites();
break;
}
@ -843,42 +843,42 @@ void LoadCreditsSceneGraphics(u8 scene)
{
case SCENE_OCEAN_MORNING:
default:
LoadPalette(&sGrass_Pal, 240, sizeof(sGrass_Pal));
LoadPalette(&sGrass_Pal, BG_PLTT_ID(15), sizeof(sGrass_Pal));
LZ77UnCompVram(sCloudsBg_Gfx, (void *)(VRAM));
LZ77UnCompVram(sCloudsBg_Tilemap, (void *)(BG_SCREEN_ADDR(6)));
LoadPalette(&sCloudsBg_Pal, 0, sizeof(sCloudsBg_Pal));
LoadPalette(&sCloudsBg_Pal, BG_PLTT_ID(0), sizeof(sCloudsBg_Pal));
LoadCompressedSpriteSheet(sSpriteSheet_Clouds);
LZ77UnCompVram(sClouds_Gfx, (void *)(OBJ_VRAM0));
LoadPalette(&sClouds_Pal, 256, sizeof(sClouds_Pal));
LoadPalette(&sClouds_Pal, OBJ_PLTT_ID(0), sizeof(sClouds_Pal));
CreateCloudSprites();
break;
case SCENE_OCEAN_SUNSET:
LoadPalette(&sGrassSunset_Pal, 240, sizeof(sGrassSunset_Pal));
LoadPalette(&sGrassSunset_Pal, BG_PLTT_ID(15), sizeof(sGrassSunset_Pal));
LZ77UnCompVram(sCloudsBg_Gfx, (void *)(VRAM));
LZ77UnCompVram(sCloudsBg_Tilemap, (void *)(BG_SCREEN_ADDR(6)));
LoadPalette(&sCloudsBgSunset_Pal, 0, sizeof(sCloudsBgSunset_Pal));
LoadPalette(&sCloudsBgSunset_Pal, BG_PLTT_ID(0), sizeof(sCloudsBgSunset_Pal));
LoadCompressedSpriteSheet(sSpriteSheet_Clouds);
LZ77UnCompVram(sClouds_Gfx, (void *)(OBJ_VRAM0));
LoadPalette(&sCloudsSunset_Pal, 256, sizeof(sCloudsSunset_Pal));
LoadPalette(&sCloudsSunset_Pal, OBJ_PLTT_ID(0), sizeof(sCloudsSunset_Pal));
CreateCloudSprites();
break;
case SCENE_FOREST_RIVAL_ARRIVE:
case SCENE_FOREST_CATCH_RIVAL:
LoadPalette(&sGrassSunset_Pal, 240, sizeof(sGrassSunset_Pal));
LoadPalette(&sGrassSunset_Pal, BG_PLTT_ID(15), sizeof(sGrassSunset_Pal));
LZ77UnCompVram(sTrees_Gfx, (void *)(VRAM));
LZ77UnCompVram(sTrees_Tilemap, (void *)(BG_SCREEN_ADDR(6)));
LoadPalette(&sTreesSunset_Pal, 0, sizeof(sTreesSunset_Pal));
LoadPalette(&sTreesSunset_Pal, BG_PLTT_ID(0), sizeof(sTreesSunset_Pal));
LoadCompressedSpriteSheet(sSpriteSheet_TreesSmall);
LoadPalette(&sTreesSunset_Pal, 256, sizeof(sTreesSunset_Pal));
LoadPalette(&sTreesSunset_Pal, OBJ_PLTT_ID(0), sizeof(sTreesSunset_Pal));
CreateTreeSprites();
break;
case SCENE_CITY_NIGHT:
LoadPalette(&sGrassNight_Pal, 240, sizeof(sGrassNight_Pal));
LoadPalette(&sGrassNight_Pal, BG_PLTT_ID(15), sizeof(sGrassNight_Pal));
LZ77UnCompVram(sHouses_Gfx, (void *)(VRAM));
LZ77UnCompVram(sHouses_Tilemap, (void *)(BG_SCREEN_ADDR(6)));
LoadPalette(&sHouses_Pal, 0, sizeof(sHouses_Pal));
LoadPalette(&sHouses_Pal, BG_PLTT_ID(0), sizeof(sHouses_Pal));
LoadCompressedSpriteSheet(sSpriteSheet_HouseSilhouette);
LoadPalette(&sHouseSilhouette_Pal, 256, sizeof(sHouseSilhouette_Pal));
LoadPalette(&sHouseSilhouette_Pal, OBJ_PLTT_ID(0), sizeof(sHouseSilhouette_Pal));
CreateHouseSprites();
break;
}
@ -1006,8 +1006,8 @@ void CycleSceneryPalette(u8 mode)
x = gPlttBufferUnfaded[10];
y = gPlttBufferUnfaded[9];
}
LoadPalette(&x, 9, sizeof(x));
LoadPalette(&y, 10, sizeof(y));
LoadPalette(&x, BG_PLTT_ID(0) + 9, sizeof(x));
LoadPalette(&y, BG_PLTT_ID(0) + 10, sizeof(y));
break;
case 2:
if (gMain.vblankCounter1 & 3 || gPaletteFade.active)
@ -1022,8 +1022,8 @@ void CycleSceneryPalette(u8 mode)
x = RGB(28, 24, 0);
y = RGB(7, 9, 15);
}
LoadPalette(&x, 12, sizeof(x));
LoadPalette(&y, 13, sizeof(y));
LoadPalette(&x, BG_PLTT_ID(0) + 12, sizeof(x));
LoadPalette(&y, BG_PLTT_ID(0) + 13, sizeof(y));
break;
case 1:
break;

View File

@ -818,9 +818,9 @@ static bool8 LoadBagMenu_Graphics(void)
break;
case 2:
if (!IsWallysBag() && gSaveBlock2Ptr->playerGender != MALE)
LoadCompressedPalette(gBagScreenFemale_Pal, 0, 0x40);
LoadCompressedPalette(gBagScreenFemale_Pal, BG_PLTT_ID(0), 2 * PLTT_SIZE_4BPP);
else
LoadCompressedPalette(gBagScreenMale_Pal, 0, 0x40);
LoadCompressedPalette(gBagScreenMale_Pal, BG_PLTT_ID(0), 2 * PLTT_SIZE_4BPP);
gBagMenu->graphicsLoadState++;
break;
case 3:
@ -2448,10 +2448,10 @@ static void LoadBagMenuTextWindows(void)
InitWindows(sDefaultBagWindows);
DeactivateAllTextPrinters();
LoadUserWindowBorderGfx(0, 1, 0xE0);
LoadMessageBoxGfx(0, 10, 0xD0);
ListMenuLoadStdPalAt(0xC0, 1);
LoadPalette(&gStandardMenuPalette, 0xF0, 0x20);
LoadUserWindowBorderGfx(0, 1, BG_PLTT_ID(14));
LoadMessageBoxGfx(0, 10, BG_PLTT_ID(13));
ListMenuLoadStdPalAt(BG_PLTT_ID(12), 1);
LoadPalette(&gStandardMenuPalette, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
for (i = 0; i <= WIN_POCKET_NAME; i++)
{
FillWindowPixelBuffer(i, PIXEL_FILL(0));

View File

@ -247,7 +247,7 @@ void Task_DestroySelf(u8 taskId)
static void InitLinkTestBG(u8 paletteNum, u8 bgNum, u8 screenBaseBlock, u8 charBaseBlock, u16 baseChar)
{
LoadPalette(sLinkTestDigitsPal, paletteNum * 16, 0x20);
LoadPalette(sLinkTestDigitsPal, BG_PLTT_ID(paletteNum), PLTT_SIZE_4BPP);
DmaCopy16(3, sLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(charBaseBlock) + (16 * baseChar), sizeof sLinkTestDigitsGfx);
gLinkTestBGInfo.screenBaseBlock = screenBaseBlock;
gLinkTestBGInfo.paletteNum = paletteNum;
@ -271,7 +271,7 @@ static void InitLinkTestBG(u8 paletteNum, u8 bgNum, u8 screenBaseBlock, u8 charB
// Unused
static void LoadLinkTestBgGfx(u8 paletteNum, u8 bgNum, u8 screenBaseBlock, u8 charBaseBlock)
{
LoadPalette(sLinkTestDigitsPal, paletteNum * 16, 0x20);
LoadPalette(sLinkTestDigitsPal, BG_PLTT_ID(paletteNum), PLTT_SIZE_4BPP);
DmaCopy16(3, sLinkTestDigitsGfx, (u16 *)BG_CHAR_ADDR(charBaseBlock), sizeof sLinkTestDigitsGfx);
gLinkTestBGInfo.screenBaseBlock = screenBaseBlock;
gLinkTestBGInfo.paletteNum = paletteNum;
@ -1595,7 +1595,7 @@ void CB2_LinkError(void)
ResetSpriteData();
FreeAllSpritePalettes();
ResetPaletteFadeControl();
FillPalette(RGB_BLACK, 0, 2);
SetBackdropFromColor(RGB_BLACK);
ResetTasks();
ScanlineEffect_Stop();
if (gWirelessCommType)
@ -1621,7 +1621,7 @@ void CB2_LinkError(void)
SetGpuReg(REG_OFFSET_BG1HOFS, 0);
SetGpuReg(REG_OFFSET_BG1VOFS, 0);
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON | DISPCNT_OBJWIN_ON);
LoadPalette(gStandardMenuPalette, 0xf0, 0x20);
LoadPalette(gStandardMenuPalette, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
gSoftResetDisabled = FALSE;
CreateTask(Task_DestroySelf, 0);
StopMapMusic();

View File

@ -1084,7 +1084,7 @@ u8 AddScrollIndicatorArrowPair(const struct ScrollArrowsTemplate *arrowInfo, u16
if (arrowInfo->palTag == TAG_NONE)
{
LoadPalette(sRedInterface_Pal, (16 * arrowInfo->palNum) + 0x100, 0x20);
LoadPalette(sRedInterface_Pal, OBJ_PLTT_ID(arrowInfo->palNum), PLTT_SIZE_4BPP);
}
else
{
@ -1330,7 +1330,7 @@ static u8 ListMenuAddRedOutlineCursorObject(struct CursorStruct *cursor)
if (cursor->palTag == TAG_NONE)
{
LoadPalette(sRedInterface_Pal, (16 * cursor->palNum) + 0x100, 0x20);
LoadPalette(sRedInterface_Pal, OBJ_PLTT_ID(cursor->palNum), PLTT_SIZE_4BPP);
}
else
{
@ -1415,7 +1415,7 @@ static u8 ListMenuAddRedArrowCursorObject(struct CursorStruct *cursor)
if (cursor->palTag == TAG_NONE)
{
LoadPalette(sRedInterface_Pal, (16 * cursor->palNum) + 0x100, 0x20);
LoadPalette(sRedInterface_Pal, OBJ_PLTT_ID(cursor->palNum), PLTT_SIZE_4BPP);
}
else
{

View File

@ -566,13 +566,13 @@ static bool8 MailReadBuildGraphics(void)
CopyBgTilemapBufferToVram(2);
break;
case 12:
LoadPalette(GetOverworldTextboxPalettePtr(), 240, 32);
LoadPalette(GetOverworldTextboxPalettePtr(), BG_PLTT_ID(15), PLTT_SIZE_4BPP);
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, 0, 32);
LoadPalette(sMailGraphics[sMailRead->mailType].palette, BG_PLTT_ID(0), PLTT_SIZE_4BPP);
gPlttBufferUnfaded[10] = sBgColors[gSaveBlock2Ptr->playerGender][0];
gPlttBufferFaded[10] = sBgColors[gSaveBlock2Ptr->playerGender][0];

View File

@ -571,8 +571,8 @@ static u32 InitMainMenu(bool8 returningFromOptionsMenu)
DmaFill16(3, 0, (void *)(PLTT + 2), PLTT_SIZE - 2);
ResetPaletteFade();
LoadPalette(sMainMenuBgPal, 0, 32);
LoadPalette(sMainMenuTextPal, 0xF0, 32);
LoadPalette(sMainMenuBgPal, BG_PLTT_ID(0), PLTT_SIZE_4BPP);
LoadPalette(sMainMenuTextPal, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
ScanlineEffect_Stop();
ResetTasks();
ResetSpriteData();
@ -750,28 +750,28 @@ static void Task_DisplayMainMenu(u8 taskId)
SetGpuReg(REG_OFFSET_BLDY, 7);
palette = RGB_BLACK;
LoadPalette(&palette, 254, 2);
LoadPalette(&palette, BG_PLTT_ID(15) + 14, PLTT_SIZEOF(1));
palette = RGB_WHITE;
LoadPalette(&palette, 250, 2);
LoadPalette(&palette, BG_PLTT_ID(15) + 10, PLTT_SIZEOF(1));
palette = RGB(12, 12, 12);
LoadPalette(&palette, 251, 2);
LoadPalette(&palette, BG_PLTT_ID(15) + 11, PLTT_SIZEOF(1));
palette = RGB(26, 26, 25);
LoadPalette(&palette, 252, 2);
LoadPalette(&palette, BG_PLTT_ID(15) + 12, PLTT_SIZEOF(1));
// Note: If there is no save file, the save block is zeroed out,
// so the default gender is MALE.
if (gSaveBlock2Ptr->playerGender == MALE)
{
palette = RGB(4, 16, 31);
LoadPalette(&palette, 241, 2);
LoadPalette(&palette, BG_PLTT_ID(15) + 1, PLTT_SIZEOF(1));
}
else
{
palette = RGB(31, 3, 21);
LoadPalette(&palette, 241, 2);
LoadPalette(&palette, BG_PLTT_ID(15) + 1, PLTT_SIZEOF(1));
}
switch (gTasks[taskId].tMenuType)
@ -1274,8 +1274,8 @@ static void Task_NewGameBirchSpeech_Init(u8 taskId)
LZ77UnCompVram(sBirchSpeechShadowGfx, (void *)VRAM);
LZ77UnCompVram(sBirchSpeechBgMap, (void *)(BG_SCREEN_ADDR(7)));
LoadPalette(sBirchSpeechBgPals, 0, 64);
LoadPalette(sBirchSpeechPlatformBlackPal, 1, 16);
LoadPalette(sBirchSpeechBgPals, BG_PLTT_ID(0), 2 * PLTT_SIZE_4BPP);
LoadPalette(sBirchSpeechPlatformBlackPal, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(8));
ScanlineEffect_Stop();
ResetSpriteData();
FreeAllSpritePalettes();
@ -1327,7 +1327,7 @@ static void Task_NewGameBirchSpeech_WaitForSpriteFadeInWelcome(u8 taskId)
{
InitWindows(sNewGameBirchSpeechTextWindows);
LoadMainMenuWindowFrameTiles(0, 0xF3);
LoadMessageBoxGfx(0, 0xFC, 0xF0);
LoadMessageBoxGfx(0, 0xFC, BG_PLTT_ID(15));
NewGameBirchSpeech_ShowDialogueWindow(0, 1);
PutWindowTilemap(0);
CopyWindowToVram(0, COPYWIN_GFX);
@ -1809,8 +1809,8 @@ static void CB2_NewGameBirchSpeech_ReturnFromNamingScreen(void)
ResetPaletteFade();
LZ77UnCompVram(sBirchSpeechShadowGfx, (u8 *)VRAM);
LZ77UnCompVram(sBirchSpeechBgMap, (u8 *)(BG_SCREEN_ADDR(7)));
LoadPalette(sBirchSpeechBgPals, 0, 64);
LoadPalette(&sBirchSpeechBgGradientPal[1], 1, 16);
LoadPalette(sBirchSpeechBgPals, BG_PLTT_ID(0), 2 * PLTT_SIZE_4BPP);
LoadPalette(&sBirchSpeechBgGradientPal[1], BG_PLTT_ID(0) + 1, PLTT_SIZEOF(8));
ResetTasks();
taskId = CreateTask(Task_NewGameBirchSpeech_ReturnFromNamingScreenShowTextbox, 0);
gTasks[taskId].tTimer = 5;
@ -1853,7 +1853,7 @@ static void CB2_NewGameBirchSpeech_ReturnFromNamingScreen(void)
SetMainCallback2(CB2_MainMenu);
InitWindows(sNewGameBirchSpeechTextWindows);
LoadMainMenuWindowFrameTiles(0, 0xF3);
LoadMessageBoxGfx(0, 0xFC, 0xF0);
LoadMessageBoxGfx(0, 0xFC, BG_PLTT_ID(15));
PutWindowTilemap(0);
CopyWindowToVram(0, COPYWIN_FULL);
}
@ -2029,7 +2029,7 @@ static void Task_NewGameBirchSpeech_FadePlatformIn(u8 taskId)
{
gTasks[taskId].tDelayTimer = gTasks[taskId].tDelay;
gTasks[taskId].tPalIndex++;
LoadPalette(&sBirchSpeechBgGradientPal[gTasks[taskId].tPalIndex], 1, 16);
LoadPalette(&sBirchSpeechBgGradientPal[gTasks[taskId].tPalIndex], BG_PLTT_ID(0) + 1, PLTT_SIZEOF(8));
}
}
@ -2063,7 +2063,7 @@ static void Task_NewGameBirchSpeech_FadePlatformOut(u8 taskId)
{
gTasks[taskId].tDelayTimer = gTasks[taskId].tDelay;
gTasks[taskId].tPalIndex--;
LoadPalette(&sBirchSpeechBgGradientPal[gTasks[taskId].tPalIndex], 1, 16);
LoadPalette(&sBirchSpeechBgGradientPal[gTasks[taskId].tPalIndex], BG_PLTT_ID(0) + 1, PLTT_SIZEOF(8));
}
}
@ -2191,7 +2191,7 @@ static void MainMenu_FormatSavegameBadges(void)
static void LoadMainMenuWindowFrameTiles(u8 bgId, u16 tileOffset)
{
LoadBgTiles(bgId, GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType)->tiles, 0x120, tileOffset);
LoadPalette(GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType)->pal, 32, 32);
LoadPalette(GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType)->pal, BG_PLTT_ID(2), PLTT_SIZE_4BPP);
}
static void DrawMainMenuWindowBorder(const struct WindowTemplate *template, u16 baseTileNum)

View File

@ -385,8 +385,8 @@ static void LoadMapNamePopUpWindowBg(void)
CallWindowFunction(popupWindowId, DrawMapNamePopUpFrame);
PutWindowTilemap(popupWindowId);
if (gMapHeader.weather == WEATHER_UNDERWATER_BUBBLES)
LoadPalette(&sMapPopUp_Palette_Underwater, 0xE0, sizeof(sMapPopUp_Palette_Underwater));
LoadPalette(&sMapPopUp_Palette_Underwater, BG_PLTT_ID(14), sizeof(sMapPopUp_Palette_Underwater));
else
LoadPalette(sMapPopUp_PaletteTable[popUpThemeId], 0xE0, sizeof(sMapPopUp_PaletteTable[0]));
LoadPalette(sMapPopUp_PaletteTable[popUpThemeId], BG_PLTT_ID(14), sizeof(sMapPopUp_PaletteTable[0]));
BlitBitmapToWindow(popupWindowId, sMapPopUp_Table[popUpThemeId], 0, 0, 80, 24);
}

View File

@ -1267,8 +1267,8 @@ static bool32 MatchCall_LoadGfx(u8 taskId)
}
FillWindowPixelBuffer(tWindowId, PIXEL_FILL(8));
LoadPalette(sMatchCallWindow_Pal, 0xE0, sizeof(sMatchCallWindow_Pal));
LoadPalette(sPokenavIcon_Pal, 0xF0, sizeof(sPokenavIcon_Pal));
LoadPalette(sMatchCallWindow_Pal, BG_PLTT_ID(14), sizeof(sMatchCallWindow_Pal));
LoadPalette(sPokenavIcon_Pal, BG_PLTT_ID(15), sizeof(sPokenavIcon_Pal));
ChangeBgY(0, -0x2000, BG_COORD_SET);
return TRUE;
}
@ -2102,7 +2102,7 @@ void LoadMatchCallWindowGfx(u32 windowId, u32 destOffset, u32 paletteId)
{
u8 bg = GetWindowAttribute(windowId, WINDOW_BG);
LoadBgTiles(bg, sMatchCallWindow_Gfx, 0x100, destOffset);
LoadPalette(sMatchCallWindow_Pal, paletteId << 4, sizeof(sMatchCallWindow_Pal));
LoadPalette(sMatchCallWindow_Pal, BG_PLTT_ID(paletteId), sizeof(sMatchCallWindow_Pal));
}
void DrawMatchCallTextBoxBorder(u32 windowId, u32 tileOffset, u32 paletteId)

View File

@ -23,6 +23,7 @@
#define DLG_WINDOW_PALETTE_NUM 15
#define DLG_WINDOW_BASE_TILE_NUM 0x200
#define STD_WINDOW_PALETTE_NUM 14
#define STD_WINDOW_PALETTE_SIZE PLTT_SIZEOF(10)
#define STD_WINDOW_BASE_TILE_NUM 0x214
struct MenuInfoIcon
@ -208,8 +209,8 @@ void AddTextPrinterWithCustomSpeedForMessage(bool8 allowSkippingDelayWithButtonP
void LoadMessageBoxAndBorderGfx(void)
{
LoadMessageBoxGfx(0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM * 0x10);
LoadUserWindowBorderGfx(0, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM * 0x10);
LoadMessageBoxGfx(0, DLG_WINDOW_BASE_TILE_NUM, BG_PLTT_ID(DLG_WINDOW_PALETTE_NUM));
LoadUserWindowBorderGfx(0, STD_WINDOW_BASE_TILE_NUM, BG_PLTT_ID(STD_WINDOW_PALETTE_NUM));
}
void DrawDialogueFrame(u8 windowId, bool8 copyToVram)
@ -427,18 +428,18 @@ void SetStandardWindowBorderStyle(u8 windowId, bool8 copyToVram)
void LoadMessageBoxAndFrameGfx(u8 windowId, bool8 copyToVram)
{
LoadMessageBoxGfx(windowId, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM * 0x10);
DrawDialogFrameWithCustomTileAndPalette(windowId, copyToVram, DLG_WINDOW_BASE_TILE_NUM, 0xF);
LoadMessageBoxGfx(windowId, DLG_WINDOW_BASE_TILE_NUM, BG_PLTT_ID(DLG_WINDOW_PALETTE_NUM));
DrawDialogFrameWithCustomTileAndPalette(windowId, copyToVram, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM);
}
void Menu_LoadStdPal(void)
{
LoadPalette(gStandardMenuPalette, STD_WINDOW_PALETTE_NUM * 0x10, 0x14);
LoadPalette(gStandardMenuPalette, BG_PLTT_ID(STD_WINDOW_PALETTE_NUM), STD_WINDOW_PALETTE_SIZE);
}
void Menu_LoadStdPalAt(u16 offset)
{
LoadPalette(gStandardMenuPalette, offset, 0x14);
LoadPalette(gStandardMenuPalette, offset, STD_WINDOW_PALETTE_SIZE);
}
// Unused
@ -550,7 +551,7 @@ void AddTextPrinterWithCallbackForMessage(bool8 canSpeedUp, void (*callback)(str
void EraseFieldMessageBox(bool8 copyToVram)
{
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 0x11);
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 17);
if (copyToVram == TRUE)
CopyBgTilemapBufferToVram(0);
}
@ -806,9 +807,9 @@ u8 HofPCTopBar_AddWindow(u8 bg, u8 xPos, u8 yPos, u8 palette, u16 baseTile)
sHofPCTopBarWindowId = AddWindow(&window);
if (palette > 15)
palette = 15 * 16;
palette = BG_PLTT_ID(15);
else
palette *= 16;
palette = BG_PLTT_ID(palette);
LoadPalette(sHofPC_TopBar_Pal, palette, sizeof(sHofPC_TopBar_Pal));
return sHofPCTopBarWindowId;
@ -2084,7 +2085,7 @@ static void UnusedBlitBitmapRect(const struct Bitmap *src, struct Bitmap *dst, u
// Unused
static void LoadMonIconPalAtOffset(u8 palOffset, u16 speciesId)
{
LoadPalette(GetValidMonIconPalettePtr(speciesId), palOffset, 0x20);
LoadPalette(GetValidMonIconPalettePtr(speciesId), palOffset, PLTT_SIZE_4BPP);
}
// Unused
@ -2111,7 +2112,7 @@ void ListMenuLoadStdPalAt(u8 palOffset, u8 palId)
break;
}
LoadPalette(palette, palOffset, 0x20);
LoadPalette(palette, palOffset, PLTT_SIZE_4BPP);
}
void BlitMenuInfoIcon(u8 windowId, u8 iconId, u16 x, u16 y)

View File

@ -114,7 +114,7 @@ static const struct WindowTemplate sMoveRelearnerWindowTemplates[] =
.tilemapTop = 1,
.width = 16,
.height = 12,
.paletteNum = 0xF,
.paletteNum = 15,
.baseBlock = 0xA
},
{
@ -123,7 +123,7 @@ static const struct WindowTemplate sMoveRelearnerWindowTemplates[] =
.tilemapTop = 1,
.width = 16,
.height = 12,
.paletteNum = 0xF,
.paletteNum = 15,
.baseBlock = 0xCA
},
{
@ -132,7 +132,7 @@ static const struct WindowTemplate sMoveRelearnerWindowTemplates[] =
.tilemapTop = 1,
.width = 10,
.height = 12,
.paletteNum = 0xF,
.paletteNum = 15,
.baseBlock = 0x18A
},
{
@ -141,7 +141,7 @@ static const struct WindowTemplate sMoveRelearnerWindowTemplates[] =
.tilemapTop = 15,
.width = 22,
.height = 4,
.paletteNum = 0xF,
.paletteNum = 15,
.baseBlock = 0x202
},
{
@ -150,7 +150,7 @@ static const struct WindowTemplate sMoveRelearnerWindowTemplates[] =
.tilemapTop = 8,
.width = 5,
.height = 4,
.paletteNum = 0xF,
.paletteNum = 15,
.baseBlock = 0x25A
},
DUMMY_WIN_TEMPLATE
@ -163,7 +163,7 @@ static const struct WindowTemplate sMoveRelearnerYesNoMenuTemplate =
.tilemapTop = 8,
.width = 5,
.height = 4,
.paletteNum = 0xF,
.paletteNum = 15,
.baseBlock = 0x25A
};
@ -707,8 +707,8 @@ void InitMoveRelearnerWindows(bool8 useContextWindow)
InitWindows(sMoveRelearnerWindowTemplates);
DeactivateAllTextPrinters();
LoadUserWindowBorderGfx(0, 1, 0xE0);
LoadPalette(gStandardMenuPalette, 0xF0, 0x20);
LoadUserWindowBorderGfx(0, 1, BG_PLTT_ID(14));
LoadPalette(gStandardMenuPalette, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
for (i = 0; i < ARRAY_COUNT(sMoveRelearnerWindowTemplates) - 1; i++)
FillWindowPixelBuffer(i, PIXEL_FILL(1));

View File

@ -405,7 +405,7 @@ static void CB2_InitLearnMove(void)
CreateUISprites();
sMoveRelearnerStruct->moveListMenuTask = ListMenuInit(&gMultiuseListMenuTemplate, sMoveRelearnerMenuSate.listOffset, sMoveRelearnerMenuSate.listRow);
FillPalette(RGB_BLACK, 0, 2);
SetBackdropFromColor(RGB_BLACK);
SetMainCallback2(CB2_MoveRelearnerMain);
}
@ -430,7 +430,7 @@ static void CB2_InitLearnMoveReturnFromSelectMove(void)
CreateUISprites();
sMoveRelearnerStruct->moveListMenuTask = ListMenuInit(&gMultiuseListMenuTemplate, sMoveRelearnerMenuSate.listOffset, sMoveRelearnerMenuSate.listRow);
FillPalette(RGB_BLACK, 0, 2);
SetBackdropFromColor(RGB_BLACK);
SetMainCallback2(CB2_MoveRelearnerMain);
}

View File

@ -91,8 +91,8 @@ void CB2_InitMysteryEventMenu(void)
FillWindowPixelBuffer(i, PIXEL_FILL(0));
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
LoadUserWindowBorderGfx(0, 1u, 0xD0u);
Menu_LoadStdPalAt(0xE0);
LoadUserWindowBorderGfx(0, 1, BG_PLTT_ID(13));
Menu_LoadStdPalAt(BG_PLTT_ID(14));
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON);
SetGpuReg(REG_OFFSET_BLDCNT, 0);
CreateTask(Task_DestroySelf, 0);
@ -102,7 +102,7 @@ void CB2_InitMysteryEventMenu(void)
BuildOamBuffer();
RunTextPrinters();
UpdatePaletteFade();
FillPalette(RGB_BLACK, 0, 2);
SetBackdropFromColor(RGB_BLACK);
SetMainCallback2(CB2_MysteryEventMenu);
}
}

View File

@ -33,7 +33,7 @@
#include "constants/cable_club.h"
#define LIST_MENU_TILE_NUM 10
#define LIST_MENU_PAL_NUM 224
#define LIST_MENU_PAL_NUM BG_PLTT_ID(14)
static void LoadMysteryGiftTextboxBorder(u8 bgId);
static void CreateMysteryGiftTask(void);
@ -411,14 +411,14 @@ static bool32 HandleMysteryGiftOrEReaderSetup(s32 isEReader)
gMain.state++;
break;
case 1:
LoadPalette(sTextboxBorder_Pal, 0, 0x20);
LoadPalette(GetTextWindowPalette(2), 0xd0, 0x20);
Menu_LoadStdPalAt(0xC0);
LoadUserWindowBorderGfx(0, 0xA, 0xE0);
LoadUserWindowBorderGfx_(0, 0x1, 0xF0);
FillBgTilemapBufferRect(0, 0x000, 0, 0, 32, 32, 0x11);
FillBgTilemapBufferRect(1, 0x000, 0, 0, 32, 32, 0x11);
FillBgTilemapBufferRect(2, 0x000, 0, 0, 32, 32, 0x11);
LoadPalette(sTextboxBorder_Pal, BG_PLTT_ID(0), PLTT_SIZE_4BPP);
LoadPalette(GetTextWindowPalette(2), BG_PLTT_ID(13), PLTT_SIZE_4BPP);
Menu_LoadStdPalAt(BG_PLTT_ID(12));
LoadUserWindowBorderGfx(0, 0xA, BG_PLTT_ID(14));
LoadUserWindowBorderGfx_(0, 0x1, BG_PLTT_ID(15));
FillBgTilemapBufferRect(0, 0x000, 0, 0, 32, 32, 17);
FillBgTilemapBufferRect(1, 0x000, 0, 0, 32, 32, 17);
FillBgTilemapBufferRect(2, 0x000, 0, 0, 32, 32, 17);
MG_DrawCheckerboardPattern(3);
PrintMysteryGiftOrEReaderTopMenu(isEReader, FALSE);
gMain.state++;
@ -505,16 +505,16 @@ void MG_DrawCheckerboardPattern(u32 bg)
{
s32 i = 0, j;
FillBgTilemapBufferRect(bg, 0x003, 0, 0, 32, 2, 0x11);
FillBgTilemapBufferRect(bg, 0x003, 0, 0, 32, 2, 17);
for (i = 0; i < 18; i++)
{
for (j = 0; j < 32; j++)
{
if ((i & 1) != (j & 1))
FillBgTilemapBufferRect(bg, 1, j, i + 2, 1, 1, 0x11);
FillBgTilemapBufferRect(bg, 1, j, i + 2, 1, 1, 17);
else
FillBgTilemapBufferRect(bg, 2, j, i + 2, 1, 1, 0x11);
FillBgTilemapBufferRect(bg, 2, j, i + 2, 1, 1, 17);
}
}
}
@ -524,10 +524,10 @@ static void ClearScreenInBg0(bool32 ignoreTopTwoRows)
switch (ignoreTopTwoRows)
{
case 0:
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 0x11);
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 32, 17);
break;
case 1:
FillBgTilemapBufferRect(0, 0, 0, 2, 32, 30, 0x11);
FillBgTilemapBufferRect(0, 0, 0, 2, 32, 30, 17);
break;
}
CopyBgTilemapBufferToVram(0);

View File

@ -240,9 +240,9 @@ s32 WonderCard_Enter(void)
case 3:
if (FreeTempTileDataBuffersIfPossible())
return 0;
LoadPalette(GetTextWindowPalette(1), 0x20, 0x20);
LoadPalette(GetTextWindowPalette(1), BG_PLTT_ID(2), PLTT_SIZE_4BPP);
gPaletteFade.bufferTransferDisabled = TRUE;
LoadPalette(sWonderCardData->gfx->pal, 0x10, 0x20);
LoadPalette(sWonderCardData->gfx->pal, BG_PLTT_ID(1), PLTT_SIZE_4BPP);
LZ77UnCompWram(sWonderCardData->gfx->map, sWonderCardData->bgTilemapBuffer);
CopyRectToBgTilemapBufferRect(2, sWonderCardData->bgTilemapBuffer, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 1, 0x008, 0);
CopyBgTilemapBufferToVram(2);
@ -703,9 +703,9 @@ s32 WonderNews_Enter(void)
case 3:
if (FreeTempTileDataBuffersIfPossible())
return 0;
LoadPalette(GetTextWindowPalette(1), 0x20, 0x20);
LoadPalette(GetTextWindowPalette(1), BG_PLTT_ID(2), PLTT_SIZE_4BPP);
gPaletteFade.bufferTransferDisabled = TRUE;
LoadPalette(sWonderNewsData->gfx->pal, 0x10, 0x20);
LoadPalette(sWonderNewsData->gfx->pal, BG_PLTT_ID(1), PLTT_SIZE_4BPP);
LZ77UnCompWram(sWonderNewsData->gfx->map, sWonderNewsData->bgTilemapBuffer);
CopyRectToBgTilemapBufferRect(1, sWonderNewsData->bgTilemapBuffer, 0, 0, DISPLAY_TILE_WIDTH, 3, 0, 0, DISPLAY_TILE_WIDTH, 3, 1, 8, 0);
CopyRectToBgTilemapBufferRect(3, sWonderNewsData->bgTilemapBuffer, 0, 3, DISPLAY_TILE_WIDTH, 3 + DISPLAY_TILE_HEIGHT, 0, 3, DISPLAY_TILE_WIDTH, 3 + DISPLAY_TILE_HEIGHT, 1, 8, 0);

View File

@ -1880,9 +1880,9 @@ static void CreateHelperTasks(void)
static void LoadPalettes(void)
{
LoadPalette(gNamingScreenMenu_Pal, 0, sizeof(gNamingScreenMenu_Pal));
LoadPalette(sKeyboard_Pal, 0xA0, sizeof(sKeyboard_Pal));
LoadPalette(GetTextWindowPalette(2), 0xB0, 0x20);
LoadPalette(gNamingScreenMenu_Pal, BG_PLTT_ID(0), sizeof(gNamingScreenMenu_Pal));
LoadPalette(sKeyboard_Pal, BG_PLTT_ID(10), sizeof(sKeyboard_Pal));
LoadPalette(GetTextWindowPalette(2), BG_PLTT_ID(11), PLTT_SIZE_4BPP);
}
static void DrawBgTilemap(u8 bg, const void *src)

View File

@ -1,34 +1,29 @@
#include "global.h"
#include "option_menu.h"
#include "main.h"
#include "menu.h"
#include "scanline_effect.h"
#include "palette.h"
#include "sprite.h"
#include "task.h"
#include "bg.h"
#include "gpu_regs.h"
#include "window.h"
#include "international_string_util.h"
#include "main.h"
#include "menu.h"
#include "palette.h"
#include "scanline_effect.h"
#include "sprite.h"
#include "strings.h"
#include "task.h"
#include "text.h"
#include "text_window.h"
#include "international_string_util.h"
#include "strings.h"
#include "window.h"
#include "gba/m4a_internal.h"
#include "constants/rgb.h"
// Task data
enum
{
TD_MENUSELECTION,
TD_TEXTSPEED,
TD_BATTLESCENE,
TD_BATTLESTYLE,
TD_SOUND,
TD_BUTTONMODE,
TD_FRAMETYPE,
};
#define tMenuSelection data[0]
#define tTextSpeed data[1]
#define tBattleSceneOff data[2]
#define tBattleStyle data[3]
#define tSound data[4]
#define tButtonMode data[5]
#define tWindowFrameType data[6]
// Menu items
enum
{
MENUITEM_TEXTSPEED,
@ -41,10 +36,9 @@ enum
MENUITEM_COUNT,
};
// Window Ids
enum
{
WIN_TEXT_OPTION,
WIN_HEADER,
WIN_OPTIONS
};
@ -55,25 +49,24 @@ enum
#define YPOS_BUTTONMODE (MENUITEM_BUTTONMODE * 16)
#define YPOS_FRAMETYPE (MENUITEM_FRAMETYPE * 16)
// this file's functions
static void Task_OptionMenuFadeIn(u8 taskId);
static void Task_OptionMenuProcessInput(u8 taskId);
static void Task_OptionMenuSave(u8 taskId);
static void Task_OptionMenuFadeOut(u8 taskId);
static void HighlightOptionMenuItem(u8 selection);
static u8 TextSpeed_ProcessInput(u8 selection);
static u8 TextSpeed_ProcessInput(u8 selection);
static void TextSpeed_DrawChoices(u8 selection);
static u8 BattleScene_ProcessInput(u8 selection);
static u8 BattleScene_ProcessInput(u8 selection);
static void BattleScene_DrawChoices(u8 selection);
static u8 BattleStyle_ProcessInput(u8 selection);
static u8 BattleStyle_ProcessInput(u8 selection);
static void BattleStyle_DrawChoices(u8 selection);
static u8 Sound_ProcessInput(u8 selection);
static u8 Sound_ProcessInput(u8 selection);
static void Sound_DrawChoices(u8 selection);
static u8 FrameType_ProcessInput(u8 selection);
static u8 FrameType_ProcessInput(u8 selection);
static void FrameType_DrawChoices(u8 selection);
static u8 ButtonMode_ProcessInput(u8 selection);
static u8 ButtonMode_ProcessInput(u8 selection);
static void ButtonMode_DrawChoices(u8 selection);
static void DrawTextOption(void);
static void DrawHeaderText(void);
static void DrawOptionMenuTexts(void);
static void DrawBgWindowFrames(void);
@ -96,7 +89,7 @@ static const u8 *const sOptionMenuItemsNames[MENUITEM_COUNT] =
static const struct WindowTemplate sOptionMenuWinTemplates[] =
{
{
[WIN_HEADER] = {
.bg = 1,
.tilemapLeft = 2,
.tilemapTop = 1,
@ -105,7 +98,7 @@ static const struct WindowTemplate sOptionMenuWinTemplates[] =
.paletteNum = 1,
.baseBlock = 2
},
{
[WIN_OPTIONS] = {
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 5,
@ -119,29 +112,28 @@ static const struct WindowTemplate sOptionMenuWinTemplates[] =
static const struct BgTemplate sOptionMenuBgTemplates[] =
{
{
.bg = 1,
.charBaseIndex = 1,
.mapBaseIndex = 30,
.screenSize = 0,
.paletteMode = 0,
.priority = 0,
.baseTile = 0
},
{
.bg = 0,
.charBaseIndex = 1,
.mapBaseIndex = 31,
.screenSize = 0,
.paletteMode = 0,
.priority = 1,
.baseTile = 0
}
{
.bg = 1,
.charBaseIndex = 1,
.mapBaseIndex = 30,
.screenSize = 0,
.paletteMode = 0,
.priority = 0,
.baseTile = 0
},
{
.bg = 0,
.charBaseIndex = 1,
.mapBaseIndex = 31,
.screenSize = 0,
.paletteMode = 0,
.priority = 1,
.baseTile = 0
}
};
static const u16 sOptionMenuBg_Pal[] = {RGB(17, 18, 31)};
// code
static void MainCB2(void)
{
RunTasks();
@ -207,24 +199,24 @@ void CB2_InitOptionMenu(void)
gMain.state++;
break;
case 4:
LoadPalette(sOptionMenuBg_Pal, 0, sizeof(sOptionMenuBg_Pal));
LoadPalette(GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType)->pal, 0x70, 0x20);
LoadPalette(sOptionMenuBg_Pal, BG_PLTT_ID(0), sizeof(sOptionMenuBg_Pal));
LoadPalette(GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType)->pal, BG_PLTT_ID(7), PLTT_SIZE_4BPP);
gMain.state++;
break;
case 5:
LoadPalette(sOptionMenuText_Pal, 16, sizeof(sOptionMenuText_Pal));
LoadPalette(sOptionMenuText_Pal, BG_PLTT_ID(1), sizeof(sOptionMenuText_Pal));
gMain.state++;
break;
case 6:
PutWindowTilemap(0);
DrawTextOption();
PutWindowTilemap(WIN_HEADER);
DrawHeaderText();
gMain.state++;
break;
case 7:
gMain.state++;
break;
case 8:
PutWindowTilemap(1);
PutWindowTilemap(WIN_OPTIONS);
DrawOptionMenuTexts();
gMain.state++;
case 9:
@ -235,28 +227,28 @@ void CB2_InitOptionMenu(void)
{
u8 taskId = CreateTask(Task_OptionMenuFadeIn, 0);
gTasks[taskId].data[TD_MENUSELECTION] = 0;
gTasks[taskId].data[TD_TEXTSPEED] = gSaveBlock2Ptr->optionsTextSpeed;
gTasks[taskId].data[TD_BATTLESCENE] = gSaveBlock2Ptr->optionsBattleSceneOff;
gTasks[taskId].data[TD_BATTLESTYLE] = gSaveBlock2Ptr->optionsBattleStyle;
gTasks[taskId].data[TD_SOUND] = gSaveBlock2Ptr->optionsSound;
gTasks[taskId].data[TD_BUTTONMODE] = gSaveBlock2Ptr->optionsButtonMode;
gTasks[taskId].data[TD_FRAMETYPE] = gSaveBlock2Ptr->optionsWindowFrameType;
gTasks[taskId].tMenuSelection = 0;
gTasks[taskId].tTextSpeed = gSaveBlock2Ptr->optionsTextSpeed;
gTasks[taskId].tBattleSceneOff = gSaveBlock2Ptr->optionsBattleSceneOff;
gTasks[taskId].tBattleStyle = gSaveBlock2Ptr->optionsBattleStyle;
gTasks[taskId].tSound = gSaveBlock2Ptr->optionsSound;
gTasks[taskId].tButtonMode = gSaveBlock2Ptr->optionsButtonMode;
gTasks[taskId].tWindowFrameType = gSaveBlock2Ptr->optionsWindowFrameType;
TextSpeed_DrawChoices(gTasks[taskId].data[TD_TEXTSPEED]);
BattleScene_DrawChoices(gTasks[taskId].data[TD_BATTLESCENE]);
BattleStyle_DrawChoices(gTasks[taskId].data[TD_BATTLESTYLE]);
Sound_DrawChoices(gTasks[taskId].data[TD_SOUND]);
ButtonMode_DrawChoices(gTasks[taskId].data[TD_BUTTONMODE]);
FrameType_DrawChoices(gTasks[taskId].data[TD_FRAMETYPE]);
HighlightOptionMenuItem(gTasks[taskId].data[TD_MENUSELECTION]);
TextSpeed_DrawChoices(gTasks[taskId].tTextSpeed);
BattleScene_DrawChoices(gTasks[taskId].tBattleSceneOff);
BattleStyle_DrawChoices(gTasks[taskId].tBattleStyle);
Sound_DrawChoices(gTasks[taskId].tSound);
ButtonMode_DrawChoices(gTasks[taskId].tButtonMode);
FrameType_DrawChoices(gTasks[taskId].tWindowFrameType);
HighlightOptionMenuItem(gTasks[taskId].tMenuSelection);
CopyWindowToVram(WIN_OPTIONS, COPYWIN_FULL);
gMain.state++;
break;
}
case 11:
BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK);
BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK);
SetVBlankCallback(VBlankCB);
SetMainCallback2(MainCB2);
return;
@ -273,7 +265,7 @@ static void Task_OptionMenuProcessInput(u8 taskId)
{
if (JOY_NEW(A_BUTTON))
{
if (gTasks[taskId].data[TD_MENUSELECTION] == MENUITEM_CANCEL)
if (gTasks[taskId].tMenuSelection == MENUITEM_CANCEL)
gTasks[taskId].func = Task_OptionMenuSave;
}
else if (JOY_NEW(B_BUTTON))
@ -282,67 +274,67 @@ static void Task_OptionMenuProcessInput(u8 taskId)
}
else if (JOY_NEW(DPAD_UP))
{
if (gTasks[taskId].data[TD_MENUSELECTION] > 0)
gTasks[taskId].data[TD_MENUSELECTION]--;
if (gTasks[taskId].tMenuSelection > 0)
gTasks[taskId].tMenuSelection--;
else
gTasks[taskId].data[TD_MENUSELECTION] = MENUITEM_CANCEL;
HighlightOptionMenuItem(gTasks[taskId].data[TD_MENUSELECTION]);
gTasks[taskId].tMenuSelection = MENUITEM_CANCEL;
HighlightOptionMenuItem(gTasks[taskId].tMenuSelection);
}
else if (JOY_NEW(DPAD_DOWN))
{
if (gTasks[taskId].data[TD_MENUSELECTION] < MENUITEM_CANCEL)
gTasks[taskId].data[TD_MENUSELECTION]++;
if (gTasks[taskId].tMenuSelection < MENUITEM_CANCEL)
gTasks[taskId].tMenuSelection++;
else
gTasks[taskId].data[TD_MENUSELECTION] = 0;
HighlightOptionMenuItem(gTasks[taskId].data[TD_MENUSELECTION]);
gTasks[taskId].tMenuSelection = 0;
HighlightOptionMenuItem(gTasks[taskId].tMenuSelection);
}
else
{
u8 previousOption;
switch (gTasks[taskId].data[TD_MENUSELECTION])
switch (gTasks[taskId].tMenuSelection)
{
case MENUITEM_TEXTSPEED:
previousOption = gTasks[taskId].data[TD_TEXTSPEED];
gTasks[taskId].data[TD_TEXTSPEED] = TextSpeed_ProcessInput(gTasks[taskId].data[TD_TEXTSPEED]);
previousOption = gTasks[taskId].tTextSpeed;
gTasks[taskId].tTextSpeed = TextSpeed_ProcessInput(gTasks[taskId].tTextSpeed);
if (previousOption != gTasks[taskId].data[TD_TEXTSPEED])
TextSpeed_DrawChoices(gTasks[taskId].data[TD_TEXTSPEED]);
if (previousOption != gTasks[taskId].tTextSpeed)
TextSpeed_DrawChoices(gTasks[taskId].tTextSpeed);
break;
case MENUITEM_BATTLESCENE:
previousOption = gTasks[taskId].data[TD_BATTLESCENE];
gTasks[taskId].data[TD_BATTLESCENE] = BattleScene_ProcessInput(gTasks[taskId].data[TD_BATTLESCENE]);
previousOption = gTasks[taskId].tBattleSceneOff;
gTasks[taskId].tBattleSceneOff = BattleScene_ProcessInput(gTasks[taskId].tBattleSceneOff);
if (previousOption != gTasks[taskId].data[TD_BATTLESCENE])
BattleScene_DrawChoices(gTasks[taskId].data[TD_BATTLESCENE]);
if (previousOption != gTasks[taskId].tBattleSceneOff)
BattleScene_DrawChoices(gTasks[taskId].tBattleSceneOff);
break;
case MENUITEM_BATTLESTYLE:
previousOption = gTasks[taskId].data[TD_BATTLESTYLE];
gTasks[taskId].data[TD_BATTLESTYLE] = BattleStyle_ProcessInput(gTasks[taskId].data[TD_BATTLESTYLE]);
previousOption = gTasks[taskId].tBattleStyle;
gTasks[taskId].tBattleStyle = BattleStyle_ProcessInput(gTasks[taskId].tBattleStyle);
if (previousOption != gTasks[taskId].data[TD_BATTLESTYLE])
BattleStyle_DrawChoices(gTasks[taskId].data[TD_BATTLESTYLE]);
if (previousOption != gTasks[taskId].tBattleStyle)
BattleStyle_DrawChoices(gTasks[taskId].tBattleStyle);
break;
case MENUITEM_SOUND:
previousOption = gTasks[taskId].data[TD_SOUND];
gTasks[taskId].data[TD_SOUND] = Sound_ProcessInput(gTasks[taskId].data[TD_SOUND]);
previousOption = gTasks[taskId].tSound;
gTasks[taskId].tSound = Sound_ProcessInput(gTasks[taskId].tSound);
if (previousOption != gTasks[taskId].data[TD_SOUND])
Sound_DrawChoices(gTasks[taskId].data[TD_SOUND]);
if (previousOption != gTasks[taskId].tSound)
Sound_DrawChoices(gTasks[taskId].tSound);
break;
case MENUITEM_BUTTONMODE:
previousOption = gTasks[taskId].data[TD_BUTTONMODE];
gTasks[taskId].data[TD_BUTTONMODE] = ButtonMode_ProcessInput(gTasks[taskId].data[TD_BUTTONMODE]);
previousOption = gTasks[taskId].tButtonMode;
gTasks[taskId].tButtonMode = ButtonMode_ProcessInput(gTasks[taskId].tButtonMode);
if (previousOption != gTasks[taskId].data[TD_BUTTONMODE])
ButtonMode_DrawChoices(gTasks[taskId].data[TD_BUTTONMODE]);
if (previousOption != gTasks[taskId].tButtonMode)
ButtonMode_DrawChoices(gTasks[taskId].tButtonMode);
break;
case MENUITEM_FRAMETYPE:
previousOption = gTasks[taskId].data[TD_FRAMETYPE];
gTasks[taskId].data[TD_FRAMETYPE] = FrameType_ProcessInput(gTasks[taskId].data[TD_FRAMETYPE]);
previousOption = gTasks[taskId].tWindowFrameType;
gTasks[taskId].tWindowFrameType = FrameType_ProcessInput(gTasks[taskId].tWindowFrameType);
if (previousOption != gTasks[taskId].data[TD_FRAMETYPE])
FrameType_DrawChoices(gTasks[taskId].data[TD_FRAMETYPE]);
if (previousOption != gTasks[taskId].tWindowFrameType)
FrameType_DrawChoices(gTasks[taskId].tWindowFrameType);
break;
default:
return;
@ -358,14 +350,14 @@ static void Task_OptionMenuProcessInput(u8 taskId)
static void Task_OptionMenuSave(u8 taskId)
{
gSaveBlock2Ptr->optionsTextSpeed = gTasks[taskId].data[TD_TEXTSPEED];
gSaveBlock2Ptr->optionsBattleSceneOff = gTasks[taskId].data[TD_BATTLESCENE];
gSaveBlock2Ptr->optionsBattleStyle = gTasks[taskId].data[TD_BATTLESTYLE];
gSaveBlock2Ptr->optionsSound = gTasks[taskId].data[TD_SOUND];
gSaveBlock2Ptr->optionsButtonMode = gTasks[taskId].data[TD_BUTTONMODE];
gSaveBlock2Ptr->optionsWindowFrameType = gTasks[taskId].data[TD_FRAMETYPE];
gSaveBlock2Ptr->optionsTextSpeed = gTasks[taskId].tTextSpeed;
gSaveBlock2Ptr->optionsBattleSceneOff = gTasks[taskId].tBattleSceneOff;
gSaveBlock2Ptr->optionsBattleStyle = gTasks[taskId].tBattleStyle;
gSaveBlock2Ptr->optionsSound = gTasks[taskId].tSound;
gSaveBlock2Ptr->optionsButtonMode = gTasks[taskId].tButtonMode;
gSaveBlock2Ptr->optionsWindowFrameType = gTasks[taskId].tWindowFrameType;
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK);
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK);
gTasks[taskId].func = Task_OptionMenuFadeOut;
}
@ -390,13 +382,13 @@ static void DrawOptionMenuChoice(const u8 *text, u8 x, u8 y, u8 style)
u8 dst[16];
u16 i;
for (i = 0; *text != EOS && i <= 14; i++)
for (i = 0; *text != EOS && i < ARRAY_COUNT(dst) - 1; i++)
dst[i] = *(text++);
if (style != 0)
{
dst[2] = 4;
dst[5] = 5;
dst[2] = TEXT_COLOR_RED;
dst[5] = TEXT_COLOR_LIGHT_RED;
}
dst[i] = EOS;
@ -529,7 +521,7 @@ static u8 FrameType_ProcessInput(u8 selection)
selection = 0;
LoadBgTiles(1, GetWindowFrameTilesPal(selection)->tiles, 0x120, 0x1A2);
LoadPalette(GetWindowFrameTilesPal(selection)->pal, 0x70, 0x20);
LoadPalette(GetWindowFrameTilesPal(selection)->pal, BG_PLTT_ID(7), PLTT_SIZE_4BPP);
sArrowPressed = TRUE;
}
if (JOY_NEW(DPAD_LEFT))
@ -540,7 +532,7 @@ static u8 FrameType_ProcessInput(u8 selection)
selection = WINDOW_FRAMES_COUNT - 1;
LoadBgTiles(1, GetWindowFrameTilesPal(selection)->tiles, 0x120, 0x1A2);
LoadPalette(GetWindowFrameTilesPal(selection)->pal, 0x70, 0x20);
LoadPalette(GetWindowFrameTilesPal(selection)->pal, BG_PLTT_ID(7), PLTT_SIZE_4BPP);
sArrowPressed = TRUE;
}
return selection;
@ -567,7 +559,7 @@ static void FrameType_DrawChoices(u8 selection)
{
text[i] = n % 10 + CHAR_0;
i++;
text[i] = 0x77;
text[i] = CHAR_SPACER;
i++;
}
@ -623,11 +615,11 @@ static void ButtonMode_DrawChoices(u8 selection)
DrawOptionMenuChoice(gText_ButtonTypeLEqualsA, GetStringRightAlignXOffset(FONT_NORMAL, gText_ButtonTypeLEqualsA, 198), YPOS_BUTTONMODE, styles[2]);
}
static void DrawTextOption(void)
static void DrawHeaderText(void)
{
FillWindowPixelBuffer(WIN_TEXT_OPTION, PIXEL_FILL(1));
AddTextPrinterParameterized(WIN_TEXT_OPTION, FONT_NORMAL, gText_Option, 8, 1, TEXT_SKIP_DRAW, NULL);
CopyWindowToVram(WIN_TEXT_OPTION, COPYWIN_FULL);
FillWindowPixelBuffer(WIN_HEADER, PIXEL_FILL(1));
AddTextPrinterParameterized(WIN_HEADER, FONT_NORMAL, gText_Option, 8, 1, TEXT_SKIP_DRAW, NULL);
CopyWindowToVram(WIN_HEADER, COPYWIN_FULL);
}
static void DrawOptionMenuTexts(void)

View File

@ -742,8 +742,8 @@ static bool8 AllocPartyMenuBgGfx(void)
}
break;
case 2:
LoadCompressedPalette(gPartyMenuBg_Pal, 0, 0x160);
CpuCopy16(gPlttBufferUnfaded, sPartyMenuInternal->palBuffer, 0x160);
LoadCompressedPalette(gPartyMenuBg_Pal, BG_PLTT_ID(0), 11 * PLTT_SIZE_4BPP);
CpuCopy16(gPlttBufferUnfaded, sPartyMenuInternal->palBuffer, 11 * PLTT_SIZE_4BPP);
sPartyMenuInternal->data[0]++;
break;
case 3:
@ -2089,9 +2089,9 @@ static void InitPartyMenuWindows(u8 layout)
DeactivateAllTextPrinters();
for (i = 0; i < PARTY_SIZE; i++)
FillWindowPixelBuffer(i, PIXEL_FILL(0));
LoadUserWindowBorderGfx(0, 0x4F, 0xD0);
LoadPalette(GetOverworldTextboxPalettePtr(), 0xE0, 0x20);
LoadPalette(gStandardMenuPalette, 0xF0, 0x20);
LoadUserWindowBorderGfx(0, 0x4F, BG_PLTT_ID(13));
LoadPalette(GetOverworldTextboxPalettePtr(), BG_PLTT_ID(14), PLTT_SIZE_4BPP);
LoadPalette(gStandardMenuPalette, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
}
static void CreateCancelConfirmWindows(bool8 chooseHalf)
@ -2193,9 +2193,9 @@ static void DrawEmptySlot(u8 windowId)
#define LOAD_PARTY_BOX_PAL(paletteIds, paletteOffsets) \
{ \
LoadPalette(GetPartyMenuPalBufferPtr(paletteIds[0]), paletteOffsets[0] + palNum, 2); \
LoadPalette(GetPartyMenuPalBufferPtr(paletteIds[1]), paletteOffsets[1] + palNum, 2); \
LoadPalette(GetPartyMenuPalBufferPtr(paletteIds[2]), paletteOffsets[2] + palNum, 2); \
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)); \
}
static void LoadPartyBoxPalette(struct PartyMenuBox *menuBox, u8 palFlags)
@ -2337,13 +2337,13 @@ static void DisplayPartyPokemonGender(u8 gender, u16 species, u8 *nickname, stru
switch (gender)
{
case MON_MALE:
LoadPalette(GetPartyMenuPalBufferPtr(sGenderMalePalIds[0]), sGenderPalOffsets[0] + palNum, 2);
LoadPalette(GetPartyMenuPalBufferPtr(sGenderMalePalIds[1]), sGenderPalOffsets[1] + palNum, 2);
LoadPalette(GetPartyMenuPalBufferPtr(sGenderMalePalIds[0]), sGenderPalOffsets[0] + palNum, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sGenderMalePalIds[1]), sGenderPalOffsets[1] + palNum, PLTT_SIZEOF(1));
DisplayPartyPokemonBarDetail(menuBox->windowId, gText_MaleSymbol, 2, &menuBox->infoRects->dimensions[8]);
break;
case MON_FEMALE:
LoadPalette(GetPartyMenuPalBufferPtr(sGenderFemalePalIds[0]), sGenderPalOffsets[0] + palNum, 2);
LoadPalette(GetPartyMenuPalBufferPtr(sGenderFemalePalIds[1]), sGenderPalOffsets[1] + palNum, 2);
LoadPalette(GetPartyMenuPalBufferPtr(sGenderFemalePalIds[0]), sGenderPalOffsets[0] + palNum, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sGenderFemalePalIds[1]), sGenderPalOffsets[1] + palNum, PLTT_SIZEOF(1));
DisplayPartyPokemonBarDetail(menuBox->windowId, gText_FemaleSymbol, 2, &menuBox->infoRects->dimensions[8]);
break;
}
@ -2404,16 +2404,16 @@ static void DisplayPartyPokemonHPBar(u16 hp, u16 maxhp, struct PartyMenuBox *men
{
case HP_BAR_GREEN:
case HP_BAR_FULL:
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarGreenPalIds[0]), sHPBarPalOffsets[0] + palNum, 2);
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarGreenPalIds[1]), sHPBarPalOffsets[1] + palNum, 2);
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarGreenPalIds[0]), sHPBarPalOffsets[0] + palNum, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarGreenPalIds[1]), sHPBarPalOffsets[1] + palNum, PLTT_SIZEOF(1));
break;
case HP_BAR_YELLOW:
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarYellowPalIds[0]), sHPBarPalOffsets[0] + palNum, 2);
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarYellowPalIds[1]), sHPBarPalOffsets[1] + palNum, 2);
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarYellowPalIds[0]), sHPBarPalOffsets[0] + palNum, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarYellowPalIds[1]), sHPBarPalOffsets[1] + palNum, PLTT_SIZEOF(1));
break;
default:
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarRedPalIds[0]), sHPBarPalOffsets[0] + palNum, 2);
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarRedPalIds[1]), sHPBarPalOffsets[1] + palNum, 2);
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarRedPalIds[0]), sHPBarPalOffsets[0] + palNum, PLTT_SIZEOF(1));
LoadPalette(GetPartyMenuPalBufferPtr(sHPBarRedPalIds[1]), sHPBarPalOffsets[1] + palNum, PLTT_SIZEOF(1));
break;
}
@ -2491,7 +2491,7 @@ void DisplayPartyMenuStdMessage(u32 stringId)
else if (!ShouldUseChooseMonText())
stringId = PARTY_MSG_CHOOSE_MON_OR_CANCEL;
}
DrawStdFrameWithCustomTileAndPalette(*windowPtr, FALSE, 0x4F, 0xD);
DrawStdFrameWithCustomTileAndPalette(*windowPtr, FALSE, 0x4F, 13);
StringExpandPlaceholders(gStringVar4, sActionStringTable[stringId]);
AddTextPrinterParameterized(*windowPtr, FONT_NORMAL, gStringVar4, 0, 1, 0, 0);
ScheduleBgCopyTilemapToVram(2);

View File

@ -653,7 +653,7 @@ static bool8 LoadPokeblockMenuGfx(void)
}
break;
case 2:
LoadCompressedPalette(gMenuPokeblock_Pal, 0, 0xC0);
LoadCompressedPalette(gMenuPokeblock_Pal, BG_PLTT_ID(0), 6 * PLTT_SIZE_4BPP);
sPokeblockMenu->gfxState++;
break;
case 3:
@ -679,9 +679,9 @@ static void HandleInitWindows(void)
InitWindows(sWindowTemplates);
DeactivateAllTextPrinters();
LoadUserWindowBorderGfx(0, 1, 0xE0);
LoadMessageBoxGfx(0, 0xA, 0xD0);
LoadPalette(gStandardMenuPalette, 0xF0, 0x20);
LoadUserWindowBorderGfx(0, 1, BG_PLTT_ID(14));
LoadMessageBoxGfx(0, 0xA, BG_PLTT_ID(13));
LoadPalette(gStandardMenuPalette, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
for (i = 0; i < ARRAY_COUNT(sWindowTemplates) - 1; i++)
FillWindowPixelBuffer(i, PIXEL_FILL(0));

View File

@ -771,7 +771,7 @@ static bool8 LoadMonAndSceneGfx(struct Pokemon *mon)
}
break;
case 8:
LoadCompressedPalette(gBattleTerrainPalette_Frontier, 0x20, 0x60);
LoadCompressedPalette(gBattleTerrainPalette_Frontier, BG_PLTT_ID(2), 3 * PLTT_SIZE_4BPP);
sPokeblockFeed->loadGfxState = 0;
return TRUE;
}
@ -783,8 +783,8 @@ static void HandleInitWindows(void)
{
InitWindows(sWindowTemplates);
DeactivateAllTextPrinters();
LoadUserWindowBorderGfx(0, 1, 0xE0);
LoadPalette(gStandardMenuPalette, 0xF0, 0x20);
LoadUserWindowBorderGfx(0, 1, BG_PLTT_ID(14));
LoadPalette(gStandardMenuPalette, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
FillWindowPixelBuffer(0, PIXEL_FILL(0));
PutWindowTilemap(0);
ScheduleBgCopyTilemapToVram(0);

View File

@ -2145,12 +2145,12 @@ static bool8 LoadPokedexListPage(u8 page)
static void LoadPokedexBgPalette(bool8 isSearchResults)
{
if (isSearchResults == TRUE)
LoadPalette(gPokedexSearchResults_Pal + 1, 1, 0xBE);
LoadPalette(gPokedexSearchResults_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(6 * 16 - 1));
else if (!IsNationalPokedexEnabled())
LoadPalette(gPokedexBgHoenn_Pal + 1, 1, 0xBE);
LoadPalette(gPokedexBgHoenn_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(6 * 16 - 1));
else
LoadPalette(gPokedexBgNational_Pal + 1, 1, 0xBE);
LoadPalette(GetOverworldTextboxPalettePtr(), 0xF0, 32);
LoadPalette(gPokedexBgNational_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(6 * 16 - 1));
LoadPalette(GetOverworldTextboxPalettePtr(), BG_PLTT_ID(15), PLTT_SIZE_4BPP);
}
static void FreeWindowAndBgBuffers(void)
@ -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, 0x31, 0x1E);
LoadPalette(gPlttBufferUnfaded + 1, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(16 - 1));
CopyWindowToVram(WIN_INFO, COPYWIN_FULL);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2);
@ -3713,7 +3713,7 @@ static void LoadPlayArrowPalette(bool8 cryPlaying)
color = RGB(18, 28, 0);
else
color = RGB(15, 21, 0);
LoadPalette(&color, 0x5D, 2);
LoadPalette(&color, BG_PLTT_ID(5) + 13, PLTT_SIZEOF(1));
}
static void Task_LoadSizeScreen(u8 taskId)
@ -3768,7 +3768,7 @@ static void Task_LoadSizeScreen(u8 taskId)
gSprites[spriteId].oam.priority = 0;
gSprites[spriteId].y2 = gPokedexEntries[sPokedexListItem->dexNum].trainerOffset;
SetOamMatrix(1, gPokedexEntries[sPokedexListItem->dexNum].trainerScale, 0, 0, gPokedexEntries[sPokedexListItem->dexNum].trainerScale);
LoadPalette(sSizeScreenSilhouette_Pal, (gSprites[spriteId].oam.paletteNum + 16) * 16, 0x20);
LoadPalette(sSizeScreenSilhouette_Pal, OBJ_PLTT_ID2(gSprites[spriteId].oam.paletteNum), PLTT_SIZE_4BPP);
gTasks[taskId].tTrainerSpriteId = spriteId;
gMain.state++;
break;
@ -3779,7 +3779,7 @@ static void Task_LoadSizeScreen(u8 taskId)
gSprites[spriteId].oam.priority = 0;
gSprites[spriteId].y2 = gPokedexEntries[sPokedexListItem->dexNum].pokemonOffset;
SetOamMatrix(2, gPokedexEntries[sPokedexListItem->dexNum].pokemonScale, 0, 0, gPokedexEntries[sPokedexListItem->dexNum].pokemonScale);
LoadPalette(sSizeScreenSilhouette_Pal, (gSprites[spriteId].oam.paletteNum + 16) * 16, 0x20);
LoadPalette(sSizeScreenSilhouette_Pal, OBJ_PLTT_ID2(gSprites[spriteId].oam.paletteNum), PLTT_SIZE_4BPP);
gTasks[taskId].tMonSpriteId = spriteId;
CopyWindowToVram(WIN_INFO, COPYWIN_FULL);
CopyBgTilemapBufferToVram(1);
@ -4030,11 +4030,11 @@ static void Task_HandleCaughtMonPageInput(u8 taskId)
// Flicker caught screen color
else if (++gTasks[taskId].tPalTimer & 16)
{
LoadPalette(gPokedexBgHoenn_Pal + 1, 0x31, 14);
LoadPalette(gPokedexBgHoenn_Pal + 1, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(7));
}
else
{
LoadPalette(gPokedexCaughtScreen_Pal + 1, 0x31, 14);
LoadPalette(gPokedexCaughtScreen_Pal + 1, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(7));
}
}
@ -4063,7 +4063,7 @@ static void Task_ExitCaughtMonPage(u8 taskId)
personality = ((u16)gTasks[taskId].tPersonalityHi << 16) | (u16)gTasks[taskId].tPersonalityLo;
paletteNum = gSprites[gTasks[taskId].tMonSpriteId].oam.paletteNum;
lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(species, otId, personality);
LoadCompressedPalette(lzPaletteData, 0x100 | paletteNum * 16, 32);
LoadCompressedPalette(lzPaletteData, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP);
DestroyTask(taskId);
}
}
@ -4836,7 +4836,7 @@ static void Task_LoadSearchMenu(u8 taskId)
CopyToBgTilemapBuffer(3, gPokedexSearchMenuHoenn_Tilemap, 0, 0);
else
CopyToBgTilemapBuffer(3, gPokedexSearchMenuNational_Tilemap, 0, 0);
LoadPalette(gPokedexSearchMenu_Pal + 1, 1, 0x7E);
LoadPalette(gPokedexSearchMenu_Pal + 1, BG_PLTT_ID(0) + 1, PLTT_SIZEOF(4 * 16 - 1));
gMain.state = 1;
}
break;

View File

@ -258,7 +258,7 @@ bool8 LoadCryWaveformWindow(struct CryScreenWindow *window, u8 windowId)
break;
case 2:
DrawWaveformWindow(windowId);
LoadPalette(sCryScreenBg_Pal, window->paletteNo * 16, 32);
LoadPalette(sCryScreenBg_Pal, BG_PLTT_ID(window->paletteNo), PLTT_SIZE_4BPP);
finished = TRUE;
break;
}
@ -458,7 +458,7 @@ bool8 LoadCryMeter(struct CryScreenWindow *window, u8 windowId)
sCryMeterNeedle = AllocZeroed(sizeof(*sCryMeterNeedle));
CopyToWindowPixelBuffer(windowId, sCryMeter_Gfx, 0, 0);
LoadPalette(sCryMeter_Pal, window->paletteNo * 16, 32);
LoadPalette(sCryMeter_Pal, BG_PLTT_ID(window->paletteNo), PLTT_SIZE_4BPP);
gDexCryScreenState++;
break;
case 1:

View File

@ -1,5 +1,6 @@
#include "global.h"
#include "battle.h"
#include "palette.h"
#include "pokemon.h"
#include "pokemon_animation.h"
#include "sprite.h"
@ -1538,7 +1539,7 @@ static void Anim_CircleCounterclockwise(struct Sprite *sprite)
#define GlowColor(color, colorIncrement, speed) \
{ \
if (sprite->data[2] == 0) \
sprite->data[7] = (sprite->oam.paletteNum * 16) + 256; \
sprite->data[7] = OBJ_PLTT_ID(sprite->oam.paletteNum); \
\
if (sprite->data[2] > 128) \
{ \
@ -2473,7 +2474,7 @@ static void Anim_FlashYellow(struct Sprite *sprite)
{
if (++sprite->data[2] == 1)
{
sprite->data[7] = (sprite->oam.paletteNum * 16) + 256;
sprite->data[7] = OBJ_PLTT_ID(sprite->oam.paletteNum);
sprite->data[6] = 0;
sprite->data[5] = 0;
sprite->data[4] = 0;
@ -5262,7 +5263,7 @@ static void Anim_ShakeFlashYellow_Fast(struct Sprite *sprite)
{
if (++sprite->data[2] == 1)
{
sprite->data[7] = (sprite->oam.paletteNum * 16) + 256;
sprite->data[7] = OBJ_PLTT_ID(sprite->oam.paletteNum);
sprite->data[6] = 0;
sprite->data[5] = 0;
sprite->data[4] = 0;
@ -5276,7 +5277,7 @@ static void Anim_ShakeFlashYellow(struct Sprite *sprite)
{
if (++sprite->data[2] == 1)
{
sprite->data[7] = (sprite->oam.paletteNum * 16) + 256;
sprite->data[7] = OBJ_PLTT_ID(sprite->oam.paletteNum);
sprite->data[6] = 0;
sprite->data[5] = 0;
sprite->data[4] = 0;
@ -5290,7 +5291,7 @@ static void Anim_ShakeFlashYellow_Slow(struct Sprite *sprite)
{
if (++sprite->data[2] == 1)
{
sprite->data[7] = (sprite->oam.paletteNum * 16) + 256;
sprite->data[7] = OBJ_PLTT_ID(sprite->oam.paletteNum);
sprite->data[6] = 0;
sprite->data[5] = 0;
sprite->data[4] = 0;
@ -5356,7 +5357,7 @@ static void Anim_ShakeGlowRed_Fast(struct Sprite *sprite)
{
if (sprite->data[2] == 0)
{
sprite->data[7] = (sprite->oam.paletteNum * 16) + 256;
sprite->data[7] = OBJ_PLTT_ID(sprite->oam.paletteNum);
sprite->data[0] = 10;
sprite->data[5] = 0;
sprite->data[4] = 2;
@ -5377,7 +5378,7 @@ static void Anim_ShakeGlowRed(struct Sprite *sprite)
{
if (sprite->data[2] == 0)
{
sprite->data[7] = (sprite->oam.paletteNum * 16) + 256;
sprite->data[7] = OBJ_PLTT_ID(sprite->oam.paletteNum);
sprite->data[0] = 20;
sprite->data[5] = 0;
sprite->data[4] = 1;
@ -5398,7 +5399,7 @@ static void Anim_ShakeGlowRed_Slow(struct Sprite *sprite)
{
if (sprite->data[2] == 0)
{
sprite->data[7] = (sprite->oam.paletteNum * 16) + 256;
sprite->data[7] = OBJ_PLTT_ID(sprite->oam.paletteNum);
sprite->data[0] = 80;
sprite->data[5] = 0;
sprite->data[4] = 1;
@ -5419,7 +5420,7 @@ static void Anim_ShakeGlowGreen_Fast(struct Sprite *sprite)
{
if (sprite->data[2] == 0)
{
sprite->data[7] = (sprite->oam.paletteNum * 16) + 256;
sprite->data[7] = OBJ_PLTT_ID(sprite->oam.paletteNum);
sprite->data[0] = 10;
sprite->data[5] = 0;
sprite->data[4] = 2;
@ -5440,7 +5441,7 @@ static void Anim_ShakeGlowGreen(struct Sprite *sprite)
{
if (sprite->data[2] == 0)
{
sprite->data[7] = (sprite->oam.paletteNum * 16) + 256;
sprite->data[7] = OBJ_PLTT_ID(sprite->oam.paletteNum);
sprite->data[0] = 20;
sprite->data[5] = 0;
sprite->data[4] = 1;
@ -5461,7 +5462,7 @@ static void Anim_ShakeGlowGreen_Slow(struct Sprite *sprite)
{
if (sprite->data[2] == 0)
{
sprite->data[7] = (sprite->oam.paletteNum * 16) + 256;
sprite->data[7] = OBJ_PLTT_ID(sprite->oam.paletteNum);
sprite->data[0] = 80;
sprite->data[5] = 0;
sprite->data[4] = 1;
@ -5482,7 +5483,7 @@ static void Anim_ShakeGlowBlue_Fast(struct Sprite *sprite)
{
if (sprite->data[2] == 0)
{
sprite->data[7] = (sprite->oam.paletteNum * 16) + 256;
sprite->data[7] = OBJ_PLTT_ID(sprite->oam.paletteNum);
sprite->data[0] = 10;
sprite->data[5] = 0;
sprite->data[4] = 2;
@ -5503,7 +5504,7 @@ static void Anim_ShakeGlowBlue(struct Sprite *sprite)
{
if (sprite->data[2] == 0)
{
sprite->data[7] = (sprite->oam.paletteNum * 16) + 256;
sprite->data[7] = OBJ_PLTT_ID(sprite->oam.paletteNum);
sprite->data[0] = 20;
sprite->data[5] = 0;
sprite->data[4] = 1;
@ -5524,7 +5525,7 @@ static void Anim_ShakeGlowBlue_Slow(struct Sprite *sprite)
{
if (sprite->data[2] == 0)
{
sprite->data[7] = (sprite->oam.paletteNum * 16) + 256;
sprite->data[7] = OBJ_PLTT_ID(sprite->oam.paletteNum);
sprite->data[0] = 80;
sprite->data[5] = 0;
sprite->data[4] = 1;

View File

@ -1201,12 +1201,12 @@ void TryLoadAllMonIconPalettesAtOffset(u16 offset)
s32 i;
const struct SpritePalette* monIconPalettePtr;
if (offset <= 0xA0)
if (offset <= BG_PLTT_ID(10))
{
monIconPalettePtr = gMonIconPaletteTable;
for(i = ARRAY_COUNT(gMonIconPaletteTable) - 1; i >= 0; i--)
for (i = ARRAY_COUNT(gMonIconPaletteTable) - 1; i >= 0; i--)
{
LoadPalette(monIconPalettePtr->data, offset, 0x20);
LoadPalette(monIconPalettePtr->data, offset, PLTT_SIZE_4BPP);
offset += 0x10;
monIconPalettePtr++;
}

View File

@ -3183,21 +3183,21 @@ static void LoadPokeJumpGfx(void)
ResetTempTileDataBuffers();
LoadSpriteSheetsAndPalettes(sPokemonJumpGfx);
InitDigitPrinters();
LoadPalette(sBg_Pal, 0, 0x20);
LoadPalette(sBg_Pal, BG_PLTT_ID(0), PLTT_SIZE_4BPP);
DecompressAndCopyTileDataToVram(BG_SCENERY, sBg_Gfx, 0, 0, 0);
DecompressAndCopyTileDataToVram(BG_SCENERY, sBg_Tilemap, 0, 0, 1);
LoadPalette(sVenusaur_Pal, 0x30, 0x20);
LoadPalette(sVenusaur_Pal, BG_PLTT_ID(3), PLTT_SIZE_4BPP);
DecompressAndCopyTileDataToVram(BG_VENUSAUR, sVenusaur_Gfx, 0, 0, 0);
DecompressAndCopyTileDataToVram(BG_VENUSAUR, sVenusaur_Tilemap, 0, 0, 1);
LoadPalette(sBonuses_Pal, 0x10, 0x20);
LoadPalette(sBonuses_Pal, BG_PLTT_ID(1), PLTT_SIZE_4BPP);
DecompressAndCopyTileDataToVram(BG_BONUSES, sBonuses_Gfx, 0, 0, 0);
DecompressAndCopyTileDataToVram(BG_BONUSES, sBonuses_Tilemap, 0, 0, 1);
LoadPalette(sInterface_Pal, 0x20, 0x20);
LoadPalette(sInterface_Pal, BG_PLTT_ID(2), PLTT_SIZE_4BPP);
SetBgTilemapBuffer(BG_INTERFACE, sPokemonJumpGfx->tilemapBuffer);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 0x20, 0x20);
PrintScoreSuffixes();
PrintScore(0);
LoadUserWindowBorderGfxOnBg(0, 1, 0xE0);
LoadUserWindowBorderGfxOnBg(0, 1, BG_PLTT_ID(14));
CopyBgTilemapBufferToVram(BG_INTERFACE);
CopyBgTilemapBufferToVram(BG_VENUSAUR);
CopyBgTilemapBufferToVram(BG_BONUSES);
@ -3601,7 +3601,7 @@ static u32 AddMessageWindow(u32 left, u32 top, u32 width, u32 height)
window.tilemapTop = top;
window.width = width;
window.height = height;
window.paletteNum = 0xF;
window.paletteNum = 15;
window.baseBlock = 0x43;
windowId = AddWindow(&window);
@ -4213,8 +4213,8 @@ static void PrintRecordsText(u16 windowId, int width)
recordNums[1] = records->bestJumpScore;
recordNums[2] = records->excellentsInRow;
LoadUserWindowBorderGfx_(windowId, 0x21D, 0xD0);
DrawTextBorderOuter(windowId, 0x21D, 0xD);
LoadUserWindowBorderGfx_(windowId, 0x21D, BG_PLTT_ID(13));
DrawTextBorderOuter(windowId, 0x21D, 13);
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
AddTextPrinterParameterized(windowId, FONT_NORMAL, gText_PkmnJumpRecords, GetStringCenterAlignXOffset(FONT_NORMAL, gText_PkmnJumpRecords, width * 8), 1, TEXT_SKIP_DRAW, NULL);
for (i = 0; i < ARRAY_COUNT(sRecordsTexts); i++)

View File

@ -2129,7 +2129,7 @@ static void Task_InitPokeStorage(u8 taskId)
PutWindowTilemap(WIN_DISPLAY_INFO);
ClearWindowTilemap(WIN_MESSAGE);
CpuFill32(0, (void *)VRAM, 0x200);
LoadUserWindowBorderGfx(WIN_MESSAGE, 0xB, 0xE0);
LoadUserWindowBorderGfx(WIN_MESSAGE, 0xB, BG_PLTT_ID(14));
break;
case 3:
ResetAllBgCoords();
@ -3850,13 +3850,13 @@ static void LoadWaveformSpritePalette(void)
static void InitPalettesAndSprites(void)
{
LoadPalette(sInterface_Pal, 0, sizeof(sInterface_Pal));
LoadPalette(sPkmnDataGray_Pal, 0x20, sizeof(sPkmnDataGray_Pal));
LoadPalette(sTextWindows_Pal, 0xF0, sizeof(sTextWindows_Pal));
LoadPalette(sInterface_Pal, BG_PLTT_ID(0), sizeof(sInterface_Pal));
LoadPalette(sPkmnDataGray_Pal, BG_PLTT_ID(2), sizeof(sPkmnDataGray_Pal));
LoadPalette(sTextWindows_Pal, BG_PLTT_ID(15), sizeof(sTextWindows_Pal));
if (sStorage->boxOption != OPTION_MOVE_ITEMS)
LoadPalette(sScrollingBg_Pal, 0x30, sizeof(sScrollingBg_Pal));
LoadPalette(sScrollingBg_Pal, BG_PLTT_ID(3), sizeof(sScrollingBg_Pal));
else
LoadPalette(sScrollingBgMoveItems_Pal, 0x30, sizeof(sScrollingBgMoveItems_Pal));
LoadPalette(sScrollingBgMoveItems_Pal, BG_PLTT_ID(3), sizeof(sScrollingBgMoveItems_Pal));
SetGpuReg(REG_OFFSET_BG1CNT, BGCNT_PRIORITY(1) | BGCNT_CHARBASE(1) | BGCNT_16COLOR | BGCNT_SCREENBASE(30));
CreateDisplayMonSprite();
@ -3959,7 +3959,7 @@ static void CreateDisplayMonSprite(void)
break;
sStorage->displayMonSprite = &gSprites[spriteId];
sStorage->displayMonPalOffset = palSlot * 16 + 0x100;
sStorage->displayMonPalOffset = OBJ_PLTT_ID(palSlot);
sStorage->displayMonTilePtr = (void *) OBJ_VRAM0 + tileStart * TILE_SIZE_4BPP;
} while (0);
@ -3980,7 +3980,7 @@ static void LoadDisplayMonGfx(u16 species, u32 pid)
LoadSpecialPokePic(&gMonFrontPicTable[species], sStorage->tileBuffer, species, pid, TRUE);
LZ77UnCompWram(sStorage->displayMonPalette, sStorage->displayMonPalBuffer);
CpuCopy32(sStorage->tileBuffer, sStorage->displayMonTilePtr, MON_PIC_SIZE);
LoadPalette(sStorage->displayMonPalBuffer, sStorage->displayMonPalOffset, 0x20);
LoadPalette(sStorage->displayMonPalBuffer, sStorage->displayMonPalOffset, PLTT_SIZE_4BPP);
sStorage->displayMonSprite->invisible = FALSE;
}
else
@ -4046,7 +4046,7 @@ static void UpdateWaveformAnimation(void)
static void InitSupplementalTilemaps(void)
{
LZ77UnCompWram(gStorageSystemPartyMenu_Tilemap, sStorage->partyMenuTilemapBuffer);
LoadPalette(gStorageSystemPartyMenu_Pal, 0x10, 0x20);
LoadPalette(gStorageSystemPartyMenu_Pal, BG_PLTT_ID(1), PLTT_SIZE_4BPP);
TilemapUtil_SetMap(TILEMAPID_PARTY_MENU, 1, sStorage->partyMenuTilemapBuffer, 12, 22);
TilemapUtil_SetMap(TILEMAPID_CLOSE_BUTTON, 1, sCloseBoxButton_Tilemap, 9, 4);
TilemapUtil_SetPos(TILEMAPID_PARTY_MENU, 10, 0);
@ -4268,7 +4268,7 @@ static void UpdateBoxToSendMons(void)
static void InitPokeStorageBg0(void)
{
SetGpuReg(REG_OFFSET_BG0CNT, BGCNT_PRIORITY(0) | BGCNT_CHARBASE(0) | BGCNT_SCREENBASE(29));
LoadUserWindowBorderGfx(WIN_MESSAGE, 2, 208);
LoadUserWindowBorderGfx(WIN_MESSAGE, 2, BG_PLTT_ID(13));
FillBgTilemapBufferRect(0, 0, 0, 0, 32, 20, 17);
CopyBgTilemapBufferToVram(0);
}
@ -5381,9 +5381,9 @@ static void LoadWallpaperGfx(u8 boxId, s8 direction)
DrawWallpaper(sStorage->wallpaperTilemap, sStorage->wallpaperLoadDir, sStorage->wallpaperOffset);
if (sStorage->wallpaperLoadDir != 0)
LoadPalette(wallpaper->palettes, (sStorage->wallpaperOffset * 32) + 0x40, 0x40);
LoadPalette(wallpaper->palettes, BG_PLTT_ID(4) + BG_PLTT_ID(sStorage->wallpaperOffset * 2), 2 * PLTT_SIZE_4BPP);
else
CpuCopy16(wallpaper->palettes, &gPlttBufferUnfaded[(sStorage->wallpaperOffset * 32) + 0x40], 0x40);
CpuCopy16(wallpaper->palettes, &gPlttBufferUnfaded[BG_PLTT_ID(4) + BG_PLTT_ID(sStorage->wallpaperOffset * 2)], 2 * PLTT_SIZE_4BPP);
sStorage->wallpaperTiles = malloc_and_decompress(wallpaper->tiles, &tilesSize);
LoadBgTiles(2, sStorage->wallpaperTiles, tilesSize, sStorage->wallpaperOffset << 8);
@ -5399,9 +5399,9 @@ static void LoadWallpaperGfx(u8 boxId, s8 direction)
CpuCopy16(GetWaldaWallpaperColorsPtr(), &sStorage->wallpaperTilemap[17], 4);
if (sStorage->wallpaperLoadDir != 0)
LoadPalette(sStorage->wallpaperTilemap, (sStorage->wallpaperOffset * 32) + 0x40, 0x40);
LoadPalette(sStorage->wallpaperTilemap, BG_PLTT_ID(4) + BG_PLTT_ID(sStorage->wallpaperOffset * 2), 2 * PLTT_SIZE_4BPP);
else
CpuCopy16(sStorage->wallpaperTilemap, &gPlttBufferUnfaded[(sStorage->wallpaperOffset * 32) + 0x40], 0x40);
CpuCopy16(sStorage->wallpaperTilemap, &gPlttBufferUnfaded[BG_PLTT_ID(4) + BG_PLTT_ID(sStorage->wallpaperOffset * 2)], 2 * PLTT_SIZE_4BPP);
sStorage->wallpaperTiles = malloc_and_decompress(wallpaper->tiles, &tilesSize);
iconGfx = malloc_and_decompress(sWaldaWallpaperIcons[GetWaldaWallpaperIconId()], &iconSize);
@ -5438,7 +5438,7 @@ static void DrawWallpaper(const void *tilemap, s8 direction, u8 offset)
else
x -= 4;
FillBgTilemapBufferRect(2, 0, x, 2, 4, 0x12, 0x11);
FillBgTilemapBufferRect(2, 0, x, 2, 4, 0x12, 17);
}
static void TrimOldWallpaper(void *tilemap)
@ -5489,7 +5489,7 @@ static void InitBoxTitle(u8 boxId)
sStorage->wallpaperPalBits = 0x3f0;
tagIndex = IndexOfSpritePaletteTag(PALTAG_BOX_TITLE);
sStorage->boxTitlePalOffset = 0x10e + 16 * tagIndex;
sStorage->boxTitlePalOffset = OBJ_PLTT_ID(tagIndex) + 14;
sStorage->wallpaperPalBits |= 0x10000 << tagIndex;
// The below seems intended to have separately tracked
@ -5497,7 +5497,7 @@ static void InitBoxTitle(u8 boxId)
// share a palette tag, all colors (and fields in some cases)
// this is redundant along with the use of boxTitleAltPalOffset
tagIndex = IndexOfSpritePaletteTag(PALTAG_BOX_TITLE);
sStorage->boxTitleAltPalOffset = 0x10e + 16 * tagIndex;
sStorage->boxTitleAltPalOffset = OBJ_PLTT_ID(tagIndex) + 14;
sStorage->wallpaperPalBits |= 0x10000 << tagIndex;
StringCopyPadded(sStorage->boxTitleText, GetBoxNamePtr(boxId), 0, BOX_NAME_LENGTH);
@ -8165,7 +8165,7 @@ static bool8 MultiMove_Start(void)
{
case 0:
HideBg(0);
TryLoadAllMonIconPalettesAtOffset(0x80);
TryLoadAllMonIconPalettesAtOffset(BG_PLTT_ID(8));
sMultiMove->state++;
break;
case 1:
@ -8214,7 +8214,7 @@ static bool8 MultiMove_Cancel(void)
if (!IsDma3ManagerBusyWithBgCopy())
{
SetCursorPriorityTo1();
LoadPalette(GetTextWindowPalette(3), 0xD0, 0x20);
LoadPalette(GetTextWindowPalette(3), BG_PLTT_ID(13), PLTT_SIZE_4BPP);
ShowBg(0);
return FALSE;
}
@ -8320,7 +8320,7 @@ static bool8 MultiMove_PlaceMons(void)
case 3:
if (!IsDma3ManagerBusyWithBgCopy())
{
LoadPalette(GetTextWindowPalette(3), 0xD0, 0x20);
LoadPalette(GetTextWindowPalette(3), BG_PLTT_ID(13), PLTT_SIZE_4BPP);
SetCursorPriorityTo1();
ShowBg(0);
return FALSE;
@ -9104,7 +9104,7 @@ static void LoadItemIconGfx(u8 id, const u32 *itemTiles, const u32 *itemPal)
CpuFastCopy(sStorage->itemIconBuffer, sStorage->itemIcons[id].tiles, 0x200);
LZ77UnCompWram(itemPal, sStorage->itemIconBuffer);
LoadPalette(sStorage->itemIconBuffer, sStorage->itemIcons[id].palIndex, 0x20);
LoadPalette(sStorage->itemIconBuffer, sStorage->itemIcons[id].palIndex, PLTT_SIZE_4BPP);
}
static void SetItemIconAffineAnim(u8 id, u8 animNum)
@ -9237,7 +9237,7 @@ static bool8 UpdateItemInfoWindowSlideOut(void)
if (pos >= 0)
DrawItemInfoWindow(pos);
FillBgTilemapBufferRect(0, 0, pos + 1, 12, 1, 9, 0x11);
FillBgTilemapBufferRect(0, 0, pos + 1, 12, 1, 9, 17);
ScheduleBgCopyTilemapToVram(0);
return TRUE;
}
@ -9246,12 +9246,12 @@ static void DrawItemInfoWindow(u32 x)
{
if (x != 0)
{
FillBgTilemapBufferRect(0, 0x13A, 0, 0xC, x, 1, 0xFu);
FillBgTilemapBufferRect(0, 0x93A, 0, 0x14, x, 1, 0xFu);
FillBgTilemapBufferRect(0, 0x13A, 0, 0xC, x, 1, 15);
FillBgTilemapBufferRect(0, 0x93A, 0, 0x14, x, 1, 15);
}
FillBgTilemapBufferRect(0, 0x13B, x, 0xD, 1, 7, 0xFu);
FillBgTilemapBufferRect(0, 0x13C, x, 0xC, 1, 1, 0xFu);
FillBgTilemapBufferRect(0, 0x13D, x, 0x14, 1, 1, 0xFu);
FillBgTilemapBufferRect(0, 0x13B, x, 0xD, 1, 7, 15);
FillBgTilemapBufferRect(0, 0x13C, x, 0xC, 1, 1, 15);
FillBgTilemapBufferRect(0, 0x13D, x, 0x14, 1, 1, 15);
ScheduleBgCopyTilemapToVram(0);
}

View File

@ -1329,8 +1329,8 @@ static bool8 DecompressGraphics(void)
sMonSummaryScreen->switchCounter++;
break;
case 6:
LoadCompressedPalette(gSummaryScreen_Pal, 0, 0x100);
LoadPalette(&gPPTextPalette, 0x81, 0x1E);
LoadCompressedPalette(gSummaryScreen_Pal, BG_PLTT_ID(0), 8 * PLTT_SIZE_4BPP);
LoadPalette(&gPPTextPalette, BG_PLTT_ID(8) + 1, PLTT_SIZEOF(16 - 1));
sMonSummaryScreen->switchCounter++;
break;
case 7:
@ -1354,7 +1354,7 @@ static bool8 DecompressGraphics(void)
sMonSummaryScreen->switchCounter++;
break;
case 12:
LoadCompressedPalette(gMoveTypes_Pal, 0x1D0, 0x60);
LoadCompressedPalette(gMoveTypes_Pal, OBJ_PLTT_ID(13), 3 * PLTT_SIZE_4BPP);
sMonSummaryScreen->switchCounter = 0;
return TRUE;
}
@ -4002,7 +4002,7 @@ static void StopPokemonAnimations(void) // A subtle effect, this function stops
gSprites[sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON]].callback = SpriteCallbackDummy;
StopPokemonAnimationDelayTask();
paletteIndex = (gSprites[sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON]].oam.paletteNum * 16) | 0x100;
paletteIndex = OBJ_PLTT_ID(gSprites[sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_MON]].oam.paletteNum);
for (i = 0; i < 16; i++)
{

View File

@ -224,8 +224,8 @@ static u32 LoopedTask_OpenConditionGraphMenu(s32 state)
CopyToBgTilemapBufferRect(3, gPokenavOptions_Tilemap, 0, 5, 9, 4);
CopyBgTilemapBufferToVram(3);
CopyPaletteIntoBufferUnfaded(gPokenavCondition_Pal, 0x10, 0x20);
CopyPaletteIntoBufferUnfaded(gConditionText_Pal, 0xF0, 0x20);
CopyPaletteIntoBufferUnfaded(gPokenavCondition_Pal, BG_PLTT_ID(1), PLTT_SIZE_4BPP);
CopyPaletteIntoBufferUnfaded(gConditionText_Pal, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
menu->monTransitionX = -80;
return LT_INC_AND_PAUSE;
case 4:
@ -235,7 +235,7 @@ static u32 LoopedTask_OpenConditionGraphMenu(s32 state)
LZ77UnCompVram(sConditionGraphData_Tilemap, menu->tilemapBuffers[2]);
SetBgTilemapBuffer(2, menu->tilemapBuffers[2]);
CopyBgTilemapBufferToVram(2);
CopyPaletteIntoBufferUnfaded(gConditionGraphData_Pal, 0x30, 0x20);
CopyPaletteIntoBufferUnfaded(gConditionGraphData_Pal, BG_PLTT_ID(3), PLTT_SIZE_4BPP);
ConditionGraph_InitWindow(2);
return LT_INC_AND_PAUSE;
case 5:
@ -827,13 +827,13 @@ static void CreateConditionMonPic(u8 id)
menu->monPicSpriteId = spriteId;
gSprites[menu->monPicSpriteId].callback = MonPicGfxSpriteCallback;
menu->monGfxPtr = (void *)VRAM + BG_VRAM_SIZE + (menu->monGfxTileStart * 32);
menu->monPalIndex = (menu->monPalIndex * 16) + 0x100;
menu->monPalIndex = OBJ_PLTT_ID(menu->monPalIndex);
}
}
else
{
DmaCopy16Defvars(3, GetConditionMonPicGfx(id), menu->monGfxPtr, MON_PIC_SIZE);
LoadPalette(GetConditionMonPal(id), menu->monPalIndex, 0x20);
LoadPalette(GetConditionMonPal(id), menu->monPalIndex, PLTT_SIZE_4BPP);
}
}

View File

@ -2,6 +2,7 @@
#include "pokenav.h"
#include "bg.h"
#include "menu.h"
#include "palette.h"
#include "window.h"
#include "sound.h"
#include "dynamic_placeholder_text_util.h"
@ -431,7 +432,7 @@ static u32 LoopedTask_OpenConditionSearchResults(s32 state)
SetBgTilemapBuffer(1, gfx->buff);
CopyToBgTilemapBuffer(1, sConditionSearchResultTilemap, 0, 0);
CopyBgTilemapBufferToVram(1);
CopyPaletteIntoBufferUnfaded(sConditionSearchResultFramePal, 0x10, 0x20);
CopyPaletteIntoBufferUnfaded(sConditionSearchResultFramePal, BG_PLTT_ID(1), PLTT_SIZE_4BPP);
CopyBgTilemapBufferToVram(1);
return LT_INC_AND_PAUSE;
case 1:
@ -443,7 +444,7 @@ static u32 LoopedTask_OpenConditionSearchResults(s32 state)
case 2:
if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE;
CopyPaletteIntoBufferUnfaded(sListBg_Pal, 0x20, 32);
CopyPaletteIntoBufferUnfaded(sListBg_Pal, BG_PLTT_ID(2), PLTT_SIZE_4BPP);
CreateSearchResultsList();
return LT_INC_AND_PAUSE;
case 3:

View File

@ -349,7 +349,7 @@ static u32 LoopedTask_InitPokenavMenu(s32 state)
DecompressAndCopyTileDataToVram(0, &gPokenavHeader_Gfx, 0, 0, 0);
SetBgTilemapBuffer(0, menu->tilemapBuffer);
CopyToBgTilemapBuffer(0, &gPokenavHeader_Tilemap, 0, 0);
CopyPaletteIntoBufferUnfaded(gPokenavHeader_Pal, 0, 0x20);
CopyPaletteIntoBufferUnfaded(gPokenavHeader_Pal, BG_PLTT_ID(0), PLTT_SIZE_4BPP);
CopyBgTilemapBufferToVram(0);
return LT_INC_AND_PAUSE;
case 2:
@ -460,8 +460,8 @@ void Pokenav_AllocAndLoadPalettes(const struct SpritePalette *palettes)
}
else
{
index = (index * 16) + 0x100;
CopyPaletteIntoBufferUnfaded(current->data, index, 0x20);
index = OBJ_PLTT_ID(index);
CopyPaletteIntoBufferUnfaded(current->data, index, PLTT_SIZE_4BPP);
}
}
}
@ -683,7 +683,7 @@ static void LoadLeftHeaderGfxForMenu(u32 menuGfxId)
menu = GetSubstructPtr(POKENAV_SUBSTRUCT_MAIN_MENU);
tag = sMenuLeftHeaderSpriteSheets[menuGfxId].tag;
size = GetDecompressedDataSize(sMenuLeftHeaderSpriteSheets[menuGfxId].data);
LoadPalette(&gPokenavLeftHeader_Pal[tag * 16], (IndexOfSpritePaletteTag(1) * 16) + 0x100, 0x20);
LoadPalette(&gPokenavLeftHeader_Pal[tag * 16], OBJ_PLTT_ID(IndexOfSpritePaletteTag(1)), PLTT_SIZE_4BPP);
LZ77UnCompWram(sMenuLeftHeaderSpriteSheets[menuGfxId].data, gDecompressionBuffer);
RequestDma3Copy(gDecompressionBuffer, (void *)OBJ_VRAM0 + (GetSpriteTileStartByTag(2) * 32), size, 1);
menu->leftHeaderSprites[1]->oam.tileNum = GetSpriteTileStartByTag(2) + sMenuLeftHeaderSpriteSheets[menuGfxId].size;
@ -703,7 +703,7 @@ static void LoadLeftHeaderGfxForSubMenu(u32 menuGfxId)
tag = sPokenavSubMenuLeftHeaderSpriteSheets[menuGfxId].tag;
size = GetDecompressedDataSize(sPokenavSubMenuLeftHeaderSpriteSheets[menuGfxId].data);
LoadPalette(&gPokenavLeftHeader_Pal[tag * 16], (IndexOfSpritePaletteTag(2) * 16) + 0x100, 0x20);
LoadPalette(&gPokenavLeftHeader_Pal[tag * 16], OBJ_PLTT_ID(IndexOfSpritePaletteTag(2)), PLTT_SIZE_4BPP);
LZ77UnCompWram(sPokenavSubMenuLeftHeaderSpriteSheets[menuGfxId].data, &gDecompressionBuffer[0x1000]);
RequestDma3Copy(&gDecompressionBuffer[0x1000], (void *)OBJ_VRAM0 + 0x800 + (GetSpriteTileStartByTag(2) * 32), size, 1);
}

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, 0x20, 0x20);
CopyPaletteIntoBufferUnfaded(sMatchCallUI_Pal, BG_PLTT_ID(2), PLTT_SIZE_4BPP);
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, 0x10, 0x20);
CopyPaletteIntoBufferUnfaded(sCallWindow_Pal, BG_PLTT_ID(1), PLTT_SIZE_4BPP);
CopyBgTilemapBufferToVram(1);
return LT_INC_AND_PAUSE;
case 2:
@ -352,8 +352,8 @@ static u32 LoopedTask_OpenMatchCall(s32 state)
LoadCallWindowAndFade(gfx);
DecompressAndCopyTileDataToVram(3, sPokeball_Gfx, 0, 0, 0);
CopyPaletteIntoBufferUnfaded(sListWindow_Pal, 0x30, 0x20);
CopyPaletteIntoBufferUnfaded(sPokeball_Pal, 0x50, 0x20);
CopyPaletteIntoBufferUnfaded(sListWindow_Pal, BG_PLTT_ID(3), PLTT_SIZE_4BPP);
CopyPaletteIntoBufferUnfaded(sPokeball_Pal, BG_PLTT_ID(5), PLTT_SIZE_4BPP);
return LT_INC_AND_PAUSE;
case 3:
if (FreeTempTileDataBuffersIfPossible() || !IsMatchCallListInitFinished())
@ -1102,7 +1102,7 @@ static void DrawMsgBoxForMatchCallMsg(struct Pokenav_MatchCallGfx *gfx)
static void DrawMsgBoxForCloseByMsg(struct Pokenav_MatchCallGfx *gfx)
{
LoadUserWindowBorderGfx(gfx->msgBoxWindowId, 1, 0x40);
LoadUserWindowBorderGfx(gfx->msgBoxWindowId, 1, BG_PLTT_ID(4));
DrawTextBorderOuter(gfx->msgBoxWindowId, 1, 4);
FillWindowPixelBuffer(gfx->msgBoxWindowId, PIXEL_FILL(1));
PutWindowTilemap(gfx->msgBoxWindowId);
@ -1186,7 +1186,7 @@ static void AllocMatchCallSprites(void)
spriteSheet.tag = GFXTAG_TRAINER_PIC;
gfx->trainerPicGfxPtr = (u8 *)OBJ_VRAM0 + LoadSpriteSheet(&spriteSheet) * 0x20;
paletteNum = AllocSpritePalette(PALTAG_TRAINER_PIC);
gfx->trainerPicPalOffset = 0x100 + paletteNum * 0x10;
gfx->trainerPicPalOffset = OBJ_PLTT_ID(paletteNum);
gfx->trainerPicSprite = CreateTrainerPicSprite();
gfx->trainerPicSprite->invisible = TRUE;
}

View File

@ -457,7 +457,7 @@ static u32 LoopedTask_OpenMenu(s32 state)
SetBgTilemapBuffer(1, gfx->bg1TilemapBuffer);
CopyToBgTilemapBuffer(1, gPokenavMessageBox_Tilemap, 0, 0);
CopyBgTilemapBufferToVram(1);
CopyPaletteIntoBufferUnfaded(gPokenavMessageBox_Pal, 0x10, 0x20);
CopyPaletteIntoBufferUnfaded(gPokenavMessageBox_Pal, BG_PLTT_ID(1), PLTT_SIZE_4BPP);
ChangeBgX(1, 0, BG_COORD_SET);
ChangeBgY(1, 0, BG_COORD_SET);
ChangeBgX(2, 0, BG_COORD_SET);
@ -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, 0x20, 0x20);
CopyPaletteIntoBufferUnfaded(sPokenavDeviceBgPal, BG_PLTT_ID(2), PLTT_SIZE_4BPP);
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, 0x30, 0x20);
CopyPaletteIntoBufferUnfaded(sPokenavBgDotsPal, BG_PLTT_ID(3), PLTT_SIZE_4BPP);
if (GetPokenavMenuType() == POKENAV_MENU_TYPE_CONDITION || GetPokenavMenuType() == POKENAV_MENU_TYPE_CONDITION_SEARCH)
ChangeBgDotsColorToPurple();
return LT_INC_AND_PAUSE;
@ -1270,7 +1270,7 @@ static void CreateBgDotPurplePalTask(void)
static void ChangeBgDotsColorToPurple(void)
{
CopyPaletteIntoBufferUnfaded(sPokenavBgDotsPal + 7, 0x31, 4);
CopyPaletteIntoBufferUnfaded(sPokenavBgDotsPal + 7, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(2));
}
static void CreateBgDotLightBluePalTask(void)
@ -1293,7 +1293,7 @@ static void Task_UpdateBgDotsPalette(u8 taskId)
const u16 * pal2 = (const u16 *)GetWordTaskArg(taskId, 3);
PokenavCopyPalette(pal1, pal2, 2, 12, ++data[0], sp8);
LoadPalette(sp8, 0x31, 4);
LoadPalette(sp8, BG_PLTT_ID(3) + 1, PLTT_SIZEOF(2));
if (data[0] == 12)
DestroyTask(taskId);
}

View File

@ -509,14 +509,14 @@ static void LoadPokenavRegionMapGfx(struct Pokenav_RegionMapGfx *state)
CpuFill16(0x1040, state->tilemapBuffer, 0x800);
SetBgTilemapBuffer(1, state->tilemapBuffer);
state->infoWindowId = AddWindow(&sMapSecInfoWindowTemplate);
LoadUserWindowBorderGfx_(state->infoWindowId, 0x42, 0x40);
LoadUserWindowBorderGfx_(state->infoWindowId, 0x42, BG_PLTT_ID(4));
DrawTextBorderOuter(state->infoWindowId, 0x42, 4);
DecompressAndCopyTileDataToVram(1, sRegionMapCityZoomTiles_Gfx, 0, 0, 0);
FillWindowPixelBuffer(state->infoWindowId, PIXEL_FILL(1));
PutWindowTilemap(state->infoWindowId);
CopyWindowToVram(state->infoWindowId, COPYWIN_FULL);
CopyPaletteIntoBufferUnfaded(sMapSecInfoWindow_Pal, 0x10, 0x20);
CopyPaletteIntoBufferUnfaded(gRegionMapCityZoomTiles_Pal, 0x30, 0x20);
CopyPaletteIntoBufferUnfaded(sMapSecInfoWindow_Pal, BG_PLTT_ID(1), PLTT_SIZE_4BPP);
CopyPaletteIntoBufferUnfaded(gRegionMapCityZoomTiles_Pal, BG_PLTT_ID(3), PLTT_SIZE_4BPP);
if (!IsRegionMapZoomed())
ChangeBgY(1, -0x6000, BG_COORD_SET);
else

View File

@ -2,6 +2,7 @@
#include "pokenav.h"
#include "bg.h"
#include "menu.h"
#include "palette.h"
#include "window.h"
#include "sound.h"
#include "string_util.h"
@ -431,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, 0x10, 0x20);
CopyPaletteIntoBufferUnfaded(sMonRibbonListFramePal, BG_PLTT_ID(1), PLTT_SIZE_4BPP);
CopyBgTilemapBufferToVram(1);
return LT_INC_AND_PAUSE;
case 1:
@ -446,7 +447,7 @@ static u32 LoopedTask_OpenRibbonsMonList(s32 state)
case 2:
if (FreeTempTileDataBuffersIfPossible())
return LT_PAUSE;
CopyPaletteIntoBufferUnfaded(sMonRibbonListUi_Pal, 0x20, 0x20);
CopyPaletteIntoBufferUnfaded(sMonRibbonListUi_Pal, BG_PLTT_ID(2), PLTT_SIZE_4BPP);
CreateRibbonMonsList();
return LT_INC_AND_PAUSE;
case 3:

View File

@ -3,6 +3,7 @@
#include "dynamic_placeholder_text_util.h"
#include "graphics.h"
#include "international_string_util.h"
#include "palette.h"
#include "pokenav.h"
#include "sound.h"
#include "sprite.h"
@ -572,7 +573,7 @@ static u32 LoopedTask_OpenRibbonsSummaryMenu(s32 state)
DecompressAndCopyTileDataToVram(2, gPokenavRibbonsSummaryBg_Gfx, 0, 0, 0);
SetBgTilemapBuffer(2, menu->tilemapBuffers[0]);
CopyToBgTilemapBuffer(2, gPokenavRibbonsSummaryBg_Tilemap, 0, 0);
CopyPaletteIntoBufferUnfaded(gPokenavRibbonsSummaryBg_Pal, 0x10, 0x20);
CopyPaletteIntoBufferUnfaded(gPokenavRibbonsSummaryBg_Pal, BG_PLTT_ID(1), PLTT_SIZE_4BPP);
CopyBgTilemapBufferToVram(2);
return LT_INC_AND_PAUSE;
case 1:
@ -582,8 +583,8 @@ static u32 LoopedTask_OpenRibbonsSummaryMenu(s32 state)
DecompressAndCopyTileDataToVram(1, sRibbonIconsSmall_Gfx, 0, 1, 0);
SetBgTilemapBuffer(1, menu->tilemapBuffers[1]);
FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 32, 20);
CopyPaletteIntoBufferUnfaded(sRibbonIcons1_Pal, 0x20, 0xA0);
CopyPaletteIntoBufferUnfaded(sMonInfo_Pal, 0xA0, 0x20);
CopyPaletteIntoBufferUnfaded(sRibbonIcons1_Pal, BG_PLTT_ID(2), 5 * PLTT_SIZE_4BPP);
CopyPaletteIntoBufferUnfaded(sMonInfo_Pal, BG_PLTT_ID(10), PLTT_SIZE_4BPP);
CopyBgTilemapBufferToVram(1);
return LT_INC_AND_PAUSE;
}

View File

@ -1301,7 +1301,7 @@ static void CB2_InitRayquazaScene(void)
ResetPaletteFade();
ResetSpriteData();
ResetTasks();
FillPalette(RGB_BLACK, 0xF0, 32);
FillPalette(RGB_BLACK, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
CreateTask(sTasksForAnimations[sRayScene->animId], 0);
SetMainCallback2(CB2_RayquazaScene);
}
@ -1592,7 +1592,7 @@ static void LoadDuoFightSceneGfx(void)
LZDecompressWram(gRaySceneDuoFight_Clouds2_Tilemap, sRayScene->tilemapBuffers[0]);
LZDecompressWram(gRaySceneDuoFight_Clouds1_Tilemap, sRayScene->tilemapBuffers[1]);
LZDecompressWram(gRaySceneDuoFight_Clouds3_Tilemap, sRayScene->tilemapBuffers[2]);
LoadCompressedPalette(gRaySceneDuoFight_Clouds_Pal, 0, 0x40);
LoadCompressedPalette(gRaySceneDuoFight_Clouds_Pal, BG_PLTT_ID(0), 2 * PLTT_SIZE_4BPP);
LoadCompressedSpriteSheet(&sSpriteSheet_DuoFight_Groudon);
LoadCompressedSpriteSheet(&sSpriteSheet_DuoFight_GroudonShoulder);
LoadCompressedSpriteSheet(&sSpriteSheet_DuoFight_GroudonClaw);
@ -2032,7 +2032,7 @@ static void LoadTakesFlightSceneGfx(void)
LZDecompressWram(gRaySceneDuoFight_Clouds2_Tilemap, sRayScene->tilemapBuffers[0]);
LZDecompressWram(gRaySceneTakesFlight_Bg_Tilemap, sRayScene->tilemapBuffers[1]);
LZDecompressWram(gRaySceneTakesFlight_Rayquaza_Tilemap, sRayScene->tilemapBuffers[2]);
LoadCompressedPalette(gRaySceneTakesFlight_Rayquaza_Pal, 0, 64);
LoadCompressedPalette(gRaySceneTakesFlight_Rayquaza_Pal, BG_PLTT_ID(0), 2 * PLTT_SIZE_4BPP);
LoadCompressedSpriteSheet(&sSpriteSheet_TakesFlight_Smoke);
LoadCompressedSpritePalette(&sSpritePal_TakesFlight_Smoke);
}
@ -2238,7 +2238,7 @@ static void LoadDescendsSceneGfx(void)
CpuFastCopy(sRayScene->tilemapBuffers[3], sRayScene->tilemapBuffers[1], BG_SCREEN_SIZE);
CpuFastFill16(0, &sRayScene->tilemapBuffers[1][0x100], 0x340);
LoadCompressedPalette(gRaySceneDescends_Bg_Pal, 0, 0x40);
LoadCompressedPalette(gRaySceneDescends_Bg_Pal, BG_PLTT_ID(0), 2 * PLTT_SIZE_4BPP);
gPlttBufferUnfaded[0] = RGB_WHITE;
gPlttBufferFaded[0] = RGB_WHITE;
LoadCompressedSpriteSheet(&sSpriteSheet_Descends_Rayquaza);
@ -2487,7 +2487,7 @@ static void LoadChargesSceneGfx(void)
LZDecompressWram(gRaySceneCharges_Rayquaza_Tilemap, sRayScene->tilemapBuffers[1]);
LZDecompressWram(gRaySceneCharges_Streaks_Tilemap, sRayScene->tilemapBuffers[2]);
LZDecompressWram(gRaySceneCharges_Bg_Tilemap, sRayScene->tilemapBuffers[3]);
LoadCompressedPalette(gRaySceneCharges_Bg_Pal, 0, 0x80);
LoadCompressedPalette(gRaySceneCharges_Bg_Pal, BG_PLTT_ID(0), 4 * PLTT_SIZE_4BPP);
}
#define tState data[0]
@ -2671,7 +2671,7 @@ static void LoadChasesAwaySceneGfx(void)
LZDecompressWram(gRaySceneChasesAway_Bg_Tilemap, sRayScene->tilemapBuffers[1]);
LZDecompressWram(gRaySceneChasesAway_Light_Tilemap, sRayScene->tilemapBuffers[0]);
LZDecompressWram(gRaySceneChasesAway_Ring_Tilemap, sRayScene->tilemapBuffers[2]);
LoadCompressedPalette(gRaySceneChasesAway_Bg_Pal, 0, 0x60);
LoadCompressedPalette(gRaySceneChasesAway_Bg_Pal, BG_PLTT_ID(0), 3 * PLTT_SIZE_4BPP);
LoadCompressedSpriteSheet(&sSpriteSheet_ChasesAway_Groudon);
LoadCompressedSpriteSheet(&sSpriteSheet_ChasesAway_GroudonTail);
LoadCompressedSpriteSheet(&sSpriteSheet_ChasesAway_Kyogre);

View File

@ -557,7 +557,7 @@ bool8 LoadRegionMapGfx(void)
break;
case 2:
if (!FreeTempTileDataBuffersIfPossible())
LoadPalette(sRegionMapBg_Pal, 0x70, 0x60);
LoadPalette(sRegionMapBg_Pal, BG_PLTT_ID(7), 3 * PLTT_SIZE_4BPP);
break;
case 3:
LZ77UnCompWram(sRegionMapCursorSmallGfxLZ, sRegionMap->cursorSmallImage);
@ -1679,7 +1679,7 @@ void CB2_OpenFlyMap(void)
gMain.state++;
break;
case 3:
LoadUserWindowBorderGfx(0, 0x65, 0xd0);
LoadUserWindowBorderGfx(0, 0x65, BG_PLTT_ID(13));
ClearScheduledBgCopiesToVram();
gMain.state++;
break;
@ -1702,7 +1702,7 @@ void CB2_OpenFlyMap(void)
gMain.state++;
break;
case 7:
LoadPalette(sRegionMapFramePal, 0x10, sizeof(sRegionMapFramePal));
LoadPalette(sRegionMapFramePal, BG_PLTT_ID(1), sizeof(sRegionMapFramePal));
PutWindowTilemap(2);
FillWindowPixelBuffer(2, PIXEL_FILL(0));
AddTextPrinterParameterized(2, FONT_NORMAL, gText_FlyToWhere, 0, 1, 0, NULL);

View File

@ -1195,7 +1195,7 @@ static void CB2_LoadRoulette(void)
ResetTempTileDataBuffers();
break;
case 3:
LoadPalette(&sWheel_Pal, 0, 0x1C0);
LoadPalette(&sWheel_Pal, BG_PLTT_ID(0), 14 * PLTT_SIZE_4BPP);
DecompressAndCopyTileDataToVram(1, gRouletteMenu_Gfx, 0, 0, 0);
DecompressAndCopyTileDataToVram(2, gRouletteWheel_Gfx, 0, 0, 0);
break;
@ -2167,16 +2167,16 @@ static void FlashSelectionOnWheel(u8 selectionId)
// The specific color of the poke it references doesn't matter, because the icons of a poke share a palette
// So it just uses the first sprite ID of each
case COL_WYNAUT:
palOffset = gSprites[sRoulette->spriteIds[SPR_WHEEL_ICON_ORANGE_WYNAUT]].oam.paletteNum * 16;
palOffset = PLTT_ID(gSprites[sRoulette->spriteIds[SPR_WHEEL_ICON_ORANGE_WYNAUT]].oam.paletteNum);
break;
case COL_AZURILL:
palOffset = gSprites[sRoulette->spriteIds[SPR_WHEEL_ICON_GREEN_AZURILL]].oam.paletteNum * 16;
palOffset = PLTT_ID(gSprites[sRoulette->spriteIds[SPR_WHEEL_ICON_GREEN_AZURILL]].oam.paletteNum);
break;
case COL_SKITTY:
palOffset = gSprites[sRoulette->spriteIds[SPR_WHEEL_ICON_PURPLE_SKITTY]].oam.paletteNum * 16;
palOffset = PLTT_ID(gSprites[sRoulette->spriteIds[SPR_WHEEL_ICON_PURPLE_SKITTY]].oam.paletteNum);
break;
case COL_MAKUHITA:
palOffset = gSprites[sRoulette->spriteIds[SPR_WHEEL_ICON_ORANGE_MAKUHITA]].oam.paletteNum * 16;
palOffset = PLTT_ID(gSprites[sRoulette->spriteIds[SPR_WHEEL_ICON_ORANGE_MAKUHITA]].oam.paletteNum);
break;
}
if (numSelected == 1)

View File

@ -214,10 +214,10 @@ static void CB2_SaveFailedScreen(void)
ResetSpriteData();
ResetTasks();
ResetPaletteFade();
LoadPalette(gBirchBagGrass_Pal, 0, 0x40);
LoadPalette(sSaveFailedClockPal, 0x100, 0x20);
LoadPalette(gTextWindowFrame1_Pal, 0xE0, 0x20);
LoadPalette(gStandardMenuPalette, 0xF0, 0x20);
LoadPalette(gBirchBagGrass_Pal, BG_PLTT_ID(0), 2 * PLTT_SIZE_4BPP);
LoadPalette(sSaveFailedClockPal, OBJ_PLTT_ID(0), PLTT_SIZE_4BPP);
LoadPalette(gTextWindowFrame1_Pal, BG_PLTT_ID(14), PLTT_SIZE_4BPP);
LoadPalette(gStandardMenuPalette, BG_PLTT_ID(15), PLTT_SIZE_4BPP);
DrawStdFrameWithCustomTileAndPalette(sWindowIds[TEXT_WIN_ID], FALSE, 0x214, 0xE);
DrawStdFrameWithCustomTileAndPalette(sWindowIds[CLOCK_WIN_ID], FALSE, 0x214, 0xE);
FillWindowPixelBuffer(sWindowIds[CLOCK_WIN_ID], PIXEL_FILL(1)); // backwards?

View File

@ -1523,7 +1523,7 @@ bool8 ScrCmd_braillemessage(struct ScriptContext *ctx)
winTemplate = CreateWindowTemplate(0, xWindow, yWindow + 1, width, height, 0xF, 0x1);
sBrailleWindowId = AddWindow(&winTemplate);
LoadUserWindowBorderGfx(sBrailleWindowId, 0x214, 0xE0);
LoadUserWindowBorderGfx(sBrailleWindowId, 0x214, BG_PLTT_ID(14));
DrawStdWindowFrame(sBrailleWindowId, FALSE);
PutWindowTilemap(sBrailleWindowId);
FillWindowPixelBuffer(sBrailleWindowId, PIXEL_FILL(1));

Some files were not shown because too many files have changed in this diff Show More