diff options
Diffstat (limited to 'src/pokemon')
-rw-r--r-- | src/pokemon/pokeblock_feed.c | 6 | ||||
-rw-r--r-- | src/pokemon/pokedex.c | 99 | ||||
-rw-r--r-- | src/pokemon/pokemon_3.c | 24 |
3 files changed, 64 insertions, 65 deletions
diff --git a/src/pokemon/pokeblock_feed.c b/src/pokemon/pokeblock_feed.c index ccbb391af..5d6b215cd 100644 --- a/src/pokemon/pokeblock_feed.c +++ b/src/pokemon/pokeblock_feed.c @@ -46,7 +46,7 @@ extern const u8 gBattleTerrainPalette_BattleTower[]; extern const struct CompressedSpriteSheet gUnknown_083F7F74; extern const struct CompressedSpritePalette gUnknown_083F7F7C; -bool8 sub_8040A3C(u16 species); +bool8 IsPokeSpriteNotFlipped(u16 species); // this file's functions static void sub_8147B04(void); @@ -626,7 +626,7 @@ static bool8 sub_8147B20(struct Pokemon* mon) species = GetMonData(mon, MON_DATA_SPECIES2); PiD = GetMonData(mon, MON_DATA_PERSONALITY); TiD = GetMonData(mon, MON_DATA_OT_ID); - palette = sub_80409C8(species, TiD, PiD); + palette = GetMonSpritePalStructFromOtIdPersonality(species, TiD, PiD); LoadCompressedObjectPalette(palette); GetMonSpriteTemplate_803C56C(palette->tag, 1); ewram[0x1FFFF]++; @@ -766,7 +766,7 @@ static u8 PokeblockFeed_CreatePokeSprite(struct Pokemon* mon) gSprites[spriteID].data2 = species; gSprites[spriteID].callback = SpriteCallbackDummy; gPokeblockMonNotFlipped = 1; - if (!sub_8040A3C(species)) + if (!IsPokeSpriteNotFlipped(species)) { gSprites[spriteID].affineAnims = sSpriteAffineAnimTable_84120EC; gSprites[spriteID].oam.affineMode = 3; diff --git a/src/pokemon/pokedex.c b/src/pokemon/pokedex.c index ffb7f7e95..e27ec1e05 100644 --- a/src/pokemon/pokedex.c +++ b/src/pokemon/pokedex.c @@ -1,4 +1,3 @@ - #include "global.h" #include "gba/m4a_internal.h" #include "pokedex.h" @@ -1320,8 +1319,8 @@ void ResetPokedex(void) { gSaveBlock2.pokedex.owned[i] = 0; gSaveBlock2.pokedex.seen[i] = 0; - gSaveBlock1.unk938[i] = 0; - gSaveBlock1.unk3A8C[i] = 0; + gSaveBlock1.dexSeen2[i] = 0; + gSaveBlock1.dexSeen3[i] = 0; } } @@ -2030,8 +2029,8 @@ static void SortPokedex(u8 dexMode, u8 sortMode) { vars[2] = HoennToNationalOrder(i + 1); gPokedexView->unk0[i].dexNum = vars[2]; - gPokedexView->unk0[i].seen = GetNationalPokedexFlag(vars[2], 0); - gPokedexView->unk0[i].owned = GetNationalPokedexFlag(vars[2], 1); + gPokedexView->unk0[i].seen = GetSetPokedexFlag(vars[2], 0); + gPokedexView->unk0[i].owned = GetSetPokedexFlag(vars[2], 1); if (gPokedexView->unk0[i].seen) gPokedexView->pokemonListCount = i + 1; } @@ -2045,14 +2044,14 @@ static void SortPokedex(u8 dexMode, u8 sortMode) for (i = 0; i < vars[0]; i++) { vars[2] = i + 1; - if (GetNationalPokedexFlag(vars[2], 0)) + if (GetSetPokedexFlag(vars[2], 0)) r10 = 1; if (r10) { asm(""); //Needed to match for some reason gPokedexView->unk0[r5].dexNum = vars[2]; - gPokedexView->unk0[r5].seen = GetNationalPokedexFlag(vars[2], 0); - gPokedexView->unk0[r5].owned = GetNationalPokedexFlag(vars[2], 1); + gPokedexView->unk0[r5].seen = GetSetPokedexFlag(vars[2], 0); + gPokedexView->unk0[r5].owned = GetSetPokedexFlag(vars[2], 1); if (gPokedexView->unk0[r5].seen) gPokedexView->pokemonListCount = r5 + 1; r5++; @@ -2065,11 +2064,11 @@ static void SortPokedex(u8 dexMode, u8 sortMode) { vars[2] = gPokedexOrder_Alphabetical[i]; - if (NationalToHoennOrder(vars[2]) <= vars[0] && GetNationalPokedexFlag(vars[2], 0)) + if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 0)) { gPokedexView->unk0[gPokedexView->pokemonListCount].dexNum = vars[2]; gPokedexView->unk0[gPokedexView->pokemonListCount].seen = 1; - gPokedexView->unk0[gPokedexView->pokemonListCount].owned = GetNationalPokedexFlag(vars[2], 1); + gPokedexView->unk0[gPokedexView->pokemonListCount].owned = GetSetPokedexFlag(vars[2], 1); gPokedexView->pokemonListCount++; } } @@ -2079,7 +2078,7 @@ static void SortPokedex(u8 dexMode, u8 sortMode) { vars[2] = gPokedexOrder_Weight[i]; - if (NationalToHoennOrder(vars[2]) <= vars[0] && GetNationalPokedexFlag(vars[2], 1)) + if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 1)) { gPokedexView->unk0[gPokedexView->pokemonListCount].dexNum = vars[2]; gPokedexView->unk0[gPokedexView->pokemonListCount].seen = 1; @@ -2093,7 +2092,7 @@ static void SortPokedex(u8 dexMode, u8 sortMode) { vars[2] = gPokedexOrder_Weight[i]; - if (NationalToHoennOrder(vars[2]) <= vars[0] && GetNationalPokedexFlag(vars[2], 1)) + if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 1)) { gPokedexView->unk0[gPokedexView->pokemonListCount].dexNum = vars[2]; gPokedexView->unk0[gPokedexView->pokemonListCount].seen = 1; @@ -2107,7 +2106,7 @@ static void SortPokedex(u8 dexMode, u8 sortMode) { vars[2] = gPokedexOrder_Height[i]; - if (NationalToHoennOrder(vars[2]) <= vars[0] && GetNationalPokedexFlag(vars[2], 1)) + if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 1)) { gPokedexView->unk0[gPokedexView->pokemonListCount].dexNum = vars[2]; gPokedexView->unk0[gPokedexView->pokemonListCount].seen = 1; @@ -2121,7 +2120,7 @@ static void SortPokedex(u8 dexMode, u8 sortMode) { vars[2] = gPokedexOrder_Height[i]; - if (NationalToHoennOrder(vars[2]) <= vars[0] && GetNationalPokedexFlag(vars[2], 1)) + if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 1)) { gPokedexView->unk0[gPokedexView->pokemonListCount].dexNum = vars[2]; gPokedexView->unk0[gPokedexView->pokemonListCount].seen = 1; @@ -3946,7 +3945,7 @@ static void sub_8090B8C(u8 taskId) otId = ((u16)gTasks[taskId].data[13] << 16) | (u16)gTasks[taskId].data[12]; personality = ((u16)gTasks[taskId].data[15] << 16) | (u16)gTasks[taskId].data[14]; paletteNum = gSprites[gTasks[taskId].data[3]].oam.paletteNum; - lzPaletteData = species_and_otid_get_pal(species, otId, personality); + lzPaletteData = GetMonSpritePalFromOtIdPersonality(species, otId, personality); LoadCompressedPalette(lzPaletteData, 0x100 | paletteNum * 16, 32); DestroyTask(taskId); } @@ -4008,79 +4007,79 @@ u16 GetPokedexHeightWeight(u16 dexNum, u8 data) } } -s8 GetNationalPokedexFlag(u16 a, u8 b) +s8 GetSetPokedexFlag(u16 nationalDexNo, u8 caseID) { u8 index; u8 bit; u8 mask; s8 retVal; - a--; - index = a / 8; - bit = a % 8; + nationalDexNo--; + index = nationalDexNo / 8; + bit = nationalDexNo % 8; mask = 1 << bit; retVal = 0; - switch (b) + switch (caseID) { - case 0: + case FLAG_GET_SEEN: if (gSaveBlock2.pokedex.seen[index] & mask) { - if ((gSaveBlock2.pokedex.seen[index] & mask) == (gSaveBlock1.unk938[index] & mask) - && (gSaveBlock2.pokedex.seen[index] & mask) == (gSaveBlock1.unk3A8C[index] & mask)) + if ((gSaveBlock2.pokedex.seen[index] & mask) == (gSaveBlock1.dexSeen2[index] & mask) + && (gSaveBlock2.pokedex.seen[index] & mask) == (gSaveBlock1.dexSeen3[index] & mask)) retVal = 1; else { gSaveBlock2.pokedex.seen[index] &= ~mask; - gSaveBlock1.unk938[index] &= ~mask; - gSaveBlock1.unk3A8C[index] &= ~mask; + gSaveBlock1.dexSeen2[index] &= ~mask; + gSaveBlock1.dexSeen3[index] &= ~mask; retVal = 0; } } break; - case 1: + case FLAG_GET_CAUGHT: if (gSaveBlock2.pokedex.owned[index] & mask) { if ((gSaveBlock2.pokedex.owned[index] & mask) == (gSaveBlock2.pokedex.seen[index] & mask) - && (gSaveBlock2.pokedex.owned[index] & mask) == (gSaveBlock1.unk938[index] & mask) - && (gSaveBlock2.pokedex.owned[index] & mask) == (gSaveBlock1.unk3A8C[index] & mask)) + && (gSaveBlock2.pokedex.owned[index] & mask) == (gSaveBlock1.dexSeen2[index] & mask) + && (gSaveBlock2.pokedex.owned[index] & mask) == (gSaveBlock1.dexSeen3[index] & mask)) retVal = 1; else { gSaveBlock2.pokedex.owned[index] &= ~mask; gSaveBlock2.pokedex.seen[index] &= ~mask; - gSaveBlock1.unk938[index] &= ~mask; - gSaveBlock1.unk3A8C[index] &= ~mask; + gSaveBlock1.dexSeen2[index] &= ~mask; + gSaveBlock1.dexSeen3[index] &= ~mask; retVal = 0; } } break; - case 2: + case FLAG_SET_SEEN: gSaveBlock2.pokedex.seen[index] |= mask; - gSaveBlock1.unk938[index] |= mask; - gSaveBlock1.unk3A8C[index] |= mask; + gSaveBlock1.dexSeen2[index] |= mask; + gSaveBlock1.dexSeen3[index] |= mask; break; - case 3: + case FLAG_SET_CAUGHT: gSaveBlock2.pokedex.owned[index] |= mask; break; } return retVal; } -u16 GetNationalPokedexCount(u8 a) +u16 GetNationalPokedexCount(u8 caseID) { u16 count = 0; u16 i; for (i = 0; i < NATIONAL_DEX_COUNT; i++) { - switch (a) + switch (caseID) { - case 0: - if (GetNationalPokedexFlag(i + 1, 0) != 0) + case FLAG_GET_SEEN: + if (GetSetPokedexFlag(i + 1, FLAG_GET_SEEN)) count++; break; - case 1: - if (GetNationalPokedexFlag(i + 1, 1) != 0) + case FLAG_GET_CAUGHT: + if (GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT)) count++; break; } @@ -4088,21 +4087,21 @@ u16 GetNationalPokedexCount(u8 a) return count; } -u16 GetHoennPokedexCount(u8 a) +u16 GetHoennPokedexCount(u8 caseID) { u16 count = 0; u16 i; for (i = 0; i < 202; i++) { - switch (a) + switch (caseID) { - case 0: - if (GetNationalPokedexFlag(HoennToNationalOrder(i + 1), 0) != 0) + case FLAG_GET_SEEN: + if (GetSetPokedexFlag(HoennToNationalOrder(i + 1), FLAG_GET_SEEN)) count++; break; - case 1: - if (GetNationalPokedexFlag(HoennToNationalOrder(i + 1), 1) != 0) + case FLAG_GET_CAUGHT: + if (GetSetPokedexFlag(HoennToNationalOrder(i + 1), FLAG_GET_CAUGHT)) count++; break; } @@ -4116,7 +4115,7 @@ bool8 sub_8090FC0(void) for (i = 0; i < 200; i++) { - if (GetNationalPokedexFlag(HoennToNationalOrder(i + 1), 1) == 0) + if (!GetSetPokedexFlag(HoennToNationalOrder(i + 1), FLAG_GET_CAUGHT)) return FALSE; } return TRUE; @@ -4128,17 +4127,17 @@ u16 sub_8090FF4(void) for (i = 0; i < 150; i++) { - if (GetNationalPokedexFlag(i + 1, 1) == 0) + if (GetSetPokedexFlag(i + 1, 1) == 0) return 0; } for (i = 152; i < 250; i++) { - if (GetNationalPokedexFlag(i + 1, 1) == 0) + if (GetSetPokedexFlag(i + 1, 1) == 0) return 0; } for (i = 252; i < 384; i++) { - if (GetNationalPokedexFlag(i + 1, 1) == 0) + if (GetSetPokedexFlag(i + 1, 1) == 0) return 0; } return 1; diff --git a/src/pokemon/pokemon_3.c b/src/pokemon/pokemon_3.c index e51d3187b..1eff9b83c 100644 --- a/src/pokemon/pokemon_3.c +++ b/src/pokemon/pokemon_3.c @@ -278,7 +278,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem) else holdEffect = ItemId_GetHoldEffect(heldItem); - if (holdEffect == 38 && type != 3) + if (holdEffect == HOLD_EFFECT_PREVENT_EVOLVE && type != 3) return 0; switch (type) @@ -1096,7 +1096,7 @@ void ClearBattleMonForms(void) gBattleMonForms[i] = 0; } -u16 sub_8040728(void) +u16 GetBGM_ForBattle(void) { if (gBattleTypeFlags & BATTLE_TYPE_KYOGRE_GROUDON) return BGM_BATTLE34; @@ -1137,7 +1137,7 @@ void sub_80408BC(void) { ResetMapMusic(); m4aMPlayAllStop(); - PlayBGM(sub_8040728()); + PlayBGM(GetBGM_ForBattle()); } void current_map_music_set__default_for_battle(u16 song) @@ -1147,15 +1147,15 @@ void current_map_music_set__default_for_battle(u16 song) if (song) PlayNewMapMusic(song); else - PlayNewMapMusic(sub_8040728()); + PlayNewMapMusic(GetBGM_ForBattle()); } -const u8 *pokemon_get_pal(struct Pokemon *mon) +const u8 *GetMonSpritePal(struct Pokemon *mon) { u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0); u32 otId = GetMonData(mon, MON_DATA_OT_ID, 0); u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, 0); - return species_and_otid_get_pal(species, otId, personality); + return GetMonSpritePalFromOtIdPersonality(species, otId, personality); } //Extracts the upper 16 bits of a 32-bit number @@ -1164,7 +1164,7 @@ const u8 *pokemon_get_pal(struct Pokemon *mon) //Extracts the lower 16 bits of a 32-bit number #define LOHALF(n) ((n) & 0xFFFF) -const u8 *species_and_otid_get_pal(u16 species, u32 otId, u32 personality) +const u8 *GetMonSpritePalFromOtIdPersonality(u16 species, u32 otId, u32 personality) { u32 shinyValue; @@ -1178,15 +1178,15 @@ const u8 *species_and_otid_get_pal(u16 species, u32 otId, u32 personality) return gMonPaletteTable[species].data; } -const struct CompressedSpritePalette *sub_8040990(struct Pokemon *mon) +const struct CompressedSpritePalette *GetMonSpritePalStruct(struct Pokemon *mon) { u16 species = GetMonData(mon, MON_DATA_SPECIES2, 0); u32 otId = GetMonData(mon, MON_DATA_OT_ID, 0); u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, 0); - return sub_80409C8(species, otId, personality); + return GetMonSpritePalStructFromOtIdPersonality(species, otId, personality); } -const struct CompressedSpritePalette *sub_80409C8(u16 species, u32 otId , u32 personality) +const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u16 species, u32 otId , u32 personality) { u32 shinyValue; @@ -1208,9 +1208,9 @@ bool32 IsHMMove2(u16 move) return FALSE; } -bool8 sub_8040A3C(u16 species) +bool8 IsPokeSpriteNotFlipped(u16 species) { - return gBaseStats[species].unk19_7; + return gBaseStats[species].noFlip; } s8 sub_8040A54(struct Pokemon *mon, u8 a2) |