Add new dex flags
This commit is contained in:
parent
dfb9a1fa16
commit
00dcc05516
3 changed files with 26 additions and 48 deletions
|
@ -57,7 +57,7 @@
|
|||
|
||||
#define PARTY_SIZE 6
|
||||
|
||||
#define POKEMON_SLOTS_NUMBER 412
|
||||
#define POKEMON_SLOTS_NUMBER 808
|
||||
|
||||
#define min(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define max(a, b) ((a) >= (b) ? (a) : (b))
|
||||
|
@ -154,8 +154,7 @@ struct Pokedex
|
|||
/*0x04*/ u32 unownPersonality; // set when you first see Unown
|
||||
/*0x08*/ u32 spindaPersonality; // set when you first see Spinda
|
||||
/*0x0C*/ u32 unknown3;
|
||||
/*0x10*/ u8 owned[DEX_FLAGS_NO];
|
||||
/*0x44*/ u8 seen[DEX_FLAGS_NO];
|
||||
/*0x10*/ u8 filler[0x68]; // Previously Dex Flags, feel free to remove.
|
||||
};
|
||||
|
||||
struct PokemonJumpResults // possibly used in the game itself?
|
||||
|
@ -909,7 +908,7 @@ struct SaveBlock1
|
|||
/*0x690*/ struct ItemSlot bagPocket_TMHM[BAG_TMHM_COUNT];
|
||||
/*0x790*/ struct ItemSlot bagPocket_Berries[BAG_BERRIES_COUNT];
|
||||
/*0x848*/ struct Pokeblock pokeblocks[POKEBLOCKS_COUNT];
|
||||
/*0x988*/ u8 seen1[DEX_FLAGS_NO];
|
||||
/*0x988*/ u8 filler1[0x34]; // Previously Dex Flags, feel free to remove.
|
||||
/*0x9BC*/ u16 berryBlenderRecords[3];
|
||||
/*0x9C2*/ u8 field_9C2[6];
|
||||
/*0x9C8*/ u16 trainerRematchStepCounter;
|
||||
|
@ -960,18 +959,17 @@ struct SaveBlock1
|
|||
/*0x31DC*/ struct Roamer roamer;
|
||||
/*0x31F8*/ struct EnigmaBerry enigmaBerry;
|
||||
/*0x322C*/ struct MEventBuffers unk_322C;
|
||||
/*0x3598*/ u8 field_3598[0x180];
|
||||
/*0x3718*/ u32 trainerHillTimes[4];
|
||||
/*0x3728*/ struct RamScript ramScript;
|
||||
/*0x3B14*/ struct RecordMixingGift recordMixingGift;
|
||||
/*0x3B24*/ u8 seen2[DEX_FLAGS_NO];
|
||||
/*0x3B58*/ LilycoveLady lilycoveLady;
|
||||
/*0x3B98*/ struct TrainerNameRecord trainerNameRecords[20];
|
||||
/*0x3C88*/ u8 unk3C88[10][21];
|
||||
/*0x3D5A*/ u8 filler3D5A[0xA];
|
||||
/*0x3D64*/ struct SaveTrainerHill trainerHill;
|
||||
/*0x3D70*/ struct WaldaPhrase waldaPhrase;
|
||||
// sizeof: 0x3D88
|
||||
/*0x3???*/ u8 dexSeen[DEX_FLAGS_NO];
|
||||
/*0x3???*/ u8 dexCaught[DEX_FLAGS_NO];
|
||||
/*0x3???*/ u32 trainerHillTimes[4];
|
||||
/*0x3???*/ struct RamScript ramScript;
|
||||
/*0x3???*/ struct RecordMixingGift recordMixingGift;
|
||||
/*0x3???*/ LilycoveLady lilycoveLady;
|
||||
/*0x3???*/ struct TrainerNameRecord trainerNameRecords[20];
|
||||
/*0x3???*/ u8 unk3C88[10][21];
|
||||
/*0x3???*/ struct SaveTrainerHill trainerHill;
|
||||
/*0x3???*/ struct WaldaPhrase waldaPhrase;
|
||||
// sizeof: 0x3???
|
||||
};
|
||||
|
||||
extern struct SaveBlock1* gSaveBlock1Ptr;
|
||||
|
|
|
@ -106,8 +106,8 @@ static void SetDefaultOptions(void)
|
|||
static void ClearPokedexFlags(void)
|
||||
{
|
||||
gUnusedPokedexU8 = 0;
|
||||
memset(&gSaveBlock2Ptr->pokedex.owned, 0, sizeof(gSaveBlock2Ptr->pokedex.owned));
|
||||
memset(&gSaveBlock2Ptr->pokedex.seen, 0, sizeof(gSaveBlock2Ptr->pokedex.seen));
|
||||
memset(&gSaveBlock1Ptr->dexCaught, 0, sizeof(gSaveBlock1Ptr->dexCaught));
|
||||
memset(&gSaveBlock1Ptr->dexSeen, 0, sizeof(gSaveBlock1Ptr->dexSeen));
|
||||
}
|
||||
|
||||
void ClearAllContestWinnerPics(void)
|
||||
|
|
|
@ -1237,10 +1237,8 @@ void ResetPokedex(void)
|
|||
DisableNationalPokedex();
|
||||
for (i = 0; i < DEX_FLAGS_NO; i++)
|
||||
{
|
||||
gSaveBlock2Ptr->pokedex.owned[i] = 0;
|
||||
gSaveBlock2Ptr->pokedex.seen[i] = 0;
|
||||
gSaveBlock1Ptr->seen1[i] = 0;
|
||||
gSaveBlock1Ptr->seen2[i] = 0;
|
||||
gSaveBlock1Ptr->dexCaught[i] = 0;
|
||||
gSaveBlock1Ptr->dexSeen[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4260,48 +4258,30 @@ u16 GetPokedexHeightWeight(u16 dexNum, u8 data)
|
|||
|
||||
s8 GetSetPokedexFlag(u16 nationalDexNo, u8 caseID)
|
||||
{
|
||||
u8 index;
|
||||
u8 bit;
|
||||
u8 mask;
|
||||
s8 retVal;
|
||||
u32 index, bit, mask;
|
||||
s8 retVal = 0;
|
||||
|
||||
nationalDexNo--;
|
||||
index = nationalDexNo / 8;
|
||||
bit = nationalDexNo % 8;
|
||||
mask = 1 << bit;
|
||||
retVal = 0;
|
||||
|
||||
switch (caseID)
|
||||
{
|
||||
case FLAG_GET_SEEN:
|
||||
if (gSaveBlock2Ptr->pokedex.seen[index] & mask)
|
||||
{
|
||||
if ((gSaveBlock2Ptr->pokedex.seen[index] & mask) == (gSaveBlock1Ptr->seen1[index] & mask)
|
||||
&& (gSaveBlock2Ptr->pokedex.seen[index] & mask) == (gSaveBlock1Ptr->seen2[index] & mask))
|
||||
retVal = 1;
|
||||
else
|
||||
retVal = 0;
|
||||
}
|
||||
retVal = ((gSaveBlock1Ptr->dexSeen[index] & mask) != 0);
|
||||
break;
|
||||
case FLAG_GET_CAUGHT:
|
||||
if (gSaveBlock2Ptr->pokedex.owned[index] & mask)
|
||||
{
|
||||
if ((gSaveBlock2Ptr->pokedex.owned[index] & mask) == (gSaveBlock2Ptr->pokedex.seen[index] & mask)
|
||||
&& (gSaveBlock2Ptr->pokedex.owned[index] & mask) == (gSaveBlock1Ptr->seen1[index] & mask)
|
||||
&& (gSaveBlock2Ptr->pokedex.owned[index] & mask) == (gSaveBlock1Ptr->seen2[index] & mask))
|
||||
retVal = 1;
|
||||
else
|
||||
retVal = 0;
|
||||
}
|
||||
retVal = ((gSaveBlock1Ptr->dexCaught[index] & mask) != 0);
|
||||
break;
|
||||
case FLAG_SET_SEEN:
|
||||
gSaveBlock2Ptr->pokedex.seen[index] |= mask;
|
||||
gSaveBlock1Ptr->seen1[index] |= mask;
|
||||
gSaveBlock1Ptr->seen2[index] |= mask;
|
||||
gSaveBlock1Ptr->dexSeen[index] |= mask;
|
||||
break;
|
||||
case FLAG_SET_CAUGHT:
|
||||
gSaveBlock2Ptr->pokedex.owned[index] |= mask;
|
||||
gSaveBlock1Ptr->dexCaught[index] |= mask;
|
||||
break;
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue