Determine required pokedex expansion constants

This commit is contained in:
Bepis 2024-02-11 01:55:24 +11:00
parent 3471f61119
commit 661aa74990
No known key found for this signature in database
GPG Key ID: 3516B17D3102022E
42 changed files with 851 additions and 772 deletions

21
include/constants/forms.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef POKEPLATINUM_CONSTANTS_FORMS_H
#define POKEPLATINUM_CONSTANTS_FORMS_H
#include "species.h"
#define FORM_DEOXYS_ATTACK NATIONAL_DEX_COUNT + 1
#define FORM_DEOXYS_DEFENSE NATIONAL_DEX_COUNT + 2
#define FORM_DEOXYS_SPEED NATIONAL_DEX_COUNT + 3
#define FORM_WORMADAM_SANDY NATIONAL_DEX_COUNT + 4
#define FORM_WORMADAM_TRASH NATIONAL_DEX_COUNT + 5
#define FORM_GIRATINA_ORIGIN NATIONAL_DEX_COUNT + 6
#define FORM_SHAYMIN_SKY NATIONAL_DEX_COUNT + 7
#define FORM_ROTOM_HEAT NATIONAL_DEX_COUNT + 8
#define FORM_ROTOM_WASH NATIONAL_DEX_COUNT + 9
#define FORM_ROTOM_FROST NATIONAL_DEX_COUNT + 10
#define FORM_ROTOM_FAN NATIONAL_DEX_COUNT + 11
#define FORM_ROTOM_MOW NATIONAL_DEX_COUNT + 12
#define FORMS_MAX FORM_ROTOM_MOW
#endif

View File

@ -14,4 +14,6 @@
#define MAX_SPECIES SPECIES_BAD_EGG
#define LOCAL_DEX_COUNT 210
#endif // POKEPLATINUM_CONSTANTS_SPECIES_H

View File

@ -2,12 +2,13 @@
#define POKEPLATINUM_STRUCT_OV21_021D3A60_H
#include "overlay021/struct_ov21_021D37DC.h"
#include "constants/species.h"
typedef struct {
UnkStruct_ov21_021D37DC unk_00[493];
UnkStruct_ov21_021D37DC unk_00[NATIONAL_DEX_COUNT];
int unk_F68;
int unk_F6C;
int unk_F70[493];
int unk_F70[NATIONAL_DEX_COUNT];
int unk_1724;
int unk_1728;
} UnkStruct_ov21_021D3A60;

View File

@ -1,6 +1,6 @@
#ifndef POKEPLATINUM_STRUCT_02026324_DECL_H
#define POKEPLATINUM_STRUCT_02026324_DECL_H
typedef struct UnkStruct_02026324_t UnkStruct_02026324;
typedef struct PokedexData UnkStruct_02026324;
#endif // POKEPLATINUM_STRUCT_02026324_DECL_H

View File

@ -9,8 +9,8 @@ void sub_02002F5C(PaletteData * param0, int param1, void * param2, void * param3
void sub_02002F70(PaletteData * param0, int param1, u32 param2, u32 param3);
void sub_02002FA0(PaletteData * param0, int param1);
void sub_02002FBC(PaletteData * param0, const void * param1, int param2, u16 param3, u16 param4);
void sub_02002FEC(PaletteData * param0, u32 param1, u32 param2, u32 param3, int param4, u32 param5, u16 param6, u16 param7);
void PaletteSys_LoadPalette(PaletteData * param0, u32 param1, u32 param2, u32 param3, int param4, u32 param5, u16 param6);
void sub_02002FEC(PaletteData * param0, u32 bankID, u32 memberIndex, u32 param3, int param4, u32 param5, u16 param6, u16 param7);
void PaletteSys_LoadPalette(PaletteData * param0, u32 bankID, u32 memberIndex, u32 param3, int param4, u32 param5, u16 param6);
void sub_02003070(PaletteData * param0, int param1, u16 param2, u32 param3);
void sub_020030E4(u32 param0, u32 param1, u32 param2, u32 param3, u16 param4, void * param5);
void sub_02003120(PaletteData * param0, int param1, u16 param2, int param3, u16 param4, u16 param5);

View File

@ -16,7 +16,7 @@ u32 sub_02006F00(u32 param0, u32 param1, BOOL param2, int param3, u32 param4, NN
void sub_02006F28(u32 param0, u32 param1, BOOL param2, int param3, u32 param4, NNS_G2D_VRAM_TYPE param5, u32 param6, u32 param7, NNSG2dImageProxy * param8);
void * sub_02006F50(u32 param0, u32 param1, BOOL param2, NNSG2dCharacterData ** param3, u32 param4);
void * sub_02006F6C(u32 param0, u32 param1, BOOL param2, NNSG2dScreenData ** param3, u32 param4);
void * sub_02006F88(u32 param0, u32 param1, NNSG2dPaletteData ** param2, u32 param3);
void * sub_02006F88(u32 bankID, u32 memberIndex, NNSG2dPaletteData ** param2, u32 param3);
void * sub_02006FA0(u32 param0, u32 param1, BOOL param2, NNSG2dCellDataBank ** param3, u32 param4);
void * sub_02006FBC(u32 param0, u32 param1, BOOL param2, NNSG2dAnimBankData ** param3, u32 param4);
void * sub_02006FD8(u32 param0, u32 param1, u32 param2);

View File

@ -28,6 +28,7 @@
#include "unk_0202CC64.h"
#include "unk_0202CD50.h"
#include "unk_020559DC.h"
#include "constants/species.h"
#include "pokemon.h"
#include "party.h"
#include "item.h"
@ -2620,7 +2621,7 @@ void ov5_021E6CF0 (Pokemon * param0, u16 param1, u8 param2, TrainerInfo * param3
v2 = 1;
Pokemon_SetValue(param0, 76, &v2);
v5 = sub_0200B32C(494, 4);
v5 = sub_0200B32C(SPECIES_EGG, 4);
Pokemon_SetValue(param0, 119, v5);
Strbuf_Free(v5);
@ -2674,7 +2675,7 @@ void ov5_021E6DE8 (Pokemon * param0, u16 param1, UnkStruct_02026310 * param2, u3
Pokemon_SetValue(param0, 156, &v0);
Pokemon_SetValue(param0, 112, &param4);
v3 = sub_0200B32C(494, 4);
v3 = sub_0200B32C(SPECIES_EGG, 4);
Pokemon_SetValue(param0, 119, v3);
Strbuf_Free(v3);

View File

@ -3,13 +3,14 @@
#include <nnsys.h>
#include "overlay005/ov5_021F0E84.h"
#include "constants/species.h"
typedef struct {
u16 unk_00;
u16 unk_02;
} UnkStruct_ov5_021FFA54;
static const UnkStruct_ov5_021FFA54 Unk_ov5_021FFA54[494] = {
static const UnkStruct_ov5_021FFA54 Unk_ov5_021FFA54[NATIONAL_DEX_COUNT + 1] = {
{0x0, 0x0},
{0x1, 0x1},
{0x1, 0x1},

File diff suppressed because it is too large Load Diff

View File

@ -132,6 +132,7 @@
#include "unk_02018340.h"
#include "unk_0201D670.h"
#include "trainer_info.h"
#include "constants/species.h"
#include "pokemon.h"
#include "move_table.h"
#include "party.h"
@ -4421,7 +4422,7 @@ static void ov16_0226232C (SysTask * param0, void * param1)
ov16_02264730(v0->unk_00);
}
if (Pokemon_GetValue(v3, MON_DATA_SPECIES_EGG, NULL) == 494) {
if (Pokemon_GetValue(v3, MON_DATA_SPECIES_EGG, NULL) == SPECIES_EGG) {
ov16_02264730(v0->unk_00);
}
}

View File

@ -10,6 +10,7 @@
#include "battle/battle_context.h"
#include "pokemon.h"
#include "constants/species.h"
#include "struct_defs/struct_0207A81C.h"
#include "struct_defs/battle_system.h"
#include "battle/battle_context.h"
@ -539,7 +540,7 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl
v8 = Party_GetPokemonBySlotIndex(v7, battleCtx->partyOrder[v2][v1]);
v5 = Pokemon_GetValue(v8, MON_DATA_SPECIES_EGG, NULL);
if ((v5) && (v5 != 494)) {
if ((v5) && (v5 != SPECIES_EGG)) {
if (Pokemon_GetValue(v8, MON_DATA_CURRENT_HP, NULL)) {
if (Pokemon_GetValue(v8, MON_DATA_STATUS_CONDITION, NULL)) {
v0.unk_08[0][v6] = 3;
@ -574,7 +575,7 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl
v8 = Party_GetPokemonBySlotIndex(v7, battleCtx->partyOrder[v2][v1]);
v5 = Pokemon_GetValue(v8, MON_DATA_SPECIES_EGG, NULL);
if ((v5) && (v5 != 494)) {
if ((v5) && (v5 != SPECIES_EGG)) {
if (Pokemon_GetValue(v8, MON_DATA_CURRENT_HP, NULL)) {
if (Pokemon_GetValue(v8, MON_DATA_STATUS_CONDITION, NULL)) {
v0.unk_08[1][v6] = 3;
@ -602,7 +603,7 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl
v8 = Party_GetPokemonBySlotIndex(v7, battleCtx->partyOrder[v2][v1]);
v5 = Pokemon_GetValue(v8, MON_DATA_SPECIES_EGG, NULL);
if ((v5) && (v5 != 494)) {
if ((v5) && (v5 != SPECIES_EGG)) {
if (Pokemon_GetValue(v8, MON_DATA_CURRENT_HP, NULL)) {
if (Pokemon_GetValue(v8, MON_DATA_STATUS_CONDITION, NULL)) {
v0.unk_08[1][v6] = 3;
@ -625,7 +626,7 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl
v8 = Party_GetPokemonBySlotIndex(v7, battleCtx->partyOrder[v2][v1]);
v5 = Pokemon_GetValue(v8, MON_DATA_SPECIES_EGG, NULL);
if ((v5) && (v5 != 494)) {
if ((v5) && (v5 != SPECIES_EGG)) {
if (Pokemon_GetValue(v8, MON_DATA_CURRENT_HP, NULL)) {
if (Pokemon_GetValue(v8, MON_DATA_STATUS_CONDITION, NULL)) {
v0.unk_08[1][v6] = 3;

View File

@ -6,6 +6,8 @@
#include "inlines.h"
#include "core_sys.h"
#include "constants/species.h"
#include "struct_decls/struct_020067E8_decl.h"
#include "message.h"
#include "struct_decls/struct_0200B358_decl.h"
@ -4294,7 +4296,7 @@ static void ov19_021D5BE8 (UnkStruct_ov19_021D4DF0 * param0, u16 param1, UnkStru
{
int v2 = BoxPokemon_GetValue(v0->unk_00, MON_DATA_SPECIES, NULL);
if (v2 == 493) {
if (v2 == SPECIES_ARCEUS) {
BoxPokemon_SetArceusForm(v0->unk_00);
v0->unk_0C = BoxPokemon_GetValue(v0->unk_00, MON_DATA_TYPE_1, NULL);
v0->unk_0D = BoxPokemon_GetValue(v0->unk_00, MON_DATA_TYPE_2, NULL);

View File

@ -242,16 +242,16 @@ BOOL ov21_021D3464 (UnkStruct_ov21_021D3320 * param0, int param1, int param2, in
int v5;
BOOL v6;
v0 = Heap_AllocFromHeapAtEnd(param7, sizeof(u16) * 493);
v0 = Heap_AllocFromHeapAtEnd(param7, sizeof(u16) * NATIONAL_DEX_COUNT);
GF_ASSERT(v0);
memset(v0, 0, sizeof(u16) * 493);
memset(v0, 0, sizeof(u16) * NATIONAL_DEX_COUNT);
v1 = 0;
v2 = Heap_AllocFromHeapAtEnd(param7, sizeof(u16) * 493);
v2 = Heap_AllocFromHeapAtEnd(param7, sizeof(u16) * NATIONAL_DEX_COUNT);
GF_ASSERT(v2);
memset(v2, 0, sizeof(u16) * 493);
memset(v2, 0, sizeof(u16) * NATIONAL_DEX_COUNT);
v3 = 0;
@ -676,7 +676,7 @@ static void ov21_021D3AB8 (UnkStruct_ov21_021D3A60 * param0, const u16 * param1,
v1++;
param0->unk_1728++;
} else {
param0->unk_F70[param0->unk_1728] = (493 + 1);
param0->unk_F70[param0->unk_1728] = (NATIONAL_DEX_COUNT + 1);
param0->unk_1728++;
}
}

View File

@ -9,6 +9,8 @@
#include "strbuf.h"
#include "unk_020986CC.h"
#include "overlay021/ov21_021D5600.h"
#include "constants/species.h"
#include "constants/narc.h"
static const u8 Unk_ov21_021E9CC4[6] = {
0x1,
@ -21,7 +23,7 @@ static const u8 Unk_ov21_021E9CC4[6] = {
static inline int inline_ov21_021D5764(int param0);
static inline BOOL inline_ov21_021D5764_1(int param0, int param1);
static Strbuf* ov21_021D5724(int param0, int param1, int param2);
static Strbuf* LoadMessage(int param0, int param1, int param2);
static void ov21_021D5764(int param0, int param1, int * param2, int * param3, int * param4);
void ov21_021D5600 (Strbuf *param0)
@ -59,7 +61,7 @@ Strbuf* ov21_021D561C (int param0, int param1, int param2)
v2 = v0;
}
return ov21_021D5724(v3, v2, param2);
return LoadMessage(v3, v2, param2);
}
Strbuf* ov21_021D566C (int param0, int param1, int param2)
@ -87,7 +89,7 @@ Strbuf* ov21_021D566C (int param0, int param1, int param2)
v2 = v0;
}
return ov21_021D5724(v3, v2, param2);
return LoadMessage(v3, v2, param2);
}
Strbuf* ov21_021D56BC (int param0, int param1, int param2, int param3)
@ -117,27 +119,27 @@ Strbuf* ov21_021D56BC (int param0, int param1, int param2, int param3)
v2 = v0 * 1 + param2;
}
return ov21_021D5724(v3, v2, param3);
return LoadMessage(v3, v2, param3);
}
static inline BOOL inline_ov21_021D5764_1 (int param0, int param1)
{
if ((param0 > 493) && (param1 != 6)) {
if ((param0 > NATIONAL_DEX_COUNT) && (param1 != 6)) {
return 0;
}
return 1;
}
static Strbuf* ov21_021D5724 (int param0, int param1, int param2)
static Strbuf* LoadMessage (int bankID, int entryID, int heapID)
{
MessageLoader * v0 = MessageLoader_Init(1, 26, param0, param2);
MessageLoader *v0 = MessageLoader_Init(1, NARC_INDEX_MSGDATA__PL_MSG, bankID, heapID);
if (v0) {
Strbuf* v1 = Strbuf_Init(256, param2);
Strbuf* v1 = Strbuf_Init(256, heapID);
if (v1) {
MessageLoader_GetStrbuf(v0, param1, v1);
MessageLoader_GetStrbuf(v0, entryID, v1);
}
MessageLoader_Free(v0);

View File

@ -581,7 +581,7 @@ static BOOL ov21_021D601C (UnkStruct_ov21_021D5B68 * param0, UnkStruct_ov21_021D
if (param0->unk_2C) {
int v0 = ov21_021D3898(param0->unk_04);
if (ov21_021D38B0(param0->unk_04, v0) != (493 + 1)) {
if (ov21_021D38B0(param0->unk_04, v0) != (NATIONAL_DEX_COUNT + 1)) {
ov21_021D7464(param1, param0);
Sound_PlayEffect(1501);
return 1;
@ -905,7 +905,7 @@ static void ov21_021D67EC (UnkStruct_ov21_021D71A8 * param0, UnkStruct_ov21_021D
if ((v1 >= 0) && (v1 < v3)) {
v7 = ov21_021D38B0(param2->unk_04, v1);
if (v7 != (493 + 1)) {
if (v7 != (NATIONAL_DEX_COUNT + 1)) {
v6 = ov21_021D37DC(param2->unk_04, v7);
v5 = ov21_021D16D8(param1, param2->unk_04, param3, v6->unk_00);
v4.unk_04 = v5;
@ -933,7 +933,7 @@ static void ov21_021D68C8 (UnkStruct_ov21_021D71A8 * param0, UnkStruct_ov21_021D
v0 = ov21_021D375C(param2->unk_04);
v2 = ov21_021D37DC(param2->unk_04, v0);
if (ov21_021D38B0(param2->unk_04, v1) == (493 + 1)) {
if (ov21_021D38B0(param2->unk_04, v1) == (NATIONAL_DEX_COUNT + 1)) {
ov21_021D217C(param1, 0);
if (param0->unk_7C) {
@ -1110,7 +1110,7 @@ static void ov21_021D6AE4 (UnkStruct_ov21_021D71A8 * param0, const UnkStruct_ov2
if ((v5 >= 0) && (v5 < v7)) {
v11 = ov21_021D38B0(param1->unk_04, v5);
if (v11 != (493 + 1)) {
if (v11 != (NATIONAL_DEX_COUNT + 1)) {
v8 = ov21_021D37DC(param1->unk_04, v11);
if (v8->unk_04 == 2) {
@ -1246,7 +1246,7 @@ static void ov21_021D6CC8 (UnkStruct_ov21_021D71A8 * param0, UnkStruct_ov21_021D
if ((v3 < v1) && (v3 >= 0)) {
v4 = ov21_021D38B0(param2->unk_04, v3);
if (v4 != (493 + 1)) {
if (v4 != (NATIONAL_DEX_COUNT + 1)) {
ov21_021D6D78(param0, param1, param2, param3, v2, v4);
} else {
ov21_021D6DF4(param0, param1, param3, v2, v3 + 1);

View File

@ -13,6 +13,7 @@
#include "struct_defs/union_02022594_020225E0.h"
#include "overlay028/struct_ov28_0225697C_1.h"
#include "constants/species.h"
#include "unk_0200D9E8.h"
#include "heap.h"
#include "unk_0202631C.h"
@ -631,7 +632,7 @@ static void ov28_02256914 (UnkStruct_ov28_02256210 * param0, const UnkStruct_ov2
{
s64 v0 = ov28_02257468(param1);
if ((v0 > 0) && (v0 <= 493)) {
if ((v0 > 0) && (v0 <= NATIONAL_DEX_COUNT)) {
UnkStruct_02026324 * v1;
u16 v2;
@ -643,7 +644,7 @@ static void ov28_02256914 (UnkStruct_ov28_02256210 * param0, const UnkStruct_ov2
v2 = Pokemon_NationalDexNumber((u16)v0);
}
if (((v2 > 0) && (v2 <= 493)) && sub_02026FE8(v1, v2)) {
if (((v2 > 0) && (v2 <= NATIONAL_DEX_COUNT)) && sub_02026FE8(v1, v2)) {
ov25_02254444(v2, 0);
}
}

View File

@ -18,6 +18,7 @@
#include "unk_020298BC.h"
#include "unk_020797C8.h"
#include "overlay061/ov61_0222AE60.h"
#include "constants/species.h"
void ov61_0222AE60 (SaveData * param0, const UnkStruct_02029C68 * param1, UnkStruct_ov61_0222AE80 * param2)
{
@ -47,7 +48,7 @@ void ov61_0222AE88 (SaveData * param0, const PCBoxes * param1, int param2, UnkSt
param3->unk_64[v1] = sub_02079C08(param1, param2, v1, 0, NULL);
param3->unk_DC[v1] = sub_02079C08(param1, param2, v1, 7, NULL);
if (sub_02079C08(param1, param2, v1, 174, NULL) == 494) {
if (sub_02079C08(param1, param2, v1, 174, NULL) == SPECIES_EGG) {
param3->unk_154 |= 1 << v1;
}

View File

@ -57,6 +57,7 @@
#include "overlay062/ov62_02231690.h"
#include "overlay062/ov62_02239D60.h"
#include "overlay062/ov62_0224112C.h"
#include "constants/species.h"
typedef struct {
int unk_00;
@ -1057,7 +1058,7 @@ static void ov62_0223ADC0 (UnkStruct_0208C06C * param0, int param1)
v2 = Strbuf_Init(255, 102);
if (ov62_0223ADB0(v0->unk_04.unk_154, (1 << v0->unk_1B0)) == 1) {
v4 = 494;
v4 = SPECIES_EGG;
}
MessageLoader_GetSpeciesName(v4, 102, v5);
@ -1200,7 +1201,7 @@ static void ov62_0223B050 (UnkStruct_0208C06C * param0)
v6 = 0;
}
v7 = 494;
v7 = SPECIES_EGG;
}
v1 = PokemonPersonalData_FromMonSpecies(v7, 102);

View File

@ -62,6 +62,7 @@
#include "unk_0202CD50.h"
#include "unk_02030EA4.h"
#include "pokemon.h"
#include "constants/species.h"
#include "party.h"
#include "unk_0207E060.h"
#include "overlay066/ov66_0222DDF0.h"
@ -2354,7 +2355,7 @@ static void ov66_0222F7C8 (UnkStruct_ov66_0222F6C4 * param0, SaveData * param1,
param0->unk_20.unk_2C[v8] = Pokemon_GetValue(v6, MON_DATA_FORM, NULL);
param0->unk_20.unk_32[v8] = Pokemon_GetValue(v6, MON_DATA_IS_EGG, NULL);
} else {
param0->unk_20.unk_20[v8] = 495;
param0->unk_20.unk_20[v8] = SPECIES_BAD_EGG;
}
}
}

View File

@ -4,6 +4,8 @@
#include "inlines.h"
#include "core_sys.h"
#include "constants/species.h"
#include "struct_decls/struct_020067E8_decl.h"
#include "struct_decls/struct_02006C24_decl.h"
#include "message.h"
@ -2502,7 +2504,7 @@ static void ov88_0223E694 (Party * param0, Party * param1, int param2, int param
Pokemon_Copy(Party_GetPokemonBySlotIndex(param0, param2), v0);
Pokemon_Copy(Party_GetPokemonBySlotIndex(param1, param3), v1);
if (Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL) == 493) {
if (Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL) == SPECIES_ARCEUS) {
if (Pokemon_GetValue(v1, MON_DATA_FATEFUL_ENCOUNTER, NULL) || ((Pokemon_GetValue(v1, MON_DATA_HATCH_LOCATION, NULL) == 86) && (Pokemon_GetValue(v1, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 0))) {
UnkStruct_020507E4 * v2 = sub_020507E4(param4->unk_10);

View File

@ -4,6 +4,8 @@
#include "core_sys.h"
#include "constants/species.h"
#include "struct_decls/struct_0200112C_decl.h"
#include "message.h"
#include "struct_decls/struct_0200B358_decl.h"
@ -1028,15 +1030,15 @@ u8 * ov94_02242548 (int param0)
{
u32 v0, v1, v2;
u16 * v3;
u8 * v4 = Heap_AllocFromHeap(62, 493 + 1);
u8 *v4 = Heap_AllocFromHeap(62, NATIONAL_DEX_COUNT + 1);
MI_CpuClearFast(v4, 493 + 1);
MI_CpuClearFast(v4, NATIONAL_DEX_COUNT + 1);
v3 = sub_02007068(75, 12, 0, param0, 0, &v0);
v1 = v0 / (sizeof(u16));
for (v2 = 0; v2 < v1; v2++) {
if (v3[v2] < 493 + 1) {
if (v3[v2] < NATIONAL_DEX_COUNT + 1) {
v4[v3[v2]] = 1;
}
}

View File

@ -3,6 +3,7 @@
#include <dwc.h>
#include "inlines.h"
#include "constants/species.h"
#include "struct_decls/struct_02018340_decl.h"
#include "struct_decls/struct_0202440C_decl.h"
@ -1288,7 +1289,7 @@ static void ov94_02243BC4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, i
if (param3) {
u8 v1 = 70;
if (Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL) == 493) {
if (Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL) == SPECIES_ARCEUS) {
if (Pokemon_GetValue(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) || ((Pokemon_GetValue(param1, MON_DATA_HATCH_LOCATION, NULL) == 86) && (Pokemon_GetValue(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 0))) {
UnkStruct_020507E4 * v2 = sub_020507E4(param0->unk_00->unk_20);
@ -1335,7 +1336,7 @@ static void ov94_02243CE4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, i
param2 = 0;
}
if (Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL) == 493) {
if (Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL) == SPECIES_ARCEUS) {
if (Pokemon_GetValue(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) || ((Pokemon_GetValue(param1, MON_DATA_HATCH_LOCATION, NULL) == 86) && (Pokemon_GetValue(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 0))) {
UnkStruct_020507E4 * v0 = sub_020507E4(param0->unk_00->unk_20);

View File

@ -52,6 +52,7 @@
#include "strbuf.h"
#include "unk_020244AC.h"
#include "unk_02033200.h"
#include "constants/species.h"
#include "pokemon.h"
#include "item.h"
#include "overlay097/ov97_02237694.h"
@ -628,10 +629,10 @@ static void ov97_02237FF4 (UnkStruct_ov97_0223F550 * param0, int param1, UnkStru
ov97_02237EF8(param0->unk_26C, v0, Pokemon_GetValue(v0, MON_DATA_SPECIES, 0), Pokemon_GetValue(v0, MON_DATA_FORM, 0), param0->unk_278, &param0->unk_EF8);
break;
case 2:
ov97_02237EF8(param0->unk_26C, v0, 494, 0, param0->unk_278, &param0->unk_EF8);
ov97_02237EF8(param0->unk_26C, v0, SPECIES_EGG, 0, param0->unk_278, &param0->unk_EF8);
break;
case 7:
ov97_02237EF8(param0->unk_26C, v0, 494, 1, param0->unk_278, &param0->unk_EF8);
ov97_02237EF8(param0->unk_26C, v0, SPECIES_EGG, 1, param0->unk_278, &param0->unk_EF8);
break;
}
}

View File

@ -4,6 +4,8 @@
#include "core_sys.h"
#include "constants/species.h"
#include "struct_decls/struct_02002F38_decl.h"
#include "struct_decls/struct_020067E8_decl.h"
#include "struct_decls/struct_02006C24_decl.h"
@ -1099,7 +1101,7 @@ static void ov113_0225D7CC (UnkStruct_ov113_0225DBCC * param0)
v3 = sub_0200316C(param0->unk_0C, 2);
for (v0 = 0; v0 < 6; v0++) {
if ((param0->unk_8D8[v0].unk_02 == 0) || (param0->unk_8D8[v0].unk_02 > 493)) {
if ((param0->unk_8D8[v0].unk_02 == 0) || (param0->unk_8D8[v0].unk_02 > NATIONAL_DEX_COUNT)) {
sub_0200D3F4(param0->unk_924[v0], 0);
sub_0200D3F4(param0->unk_93C[v0], 0);
sub_0200D3F4(param0->unk_954[v0], 0);
@ -1135,7 +1137,7 @@ static BOOL ov113_0225D938 (int param0, int param1, CellActorData * param2, NARC
NNSG2dCharacterData * v3;
u8 * v4, * v5;
if ((param0 == 0) || (param0 > 493)) {
if ((param0 == 0) || (param0 > NATIONAL_DEX_COUNT)) {
return 0;
}

View File

@ -1,6 +1,8 @@
#include <nitro.h>
#include <string.h>
#include "constants/species.h"
#include "struct_decls/struct_02006C24_decl.h"
#include "struct_decls/struct_020203AC_decl.h"
#include "overlay113/struct_ov113_0225DBCC_decl.h"
@ -553,7 +555,7 @@ static UnkStruct_ov113_0225E6B8 * ov113_0225E6B8 (UnkStruct_ov113_0225DBCC * par
v0->unk_240_24 = 0xff;
v0->unk_00 = *param2;
if (v0->unk_00.unk_02 > 493) {
if (v0->unk_00.unk_02 > NATIONAL_DEX_COUNT) {
GF_ASSERT(0);
v0->unk_00.unk_02 = 132;
}

View File

@ -14,6 +14,7 @@
#include "overlay113/struct_ov113_02260D90.h"
#include "message.h"
#include "constants/species.h"
#include "unk_0200B358.h"
#include "heap.h"
#include "unk_02018340.h"
@ -36,7 +37,9 @@ __attribute__((aligned(4))) static const u16 Unk_ov113_02260D6C[][2] = {
{ 0x3A80, 0x5400 },
{ 0x2D4A, 0x5651 }
};
static const UnkStruct_ov113_02260D90 Unk_ov113_02260D90[] = {
// footprint data, but apparently only affects overworld
static const UnkStruct_ov113_02260D90 Unk_ov113_02260D90[NATIONAL_DEX_COUNT + 1] = {
{ 0x0, 0x0 },
{ 0x1, 0x1 },
{ 0x1, 0x1 },
@ -630,7 +633,7 @@ int ov113_02260748 (UnkStruct_ov113_02260818 * param0, int param1)
v0 = sub_02022664(Unk_ov113_02260D4C);
if (v0 < 6) {
if ((param1 != v0) && (param0[v0].unk_02 != 0) && (param0[v0].unk_02 <= 493)) {
if ((param1 != v0) && (param0[v0].unk_02 != 0) && (param0[v0].unk_02 <= NATIONAL_DEX_COUNT)) {
v1 = v0;
}
} else if (v0 == 6) {
@ -648,7 +651,7 @@ BOOL ov113_02260788 (int param0, int param1, BOOL param2)
return 0;
}
if ((param0 == 493) && (param2 == 0)) {
if ((param0 == SPECIES_ARCEUS) && (param2 == 0)) {
return 0;
}

View File

@ -3817,7 +3817,7 @@ u16 Pokemon_NationalDexNumber(u16 sinnohDexNumber)
{
u16 result = 0;
if (sinnohDexNumber <= 210) {
if (sinnohDexNumber <= LOCAL_DEX_COUNT) {
NARC_ReadFromMemberByIndexPair(&result, NARC_INDEX_POKETOOL__SHINZUKAN, 0, sinnohDexNumber * 2, 2);
}

View File

@ -87,12 +87,12 @@ void sub_02002FBC (PaletteData * param0, const void * param1, int param2, u16 pa
MI_CpuCopy16(param1, (void *)&param0->unk_00[param2].unk_04[param3], (u32)param4);
}
void sub_02002FEC (PaletteData * param0, u32 param1, u32 param2, u32 param3, int param4, u32 param5, u16 param6, u16 param7)
void sub_02002FEC (PaletteData * param0, u32 bankID, u32 memberIndex, u32 param3, int param4, u32 param5, u16 param6, u16 param7)
{
NNSG2dPaletteData * v0;
void * v1;
v1 = sub_02006F88(param1, param2, &v0, param3);
v1 = sub_02006F88(bankID, memberIndex, &v0, param3);
GF_ASSERT(v1 != NULL);
if (param5 == 0) {
@ -105,9 +105,9 @@ void sub_02002FEC (PaletteData * param0, u32 param1, u32 param2, u32 param3, int
Heap_FreeToHeap(v1);
}
void PaletteSys_LoadPalette (PaletteData * param0, u32 param1, u32 param2, u32 param3, int param4, u32 param5, u16 param6)
void PaletteSys_LoadPalette (PaletteData * param0, u32 bankID, u32 memberIndex, u32 param3, int param4, u32 param5, u16 param6)
{
sub_02002FEC(param0, param1, param2, param3, param4, param5, param6, 0);
sub_02002FEC(param0, bankID, memberIndex, param3, param4, param5, param6, 0);
}
void sub_02003070 (PaletteData * param0, int param1, u16 param2, u32 param3)

View File

@ -48,7 +48,7 @@ BOOL sub_02005844(u16 param0, u8 param1);
BOOL sub_0200590C(u16 param0, u8 param1, u8 param2);
void sub_0200592C(int param0);
int sub_0200598C(void);
BOOL Sound_PlayPokemonCry(int param0, u16 param1, int param2, int param3, int param4, u8 param5);
BOOL Sound_PlayPokemonCry(int param0, u16 species, int param2, int param3, int param4, u8 param5);
void sub_02005E64(int param0, int param1);
static void sub_02005EB0(SysTask * param0, void * param1);
void sub_02005F24(void);
@ -415,11 +415,11 @@ BOOL sub_02005844 (u16 param0, u8 param1)
v0 = param0;
if (sub_02006038(v0, param1) == 1) {
v0 = 494;
v0 = SPECIES_EGG;
}
if (v0 != 494) {
if ((v0 > 495) || (v0 == 0)) {
if (v0 != SPECIES_EGG) {
if ((v0 > MAX_SPECIES) || (v0 == 0)) {
v0 = 1;
}
}
@ -501,7 +501,7 @@ int sub_0200598C (void)
return sub_02004B04(0);
}
BOOL Sound_PlayPokemonCry (int param0, u16 param1, int param2, int param3, int param4, u8 param5)
BOOL Sound_PlayPokemonCry (int param0, u16 species, int param2, int param3, int param4, u8 param5)
{
int v0, v1;
u16 v2;
@ -517,13 +517,13 @@ BOOL Sound_PlayPokemonCry (int param0, u16 param1, int param2, int param3, int p
v5 = 0;
v6 = 0;
v7 = 0;
v2 = param1;
v2 = species;
if (sub_02006038(v2, param5) == 1) {
v2 = 494;
v2 = SPECIES_EGG;
}
if (v2 != 494) {
if (v2 != SPECIES_EGG) {
if ((v2 > MAX_SPECIES) || (v2 == 0)) {
v2 = SPECIES_BULBASAUR;
}
@ -816,7 +816,7 @@ void Sound_PlayDelayedPokemonCry (int param0, u16 param1, int param2, int param3
v0 = param1;
if (sub_02006038(v0, param6) == 1) {
v0 = 494;
v0 = SPECIES_EGG;
}
if (v0 == 0) {
@ -846,7 +846,7 @@ static BOOL sub_02006038 (u16 param0, u8 param1)
}
}
if (param0 == 494) {
if (param0 == SPECIES_EGG) {
return 1;
}

View File

@ -4,6 +4,7 @@
#include "struct_decls/struct_021C0794_decl.h"
#include "unk_02006E3C.h"
#include "narc.h"
#include "message.h"
#include "unk_02014D38.h"
#include "heap.h"
@ -181,7 +182,7 @@ void sub_02014DB8 (u16 param0, Strbuf *param1)
sub_02014E4C(param0, &v0, &v1);
v0 = Unk_020E550C[v0];
MessageBank_GetStrbufFromNARC(26, v0, v1, 0, param1);
MessageBank_GetStrbufFromNARC(NARC_INDEX_MSGDATA__PL_MSG, v0, v1, 0, param1);
} else {
Strbuf_Clear(param1);
}

View File

@ -10,24 +10,32 @@
#include "unk_020244AC.h"
#include "unk_0202631C.h"
#include "pokemon.h"
#include "constants/species.h"
#include "unk_020986CC.h"
typedef struct UnkStruct_02026324_t {
u32 unk_00;
u32 unk_04[16];
u32 unk_44[16];
u32 unk_84[2][16];
// These u32[16] arrays store pokedex seen/caught info as bit flags
// Therefore 32 * 16 = 512 pokedex slots. These need to be bumped up if it's pushed past this number
// ReadBit and WriteBit may need to be changed as well, to handle a larger range of bits
#define UNOWN_COUNT 28
#define BYTE_SLOTS 16
typedef struct PokedexData {
u32 magic;
u32 caughtPokemon[BYTE_SLOTS];
u32 seenPokemon[BYTE_SLOTS];
u32 recordedGenders[2][BYTE_SLOTS];
u32 unk_104;
u8 unk_108;
u8 unk_109;
u8 unk_10A;
u8 unk_10B;
u8 unk_10C[28];
u8 unk_128[496];
u8 unk_318;
u8 unk_10C[UNOWN_COUNT];
u8 recordedLanguages[MAX_SPECIES + 1];
u8 canDetectForms;
u8 unk_319;
u8 unk_31A;
u8 unk_31B;
u8 pokedexObtained;
u8 nationalDexObtained;
u32 unk_31C;
u8 unk_320;
u8 unk_321;
@ -54,14 +62,14 @@ void sub_02026338 (const UnkStruct_02026324 * param0, UnkStruct_02026324 * param
MI_CpuCopy8(param0, param1, sizeof(UnkStruct_02026324));
}
static inline void inline_02026DD0 (const UnkStruct_02026324 * param0)
static inline void CheckPokedexIntegrity (const UnkStruct_02026324 * param0)
{
GF_ASSERT(param0->unk_00 == 3203386110);
GF_ASSERT(param0->magic == 3203386110);
}
static BOOL sub_02026344 (u16 param0)
{
if ((param0 == 0) || (param0 > 493)) {
if ((param0 == 0) || (param0 > NATIONAL_DEX_COUNT)) {
GF_ASSERT(0);
return 1;
} else {
@ -69,16 +77,16 @@ static BOOL sub_02026344 (u16 param0)
}
}
static inline BOOL inline_02026464 (const u8 * param0, u16 param1)
static inline BOOL ReadBit (const u8 * array, u16 bitNumber)
{
param1--;
return 0 != (param0[param1 >> 3] & (1 << (param1 & 7)));
bitNumber--;
return 0 != (array[bitNumber >> 3] & (1 << (bitNumber & 7)));
}
static inline void inline_0202736C_sub (u8 * param0, u16 param1)
static inline void WriteBit (u8 * array, u16 bitNumber)
{
param1--;
param0[param1 >> 3] |= 1 << (param1 & 7);
bitNumber--;
array[bitNumber >> 3] |= 1 << (bitNumber & 7);
}
static inline void inline_02026360 (u8 * param0, u8 param1, u16 param2)
@ -106,21 +114,21 @@ static inline void inline_020267B8 (u8 * param0, u8 param1, u16 param2)
static inline void inline_0202736C (UnkStruct_02026324 * param0, u16 param1)
{
inline_0202736C_sub((u8 *)param0->unk_44, param1);
WriteBit((u8 *)param0->seenPokemon, param1);
}
static inline void inline_sub_0202736C_1 (UnkStruct_02026324 * param0, u16 param1)
{
inline_0202736C_sub((u8 *)param0->unk_04, param1);
WriteBit((u8 *)param0->caughtPokemon, param1);
}
static void sub_02026360 (UnkStruct_02026324 * param0, u8 param1, u8 param2, u16 param3)
{
if (param2 == 0) {
inline_02026360((u8 *)param0->unk_84[1], param1, param3);
inline_02026360((u8 *)param0->recordedGenders[1], param1, param3);
}
inline_02026360((u8 *)param0->unk_84[param2], param1, param3);
inline_02026360((u8 *)param0->recordedGenders[param2], param1, param3);
}
static void sub_020263D8 (UnkStruct_02026324 * param0, u8 param1, u8 param2, u16 param3)
@ -136,17 +144,17 @@ static void sub_020263D8 (UnkStruct_02026324 * param0, u8 param1, u8 param2, u16
static inline BOOL inline_02026FE8 (const UnkStruct_02026324 * param0, u16 param1)
{
return inline_02026464((const u8 *)param0->unk_44, param1);
return ReadBit((const u8 *)param0->seenPokemon, param1);
}
static inline BOOL inline_02026F9C (const UnkStruct_02026324 * param0, u16 param1)
{
return inline_02026464((const u8 *)param0->unk_04, param1);
return ReadBit((const u8 *)param0->caughtPokemon, param1);
}
static inline u8 inline_02026BAC (const UnkStruct_02026324 * param0, u16 param1, u8 param2)
{
return inline_02026464((const u8 *)param0->unk_84[param2], param1);
return ReadBit((const u8 *)param0->recordedGenders[param2], param1);
}
static inline void inline_0202736C_1 (UnkStruct_02026324 * param0, u16 param1, u32 param2)
@ -160,7 +168,7 @@ static int sub_02026400 (const UnkStruct_02026324 * param0)
{
int v0;
for (v0 = 0; v0 < 28; v0++) {
for (v0 = 0; v0 < UNOWN_COUNT; v0++) {
if (param0->unk_10C[v0] == 0xff) {
break;
}
@ -173,7 +181,7 @@ static BOOL sub_02026418 (const UnkStruct_02026324 * param0, u8 param1)
{
int v0;
for (v0 = 0; v0 < 28; v0++) {
for (v0 = 0; v0 < UNOWN_COUNT; v0++) {
if (param0->unk_10C[v0] == param1) {
return 1;
}
@ -192,7 +200,7 @@ static void sub_0202643C (UnkStruct_02026324 * param0, int param1)
v0 = sub_02026400(param0);
if (v0 < 28) {
if (v0 < UNOWN_COUNT) {
param0->unk_10C[v0] = param1;
}
}
@ -224,8 +232,8 @@ static int sub_02026464 (const UnkStruct_02026324 * param0, u32 param1)
break;
}
v0 = inline_02026464(v2, 1);
v1 = inline_02026464(v2, 2);
v0 = ReadBit(v2, 1);
v1 = ReadBit(v2, 2);
if (v0 == v1) {
return 1;
@ -265,7 +273,7 @@ static BOOL sub_02026514 (const UnkStruct_02026324 * param0, u32 param1, u8 para
v2 = sub_02026464(param0, param1);
for (v1 = 0; v1 < v2; v1++) {
v0 = inline_02026464(v3, v1 + 1);
v0 = ReadBit(v3, v1 + 1);
if (v0 == param2) {
return 1;
@ -409,9 +417,9 @@ static void sub_02026850 (UnkStruct_02026324 * param0, u8 param1, u8 param2)
GF_ASSERT(param1 <= 15);
if (param2 < 2) {
sub_02026834(param0->unk_04, param1, param2);
sub_02026834(param0->caughtPokemon, param1, param2);
} else {
sub_02026834(param0->unk_44, param1, param2 - 2);
sub_02026834(param0->seenPokemon, param1, param2 - 2);
}
}
@ -428,9 +436,9 @@ static u32 sub_0202688C (const UnkStruct_02026324 * param0, u8 param1)
u32 v0;
if (param1 < 2) {
v0 = inline_0202688C(param0->unk_04, param1);
v0 = inline_0202688C(param0->caughtPokemon, param1);
} else {
v0 = inline_0202688C(param0->unk_44, param1 - 2);
v0 = inline_0202688C(param0->seenPokemon, param1 - 2);
}
return v0;
@ -622,7 +630,7 @@ static void sub_02026B88 (UnkStruct_02026324 * param0, u16 param1, u32 param2)
return;
}
param0->unk_128[v0] |= 1 << v1;
param0->recordedLanguages[v0] |= 1 << v1;
}
static u32 sub_02026BAC (const UnkStruct_02026324 * param0, u16 param1, int param2)
@ -682,7 +690,7 @@ static int sub_02026C24 (const UnkStruct_02026324 * param0, u32 param1, int para
break;
}
return inline_02026464(v0, param2 + 1);
return ReadBit(v0, param2 + 1);
}
static int sub_02026CCC (const UnkStruct_02026324 * param0, u32 param1, int param2)
@ -747,10 +755,10 @@ void Pokedex_Init (UnkStruct_02026324 * param0)
{
memset(param0, 0, sizeof(UnkStruct_02026324));
param0->unk_00 = 3203386110;
param0->unk_31B = 0;
param0->magic = 3203386110;
param0->nationalDexObtained = FALSE;
memset(param0->unk_10C, 0xff, sizeof(u8) * 28);
memset(param0->unk_10C, 0xff, sizeof(u8) * UNOWN_COUNT);
param0->unk_108 = 0xff;
param0->unk_109 = 0xff;
@ -768,10 +776,10 @@ u16 sub_02026DD0 (const UnkStruct_02026324 * param0)
int v0;
int v1;
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
v1 = 0;
for (v0 = 1; v0 <= 493; v0++) {
for (v0 = 1; v0 <= NATIONAL_DEX_COUNT; v0++) {
if (Pokedex_CaughtSpecies(param0, v0) == 1) {
v1++;
}
@ -785,10 +793,10 @@ u16 sub_02026E0C (const UnkStruct_02026324 * param0)
int v0;
int v1;
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
v1 = 0;
for (v0 = 1; v0 <= 493; v0++) {
for (v0 = 1; v0 <= NATIONAL_DEX_COUNT; v0++) {
if (sub_02026FE8(param0, v0) == 1) {
v1++;
}
@ -811,10 +819,10 @@ u16 sub_02026E64 (const UnkStruct_02026324 * param0)
int v0;
int v1;
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
v1 = 0;
for (v0 = 1; v0 <= 493; v0++) {
for (v0 = 1; v0 <= NATIONAL_DEX_COUNT; v0++) {
if (Pokedex_CaughtSpecies(param0, v0) == 1) {
if (Pokemon_SinnohDexNumber(v0) != 0) {
v1++;
@ -830,10 +838,10 @@ u16 sub_02026EAC (const UnkStruct_02026324 * param0)
int v0;
int v1;
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
v1 = 0;
for (v0 = 1; v0 <= 493; v0++) {
for (v0 = 1; v0 <= NATIONAL_DEX_COUNT; v0++) {
if (sub_02026FE8(param0, v0) == 1) {
if (Pokemon_SinnohDexNumber(v0) != 0) {
v1++;
@ -863,7 +871,7 @@ BOOL sub_02026F0C (const UnkStruct_02026324 * param0)
v0 = sub_02026F58(param0);
if (v0 >= 210) {
if (v0 >= LOCAL_DEX_COUNT) {
return 1;
}
@ -877,7 +885,7 @@ u16 sub_02026F20 (const UnkStruct_02026324 * param0)
v1 = 0;
for (v0 = 1; v0 <= 493; v0++) {
for (v0 = 1; v0 <= NATIONAL_DEX_COUNT; v0++) {
if (Pokedex_CaughtSpecies(param0, v0) == 1) {
if (sub_02026D44(v0) == 1) {
v1++;
@ -896,7 +904,7 @@ u16 sub_02026F58 (const UnkStruct_02026324 * param0)
v1 = 0;
for (v0 = 1; v0 <= 493; v0++) {
for (v0 = 1; v0 <= NATIONAL_DEX_COUNT; v0++) {
if (sub_02026FE8(param0, v0) == 1) {
v2 = Pokemon_SinnohDexNumber(v0);
@ -913,7 +921,7 @@ u16 sub_02026F58 (const UnkStruct_02026324 * param0)
BOOL Pokedex_CaughtSpecies (const UnkStruct_02026324 * param0, u16 param1)
{
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
if (sub_02026344(param1)) {
return 0;
@ -928,7 +936,7 @@ BOOL Pokedex_CaughtSpecies (const UnkStruct_02026324 * param0, u16 param1)
BOOL sub_02026FE8 (const UnkStruct_02026324 * param0, u16 param1)
{
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
if (sub_02026344(param1)) {
return 0;
@ -941,7 +949,7 @@ u32 sub_0202702C (const UnkStruct_02026324 * param0, u8 param1)
{
u32 v0;
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
switch (param1) {
case 0:
@ -957,7 +965,7 @@ u32 sub_0202702C (const UnkStruct_02026324 * param0, u8 param1)
u32 sub_02027058 (const UnkStruct_02026324 * param0, u16 param1, int param2)
{
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
if (sub_02026344(param1)) {
return -1;
@ -972,7 +980,7 @@ u32 sub_02027058 (const UnkStruct_02026324 * param0, u16 param1, int param2)
u32 sub_020270AC (const UnkStruct_02026324 * param0, int param1)
{
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
if (sub_02026400(param0) <= param1) {
return -1;
@ -983,13 +991,13 @@ u32 sub_020270AC (const UnkStruct_02026324 * param0, int param1)
u32 sub_020270DC (const UnkStruct_02026324 * param0)
{
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
return sub_02026400(param0);
}
u32 sub_020270F8 (const UnkStruct_02026324 * param0, int param1)
{
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
if (sub_02026464(param0, 422) <= param1) {
return -1;
@ -1000,13 +1008,13 @@ u32 sub_020270F8 (const UnkStruct_02026324 * param0, int param1)
u32 sub_02027130 (const UnkStruct_02026324 * param0)
{
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
return sub_02026464(param0, 422);
}
u32 sub_02027154 (const UnkStruct_02026324 * param0, int param1)
{
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
if (sub_02026464(param0, 423) <= param1) {
return -1;
@ -1017,13 +1025,13 @@ u32 sub_02027154 (const UnkStruct_02026324 * param0, int param1)
u32 sub_0202718C (const UnkStruct_02026324 * param0)
{
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
return sub_02026464(param0, 423);
}
u32 sub_020271B0 (const UnkStruct_02026324 * param0, int param1)
{
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
if (sub_020266F8(param0, 412) <= param1) {
return -1;
@ -1034,13 +1042,13 @@ u32 sub_020271B0 (const UnkStruct_02026324 * param0, int param1)
u32 sub_020271E8 (const UnkStruct_02026324 * param0)
{
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
return sub_020266F8(param0, 412);
}
u32 sub_02027208 (const UnkStruct_02026324 * param0, int param1)
{
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
if (sub_020266F8(param0, 413) <= param1) {
return -1;
@ -1051,30 +1059,30 @@ u32 sub_02027208 (const UnkStruct_02026324 * param0, int param1)
u32 sub_02027240 (const UnkStruct_02026324 * param0)
{
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
return sub_020266F8(param0, 413);
}
u32 sub_02027264 (const UnkStruct_02026324 * param0, int param1)
{
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
return sub_0202688C(param0, param1);
}
u32 sub_02027288 (const UnkStruct_02026324 * param0)
{
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
return sub_020268B8(param0);
}
void sub_020272A4 (UnkStruct_02026324 * param0, Pokemon * param1)
void sub_020272A4 (UnkStruct_02026324 * param0, Pokemon * pokemon)
{
u16 v0 = Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL);
u32 v1 = Pokemon_GetValue(param1, MON_DATA_PERSONALITY, NULL);
u32 v2 = Pokemon_GetGender(param1);
u16 v0 = Pokemon_GetValue(pokemon, MON_DATA_SPECIES, NULL);
u32 v1 = Pokemon_GetValue(pokemon, MON_DATA_PERSONALITY, NULL);
u32 v2 = Pokemon_GetGender(pokemon);
u32 v3;
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
if (sub_02026344(v0)) {
return;
@ -1091,7 +1099,7 @@ void sub_020272A4 (UnkStruct_02026324 * param0, Pokemon * param1)
}
}
sub_02026A60(param0, v0, param1);
sub_02026A60(param0, v0, pokemon);
inline_0202736C(param0, v0);
}
@ -1103,7 +1111,7 @@ void sub_0202736C (UnkStruct_02026324 * param0, Pokemon * param1)
u32 v3 = Pokemon_GetGender(param1);
u32 v4;
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
if (sub_02026344(v0)) {
return;
@ -1129,26 +1137,26 @@ void sub_0202736C (UnkStruct_02026324 * param0, Pokemon * param1)
void sub_02027454 (UnkStruct_02026324 * param0)
{
inline_02026DD0(param0);
param0->unk_31B = 1;
CheckPokedexIntegrity(param0);
param0->nationalDexObtained = 1;
}
BOOL sub_02027474 (const UnkStruct_02026324 * param0)
{
inline_02026DD0(param0);
return param0->unk_31B;
CheckPokedexIntegrity(param0);
return param0->nationalDexObtained;
}
BOOL sub_02027494 (const UnkStruct_02026324 * param0)
{
inline_02026DD0(param0);
return param0->unk_318;
CheckPokedexIntegrity(param0);
return param0->canDetectForms;
}
void sub_020274B0 (UnkStruct_02026324 * param0)
{
inline_02026DD0(param0);
param0->unk_318 = 1;
CheckPokedexIntegrity(param0);
param0->canDetectForms = 1;
}
BOOL sub_020274D0 (const UnkStruct_02026324 * param0, u16 param1, u32 param2)
@ -1157,12 +1165,12 @@ BOOL sub_020274D0 (const UnkStruct_02026324 * param0, u16 param1, u32 param2)
GF_ASSERT(param2 < 8);
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
v0 = param1;
param2 = sub_020986CC(param2);
return param0->unk_128[v0] & (1 << param2);
return param0->recordedLanguages[v0] & (1 << param2);
}
void sub_02027508 (UnkStruct_02026324 * param0)
@ -1177,14 +1185,14 @@ BOOL sub_02027514 (const UnkStruct_02026324 * param0)
BOOL sub_02027520 (const UnkStruct_02026324 * param0)
{
inline_02026DD0(param0);
return param0->unk_31A;
CheckPokedexIntegrity(param0);
return param0->pokedexObtained;
}
void sub_02027540 (UnkStruct_02026324 * param0)
{
inline_02026DD0(param0);
param0->unk_31A = 1;
CheckPokedexIntegrity(param0);
param0->pokedexObtained = 1;
}
UnkStruct_02026324 * sub_02027560 (SaveData * param0)
@ -1197,7 +1205,7 @@ UnkStruct_02026324 * sub_02027560 (SaveData * param0)
u32 sub_0202756C (const UnkStruct_02026324 * param0, int param1, int param2)
{
inline_02026DD0(param0);
CheckPokedexIntegrity(param0);
switch (param1) {
case 201:
@ -1252,29 +1260,29 @@ u32 sub_0202756C (const UnkStruct_02026324 * param0, int param1, int param2)
return 0;
}
u32 sub_020276C8 (const UnkStruct_02026324 * param0, int param1)
u32 sub_020276C8 (const UnkStruct_02026324 * pokedex, int param1)
{
inline_02026DD0(param0);
CheckPokedexIntegrity(pokedex);
switch (param1) {
case 201:
return sub_020270DC(param0);
return sub_020270DC(pokedex);
case 422:
return sub_02027130(param0);
return sub_02027130(pokedex);
case 423:
return sub_0202718C(param0);
return sub_0202718C(pokedex);
case 412:
return sub_020271E8(param0);
return sub_020271E8(pokedex);
case 413:
return sub_02027240(param0);
return sub_02027240(pokedex);
case 386:
return sub_02027288(param0);
return sub_02027288(pokedex);
case 492:
return sub_02026464(param0, 492);
return sub_02026464(pokedex, 492);
case 487:
return sub_02026464(param0, 487);
return sub_02026464(pokedex, 487);
case 479:
return sub_02026958(param0, 479);
return sub_02026958(pokedex, 479);
default:
break;
}

View File

@ -12,6 +12,7 @@
#include "struct_defs/struct_0202FAA8.h"
#include "struct_defs/struct_0202FD30.h"
#include "struct_defs/struct_02030A80.h"
#include "constants/species.h"
#include "pokemon.h"
#include "struct_defs/struct_02078B40.h"
#include "struct_defs/struct_party.h"
@ -393,7 +394,7 @@ static BOOL sub_0202F794 (SaveData * param0, const BattleRecording * param1)
for (v4 = 0; v4 < 6; v4++) {
v6 = &(v0->unk_1150[v3].unk_04[v4]);
if (v6->species > 495) {
if (v6->species > MAX_SPECIES) {
return 0;
}
@ -673,7 +674,7 @@ u64 sub_0202FE98 (UnkStruct_0202F41C * param0, int param1, int param2)
case 0:
GF_ASSERT(param2 < 12);
if (param0->unk_00[param2] > 493) {
if (param0->unk_00[param2] > NATIONAL_DEX_COUNT) {
return 0;
}

View File

@ -6,14 +6,15 @@
#include "heap.h"
#include "savedata/save_table.h"
#include "constants/species.h"
#include "unk_020244AC.h"
#include "unk_0203061C.h"
#include "unk_02030880.h"
typedef struct {
u16 unk_00[495];
u16 unk_3DE[495];
u16 unk_7BC[495];
u16 unk_00[MAX_SPECIES];
u16 unk_3DE[MAX_SPECIES];
u16 unk_7BC[MAX_SPECIES];
u16 unk_B9A;
} UnkStruct_020308A0_sub1;

View File

@ -184,6 +184,7 @@
#include "unk_02071CD0.h"
#include "unk_02071D40.h"
#include "unk_020722AC.h"
#include "constants/species.h"
#include "pokemon.h"
#include "trainer_data.h"
#include "unk_020797C8.h"
@ -6605,7 +6606,7 @@ static BOOL sub_02044BE8 (UnkStruct_0203E724 * param0)
v3 = LCRNG_Next() % v2;
*v1 = 25;
for (v4 = 1, v5 = 0; v4 <= 493; v4++) {
for (v4 = 1, v5 = 0; v4 <= NATIONAL_DEX_COUNT; v4++) {
if ((sub_02026FE8(v0, v4) == 1) && (Pokemon_SinnohDexNumber(v4) != 0)) {
if (v5 == v3) {
*v1 = v4;

View File

@ -2,6 +2,7 @@
#include <string.h>
#include "inlines.h"
#include "constants/species.h"
#include "struct_decls/struct_0200B358_decl.h"
#include "strbuf.h"
@ -306,7 +307,7 @@ static void sub_0204BAAC (UnkStruct_0203CDB0 * param0, void * param1)
sub_0209304C(v4, v1, 4, sub_02017070(2, v12), 32);
if (Pokemon_GetValue(v4, MON_DATA_SPECIES, NULL) == 493) {
if (Pokemon_GetValue(v4, MON_DATA_SPECIES, NULL) == SPECIES_ARCEUS) {
if (Pokemon_GetValue(v4, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1) {
if (sub_0206B5F8(v2) == 0) {
sub_0206B608(v2, 1);

View File

@ -43,6 +43,7 @@
#include "unk_0204FA34.h"
#include "unk_020508D4.h"
#include "unk_0205DFC4.h"
#include "constants/species.h"
#include "pokemon.h"
#include "party.h"
#include "unk_0207A274.h"
@ -553,7 +554,7 @@ BOOL sub_0204F6D8 (UnkStruct_0203E724 * param0)
if (v0 != 1) {
v4 = 0;
} else {
for (v5 = 0; v5 < 493; v5++) {
for (v5 = 0; v5 < NATIONAL_DEX_COUNT; v5++) {
v4 += sub_020308BC(v9->unk_0C, v2,
0, v5);
;
@ -639,7 +640,7 @@ BOOL sub_0204F8A8 (UnkStruct_0203E724 * param0)
if (v0 != 1) {
v4 = 0;
} else {
for (v3 = 0; v3 < 493; v3++) {
for (v3 = 0; v3 < NATIONAL_DEX_COUNT; v3++) {
v2 = 0;
v2 += sub_020308BC(v5->unk_0C, v1,
@ -691,7 +692,7 @@ BOOL sub_0204F950 (UnkStruct_0203E724 * param0)
if (v0 != 1) {
v4 = 0;
} else {
for (v5 = 0; v5 < 493; v5++) {
for (v5 = 0; v5 < NATIONAL_DEX_COUNT; v5++) {
v4 += sub_020308BC(v6->unk_0C, v2,
0, v5);
;

View File

@ -22,6 +22,7 @@
#include "unk_020562F8.h"
#include "unk_0205DAC8.h"
#include "pokemon.h"
#include "constants/species.h"
typedef struct {
u16 unk_00;
@ -126,7 +127,7 @@ static void sub_02056400 (u32 param0, u8 * param1)
{
int v0;
GF_ASSERT(0 < param0 && param0 <= 493);
GF_ASSERT(0 < param0 && param0 <= NATIONAL_DEX_COUNT);
v0 = (param0 - 1) * 6;
NARC_ReadFromMemberByIndexPair(param1, NARC_INDEX_ARC__PPARK, 0, v0, sizeof(u8) * 6);

View File

@ -1,6 +1,8 @@
#include <nitro.h>
#include <string.h>
#include "constants/species.h"
#include "struct_decls/struct_020298B0_decl.h"
#include "struct_decls/struct_0202D060_decl.h"
#include "struct_decls/struct_0202D750_decl.h"
@ -519,7 +521,7 @@ u32 sub_0206C068 (SaveData * param0)
BOOL sub_0206C0D0 (UnkStruct_0203CDB0 * param0)
{
if (param0->unk_1C->unk_00 == 493) {
if (param0->unk_1C->unk_00 == SPECIES_ARCEUS) {
return 1;
}

View File

@ -60,6 +60,7 @@
#include "roaming_pokemon.h"
#include "unk_0206CCB0.h"
#include "unk_02071CFC.h"
#include "constants/species.h"
#include "pokemon.h"
#include "party.h"
#include "unk_0207D3B8.h"
@ -2761,9 +2762,9 @@ static int sub_0206F01C (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param
u16 v1, v2, v3;
const UnkStruct_02026324 * v4 = sub_02027560(param0->unk_0C);
v1 = (LCRNG_Next() % (493 - 1)) + 1;
v1 = (LCRNG_Next() % (NATIONAL_DEX_COUNT - 1)) + 1;
for (v2 = 1; v2 <= 493; v2++) {
for (v2 = 1; v2 <= NATIONAL_DEX_COUNT; v2++) {
if (sub_02026FE8(v4, v1) == 1) {
v3 = v1;
break;
@ -2771,7 +2772,7 @@ static int sub_0206F01C (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param
v1++;
if (v1 == 493) {
if (v1 == NATIONAL_DEX_COUNT) {
v1 = 1;
}
}
@ -2862,9 +2863,9 @@ static int sub_0206F160 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param
sub_0206CE74(param1, 0, Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL), Pokemon_GetValue(v3, MON_DATA_GENDER, NULL), TrainerInfo_RegionCode(v5), TrainerInfo_GameCode(v5));
sub_0200BFAC(param1, 1, (LCRNG_Next() % 100));
v1 = (LCRNG_Next() % (493 - 2) + 1);
v1 = (LCRNG_Next() % (NATIONAL_DEX_COUNT - 2) + 1);
for (v2 = 1; v2 <= 493; v2++) {
for (v2 = 1; v2 <= NATIONAL_DEX_COUNT; v2++) {
if (sub_02026FE8(v6, v1) == 1) {
v0 = sub_0206F0D8(v1, 4);
sub_0200B48C(param1, 2, v0, 0, 1, GAME_LANGUAGE);
@ -2874,7 +2875,7 @@ static int sub_0206F160 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param
v1++;
if (v1 >= 493) {
if (v1 >= NATIONAL_DEX_COUNT) {
v1 = 1;
}
}

View File

@ -82,36 +82,39 @@ SCHEMA = j2b.Parser() \
.register('evolutions', 44, parse_evolutions, optional=j2b.OptionalBehavior.PAD)
NATIONAL_DEX_COUNT = 493
# I'm not sure if this is correct? The form indices in-game are offset at NATIONAL_DEX_COUNT, not SPECIES_BAD_EGG
FORM_INDICES = {
'DEOXYS' : {
'ATTACK': 496,
'DEFENSE': 497,
'SPEED': 498,
'ATTACK': NATIONAL_DEX_COUNT + 3,
'DEFENSE': NATIONAL_DEX_COUNT + 4,
'SPEED': NATIONAL_DEX_COUNT + 5,
},
'WORMADAM': {
'SANDY': 499,
'TRASH': 500,
'SANDY': NATIONAL_DEX_COUNT + 6,
'TRASH': NATIONAL_DEX_COUNT + 7,
},
'GIRATINA': {
'ORIGIN': 501,
'ORIGIN': NATIONAL_DEX_COUNT + 8,
},
'SHAYMIN': {
'SKY': 502,
'SKY': NATIONAL_DEX_COUNT + 9,
},
'ROTOM': {
'HEAT': 503,
'WASH': 504,
'FROST': 505,
'FAN': 506,
'MOW': 507,
'HEAT': NATIONAL_DEX_COUNT + 10,
'WASH': NATIONAL_DEX_COUNT + 11,
'FROST': NATIONAL_DEX_COUNT + 12,
'FAN': NATIONAL_DEX_COUNT + 13,
'MOW': NATIONAL_DEX_COUNT + 14,
},
}
def indexer(file_path: pathlib.Path) -> int:
name = file_path.parent.stem.upper()
if name == '000': return 0
if name == 'egg': return 494
if name == 'bad_egg': return 495
if name == 'egg': return NATIONAL_DEX_COUNT + 1
if name == 'bad_egg': return NATIONAL_DEX_COUNT + 2
if file_path.parent.parent.stem == 'forms':
species_idx = file_path.parent.parent.parent.stem.upper()
form = file_path.parent.stem.upper()

View File

@ -55,35 +55,39 @@ SCHEMA = j2b.Parser() \
.register('learnset.tms', 16, j2b.pack_flags, tm_learnset.TMLearnsetFlags)
NATIONAL_DEX_COUNT = 493
# I'm not sure if this is correct? The form indices in-game are offset at NATIONAL_DEX_COUNT, not SPECIES_BAD_EGG
FORM_INDICES = {
'DEOXYS' : {
'ATTACK': 496,
'DEFENSE': 497,
'SPEED': 498,
'ATTACK': NATIONAL_DEX_COUNT + 3,
'DEFENSE': NATIONAL_DEX_COUNT + 4,
'SPEED': NATIONAL_DEX_COUNT + 5,
},
'WORMADAM': {
'SANDY': 499,
'TRASH': 500,
'SANDY': NATIONAL_DEX_COUNT + 6,
'TRASH': NATIONAL_DEX_COUNT + 7,
},
'GIRATINA': {
'ORIGIN': 501,
'ORIGIN': NATIONAL_DEX_COUNT + 8,
},
'SHAYMIN': {
'SKY': 502,
'SKY': NATIONAL_DEX_COUNT + 9,
},
'ROTOM': {
'HEAT': 503,
'WASH': 504,
'FROST': 505,
'FAN': 506,
'MOW': 507,
'HEAT': NATIONAL_DEX_COUNT + 10,
'WASH': NATIONAL_DEX_COUNT + 11,
'FROST': NATIONAL_DEX_COUNT + 12,
'FAN': NATIONAL_DEX_COUNT + 13,
'MOW': NATIONAL_DEX_COUNT + 14,
},
}
def indexer(file_path: pathlib.Path) -> int:
name = file_path.parent.stem.upper()
if name == '000': return 0
if name == 'egg': return 494
if name == 'bad_egg': return 495
if name == 'egg': return NATIONAL_DEX_COUNT + 1
if name == 'bad_egg': return NATIONAL_DEX_COUNT + 2
if file_path.parent.parent.stem == 'forms':
species_idx = file_path.parent.parent.parent.stem.upper()
form = file_path.parent.stem.upper()

View File

@ -34,37 +34,39 @@ SCHEMA = j2b.Parser() \
.align(4)
NATIONAL_DEX_COUNT = 493
# I'm not sure if this is correct? The form indices in-game are offset at NATIONAL_DEX_COUNT, not SPECIES_BAD_EGG
FORM_INDICES = {
'DEOXYS' : {
'ATTACK': 496,
'DEFENSE': 497,
'SPEED': 498,
'ATTACK': NATIONAL_DEX_COUNT + 3,
'DEFENSE': NATIONAL_DEX_COUNT + 4,
'SPEED': NATIONAL_DEX_COUNT + 5,
},
'WORMADAM': {
'SANDY': 499,
'TRASH': 500,
'SANDY': NATIONAL_DEX_COUNT + 6,
'TRASH': NATIONAL_DEX_COUNT + 7,
},
'GIRATINA': {
'ORIGIN': 501,
'ORIGIN': NATIONAL_DEX_COUNT + 8,
},
'SHAYMIN': {
'SKY': 502,
'SKY': NATIONAL_DEX_COUNT + 9,
},
'ROTOM': {
'HEAT': 503,
'WASH': 504,
'FROST': 505,
'FAN': 506,
'MOW': 507,
'HEAT': NATIONAL_DEX_COUNT + 10,
'WASH': NATIONAL_DEX_COUNT + 11,
'FROST': NATIONAL_DEX_COUNT + 12,
'FAN': NATIONAL_DEX_COUNT + 13,
'MOW': NATIONAL_DEX_COUNT + 14,
},
}
def indexer(file_path: pathlib.Path) -> int:
name = file_path.parent.stem.upper()
if name == '000': return 0
if name == 'egg': return 494
if name == 'bad_egg': return 495
if name == 'egg': return NATIONAL_DEX_COUNT + 1
if name == 'bad_egg': return NATIONAL_DEX_COUNT + 2
if file_path.parent.parent.stem == 'forms':
species_idx = file_path.parent.parent.parent.stem.upper()
form = file_path.parent.stem.upper()