From 98062c69d613fb1b9e2345924dd34d0bbdcfcc90 Mon Sep 17 00:00:00 2001 From: ProjectRevoTPP Date: Mon, 2 Jan 2017 04:27:51 -0500 Subject: label and document berry.c, decompress.c, item_use.c and label gBattleTypeFlags (#146) * make ROM match again * clean up item_use.c labels and clarify functions. * label and clarify some functions in decompress.c * label and clarify berry.c * rename 20239F8 to gBattleTypeFlags * formatting --- src/decompress.c | 50 ++++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-) (limited to 'src/decompress.c') diff --git a/src/decompress.c b/src/decompress.c index ebfd78ffb..8f573fecb 100644 --- a/src/decompress.c +++ b/src/decompress.c @@ -61,50 +61,52 @@ void LoadCompressedObjectPaletteOverrideBuffer(const struct SpritePalette *a, vo LoadSpritePalette(&spritePalette); } -void DecompressPicFromTable_2(const struct SpriteSheet *a, u8 b, u8 c, void *d, void *e, s32 f) +void DecompressPicFromTable_2(const struct SpriteSheet *a, u8 b, u8 c, void *d, void *e, s32 species) { - if (f > 412) + if (species > SPECIES_EGG) LZ77UnCompWram(gMonFrontPicTable[0].data, e); else LZ77UnCompWram(a->data, e); } -void sub_800D334(const struct SpriteSheet *a, u32 b, u32 c, u32 d, void *dest, s32 f, u32 g) +void HandleLoadSpecialPokePic(const struct SpriteSheet *spriteSheet, u32 b, u32 c, u32 d, void *dest, s32 species, u32 g) { - u32 unk; + u32 frontOrBack; + // gUnknown_081FAF4C appears to be a list of pointers to locations to store poke pics for back and front pic here. the first and third pointers are used for back while the others are used for front. if (dest == gUnknown_081FAF4C[0] || dest == gUnknown_081FAF4C[2]) - unk = 0; + frontOrBack = 0; // backPic else - unk = 1; - sub_800D378(a, b, c, d, dest, f, g, unk); + frontOrBack = 1; // frontPic + + LoadSpecialPokePic(spriteSheet, b, c, d, dest, species, g, frontOrBack); } -void sub_800D378(const struct SpriteSheet *a, u32 b, u32 c, u32 d, void *dest, s32 f, u32 g, u32 h) +void LoadSpecialPokePic(const struct SpriteSheet *spriteSheet, u32 b, u32 c, u32 d, void *dest, s32 species, u32 g, u32 frontOrBack) { - u8 r7 = h; + u8 frontOrBack8 = frontOrBack; - if (f == SPECIES_UNOWN) + if (species == SPECIES_UNOWN) { - u16 r1 = (((g & 0x3000000) >> 18) | ((g & 0x30000) >> 12) | ((g & 0x300) >> 6) | (g & 3)) % 0x1C; + u16 i = (((g & 0x3000000) >> 18) | ((g & 0x30000) >> 12) | ((g & 0x300) >> 6) | (g & 3)) % 0x1C; - if (r1 == 0) - r1 = SPECIES_UNOWN; + // if it is Unown A, set the index to where Unown begins, otherwise add the egg index to get the correct letter to load. + if (i == 0) + i = SPECIES_UNOWN; else - r1 += 412; - if (r7 == 0) - LZ77UnCompWram(gMonBackPicTable[r1].data, dest); + i += SPECIES_EGG; + + if (frontOrBack8 == 0) + LZ77UnCompWram(gMonBackPicTable[i].data, dest); else - LZ77UnCompWram(gMonFrontPicTable[r1].data, dest); + LZ77UnCompWram(gMonFrontPicTable[i].data, dest); } + else if (species > SPECIES_EGG) // is species unknown? draw the ? icon + LZ77UnCompWram(gMonFrontPicTable[0].data, dest); else - { - if (f > 412) - LZ77UnCompWram(gMonFrontPicTable[0].data, dest); - else - LZ77UnCompWram(a->data, dest); - } - DrawSpindaSpots(f, g, dest, r7); + LZ77UnCompWram(spriteSheet->data, dest); + + DrawSpindaSpots(species, g, dest, frontOrBack8); } void Unused_LZDecompressWramIndirect(const void **src, void *dest) -- cgit v1.2.3