Add MON_PIC_SIZE constant

This commit is contained in:
GriffinR 2021-03-29 09:38:19 -04:00
parent 357c5439f5
commit 62968895ca
17 changed files with 55 additions and 51 deletions

View File

@ -346,4 +346,6 @@
#define NUM_MALE_LINK_FACILITY_CLASSES 8 #define NUM_MALE_LINK_FACILITY_CLASSES 8
#define NUM_FEMALE_LINK_FACILITY_CLASSES 8 #define NUM_FEMALE_LINK_FACILITY_CLASSES 8
#define MON_PIC_SIZE (64 * 64 / 2)
#endif // GUARD_CONSTANTS_POKEMON_H #endif // GUARD_CONSTANTS_POKEMON_H

View File

@ -2292,7 +2292,7 @@ void AnimTask_TransformMon(u8 taskId)
src = gMonSpritesGfxPtr->sprites.ptr[position] + (gBattleMonForms[gBattleAnimAttacker] << 11); src = gMonSpritesGfxPtr->sprites.ptr[position] + (gBattleMonForms[gBattleAnimAttacker] << 11);
dest = animBg.bgTiles; dest = animBg.bgTiles;
CpuCopy32(src, dest, 0x800); CpuCopy32(src, dest, MON_PIC_SIZE);
LoadBgTiles(1, animBg.bgTiles, 0x800, animBg.tilesOffset); LoadBgTiles(1, animBg.bgTiles, 0x800, animBg.tilesOffset);
if (IsContest()) if (IsContest())
{ {

View File

@ -107,8 +107,8 @@ static const struct SpriteTemplate sSpriteTemplate_MoveEffectMons[] =
static const struct SpriteSheet sSpriteSheet_MoveEffectMons[] = static const struct SpriteSheet sSpriteSheet_MoveEffectMons[] =
{ {
{ gMiscBlank_Gfx, 0x800, TAG_MOVE_EFFECT_MON_1, }, { gMiscBlank_Gfx, MON_PIC_SIZE, TAG_MOVE_EFFECT_MON_1, },
{ gMiscBlank_Gfx, 0x800, TAG_MOVE_EFFECT_MON_2, }, { gMiscBlank_Gfx, MON_PIC_SIZE, TAG_MOVE_EFFECT_MON_2, },
}; };
u8 GetBattlerSpriteCoord(u8 battlerId, u8 coordType) u8 GetBattlerSpriteCoord(u8 battlerId, u8 coordType)
@ -2068,7 +2068,7 @@ u8 CreateAdditionalMonSpriteForMoveAnim(u16 species, bool8 isBackpic, u8 id, s16
FALSE); FALSE);
} }
RequestDma3Copy(gMonSpritesGfxPtr->buffer, (void *)(OBJ_VRAM0 + (sheet * 0x20)), 0x800, 1); RequestDma3Copy(gMonSpritesGfxPtr->buffer, (void *)(OBJ_VRAM0 + (sheet * 0x20)), MON_PIC_SIZE, 1);
FREE_AND_SET_NULL(gMonSpritesGfxPtr->buffer); FREE_AND_SET_NULL(gMonSpritesGfxPtr->buffer);
if (!isBackpic) if (!isBackpic)

View File

@ -2182,7 +2182,7 @@ void AnimTask_SubstituteFadeToInvisible(u8 taskId)
break; break;
case 2: case 2:
spriteId = gBattlerSpriteIds[gBattleAnimAttacker]; spriteId = gBattlerSpriteIds[gBattleAnimAttacker];
RequestDma3Fill(0, (void *)OBJ_VRAM0 + gSprites[spriteId].oam.tileNum * TILE_SIZE_4BPP, 0x800, 1); RequestDma3Fill(0, (void *)OBJ_VRAM0 + gSprites[spriteId].oam.tileNum * TILE_SIZE_4BPP, MON_PIC_SIZE, 1);
ClearBehindSubstituteBit(gBattleAnimAttacker); ClearBehindSubstituteBit(gBattleAnimAttacker);
DestroyAnimVisualTask(taskId); DestroyAnimVisualTask(taskId);
break; break;

View File

@ -967,7 +967,7 @@ void HandleSpeciesGfxDataChange(u8 battlerAtk, u8 battlerDef, bool8 notTransform
src = gMonSpritesGfxPtr->sprites.ptr[position]; src = gMonSpritesGfxPtr->sprites.ptr[position];
dst = (void *)(OBJ_VRAM0 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32); dst = (void *)(OBJ_VRAM0 + gSprites[gBattlerSpriteIds[battlerAtk]].oam.tileNum * 32);
DmaCopy32(3, src, dst, 0x800); DmaCopy32(3, src, dst, MON_PIC_SIZE);
paletteOffset = 0x100 + battlerAtk * 16; paletteOffset = 0x100 + battlerAtk * 16;
lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(targetSpecies, otId, personalityValue); lzPaletteData = GetMonSpritePalFromSpeciesAndPersonality(targetSpecies, otId, personalityValue);
LZDecompressWram(lzPaletteData, gDecompressionBuffer); LZDecompressWram(lzPaletteData, gDecompressionBuffer);
@ -1014,7 +1014,7 @@ void BattleLoadSubstituteOrMonSpriteGfx(u8 battlerId, bool8 loadMonSprite)
for (i = 1; i < 4; i++) for (i = 1; i < 4; i++)
{ {
Dma3CopyLarge32_(gMonSpritesGfxPtr->sprites.ptr[position], &gMonSpritesGfxPtr->sprites.byte[position][0x800 * i], 0x800); Dma3CopyLarge32_(gMonSpritesGfxPtr->sprites.ptr[position], &gMonSpritesGfxPtr->sprites.byte[position][MON_PIC_SIZE * i], MON_PIC_SIZE);
} }
palOffset = (battlerId * 16) + 0x100; palOffset = (battlerId * 16) + 0x100;
@ -1259,8 +1259,8 @@ void AllocateMonSpritesGfx(void)
for (j = 0; j < 4; j++) for (j = 0; j < 4; j++)
{ {
gMonSpritesGfxPtr->field_74[i][j].data = gMonSpritesGfxPtr->sprites.ptr[i] + (j * 0x800); gMonSpritesGfxPtr->field_74[i][j].data = gMonSpritesGfxPtr->sprites.ptr[i] + (j * MON_PIC_SIZE);
gMonSpritesGfxPtr->field_74[i][j].size = 0x800; gMonSpritesGfxPtr->field_74[i][j].size = MON_PIC_SIZE;
} }
gMonSpritesGfxPtr->templates[i].images = gMonSpritesGfxPtr->field_74[i]; gMonSpritesGfxPtr->templates[i].images = gMonSpritesGfxPtr->field_74[i];

View File

@ -288,7 +288,7 @@ static const union AnimCmd *const sAnims_Rival[] =
sAnim_Rival_Still, sAnim_Rival_Still,
}; };
#define MONBG_OFFSET (0x800 * 3) #define MONBG_OFFSET (MON_PIC_SIZE * 3)
static const struct SpriteSheet sSpriteSheet_MonBg[] = { static const struct SpriteSheet sSpriteSheet_MonBg[] = {
{ gDecompressionBuffer, MONBG_OFFSET, TAG_MON_BG }, { gDecompressionBuffer, MONBG_OFFSET, TAG_MON_BG },
{}, {},
@ -566,12 +566,12 @@ static void Task_CreditsLoadGrassScene(u8 taskIdA)
LZ77UnCompVram(gBirchGrassTilemap, (void *)(BG_SCREEN_ADDR(7))); LZ77UnCompVram(gBirchGrassTilemap, (void *)(BG_SCREEN_ADDR(7)));
LoadPalette(gBirchBagGrassPal[0] + 1, 1, 31 * 2); LoadPalette(gBirchBagGrassPal[0] + 1, 1, 31 * 2);
for (i = 0; i < 0x800; i++) for (i = 0; i < MON_PIC_SIZE; i++)
gDecompressionBuffer[i] = 0x11; gDecompressionBuffer[i] = 0x11;
for (i = 0; i < 0x800; i++) for (i = 0; i < MON_PIC_SIZE; i++)
(gDecompressionBuffer + 0x800)[i] = 0x22; (gDecompressionBuffer + MON_PIC_SIZE)[i] = 0x22;
for (i = 0; i < 0x800; i++) for (i = 0; i < MON_PIC_SIZE; i++)
(gDecompressionBuffer + 0x800 * 2)[i] = 0x33; (gDecompressionBuffer + MON_PIC_SIZE * 2)[i] = 0x33;
temp = (u16 *)(&gDecompressionBuffer[MONBG_OFFSET]); temp = (u16 *)(&gDecompressionBuffer[MONBG_OFFSET]);
temp[0] = RGB_BLACK; temp[0] = RGB_BLACK;

View File

@ -12,36 +12,38 @@ const u16 gMinigameDigits_Pal[] = INCBIN_U16("graphics/link/minigame_digits.gbap
const u32 gMinigameDigits_Gfx[] = INCBIN_U32("graphics/link/minigame_digits.4bpp.lz"); const u32 gMinigameDigits_Gfx[] = INCBIN_U32("graphics/link/minigame_digits.4bpp.lz");
static const u32 sMinigameDigitsThin_Gfx[] = INCBIN_U32("graphics/link/minigame_digits2.4bpp.lz"); // Unused static const u32 sMinigameDigitsThin_Gfx[] = INCBIN_U32("graphics/link/minigame_digits2.4bpp.lz"); // Unused
#define BATTLER_OFFSET(i) (gHeap + 0x8000 + MON_PIC_SIZE * (i))
const struct SpriteFrameImage gBattlerPicTable_PlayerLeft[] = const struct SpriteFrameImage gBattlerPicTable_PlayerLeft[] =
{ {
gHeap + 0x8000, 0x800, BATTLER_OFFSET(0), MON_PIC_SIZE,
gHeap + 0x8800, 0x800, BATTLER_OFFSET(1), MON_PIC_SIZE,
gHeap + 0x9000, 0x800, BATTLER_OFFSET(2), MON_PIC_SIZE,
gHeap + 0x9800, 0x800, BATTLER_OFFSET(3), MON_PIC_SIZE,
}; };
const struct SpriteFrameImage gBattlerPicTable_OpponentLeft[] = const struct SpriteFrameImage gBattlerPicTable_OpponentLeft[] =
{ {
gHeap + 0xA000, 0x800, BATTLER_OFFSET(4), MON_PIC_SIZE,
gHeap + 0xA800, 0x800, BATTLER_OFFSET(5), MON_PIC_SIZE,
gHeap + 0xB000, 0x800, BATTLER_OFFSET(6), MON_PIC_SIZE,
gHeap + 0xB800, 0x800, BATTLER_OFFSET(7), MON_PIC_SIZE,
}; };
const struct SpriteFrameImage gBattlerPicTable_PlayerRight[] = const struct SpriteFrameImage gBattlerPicTable_PlayerRight[] =
{ {
gHeap + 0xC000, 0x800, BATTLER_OFFSET(8), MON_PIC_SIZE,
gHeap + 0xC800, 0x800, BATTLER_OFFSET(9), MON_PIC_SIZE,
gHeap + 0xD000, 0x800, BATTLER_OFFSET(10), MON_PIC_SIZE,
gHeap + 0xD800, 0x800, BATTLER_OFFSET(11), MON_PIC_SIZE,
}; };
const struct SpriteFrameImage gBattlerPicTable_OpponentRight[] = const struct SpriteFrameImage gBattlerPicTable_OpponentRight[] =
{ {
gHeap + 0xE000, 0x800, BATTLER_OFFSET(12), MON_PIC_SIZE,
gHeap + 0xE800, 0x800, BATTLER_OFFSET(13), MON_PIC_SIZE,
gHeap + 0xF000, 0x800, BATTLER_OFFSET(14), MON_PIC_SIZE,
gHeap + 0xF800, 0x800, BATTLER_OFFSET(15), MON_PIC_SIZE,
}; };
const struct SpriteFrameImage gTrainerBackPicTable_Brendan[] = const struct SpriteFrameImage gTrainerBackPicTable_Brendan[] =
@ -290,7 +292,7 @@ const union AnimCmd *const gUnknown_082FF70C[] =
gUnknown_082FF704, gUnknown_082FF704,
}; };
#define SPECIES_SPRITE(species, sprite) [SPECIES_##species] = {sprite, 0x800, SPECIES_##species} #define SPECIES_SPRITE(species, sprite) [SPECIES_##species] = {sprite, MON_PIC_SIZE, SPECIES_##species}
#define SPECIES_PAL(species, pal) [SPECIES_##species] = {pal, SPECIES_##species} #define SPECIES_PAL(species, pal) [SPECIES_##species] = {pal, SPECIES_##species}
#define SPECIES_SHINY_PAL(species, pal) [SPECIES_##species] = {pal, SPECIES_##species + SPECIES_SHINY_TAG} #define SPECIES_SHINY_PAL(species, pal) [SPECIES_##species] = {pal, SPECIES_##species + SPECIES_SHINY_TAG}

View File

@ -390,5 +390,5 @@ void LoadSpecialPokePic_DontHandleDeoxys(const struct CompressedSpriteSheet *src
static void DuplicateDeoxysTiles(void *pointer, s32 species) static void DuplicateDeoxysTiles(void *pointer, s32 species)
{ {
if (species == SPECIES_DEOXYS) if (species == SPECIES_DEOXYS)
CpuCopy32(pointer + 0x800, pointer, 0x800); CpuCopy32(pointer + MON_PIC_SIZE, pointer, MON_PIC_SIZE);
} }

View File

@ -1150,7 +1150,7 @@ static const union AnimCmd *const sAnims_ConditionSelectionIcon[] =
// Just loads the generic data, up to the caller to load the actual sheet/pal for the specific mon // Just loads the generic data, up to the caller to load the actual sheet/pal for the specific mon
void LoadConditionMonPicTemplate(struct SpriteSheet *sheet, struct SpriteTemplate *template, struct SpritePalette *pal) void LoadConditionMonPicTemplate(struct SpriteSheet *sheet, struct SpriteTemplate *template, struct SpritePalette *pal)
{ {
struct SpriteSheet dataSheet = {NULL, 0x800, TAG_CONDITION_MON}; struct SpriteSheet dataSheet = {NULL, MON_PIC_SIZE, TAG_CONDITION_MON};
struct SpriteTemplate dataTemplate = struct SpriteTemplate dataTemplate =
{ {

View File

@ -394,10 +394,10 @@ bool32 HandleMysteryGiftOrEReaderSetup(s32 mg_or_ereader)
ChangeBgX(3, 0, 0); ChangeBgX(3, 0, 0);
ChangeBgY(3, 0, 0); ChangeBgY(3, 0, 0);
SetBgTilemapBuffer(3, Alloc(0x800)); SetBgTilemapBuffer(3, Alloc(BG_SCREEN_SIZE));
SetBgTilemapBuffer(2, Alloc(0x800)); SetBgTilemapBuffer(2, Alloc(BG_SCREEN_SIZE));
SetBgTilemapBuffer(1, Alloc(0x800)); SetBgTilemapBuffer(1, Alloc(BG_SCREEN_SIZE));
SetBgTilemapBuffer(0, Alloc(0x800)); SetBgTilemapBuffer(0, Alloc(BG_SCREEN_SIZE));
bgid_upload_textbox_1(3); bgid_upload_textbox_1(3);
InitWindows(sMainWindows); InitWindows(sMainWindows);

View File

@ -2713,7 +2713,7 @@ static void CreateJumpMonSprite(struct PokemonJumpGfx *jumpGfx, struct PokemonJu
spriteTemplate = sSpriteTemplate_JumpMon; spriteTemplate = sSpriteTemplate_JumpMon;
buffer = Alloc(0x2000); buffer = Alloc(0x2000);
unusedBuffer = Alloc(0x800); unusedBuffer = Alloc(MON_PIC_SIZE);
if (multiplayerId == GetPokeJumpMultiplayerId()) if (multiplayerId == GetPokeJumpMultiplayerId())
subpriority = 3; subpriority = 3;
else else
@ -2729,7 +2729,7 @@ static void CreateJumpMonSprite(struct PokemonJumpGfx *jumpGfx, struct PokemonJu
spriteSheet.data = buffer; spriteSheet.data = buffer;
spriteSheet.tag = multiplayerId; spriteSheet.tag = multiplayerId;
spriteSheet.size = 0x800; spriteSheet.size = MON_PIC_SIZE;
LoadSpriteSheet(&spriteSheet); LoadSpriteSheet(&spriteSheet);
spritePalette.data = GetMonSpritePalFromSpeciesAndPersonality(monInfo->species, monInfo->otId, monInfo->personality); spritePalette.data = GetMonSpritePalFromSpeciesAndPersonality(monInfo->species, monInfo->otId, monInfo->personality);

View File

@ -4049,11 +4049,11 @@ static void LoadCursorMonSprite(void)
u16 tileStart; u16 tileStart;
u8 palSlot; u8 palSlot;
u8 spriteId; u8 spriteId;
struct SpriteSheet sheet = {sPSSData->field_22C4, 0x800, TAG_TILE_2}; struct SpriteSheet sheet = {sPSSData->field_22C4, MON_PIC_SIZE, TAG_TILE_2};
struct SpritePalette palette = {sPSSData->field_2244, TAG_PAL_DAC6}; struct SpritePalette palette = {sPSSData->field_2244, TAG_PAL_DAC6};
struct SpriteTemplate template = sSpriteTemplate_CursorMon; struct SpriteTemplate template = sSpriteTemplate_CursorMon;
for (i = 0; i < 0x800; i++) for (i = 0; i < MON_PIC_SIZE; i++)
sPSSData->field_22C4[i] = 0; sPSSData->field_22C4[i] = 0;
for (i = 0; i < 0x10; i++) for (i = 0; i < 0x10; i++)
sPSSData->field_2244[i] = 0; sPSSData->field_2244[i] = 0;
@ -4095,7 +4095,7 @@ static void LoadCursorMonGfx(u16 species, u32 pid)
{ {
LoadSpecialPokePic(&gMonFrontPicTable[species], sPSSData->field_22C4, species, pid, TRUE); LoadSpecialPokePic(&gMonFrontPicTable[species], sPSSData->field_22C4, species, pid, TRUE);
LZ77UnCompWram(sPSSData->cursorMonPalette, sPSSData->field_2244); LZ77UnCompWram(sPSSData->cursorMonPalette, sPSSData->field_2244);
CpuCopy32(sPSSData->field_22C4, sPSSData->field_223C, 0x800); CpuCopy32(sPSSData->field_22C4, sPSSData->field_223C, MON_PIC_SIZE);
LoadPalette(sPSSData->field_2244, sPSSData->field_223A, 0x20); LoadPalette(sPSSData->field_2244, sPSSData->field_223A, 0x20);
sPSSData->cursorMonSprite->invisible = FALSE; sPSSData->cursorMonSprite->invisible = FALSE;
} }

View File

@ -17,7 +17,7 @@ struct PokenavSub11
{ {
u32 monPal[3][0x20]; u32 monPal[3][0x20];
u8 fill[0x180]; u8 fill[0x180];
u32 monPicGfx[3][0x800]; u32 monPicGfx[3][MON_PIC_SIZE];
u8 searchMode; u8 searchMode;
s16 monIndex; s16 monIndex;
u32 (*callback)(struct PokenavSub11 *); u32 (*callback)(struct PokenavSub11 *);

View File

@ -828,7 +828,7 @@ void CreateConditionMonPic(u8 id)
} }
else else
{ {
DmaCopy16Defvars(3, GetConditionMonPicGfx(id), structPtr->unk181C, 0x800); DmaCopy16Defvars(3, GetConditionMonPicGfx(id), structPtr->unk181C, MON_PIC_SIZE);
LoadPalette(GetConditionMonPal(id), structPtr->monPalIndex, 0x20); LoadPalette(GetConditionMonPal(id), structPtr->monPalIndex, 0x20);
} }
} }

View File

@ -2893,9 +2893,9 @@ static void InitTradeBgInternal(void)
InitBgsFromTemplates(0, sTradeSequenceBgTemplates, ARRAY_COUNT(sTradeSequenceBgTemplates)); InitBgsFromTemplates(0, sTradeSequenceBgTemplates, ARRAY_COUNT(sTradeSequenceBgTemplates));
ChangeBgX(0, 0, 0); ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0); ChangeBgY(0, 0, 0);
SetBgTilemapBuffer(0, Alloc(0x800)); SetBgTilemapBuffer(0, Alloc(BG_SCREEN_SIZE));
SetBgTilemapBuffer(1, Alloc(0x800)); SetBgTilemapBuffer(1, Alloc(BG_SCREEN_SIZE));
SetBgTilemapBuffer(3, Alloc(0x800)); SetBgTilemapBuffer(3, Alloc(BG_SCREEN_SIZE));
DeactivateAllTextPrinters(); DeactivateAllTextPrinters();
DecompressAndLoadBgGfxUsingHeap(0, gBattleTextboxTiles, 0, 0, 0); DecompressAndLoadBgGfxUsingHeap(0, gBattleTextboxTiles, 0, 0, 0);
LZDecompressWram(gBattleTextboxTilemap, gDecompressionBuffer); LZDecompressWram(gBattleTextboxTilemap, gDecompressionBuffer);

View File

@ -1241,7 +1241,7 @@ static void UpdateMonPic(u8 loadId)
} }
else else
{ {
Dma3CopyLarge16_(sMenu->partySheets[loadId], sMenu->curMonTileStart, 0x800); Dma3CopyLarge16_(sMenu->partySheets[loadId], sMenu->curMonTileStart, MON_PIC_SIZE);
LoadPalette(sMenu->partyPalettes[loadId], sMenu->curMonPalette, 32); LoadPalette(sMenu->partyPalettes[loadId], sMenu->curMonPalette, 32);
} }
} }

View File

@ -174,8 +174,8 @@ static void CB2_InitWirelessCommunicationScreen(void)
SetVBlankCallback(NULL); SetVBlankCallback(NULL);
ResetBgsAndClearDma3BusyFlags(0); ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates)); InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates));
SetBgTilemapBuffer(1, Alloc(0x800)); SetBgTilemapBuffer(1, Alloc(BG_SCREEN_SIZE));
SetBgTilemapBuffer(0, Alloc(0x800)); SetBgTilemapBuffer(0, Alloc(BG_SCREEN_SIZE));
DecompressAndLoadBgGfxUsingHeap(1, sBgTiles_Gfx, 0, 0, 0); DecompressAndLoadBgGfxUsingHeap(1, sBgTiles_Gfx, 0, 0, 0);
CopyToBgTilemapBuffer(1, sBgTiles_Tilemap, 0, 0); CopyToBgTilemapBuffer(1, sBgTiles_Tilemap, 0, 0);
InitWindows(sWindowTemplates); InitWindows(sWindowTemplates);