From b402d1397bf71e577beadadcab8449d76bb34420 Mon Sep 17 00:00:00 2001 From: Bepis <36346617+bbepis@users.noreply.github.com> Date: Tue, 13 Feb 2024 06:34:31 +1100 Subject: [PATCH] Generate footprint size data table --- consts/pokemon.json | 9 + include/overlay113/FootprintSizeData.h | 10 + include/overlay113/ov113_02260620.h | 4 +- include/overlay113/struct_ov113_02260D90.h | 10 - res/pokemon/meson.build | 1 + src/overlay113/ov113_0225C700.c | 2 +- src/overlay113/ov113_0225E368.c | 4 +- src/overlay113/ov113_02260620.c | 517 +-------------------- tools/scripts/make_species_tables.py | 43 +- 9 files changed, 77 insertions(+), 523 deletions(-) create mode 100644 include/overlay113/FootprintSizeData.h delete mode 100644 include/overlay113/struct_ov113_02260D90.h diff --git a/consts/pokemon.json b/consts/pokemon.json index 5e8eecb77e..955e48468b 100644 --- a/consts/pokemon.json +++ b/consts/pokemon.json @@ -166,6 +166,15 @@ "GENDER_RATIO_FEMALE_ONLY": 254, "GENDER_RATIO_NO_GENDER": 255 } + }, + "@PokemonFootprintSize": { + "type": "enum", + "as_preproc": true, + "values": [ + "FOOTPRINT_SMALL", + "FOOTPRINT_MEDIUM", + "FOOTPRINT_LARGE" + ] } } } diff --git a/include/overlay113/FootprintSizeData.h b/include/overlay113/FootprintSizeData.h new file mode 100644 index 0000000000..1555fb0c62 --- /dev/null +++ b/include/overlay113/FootprintSizeData.h @@ -0,0 +1,10 @@ +#ifndef POKEPLATINUM_FOOTPRINTSIZEDATA_H +#define POKEPLATINUM_FOOTPRINTSIZEDATA_H + +typedef struct FootprintSizeData { + u8 hasFootprint; + u8 footprintSize; + u16 unk_02; +} FootprintSizeData; + +#endif // POKEPLATINUM_FOOTPRINTSIZEDATA_H diff --git a/include/overlay113/ov113_02260620.h b/include/overlay113/ov113_02260620.h index 8e1a07bf13..1cb2437bce 100644 --- a/include/overlay113/ov113_02260620.h +++ b/include/overlay113/ov113_02260620.h @@ -11,7 +11,7 @@ void ov113_02260620(MessageLoader * param0, StringTemplate * param1, Window para void ov113_02260714(Window param0[], u32 param1); u16 ov113_0226072C(int param0, u32 param1); int ov113_02260748(UnkStruct_ov113_02260818 * param0, int param1); -BOOL ov113_02260788(int param0, int param1, BOOL param2); -BOOL ov113_022607B8(int param0, int param1); +BOOL PokemonHasOverworldFootprint(int param0, int param1, BOOL param2); +int PokemonOverworldFootprintSize(int param0, int param1); #endif // POKEPLATINUM_OV113_02260620_H diff --git a/include/overlay113/struct_ov113_02260D90.h b/include/overlay113/struct_ov113_02260D90.h deleted file mode 100644 index 30c6151e53..0000000000 --- a/include/overlay113/struct_ov113_02260D90.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_OV113_02260D90_H -#define POKEPLATINUM_STRUCT_OV113_02260D90_H - -typedef struct { - u8 unk_00; - u8 unk_01; - u16 unk_02; -} UnkStruct_ov113_02260D90; - -#endif // POKEPLATINUM_STRUCT_OV113_02260D90_H diff --git a/res/pokemon/meson.build b/res/pokemon/meson.build index 110c1e45f5..c5c63cf52d 100644 --- a/res/pokemon/meson.build +++ b/res/pokemon/meson.build @@ -778,6 +778,7 @@ gen_species_headers = custom_target('auto-generated species headers', output: 'gen_species_headers', input: personal_files, env: json2bin_env, + depends: [ py_consts_generators ], command: [ make_species_tables_py, '--source-dir', '@CURRENT_SOURCE_DIR@', diff --git a/src/overlay113/ov113_0225C700.c b/src/overlay113/ov113_0225C700.c index e6b9c3f6f8..0277172d36 100644 --- a/src/overlay113/ov113_0225C700.c +++ b/src/overlay113/ov113_0225C700.c @@ -1139,7 +1139,7 @@ static BOOL ov113_0225D938 (int param0, int param1, CellActorData * param2, NARC return 0; } - if (ov113_02260788(param0, param1, param6) == 1) { + if (PokemonHasOverworldFootprint(param0, param1, param6) == 1) { v2 = sub_0200723C(param4, 3 + param0, 1, 118, 1); NNS_G2dGetUnpackedCharacterData(v2, &v3); DC_FlushRange(v3->pRawData, 0x20 * 8); diff --git a/src/overlay113/ov113_0225E368.c b/src/overlay113/ov113_0225E368.c index cb2c9579d5..ce118f1b7a 100644 --- a/src/overlay113/ov113_0225E368.c +++ b/src/overlay113/ov113_0225E368.c @@ -682,7 +682,7 @@ static void ov113_0225E920 (NNSG3dResTex * param0, NARC * param1, NARC * param2, NNSG2dCharacterData * v3; int v4; - v4 = ov113_02260788(param3->unk_02, param3->unk_08, param4); + v4 = PokemonHasOverworldFootprint(param3->unk_02, param3->unk_08, param4); v1 = (u8 *)((u8 *)param0 + param0->texInfo.ofsTex); if (v4 == 1) { @@ -920,7 +920,7 @@ static void ov113_0225ECA0 (UnkStruct_02017294 * param0, const UnkStruct_ov113_0 int v6; fx64 v7, v8, v9, v10; - v6 = ov113_022607B8(param1->unk_02, param1->unk_08); + v6 = PokemonOverworldFootprintSize(param1->unk_02, param1->unk_08); GF_ASSERT(v6 < NELEMS(Unk_ov113_02260C38)); sub_02017358(param0, &v0, &v1, &v2); diff --git a/src/overlay113/ov113_02260620.c b/src/overlay113/ov113_02260620.c index 30b5184f4b..8fc0bc0a6b 100644 --- a/src/overlay113/ov113_02260620.c +++ b/src/overlay113/ov113_02260620.c @@ -10,7 +10,7 @@ #include "touch_screen.h" #include "struct_defs/struct_0205AA50.h" #include "overlay113/struct_ov113_02260818.h" -#include "overlay113/struct_ov113_02260D90.h" +#include "overlay113/FootprintSizeData.h" #include "message.h" #include "constants/species.h" @@ -36,503 +36,7 @@ __attribute__((aligned(4))) static const u16 Unk_ov113_02260D6C[][2] = { { 0x2D4A, 0x5651 } }; -// 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 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x0 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x0, 0x2 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x2 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x1, 0x0 }, - { 0x0, 0x2 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x0 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x0, 0x2 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x1 }, - { 0x1, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x0, 0x2 }, - { 0x1, 0x0 }, - { 0x1, 0x1 }, - { 0x1, 0x0 } -}; +#include "res/pokemon/footprint_data.h" static const TouchScreenRect Unk_ov113_02260D4C[] = { {0xA0, 0xC0, 0x0, 0x20}, @@ -643,24 +147,27 @@ int ov113_02260748 (UnkStruct_ov113_02260818 * param0, int param1) return v1; } -BOOL ov113_02260788 (int param0, int param1, BOOL param2) +// canShowArceus is a flag pulled from wifi room data that dictates whether or not Arceus is allowed to be seen. +// The contexts where Arceus is allowed to be seen is unclear. I haven't seen any case where this could be true +// Seems to be from a cut feature where you could have pokemon out walking around while being in a wifi room. Amity square? +BOOL PokemonHasOverworldFootprint (int species, int form, BOOL canShowArceus) { - if ((param0 == 487) && (param1 > 0)) { + if ((species == SPECIES_GIRATINA) && (form > 0)) { return 0; } - if ((param0 == SPECIES_ARCEUS) && (param2 == 0)) { + if ((species == SPECIES_ARCEUS) && (canShowArceus == 0)) { return 0; } - return Unk_ov113_02260D90[param0].unk_00; + return sSpeciesFootprintData[species].hasFootprint; } -BOOL ov113_022607B8 (int param0, int param1) +int PokemonOverworldFootprintSize (int species, int form) { - if ((param0 == 487) && (param1 > 0)) { + if ((species == SPECIES_GIRATINA) && (form > 0)) { return 2; } - return Unk_ov113_02260D90[param0].unk_01; + return sSpeciesFootprintData[species].footprintSize; } diff --git a/tools/scripts/make_species_tables.py b/tools/scripts/make_species_tables.py index bb4874a5d5..cbc5b39177 100644 --- a/tools/scripts/make_species_tables.py +++ b/tools/scripts/make_species_tables.py @@ -5,6 +5,7 @@ import pathlib import sys from consts.moves import Move from consts.species import PokemonSpecies +from consts.pokemon import PokemonFootprintSize argparser = argparse.ArgumentParser( @@ -90,7 +91,10 @@ FORM_INDICES = { }, } -species_sets = {} +species_movesets = {} +species_footprints = { + 0: { "has_footprint": False, "footprint_size": "FOOTPRINT_SMALL" } +} for file_path in source_dir.glob("**/data.json"): with open(file_path, 'r') as data_file: @@ -101,12 +105,16 @@ for file_path in source_dir.glob("**/data.json"): if species_name in ["000", "EGG", "BAD_EGG"]: continue + isForm = False + if file_path.parent.parent.stem == "forms": form_name = species_name species_name = file_path.parent.parent.parent.stem.upper() species_id = FORM_INDICES[species_name][form_name] + + isForm = True else: species_id = PokemonSpecies[f"SPECIES_{species_name}"].value @@ -124,7 +132,10 @@ for file_path in source_dir.glob("**/data.json"): for tutor_move in species_data["learnset"]["tutor"]: set_bit(moveset.index(Move[tutor_move])) - species_sets[species_id] = byte_array + species_movesets[species_id] = byte_array + + if not isForm: + species_footprints[species_id] = species_data["footprint"] generated_disclaimer = [ @@ -132,6 +143,7 @@ generated_disclaimer = [ "// Check make_species_tables.py for reference\n", ] +# write moveset table header output_path = output_dir / "tutor_movesets.h" with open(output_path, "w") as output_file: @@ -143,7 +155,7 @@ with open(output_path, "w") as output_file: output_file.write("\n") output_file.write("const MovesetMask sTeachableMovesets[MOVESET_MAX] = {\n") - sorted_array = sorted(species_sets.items()) + sorted_array = sorted(species_movesets.items()) for key, value in sorted_array: struct = ''.join([f" 0x{i:X},".ljust(6) for i in value]) @@ -152,3 +164,28 @@ with open(output_path, "w") as output_file: output_file.write("};\n") output_file.write("\n#endif\n") + + +# write footprint table header +output_path = output_dir / "footprint_data.h" + +with open(output_path, "w") as output_file: + output_file.writelines(generated_disclaimer) + output_file.write("#ifndef POKEPLATINUM_GENERATED_FOOTPRINT_DATA_H\n") + output_file.write("#define POKEPLATINUM_GENERATED_FOOTPRINT_DATA_H\n") + output_file.write("#include \"overlay113/FootprintSizeData.h\"\n") + output_file.write("#include \"constants/species.h\"\n") + output_file.write("\n") + output_file.write("static const FootprintSizeData sSpeciesFootprintData[NATIONAL_DEX_COUNT + 1] = {\n") + + sorted_array = sorted(species_footprints.items()) + + for key, value in sorted_array: + + has_footprint = "TRUE" if species_footprints[key]["has_footprint"] else "FALSE" + footprint_size = PokemonFootprintSize[species_footprints[key]["footprint_size"]].value + + output_file.write(f" {{ {has_footprint}, {footprint_size} }},\n") + + output_file.write("};\n") + output_file.write("\n#endif\n")