From ff273825aa2c696bbcc019750f15d8a979d41c77 Mon Sep 17 00:00:00 2001 From: csaldiasdev Date: Mon, 6 Jul 2026 13:21:33 -0400 Subject: [PATCH] rename: 7 type-lookup functions in src/232C0.{c,h} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 3 of rename-plan.md: rename the species type/gender/ growth-rate/egg-group/habitat lookups plus the move-type lookup. Each function reads from a per-species or per-move table. func_80022A28 → GetMoveType reads gMoveType[moveId] func_80022A38 → GetSpeciesType1 reads gSpeciesType1[species] func_80022A60 → GetSpeciesType2 reads gSpeciesType2[species] func_80022A88 → GetSpeciesGrowthRate reads gSpeciesGrowthRate[species] func_80022A98 → GetSpeciesEggGroup reads gSpeciesEggGroup[species] func_80022AA8 → GetSpeciesGenderRatio reads gSpeciesGenderRatio[species] func_80022ACC → GetSpeciesHabitat reads gSpeciesHabitat[species] Touches src/232C0.{c,h} (declarations + definitions), src/22630.c (stat calc usage), src/fragments/24/* and src/fragments/62/* (callers), and include/pokemon.h (comment reference to func_80022A60). Still matching: md5 ed1378bc… (verified by `make`) --- include/pokemon.h | 2 +- src/22630.c | 6 +++--- src/232C0.c | 16 ++++++++-------- src/232C0.h | 14 +++++++------- src/fragments/24/fragment24_1CEA00.c | 2 +- src/fragments/24/fragment24_1D7B40.c | 2 +- src/fragments/62/fragment62_2EC3C0.c | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/include/pokemon.h b/include/pokemon.h index 1a10462..b61b3b4 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -9,7 +9,7 @@ // The codebase uses 1-indexed species IDs throughout. ID 0 is reserved as // "no species / invalid". The canonical Gen-1 range is 1..NATIONAL_DEX_COUNT. // -// Several internal APIs (func_80022A60, the moves/effects tables) accept a +// Several internal APIs (GetSpeciesType2, the moves/effects tables) accept a // wider range up to SPECIES_EXTENDED_MAX to accommodate Pokemon Stadium- // specific IDs beyond the national dex (glitch forms, event Pokemon, etc.). // SPECIES_BLANK is the sentinel returned when a lookup fails or the input diff --git a/src/22630.c b/src/22630.c index 6f0daad..34084b9 100644 --- a/src/22630.c +++ b/src/22630.c @@ -119,7 +119,7 @@ char* func_80021CE0(s32 arg0, char* arg1) { } void func_80021D9C(unk_func_80026268_arg0* arg0, unk_D_800AE4E8_004_1_000_010_000* arg1) { - arg0->unk_00.unk_00 = func_80022A60(arg1->unk_00); + arg0->unk_00.unk_00 = GetSpeciesType2(arg1->unk_00); arg0->unk_00.unk_01 = arg1->unk_00; arg0->unk_02 = func_80021A30(arg1->unk_01); @@ -153,8 +153,8 @@ void func_80021E90(unk_func_80026268_arg0* arg0, unk_D_800AC910_050_9AC_008* arg } void func_80021F04(unk_func_80026268_arg0* arg0, unk_D_800AE4E8_004_1_000_010_000* arg1) { - if (func_80022A38(arg0->unk_00.unk_00) & 0xFF) { - arg1->unk_00 = func_80022A38(arg0->unk_00.unk_00); + if (GetSpeciesType1(arg0->unk_00.unk_00) & 0xFF) { + arg1->unk_00 = GetSpeciesType1(arg0->unk_00.unk_00); } else { arg1->unk_00 = arg0->unk_00.unk_01; } diff --git a/src/232C0.c b/src/232C0.c index 02e87a6..1a9ed1b 100644 --- a/src/232C0.c +++ b/src/232C0.c @@ -107,13 +107,13 @@ s32 func_80022A04(u16* arg0, unk_D_800AC910_040* arg1) { return !bcmp(arg0, arg1, 0xD); } -u8 func_80022A28(s32 arg0) { +u8 GetMoveType(s32 arg0) { extern u8 gMoveType[]; return gMoveType[arg0]; } -u8 func_80022A38(s32 arg0) { +u8 GetSpeciesType1(s32 arg0) { if ((arg0 <= 0) || (arg0 > NATIONAL_DEX_COUNT)) { return 0; } @@ -121,7 +121,7 @@ u8 func_80022A38(s32 arg0) { return gSpeciesType1[arg0]; } -s32 func_80022A60(s32 arg0) { +s32 GetSpeciesType2(s32 arg0) { if ((arg0 <= 0) || (arg0 > SPECIES_EXTENDED_MAX)) { return SPECIES_BLANK; } @@ -129,19 +129,19 @@ s32 func_80022A60(s32 arg0) { return gSpeciesType2[arg0]; } -u8 func_80022A88(s32 arg0) { +u8 GetSpeciesGrowthRate(s32 arg0) { extern u8 gSpeciesGrowthRate[]; return gSpeciesGrowthRate[arg0]; } -u8 func_80022A98(s32 arg0) { +u8 GetSpeciesEggGroup(s32 arg0) { extern u8 gSpeciesEggGroup[]; return gSpeciesEggGroup[arg0]; } -s32 func_80022AA8(s32 arg0) { +s32 GetSpeciesGenderRatio(s32 arg0) { extern u8 gSpeciesGenderRatio[]; if (arg0 == 0) { @@ -150,7 +150,7 @@ s32 func_80022AA8(s32 arg0) { return gSpeciesGenderRatio[arg0] + 1; } -s32 func_80022ACC(s32 arg0) { +s32 GetSpeciesHabitat(s32 arg0) { extern u8 gSpeciesHabitat[]; if (arg0 == 0) { @@ -1328,7 +1328,7 @@ void func_80025498(char* arg0, s32 arg1, u8* arg2) { s32 h; while (arg1-- > 0) { - temp_v0 = func_80022A60(*arg2++); + temp_v0 = GetSpeciesType2(*arg2++); if (0x98 != temp_v0) { temp_v0++; temp_v0--; diff --git a/src/232C0.h b/src/232C0.h index 38970bf..db0cd6c 100644 --- a/src/232C0.h +++ b/src/232C0.h @@ -37,13 +37,13 @@ void func_800228B0(unk_func_80026268_arg0* arg0); s32 func_800228F0(unk_func_800228F0*, u16); void func_80022978(unk_func_80026268_arg0* arg0, s16 arg1, u8 arg2); s32 func_80022A04(u16* arg0, unk_D_800AC910_040* arg1); -u8 func_80022A28(s32 arg0); -u8 func_80022A38(s32 arg0); -s32 func_80022A60(s32 arg0); -u8 func_80022A88(s32 arg0); -u8 func_80022A98(s32 arg0); -s32 func_80022AA8(s32 arg0); -s32 func_80022ACC(s32 arg0); +u8 GetMoveType(s32 arg0); +u8 GetSpeciesType1(s32 arg0); +s32 GetSpeciesType2(s32 arg0); +u8 GetSpeciesGrowthRate(s32 arg0); +u8 GetSpeciesEggGroup(s32 arg0); +s32 GetSpeciesGenderRatio(s32 arg0); +s32 GetSpeciesHabitat(s32 arg0); void func_80022AF0(unk_func_80022C28_ret* arg0); void func_80022B88(unk_func_80022C28_ret* arg0); unk_func_80022C28_ret* func_80022C28(s32 arg0, s32 arg1, s32 arg2, s32 arg3); diff --git a/src/fragments/24/fragment24_1CEA00.c b/src/fragments/24/fragment24_1CEA00.c index ad4126a..aa84128 100644 --- a/src/fragments/24/fragment24_1CEA00.c +++ b/src/fragments/24/fragment24_1CEA00.c @@ -1805,7 +1805,7 @@ void func_88305CDC(unk_func_8830867C_02C_0CC_000* arg0, unk_func_8830867C_04C_03 var_a0 = arg1->unk_00[0]->unk_00 - 0x92; } - ptr->unk_09[arg2] = func_80022A28(var_a0); + ptr->unk_09[arg2] = GetMoveType(var_a0); ptr->unk_20[arg2] = func_8002ED40(ptr->unk_09[arg2])->pp; if (arg1->unk_00[0]->unk_00 >= 0xC9) { diff --git a/src/fragments/24/fragment24_1D7B40.c b/src/fragments/24/fragment24_1D7B40.c index 8a2b22f..d407c16 100644 --- a/src/fragments/24/fragment24_1D7B40.c +++ b/src/fragments/24/fragment24_1D7B40.c @@ -3133,7 +3133,7 @@ s32 func_88311D6C(s32 arg0, unk_func_8830867C_02C_0CC_000_008* arg1) { temp_v0 = func_8002ECDC(arg1); var_s4 = 0; for (i = 0; i < temp_v0; i++) { - if (func_80022A28(var_s3) == arg1->unk_09[i]) { + if (GetMoveType(var_s3) == arg1->unk_09[i]) { break; } } diff --git a/src/fragments/62/fragment62_2EC3C0.c b/src/fragments/62/fragment62_2EC3C0.c index a62a4e6..9327277 100644 --- a/src/fragments/62/fragment62_2EC3C0.c +++ b/src/fragments/62/fragment62_2EC3C0.c @@ -303,7 +303,7 @@ void func_843021E8(unk_D_84390010* arg0, u16 arg1, unk_D_84390010_94C* arg2, unk var_a0 = temp_s4->unk_0F[j / 8]; } - if (((var_a0 >> (j % 8)) & 1) && (func_80022A28(j) == temp_s5->unk_1F[i])) { + if (((var_a0 >> (j % 8)) & 1) && (GetMoveType(j) == temp_s5->unk_1F[i])) { arg0->unk_654.unk_C1[i] = 0; } }