mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
Document various things relating to the Pokedex.
This commit is contained in:
parent
58ca87accc
commit
bc11a4a9f4
16
asm/trade.s
16
asm/trade.s
@ -3590,7 +3590,7 @@ _08079138:
|
||||
cmp r0, 0
|
||||
bne _08079158
|
||||
adds r0, r4, 0
|
||||
bl sub_806E3F8
|
||||
bl IsSpeciesInHoennDex
|
||||
cmp r0, 0
|
||||
bne _08079164
|
||||
_08079158:
|
||||
@ -6160,7 +6160,7 @@ _0807A62E:
|
||||
_0807A64C:
|
||||
lsls r0, r1, 16
|
||||
lsrs r0, 16
|
||||
bl sub_806E3F8
|
||||
bl IsSpeciesInHoennDex
|
||||
cmp r0, 0
|
||||
bne _0807A65C
|
||||
movs r0, 0x2
|
||||
@ -6200,7 +6200,7 @@ _0807A65C:
|
||||
_0807A6A0:
|
||||
lsls r0, r1, 16
|
||||
lsrs r0, 16
|
||||
bl sub_806E3F8
|
||||
bl IsSpeciesInHoennDex
|
||||
cmp r0, 0
|
||||
beq _0807A6D2
|
||||
_0807A6AC:
|
||||
@ -6471,7 +6471,7 @@ _0807A87C:
|
||||
b _0807A8C0
|
||||
_0807A88E:
|
||||
adds r0, r7, 0
|
||||
bl sub_806E3F8
|
||||
bl IsSpeciesInHoennDex
|
||||
cmp r0, 0
|
||||
bne _0807A89C
|
||||
_0807A898:
|
||||
@ -6479,7 +6479,7 @@ _0807A898:
|
||||
b _0807A8C0
|
||||
_0807A89C:
|
||||
mov r0, r8
|
||||
bl sub_806E3F8
|
||||
bl IsSpeciesInHoennDex
|
||||
cmp r0, 0
|
||||
bne _0807A8AA
|
||||
movs r0, 0x5
|
||||
@ -6489,7 +6489,7 @@ _0807A8AA:
|
||||
cmp r0, 0
|
||||
bne _0807A8BE
|
||||
adds r0, r7, 0
|
||||
bl sub_806E3F8
|
||||
bl IsSpeciesInHoennDex
|
||||
cmp r0, 0
|
||||
bne _0807A8BE
|
||||
movs r0, 0x7
|
||||
@ -6533,7 +6533,7 @@ sub_807A8D0: @ 807A8D0
|
||||
b _0807A910
|
||||
_0807A900:
|
||||
adds r0, r6, 0
|
||||
bl sub_806E3F8
|
||||
bl IsSpeciesInHoennDex
|
||||
cmp r0, 0
|
||||
bne _0807A90E
|
||||
_0807A90A:
|
||||
@ -6645,7 +6645,7 @@ _0807A9B4:
|
||||
mov r1, sp
|
||||
adds r4, r1, r0
|
||||
ldrh r0, [r4]
|
||||
bl sub_806E3F8
|
||||
bl IsSpeciesInHoennDex
|
||||
cmp r0, 0
|
||||
bne _0807A9E0
|
||||
movs r0, 0x2
|
||||
|
@ -230,7 +230,7 @@ struct Time
|
||||
struct Pokedex
|
||||
{
|
||||
/*0x00*/ u8 order;
|
||||
/*0x01*/ u8 unknown1;
|
||||
/*0x01*/ u8 mode;
|
||||
/*0x02*/ u8 nationalMagic; // must equal 0xDA in order to have National mode
|
||||
/*0x03*/ u8 unknown2;
|
||||
/*0x04*/ u32 unownPersonality; // set when you first see Unown
|
||||
|
@ -4,6 +4,15 @@
|
||||
extern u8 gUnknown_030060B0;
|
||||
extern void (*gUnknown_030060B4)(void);
|
||||
|
||||
#define HOENN_DEX_COUNT 202
|
||||
#define NATIONAL_DEX_COUNT 386
|
||||
|
||||
enum
|
||||
{
|
||||
DEX_MODE_HOENN,
|
||||
DEX_MODE_NATIONAL
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
FLAG_GET_SEEN,
|
||||
@ -31,6 +40,6 @@ u16 GetNationalPokedexCount(u8);
|
||||
u16 GetHoennPokedexCount(u8);
|
||||
u8 CreateDexDisplayMonDataTask(u16 dexNum, u32 trainerId, u32 personality);
|
||||
s8 GetSetPokedexFlag(u16 nationalNum, u8 caseId);
|
||||
u16 sub_80C0E9C(u16, s16, s16, u16);
|
||||
u16 CreateMonSpriteFromNationalDexNumber(u16, s16, s16, u16);
|
||||
|
||||
#endif // GUARD_POKEDEX_H
|
||||
|
@ -566,7 +566,7 @@ u8 GetMoveRelearnerMoves(struct Pokemon *mon, u16 *moves);
|
||||
u8 GetLevelUpMovesBySpecies(u16 species, u16 *moves);
|
||||
u8 GetNumberOfRelearnableMoves(struct Pokemon *mon);
|
||||
u16 SpeciesToPokedexNum(u16 species);
|
||||
bool32 sub_806E3F8(u16 species);
|
||||
bool32 IsSpeciesInHoennDex(u16 species);
|
||||
void ClearBattleMonForms(void);
|
||||
u16 GetBattleBGM(void);
|
||||
void PlayBattleBGM(void);
|
||||
|
@ -66,19 +66,19 @@ const u8 *GetPokedexRatingText(u16 count)
|
||||
return gBirchDexRatingText_LessThan200;
|
||||
if (count == 200)
|
||||
{
|
||||
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1)
|
||||
|| GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) // Jirachi or Deoxys is not counted towards the dex completion. If either of these flags are enabled, it means the actual count is less than 200.
|
||||
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), FLAG_GET_CAUGHT)
|
||||
|| GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), FLAG_GET_CAUGHT)) // Jirachi or Deoxys is not counted towards the dex completion. If either of these flags are enabled, it means the actual count is less than 200.
|
||||
return gBirchDexRatingText_LessThan200;
|
||||
return gBirchDexRatingText_DexCompleted;
|
||||
}
|
||||
if (count == 201)
|
||||
if (count == HOENN_DEX_COUNT - 1)
|
||||
{
|
||||
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), 1)
|
||||
&& GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), 1)) // If both of these flags are enabled, it means the actual count is less than 200.
|
||||
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_JIRACHI), FLAG_GET_CAUGHT)
|
||||
&& GetSetPokedexFlag(SpeciesToNationalPokedexNum(SPECIES_DEOXYS), FLAG_GET_CAUGHT)) // If both of these flags are enabled, it means the actual count is less than 200.
|
||||
return gBirchDexRatingText_LessThan200;
|
||||
return gBirchDexRatingText_DexCompleted;
|
||||
}
|
||||
if (count == 202)
|
||||
if (count == HOENN_DEX_COUNT)
|
||||
return gBirchDexRatingText_DexCompleted; // Hoenn dex is considered complete, even though the hoenn dex count is 210.
|
||||
return gBirchDexRatingText_LessThan10;
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ struct Unk201C000
|
||||
u16 unk90;
|
||||
u16 unk92;
|
||||
u16 unk94;
|
||||
u16 unk96[386];
|
||||
u16 unk96[NATIONAL_DEX_COUNT];
|
||||
u16 unk39A;
|
||||
u16 unk39C[7];
|
||||
};
|
||||
@ -2259,7 +2259,7 @@ static u8 sub_8177224(u16 species, s16 x, s16 y, u16 position)
|
||||
u8 spriteId;
|
||||
u8 spriteId2;
|
||||
|
||||
spriteId = sub_80C0E9C(species, x, y, position);
|
||||
spriteId = CreateMonSpriteFromNationalDexNumber(species, x, y, position);
|
||||
gSprites[spriteId].oam.priority = 1;
|
||||
gSprites[spriteId].data[1] = position + 1;
|
||||
gSprites[spriteId].invisible = TRUE;
|
||||
@ -2297,16 +2297,16 @@ static void sub_8177388(void)
|
||||
u16 dexNum;
|
||||
u16 j;
|
||||
|
||||
for (dexNum = 1, j = 0; dexNum < 386; dexNum++)
|
||||
for (dexNum = 1, j = 0; dexNum < NATIONAL_DEX_COUNT; dexNum++)
|
||||
{
|
||||
if (GetSetPokedexFlag(dexNum, 1))
|
||||
if (GetSetPokedexFlag(dexNum, FLAG_GET_CAUGHT))
|
||||
{
|
||||
gUnknown_0203BCE8->unk96[j] = dexNum;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
|
||||
for (dexNum = j; dexNum < 386; dexNum++)
|
||||
for (dexNum = j; dexNum < NATIONAL_DEX_COUNT; dexNum++)
|
||||
gUnknown_0203BCE8->unk96[dexNum] = 0;
|
||||
|
||||
gUnknown_0203BCE8->unk39A = j;
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "event_data.h"
|
||||
#include "pokedex.h"
|
||||
|
||||
#define TEMP_FLAGS_SIZE 0x4
|
||||
#define TEMP_UPPER_FLAGS_SIZE 0x8
|
||||
@ -67,7 +68,7 @@ void EnableNationalPokedex(void)
|
||||
gSaveBlock2Ptr->pokedex.nationalMagic = 0xDA;
|
||||
*nationalDexVar = 0x302;
|
||||
FlagSet(FLAG_SYS_NATIONAL_DEX);
|
||||
gSaveBlock2Ptr->pokedex.unknown1 = 1;
|
||||
gSaveBlock2Ptr->pokedex.mode = DEX_MODE_NATIONAL;
|
||||
gSaveBlock2Ptr->pokedex.order = 0;
|
||||
sub_80BB358();
|
||||
}
|
||||
|
164
src/pokedex.c
164
src/pokedex.c
@ -75,9 +75,6 @@ struct UnknownStruct4
|
||||
u8 unk9;
|
||||
};
|
||||
|
||||
#define HOENN_DEX_COUNT 202
|
||||
#define NATIONAL_DEX_COUNT 386
|
||||
|
||||
extern struct MusicPlayerInfo gMPlayInfo_BGM;
|
||||
|
||||
struct PokedexListItem
|
||||
@ -130,12 +127,6 @@ struct PokedexView
|
||||
u8 unk65C[8];
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
DEX_MODE_HOENN,
|
||||
DEX_MODE_NATIONAL
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
AREA_SCREEN,
|
||||
@ -176,7 +167,7 @@ u16 sub_80BD69C(u16, u16);
|
||||
void sub_80BD8D0(void);
|
||||
bool8 sub_80BD930(void);
|
||||
u8 sub_80BDA40(void);
|
||||
u16 sub_80BDA8C(u16);
|
||||
u16 GetPokemonSpriteToDisplay(u16);
|
||||
u32 sub_80BDACC(u16, s16, s16);
|
||||
static void CreateInterfaceSprites(u8);
|
||||
void sub_80BE470(struct Sprite *sprite);
|
||||
@ -1237,7 +1228,7 @@ void ResetPokedex(void)
|
||||
gUnknown_02039B50 = 0;
|
||||
gUnknown_02039B52 = 64;
|
||||
gUnknown_030060B0 = 0;
|
||||
gSaveBlock2Ptr->pokedex.unknown1 = 0;
|
||||
gSaveBlock2Ptr->pokedex.mode = DEX_MODE_HOENN;
|
||||
gSaveBlock2Ptr->pokedex.order = 0;
|
||||
gSaveBlock2Ptr->pokedex.nationalMagic = 0;
|
||||
gSaveBlock2Ptr->pokedex.unknown2 = 0;
|
||||
@ -1289,7 +1280,7 @@ static void ResetPokedexView(struct PokedexView *pokedexView)
|
||||
pokedexView->unk618 = 0;
|
||||
pokedexView->seenCount = 0;
|
||||
pokedexView->ownCount = 0;
|
||||
for (i = 0; i <= 3; i++)
|
||||
for (i = 0; i < 4; i++)
|
||||
pokedexView->unk61E[i] |= 0xFFFF;
|
||||
pokedexView->unk628 = 0;
|
||||
pokedexView->unk62A = 0;
|
||||
@ -1348,7 +1339,7 @@ void CB2_Pokedex(void)
|
||||
sPokedexView = AllocZeroed(sizeof(struct PokedexView));
|
||||
ResetPokedexView(sPokedexView);
|
||||
CreateTask(sub_80BB78C, 0);
|
||||
sPokedexView->dexMode = gSaveBlock2Ptr->pokedex.unknown1;
|
||||
sPokedexView->dexMode = gSaveBlock2Ptr->pokedex.mode;
|
||||
if (!IsNationalPokedexEnabled())
|
||||
sPokedexView->dexMode = DEX_MODE_HOENN;
|
||||
sPokedexView->dexOrder = gSaveBlock2Ptr->pokedex.order;
|
||||
@ -1571,9 +1562,9 @@ void sub_80BBDE8(u8 taskId)
|
||||
{
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
gSaveBlock2Ptr->pokedex.unknown1 = sPokedexView->dexMode;
|
||||
gSaveBlock2Ptr->pokedex.mode = sPokedexView->dexMode;
|
||||
if (!IsNationalPokedexEnabled())
|
||||
gSaveBlock2Ptr->pokedex.unknown1 = DEX_MODE_HOENN;
|
||||
gSaveBlock2Ptr->pokedex.mode = DEX_MODE_HOENN;
|
||||
gSaveBlock2Ptr->pokedex.order = sPokedexView->dexOrder;
|
||||
sub_80BDA40();
|
||||
sub_80BC890();
|
||||
@ -1898,6 +1889,9 @@ void sub_80BC890(void)
|
||||
void sub_80BC8D4(u8 dexMode, u8 sortMode)
|
||||
{
|
||||
u16 vars[3]; //I have no idea why three regular variables are stored in an array, but whatever.
|
||||
#define temp_dexCount vars[0]
|
||||
#define temp_notNationalDex vars[1]
|
||||
#define temp_dexNum vars[2]
|
||||
s16 i;
|
||||
|
||||
sPokedexView->pokemonListCount = 0;
|
||||
@ -1906,19 +1900,19 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode)
|
||||
{
|
||||
default:
|
||||
case DEX_MODE_HOENN:
|
||||
vars[0] = HOENN_DEX_COUNT;
|
||||
vars[1] = 1;
|
||||
temp_dexCount = HOENN_DEX_COUNT;
|
||||
temp_notNationalDex = TRUE;
|
||||
break;
|
||||
case DEX_MODE_NATIONAL:
|
||||
if (IsNationalPokedexEnabled())
|
||||
{
|
||||
vars[0] = NATIONAL_DEX_COUNT;
|
||||
vars[1] = 0;
|
||||
temp_dexCount = NATIONAL_DEX_COUNT;
|
||||
temp_notNationalDex = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
vars[0] = HOENN_DEX_COUNT;
|
||||
vars[1] = 1;
|
||||
temp_dexCount = HOENN_DEX_COUNT;
|
||||
temp_notNationalDex = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1926,14 +1920,14 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode)
|
||||
switch (sortMode)
|
||||
{
|
||||
case 0:
|
||||
if (vars[1])
|
||||
if (temp_notNationalDex)
|
||||
{
|
||||
for (i = 0; i < vars[0]; i++)
|
||||
for (i = 0; i < temp_dexCount; i++)
|
||||
{
|
||||
vars[2] = HoennToNationalOrder(i + 1);
|
||||
sPokedexView->pokedexList[i].dexNum = vars[2];
|
||||
sPokedexView->pokedexList[i].seen = GetSetPokedexFlag(vars[2], 0);
|
||||
sPokedexView->pokedexList[i].owned = GetSetPokedexFlag(vars[2], 1);
|
||||
temp_dexNum = HoennToNationalOrder(i + 1);
|
||||
sPokedexView->pokedexList[i].dexNum = temp_dexNum;
|
||||
sPokedexView->pokedexList[i].seen = GetSetPokedexFlag(temp_dexNum, FLAG_GET_SEEN);
|
||||
sPokedexView->pokedexList[i].owned = GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT);
|
||||
if (sPokedexView->pokedexList[i].seen)
|
||||
sPokedexView->pokemonListCount = i + 1;
|
||||
}
|
||||
@ -1944,17 +1938,17 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode)
|
||||
s16 r5;
|
||||
|
||||
r10 = r5 = i = 0;
|
||||
for (i = 0; i < vars[0]; i++)
|
||||
for (i = 0; i < temp_dexCount; i++)
|
||||
{
|
||||
vars[2] = i + 1;
|
||||
if (GetSetPokedexFlag(vars[2], 0))
|
||||
temp_dexNum = i + 1;
|
||||
if (GetSetPokedexFlag(temp_dexNum, FLAG_GET_SEEN))
|
||||
r10 = 1;
|
||||
if (r10)
|
||||
{
|
||||
asm(""); //Needed to match for some reason
|
||||
sPokedexView->pokedexList[r5].dexNum = vars[2];
|
||||
sPokedexView->pokedexList[r5].seen = GetSetPokedexFlag(vars[2], 0);
|
||||
sPokedexView->pokedexList[r5].owned = GetSetPokedexFlag(vars[2], 1);
|
||||
sPokedexView->pokedexList[r5].dexNum = temp_dexNum;
|
||||
sPokedexView->pokedexList[r5].seen = GetSetPokedexFlag(temp_dexNum, FLAG_GET_SEEN);
|
||||
sPokedexView->pokedexList[r5].owned = GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT);
|
||||
if (sPokedexView->pokedexList[r5].seen)
|
||||
sPokedexView->pokemonListCount = r5 + 1;
|
||||
r5++;
|
||||
@ -1965,13 +1959,13 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode)
|
||||
case 1:
|
||||
for (i = 0; i < POKEMON_SLOTS_NUMBER - 1; i++)
|
||||
{
|
||||
vars[2] = gPokedexOrder_Alphabetical[i];
|
||||
temp_dexNum = gPokedexOrder_Alphabetical[i];
|
||||
|
||||
if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 0))
|
||||
if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_SEEN))
|
||||
{
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = vars[2];
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = 1;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = GetSetPokedexFlag(vars[2], 1);
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT);
|
||||
sPokedexView->pokemonListCount++;
|
||||
}
|
||||
}
|
||||
@ -1979,13 +1973,13 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode)
|
||||
case 2:
|
||||
for (i = NATIONAL_DEX_COUNT - 1; i >= 0; i--)
|
||||
{
|
||||
vars[2] = gPokedexOrder_Weight[i];
|
||||
temp_dexNum = gPokedexOrder_Weight[i];
|
||||
|
||||
if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 1))
|
||||
if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT))
|
||||
{
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = vars[2];
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = 1;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = 1;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = TRUE;
|
||||
sPokedexView->pokemonListCount++;
|
||||
}
|
||||
}
|
||||
@ -1993,27 +1987,27 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode)
|
||||
case 3:
|
||||
for (i = 0; i < NATIONAL_DEX_COUNT; i++)
|
||||
{
|
||||
vars[2] = gPokedexOrder_Weight[i];
|
||||
temp_dexNum = gPokedexOrder_Weight[i];
|
||||
|
||||
if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 1))
|
||||
if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT))
|
||||
{
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = vars[2];
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = 1;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = 1;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = TRUE;
|
||||
sPokedexView->pokemonListCount++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
for (i = NATIONAL_DEX_COUNT - 1; i >=0; i--)
|
||||
for (i = NATIONAL_DEX_COUNT - 1; i >= 0; i--)
|
||||
{
|
||||
vars[2] = gPokedexOrder_Height[i];
|
||||
temp_dexNum = gPokedexOrder_Height[i];
|
||||
|
||||
if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 1))
|
||||
if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT))
|
||||
{
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = vars[2];
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = 1;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = 1;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = TRUE;
|
||||
sPokedexView->pokemonListCount++;
|
||||
}
|
||||
}
|
||||
@ -2021,13 +2015,13 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode)
|
||||
case 5:
|
||||
for (i = 0; i < NATIONAL_DEX_COUNT; i++)
|
||||
{
|
||||
vars[2] = gPokedexOrder_Height[i];
|
||||
temp_dexNum = gPokedexOrder_Height[i];
|
||||
|
||||
if (NationalToHoennOrder(vars[2]) <= vars[0] && GetSetPokedexFlag(vars[2], 1))
|
||||
if (NationalToHoennOrder(temp_dexNum) <= temp_dexCount && GetSetPokedexFlag(temp_dexNum, FLAG_GET_CAUGHT))
|
||||
{
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = vars[2];
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = 1;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = 1;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].dexNum = temp_dexNum;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].seen = TRUE;
|
||||
sPokedexView->pokedexList[sPokedexView->pokemonListCount].owned = TRUE;
|
||||
sPokedexView->pokemonListCount++;
|
||||
}
|
||||
}
|
||||
@ -2037,8 +2031,8 @@ void sub_80BC8D4(u8 dexMode, u8 sortMode)
|
||||
for (i = sPokedexView->pokemonListCount; i < NATIONAL_DEX_COUNT; i++)
|
||||
{
|
||||
sPokedexView->pokedexList[i].dexNum |= 0xFFFF;
|
||||
sPokedexView->pokedexList[i].seen = 0;
|
||||
sPokedexView->pokedexList[i].owned = 0;
|
||||
sPokedexView->pokedexList[i].seen = FALSE;
|
||||
sPokedexView->pokedexList[i].owned = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2192,7 +2186,7 @@ static void CreateInitialPokemonSprites(u16 selectedMon, u16 b)
|
||||
sPokedexView->unk61E[i] = 0xFFFF;
|
||||
sPokedexView->selectedMonSpriteId = 0xFFFF;
|
||||
|
||||
unk = sub_80BDA8C(selectedMon - 1);
|
||||
unk = GetPokemonSpriteToDisplay(selectedMon - 1);
|
||||
if (unk != 0xFFFF)
|
||||
{
|
||||
spriteId = sub_80BDACC(unk, 0x60, 0x50);
|
||||
@ -2200,7 +2194,7 @@ static void CreateInitialPokemonSprites(u16 selectedMon, u16 b)
|
||||
gSprites[spriteId].data[5] = -32;
|
||||
}
|
||||
|
||||
unk = sub_80BDA8C(selectedMon);
|
||||
unk = GetPokemonSpriteToDisplay(selectedMon);
|
||||
if (unk != 0xFFFF)
|
||||
{
|
||||
spriteId = sub_80BDACC(unk, 0x60, 0x50);
|
||||
@ -2208,7 +2202,7 @@ static void CreateInitialPokemonSprites(u16 selectedMon, u16 b)
|
||||
gSprites[spriteId].data[5] = 0;
|
||||
}
|
||||
|
||||
unk = sub_80BDA8C(selectedMon + 1);
|
||||
unk = GetPokemonSpriteToDisplay(selectedMon + 1);
|
||||
if (unk != 0xFFFF)
|
||||
{
|
||||
spriteId = sub_80BDACC(unk, 0x60, 0x50);
|
||||
@ -2274,7 +2268,7 @@ static void CreateNewPokemonSprite(u8 direction, u16 selectedMon)
|
||||
switch (direction)
|
||||
{
|
||||
case 1: // up
|
||||
unk = sub_80BDA8C(selectedMon - 1);
|
||||
unk = GetPokemonSpriteToDisplay(selectedMon - 1);
|
||||
if (unk != 0xFFFF)
|
||||
{
|
||||
spriteId = sub_80BDACC(unk, 0x60, 0x50);
|
||||
@ -2287,7 +2281,7 @@ static void CreateNewPokemonSprite(u8 direction, u16 selectedMon)
|
||||
sPokedexView->unk630 = 15;
|
||||
break;
|
||||
case 2: // down
|
||||
unk = sub_80BDA8C(selectedMon + 1);
|
||||
unk = GetPokemonSpriteToDisplay(selectedMon + 1);
|
||||
if (unk != 0xFFFF)
|
||||
{
|
||||
spriteId = sub_80BDACC(unk, 0x60, 0x50);
|
||||
@ -2449,12 +2443,12 @@ u8 sub_80BDA40(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
u16 sub_80BDA8C(u16 a1)
|
||||
u16 GetPokemonSpriteToDisplay(u16 species)
|
||||
{
|
||||
if (a1 >= NATIONAL_DEX_COUNT || sPokedexView->pokedexList[a1].dexNum == 0xFFFF)
|
||||
if (species >= NATIONAL_DEX_COUNT || sPokedexView->pokedexList[species].dexNum == 0xFFFF)
|
||||
return 0xFFFF;
|
||||
else if (sPokedexView->pokedexList[a1].seen)
|
||||
return sPokedexView->pokedexList[a1].dexNum;
|
||||
else if (sPokedexView->pokedexList[species].seen)
|
||||
return sPokedexView->pokedexList[species].dexNum;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@ -2467,7 +2461,7 @@ u32 sub_80BDACC(u16 num, s16 x, s16 y)
|
||||
{
|
||||
if (sPokedexView->unk61E[i] == 0xFFFF)
|
||||
{
|
||||
u8 spriteId = sub_80C0E9C(num, x, y, i);
|
||||
u8 spriteId = CreateMonSpriteFromNationalDexNumber(num, x, y, i);
|
||||
|
||||
gSprites[spriteId].oam.affineMode = 1;
|
||||
gSprites[spriteId].oam.priority = 3;
|
||||
@ -2963,7 +2957,7 @@ void sub_80BEA24(u8 taskId)
|
||||
case 5:
|
||||
if (gTasks[taskId].data[1] == 0)
|
||||
{
|
||||
gTasks[taskId].data[4] = (u16)sub_80C0E9C(sPokedexListItem->dexNum, 0x30, 0x38, 0);
|
||||
gTasks[taskId].data[4] = (u16)CreateMonSpriteFromNationalDexNumber(sPokedexListItem->dexNum, 0x30, 0x38, 0);
|
||||
gSprites[gTasks[taskId].data[4]].oam.priority = 0;
|
||||
}
|
||||
gMain.state++;
|
||||
@ -3251,7 +3245,7 @@ void sub_80BF250(u8 taskId)
|
||||
gMain.state++;
|
||||
break;
|
||||
case 5:
|
||||
gTasks[taskId].data[4] = sub_80C0E9C(sPokedexListItem->dexNum, 48, 56, 0);
|
||||
gTasks[taskId].data[4] = CreateMonSpriteFromNationalDexNumber(sPokedexListItem->dexNum, 48, 56, 0);
|
||||
gSprites[gTasks[taskId].data[4]].oam.priority = 0;
|
||||
gDexCryScreenState = 0;
|
||||
gMain.state++;
|
||||
@ -3459,7 +3453,7 @@ void sub_80BF82C(u8 taskId)
|
||||
gMain.state++;
|
||||
break;
|
||||
case 6:
|
||||
spriteId = sub_80C0E9C(sPokedexListItem->dexNum, 88, 56, 1);
|
||||
spriteId = CreateMonSpriteFromNationalDexNumber(sPokedexListItem->dexNum, 88, 56, 1);
|
||||
gSprites[spriteId].oam.affineMode = 1;
|
||||
gSprites[spriteId].oam.matrixNum = 2;
|
||||
gSprites[spriteId].oam.priority = 0;
|
||||
@ -3790,7 +3784,7 @@ void sub_80BFE38(u8 taskId)
|
||||
gTasks[taskId].data[0]++;
|
||||
break;
|
||||
case 4:
|
||||
spriteId = sub_80C0E9C(dexNum, 0x30, 0x38, 0);
|
||||
spriteId = CreateMonSpriteFromNationalDexNumber(dexNum, 0x30, 0x38, 0);
|
||||
gSprites[spriteId].oam.priority = 0;
|
||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0x10, 0, RGB_BLACK);
|
||||
SetVBlankCallback(gUnknown_030060B4);
|
||||
@ -4348,7 +4342,7 @@ u16 GetHoennPokedexCount(u8 caseID)
|
||||
u16 count = 0;
|
||||
u16 i;
|
||||
|
||||
for (i = 0; i < 202; i++)
|
||||
for (i = 0; i < HOENN_DEX_COUNT; i++)
|
||||
{
|
||||
switch (caseID)
|
||||
{
|
||||
@ -4417,17 +4411,17 @@ u16 sub_80C0944(void)
|
||||
|
||||
for (i = 0; i < 150; i++)
|
||||
{
|
||||
if (GetSetPokedexFlag(i + 1, 1) == 0)
|
||||
if (GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT) == FALSE)
|
||||
return 0;
|
||||
}
|
||||
for (i = 151; i < 248; i++)
|
||||
{
|
||||
if (GetSetPokedexFlag(i + 1, 1) == 0)
|
||||
if (GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT) == FALSE)
|
||||
return 0;
|
||||
}
|
||||
for (i = 251; i < 384; i++)
|
||||
{
|
||||
if (GetSetPokedexFlag(i + 1, 1) == 0)
|
||||
if (GetSetPokedexFlag(i + 1, FLAG_GET_CAUGHT) == FALSE)
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
@ -4643,10 +4637,10 @@ u32 sub_80C0E68(u16 a)
|
||||
}
|
||||
}
|
||||
|
||||
u16 sub_80C0E9C(u16 num, s16 x, s16 y, u16 paletteSlot)
|
||||
u16 CreateMonSpriteFromNationalDexNumber(u16 nationalNum, s16 x, s16 y, u16 paletteSlot)
|
||||
{
|
||||
num = NationalPokedexNumToSpecies(num);
|
||||
return CreateMonPicSprite_HandleDeoxys(num, 8, sub_80C0E68(num), TRUE, x, y, paletteSlot, 0xFFFF);
|
||||
nationalNum = NationalPokedexNumToSpecies(nationalNum);
|
||||
return CreateMonPicSprite_HandleDeoxys(nationalNum, 8, sub_80C0E68(nationalNum), TRUE, x, y, paletteSlot, 0xFFFF);
|
||||
}
|
||||
|
||||
u16 sub_80C0EF8(u16 species, s16 x, s16 y, s8 paletteSlot)
|
||||
@ -4980,10 +4974,10 @@ void sub_80C170C(u8 taskId)
|
||||
sPokedexView->unk62A = 0x40;
|
||||
gUnknown_02039B50 = 0;
|
||||
sPokedexView->unk610 = 0;
|
||||
gSaveBlock2Ptr->pokedex.unknown1 = sub_80C2318(taskId, 5);
|
||||
gSaveBlock2Ptr->pokedex.mode = sub_80C2318(taskId, 5);
|
||||
if (!IsNationalPokedexEnabled())
|
||||
gSaveBlock2Ptr->pokedex.unknown1 = 0;
|
||||
sPokedexView->unk614 = gSaveBlock2Ptr->pokedex.unknown1;
|
||||
gSaveBlock2Ptr->pokedex.mode = DEX_MODE_HOENN;
|
||||
sPokedexView->unk614 = gSaveBlock2Ptr->pokedex.mode;
|
||||
gSaveBlock2Ptr->pokedex.order = sub_80C2318(taskId, 4);
|
||||
sPokedexView->unk618 = gSaveBlock2Ptr->pokedex.order;
|
||||
PlaySE(SE_PC_OFF);
|
||||
|
@ -5864,10 +5864,10 @@ u16 HoennPokedexNumToSpecies(u16 hoennNum)
|
||||
|
||||
species = 0;
|
||||
|
||||
while (species < 411 && gSpeciesToHoennPokedexNum[species] != hoennNum)
|
||||
while (species < (NUM_SPECIES - 1) && gSpeciesToHoennPokedexNum[species] != hoennNum)
|
||||
species++;
|
||||
|
||||
if (species == 411)
|
||||
if (species == NUM_SPECIES - 1)
|
||||
return 0;
|
||||
|
||||
return species + 1;
|
||||
@ -5882,10 +5882,10 @@ u16 NationalPokedexNumToSpecies(u16 nationalNum)
|
||||
|
||||
species = 0;
|
||||
|
||||
while (species < 411 && gSpeciesToNationalPokedexNum[species] != nationalNum)
|
||||
while (species < (NUM_SPECIES - 1) && gSpeciesToNationalPokedexNum[species] != nationalNum)
|
||||
species++;
|
||||
|
||||
if (species == 411)
|
||||
if (species == NUM_SPECIES - 1)
|
||||
return 0;
|
||||
|
||||
return species + 1;
|
||||
@ -5900,10 +5900,10 @@ u16 NationalToHoennOrder(u16 nationalNum)
|
||||
|
||||
hoennNum = 0;
|
||||
|
||||
while (hoennNum < 411 && gHoennToNationalOrder[hoennNum] != nationalNum)
|
||||
while (hoennNum < (NUM_SPECIES - 1) && gHoennToNationalOrder[hoennNum] != nationalNum)
|
||||
hoennNum++;
|
||||
|
||||
if (hoennNum == 411)
|
||||
if (hoennNum == NUM_SPECIES - 1)
|
||||
return 0;
|
||||
|
||||
return hoennNum + 1;
|
||||
@ -6584,15 +6584,15 @@ u16 SpeciesToPokedexNum(u16 species)
|
||||
else
|
||||
{
|
||||
species = SpeciesToHoennPokedexNum(species);
|
||||
if (species <= 202)
|
||||
if (species <= HOENN_DEX_COUNT)
|
||||
return species;
|
||||
return 0xFFFF;
|
||||
}
|
||||
}
|
||||
|
||||
bool32 sub_806E3F8(u16 species)
|
||||
bool32 IsSpeciesInHoennDex(u16 species)
|
||||
{
|
||||
if (SpeciesToHoennPokedexNum(species) > 202)
|
||||
if (SpeciesToHoennPokedexNum(species) > HOENN_DEX_COUNT)
|
||||
return FALSE;
|
||||
else
|
||||
return TRUE;
|
||||
|
@ -563,8 +563,8 @@ u8 ScriptGiveMon(u16 species, u8 level, u16 item, u32 unused1, u32 unused2, u8 u
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
GetSetPokedexFlag(nationalDexNum, 2);
|
||||
GetSetPokedexFlag(nationalDexNum, 3);
|
||||
GetSetPokedexFlag(nationalDexNum, FLAG_SET_SEEN);
|
||||
GetSetPokedexFlag(nationalDexNum, FLAG_SET_CAUGHT);
|
||||
break;
|
||||
}
|
||||
return sentToPc;
|
||||
|
4
src/tv.c
4
src/tv.c
@ -3229,7 +3229,7 @@ u16 TV_GetSomeOtherSpeciesAlreadySeenByPlayer(u16 passedSpecies)
|
||||
|
||||
species = (Random() % (NUM_SPECIES - 1)) + 1;
|
||||
initSpecies = species;
|
||||
while (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), 0) != 1 || species == passedSpecies)
|
||||
while (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_SEEN) != TRUE || species == passedSpecies)
|
||||
{
|
||||
if (species == 1)
|
||||
{
|
||||
@ -4376,7 +4376,7 @@ void SetTvShowInactive(u8 showIdx)
|
||||
|
||||
static void sub_80F0B24(u16 species, u8 showIdx)
|
||||
{
|
||||
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), 0) == 0)
|
||||
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_SEEN) == FALSE)
|
||||
{
|
||||
gSaveBlock1Ptr->tvShows[showIdx].common.active = FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user