From 10275fd56eb4ed8b30927a1515c9b9ea4805630c Mon Sep 17 00:00:00 2001 From: wildfire Date: Tue, 5 Sep 2023 10:47:46 +0100 Subject: [PATCH 01/11] Document RNG Functions --- include/inlines.h | 2 +- include/unk_0201D15C.h | 12 ++-- src/main.c | 4 +- src/overlay005/ov5_021D5EB8.c | 118 ++++++++++++++++---------------- src/overlay005/ov5_021DB888.c | 2 +- src/overlay005/ov5_021E622C.c | 18 ++--- src/overlay005/ov5_021EB1A0.c | 4 +- src/overlay005/ov5_021F08CC.c | 2 +- src/overlay005/ov5_021F6454.c | 2 +- src/overlay006/ov6_02240C9C.c | 6 +- src/overlay006/ov6_022426AC.c | 2 +- src/overlay006/ov6_022465FC.c | 2 +- src/overlay006/ov6_02246A30.c | 2 +- src/overlay008/ov8_02249960.c | 6 +- src/overlay009/ov9_02249960.c | 2 +- src/overlay010/ov10_0221F800.c | 4 +- src/overlay012/ov12_02226B84.c | 12 ++-- src/overlay012/ov12_0222D6B0.c | 12 ++-- src/overlay012/ov12_02235E94.c | 6 +- src/overlay016/ov16_0223B140.c | 4 +- src/overlay016/ov16_0226871C.c | 2 +- src/overlay022/ov22_02257F50.c | 4 +- src/overlay022/ov22_022589E0.c | 4 +- src/overlay023/ov23_0223E140.c | 2 +- src/overlay023/ov23_0224340C.c | 4 +- src/overlay023/ov23_02248F1C.c | 4 +- src/overlay023/ov23_0224DC40.c | 2 +- src/overlay033/ov33_02256474.c | 4 +- src/overlay041/ov41_022567B0.c | 2 +- src/overlay042/ov42_022561C0.c | 2 +- src/overlay057/ov57_021D0D80.c | 4 +- src/overlay065/ov65_02235060.c | 6 +- src/overlay066/ov66_0222DDF0.c | 2 +- src/overlay070/ov70_0225C9B4.c | 2 +- src/overlay070/ov70_02260B44.c | 6 +- src/overlay070/ov70_022630A4.c | 4 +- src/overlay070/ov70_02266E9C.c | 2 +- src/overlay077/ov77_021D25B0.c | 6 +- src/overlay077/ov77_021D6670.c | 8 +-- src/overlay083/ov83_0223D6A8.c | 8 +-- src/overlay083/ov83_0223F7F4.c | 2 +- src/overlay086/ov86_0223B140.c | 20 +++--- src/overlay095/ov95_02248590.c | 10 +-- src/overlay097/ov97_0222D30C.c | 40 +++++------ src/overlay099/ov99_021D4134.c | 6 +- src/overlay100/ov100_021D13E4.c | 4 +- src/overlay100/ov100_021D1C44.c | 2 +- src/overlay100/ov100_021D400C.c | 6 +- src/overlay101/ov101_021D1A28.c | 6 +- src/overlay104/ov104_0222DCE0.c | 6 +- src/overlay104/ov104_0222FBE4.c | 2 +- src/overlay104/ov104_022339B4.c | 2 +- src/overlay104/ov104_02237DD8.c | 2 +- src/overlay104/ov104_0223A7F4.c | 6 +- src/overlay104/ov104_0223AF58.c | 8 +-- src/overlay104/ov104_0223B6F4.c | 2 +- src/overlay104/ov104_0223BCBC.c | 2 +- src/overlay108/ov108_02241AE0.c | 10 +-- src/overlay109/ov109_021D0D80.c | 2 +- src/overlay111/ov111_021D0D80.c | 10 +-- src/overlay114/ov114_0225C700.c | 2 +- src/overlay115/ov115_02260CEC.c | 2 +- src/overlay116/ov116_02260440.c | 2 +- src/overlay116/ov116_022604C4.c | 4 +- src/overlay116/ov116_02262A8C.c | 8 +-- src/overlay117/ov117_02263AF0.c | 38 +++++----- src/poffin.c | 2 +- src/unk_02006224.c | 2 +- src/unk_02014D38.c | 2 +- src/unk_0201D15C.c | 88 ++++++++++++------------ src/unk_020244AC.c | 2 +- src/unk_0202854C.c | 2 +- src/unk_0202B37C.c | 4 +- src/unk_0202D7A8.c | 4 +- src/unk_02030CE8.c | 2 +- src/unk_0203D1B8.c | 8 +-- src/unk_0203E880.c | 8 +-- src/unk_0203F6C4.c | 20 +++--- src/unk_02048BD0.c | 2 +- src/unk_02049D08.c | 2 +- src/unk_0204B830.c | 8 +-- src/unk_0204CDDC.c | 4 +- src/unk_0205B33C.c | 12 ++-- src/unk_0206450C.c | 4 +- src/unk_0206AFE0.c | 12 ++-- src/unk_0206CCB0.c | 36 +++++----- src/unk_02073C2C.c | 32 ++++----- src/unk_02079170.c | 20 +++--- src/unk_0208694C.c | 6 +- src/unk_020933F8.c | 10 +-- src/unk_02094EDC.c | 4 +- src/unk_020961E8.c | 2 +- 92 files changed, 401 insertions(+), 401 deletions(-) diff --git a/include/inlines.h b/include/inlines.h index ff297313df..d077e63d04 100644 --- a/include/inlines.h +++ b/include/inlines.h @@ -216,7 +216,7 @@ inline u16 inline_020564D0 (const u16 param0) u16 v0; u16 v1; v0 = (0xffff / param0) + 1; - v1 = sub_0201D2E8() / v0; + v1 = LCRNG_Next() / v0; GF_ASSERT((v1 < param0)); return v1; diff --git a/include/unk_0201D15C.h b/include/unk_0201D15C.h index fb74f74113..5e33ebd019 100644 --- a/include/unk_0201D15C.h +++ b/include/unk_0201D15C.h @@ -12,12 +12,12 @@ u16 sub_0201D278(u16 param0); u16 sub_0201D2A4(u16 param0); fx32 sub_0201D2B8(fx32 param0); fx32 sub_0201D2C4(fx32 param0); -u32 sub_0201D2D0(void); -void sub_0201D2DC(u32 param0); -u16 sub_0201D2E8(void); -u32 sub_0201D30C(u32 param0); -void sub_0201D318(u32 param0); -u32 sub_0201D35C(void); +u32 LCRNG_GetSeed(void); +void LCRNG_SetSeed(u32 seed); +u16 LCRNG_Next(void); +u32 ARNG_Next(u32 seed); +void MTRNG_SetSeed(u32 seed); +u32 MTRNG_Next(void); void sub_0201D470(MtxFx22 * param0, u16 param1, fx32 param2, fx32 param3, u8 param4); s32 sub_0201D4CC(s32 param0, s32 param1, s32 param2, s32 param3, u32 param4); s32 sub_0201D580(u16 param0, s32 param1); diff --git a/src/main.c b/src/main.c index a2849d42f4..7f560ad6d3 100644 --- a/src/main.c +++ b/src/main.c @@ -323,8 +323,8 @@ void sub_02001028 (void) v2 = v0.year + v0.month * 0x100 * v0.day * 0x10000 + v1.hour * 0x10000 + (v1.minute + v1.second) * 0x1000000 + Unk_021BF67C.unk_2C; - sub_0201D318(v2); - sub_0201D2DC(v2); + MTRNG_SetSeed(v2); + LCRNG_SetSeed(v2); } void sub_0200106C (void) diff --git a/src/overlay005/ov5_021D5EB8.c b/src/overlay005/ov5_021D5EB8.c index 1cac6fafb6..5e24fa5a52 100644 --- a/src/overlay005/ov5_021D5EB8.c +++ b/src/overlay005/ov5_021D5EB8.c @@ -2240,7 +2240,7 @@ static void ov5_021D78A4 (UnkStruct_ov5_021DB4B8 * param0, int param1) } v3 = (s32 *)v1->unk_08; - v6 = sub_0201D35C(); + v6 = MTRNG_Next(); v3[0] = 0; v4 = v6 % 3; @@ -2289,7 +2289,7 @@ static void ov5_021D7960 (UnkStruct_ov5_021D6FA8 * param0) v2[0] += 2; if (v2[0] > v2[1]) { - if ((sub_0201D35C() % 10) < 7) { + if ((MTRNG_Next() % 10) < 7) { v2[3] = 2; } else { v2[3] = 1; @@ -2442,7 +2442,7 @@ static void ov5_021D7C40 (UnkStruct_ov5_021DB4B8 * param0, int param1) } v4 = (s32 *)v2->unk_08; - v5 = sub_0201D35C() % 4; + v5 = MTRNG_Next() % 4; sub_02021E50(v2->unk_04, v5); @@ -2451,7 +2451,7 @@ static void ov5_021D7C40 (UnkStruct_ov5_021DB4B8 * param0, int param1) v4[6] = 0; v4[8] = 0; - v1 = sub_0201D35C(); + v1 = MTRNG_Next(); v4[9] = 4 + (v1 % 60); @@ -2461,17 +2461,17 @@ static void ov5_021D7C40 (UnkStruct_ov5_021DB4B8 * param0, int param1) v4[1] = -1; } - v4[2] = 4 + (sub_0201D35C() % 2); - v4[3] = 1 + (sub_0201D35C() % 2); + v4[2] = 4 + (MTRNG_Next() % 2); + v4[3] = 1 + (MTRNG_Next() % 2); v4[0] = (s32) & v3->unk_B4[1]; v4[7] = (s32) & v3->unk_B4[2]; - v6.x = (-32 + (sub_0201D35C() % 414)) << FX32_SHIFT; + v6.x = (-32 + (MTRNG_Next() % 414)) << FX32_SHIFT; if ((v3->unk_B4[1] == 1) && (v0 >= (param1 / 2))) { - v6.y = (-40 - (sub_0201D35C() % 20)) << FX32_SHIFT; + v6.y = (-40 - (MTRNG_Next() % 20)) << FX32_SHIFT; } else { - v6.y = (-8 - (sub_0201D35C() % 20)) << FX32_SHIFT; + v6.y = (-8 - (MTRNG_Next() % 20)) << FX32_SHIFT; } ov5_021D630C(v2->unk_04, &v6); @@ -2682,7 +2682,7 @@ static void ov5_021D8098 (UnkStruct_ov5_021DB4B8 * param0, int param1) v4[5] = v5[v2]; v4[0] = 0; - v4[1] = 4 + (sub_0201D35C() % (46 - 4)); + v4[1] = 4 + (MTRNG_Next() % (46 - 4)); v7 = (v4[1] - 4) / (((46 - 4) / 3) + 1); sub_02021E50(v1->unk_04, v7); @@ -2694,7 +2694,7 @@ static void ov5_021D8098 (UnkStruct_ov5_021DB4B8 * param0, int param1) { VecFx32 v8 = ov5_021D7010(v1); - v8.x = -20 + (v7 * 20) + (sub_0201D35C() % 420); + v8.x = -20 + (v7 * 20) + (MTRNG_Next() % 420); v8.y = -8; v8.z = 0; v8.x <<= FX32_SHIFT; @@ -3214,7 +3214,7 @@ static void ov5_021D8B88 (UnkStruct_ov5_021DB4B8 * param0, int param1) v5 = v1->unk_08; v5[0] = 0; - v5[1] = 15 + (sub_0201D35C() % (35 - 15)); + v5[1] = 15 + (MTRNG_Next() % (35 - 15)); v6 = 3 - ((v5[1] - 15) / (((35 - 15) / 4) + 1)); @@ -3223,7 +3223,7 @@ static void ov5_021D8B88 (UnkStruct_ov5_021DB4B8 * param0, int param1) v5[3] = 0; v5[5] = v7[v2]; - v3 = sub_0201D35C() % 1000; + v3 = MTRNG_Next() % 1000; if (v3 == 777) { v6 = 4; @@ -3236,9 +3236,9 @@ static void ov5_021D8B88 (UnkStruct_ov5_021DB4B8 * param0, int param1) VecFx32 v9; v9 = ov5_021D7010(v1); - v9.x = 262 + (sub_0201D35C() % 24); + v9.x = 262 + (MTRNG_Next() % 24); v9.x <<= FX32_SHIFT; - v9.y = -64 + (sub_0201D35C() % 192); + v9.y = -64 + (MTRNG_Next() % 192); v9.y <<= FX32_SHIFT; ov5_021D630C(v1->unk_04, &v9); @@ -3545,8 +3545,8 @@ static void ov5_021D92C4 (UnkStruct_ov5_021DB4B8 * param0, int param1) v4 = (s32 *)v1->unk_08; v4[0] = 0; - v4[1] = 18 + (sub_0201D35C() % (24 - 18)); - v5 = sub_0201D35C() % 4; + v4[1] = 18 + (MTRNG_Next() % (24 - 18)); + v5 = MTRNG_Next() % 4; sub_02021E50(v1->unk_04, v5); @@ -3564,8 +3564,8 @@ static void ov5_021D92C4 (UnkStruct_ov5_021DB4B8 * param0, int param1) { VecFx32 v6 = ov5_021D7010(v1); - v6.x = 256 + (sub_0201D35C() % 24); - v6.y = -32 + (sub_0201D35C() % 168); + v6.x = 256 + (MTRNG_Next() % 24); + v6.y = -32 + (MTRNG_Next() % 168); v6.x <<= FX32_SHIFT; v6.y <<= FX32_SHIFT; v6.z = 0; @@ -3722,9 +3722,9 @@ static void ov5_021D9690 (UnkStruct_ov5_021DB4B8 * param0, int param1) v7 = (s32 *)v1->unk_08; v7[0] = 0; - v7[1] = 7 + (sub_0201D35C() % 5); + v7[1] = 7 + (MTRNG_Next() % 5); - v2 = sub_0201D35C() % 1000; + v2 = MTRNG_Next() % 1000; if ((v2 % 2) == 0) { v7[2] = 1; @@ -3733,15 +3733,15 @@ static void ov5_021D9690 (UnkStruct_ov5_021DB4B8 * param0, int param1) } v7[3] = 1; - v7[4] = 3 + (sub_0201D35C() % 6); - v7[5] = 4 + (sub_0201D35C() % 5); + v7[4] = 3 + (MTRNG_Next() % 6); + v7[5] = 4 + (MTRNG_Next() % 5); - v5 = sub_0201D35C() % 0x14; + v5 = MTRNG_Next() % 0x14; { v6 = ov5_021D7010(v1); - v6.x = -64 + (sub_0201D35C() % 384); - v6.y = -8 + (sub_0201D35C() % 256); + v6.x = -64 + (MTRNG_Next() % 384); + v6.y = -8 + (MTRNG_Next() % 256); v6.x <<= FX32_SHIFT; v6.y <<= FX32_SHIFT; v6.z = 0; @@ -3757,15 +3757,15 @@ static void ov5_021D9690 (UnkStruct_ov5_021DB4B8 * param0, int param1) if (v2 < 0) { v2 *= -1; - v4 = v3 - (sub_0201D35C() % v2); + v4 = v3 - (MTRNG_Next() % v2); } else { - v4 = v3 + (sub_0201D35C() % v2); + v4 = v3 + (MTRNG_Next() % v2); } if ((v3 <= v6.y) && (v4 >= v6.y)) { v7[1] *= 2; } else { - v5 = sub_0201D35C() % 4; + v5 = MTRNG_Next() % 4; } sub_02021E50(v1->unk_04, v5); @@ -3824,8 +3824,8 @@ static void ov5_021D97E8 (UnkStruct_0201CD38 * param0, void * param1) ov5_021D64E4(v2[1], 16); if (v2[1] >= 10) { - v2[2] = 10 + (sub_0201D35C() % 20); - v2[3] = 5 + (sub_0201D35C() % 3); + v2[2] = 10 + (MTRNG_Next() % 20); + v2[3] = 5 + (MTRNG_Next() % 3); v2[4] = 1; v0->unk_BA2 = 3; } @@ -3838,8 +3838,8 @@ static void ov5_021D97E8 (UnkStruct_0201CD38 * param0, void * param1) G2_SetBG2Offset(0, 32); ov5_021D64E4(v2[1], 16); - v2[2] = 10 + (sub_0201D35C() % 20); - v2[3] = 5 + (sub_0201D35C() % 3); + v2[2] = 10 + (MTRNG_Next() % 20); + v2[3] = 5 + (MTRNG_Next() % 3); v2[4] = 1; v0->unk_BA2 = 3; @@ -3854,16 +3854,16 @@ static void ov5_021D97E8 (UnkStruct_0201CD38 * param0, void * param1) v2[1]--; if (v2[1] <= v2[3]) { - v2[2] = 10 + (sub_0201D35C() % 15); - v2[3] = 7 + (sub_0201D35C() % 3); + v2[2] = 10 + (MTRNG_Next() % 15); + v2[3] = 7 + (MTRNG_Next() % 3); v2[4] = 0; } } else { v2[1]++; if (v2[1] >= v2[3]) { - v2[2] = 10 + (sub_0201D35C() % 20); - v2[3] = 5 + (sub_0201D35C() % 3); + v2[2] = 10 + (MTRNG_Next() % 20); + v2[3] = 5 + (MTRNG_Next() % 3); v2[4] = 1; } } @@ -4283,7 +4283,7 @@ static void ov5_021DA0A8 (UnkStruct_ov5_021DB4B8 * param0, int param1) } v3 = (s32 *)v1->unk_08; - v8 = sub_0201D35C(); + v8 = MTRNG_Next(); v3[0] = 0; v6 = v8 % 3; @@ -4326,7 +4326,7 @@ static void ov5_021DA1A8 (UnkStruct_ov5_021D6FA8 * param0) v2[0] += 2; if (v2[0] > v2[1]) { - if ((sub_0201D35C() % 10) < 5) { + if ((MTRNG_Next() % 10) < 5) { v2[3] = 2; } else { v2[3] = 1; @@ -4522,14 +4522,14 @@ static void ov5_021DA5A0 (UnkStruct_ov5_021DB4B8 * param0, int param1) } v5 = (s32 *)v2->unk_08; - v4 = sub_0201D35C() % 4; + v4 = MTRNG_Next() % 4; sub_02021E50(v2->unk_04, v4); v5[4] = 10; v5[5] = 0; - v1 = sub_0201D35C(); + v1 = MTRNG_Next(); if ((v1 % 2) == 0) { v5[1] = 1; @@ -4537,20 +4537,20 @@ static void ov5_021DA5A0 (UnkStruct_ov5_021DB4B8 * param0, int param1) v5[1] = -1; } - v5[3] = 1 + (sub_0201D35C() % 1); + v5[3] = 1 + (MTRNG_Next() % 1); v5[0] = (s32) & v3->unk_B4[1]; v5[6] = (s32) & v3->unk_B4[5]; - v5[7] = 10 + (sub_0201D35C() % 20); + v5[7] = 10 + (MTRNG_Next() % 20); { VecFx32 v6 = ov5_021D7010(v2); - v6.x = -32 + (sub_0201D35C() % 414); + v6.x = -32 + (MTRNG_Next() % 414); if ((v3->unk_B4[1] == 1) && (v0 >= (param1 / 2))) { - v6.y = -40 - (sub_0201D35C() % 20); + v6.y = -40 - (MTRNG_Next() % 20); } else { - v6.y = -8 - (sub_0201D35C() % 20); + v6.y = -8 - (MTRNG_Next() % 20); } v6.x <<= FX32_SHIFT; @@ -4628,10 +4628,10 @@ static void ov5_021DA748 (UnkStruct_0201CD38 * param0, void * param1) case 0: v1[1] = 1; v1[5] = 0; - v1[6] = 200 + (sub_0201D35C() % 480); + v1[6] = 200 + (MTRNG_Next() % 480); v1[7] = 0; - if ((sub_0201D35C() % 3) != 0) { + if ((MTRNG_Next() % 3) != 0) { v1[2] = 36; sub_02005748(1597); @@ -4659,9 +4659,9 @@ static void ov5_021DA748 (UnkStruct_0201CD38 * param0, void * param1) v1[7] = 0; if (v1[2] == 200) { - v1[4] = (sub_0201D35C() % 15); + v1[4] = (MTRNG_Next() % 15); } else { - v1[4] = ((v1[6] * 50) / 100) + (sub_0201D35C() % 120); + v1[4] = ((v1[6] * 50) / 100) + (MTRNG_Next() % 120); } } @@ -4768,33 +4768,33 @@ static void ov5_021DA9DC (UnkStruct_ov5_021DB4B8 * param0, int param1) } v2 = (s32 *)v1->unk_08; - v4 = sub_0201D35C() % 0xe; + v4 = MTRNG_Next() % 0xe; sub_02021E50(v1->unk_04, v4); v3 = v4 / 4; v3++; - v2[0] = 8 + (sub_0201D35C() % 25); + v2[0] = 8 + (MTRNG_Next() % 25); v2[0] *= v3; v2[1] = 16 / v3; v2[2] = 0; - v2[3] = sub_0201D35C() % 2; + v2[3] = MTRNG_Next() % 2; v2[4] = 1; switch (v3) { case 1: case 2: - v5.x = -128 + (sub_0201D35C() % 512); - v5.y = 8 + (sub_0201D35C() % 192); + v5.x = -128 + (MTRNG_Next() % 512); + v5.y = 8 + (MTRNG_Next() % 192); break; case 3: - v5.x = -128 + (sub_0201D35C() % 512); - v5.y = 64 + (sub_0201D35C() % 128); + v5.x = -128 + (MTRNG_Next() % 512); + v5.y = 64 + (MTRNG_Next() % 128); break; case 4: - v5.x = -128 + (sub_0201D35C() % 512); - v5.y = 160 + (sub_0201D35C() % 32); + v5.x = -128 + (MTRNG_Next() % 512); + v5.y = 160 + (MTRNG_Next() % 32); break; } diff --git a/src/overlay005/ov5_021DB888.c b/src/overlay005/ov5_021DB888.c index 0c505fed9a..75b10c946b 100644 --- a/src/overlay005/ov5_021DB888.c +++ b/src/overlay005/ov5_021DB888.c @@ -648,7 +648,7 @@ static BOOL ov5_021DBCE0 (UnkStruct_ov5_021DBA58 * param0) ov5_021DBC40(param0, param0->unk_10[v3], Unk_ov5_021F8E34); v4 = 1; } else { - if (((sub_0201D2E8() % 100) < 50) && (ov5_021DBEB8(param0->unk_10[v3]) == 0)) { + if (((LCRNG_Next() % 100) < 50) && (ov5_021DBEB8(param0->unk_10[v3]) == 0)) { ov5_021DBECC(param0->unk_10[v3], 0x31); ov5_021DBC40(param0, param0->unk_10[v3], Unk_ov5_021F8E3C); diff --git a/src/overlay005/ov5_021E622C.c b/src/overlay005/ov5_021E622C.c index a468b7a215..f36b048e28 100644 --- a/src/overlay005/ov5_021E622C.c +++ b/src/overlay005/ov5_021E622C.c @@ -2259,7 +2259,7 @@ static int ov5_021E6684 (UnkStruct_02026310 * param0) } if (v3 == 2) { - if (sub_0201D2E8() >= (0xffff / 2)) { + if (LCRNG_Next() >= (0xffff / 2)) { v2 = 0; } else { v2 = 1; @@ -2267,7 +2267,7 @@ static int ov5_021E6684 (UnkStruct_02026310 * param0) } if (sub_02074570(v4[v2], MON_DATA_HELD_ITEM, NULL) == 229) { - if (sub_0201D2E8() >= (0xffff / 2)) { + if (LCRNG_Next() >= (0xffff / 2)) { return -1; } } else { @@ -2284,7 +2284,7 @@ void ov5_021E6720 (UnkStruct_02026310 * param0) int v4 = 0; if ((v2 = ov5_021E6684(param0)) < 0) { - sub_02026270(param0, sub_0201D35C()); + sub_02026270(param0, MTRNG_Next()); } else { BoxPokemon * v5 = ov5_021E622C(param0, v2); @@ -2292,7 +2292,7 @@ void ov5_021E6720 (UnkStruct_02026310 * param0) v3 = GetNatureFromPersonality(v0); while (TRUE) { - v1 = sub_0201D35C(); + v1 = MTRNG_Next(); if ((v3 == GetNatureFromPersonality(v1)) && (v1 != 0)) { break; @@ -2336,12 +2336,12 @@ static void ov5_021E67B0 (Pokemon * param0, UnkStruct_02026310 * param1) } for (v1 = 0; v1 < 3; v1++) { - v0[v1] = v2[sub_0201D2E8() % (6 - v1)]; + v0[v1] = v2[LCRNG_Next() % (6 - v1)]; ov5_021E6778(v2, v1); } for (v1 = 0; v1 < 3; v1++) { - v3[v1] = sub_0201D2E8() % 2; + v3[v1] = LCRNG_Next() % 2; } for (v1 = 0; v1 < 3; v1++) { @@ -2654,7 +2654,7 @@ void ov5_021E6DE8 (Pokemon * param0, u16 param1, UnkStruct_02026310 * param2, u3 if (sub_02075E38(param3, v2) == 0) { for (v5 = 0; v5 < 4; v5++) { - v2 = sub_0201D30C(v2); + v2 = ARNG_Next(v2); if (sub_02075E38(param3, v2)) { break; @@ -2872,7 +2872,7 @@ BOOL ov5_021E7154 (UnkStruct_02026310 * param0, Party * param1, UnkStruct_0203CD if ((sub_02026234(param0) == 0) && (v2 == 2)) { if ((sub_02026228(sub_02026218(param0, 1)) & 0xff) == 0xff) { v3 = ov5_021E70FC(param0); - v4 = sub_0201D2E8(); + v4 = LCRNG_Next(); v4 = (v4 * 100) / 0xffff; if (v3 > v4) { @@ -3068,7 +3068,7 @@ static void ov5_021E742C (Pokemon * param0, int param1) if (v17 == sub_02017070(2, 1)) { while (sub_02075E38(v4, v3)) { - v3 = sub_0201D30C(v3); + v3 = ARNG_Next(v3); } } } diff --git a/src/overlay005/ov5_021EB1A0.c b/src/overlay005/ov5_021EB1A0.c index 417632cb89..394d15f27e 100644 --- a/src/overlay005/ov5_021EB1A0.c +++ b/src/overlay005/ov5_021EB1A0.c @@ -582,7 +582,7 @@ void ov5_021EB7F8 (UnkStruct_02061AB4 * param0) v0 = sub_02062ACC(param0, (sizeof(UnkStruct_ov5_021EB7F8))); v0->unk_00 = -1; - v0->unk_02 = sub_0201D2E8() % 16; + v0->unk_02 = LCRNG_Next() % 16; ov5_021ECF04(param0, &v0->unk_04); @@ -663,7 +663,7 @@ void ov5_021EB8B8 (UnkStruct_02061AB4 * param0) if (v2->unk_01 >= 32) { v2->unk_01 = 0; - v2->unk_02 = sub_0201D2E8() % 16; + v2->unk_02 = LCRNG_Next() % 16; } } diff --git a/src/overlay005/ov5_021F08CC.c b/src/overlay005/ov5_021F08CC.c index 24a16fbff2..a41530b32e 100644 --- a/src/overlay005/ov5_021F08CC.c +++ b/src/overlay005/ov5_021F08CC.c @@ -241,7 +241,7 @@ static int ov5_021F0A80 (UnkStruct_ov5_021F0D6C * param0, UnkStruct_0205E884 * p static int ov5_021F0AB8 (UnkStruct_ov5_021F0D6C * param0, UnkStruct_0205E884 * param1, UnkStruct_02061AB4 * param2) { - param0->unk_14 = ((sub_0201D2E8() % 4) + 1) * 30; + param0->unk_14 = ((LCRNG_Next() % 4) + 1) * 30; param0->unk_18 = Unk_ov5_021FFA00[param0->unk_1C]; param0->unk_0C = 4; diff --git a/src/overlay005/ov5_021F6454.c b/src/overlay005/ov5_021F6454.c index 65f4ded7aa..15149c6f0d 100644 --- a/src/overlay005/ov5_021F6454.c +++ b/src/overlay005/ov5_021F6454.c @@ -486,7 +486,7 @@ BOOL ov5_021F6B3C (UnkStruct_0203E724 * param0) *v6 = v0; *v7 = v1[v0]; } else if (v1[*v6] == v1[v0]) { - if ((sub_0201D2E8() % 2) == 0) { + if ((LCRNG_Next() % 2) == 0) { *v6 = v0; *v7 = v1[v0]; } diff --git a/src/overlay006/ov6_02240C9C.c b/src/overlay006/ov6_02240C9C.c index c99a22de56..a72c275936 100644 --- a/src/overlay006/ov6_02240C9C.c +++ b/src/overlay006/ov6_02240C9C.c @@ -1107,7 +1107,7 @@ static u8 ov6_02241B40 (const UnkStruct_ov6_0224222C * param0, const UnkStruct_o } v0 = v3 - v2 + 1; - v1 = sub_0201D2E8() % v0; + v1 = LCRNG_Next() % v0; if (param1->unk_0D == 0) { if ((param1->unk_0E == 55) || (param1->unk_0E == 72) || (param1->unk_0E == 46)) { @@ -1502,7 +1502,7 @@ static BOOL ov6_0224219C (const UnkStruct_ov6_0224222C * param0, const u8 param1 return 0; } - *param3 = v0[sub_0201D2E8() % v1]; + *param3 = v0[LCRNG_Next() % v1]; return 1; } @@ -1717,7 +1717,7 @@ static BOOL ov6_02242514 (const int param0, const UnkStruct_ov6_022422D0 * param v1 = 1; v4 = Unk_ov6_02248FF0[param1->unk_11].unk_00; - v2 = Unk_ov6_02248FF0[param1->unk_11].unk_04[sub_0201D2E8() % v4]; + v2 = Unk_ov6_02248FF0[param1->unk_11].unk_04[LCRNG_Next() % v4]; } if (v1) { diff --git a/src/overlay006/ov6_022426AC.c b/src/overlay006/ov6_022426AC.c index ef3a39ffba..9c54f02e14 100644 --- a/src/overlay006/ov6_022426AC.c +++ b/src/overlay006/ov6_022426AC.c @@ -86,7 +86,7 @@ void ov6_022426C0 (UnkStruct_ov6_022426B8 * param0, const int param1) v2 = 2; break; default: - if (sub_0201D2E8() % 2) { + if (LCRNG_Next() % 2) { v2 = 0; } else { v2 = 1; diff --git a/src/overlay006/ov6_022465FC.c b/src/overlay006/ov6_022465FC.c index 3efc0e4fbe..d57bd133cd 100644 --- a/src/overlay006/ov6_022465FC.c +++ b/src/overlay006/ov6_022465FC.c @@ -151,7 +151,7 @@ static int ov6_0224673C (UnkStruct_0203CDB0 * param0, const u8 * param1) return v0[0]; } - return v0[sub_0201D35C() % v2]; + return v0[MTRNG_Next() % v2]; } static int ov6_0224678C (UnkStruct_0202440C * param0, int param1, int param2, BOOL param3, BOOL param4, u8 * param5) diff --git a/src/overlay006/ov6_02246A30.c b/src/overlay006/ov6_02246A30.c index ae9f6d7ea4..f94dfd960d 100644 --- a/src/overlay006/ov6_02246A30.c +++ b/src/overlay006/ov6_02246A30.c @@ -193,5 +193,5 @@ int ov6_02246B40 (UnkStruct_0203CDB0 * param0) return 0; } - return v0[sub_0201D35C() % v1]; + return v0[MTRNG_Next() % v1]; } diff --git a/src/overlay008/ov8_02249960.c b/src/overlay008/ov8_02249960.c index 971c882f9d..a56d66eca8 100644 --- a/src/overlay008/ov8_02249960.c +++ b/src/overlay008/ov8_02249960.c @@ -3929,14 +3929,14 @@ void ov8_0224C198 (UnkStruct_0203CDB0 * param0) if (v6 != 2) { const u8 * v9 = Unk_ov8_0224C6F8[v6]; - int v10 = sub_0201D35C() % v8->unk_08; + int v10 = MTRNG_Next() % v8->unk_08; v1->unk_02 = v10 + v8->unk_04; do { do { - v1->unk_04 = sub_0201D35C() % v8->unk_14; - v1->unk_06 = sub_0201D35C() % v8->unk_18; + v1->unk_04 = MTRNG_Next() % v8->unk_14; + v1->unk_06 = MTRNG_Next() % v8->unk_18; } while (v9[(v1->unk_06 * v8->unk_14) + v1->unk_04] == 1); v1->unk_04 += v8->unk_0C; diff --git a/src/overlay009/ov9_02249960.c b/src/overlay009/ov9_02249960.c index 5d742b4cf8..27f91b32e7 100644 --- a/src/overlay009/ov9_02249960.c +++ b/src/overlay009/ov9_02249960.c @@ -3307,7 +3307,7 @@ static int ov9_0224B964 (UnkStruct_ov101_021D5D90 * param0, void * param1) v2->unk_10.z += v6->z; } - v2->unk_04 = sub_0201D2E8() % ((FX32_ONE * 8)); + v2->unk_04 = LCRNG_Next() % ((FX32_ONE * 8)); v2->unk_08 = 0x800; if ((v2->unk_04 & 0x1)) { diff --git a/src/overlay010/ov10_0221F800.c b/src/overlay010/ov10_0221F800.c index 71507ff161..70fd7d4899 100644 --- a/src/overlay010/ov10_0221F800.c +++ b/src/overlay010/ov10_0221F800.c @@ -804,8 +804,8 @@ static u8 ov10_02220014 (UnkStruct_ov10_0221FB28 * param0) ov10_02221440(param0, 2, 0, 0); ov10_02221440(param0, 3, 0, 0); } else if (param0->unk_B76 < 24) { - v0 = (sub_0201D2E8() % param0->unk_B70) - (param0->unk_B70 / 2); - v1 = (sub_0201D2E8() % param0->unk_B71) - (param0->unk_B71 / 2); + v0 = (LCRNG_Next() % param0->unk_B70) - (param0->unk_B70 / 2); + v1 = (LCRNG_Next() % param0->unk_B71) - (param0->unk_B71 / 2); if (((v0 < 0) && (param0->unk_B6C < 0)) || ((v0 > 0) && (param0->unk_B6C > 0))) { v0 *= -1; diff --git a/src/overlay012/ov12_02226B84.c b/src/overlay012/ov12_02226B84.c index da0ffb8dea..6d695dfdd7 100644 --- a/src/overlay012/ov12_02226B84.c +++ b/src/overlay012/ov12_02226B84.c @@ -3539,18 +3539,18 @@ static void ov12_0222A624 (UnkStruct_ov12_0222A624 * param0) G2_SetWnd0InsidePlane(GX_WND_PLANEMASK_BG0 | GX_WND_PLANEMASK_BG1 | GX_WND_PLANEMASK_BG2 | GX_WND_PLANEMASK_BG3, 1); G2_SetWndOutsidePlane(GX_WND_PLANEMASK_BG0 | GX_WND_PLANEMASK_BG1 | GX_WND_PLANEMASK_BG2 | GX_WND_PLANEMASK_BG3 | GX_WND_PLANEMASK_OBJ, 1); G2_SetWnd0Position(0, 160, 128, 192); - param0->unk_3C = 35 + (sub_0201D2E8() % 5); + param0->unk_3C = 35 + (LCRNG_Next() % 5); } else { GX_SetVisibleWnd(GX_WNDMASK_W0); G2_SetWnd0InsidePlane(GX_WND_PLANEMASK_BG0 | GX_WND_PLANEMASK_BG1 | GX_WND_PLANEMASK_BG2 | GX_WND_PLANEMASK_BG3, 1); G2_SetWndOutsidePlane(GX_WND_PLANEMASK_BG0 | GX_WND_PLANEMASK_BG1 | GX_WND_PLANEMASK_BG2 | GX_WND_PLANEMASK_BG3 | GX_WND_PLANEMASK_OBJ, 1); G2_SetWnd0Position(128, 96 - 10, 256, 192); - param0->unk_3C = 35 + (sub_0201D2E8() % 5); + param0->unk_3C = 35 + (LCRNG_Next() % 5); } break; case 5: case 6: - if (sub_0201D2E8() % 2) { + if (LCRNG_Next() % 2) { if (param0->unk_38 == 0) { param0->unk_38++; sub_0200D5DC(param0->unk_1C, 0, +4); @@ -3565,7 +3565,7 @@ static void ov12_0222A624 (UnkStruct_ov12_0222A624 * param0) break; case 10: case 11: - if (sub_0201D2E8() % 2) { + if (LCRNG_Next() % 2) { if (param0->unk_38 == 1) { param0->unk_38++; sub_0200D5DC(param0->unk_1C, 0, +4); @@ -3580,7 +3580,7 @@ static void ov12_0222A624 (UnkStruct_ov12_0222A624 * param0) break; case 15: case 16: - if (sub_0201D2E8() % 2) { + if (LCRNG_Next() % 2) { if (param0->unk_38 == 2) { param0->unk_38++; sub_0200D5DC(param0->unk_1C, 0, +4); @@ -3595,7 +3595,7 @@ static void ov12_0222A624 (UnkStruct_ov12_0222A624 * param0) break; case 22: case 23: - if (sub_0201D2E8() % 2) { + if (LCRNG_Next() % 2) { if (param0->unk_38 == 3) { param0->unk_38++; sub_0200D5DC(param0->unk_1C, 0, +8); diff --git a/src/overlay012/ov12_0222D6B0.c b/src/overlay012/ov12_0222D6B0.c index 894ffac4e0..fd017df47c 100644 --- a/src/overlay012/ov12_0222D6B0.c +++ b/src/overlay012/ov12_0222D6B0.c @@ -533,7 +533,7 @@ static void ov12_0222DC98 (UnkStruct_0201CD38 * param0, void * param1) UnkStruct_ov12_02235350 v1; int v2; - v2 = 10 + (sub_0201D2E8() % 10); + v2 = 10 + (LCRNG_Next() % 10); sub_0200D550(v0->unk_10, &v1.unk_00, &v1.unk_02); ov12_02225BC8(&v0->unk_14, v1.unk_00, Unk_ov12_0223A14A[v0->unk_0F].unk_00, v1.unk_02, Unk_ov12_0223A14A[v0->unk_0F].unk_02, v2); @@ -670,16 +670,16 @@ void ov12_0222DEFC (UnkStruct_ov12_0221FCDC * param0, UnkStruct_0200C6E4 * param v2->unk_14[v1].unk_0C = 0; v2->unk_14[v1].unk_0D = 0; - v2->unk_14[v1].unk_0E = 10 + (sub_0201D2E8() % 10) + v1; - v2->unk_14[v1].unk_0F = (sub_0201D2E8() % 6); + v2->unk_14[v1].unk_0E = 10 + (LCRNG_Next() % 10) + v1; + v2->unk_14[v1].unk_0F = (LCRNG_Next() % 6); v2->unk_14[v1].unk_38 = 1.0f; v2->unk_14[v1].unk_00 = v2->unk_08; v2->unk_14[v1].unk_04 = v2->unk_0C; v2->unk_14[v1].unk_08 = v2->unk_10; v2->unk_14[v1].unk_3C = &v2->unk_514[v1]; - v4 = Unk_ov12_0223A19A[v0][1] + (sub_0201D2E8() % Unk_ov12_0223A19A[v0][3]); - v5 = Unk_ov12_0223A19A[v0][0] + (sub_0201D2E8() % Unk_ov12_0223A19A[v0][2]); + v4 = Unk_ov12_0223A19A[v0][1] + (LCRNG_Next() % Unk_ov12_0223A19A[v0][3]); + v5 = Unk_ov12_0223A19A[v0][0] + (LCRNG_Next() % Unk_ov12_0223A19A[v0][2]); sub_0200D4C4(v6, v4, v5); sub_0200D6A4(v6, 2); @@ -987,7 +987,7 @@ void ov12_0222E61C (UnkStruct_ov12_0221FCDC * param0, UnkStruct_0200C6E4 * param v0->unk_22[0] = 0; for (v1 = 1; v1 < 4; v1++) { - v0->unk_22[v1] = (sub_0201D2E8() % 4) + (v1 * 5); + v0->unk_22[v1] = (LCRNG_Next() % 4) + (v1 * 5); v0->unk_2C[v1] = sub_0200CE6C(v0->unk_00.unk_08, v0->unk_00.unk_10, &v4); } diff --git a/src/overlay012/ov12_02235E94.c b/src/overlay012/ov12_02235E94.c index f93ea54e32..9db5adaba9 100644 --- a/src/overlay012/ov12_02235E94.c +++ b/src/overlay012/ov12_02235E94.c @@ -1632,7 +1632,7 @@ static BOOL ov12_02236F24 (UnkStruct_ov12_02237C54 * param0) int v0; if (ov12_02235EB0(param0->unk_90.unk_00) == 1) { - v0 = (sub_0201D2E8() % 20) + 10; + v0 = (LCRNG_Next() % 20) + 10; sub_0200D7C0(param0->unk_30, 0x2000 * v0); } @@ -1743,7 +1743,7 @@ static BOOL ov12_022371E4 (UnkStruct_ov12_02237C54 * param0) int v0; if (ov12_02235EB0(param0->unk_90.unk_00) == 1) { - v0 = (sub_0201D2E8() % 20) + 10; + v0 = (LCRNG_Next() % 20) + 10; sub_0200D7C0(param0->unk_30, 0x2000 * v0); } @@ -2037,7 +2037,7 @@ UnkStruct_ov12_02237C54 * ov12_02237728 (UnkStruct_ov12_02237728 * param0) { int v1; - v1 = sub_0201D2E8() % 2; + v1 = LCRNG_Next() % 2; if (v1) { v0->unk_22 = +1; diff --git a/src/overlay016/ov16_0223B140.c b/src/overlay016/ov16_0223B140.c index a37b03746d..5205d6b048 100644 --- a/src/overlay016/ov16_0223B140.c +++ b/src/overlay016/ov16_0223B140.c @@ -802,7 +802,7 @@ static void ov16_0223BCB4 (UnkStruct_020067E8 * param0) ov16_0223CE20(v0->unk_00); - sub_0201D2DC(v0->unk_2430); + LCRNG_SetSeed(v0->unk_2430); if (ov16_0223F450(v0)) { sub_020057A4(1796, 0); @@ -1086,7 +1086,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) param0->unk_2464[v0] = param1->unk_178[v0]; } - param0->unk_2430 = sub_0201D2D0(); + param0->unk_2430 = LCRNG_GetSeed(); param0->unk_2444 = param1->unk_174; param0->unk_2448 = param1->unk_174; param0->battleStatusMask = param1->unk_164; diff --git a/src/overlay016/ov16_0226871C.c b/src/overlay016/ov16_0226871C.c index e2e5757f27..892bb94cf1 100644 --- a/src/overlay016/ov16_0226871C.c +++ b/src/overlay016/ov16_0226871C.c @@ -1438,7 +1438,7 @@ static void ov16_02268FCC (UnkStruct_0201CD38 * param0, void * param1) break; } - v2->unk_05 += sub_0201D2E8() % 8; + v2->unk_05 += LCRNG_Next() % 8; v2->unk_07 = 2; v2->unk_03++; break; diff --git a/src/overlay022/ov22_02257F50.c b/src/overlay022/ov22_02257F50.c index e294c3ded3..45a393b072 100644 --- a/src/overlay022/ov22_02257F50.c +++ b/src/overlay022/ov22_02257F50.c @@ -148,8 +148,8 @@ void ov22_0225804C (int param0, int param1, int * param2, int * param3, int para case 0: *param2 = (8 + 2); *param3 = (16 + 2); - *param2 += (sub_0201D35C() % ((112 - (2 * 2)) - param4)); - *param3 += (sub_0201D35C() % ((129 - (2 * 2)) - param5)); + *param2 += (MTRNG_Next() % ((112 - (2 * 2)) - param4)); + *param3 += (MTRNG_Next() % ((129 - (2 * 2)) - param5)); break; case 1: case 2: diff --git a/src/overlay022/ov22_022589E0.c b/src/overlay022/ov22_022589E0.c index 51577515a5..55c2f51011 100644 --- a/src/overlay022/ov22_022589E0.c +++ b/src/overlay022/ov22_022589E0.c @@ -245,8 +245,8 @@ static void ov22_02258BB8 (UnkStruct_ov22_02258A48 * param0) if (v0->unk_20 == 1) { ov22_02259698(v0->unk_10, &v7, &v8); - v9 = ((8 + 2)) + (sub_0201D35C() % ((112 - (2 * 2)) - v7)); - v10 = ((16 + 2)) + (sub_0201D35C() % ((129 - (2 * 2)) - v8)); + v9 = ((8 + 2)) + (MTRNG_Next() % ((112 - (2 * 2)) - v7)); + v10 = ((16 + 2)) + (MTRNG_Next() % ((129 - (2 * 2)) - v8)); } else { v9 = v0->unk_1C; v10 = v0->unk_1E; diff --git a/src/overlay023/ov23_0223E140.c b/src/overlay023/ov23_0223E140.c index 8f81054bd8..0e4416ca91 100644 --- a/src/overlay023/ov23_0223E140.c +++ b/src/overlay023/ov23_0223E140.c @@ -982,7 +982,7 @@ static int ov23_0223E8CC (u16 param0, u16 param1) return -1; } - v6 = sub_0201D2E8() % v5; + v6 = LCRNG_Next() % v5; v5 = 0; for (v0 = 0; v0 < 250; v0++) { diff --git a/src/overlay023/ov23_0224340C.c b/src/overlay023/ov23_0224340C.c index b764c71d1c..6c5e9999c8 100644 --- a/src/overlay023/ov23_0224340C.c +++ b/src/overlay023/ov23_0224340C.c @@ -2367,7 +2367,7 @@ static void ov23_022451C8 (UnkStruct_0201CD38 * param0, void * param1) sub_02006E60(50, 8, v0->unk_10, 2, 0, 32 * 24 * 2, 0, 4); } else { u16 v2[] = {11, 12, 13, 14}; - u16 v3 = sub_0201D2E8() % 4; + u16 v3 = LCRNG_Next() % 4; sub_02006E60(50, v2[v3], v0->unk_10, 2, 0, 32 * 24 * 2, 0, 4); } @@ -4087,7 +4087,7 @@ static BOOL ov23_02247568 (UnkStruct_02018340 * param0, UnkStruct_ov23_022471D8 param1->unk_124++; - v11.x = (128 - (10 / 2) + (sub_0201D2E8() % 10)) * FX32_ONE; + v11.x = (128 - (10 / 2) + (LCRNG_Next() % 10)) * FX32_ONE; v11.y = param1->unk_120 * FX32_ONE; sub_02021C50(Unk_ov23_02257764->unk_25C[0], &v11); diff --git a/src/overlay023/ov23_02248F1C.c b/src/overlay023/ov23_02248F1C.c index ef5e3393d8..27ed82f846 100644 --- a/src/overlay023/ov23_02248F1C.c +++ b/src/overlay023/ov23_02248F1C.c @@ -210,8 +210,8 @@ static void ov23_022491CC (int param0[][2], int param1[][3]) param1[v0][1] = 0; param1[v0][2] = 0; - Unk_ov23_0225776C[v0][0] = sub_0201D2E8() % 500 + 50; - Unk_ov23_0225776C[v0][1] = sub_0201D2E8() % 500 + 50; + Unk_ov23_0225776C[v0][0] = LCRNG_Next() % 500 + 50; + Unk_ov23_0225776C[v0][1] = LCRNG_Next() % 500 + 50; } } diff --git a/src/overlay023/ov23_0224DC40.c b/src/overlay023/ov23_0224DC40.c index f1ae2bed3f..634468623d 100644 --- a/src/overlay023/ov23_0224DC40.c +++ b/src/overlay023/ov23_0224DC40.c @@ -314,7 +314,7 @@ static void ov23_0224DE3C (UnkStruct_ov23_0224E280 * param0) v1 = MessageLoader_Init(0, 26, 633, 4); for (v2 = 0; v2 < 4; v2++) { - u32 v5 = sub_0201D35C() % 12; + u32 v5 = MTRNG_Next() % 12; for (v3 = 0; v3 < v2; v3++) { if ((v4[v3] == v5)) { diff --git a/src/overlay033/ov33_02256474.c b/src/overlay033/ov33_02256474.c index 0f89a8751b..4a3937e1f9 100644 --- a/src/overlay033/ov33_02256474.c +++ b/src/overlay033/ov33_02256474.c @@ -309,8 +309,8 @@ static void ov33_022567D4 (VecFx32 * param0) { fx32 v0, v1; - v0 = (-32 + (sub_0201D35C() & 63)) * FX32_ONE; - v1 = (-32 + (sub_0201D35C() & 63)) * FX32_ONE; + v0 = (-32 + (MTRNG_Next() & 63)) * FX32_ONE; + v1 = (-32 + (MTRNG_Next() & 63)) * FX32_ONE; VEC_Set(param0, v0, v1, 0); VEC_Normalize(param0, param0); diff --git a/src/overlay041/ov41_022567B0.c b/src/overlay041/ov41_022567B0.c index 866157b52c..cc199befdd 100644 --- a/src/overlay041/ov41_022567B0.c +++ b/src/overlay041/ov41_022567B0.c @@ -374,7 +374,7 @@ static void ov41_02256B8C (UnkStruct_0201CD38 * param0, void * param1) ov25_02255950(v0->unk_24[0], v0->unk_68); if (v0->unk_60) { - v0->unk_6C = sub_0201D35C() & 7; + v0->unk_6C = MTRNG_Next() & 7; if (v0->unk_6A > 6656) { v0->unk_6A = 6656; diff --git a/src/overlay042/ov42_022561C0.c b/src/overlay042/ov42_022561C0.c index 1928b72c5f..a3d7aff106 100644 --- a/src/overlay042/ov42_022561C0.c +++ b/src/overlay042/ov42_022561C0.c @@ -152,7 +152,7 @@ static BOOL ov42_02256310 (UnkStruct_ov42_0225621C * param0) case 0: if (ov42_02256398()) { - param0->unk_08.unk_00 = sub_0201D35C() & 1; + param0->unk_08.unk_00 = MTRNG_Next() & 1; ov42_022564A0(param0->unk_0C, 2); param0->unk_01++; } diff --git a/src/overlay057/ov57_021D0D80.c b/src/overlay057/ov57_021D0D80.c index 0bea5f8445..a6a0ebbd56 100644 --- a/src/overlay057/ov57_021D0D80.c +++ b/src/overlay057/ov57_021D0D80.c @@ -404,11 +404,11 @@ static void ov57_021D0EAC (int param0, UnkStruct_021C0794 * param1, BOOL param2) sub_02025D84(v3); v4 = sub_0202B4A0(param1); - sub_0202B40C(v4, 1, sub_0201D35C()); + sub_0202B40C(v4, 1, MTRNG_Next()); sub_0206C008(param1); v2 = sub_02025E38(param1); - v0 = sub_0201D35C(); + v0 = MTRNG_Next(); if (param2) { sub_02025F1C(v2, v0); diff --git a/src/overlay065/ov65_02235060.c b/src/overlay065/ov65_02235060.c index 39d4a47192..13058e11e6 100644 --- a/src/overlay065/ov65_02235060.c +++ b/src/overlay065/ov65_02235060.c @@ -905,7 +905,7 @@ static void ov65_02235E84 (UnkStruct_ov65_02235130 * param0, UnkStruct_ov65_0223 { param1->unk_10 = ov65_022361C8; param1->unk_18 = ov65_02235EF4; - param1->unk_08 = 256 + (sub_0201D35C() % 1024); + param1->unk_08 = 256 + (MTRNG_Next() % 1024); param1->unk_0C = 3; ov65_02236250(param0, 0, param1); @@ -1083,9 +1083,9 @@ static BOOL ov65_022361C8 (UnkStruct_ov65_02235130 * param0, UnkStruct_ov65_0223 param1->unk_08--; if (param1->unk_08 <= 0) { - param1->unk_08 = 256 + (sub_0201D35C() % 1024); + param1->unk_08 = 256 + (MTRNG_Next() % 1024); - v0 = sub_0201D35C() % 4; + v0 = MTRNG_Next() % 4; v1 = ov63_0222BF90(param1->unk_00, 4); ov65_02236230(param0, 0, v0, v1); diff --git a/src/overlay066/ov66_0222DDF0.c b/src/overlay066/ov66_0222DDF0.c index 9024982bd3..fac47dd73c 100644 --- a/src/overlay066/ov66_0222DDF0.c +++ b/src/overlay066/ov66_0222DDF0.c @@ -3423,7 +3423,7 @@ static u32 ov66_02230828 (const UnkStruct_ov66_022307D4 * param0) v1 += param0->unk_00[v0]; } - v3 = sub_0201D35C() % v1; + v3 = MTRNG_Next() % v1; v2 = 0; for (v0 = 0; v0 < (27 / 3); v0++) { diff --git a/src/overlay070/ov70_0225C9B4.c b/src/overlay070/ov70_0225C9B4.c index 936f197d0d..02f0d1b3a0 100644 --- a/src/overlay070/ov70_0225C9B4.c +++ b/src/overlay070/ov70_0225C9B4.c @@ -712,7 +712,7 @@ static u8 ov70_0225D194 (const u8 * param0, u32 param1) { int v0; - v0 = sub_0201D35C() % param1; + v0 = MTRNG_Next() % param1; return param0[v0]; } diff --git a/src/overlay070/ov70_02260B44.c b/src/overlay070/ov70_02260B44.c index 80c1a249de..404567671c 100644 --- a/src/overlay070/ov70_02260B44.c +++ b/src/overlay070/ov70_02260B44.c @@ -449,11 +449,11 @@ void ov70_0226111C (UnkStruct_ov70_02260BB8 * param0, UnkStruct_ov70_022610B8 * break; case 5: param1->unk_C0[param2] = 0; - param1->unk_CD[param2] = sub_0201D35C() % param1->unk_CC; + param1->unk_CD[param2] = MTRNG_Next() % param1->unk_CC; break; case 6: param1->unk_C0[param2] = 0; - param1->unk_CD[param2] = sub_0201D35C() % param1->unk_CC; + param1->unk_CD[param2] = MTRNG_Next() % param1->unk_CC; break; } @@ -1059,7 +1059,7 @@ static void ov70_02261C60 (UnkStruct_ov70_02260BB8 * param0, UnkStruct_ov70_0226 v1 = ov70_02261498(¶m1->unk_C0[v0], ¶m1->unk_7C[v0], param1->unk_DC); if (v1 == 1) { - param1->unk_CD[v0] = sub_0201D35C() % param1->unk_CC; + param1->unk_CD[v0] = MTRNG_Next() % param1->unk_CC; param1->unk_C0[v0] = 0; } diff --git a/src/overlay070/ov70_022630A4.c b/src/overlay070/ov70_022630A4.c index ac3d01c3de..8c018e436e 100644 --- a/src/overlay070/ov70_022630A4.c +++ b/src/overlay070/ov70_022630A4.c @@ -555,7 +555,7 @@ static void ov70_02263270 (UnkStruct_ov70_02263270 * param0) param0->unk_00 = 0; param0->unk_04 = 0; param0->unk_05 = 1; - param0->unk_06 = sub_0201D35C() % 4; + param0->unk_06 = MTRNG_Next() % 4; param0->unk_07 = 1; } @@ -584,7 +584,7 @@ static fx32 ov70_02263290 (UnkStruct_ov70_02263270 * param0) if (param0->unk_07 == 1) { param0->unk_04 = 0; param0->unk_05 = 1; - param0->unk_06 = sub_0201D35C() % 4; + param0->unk_06 = MTRNG_Next() % 4; } else { param0->unk_05 = 0; } diff --git a/src/overlay070/ov70_02266E9C.c b/src/overlay070/ov70_02266E9C.c index 828a696430..0db03ebbbc 100644 --- a/src/overlay070/ov70_02266E9C.c +++ b/src/overlay070/ov70_02266E9C.c @@ -2337,7 +2337,7 @@ static void ov70_02268EEC (UnkStruct_ov70_02268E44 * param0, UnkStruct_ov70_0225 } } else { do { - v1 = sub_0201D35C() % param2; + v1 = MTRNG_Next() % param2; v2 = v1; v4 = ov70_0225E064(param1, v2); } while (v4 == 1); diff --git a/src/overlay077/ov77_021D25B0.c b/src/overlay077/ov77_021D25B0.c index d4bd12b39f..0e3465c22e 100644 --- a/src/overlay077/ov77_021D25B0.c +++ b/src/overlay077/ov77_021D25B0.c @@ -959,9 +959,9 @@ static int ov77_021D2D08 (UnkStruct_020067E8 * param0, int * param1) Unk_021BF67C.unk_65 = 0; GXLayers_SwapDisplay(); - v0->unk_14 = sub_0201D2D0(); + v0->unk_14 = LCRNG_GetSeed(); - sub_0201D2DC(0); + LCRNG_SetSeed(0); return 1; } @@ -1023,7 +1023,7 @@ static int ov77_021D2E60 (UnkStruct_020067E8 * param0, int * param1) sub_0200F2C0(); } - sub_0201D2DC(v0->unk_14); + LCRNG_SetSeed(v0->unk_14); sub_02006830(param0); Heap_Destroy(76); sub_02000EC4(FS_OVERLAY_ID(overlay77), &Unk_ov77_021D742C); diff --git a/src/overlay077/ov77_021D6670.c b/src/overlay077/ov77_021D6670.c index 122df12677..3c43d88484 100644 --- a/src/overlay077/ov77_021D6670.c +++ b/src/overlay077/ov77_021D6670.c @@ -303,8 +303,8 @@ static void ov77_021D6A44 (UnkStruct_ov77_021D6ADC * param0, const u8 param1, co VecFx32 v3; v3 = *sub_02021D28(v1->unk_04); - v3.x = FX32_ONE * (64 + (sub_0201D2E8() % 128)); - v3.y = FX32_ONE * (v2 + (sub_0201D2E8() % 64)); + v3.x = FX32_ONE * (64 + (LCRNG_Next() % 128)); + v3.y = FX32_ONE * (v2 + (LCRNG_Next() % 64)); sub_02021C50(v1->unk_04, &v3); } @@ -394,8 +394,8 @@ static void ov77_021D6BAC (UnkStruct_ov77_021D6734 * param0, const u8 param1, in VecFx32 v3; v3 = *sub_02021D28(v2->unk_04); - v3.x = FX32_ONE * ((16 - 6) + (sub_0201D2E8() % 224)); - v3.y = FX32_ONE * (192 + (64 - 6) + (sub_0201D2E8() % 56)); + v3.x = FX32_ONE * ((16 - 6) + (LCRNG_Next() % 224)); + v3.y = FX32_ONE * (192 + (64 - 6) + (LCRNG_Next() % 56)); sub_02021C50(v2->unk_04, &v3); } diff --git a/src/overlay083/ov83_0223D6A8.c b/src/overlay083/ov83_0223D6A8.c index 090f31a35b..4cc490b3ba 100644 --- a/src/overlay083/ov83_0223D6A8.c +++ b/src/overlay083/ov83_0223D6A8.c @@ -1326,9 +1326,9 @@ void ov83_0223EDDC (UnkStruct_ov83_0223ED3C * param0, int param1, int param2) ov83_0223F054(v0); } - v1 = sub_0201D35C(); - v10 = v9.unk_10 + (sub_0201D35C() % v9.unk_11); - v11 = v9.unk_12 + (sub_0201D35C() % v9.unk_13); + v1 = MTRNG_Next(); + v10 = v9.unk_10 + (MTRNG_Next() % v9.unk_11); + v11 = v9.unk_12 + (MTRNG_Next() % v9.unk_13); v11 += v10; @@ -1344,7 +1344,7 @@ void ov83_0223EDDC (UnkStruct_ov83_0223ED3C * param0, int param1, int param2) v4 += 96 * FX32_ONE; v5 += 96 * FX32_ONE; - v6 = v9.unk_00 + (sub_0201D35C() % v9.unk_04); + v6 = v9.unk_00 + (MTRNG_Next() % v9.unk_04); ov83_0223F1C0(v0, v9.unk_17, v2, v3, v7, v4, v5, v8, FX32_CONST(0.10f), v6, v9.unk_08, v9.unk_18, v9.unk_14, ¶m0->unk_08[v9.unk_15], v9.unk_16, param0->unk_04, param0->unk_0C, v9.unk_19, v9.unk_1A); v0->unk_7C = param0->unk_410; diff --git a/src/overlay083/ov83_0223F7F4.c b/src/overlay083/ov83_0223F7F4.c index 2e2d2b7d9d..1c29ed2e93 100644 --- a/src/overlay083/ov83_0223F7F4.c +++ b/src/overlay083/ov83_0223F7F4.c @@ -344,7 +344,7 @@ void ov83_0223FBBC (UnkStruct_ov83_0223FBA4 * param0, int param1, s32 param2, BO } if (param0->unk_04 < 0) { - v1 = sub_0201D35C(); + v1 = MTRNG_Next(); v2 = (v1 % 5); if (v2 <= param0->unk_08) { diff --git a/src/overlay086/ov86_0223B140.c b/src/overlay086/ov86_0223B140.c index f42ebcbbe4..6f76f61eb7 100644 --- a/src/overlay086/ov86_0223B140.c +++ b/src/overlay086/ov86_0223B140.c @@ -1729,9 +1729,9 @@ static UnkStruct_0201CD38 * ov86_0223CD94 (UnkStruct_ov86_0223B3C8 * param0) s16 v7, v8, v9; v2 = Heap_AllocFromHeap(63, sizeof(UnkStruct_ov86_0223CD94)); - v5 = sub_0201D2E8(); + v5 = LCRNG_Next(); - sub_0201D2DC(13716); + LCRNG_SetSeed(13716); for (v3 = 0, v6 = 0; v3 < 48; v3++) { v2->unk_08[v3].unk_00 = v0[v6]; @@ -1740,9 +1740,9 @@ static UnkStruct_0201CD38 * ov86_0223CD94 (UnkStruct_ov86_0223B3C8 * param0) v6 = 0; } - v7 = -4096 + (sub_0201D2E8() % 8192); - v8 = 4096 + (sub_0201D2E8() % 8192); - v9 = -328 + (sub_0201D2E8() % 656); + v7 = -4096 + (LCRNG_Next() % 8192); + v8 = 4096 + (LCRNG_Next() % 8192); + v9 = -328 + (LCRNG_Next() % 656); for (v4 = 0; v4 < 4; v4++) { v2->unk_08[v3].unk_08[v4].x = v7 + v1[v4].x; @@ -1751,21 +1751,21 @@ static UnkStruct_0201CD38 * ov86_0223CD94 (UnkStruct_ov86_0223B3C8 * param0) v2->unk_08[v3].unk_20.x = 0; v2->unk_08[v3].unk_20.y = 0; v2->unk_08[v3].unk_20.z = 0; - v2->unk_08[v3].unk_26.x = 512 + sub_0201D2E8() % 512; - v2->unk_08[v3].unk_26.y = 512 + sub_0201D2E8() % 512; - v2->unk_08[v3].unk_26.z = 512 + sub_0201D2E8() % 512; + v2->unk_08[v3].unk_26.x = 512 + LCRNG_Next() % 512; + v2->unk_08[v3].unk_26.y = 512 + LCRNG_Next() % 512; + v2->unk_08[v3].unk_26.z = 512 + LCRNG_Next() % 512; MTX_Identity44(&v2->unk_08[v3].unk_2C); } - v4 = sub_0201D2E8() & 7; + v4 = LCRNG_Next() & 7; while (v4--) { VEC_Fx16Add(&v2->unk_08[v3].unk_20, &v2->unk_08[v3].unk_26, &v2->unk_08[v3].unk_20); } } - sub_0201D2DC(v5); + LCRNG_SetSeed(v5); v2->unk_00 = 0; v2->unk_04 = 0; diff --git a/src/overlay095/ov95_02248590.c b/src/overlay095/ov95_02248590.c index a2bce723cd..442aa96eb3 100644 --- a/src/overlay095/ov95_02248590.c +++ b/src/overlay095/ov95_02248590.c @@ -226,7 +226,7 @@ void * ov95_02248590 (UnkStruct_ov95_02247628 * param0) v0->unk_CC = NULL; v0->unk_160 = NULL; v0->unk_164 = NULL; - v0->unk_BC = sub_0201D35C(); + v0->unk_BC = MTRNG_Next(); v0->unk_D0 = 0; v0->unk_168 = 0; @@ -259,7 +259,7 @@ void ov95_022485FC (void * param0) ov95_022490A4(v1->unk_164); } - sub_0201D318(v1->unk_BC); + MTRNG_SetSeed(v1->unk_BC); Heap_FreeToHeap(v1); } @@ -618,11 +618,11 @@ static void ov95_02248CA8 (UnkStruct_ov95_02248688 * param0) sub_02006EE0(93, 14, NNS_G2D_VRAM_TYPE_2DMAIN, 0, 58, &v0); sub_02006EE0(93, 14, NNS_G2D_VRAM_TYPE_2DSUB, 0, 58, &v0); ov95_022475C4(&v2, ¶m0->unk_0C, &v1, &v0, 1); - sub_0201D318(UnkEnum_ov95_02248CA8_00); + MTRNG_SetSeed(UnkEnum_ov95_02248CA8_00); for (v3 = 0; v3 < 20; v3++) { - v4 = 12 + (sub_0201D35C() % 232); - v5 = -28 + (sub_0201D35C() % 452); + v4 = 12 + (MTRNG_Next() % 232); + v5 = -28 + (MTRNG_Next() % 452); param0->unk_1C[v3][0] = ov95_022475E4(param0->unk_00, &v2, v4, v5, 0, NNS_G2D_VRAM_TYPE_2DMAIN); param0->unk_1C[v3][1] = ov95_022475E4(param0->unk_00, &v2, v4, v5 + 56, 0, NNS_G2D_VRAM_TYPE_2DMAIN); diff --git a/src/overlay097/ov97_0222D30C.c b/src/overlay097/ov97_0222D30C.c index 7ac71c71a5..a744fc8efa 100644 --- a/src/overlay097/ov97_0222D30C.c +++ b/src/overlay097/ov97_0222D30C.c @@ -1370,15 +1370,15 @@ static void ov97_0222E814 (UnkStruct_ov97_0222E398 * param0) } { if (v0 > 50) { - param0->unk_88[v0].unk_30 = 210 + 50 + v0 + sub_0201D2E8() % 5; + param0->unk_88[v0].unk_30 = 210 + 50 + v0 + LCRNG_Next() % 5; } else if (v0 > 40) { - param0->unk_88[v0].unk_30 = 210 + 40 + v0 + sub_0201D2E8() % 5; + param0->unk_88[v0].unk_30 = 210 + 40 + v0 + LCRNG_Next() % 5; } else if (v0 > 30) { - param0->unk_88[v0].unk_30 = 210 + 30 + v0 + sub_0201D2E8() % 5; + param0->unk_88[v0].unk_30 = 210 + 30 + v0 + LCRNG_Next() % 5; } else if (v0 > 25) { - param0->unk_88[v0].unk_30 = 210 + 20 + v0 + sub_0201D2E8() % 5; + param0->unk_88[v0].unk_30 = 210 + 20 + v0 + LCRNG_Next() % 5; } else if (v0 > 20) { - param0->unk_88[v0].unk_30 = 210 + 10 + v0 + sub_0201D2E8() % 5; + param0->unk_88[v0].unk_30 = 210 + 10 + v0 + LCRNG_Next() % 5; } else { int v2[] = { 1, @@ -1416,7 +1416,7 @@ static void ov97_0222E814 (UnkStruct_ov97_0222E398 * param0) param0->unk_88[v0].unk_44 = param0->unk_88[v0].unk_38; v1 = *( VecFx32 *)sub_02021D28(param0->unk_88[v0].unk_0C); - v1.x = FX32_CONST(16 + (sub_0201D2E8() % (256 - 32))); + v1.x = FX32_CONST(16 + (LCRNG_Next() % (256 - 32))); v1.y = FX32_CONST(0); sub_02021C50(param0->unk_88[v0].unk_0C, &v1); @@ -1447,13 +1447,13 @@ static void ov97_0222EA68 (UnkStruct_ov97_0222E398 * param0) param0->unk_88[v0].unk_08 = 0; if (v0 > 30) { - param0->unk_88[v0].unk_30 = 15 + (sub_0201D2E8() % 10); + param0->unk_88[v0].unk_30 = 15 + (LCRNG_Next() % 10); } else if (v0 > 20) { - param0->unk_88[v0].unk_30 = 10 + (sub_0201D2E8() % 10); + param0->unk_88[v0].unk_30 = 10 + (LCRNG_Next() % 10); } else if (v0 > 10) { - param0->unk_88[v0].unk_30 = 10 + (sub_0201D2E8() % 5); + param0->unk_88[v0].unk_30 = 10 + (LCRNG_Next() % 5); } else { - param0->unk_88[v0].unk_30 = 5 + (sub_0201D2E8() % 5); + param0->unk_88[v0].unk_30 = 5 + (LCRNG_Next() % 5); } param0->unk_88[v0].unk_30 = 0; @@ -1461,8 +1461,8 @@ static void ov97_0222EA68 (UnkStruct_ov97_0222E398 * param0) param0->unk_88[v0].unk_44 = param0->unk_88[v0].unk_38; { - int v2 = sub_0201D2E8() % 360; - int v3 = 64 + (sub_0201D2E8() % 32); + int v2 = LCRNG_Next() % 360; + int v3 = 64 + (LCRNG_Next() % 32); v1.x = param0->unk_88[v0].unk_10.x + (sub_0201D250(v2) * v3); v1.y = param0->unk_88[v0].unk_10.y + (sub_0201D264(v2) * v3); @@ -1490,30 +1490,30 @@ static void ov97_0222EBD0 (UnkStruct_ov97_0222E398 * param0) param0->unk_1848[v0].unk_2C = 4 + (v0 % 2); param0->unk_1848[v0].unk_34 = 0; param0->unk_1848[v0].unk_04 = 0; - param0->unk_1848[v0].unk_3C = 2 + (sub_0201D2E8() % 4); + param0->unk_1848[v0].unk_3C = 2 + (LCRNG_Next() % 4); param0->unk_1848[v0].unk_1C = FX32_CONST((v0 / 30) + 4); if (v0 > 60) { param0->unk_1848[v0].unk_38 = 5; - param0->unk_1848[v0].unk_30 = 70 + (sub_0201D2E8() % 10); + param0->unk_1848[v0].unk_30 = 70 + (LCRNG_Next() % 10); } else if (v0 > 50) { param0->unk_1848[v0].unk_38 = 5; - param0->unk_1848[v0].unk_30 = 60 + (sub_0201D2E8() % 10); + param0->unk_1848[v0].unk_30 = 60 + (LCRNG_Next() % 10); } else if (v0 > 40) { param0->unk_1848[v0].unk_38 = 5; - param0->unk_1848[v0].unk_30 = 50 + (sub_0201D2E8() % 5); + param0->unk_1848[v0].unk_30 = 50 + (LCRNG_Next() % 5); } else if (v0 > 30) { param0->unk_1848[v0].unk_38 = 5; - param0->unk_1848[v0].unk_30 = 40 + (sub_0201D2E8() % 10); + param0->unk_1848[v0].unk_30 = 40 + (LCRNG_Next() % 10); } else if (v0 > 20) { param0->unk_1848[v0].unk_38 = 5; - param0->unk_1848[v0].unk_30 = 30 + (sub_0201D2E8() % 10); + param0->unk_1848[v0].unk_30 = 30 + (LCRNG_Next() % 10); } else if (v0 > 10) { param0->unk_1848[v0].unk_38 = 5; - param0->unk_1848[v0].unk_30 = 20 + (sub_0201D2E8() % 5); + param0->unk_1848[v0].unk_30 = 20 + (LCRNG_Next() % 5); } else { param0->unk_1848[v0].unk_38 = 5; - param0->unk_1848[v0].unk_30 = 10 + (sub_0201D2E8() % 5); + param0->unk_1848[v0].unk_30 = 10 + (LCRNG_Next() % 5); } param0->unk_1848[v0].unk_40 = param0->unk_1848[v0].unk_38; diff --git a/src/overlay099/ov99_021D4134.c b/src/overlay099/ov99_021D4134.c index 5f6304dfd7..ca55e2f83f 100644 --- a/src/overlay099/ov99_021D4134.c +++ b/src/overlay099/ov99_021D4134.c @@ -235,8 +235,8 @@ void ov99_021D44CC (UnkStruct_ov99_021D2CB0 * param0, UnkStruct_0200D0F4 * param if (param0->unk_1114.unk_02 == 0) { if (param0->unk_1114.unk_06 % 3 == 0) { - if (sub_0201D2E8() & 1) { - param0->unk_1114.unk_00 = sub_0201D2E8() % 10; + if (LCRNG_Next() & 1) { + param0->unk_1114.unk_00 = LCRNG_Next() % 10; param0->unk_1114.unk_06++; } else { param0->unk_1114.unk_00 = 40; @@ -257,7 +257,7 @@ void ov99_021D44CC (UnkStruct_ov99_021D2CB0 * param0, UnkStruct_0200D0F4 * param if (param0->unk_1114.unk_04 != -1) { param0->unk_1114.unk_04++; - if ((param0->unk_1114.unk_04 > 16) && (sub_0201D2E8() % 5 == 0)) { + if ((param0->unk_1114.unk_04 > 16) && (LCRNG_Next() % 5 == 0)) { v1 = 1; param0->unk_1114.unk_04 = -1; } else { diff --git a/src/overlay100/ov100_021D13E4.c b/src/overlay100/ov100_021D13E4.c index e0dd61c9e2..0af0ebf6a0 100644 --- a/src/overlay100/ov100_021D13E4.c +++ b/src/overlay100/ov100_021D13E4.c @@ -328,7 +328,7 @@ static void ov100_021D1A54 (UnkStruct_ov100_021D1808 * param0) param0->unk_0C.unk_D4[v0].unk_24 = 0; param0->unk_0C.unk_D4[v0].unk_28[0] = 1; param0->unk_0C.unk_D4[v0].unk_28[1] = 1; - param0->unk_0C.unk_D4[v0].unk_28[2] = sub_0201D2E8() % 10; + param0->unk_0C.unk_D4[v0].unk_28[2] = LCRNG_Next() % 10; param0->unk_0C.unk_D4[v0].unk_28[3] = 0; param0->unk_0C.unk_D4[v0].unk_40 = sub_0200D9E8(ov100_021D4438, ¶m0->unk_0C.unk_D4[v0], 4096 - 1); } @@ -361,7 +361,7 @@ static void ov100_021D1A54 (UnkStruct_ov100_021D1808 * param0) param0->unk_0C.unk_0C[v0].unk_24 = 0; param0->unk_0C.unk_0C[v0].unk_28[0] = 1; param0->unk_0C.unk_0C[v0].unk_28[1] = 1; - param0->unk_0C.unk_0C[v0].unk_28[2] = sub_0201D2E8() % 10; + param0->unk_0C.unk_0C[v0].unk_28[2] = LCRNG_Next() % 10; param0->unk_0C.unk_0C[v0].unk_28[3] = 0; param0->unk_0C.unk_0C[v0].unk_40 = sub_0200D9E8(ov100_021D4438, ¶m0->unk_0C.unk_0C[v0], 4096); } diff --git a/src/overlay100/ov100_021D1C44.c b/src/overlay100/ov100_021D1C44.c index db6b387583..5f6b3451e7 100644 --- a/src/overlay100/ov100_021D1C44.c +++ b/src/overlay100/ov100_021D1C44.c @@ -238,7 +238,7 @@ static void ov100_021D2250 (UnkStruct_ov100_021D1C98 * param0) param0->unk_08.unk_0C[v0].unk_24 = v0; param0->unk_08.unk_0C[v0].unk_28[0] = 1; param0->unk_08.unk_0C[v0].unk_28[1] = 1; - param0->unk_08.unk_0C[v0].unk_28[2] = sub_0201D2E8() % 10; + param0->unk_08.unk_0C[v0].unk_28[2] = LCRNG_Next() % 10; param0->unk_08.unk_0C[v0].unk_28[3] = 0; param0->unk_08.unk_0C[v0].unk_40 = sub_0200D9E8(ov100_021D4414, ¶m0->unk_08.unk_0C[v0], 4096); } diff --git a/src/overlay100/ov100_021D400C.c b/src/overlay100/ov100_021D400C.c index c4e5c61cd1..950f87e870 100644 --- a/src/overlay100/ov100_021D400C.c +++ b/src/overlay100/ov100_021D400C.c @@ -153,7 +153,7 @@ static void ov100_021D42B0 (UnkStruct_ov100_021D4104 * param0) if (v3 == 0) { param0->unk_28[2]++; param0->unk_28[2] %= NELEMS(v2); - param0->unk_28[2] = sub_0201D2E8() % NELEMS(v2); + param0->unk_28[2] = LCRNG_Next() % NELEMS(v2); param0->unk_0C = 3; } @@ -172,8 +172,8 @@ static void ov100_021D4318 (UnkStruct_ov100_021D4104 * param0) if (param0->unk_20 < 12) { param0->unk_24++; param0->unk_24 %= 3; - param0->unk_28[0] = (sub_0201D2E8() % param0->unk_24) + 1; - param0->unk_28[1] = (sub_0201D2E8() % param0->unk_24) + 1; + param0->unk_28[0] = (LCRNG_Next() % param0->unk_24) + 1; + param0->unk_28[1] = (LCRNG_Next() % param0->unk_24) + 1; param0->unk_0C = 2; } diff --git a/src/overlay101/ov101_021D1A28.c b/src/overlay101/ov101_021D1A28.c index 75d0ac8f9b..88397cd581 100644 --- a/src/overlay101/ov101_021D1A28.c +++ b/src/overlay101/ov101_021D1A28.c @@ -228,7 +228,7 @@ static void ov101_021D1A68 (UnkStruct_ov101_021D13C8 * param0) fx32 v2; for (v0 = 0; v0 < 3; v0++) { - v1 = (int)sub_0201D2E8() % 21; + v1 = (int)LCRNG_Next() % 21; param0->unk_A8[v0] = v1; param0->unk_90[v0] = (FX32_ONE * ((21 * 32))) - ((FX32_ONE * ((v1) * 32))); param0->unk_90[v0] %= (FX32_ONE * ((21 * 32))); @@ -2738,7 +2738,7 @@ static fx32 ov101_021D4024 (UnkStruct_ov101_021D13C8 * param0, UnkEnum_ov101_021 static u32 ov101_021D405C (UnkStruct_ov101_021D13C8 * param0) { - u32 v0 = ((u32)sub_0201D2E8()) % 100; + u32 v0 = ((u32)LCRNG_Next()) % 100; return v0; } @@ -3063,7 +3063,7 @@ static UnkEnum_ov101_021D4550 ov101_021D4550 (UnkStruct_ov101_021D13C8 * param0) static void ov101_021D45B0 (UnkStruct_ov101_021D13C8 * param0) { - param0->unk_34 = sub_0201D2E8() % 6; + param0->unk_34 = LCRNG_Next() % 6; } static void ov101_021D45C4 (UnkStruct_ov101_021D13C8 * param0) diff --git a/src/overlay104/ov104_0222DCE0.c b/src/overlay104/ov104_0222DCE0.c index 355c55cfe7..97860b7376 100644 --- a/src/overlay104/ov104_0222DCE0.c +++ b/src/overlay104/ov104_0222DCE0.c @@ -196,7 +196,7 @@ u32 ov104_0222DD6C (UnkStruct_ov104_0223A348_sub2 * param0, u16 param1, u32 para if (param3 == 0) { do { - v2 = (sub_0201D2E8() | sub_0201D2E8() << 16); + v2 = (LCRNG_Next() | LCRNG_Next() << 16); } while ((v4.unk_0B != GetNatureFromPersonality(v2)) || (sub_02075E38(param2, v2) == 1)); param0->unk_10 = v2; @@ -465,7 +465,7 @@ u32 ov104_0222E2F0 (UnkStruct_ov104_0223A348_sub2 * param0, u16 param1, int para { u32 v0, v1, v2; - v0 = sub_0201D2E8() | (sub_0201D2E8() << 16); + v0 = LCRNG_Next() | (LCRNG_Next() << 16); v2 = ov104_0222DD6C(param0, param1, v0, param4, param3, param2, 0, param5, param6); return v2; @@ -531,7 +531,7 @@ BOOL ov104_0222E3E4 (UnkStruct_0204B184 * param0, const u16 param1[], const u16 v2 = 0; while (v0 != param4) { - v5 = (sub_0201D2E8() % param0->unk_02); + v5 = (LCRNG_Next() % param0->unk_02); v1 = param0->unk_04[v5]; ov104_0222DCF4(&v3[v0], v1, 179); diff --git a/src/overlay104/ov104_0222FBE4.c b/src/overlay104/ov104_0222FBE4.c index 6ced988323..8ac6f61f4d 100644 --- a/src/overlay104/ov104_0222FBE4.c +++ b/src/overlay104/ov104_0222FBE4.c @@ -1995,7 +1995,7 @@ static BOOL ov104_0223102C (UnkStruct_ov104_0222E930 * param0) u16 * v0 = ov104_0222FBE4(param0); u16 v1 = ov104_0222FC00(param0); - *v0 = (sub_0201D2E8() % v1); + *v0 = (LCRNG_Next() % v1); return 1; } diff --git a/src/overlay104/ov104_022339B4.c b/src/overlay104/ov104_022339B4.c index db92a636ff..f272826c68 100644 --- a/src/overlay104/ov104_022339B4.c +++ b/src/overlay104/ov104_022339B4.c @@ -209,7 +209,7 @@ static void ov104_02233D80 (UnkStruct_ov104_0223ADA0 * param0, u8 param1, u8 par u32 v3; UnkStruct_ov104_0223A348_sub2 v4; - v0 = (sub_0201D2E8() % 6); + v0 = (LCRNG_Next() % 6); if (param2 == 0) { v1 = param0->unk_254[param1]; diff --git a/src/overlay104/ov104_02237DD8.c b/src/overlay104/ov104_02237DD8.c index c14d0fe84a..6b352f7b03 100644 --- a/src/overlay104/ov104_02237DD8.c +++ b/src/overlay104/ov104_02237DD8.c @@ -1231,7 +1231,7 @@ static void ov104_02238D8C (UnkStruct_ov104_0223BFFC * param0, Party * param1, u v0 = 0; } } else { - v3 = (sub_0201D2E8() % 4 + 2); + v3 = (LCRNG_Next() % 4 + 2); sub_02074B30(v5, 160, &v3); break; } diff --git a/src/overlay104/ov104_0223A7F4.c b/src/overlay104/ov104_0223A7F4.c index 50666edf36..cc8218ec8b 100644 --- a/src/overlay104/ov104_0223A7F4.c +++ b/src/overlay104/ov104_0223A7F4.c @@ -126,7 +126,7 @@ static int ov104_0223A7F4 (u8 param0, int param1, int param2) v2 = Unk_ov104_022401FC[param1].unk_00; } - v0 = v2 + (sub_0201D2E8() % v1); + v0 = v2 + (LCRNG_Next() % v1); return v0; } @@ -231,10 +231,10 @@ BOOL ov104_0223A918 (const u16 param0[], const u16 param1[], int param2, int par while (v1 != param3) { if ((v1 >= param3 - v6) && (v7->unk_07 == 1)) { v2 = (v7 + 1)->unk_04 - (v7 + 1)->unk_02; - v3 = (v7 + 1)->unk_04 - (sub_0201D2E8() % (v2 + 1)); + v3 = (v7 + 1)->unk_04 - (LCRNG_Next() % (v2 + 1)); v0 = (v7 + 1)->unk_06; } else { - v3 = v7->unk_04 - (sub_0201D2E8() % (v2 + 1)); + v3 = v7->unk_04 - (LCRNG_Next() % (v2 + 1)); v0 = v7->unk_06; } diff --git a/src/overlay104/ov104_0223AF58.c b/src/overlay104/ov104_0223AF58.c index 20dc97bce1..3cc49e9bc2 100644 --- a/src/overlay104/ov104_0223AF58.c +++ b/src/overlay104/ov104_0223AF58.c @@ -1376,7 +1376,7 @@ void ov104_0223AF58 (u8 param0, u8 param1, u8 param2, u8 param3, u16 param4[]) v3 = ov104_0223B644(param2); do { - v1 = (sub_0201D2E8() % (8 + 4)); + v1 = (LCRNG_Next() % (8 + 4)); if (v1 < 8) { param4[v2 + v4] = Unk_ov104_0224041C[v3][v1]; @@ -1413,7 +1413,7 @@ void ov104_0223AFB4 (u8 param0, u8 param1, int param2, u8 param3, u8 param4, u16 } do { - v5 = (sub_0201D2E8() % (NELEMS(Unk_ov104_022404BC))); + v5 = (LCRNG_Next() % (NELEMS(Unk_ov104_022404BC))); v1 = v5; while (TRUE) { @@ -1441,7 +1441,7 @@ void ov104_0223AFB4 (u8 param0, u8 param1, int param2, u8 param3, u8 param4, u16 if (v5 == v1) { while (TRUE) { - v6 = (sub_0201D2E8() % 8); + v6 = (LCRNG_Next() % 8); if (v4 != Unk_ov104_0224041C[v8][v6]) { param5[v7 + v3] = Unk_ov104_0224041C[v8][v6]; @@ -1519,7 +1519,7 @@ void ov104_0223B0C8 (u8 param0, u8 param1, u8 param2, u8 param3, u16 param4, u16 } v5 = (v0->unk_02 - v0->unk_00) + 1; - v4 = v0->unk_00 + (sub_0201D2E8() % v5); + v4 = v0->unk_00 + (LCRNG_Next() % v5); v4 -= 1; v6 = v4; diff --git a/src/overlay104/ov104_0223B6F4.c b/src/overlay104/ov104_0223B6F4.c index 685d16d879..08456ed24f 100644 --- a/src/overlay104/ov104_0223B6F4.c +++ b/src/overlay104/ov104_0223B6F4.c @@ -94,7 +94,7 @@ static int ov104_0223B6F4 (u8 param0, int param1, int param2) v2 = Unk_ov104_02241258[v4].unk_00; } - v0 = v2 + (sub_0201D2E8() % v1); + v0 = v2 + (LCRNG_Next() % v1); return v0; } diff --git a/src/overlay104/ov104_0223BCBC.c b/src/overlay104/ov104_0223BCBC.c index 351dc567ac..a8103a564b 100644 --- a/src/overlay104/ov104_0223BCBC.c +++ b/src/overlay104/ov104_0223BCBC.c @@ -97,7 +97,7 @@ static int ov104_0223BCBC (u8 param0, int param1, int param2) v2 = Unk_ov104_02241298[param1].unk_00; } - v0 = v2 + (sub_0201D2E8() % v1); + v0 = v2 + (LCRNG_Next() % v1); return v0; } diff --git a/src/overlay108/ov108_02241AE0.c b/src/overlay108/ov108_02241AE0.c index dea438198b..670f4470a2 100644 --- a/src/overlay108/ov108_02241AE0.c +++ b/src/overlay108/ov108_02241AE0.c @@ -339,7 +339,7 @@ int ov108_02241AE0 (UnkStruct_020067E8 * param0, int * param1) (*v1->unk_24) = ov108_02242B1C(v1); - v1->unk_16 = (sub_0201D2E8() % (4 * 4)); + v1->unk_16 = (LCRNG_Next() % (4 * 4)); ov108_0224237C(v1); @@ -1108,7 +1108,7 @@ static void ov108_02242964 (UnkStruct_ov108_02241DB0 * param0, int param1) param0->unk_10 = 0; if (param0->unk_0C == 1) { - param0->unk_0D = (sub_0201D2E8() % (4 * 4)); + param0->unk_0D = (LCRNG_Next() % (4 * 4)); } else { param0->unk_0D++; } @@ -1267,7 +1267,7 @@ void ov108_02242AE8 (UnkStruct_ov108_02241DB0 * param0, u16 param1, u16 param2) static u16 ov108_02242B1C (UnkStruct_ov108_02241DB0 * param0) { - return sub_0201D2E8(); + return LCRNG_Next(); } void ov108_02242B24 (int param0, int param1, void * param2, void * param3) @@ -1516,7 +1516,7 @@ static void ov108_02242E10 (UnkStruct_ov108_02241DB0 * param0) v2 += param0->unk_30[2]; } - v4 = (sub_0201D2E8() % v3); + v4 = (LCRNG_Next() % v3); v4 += v2; v6 = v4; v0 = 0; @@ -1561,7 +1561,7 @@ static u8 ov108_02242EF4 (UnkStruct_ov108_02241DB0 * param0, u8 param1) u16 v2; v0 = 0; - v2 = (sub_0201D2E8() % 100); + v2 = (LCRNG_Next() % 100); for (v1 = 0; v1 < 4; v1++) { v0 += Unk_ov108_022436B0[param1][v1]; diff --git a/src/overlay109/ov109_021D0D80.c b/src/overlay109/ov109_021D0D80.c index 3718e43051..a98a29ef56 100644 --- a/src/overlay109/ov109_021D0D80.c +++ b/src/overlay109/ov109_021D0D80.c @@ -1301,7 +1301,7 @@ static int ov109_021D1918 (UnkStruct_ov109_021D0F70 * param0) BOOL v1; v0 = Unk_ov109_021D5BE4[param0->unk_2C.unk_04][0]; - v0 += sub_0201D2E8() % (Unk_ov109_021D5BE4[param0->unk_2C.unk_04][1] - v0 + 1); + v0 += LCRNG_Next() % (Unk_ov109_021D5BE4[param0->unk_2C.unk_04][1] - v0 + 1); if (v0 < Unk_ov109_021D5BE4[param0->unk_2C.unk_04][0]) { v0 = Unk_ov109_021D5BE4[param0->unk_2C.unk_04][0]; diff --git a/src/overlay111/ov111_021D0D80.c b/src/overlay111/ov111_021D0D80.c index 388b822e75..c3b04cfc48 100644 --- a/src/overlay111/ov111_021D0D80.c +++ b/src/overlay111/ov111_021D0D80.c @@ -1715,7 +1715,7 @@ static void ov111_021D26EC (UnkStruct_ov111_021D0F7C * param0) for (v0 = 0; v0 < 2; v0++) { while (TRUE) { - v1 = (sub_0201D2E8() % 9); + v1 = (LCRNG_Next() % 9); if (param0->unk_3C4[v1] == 176) { param0->unk_3C4[v1] = 4; @@ -1732,12 +1732,12 @@ static void ov111_021D271C (UnkStruct_ov111_021D0F7C * param0) int v0, v1, v2, v3, v4; u8 v5; - v5 = (sub_0201D2E8() % 4); + v5 = (LCRNG_Next() % 4); v3 = 0; for (v0 = 0; v0 < 9; v0++) { while (TRUE) { - v4 = (sub_0201D2E8() % 9); + v4 = (LCRNG_Next() % 9); if (param0->unk_3C4[v4] == 176) { v3 = 0; @@ -1813,14 +1813,14 @@ static void ov111_021D27D4 (UnkStruct_ov111_021D0F7C * param0, u8 param1) v2[v0] = 0xff; } - v3 = (sub_0201D2E8() % 4); + v3 = (LCRNG_Next() % 4); for (v0 = 0; v0 < 4; v0++) { if (v0 == v3) { param0->unk_3CE[v0] = 92; } else { while (TRUE) { - v2[v0] = (sub_0201D2E8() % (NELEMS(Unk_ov111_021D37E4))); + v2[v0] = (LCRNG_Next() % (NELEMS(Unk_ov111_021D37E4))); for (v1 = 0; v1 < v0; v1++) { if (v2[v1] == v2[v0]) { diff --git a/src/overlay114/ov114_0225C700.c b/src/overlay114/ov114_0225C700.c index bff07f3e4c..4e66ec40d1 100644 --- a/src/overlay114/ov114_0225C700.c +++ b/src/overlay114/ov114_0225C700.c @@ -1910,7 +1910,7 @@ static int ov114_0225DA2C (const u8 * param0, u32 param1) u32 v1; int v2; - v0 = sub_0201D35C() % 100; + v0 = MTRNG_Next() % 100; v1 = 0; for (v2 = 0; v2 < param1; v2++) { diff --git a/src/overlay115/ov115_02260CEC.c b/src/overlay115/ov115_02260CEC.c index 0b57c0d78e..2126e2f26c 100644 --- a/src/overlay115/ov115_02260CEC.c +++ b/src/overlay115/ov115_02260CEC.c @@ -2180,7 +2180,7 @@ static void ov115_022626E0 (UnkStruct_ov115_022622F8 * param0, UnkStruct_ov115_0 param0->unk_04.unk_04.z = -param0->unk_04.unk_04.z; if (param4) { - v3 = sub_0201D35C(); + v3 = MTRNG_Next(); if (MATH_ABS(param0->unk_04.unk_04.x) <= MATH_ABS(param0->unk_04.unk_04.z)) { v1 = FX_Mul(param0->unk_04.unk_04.z, (FX32_CONST(1.0f))); diff --git a/src/overlay116/ov116_02260440.c b/src/overlay116/ov116_02260440.c index f7ae810013..293ea15ae4 100644 --- a/src/overlay116/ov116_02260440.c +++ b/src/overlay116/ov116_02260440.c @@ -38,7 +38,7 @@ static void ov116_02260440 (int param0, int param1, void * param2, void * param3 v0->unk_14 = *((UnkStruct_ov116_0226048C *)param2); - sub_0201D2DC(v0->unk_14.unk_04); + LCRNG_SetSeed(v0->unk_14.unk_04); ov116_022617D4(v0); } diff --git a/src/overlay116/ov116_022604C4.c b/src/overlay116/ov116_022604C4.c index bdfbebbb67..f5ab3d2111 100644 --- a/src/overlay116/ov116_022604C4.c +++ b/src/overlay116/ov116_022604C4.c @@ -63,7 +63,7 @@ static u32 ov116_022617E4(UnkStruct_ov116_0226139C * param0); static void ov116_022604C4 (UnkStruct_ov116_0226139C * param0) { - param0->unk_78 = sub_0201D2D0(); + param0->unk_78 = LCRNG_GetSeed(); ov116_022612CC(param0); sub_02017798(ov116_02261794, param0); @@ -680,7 +680,7 @@ static void ov116_022610FC (UnkStruct_ov116_0226139C * param0) v0 = sub_0201E530(); } - sub_0201D2DC(param0->unk_78); + LCRNG_SetSeed(param0->unk_78); ov116_02261F3C(param0->unk_04); ov116_02261DF0(param0->unk_04); diff --git a/src/overlay116/ov116_02262A8C.c b/src/overlay116/ov116_02262A8C.c index 647a8a1287..9276c5e7a4 100644 --- a/src/overlay116/ov116_02262A8C.c +++ b/src/overlay116/ov116_02262A8C.c @@ -1118,18 +1118,18 @@ static const UnkStruct_ov116_02267C88 Unk_ov116_02267C88[][4] = { static inline u32 inline_ov116_02263E20 (void) { - u32 v0 = sub_0201D2D0(); + u32 v0 = LCRNG_GetSeed(); u32 v1; - v1 = sub_0201D2E8(); - sub_0201D2DC(v0); + v1 = LCRNG_Next(); + LCRNG_SetSeed(v0); return v1; } static inline s8 inline_ov116_02263E20_1 (void) { - if (sub_0201D2E8() % 2) { + if (LCRNG_Next() % 2) { return +1; } else { return -1; diff --git a/src/overlay117/ov117_02263AF0.c b/src/overlay117/ov117_02263AF0.c index 0f7798bba8..b0daccd04a 100644 --- a/src/overlay117/ov117_02263AF0.c +++ b/src/overlay117/ov117_02263AF0.c @@ -454,7 +454,7 @@ static void ov117_02263BA4 (UnkStruct_02018340 * param0, UnkStruct_ov117_02263DA if (param1->unk_10 == 0) { v7 = 0; } else { - v7 = (sub_0201D2E8() & 7) + 1; + v7 = (LCRNG_Next() & 7) + 1; if (param1->unk_28 & 1) { v7 = -v7; @@ -841,11 +841,11 @@ static void ov117_02264214 (UnkStruct_ov117_02261280 * param0, UnkStruct_ov117_0 sub_0200D364(v1, v6); sub_0200D324(v1->unk_00); - v10->unk_04 = sub_0201D2E8() % 0x2000 + 0x2000; - v10->unk_08 = sub_0201D2E8() % 0x4000 + 0x2000; - v10->unk_0C = (sub_0201D2E8() % 360) << FX32_SHIFT; - v10->unk_10 = sub_0201D2E8() % 0x14000 + 0xa000; - v10->unk_14 = sub_0201D2E8() % 15 + 20; + v10->unk_04 = LCRNG_Next() % 0x2000 + 0x2000; + v10->unk_08 = LCRNG_Next() % 0x4000 + 0x2000; + v10->unk_0C = (LCRNG_Next() % 360) << FX32_SHIFT; + v10->unk_10 = LCRNG_Next() % 0x14000 + 0xa000; + v10->unk_14 = LCRNG_Next() % 15 + 20; param1->unk_04[v7].unk_00 = v1; @@ -866,14 +866,14 @@ static void ov117_02264214 (UnkStruct_ov117_02261280 * param0, UnkStruct_ov117_0 } sub_0200D500(v1, 128, 96, ((192 + 160) << FX32_SHIFT)); - sub_0200D364(v1, 28 + sub_0201D2E8() % 3); + sub_0200D364(v1, 28 + LCRNG_Next() % 3); sub_0200D324(v1->unk_00); - v11->unk_04 = sub_0201D2E8() % 0x2000 + 0x2000; - v11->unk_08 = sub_0201D2E8() % 0x4000 + 0x2000; - v11->unk_0C = (sub_0201D2E8() % 360) << FX32_SHIFT; - v11->unk_10 = sub_0201D2E8() % 0x14000 + 0x10000; - v11->unk_14 = sub_0201D2E8() % 15 + 20; + v11->unk_04 = LCRNG_Next() % 0x2000 + 0x2000; + v11->unk_08 = LCRNG_Next() % 0x4000 + 0x2000; + v11->unk_0C = (LCRNG_Next() % 360) << FX32_SHIFT; + v11->unk_10 = LCRNG_Next() % 0x14000 + 0x10000; + v11->unk_14 = LCRNG_Next() % 15 + 20; param1->unk_868[v8].unk_00 = v1; } @@ -894,11 +894,11 @@ static void ov117_02264214 (UnkStruct_ov117_02261280 * param0, UnkStruct_ov117_0 sub_0200D364(v1, 11); sub_0200D324(v1->unk_00); - v12->unk_04 = sub_0201D2E8() % 0x2000 + 0x2000; - v12->unk_08 = sub_0201D2E8() % 0x4000 + 0x2000; - v12->unk_0C = (sub_0201D2E8() % 360) << FX32_SHIFT; - v12->unk_10 = sub_0201D2E8() % 0x14000 + 0x10000; - v12->unk_14 = sub_0201D2E8() % 15 + 20; + v12->unk_04 = LCRNG_Next() % 0x2000 + 0x2000; + v12->unk_08 = LCRNG_Next() % 0x4000 + 0x2000; + v12->unk_0C = (LCRNG_Next() % 360) << FX32_SHIFT; + v12->unk_10 = LCRNG_Next() % 0x14000 + 0x10000; + v12->unk_14 = LCRNG_Next() % 15 + 20; param1->unk_928[v8].unk_00 = v1; } @@ -2456,8 +2456,8 @@ static void ov117_0226639C (UnkStruct_ov117_02261280 * param0, UnkStruct_ov117_0 sub_0200D810(param2->unk_00[v2], GX_OAM_MODE_XLU); sub_0200D3F4(param2->unk_00[v2], 1); - param2->unk_08[v2] = sub_0201D2E8() % 0x1000 + 0x1000; - param2->unk_10[v2] = sub_0201D2E8() % 0x400 + 0x400; + param2->unk_08[v2] = LCRNG_Next() % 0x1000 + 0x1000; + param2->unk_10[v2] = LCRNG_Next() % 0x400 + 0x400; if (v2 & 1) { param2->unk_08[v2] *= -1; diff --git a/src/poffin.c b/src/poffin.c index 0e773bd1f6..1172f172c4 100644 --- a/src/poffin.c +++ b/src/poffin.c @@ -88,7 +88,7 @@ static void MakePoffinFoul (Poffin * poffin, u8 param1) v0 = 0; do { - v1 = sub_0201D2E8() % 5; + v1 = LCRNG_Next() % 5; if (poffin->attributes[v1 + 1] != 0) { continue; diff --git a/src/unk_02006224.c b/src/unk_02006224.c index 9cc46d7423..f7eab59e2b 100644 --- a/src/unk_02006224.c +++ b/src/unk_02006224.c @@ -85,7 +85,7 @@ BOOL sub_0200629C (const UnkStruct_0202CC84 * param0, u32 param1, int param2, in sub_02006350(); sub_02004BCC(14); - v0 = (sub_0201D2E8() % 8192); + v0 = (LCRNG_Next() % 8192); sub_0202CCB4(v3, sub_0202CCB0(param0)); { diff --git a/src/unk_02014D38.c b/src/unk_02014D38.c index fb5f01c48d..708e07608c 100644 --- a/src/unk_02014D38.c +++ b/src/unk_02014D38.c @@ -282,7 +282,7 @@ u32 sub_02014EE4 (UnkStruct_02014EC4 * param0) } if (v1) { - int v2 = sub_0201D2E8() % v1; + int v2 = LCRNG_Next() % v1; for (v0 = 0; v0 < 32; v0++) { if (((param0->unk_04 >> v0) & 1) == 0) { diff --git a/src/unk_0201D15C.c b/src/unk_0201D15C.c index f3e922c3ec..fd8381f137 100644 --- a/src/unk_0201D15C.c +++ b/src/unk_0201D15C.c @@ -10,7 +10,7 @@ typedef struct { MATHCRC16Table unk_00; } UnkStruct_021BFB10; -static u16 sub_0201D608(u32 * param0); +static u16 LCRNG_NextFrom(u32 * seed); fx32 sub_0201D15C (u16 param0) { @@ -85,78 +85,78 @@ fx32 sub_0201D2C4 (fx32 param0) return sub_0201D264(v0); } -u32 Unk_021BFB14; +u32 gLCRNG_State; -u32 sub_0201D2D0 (void) +u32 LCRNG_GetSeed (void) { - return Unk_021BFB14; + return gLCRNG_State; } -void sub_0201D2DC (u32 param0) +void LCRNG_SetSeed (u32 seed) { - Unk_021BFB14 = param0; + gLCRNG_State = seed; } -u16 sub_0201D2E8 (void) +u16 LCRNG_Next (void) { - Unk_021BFB14 = Unk_021BFB14 * 1103515245L + 24691; - return (u16)(Unk_021BFB14 / 65536L); + gLCRNG_State = gLCRNG_State * 1103515245L + 24691; + return (u16)(gLCRNG_State / 65536L); } -u32 sub_0201D30C (u32 param0) +u32 ARNG_Next (u32 seed) { - return param0 * 1812433253L + 1; + return seed * 1812433253L + 1; } -static u32 Unk_021BFB18[624]; -static int Unk_02100834 = 624 + 1; -static u32 Unk_02100838[2] = {0x0UL, 0x9908b0dfUL}; +static u32 sMTRNG_State[624]; +static int sMTRNG_Size = 624 + 1; +static u32 sMTRNG_Xor[2] = {0x0UL, 0x9908b0dfUL}; -void sub_0201D318 (u32 param0) +void MTRNG_SetSeed (u32 seed) { - Unk_021BFB18[0] = param0 & 0xffffffff; + sMTRNG_State[0] = seed & 0xffffffff; - for (Unk_02100834 = 1; Unk_02100834 < 624; Unk_02100834++) { - Unk_021BFB18[Unk_02100834] = (1812433253UL * (Unk_021BFB18[Unk_02100834 - 1] ^ (Unk_021BFB18[Unk_02100834 - 1] >> 30)) + Unk_02100834); - Unk_021BFB18[Unk_02100834] &= 0xffffffff; + for (sMTRNG_Size = 1; sMTRNG_Size < 624; sMTRNG_Size++) { + sMTRNG_State[sMTRNG_Size] = (1812433253UL * (sMTRNG_State[sMTRNG_Size - 1] ^ (sMTRNG_State[sMTRNG_Size - 1] >> 30)) + sMTRNG_Size); + sMTRNG_State[sMTRNG_Size] &= 0xffffffff; } } -u32 sub_0201D35C (void) +u32 MTRNG_Next (void) { - u32 v0; + u32 result; - if (Unk_02100834 >= 624) { - int v1; + if (sMTRNG_Size >= 624) { + int i; - if (Unk_02100834 == 624 + 1) { - sub_0201D318(5489UL); + if (sMTRNG_Size == 624 + 1) { + MTRNG_SetSeed(5489UL); } - for (v1 = 0; v1 < 624 - 397; v1++) { - v0 = (Unk_021BFB18[v1] & 0x80000000UL) | (Unk_021BFB18[v1 + 1] & 0x7fffffffUL); - Unk_021BFB18[v1] = Unk_021BFB18[v1 + 397] ^ (v0 >> 1) ^ Unk_02100838[v0 & 0x1UL]; + for (i = 0; i < 624 - 397; i++) { + result = (sMTRNG_State[i] & 0x80000000UL) | (sMTRNG_State[i + 1] & 0x7fffffffUL); + sMTRNG_State[i] = sMTRNG_State[i + 397] ^ (result >> 1) ^ sMTRNG_Xor[result & 0x1UL]; } - for (; v1 < 624 - 1; v1++) { - v0 = (Unk_021BFB18[v1] & 0x80000000UL) | (Unk_021BFB18[v1 + 1] & 0x7fffffffUL); - Unk_021BFB18[v1] = Unk_021BFB18[v1 + (397 - 624)] ^ (v0 >> 1) ^ Unk_02100838[v0 & 0x1UL]; + for (; i < 624 - 1; i++) { + result = (sMTRNG_State[i] & 0x80000000UL) | (sMTRNG_State[i + 1] & 0x7fffffffUL); + sMTRNG_State[i] = sMTRNG_State[i + (397 - 624)] ^ (result >> 1) ^ sMTRNG_Xor[result & 0x1UL]; } - v0 = (Unk_021BFB18[624 - 1] & 0x80000000UL) | (Unk_021BFB18[0] & 0x7fffffffUL); + result = (sMTRNG_State[624 - 1] & 0x80000000UL) | (sMTRNG_State[0] & 0x7fffffffUL); - Unk_021BFB18[624 - 1] = Unk_021BFB18[397 - 1] ^ (v0 >> 1) ^ Unk_02100838[v0 & 0x1UL]; - Unk_02100834 = 0; + sMTRNG_State[624 - 1] = sMTRNG_State[397 - 1] ^ (result >> 1) ^ sMTRNG_Xor[result & 0x1UL]; + sMTRNG_Size = 0; } - v0 = Unk_021BFB18[Unk_02100834++]; + result = sMTRNG_State[sMTRNG_Size++]; - v0 ^= (v0 >> 11); - v0 ^= (v0 << 7) & 0x9d2c5680UL; - v0 ^= (v0 << 15) & 0xefc60000UL; - v0 ^= (v0 >> 18); + result ^= (result >> 11); + result ^= (result << 7) & 0x9d2c5680UL; + result ^= (result << 15) & 0xefc60000UL; + result ^= (result >> 18); - return v0; + return result; } void sub_0201D470 (MtxFx22 * param0, u16 param1, fx32 param2, fx32 param3, u8 param4) @@ -235,7 +235,7 @@ void sub_0201D5D4 (void * param0, u32 param1, u32 param2) u16 * v1 = (u16 *)param0; for (v0 = 0; v0 < param1 / 2; v0++) { - v1[v0] ^= sub_0201D608(¶m2); + v1[v0] ^= LCRNG_NextFrom(¶m2); } } @@ -244,10 +244,10 @@ void sub_0201D600 (void * param0, u32 param1, u32 param2) sub_0201D5D4(param0, param1, param2); } -static u16 sub_0201D608 (u32 * param0) +static u16 LCRNG_NextFrom (u32 * seed) { - param0[0] = param0[0] * 1103515245L + 24691; - return (u16)(param0[0] / 65536L); + seed[0] = seed[0] * 1103515245L + 24691; + return (u16)(seed[0] / 65536L); } static UnkStruct_021BFB10 * Unk_021BFB10 = NULL; diff --git a/src/unk_020244AC.c b/src/unk_020244AC.c index 074831f634..05a260d1f1 100644 --- a/src/unk_020244AC.c +++ b/src/unk_020244AC.c @@ -1163,7 +1163,7 @@ int sub_02025574 (UnkStruct_021C0794 * param0, int param1, void * param2) sub_020259F8(param0, param1, &v3, &v4, &v6); do { - v5 = sub_0201D30C(v3); + v5 = ARNG_Next(v3); } while (v5 == 0xffffffff); sub_02025A18(param0, param1, v5, v3, v6 ^ 1); diff --git a/src/unk_0202854C.c b/src/unk_0202854C.c index c3da5d823d..bde574f802 100644 --- a/src/unk_0202854C.c +++ b/src/unk_0202854C.c @@ -199,7 +199,7 @@ void sub_02028658 (UnkStruct_021C0794 * param0, int param1) } } - v0->unk_90 = sub_0201D30C(v0->unk_90 + param1); + v0->unk_90 = ARNG_Next(v0->unk_90 + param1); v0->unk_9AC_0 = 1; } diff --git a/src/unk_0202B37C.c b/src/unk_0202B37C.c index e5f1982fef..37c5e3ac5e 100644 --- a/src/unk_0202B37C.c +++ b/src/unk_0202B37C.c @@ -45,7 +45,7 @@ void sub_0202B3D8 (UnkStruct_0202B4A0 * param0, u32 param1) for (v0 = 0; v0 < 6; v0++) { for (v1 = 0; v1 < param1; v1++) { - param0->unk_00[v0].unk_28 = sub_0201D30C(param0->unk_00[v0].unk_28); + param0->unk_00[v0].unk_28 = ARNG_Next(param0->unk_00[v0].unk_28); } } } @@ -58,7 +58,7 @@ u32 sub_0202B400 (UnkStruct_0202B4A0 * param0, int param1) void sub_0202B40C (UnkStruct_0202B4A0 * param0, int param1, u32 param2) { param0->unk_00[param1].unk_24 = param2; - param0->unk_00[param1].unk_28 = sub_0201D30C(param2); + param0->unk_00[param1].unk_28 = ARNG_Next(param2); } u32 sub_0202B428 (UnkStruct_0202B4A0 * param0) diff --git a/src/unk_0202D7A8.c b/src/unk_0202D7A8.c index a68b87e97d..ec911eeab3 100644 --- a/src/unk_0202D7A8.c +++ b/src/unk_0202D7A8.c @@ -22,8 +22,8 @@ void sub_0202D7B0 (UnkStruct_0202D7B0 * param0) { memset(param0, 0, sizeof(UnkStruct_0202D7B0)); - param0->unk_00 = sub_0201D35C(); - param0->unk_04 = sub_0201D35C(); + param0->unk_00 = MTRNG_Next(); + param0->unk_04 = MTRNG_Next(); param0->unk_08.unk_00 = 0; param0->unk_08.unk_04 = 0xffff; param0->unk_08.unk_06 = 0xffff; diff --git a/src/unk_02030CE8.c b/src/unk_02030CE8.c index 46726c8e1d..3a2e60d44d 100644 --- a/src/unk_02030CE8.c +++ b/src/unk_02030CE8.c @@ -138,7 +138,7 @@ u32 sub_02030E48 (UnkStruct_021C0794 * param0, UnkStruct_ov96_0223B574 * param1) sub_02030DD0(param0, param1); - v0 = sub_0201D2E8() % 1000; + v0 = LCRNG_Next() % 1000; param1->unk_58 = v0; param1->unk_5A = 0xffff; diff --git a/src/unk_0203D1B8.c b/src/unk_0203D1B8.c index 074109badf..62a7acd97f 100644 --- a/src/unk_0203D1B8.c +++ b/src/unk_0203D1B8.c @@ -1642,21 +1642,21 @@ static u8 sub_0203E484 (UnkStruct_021C0794 * param0, u8 param1) u8 v3[12]; u8 v4, v5, v6, v7; - v2 = sub_0201D2D0(); + v2 = LCRNG_GetSeed(); - sub_0201D2DC(sub_0202B428(v1)); + LCRNG_SetSeed(sub_0202B428(v1)); MI_CpuCopy8(v0, v3, sizeof(v3)); for (v4 = 0; v4 < 12; v4++) { for (v5 = v4 + 1; v5 < 12; v5++) { - v6 = sub_0201D2E8() % 12; + v6 = LCRNG_Next() % 12; v7 = v3[v4]; v3[v4] = v3[v6]; v3[v6] = v7; } } - sub_0201D2DC(v2); + LCRNG_SetSeed(v2); return v3[param1]; } diff --git a/src/unk_0203E880.c b/src/unk_0203E880.c index 136aecdd4f..580a1e1ae2 100644 --- a/src/unk_0203E880.c +++ b/src/unk_0203E880.c @@ -1017,23 +1017,23 @@ void sub_0203F310 (UnkStruct_0203CDB0 * param0) { u8 v0; - v0 = (sub_0201D2E8() % (NELEMS(Unk_02100AE0))); + v0 = (LCRNG_Next() % (NELEMS(Unk_02100AE0))); if (param0->unk_1C->unk_00 != Unk_02100AE0[v0][0]) { sub_0203F1B0(param0, (730 + Unk_02100AE0[v0][1])); } - v0 = (sub_0201D2E8() % (NELEMS(Unk_02100AE0))); + v0 = (LCRNG_Next() % (NELEMS(Unk_02100AE0))); if (param0->unk_1C->unk_00 != Unk_02100AE0[v0][0]) { sub_0203F1B0(param0, (730 + Unk_02100AE0[v0][1])); } if (param0->unk_1C->unk_00 != 256) { - v0 = (sub_0201D2E8() % (NELEMS(Unk_02100AD4))); + v0 = (LCRNG_Next() % (NELEMS(Unk_02100AD4))); sub_0203F1B0(param0, (730 + Unk_02100AD4[v0])); - v0 = (sub_0201D2E8() % (NELEMS(Unk_02100AD4))); + v0 = (LCRNG_Next() % (NELEMS(Unk_02100AD4))); sub_0203F1B0(param0, (730 + Unk_02100AD4[v0])); } diff --git a/src/unk_0203F6C4.c b/src/unk_0203F6C4.c index 3b23f2a397..088cfd7e79 100644 --- a/src/unk_0203F6C4.c +++ b/src/unk_0203F6C4.c @@ -6157,7 +6157,7 @@ static BOOL sub_02044398 (UnkStruct_0203E724 * param0) u16 * v1 = inline_0204FCAC(param0); u16 v2 = inline_02049538(param0); - *v1 = (sub_0201D2E8() % v2); + *v1 = (LCRNG_Next() % v2); return 1; } @@ -6168,7 +6168,7 @@ static BOOL sub_020443D0 (UnkStruct_0203E724 * param0) u16 * v1 = inline_0204FCAC(param0); u16 v2 = inline_02049538(param0); - *v1 = (sub_0201D2E8() % v2); + *v1 = (LCRNG_Next() % v2); return 1; } @@ -6603,7 +6603,7 @@ static BOOL sub_02044BE8 (UnkStruct_0203E724 * param0) u16 v2, v3, v4, v5; v2 = sub_02026EAC(v0); - v3 = sub_0201D2E8() % v2; + v3 = LCRNG_Next() % v2; *v1 = 25; for (v4 = 1, v5 = 0; v4 <= 493; v4++) { @@ -7175,7 +7175,7 @@ static BOOL sub_02045650 (UnkStruct_0203E724 * param0) return 0; } - v5 = sub_0201D2E8() % v4; + v5 = LCRNG_Next() % v4; for (v3 = 0; v3 < (49 - 34 + 1); v3++) { if (v2[v3] == 1) { @@ -7417,7 +7417,7 @@ static BOOL sub_020459BC (UnkStruct_0203E724 * param0) v2 = 270; } else if (v6 >= 30) { v2 = 268; - } else if (sub_0201D2E8() % 100 < 25) { + } else if (LCRNG_Next() % 100 < 25) { v2 = 269; } else { static const u16 v9[] = { @@ -7441,7 +7441,7 @@ static BOOL sub_020459BC (UnkStruct_0203E724 * param0) 0x214 }; - v2 = sub_0201D2E8() % 6; + v2 = LCRNG_Next() % 6; v2 = v9[v2 + (v5 * 6)]; } @@ -7653,7 +7653,7 @@ static BOOL sub_02045D70 (UnkStruct_0203E724 * param0) v1 = 100; } - v0 = sub_0201D2E8() % 101; + v0 = LCRNG_Next() % 101; if (v0 <= v1) { *v2 = 1; @@ -8103,7 +8103,7 @@ BOOL sub_0204645C (UnkStruct_0203E724 * param0) *v6 = 0xfff; *v7 = 0xfff; *v8 = 0xfff; - v0 = (sub_0201D2E8() % (NELEMS(Unk_020EAB96))); + v0 = (LCRNG_Next() % (NELEMS(Unk_020EAB96))); *v5 = Unk_020EAB96[v0]; v1 = sub_02046524(v0, 0xfff, 0xfff, 0xfff); @@ -8135,7 +8135,7 @@ static u8 sub_02046524 (u16 param0, u16 param1, u16 param2, u16 param3) v1 = 0; while (TRUE) { - v0 = (sub_0201D2E8() % ((NELEMS(Unk_020EAB96)) + 1)); + v0 = (LCRNG_Next() % ((NELEMS(Unk_020EAB96)) + 1)); if (v0 == (NELEMS(Unk_020EAB96))) { break; @@ -8164,7 +8164,7 @@ static u8 sub_02046568 (u16 param0, u16 param1, u16 param2, u16 param3) v1 = 0; while (TRUE) { - v0 = (sub_0201D2E8() % ((NELEMS(Unk_020EAB8C)) + 1)); + v0 = (LCRNG_Next() % ((NELEMS(Unk_020EAB8C)) + 1)); if (v0 == (NELEMS(Unk_020EAB8C))) { break; diff --git a/src/unk_02048BD0.c b/src/unk_02048BD0.c index 97f3740de2..97ceac7bff 100644 --- a/src/unk_02048BD0.c +++ b/src/unk_02048BD0.c @@ -104,7 +104,7 @@ BOOL sub_02048BD0 (UnkStruct_0203E724 * param0) sub_0202B444(v1, 0, 1, v14); sub_0202B470(v1, 0, sub_02025F30(v15)); sub_0202B494(v1, 0, GAME_LANGUAGE); - sub_0202B40C(v1, 0, sub_0201D35C()); + sub_0202B40C(v1, 0, MTRNG_Next()); Strbuf_Free(v14); sub_0202B384(v1, 0, 1); sub_0206D424(param0->unk_34); diff --git a/src/unk_02049D08.c b/src/unk_02049D08.c index 4e003fad39..5094645b74 100644 --- a/src/unk_02049D08.c +++ b/src/unk_02049D08.c @@ -1071,7 +1071,7 @@ u8 sub_0204AE84 (u16 param0) u16 sub_0204AEC0 (UnkStruct_0204AFC4 * param0) { if (param0->unk_0F == 6) { - return sub_0201D2E8(); + return LCRNG_Next(); } param0->unk_08 = sub_0206BFF0(param0->unk_08); diff --git a/src/unk_0204B830.c b/src/unk_0204B830.c index 841093184c..c49d81810d 100644 --- a/src/unk_0204B830.c +++ b/src/unk_0204B830.c @@ -205,13 +205,13 @@ static void sub_0204BAAC (UnkStruct_0203CDB0 * param0, void * param1) v12 = GetMonData(v4, MON_DATA_152, NULL); v8 = GetMonData(v4, MON_DATA_PERSONALITY, NULL); v7 = GetMonData(v4, MON_DATA_OT_ID, NULL); - v9 = sub_0201D30C((u32)OS_GetTick()); + v9 = ARNG_Next((u32)OS_GetTick()); if (v8 == 0x0) { (void)0; } else if (v8 == 0x1) { while (sub_02075E38(v7, v9)) { - v9 = sub_0201D30C(v9); + v9 = ARNG_Next(v9); } } else { v9 = v8; @@ -224,7 +224,7 @@ static void sub_0204BAAC (UnkStruct_0203CDB0 * param0, void * param1) v10 = GetMonData(v4, MON_DATA_HP_IV, 0) + GetMonData(v4, MON_DATA_ATK_IV, 0) + GetMonData(v4, MON_DATA_DEF_IV, 0) + GetMonData(v4, MON_DATA_SPEED_IV, 0) + GetMonData(v4, MON_DATA_SPATK_IV, 0) + GetMonData(v4, MON_DATA_SPDEF_IV, 0); if (v10 == 0) { - v8 = sub_0201D2E8(); + v8 = LCRNG_Next(); v9 = (v8 & (0x1F << 0)) >> 0; sub_02074B30(v4, 70, (u8 *)&v9); @@ -235,7 +235,7 @@ static void sub_0204BAAC (UnkStruct_0203CDB0 * param0, void * param1) v9 = (v8 & (0x1F << 10)) >> 10; sub_02074B30(v4, 72, (u8 *)&v9); - v8 = sub_0201D2E8(); + v8 = LCRNG_Next(); v9 = (v8 & (0x1F << 0)) >> 0; sub_02074B30(v4, 73, (u8 *)&v9); diff --git a/src/unk_0204CDDC.c b/src/unk_0204CDDC.c index bc863b5389..8372c823d8 100644 --- a/src/unk_0204CDDC.c +++ b/src/unk_0204CDDC.c @@ -46,7 +46,7 @@ BOOL sub_0204CE1C (UnkStruct_0203E724 * param0) u16 * v3 = inline_0204FCAC(param0); u16 v4 = inline_02049538(param0); - v2 = sub_0201D2E8() % 100; + v2 = LCRNG_Next() % 100; if (v2 < 15) { v0 = 0; @@ -136,7 +136,7 @@ BOOL sub_0204CF68 (UnkStruct_0203E724 * param0) { u16 * v0 = inline_0204FCAC(param0); - *v0 = (sub_0201D2E8() % (NELEMS(Unk_020EBF64))); + *v0 = (LCRNG_Next() % (NELEMS(Unk_020EBF64))); return 0; } diff --git a/src/unk_0205B33C.c b/src/unk_0205B33C.c index b278773ee8..d7f06b0328 100644 --- a/src/unk_0205B33C.c +++ b/src/unk_0205B33C.c @@ -935,27 +935,27 @@ static int sub_0205BAE8 (UnkStruct_0205B43C * param0, int param1) return Unk_020ED548[v0]; break; case 5: - return Unk_020ED560[sub_0201D2E8() % 2][v0]; + return Unk_020ED560[LCRNG_Next() % 2][v0]; break; case 6: - return Unk_020ED620[sub_0201D2E8() % 4][v0]; + return Unk_020ED620[LCRNG_Next() % 4][v0]; break; case 7: - return Unk_020ED550[sub_0201D2E8() % 2][v0]; + return Unk_020ED550[LCRNG_Next() % 2][v0]; break; case 8: case 1: - return Unk_020ED600[sub_0201D2E8() % 4][v0]; + return Unk_020ED600[LCRNG_Next() % 4][v0]; break; case 9: case 2: - return Unk_020ED640[sub_0201D2E8() % 4][v0]; + return Unk_020ED640[LCRNG_Next() % 4][v0]; break; case 10: case 3: case 12: case 13: - return Unk_020ED660[sub_0201D2E8() % 4][v0]; + return Unk_020ED660[LCRNG_Next() % 4][v0]; break; } diff --git a/src/unk_0206450C.c b/src/unk_0206450C.c index cd3344e3cf..1fc965e9e9 100644 --- a/src/unk_0206450C.c +++ b/src/unk_0206450C.c @@ -1250,13 +1250,13 @@ static int sub_020652EC (const int * param0, int param1) static int sub_0206530C (const int * param0, int param1) { - return param0[sub_0201D2E8() % sub_020652EC(param0, param1)]; + return param0[LCRNG_Next() % sub_020652EC(param0, param1)]; } static int sub_02065330 (int param0, int param1) { const int * v0 = sub_02065358(param0); - return v0[sub_0201D2E8() % sub_020652EC(v0, param1)]; + return v0[LCRNG_Next() % sub_020652EC(v0, param1)]; } static const int * sub_02065358 (int param0) diff --git a/src/unk_0206AFE0.c b/src/unk_0206AFE0.c index 32e2da8673..9f6a654399 100644 --- a/src/unk_0206AFE0.c +++ b/src/unk_0206AFE0.c @@ -253,8 +253,8 @@ void sub_0206B2C8 (UnkStruct_020507E4 * param0) { u16 v0, v1; - v0 = sub_0201D2E8(); - v1 = sub_0201D2E8(); + v0 = LCRNG_Next(); + v1 = LCRNG_Next(); sub_0206B280(param0, (v1 << 16) | v0); } @@ -285,7 +285,7 @@ void sub_0206B334 (UnkStruct_021C0794 * param0) UnkStruct_020507E4 * v0 = sub_020507E4(param0); u32 v1; - v1 = (sub_0201D2E8() % 98) + 2; + v1 = (LCRNG_Next() % 98) + 2; sub_0206B324(v0, v1); } @@ -436,13 +436,13 @@ static u8 sub_0206B4A4 (UnkStruct_020507E4 * param0) v3 = 0; } - v2 = (sub_0201D2E8() % 100); + v2 = (LCRNG_Next() % 100); if (v2 > Unk_020EFA70[v3]) { return 0xff; } - v2 = (sub_0201D2E8() % Unk_020EFA6C[v3]); + v2 = (LCRNG_Next() % Unk_020EFA6C[v3]); return v2; } @@ -465,7 +465,7 @@ void sub_0206B514 (UnkStruct_021C0794 * param0) void sub_0206B558 (UnkStruct_020507E4 * param0, u16 param1) { sub_0206AFE0(param0, (30 + (((0 + 0x4000) + 32) + 16)), param1); - sub_0206AFE0(param0, (42 + (((0 + 0x4000) + 32) + 16)), (sub_0201D2E8() % 5)); + sub_0206AFE0(param0, (42 + (((0 + 0x4000) + 32) + 16)), (LCRNG_Next() % 5)); } u16 sub_0206B588 (UnkStruct_020507E4 * param0) diff --git a/src/unk_0206CCB0.c b/src/unk_0206CCB0.c index 91b5bf48c7..47c9e29cf0 100644 --- a/src/unk_0206CCB0.c +++ b/src/unk_0206CCB0.c @@ -1156,7 +1156,7 @@ void sub_0206D9B4 (UnkStruct_0202440C * param0, Pokemon * param1, u8 param2) UnkStruct_0206D9F4 * v1 = &v0.val14; v1->unk_06 = param2; - v1->unk_05 = sub_0201D35C() % 3; + v1->unk_05 = MTRNG_Next() % 3; sub_0206CE38(param1, &v1->unk_00, &v1->unk_02, &v1->unk_03, &v1->unk_04); sub_0202E43C(param0, 2, 21, (const u8 *)v1); @@ -2072,7 +2072,7 @@ static int sub_0206E870 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param GF_ASSERT(v1 > 0); if (v1 > 1) { - v1 = sub_0201D35C() % v1; + v1 = MTRNG_Next() % v1; } else { v1 = 0; } @@ -2703,7 +2703,7 @@ static int sub_0206ED14 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param v5 = 0xff; v6 = 0xff; - v0 = (sub_0201D2E8() % 0xffff); + v0 = (LCRNG_Next() % 0xffff); v2 = GetNatureFromPersonality(v0); sub_0200B6D8(param1, 0, v2); @@ -2745,7 +2745,7 @@ static int sub_0206EDAC (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param UnkStruct_02025E6C * v7 = sub_02025E38(sub_0203D174(param0)); v1 = sub_0202D834(param0->unk_0C); - v2 = (sub_0201D2E8() % 29); + v2 = (LCRNG_Next() % 29); sub_02071D10(sub_0206C3C8(v2), 4, v6); sub_0200B48C(param1, 0, v6, 0, 1, GAME_LANGUAGE); @@ -2804,7 +2804,7 @@ static int sub_0206EEBC (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param v2 = sub_0206EE9C(v5); if (v2 > 1) { - v3 = sub_0201D35C() % v2; + v3 = MTRNG_Next() % v2; } else { v3 = 0; } @@ -2857,13 +2857,13 @@ static int sub_0206EF7C (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param v0 = 0; if (sub_0206A954(sub_020507E4(param0->unk_0C)) == 1) { - v0 = (sub_0201D2E8() % 8); + v0 = (LCRNG_Next() % 8); } else if (inline_0208BE68(sub_020507E4(param0->unk_0C), 11) == 1) { - v0 = (sub_0201D2E8() % 5); + v0 = (LCRNG_Next() % 5); } else if (inline_0208BE68(sub_020507E4(param0->unk_0C), 10) == 1) { - v0 = (sub_0201D2E8() % 4); + v0 = (LCRNG_Next() % 4); } else if (inline_0208BE68(sub_020507E4(param0->unk_0C), 18) == 1) { - v0 = (sub_0201D2E8() % 2); + v0 = (LCRNG_Next() % 2); } return 0 + v0; @@ -2875,7 +2875,7 @@ static int sub_0206F01C (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param u16 v1, v2, v3; const UnkStruct_02026324 * v4 = sub_02027560(param0->unk_0C); - v1 = (sub_0201D2E8() % (493 - 1)) + 1; + v1 = (LCRNG_Next() % (493 - 1)) + 1; for (v2 = 1; v2 <= 493; v2++) { if (sub_02026FE8(v4, v1) == 1) { @@ -2895,12 +2895,12 @@ static int sub_0206F01C (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param sub_0200B48C(param1, 0, v0, 0, 1, GAME_LANGUAGE); Strbuf_Free(v0); - v1 = (sub_0201D2E8() % 3); + v1 = (LCRNG_Next() % 3); if (v1 == 0) { return 8; } else if (v1 == 1) { - v1 = (sub_0201D2E8() % 34) + 25; + v1 = (LCRNG_Next() % 34) + 25; sub_0200B60C(param1, 1, v1, 2, 0, 1); return 9; } else { @@ -2935,7 +2935,7 @@ static int sub_0206F118 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param { u16 v0; - v0 = (sub_0201D2E8() % 3); + v0 = (LCRNG_Next() % 3); if (v0 == 0) { return 11; @@ -2950,7 +2950,7 @@ static int sub_0206F13C (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param { u16 v0; - v0 = (sub_0201D2E8() % 3); + v0 = (LCRNG_Next() % 3); if (v0 == 0) { return 14; @@ -2974,9 +2974,9 @@ static int sub_0206F160 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param v3 = Party_GetPokemonBySlotIndex(v4, sub_0205E1B4(param0->unk_0C)); sub_0206CE74(param1, 0, GetMonData(v3, MON_DATA_SPECIES, NULL), GetMonData(v3, MON_DATA_111, NULL), sub_02025FD8(v5), sub_02025FCC(v5)); - sub_0200BFAC(param1, 1, (sub_0201D2E8() % 100)); + sub_0200BFAC(param1, 1, (LCRNG_Next() % 100)); - v1 = (sub_0201D2E8() % (493 - 2) + 1); + v1 = (LCRNG_Next() % (493 - 2) + 1); for (v2 = 1; v2 <= 493; v2++) { if (sub_02026FE8(v6, v1) == 1) { @@ -2993,7 +2993,7 @@ static int sub_0206F160 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param } } - sub_0200B630(param1, 3, (sub_0201D2E8() % 467 - 2) + 1); + sub_0200B630(param1, 3, (LCRNG_Next() % 467 - 2) + 1); return 17; } @@ -3032,7 +3032,7 @@ static int sub_0206F29C (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param { u16 v0; - v0 = (sub_0201D2E8() % 9); + v0 = (LCRNG_Next() % 9); if (v0 == 0) { return 20; diff --git a/src/unk_02073C2C.c b/src/unk_02073C2C.c index 7aa346f0e7..a198f8dacf 100644 --- a/src/unk_02073C2C.c +++ b/src/unk_02073C2C.c @@ -384,14 +384,14 @@ void sub_02073E18 (BoxPokemon * param0, int param1, int param2, int param3, int v3 = sub_02073D20(param0); if (!param4) { - param5 = (sub_0201D2E8() | (sub_0201D2E8() << 16)); + param5 = (LCRNG_Next() | (LCRNG_Next() << 16)); } SetBoxMonData(param0, 0, (u8 *)¶m5); if (param6 == 2) { do { - param7 = (sub_0201D2E8() | (sub_0201D2E8() << 16)); + param7 = (LCRNG_Next() | (LCRNG_Next() << 16)); } while ((((param7 & 0xffff0000) >> 16) ^ (param7 & 0xffff) ^ ((param5 & 0xffff0000) >> 16) ^ (param5 & 0xffff)) < 8); } else if (param6 != 1) { param7 = 0; @@ -422,7 +422,7 @@ void sub_02073E18 (BoxPokemon * param0, int param1, int param2, int param3, int SetBoxMonData(param0, 74, (u8 *)¶m3); SetBoxMonData(param0, 75, (u8 *)¶m3); } else { - v1 = sub_0201D2E8(); + v1 = LCRNG_Next(); v2 = (v1 & (0x1f << 0)) >> 0; SetBoxMonData(param0, 70, (u8 *)&v2); @@ -432,7 +432,7 @@ void sub_02073E18 (BoxPokemon * param0, int param1, int param2, int param3, int v2 = (v1 & (0x1f << 10)) >> 10; SetBoxMonData(param0, 72, (u8 *)&v2); - v1 = sub_0201D2E8(); + v1 = LCRNG_Next(); v2 = (v1 & (0x1f << 0)) >> 0; SetBoxMonData(param0, 73, (u8 *)&v2); @@ -468,7 +468,7 @@ void sub_02074044 (Pokemon * param0, u16 param1, u8 param2, u8 param3, u8 param4 u32 v0; do { - v0 = (sub_0201D2E8() | (sub_0201D2E8() << 16)); + v0 = (LCRNG_Next() | (LCRNG_Next() << 16)); } while (param4 != GetNatureFromPersonality(v0)); sub_02073D80(param0, param1, param2, param3, 1, v0, 0, 0); @@ -482,7 +482,7 @@ void sub_02074088 (Pokemon * param0, u16 param1, u8 param2, u8 param3, u8 param4 if ((param6) && (param6 < 29)) { do { - v0 = (sub_0201D2E8() | (sub_0201D2E8() << 16)); + v0 = (LCRNG_Next() | (LCRNG_Next() << 16)); v2 = (((v0 & 0x3000000) >> 18) | ((v0 & 0x30000) >> 12) | ((v0 & 0x300) >> 6) | (v0 & 0x3)) % 28; } while ((param5 != GetNatureFromPersonality(v0)) || (param4 != sub_02075DAC(param1, v0)) || (v2 != (param6 - 1))); } else { @@ -2362,7 +2362,7 @@ void sub_02075C74 (Pokemon * param0, u8 param1, u16 param2) u8 v5; if (param1 == 5) { - if (sub_0201D2E8() & 1) { + if (LCRNG_Next() & 1) { return; } } @@ -2498,18 +2498,18 @@ u32 sub_02075E64 (u32 param0) param0 = (((param0 & 0xffff0000) >> 16) ^ (param0 & 0xffff)) >> 3; - v2 = sub_0201D2E8() & 0x7; - v3 = sub_0201D2E8() & 0x7; + v2 = LCRNG_Next() & 0x7; + v3 = LCRNG_Next() & 0x7; for (v0 = 0; v0 < 13; v0++) { if (param0 & FlagIndex(v0)) { - if (sub_0201D2E8() & 1) { + if (LCRNG_Next() & 1) { v2 |= FlagIndex(v0 + 3); } else { v3 |= FlagIndex(v0 + 3); } } else { - if (sub_0201D2E8() & 1) { + if (LCRNG_Next() & 1) { v2 |= FlagIndex(v0 + 3); v3 |= FlagIndex(v0 + 3); } @@ -3851,11 +3851,11 @@ void sub_020776B0 (Party * param0) int v4; v3 = Party_GetCurrentCount(param0); - v0 = sub_0201D2E8(); + v0 = LCRNG_Next(); if ((v0 == 16384) || (v0 == 32768) || (v0 == 49152)) { do { - v4 = sub_0201D2E8() % v3; + v4 = LCRNG_Next() % v3; v2 = Party_GetPokemonBySlotIndex(param0, v4); if ((GetMonData(v2, MON_DATA_SPECIES, NULL)) && (GetMonData(v2, MON_DATA_IS_EGG, NULL) == 0)) { @@ -3867,7 +3867,7 @@ void sub_020776B0 (Party * param0) if (sub_02077758(param0, FlagIndex(v4)) == 0) { do { - v1 = sub_0201D2E8() & 0xff; + v1 = LCRNG_Next() & 0xff; } while ((v1 & 0x7) == 0); if (v1 & 0xf0) { @@ -3956,7 +3956,7 @@ void sub_0207782C (Party * param0) v1 = Party_GetCurrentCount(param0); - if (sub_0201D2E8() % 3 == 0) { + if (LCRNG_Next() % 3 == 0) { for (v0 = 0; v0 < v1; v0++) { v3 = Party_GetPokemonBySlotIndex(param0, v0); @@ -4425,7 +4425,7 @@ void sub_02077F0C (Pokemon * param0, u32 param1, int param2) return; } - v1 = sub_0201D2E8() % 100; + v1 = LCRNG_Next() % 100; v2 = GetMonData(param0, MON_DATA_SPECIES, NULL); v3 = GetMonData(param0, MON_DATA_FORM, NULL); v5 = sub_020759CC(v2, v3, 16); diff --git a/src/unk_02079170.c b/src/unk_02079170.c index 922b777880..12ded1869c 100644 --- a/src/unk_02079170.c +++ b/src/unk_02079170.c @@ -297,7 +297,7 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) u8 v6; Pokemon * v7; - v5 = sub_0201D2D0(); + v5 = LCRNG_GetSeed(); Party_InitWithCapacity(param0->parties[param1], 6); @@ -326,10 +326,10 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) v10 = (v8[v1].unk_04 & 0xfc00) >> 10; v4 = v8[v1].unk_00 + v8[v1].unk_02 + v9 + param0->unk_18[param1]; - sub_0201D2DC(v4); + LCRNG_SetSeed(v4); for (v2 = 0; v2 < param0->trainerData[param1].class; v2++) { - v4 = sub_0201D2E8(); + v4 = LCRNG_Next(); } v4 = (v4 << 8) + v3; @@ -355,10 +355,10 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) v13 = (v11[v1].unk_04 & 0xfc00) >> 10; v4 = v11[v1].unk_00 + v11[v1].unk_02 + v12 + param0->unk_18[param1]; - sub_0201D2DC(v4); + LCRNG_SetSeed(v4); for (v2 = 0; v2 < param0->trainerData[param1].class; v2++) { - v4 = sub_0201D2E8(); + v4 = LCRNG_Next(); } v4 = (v4 << 8) + v3; @@ -389,10 +389,10 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) v16 = (v14[v1].unk_04 & 0xfc00) >> 10; v4 = v14[v1].unk_00 + v14[v1].unk_02 + v15 + param0->unk_18[param1]; - sub_0201D2DC(v4); + LCRNG_SetSeed(v4); for (v2 = 0; v2 < param0->trainerData[param1].class; v2++) { - v4 = sub_0201D2E8(); + v4 = LCRNG_Next(); } v4 = (v4 << 8) + v3; @@ -419,10 +419,10 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) v19 = (v17[v1].unk_04 & 0xfc00) >> 10; v4 = v17[v1].unk_00 + v17[v1].unk_02 + v18 + param0->unk_18[param1]; - sub_0201D2DC(v4); + LCRNG_SetSeed(v4); for (v2 = 0; v2 < param0->trainerData[param1].class; v2++) { - v4 = sub_0201D2E8(); + v4 = LCRNG_Next(); } v4 = (v4 << 8) + v3; @@ -445,5 +445,5 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) Heap_FreeToHeap(v0); Heap_FreeToHeap(v7); - sub_0201D2DC(v5); + LCRNG_SetSeed(v5); } diff --git a/src/unk_0208694C.c b/src/unk_0208694C.c index 4e30c73ad0..d5aed3b635 100644 --- a/src/unk_0208694C.c +++ b/src/unk_0208694C.c @@ -1090,9 +1090,9 @@ static void sub_02086E6C (UnkStruct_02087A10 * param0, UnkStruct_0208737C * para Strbuf* v0; if (param0->unk_04 == 0) { - v0 = MessageLoader_GetNewStrbuf(param0->unk_170, 0 + sub_0201D2E8() % 18); + v0 = MessageLoader_GetNewStrbuf(param0->unk_170, 0 + LCRNG_Next() % 18); } else if (param0->unk_04 == 1) { - v0 = MessageLoader_GetNewStrbuf(param0->unk_170, 18 + sub_0201D2E8() % 18); + v0 = MessageLoader_GetNewStrbuf(param0->unk_170, 18 + LCRNG_Next() % 18); } Strbuf_Copy(param1->unk_18, v0); @@ -1101,7 +1101,7 @@ static void sub_02086E6C (UnkStruct_02087A10 * param0, UnkStruct_0208737C * para } else if (param0->unk_00 == 3) { Strbuf* v1; - v1 = MessageLoader_GetNewStrbuf(param0->unk_170, 88 + (sub_0201D2E8() % 2)); + v1 = MessageLoader_GetNewStrbuf(param0->unk_170, 88 + (LCRNG_Next() % 2)); Strbuf_Copy(param1->unk_18, v1); Strbuf_Free(v1); diff --git a/src/unk_020933F8.c b/src/unk_020933F8.c index af1316d90e..4e630a1285 100644 --- a/src/unk_020933F8.c +++ b/src/unk_020933F8.c @@ -413,7 +413,7 @@ UnkStruct_02095C48 * sub_02093800 (const UnkStruct_02093800 * param0) Heap_Create(11, 20, (0x3000 + 0x1000)); v0 = sub_020937C4(); - v0->unk_19A4 = sub_0201D2D0(); + v0->unk_19A4 = LCRNG_GetSeed(); sub_02094E7C(v0); @@ -541,7 +541,7 @@ void sub_02093AD4 (UnkStruct_02095C48 * param0) Heap_FreeToHeap(param0->unk_14C[v0]); } - sub_0201D2DC(param0->unk_19A4); + LCRNG_SetSeed(param0->unk_19A4); sub_020937F8(param0); Heap_Destroy(20); } @@ -1704,19 +1704,19 @@ void sub_02094C44 (UnkStruct_02095C48 * param0, UnkStruct_021C0794 * param1, u32 static void sub_02094E7C (UnkStruct_02095C48 * param0) { - sub_0201D2DC((sub_020138C8() * (sub_0201D2D0() + 10)) & 0xffff); + LCRNG_SetSeed((sub_020138C8() * (LCRNG_GetSeed() + 10)) & 0xffff); } u16 sub_02094E98 (UnkStruct_02095C48 * param0) { - return sub_0201D2E8(); + return LCRNG_Next(); } u16 sub_02094EA0 (u32 param0, u32 * param1) { u32 v0; - v0 = sub_0201D30C(param0); + v0 = ARNG_Next(param0); *param1 = v0; return v0 / 65536L; diff --git a/src/unk_02094EDC.c b/src/unk_02094EDC.c index aa92ea451e..188bd5e61a 100644 --- a/src/unk_02094EDC.c +++ b/src/unk_02094EDC.c @@ -1051,7 +1051,7 @@ u32 sub_02095A74 (int param0, int param1) u32 v2; if ((param0 == 3) || (param1 == 1)) { - return sub_0201D2E8() % 12; + return LCRNG_Next() % 12; } MI_CpuClear8(v0, 12); @@ -1072,5 +1072,5 @@ u32 sub_02095A74 (int param0, int param1) v0[v1++] = 8; } - return v0[sub_0201D2E8() % v1]; + return v0[LCRNG_Next() % v1]; } diff --git a/src/unk_020961E8.c b/src/unk_020961E8.c index 40de9cdfca..3316c998b5 100644 --- a/src/unk_020961E8.c +++ b/src/unk_020961E8.c @@ -302,7 +302,7 @@ static void sub_020963C0 (UnkStruct_020961E8 * param0, int param1) param0->unk_418.unk_BB8 = v2; } - param0->unk_418.unk_BBC = sub_0201D2E8(); + param0->unk_418.unk_BBC = LCRNG_Next(); sub_0203597C(116, ¶m0->unk_418, sizeof(UnkStruct_ov59_021D30E0)); } From 89ceba05a3c669662b02e45e3d54a497a177d72a Mon Sep 17 00:00:00 2001 From: wildfire Date: Tue, 5 Sep 2023 10:50:28 +0100 Subject: [PATCH 02/11] Document pokemon.c and related structs --- include/constants/pokemon.h | 82 +- include/pokemon.h | 769 +++ include/struct_decls/party_pokemon.h | 6 - include/struct_decls/struct_02075874_decl.h | 6 - include/struct_decls/struct_0207821C_decl.h | 6 - .../struct_decls/struct_0207821C_sub1_decl.h | 6 - include/struct_defs/box_pokemon.h | 29 +- include/struct_defs/party_pokemon.h | 9 +- include/struct_defs/pokemon.h | 8 +- include/struct_defs/pokemon_data_block_a.h | 31 + include/struct_defs/pokemon_data_block_b.h | 29 + ...n_substruct_2.h => pokemon_data_block_c.h} | 9 +- include/struct_defs/pokemon_data_block_d.h | 25 + .../pokemon_data_block_shuffle_0.h | 16 + .../pokemon_data_block_shuffle_1.h | 16 + .../pokemon_data_block_shuffle_10.h | 16 + .../pokemon_data_block_shuffle_11.h | 16 + .../pokemon_data_block_shuffle_12.h | 16 + .../pokemon_data_block_shuffle_13.h | 16 + .../pokemon_data_block_shuffle_14.h | 16 + .../pokemon_data_block_shuffle_15.h | 16 + .../pokemon_data_block_shuffle_16.h | 16 + .../pokemon_data_block_shuffle_17.h | 16 + .../pokemon_data_block_shuffle_18.h | 16 + .../pokemon_data_block_shuffle_19.h | 16 + .../pokemon_data_block_shuffle_2.h | 16 + .../pokemon_data_block_shuffle_20.h | 16 + .../pokemon_data_block_shuffle_21.h | 16 + .../pokemon_data_block_shuffle_22.h | 16 + .../pokemon_data_block_shuffle_23.h | 16 + .../pokemon_data_block_shuffle_3.h | 16 + .../pokemon_data_block_shuffle_4.h | 16 + .../pokemon_data_block_shuffle_5.h | 16 + .../pokemon_data_block_shuffle_6.h | 16 + .../pokemon_data_block_shuffle_7.h | 16 + .../pokemon_data_block_shuffle_8.h | 16 + .../pokemon_data_block_shuffle_9.h | 16 + include/struct_defs/pokemon_evolution_data.h | 10 + ...821C_sub1.h => pokemon_evolution_method.h} | 10 +- include/struct_defs/pokemon_personal_data.h | 44 + include/struct_defs/pokemon_substruct_0.h | 28 - include/struct_defs/pokemon_substruct_1.h | 26 - include/struct_defs/pokemon_substruct_3.h | 22 - include/struct_defs/struct_02075874.h | 41 - include/struct_defs/struct_0207821C.h | 10 - include/struct_defs/struct_0207825C.h | 16 - include/struct_defs/struct_0207825C_1.h | 16 - include/struct_defs/struct_0207825C_10.h | 16 - include/struct_defs/struct_0207825C_11.h | 16 - include/struct_defs/struct_0207825C_12.h | 16 - include/struct_defs/struct_0207825C_13.h | 16 - include/struct_defs/struct_0207825C_14.h | 16 - include/struct_defs/struct_0207825C_15.h | 16 - include/struct_defs/struct_0207825C_16.h | 16 - include/struct_defs/struct_0207825C_17.h | 16 - include/struct_defs/struct_0207825C_18.h | 16 - include/struct_defs/struct_0207825C_19.h | 16 - include/struct_defs/struct_0207825C_2.h | 16 - include/struct_defs/struct_0207825C_20.h | 16 - include/struct_defs/struct_0207825C_21.h | 16 - include/struct_defs/struct_0207825C_22.h | 16 - include/struct_defs/struct_0207825C_23.h | 16 - include/struct_defs/struct_0207825C_3.h | 16 - include/struct_defs/struct_0207825C_4.h | 16 - include/struct_defs/struct_0207825C_5.h | 16 - include/struct_defs/struct_0207825C_6.h | 16 - include/struct_defs/struct_0207825C_7.h | 16 - include/struct_defs/struct_0207825C_8.h | 16 - include/struct_defs/struct_0207825C_9.h | 16 - include/struct_defs/struct_02078B40.h | 58 +- include/unk_0201D15C.h | 4 +- include/unk_02073C2C.h | 173 - platinum.us/main.lsf | 2 +- src/enc_effects.c | 2 +- src/meson.build | 2 +- src/overlay005/ov5_021D1C30.c | 2 +- src/overlay005/ov5_021DDBE8.c | 6 +- src/overlay005/ov5_021E622C.c | 232 +- src/overlay005/ov5_021EE7D4.c | 2 +- src/overlay005/ov5_021F6454.c | 12 +- src/overlay005/ov5_021F77A8.c | 2 +- src/overlay006/ov6_02240C9C.c | 38 +- src/overlay006/ov6_022426AC.c | 4 +- src/overlay006/ov6_02243258.c | 2 +- src/overlay006/ov6_02246034.c | 4 +- src/overlay006/ov6_02246184.c | 46 +- src/overlay006/ov6_022489E4.c | 2 +- src/overlay010/ov10_0221F800.c | 12 +- src/overlay012/ov12_0221FC20.c | 2 +- src/overlay012/ov12_0222E91C.c | 2 +- src/overlay012/ov12_02235E94.c | 2 +- src/overlay012/ov12_022380BC.c | 2 +- src/overlay013/ov13_0221FC20.c | 44 +- src/overlay013/ov13_02221A88.c | 30 +- src/overlay013/ov13_022264F4.c | 4 +- src/overlay014/ov14_0221FC20.c | 78 +- src/overlay016/battle_controller.c | 64 +- src/overlay016/ov16_0223B140.c | 30 +- src/overlay016/ov16_0223DF00.c | 58 +- src/overlay016/ov16_022405FC.c | 170 +- src/overlay016/ov16_0225177C.c | 152 +- src/overlay016/ov16_0225BFFC.c | 30 +- src/overlay016/ov16_0225CBB8.c | 20 +- src/overlay016/ov16_0226485C.c | 50 +- src/overlay016/ov16_02266F1C.c | 4 +- src/overlay016/ov16_0226871C.c | 4 +- src/overlay017/ov17_0223B140.c | 2 +- src/overlay017/ov17_0223DAD0.c | 2 +- src/overlay017/ov17_0223F118.c | 2 +- src/overlay017/ov17_0223F7E4.c | 2 +- src/overlay017/ov17_022413D8.c | 50 +- src/overlay017/ov17_02243C28.c | 10 +- src/overlay017/ov17_02246ECC.c | 2 +- src/overlay017/ov17_022476F8.c | 4 +- src/overlay017/ov17_02247A48.c | 2 +- src/overlay017/ov17_0224A0FC.c | 10 +- src/overlay017/ov17_0224CFB8.c | 2 +- src/overlay017/ov17_02250744.c | 6 +- src/overlay017/ov17_02251D6C.c | 2 +- src/overlay019/ov19_021D0D80.c | 120 +- src/overlay019/ov19_021D79F8.c | 10 +- src/overlay019/ov19_021DA270.c | 28 +- src/overlay019/ov19_021DA92C.c | 2 +- src/overlay019/ov19_021DB8E4.c | 14 +- src/overlay021/ov21_021D0D80.c | 2 +- src/overlay021/ov21_021D1FA4.c | 4 +- src/overlay021/ov21_021DE668.c | 6 +- src/overlay021/ov21_021DF734.c | 4 +- src/overlay021/ov21_021E8D48.c | 6 +- src/overlay022/ov22_02259098.c | 2 +- src/overlay022/ov22_0225AF8C.c | 2 +- src/overlay022/ov22_0225B660.c | 4 +- src/overlay028/ov28_022561C0.c | 2 +- src/overlay032/ov32_022561C0.c | 10 +- src/overlay033/ov33_022561C0.c | 2 +- src/overlay033/ov33_02256474.c | 4 +- src/overlay040/ov40_022561C0.c | 12 +- src/overlay040/ov40_0225645C.c | 4 +- src/overlay044/ov44_022561C0.c | 2 +- src/overlay044/ov44_022565BC.c | 4 +- src/overlay057/ov57_021D0D80.c | 4 +- src/overlay062/ov62_02239D60.c | 14 +- src/overlay062/ov62_02248408.c | 4 +- src/overlay064/ov64_0222DCE0.c | 2 +- src/overlay065/ov65_0222DCE0.c | 4 +- src/overlay066/ov66_0222DDF0.c | 2 +- src/overlay070/ov70_0225D9A4.c | 2 +- src/overlay073/ov73_021D0D80.c | 2 +- src/overlay076/ov76_0223B870.c | 6 +- src/overlay076/ov76_0223D338.c | 12 +- src/overlay077/ov77_021D6C70.c | 2 +- src/overlay078/ov78_021D0D80.c | 4 +- src/overlay079/ov79_021D2268.c | 8 +- src/overlay079/ov79_021D3768.c | 2 +- src/overlay081/ov81_021D1610.c | 4 +- src/overlay086/ov86_0223B140.c | 14 +- src/overlay087/ov87_021D106C.c | 6 +- src/overlay088/ov88_0223B140.c | 28 +- src/overlay091/ov91_021D0D80.c | 22 +- src/overlay094/ov94_0223D0C4.c | 10 +- src/overlay094/ov94_0223DC04.c | 4 +- src/overlay094/ov94_0223E46C.c | 6 +- src/overlay094/ov94_0223FB48.c | 66 +- src/overlay094/ov94_022414B8.c | 12 +- src/overlay094/ov94_02242AD0.c | 20 +- src/overlay094/ov94_022444C8.c | 16 +- src/overlay095/ov95_02246C20.c | 24 +- src/overlay095/ov95_02247B6C.c | 4 +- src/overlay095/ov95_0224B3D8.c | 4 +- src/overlay097/ov97_0222D30C.c | 2 +- src/overlay097/ov97_02233B18.c | 4 +- src/overlay097/ov97_02236380.c | 26 +- src/overlay097/ov97_02237694.c | 6 +- src/overlay104/ov104_0222DCE0.c | 60 +- src/overlay104/ov104_0222ECE8.c | 2 +- src/overlay104/ov104_02231F74.c | 2 +- src/overlay104/ov104_022332B4.c | 4 +- src/overlay104/ov104_022339B4.c | 2 +- src/overlay104/ov104_02234838.c | 4 +- src/overlay104/ov104_02234DB4.c | 2 +- src/overlay104/ov104_022358E8.c | 4 +- src/overlay104/ov104_022361B4.c | 64 +- src/overlay104/ov104_02237378.c | 38 +- src/overlay104/ov104_02237DD8.c | 56 +- src/overlay104/ov104_0223A0C4.c | 22 +- src/overlay104/ov104_0223A7F4.c | 2 +- src/overlay104/ov104_0223AF58.c | 14 +- src/overlay104/ov104_0223B6F4.c | 8 +- src/overlay104/ov104_0223BCBC.c | 4 +- src/overlay105/ov105_02241AE0.c | 12 +- src/overlay105/ov105_02245CD0.c | 2 +- src/overlay106/ov106_02241AE0.c | 4 +- src/overlay107/ov107_02241AE0.c | 44 +- src/overlay107/ov107_02245EB0.c | 44 +- src/overlay108/ov108_02241AE0.c | 2 +- src/overlay109/ov109_021D0D80.c | 2 +- src/overlay113/ov113_0225C700.c | 2 +- src/overlay113/ov113_0225E368.c | 2 +- src/overlay118/ov118_021D0D80.c | 6 +- src/overlay119/ov119_021D0D80.c | 8 +- src/overlay119/ov119_021D191C.c | 2 +- src/party.c | 2 +- src/pokemon.c | 5567 +++++++++++++++++ src/roaming_pokemon.c | 6 +- src/unk_0200B358.c | 10 +- src/unk_0200DA60.c | 2 +- src/unk_0201D15C.c | 14 +- src/unk_020261E4.c | 6 +- src/unk_0202631C.c | 10 +- src/unk_02028124.c | 2 +- src/unk_020298BC.c | 6 +- src/unk_0202CD50.c | 4 +- src/unk_0202DF8C.c | 8 +- src/unk_0202EEC0.c | 2 +- src/unk_0202F180.c | 2 +- src/unk_0202F1D4.c | 18 +- src/unk_02030A80.c | 2 +- src/unk_0203A9C8.c | 2 +- src/unk_0203D1B8.c | 14 +- src/unk_0203F6C4.c | 20 +- src/unk_020474B8.c | 2 +- src/unk_020480A8.c | 8 +- src/unk_02048DD8.c | 4 +- src/unk_02049D08.c | 10 +- src/unk_0204AEE8.c | 14 +- src/unk_0204B830.c | 32 +- src/unk_0204C500.c | 4 +- src/unk_0204CFFC.c | 26 +- src/unk_0204F13C.c | 4 +- src/unk_02050A74.c | 10 +- src/unk_02051D8C.c | 10 +- src/unk_020528D0.c | 4 +- src/unk_02054884.c | 18 +- src/unk_020559DC.c | 4 +- src/unk_020562F8.c | 2 +- src/unk_02056720.c | 6 +- src/unk_0205A0D8.c | 16 +- src/unk_0205DFC4.c | 2 +- src/unk_0206C660.c | 2 +- src/unk_0206CCB0.c | 14 +- src/unk_02073C2C.c | 5564 ---------------- src/unk_02079170.c | 18 +- src/unk_020797C8.c | 18 +- src/unk_02079D40.c | 28 +- src/unk_0207A274.c | 2 +- src/unk_0207A2A8.c | 8 +- src/unk_0207AE68.c | 78 +- src/unk_0207E0B8.c | 38 +- src/unk_020819DC.c | 18 +- src/unk_02082C2C.c | 2 +- src/unk_02083370.c | 18 +- src/unk_02084B70.c | 52 +- src/unk_0208694C.c | 6 +- src/unk_0208C324.c | 58 +- src/unk_0208EA44.c | 4 +- src/unk_0208FCF8.c | 2 +- src/unk_020916B4.c | 4 +- src/unk_02092494.c | 24 +- src/unk_020933F8.c | 6 +- src/unk_02094EDC.c | 20 +- src/unk_02096420.c | 76 +- src/unk_02097624.c | 12 +- src/unk_02097B18.c | 6 +- src/unk_02098218.c | 10 +- src/unk_020989DC.c | 8 +- src/unk_020997B8.c | 6 +- src/unk_0209BA80.c | 2 +- 267 files changed, 8520 insertions(+), 7886 deletions(-) create mode 100644 include/pokemon.h delete mode 100644 include/struct_decls/party_pokemon.h delete mode 100644 include/struct_decls/struct_02075874_decl.h delete mode 100644 include/struct_decls/struct_0207821C_decl.h delete mode 100644 include/struct_decls/struct_0207821C_sub1_decl.h create mode 100644 include/struct_defs/pokemon_data_block_a.h create mode 100644 include/struct_defs/pokemon_data_block_b.h rename include/struct_defs/{pokemon_substruct_2.h => pokemon_data_block_c.h} (51%) create mode 100644 include/struct_defs/pokemon_data_block_d.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_0.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_1.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_10.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_11.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_12.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_13.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_14.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_15.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_16.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_17.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_18.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_19.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_2.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_20.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_21.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_22.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_23.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_3.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_4.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_5.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_6.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_7.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_8.h create mode 100644 include/struct_defs/pokemon_data_block_shuffle_9.h create mode 100644 include/struct_defs/pokemon_evolution_data.h rename include/struct_defs/{struct_0207821C_sub1.h => pokemon_evolution_method.h} (53%) create mode 100644 include/struct_defs/pokemon_personal_data.h delete mode 100644 include/struct_defs/pokemon_substruct_0.h delete mode 100644 include/struct_defs/pokemon_substruct_1.h delete mode 100644 include/struct_defs/pokemon_substruct_3.h delete mode 100644 include/struct_defs/struct_02075874.h delete mode 100644 include/struct_defs/struct_0207821C.h delete mode 100644 include/struct_defs/struct_0207825C.h delete mode 100644 include/struct_defs/struct_0207825C_1.h delete mode 100644 include/struct_defs/struct_0207825C_10.h delete mode 100644 include/struct_defs/struct_0207825C_11.h delete mode 100644 include/struct_defs/struct_0207825C_12.h delete mode 100644 include/struct_defs/struct_0207825C_13.h delete mode 100644 include/struct_defs/struct_0207825C_14.h delete mode 100644 include/struct_defs/struct_0207825C_15.h delete mode 100644 include/struct_defs/struct_0207825C_16.h delete mode 100644 include/struct_defs/struct_0207825C_17.h delete mode 100644 include/struct_defs/struct_0207825C_18.h delete mode 100644 include/struct_defs/struct_0207825C_19.h delete mode 100644 include/struct_defs/struct_0207825C_2.h delete mode 100644 include/struct_defs/struct_0207825C_20.h delete mode 100644 include/struct_defs/struct_0207825C_21.h delete mode 100644 include/struct_defs/struct_0207825C_22.h delete mode 100644 include/struct_defs/struct_0207825C_23.h delete mode 100644 include/struct_defs/struct_0207825C_3.h delete mode 100644 include/struct_defs/struct_0207825C_4.h delete mode 100644 include/struct_defs/struct_0207825C_5.h delete mode 100644 include/struct_defs/struct_0207825C_6.h delete mode 100644 include/struct_defs/struct_0207825C_7.h delete mode 100644 include/struct_defs/struct_0207825C_8.h delete mode 100644 include/struct_defs/struct_0207825C_9.h delete mode 100644 include/unk_02073C2C.h create mode 100644 src/pokemon.c delete mode 100644 src/unk_02073C2C.c diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 028b36e48b..56bd1764f1 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -37,7 +37,7 @@ enum { MON_DATA_OT_ID, MON_DATA_EXP, MON_DATA_FRIENDSHIP, - MON_DATA_10, + MON_DATA_ABILITY, MON_DATA_11, MON_DATA_LANGUAGE, MON_DATA_HP_EV, @@ -85,18 +85,18 @@ enum { MON_DATA_MOVE2, MON_DATA_MOVE3, MON_DATA_MOVE4, - MON_DATA_58, - MON_DATA_59, - MON_DATA_60, - MON_DATA_61, - MON_DATA_62, - MON_DATA_63, - MON_DATA_64, - MON_DATA_65, - MON_DATA_66, - MON_DATA_67, - MON_DATA_68, - MON_DATA_69, + MON_DATA_MOVE1_PP, + MON_DATA_MOVE2_PP, + MON_DATA_MOVE3_PP, + MON_DATA_MOVE4_PP, + MON_DATA_MOVE1_PP_UPS, + MON_DATA_MOVE2_PP_UPS, + MON_DATA_MOVE3_PP_UPS, + MON_DATA_MOVE4_PP_UPS, + MON_DATA_MOVE1_MAX_PP, + MON_DATA_MOVE2_MAX_PP, + MON_DATA_MOVE3_MAX_PP, + MON_DATA_MOVE4_MAX_PP, MON_DATA_HP_IV, MON_DATA_ATK_IV, MON_DATA_DEF_IV, @@ -138,7 +138,7 @@ enum { MON_DATA_EARTH_RIBBON, MON_DATA_WORLD_RIBBON, MON_DATA_FATEFUL_ENCOUNTER, - MON_DATA_111, + MON_DATA_GENDER, MON_DATA_FORM, MON_DATA_113, MON_DATA_114, @@ -188,25 +188,61 @@ enum { MON_DATA_158, MON_DATA_159, MON_DATA_160, - MON_DATA_161, + MON_DATA_LEVEL, MON_DATA_162, - MON_DATA_163, - MON_DATA_164, - MON_DATA_165, - MON_DATA_166, - MON_DATA_167, - MON_DATA_168, - MON_DATA_169, + MON_DATA_CURRENT_HP, + MON_DATA_MAX_HP, + MON_DATA_ATK, + MON_DATA_DEF, + MON_DATA_SPEED, + MON_DATA_SP_ATK, + MON_DATA_SP_DEF, MON_DATA_170, MON_DATA_171, MON_DATA_172, MON_DATA_173, MON_DATA_SPECIES_EGG, - MON_DATA_175, + MON_DATA_COMBINED_IVS, MON_DATA_176, MON_DATA_177, MON_DATA_178, MON_DATA_179, }; +enum { + MON_DATA_PERSONAL_BASE_HP = 0, + MON_DATA_PERSONAL_BASE_ATK, + MON_DATA_PERSONAL_BASE_DEF, + MON_DATA_PERSONAL_BASE_SPEED, + MON_DATA_PERSONAL_BASE_SP_ATK, + MON_DATA_PERSONAL_BASE_SP_DEF, + MON_DATA_PERSONAL_TYPE_1, + MON_DATA_PERSONAL_TYPE_2, + MON_DATA_PERSONAL_CATCH_RATE, + MON_DATA_PERSONAL_BASE_EXP, + MON_DATA_PERSONAL_EV_HP_YIELD, + MON_DATA_PERSONAL_EV_ATK_YIELD, + MON_DATA_PERSONAL_EV_DEF_YIELD, + MON_DATA_PERSONAL_EV_SPEED_YIELD, + MON_DATA_PERSONAL_EV_SP_ATK_YIELD, + MON_DATA_PERSONAL_EV_SP_DEF_YIELD, + MON_DATA_PERSONAL_ITEM1, + MON_DATA_PERSONAL_ITEM2, + MON_DATA_PERSONAL_GENDER, + MON_DATA_PERSONAL_HATCH_CYCLE, + MON_DATA_PERSONAL_BASE_FRIENDSHIP, + MON_DATA_PERSONAL_EXP_RATE, + MON_DATA_PERSONAL_EGG_GROUP_1, + MON_DATA_PERSONAL_EGG_GROUP_2, + MON_DATA_PERSONAL_ABILITY_1, + MON_DATA_PERSONAL_ABILITY_2, + MON_DATA_PERSONAL_GREAT_MARSH_FLEE_RATE, + MON_DATA_PERSONAL_COLOR, + MON_DATA_PERSONAL_INVERSE, + MON_DATA_PERSONAL_UNK_1C, + MON_DATA_PERSONAL_UNK_20, + MON_DATA_PERSONAL_UNK_24, + MON_DATA_PERSONAL_UNK_28, +}; + #endif // POKEPLATINUM_CONSTANTS_POKEMON_H diff --git a/include/pokemon.h b/include/pokemon.h new file mode 100644 index 0000000000..7ad6352573 --- /dev/null +++ b/include/pokemon.h @@ -0,0 +1,769 @@ +#ifndef POKEPLATINUM_UNK_02073C2C_H +#define POKEPLATINUM_UNK_02073C2C_H + +#include "struct_decls/struct_02002F38_decl.h" +#include "struct_decls/struct_02006C24_decl.h" +#include "struct_defs/struct_02007C10.h" +#include "struct_decls/struct_02007C7C_decl.h" +#include "struct_defs/struct_02008A90.h" +#include "struct_decls/struct_0200C6E4_decl.h" +#include "struct_decls/struct_0200C704_decl.h" +#include "struct_decls/struct_0200D0F4_decl.h" +#include "struct_decls/struct_02015F84_decl.h" +#include "struct_decls/struct_02025E6C_decl.h" +#include "struct_decls/struct_0202CC84_decl.h" +#include "struct_defs/pokemon.h" +#include "struct_defs/box_pokemon.h" +#include "struct_defs/pokemon_personal_data.h" +#include "struct_decls/struct_02078B40_decl.h" +#include "struct_decls/struct_party_decl.h" +#include "overlay005/struct_ov5_021DE5D0.h" + +#include + +/** + * @brief Zeros out a Pokemon data structure, then encrypts the result + * + * @param mon + */ +void ZeroMonData(Pokemon * mon); + +/** + * @brief Zeros out a BoxPokemon data structure, then encrypts the result + * + * @param boxMon + */ +void ZeroBoxMonData(BoxPokemon * boxMon); + +/** + * @brief Returns the size in bytes of a Pokemon struct as an int + * + * @return Size in bytes of a Pokemon struct + */ +int PokemonStructSize(void); + +/** + * @brief Allocates a Pokemon struct on the given heap, then calls ZeroMonData() on it + * + * @param heapID + * @return A new empty but encrypted Pokemon struct + */ +Pokemon * AllocMonZeroed(u32 heapID); + +/** + * @brief Decrypts a Pokemon data structure. PartyPokemon data is encrypted using the pokemons personality value, BoxPokemon data using a checksum value + * + * @param mon + * @return Whether the pokemons data was decrypted by this call. Passed to EncryptMon() to decide whether to reencrypt the data or not + */ +BOOL DecryptMon(Pokemon * mon); + +/** + * @brief Encrypts a Pokemon data structure. PartyPokemon data is encrypted using the pokemons personality value, BoxPokemon data using a checksum value + * + * @param mon + * @param encrypt Whether to encrypt the data or not. If this is false, the function does nothing and returns false. + * @return Whether the pokemons data was encrypted by this call. + */ +BOOL EncryptMon(Pokemon * mon, BOOL encrypt); + +/** + * @brief Decrypts a BoxPokemon data structure + * + * @param boxMon + * @return Whether the pokemons data was decrypted by this call. Passed to EncryptBoxMon() to decide whether to reencrypt the data or not + */ +BOOL DecryptBoxMon(BoxPokemon * boxMon); + +/** + * @brief Encrypts a BoxPokemon data structure + * + * @param boxMon + * @param encrypt Whether to encrypt the data or not. If this is false, the function does nothing and returns false. + * @return Whether the pokemons data was encrypted by this call. + */ +BOOL EncryptBoxMon(BoxPokemon * boxMon, BOOL encrypt); + +void sub_02073D80(Pokemon * mon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); +void sub_02073E18(BoxPokemon * boxMon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); +void sub_02074044(Pokemon * mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monNature); +void sub_02074088(Pokemon * mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 param4, u8 param5, u8 param6); +u32 sub_02074128(u16 monSpecies, u8 param1, u8 param2); +void sub_02074158(Pokemon * mon, u16 monSpecies, u8 monLevel, u32 monCombinedIVs, u32 monPersonality); + +/** + * @brief Calculates and stores the current level and stats for a given Pokemon based on its IVs, EVs etc. + * + * @param mon + */ +void CalculateMonLevelAndStats(Pokemon * mon); + +/** + * @brief Calculates and stores the current stats for a given Pokemon based on its IVs, EVs etc. + * + * @param mon + */ +void CalculateMonStats(Pokemon * mon); + +/** + * @brief Gets a value from a Pokemon, storing it in dest if neccessary + * + * @param mon + * @param monDataAttribute + * @param[out] dest Pointer for storing longer data + * @return The requested value + */ +u32 GetMonData(Pokemon * mon, int monDataAttribute, void * dest); + +/** + * @brief Gets a value from a Pokemon, storing it in dest if neccessary + * + * @param boxMon + * @param monDataAttribute + * @param[out] dest Pointer for storing longer data + * @return The requested value + */ +u32 GetBoxMonData(BoxPokemon * boxMon, int monDataAttribute, void * dest); + +/** + * @brief Sets a value in a Pokemon, reading it from value if neccessary + * + * @param mon + * @param monDataAttribute + * @param value + */ +void SetMonData(Pokemon * mon, int monDataAttribute, const void * value); + +/** + * @brief Sets a value in a BoxPokemon, reading it from value if neccessary + * + * @param boxMon + * @param monDataAttribute + * @param value + */ +void SetBoxMonData(BoxPokemon * boxMon, int monDataAttribute, const void * value); + +/** + * @brief Increases some numerical fields in a Pokemon by the given value. Does nothing if the field is not supported + * + * @todo list of supported fields? + * + * @param mon + * @param monDataAttribute + * @param value + */ +void IncreaseMonData(Pokemon * mon, int monDataAttribute, int value); + +/** + * @brief Gets a PokemonPersonalData based on a pokemon species and form + * + * @param monSpecies + * @param monForm + * @param heapID The index of the heap that the PokemonPersonalData should be loaded into + * @return PokemonPersonalData* + */ +PokemonPersonalData * GetMonFormPersonalData(int monSpecies, int monForm, int heapID); + +/** + * @brief Gets a PokemonPersonalData based on a pokemon species + * + * @param monSpecies + * @param heapID The index of the heap that the PokemonPersonalData should be loaded into + * @return PokemonPersonalData* + */ +PokemonPersonalData * GetMonPersonalData(int monSpecies, int heapID); + +/** + * @brief Gets a value from a PokemonPersonalData structure + * + * @param monPersonalData + * @param monPersonalDataAttribute What value to get + * @return The requested value + */ +u32 GetMonPersonalDataAttribute(PokemonPersonalData * monPersonalData, int monPersonalDataAttribute); + +/** + * @brief Frees a PokemonPersonalData structure from the heap + * + * @param monPersonalData + */ +void FreeMonPersonalData(PokemonPersonalData * monPersonalData); + +/** + * @brief Loads a PokemonPersonalData based on its species and form and gets a value from it + * + * @param monSpecies + * @param monForm + * @param monPersonalDataAttribute What value to get + * @return The requested value + */ +u32 GetMonFormPersonalDataAttribute(int monSpecies, int monForm, int monPersonalDataAttribute); + +/** + * @brief Loads a PokemonPersonalData based on its species and gets a value from it + * + * @param monSpecies + * @param monPersonalDataAttribute What value to get + * @return The requested value + */ +u32 GetMonSpeciesPersonalDataAttribute(int monSpecies, int monPersonalDataAttribute); + +/** + * @brief Gets how much progress a Pokemon has made towards its next level as a percentage + * + * @param mon + * @return how much progress a Pokemon has made towards its next level as a percentage + */ +u8 GetMonPercentToNextLevel(Pokemon * mon); + +/** + * @brief Gets how much experience is needed for the given Pokemon to level up + * + * @param boxMon + * @return The amount of exp. needed for the given Pokemon to level up + */ +u32 GetMonExpToNextLevel(Pokemon * mon); + +/** + * @brief Gets how much experience is needed for the given BoxPokemon to level up + * + * @param boxMon + * @return The amount of exp. needed for the given BoxPokemon to level up + */ +u32 GetBoxMonExpToNextLevel(BoxPokemon * boxMon); + +/** + * @brief Gets the amount of expeirence needed for the given Pokemon to reach its current level + * + * @param mon + * @return The amount of exp. needed for the given Pokemon to reach its current level + */ +u32 GetMonCurrentLevelExp(Pokemon * mon); + +/** + * @brief Gets the amount of expeirence needed for a pokemon species to reach a specified level + * + * @param monSpecies + * @param monLevel + * @return The amount of exp. needed for the given pokemon species to reach the specified level + */ +u32 GetMonSpeciesLevelExp(int monSpecies, int monLevel); + +/** + * @copybrief GetMonSpeciesLevel() + * + * @param mon + * @return The pokemons level + */ +u32 GetMonLevel(Pokemon * mon); + +/** + * @copybrief GetMonSpeciesLevel() + * + * @param boxMon + * @return The pokemons level + */ +u32 GetBoxMonLevel(BoxPokemon * boxMon); + +/** + * @brief Gets the level of a pokemon based on its species and exp + * + * @param monSpecies + * @param monExp + * @return The pokemons level + */ +u32 GetMonSpeciesLevel(u16 monSpecies, u32 monExp); + +/** + * @brief Gets the level of a pokemon based on its personal data and exp + * + * @param monPersonalData + * @param unused_monSpecies unused + * @param monExp + * @return The pokemons level + */ +u32 GetMonPersonalDataLevel(PokemonPersonalData * monPersonalData, u16 unused_monSpecies, u32 monExp); + +/** + * @brief Gets the nature of a Pokemon based on its personality value + * + * @param mon + * @return The pokemons nature + */ +u8 GetMonNature(Pokemon * mon); + +/** + * @brief Gets the nature of a BoxPokemon based on its personality value + * + * @param boxMon + * @return The pokemons nature + */ +u8 GetBoxMonNature(BoxPokemon * boxMon); + +/** + * @brief Gets the nature of a pokemon based on its personality value + * + * @param monPersonality + * @return The pokemons nature + */ +u8 GetNatureFromPersonality(u32 monPersonality); + +/** + * @brief Gets the affinitiy of a given pokemon nature to a given stat + * + * @param monNature + * @param statType + * @return 1 if stat is increased, -1 if stat is decreased, else 0 + */ +s8 GetNatureStatAffinity(u8 monNature, u8 statType); + +void sub_02075C74(Pokemon * mon, u8 param1, u16 param2); + +/** + * @brief Gets the gender of a Pokemon based on its species and personality value + * + * @param boxMon + * @return The pokemons gender + */ +u8 GetMonGender(Pokemon * mon); + +/** + * @brief Gets the gender of a BoxPokemon based on its species and personality value + * + * @param boxMon + * @return The pokemons gender + */ +u8 GetBoxMonGender(BoxPokemon * boxMon); + +/** + * @brief Gets the gender of a pokemon based on its species and personality value + * + * @param monSpecies + * @param monPersonality + * @return The pokemons gender + */ +u8 GetMonPersonalityGender(u16 monSpecies, u32 monPersonality); + +/** + * @brief Gets the gender of a pokemon based on its PokemonPersonalData and personality value + * + * @param monPersonalData + * @param unused_monSpecies unused + * @param monPersonality + * @return The pokemons gender + */ +u8 GetMonPersonalDataGender(PokemonPersonalData * monPersonalData, u16 unused_monSpecies, u32 monPersonality); + +/** + * @brief Gets whether a BoxPokemon is shiny based on its Original Trainer ID and its personality value + * + * @param mon + * @return Whether the pokemon is shiny or not + */ +u8 GetMonShininess(Pokemon * mon); + +/** + * @brief Gets whether a BoxPokemon is shiny based on its Original Trainer ID and its personality value + * + * @param boxMon + * @return Whether the pokemon is shiny or not + */ +u8 GetBoxMonShininess(BoxPokemon * boxMon); + +/** + * @brief Gets whether a pokemon is shiny based on its Original Trainer ID and its personality value + * + * @param monOTID + * @param monPersonality + * @return Whether the pokemon is shiny or not + */ +u8 GetMonPersonalityShininess(u32 monOTID, u32 monPersonality); + +u32 sub_02075E64(u32 param0); +void sub_02075EF4(UnkStruct_02008A90 * param0, Pokemon * mon, u8 param2); +void sub_02075F00(UnkStruct_02008A90 * param0, Pokemon * mon, u8 param2); +void sub_02075F0C(UnkStruct_02008A90 * param0, BoxPokemon * boxMon, u8 param2, int param3); +void sub_02075FB4(UnkStruct_02008A90 * param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); + +/** + * @brief Sanitizes a pokemon form. If the given form is greater than the max for the given species, returns zero, else returns the form unchanged + * + * @param monSpecies + * @param monForm + * @return The sanitized pokemon form + */ +u8 SanitizeFormId(u16 monSpecies, u8 monForm); + +u8 sub_020765AC(Pokemon * mon, u8 param1); +u8 sub_020765B8(Pokemon * mon, u8 param1); +u8 sub_020765C4(BoxPokemon * boxMon, u8 param1, int param2); +u8 sub_02076648(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality); +void sub_0207697C(UnkStruct_02008A90 * param0, u16 param1); +UnkStruct_0200D0F4 * sub_02076994(UnkStruct_0200C6E4 * param0, UnkStruct_0200C704 * param1, UnkStruct_02002F38 * param2, int param3, int param4, int param5, int param6, int param7, int heapID); +void sub_02076AAC(int param0, int param1, UnkStruct_ov5_021DE5D0 * param2); + +/** + * @brief Returns the size in bytes of a Pokemon struct as a u32 + * + * @return Size in bytes of a Pokemon struct + */ +u32 GetPokemonStructSize(void); + +/** + * @brief Returns the size in bytes of a BoxPokemon struct as a u32 + * + * @return Size in bytes of a BoxPokemon struct + */ +u32 GetBoxPokemonStructSize(void); + +/** + * @brief Gets the form of a Pokemon + * + * @param mon + * @return The pokemons form + */ +u8 GetMonForm(Pokemon * mon); + +/** + * @brief Gets the form of a BoxPokemon + * + * @param boxMon + * @return The pokemons form + */ +u8 GetBoxMonForm(BoxPokemon * boxMon); + +/** + * @brief Gets the BoxPokemon data for a given Pokemon + * + * @param mon + * @return The BoxPokemon data for a given Pokemon + */ +BoxPokemon * GetBoxMon(Pokemon * mon); + +u8 sub_02076B14(Pokemon * mon); +u16 sub_02076B94(Party * party, Pokemon * mon, u8 evoTypeList, u16 evoParam, int * evoTypeResult); +u16 sub_02076F84(const u16 monSpecies); +u16 sub_02076FD4(const u16 monSpecies); + +/** + * @brief Sets the moveset of a BoxPokemon to the highest 4 available to that pokemon in its level up movelist + * + * @param boxMon + */ +void SetBoxMonDefaultMoves(BoxPokemon * boxMon); + +/** + * @brief Adds a move to the moveset of a Pokemon + * + * @param mon + * @param moveID + * @return The given moveID if successful, 0xfffe if already known, 0xffff if there is no room for the move + */ +u16 AddMonMove(Pokemon * mon, u16 moveID); + +/** + * @brief Adds a move to the moveset of a BoxPokemon + * + * @param boxMon + * @param moveID + * @return u16 + */ +u16 AddBoxMonMove(BoxPokemon * boxMon, u16 moveID); + +/** + * @brief Deletes the first move of a Pokemon and adds the given move to the end of its moveset + * + * @param mon + * @param moveID + */ +void ReplaceMonMove(Pokemon * mon, u16 moveID); + +/** + * @brief Deletes the first move of a BoxPokemon and adds the given move to the end of its moveset + * + * @param boxMon + * @param moveID + */ +void ReplaceBoxMonMove(BoxPokemon * boxMon, u16 moveID); + +/** + * @brief Sets the given moveSlot of a Pokemon, removing its PP Ups + * + * @param mon + * @param moveID + * @param moveSlot + */ +void ResetMonMove(Pokemon * mon, u16 moveID, u8 moveSlot); + +/** + * @brief Sets the given moveSlot of a Pokemon, retaining the PP Ups for that slot + * + * @param mon + * @param moveID + * @param moveSlot + */ +void SetMonMove(Pokemon * mon, u16 moveID, u8 moveSlot); + +/** + * @brief Sets the given moveSlot of a BoxPokemon, retaining the PP Ups for that slot + * + * @param boxMon + * @param moveID + * @param moveSlot + */ +void SetBoxMonMove(BoxPokemon * boxMon, u16 moveID, u8 moveSlot); + +u16 sub_0207727C(Pokemon * mon, int * index, u16 * moveID); + +/** + * @brief Swaps the places of two moves on a Pokemon + * + * @param mon + * @param moveSlot1 + * @param moveSlot2 + */ +void SwapMonMoves(Pokemon * mon, int moveSlot1, int moveSlot2); + +/** + * @brief Swaps the places of two moves on a BoxPokemon + * + * @param boxMon + * @param moveSlot1 + * @param moveSlot2 + */ +void SwapBoxMonMoves(BoxPokemon * boxMon, int moveSlot1, int moveSlot2); + +/** + * @brief Deletes the given moveSlot of a Pokemon, shifting the ones above it down + * + * @param mon + * @param moveSlot + */ +void DeleteMonMove(Pokemon * mon, u32 moveSlot); + +/** + * @brief Checks whether a Pokemon has a given move + * + * @param mon + * @param moveID + * @return Whether the given Pokemon has the given move + */ +BOOL MonHasMove(Pokemon * mon, u16 moveID); + +void sub_020774C8(BoxPokemon * boxMon, Pokemon * mon); + +/** + * @brief Gets the level of the highest level pokemon in the Party + * + * @param party + * @return The level of the highest level pokemon in the Party + */ +u8 GetPartyHighestLevel(Party * party); + +u16 sub_020775A4(u16 param0); +u16 sub_020775C4(u16 param0); +void sub_020775EC(Pokemon * src, Pokemon * dest); +void sub_02077604(BoxPokemon * src, BoxPokemon * dest); +void sub_02077618(Pokemon * src, BoxPokemon * dest); +s8 sub_0207762C(Pokemon * mon, int param1); +s8 sub_02077634(BoxPokemon * boxMon, int param1); +s8 sub_02077648(u32 monPersonality, int param1); + +/** + * @brief Gets all moves that the given pokemon species and form can learn by leveling up + * + * @param monSpecies + * @param monForm + * @param[out] monLevelUpMoveIDs Pointer to a u16 array for storing the level up moves + * @return int + */ +int GetMonLevelUpMoveIDs(int monSpecies, int monForm, u16 * monLevelUpMoveIDs); + +void sub_020776B0(Party * party); +u8 sub_02077758(Party * party, u8 param1); +void sub_020777B4(Party * party, s32 param1); +void sub_0207782C(Party * party); +BOOL sub_020778D8(Pokemon * mon); +BOOL sub_020778E0(BoxPokemon * boxMon); +BOOL sub_020778F8(Pokemon * mon); +BOOL sub_02077900(BoxPokemon * boxMon); + +/** + * @brief Sets Arceus' form based on its held item. Has no effect if the given Pokemon is not an Arceus + * + * @param mon + */ +void SetArceusForm(Pokemon * mon); + +/** + * @brief Sets Arceus' form based on its held item. Has no effect if the given Pokemon is not an Arceus + * + * @param boxMon + */ +void SetBoxArceusForm(BoxPokemon * boxMon); + +/** + * @brief Get Arceus' form given an items hold effect + * + * @param itemHoldEffect + * @return The form arceus should be in + */ +u8 GetArceusItemType(u16 itemHoldEffect); + +/** + * @brief Sets Giratina's form based on its held item. Has no effect if the given Pokemon is not a Giratina + * + * @param mon + * @return The form Giratina was set to, or -1 if the given BoxPokemon was not a Giratina + */ +int SetGiratinaForm(Pokemon * mon); + +/** + * @brief Sets Giratina's form based on its held item. Has no effect if the given BoxPokemon is not a Giratina + * + * @param boxMon + * @return The form Giratina was set to, or -1 if the given BoxPokemon was not a Giratina + */ +int SetBoxGiratinaForm(BoxPokemon * boxMon); + +/** + * @brief Set Giratina to its Origin form. Has no effect if the given Pokemon is not a Giratina + * + * @param mon + */ +void SetGiratinaOriginForm(Pokemon * mon); + +/** + * @brief Iterates over all the Pokemon in Party, setting the form of any Giratina. + * If param1 is 1, always sets Giratina into Origin form, otherwise its form is based on held item + * + * @param party + * @param param1 + */ +void SetPartyGiratinaForm(Party * party, int param1); + +/** + * @brief Sets Shaymin to the given form. Has no effect if the given Pokemon is not a Shaymin + * + * @param mon + * @param monForm + */ +void SetShayminForm(Pokemon * mon, int monForm); + +/** + * @brief Sets Shaymin to the given form. Has no effect if the given BoxPokemon is not a Shaymin + * + * @param boxMon + * @param monForm + */ +void SetBoxShayminForm(BoxPokemon * boxMon, int monForm); + +/** + * @brief Checks whether Shaymin is allowed to change into Sky Form. Always returns false if the given Pokemon is not a Shaymin + * + * @param mon + * @return Whether Shaymin is allowed to change into Sky Form + */ +BOOL AllowShayminSkyForm(Pokemon * mon); + +/** + * @brief Iterates over all the Pokemon in Party, setting the form of any Shaymin to land form. + * + * @param party + */ +void SetShayminLandForm(Party * party); + +/** + * @brief Sets all Shaymin in the party to Land form at night + * + * @todo Verify this, seems correct but not sure what param1 does to the calculation here (time zone offset?) + * + * @param party + * @param param1 + * @param rtcTime + * @return Whether Shaymin should be set to Land form + */ +BOOL SetPartyShayminForm(Party * party, int param1, const RTCTime * rtcTime); + +/** + * @brief Sets Rotom to the given form. Has no effect if the given Pokemon is not a Rotom + * If Rotom should learn a form specific move and there is no room, overwrites moveSlot with the new move + * + * @param mon + * @param monForm + * @param moveSlot + * @return Whether the given pokemon was a Rotom + */ +BOOL SetRotomForm(Pokemon * mon, int monForm, int moveSlot); + +/** + * @brief Loads a Level-Up move table based on a pokemon species and form into the pointed to array + * + * @param monSpecies + * @param monForm + * @param[out] monLevelUpMoves Pointer to a u16 array to store the move table + */ +void LoadMonLevelUpMoves(int monSpecies, int monForm, u16 * monLevelUpMoves); + +void sub_02077D3C(UnkStruct_0202CC84 * param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7); +void sub_02077DB4(UnkStruct_0202CC84 * param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7, u8 param8); +BOOL sub_02077E3C(Pokemon * mon); +void sub_02077E64(Pokemon * mon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5); +void sub_02077EA4(BoxPokemon * boxMon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5); +void sub_02077EE4(Pokemon * mon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5); +void sub_02077EF8(BoxPokemon * boxMon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5); +void sub_02077F0C(Pokemon * mon, u32 param1, int param2); +BOOL sub_02077FB4(Pokemon * mon, u8 param1); +BOOL sub_02077FBC(BoxPokemon * boxMon, u8 param1); +BOOL sub_02077FE4(u16 monSpecies, int monForm, u8 tmID); + +/** + * @brief Sets the ability of a Pokemon based on its species, form and peronsality value + * + * @param mon + */ +void CalculateMonAbility(Pokemon * mon); + +/** + * @brief Sets the ability of a BoxPokemon based on its species, form and peronsality value + * + * @param boxMon + */ +void CalculateBoxMonAbility(BoxPokemon * boxMon); + +void sub_020780C4(Pokemon * mon, u32 monPersonality); + +/** + * @brief Gets a bitmask with a single bit set at the specified index. + * + * @param index + * @return A bitmask with a single bit set at the specified index. + */ +u32 GetSingleBitMask(int index); + +/** + * @brief Gets the index of the lowest set bit of the given number + * + * @param num + * @return The index of the lowest set bit of the given number + */ +int GetLowestSetBitIndex(u32 num); + +BOOL sub_02078804(u16 param0); +u16 sub_02078824(u8 index); +BOOL sub_02078838(Pokemon * mon); +BOOL sub_0207884C(BoxPokemon * boxMon, UnkStruct_02025E6C * param1, int heapID); +int sub_020788D0(int param0); +void sub_0207893C(Pokemon * mon); +void sub_0207896C(BoxPokemon * boxMon); +void sub_020789BC(NARC * narc, UnkStruct_02007C10 * param1, u16 param2, u16 param3); +void sub_020789F4(NARC * narc, UnkStruct_02015F84 * param1, UnkStruct_02007C7C * param2, u16 param3, int param4, int param5, int param6); +void sub_02078A4C(NARC * narc, u8 * param1, u16 param2, u16 param3); +void sub_02078A80(NARC * narc, s8 * param1, u16 param2); +void sub_02078AA4(NARC * narc, s8 * param1, u16 param2); +void sub_02078AC8(NARC * narc, u8 * param1, u16 param2); +BOOL sub_02078AEC(int param0, Pokemon * mon, int heapID); +void sub_02078B40(Pokemon * mon, UnkStruct_02078B40 * param1); +void sub_02078E0C(UnkStruct_02078B40 * param0, Pokemon * mon); + +#endif // POKEPLATINUM_UNK_02073C2C_H diff --git a/include/struct_decls/party_pokemon.h b/include/struct_decls/party_pokemon.h deleted file mode 100644 index 22a6e3a479..0000000000 --- a/include/struct_decls/party_pokemon.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef POKEPLATINUM_PARTY_POKEMON_DECL_H -#define POKEPLATINUM_PARTY_POKEMON_DECL_H - -typedef struct PartyPokemon_t PartyPokemon; - -#endif // POKEPLATINUM_PARTY_POKEMON_DECL_H diff --git a/include/struct_decls/struct_02075874_decl.h b/include/struct_decls/struct_02075874_decl.h deleted file mode 100644 index 316e92eddd..0000000000 --- a/include/struct_decls/struct_02075874_decl.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_02075874_DECL_H -#define POKEPLATINUM_STRUCT_02075874_DECL_H - -typedef struct UnkStruct_02075874_t UnkStruct_02075874; - -#endif // POKEPLATINUM_STRUCT_02075874_DECL_H diff --git a/include/struct_decls/struct_0207821C_decl.h b/include/struct_decls/struct_0207821C_decl.h deleted file mode 100644 index c4d6d0d24b..0000000000 --- a/include/struct_decls/struct_0207821C_decl.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207821C_DECL_H -#define POKEPLATINUM_STRUCT_0207821C_DECL_H - -typedef struct UnkStruct_0207821C_t UnkStruct_0207821C; - -#endif // POKEPLATINUM_STRUCT_0207821C_DECL_H diff --git a/include/struct_decls/struct_0207821C_sub1_decl.h b/include/struct_decls/struct_0207821C_sub1_decl.h deleted file mode 100644 index cdeca7ca8e..0000000000 --- a/include/struct_decls/struct_0207821C_sub1_decl.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207821C_SUB1_DECL_H -#define POKEPLATINUM_STRUCT_0207821C_SUB1_DECL_H - -typedef struct UnkStruct_0207821C_sub1_t UnkStruct_0207821C_sub1; - -#endif // POKEPLATINUM_STRUCT_0207821C_SUB1_DECL_H diff --git a/include/struct_defs/box_pokemon.h b/include/struct_defs/box_pokemon.h index 8eb698a3bb..51a5782fbc 100644 --- a/include/struct_defs/box_pokemon.h +++ b/include/struct_defs/box_pokemon.h @@ -1,22 +1,25 @@ #ifndef POKEPLATINUM_BOX_POKEMON_H #define POKEPLATINUM_BOX_POKEMON_H -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" -#include "struct_defs/pokemon_substruct_0.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" +#include "struct_defs/pokemon_data_block_a.h" +/** + * @brief Boxed Pokemon data structure + */ typedef struct { - u32 unk_00; - u16 unk_04_0 : 1; - u16 unk_04_1 : 1; - u16 unk_04_2 : 1; + u32 personality; //!< The personality value of the pokemon + u16 partyDecrypted : 1; //!< Whether the pokemons party data is currently decrypted + u16 boxDecrypted : 1; //!< Whether the pokemons boxed data is currently decrypted + u16 invalidData : 1; //!< Set if the pokemons data is invalid (failed checksum). This will make the mon appear as a Bad Egg in game u16 unk_04_3 : 13; - u16 unk_06; - u8 unk_08[sizeof(PokemonSubstruct0) - + sizeof(PokemonSubstruct1) - + sizeof(PokemonSubstruct2) - + sizeof(PokemonSubstruct3)]; + u16 checksum; //!< Checksum for the pokemons data + u8 dataBlocks[sizeof(PokemonDataBlockA) + + sizeof(PokemonDataBlockB) + + sizeof(PokemonDataBlockC) + + sizeof(PokemonDataBlockD)]; //!< Data blocks containing the pokemons boxed data, stored encrypted } BoxPokemon; #endif // POKEPLATINUM_BOX_POKEMON_H diff --git a/include/struct_defs/party_pokemon.h b/include/struct_defs/party_pokemon.h index 3bfe7ce770..7581303fde 100644 --- a/include/struct_defs/party_pokemon.h +++ b/include/struct_defs/party_pokemon.h @@ -4,9 +4,12 @@ #include "struct_defs/struct_0202818C.h" #include "struct_defs/struct_0202CA28.h" -struct PartyPokemon_t { +/** + * @brief Party Pokemon data structure + */ +typedef struct PartyPokemon { u32 unk_00; - u8 unk_04; + u8 level; //!< The pokemons level u8 unk_05; u16 unk_06; u16 unk_08; @@ -17,6 +20,6 @@ struct PartyPokemon_t { u16 unk_12; UnkStruct_0202818C unk_14; UnkStruct_0202CA28 unk_4C; -}; +} PartyPokemon; #endif // POKEPLATINUM_PARTY_POKEMON_DATA_T_H diff --git a/include/struct_defs/pokemon.h b/include/struct_defs/pokemon.h index 87342992d3..ab5345a985 100644 --- a/include/struct_defs/pokemon.h +++ b/include/struct_defs/pokemon.h @@ -2,12 +2,14 @@ #define POKEPLATINUM_STRUCT_POKEMON_H #include "struct_defs/box_pokemon.h" -#include "struct_decls/party_pokemon.h" #include "struct_defs/party_pokemon.h" +/** + * @brief The main Pokemon data structure + */ typedef struct { - BoxPokemon box; - PartyPokemon party; + BoxPokemon box; //!< Contains the pokemons boxed data + PartyPokemon party; //!< Contains the pokemons extra data while it is in the players party } Pokemon; #endif // POKEPLATINUM_STRUCT_POKEMON_H diff --git a/include/struct_defs/pokemon_data_block_a.h b/include/struct_defs/pokemon_data_block_a.h new file mode 100644 index 0000000000..4ab865b15e --- /dev/null +++ b/include/struct_defs/pokemon_data_block_a.h @@ -0,0 +1,31 @@ +#ifndef POKEPLATINUM_POKEMON_SUBSTRUCT_0_H +#define POKEPLATINUM_POKEMON_SUBSTRUCT_0_H + +/** + * @brief Block A of the BoxPokemon data structure + */ +typedef struct PokemonDataBlockA { + u16 species; //!< The pokemons species + u16 heldItem; //!< The pokemons currently held item + u32 otID; //!< The pokemons Original Trainer ID + u32 exp; //!< The pokemons experience points + u8 friendship; //!< The pokemons friendship stat + u8 ability; //!< The pokemons ability + u8 unk_0E; + u8 originLanguage; //!< The language of the game this pokemon was caught in + u8 hpEV; //!< The pokemons HP EVs + u8 atkEV; //!< The pokemons Attack EVs + u8 defEV; //!< The pokemons Defense EVs + u8 speedEV; //!< The pokemons Speed EVs + u8 spAtkEV; //!< The pokemons Special Attack EVs + u8 spDefEV; //!< The pokemons Special Defense EVs + u8 cool; //!< The pokemons Cool contest stat + u8 beauty; //!< The pokemons Beauty contest stat + u8 cute; //!< The pokemons Cute contest stat + u8 smart; //!< The pokemons Smart contest stat + u8 tough; //!< The pokemons Tough contest stat + u8 sheen; //!< The pokemons Sheen + u32 unk_1C; +} PokemonDataBlockA; + +#endif // POKEPLATINUM_POKEMON_SUBSTRUCT_0_H diff --git a/include/struct_defs/pokemon_data_block_b.h b/include/struct_defs/pokemon_data_block_b.h new file mode 100644 index 0000000000..570507c909 --- /dev/null +++ b/include/struct_defs/pokemon_data_block_b.h @@ -0,0 +1,29 @@ +#ifndef POKEPLATINUM_POKEMON_SUBSTRUCT_1_H +#define POKEPLATINUM_POKEMON_SUBSTRUCT_1_H + +/** + * @brief Block B of the BoxPokemon data structure + */ +typedef struct PokemonDataBlockB { + u16 unk_00[4]; + u8 unk_08[4]; + u8 unk_0C[4]; + u32 hpIV : 5; //!< The pokemons HP IVs + u32 atkIV : 5; //!< The pokemons Attack IVs + u32 defIV : 5; //!< The pokemons Defense IVs + u32 speedIV : 5; //!< The pokemons Speed IVs + u32 spAtkIV : 5; //!< The pokemons Special Attack IVs + u32 spDefIV : 5; //!< The pokemons Special Defense IVs + u32 isEgg : 1; //!< Whether this pokemon is an egg or not + u32 unk_10_31 : 1; + u32 unk_14; + u8 fatefulEncounter:1; //!< The pokemons "Fateful Encounter" flag + u8 gender : 2; //!< The pokemons gender + u8 form:5; //!< The pokemons form + u8 unk_19; + u16 unk_1A; + u16 unk_1C; + u16 unk_1E; +} PokemonDataBlockB; + +#endif // POKEPLATINUM_POKEMON_SUBSTRUCT_1_H diff --git a/include/struct_defs/pokemon_substruct_2.h b/include/struct_defs/pokemon_data_block_c.h similarity index 51% rename from include/struct_defs/pokemon_substruct_2.h rename to include/struct_defs/pokemon_data_block_c.h index e4d18d0398..3d9c7552c4 100644 --- a/include/struct_defs/pokemon_substruct_2.h +++ b/include/struct_defs/pokemon_data_block_c.h @@ -1,11 +1,14 @@ #ifndef POKEPLATINUM_POKEMON_SUBSTRUCT_2_H #define POKEPLATINUM_POKEMON_SUBSTRUCT_2_H -typedef struct PokemonSubstruct2_t { +/** + * @brief Block C of the BoxPokemon data structure + */ +typedef struct PokemonDataBlockC { u16 unk_00[11]; u8 unk_16; - u8 unk_17; + u8 originGame; //!< The game this pokemon was caught in u64 unk_18; -} PokemonSubstruct2; +} PokemonDataBlockC; #endif // POKEPLATINUM_POKEMON_SUBSTRUCT_2_H diff --git a/include/struct_defs/pokemon_data_block_d.h b/include/struct_defs/pokemon_data_block_d.h new file mode 100644 index 0000000000..e3641fa637 --- /dev/null +++ b/include/struct_defs/pokemon_data_block_d.h @@ -0,0 +1,25 @@ +#ifndef POKEPLATINUM_POKEMON_SUBSTRUCT_3_H +#define POKEPLATINUM_POKEMON_SUBSTRUCT_3_H + +/** + * @brief Block D of the BoxPokemon data structure + */ +typedef struct PokemonDataBlockD { + u16 unk_00[8]; + u8 unk_10; + u8 unk_11; + u8 unk_12; + u8 unk_13; + u8 unk_14; + u8 unk_15; + u16 unk_16; + u16 unk_18; + u8 pokerus; //!< The pokemons Pokerus value + u8 pokeball; //!< What pokeball this pokemon was caught in + u8 metLevel : 7; //!< What level this pokemon was originally met at + u8 otGender : 1; //!< The gender of this pokemons Original Trainer + u8 unk_1D; + u16 unk_1E; +} PokemonDataBlockD; + +#endif // POKEPLATINUM_POKEMON_SUBSTRUCT_3_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_0.h b/include/struct_defs/pokemon_data_block_shuffle_0.h new file mode 100644 index 0000000000..10565bd548 --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_0.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_H +#define POKEPLATINUM_STRUCT_0207825C_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlocksShuffle0 { + PokemonDataBlockA dataBlockA; + PokemonDataBlockB dataBlockB; + PokemonDataBlockC dataBlockC; + PokemonDataBlockD dataBlockD; +} PokemonDataBlocksShuffle0; + +#endif // POKEPLATINUM_STRUCT_0207825C_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_1.h b/include/struct_defs/pokemon_data_block_shuffle_1.h new file mode 100644 index 0000000000..bb957c09d3 --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_1.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_1_H +#define POKEPLATINUM_STRUCT_0207825C_1_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle1 { + PokemonDataBlockA dataBlockA; + PokemonDataBlockB dataBlockB; + PokemonDataBlockD dataBlockD; + PokemonDataBlockC dataBlockC; +} PokemonDataBlockShuffle1; + +#endif // POKEPLATINUM_STRUCT_0207825C_1_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_10.h b/include/struct_defs/pokemon_data_block_shuffle_10.h new file mode 100644 index 0000000000..89ca560b37 --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_10.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_10_H +#define POKEPLATINUM_STRUCT_0207825C_10_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle10 { + PokemonDataBlockB dataBlockB; + PokemonDataBlockD dataBlockD; + PokemonDataBlockA dataBlockA; + PokemonDataBlockC dataBlockC; +} PokemonDataBlockShuffle10; + +#endif // POKEPLATINUM_STRUCT_0207825C_10_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_11.h b/include/struct_defs/pokemon_data_block_shuffle_11.h new file mode 100644 index 0000000000..2c86be02a5 --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_11.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_11_H +#define POKEPLATINUM_STRUCT_0207825C_11_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle11 { + PokemonDataBlockB dataBlockB; + PokemonDataBlockD dataBlockD; + PokemonDataBlockC dataBlockC; + PokemonDataBlockA dataBlockA; +} PokemonDataBlockShuffle11; + +#endif // POKEPLATINUM_STRUCT_0207825C_11_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_12.h b/include/struct_defs/pokemon_data_block_shuffle_12.h new file mode 100644 index 0000000000..6ca248d472 --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_12.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_12_H +#define POKEPLATINUM_STRUCT_0207825C_12_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle12 { + PokemonDataBlockC dataBlockC; + PokemonDataBlockA dataBlockA; + PokemonDataBlockB dataBlockB; + PokemonDataBlockD dataBlockD; +} PokemonDataBlockShuffle12; + +#endif // POKEPLATINUM_STRUCT_0207825C_12_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_13.h b/include/struct_defs/pokemon_data_block_shuffle_13.h new file mode 100644 index 0000000000..e07a2fed2a --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_13.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_13_H +#define POKEPLATINUM_STRUCT_0207825C_13_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle13 { + PokemonDataBlockC dataBlockC; + PokemonDataBlockA dataBlockA; + PokemonDataBlockD dataBlockD; + PokemonDataBlockB dataBlockB; +} PokemonDataBlockShuffle13; + +#endif // POKEPLATINUM_STRUCT_0207825C_13_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_14.h b/include/struct_defs/pokemon_data_block_shuffle_14.h new file mode 100644 index 0000000000..96562f51de --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_14.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_14_H +#define POKEPLATINUM_STRUCT_0207825C_14_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle14 { + PokemonDataBlockC dataBlockC; + PokemonDataBlockB dataBlockB; + PokemonDataBlockA dataBlockA; + PokemonDataBlockD dataBlockD; +} PokemonDataBlockShuffle14; + +#endif // POKEPLATINUM_STRUCT_0207825C_14_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_15.h b/include/struct_defs/pokemon_data_block_shuffle_15.h new file mode 100644 index 0000000000..c6a80ed5fe --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_15.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_15_H +#define POKEPLATINUM_STRUCT_0207825C_15_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle15 { + PokemonDataBlockC dataBlockC; + PokemonDataBlockB dataBlockB; + PokemonDataBlockD dataBlockD; + PokemonDataBlockA dataBlockA; +} PokemonDataBlockShuffle15; + +#endif // POKEPLATINUM_STRUCT_0207825C_15_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_16.h b/include/struct_defs/pokemon_data_block_shuffle_16.h new file mode 100644 index 0000000000..a98f2bc225 --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_16.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_16_H +#define POKEPLATINUM_STRUCT_0207825C_16_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle16 { + PokemonDataBlockC dataBlockC; + PokemonDataBlockD dataBlockD; + PokemonDataBlockA dataBlockA; + PokemonDataBlockB dataBlockB; +} PokemonDataBlockShuffle16; + +#endif // POKEPLATINUM_STRUCT_0207825C_16_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_17.h b/include/struct_defs/pokemon_data_block_shuffle_17.h new file mode 100644 index 0000000000..086ae99c96 --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_17.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_17_H +#define POKEPLATINUM_STRUCT_0207825C_17_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle17 { + PokemonDataBlockC dataBlockC; + PokemonDataBlockD dataBlockD; + PokemonDataBlockB dataBlockB; + PokemonDataBlockA dataBlockA; +} PokemonDataBlockShuffle17; + +#endif // POKEPLATINUM_STRUCT_0207825C_17_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_18.h b/include/struct_defs/pokemon_data_block_shuffle_18.h new file mode 100644 index 0000000000..508c685334 --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_18.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_18_H +#define POKEPLATINUM_STRUCT_0207825C_18_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle18 { + PokemonDataBlockD dataBlockD; + PokemonDataBlockA dataBlockA; + PokemonDataBlockB dataBlockB; + PokemonDataBlockC dataBlockC; +} PokemonDataBlockShuffle18; + +#endif // POKEPLATINUM_STRUCT_0207825C_18_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_19.h b/include/struct_defs/pokemon_data_block_shuffle_19.h new file mode 100644 index 0000000000..4f49a550ba --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_19.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_19_H +#define POKEPLATINUM_STRUCT_0207825C_19_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle19 { + PokemonDataBlockD dataBlockD; + PokemonDataBlockA dataBlockA; + PokemonDataBlockC dataBlockC; + PokemonDataBlockB dataBlockB; +} PokemonDataBlockShuffle19; + +#endif // POKEPLATINUM_STRUCT_0207825C_19_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_2.h b/include/struct_defs/pokemon_data_block_shuffle_2.h new file mode 100644 index 0000000000..010b6955ec --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_2.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_2_H +#define POKEPLATINUM_STRUCT_0207825C_2_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle2 { + PokemonDataBlockA dataBlockA; + PokemonDataBlockC dataBlockC; + PokemonDataBlockB dataBlockB; + PokemonDataBlockD dataBlockD; +} PokemonDataBlockShuffle2; + +#endif // POKEPLATINUM_STRUCT_0207825C_2_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_20.h b/include/struct_defs/pokemon_data_block_shuffle_20.h new file mode 100644 index 0000000000..868470cf9e --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_20.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_20_H +#define POKEPLATINUM_STRUCT_0207825C_20_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle20 { + PokemonDataBlockD dataBlockD; + PokemonDataBlockB dataBlockB; + PokemonDataBlockA dataBlockA; + PokemonDataBlockC dataBlockC; +} PokemonDataBlockShuffle20; + +#endif // POKEPLATINUM_STRUCT_0207825C_20_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_21.h b/include/struct_defs/pokemon_data_block_shuffle_21.h new file mode 100644 index 0000000000..f50606d38e --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_21.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_21_H +#define POKEPLATINUM_STRUCT_0207825C_21_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle21 { + PokemonDataBlockD dataBlockD; + PokemonDataBlockB dataBlockB; + PokemonDataBlockC dataBlockC; + PokemonDataBlockA dataBlockA; +} PokemonDataBlockShuffle21; + +#endif // POKEPLATINUM_STRUCT_0207825C_21_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_22.h b/include/struct_defs/pokemon_data_block_shuffle_22.h new file mode 100644 index 0000000000..fe4e41d1cf --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_22.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_22_H +#define POKEPLATINUM_STRUCT_0207825C_22_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle22 { + PokemonDataBlockD dataBlockD; + PokemonDataBlockC dataBlockC; + PokemonDataBlockA dataBlockA; + PokemonDataBlockB dataBlockB; +} PokemonDataBlockShuffle22; + +#endif // POKEPLATINUM_STRUCT_0207825C_22_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_23.h b/include/struct_defs/pokemon_data_block_shuffle_23.h new file mode 100644 index 0000000000..3ec7826565 --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_23.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_23_H +#define POKEPLATINUM_STRUCT_0207825C_23_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle23 { + PokemonDataBlockD dataBlockD; + PokemonDataBlockC dataBlockC; + PokemonDataBlockB dataBlockB; + PokemonDataBlockA dataBlockA; +} PokemonDataBlockShuffle23; + +#endif // POKEPLATINUM_STRUCT_0207825C_23_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_3.h b/include/struct_defs/pokemon_data_block_shuffle_3.h new file mode 100644 index 0000000000..d9dca0e99f --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_3.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_3_H +#define POKEPLATINUM_STRUCT_0207825C_3_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle3 { + PokemonDataBlockA dataBlockA; + PokemonDataBlockC dataBlockC; + PokemonDataBlockD dataBlockD; + PokemonDataBlockB dataBlockB; +} PokemonDataBlockShuffle3; + +#endif // POKEPLATINUM_STRUCT_0207825C_3_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_4.h b/include/struct_defs/pokemon_data_block_shuffle_4.h new file mode 100644 index 0000000000..1dc4ee8cb5 --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_4.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_4_H +#define POKEPLATINUM_STRUCT_0207825C_4_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle4 { + PokemonDataBlockA dataBlockA; + PokemonDataBlockD dataBlockD; + PokemonDataBlockB dataBlockB; + PokemonDataBlockC dataBlockC; +} PokemonDataBlockShuffle4; + +#endif // POKEPLATINUM_STRUCT_0207825C_4_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_5.h b/include/struct_defs/pokemon_data_block_shuffle_5.h new file mode 100644 index 0000000000..7f2905a6fc --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_5.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_5_H +#define POKEPLATINUM_STRUCT_0207825C_5_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle5 { + PokemonDataBlockA dataBlockA; + PokemonDataBlockD dataBlockD; + PokemonDataBlockC dataBlockC; + PokemonDataBlockB dataBlockB; +} PokemonDataBlockShuffle5; + +#endif // POKEPLATINUM_STRUCT_0207825C_5_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_6.h b/include/struct_defs/pokemon_data_block_shuffle_6.h new file mode 100644 index 0000000000..ca94f709b5 --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_6.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_6_H +#define POKEPLATINUM_STRUCT_0207825C_6_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle6 { + PokemonDataBlockB dataBlockB; + PokemonDataBlockA dataBlockA; + PokemonDataBlockC dataBlockC; + PokemonDataBlockD dataBlockD; +} PokemonDataBlockShuffle6; + +#endif // POKEPLATINUM_STRUCT_0207825C_6_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_7.h b/include/struct_defs/pokemon_data_block_shuffle_7.h new file mode 100644 index 0000000000..7a671a6354 --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_7.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_7_H +#define POKEPLATINUM_STRUCT_0207825C_7_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle7 { + PokemonDataBlockB dataBlockB; + PokemonDataBlockA dataBlockA; + PokemonDataBlockD dataBlockD; + PokemonDataBlockC dataBlockC; +} PokemonDataBlockShuffle7; + +#endif // POKEPLATINUM_STRUCT_0207825C_7_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_8.h b/include/struct_defs/pokemon_data_block_shuffle_8.h new file mode 100644 index 0000000000..381edca876 --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_8.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_8_H +#define POKEPLATINUM_STRUCT_0207825C_8_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle8 { + PokemonDataBlockB dataBlockB; + PokemonDataBlockC dataBlockC; + PokemonDataBlockA dataBlockA; + PokemonDataBlockD dataBlockD; +} PokemonDataBlockShuffle8; + +#endif // POKEPLATINUM_STRUCT_0207825C_8_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_9.h b/include/struct_defs/pokemon_data_block_shuffle_9.h new file mode 100644 index 0000000000..66c0074567 --- /dev/null +++ b/include/struct_defs/pokemon_data_block_shuffle_9.h @@ -0,0 +1,16 @@ +#ifndef POKEPLATINUM_STRUCT_0207825C_9_H +#define POKEPLATINUM_STRUCT_0207825C_9_H + +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" + +typedef struct PokemonDataBlockShuffle9 { + PokemonDataBlockB dataBlockB; + PokemonDataBlockC dataBlockC; + PokemonDataBlockD dataBlockD; + PokemonDataBlockA dataBlockA; +} PokemonDataBlockShuffle9; + +#endif // POKEPLATINUM_STRUCT_0207825C_9_H diff --git a/include/struct_defs/pokemon_evolution_data.h b/include/struct_defs/pokemon_evolution_data.h new file mode 100644 index 0000000000..9c901757dd --- /dev/null +++ b/include/struct_defs/pokemon_evolution_data.h @@ -0,0 +1,10 @@ +#ifndef POKEPLATINUM_STRUCT_0207821C_H +#define POKEPLATINUM_STRUCT_0207821C_H + +#include "struct_defs/pokemon_evolution_method.h" + +typedef struct PokemonEvolutionData { + PokemonEvolutionMethod methods[7]; +} PokemonEvolutionData; + +#endif // POKEPLATINUM_STRUCT_0207821C_H diff --git a/include/struct_defs/struct_0207821C_sub1.h b/include/struct_defs/pokemon_evolution_method.h similarity index 53% rename from include/struct_defs/struct_0207821C_sub1.h rename to include/struct_defs/pokemon_evolution_method.h index 0667b23b59..34eb93d652 100644 --- a/include/struct_defs/struct_0207821C_sub1.h +++ b/include/struct_defs/pokemon_evolution_method.h @@ -1,10 +1,10 @@ #ifndef POKEPLATINUM_STRUCT_0207821C_SUB1_H #define POKEPLATINUM_STRUCT_0207821C_SUB1_H -typedef struct UnkStruct_0207821C_sub1_t { - u16 unk_00; - u16 unk_02; - u16 unk_04; -} UnkStruct_0207821C_sub1; +typedef struct PokemonEvolutionMethod { + u16 type; + u16 param; + u16 targetSpecies; +} PokemonEvolutionMethod; #endif // POKEPLATINUM_STRUCT_0207821C_SUB1_H diff --git a/include/struct_defs/pokemon_personal_data.h b/include/struct_defs/pokemon_personal_data.h new file mode 100644 index 0000000000..e46b09c13d --- /dev/null +++ b/include/struct_defs/pokemon_personal_data.h @@ -0,0 +1,44 @@ +#ifndef POKEPLATINUM_STRUCT_02075874_H +#define POKEPLATINUM_STRUCT_02075874_H + +/** + * @brief Pokemon Personal data structure. This contains data that is the same across all pokemon of the same species/form + */ +typedef struct PokemonPersonalData { + u8 baseHp; //!< The pokemons base HP stat + u8 baseAtk; //!< The pokemons base Attack stat + u8 baseDef; //!< The pokemons base Defense stat + u8 baseSpeed; //!< The pokemons base Speed stat + u8 baseSpAtk; //!< The pokemons base Special Attack stat + u8 baseSpDef; //!< The pokemons base Special Defense stat + u8 type1; //!< The pokemons first type + u8 type2; //!< The pokemons second type + u8 catchRate; //!< The pokemons catch rate + u8 baseExp; //!< A factor in determining experience yield when defeating this pokemon + u16 evHpYield : 2; //!< How many HP EVs will be gained when defeating this pokemon + u16 evAtkYield : 2; //!< How many Attack EVs will be gained when defeating this pokemon + u16 evDefYield : 2; //!< How many Defense EVs will be gained when defeating this pokemon + u16 evSpeedYield : 2; //!< How many Speed EVs will be gained when defeating this pokemon + u16 evSpAtkYield : 2; //!< How many Special Attack EVs will be gained when defeating this pokemon + u16 evSpDefYield : 2; //!< How many Special Defense EVs will be gained when defeating this pokemon + u16 padding : 4; + u16 item1; //!< Common held item when this pokemon is encountered in the wild + u16 item2; //!< Rare held item when this pokemon is encountered in the wild + u8 gender; //!< The pokemons gender ratio, except for special values, a higher value will result in more females and a lower value will result in more males appearing + u8 hatchCycles; //!< How long eggs of this pokemon will take to hatch. In Gen.IV One cycle is 255 steps + u8 baseFriendship; //!< The pokemons base Friendship stat + u8 expRate; //!< The experience rate category of the pokemon. This sets which formula is used to determine the pokemons level based on its experience + u8 eggGroup1; //!< The pokemons first egg group + u8 eggGroup2; //!< The pokemons second egg group + u8 ability1; //!< The pokemons first possible ability + u8 ability2; //!< The pokemons second possible ability + u8 greatMarshFleeRate; //!< The pokemons base flee rate in the Great Marsh safari zone + u8 color : 7; //!< The pokemons color category + u8 inverse : 1; + u32 unk_1C; + u32 unk_20; + u32 unk_24; + u32 unk_28; +} PokemonPersonalData; + +#endif // POKEPLATINUM_STRUCT_02075874_H diff --git a/include/struct_defs/pokemon_substruct_0.h b/include/struct_defs/pokemon_substruct_0.h deleted file mode 100644 index ec2cf75f23..0000000000 --- a/include/struct_defs/pokemon_substruct_0.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef POKEPLATINUM_POKEMON_SUBSTRUCT_0_H -#define POKEPLATINUM_POKEMON_SUBSTRUCT_0_H - -typedef struct PokemonSubstruct0_t { - u16 species; - u16 item; - u32 unk_04; - u32 unk_08; - u8 friendship; - u8 unk_0D; - u8 unk_0E; - u8 unk_0F; - u8 unk_10; - u8 unk_11; - u8 unk_12; - u8 unk_13; - u8 unk_14; - u8 unk_15; - u8 unk_16; - u8 unk_17; - u8 unk_18; - u8 unk_19; - u8 unk_1A; - u8 unk_1B; - u32 unk_1C; -} PokemonSubstruct0; - -#endif // POKEPLATINUM_POKEMON_SUBSTRUCT_0_H diff --git a/include/struct_defs/pokemon_substruct_1.h b/include/struct_defs/pokemon_substruct_1.h deleted file mode 100644 index fc44f07dbe..0000000000 --- a/include/struct_defs/pokemon_substruct_1.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef POKEPLATINUM_POKEMON_SUBSTRUCT_1_H -#define POKEPLATINUM_POKEMON_SUBSTRUCT_1_H - -typedef struct PokemonSubstruct1_t { - u16 unk_00[4]; - u8 unk_08[4]; - u8 unk_0C[4]; - u32 unk_10_0 : 5; - u32 unk_10_5 : 5; - u32 unk_10_10 : 5; - u32 unk_10_15 : 5; - u32 unk_10_20 : 5; - u32 unk_10_25 : 5; - u32 unk_10_30 : 1; - u32 unk_10_31 : 1; - u32 unk_14; - u8 fatefulEncounter:1; - u8 unk_18_1 : 2; - u8 form:5; - u8 unk_19; - u16 unk_1A; - u16 unk_1C; - u16 unk_1E; -} PokemonSubstruct1; - -#endif // POKEPLATINUM_POKEMON_SUBSTRUCT_1_H diff --git a/include/struct_defs/pokemon_substruct_3.h b/include/struct_defs/pokemon_substruct_3.h deleted file mode 100644 index 726c0cba09..0000000000 --- a/include/struct_defs/pokemon_substruct_3.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef POKEPLATINUM_POKEMON_SUBSTRUCT_3_H -#define POKEPLATINUM_POKEMON_SUBSTRUCT_3_H - -typedef struct PokemonSubstruct3_t { - u16 unk_00[8]; - u8 unk_10; - u8 unk_11; - u8 unk_12; - u8 unk_13; - u8 unk_14; - u8 unk_15; - u16 unk_16; - u16 unk_18; - u8 unk_1A; - u8 unk_1B; - u8 unk_1C_0 : 7; - u8 unk_1C_7 : 1; - u8 unk_1D; - u16 unk_1E; -} PokemonSubstruct3; - -#endif // POKEPLATINUM_POKEMON_SUBSTRUCT_3_H diff --git a/include/struct_defs/struct_02075874.h b/include/struct_defs/struct_02075874.h deleted file mode 100644 index 1483a45efb..0000000000 --- a/include/struct_defs/struct_02075874.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_02075874_H -#define POKEPLATINUM_STRUCT_02075874_H - -typedef struct UnkStruct_02075874_t { - u8 unk_00; - u8 unk_01; - u8 unk_02; - u8 unk_03; - u8 unk_04; - u8 unk_05; - u8 unk_06; - u8 unk_07; - u8 unk_08; - u8 unk_09; - u16 unk_0A_0 : 2; - u16 unk_0A_2 : 2; - u16 unk_0A_4 : 2; - u16 unk_0A_6 : 2; - u16 unk_0A_8 : 2; - u16 unk_0A_10 : 2; - u16 unk_0A_12 : 4; - u16 unk_0C; - u16 unk_0E; - u8 unk_10; - u8 unk_11; - u8 unk_12; - u8 unk_13; - u8 unk_14; - u8 unk_15; - u8 unk_16; - u8 unk_17; - u8 unk_18; - u8 unk_19_0 : 7; - u8 unk_19_7 : 1; - u32 unk_1C; - u32 unk_20; - u32 unk_24; - u32 unk_28; -} UnkStruct_02075874; - -#endif // POKEPLATINUM_STRUCT_02075874_H diff --git a/include/struct_defs/struct_0207821C.h b/include/struct_defs/struct_0207821C.h deleted file mode 100644 index c2152ade38..0000000000 --- a/include/struct_defs/struct_0207821C.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207821C_H -#define POKEPLATINUM_STRUCT_0207821C_H - -#include "struct_defs/struct_0207821C_sub1.h" - -typedef struct UnkStruct_0207821C_t { - UnkStruct_0207821C_sub1 unk_00[7]; -} UnkStruct_0207821C; - -#endif // POKEPLATINUM_STRUCT_0207821C_H diff --git a/include/struct_defs/struct_0207825C.h b/include/struct_defs/struct_0207825C.h deleted file mode 100644 index 0706391a7c..0000000000 --- a/include/struct_defs/struct_0207825C.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_H -#define POKEPLATINUM_STRUCT_0207825C_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_t { - PokemonSubstruct0 unk_00; - PokemonSubstruct1 unk_20; - PokemonSubstruct2 unk_40; - PokemonSubstruct3 unk_60; -} UnkStruct_0207825C; - -#endif // POKEPLATINUM_STRUCT_0207825C_H diff --git a/include/struct_defs/struct_0207825C_1.h b/include/struct_defs/struct_0207825C_1.h deleted file mode 100644 index 4652ed3da2..0000000000 --- a/include/struct_defs/struct_0207825C_1.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_1_H -#define POKEPLATINUM_STRUCT_0207825C_1_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_1_t { - PokemonSubstruct0 unk_00; - PokemonSubstruct1 unk_20; - PokemonSubstruct3 unk_40; - PokemonSubstruct2 unk_60; -} UnkStruct_0207825C_1; - -#endif // POKEPLATINUM_STRUCT_0207825C_1_H diff --git a/include/struct_defs/struct_0207825C_10.h b/include/struct_defs/struct_0207825C_10.h deleted file mode 100644 index 923b95d896..0000000000 --- a/include/struct_defs/struct_0207825C_10.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_10_H -#define POKEPLATINUM_STRUCT_0207825C_10_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_10_t { - PokemonSubstruct1 unk_00; - PokemonSubstruct3 unk_20; - PokemonSubstruct0 unk_40; - PokemonSubstruct2 unk_60; -} UnkStruct_0207825C_10; - -#endif // POKEPLATINUM_STRUCT_0207825C_10_H diff --git a/include/struct_defs/struct_0207825C_11.h b/include/struct_defs/struct_0207825C_11.h deleted file mode 100644 index 98e1c25bdb..0000000000 --- a/include/struct_defs/struct_0207825C_11.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_11_H -#define POKEPLATINUM_STRUCT_0207825C_11_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_11_t { - PokemonSubstruct1 unk_00; - PokemonSubstruct3 unk_20; - PokemonSubstruct2 unk_40; - PokemonSubstruct0 unk_60; -} UnkStruct_0207825C_11; - -#endif // POKEPLATINUM_STRUCT_0207825C_11_H diff --git a/include/struct_defs/struct_0207825C_12.h b/include/struct_defs/struct_0207825C_12.h deleted file mode 100644 index 623c3881b4..0000000000 --- a/include/struct_defs/struct_0207825C_12.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_12_H -#define POKEPLATINUM_STRUCT_0207825C_12_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_12_t { - PokemonSubstruct2 unk_00; - PokemonSubstruct0 unk_20; - PokemonSubstruct1 unk_40; - PokemonSubstruct3 unk_60; -} UnkStruct_0207825C_12; - -#endif // POKEPLATINUM_STRUCT_0207825C_12_H diff --git a/include/struct_defs/struct_0207825C_13.h b/include/struct_defs/struct_0207825C_13.h deleted file mode 100644 index 6409bb316b..0000000000 --- a/include/struct_defs/struct_0207825C_13.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_13_H -#define POKEPLATINUM_STRUCT_0207825C_13_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_13_t { - PokemonSubstruct2 unk_00; - PokemonSubstruct0 unk_20; - PokemonSubstruct3 unk_40; - PokemonSubstruct1 unk_60; -} UnkStruct_0207825C_13; - -#endif // POKEPLATINUM_STRUCT_0207825C_13_H diff --git a/include/struct_defs/struct_0207825C_14.h b/include/struct_defs/struct_0207825C_14.h deleted file mode 100644 index d869f5348b..0000000000 --- a/include/struct_defs/struct_0207825C_14.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_14_H -#define POKEPLATINUM_STRUCT_0207825C_14_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_14_t { - PokemonSubstruct2 unk_00; - PokemonSubstruct1 unk_20; - PokemonSubstruct0 unk_40; - PokemonSubstruct3 unk_60; -} UnkStruct_0207825C_14; - -#endif // POKEPLATINUM_STRUCT_0207825C_14_H diff --git a/include/struct_defs/struct_0207825C_15.h b/include/struct_defs/struct_0207825C_15.h deleted file mode 100644 index 019984e9e9..0000000000 --- a/include/struct_defs/struct_0207825C_15.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_15_H -#define POKEPLATINUM_STRUCT_0207825C_15_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_15_t { - PokemonSubstruct2 unk_00; - PokemonSubstruct1 unk_20; - PokemonSubstruct3 unk_40; - PokemonSubstruct0 unk_60; -} UnkStruct_0207825C_15; - -#endif // POKEPLATINUM_STRUCT_0207825C_15_H diff --git a/include/struct_defs/struct_0207825C_16.h b/include/struct_defs/struct_0207825C_16.h deleted file mode 100644 index 7909704194..0000000000 --- a/include/struct_defs/struct_0207825C_16.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_16_H -#define POKEPLATINUM_STRUCT_0207825C_16_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_16_t { - PokemonSubstruct2 unk_00; - PokemonSubstruct3 unk_20; - PokemonSubstruct0 unk_40; - PokemonSubstruct1 unk_60; -} UnkStruct_0207825C_16; - -#endif // POKEPLATINUM_STRUCT_0207825C_16_H diff --git a/include/struct_defs/struct_0207825C_17.h b/include/struct_defs/struct_0207825C_17.h deleted file mode 100644 index 56aa5df332..0000000000 --- a/include/struct_defs/struct_0207825C_17.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_17_H -#define POKEPLATINUM_STRUCT_0207825C_17_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_17_t { - PokemonSubstruct2 unk_00; - PokemonSubstruct3 unk_20; - PokemonSubstruct1 unk_40; - PokemonSubstruct0 unk_60; -} UnkStruct_0207825C_17; - -#endif // POKEPLATINUM_STRUCT_0207825C_17_H diff --git a/include/struct_defs/struct_0207825C_18.h b/include/struct_defs/struct_0207825C_18.h deleted file mode 100644 index 0f25713c27..0000000000 --- a/include/struct_defs/struct_0207825C_18.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_18_H -#define POKEPLATINUM_STRUCT_0207825C_18_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_18_t { - PokemonSubstruct3 unk_00; - PokemonSubstruct0 unk_20; - PokemonSubstruct1 unk_40; - PokemonSubstruct2 unk_60; -} UnkStruct_0207825C_18; - -#endif // POKEPLATINUM_STRUCT_0207825C_18_H diff --git a/include/struct_defs/struct_0207825C_19.h b/include/struct_defs/struct_0207825C_19.h deleted file mode 100644 index 934782fcbc..0000000000 --- a/include/struct_defs/struct_0207825C_19.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_19_H -#define POKEPLATINUM_STRUCT_0207825C_19_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_19_t { - PokemonSubstruct3 unk_00; - PokemonSubstruct0 unk_20; - PokemonSubstruct2 unk_40; - PokemonSubstruct1 unk_60; -} UnkStruct_0207825C_19; - -#endif // POKEPLATINUM_STRUCT_0207825C_19_H diff --git a/include/struct_defs/struct_0207825C_2.h b/include/struct_defs/struct_0207825C_2.h deleted file mode 100644 index 838613f005..0000000000 --- a/include/struct_defs/struct_0207825C_2.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_2_H -#define POKEPLATINUM_STRUCT_0207825C_2_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_2_t { - PokemonSubstruct0 unk_00; - PokemonSubstruct2 unk_20; - PokemonSubstruct1 unk_40; - PokemonSubstruct3 unk_60; -} UnkStruct_0207825C_2; - -#endif // POKEPLATINUM_STRUCT_0207825C_2_H diff --git a/include/struct_defs/struct_0207825C_20.h b/include/struct_defs/struct_0207825C_20.h deleted file mode 100644 index 2af3a3223e..0000000000 --- a/include/struct_defs/struct_0207825C_20.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_20_H -#define POKEPLATINUM_STRUCT_0207825C_20_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_20_t { - PokemonSubstruct3 unk_00; - PokemonSubstruct1 unk_20; - PokemonSubstruct0 unk_40; - PokemonSubstruct2 unk_60; -} UnkStruct_0207825C_20; - -#endif // POKEPLATINUM_STRUCT_0207825C_20_H diff --git a/include/struct_defs/struct_0207825C_21.h b/include/struct_defs/struct_0207825C_21.h deleted file mode 100644 index 51de00b106..0000000000 --- a/include/struct_defs/struct_0207825C_21.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_21_H -#define POKEPLATINUM_STRUCT_0207825C_21_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_21_t { - PokemonSubstruct3 unk_00; - PokemonSubstruct1 unk_20; - PokemonSubstruct2 unk_40; - PokemonSubstruct0 unk_60; -} UnkStruct_0207825C_21; - -#endif // POKEPLATINUM_STRUCT_0207825C_21_H diff --git a/include/struct_defs/struct_0207825C_22.h b/include/struct_defs/struct_0207825C_22.h deleted file mode 100644 index 2a5816fbd0..0000000000 --- a/include/struct_defs/struct_0207825C_22.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_22_H -#define POKEPLATINUM_STRUCT_0207825C_22_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_22_t { - PokemonSubstruct3 unk_00; - PokemonSubstruct2 unk_20; - PokemonSubstruct0 unk_40; - PokemonSubstruct1 unk_60; -} UnkStruct_0207825C_22; - -#endif // POKEPLATINUM_STRUCT_0207825C_22_H diff --git a/include/struct_defs/struct_0207825C_23.h b/include/struct_defs/struct_0207825C_23.h deleted file mode 100644 index f6bba521dd..0000000000 --- a/include/struct_defs/struct_0207825C_23.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_23_H -#define POKEPLATINUM_STRUCT_0207825C_23_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_23_t { - PokemonSubstruct3 unk_00; - PokemonSubstruct2 unk_20; - PokemonSubstruct1 unk_40; - PokemonSubstruct0 unk_60; -} UnkStruct_0207825C_23; - -#endif // POKEPLATINUM_STRUCT_0207825C_23_H diff --git a/include/struct_defs/struct_0207825C_3.h b/include/struct_defs/struct_0207825C_3.h deleted file mode 100644 index f5dca58b52..0000000000 --- a/include/struct_defs/struct_0207825C_3.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_3_H -#define POKEPLATINUM_STRUCT_0207825C_3_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_3_t { - PokemonSubstruct0 unk_00; - PokemonSubstruct2 unk_20; - PokemonSubstruct3 unk_40; - PokemonSubstruct1 unk_60; -} UnkStruct_0207825C_3; - -#endif // POKEPLATINUM_STRUCT_0207825C_3_H diff --git a/include/struct_defs/struct_0207825C_4.h b/include/struct_defs/struct_0207825C_4.h deleted file mode 100644 index 038516c437..0000000000 --- a/include/struct_defs/struct_0207825C_4.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_4_H -#define POKEPLATINUM_STRUCT_0207825C_4_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_4_t { - PokemonSubstruct0 unk_00; - PokemonSubstruct3 unk_20; - PokemonSubstruct1 unk_40; - PokemonSubstruct2 unk_60; -} UnkStruct_0207825C_4; - -#endif // POKEPLATINUM_STRUCT_0207825C_4_H diff --git a/include/struct_defs/struct_0207825C_5.h b/include/struct_defs/struct_0207825C_5.h deleted file mode 100644 index 505d4ce7ac..0000000000 --- a/include/struct_defs/struct_0207825C_5.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_5_H -#define POKEPLATINUM_STRUCT_0207825C_5_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_5_t { - PokemonSubstruct0 unk_00; - PokemonSubstruct3 unk_20; - PokemonSubstruct2 unk_40; - PokemonSubstruct1 unk_60; -} UnkStruct_0207825C_5; - -#endif // POKEPLATINUM_STRUCT_0207825C_5_H diff --git a/include/struct_defs/struct_0207825C_6.h b/include/struct_defs/struct_0207825C_6.h deleted file mode 100644 index 8ee784725c..0000000000 --- a/include/struct_defs/struct_0207825C_6.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_6_H -#define POKEPLATINUM_STRUCT_0207825C_6_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_6_t { - PokemonSubstruct1 unk_00; - PokemonSubstruct0 unk_20; - PokemonSubstruct2 unk_40; - PokemonSubstruct3 unk_60; -} UnkStruct_0207825C_6; - -#endif // POKEPLATINUM_STRUCT_0207825C_6_H diff --git a/include/struct_defs/struct_0207825C_7.h b/include/struct_defs/struct_0207825C_7.h deleted file mode 100644 index 5367910557..0000000000 --- a/include/struct_defs/struct_0207825C_7.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_7_H -#define POKEPLATINUM_STRUCT_0207825C_7_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_7_t { - PokemonSubstruct1 unk_00; - PokemonSubstruct0 unk_20; - PokemonSubstruct3 unk_40; - PokemonSubstruct2 unk_60; -} UnkStruct_0207825C_7; - -#endif // POKEPLATINUM_STRUCT_0207825C_7_H diff --git a/include/struct_defs/struct_0207825C_8.h b/include/struct_defs/struct_0207825C_8.h deleted file mode 100644 index 5c50dbeef7..0000000000 --- a/include/struct_defs/struct_0207825C_8.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_8_H -#define POKEPLATINUM_STRUCT_0207825C_8_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_8_t { - PokemonSubstruct1 unk_00; - PokemonSubstruct2 unk_20; - PokemonSubstruct0 unk_40; - PokemonSubstruct3 unk_60; -} UnkStruct_0207825C_8; - -#endif // POKEPLATINUM_STRUCT_0207825C_8_H diff --git a/include/struct_defs/struct_0207825C_9.h b/include/struct_defs/struct_0207825C_9.h deleted file mode 100644 index f178803410..0000000000 --- a/include/struct_defs/struct_0207825C_9.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_9_H -#define POKEPLATINUM_STRUCT_0207825C_9_H - -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" - -typedef struct UnkStruct_0207825C_9_t { - PokemonSubstruct1 unk_00; - PokemonSubstruct2 unk_20; - PokemonSubstruct3 unk_40; - PokemonSubstruct0 unk_60; -} UnkStruct_0207825C_9; - -#endif // POKEPLATINUM_STRUCT_0207825C_9_H diff --git a/include/struct_defs/struct_02078B40.h b/include/struct_defs/struct_02078B40.h index 590adea3f9..d9993eb4a6 100644 --- a/include/struct_defs/struct_02078B40.h +++ b/include/struct_defs/struct_02078B40.h @@ -2,43 +2,43 @@ #define POKEPLATINUM_STRUCT_02078B40_H typedef struct UnkStruct_02078B40_t { - u32 unk_00; - u16 unk_04_0 : 1; - u16 unk_04_1 : 1; - u16 unk_04_2 : 1; + u32 personality; + u16 partyDecrypted : 1; + u16 boxDecrypted : 1; + u16 invalidData : 1; u16 : 13; - u16 unk_06; - u16 unk_08; - u32 unk_0C; - u32 unk_10; - u8 unk_14; - u8 unk_15; - u8 unk_16; - u8 unk_17; - u8 unk_18; - u8 unk_19; - u8 unk_1A; - u8 unk_1B; + u16 species; + u16 heldItem; + u32 otID; + u32 exp; + u8 friendship; + u8 ability; + u8 hpEV; + u8 atkEV; + u8 defEV; + u8 speedEV; + u8 spAtkEV; + u8 spDefEV; u16 unk_1C[4]; u8 unk_24[4]; u8 unk_28[4]; - u32 unk_2C_0 : 5; - u32 unk_2C_5 : 5; - u32 unk_2C_10 : 5; - u32 unk_2C_15 : 5; - u32 unk_2C_20 : 5; - u32 unk_2C_25 : 5; - u32 unk_2C_30 : 1; + u32 hpIV : 5; + u32 atkIV : 5; + u32 defIV : 5; + u32 speedIV : 5; + u32 spAtkIV : 5; + u32 spDefIV : 5; + u32 isEgg : 1; u32 unk_2C_31 : 1; - u8 unk_30_0 : 1; - u8 unk_30_1 : 2; - u8 unk_30_3 : 5; + u8 fatefulEncounter : 1; + u8 gender : 2; + u8 form : 5; u16 unk_32[11]; u16 unk_48[8]; - u8 unk_58; - u8 unk_59; + u8 pokeball; + u8 originLanguage; u32 unk_5C; - u8 unk_60; + u8 level; u8 unk_61; u16 unk_62; u16 unk_64; diff --git a/include/unk_0201D15C.h b/include/unk_0201D15C.h index 5e33ebd019..a380e2c3ca 100644 --- a/include/unk_0201D15C.h +++ b/include/unk_0201D15C.h @@ -22,8 +22,8 @@ void sub_0201D470(MtxFx22 * param0, u16 param1, fx32 param2, fx32 param3, u8 par s32 sub_0201D4CC(s32 param0, s32 param1, s32 param2, s32 param3, u32 param4); s32 sub_0201D580(u16 param0, s32 param1); u32 sub_0201D5B8(const void * param0, u32 param1); -void sub_0201D5D4(void * param0, u32 param1, u32 param2); -void sub_0201D600(void * param0, u32 param1, u32 param2); +void EncryptData(void * data, u32 bytes, u32 seed); +void DecryptData(void * data, u32 bytes, u32 seed); u16 sub_0201D628(const void * param0, u32 param1); void sub_0201D640(int param0); diff --git a/include/unk_02073C2C.h b/include/unk_02073C2C.h deleted file mode 100644 index 3212350b37..0000000000 --- a/include/unk_02073C2C.h +++ /dev/null @@ -1,173 +0,0 @@ -#ifndef POKEPLATINUM_UNK_02073C2C_H -#define POKEPLATINUM_UNK_02073C2C_H - -#include "struct_decls/struct_02002F38_decl.h" -#include "struct_decls/struct_02006C24_decl.h" -#include "struct_defs/struct_02007C10.h" -#include "struct_decls/struct_02007C7C_decl.h" -#include "struct_defs/struct_02008A90.h" -#include "struct_decls/struct_0200C6E4_decl.h" -#include "struct_decls/struct_0200C704_decl.h" -#include "struct_decls/struct_0200D0F4_decl.h" -#include "struct_decls/struct_02015F84_decl.h" -#include "struct_decls/struct_02025E6C_decl.h" -#include "struct_decls/struct_0202CC84_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" -#include "struct_decls/struct_02075874_decl.h" -#include "struct_decls/struct_02078B40_decl.h" -#include "struct_decls/struct_party_decl.h" -#include "overlay005/struct_ov5_021DE5D0.h" - -#include - -void ZeroMonData(Pokemon * param0); -void ZeroBoxMonData(BoxPokemon * param0); -int PokemonStructSize(void); -Pokemon * AllocMonZeroed(u32 heapID); -BOOL sub_02073C88(Pokemon * param0); -BOOL sub_02073CD4(Pokemon * param0, BOOL param1); -BOOL sub_02073D20(BoxPokemon * param0); -BOOL sub_02073D48(BoxPokemon * param0, BOOL param1); -void sub_02073D80(Pokemon * param0, int param1, int param2, int param3, int param4, u32 param5, int param6, u32 param7); -void sub_02073E18(BoxPokemon * param0, int param1, int param2, int param3, int param4, u32 param5, int param6, u32 param7); -void sub_02074044(Pokemon * param0, u16 param1, u8 param2, u8 param3, u8 param4); -void sub_02074088(Pokemon * param0, u16 param1, u8 param2, u8 param3, u8 param4, u8 param5, u8 param6); -u32 sub_02074128(u16 param0, u8 param1, u8 param2); -void sub_02074158(Pokemon * param0, u16 param1, u8 param2, u32 param3, u32 param4); -void sub_0207418C(Pokemon * param0); -void sub_020741B8(Pokemon * param0); -u32 GetMonData(Pokemon * param0, int param1, void * param2); -u32 sub_02074570(BoxPokemon * param0, int param1, void * param2); -void sub_02074B30(Pokemon * param0, int param1, const void * param2); -void SetBoxMonData(BoxPokemon * param0, int param1, const void * param2); -void sub_0207536C(Pokemon * param0, int param1, int param2); -UnkStruct_02075874 * sub_02075874(int param0, int param1, int param2); -UnkStruct_02075874 * sub_02075894(int param0, int param1); -u32 sub_020758B0(UnkStruct_02075874 * param0, int param1); -void sub_020759B8(UnkStruct_02075874 * param0); -u32 sub_020759CC(int param0, int param1, int param2); -u32 sub_020759F0(int param0, int param1); -u8 sub_02075A10(Pokemon * param0); -u32 sub_02075A70(Pokemon * param0); -u32 sub_02075A78(BoxPokemon * param0); -u32 sub_02075AAC(Pokemon * param0); -u32 sub_02075AD0(int param0, int param1); -u32 sub_02075B38(Pokemon * param0); -u32 sub_02075B40(BoxPokemon * param0); -u32 sub_02075B78(u16 param0, u32 param1); -u32 sub_02075B9C(UnkStruct_02075874 * param0, u16 param1, u32 param2); -u8 sub_02075BCC(Pokemon * param0); -u8 sub_02075BD4(BoxPokemon * param0); -u8 GetNatureFromPersonality(u32 param0); -s8 sub_02075C60(u8 param0, u8 param1); -void sub_02075C74(Pokemon * param0, u8 param1, u16 param2); -u8 sub_02075D6C(Pokemon * param0); -u8 sub_02075D74(BoxPokemon * param0); -u8 sub_02075DAC(u16 param0, u32 param1); -u8 sub_02075DD0(UnkStruct_02075874 * param0, u16 param1, u32 param2); -u8 sub_02075E0C(Pokemon * param0); -u8 sub_02075E14(BoxPokemon * param0); -u8 sub_02075E38(u32 param0, u32 param1); -u32 sub_02075E64(u32 param0); -void sub_02075EF4(UnkStruct_02008A90 * param0, Pokemon * param1, u8 param2); -void sub_02075F00(UnkStruct_02008A90 * param0, Pokemon * param1, u8 param2); -void sub_02075F0C(UnkStruct_02008A90 * param0, BoxPokemon * param1, u8 param2, int param3); -void sub_02075FB4(UnkStruct_02008A90 * param0, u16 param1, u8 param2, u8 param3, u8 param4, u8 param5, u32 param6); -u8 SanitizeFormId(u16 param0, u8 param1); -u8 sub_020765AC(Pokemon * param0, u8 param1); -u8 sub_020765B8(Pokemon * param0, u8 param1); -u8 sub_020765C4(BoxPokemon * param0, u8 param1, int param2); -u8 sub_02076648(u16 param0, u8 param1, u8 param2, u8 param3, u32 param4); -void sub_0207697C(UnkStruct_02008A90 * param0, u16 param1); -UnkStruct_0200D0F4 * sub_02076994(UnkStruct_0200C6E4 * param0, UnkStruct_0200C704 * param1, UnkStruct_02002F38 * param2, int param3, int param4, int param5, int param6, int param7, int param8); -void sub_02076AAC(int param0, int param1, UnkStruct_ov5_021DE5D0 * param2); -u32 sub_02076AF0(void); -u32 sub_02076AF4(void); -u8 sub_02076AF8(Pokemon * param0); -u8 sub_02076B00(BoxPokemon * param0); -BoxPokemon * sub_02076B10(Pokemon * param0); -u8 sub_02076B14(Pokemon * param0); -u16 sub_02076B94(Party * param0, Pokemon * param1, u8 param2, u16 param3, int * param4); -u16 sub_02076F84(const u16 param0); -u16 sub_02076FD4(const u16 param0); -void sub_02077020(BoxPokemon * param0); -u16 sub_020770C4(Pokemon * param0, u16 param1); -u16 sub_020770D4(BoxPokemon * param0, u16 param1); -void sub_02077134(Pokemon * param0, u16 param1); -void sub_02077144(BoxPokemon * param0, u16 param1); -void sub_020771F8(Pokemon * param0, u16 param1, u8 param2); -void sub_02077230(Pokemon * param0, u16 param1, u8 param2); -void sub_02077238(BoxPokemon * param0, u16 param1, u8 param2); -u16 sub_0207727C(Pokemon * param0, int * param1, u16 * param2); -void sub_02077344(Pokemon * param0, int param1, int param2); -void sub_0207734C(BoxPokemon * param0, int param1, int param2); -void sub_02077408(Pokemon * param0, u32 param1); -BOOL sub_0207749C(Pokemon * param0, u16 param1); -void sub_020774C8(BoxPokemon * param0, Pokemon * param1); -u8 sub_02077550(Party * param0); -u16 sub_020775A4(u16 param0); -u16 sub_020775C4(u16 param0); -void sub_020775EC(Pokemon * param0, Pokemon * param1); -void sub_02077604(BoxPokemon * param0, BoxPokemon * param1); -void sub_02077618(Pokemon * param0, BoxPokemon * param1); -s8 sub_0207762C(Pokemon * param0, int param1); -s8 sub_02077634(BoxPokemon * param0, int param1); -s8 sub_02077648(u32 param0, int param1); -int sub_02077660(int param0, int param1, u16 * param2); -void sub_020776B0(Party * param0); -u8 sub_02077758(Party * param0, u8 param1); -void sub_020777B4(Party * param0, s32 param1); -void sub_0207782C(Party * param0); -BOOL sub_020778D8(Pokemon * param0); -BOOL sub_020778E0(BoxPokemon * param0); -BOOL sub_020778F8(Pokemon * param0); -BOOL sub_02077900(BoxPokemon * param0); -void sub_02077928(Pokemon * param0); -void sub_02077930(BoxPokemon * param0); -u8 sub_02077988(u16 param0); -int sub_02077A00(Pokemon * param0); -int sub_02077A1C(BoxPokemon * param0); -void sub_02077A64(Pokemon * param0); -void sub_02077A9C(Party * param0, int param1); -void SetShayminForm(Pokemon * param0, int param1); -void SetBoxShayminForm(BoxPokemon * param0, int param1); -BOOL sub_02077B14(Pokemon * param0); -void sub_02077B8C(Party * param0); -BOOL sub_02077BD8(Party * param0, int param1, const RTCTime * param2); -BOOL SetRotomForm(Pokemon * param0, int param1, int param2); -void sub_02077D28(int param0, int param1, u16 * param2); -void sub_02077D3C(UnkStruct_0202CC84 * param0, int param1, u16 param2, int param3, int param4, int param5, int param6, int param7); -void sub_02077DB4(UnkStruct_0202CC84 * param0, int param1, u16 param2, int param3, int param4, int param5, int param6, int param7, u8 param8); -BOOL sub_02077E3C(Pokemon * param0); -void sub_02077E64(Pokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5); -void sub_02077EA4(BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5); -void sub_02077EE4(Pokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5); -void sub_02077EF8(BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5); -void sub_02077F0C(Pokemon * param0, u32 param1, int param2); -BOOL sub_02077FB4(Pokemon * param0, u8 param1); -BOOL sub_02077FBC(BoxPokemon * param0, u8 param1); -BOOL sub_02077FE4(u16 param0, int param1, u8 param2); -void sub_0207803C(Pokemon * param0); -void sub_02078044(BoxPokemon * param0); -void sub_020780C4(Pokemon * param0, u32 param1); -u32 FlagIndex(int flag); -int sub_020787EC(u32 param0); -BOOL sub_02078804(u16 param0); -u16 sub_02078824(u8 param0); -BOOL sub_02078838(Pokemon * param0); -BOOL sub_0207884C(BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2); -int sub_020788D0(int param0); -void sub_0207893C(Pokemon * param0); -void sub_0207896C(BoxPokemon * param0); -void sub_020789BC(NARC * param0, UnkStruct_02007C10 * param1, u16 param2, u16 param3); -void sub_020789F4(NARC * param0, UnkStruct_02015F84 * param1, UnkStruct_02007C7C * param2, u16 param3, int param4, int param5, int param6); -void sub_02078A4C(NARC * param0, u8 * param1, u16 param2, u16 param3); -void sub_02078A80(NARC * param0, s8 * param1, u16 param2); -void sub_02078AA4(NARC * param0, s8 * param1, u16 param2); -void sub_02078AC8(NARC * param0, u8 * param1, u16 param2); -BOOL sub_02078AEC(int param0, Pokemon * param1, int param2); -void sub_02078B40(Pokemon * param0, UnkStruct_02078B40 * param1); -void sub_02078E0C(UnkStruct_02078B40 * param0, Pokemon * param1); - -#endif // POKEPLATINUM_UNK_02073C2C_H diff --git a/platinum.us/main.lsf b/platinum.us/main.lsf index 50d95045a4..5e670a0cb6 100644 --- a/platinum.us/main.lsf +++ b/platinum.us/main.lsf @@ -287,7 +287,7 @@ Static main Object main.nef.p/src_unk_020722AC.c.o Object main.nef.p/src_unk_02073700.c.o Object main.nef.p/src_unk_02073838.c.o - Object main.nef.p/src_unk_02073C2C.c.o + Object main.nef.p/src_pokemon.c.o Object main.nef.p/src_move_table.c.o Object main.nef.p/src_unk_02079170.c.o Object main.nef.p/src_unk_020797C8.c.o diff --git a/src/enc_effects.c b/src/enc_effects.c index c01717fdb5..35250c19d1 100644 --- a/src/enc_effects.c +++ b/src/enc_effects.c @@ -14,7 +14,7 @@ #include "enc_effects.h" #include "unk_02054884.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay005/ov5_021DDBE8.h" // This needs to be moved to a constants file somewhere diff --git a/src/meson.build b/src/meson.build index 1c16cd03dc..0e2fd68d10 100644 --- a/src/meson.build +++ b/src/meson.build @@ -274,7 +274,7 @@ pokeplatinum_c = files( 'unk_020722AC.c', 'unk_02073700.c', 'unk_02073838.c', - 'unk_02073C2C.c', + 'pokemon.c', 'unk_02079170.c', 'unk_020797C8.c', 'unk_02079D40.c', diff --git a/src/overlay005/ov5_021D1C30.c b/src/overlay005/ov5_021D1C30.c index 7dde76e012..1626ad5c2f 100644 --- a/src/overlay005/ov5_021D1C30.c +++ b/src/overlay005/ov5_021D1C30.c @@ -55,7 +55,7 @@ #include "unk_0206A8DC.h" #include "unk_0206AFE0.h" #include "unk_02071B10.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay005/ov5_021D1C30.h" #include "overlay005/ov5_021DB888.h" diff --git a/src/overlay005/ov5_021DDBE8.c b/src/overlay005/ov5_021DDBE8.c index 1ecb0b16e5..9e3e6bf417 100644 --- a/src/overlay005/ov5_021DDBE8.c +++ b/src/overlay005/ov5_021DDBE8.c @@ -54,7 +54,7 @@ #include "unk_02020020.h" #include "unk_020218BC.h" #include "unk_02054884.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay005/ov5_021D0D80.h" #include "overlay005/ov5_021DDBE8.h" #include "overlay005/ov5_021E2338.h" @@ -1421,8 +1421,8 @@ u32 CutInEffects_ForBattle (const BattleParams * param0) v3 = Party_FirstBattler(param0->parties[0]); v4 = Party_FirstBattler(param0->parties[1]); - v5 = GetMonData(v3, MON_DATA_161, NULL); - v6 = GetMonData(v4, MON_DATA_161, NULL); + v5 = GetMonData(v3, MON_DATA_LEVEL, NULL); + v6 = GetMonData(v4, MON_DATA_LEVEL, NULL); v0 = v6 - v5; switch (param0->unk_12C) { diff --git a/src/overlay005/ov5_021E622C.c b/src/overlay005/ov5_021E622C.c index f36b048e28..09edcb330d 100644 --- a/src/overlay005/ov5_021E622C.c +++ b/src/overlay005/ov5_021E622C.c @@ -29,7 +29,7 @@ #include "unk_0202CC64.h" #include "unk_0202CD50.h" #include "unk_020559DC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "item.h" #include "unk_02092494.h" @@ -1987,7 +1987,7 @@ u8 ov5_021E6238 (UnkStruct_02026310 * param0) for (v1 = 0; v1 < 2; v1++) { v2 = sub_02026220(sub_02026218(param0, v1)); - if (sub_02074570(v2, MON_DATA_SPECIES, NULL) != 0) { + if (GetBoxMonData(v2, MON_DATA_SPECIES, NULL) != 0) { v0++; } } @@ -2005,7 +2005,7 @@ int ov5_021E6270 (UnkStruct_02026310 * param0) for (v0 = 0; v0 < 2; v0++) { v1 = sub_02026220(sub_02026218(param0, v0)); - if (sub_02074570(v1, MON_DATA_SPECIES, NULL) == 0) { + if (GetBoxMonData(v1, MON_DATA_SPECIES, NULL) == 0) { return v0; } } @@ -2015,7 +2015,7 @@ int ov5_021E6270 (UnkStruct_02026310 * param0) static int ov5_021E62B0 (BoxPokemon * param0) { - int v0 = sub_02074570(param0, MON_DATA_HELD_ITEM, NULL); + int v0 = GetBoxMonData(param0, MON_DATA_HELD_ITEM, NULL); return Item_IsMail(v0); } @@ -2032,7 +2032,7 @@ static void ov5_021E62C4 (Party * param0, int param1, UnkStruct_02026218 * param v2 = sub_02025EF0(v6); GetMonData(v1, MON_DATA_117, v3); - if (ov5_021E62B0(sub_02076B10(v1))) { + if (ov5_021E62B0(GetBoxMon(v1))) { GetMonData(v1, MON_DATA_170, sub_02026230(v4)); } @@ -2067,8 +2067,8 @@ static void ov5_021E638C (UnkStruct_02026310 * param0) v2 = sub_02026220(v0); v3 = sub_02026220(v1); - if (sub_02074570(v2, MON_DATA_SPECIES, NULL) == 0) { - if (sub_02074570(v3, MON_DATA_SPECIES, NULL) != 0) { + if (GetBoxMonData(v2, MON_DATA_SPECIES, NULL) == 0) { + if (GetBoxMonData(v3, MON_DATA_SPECIES, NULL) != 0) { sub_020262A8(v0, v1); sub_020262F4(v1); } @@ -2087,7 +2087,7 @@ static void ov5_021E63E0 (Pokemon * param0) while ((v4 = sub_0207727C(param0, &v1, &v3)) != 0) { if (v4 == 0xffff) { - sub_02077134(param0, v3); + ReplaceMonMove(param0, v3); } } } else { @@ -2095,7 +2095,7 @@ static void ov5_021E63E0 (Pokemon * param0) } } - sub_0207418C(param0); + CalculateMonLevelAndStats(param0); } static int ov5_021E6444 (Party * param0, UnkStruct_02026218 * param1, UnkStruct_0200B358 * param2) @@ -2107,18 +2107,18 @@ static int ov5_021E6444 (Party * param0, UnkStruct_02026218 * param1, UnkStruct_ u16 v4; sub_0200B5CC(param2, 0, v1); - v4 = sub_02074570(v1, MON_DATA_SPECIES, NULL); + v4 = GetBoxMonData(v1, MON_DATA_SPECIES, NULL); sub_020774C8(v1, v0); - if (GetMonData(v0, MON_DATA_161, NULL) != 100) { + if (GetMonData(v0, MON_DATA_LEVEL, NULL) != 100) { v3 = GetMonData(v0, MON_DATA_EXP, NULL); v3 += sub_02026228(param1); - sub_02074B30(v0, 8, (u8 *)&v3); + SetMonData(v0, 8, (u8 *)&v3); ov5_021E63E0(v0); } if (ov5_021E62B0(v1)) { - sub_02074B30(v0, 170, sub_02026230(v2)); + SetMonData(v0, 170, sub_02026230(v2)); } Party_AddPokemon(param0, v0); @@ -2143,17 +2143,17 @@ u16 ov5_021E64F8 (Party * param0, UnkStruct_0200B358 * param1, UnkStruct_0202631 int ov5_021E6520 (BoxPokemon * param0, u32 param1) { Pokemon * v0 = AllocMonZeroed(4); - BoxPokemon * v1 = sub_02076B10(v0); + BoxPokemon * v1 = GetBoxMon(v0); int v2; u32 v3; sub_02077604(param0, v1); - v3 = sub_02074570(v1, MON_DATA_EXP, NULL); + v3 = GetBoxMonData(v1, MON_DATA_EXP, NULL); v3 += param1; SetBoxMonData(v1, 8, (u8 *)&v3); - v2 = sub_02075B40(v1); + v2 = GetBoxMonLevel(v1); Heap_FreeToHeap(v0); return v2; @@ -2165,7 +2165,7 @@ int ov5_021E6568 (UnkStruct_02026218 * param0) BoxPokemon * v2; v2 = sub_02026220(param0); - v0 = sub_02075B40(v2); + v0 = GetBoxMonLevel(v2); v1 = ov5_021E6520(v2, sub_02026228(param0)); return v1 - v0; @@ -2224,7 +2224,7 @@ u8 ov5_021E6640 (UnkStruct_02026310 * param0, int param1, UnkStruct_0200B358 * p UnkStruct_02026218 * v0 = sub_02026218(param0, param1); BoxPokemon * v1 = sub_02026220(v0); - if (sub_02074570(v1, MON_DATA_SPECIES, NULL)) { + if (GetBoxMonData(v1, MON_DATA_SPECIES, NULL)) { return ov5_021E65B0(v0, param2); } @@ -2246,13 +2246,13 @@ static int ov5_021E6684 (UnkStruct_02026310 * param0) ov5_021E6668(param0, v4); for (v0 = 0; v0 < 2; v0++) { - if (sub_02075D74(v4[v0]) == 1) { + if (GetBoxMonGender(v4[v0]) == 1) { v2 = v0; } } for (v3 = 0, v0 = 0; v0 < 2; v0++) { - if ((v1[v0] = sub_02074570(v4[v0], MON_DATA_SPECIES, NULL)) == 132) { + if ((v1[v0] = GetBoxMonData(v4[v0], MON_DATA_SPECIES, NULL)) == 132) { v3++; v2 = v0; } @@ -2266,7 +2266,7 @@ static int ov5_021E6684 (UnkStruct_02026310 * param0) } } - if (sub_02074570(v4[v2], MON_DATA_HELD_ITEM, NULL) == 229) { + if (GetBoxMonData(v4[v2], MON_DATA_HELD_ITEM, NULL) == 229) { if (LCRNG_Next() >= (0xffff / 2)) { return -1; } @@ -2288,7 +2288,7 @@ void ov5_021E6720 (UnkStruct_02026310 * param0) } else { BoxPokemon * v5 = ov5_021E622C(param0, v2); - v0 = sub_02074570(v5, MON_DATA_PERSONALITY, NULL); + v0 = GetBoxMonData(v5, MON_DATA_PERSONALITY, NULL); v3 = GetNatureFromPersonality(v0); while (TRUE) { @@ -2349,28 +2349,28 @@ static void ov5_021E67B0 (Pokemon * param0, UnkStruct_02026310 * param1) switch (v0[v1]) { case 0: - v4 = sub_02074570(v5, MON_DATA_HP_IV, NULL); - sub_02074B30(param0, 70, (u8 *)&v4); + v4 = GetBoxMonData(v5, MON_DATA_HP_IV, NULL); + SetMonData(param0, 70, (u8 *)&v4); break; case 1: - v4 = sub_02074570(v5, MON_DATA_ATK_IV, NULL); - sub_02074B30(param0, 71, (u8 *)&v4); + v4 = GetBoxMonData(v5, MON_DATA_ATK_IV, NULL); + SetMonData(param0, 71, (u8 *)&v4); break; case 2: - v4 = sub_02074570(v5, MON_DATA_DEF_IV, NULL); - sub_02074B30(param0, 72, (u8 *)&v4); + v4 = GetBoxMonData(v5, MON_DATA_DEF_IV, NULL); + SetMonData(param0, 72, (u8 *)&v4); break; case 3: - v4 = sub_02074570(v5, MON_DATA_SPEED_IV, NULL); - sub_02074B30(param0, 73, (u8 *)&v4); + v4 = GetBoxMonData(v5, MON_DATA_SPEED_IV, NULL); + SetMonData(param0, 73, (u8 *)&v4); break; case 4: - v4 = sub_02074570(v5, MON_DATA_SPATK_IV, NULL); - sub_02074B30(param0, 74, (u8 *)&v4); + v4 = GetBoxMonData(v5, MON_DATA_SPATK_IV, NULL); + SetMonData(param0, 74, (u8 *)&v4); break; case 5: - v4 = sub_02074570(v5, MON_DATA_SPDEF_IV, NULL); - sub_02074B30(param0, 75, (u8 *)&v4); + v4 = GetBoxMonData(v5, MON_DATA_SPDEF_IV, NULL); + SetMonData(param0, 75, (u8 *)&v4); break; } } @@ -2414,11 +2414,11 @@ static void ov5_021E6948 (Pokemon * param0, BoxPokemon * param1, BoxPokemon * pa v3 = GetMonData(param0, MON_DATA_SPECIES, NULL); v6 = GetMonData(param0, MON_DATA_FORM, NULL); - v4 = sub_02077660(v3, v6, v7->unk_30); + v4 = GetMonLevelUpMoveIDs(v3, v6, v7->unk_30); for (v0 = 0; v0 < 4; v0++) { - v7->unk_00[v0] = sub_02074570(param1, 54 + v0, NULL); - v7->unk_20[v0] = sub_02074570(param2, 54 + v0, NULL); + v7->unk_00[v0] = GetBoxMonData(param1, 54 + v0, NULL); + v7->unk_20[v0] = GetBoxMonData(param2, 54 + v0, NULL); } v5 = ov5_021E68D8(param0, v7->unk_94); @@ -2427,8 +2427,8 @@ static void ov5_021E6948 (Pokemon * param0, BoxPokemon * param1, BoxPokemon * pa if (v7->unk_00[v0] != 0) { for (v1 = 0; v1 < v5; v1++) { if (v7->unk_00[v0] == v7->unk_94[v1]) { - if (sub_020770C4(param0, v7->unk_00[v0]) == 0xffff) { - sub_02077134(param0, v7->unk_00[v0]); + if (AddMonMove(param0, v7->unk_00[v0]) == 0xffff) { + ReplaceMonMove(param0, v7->unk_00[v0]); } break; } @@ -2443,8 +2443,8 @@ static void ov5_021E6948 (Pokemon * param0, BoxPokemon * param1, BoxPokemon * pa for (v1 = 0; v1 < 100; v1++) { if (v7->unk_00[v0] == Item_MoveForTMHM(328 + v1)) { if (sub_02077FE4(v3, v6, v1)) { - if (sub_020770C4(param0, v7->unk_00[v0]) == 0xffff) { - sub_02077134(param0, v7->unk_00[v0]); + if (AddMonMove(param0, v7->unk_00[v0]) == 0xffff) { + ReplaceMonMove(param0, v7->unk_00[v0]); } } } @@ -2472,8 +2472,8 @@ static void ov5_021E6948 (Pokemon * param0, BoxPokemon * param1, BoxPokemon * pa for (v1 = 0; v1 < v4; v1++) { if (v7->unk_30[v1] != 0) { if (v7->unk_10[v0] == v7->unk_30[v1]) { - if (sub_020770C4(param0, v7->unk_10[v0]) == 0xffff) { - sub_02077134(param0, v7->unk_10[v0]); + if (AddMonMove(param0, v7->unk_10[v0]) == 0xffff) { + ReplaceMonMove(param0, v7->unk_10[v0]); } break; } @@ -2520,8 +2520,8 @@ static u16 ov5_021E6B54 (u16 param0, UnkStruct_02026310 * param1) return param0; } - v0 = sub_02074570(v4[0], MON_DATA_HELD_ITEM, NULL); - v1 = sub_02074570(v4[1], MON_DATA_HELD_ITEM, NULL); + v0 = GetBoxMonData(v4[0], MON_DATA_HELD_ITEM, NULL); + v1 = GetBoxMonData(v4[1], MON_DATA_HELD_ITEM, NULL); if ((v0 != Unk_ov5_021F9F6C[v2][1]) && (v1 != Unk_ov5_021F9F6C[v2][1])) { param0 = Unk_ov5_021F9F6C[v2][2]; @@ -2537,12 +2537,12 @@ static void ov5_021E6BD0 (Pokemon * param0, UnkStruct_02026310 * param1) ov5_021E6668(param1, v2); - v0 = sub_02074570(v2[0], MON_DATA_HELD_ITEM, NULL); - v1 = sub_02074570(v2[1], MON_DATA_HELD_ITEM, NULL); + v0 = GetBoxMonData(v2[0], MON_DATA_HELD_ITEM, NULL); + v1 = GetBoxMonData(v2[1], MON_DATA_HELD_ITEM, NULL); if ((v0 == 236) || (v1 == 236)) { - if (sub_020770C4(param0, 344) == 0xffff) { - sub_02077134(param0, 344); + if (AddMonMove(param0, 344) == 0xffff) { + ReplaceMonMove(param0, 344); } } } @@ -2557,10 +2557,10 @@ static u16 ov5_021E6C20 (UnkStruct_02026310 * param0, u8 param1[]) v2 = 0; for (v1 = 0; v1 < 2; v1++) { - if ((v0[v1] = sub_02074570(v6[v1], MON_DATA_SPECIES, NULL)) == 132) { + if ((v0[v1] = GetBoxMonData(v6[v1], MON_DATA_SPECIES, NULL)) == 132) { param1[0] = v1 ^ 1; param1[1] = v1; - } else if (sub_02075D74(v6[v1]) == 1) { + } else if (GetBoxMonGender(v6[v1]) == 1) { param1[0] = v1; param1[1] = v1 ^ 1; } @@ -2589,7 +2589,7 @@ static u16 ov5_021E6C20 (UnkStruct_02026310 * param0, u8 param1[]) v4 = 489; } - if ((v0[param1[1]] == 132) && (sub_02075D74(v6[param1[0]]) != 1)) { + if ((v0[param1[1]] == 132) && (GetBoxMonGender(v6[param1[0]]) != 1)) { v5 = param1[1]; param1[1] = param1[0]; param1[0] = v5; @@ -2602,7 +2602,7 @@ void ov5_021E6CF0 (Pokemon * param0, u16 param1, u8 param2, UnkStruct_02025E6C * { u8 v0, v1, v2; u16 v3; - u8 v4 = sub_020759F0(param1, 19); + u8 v4 = GetMonSpeciesPersonalDataAttribute(param1, 19); Strbuf* v5; sub_02073D80(param0, param1, 1, 32, 0, 0, 0, 0); @@ -2610,19 +2610,19 @@ void ov5_021E6CF0 (Pokemon * param0, u16 param1, u8 param2, UnkStruct_02025E6C * v0 = 0; v3 = 4; - sub_02074B30(param0, 155, &v3); - sub_02074B30(param0, 9, &v4); - sub_02074B30(param0, 156, &v0); + SetMonData(param0, 155, &v3); + SetMonData(param0, 9, &v4); + SetMonData(param0, 156, &v0); if (param2) { - sub_02074B30(param0, 152, ¶m2); + SetMonData(param0, 152, ¶m2); } v2 = 1; - sub_02074B30(param0, 76, &v2); + SetMonData(param0, 76, &v2); v5 = sub_0200B32C(494, 4); - sub_02074B30(param0, 119, v5); + SetMonData(param0, 119, v5); Strbuf_Free(v5); if (param4 == 4) { @@ -2630,9 +2630,9 @@ void ov5_021E6CF0 (Pokemon * param0, u16 param1, u8 param2, UnkStruct_02025E6C * u32 v7 = sub_02025F30(param3); Strbuf* v8 = sub_02025F04(param3, 32); - sub_02074B30(param0, 145, v8); - sub_02074B30(param0, 7, &v6); - sub_02074B30(param0, 157, &v7); + SetMonData(param0, 145, v8); + SetMonData(param0, 7, &v6); + SetMonData(param0, 157, &v7); Strbuf_Free(v8); } @@ -2645,18 +2645,18 @@ void ov5_021E6DE8 (Pokemon * param0, u16 param1, UnkStruct_02026310 * param2, u3 u16 v1; u32 v2; Strbuf* v3; - u8 v4 = sub_020759F0(param1, 19); + u8 v4 = GetMonSpeciesPersonalDataAttribute(param1, 19); v2 = sub_02026248(param2); if (sub_02026280(param2)) { int v5; - if (sub_02075E38(param3, v2) == 0) { + if (GetMonPersonalityShininess(param3, v2) == 0) { for (v5 = 0; v5 < 4; v5++) { v2 = ARNG_Next(v2); - if (sub_02075E38(param3, v2)) { + if (GetMonPersonalityShininess(param3, v2)) { break; } } @@ -2670,14 +2670,14 @@ void ov5_021E6DE8 (Pokemon * param0, u16 param1, UnkStruct_02026310 * param2, u3 v0 = 0; v1 = 4; - sub_02074B30(param0, 155, &v1); - sub_02074B30(param0, 9, &v4); - sub_02074B30(param0, 156, &v0); - sub_02074B30(param0, 112, ¶m4); + SetMonData(param0, 155, &v1); + SetMonData(param0, 9, &v4); + SetMonData(param0, 156, &v0); + SetMonData(param0, 112, ¶m4); v3 = sub_0200B32C(494, 4); - sub_02074B30(param0, 119, v3); + SetMonData(param0, 119, v3); Strbuf_Free(v3); } @@ -2693,7 +2693,7 @@ void ov5_021E6EA8 (UnkStruct_02026310 * param0, Party * param1, UnkStruct_02025E { u32 v4 = sub_02025F20(param2); BoxPokemon * v5 = ov5_021E622C(param0, v1[0]); - u8 v6 = sub_02074570(v5, MON_DATA_FORM, NULL); + u8 v6 = GetBoxMonData(v5, MON_DATA_FORM, NULL); ov5_021E6DE8(v3, v0, param0, v4, v6); } @@ -2708,7 +2708,7 @@ void ov5_021E6EA8 (UnkStruct_02026310 * param0, Party * param1, UnkStruct_02025E } v2 = 1; - sub_02074B30(v3, 76, &v2); + SetMonData(v3, 76, &v2); Party_AddPokemon(param1, v3); ov5_021E6B40(param0); @@ -2725,7 +2725,7 @@ static int ov5_021E6F6C (Party * param0) for (v0 = 0; v0 < v2; v0++) { if (GetMonData(Party_GetPokemonBySlotIndex(param0, v0), MON_DATA_173, NULL) == 0) { - v1 = GetMonData(Party_GetPokemonBySlotIndex(param0, v0), MON_DATA_10, NULL); + v1 = GetMonData(Party_GetPokemonBySlotIndex(param0, v0), MON_DATA_ABILITY, NULL); if ((v1 == 40) || (v1 == 49)) { return 2; @@ -2757,12 +2757,12 @@ static u8 ov5_021E6FF0 (BoxPokemon ** param0) u32 v2[2], v3[2], v4, v5; for (v5 = 0; v5 < 2; v5++) { - v1[v5] = sub_02074570(param0[v5], MON_DATA_SPECIES, NULL); - v2[v5] = sub_02074570(param0[v5], MON_DATA_OT_ID, NULL); - v4 = sub_02074570(param0[v5], MON_DATA_PERSONALITY, NULL); - v3[v5] = sub_02075DAC(v1[v5], v4); - v0[v5][0] = sub_020759F0(v1[v5], 22); - v0[v5][1] = sub_020759F0(v1[v5], 23); + v1[v5] = GetBoxMonData(param0[v5], MON_DATA_SPECIES, NULL); + v2[v5] = GetBoxMonData(param0[v5], MON_DATA_OT_ID, NULL); + v4 = GetBoxMonData(param0[v5], MON_DATA_PERSONALITY, NULL); + v3[v5] = GetMonPersonalityGender(v1[v5], v4); + v0[v5][0] = GetMonSpeciesPersonalDataAttribute(v1[v5], 22); + v0[v5][1] = GetMonSpeciesPersonalDataAttribute(v1[v5], 23); } if ((v0[0][0] == 15) || (v0[1][0] == 15)) { @@ -2863,7 +2863,7 @@ BOOL ov5_021E7154 (UnkStruct_02026310 * param0, Party * param1, UnkStruct_0203CD v2 = 0; for (v0 = 0; v0 < 2; v0++) { - if (sub_02074570(v8[v0], MON_DATA_172, NULL) != 0) { + if (GetBoxMonData(v8[v0], MON_DATA_172, NULL) != 0) { sub_02026260(sub_02026218(param0, v0), 1); v2++; } @@ -2905,7 +2905,7 @@ BOOL ov5_021E7154 (UnkStruct_02026310 * param0, Party * param1, UnkStruct_0203CD v1--; } - sub_02074B30(v9, 9, (u8 *)&v1); + SetMonData(v9, 9, (u8 *)&v1); } else { return 1; } @@ -2941,12 +2941,12 @@ void ov5_021E72BC (UnkStruct_02026310 * param0, UnkStruct_0200B358 * param1) ov5_021E6668(param0, v0); - if (sub_02074570(v0[0], MON_DATA_SPECIES, NULL) != 0) { + if (GetBoxMonData(v0[0], MON_DATA_SPECIES, NULL) != 0) { sub_0200B5CC(param1, 0, v0[0]); sub_0200B5EC(param1, 2, v0[0]); } - if (sub_02074570(v0[1], MON_DATA_SPECIES, NULL) != 0) { + if (GetBoxMonData(v0[1], MON_DATA_SPECIES, NULL) != 0) { sub_0200B5CC(param1, 1, v0[1]); } } @@ -2965,12 +2965,12 @@ void ov5_021E7308 (UnkStruct_02026310 * param0, u32 param1, u32 param2, u32 para v2 = ov5_021E6520(v1, sub_02026228(v0)); sub_0200B60C(param5, param2, v2, 3, 0, 1); - v3 = sub_02074570(v1, MON_DATA_111, NULL); + v3 = GetBoxMonData(v1, MON_DATA_GENDER, NULL); if (v3 != 2) { - v4 = sub_02074570(v1, MON_DATA_SPECIES, NULL); + v4 = GetBoxMonData(v1, MON_DATA_SPECIES, NULL); - if (((v4 == 29) || (v4 == 32)) && (sub_02074570(v1, MON_DATA_77, NULL) == 0)) { + if (((v4 == 29) || (v4 == 32)) && (GetBoxMonData(v1, MON_DATA_77, NULL) == 0)) { v3 = 2; } } @@ -2982,7 +2982,7 @@ u16 ov5_021E73A0 (Party * param0, int param1, UnkStruct_0200B358 * param2) { Pokemon * v0 = Party_GetPokemonBySlotIndex(param0, param1); - sub_0200B5CC(param2, 0, sub_02076B10(v0)); + sub_0200B5CC(param2, 0, GetBoxMon(v0)); return GetMonData(v0, MON_DATA_SPECIES, NULL); } @@ -3042,7 +3042,7 @@ static void ov5_021E742C (Pokemon * param0, int param1) for (v7 = 0; v7 < 4; v7++) { v1[v7] = GetMonData(param0, MON_DATA_MOVE1 + v7, NULL); - v2[v7] = GetMonData(param0, MON_DATA_58 + v7, NULL); + v2[v7] = GetMonData(param0, MON_DATA_MOVE1_PP + v7, NULL); } v3 = GetMonData(param0, MON_DATA_PERSONALITY, NULL); @@ -3067,7 +3067,7 @@ static void ov5_021E742C (Pokemon * param0, int param1) int v17 = GetMonData(param0, MON_DATA_152, NULL); if (v17 == sub_02017070(2, 1)) { - while (sub_02075E38(v4, v3)) { + while (GetMonPersonalityShininess(v4, v3)) { v3 = ARNG_Next(v3); } } @@ -3076,27 +3076,27 @@ static void ov5_021E742C (Pokemon * param0, int param1) sub_02073D80(v16, v0, 1, 32, 1, v3, 0, 0); for (v7 = 0; v7 < 4; v7++) { - sub_02074B30(v16, 54 + v7, &(v1[v7])); - sub_02074B30(v16, 58 + v7, &(v2[v7])); + SetMonData(v16, 54 + v7, &(v1[v7])); + SetMonData(v16, 58 + v7, &(v2[v7])); } for (v7 = 0; v7 < 6; v7++) { - sub_02074B30(v16, 70 + v7, &(v5[v7])); + SetMonData(v16, 70 + v7, &(v5[v7])); } - sub_02074B30(v16, 12, &v8); - sub_02074B30(v16, 122, &v9); - sub_02074B30(v16, 11, &v10); + SetMonData(v16, 12, &v8); + SetMonData(v16, 122, &v9); + SetMonData(v16, 11, &v10); v11 = 120; - sub_02074B30(v16, 9, &v11); - sub_02074B30(v16, 154, &v6); - sub_02074B30(v16, 110, &v12); - sub_02074B30(v16, 145, v15); - sub_02074B30(v16, 157, &v14); - sub_02074B30(v16, 7, &v4); - sub_02074B30(v16, 112, &v13); + SetMonData(v16, 9, &v11); + SetMonData(v16, 154, &v6); + SetMonData(v16, 110, &v12); + SetMonData(v16, 145, v15); + SetMonData(v16, 157, &v14); + SetMonData(v16, 7, &v4); + SetMonData(v16, 112, &v13); { u16 v18; @@ -3107,20 +3107,20 @@ static void ov5_021E742C (Pokemon * param0, int param1) v20 = GetMonData(param0, MON_DATA_147, NULL); v21 = GetMonData(param0, MON_DATA_148, NULL); - sub_02074B30(v16, 152, &v18); - sub_02074B30(v16, 146, &v19); - sub_02074B30(v16, 147, &v20); - sub_02074B30(v16, 148, &v21); + SetMonData(v16, 152, &v18); + SetMonData(v16, 146, &v19); + SetMonData(v16, 147, &v20); + SetMonData(v16, 148, &v21); v18 = GetMonData(param0, MON_DATA_153, NULL); v19 = GetMonData(param0, MON_DATA_149, NULL); v20 = GetMonData(param0, MON_DATA_150, NULL); v21 = GetMonData(param0, MON_DATA_151, NULL); - sub_02074B30(v16, 153, &v18); - sub_02074B30(v16, 149, &v19); - sub_02074B30(v16, 150, &v20); - sub_02074B30(v16, 151, &v21); + SetMonData(v16, 153, &v18); + SetMonData(v16, 149, &v19); + SetMonData(v16, 150, &v20); + SetMonData(v16, 151, &v21); } sub_020775EC(v16, param0); @@ -3141,16 +3141,16 @@ void ov5_021E771C (Pokemon * param0, int param1) v3 = 0; ov5_021E742C(param0, param1); - sub_02074B30(param0, 76, &v0); + SetMonData(param0, 76, &v0); v4 = GetMonData(param0, MON_DATA_SPECIES, NULL); MessageLoader_GetSpeciesName(v4, 0, v5); - sub_02074B30(param0, 117, v5); - sub_02074B30(param0, 77, &v1); - sub_02074B30(param0, 155, &v2); - sub_02074B30(param0, 156, &v3); - sub_0207418C(param0); + SetMonData(param0, 117, v5); + SetMonData(param0, 77, &v1); + SetMonData(param0, 155, &v2); + SetMonData(param0, 156, &v3); + CalculateMonLevelAndStats(param0); } u32 ov5_021E7790 (BoxPokemon ** param0) diff --git a/src/overlay005/ov5_021EE7D4.c b/src/overlay005/ov5_021EE7D4.c index f15cda2ec7..803129e7c6 100644 --- a/src/overlay005/ov5_021EE7D4.c +++ b/src/overlay005/ov5_021EE7D4.c @@ -12,7 +12,7 @@ #include "unk_020507CC.h" #include "unk_0206AFE0.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_02098700.h" #include "overlay005/ov5_021EE7D4.h" diff --git a/src/overlay005/ov5_021F6454.c b/src/overlay005/ov5_021F6454.c index 15149c6f0d..f1596d0aaa 100644 --- a/src/overlay005/ov5_021F6454.c +++ b/src/overlay005/ov5_021F6454.c @@ -56,7 +56,7 @@ #include "unk_02061804.h" #include "unk_020677F4.h" #include "unk_0206AFE0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "overlay005/ov5_021EB1A0.h" @@ -535,7 +535,7 @@ BOOL ov5_021F6C60 (UnkStruct_0203E724 * param0) for (v3 = 0; v3 < v2; v3++) { if (v8[v3] == 112) { v0 = Party_GetPokemonBySlotIndex(v1, v3); - sub_02074B30(v0, 6, &v7); + SetMonData(v0, 6, &v7); } } } @@ -549,7 +549,7 @@ BOOL ov5_021F6C60 (UnkStruct_0203E724 * param0) switch (v5) { case 487: - sub_02077A00(v0); + SetGiratinaForm(v0); break; case 479: SetRotomForm(v0, 0, 0); @@ -596,7 +596,7 @@ BOOL ov5_021F6D80 (UnkStruct_0203E724 * param0) } v4 = 0; - sub_02074B30(v0, 6, &v4); + SetMonData(v0, 6, &v4); } v3 = GetMonData(v0, MON_DATA_FORM, NULL); @@ -606,7 +606,7 @@ BOOL ov5_021F6D80 (UnkStruct_0203E724 * param0) switch (v2) { case 487: - sub_02077A00(v0); + SetGiratinaForm(v0); break; case 479: SetRotomForm(v0, 0, 0); @@ -628,7 +628,7 @@ BOOL ov5_021F6E50 (UnkStruct_0203E724 * param0) u16 v3 = inline_02049538(param0); v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v1->unk_0C), v2); - sub_02074B30(v0, 112, &v3); + SetMonData(v0, 112, &v3); return 0; } diff --git a/src/overlay005/ov5_021F77A8.c b/src/overlay005/ov5_021F77A8.c index b28bf5e0ca..54c85d8fbe 100644 --- a/src/overlay005/ov5_021F77A8.c +++ b/src/overlay005/ov5_021F77A8.c @@ -35,7 +35,7 @@ #include "unk_0203E724.h" #include "unk_0203E880.h" #include "unk_02054884.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "overlay005/ov5_021DC018.h" diff --git a/src/overlay006/ov6_02240C9C.c b/src/overlay006/ov6_02240C9C.c index a72c275936..bbf7d8c097 100644 --- a/src/overlay006/ov6_02240C9C.c +++ b/src/overlay006/ov6_02240C9C.c @@ -40,7 +40,7 @@ #include "unk_0206A8DC.h" #include "unk_0206AFE0.h" #include "roaming_pokemon.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079170.h" #include "party.h" #include "overlay005/ov5_021EFB0C.h" @@ -270,7 +270,7 @@ BOOL ov6_02240D5C (UnkStruct_0203CDB0 * param0) v16 = Party_FirstBattler(v11); v14.unk_04 = 1; - v14.unk_0C = GetMonData(v16, MON_DATA_161, NULL); + v14.unk_0C = GetMonData(v16, MON_DATA_LEVEL, NULL); } } @@ -649,7 +649,7 @@ BOOL ov6_022413E4 (UnkStruct_0203CDB0 * param0, BattleParams ** param1) v15 = Party_FirstBattler(v10); v13.unk_04 = 1; - v13.unk_0C = GetMonData(v15, MON_DATA_161, NULL); + v13.unk_0C = GetMonData(v15, MON_DATA_LEVEL, NULL); } } @@ -1140,7 +1140,7 @@ static void ov6_02241BAC (const u16 param0, const u8 param1, const int param2, c if (param4->unk_0E == 56) { u32 v6; - v6 = sub_020759F0(param0, 18); + v6 = GetMonSpeciesPersonalDataAttribute(param0, 18); switch (v6) { case 0: @@ -1149,13 +1149,13 @@ static void ov6_02241BAC (const u16 param0, const u8 param1, const int param2, c break; default: if (inline_020564D0(3) > 0) { - v3 = GetMonData(param5, MON_DATA_111, NULL); + v3 = GetMonData(param5, MON_DATA_GENDER, NULL); v2 = 1; } } } else if (param4->unk_0E == 28) { if (inline_020564D0(2) == 0) { - v4 = sub_02075BCC(param5); + v4 = GetMonNature(param5); v2 = 1; } } @@ -1168,7 +1168,7 @@ static void ov6_02241BAC (const u16 param0, const u8 param1, const int param2, c do { if (param4->unk_0E == 56) { - v7 = sub_02075DAC(param0, v1); + v7 = GetMonPersonalityGender(param0, v1); GF_ASSERT(v7 != 2); if (v7 != v3) { @@ -1209,7 +1209,7 @@ static void ov6_02241CC0 (u16 param0, u8 param1, const int param2, const UnkStru { u32 v4; - v4 = sub_020759F0(param0, 18); + v4 = GetMonSpeciesPersonalDataAttribute(param0, 18); switch (v4) { case 0: @@ -1223,7 +1223,7 @@ static void ov6_02241CC0 (u16 param0, u8 param1, const int param2, const UnkStru if (param3->unk_0D == 0) { if (param3->unk_0E == 56) { if (inline_020564D0(3) > 0) { - v1 = GetMonData(param4, MON_DATA_111, NULL); + v1 = GetMonData(param4, MON_DATA_GENDER, NULL); if (v1 == 1) { v1 = 0; @@ -1234,7 +1234,7 @@ static void ov6_02241CC0 (u16 param0, u8 param1, const int param2, const UnkStru } sub_02074088(v3, param0, param1, 32, v1, ov6_02241AE4(param4, param3), 0); - sub_02074B30(v3, 7, ¶m3->unk_00); + SetMonData(v3, 7, ¶m3->unk_00); v2 = ov6_02242514(param2, param3, v3, param5); GF_ASSERT(v2); @@ -1246,7 +1246,7 @@ static void ov6_02241CC0 (u16 param0, u8 param1, const int param2, const UnkStru } sub_02074044(v3, param0, param1, 32, ov6_02241AE4(param4, param3)); - sub_02074B30(v3, 7, ¶m3->unk_00); + SetMonData(v3, 7, ¶m3->unk_00); v2 = ov6_02242514(param2, param3, v3, param5); GF_ASSERT(v2); @@ -1490,8 +1490,8 @@ static BOOL ov6_0224219C (const UnkStruct_ov6_0224222C * param0, const u8 param1 v1 = 0; for (v2 = 0; v2 < param1; v2++) { - v3 = sub_020759F0(param0[v2].unk_00, 6); - v4 = sub_020759F0(param0[v2].unk_00, 7); + v3 = GetMonSpeciesPersonalDataAttribute(param0[v2].unk_00, 6); + v4 = GetMonSpeciesPersonalDataAttribute(param0[v2].unk_00, 7); if ((v3 == param2) || (v4 == param2)) { v0[v1++] = v2; @@ -1564,7 +1564,7 @@ static BOOL ov6_022422D0 (const UnkStruct_ov6_022422D0 * param0, Pokemon * param if (param0->unk_0D == 0) { if ((param0->unk_0E == 51) || (param0->unk_0E == 22)) { - v0 = GetMonData(param1, MON_DATA_161, NULL); + v0 = GetMonData(param1, MON_DATA_LEVEL, NULL); if (v0 <= 5) { return 0; @@ -1629,9 +1629,9 @@ static void ov6_0224239C (const u32 param0, UnkStruct_0206C638 * param1, BattleP v5 = sub_0202D93C(param1, 5); sub_02074158(v7, v0, v1, v2, v3); - sub_02074B30(v7, 7, ¶m0); - sub_02074B30(v7, 160, &v4); - sub_02074B30(v7, 163, &v5); + SetMonData(v7, 7, ¶m0); + SetMonData(v7, 160, &v4); + SetMonData(v7, 163, &v5); v6 = Party_AddPokemon(param2->parties[1], v7); @@ -1721,7 +1721,7 @@ static BOOL ov6_02242514 (const int param0, const UnkStruct_ov6_022422D0 * param } if (v1) { - sub_02074B30(param2, 112, (u8 *)&v2); + SetMonData(param2, 112, (u8 *)&v2); } } @@ -1760,7 +1760,7 @@ static void ov6_02242634 (UnkStruct_0203CDB0 * param0, Pokemon * param1, UnkStru { if (GetMonData(param1, MON_DATA_IS_EGG, NULL) == 0) { param3->unk_0D = 0; - param3->unk_0E = GetMonData(param1, MON_DATA_10, NULL); + param3->unk_0E = GetMonData(param1, MON_DATA_ABILITY, NULL); } else { param3->unk_0D = 1; param3->unk_0E = 123; diff --git a/src/overlay006/ov6_022426AC.c b/src/overlay006/ov6_022426AC.c index 9c54f02e14..0781ddbe6a 100644 --- a/src/overlay006/ov6_022426AC.c +++ b/src/overlay006/ov6_022426AC.c @@ -22,7 +22,7 @@ #include "heap.h" #include "unk_0201D15C.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay006/ov6_022426AC.h" typedef struct UnkStruct_ov6_022426B8_t { @@ -73,7 +73,7 @@ void ov6_022426C0 (UnkStruct_ov6_022426B8 * param0, const int param1) int v2; u8 v3; - v3 = sub_020759F0(param1, 18); + v3 = GetMonSpeciesPersonalDataAttribute(param1, 18); switch (v3) { case 0: diff --git a/src/overlay006/ov6_02243258.c b/src/overlay006/ov6_02243258.c index e5a7099f11..95ad5a38b1 100644 --- a/src/overlay006/ov6_02243258.c +++ b/src/overlay006/ov6_02243258.c @@ -38,7 +38,7 @@ #include "unk_0205E7D0.h" #include "unk_02061804.h" #include "unk_020711EC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay005/ov5_021F0EB0.h" #include "overlay006/ov6_02243258.h" diff --git a/src/overlay006/ov6_02246034.c b/src/overlay006/ov6_02246034.c index 86ba911233..73bd15f3b2 100644 --- a/src/overlay006/ov6_02246034.c +++ b/src/overlay006/ov6_02246034.c @@ -15,7 +15,7 @@ #include "unk_020507CC.h" #include "unk_0206AFE0.h" #include "roaming_pokemon.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay006/ov6_02246034.h" @@ -39,7 +39,7 @@ void ov6_02246034 (UnkStruct_0203CDB0 * param0, BattleParams * param1) v4 = ov6_02246148(v3, v2); if (v4 != NULL) { - v0 = (u16)(GetMonData(v6, MON_DATA_163, NULL)); + v0 = (u16)(GetMonData(v6, MON_DATA_CURRENT_HP, NULL)); v1 = (u8)(GetMonData(v6, MON_DATA_160, NULL)); if (((param1->unk_14 == 0x1) && (v0 == 0))) { diff --git a/src/overlay006/ov6_02246184.c b/src/overlay006/ov6_02246184.c index cae40cf818..c7b6e6c78b 100644 --- a/src/overlay006/ov6_02246184.c +++ b/src/overlay006/ov6_02246184.c @@ -18,7 +18,7 @@ #include "unk_0202F180.h" #include "map_header.h" #include "unk_020559DC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_02092494.h" #include "overlay006/ov6_02246184.h" @@ -120,15 +120,15 @@ void ov6_02246254 (UnkStruct_0203CDB0 * param0, UnkStruct_ov6_02246204 * param1, int v4; v1 = Party_GetPokemonBySlotIndex(v0, param2); - v3 = GetMonData(v1, MON_DATA_161, NULL); + v3 = GetMonData(v1, MON_DATA_LEVEL, NULL); ov6_0224630C(param1->unk_04, param1->unk_00, v3, param1->unk_0C, param1->unk_10, param0->unk_1C->unk_00); sub_020775EC(v1, param4); sub_020775EC(param1->unk_04, param5); - param3->unk_00 = sub_02076B10(param4); - param3->unk_04 = sub_02076B10(param5); + param3->unk_00 = GetBoxMon(param4); + param3->unk_04 = GetBoxMon(param5); param3->unk_08 = param1->unk_08; param3->unk_10 = 1; param3->unk_14 = sub_02025E44(param0->unk_0C); @@ -164,36 +164,36 @@ static void ov6_0224630C (Pokemon * param0, UnkStruct_ov6_0224630C * param1, u32 v0 = ov6_022462E4(param4, param3); - sub_02074B30(param0, 119, v0); + SetMonData(param0, 119, v0); Strbuf_Free(v0); v1 = 1; - sub_02074B30(param0, 77, &v1); - sub_02074B30(param0, 70, ¶m1->unk_04); - sub_02074B30(param0, 71, ¶m1->unk_08); - sub_02074B30(param0, 72, ¶m1->unk_0C); - sub_02074B30(param0, 73, ¶m1->unk_10); - sub_02074B30(param0, 74, ¶m1->unk_14); - sub_02074B30(param0, 75, ¶m1->unk_18); - sub_02074B30(param0, 19, ¶m1->unk_24); - sub_02074B30(param0, 20, ¶m1->unk_28); - sub_02074B30(param0, 21, ¶m1->unk_2C); - sub_02074B30(param0, 22, ¶m1->unk_30); - sub_02074B30(param0, 23, ¶m1->unk_34); - sub_02074B30(param0, 6, ¶m1->unk_3C); + SetMonData(param0, 77, &v1); + SetMonData(param0, 70, ¶m1->unk_04); + SetMonData(param0, 71, ¶m1->unk_08); + SetMonData(param0, 72, ¶m1->unk_0C); + SetMonData(param0, 73, ¶m1->unk_10); + SetMonData(param0, 74, ¶m1->unk_14); + SetMonData(param0, 75, ¶m1->unk_18); + SetMonData(param0, 19, ¶m1->unk_24); + SetMonData(param0, 20, ¶m1->unk_28); + SetMonData(param0, 21, ¶m1->unk_2C); + SetMonData(param0, 22, ¶m1->unk_30); + SetMonData(param0, 23, ¶m1->unk_34); + SetMonData(param0, 6, ¶m1->unk_3C); v0 = ov6_022462E4(param4, 4 + param3); - sub_02074B30(param0, 145, v0); + SetMonData(param0, 145, v0); Strbuf_Free(v0); - sub_02074B30(param0, 157, ¶m1->unk_40); - sub_02074B30(param0, 12, ¶m1->unk_48); + SetMonData(param0, 157, ¶m1->unk_40); + SetMonData(param0, 12, ¶m1->unk_48); v2 = sub_0203A138(param5); sub_0209304C(param0, NULL, 1, v2, param4); - sub_0207418C(param0); + CalculateMonLevelAndStats(param0); - GF_ASSERT(sub_02075E0C(param0) == 0); + GF_ASSERT(GetMonShininess(param0) == 0); } diff --git a/src/overlay006/ov6_022489E4.c b/src/overlay006/ov6_022489E4.c index aa1d9a4d48..c6e0edfc46 100644 --- a/src/overlay006/ov6_022489E4.c +++ b/src/overlay006/ov6_022489E4.c @@ -13,7 +13,7 @@ #include "strbuf.h" #include "unk_0202CC64.h" #include "unk_02034198.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay006/ov6_022489E4.h" typedef struct { diff --git a/src/overlay010/ov10_0221F800.c b/src/overlay010/ov10_0221F800.c index 70fd7d4899..d719c57e37 100644 --- a/src/overlay010/ov10_0221F800.c +++ b/src/overlay010/ov10_0221F800.c @@ -74,7 +74,7 @@ #include "unk_020366A0.h" #include "unk_020393C8.h" #include "map_header.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079170.h" #include "unk_02079D40.h" #include "party.h" @@ -2051,9 +2051,9 @@ static void ov10_02221D14 (UnkStruct_ov10_0221FB28 * param0, Party * param1, u8 } param0->unk_214[v1 + param2].unk_0F = (u16)GetMonData(v0, MON_DATA_IS_EGG, NULL); - param0->unk_214[v1 + param2].unk_06 = (u16)GetMonData(v0, MON_DATA_163, NULL); - param0->unk_214[v1 + param2].unk_08 = (u16)GetMonData(v0, MON_DATA_164, NULL); - param0->unk_214[v1 + param2].unk_0C = (u16)GetMonData(v0, MON_DATA_161, NULL); + param0->unk_214[v1 + param2].unk_06 = (u16)GetMonData(v0, MON_DATA_CURRENT_HP, NULL); + param0->unk_214[v1 + param2].unk_08 = (u16)GetMonData(v0, MON_DATA_MAX_HP, NULL); + param0->unk_214[v1 + param2].unk_0C = (u16)GetMonData(v0, MON_DATA_LEVEL, NULL); param0->unk_214[v1 + param2].unk_0A = (u16)GetMonData(v0, MON_DATA_HELD_ITEM, NULL); param0->unk_214[v1 + param2].unk_10 = (u8)GetMonData(v0, MON_DATA_162, NULL); param0->unk_214[v1 + param2].unk_11 = (u8)GetMonData(v0, MON_DATA_FORM, NULL); @@ -2064,7 +2064,7 @@ static void ov10_02221D14 (UnkStruct_ov10_0221FB28 * param0, Party * param1, u8 param0->unk_214[v1 + param2].unk_0E = 1; } - param0->unk_214[v1 + param2].unk_0D = sub_02075D6C(v0); + param0->unk_214[v1 + param2].unk_0D = GetMonGender(v0); param0->unk_214[v1 + param2].unk_14 = (u8)sub_0208E9F0(v0); } } @@ -2273,7 +2273,7 @@ static void ov10_02222400 (UnkStruct_ov10_0221FB28 * param0, MessageLoader * par v2 = MessageLoader_GetNewStrbuf(param1, 8 + param5); - sub_0200B5CC(param3, 0, sub_02076B10(v0)); + sub_0200B5CC(param3, 0, GetBoxMon(v0)); sub_0200C388(param3, param4, v2); Strbuf_Free(v2); sub_0201D78C(v1, 0, param4, 0, 0, 0xff, ((u32)(((15 & 0xff) << 16) | ((14 & 0xff) << 8) | ((0 & 0xff) << 0))), NULL); diff --git a/src/overlay012/ov12_0221FC20.c b/src/overlay012/ov12_0221FC20.c index aeb3109d1b..cbfd0cf59c 100644 --- a/src/overlay012/ov12_0221FC20.c +++ b/src/overlay012/ov12_0221FC20.c @@ -48,7 +48,7 @@ #include "unk_0201DBEC.h" #include "unk_0201F834.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay012/ov12_0221FC20.h" #include "overlay012/ov12_022237EC.h" #include "overlay012/ov12_02225864.h" diff --git a/src/overlay012/ov12_0222E91C.c b/src/overlay012/ov12_0222E91C.c index 5c08de4cc1..94686bee8e 100644 --- a/src/overlay012/ov12_0222E91C.c +++ b/src/overlay012/ov12_0222E91C.c @@ -23,7 +23,7 @@ #include "unk_02018340.h" #include "unk_0201F834.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay012/ov12_0221FC20.h" #include "overlay012/ov12_02225864.h" #include "overlay012/ov12_0222D6B0.h" diff --git a/src/overlay012/ov12_02235E94.c b/src/overlay012/ov12_02235E94.c index 9db5adaba9..18cf050db3 100644 --- a/src/overlay012/ov12_02235E94.c +++ b/src/overlay012/ov12_02235E94.c @@ -32,7 +32,7 @@ #include "heap.h" #include "unk_0201D15C.h" #include "unk_0202C9F4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02097B18.h" #include "overlay012/ov12_0221FC20.h" #include "overlay012/ov12_022237EC.h" diff --git a/src/overlay012/ov12_022380BC.c b/src/overlay012/ov12_022380BC.c index 743972427d..868756b59a 100644 --- a/src/overlay012/ov12_022380BC.c +++ b/src/overlay012/ov12_022380BC.c @@ -13,7 +13,7 @@ #include "narc.h" #include "unk_0200762C.h" #include "unk_020131EC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay012/ov12_022380BC.h" static void ov12_022380DC(UnkStruct_ov12_022380DC * param0, int param1, int param2, int param3); diff --git a/src/overlay013/ov13_0221FC20.c b/src/overlay013/ov13_0221FC20.c index 9e7fbf29eb..d3e663edc0 100644 --- a/src/overlay013/ov13_0221FC20.c +++ b/src/overlay013/ov13_0221FC20.c @@ -34,7 +34,7 @@ #include "gx_layers.h" #include "unk_02022594.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "party.h" #include "item.h" @@ -394,7 +394,7 @@ static u8 ov13_0221FFDC (UnkStruct_ov13_022213F0 * param0) if ((ov13_022213F0(param0, v0->unk_11) == 1) && (Item_LoadParam(v0->unk_22, 23, v0->unk_0C) == 0)) { ov13_02221A54(v0->unk_08, v0->unk_22, v0->unk_33, v0->unk_0C); param0->unk_04[v0->unk_11].unk_00 = ov16_0223DFAC(v0->unk_08, v0->unk_28, v0->unk_2C[v0->unk_11]); - v0->unk_20 = GetMonData(param0->unk_04[v0->unk_11].unk_00, MON_DATA_163, NULL); + v0->unk_20 = GetMonData(param0->unk_04[v0->unk_11].unk_00, MON_DATA_CURRENT_HP, NULL); v0->unk_20 -= param0->unk_04[v0->unk_11].unk_10; param0->unk_2075 = 25; } else { @@ -897,7 +897,7 @@ static u8 ov13_022208A4 (UnkStruct_ov13_022213F0 * param0) ov13_022234A8(param0, v0->unk_11); } - param0->unk_207A = GetMonData(param0->unk_04[v0->unk_11].unk_00, MON_DATA_163, NULL); + param0->unk_207A = GetMonData(param0->unk_04[v0->unk_11].unk_00, MON_DATA_CURRENT_HP, NULL); param0->unk_2078 = 4; } @@ -954,7 +954,7 @@ static u8 ov13_02220A4C (UnkStruct_ov13_022213F0 * param0) continue; } - param0->unk_207C[v1] = (u16)GetMonData(param0->unk_04[v0->unk_11].unk_00, MON_DATA_58 + v1, NULL); + param0->unk_207C[v1] = (u16)GetMonData(param0->unk_04[v0->unk_11].unk_00, MON_DATA_MOVE1_PP + v1, NULL); } ov13_02224144(param0); @@ -1212,16 +1212,16 @@ static void ov13_02220F98 (UnkStruct_ov13_022213F0 * param0) continue; } - param0->unk_04[v0].unk_06 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_165, NULL); - param0->unk_04[v0].unk_08 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_166, NULL); - param0->unk_04[v0].unk_0A = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_167, NULL); - param0->unk_04[v0].unk_0C = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_168, NULL); - param0->unk_04[v0].unk_0E = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_169, NULL); - param0->unk_04[v0].unk_10 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_163, NULL); - param0->unk_04[v0].unk_12 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_164, NULL); + param0->unk_04[v0].unk_06 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_ATK, NULL); + param0->unk_04[v0].unk_08 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_DEF, NULL); + param0->unk_04[v0].unk_0A = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_SPEED, NULL); + param0->unk_04[v0].unk_0C = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_SP_ATK, NULL); + param0->unk_04[v0].unk_0E = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_SP_DEF, NULL); + param0->unk_04[v0].unk_10 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_CURRENT_HP, NULL); + param0->unk_04[v0].unk_12 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_MAX_HP, NULL); param0->unk_04[v0].unk_14 = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_177, NULL); param0->unk_04[v0].unk_15 = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_178, NULL); - param0->unk_04[v0].unk_16_0 = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_161, NULL); + param0->unk_04[v0].unk_16_0 = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_LEVEL, NULL); if (GetMonData(param0->unk_04[v0].unk_00, MON_DATA_176, NULL) == 1) { param0->unk_04[v0].unk_16_7 = 0; @@ -1229,18 +1229,18 @@ static void ov13_02220F98 (UnkStruct_ov13_022213F0 * param0) param0->unk_04[v0].unk_16_7 = 1; } - param0->unk_04[v0].unk_17_0 = sub_02075D6C(param0->unk_04[v0].unk_00); + param0->unk_04[v0].unk_17_0 = GetMonGender(param0->unk_04[v0].unk_00); param0->unk_04[v0].unk_17_3 = sub_0208E9F0(param0->unk_04[v0].unk_00); param0->unk_04[v0].unk_17_7 = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_IS_EGG, NULL); - param0->unk_04[v0].unk_18 = (u16)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_10, NULL); + param0->unk_04[v0].unk_18 = (u16)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_ABILITY, NULL); param0->unk_04[v0].unk_1A = (u16)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_HELD_ITEM, NULL); param0->unk_04[v0].unk_1C = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_EXP, NULL); - param0->unk_04[v0].unk_20 = sub_02075AD0(param0->unk_04[v0].unk_04, param0->unk_04[v0].unk_16_0); + param0->unk_04[v0].unk_20 = GetMonSpeciesLevelExp(param0->unk_04[v0].unk_04, param0->unk_04[v0].unk_16_0); if (param0->unk_04[v0].unk_16_0 == 100) { param0->unk_04[v0].unk_24 = param0->unk_04[v0].unk_20; } else { - param0->unk_04[v0].unk_24 = sub_02075AD0(param0->unk_04[v0].unk_04, param0->unk_04[v0].unk_16_0 + 1); + param0->unk_04[v0].unk_24 = GetMonSpeciesLevelExp(param0->unk_04[v0].unk_04, param0->unk_04[v0].unk_16_0 + 1); } param0->unk_04[v0].unk_28 = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_COOL, NULL); @@ -1260,8 +1260,8 @@ static void ov13_02220F98 (UnkStruct_ov13_022213F0 * param0) continue; } - v2->unk_02 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_58 + v1, NULL); - v2->unk_03 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_62 + v1, NULL); + v2->unk_02 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_MOVE1_PP + v1, NULL); + v2->unk_03 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_MOVE1_PP_UPS + v1, NULL); v2->unk_03 = MoveTable_CalcMaxPP(v2->unk_00, v2->unk_03); v2->unk_04 = MoveTable_LoadParam(v2->unk_00, MOVEATTRIBUTE_TYPE); v2->unk_05 = MoveTable_LoadParam(v2->unk_00, MOVEATTRIBUTE_CLASS); @@ -1620,7 +1620,7 @@ static u8 ov13_022217A4 (UnkStruct_ov13_022213F0 * param0) if (v0->unk_10 == 0) { v1 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 77); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0->unk_00)); + sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0->unk_00)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v1); Strbuf_Free(v1); return 0; @@ -1628,7 +1628,7 @@ static u8 ov13_022217A4 (UnkStruct_ov13_022213F0 * param0) if ((param0->unk_00->unk_2C[param0->unk_00->unk_11] == param0->unk_00->unk_14) || (param0->unk_00->unk_2C[param0->unk_00->unk_11] == param0->unk_00->unk_15)) { v1 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 76); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0->unk_00)); + sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0->unk_00)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v1); Strbuf_Free(v1); return 0; @@ -1643,7 +1643,7 @@ static u8 ov13_022217A4 (UnkStruct_ov13_022213F0 * param0) v0 = ¶m0->unk_04[param0->unk_00->unk_11]; v1 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 93); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0->unk_00)); + sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0->unk_00)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v1); Strbuf_Free(v1); return 0; @@ -1653,7 +1653,7 @@ static u8 ov13_022217A4 (UnkStruct_ov13_022213F0 * param0) v0 = ¶m0->unk_04[param0->unk_2072]; v1 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 78); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0->unk_00)); + sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0->unk_00)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v1); Strbuf_Free(v1); return 0; diff --git a/src/overlay013/ov13_02221A88.c b/src/overlay013/ov13_02221A88.c index a97ad167d9..c34926b774 100644 --- a/src/overlay013/ov13_02221A88.c +++ b/src/overlay013/ov13_02221A88.c @@ -19,7 +19,7 @@ #include "unk_02018340.h" #include "unk_0201D670.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "party.h" #include "item.h" @@ -318,7 +318,7 @@ static void ov13_02221C54 (UnkStruct_ov13_022213F0 * param0, u32 param1, u32 par v2 = Strbuf_Init(12, param0->unk_00->unk_0C); v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, Unk_ov13_02228EC4[param3]); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v1->unk_00)); + sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v1->unk_00)); sub_0200C388(param0->unk_1FA8, v2, v3); if (param2 == 0) { @@ -1204,7 +1204,7 @@ static void ov13_02223550 (UnkStruct_ov13_022213F0 * param0, u32 param1) v2 = Strbuf_Init(12, param0->unk_00->unk_0C); v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, Unk_ov13_02228EC4[param1]); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v1->unk_00)); + sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v1->unk_00)); sub_0200C388(param0->unk_1FA8, v2, v3); Strbuf_Free(v3); @@ -1564,7 +1564,7 @@ void ov13_02224144 (UnkStruct_ov13_022213F0 * param0) v1 = param0->unk_00; v2 = Item_Load(v1->unk_22, 0, v1->unk_0C); v0 = ov16_0223DFAC(v1->unk_08, v1->unk_28, v1->unk_2C[v1->unk_11]); - v4 = GetMonData(v0, MON_DATA_163, NULL); + v4 = GetMonData(v0, MON_DATA_CURRENT_HP, NULL); v5 = 0; if (Item_Get(v2, 15) != 0) { @@ -1597,12 +1597,12 @@ void ov13_02224144 (UnkStruct_ov13_022213F0 * param0) if ((param0->unk_04[v1->unk_11].unk_10 == 0) && (v4 != 0)) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 88); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (param0->unk_04[v1->unk_11].unk_10 != v4) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 82); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); sub_0200B60C(param0->unk_1FA8, 1, v4 - param0->unk_04[v1->unk_11].unk_10, 3, 0, 1); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); @@ -1610,42 +1610,42 @@ void ov13_02224144 (UnkStruct_ov13_022213F0 * param0) MessageLoader_GetStrbuf(param0->unk_1FA4, 87, param0->unk_1FAC); } else if (v5 == 0x1) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 92); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (v5 == 0x2) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 83); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (v5 == 0x4) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 85); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (v5 == 0x8) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 86); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (v5 == 0x10) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 84); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (v5 == 0x20) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 90); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (v5 == 0x40) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 91); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 89); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } @@ -1663,7 +1663,7 @@ void ov13_0222449C (UnkStruct_ov13_022213F0 * param0) v0 = ov16_0223DFAC(v1->unk_08, v1->unk_28, v1->unk_2C[v1->unk_11]); v2 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 95); - sub_0200B5CC(param0->unk_1FA8, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); sub_0200B630(param0->unk_1FA8, 1, 373); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v2); Strbuf_Free(v2); diff --git a/src/overlay013/ov13_022264F4.c b/src/overlay013/ov13_022264F4.c index a5a75cab3a..7fc069a79f 100644 --- a/src/overlay013/ov13_022264F4.c +++ b/src/overlay013/ov13_022264F4.c @@ -38,7 +38,7 @@ #include "gx_layers.h" #include "unk_02022594.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "party.h" #include "item.h" @@ -415,7 +415,7 @@ static u8 ov13_02226A5C (UnkStruct_ov13_02227244 * param0) v3 = ov16_0223DFAC(v0->unk_00, v0->unk_10, v1); v4 = MessageLoader_GetNewStrbuf(param0->unk_10, 46); - sub_0200B5CC(param0->unk_14, 0, sub_02076B10(v3)); + sub_0200B5CC(param0->unk_14, 0, GetBoxMon(v3)); sub_0200B630(param0->unk_14, 1, 373); sub_0200C388(param0->unk_14, param0->unk_18, v4); Strbuf_Free(v4); diff --git a/src/overlay014/ov14_0221FC20.c b/src/overlay014/ov14_0221FC20.c index d684ad3304..be6b87a59c 100644 --- a/src/overlay014/ov14_0221FC20.c +++ b/src/overlay014/ov14_0221FC20.c @@ -13,7 +13,7 @@ #include "battle/ai_context.h" #include "battle/battle_context.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay014/ov14_0221FC20.h" #include "overlay016/ov16_0223DF00.h" @@ -327,7 +327,7 @@ void ov14_0221FC20 (BattleSystem * param0, BattleContext * param1, u8 param2, u8 v1 = BattleSystem_CheckStruggling(param0, param1, param2, 0, 0xffffffff); for (v0 = 0; v0 < LEARNED_MOVES_MAX; v0++) { - if (v1 & FlagIndex(v0)) { + if (v1 & GetSingleBitMask(v0)) { param1->aiContext.moveCurPP[v0] = 0; } @@ -1337,7 +1337,7 @@ static void ov14_02220D8C (BattleSystem * param0, BattleContext * param1) for (v2 = 0; v2 < ov16_0223DF60(param0, v3); v2++) { v1 = Party_GetPokemonBySlotIndex(v0, v2); - if ((v2 != v4) && (v2 != v5) && (GetMonData(v1, MON_DATA_163, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 494)) { + if ((v2 != v4) && (v2 != v5) && (GetMonData(v1, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 494)) { param1->aiContext.calcTemp++; } } @@ -1375,8 +1375,8 @@ static void ov14_02220EA8 (BattleSystem * param0, BattleContext * param1) if ((param1->battleMons[v0].ability == 23) || (param1->battleMons[v0].ability == 42) || (param1->battleMons[v0].ability == 71)) { param1->aiContext.calcTemp = param1->battleMons[v0].ability; } else { - v2 = sub_020759F0(param1->battleMons[v0].species, 24); - v3 = sub_020759F0(param1->battleMons[v0].species, 25); + v2 = GetMonSpeciesPersonalDataAttribute(param1->battleMons[v0].species, 24); + v3 = GetMonSpeciesPersonalDataAttribute(param1->battleMons[v0].species, 25); if ((v2) && (v3)) { if (BattleSystem_RandNext(param0) & 1) { @@ -1420,8 +1420,8 @@ static void ov14_02220F88 (BattleSystem * param0, BattleContext * param1) if ((param1->battleMons[v0].ability == 23) || (param1->battleMons[v0].ability == 42) || (param1->battleMons[v0].ability == 71)) { v3 = param1->battleMons[v0].ability; } else { - v4 = sub_020759F0(param1->battleMons[v0].species, 24); - v5 = sub_020759F0(param1->battleMons[v0].species, 25); + v4 = GetMonSpeciesPersonalDataAttribute(param1->battleMons[v0].species, 24); + v5 = GetMonSpeciesPersonalDataAttribute(param1->battleMons[v0].species, 25); if ((v4) && (v5)) { if ((v4 != v2) && (v5 != v2)) { @@ -1555,7 +1555,7 @@ static void ov14_022211AC (BattleSystem * param0, BattleContext * param1) for (v2 = 0; v2 < ov16_0223DF60(param0, v3); v2++) { v1 = Party_GetPokemonBySlotIndex(v0, v2); - if ((v2 != v4) && (v2 != v5) && (GetMonData(v1, MON_DATA_163, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 494) && (GetMonData(v1, MON_DATA_160, NULL) & v7)) { + if ((v2 != v4) && (v2 != v5) && (GetMonData(v1, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 494) && (GetMonData(v1, MON_DATA_160, NULL) & v7)) { ov14_02222D24(param1, v8); return; } @@ -1592,7 +1592,7 @@ static void ov14_022212A0 (BattleSystem * param0, BattleContext * param1) for (v2 = 0; v2 < ov16_0223DF60(param0, v3); v2++) { v1 = Party_GetPokemonBySlotIndex(v0, v2); - if ((v2 != v4) && (v2 != v5) && (GetMonData(v1, MON_DATA_163, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 494) && ((GetMonData(v1, MON_DATA_160, NULL) & v7) == 0)) { + if ((v2 != v4) && (v2 != v5) && (GetMonData(v1, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 494) && ((GetMonData(v1, MON_DATA_160, NULL) & v7) == 0)) { ov14_02222D24(param1, v8); return; } @@ -2235,7 +2235,7 @@ static void ov14_02221D88 (BattleSystem * param0, BattleContext * param1) v4 = ov16_0223DFAC(param0, v0, v3); if (v3 != param1->selectedPartySlot[v0]) { - if (GetMonData(v4, MON_DATA_163, NULL) != GetMonData(v4, MON_DATA_164, NULL)) { + if (GetMonData(v4, MON_DATA_CURRENT_HP, NULL) != GetMonData(v4, MON_DATA_MAX_HP, NULL)) { ov14_02222D24(param1, v2); break; } @@ -2262,7 +2262,7 @@ static void ov14_02221E18 (BattleSystem * param0, BattleContext * param1) if (v3 != param1->selectedPartySlot[v0]) { for (v4 = 0; v4 < 4; v4++) { - if (GetMonData(v5, MON_DATA_58 + v4, NULL) != GetMonData(v5, MON_DATA_66 + v4, NULL)) { + if (GetMonData(v5, MON_DATA_MOVE1_PP + v4, NULL) != GetMonData(v5, MON_DATA_MOVE1_MAX_PP + v4, NULL)) { ov14_02222D24(param1, v2); break; } @@ -2406,7 +2406,7 @@ static void ov14_022220CC (BattleSystem * param0, BattleContext * param1) if (v0 != param1->selectedPartySlot[v4]) { v10 = ov16_0223DFAC(param0, v4, v0); - if ((GetMonData(v10, MON_DATA_163, NULL) != 0) && (GetMonData(v10, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v10, MON_DATA_SPECIES_EGG, NULL) != 494)) { + if ((GetMonData(v10, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v10, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v10, MON_DATA_SPECIES_EGG, NULL) != 494)) { for (v1 = 0; v1 < 4; v1++) { v8[v1] = GetMonData(v10, MON_DATA_MOVE1 + v1, NULL); } @@ -2415,7 +2415,7 @@ static void ov14_022220CC (BattleSystem * param0, BattleContext * param1) v9[v1] = GetMonData(v10, MON_DATA_HP_IV + v1, NULL); } - v6 = ov14_02222D7C(param0, param1, param1->aiContext.attacker, &v8[0], &v7[0], GetMonData(v10, MON_DATA_HELD_ITEM, NULL), &v9[0], GetMonData(v10, MON_DATA_10, NULL), MON_DATA_PERSONALITY, v2); + v6 = ov14_02222D7C(param0, param1, param1->aiContext.attacker, &v8[0], &v7[0], GetMonData(v10, MON_DATA_HELD_ITEM, NULL), &v9[0], GetMonData(v10, MON_DATA_ABILITY, NULL), MON_DATA_PERSONALITY, v2); if (v6 > v5) { ov14_02222D24(param1, v3); @@ -2697,7 +2697,7 @@ static void ov14_022227A4 (BattleSystem * param0, BattleContext * param1) v2 = ov14_02222D34(param1, v0); - if (param1->battlersSwitchingMask & FlagIndex(v2)) { + if (param1->battlersSwitchingMask & GetSingleBitMask(v2)) { ov14_02222D24(param1, v1); } } @@ -2718,7 +2718,7 @@ static void ov14_022227F4 (BattleSystem * param0, BattleContext * param1) v2 = ov14_02222D34(param1, v0); - if ((param1->battlersSwitchingMask & FlagIndex(v2)) == 0) { + if ((param1->battlersSwitchingMask & GetSingleBitMask(v2)) == 0) { ov14_02222D24(param1, v1); } } @@ -3423,14 +3423,14 @@ static BOOL ov14_0222342C (BattleSystem * param0, BattleContext * param1, int pa for (v0 = 0; v0 < ov16_0223DF60(param0, param2); v0++) { v5 = ov16_0223DFAC(param0, param2, v0); - if ((GetMonData(v5, MON_DATA_163, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[param2])) { + if ((GetMonData(v5, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[param2])) { for (v1 = 0; v1 < 4; v1++) { v2 = GetMonData(v5, MON_DATA_MOVE1 + v1, NULL); v3 = ov16_0225BE3C(param0, param1, v5, v2); if (v2) { v4 = 0; - ov16_022552D4(param1, v2, v3, GetMonData(v5, MON_DATA_10, NULL), Battler_Ability(param1, param2 ^ 1), ov16_02258AB8(param1, param2 ^ 1), ov16_02252060(param1, param2 ^ 1, 27, NULL), ov16_02252060(param1, param2 ^ 1, 28, NULL), &v4); + ov16_022552D4(param1, v2, v3, GetMonData(v5, MON_DATA_ABILITY, NULL), Battler_Ability(param1, param2 ^ 1), ov16_02258AB8(param1, param2 ^ 1), ov16_02252060(param1, param2 ^ 1, 27, NULL), ov16_02252060(param1, param2 ^ 1, 28, NULL), &v4); if (v4 & 0x2) { if ((BattleSystem_RandNext(param0) % 3) < 2) { @@ -3515,7 +3515,7 @@ static BOOL ov14_022235F0 (BattleSystem * param0, BattleContext * param1, int pa for (v0 = v9; v0 < v10; v0++) { v12 = ov16_0223DFAC(param0, param2, v0); - if ((GetMonData(v12, MON_DATA_163, NULL) != 0) && (GetMonData(v12, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v12, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v4]) && (v0 != param1->selectedPartySlot[v5]) && (v0 != param1->aiSwitchedPartySlot[v4]) && (v0 != param1->aiSwitchedPartySlot[v5])) { + if ((GetMonData(v12, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v12, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v12, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v4]) && (v0 != param1->selectedPartySlot[v5]) && (v0 != param1->aiSwitchedPartySlot[v4]) && (v0 != param1->aiSwitchedPartySlot[v5])) { for (v1 = 0; v1 < 4; v1++) { v6 = GetMonData(v12, MON_DATA_MOVE1 + v1, NULL); v7 = ov16_0225BE3C(param0, param1, v12, v6); @@ -3524,7 +3524,7 @@ static BOOL ov14_022235F0 (BattleSystem * param0, BattleContext * param1, int pa v8 = 0; if (param1->battleMons[v2].curHP) { - ov16_022552D4(param1, v6, v7, GetMonData(v12, MON_DATA_10, NULL), Battler_Ability(param1, v2), ov16_02258AB8(param1, v2), ov16_02252060(param1, v2, 27, NULL), ov16_02252060(param1, v2, 28, NULL), &v8); + ov16_022552D4(param1, v6, v7, GetMonData(v12, MON_DATA_ABILITY, NULL), Battler_Ability(param1, v2), ov16_02258AB8(param1, v2), ov16_02252060(param1, v2, 27, NULL), ov16_02252060(param1, v2, 28, NULL), &v8); } if (v8 & 0x2) { @@ -3537,7 +3537,7 @@ static BOOL ov14_022235F0 (BattleSystem * param0, BattleContext * param1, int pa v8 = 0; if (param1->battleMons[v3].curHP) { - ov16_022552D4(param1, v6, v7, GetMonData(v12, MON_DATA_10, NULL), Battler_Ability(param1, v3), ov16_02258AB8(param1, v3), ov16_02252060(param1, v3, 27, NULL), ov16_02252060(param1, v3, 28, NULL), &v8); + ov16_022552D4(param1, v6, v7, GetMonData(v12, MON_DATA_ABILITY, NULL), Battler_Ability(param1, v3), ov16_02258AB8(param1, v3), ov16_02252060(param1, v3, 27, NULL), ov16_02252060(param1, v3, 28, NULL), &v8); } if (v8 & 0x2) { @@ -3554,7 +3554,7 @@ static BOOL ov14_022235F0 (BattleSystem * param0, BattleContext * param1, int pa for (v0 = v9; v0 < v10; v0++) { v12 = ov16_0223DFAC(param0, param2, v0); - if ((GetMonData(v12, MON_DATA_163, NULL) != 0) && (GetMonData(v12, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v12, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v4]) && (v0 != param1->selectedPartySlot[v5]) && (v0 != param1->aiSwitchedPartySlot[v4]) && (v0 != param1->aiSwitchedPartySlot[v5])) { + if ((GetMonData(v12, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v12, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v12, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v4]) && (v0 != param1->selectedPartySlot[v5]) && (v0 != param1->aiSwitchedPartySlot[v4]) && (v0 != param1->aiSwitchedPartySlot[v5])) { for (v1 = 0; v1 < 4; v1++) { v6 = GetMonData(v12, MON_DATA_MOVE1 + v1, NULL); v7 = ov16_0225BE3C(param0, param1, v12, v6); @@ -3563,7 +3563,7 @@ static BOOL ov14_022235F0 (BattleSystem * param0, BattleContext * param1, int pa v8 = 0; if (param1->battleMons[v2].curHP) { - ov16_022552D4(param1, v6, v7, GetMonData(v12, MON_DATA_10, NULL), Battler_Ability(param1, v2), ov16_02258AB8(param1, v2), ov16_02252060(param1, v2, 27, NULL), ov16_02252060(param1, v2, 28, NULL), &v8); + ov16_022552D4(param1, v6, v7, GetMonData(v12, MON_DATA_ABILITY, NULL), Battler_Ability(param1, v2), ov16_02258AB8(param1, v2), ov16_02252060(param1, v2, 27, NULL), ov16_02252060(param1, v2, 28, NULL), &v8); } if (v8 == 0) { @@ -3576,7 +3576,7 @@ static BOOL ov14_022235F0 (BattleSystem * param0, BattleContext * param1, int pa v8 = 0; if (param1->battleMons[v3].curHP) { - ov16_022552D4(param1, v6, v7, GetMonData(v12, MON_DATA_10, NULL), Battler_Ability(param1, v3), ov16_02258AB8(param1, v3), ov16_02252060(param1, v3, 27, NULL), ov16_02252060(param1, v3, 28, NULL), &v8); + ov16_022552D4(param1, v6, v7, GetMonData(v12, MON_DATA_ABILITY, NULL), Battler_Ability(param1, v3), ov16_02258AB8(param1, v3), ov16_02252060(param1, v3, 27, NULL), ov16_02252060(param1, v3, 28, NULL), &v8); } if (v8 == 0) { @@ -3605,7 +3605,7 @@ static BOOL ov14_02223B34 (BattleSystem * param0, BattleContext * param1, int pa v3 = BattleSystem_BattlerSlot(param0, param2) ^ 1; v2 = ov16_0223E1C4(param0, v3); - if ((param1->battlersSwitchingMask & FlagIndex(v2)) == 0) { + if ((param1->battlersSwitchingMask & GetSingleBitMask(v2)) == 0) { for (v0 = 0; v0 < 4; v0++) { v4 = param1->battleMons[param2].moves[v0]; v5 = ov14_0222327C(param0, param1, param2, v4); @@ -3633,7 +3633,7 @@ static BOOL ov14_02223B34 (BattleSystem * param0, BattleContext * param1, int pa v2 = BattleSystem_Partner(param0, v2); - if ((param1->battlersSwitchingMask & FlagIndex(v2)) == 0) { + if ((param1->battlersSwitchingMask & GetSingleBitMask(v2)) == 0) { for (v0 = 0; v0 < 4; v0++) { v4 = param1->battleMons[param2].moves[v0]; v5 = ov14_0222327C(param0, param1, param2, v4); @@ -3710,8 +3710,8 @@ static BOOL ov14_02223C8C (BattleSystem * param0, BattleContext * param1, int pa for (v0 = v6; v0 < v7; v0++) { v8 = ov16_0223DFAC(param0, param2, v0); - if ((GetMonData(v8, MON_DATA_163, NULL) != 0) && (GetMonData(v8, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v8, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v1]) && (v0 != param1->selectedPartySlot[v2]) && (v0 != param1->aiSwitchedPartySlot[v1]) && (v0 != param1->aiSwitchedPartySlot[v2])) { - v4 = GetMonData(v8, MON_DATA_10, NULL); + if ((GetMonData(v8, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v8, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v8, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v1]) && (v0 != param1->selectedPartySlot[v2]) && (v0 != param1->aiSwitchedPartySlot[v1]) && (v0 != param1->aiSwitchedPartySlot[v2])) { + v4 = GetMonData(v8, MON_DATA_ABILITY, NULL); if ((v5 == v4) && (BattleSystem_RandNext(param0) & 1)) { param1->aiSwitchedPartySlot[param2] = v0; @@ -3755,11 +3755,11 @@ static BOOL ov14_02223E10 (BattleSystem * param0, BattleContext * param1, int pa for (v0 = v7; v0 < v8; v0++) { v9 = ov16_0223DFAC(param0, param2, v0); - if ((GetMonData(v9, MON_DATA_163, NULL) != 0) && (GetMonData(v9, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v9, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v2]) && (v0 != param1->selectedPartySlot[v3]) && (v0 != param1->aiSwitchedPartySlot[v2]) && (v0 != param1->aiSwitchedPartySlot[v3])) { + if ((GetMonData(v9, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v9, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v9, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v2]) && (v0 != param1->selectedPartySlot[v3]) && (v0 != param1->aiSwitchedPartySlot[v2]) && (v0 != param1->aiSwitchedPartySlot[v3])) { v6 = 0; v5 = ov14_0222327C(param0, param1, param1->moveHitBattler[param2], param1->moveHit[param2]); - ov16_022552D4(param1, param1->moveHit[param2], v5, Battler_Ability(param1, param1->moveHitBattler[param2]), GetMonData(v9, MON_DATA_10, NULL), ov16_0225B0FC(param1, GetMonData(v9, MON_DATA_HELD_ITEM, NULL), 1), GetMonData(v9, MON_DATA_177, NULL), GetMonData(v9, MON_DATA_178, NULL), &v6); + ov16_022552D4(param1, param1->moveHit[param2], v5, Battler_Ability(param1, param1->moveHitBattler[param2]), GetMonData(v9, MON_DATA_ABILITY, NULL), ov16_0225B0FC(param1, GetMonData(v9, MON_DATA_HELD_ITEM, NULL), 1), GetMonData(v9, MON_DATA_177, NULL), GetMonData(v9, MON_DATA_178, NULL), &v6); if (v6 & param3) { for (v1 = 0; v1 < 4; v1++) { @@ -3768,7 +3768,7 @@ static BOOL ov14_02223E10 (BattleSystem * param0, BattleContext * param1, int pa if (v4) { v6 = 0; - ov16_022552D4(param1, v4, v5, GetMonData(v9, MON_DATA_10, NULL), Battler_Ability(param1, param1->moveHitBattler[param2]), ov16_02258AB8(param1, param1->moveHitBattler[param2]), ov16_02252060(param1, param1->moveHitBattler[param2], 27, NULL), ov16_02252060(param1, param1->moveHitBattler[param2], 28, NULL), &v6); + ov16_022552D4(param1, v4, v5, GetMonData(v9, MON_DATA_ABILITY, NULL), Battler_Ability(param1, param1->moveHitBattler[param2]), ov16_02258AB8(param1, param1->moveHitBattler[param2]), ov16_02252060(param1, param1->moveHitBattler[param2], 27, NULL), ov16_02252060(param1, param1->moveHitBattler[param2], 28, NULL), &v6); if (v6 & 0x2) { if ((BattleSystem_RandNext(param0) % param4) == 0) { @@ -3864,7 +3864,7 @@ static BOOL ov14_022241A4 (BattleSystem * param0, BattleContext * param1, int pa for (v0 = v5; v0 < v6; v0++) { v7 = ov16_0223DFAC(param0, param2, v0); - if ((GetMonData(v7, MON_DATA_163, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v2]) && (v0 != param1->selectedPartySlot[v3]) && (v0 != param1->aiSwitchedPartySlot[v2]) && (v0 != param1->aiSwitchedPartySlot[v3])) { + if ((GetMonData(v7, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v2]) && (v0 != param1->selectedPartySlot[v3]) && (v0 != param1->aiSwitchedPartySlot[v2]) && (v0 != param1->aiSwitchedPartySlot[v3])) { v1++; } } @@ -3940,7 +3940,7 @@ int ov14_022243BC (BattleSystem * param0, int param1) for (v0 = v4; v0 < v5; v0++) { v6 = ov16_0223DFAC(param0, param1, v0); - if ((GetMonData(v6, MON_DATA_163, NULL) != 0) && (v0 != v7->selectedPartySlot[v1]) && (v0 != v7->selectedPartySlot[v2]) && (v0 != v7->aiSwitchedPartySlot[v1]) && (v0 != v7->aiSwitchedPartySlot[v2])) { + if ((GetMonData(v6, MON_DATA_CURRENT_HP, NULL) != 0) && (v0 != v7->selectedPartySlot[v1]) && (v0 != v7->selectedPartySlot[v2]) && (v0 != v7->aiSwitchedPartySlot[v1]) && (v0 != v7->aiSwitchedPartySlot[v2])) { break; } } @@ -3990,7 +3990,7 @@ BOOL ov14_022244B0 (BattleSystem * param0, int param1) for (v0 = 0; v0 < Party_GetCurrentCount(v6); v0++) { v7 = Party_GetPokemonBySlotIndex(v6, v0); - if ((GetMonData(v7, MON_DATA_163, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 494)) { + if ((GetMonData(v7, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 494)) { v1++; } } @@ -4019,37 +4019,37 @@ BOOL ov14_022244B0 (BattleSystem * param0, int param1) } } else if (ov16_0225B0FC(v8, v2, 15)) { if (v8->battleMons[param1].status & 0x7) { - v8->aiContext.usedItemCondition[param1 >> 1] |= FlagIndex(5); + v8->aiContext.usedItemCondition[param1 >> 1] |= GetSingleBitMask(5); v8->aiContext.usedItemType[param1 >> 1] = 2; v4 = 1; } } else if (ov16_0225B0FC(v8, v2, 16)) { if ((v8->battleMons[param1].status & 0x8) || (v8->battleMons[param1].status & 0x80)) { - v8->aiContext.usedItemCondition[param1 >> 1] |= FlagIndex(4); + v8->aiContext.usedItemCondition[param1 >> 1] |= GetSingleBitMask(4); v8->aiContext.usedItemType[param1 >> 1] = 2; v4 = 1; } } else if (ov16_0225B0FC(v8, v2, 17)) { if (v8->battleMons[param1].status & 0x10) { - v8->aiContext.usedItemCondition[param1 >> 1] |= FlagIndex(3); + v8->aiContext.usedItemCondition[param1 >> 1] |= GetSingleBitMask(3); v8->aiContext.usedItemType[param1 >> 1] = 2; v4 = 1; } } else if (ov16_0225B0FC(v8, v2, 18)) { if (v8->battleMons[param1].status & 0x20) { - v8->aiContext.usedItemCondition[param1 >> 1] |= FlagIndex(2); + v8->aiContext.usedItemCondition[param1 >> 1] |= GetSingleBitMask(2); v8->aiContext.usedItemType[param1 >> 1] = 2; v4 = 1; } } else if (ov16_0225B0FC(v8, v2, 19)) { if (v8->battleMons[param1].status & 0x40) { - v8->aiContext.usedItemCondition[param1 >> 1] |= FlagIndex(1); + v8->aiContext.usedItemCondition[param1 >> 1] |= GetSingleBitMask(1); v8->aiContext.usedItemType[param1 >> 1] = 2; v4 = 1; } } else if (ov16_0225B0FC(v8, v2, 20)) { if (v8->battleMons[param1].statusVolatile & 0x7) { - v8->aiContext.usedItemCondition[param1 >> 1] |= FlagIndex(0); + v8->aiContext.usedItemCondition[param1 >> 1] |= GetSingleBitMask(0); v8->aiContext.usedItemType[param1 >> 1] = 2; v4 = 1; } diff --git a/src/overlay016/battle_controller.c b/src/overlay016/battle_controller.c index 1bbcbe0e85..dac2910540 100644 --- a/src/overlay016/battle_controller.c +++ b/src/overlay016/battle_controller.c @@ -32,7 +32,7 @@ #include "heap.h" #include "unk_02025E68.h" #include "unk_02034198.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "party.h" #include "item.h" @@ -369,7 +369,7 @@ static void BattleController_CommandSelectionInput (BattleSystem *battleSys, Bat break; } - if (battleCtx->battlersSwitchingMask & FlagIndex(i)) { + if (battleCtx->battlersSwitchingMask & GetSingleBitMask(i)) { battleCtx->curCommandState[i] = COMMAND_SELECTION_WAIT; battleCtx->battlerActions[i][BATTLE_ACTION_PICK_COMMAND] = BATTLE_CONTROL_AFTER_MOVE; break; @@ -860,7 +860,7 @@ static void BattleController_CheckPreMoveActions(BattleSystem *battleSys, Battle while (battleCtx->turnStartCheckTemp < maxBattlers) { battler = battleCtx->battlerActionOrder[battleCtx->turnStartCheckTemp]; - if (battleCtx->battlersSwitchingMask & FlagIndex(battler)) { + if (battleCtx->battlersSwitchingMask & GetSingleBitMask(battler)) { battleCtx->turnStartCheckTemp++; continue; } @@ -1349,7 +1349,7 @@ static void BattleController_CheckMonConditions(BattleSystem *battleSys, BattleC while (battleCtx->monConditionCheckTemp < maxBattlers) { battler = battleCtx->monSpeedOrder[battleCtx->monConditionCheckTemp]; - if (battleCtx->battlersSwitchingMask & FlagIndex(battler)) { + if (battleCtx->battlersSwitchingMask & GetSingleBitMask(battler)) { battleCtx->monConditionCheckTemp++; continue; } @@ -1573,13 +1573,13 @@ static void BattleController_CheckMonConditions(BattleSystem *battleSys, BattleC if (BattleContext_MoveFailed(battleCtx, battler)) { i = BATTLE_SUBSEQ_UPROAR_END; battleCtx->battleMons[battler].statusVolatile &= ~VOLATILE_CONDITION_UPROAR; - battleCtx->fieldConditionsMask &= ((FlagIndex(battler) << FIELD_CONDITION_UPROAR_SHIFT) ^ 0xFFFFFFFF); + battleCtx->fieldConditionsMask &= ((GetSingleBitMask(battler) << FIELD_CONDITION_UPROAR_SHIFT) ^ 0xFFFFFFFF); } else if (battleCtx->battleMons[battler].statusVolatile & VOLATILE_CONDITION_UPROAR) { i = BATTLE_SUBSEQ_UPROAR_CONTINUES; } else { i = BATTLE_SUBSEQ_UPROAR_END; battleCtx->battleMons[battler].statusVolatile &= ~VOLATILE_CONDITION_UPROAR; - battleCtx->fieldConditionsMask &= ((FlagIndex(battler) << FIELD_CONDITION_UPROAR_SHIFT) ^ 0xFFFFFFFF); + battleCtx->fieldConditionsMask &= ((GetSingleBitMask(battler) << FIELD_CONDITION_UPROAR_SHIFT) ^ 0xFFFFFFFF); } battleCtx->msgBattlerTemp = battler; @@ -1806,7 +1806,7 @@ static void BattleController_CheckSideConditions(BattleSystem *battleSys, Battle case SIDE_COND_CHECK_FUTURE_SIGHT: while (battleCtx->sideConditionCheckTemp < maxBattlers) { battler = battleCtx->monSpeedOrder[battleCtx->sideConditionCheckTemp]; - if (battleCtx->battlersSwitchingMask & FlagIndex(battler)) { + if (battleCtx->battlersSwitchingMask & GetSingleBitMask(battler)) { battleCtx->sideConditionCheckTemp++; continue; } @@ -1837,7 +1837,7 @@ static void BattleController_CheckSideConditions(BattleSystem *battleSys, Battle case SIDE_COND_CHECK_PERISH_SONG: while (battleCtx->sideConditionCheckTemp < maxBattlers) { battler = battleCtx->monSpeedOrder[battleCtx->sideConditionCheckTemp]; - if (battleCtx->battlersSwitchingMask & FlagIndex(battler)) { + if (battleCtx->battlersSwitchingMask & GetSingleBitMask(battler)) { battleCtx->sideConditionCheckTemp++; continue; } @@ -1959,7 +1959,7 @@ static void ov16_0224DDA8 (BattleSystem * param0, BattleContext * param1) if ((param1->aiContext.usedItemCondition[param1->attacker >> 1] & 1) && (param1->aiContext.usedItemCondition[param1->attacker >> 1] & 0x3e)) { param1->msgTemp = 6; } else { - param1->msgTemp = sub_020787EC(param1->aiContext.usedItemCondition[param1->attacker >> 1]); + param1->msgTemp = GetLowestSetBitIndex(param1->aiContext.usedItemCondition[param1->attacker >> 1]); } v1 = (0 + 268); @@ -2196,7 +2196,7 @@ static int ov16_0224E13C (BattleSystem * param0, BattleContext * param1, int * p v0 = ((BattleSystem_RandNext(param0) & 0xff) * (param1->battleMons[param1->attacker].level + v3)) >> 8; if (v0 < v3) { - v0 = BattleSystem_CheckStruggling(param0, param1, param1->attacker, FlagIndex(param1->moveSlot[param1->attacker]), 0xffffffff); + v0 = BattleSystem_CheckStruggling(param0, param1, param1->attacker, GetSingleBitMask(param1->moveSlot[param1->attacker]), 0xffffffff); if (v0 == 0xf) { param2[0] = (0 + 255); @@ -2205,7 +2205,7 @@ static int ov16_0224E13C (BattleSystem * param0, BattleContext * param1, int * p do { v1 = BattleSystem_RandNext(param0) & 3; - } while (v0 & FlagIndex(v1)); + } while (v0 & GetSingleBitMask(v1)); param1->moveSlot[param1->attacker] = v1; param1->moveTemp = param1->battleMons[param1->attacker].moves[param1->moveSlot[param1->attacker]]; @@ -2301,7 +2301,7 @@ static BOOL ov16_0224E458 (BattleSystem * param0, BattleContext * param1) } else { param1->moveStatusFlags |= 0x200; } - } else if ((param1->battleMons[param1->attacker].ppCur[v1] == 0) && ((param1->battleStatusMask & 0x200) == 0) && ((param1->battleMons[param1->attacker].statusVolatile & 0x1000) == 0) && ((param1->battleMons[param1->attacker].statusVolatile & 0xc00) == 0) && ((param1->fieldConditionsMask & (FlagIndex(param1->attacker) << 8)) == 0) && (v1 < 4)) { + } else if ((param1->battleMons[param1->attacker].ppCur[v1] == 0) && ((param1->battleStatusMask & 0x200) == 0) && ((param1->battleMons[param1->attacker].statusVolatile & 0x1000) == 0) && ((param1->battleMons[param1->attacker].statusVolatile & 0xc00) == 0) && ((param1->fieldConditionsMask & (GetSingleBitMask(param1->attacker) << 8)) == 0) && (v1 < 4)) { param1->moveStatusFlags |= 0x200; } @@ -2574,7 +2574,7 @@ static BOOL ov16_0224E784 (BattleSystem * param0, BattleContext * param1) break; case 13: if (param1->battleMons[param1->attacker].statusVolatile & 0xf0000) { - param1->msgBattlerTemp = sub_020787EC((param1->battleMons[param1->attacker].statusVolatile & 0xf0000) >> 16); + param1->msgBattlerTemp = GetLowestSetBitIndex((param1->battleMons[param1->attacker].statusVolatile & 0xf0000) >> 16); if (BattleSystem_RandNext(param0) & 1) { BattleSystem_LoadScript(param1, 1, (0 + 107)); @@ -3218,13 +3218,13 @@ static void ov16_0224F8EC (BattleSystem * param0, BattleContext * param1) if (param1->aiContext.moveTable[param1->moveCur].class == 0) { param1->turnFlags[param1->defender].physicalDamageTakenFrom[param1->attacker] = param1->damage; param1->turnFlags[param1->defender].physicalDamageLastAttacker = param1->attacker; - param1->turnFlags[param1->defender].physicalDamageAttackerMask |= FlagIndex(param1->attacker); + param1->turnFlags[param1->defender].physicalDamageAttackerMask |= GetSingleBitMask(param1->attacker); param1->selfTurnFlags[param1->defender].physicalDamageTaken = param1->damage; param1->selfTurnFlags[param1->defender].physicalDamageLastAttacker = param1->attacker; } else if (param1->aiContext.moveTable[param1->moveCur].class == 1) { param1->turnFlags[param1->defender].specialDamageTakenFrom[param1->attacker] = param1->damage; param1->turnFlags[param1->defender].specialDamageLastAttacker = param1->attacker; - param1->turnFlags[param1->defender].specialDamageAttackerMask |= FlagIndex(param1->attacker); + param1->turnFlags[param1->defender].specialDamageAttackerMask |= GetSingleBitMask(param1->attacker); param1->selfTurnFlags[param1->defender].specialDamageTaken = param1->damage; param1->selfTurnFlags[param1->defender].specialDamageLastAttacker = param1->attacker; } @@ -3495,7 +3495,7 @@ static void ov16_0224FEE4 (BattleSystem * param0, BattleContext * param1) while (param1->afterMoveEffectTemp < BattleSystem_MaxBattlers(param0)) { v4 = param1->monSpeedOrder[param1->afterMoveEffectTemp]; - if (param1->battlersSwitchingMask & FlagIndex(v4)) { + if (param1->battlersSwitchingMask & GetSingleBitMask(v4)) { param1->afterMoveEffectTemp++; continue; } @@ -3604,7 +3604,7 @@ static void ov16_02250298 (BattleSystem * param0, BattleContext * param1) do { v0 = param1->monSpeedOrder[param1->battlerCounter++]; - if (((param1->battlersSwitchingMask & FlagIndex(v0)) == 0) && (param1->battleMons[v0].curHP)) { + if (((param1->battlersSwitchingMask & GetSingleBitMask(v0)) == 0) && (param1->battleMons[v0].curHP)) { v2 = BattleSystem_BattlerData(param0, v0); if (((v3 & 0x1) && ((ov16_02263AE4(v2) & 0x1) == 0)) || ((v3 & 0x1) == 0) && (ov16_02263AE4(v2) & 0x1)) { @@ -3626,7 +3626,7 @@ static void ov16_02250298 (BattleSystem * param0, BattleContext * param1) do { v4 = param1->monSpeedOrder[param1->battlerCounter++]; - if (((param1->battlersSwitchingMask & FlagIndex(v4)) == 0) && (param1->battleMons[v4].curHP)) { + if (((param1->battlersSwitchingMask & GetSingleBitMask(v4)) == 0) && (param1->battleMons[v4].curHP)) { if (v4 != param1->attacker) { ov16_02255F94(param0, param1); param1->defender = v4; @@ -3645,7 +3645,7 @@ static void ov16_02250298 (BattleSystem * param0, BattleContext * param1) static void ov16_02250438 (BattleSystem * param0, BattleContext * param1) { if (param1->battleStatusMask & 0xf0000000) { - param1->faintedMon = sub_020787EC((param1->battleStatusMask & 0xf0000000) >> 28); + param1->faintedMon = GetLowestSetBitIndex((param1->battleStatusMask & 0xf0000000) >> 28); param1->battleStatusMask &= (0xf0000000 ^ 0xffffffff); BattleSystem_LoadScript(param1, 1, (0 + 277)); @@ -3872,7 +3872,7 @@ static BOOL BattleController_CheckAnySwitches (BattleSystem * param0, BattleCont v10 = Party_GetPokemonBySlotIndex(v9, v5); if ((GetMonData(v10, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v10, MON_DATA_SPECIES_EGG, NULL) != 494)) { - if (v6 = GetMonData(v10, MON_DATA_163, NULL)) { + if (v6 = GetMonData(v10, MON_DATA_CURRENT_HP, NULL)) { v8++; if (param1->selectedPartySlot[v1 ^ 2] != v5) { @@ -3883,7 +3883,7 @@ static BOOL BattleController_CheckAnySwitches (BattleSystem * param0, BattleCont } if (v7 == 0) { - param1->battlersSwitchingMask |= FlagIndex(v1); + param1->battlersSwitchingMask |= GetSingleBitMask(v1); param1->selectedPartySlot[v1] = 6; } else { param1->commandNext = v4; @@ -3908,12 +3908,12 @@ static BOOL BattleController_CheckAnySwitches (BattleSystem * param0, BattleCont v15 = Party_GetPokemonBySlotIndex(v14, v12); if ((GetMonData(v15, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v15, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v13 += GetMonData(v15, MON_DATA_163, NULL); + v13 += GetMonData(v15, MON_DATA_CURRENT_HP, NULL); } } if (v13 == 0) { - param1->battlersSwitchingMask |= FlagIndex(v1); + param1->battlersSwitchingMask |= GetSingleBitMask(v1); param1->selectedPartySlot[v1] = 6; } else { param1->commandNext = v4; @@ -3973,7 +3973,7 @@ static BOOL BattleController_CheckBattleOver (BattleSystem * param0, BattleConte v7 = Party_GetPokemonBySlotIndex(v6, v4); if ((GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v5 += GetMonData(v7, MON_DATA_163, NULL); + v5 += GetMonData(v7, MON_DATA_CURRENT_HP, NULL); } } @@ -4001,7 +4001,7 @@ static BOOL BattleController_CheckBattleOver (BattleSystem * param0, BattleConte v13 = Party_GetPokemonBySlotIndex(v11, v9); if ((GetMonData(v13, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v13, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v10 += GetMonData(v13, MON_DATA_163, NULL); + v10 += GetMonData(v13, MON_DATA_CURRENT_HP, NULL); } } @@ -4009,7 +4009,7 @@ static BOOL BattleController_CheckBattleOver (BattleSystem * param0, BattleConte v13 = Party_GetPokemonBySlotIndex(v12, v9); if ((GetMonData(v13, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v13, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v10 += GetMonData(v13, MON_DATA_163, NULL); + v10 += GetMonData(v13, MON_DATA_CURRENT_HP, NULL); } } @@ -4038,7 +4038,7 @@ static BOOL BattleController_CheckBattleOver (BattleSystem * param0, BattleConte v18 = Party_GetPokemonBySlotIndex(v17, v15); if ((GetMonData(v18, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v18, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v16 += GetMonData(v18, MON_DATA_163, NULL); + v16 += GetMonData(v18, MON_DATA_CURRENT_HP, NULL); } } @@ -4120,7 +4120,7 @@ static BOOL BattleController_CheckRange (BattleSystem *battleSys, BattleContext if (battleType & 0x2) { if (*range == 0x100) { - if ((battleCtx->battlersSwitchingMask & FlagIndex(BattleSystem_Partner(battleSys, battler))) == 0) { + if ((battleCtx->battlersSwitchingMask & GetSingleBitMask(BattleSystem_Partner(battleSys, battler))) == 0) { return 1; } else { return 0; @@ -4161,16 +4161,16 @@ static BOOL BattleController_CheckAnyFainted (BattleContext * param0, int param1 int v1; v0 = 0; - v1 = FlagIndex(param0->monSpeedOrder[v0]) << 24; + v1 = GetSingleBitMask(param0->monSpeedOrder[v0]) << 24; if (param0->battleStatusMask & 0xf000000) { while ((param0->battleStatusMask & v1) == 0) { v0++; - v1 = FlagIndex(param0->monSpeedOrder[v0]) << 24; + v1 = GetSingleBitMask(param0->monSpeedOrder[v0]) << 24; } param0->battleStatusMask &= (v1 ^ 0xffffffff); - param0->faintedMon = sub_020787EC(v1 >> 24); + param0->faintedMon = GetLowestSetBitIndex(v1 >> 24); if (param3 == 1) { BattleSystem_LoadScript(param0, 1, (0 + 6)); @@ -4202,7 +4202,7 @@ static BOOL BattleController_CheckExpPayout (BattleContext * param0, int param1, } param0->battleStatusMask2 &= (v0 ^ 0xffffffff); - param0->faintedMon = sub_020787EC(v0 >> 28); + param0->faintedMon = GetLowestSetBitIndex(v0 >> 28); BattleSystem_LoadScript(param0, 1, (0 + 276)); diff --git a/src/overlay016/ov16_0223B140.c b/src/overlay016/ov16_0223B140.c index 5205d6b048..07d78da4c6 100644 --- a/src/overlay016/ov16_0223B140.c +++ b/src/overlay016/ov16_0223B140.c @@ -75,7 +75,7 @@ #include "unk_020366A0.h" #include "unk_02038F8C.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207A6DC.h" #include "unk_0207AE68.h" @@ -1134,8 +1134,8 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) for (v0 = 0; v0 < 4; v0++) { for (v1 = 0; v1 < Party_GetCurrentCount(param1->parties[v0]); v1++) { v3 = Party_GetPokemonBySlotIndex(param1->parties[v0], v1); - v5 = sub_02075D6C(v3); - sub_02074B30(v3, 111, &v5); + v5 = GetMonGender(v3); + SetMonData(v3, 111, &v5); } } } @@ -1166,7 +1166,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) for (v1 = 0; v1 < Party_GetCurrentCount(param0->parties[v0]); v1++) { v3 = Party_GetPokemonBySlotIndex(param0->parties[v0], v1); - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1193,7 +1193,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) for (v1 = 0; v1 < Party_GetCurrentCount(param0->parties[v0]); v1++) { v3 = Party_GetPokemonBySlotIndex(param0->parties[v0], v1); - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1221,11 +1221,11 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) v3 = Party_GetPokemonBySlotIndex(param0->parties[v0 & 1], v1); if (v0 > 1) { - if ((ov16_0225B45C(param0, param0->battleCtx, 2, v0 & 1) != v1) && (GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((ov16_0225B45C(param0, param0->battleCtx, 2, v0 & 1) != v1) && (GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } else { - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1249,7 +1249,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) for (v1 = 0; v1 < Party_GetCurrentCount(param0->parties[v0]); v1++) { v3 = Party_GetPokemonBySlotIndex(param0->parties[v0], v1); - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1281,11 +1281,11 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) v3 = ov16_0223DFAC(param0, v0, v1); if (v0 == 2) { - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL)) && (v8 != v1)) { + if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL)) && (v8 != v1)) { break; } } else { - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1318,7 +1318,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) for (v1 = 0; v1 < Party_GetCurrentCount(param0->parties[v0]); v1++) { v3 = Party_GetPokemonBySlotIndex(param0->parties[v0], v1); - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1347,11 +1347,11 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) v3 = Party_GetPokemonBySlotIndex(param0->parties[v0 & 1], v1); if (v0 > 1) { - if ((ov16_0225B45C(param0, param0->battleCtx, 2, v0 & 1) != v1) && (GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((ov16_0225B45C(param0, param0->battleCtx, 2, v0 & 1) != v1) && (GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } else { - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1378,7 +1378,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) for (v1 = 0; v1 < Party_GetCurrentCount(param0->parties[v0]); v1++) { v3 = Party_GetPokemonBySlotIndex(param0->parties[v0], v1); - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1603,7 +1603,7 @@ static void ov16_0223CF8C (UnkStruct_0201CD38 * param0, void * param1) if (v2 != NULL) { if (sub_0208C104(v2->unk_28, v2->unk_2C, (8 * 6)) == 1) { - v5 |= FlagIndex(v3); + v5 |= GetSingleBitMask(v3); } } } diff --git a/src/overlay016/ov16_0223DF00.c b/src/overlay016/ov16_0223DF00.c index 2c7f611acc..66524f62b5 100644 --- a/src/overlay016/ov16_0223DF00.c +++ b/src/overlay016/ov16_0223DF00.c @@ -63,7 +63,7 @@ #include "unk_0202F1D4.h" #include "unk_02056720.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079170.h" #include "party.h" #include "item.h" @@ -592,7 +592,7 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i if (v3 & 0x7) { v3 &= (0x7 ^ 0xffffffff); - sub_02074B30(v1, 160, &v3); + SetMonData(v1, 160, &v3); if ((v4 == param2) || (v5 == param2)) { v3 = ov16_02252060(v0, param1, 52, NULL); @@ -612,7 +612,7 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i if (v3 & 0xf88) { v3 &= ((0x8 | 0x80 | 0xf00) ^ 0xffffffff); - sub_02074B30(v1, 160, &v3); + SetMonData(v1, 160, &v3); if ((v4 == param2) || (v5 == param2)) { v3 = ov16_02252060(v0, param1, 52, NULL); @@ -629,7 +629,7 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i if (v3 & 0x10) { v3 &= (0x10 ^ 0xffffffff); - sub_02074B30(v1, 160, &v3); + SetMonData(v1, 160, &v3); if ((v4 == param2) || (v5 == param2)) { v3 = ov16_02252060(v0, param1, 52, NULL); @@ -646,7 +646,7 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i if (v3 & 0x20) { v3 &= (0x20 ^ 0xffffffff); - sub_02074B30(v1, 160, &v3); + SetMonData(v1, 160, &v3); if ((v4 == param2) || (v5 == param2)) { v3 = ov16_02252060(v0, param1, 52, NULL); @@ -663,7 +663,7 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i if (v3 & 0x40) { v3 &= (0x40 ^ 0xffffffff); - sub_02074B30(v1, 160, &v3); + SetMonData(v1, 160, &v3); if ((v4 == param2) || (v5 == param2)) { v3 = ov16_02252060(v0, param1, 52, NULL); @@ -780,11 +780,11 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i if (Item_LoadParam(param4, 36, 5)) { v3 = Item_LoadParam(param4, 55, 5); - if (GetMonData(v1, MON_DATA_58 + param3, NULL) != GetMonData(v1, MON_DATA_66 + param3, NULL)) { - sub_0207536C(v1, MON_DATA_58 + param3, v3); + if (GetMonData(v1, MON_DATA_MOVE1_PP + param3, NULL) != GetMonData(v1, MON_DATA_MOVE1_MAX_PP + param3, NULL)) { + IncreaseMonData(v1, MON_DATA_MOVE1_PP + param3, v3); if ((v4 == param2) || (v5 == param2)) { - if (((ov16_02252060(v0, param1, 53, NULL) & 0x200000) == 0) && ((ov16_02252060(v0, param1, 75, NULL) & FlagIndex(param3)) == 0)) { + if (((ov16_02252060(v0, param1, 53, NULL) & 0x200000) == 0) && ((ov16_02252060(v0, param1, 75, NULL) & GetSingleBitMask(param3)) == 0)) { ov16_02252A14(v0, param1, 31 + param3, v3); } } @@ -797,11 +797,11 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i v3 = Item_LoadParam(param4, 55, 5); for (param3 = 0; param3 < 4; param3++) { - if (GetMonData(v1, MON_DATA_58 + param3, NULL) != GetMonData(v1, MON_DATA_66 + param3, NULL)) { - sub_0207536C(v1, MON_DATA_58 + param3, v3); + if (GetMonData(v1, MON_DATA_MOVE1_PP + param3, NULL) != GetMonData(v1, MON_DATA_MOVE1_MAX_PP + param3, NULL)) { + IncreaseMonData(v1, MON_DATA_MOVE1_PP + param3, v3); if ((v4 == param2) || (v5 == param2)) { - if (((ov16_02252060(v0, param1, 53, NULL) & 0x200000) == 0) && ((ov16_02252060(v0, param1, 75, NULL) & FlagIndex(param3)) == 0)) { + if (((ov16_02252060(v0, param1, 53, NULL) & 0x200000) == 0) && ((ov16_02252060(v0, param1, 75, NULL) & GetSingleBitMask(param3)) == 0)) { ov16_02252A14(v0, param1, 31 + param3, v3); } } @@ -815,29 +815,29 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i v3 = 0; if (Item_LoadParam(param4, 23, 5)) { - if (GetMonData(v1, MON_DATA_163, NULL) == 0) { + if (GetMonData(v1, MON_DATA_CURRENT_HP, NULL) == 0) { v3 = 1; } } else { - v3 = GetMonData(v1, MON_DATA_163, NULL); + v3 = GetMonData(v1, MON_DATA_CURRENT_HP, NULL); } - if ((v3) && (GetMonData(v1, MON_DATA_163, NULL) != GetMonData(v1, MON_DATA_164, NULL))) { + if ((v3) && (GetMonData(v1, MON_DATA_CURRENT_HP, NULL) != GetMonData(v1, MON_DATA_MAX_HP, NULL))) { v3 = Item_LoadParam(param4, 54, 5); switch (v3) { case 255: - v3 = GetMonData(v1, MON_DATA_164, NULL); + v3 = GetMonData(v1, MON_DATA_MAX_HP, NULL); break; case 254: - v3 = GetMonData(v1, MON_DATA_164, NULL) / 2; + v3 = GetMonData(v1, MON_DATA_MAX_HP, NULL) / 2; if (v3 == 0) { v3 = 1; } break; case 253: - v3 = GetMonData(v1, MON_DATA_164, NULL) * 25 / 100; + v3 = GetMonData(v1, MON_DATA_MAX_HP, NULL) * 25 / 100; if (v3 == 0) { v3 = 1; @@ -847,7 +847,7 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i break; } - sub_0207536C(v1, MON_DATA_163, v3); + IncreaseMonData(v1, MON_DATA_CURRENT_HP, v3); if (!Item_LoadParam(param4, 23, 5)) { if (Battler_Side(param0, param1)) { @@ -898,7 +898,7 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i } } - sub_0207536C(v1, MON_DATA_FRIENDSHIP, v6); + IncreaseMonData(v1, MON_DATA_FRIENDSHIP, v6); if ((v4 == param2) || (v5 == param2)) { ov16_02252A14(v0, param1, 44, v6); @@ -957,13 +957,13 @@ u8 ov16_0223EC58 (BattleSystem * param0, int param1, u8 param2) if (((BattleSystem_BattlerSlot(param0, param1) == 4) && ((param0->battleType & 0x8) == 0))) { if (param0->battleType & 0x4) { - if ((param2 & FlagIndex(BattleSystem_Partner(param0, param1))) == 0) { + if ((param2 & GetSingleBitMask(BattleSystem_Partner(param0, param1))) == 0) { return 1; } } else { v0 = ov16_0225B45C(param0, param0->battleCtx, 12, 0) & 0xffff; - if (((ov16_0225B45C(param0, param0->battleCtx, 8, 0) == 14) && (v0 > 16)) || (param2 & FlagIndex(0))) { + if (((ov16_0225B45C(param0, param0->battleCtx, 8, 0) == 14) && (v0 > 16)) || (param2 & GetSingleBitMask(0))) { return 0; } else { return 1; @@ -987,8 +987,8 @@ u16 ov16_0223ECC4 (BattleParams * param0, int * param1, int * param2) while (param0->unk_150) { for (param1[0] = 0; param1[0] < 6; param1[0]++) { - if (param0->unk_150 & FlagIndex(param1[0])) { - param0->unk_150 &= (FlagIndex(param1[0]) ^ 0xffffffff); + if (param0->unk_150 & GetSingleBitMask(param1[0])) { + param0->unk_150 &= (GetSingleBitMask(param1[0]) ^ 0xffffffff); break; } } @@ -1089,7 +1089,7 @@ void ov16_0223EE70 (BattleSystem * param0) v2 = ov16_0223DFAC(param0, 0, v0); v3 = GetMonData(v2, MON_DATA_SPECIES_EGG, NULL); - if ((v3 == 412) && (param0->unk_2414[0] & FlagIndex(v0))) { + if ((v3 == 412) && (param0->unk_2414[0] & GetSingleBitMask(v0))) { switch (ov16_0223E22C(param0)) { default: case 2: @@ -1119,20 +1119,20 @@ void ov16_0223EE70 (BattleSystem * param0) break; } - sub_02074B30(v2, 112, &v1); + SetMonData(v2, 112, &v1); } } } void ov16_0223EF2C (BattleSystem * param0, int param1, int param2) { - param0->unk_2414[param1] |= FlagIndex(param2); + param0->unk_2414[param1] |= GetSingleBitMask(param2); } void ov16_0223EF48 (BattleSystem * param0, Pokemon * param1) { if (param0->unk_98) { - sub_02056A48(param0->unk_98, sub_02076B10(param1)); + sub_02056A48(param0->unk_98, GetBoxMon(param1)); } } @@ -1678,7 +1678,7 @@ u32 ov16_0223F904 (Party * param0, UnkStruct_02025E6C * param1) u8 v3; v3 = sub_02025F58(param1); - v1 = sub_02077550(param0) * 4 * v0[v3]; + v1 = GetPartyHighestLevel(param0) * 4 * v0[v3]; v2 = sub_02025F74(param1); if (v1 > v2) { diff --git a/src/overlay016/ov16_022405FC.c b/src/overlay016/ov16_022405FC.c index f62fc2bfcc..6186b3ec41 100644 --- a/src/overlay016/ov16_022405FC.c +++ b/src/overlay016/ov16_022405FC.c @@ -31,7 +31,7 @@ #include "struct_defs/struct_0201EE28.h" #include "struct_defs/struct_0205AA50.h" #include "struct_defs/pokemon.h" -#include "struct_defs/struct_02075874.h" +#include "struct_defs/pokemon_personal_data.h" #include "struct_defs/trainer_data.h" #include "struct_defs/battle_system.h" #include "struct_defs/struct_0208737C.h" @@ -70,7 +70,7 @@ #include "unk_02022594.h" #include "strbuf.h" #include "unk_02025E68.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "unk_02079170.h" #include "unk_020797C8.h" @@ -844,7 +844,7 @@ static BOOL ov16_02240A7C (BattleSystem * param0, BattleContext * param1) for (v0 = 0; v0 < v2; v0++) { v3 = BattleSystem_BattlerData(param0, v0); - if ((v3->unk_191 & 0x1) && ((param1->battlersSwitchingMask & FlagIndex(v0)) == 0)) { + if ((v3->unk_191 & 0x1) && ((param1->battlersSwitchingMask & GetSingleBitMask(v0)) == 0)) { ov16_02264EF8(param0, param1, v0); } } @@ -1306,7 +1306,7 @@ static BOOL ov16_02241288 (BattleSystem * param0, BattleContext * param1) for (v0 = 0; v0 < v2; v0++) { v3 = BattleSystem_BattlerData(param0, v0); - if (((v3->unk_191 & 0x1) == 0) && ((param1->battlersSwitchingMask & FlagIndex(v0)) == 0)) { + if (((v3->unk_191 & 0x1) == 0) && ((param1->battlersSwitchingMask & GetSingleBitMask(v0)) == 0)) { ov16_02265314(param0, v0); } } @@ -1618,7 +1618,7 @@ static BOOL ov16_022418C0 (BattleSystem * param0, BattleContext * param1) if (param1->battleMons[v1].curHP == 0) { param1->faintedMon = v1; - param1->battleStatusMask |= (FlagIndex(v1) << 24); + param1->battleStatusMask |= (GetSingleBitMask(v1) << 24); param1->totalFainted[v1]++; ov16_0224B850(param0, param1, v1); @@ -1632,8 +1632,8 @@ static BOOL ov16_02241924 (BattleSystem * param0, BattleContext * param1) ov16_02248AF0(param1, 1); ov16_02265D98(param0, param1, param1->faintedMon); - param1->battleStatusMask &= (FlagIndex(param1->faintedMon) << 24) ^ 0xffffffff; - param1->battleStatusMask2 |= FlagIndex(param1->faintedMon) << 28; + param1->battleStatusMask &= (GetSingleBitMask(param1->faintedMon) << 24) ^ 0xffffffff; + param1->battleStatusMask2 |= GetSingleBitMask(param1->faintedMon) << 28; param1->battlerActions[param1->faintedMon][0] = 39; ov16_02254744(param0, param1, param1->faintedMon); @@ -1917,8 +1917,8 @@ static BOOL ov16_02241D34 (BattleSystem * param0, BattleContext * param1) for (v3 = 0; v3 < Party_GetCurrentCount(ov16_0223DF20(param0, 0)); v3++) { v10 = ov16_0223DFAC(param0, 0, v3); - if ((GetMonData(v10, MON_DATA_SPECIES, NULL)) && (GetMonData(v10, MON_DATA_163, NULL))) { - if (param1->monsGainingExp[(param1->faintedMon >> 1) & 1] & FlagIndex(v3)) { + if ((GetMonData(v10, MON_DATA_SPECIES, NULL)) && (GetMonData(v10, MON_DATA_CURRENT_HP, NULL))) { + if (param1->monsGainingExp[(param1->faintedMon >> 1) & 1] & GetSingleBitMask(v3)) { v5++; } @@ -1931,7 +1931,7 @@ static BOOL ov16_02241D34 (BattleSystem * param0, BattleContext * param1) } } - v8 = sub_020759F0(param1->battleMons[param1->faintedMon].species, 9); + v8 = GetMonSpeciesPersonalDataAttribute(param1->battleMons[param1->faintedMon].species, 9); v8 = (v8 * param1->battleMons[param1->faintedMon].level) / 7; if (v6) { @@ -2013,7 +2013,7 @@ static BOOL ov16_02241F34 (BattleSystem * param0, BattleContext * param1) for (v0 = 0; v0 < v3; v0++) { if (param1->battlerStatusFlags[v0] & 0x1) { - v2 |= FlagIndex(v0); + v2 |= GetSingleBitMask(v0); BattleIO_ShowPartyScreen(param0, param1, v0, 1, 0, 6); } } @@ -2022,12 +2022,12 @@ static BOOL ov16_02241F34 (BattleSystem * param0, BattleContext * param1) if (BattleSystem_BattleType(param0) == ((0x4 | 0x1) | 0x2)) { v1 = BattleSystem_Partner(param0, v0); - if (((v2 & FlagIndex(v0)) == 0) && ((v2 & FlagIndex(v1)) == 0)) { - v2 |= FlagIndex(v0); + if (((v2 & GetSingleBitMask(v0)) == 0) && ((v2 & GetSingleBitMask(v1)) == 0)) { + v2 |= GetSingleBitMask(v0); BattleIO_LinkWaitMessage(param0, v0); } } else { - if ((v2 & FlagIndex(v0)) == 0) { + if ((v2 & GetSingleBitMask(v0)) == 0) { BattleIO_LinkWaitMessage(param0, v0); } } @@ -2063,8 +2063,8 @@ static BOOL ov16_0224200C (BattleSystem * param0, BattleContext * param1) param1->switchedPartySlot[v0] = param1->ioBuffer[v0][0] - 1; v2--; - if ((param1->battleStatusMask2 & (FlagIndex(v0) << 24)) == 0) { - param1->battleStatusMask2 |= (FlagIndex(v0) << 24); + if ((param1->battleStatusMask2 & (GetSingleBitMask(v0) << 24)) == 0) { + param1->battleStatusMask2 |= (GetSingleBitMask(v0) << 24); BattleIO_LinkWaitMessage(param0, v0); } } @@ -2109,7 +2109,7 @@ static BOOL ov16_02242134 (BattleSystem * param0, BattleContext * param1) } param1->battlerStatusFlags[v0] &= 0x1 ^ 0xffffffff; - param1->battlersSwitchingMask &= (FlagIndex(v0) ^ 0xffffffff); + param1->battlersSwitchingMask &= (GetSingleBitMask(v0) ^ 0xffffffff); param1->selectedPartySlot[v0] = param1->switchedPartySlot[v0]; param1->switchedPartySlot[v0] = 6; @@ -2251,7 +2251,7 @@ static BOOL ov16_0224230C (BattleSystem * param0, BattleContext * param1) v3[0] = v4; break; case ((6 + 1) + 9): - v3[0] = FlagIndex(v2); + v3[0] = GetSingleBitMask(v2); break; case ((6 + 1) + 10): GF_ASSERT(0); @@ -2516,7 +2516,7 @@ static BOOL ov16_02242A14 (BattleSystem * param0, BattleContext * param1) v5 = v6; break; case ((6 + 1) + 9): - v5 = FlagIndex(v3); + v5 = GetSingleBitMask(v3); break; case ((6 + 1) + 10): GF_ASSERT(0); @@ -2701,7 +2701,7 @@ static BOOL ov16_02242CA4 (BattleSystem * param0, BattleContext * param1) v3[0] = v5; break; case ((6 + 1) + 9): - v3[0] = FlagIndex(v4[0]); + v3[0] = GetSingleBitMask(v4[0]); break; case ((6 + 1) + 10): v4[0] = v3[0]; @@ -2779,7 +2779,7 @@ static BOOL ov16_02242DBC (BattleSystem * param0, BattleContext * param1) v5 = v7; break; case ((6 + 1) + 9): - v5 = FlagIndex(v6[0]); + v5 = GetSingleBitMask(v6[0]); break; case ((6 + 1) + 10): v6[0] = v5; @@ -3765,7 +3765,7 @@ static BOOL ov16_02243DBC (BattleSystem * param0, BattleContext * param1) param1->battleMons[param1->attacker].ppCur[v2] = 5; } - param1->battleMons[param1->attacker].moveEffectsData.mimickedMoveSlot |= FlagIndex(v2); + param1->battleMons[param1->attacker].moveEffectsData.mimickedMoveSlot |= GetSingleBitMask(v2); if (param1->msgMoveTemp == 387) { param1->battleMons[param1->attacker].moveEffectsData.lastResortCount = 0; @@ -4045,7 +4045,7 @@ static BOOL ov16_022445D4 (BattleSystem * param0, BattleContext * param1) for (v0 = 0; v0 < 4; v0++) { if ((ov16_02255918(param1->battleMons[param1->attacker].moves[v0])) || (param1->battleMons[param1->attacker].moves[v0] == 264) || (param1->battleMons[param1->attacker].moves[v0] == 253) || (param1->battleMons[param1->attacker].moves[v0] == 448) || (ov16_0225582C(param1, param1->battleMons[param1->attacker].moves[v0]))) { - v1 |= FlagIndex(v0); + v1 |= GetSingleBitMask(v0); } } @@ -4056,7 +4056,7 @@ static BOOL ov16_022445D4 (BattleSystem * param0, BattleContext * param1) } else { do { v0 = BattleSystem_RandNext(param0) % 4; - } while ((v1 & FlagIndex(v0))); + } while ((v1 & GetSingleBitMask(v0))); param1->msgMoveTemp = param1->battleMons[param1->attacker].moves[v0]; } @@ -4149,7 +4149,7 @@ static BOOL ov16_02244798 (BattleSystem * param0, BattleContext * param1) if (v0 & 0x2) { v1 = ov16_0224A984(param0, param1, 0x10); - if ((param1->battlersSwitchingMask & FlagIndex(v1)) == 0) { + if ((param1->battlersSwitchingMask & GetSingleBitMask(v1)) == 0) { if (ov16_02255AB4(param1, param1->attacker, v1, 43) == 0) { param1->battleMons[v1].status = 0; param1->battleMons[v1].statusVolatile &= (0x8000000 ^ 0xffffffff); @@ -4168,7 +4168,7 @@ static BOOL ov16_02244798 (BattleSystem * param0, BattleContext * param1) if (v0 & 0x2) { v1 = ov16_0224A984(param0, param1, 0x10); - if ((param1->battlersSwitchingMask & FlagIndex(v1)) == 0) { + if ((param1->battlersSwitchingMask & GetSingleBitMask(v1)) == 0) { param1->battleMons[v1].status = 0; param1->battleMons[v1].statusVolatile &= (0x8000000 ^ 0xffffffff); } @@ -4198,7 +4198,7 @@ static BOOL ov16_022448E8 (BattleSystem * param0, BattleContext * param1) if ((Battler_Side(param0, param1->attacker)) && ((v2 & (0x4 | 0x80)) == 0)) { ov16_02248AF0(param1, v0); - } else if (param1->sideConditions[v3].knockedOffItemsMask & FlagIndex(param1->selectedPartySlot[param1->attacker])) { + } else if (param1->sideConditions[v3].knockedOffItemsMask & GetSingleBitMask(param1->selectedPartySlot[param1->attacker])) { ov16_02248AF0(param1, v0); } else if ((Battler_Ability(param1, param1->attacker) == 121) || (Battler_Ability(param1, param1->defender) == 121)) { ov16_02248AF0(param1, v0); @@ -4336,7 +4336,7 @@ static BOOL ov16_02244BC4 (BattleSystem * param0, BattleContext * param1) for (v7 = v8; v7 < v9; v7++) { v3 = Party_GetPokemonBySlotIndex(v2, v7); - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_163, NULL))) { + if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { v5++; } } @@ -4352,7 +4352,7 @@ static BOOL ov16_02244BC4 (BattleSystem * param0, BattleContext * param1) } while ((v7 == v11) || (v7 == v12)); v3 = Party_GetPokemonBySlotIndex(v2, v7); - } while ((GetMonData(v3, MON_DATA_SPECIES, NULL) == 0) || (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 1) || (GetMonData(v3, MON_DATA_163, NULL) == 0)); + } while ((GetMonData(v3, MON_DATA_SPECIES, NULL) == 0) || (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 1) || (GetMonData(v3, MON_DATA_CURRENT_HP, NULL) == 0)); param1->switchedPartySlot[param1->defender] = v7; } else { @@ -4671,7 +4671,7 @@ static BOOL ov16_022455F8 (BattleSystem * param0, BattleContext * param1) if ((param1->battleMons[param1->msgBattlerTemp].gender == param1->battleMons[param1->sideEffectMon].gender) || (param1->battleMons[param1->sideEffectMon].statusVolatile & 0xf0000) || (param1->battleMons[param1->msgBattlerTemp].gender == 2) || (param1->battleMons[param1->sideEffectMon].gender == 2)) { ov16_02248AF0(param1, v0); } else { - param1->battleMons[param1->sideEffectMon].statusVolatile |= FlagIndex(param1->msgBattlerTemp) << 16; + param1->battleMons[param1->sideEffectMon].statusVolatile |= GetSingleBitMask(param1->msgBattlerTemp) << 16; } return 0; @@ -4979,7 +4979,7 @@ static BOOL ov16_02245D68 (BattleSystem * param0, BattleContext * param1) while (TRUE) { v5 = ov16_0223DFAC(param0, param1->attacker, param1->beatUpCounter); - if ((param1->beatUpCounter == param1->selectedPartySlot[param1->attacker]) || ((GetMonData(v5, MON_DATA_163, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 494) && (GetMonData(v5, MON_DATA_160, NULL) == 0))) { + if ((param1->beatUpCounter == param1->selectedPartySlot[param1->attacker]) || ((GetMonData(v5, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 494) && (GetMonData(v5, MON_DATA_160, NULL) == 0))) { break; } @@ -4990,12 +4990,12 @@ static BOOL ov16_02245D68 (BattleSystem * param0, BattleContext * param1) v5 = ov16_0223DFAC(param0, param1->attacker, param1->beatUpCounter); v2 = GetMonData(v5, MON_DATA_SPECIES, NULL); v3 = GetMonData(v5, MON_DATA_FORM, NULL); - v4 = GetMonData(v5, MON_DATA_161, NULL); + v4 = GetMonData(v5, MON_DATA_LEVEL, NULL); - param1->damage = sub_020759CC(v2, v3, 1); + param1->damage = GetMonFormPersonalDataAttribute(v2, v3, 1); param1->damage *= param1->aiContext.moveTable[param1->moveCur].power; param1->damage *= ((v4 * 2 / 5) + 2); - param1->damage /= sub_020759CC(param1->battleMons[param1->defender].species, param1->battleMons[param1->defender].formNum, 2); + param1->damage /= GetMonFormPersonalDataAttribute(param1->battleMons[param1->defender].species, param1->battleMons[param1->defender].formNum, 2); param1->damage /= 50; param1->damage += 2; param1->damage *= param1->criticalMul; @@ -5016,7 +5016,7 @@ static BOOL ov16_02245D68 (BattleSystem * param0, BattleContext * param1) while (TRUE) { v5 = ov16_0223DFAC(param0, param1->attacker, param1->beatUpCounter); - if ((param1->beatUpCounter == param1->selectedPartySlot[param1->attacker]) || ((GetMonData(v5, MON_DATA_163, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 494) && (GetMonData(v5, MON_DATA_160, NULL) == 0))) { + if ((param1->beatUpCounter == param1->selectedPartySlot[param1->attacker]) || ((GetMonData(v5, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 494) && (GetMonData(v5, MON_DATA_160, NULL) == 0))) { break; } @@ -5062,7 +5062,7 @@ static BOOL ov16_02246004 (BattleSystem * param0, BattleContext * param1) if (v2 & 0x2) { v1 = ov16_0224A984(param0, param1, 0x10); - if (((param1->battlersSwitchingMask & FlagIndex(v1)) == 0) && (param1->battlerActions[v1][0] != 39) && (param1->battleMons[v1].curHP) && (param1->turnFlags[param1->attacker].helpingHand == 0) && (param1->turnFlags[v1].helpingHand == 0)) { + if (((param1->battlersSwitchingMask & GetSingleBitMask(v1)) == 0) && (param1->battlerActions[v1][0] != 39) && (param1->battleMons[v1].curHP) && (param1->turnFlags[param1->attacker].helpingHand == 0) && (param1->turnFlags[v1].helpingHand == 0)) { param1->msgBattlerTemp = v1; param1->turnFlags[v1].helpingHand = 1; } else { @@ -5093,7 +5093,7 @@ static BOOL ov16_022460A8 (BattleSystem * param0, BattleContext * param1) if ((Battler_Side(param0, param1->attacker)) && ((v2 & (0x4 | 0x80)) == 0)) { ov16_02248AF0(param1, v0); - } else if ((param1->sideConditions[v3].knockedOffItemsMask & FlagIndex(param1->selectedPartySlot[param1->attacker])) || (param1->sideConditions[v4].knockedOffItemsMask & FlagIndex(param1->selectedPartySlot[param1->defender]))) { + } else if ((param1->sideConditions[v3].knockedOffItemsMask & GetSingleBitMask(param1->selectedPartySlot[param1->attacker])) || (param1->sideConditions[v4].knockedOffItemsMask & GetSingleBitMask(param1->selectedPartySlot[param1->defender]))) { ov16_02248AF0(param1, v0); } else if (((param1->battleMons[param1->attacker].heldItem == 0) && (param1->battleMons[param1->defender].heldItem == 0)) || (ov16_022559DC(param1, param1->attacker) == 0) || (ov16_022559DC(param1, param1->defender) == 0)) { ov16_02248AF0(param1, v0); @@ -5229,7 +5229,7 @@ static BOOL ov16_022463E8 (BattleSystem * param0, BattleContext * param1) { ov16_02248AF0(param1, 1); - if (((param1->turnFlags[param1->attacker].physicalDamageTakenFrom[param1->defender]) && (param1->turnFlags[param1->attacker].physicalDamageAttackerMask & FlagIndex(param1->defender))) || ((param1->turnFlags[param1->attacker].specialDamageTakenFrom[param1->defender]) && (param1->turnFlags[param1->attacker].specialDamageAttackerMask & FlagIndex(param1->defender)))) { + if (((param1->turnFlags[param1->attacker].physicalDamageTakenFrom[param1->defender]) && (param1->turnFlags[param1->attacker].physicalDamageAttackerMask & GetSingleBitMask(param1->defender))) || ((param1->turnFlags[param1->attacker].specialDamageTakenFrom[param1->defender]) && (param1->turnFlags[param1->attacker].specialDamageAttackerMask & GetSingleBitMask(param1->defender)))) { param1->powerMul = 20; } else { param1->powerMul = 10; @@ -5300,7 +5300,7 @@ static BOOL ov16_0224650C (BattleSystem * param0, BattleContext * param1) param1->msgBuffer.params[1] = BattleSystem_NicknameTag(param1, param1->defender); param1->msgBuffer.params[2] = param1->battleMons[param1->defender].heldItem; param1->battleMons[param1->defender].heldItem = 0; - param1->sideConditions[v1].knockedOffItemsMask |= FlagIndex(param1->selectedPartySlot[param1->defender]); + param1->sideConditions[v1].knockedOffItemsMask |= GetSingleBitMask(param1->selectedPartySlot[param1->defender]); } else { ov16_02248AF0(param1, v0); } @@ -6204,11 +6204,11 @@ static BOOL ov16_022476F8 (BattleSystem * param0, BattleContext * param1) v8 = ov16_0223DFAC(param0, 0, v1); v4 = GetMonData(v8, MON_DATA_SPECIES_EGG, NULL); v5 = GetMonData(v8, MON_DATA_HELD_ITEM, NULL); - v6 = GetMonData(v8, MON_DATA_10, NULL); + v6 = GetMonData(v8, MON_DATA_ABILITY, NULL); if ((v6 == 53) && (v4 != 0) && (v4 != 494) && (v5 == 0) && ((BattleSystem_RandNext(param0) % 10) == 0)) { v0 = BattleSystem_RandNext(param0) % 100; - v7 = (GetMonData(v8, MON_DATA_161, NULL) - 1) / 10; + v7 = (GetMonData(v8, MON_DATA_LEVEL, NULL) - 1) / 10; if (v7 >= 10) { v7 = 9; @@ -6216,10 +6216,10 @@ static BOOL ov16_022476F8 (BattleSystem * param0, BattleContext * param1) for (v2 = 0; v2 < 9; v2++) { if (Unk_ov16_0226EAA8[v2] > v0) { - sub_02074B30(v8, 6, (u8 *)&Unk_ov16_0226E66C[v7 + v2]); + SetMonData(v8, 6, (u8 *)&Unk_ov16_0226E66C[v7 + v2]); break; } else if ((v0 >= 98) && (v0 <= 99)) { - sub_02074B30(v8, 6, (u8 *)&Unk_ov16_0226E590[v7 + (99 - v0)]); + SetMonData(v8, 6, (u8 *)&Unk_ov16_0226E590[v7 + (99 - v0)]); break; } } @@ -6228,7 +6228,7 @@ static BOOL ov16_022476F8 (BattleSystem * param0, BattleContext * param1) if ((v6 == 118) && (v4 != 0) && (v4 != 494) && (v5 == 0)) { v2 = 0; v3 = 10; - v7 = GetMonData(v8, MON_DATA_161, NULL); + v7 = GetMonData(v8, MON_DATA_LEVEL, NULL); while (v7 > v3) { v2++; @@ -6239,7 +6239,7 @@ static BOOL ov16_022476F8 (BattleSystem * param0, BattleContext * param1) if (BattleSystem_RandNext(param0) % 100 < Unk_ov16_0226EAB4[v2]) { v2 = 94; - sub_02074B30(v8, 6, (u8 *)&v2); + SetMonData(v8, 6, (u8 *)&v2); } } } @@ -7044,7 +7044,7 @@ static BOOL ov16_02248324 (BattleSystem * param0, BattleContext * param1) v6 = Party_GetPokemonBySlotIndex(v8, v3); if ((GetMonData(v6, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v6, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v4 += GetMonData(v6, MON_DATA_163, NULL); + v4 += GetMonData(v6, MON_DATA_CURRENT_HP, NULL); } } @@ -7055,7 +7055,7 @@ static BOOL ov16_02248324 (BattleSystem * param0, BattleContext * param1) v6 = Party_GetPokemonBySlotIndex(v9, v3); if ((GetMonData(v6, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v6, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v4 += GetMonData(v6, MON_DATA_163, NULL); + v4 += GetMonData(v6, MON_DATA_CURRENT_HP, NULL); } } } @@ -7075,7 +7075,7 @@ static BOOL ov16_02248324 (BattleSystem * param0, BattleContext * param1) v6 = Party_GetPokemonBySlotIndex(v10, v3); if ((GetMonData(v6, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v6, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v4 += GetMonData(v6, MON_DATA_163, NULL); + v4 += GetMonData(v6, MON_DATA_CURRENT_HP, NULL); } } @@ -7240,7 +7240,7 @@ static BOOL ov16_02248708 (BattleSystem * param0, BattleContext * param1) if ((param1->battleMons[v1].curHP) && (param1->selectedPartySlot[v1] != 6)) { v3 = ov16_0223DFAC(param0, v1, param1->selectedPartySlot[v1]); - v4 = GetMonData(v3, MON_DATA_10, NULL); + v4 = GetMonData(v3, MON_DATA_ABILITY, NULL); v5 = GetMonData(v3, MON_DATA_160, NULL); if ((param1->battleMons[v1].ability != 30) && (ov16_022577A4(param1, v4, v5) == 0)) { @@ -7441,7 +7441,7 @@ static BOOL ov16_02248A34 (BattleSystem * param0, BattleContext * param1) v2 = ov16_02248AD0(param1); v3 = ov16_02248B10(param0, param1, v1); - param1->calcTemp = sub_020759CC(v0, v3[0], v2); + param1->calcTemp = GetMonFormPersonalDataAttribute(v0, v3[0], v2); return 0; } @@ -7666,7 +7666,7 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) v9 = GetMonData(v3, MON_DATA_HELD_ITEM, NULL); v10 = Item_LoadParam(v9, 1, 5); - if ((v10 == 51) || (v2->unk_04->monsGainingExp[v5] & FlagIndex(v1))) { + if ((v10 == 51) || (v2->unk_04->monsGainingExp[v5] & GetSingleBitMask(v1))) { break; } } @@ -7688,7 +7688,7 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) v9 = GetMonData(v3, MON_DATA_HELD_ITEM, NULL); v10 = Item_LoadParam(v9, 1, 5); - if (((v8 & 0x1) == 0) && ((v2->unk_04->battleMons[1].curHP + v2->unk_04->battleMons[3].curHP) == 0) && (GetMonData(v3, MON_DATA_163, NULL)) && (v2->unk_04->expJinglePlayed == 0)) { + if (((v8 & 0x1) == 0) && ((v2->unk_04->battleMons[1].curHP + v2->unk_04->battleMons[3].curHP) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL)) && (v2->unk_04->expJinglePlayed == 0)) { sub_0200549C(1127); v2->unk_04->expJinglePlayed = 1; ov16_0223F460(v2->unk_00, 2); @@ -7697,8 +7697,8 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) v11 = 0; v4.id = 1; - if ((GetMonData(v3, MON_DATA_163, NULL)) && (GetMonData(v3, MON_DATA_161, NULL) != 100)) { - if (v2->unk_04->monsGainingExp[v5] & FlagIndex(v1)) { + if ((GetMonData(v3, MON_DATA_CURRENT_HP, NULL)) && (GetMonData(v3, MON_DATA_LEVEL, NULL) != 100)) { + if (v2->unk_04->monsGainingExp[v5] & GetSingleBitMask(v1)) { v11 = v2->unk_04->gainedExp; } @@ -7725,14 +7725,14 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) } v12 = GetMonData(v3, MON_DATA_EXP, NULL); - v2->unk_30[3] = v12 - sub_02075AAC(v3); + v2->unk_30[3] = v12 - GetMonCurrentLevelExp(v3); v12 += v11; if (v1 == v2->unk_04->selectedPartySlot[v6]) { v2->unk_04->battleMons[v6].exp = v12; } - sub_02074B30(v3, 8, (u8 *)&v12); + SetMonData(v3, 8, (u8 *)&v12); ov16_022499C0(ov16_0223DF20(v2->unk_00, v6), v1, v2->unk_04->battleMons[v2->unk_04->faintedMon].species, v2->unk_04->battleMons[v2->unk_04->faintedMon].formNum); } @@ -7791,7 +7791,7 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) int v14[6] = {164, 165, 166, 168, 169, 167}; UnkStruct_ov16_02248E74 * v15; - v13 = GetMonData(v3, MON_DATA_161, NULL); + v13 = GetMonData(v3, MON_DATA_LEVEL, NULL); v2->unk_04->unk_17C = Heap_AllocFromHeap(5, sizeof(UnkStruct_ov16_02248E74)); v15 = (UnkStruct_ov16_02248E74 *)v2->unk_04->unk_17C; @@ -7800,13 +7800,13 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) } sub_02075C74(v3, 0, ov16_0223E24C(v2->unk_00)); - sub_020741B8(v3); + CalculateMonStats(v3); if (v2->unk_04->selectedPartySlot[v6] == v1) { ov16_02251C94(v2->unk_00, v2->unk_04, v6, v2->unk_04->selectedPartySlot[v6]); } - v2->unk_04->levelUpMons |= FlagIndex(v1); + v2->unk_04->levelUpMons |= GetSingleBitMask(v1); ov16_022661CC(v2->unk_00, v2->unk_04, v6); v4.id = 3; @@ -8083,8 +8083,8 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) v2->unk_30[0] = ov16_0223FB24(v2->unk_00, v7, &v4, ov16_0223EDF0(v2->unk_00)); v0 = 0; - sub_02074B30(v3, 62 + v2->unk_30[5], &v0); - sub_02077230(v3, v2->unk_30[4], v2->unk_30[5]); + SetMonData(v3, 62 + v2->unk_30[5], &v0); + SetMonMove(v3, v2->unk_30[4], v2->unk_30[5]); if (v2->unk_04->selectedPartySlot[v6] == v1) { ov16_02251C94(v2->unk_00, v2->unk_04, v6, v2->unk_04->selectedPartySlot[v6]); @@ -8098,7 +8098,7 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) } break; case 37: - v2->unk_04->monsGainingExp[v5] &= (FlagIndex(v1) ^ 0xffffffff); + v2->unk_04->monsGainingExp[v5] &= (GetSingleBitMask(v1) ^ 0xffffffff); v2->unk_30[6] = v1 + 1; v2->unk_28 = 0; break; @@ -8120,9 +8120,9 @@ static void ov16_022499C0 (Party * param0, int param1, int param2, int param3) int v5; int v6; Pokemon * v7; - UnkStruct_02075874 * v8; + PokemonPersonalData * v8; - v8 = sub_02075874(param2, param3, 5); + v8 = GetMonFormPersonalData(param2, param3, 5); v7 = Party_GetPokemonBySlotIndex(param0, param1); v4 = GetMonData(v7, MON_DATA_HELD_ITEM, NULL); v5 = Item_LoadParam(v4, 1, 5); @@ -8141,42 +8141,42 @@ static void ov16_022499C0 (Party * param0, int param1, int param2, int param3) switch (v0) { case 0: - v1 = sub_020758B0(v8, 10); + v1 = GetMonPersonalDataAttribute(v8, 10); if (v5 == 122) { v1 += v6; } break; case 1: - v1 = sub_020758B0(v8, 11); + v1 = GetMonPersonalDataAttribute(v8, 11); if (v5 == 117) { v1 += v6; } break; case 2: - v1 = sub_020758B0(v8, 12); + v1 = GetMonPersonalDataAttribute(v8, 12); if (v5 == 118) { v1 += v6; } break; case 3: - v1 = sub_020758B0(v8, 13); + v1 = GetMonPersonalDataAttribute(v8, 13); if (v5 == 121) { v1 += v6; } break; case 4: - v1 = sub_020758B0(v8, 14); + v1 = GetMonPersonalDataAttribute(v8, 14); if (v5 == 119) { v1 += v6; } break; case 5: - v1 = sub_020758B0(v8, 15); + v1 = GetMonPersonalDataAttribute(v8, 15); if (v5 == 120) { v1 += v6; @@ -8184,7 +8184,7 @@ static void ov16_022499C0 (Party * param0, int param1, int param2, int param3) break; } - if (sub_02077758(param0, FlagIndex(param1))) { + if (sub_02077758(param0, GetSingleBitMask(param1))) { v1 = v1 * 2; } @@ -8202,10 +8202,10 @@ static void ov16_022499C0 (Party * param0, int param1, int param2, int param3) v2[v0] += v1; v3 += v1; - sub_02074B30(v7, 13 + v0, (u8 *)&v2[v0]); + SetMonData(v7, 13 + v0, (u8 *)&v2[v0]); } - sub_020759B8(v8); + FreeMonPersonalData(v8); } static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) @@ -8223,7 +8223,7 @@ static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) v5 = ov16_0223E000(v2->unk_00); v1 = 1; - if (v2->unk_04->battlersSwitchingMask & FlagIndex(v1)) { + if (v2->unk_04->battlersSwitchingMask & GetSingleBitMask(v1)) { v1 = 3; } @@ -8552,7 +8552,7 @@ static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) v16->unk_08 = GetMonData(v3, MON_DATA_FORM, NULL); v16->unk_48 = ov16_0223E228(v2->unk_00); - v16->unk_10 = GetMonData(v3, MON_DATA_111, NULL); + v16->unk_10 = GetMonData(v3, MON_DATA_GENDER, NULL); v2->unk_50[0] = sub_020067E8(&Unk_020F2DAC, v16, 5); v2->unk_28 = 21; @@ -8587,7 +8587,7 @@ static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) v3 = ov16_0223DFAC(v2->unk_00, v1, v2->unk_04->selectedPartySlot[v1]); if (v19->unk_14 == 0) { - sub_02074B30(v3, 120, v19->unk_18); + SetMonData(v3, 120, v19->unk_18); ov16_0223F24C(v2->unk_00, (1 + 48)); } @@ -8640,15 +8640,15 @@ static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) sub_02079A94(v24, v26); for (v27 = 0; v27 < 4; v27++) { - v28 = GetMonData(v3, MON_DATA_66 + v27, NULL); - sub_02074B30(v3, 58 + v27, &v28); + v28 = GetMonData(v3, MON_DATA_MOVE1_MAX_PP + v27, NULL); + SetMonData(v3, 58 + v27, &v28); } - if (sub_02077A00(v3) != -1) { + if (SetGiratinaForm(v3) != -1) { ov16_0223F9A0(v2->unk_00, v1); } - sub_020798A0(v24, v26, sub_02076B10(v3)); + sub_020798A0(v24, v26, GetBoxMon(v3)); if (v2->unk_28 == 22) { if (v25 == v26) { @@ -8816,10 +8816,10 @@ static int ov16_0224A724 (BattleSystem * param0, BattleContext * param1) } if (param1->msgItemTemp == 5) { - v3 = sub_020759F0(param1->battleMons[param1->defender].species, 8); + v3 = GetMonSpeciesPersonalDataAttribute(param1->battleMons[param1->defender].species, 8); v3 = v3 * Unk_ov16_0226E638[param1->safariCatchCount][0] / Unk_ov16_0226E638[param1->safariCatchCount][1]; } else { - v3 = sub_020759F0(param1->battleMons[param1->defender].species, 8); + v3 = GetMonSpeciesPersonalDataAttribute(param1->battleMons[param1->defender].species, 8); } v4 = 10; @@ -9774,7 +9774,7 @@ static void ov16_0224B520 (BattleSystem * param0, UnkStruct_ov16_0224B7CC * para if (GetMonData(param2, MON_DATA_176, NULL) == 0) { v13 = 2; } else { - v13 = GetMonData(param2, MON_DATA_111, NULL); + v13 = GetMonData(param2, MON_DATA_GENDER, NULL); } if (v13 == 0) { @@ -9785,8 +9785,8 @@ static void ov16_0224B520 (BattleSystem * param0, UnkStruct_ov16_0224B7CC * para v6 = MessageLoader_GetNewStrbuf(v4, 946); } - sub_0200B5CC(v5, 0, sub_02076B10(param2)); - sub_0200B60C(v5, 1, GetMonData(param2, MON_DATA_161, NULL), 3, 0, 1); + sub_0200B5CC(v5, 0, GetBoxMon(param2)); + sub_0200B60C(v5, 1, GetMonData(param2, MON_DATA_LEVEL, NULL), 3, 0, 1); sub_0200C388(v5, v7, v6); Strbuf_Free(v6); sub_0201A7A0(&v9); diff --git a/src/overlay016/ov16_0225177C.c b/src/overlay016/ov16_0225177C.c index 978c94c62d..da34fd0b12 100644 --- a/src/overlay016/ov16_0225177C.c +++ b/src/overlay016/ov16_0225177C.c @@ -22,7 +22,7 @@ #include "strbuf.h" #include "unk_02025E68.h" #include "unk_020366A0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "unk_02079170.h" #include "party.h" @@ -192,16 +192,16 @@ void BattleSystem_InitBattleMon (BattleSystem *battleSys, BattleContext *battleC UnkStruct_02098700 * v3; battleCtx->battleMons[battler].species = GetMonData(v0, MON_DATA_SPECIES, 0); - battleCtx->battleMons[battler].attack = GetMonData(v0, MON_DATA_165, 0); - battleCtx->battleMons[battler].defense = GetMonData(v0, MON_DATA_166, 0); - battleCtx->battleMons[battler].speed = GetMonData(v0, MON_DATA_167, 0); - battleCtx->battleMons[battler].spAttack = GetMonData(v0, MON_DATA_168, 0); - battleCtx->battleMons[battler].spDefense = GetMonData(v0, MON_DATA_169, 0); + battleCtx->battleMons[battler].attack = GetMonData(v0, MON_DATA_ATK, 0); + battleCtx->battleMons[battler].defense = GetMonData(v0, MON_DATA_DEF, 0); + battleCtx->battleMons[battler].speed = GetMonData(v0, MON_DATA_SPEED, 0); + battleCtx->battleMons[battler].spAttack = GetMonData(v0, MON_DATA_SP_ATK, 0); + battleCtx->battleMons[battler].spDefense = GetMonData(v0, MON_DATA_SP_DEF, 0); for (v1 = 0; v1 < 4; v1++) { battleCtx->battleMons[battler].moves[v1] = GetMonData(v0, MON_DATA_MOVE1 + v1, 0); - battleCtx->battleMons[battler].ppCur[v1] = GetMonData(v0, MON_DATA_58 + v1, 0); - battleCtx->battleMons[battler].ppUps[v1] = GetMonData(v0, MON_DATA_62 + v1, 0); + battleCtx->battleMons[battler].ppCur[v1] = GetMonData(v0, MON_DATA_MOVE1_PP + v1, 0); + battleCtx->battleMons[battler].ppUps[v1] = GetMonData(v0, MON_DATA_MOVE1_PP_UPS + v1, 0); } battleCtx->battleMons[battler].hpIV = GetMonData(v0, MON_DATA_HP_IV, 0); @@ -232,15 +232,15 @@ void BattleSystem_InitBattleMon (BattleSystem *battleSys, BattleContext *battleC battleCtx->battleMons[battler].pressureAnnounced = 0; battleCtx->battleMons[battler].type1 = GetMonData(v0, MON_DATA_177, 0); battleCtx->battleMons[battler].type2 = GetMonData(v0, MON_DATA_178, 0); - battleCtx->battleMons[battler].gender = sub_02075D6C(v0); - battleCtx->battleMons[battler].isShiny = sub_02075E0C(v0); + battleCtx->battleMons[battler].gender = GetMonGender(v0); + battleCtx->battleMons[battler].isShiny = GetMonShininess(v0); if (BattleSystem_BattleType(battleSys) & (0x20 | 0x200)) { battleCtx->battleMons[battler].ability = 0; battleCtx->battleMons[battler].status = 0; battleCtx->battleMons[battler].heldItem = 0; } else { - battleCtx->battleMons[battler].ability = GetMonData(v0, MON_DATA_10, 0); + battleCtx->battleMons[battler].ability = GetMonData(v0, MON_DATA_ABILITY, 0); battleCtx->battleMons[battler].status = GetMonData(v0, MON_DATA_160, 0); battleCtx->battleMons[battler].heldItem = GetMonData(v0, MON_DATA_HELD_ITEM, 0); } @@ -251,10 +251,10 @@ void BattleSystem_InitBattleMon (BattleSystem *battleSys, BattleContext *battleC battleCtx->battleMons[battler].formNum = GetMonData(v0, MON_DATA_FORM, 0); } - battleCtx->battleMons[battler].level = GetMonData(v0, MON_DATA_161, 0); + battleCtx->battleMons[battler].level = GetMonData(v0, MON_DATA_LEVEL, 0); battleCtx->battleMons[battler].friendship = GetMonData(v0, MON_DATA_FRIENDSHIP, 0); - battleCtx->battleMons[battler].curHP = GetMonData(v0, MON_DATA_163, 0); - battleCtx->battleMons[battler].maxHP = GetMonData(v0, MON_DATA_164, 0); + battleCtx->battleMons[battler].curHP = GetMonData(v0, MON_DATA_CURRENT_HP, 0); + battleCtx->battleMons[battler].maxHP = GetMonData(v0, MON_DATA_MAX_HP, 0); battleCtx->battleMons[battler].exp = GetMonData(v0, MON_DATA_EXP, 0); battleCtx->battleMons[battler].pid = GetMonData(v0, MON_DATA_PERSONALITY, 0); battleCtx->battleMons[battler].OTId = GetMonData(v0, MON_DATA_OT_ID, 0); @@ -277,7 +277,7 @@ void BattleSystem_InitBattleMon (BattleSystem *battleSys, BattleContext *battleC v2 = Battler_Side(battleSys, battler); - if (battleCtx->sideConditions[v2].knockedOffItemsMask & FlagIndex(battleCtx->selectedPartySlot[battler])) { + if (battleCtx->sideConditions[v2].knockedOffItemsMask & GetSingleBitMask(battleCtx->selectedPartySlot[battler])) { battleCtx->battleMons[battler].heldItem = 0; battleCtx->battleMons[battler].moveEffectsData.canUnburden = 0; } else { @@ -293,22 +293,22 @@ void ov16_02251C94 (BattleSystem * param0, BattleContext * param1, int param2, i int v1; int v2; - param1->battleMons[param2].attack = GetMonData(v0, MON_DATA_165, 0); - param1->battleMons[param2].defense = GetMonData(v0, MON_DATA_166, 0); - param1->battleMons[param2].speed = GetMonData(v0, MON_DATA_167, 0); - param1->battleMons[param2].spAttack = GetMonData(v0, MON_DATA_168, 0); - param1->battleMons[param2].spDefense = GetMonData(v0, MON_DATA_169, 0); - param1->battleMons[param2].level = GetMonData(v0, MON_DATA_161, 0); + param1->battleMons[param2].attack = GetMonData(v0, MON_DATA_ATK, 0); + param1->battleMons[param2].defense = GetMonData(v0, MON_DATA_DEF, 0); + param1->battleMons[param2].speed = GetMonData(v0, MON_DATA_SPEED, 0); + param1->battleMons[param2].spAttack = GetMonData(v0, MON_DATA_SP_ATK, 0); + param1->battleMons[param2].spDefense = GetMonData(v0, MON_DATA_SP_DEF, 0); + param1->battleMons[param2].level = GetMonData(v0, MON_DATA_LEVEL, 0); param1->battleMons[param2].friendship = GetMonData(v0, MON_DATA_FRIENDSHIP, 0); - param1->battleMons[param2].curHP = GetMonData(v0, MON_DATA_163, 0); - param1->battleMons[param2].maxHP = GetMonData(v0, MON_DATA_164, 0); + param1->battleMons[param2].curHP = GetMonData(v0, MON_DATA_CURRENT_HP, 0); + param1->battleMons[param2].maxHP = GetMonData(v0, MON_DATA_MAX_HP, 0); if ((param1->battleMons[param2].statusVolatile & 0x200000) == 0) { for (v1 = 0; v1 < 4; v1++) { - if ((param1->battleMons[param2].moveEffectsData.mimickedMoveSlot & FlagIndex(v1)) == 0) { + if ((param1->battleMons[param2].moveEffectsData.mimickedMoveSlot & GetSingleBitMask(v1)) == 0) { param1->battleMons[param2].moves[v1] = GetMonData(v0, MON_DATA_MOVE1 + v1, 0); - param1->battleMons[param2].ppCur[v1] = GetMonData(v0, MON_DATA_58 + v1, 0); - param1->battleMons[param2].ppUps[v1] = GetMonData(v0, MON_DATA_62 + v1, 0); + param1->battleMons[param2].ppCur[v1] = GetMonData(v0, MON_DATA_MOVE1_PP + v1, 0); + param1->battleMons[param2].ppUps[v1] = GetMonData(v0, MON_DATA_MOVE1_PP_UPS + v1, 0); } } @@ -1499,8 +1499,8 @@ void ov16_022535F0 (BattleSystem * param0, BattleContext * param1, int param2) v1 = BattleSystem_BattleType(param0); while (v0 <= 2) { - if (((param1->battlersSwitchingMask & FlagIndex(v0)) == 0) && ((param1->battlersSwitchingMask & FlagIndex(param2)) == 0) && (param1->battleMons[param2].curHP)) { - param1->monsGainingExp[(param2 >> 1) & 1] |= FlagIndex(param1->selectedPartySlot[v0]); + if (((param1->battlersSwitchingMask & GetSingleBitMask(v0)) == 0) && ((param1->battlersSwitchingMask & GetSingleBitMask(param2)) == 0) && (param1->battleMons[param2].curHP)) { + param1->monsGainingExp[(param2 >> 1) & 1] |= GetSingleBitMask(param1->selectedPartySlot[v0]); } v0 += 2; @@ -1972,7 +1972,7 @@ BOOL BattleSystem_CheckTrainerMessage (BattleSystem * param0, BattleContext * pa for (v3 = 0; v3 < Party_GetCurrentCount(v5); v3++) { v6 = Party_GetPokemonBySlotIndex(v5, v3); - if (GetMonData(v6, MON_DATA_163, NULL)) { + if (GetMonData(v6, MON_DATA_CURRENT_HP, NULL)) { v4++; } } @@ -2003,7 +2003,7 @@ BOOL BattleSystem_CheckTrainerMessage (BattleSystem * param0, BattleContext * pa for (v7 = 0; v7 < Party_GetCurrentCount(v9); v7++) { v10 = Party_GetPokemonBySlotIndex(v9, v7); - if (GetMonData(v10, MON_DATA_163, NULL)) { + if (GetMonData(v10, MON_DATA_CURRENT_HP, NULL)) { v8++; } } @@ -2092,8 +2092,8 @@ void BattleContext_InitCounters (BattleSystem * param0, BattleContext * param1) v0 = BattleSystem_BattleType(param0); if ((v0 & 0x2) == 0) { - param1->battlersSwitchingMask |= FlagIndex(2); - param1->battlersSwitchingMask |= FlagIndex(3); + param1->battlersSwitchingMask |= GetSingleBitMask(2); + param1->battlersSwitchingMask |= GetSingleBitMask(3); } param1->safariCatchCount = 6; @@ -2141,8 +2141,8 @@ void ov16_0225433C (BattleSystem * param0, BattleContext * param1, int param2) } for (v0 = 0; v0 < v1; v0++) { - if (param1->battleMons[v0].statusVolatile & (FlagIndex(param2) << 16)) { - param1->battleMons[v0].statusVolatile &= ((FlagIndex(param2) << 16) ^ 0xffffffff); + if (param1->battleMons[v0].statusVolatile & (GetSingleBitMask(param2) << 16)) { + param1->battleMons[v0].statusVolatile &= ((GetSingleBitMask(param2) << 16) ^ 0xffffffff); } if ((param1->battleMons[v0].statusVolatile & 0xe000) && (param1->battleMons[v0].moveEffectsData.bindTarget == param2)) { @@ -2184,7 +2184,7 @@ void ov16_0225433C (BattleSystem * param0, BattleContext * param1, int param2) param1->conversion2Battler[param2] = 0; param1->conversion2Type[param2] = 0; param1->metronomeMove[param2] = 0; - param1->fieldConditionsMask &= ((FlagIndex(param2) << 8) ^ 0xffffffff); + param1->fieldConditionsMask &= ((GetSingleBitMask(param2) << 8) ^ 0xffffffff); if (param1->battleMons[param2].moveEffectsMask & 0x800000) { v0 = param1->battleMons[param2].attack; @@ -2226,8 +2226,8 @@ void ov16_02254744 (BattleSystem * param0, BattleContext * param1, int param2) param1->battleMons[v0].statusVolatile &= (0x4000000 ^ 0xffffffff); } - if (param1->battleMons[v0].statusVolatile & (FlagIndex(param2) << 16)) { - param1->battleMons[v0].statusVolatile &= ((FlagIndex(param2) << 16) ^ 0xffffffff); + if (param1->battleMons[v0].statusVolatile & (GetSingleBitMask(param2) << 16)) { + param1->battleMons[v0].statusVolatile &= ((GetSingleBitMask(param2) << 16) ^ 0xffffffff); } if ((param1->battleMons[v0].statusVolatile & 0xe000) && (param1->battleMons[v0].moveEffectsData.bindTarget == param2)) { @@ -2265,7 +2265,7 @@ void ov16_02254744 (BattleSystem * param0, BattleContext * param1, int param2) param1->conversion2Battler[param2] = 0; param1->conversion2Type[param2] = 0; param1->metronomeMove[param2] = 0; - param1->fieldConditionsMask &= ((FlagIndex(param2) << 8) ^ 0xffffffff); + param1->fieldConditionsMask &= ((GetSingleBitMask(param2) << 8) ^ 0xffffffff); for (v0 = 0; v0 < v1; v0++) { if ((v0 != param2) && (Battler_Side(param0, v0) != Battler_Side(param0, param2))) { @@ -2318,39 +2318,39 @@ int BattleSystem_CheckStruggling (BattleSystem *battleSys, BattleContext *battle for (v0 = 0; v0 < 4; v0++) { if ((battleCtx->battleMons[battler].moves[v0] == 0) && (struggleChecksMask & 0x1)) { - moveFlags |= FlagIndex(v0); + moveFlags |= GetSingleBitMask(v0); } if ((battleCtx->battleMons[battler].ppCur[v0] == 0) && (struggleChecksMask & 0x2)) { - moveFlags |= FlagIndex(v0); + moveFlags |= GetSingleBitMask(v0); } if ((battleCtx->battleMons[battler].moves[v0] == battleCtx->battleMons[battler].moveEffectsData.disabledMove) && (struggleChecksMask & 0x4)) { - moveFlags |= FlagIndex(v0); + moveFlags |= GetSingleBitMask(v0); } if ((battleCtx->battleMons[battler].moves[v0] == battleCtx->movePrevByBattler[battler]) && (struggleChecksMask & 0x8) && (battleCtx->battleMons[battler].statusVolatile & 0x80000000)) { - moveFlags |= FlagIndex(v0); + moveFlags |= GetSingleBitMask(v0); } if ((battleCtx->battleMons[battler].moveEffectsData.tauntedTurns) && (struggleChecksMask & 0x10) && (battleCtx->aiContext.moveTable[battleCtx->battleMons[battler].moves[v0]].power == 0)) { - moveFlags |= FlagIndex(v0); + moveFlags |= GetSingleBitMask(v0); } if ((ov16_02255EF4(battleSys, battleCtx, battler, battleCtx->battleMons[battler].moves[v0])) && (struggleChecksMask & 0x20)) { - moveFlags |= FlagIndex(v0); + moveFlags |= GetSingleBitMask(v0); } if ((ov16_02256044(battleSys, battleCtx, battler, battleCtx->battleMons[battler].moves[v0])) && (struggleChecksMask & 0x40)) { - moveFlags |= FlagIndex(v0); + moveFlags |= GetSingleBitMask(v0); } if ((ov16_02256078(battleSys, battleCtx, battler, battleCtx->battleMons[battler].moves[v0])) && (struggleChecksMask & 0x80)) { - moveFlags |= FlagIndex(v0); + moveFlags |= GetSingleBitMask(v0); } if ((battleCtx->battleMons[battler].moveEffectsData.encoredMove) && (battleCtx->battleMons[battler].moveEffectsData.encoredMove != battleCtx->battleMons[battler].moves[v0])) { - moveFlags |= FlagIndex(v0); + moveFlags |= GetSingleBitMask(v0); } if (((v1 == 55) || (v1 == 115) || (v1 == 125)) && (struggleChecksMask & 0x200)) { @@ -2358,7 +2358,7 @@ int BattleSystem_CheckStruggling (BattleSystem *battleSys, BattleContext *battle battleCtx->battleMons[battler].moveEffectsData.choiceLockedMove = 0; } else { if ((battleCtx->battleMons[battler].moveEffectsData.choiceLockedMove) && (battleCtx->battleMons[battler].moveEffectsData.choiceLockedMove != battleCtx->battleMons[battler].moves[v0])) { - moveFlags |= FlagIndex(v0); + moveFlags |= GetSingleBitMask(v0); } } } @@ -2371,49 +2371,49 @@ BOOL BattleSystem_CanUseMove (BattleSystem *battleSys, BattleContext *battleCtx, { BOOL result = TRUE; - if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x4) & FlagIndex(moveSlot)) { + if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x4) & GetSingleBitMask(moveSlot)) { msgOut->tags = 10; msgOut->id = 609; msgOut->params[0] = BattleSystem_NicknameTag(battleCtx, battler); msgOut->params[1] = battleCtx->battleMons[battler].moves[moveSlot]; result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x8) & FlagIndex(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x8) & GetSingleBitMask(moveSlot)) { msgOut->tags = 2; msgOut->id = 612; msgOut->params[0] = BattleSystem_NicknameTag(battleCtx, battler); result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x10) & FlagIndex(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x10) & GetSingleBitMask(moveSlot)) { msgOut->tags = 10; msgOut->id = 613; msgOut->params[0] = BattleSystem_NicknameTag(battleCtx, battler); msgOut->params[1] = battleCtx->battleMons[battler].moves[moveSlot]; result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x20) & FlagIndex(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x20) & GetSingleBitMask(moveSlot)) { msgOut->tags = 10; msgOut->id = 616; msgOut->params[0] = BattleSystem_NicknameTag(battleCtx, battler); msgOut->params[1] = battleCtx->battleMons[battler].moves[moveSlot]; result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x40) & FlagIndex(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x40) & GetSingleBitMask(moveSlot)) { msgOut->tags = 10; msgOut->id = 1001; msgOut->params[0] = BattleSystem_NicknameTag(battleCtx, battler); msgOut->params[1] = battleCtx->battleMons[battler].moves[moveSlot]; result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x80) & FlagIndex(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x80) & GetSingleBitMask(moveSlot)) { msgOut->tags = 34; msgOut->id = 1057; msgOut->params[0] = BattleSystem_NicknameTag(battleCtx, battler); msgOut->params[1] = 377; msgOut->params[2] = battleCtx->battleMons[battler].moves[moveSlot]; result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x200) & FlagIndex(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x200) & GetSingleBitMask(moveSlot)) { msgOut->tags = 24; msgOut->id = 911; msgOut->params[0] = battleCtx->battleMons[battler].heldItem; msgOut->params[1] = battleCtx->battleMons[battler].moveEffectsData.choiceLockedMove; result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x2) & FlagIndex(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x2) & GetSingleBitMask(moveSlot)) { msgOut->tags = 0; msgOut->id = 823; result = FALSE; @@ -2898,7 +2898,7 @@ int BattleSystem_CountAbility (BattleSystem * param0, BattleContext * param1, in case 4: for (v1 = 0; v1 < v2; v1++) { if ((Battler_Side(param0, v1) != Battler_Side(param0, param3)) && (param1->battleMons[v1].curHP) && (Battler_Ability(param1, v1) == param4)) { - v0 |= FlagIndex(v1); + v0 |= GetSingleBitMask(v1); } } break; @@ -3028,7 +3028,7 @@ BOOL ov16_02255980 (BattleSystem * param0, BattleContext * param1, int param2) v0 = 0; v1 = Battler_Side(param0, param2); - if ((param1->battleMons[param2].heldItem) && ((param1->sideConditions[v1].knockedOffItemsMask & FlagIndex(param1->selectedPartySlot[param2])) == 0) && (Item_IsMail(param1->battleMons[param2].heldItem) == 0)) { + if ((param1->battleMons[param2].heldItem) && ((param1->sideConditions[v1].knockedOffItemsMask & GetSingleBitMask(param1->selectedPartySlot[param2])) == 0) && (Item_IsMail(param1->battleMons[param2].heldItem) == 0)) { v0 = 1; } @@ -3137,7 +3137,7 @@ BOOL ov16_02255B10 (BattleSystem * param0, BattleContext * param1, int param2) for (v6 = v7; v6 < v8; v6++) { v2 = Party_GetPokemonBySlotIndex(v1, v6); - if ((GetMonData(v2, MON_DATA_SPECIES, NULL)) && (GetMonData(v2, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v2, MON_DATA_163, NULL)) && (v10 != v6) && (v11 != v6)) { + if ((GetMonData(v2, MON_DATA_SPECIES, NULL)) && (GetMonData(v2, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v2, MON_DATA_CURRENT_HP, NULL)) && (v10 != v6) && (v11 != v6)) { v4++; } } @@ -5203,7 +5203,7 @@ BOOL ov16_022588BC (BattleSystem * param0, BattleContext * param1, int * param2) switch (v2) { case 116: - if ((param1->battleMons[param1->attacker].curHP) && (param1->battleMons[param1->attacker].heldItem == 0) && ((param1->sideConditions[v4].knockedOffItemsMask & FlagIndex(param1->selectedPartySlot[param1->attacker])) == 0) && (param1->moveCur != 282) && ((param1->selfTurnFlags[param1->defender].physicalDamageTaken) || (param1->selfTurnFlags[param1->defender].specialDamageTaken)) && ((param1->battleStatusMask2 & 0x10) == 0) && (param1->aiContext.moveTable[param1->moveCur].flags & 0x1)) { + if ((param1->battleMons[param1->attacker].curHP) && (param1->battleMons[param1->attacker].heldItem == 0) && ((param1->sideConditions[v4].knockedOffItemsMask & GetSingleBitMask(param1->selectedPartySlot[param1->attacker])) == 0) && (param1->moveCur != 282) && ((param1->selfTurnFlags[param1->defender].physicalDamageTaken) || (param1->selfTurnFlags[param1->defender].specialDamageTaken)) && ((param1->battleStatusMask2 & 0x10) == 0) && (param1->aiContext.moveTable[param1->moveCur].flags & 0x1)) { param2[0] = (0 + 216); v0 = 1; } @@ -6158,7 +6158,7 @@ BOOL ov16_02259B9C (BattleSystem * param0, BattleContext * param1, int * param2) } if ((param1->battleMons[param1->msgBattlerTemp].species == 493) && (param1->battleMons[param1->msgBattlerTemp].curHP) && (Battler_Ability(param1, param1->msgBattlerTemp) == 121)) { - v1 = sub_02077988(Item_LoadParam(param1->battleMons[param1->msgBattlerTemp].heldItem, 1, 5)); + v1 = GetArceusItemType(Item_LoadParam(param1->battleMons[param1->msgBattlerTemp].heldItem, 1, 5)); if (param1->battleMons[param1->msgBattlerTemp].formNum != v1) { param1->battleMons[param1->msgBattlerTemp].formNum = v1; @@ -6186,18 +6186,18 @@ BOOL ov16_02259B9C (BattleSystem * param0, BattleContext * param1, int * param2) sub_020775EC(ov16_0223DFAC(param0, v4, param1->selectedPartySlot[v4]), v3); v5 = 0; - sub_02074B30(v3, 6, &v5); + SetMonData(v3, 6, &v5); v5 = 0; - sub_02074B30(v3, 112, &v5); - sub_02077A00(v3); + SetMonData(v3, 112, &v5); + SetGiratinaForm(v3); - param1->battleMons[param1->msgBattlerTemp].attack = GetMonData(v3, MON_DATA_165, 0); - param1->battleMons[param1->msgBattlerTemp].defense = GetMonData(v3, MON_DATA_166, 0); - param1->battleMons[param1->msgBattlerTemp].speed = GetMonData(v3, MON_DATA_167, 0); - param1->battleMons[param1->msgBattlerTemp].spAttack = GetMonData(v3, MON_DATA_168, 0); - param1->battleMons[param1->msgBattlerTemp].spDefense = GetMonData(v3, MON_DATA_169, 0); - param1->battleMons[param1->msgBattlerTemp].ability = GetMonData(v3, MON_DATA_10, 0); + param1->battleMons[param1->msgBattlerTemp].attack = GetMonData(v3, MON_DATA_ATK, 0); + param1->battleMons[param1->msgBattlerTemp].defense = GetMonData(v3, MON_DATA_DEF, 0); + param1->battleMons[param1->msgBattlerTemp].speed = GetMonData(v3, MON_DATA_SPEED, 0); + param1->battleMons[param1->msgBattlerTemp].spAttack = GetMonData(v3, MON_DATA_SP_ATK, 0); + param1->battleMons[param1->msgBattlerTemp].spDefense = GetMonData(v3, MON_DATA_SP_DEF, 0); + param1->battleMons[param1->msgBattlerTemp].ability = GetMonData(v3, MON_DATA_ABILITY, 0); param1->battleMons[param1->msgBattlerTemp].formNum = 0; param1->battleStatusMask2 |= 0x4000000; @@ -7082,7 +7082,7 @@ BOOL ov16_0225B228 (BattleSystem * param0, BattleContext * param1, int * param2) v0 = 1; } - if ((v4 == 116) && (param1->battleMons[param1->attacker].curHP) && (param1->battleMons[param1->attacker].heldItem == 0) && ((param1->sideConditions[v6].knockedOffItemsMask & FlagIndex(param1->selectedPartySlot[param1->attacker])) == 0) && ((param1->selfTurnFlags[param1->defender].physicalDamageTaken) || (param1->selfTurnFlags[param1->defender].specialDamageTaken)) && (param1->aiContext.moveTable[param1->moveCur].flags & 0x1)) { + if ((v4 == 116) && (param1->battleMons[param1->attacker].curHP) && (param1->battleMons[param1->attacker].heldItem == 0) && ((param1->sideConditions[v6].knockedOffItemsMask & GetSingleBitMask(param1->selectedPartySlot[param1->attacker])) == 0) && ((param1->selfTurnFlags[param1->defender].physicalDamageTaken) || (param1->selfTurnFlags[param1->defender].specialDamageTaken)) && (param1->aiContext.moveTable[param1->moveCur].flags & 0x1)) { param2[0] = (0 + 216); v0 = 1; } @@ -7694,7 +7694,7 @@ int ov16_0225BA88 (BattleSystem * param0, int param1) v19 = ov16_0223DFAC(param0, param1, v0); v7 = GetMonData(v19, MON_DATA_SPECIES_EGG, NULL); - if ((v7 != 0) && (v7 != 494) && (GetMonData(v19, MON_DATA_163, NULL)) && ((v10 & FlagIndex(v0)) == 0) && (v20->selectedPartySlot[v14] != v0) && (v20->selectedPartySlot[v15] != v0) && (v0 != v20->aiSwitchedPartySlot[v14]) && (v0 != v20->aiSwitchedPartySlot[v15])) { + if ((v7 != 0) && (v7 != 494) && (GetMonData(v19, MON_DATA_CURRENT_HP, NULL)) && ((v10 & GetSingleBitMask(v0)) == 0) && (v20->selectedPartySlot[v14] != v0) && (v20->selectedPartySlot[v15] != v0) && (v0 != v20->aiSwitchedPartySlot[v14]) && (v0 != v20->aiSwitchedPartySlot[v15])) { v3 = ov16_02252060(v20, v2, 27, NULL); v4 = ov16_02252060(v20, v2, 28, NULL); v5 = GetMonData(v19, MON_DATA_177, NULL); @@ -7707,7 +7707,7 @@ int ov16_0225BA88 (BattleSystem * param0, int param1) v13 = v0; } } else { - v10 |= FlagIndex(v0); + v10 |= GetSingleBitMask(v0); } } @@ -7720,7 +7720,7 @@ int ov16_0225BA88 (BattleSystem * param0, int param1) if (v8) { v16 = 0; - ov16_022552D4(v20, v8, v9, GetMonData(v19, MON_DATA_10, NULL), Battler_Ability(v20, v2), ov16_02258AB8(v20, v2), ov16_02252060(v20, v2, 27, NULL), ov16_02252060(v20, v2, 28, NULL), &v16); + ov16_022552D4(v20, v8, v9, GetMonData(v19, MON_DATA_ABILITY, NULL), Battler_Ability(v20, v2), ov16_02258AB8(v20, v2), ov16_02252060(v20, v2, 27, NULL), ov16_02252060(v20, v2, 28, NULL), &v16); if (v16 & 0x2) { break; @@ -7729,7 +7729,7 @@ int ov16_0225BA88 (BattleSystem * param0, int param1) } if (v0 == 4) { - v10 |= FlagIndex(v13); + v10 |= GetSingleBitMask(v13); } else { return v13; } @@ -7745,7 +7745,7 @@ int ov16_0225BA88 (BattleSystem * param0, int param1) v19 = ov16_0223DFAC(param0, param1, v0); v7 = GetMonData(v19, MON_DATA_SPECIES_EGG, NULL); - if ((v7 != 0) && (v7 != 494) && (GetMonData(v19, MON_DATA_163, NULL)) && (v20->selectedPartySlot[v14] != v0) && (v20->selectedPartySlot[v15] != v0) && (v0 != v20->aiSwitchedPartySlot[v14]) && (v0 != v20->aiSwitchedPartySlot[v15])) { + if ((v7 != 0) && (v7 != 494) && (GetMonData(v19, MON_DATA_CURRENT_HP, NULL)) && (v20->selectedPartySlot[v14] != v0) && (v20->selectedPartySlot[v15] != v0) && (v0 != v20->aiSwitchedPartySlot[v14]) && (v0 != v20->aiSwitchedPartySlot[v15])) { for (v1 = 0; v1 < 4; v1++) { v8 = GetMonData(v19, MON_DATA_MOVE1 + v1, NULL); v9 = ov16_0225BE3C(param0, v20, v19, v8); diff --git a/src/overlay016/ov16_0225BFFC.c b/src/overlay016/ov16_0225BFFC.c index 72c834e6d3..0ba85e1bf9 100644 --- a/src/overlay016/ov16_0225BFFC.c +++ b/src/overlay016/ov16_0225BFFC.c @@ -67,7 +67,7 @@ #include "unk_020131EC.h" #include "heap.h" #include "unk_02018340.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay012/ov12_02235E94.h" #include "overlay012/ov12_022380BC.h" @@ -611,27 +611,27 @@ static void ov16_0225C47C (BattleSystem * param0, UnkStruct_ov16_0225BFFC * para if ((v0->unk_18 & 0x200000) == 0) { for (v1 = 0; v1 < 4; v1++) { - if ((v0->unk_01_4 & FlagIndex(v1)) == 0) { - sub_02074B30(v2, 54 + v1, (u8 *)&v0->unk_0E[v1]); - sub_02074B30(v2, 58 + v1, (u8 *)&v0->unk_12[v1]); + if ((v0->unk_01_4 & GetSingleBitMask(v1)) == 0) { + SetMonData(v2, 54 + v1, (u8 *)&v0->unk_0E[v1]); + SetMonData(v2, 58 + v1, (u8 *)&v0->unk_12[v1]); } } } - if ((v0->unk_08 & FlagIndex(v0->unk_01_0)) == 0) { - sub_02074B30(v2, 6, (u8 *)&v0->unk_0C); + if ((v0->unk_08 & GetSingleBitMask(v0->unk_01_0)) == 0) { + SetMonData(v2, 6, (u8 *)&v0->unk_0C); } - sub_02074B30(v2, 163, (u8 *)&v0->unk_02); - sub_02074B30(v2, 160, (u8 *)&v0->unk_04); + SetMonData(v2, 163, (u8 *)&v0->unk_02); + SetMonData(v2, 160, (u8 *)&v0->unk_04); if (v0->unk_26) { - sub_02074B30(v2, 112, (u8 *)&v0->unk_1C); + SetMonData(v2, 112, (u8 *)&v0->unk_1C); } if (v0->unk_24) { - sub_02074B30(v2, 10, (u8 *)&v0->unk_20); - sub_0207418C(v2); + SetMonData(v2, 10, (u8 *)&v0->unk_20); + CalculateMonLevelAndStats(v2); } ov16_02266ABC(param0, param1->unk_190, v0->unk_00); @@ -680,11 +680,11 @@ static void ov16_0225C5E0 (BattleSystem * param0, UnkStruct_ov16_0225BFFC * para if (v0->unk_01 == 104) { v4 = 0; } else { - v4 = GetMonData(v1, MON_DATA_10, NULL); + v4 = GetMonData(v1, MON_DATA_ABILITY, NULL); } if ((v0->unk_02 != 215) || ((v0->unk_02 == 215) && (v4 != 43))) { - sub_02074B30(v1, 160, (u8 *)&v5); + SetMonData(v1, 160, (u8 *)&v5); } } @@ -974,9 +974,9 @@ static void ov16_0225CA74 (BattleSystem * param0, UnkStruct_ov16_0225BFFC * para if ((GetMonData(v2, MON_DATA_SPECIES, NULL)) && (GetMonData(v2, MON_DATA_IS_EGG, NULL) == 0)) { if (Battler_Side(param0, v4)) { - v6 += GetMonData(v2, MON_DATA_163, NULL); + v6 += GetMonData(v2, MON_DATA_CURRENT_HP, NULL); } else { - v5 += GetMonData(v2, MON_DATA_163, NULL); + v5 += GetMonData(v2, MON_DATA_CURRENT_HP, NULL); } } } diff --git a/src/overlay016/ov16_0225CBB8.c b/src/overlay016/ov16_0225CBB8.c index a69056aeca..c5cb90f7b0 100644 --- a/src/overlay016/ov16_0225CBB8.c +++ b/src/overlay016/ov16_0225CBB8.c @@ -132,7 +132,7 @@ #include "unk_02018340.h" #include "unk_0201D670.h" #include "unk_02025E68.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "party.h" #include "item.h" @@ -3231,7 +3231,7 @@ static void ov16_02260B04 (UnkStruct_0201CD38 * param0, void * param1) v3 = ov16_0223ED6C(v0->unk_00); v2 = ov16_02252060(BattleSystem_Context(v0->unk_00), v0->unk_09, 0, NULL); - v1 = sub_020759F0(v2, 26); + v1 = GetMonSpeciesPersonalDataAttribute(v2, 26); v1 = v1 * Unk_ov16_0226F194[v3][0] / Unk_ov16_0226F194[v3][1]; if ((BattleSystem_RandNext(v0->unk_00) % 255) <= v1) { @@ -3402,7 +3402,7 @@ static void ov16_02260DB0 (UnkStruct_0201CD38 * param0, void * param1) v6 = 0; for (v4 = 0; v4 < 4; v4++) { - if ((v0->unk_22 & FlagIndex(v4)) == 0) { + if ((v0->unk_22 & GetSingleBitMask(v4)) == 0) { v5[v6] = v4 + 1; v6++; } @@ -4004,8 +4004,8 @@ static void ov16_022611DC (UnkStruct_0201CD38 * param0, void * param1) v18->unk_25 = ov16_0226825C(BattleSystem_BattlerSlot(v0->unk_00, v20), BattleSystem_BattleType(v0->unk_00)); v19 = ov16_0223DFAC(v0->unk_00, v20, v21); - v18->unk_28 = GetMonData(v19, MON_DATA_163, NULL) - v0->unk_08->unk_04->unk_20; - v18->unk_2C = GetMonData(v19, MON_DATA_164, NULL); + v18->unk_28 = GetMonData(v19, MON_DATA_CURRENT_HP, NULL) - v0->unk_08->unk_04->unk_20; + v18->unk_2C = GetMonData(v19, MON_DATA_MAX_HP, NULL); v18->unk_30 = v0->unk_08->unk_04->unk_20; if (GetMonData(v19, MON_DATA_160, NULL) == 0) { @@ -4348,7 +4348,7 @@ static void ov16_02261E8C (UnkStruct_0201CD38 * param0, void * param1) v0->unk_04->unk_28 = v0->unk_09; v0->unk_04->unk_32 = v0->unk_17; - if ((v0->unk_18 & FlagIndex(v0->unk_09)) == 0) { + if ((v0->unk_18 & GetSingleBitMask(v0->unk_09)) == 0) { v0->unk_04->unk_14 = v0->unk_0C[v0->unk_09]; } else { v0->unk_04->unk_14 = 6; @@ -4356,7 +4356,7 @@ static void ov16_02261E8C (UnkStruct_0201CD38 * param0, void * param1) if (BattleSystem_BattleType(v0->unk_00) & 0x8) { v0->unk_04->unk_15 = 6; - } else if ((v0->unk_18 & FlagIndex(BattleSystem_Partner(v0->unk_00, v0->unk_09))) == 0) { + } else if ((v0->unk_18 & GetSingleBitMask(BattleSystem_Partner(v0->unk_00, v0->unk_09))) == 0) { v0->unk_04->unk_15 = v0->unk_0C[BattleSystem_Partner(v0->unk_00, v0->unk_09)]; } else { v0->unk_04->unk_15 = 6; @@ -4425,7 +4425,7 @@ static void ov16_02262258 (UnkStruct_0201CD38 * param0, void * param1) for (v1 = 0; v1 < Party_GetCurrentCount(v2); v1++) { v3 = ov16_0223DFAC(v0->unk_00, v0->unk_09, v1); - if ((GetMonData(v3, MON_DATA_163, NULL)) && (v0->unk_0C[v4] != v1) && (v0->unk_0C[v5] != v1)) { + if ((GetMonData(v3, MON_DATA_CURRENT_HP, NULL)) && (v0->unk_0C[v4] != v1) && (v0->unk_0C[v5] != v1)) { break; } } @@ -4475,7 +4475,7 @@ static void ov16_0226232C (UnkStruct_0201CD38 * param0, void * param1) } else { v3 = ov16_0223DFAC(v0->unk_00, v0->unk_09, v1 - 1); - if (GetMonData(v3, MON_DATA_163, NULL) == 0) { + if (GetMonData(v3, MON_DATA_CURRENT_HP, NULL) == 0) { ov16_02264730(v0->unk_00); } @@ -6158,7 +6158,7 @@ static void ov16_02264270 (BattleSystem * param0, UnkStruct_ov16_0225BFFC * para int v2 = 0; for (v0 = 0; v0 < BattleSystem_MaxBattlers(param0); v0++) { - if (param2->unk_01 & FlagIndex(v0)) { + if (param2->unk_01 & GetSingleBitMask(v0)) { if (Battler_Side(param0, v0)) { v2++; } else { diff --git a/src/overlay016/ov16_0226485C.c b/src/overlay016/ov16_0226485C.c index 6e468e407c..02bc075379 100644 --- a/src/overlay016/ov16_0226485C.c +++ b/src/overlay016/ov16_0226485C.c @@ -60,7 +60,7 @@ #include "unk_0202F1D4.h" #include "unk_02034198.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "party.h" #include "unk_0207A6DC.h" @@ -546,7 +546,7 @@ void ov16_022651DC (BattleSystem * param0, BattleContext * param1, int param2, i v1 = ov16_0223DFAC(param0, param2, param1->selectedPartySlot[param2]); v2 = GetMonData(v1, MON_DATA_SPECIES, NULL); - v3 = GetMonData(v1, MON_DATA_161, NULL); + v3 = GetMonData(v1, MON_DATA_LEVEL, NULL); v0.unk_00 = 12; v0.unk_01 = param1->battleMons[param2].level; @@ -561,8 +561,8 @@ void ov16_022651DC (BattleSystem * param0, BattleContext * param1, int param2, i v0.unk_07_5 = param1->battleMons[param2].gender; } - v0.unk_08 = param1->battleMons[param2].exp - sub_02075AD0(v2, v3); - v0.unk_0C = sub_02075AD0(v2, v3 + 1) - sub_02075AD0(v2, v3); + v0.unk_08 = param1->battleMons[param2].exp - GetMonSpeciesLevelExp(v2, v3); + v0.unk_0C = GetMonSpeciesLevelExp(v2, v3 + 1) - GetMonSpeciesLevelExp(v2, v3); v0.unk_07_7 = ov16_0223F9E0(param0, param1->battleMons[param2].species); v0.unk_10 = ov16_0223ED8C(param0); v0.unk_14 = param3; @@ -596,7 +596,7 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl for (v1 = 0; v1 < BattleSystem_MaxBattlers(battleSys); v1++) { if (BattleSystem_CanPickCommand(battleCtx, v1) == 0) { - v10 |= FlagIndex(v1); + v10 |= GetSingleBitMask(v1); } } @@ -620,7 +620,7 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl v5 = GetMonData(v8, MON_DATA_SPECIES_EGG, NULL); if ((v5) && (v5 != 494)) { - if (GetMonData(v8, MON_DATA_163, NULL)) { + if (GetMonData(v8, MON_DATA_CURRENT_HP, NULL)) { if (GetMonData(v8, MON_DATA_160, NULL)) { v0.unk_08[0][v6] = 3; } else { @@ -633,7 +633,7 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl if (v9 & (0x4 | 0x20 | 0x80 | 0x200)) { v0.unk_02[v6] = 0; } else { - v0.unk_02[v6] = sub_02075A10(v8); + v0.unk_02[v6] = GetMonPercentToNextLevel(v8); } v6++; @@ -655,7 +655,7 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl v5 = GetMonData(v8, MON_DATA_SPECIES_EGG, NULL); if ((v5) && (v5 != 494)) { - if (GetMonData(v8, MON_DATA_163, NULL)) { + if (GetMonData(v8, MON_DATA_CURRENT_HP, NULL)) { if (GetMonData(v8, MON_DATA_160, NULL)) { v0.unk_08[1][v6] = 3; } else { @@ -683,7 +683,7 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl v5 = GetMonData(v8, MON_DATA_SPECIES_EGG, NULL); if ((v5) && (v5 != 494)) { - if (GetMonData(v8, MON_DATA_163, NULL)) { + if (GetMonData(v8, MON_DATA_CURRENT_HP, NULL)) { if (GetMonData(v8, MON_DATA_160, NULL)) { v0.unk_08[1][v6] = 3; } else { @@ -706,7 +706,7 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl v5 = GetMonData(v8, MON_DATA_SPECIES_EGG, NULL); if ((v5) && (v5 != 494)) { - if (GetMonData(v8, MON_DATA_163, NULL)) { + if (GetMonData(v8, MON_DATA_CURRENT_HP, NULL)) { if (GetMonData(v8, MON_DATA_160, NULL)) { v0.unk_08[1][v6] = 3; } else { @@ -844,11 +844,11 @@ void BattleIO_ShowBagScreen (BattleSystem *battleSys, BattleContext *battleCtx, } if (BattleSystem_BattleType(battleSys) == (0x2 | 0x8 | 0x40)) { - if (((battleCtx->battlersSwitchingMask & FlagIndex(1)) == 0) && ((battleCtx->battlersSwitchingMask & FlagIndex(3)) == 0)) { + if (((battleCtx->battlersSwitchingMask & GetSingleBitMask(1)) == 0) && ((battleCtx->battlersSwitchingMask & GetSingleBitMask(3)) == 0)) { v0.unk_01 = 1; v0.unk_02 = 0; v0.unk_03 = 0; - } else if ((battleCtx->battlersSwitchingMask & FlagIndex(1)) == 0) { + } else if ((battleCtx->battlersSwitchingMask & GetSingleBitMask(1)) == 0) { v0.unk_01 = 0; if (battleCtx->battleMons[1].moveEffectsMask & (0x40 | 0x80 | 0x40000 | 0x20000000)) { @@ -995,7 +995,7 @@ void ov16_02265C38 (BattleSystem * param0, BattleContext * param1, int param2) v1 = ov16_0223DFAC(param0, param2, param1->selectedPartySlot[param2]); v2 = GetMonData(v1, MON_DATA_SPECIES, NULL); - v3 = GetMonData(v1, MON_DATA_161, NULL); + v3 = GetMonData(v1, MON_DATA_LEVEL, NULL); v0.unk_00 = 24; v0.unk_01 = param1->battleMons[param2].level; @@ -1009,8 +1009,8 @@ void ov16_02265C38 (BattleSystem * param0, BattleContext * param1, int param2) v0.unk_07 = param1->battleMons[param2].gender; } - v0.unk_0C = param1->battleMons[param2].exp - sub_02075AD0(v2, v3); - v0.unk_10 = sub_02075AD0(v2, v3 + 1) - sub_02075AD0(v2, v3); + v0.unk_0C = param1->battleMons[param2].exp - GetMonSpeciesLevelExp(v2, v3); + v0.unk_10 = GetMonSpeciesLevelExp(v2, v3 + 1) - GetMonSpeciesLevelExp(v2, v3); ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C35C)); } @@ -1024,12 +1024,12 @@ void ov16_02265D14 (BattleSystem * param0, BattleContext * param1, int param2, i v1 = ov16_0223DFAC(param0, param2, param1->selectedPartySlot[param2]); v2 = GetMonData(v1, MON_DATA_SPECIES, NULL); - v3 = GetMonData(v1, MON_DATA_161, NULL); + v3 = GetMonData(v1, MON_DATA_LEVEL, NULL); v0.unk_00 = 25; v0.unk_04 = param3; - v0.unk_08 = param1->battleMons[param2].exp - sub_02075AD0(v2, v3); - v0.unk_0C = sub_02075AD0(v2, v3 + 1) - sub_02075AD0(v2, v3); + v0.unk_08 = param1->battleMons[param2].exp - GetMonSpeciesLevelExp(v2, v3); + v0.unk_0C = GetMonSpeciesLevelExp(v2, v3 + 1) - GetMonSpeciesLevelExp(v2, v3); ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C370)); } @@ -1233,7 +1233,7 @@ void ov16_022661CC (BattleSystem * param0, BattleContext * param1, int param2) v1 = ov16_0223DFAC(param0, param2, param1->selectedPartySlot[param2]); v2 = GetMonData(v1, MON_DATA_SPECIES, NULL); - v3 = GetMonData(v1, MON_DATA_161, NULL); + v3 = GetMonData(v1, MON_DATA_LEVEL, NULL); v0.unk_00 = 38; v0.unk_01 = param1->battleMons[param2].level; @@ -1248,8 +1248,8 @@ void ov16_022661CC (BattleSystem * param0, BattleContext * param1, int param2) v0.unk_07_5 = param1->battleMons[param2].gender; } - v0.unk_08 = param1->battleMons[param2].exp - sub_02075AD0(v2, v3); - v0.unk_0C = sub_02075AD0(v2, v3 + 1) - sub_02075AD0(v2, v3); + v0.unk_08 = param1->battleMons[param2].exp - GetMonSpeciesLevelExp(v2, v3); + v0.unk_0C = GetMonSpeciesLevelExp(v2, v3 + 1) - GetMonSpeciesLevelExp(v2, v3); v0.unk_07_7 = ov16_0223F9E0(param0, param1->battleMons[param2].species); v0.unk_10 = ov16_0223ED8C(param0); @@ -1505,7 +1505,7 @@ void ov16_0226683C (BattleSystem * param0, BattleContext * param1) for (v1 = 0; v1 < BattleSystem_MaxBattlers(param0); v1++) { if (param1->battlerActions[v1][0] == 16) { - v0.unk_01 |= FlagIndex(v1); + v0.unk_01 |= GetSingleBitMask(v1); } } @@ -1747,7 +1747,7 @@ static void ov16_02266CF0 (BattleSystem * param0, BattleContext * param1, UnkStr v3 = GetMonData(v7, MON_DATA_SPECIES_EGG, NULL); if ((v3) && (v3 != 494)) { - if (GetMonData(v7, MON_DATA_163, NULL)) { + if (GetMonData(v7, MON_DATA_CURRENT_HP, NULL)) { if (GetMonData(v7, MON_DATA_160, NULL)) { param2->unk_02[v4] = 3; } else { @@ -1769,7 +1769,7 @@ static void ov16_02266CF0 (BattleSystem * param0, BattleContext * param1, UnkStr v3 = GetMonData(v7, MON_DATA_SPECIES_EGG, NULL); if ((v3) && (v3 != 494)) { - if (GetMonData(v7, MON_DATA_163, NULL)) { + if (GetMonData(v7, MON_DATA_CURRENT_HP, NULL)) { if (GetMonData(v7, MON_DATA_160, NULL)) { param2->unk_02[v4] = 3; } else { @@ -1797,7 +1797,7 @@ static void ov16_02266CF0 (BattleSystem * param0, BattleContext * param1, UnkStr v3 = GetMonData(v7, MON_DATA_SPECIES_EGG, NULL); if ((v3) && (v3 != 494)) { - if (GetMonData(v7, MON_DATA_163, NULL)) { + if (GetMonData(v7, MON_DATA_CURRENT_HP, NULL)) { if (GetMonData(v7, MON_DATA_160, NULL)) { param2->unk_02[v4] = 3; } else { diff --git a/src/overlay016/ov16_02266F1C.c b/src/overlay016/ov16_02266F1C.c index 638823832d..a67f5c95d5 100644 --- a/src/overlay016/ov16_02266F1C.c +++ b/src/overlay016/ov16_02266F1C.c @@ -35,7 +35,7 @@ #include "unk_0201D670.h" #include "unk_020218BC.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0208C098.h" #include "overlay016/ov16_0223DF00.h" #include "overlay016/ov16_02266F1C.h" @@ -961,7 +961,7 @@ static void ov16_02267864 (UnkStruct_ov16_022674C4 * param0) v5 = Strbuf_Init((12 + (5 * 2)), 5); v6 = MessageLoader_GetNewStrbuf(v4, 964); v7 = ov16_0223DFAC(param0->unk_0C, param0->unk_24, param0->unk_26); - v8 = sub_02076B10(v7); + v8 = GetBoxMon(v7); sub_0200B5CC(v9, 0, v8); sub_0200C388(v9, v5, v6); diff --git a/src/overlay016/ov16_0226871C.c b/src/overlay016/ov16_0226871C.c index 892bb94cf1..fe350baa82 100644 --- a/src/overlay016/ov16_0226871C.c +++ b/src/overlay016/ov16_0226871C.c @@ -61,7 +61,7 @@ #include "unk_020218BC.h" #include "unk_02022594.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "unk_02079D40.h" #include "unk_0207C908.h" @@ -2166,7 +2166,7 @@ static void ov16_0226A12C (UnkStruct_ov16_02268A14 * param0, int param1, int par } v6 = ov16_0223DFAC(param0->unk_00, v12, v0->unk_00[v12].unk_00); - v7 = sub_02076B10(v6); + v7 = GetBoxMon(v6); sub_0200B5CC(v8, 0, v7); sub_0200C388(v8, v4, v5); diff --git a/src/overlay017/ov17_0223B140.c b/src/overlay017/ov17_0223B140.c index bc9dbbd5ed..3b6cadff80 100644 --- a/src/overlay017/ov17_0223B140.c +++ b/src/overlay017/ov17_0223B140.c @@ -43,7 +43,7 @@ #include "strbuf.h" #include "unk_020366A0.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "unk_020933F8.h" #include "unk_02094EDC.h" diff --git a/src/overlay017/ov17_0223DAD0.c b/src/overlay017/ov17_0223DAD0.c index 5526731adb..296ed01e05 100644 --- a/src/overlay017/ov17_0223DAD0.c +++ b/src/overlay017/ov17_0223DAD0.c @@ -49,7 +49,7 @@ #include "unk_020279FC.h" #include "unk_020366A0.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020933F8.h" #include "unk_02094EDC.h" #include "overlay011/ov11_0221F840.h" diff --git a/src/overlay017/ov17_0223F118.c b/src/overlay017/ov17_0223F118.c index 123c07806c..6fd0206c5b 100644 --- a/src/overlay017/ov17_0223F118.c +++ b/src/overlay017/ov17_0223F118.c @@ -37,7 +37,7 @@ #include "unk_0201E86C.h" #include "gx_layers.h" #include "unk_02024220.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay017/ov17_0223F118.h" #include "overlay017/ov17_02252A70.h" diff --git a/src/overlay017/ov17_0223F7E4.c b/src/overlay017/ov17_0223F7E4.c index 9cf23e52da..6948c78962 100644 --- a/src/overlay017/ov17_0223F7E4.c +++ b/src/overlay017/ov17_0223F7E4.c @@ -43,7 +43,7 @@ #include "unk_0201E86C.h" #include "unk_02022594.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "unk_02094EDC.h" #include "overlay017/ov17_0223F118.h" diff --git a/src/overlay017/ov17_022413D8.c b/src/overlay017/ov17_022413D8.c index df1483f7eb..b70a92c2a5 100644 --- a/src/overlay017/ov17_022413D8.c +++ b/src/overlay017/ov17_022413D8.c @@ -44,7 +44,7 @@ #include "unk_0201D670.h" #include "strbuf.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0208C098.h" #include "unk_02094EDC.h" #include "overlay012/is_form_symmetrical.h" @@ -1381,13 +1381,13 @@ static void ov17_0224290C (UnkStruct_ov17_02246F24 * param0, int param1, const U case 0: break; case 1: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param0->unk_304.unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param0->unk_304.unk_00])); break; case 2: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 3: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); break; case 4: sub_0200B630(param0->unk_0C.unk_48, 0, param2->unk_02); @@ -1399,44 +1399,44 @@ static void ov17_0224290C (UnkStruct_ov17_02246F24 * param0, int param1, const U sub_0200BB74(param0->unk_0C.unk_48, 0, param0->unk_0C.unk_00->unk_C0[param2->unk_05].unk_00); break; case 7: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); break; case 8: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); sub_0200B630(param0->unk_0C.unk_48, 1, param2->unk_02); break; case 9: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); sub_0200B60C(param0->unk_0C.unk_48, 1, param2->unk_04, 1, 0, 1); break; case 10: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); sub_0200BB74(param0->unk_0C.unk_48, 1, param0->unk_0C.unk_00->unk_C0[param2->unk_05].unk_00); break; case 11: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_01])); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 12: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); sub_0200B630(param0->unk_0C.unk_48, 1, param2->unk_02); break; case 13: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); sub_0200B60C(param0->unk_0C.unk_48, 1, param2->unk_04, 1, 0, 1); break; case 14: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_01])); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 15: sub_0200B630(param0->unk_0C.unk_48, 0, param2->unk_02); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 16: sub_0200B630(param0->unk_0C.unk_48, 0, param2->unk_02); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); break; case 17: sub_0200B630(param0->unk_0C.unk_48, 0, param2->unk_02); @@ -1444,15 +1444,15 @@ static void ov17_0224290C (UnkStruct_ov17_02246F24 * param0, int param1, const U break; case 18: sub_0200B630(param0->unk_0C.unk_48, 0, param2->unk_02); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 19: sub_0200B60C(param0->unk_0C.unk_48, 0, param2->unk_04, 1, 0, 1); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 20: sub_0200B60C(param0->unk_0C.unk_48, 0, param2->unk_04, 1, 0, 1); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); break; case 21: sub_0200B60C(param0->unk_0C.unk_48, 0, param2->unk_04, 1, 0, 1); @@ -1460,15 +1460,15 @@ static void ov17_0224290C (UnkStruct_ov17_02246F24 * param0, int param1, const U break; case 22: sub_0200B60C(param0->unk_0C.unk_48, 0, param2->unk_04, 1, 0, 1); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 23: sub_0200BB74(param0->unk_0C.unk_48, 0, param0->unk_0C.unk_00->unk_C0[param2->unk_05].unk_00); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 24: sub_0200BB74(param0->unk_0C.unk_48, 0, param0->unk_0C.unk_00->unk_C0[param2->unk_05].unk_00); - sub_0200B5CC(param0->unk_0C.unk_48, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); break; case 25: sub_0200BB74(param0->unk_0C.unk_48, 0, param0->unk_0C.unk_00->unk_C0[param2->unk_05].unk_00); @@ -1479,7 +1479,7 @@ static void ov17_0224290C (UnkStruct_ov17_02246F24 * param0, int param1, const U sub_0200B60C(param0->unk_0C.unk_48, 1, param2->unk_04, 1, 0, 1); break; case 27: - sub_0200B5CC(param0->unk_0C.unk_48, 0, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); sub_0200BB74(param0->unk_0C.unk_48, 1, param0->unk_0C.unk_00->unk_C0[param2->unk_05].unk_00); sub_0200B630(param0->unk_0C.unk_48, 2, param2->unk_02); break; @@ -1495,7 +1495,7 @@ static void ov17_0224290C (UnkStruct_ov17_02246F24 * param0, int param1, const U break; } - sub_0200B5CC(param0->unk_0C.unk_48, 1 + v1, sub_02076B10(param0->unk_0C.unk_00->unk_00[v0->unk_01[v1]])); + sub_0200B5CC(param0->unk_0C.unk_48, 1 + v1, GetBoxMon(param0->unk_0C.unk_00->unk_00[v0->unk_01[v1]])); } } break; diff --git a/src/overlay017/ov17_02243C28.c b/src/overlay017/ov17_02243C28.c index 5e12452d29..1680562fee 100644 --- a/src/overlay017/ov17_02243C28.c +++ b/src/overlay017/ov17_02243C28.c @@ -31,7 +31,7 @@ #include "unk_0200762C.h" #include "unk_0200D9E8.h" #include "heap.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02094EDC.h" #include "overlay012/ov12_0221FC20.h" #include "overlay017/ov17_0223F7E4.h" @@ -681,14 +681,14 @@ static void ov17_022444BC (UnkStruct_0201CD38 * param0, void * param1) MI_CpuClear8(&v4, sizeof(UnkStruct_ov16_02264408)); v6 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_SPECIES, NULL); - v7 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_111, NULL); - v8 = sub_02075E0C(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D]); + v7 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_GENDER, NULL); + v8 = GetMonShininess(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D]); v9 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_FORM, NULL); v14 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_PERSONALITY, NULL); v10 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_SPECIES, NULL); - v11 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_111, NULL); - v12 = sub_02075E0C(v0->unk_00->unk_0C.unk_00->unk_00[v16]); + v11 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_GENDER, NULL); + v12 = GetMonShininess(v0->unk_00->unk_0C.unk_00->unk_00[v16]); v13 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_FORM, NULL); v15 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_PERSONALITY, NULL); diff --git a/src/overlay017/ov17_02246ECC.c b/src/overlay017/ov17_02246ECC.c index 80e6bee633..ba83654500 100644 --- a/src/overlay017/ov17_02246ECC.c +++ b/src/overlay017/ov17_02246ECC.c @@ -6,7 +6,7 @@ #include "overlay017/struct_ov17_022472F8.h" #include "heap.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "unk_020933F8.h" #include "unk_02094EDC.h" diff --git a/src/overlay017/ov17_022476F8.c b/src/overlay017/ov17_022476F8.c index d33ed22f4c..4f52ecae55 100644 --- a/src/overlay017/ov17_022476F8.c +++ b/src/overlay017/ov17_022476F8.c @@ -28,7 +28,7 @@ #include "unk_0201D670.h" #include "strbuf.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay017/ov17_022476F8.h" typedef struct { @@ -196,7 +196,7 @@ static void ov17_0224792C (UnkStruct_ov17_02247A48 * param0, int param1, const U break; case 1: sub_0200B48C(param0->unk_0C.unk_3C, 0, param0->unk_00->unk_00.unk_D8[param2->unk_00], param0->unk_00->unk_00.unk_F8[param2->unk_00], 1, GAME_LANGUAGE); - sub_0200B5CC(param0->unk_0C.unk_3C, 1, sub_02076B10(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_3C, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; default: GF_ASSERT(FALSE); diff --git a/src/overlay017/ov17_02247A48.c b/src/overlay017/ov17_02247A48.c index 635906b281..1b8c711741 100644 --- a/src/overlay017/ov17_02247A48.c +++ b/src/overlay017/ov17_02247A48.c @@ -43,7 +43,7 @@ #include "unk_0200DA60.h" #include "heap.h" #include "unk_02018340.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020933F8.h" #include "unk_02094EDC.h" #include "overlay012/ov12_02235E94.h" diff --git a/src/overlay017/ov17_0224A0FC.c b/src/overlay017/ov17_0224A0FC.c index f4be019b4a..2bebbc28ac 100644 --- a/src/overlay017/ov17_0224A0FC.c +++ b/src/overlay017/ov17_0224A0FC.c @@ -55,7 +55,7 @@ #include "unk_020218BC.h" #include "strbuf.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020933F8.h" #include "unk_02094EDC.h" #include "overlay017/ov17_0223DAD0.h" @@ -1900,7 +1900,7 @@ static void ov17_0224C0C0 (UnkStruct_ov17_0224DF54 * param0, int param1, const U case 0: break; case 1: - sub_0200B5CC(param0->unk_14.unk_88, 0, sub_02076B10(param0->unk_14.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_14.unk_88, 0, GetBoxMon(param0->unk_14.unk_00->unk_00[param2->unk_00])); break; case 2: v0 = sub_02095848(param0->unk_00->unk_00.unk_110, param0->unk_00->unk_00.unk_111, param0->unk_00->unk_155); @@ -1911,10 +1911,10 @@ static void ov17_0224C0C0 (UnkStruct_ov17_0224DF54 * param0, int param1, const U break; case 4: sub_0200B48C(param0->unk_14.unk_88, 0, param0->unk_00->unk_00.unk_D8[param2->unk_00], param0->unk_00->unk_00.unk_F8[param2->unk_00], 1, GAME_LANGUAGE); - sub_0200B5CC(param0->unk_14.unk_88, 1, sub_02076B10(param0->unk_14.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_14.unk_88, 1, GetBoxMon(param0->unk_14.unk_00->unk_00[param2->unk_00])); break; case 5: - sub_0200B5CC(param0->unk_14.unk_88, 0, sub_02076B10(param0->unk_14.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_14.unk_88, 0, GetBoxMon(param0->unk_14.unk_00->unk_00[param2->unk_00])); sub_0200B60C(param0->unk_14.unk_88, 1, param2->unk_04, 1, 0, 1); break; case 6: @@ -1922,7 +1922,7 @@ static void ov17_0224C0C0 (UnkStruct_ov17_0224DF54 * param0, int param1, const U sub_0200BBA8(param0->unk_14.unk_88, 0, v0); sub_0200B60C(param0->unk_14.unk_88, 1, param2->unk_04, 1, 0, 1); sub_0200B48C(param0->unk_14.unk_88, 2, param0->unk_00->unk_00.unk_D8[param2->unk_00], param0->unk_00->unk_00.unk_F8[param2->unk_00], 1, GAME_LANGUAGE); - sub_0200B5CC(param0->unk_14.unk_88, 3, sub_02076B10(param0->unk_14.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_14.unk_88, 3, GetBoxMon(param0->unk_14.unk_00->unk_00[param2->unk_00])); break; default: GF_ASSERT(FALSE); diff --git a/src/overlay017/ov17_0224CFB8.c b/src/overlay017/ov17_0224CFB8.c index 7ad359bb1c..c8acbbd6e6 100644 --- a/src/overlay017/ov17_0224CFB8.c +++ b/src/overlay017/ov17_0224CFB8.c @@ -35,7 +35,7 @@ #include "heap.h" #include "unk_02018340.h" #include "unk_02034198.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02094EDC.h" #include "overlay017/ov17_0223DAD0.h" #include "overlay017/ov17_022492DC.h" diff --git a/src/overlay017/ov17_02250744.c b/src/overlay017/ov17_02250744.c index 69ffd1cd1a..8228a546c7 100644 --- a/src/overlay017/ov17_02250744.c +++ b/src/overlay017/ov17_02250744.c @@ -34,7 +34,7 @@ #include "unk_020218BC.h" #include "strbuf.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "unk_020933F8.h" #include "unk_02094EDC.h" @@ -226,12 +226,12 @@ static void ov17_022507F0 (UnkStruct_ov17_0224FCA0 * param0, int param1, const U break; case 2: sub_0200B48C(param0->unk_10.unk_B8, 0, param0->unk_00->unk_00.unk_D8[param2->unk_00], param0->unk_00->unk_00.unk_F8[param2->unk_00], 1, GAME_LANGUAGE); - sub_0200B5CC(param0->unk_10.unk_B8, 1, sub_02076B10(param0->unk_10.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_10.unk_B8, 1, GetBoxMon(param0->unk_10.unk_00->unk_00[param2->unk_00])); break; case 3: sub_0200B60C(param0->unk_10.unk_B8, 0, param2->unk_04, 1, 0, 1); sub_0200B48C(param0->unk_10.unk_B8, 1, param0->unk_00->unk_00.unk_D8[param2->unk_00], param0->unk_00->unk_00.unk_F8[param2->unk_00], 1, GAME_LANGUAGE); - sub_0200B5CC(param0->unk_10.unk_B8, 2, sub_02076B10(param0->unk_10.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_10.unk_B8, 2, GetBoxMon(param0->unk_10.unk_00->unk_00[param2->unk_00])); break; default: GF_ASSERT(FALSE); diff --git a/src/overlay017/ov17_02251D6C.c b/src/overlay017/ov17_02251D6C.c index 146bc83c73..dd0ce0a35b 100644 --- a/src/overlay017/ov17_02251D6C.c +++ b/src/overlay017/ov17_02251D6C.c @@ -28,7 +28,7 @@ #include "unk_0200F174.h" #include "heap.h" #include "unk_02018340.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay017/ov17_0223F118.h" #include "overlay017/ov17_0224F18C.h" #include "overlay017/ov17_02250744.h" diff --git a/src/overlay019/ov19_021D0D80.c b/src/overlay019/ov19_021D0D80.c index e83926b7fd..d27c86e431 100644 --- a/src/overlay019/ov19_021D0D80.c +++ b/src/overlay019/ov19_021D0D80.c @@ -14,7 +14,7 @@ #include "struct_decls/struct_0202CC84_decl.h" #include "struct_defs/pokemon.h" #include "struct_defs/box_pokemon.h" -#include "struct_decls/struct_02075874_decl.h" +#include "struct_defs/pokemon_personal_data.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207CB08_decl.h" @@ -58,7 +58,7 @@ #include "unk_020279FC.h" #include "unk_0202CC64.h" #include "unk_0202D778.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "party.h" #include "unk_0207A274.h" @@ -1208,7 +1208,7 @@ static void ov19_021D2308 (UnkStruct_ov19_021D5DF8 * param0, u32 * param1) case 3: switch (param0->unk_1B8) { case UnkEnum_021DFB94_46: - if ((ov19_021D5F7C(¶m0->unk_00) == 112) && (sub_02074570(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { + if ((ov19_021D5F7C(¶m0->unk_00) == 112) && (GetBoxMonData(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { sub_0200B70C(param0->unk_19C, 0, 112); ov19_021D5408(¶m0->unk_00, 45); ov19_021D6594(param0->unk_114, 24); @@ -1248,7 +1248,7 @@ static void ov19_021D2308 (UnkStruct_ov19_021D5DF8 * param0, u32 * param1) ov19_021D5408(¶m0->unk_00, 24); ov19_021D6594(param0->unk_114, 24); (*param1) = 7; - } else if ((param0->unk_00.unk_112 == 112) && (sub_02074570(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { + } else if ((param0->unk_00.unk_112 == 112) && (GetBoxMonData(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { sub_0200B70C(param0->unk_19C, 0, 112); ov19_021D5408(¶m0->unk_00, 45); ov19_021D6594(param0->unk_114, 24); @@ -1835,7 +1835,7 @@ static BOOL ov19_021D2DD0 (const UnkStruct_ov19_021D4DF0 * param0) v4 = v3 + (v6->unk_0C[v1] - v2); v0 = sub_02079C9C(param0->unk_00, 0xffffffff, v4); - if (sub_02074570(v0, MON_DATA_172, NULL)) { + if (GetBoxMonData(v0, MON_DATA_172, NULL)) { return 0; } } @@ -2177,13 +2177,13 @@ static BOOL ov19_021D34E4 (UnkStruct_ov19_021D5DF8 * param0) for (v1 = 0, v2 = 0; v1 < v3; v1++) { v0 = Party_GetPokemonBySlotIndex(param0->unk_124, v1); - v4 = sub_02073C88(v0); + v4 = DecryptMon(v0); - if ((GetMonData(v0, MON_DATA_173, NULL) == 0) && (GetMonData(v0, MON_DATA_163, NULL) != 0)) { + if ((GetMonData(v0, MON_DATA_173, NULL) == 0) && (GetMonData(v0, MON_DATA_CURRENT_HP, NULL) != 0)) { v2++; } - sub_02073CD4(v0, v4); + EncryptMon(v0, v4); if (v2 >= 2) { return 0; @@ -2431,7 +2431,7 @@ static void ov19_021D3978 (UnkStruct_0201CD38 * param0, void * param1) for (v2 = v0->unk_03; v2 < v4; v2++) { v1 = sub_02079C9C(v0->unk_14, v0->unk_02, v2); - if (sub_02074570(v1, MON_DATA_172, NULL)) { + if (GetBoxMonData(v1, MON_DATA_172, NULL)) { for (v3 = 0; v3 < (NELEMS(Unk_ov19_021DFDF0)); v3++) { if (ov19_021D3AC8(v1, Unk_ov19_021DFDF0[v3])) { v0->unk_08[v3]++; @@ -2486,20 +2486,20 @@ static BOOL ov19_021D3AC8 (BoxPokemon * param0, u16 param1) BOOL v0, v1; v0 = 0; - v1 = sub_02073D20(param0); + v1 = DecryptBoxMon(param0); - if (sub_02074570(param0, MON_DATA_173, NULL) == 0) { + if (GetBoxMonData(param0, MON_DATA_173, NULL) == 0) { int v2; for (v2 = 0; v2 < 4; v2++) { - if (sub_02074570(param0, MON_DATA_MOVE1 + v2, NULL) == param1) { + if (GetBoxMonData(param0, MON_DATA_MOVE1 + v2, NULL) == param1) { v0 = 1; break; } } } - sub_02073D48(param0, v1); + EncryptBoxMon(param0, v1); return v0; } @@ -2643,7 +2643,7 @@ static void ov19_021D3D44 (UnkStruct_ov19_021D5DF8 * param0, u32 * param1) Heap_FreeToHeap(param0->unk_214); Overlay_UnloadByID(FS_OVERLAY_ID(overlay84)); - if ((v1 == 112) && (sub_02074570(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { + if ((v1 == 112) && (GetBoxMonData(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { (void)0; } else if (v1 != 0) { sub_0207D60C(sub_0207D990(param0->unk_11C), v1, 1, 9); @@ -2667,7 +2667,7 @@ static void ov19_021D3D44 (UnkStruct_ov19_021D5DF8 * param0, u32 * param1) if (ov19_021D6600(param0->unk_114, 2)) { if (v1 == 0) { ov19_021D0EC0(param0); - } else if ((v1 == 112) && (sub_02074570(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { + } else if ((v1 == 112) && (GetBoxMonData(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { sub_0200B70C(param0->unk_19C, 0, v1); ov19_021D5408(¶m0->unk_00, 45); ov19_021D6594(param0->unk_114, 24); @@ -3407,7 +3407,7 @@ static void ov19_021D4DF0 (UnkStruct_ov19_021D5DF8 * param0) static void ov19_021D4E30 (UnkStruct_ov19_021D5594 * param0) { - param0->unk_00 = Heap_AllocFromHeap(9, (5 * 6) * sub_02076AF4()); + param0->unk_00 = Heap_AllocFromHeap(9, (5 * 6) * GetBoxPokemonStructSize()); param0->unk_08 = 0; param0->unk_0B = 0; } @@ -3826,7 +3826,7 @@ static BOOL ov19_021D52F4 (UnkStruct_ov19_021D5DF8 * param0) } if (v2->unk_00) { - if (sub_02074570(v2->unk_00, MON_DATA_172, NULL)) { + if (GetBoxMonData(v2->unk_00, MON_DATA_172, NULL)) { v2->unk_0A = 1; if (!(ov19_021D5E38(v0) & 6)) { @@ -3890,11 +3890,11 @@ static void ov19_021D5420 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D UnkStruct_ov19_021D3CFC * v1 = ¶m1->unk_08; if (ov19_021D5E10(param1) == 0) { - MI_CpuCopy32(v1->unk_00, v0->unk_00, sub_02076AF4()); + MI_CpuCopy32(v1->unk_00, v0->unk_00, GetBoxPokemonStructSize()); sub_02079968(param0->unk_120, 0xffffffff, v1->unk_07); v0->unk_0B = 0; } else { - MI_CpuCopy32(v1->unk_00, v0->unk_00, sub_02076AF0()); + MI_CpuCopy32(v1->unk_00, v0->unk_00, GetPokemonStructSize()); Party_RemovePokemonBySlotIndex(param0->unk_124, v1->unk_08); v0->unk_0B = 1; } @@ -3919,7 +3919,7 @@ static void ov19_021D54A4 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D v11->unk_0A = 1; v7 = ov19_021D5E24(param1); - v9 = sub_02076AF4(); + v9 = GetBoxPokemonStructSize(); v8 = 0; v12 = (void *)(v11->unk_00); @@ -3931,7 +3931,7 @@ static void ov19_021D54A4 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D for (v0 = v2; v0 <= v3; v0++) { v10 = sub_02079C9C(param0->unk_120, 0xffffffff, v6); - if (sub_02074570(v10, MON_DATA_172, NULL)) { + if (GetBoxMonData(v10, MON_DATA_172, NULL)) { MI_CpuCopy32(v10, v12, v9); sub_02079968(param0->unk_120, 0xffffffff, v6); (u8 *)v12 += v9; @@ -3980,11 +3980,11 @@ static void ov19_021D55C4 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D BOOL v5; if (ov19_021D5E10(param1) == 0) { - v4 = sub_02074570(v0->unk_00, MON_DATA_FORM, NULL); + v4 = GetBoxMonData(v0->unk_00, MON_DATA_FORM, NULL); sub_02079914(param0->unk_120, 0xffffffff, v1->unk_07, v0->unk_00); v2 = sub_02079C9C(param0->unk_120, 0xffffffff, v1->unk_07); - if ((sub_02074570(v2, MON_DATA_SPECIES, NULL) == 492) && (v4 == 1)) { + if ((GetBoxMonData(v2, MON_DATA_SPECIES, NULL) == 492) && (v4 == 1)) { v3 = 1; } } else { @@ -4019,7 +4019,7 @@ static void ov19_021D56AC (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D v3 = ov19_021D5F3C(param1); v2 = v7->unk_09; - v5 = sub_02076AF4(); + v5 = GetBoxPokemonStructSize(); v0 = v7->unk_00; for (v1 = 0; v1 < v7->unk_08; v1++) { @@ -4043,7 +4043,7 @@ static void ov19_021D5734 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D UnkStruct_ov19_021D3CFC * v3; v2 = ¶m1->unk_14; - v0 = sub_02076AF0(); + v0 = GetPokemonStructSize(); v1 = (u8 *)(v2->unk_00) + v0; v3 = ¶m1->unk_08; @@ -4144,27 +4144,27 @@ static void ov19_021D5888 (UnkStruct_ov19_021D4DF0 * param0, BoxPokemon * param1 static void ov19_021D58AC (UnkStruct_ov19_021D4DF0 * param0, BoxPokemon * param1, UnkStruct_ov19_021D5DF8 * param2) { UnkStruct_ov19_021D5BAC * v0 = &(param0->unk_4C); - BOOL v1 = sub_02073D20(param1); - UnkStruct_02075874 * v2; + BOOL v1 = DecryptBoxMon(param1); + PokemonPersonalData * v2; v0->unk_00 = param1; - v0->unk_04 = sub_02074570(param1, MON_DATA_SPECIES, NULL); - v0->unk_06 = sub_02074570(param1, MON_DATA_HELD_ITEM, NULL); + v0->unk_04 = GetBoxMonData(param1, MON_DATA_SPECIES, NULL); + v0->unk_06 = GetBoxMonData(param1, MON_DATA_HELD_ITEM, NULL); v0->unk_08 = sub_0207A294(sub_0207A274(param2->unk_11C), v0->unk_04); - v0->unk_0F = sub_02074570(param1, MON_DATA_173, NULL); - v2 = sub_02075894(v0->unk_04, 9); - v0->unk_0A = sub_02075B9C(v2, v0->unk_04, sub_02074570(param1, MON_DATA_EXP, NULL)); - v0->unk_0B = sub_02074570(param1, MON_DATA_11, NULL); - v0->unk_0C = sub_02074570(param1, MON_DATA_177, NULL); - v0->unk_0D = sub_02074570(param1, MON_DATA_178, NULL); - - if ((v0->unk_0F == 0) && sub_02074570(param1, MON_DATA_176, NULL)) { - v0->unk_0E = sub_02075DD0(v2, v0->unk_04, sub_02074570(param1, MON_DATA_PERSONALITY, NULL)); + v0->unk_0F = GetBoxMonData(param1, MON_DATA_173, NULL); + v2 = GetMonPersonalData(v0->unk_04, 9); + v0->unk_0A = GetMonPersonalDataLevel(v2, v0->unk_04, GetBoxMonData(param1, MON_DATA_EXP, NULL)); + v0->unk_0B = GetBoxMonData(param1, MON_DATA_11, NULL); + v0->unk_0C = GetBoxMonData(param1, MON_DATA_177, NULL); + v0->unk_0D = GetBoxMonData(param1, MON_DATA_178, NULL); + + if ((v0->unk_0F == 0) && GetBoxMonData(param1, MON_DATA_176, NULL)) { + v0->unk_0E = GetMonPersonalDataGender(v2, v0->unk_04, GetBoxMonData(param1, MON_DATA_PERSONALITY, NULL)); } else { v0->unk_0E = 255; } - sub_02074570(param1, MON_DATA_119, v0->unk_14); + GetBoxMonData(param1, MON_DATA_119, v0->unk_14); if (v0->unk_0F == 0) { MessageLoader_GetStrbuf(param2->unk_190, v0->unk_04, v0->unk_18); @@ -4180,15 +4180,15 @@ static void ov19_021D58AC (UnkStruct_ov19_021D4DF0 * param0, BoxPokemon * param1 } { - u32 v3 = sub_02075BD4(param1); + u32 v3 = GetBoxMonNature(param1); MessageLoader_GetStrbuf(param2->unk_194, v3, v0->unk_20); - v3 = sub_02074570(param1, MON_DATA_10, NULL); + v3 = GetBoxMonData(param1, MON_DATA_ABILITY, NULL); MessageLoader_GetStrbuf(param2->unk_198, v3, v0->unk_24); } - sub_020759B8(v2); - sub_02073D48(param1, v1); + FreeMonPersonalData(v2); + EncryptBoxMon(param1, v1); } static void ov19_021D59F4 (UnkStruct_ov19_021D4DF0 * param0, BoxPokemon * param1, UnkStruct_ov19_021D5DF8 * param2) @@ -4211,14 +4211,14 @@ static void ov19_021D59F4 (UnkStruct_ov19_021D4DF0 * param0, BoxPokemon * param1 Strbuf_Copy(v1->unk_2C, v0->unk_20); sub_020774C8(param1, param2->unk_1A0); - v2 = sub_02073C88(param2->unk_1A0); + v2 = DecryptMon(param2->unk_1A0); - v1->unk_0A = GetMonData(param2->unk_1A0, MON_DATA_164, NULL); - v1->unk_0C = GetMonData(param2->unk_1A0, MON_DATA_165, NULL); - v1->unk_0E = GetMonData(param2->unk_1A0, MON_DATA_166, NULL); - v1->unk_10 = GetMonData(param2->unk_1A0, MON_DATA_168, NULL); - v1->unk_12 = GetMonData(param2->unk_1A0, MON_DATA_169, NULL); - v1->unk_14 = GetMonData(param2->unk_1A0, MON_DATA_167, NULL); + v1->unk_0A = GetMonData(param2->unk_1A0, MON_DATA_MAX_HP, NULL); + v1->unk_0C = GetMonData(param2->unk_1A0, MON_DATA_ATK, NULL); + v1->unk_0E = GetMonData(param2->unk_1A0, MON_DATA_DEF, NULL); + v1->unk_10 = GetMonData(param2->unk_1A0, MON_DATA_SP_ATK, NULL); + v1->unk_12 = GetMonData(param2->unk_1A0, MON_DATA_SP_DEF, NULL); + v1->unk_14 = GetMonData(param2->unk_1A0, MON_DATA_SPEED, NULL); v1->unk_16 = GetMonData(param2->unk_1A0, MON_DATA_COOL, NULL); v1->unk_18 = GetMonData(param2->unk_1A0, MON_DATA_BEAUTY, NULL); v1->unk_1A = GetMonData(param2->unk_1A0, MON_DATA_CUTE, NULL); @@ -4230,7 +4230,7 @@ static void ov19_021D59F4 (UnkStruct_ov19_021D4DF0 * param0, BoxPokemon * param1 v1->unk_20[3] = GetMonData(param2->unk_1A0, MON_DATA_MOVE4, NULL); v1->unk_07 = GetMonData(param2->unk_1A0, MON_DATA_FORM, NULL); - sub_02073CD4(param2->unk_1A0, v2); + EncryptMon(param2->unk_1A0, v2); param0->unk_A4.unk_02[param0->unk_A4.unk_00] = 1; } @@ -4294,17 +4294,17 @@ static void ov19_021D5BE8 (UnkStruct_ov19_021D4DF0 * param0, u16 param1, UnkStru SetBoxMonData(v0->unk_00, 6, ¶m1); { - int v2 = sub_02074570(v0->unk_00, MON_DATA_SPECIES, NULL); + int v2 = GetBoxMonData(v0->unk_00, MON_DATA_SPECIES, NULL); if (v2 == 493) { - sub_02077930(v0->unk_00); - v0->unk_0C = sub_02074570(v0->unk_00, MON_DATA_177, NULL); - v0->unk_0D = sub_02074570(v0->unk_00, MON_DATA_178, NULL); + SetBoxArceusForm(v0->unk_00); + v0->unk_0C = GetBoxMonData(v0->unk_00, MON_DATA_177, NULL); + v0->unk_0D = GetBoxMonData(v0->unk_00, MON_DATA_178, NULL); } else if (v2 == 487) { int v3; - sub_02077A1C(v0->unk_00); - v3 = sub_02074570(v0->unk_00, MON_DATA_10, NULL); + SetBoxGiratinaForm(v0->unk_00); + v3 = GetBoxMonData(v0->unk_00, MON_DATA_ABILITY, NULL); MessageLoader_GetStrbuf(param2->unk_198, v3, v0->unk_24); } } @@ -4693,13 +4693,13 @@ static u32 ov19_021D5FD0 (UnkStruct_ov19_021D4DF0 * param0, int param1, void * p { if (ov19_021D5E38(param0) == 1) { if (ov19_021D5E10(param0) == 0) { - return sub_02074570(param0->unk_4C.unk_00, param1, param2); + return GetBoxMonData(param0->unk_4C.unk_00, param1, param2); } } else { UnkStruct_ov19_021D5594 * v0 = ¶m0->unk_14; if (v0->unk_0B == 0) { - return sub_02074570(param0->unk_4C.unk_00, param1, param2); + return GetBoxMonData(param0->unk_4C.unk_00, param1, param2); } } @@ -4709,7 +4709,7 @@ static u32 ov19_021D5FD0 (UnkStruct_ov19_021D4DF0 * param0, int param1, void * p static u32 ov19_021D6014 (UnkStruct_ov19_021D4DF0 * param0, int param1, void * param2) { if (ov19_021D5E10(param0) == 0) { - return sub_02074570(param0->unk_4C.unk_00, param1, param2); + return GetBoxMonData(param0->unk_4C.unk_00, param1, param2); } else { return GetMonData(param0->unk_08.unk_00, param1, param2); } diff --git a/src/overlay019/ov19_021D79F8.c b/src/overlay019/ov19_021D79F8.c index 1d23f4a632..46a9c32d8f 100644 --- a/src/overlay019/ov19_021D79F8.c +++ b/src/overlay019/ov19_021D79F8.c @@ -23,7 +23,7 @@ #include "unk_02018340.h" #include "unk_0201D670.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "unk_02079D40.h" #include "overlay019/ov19_021D0D80.h" @@ -396,7 +396,7 @@ static void ov19_021D803C (UnkStruct_ov19_021D8318 * param0, UnkStruct_ov19_021D if (param1->unk_00 == NULL) { v1 = sub_02079C9C(v0, param0->unk_30, v3); - if (sub_02074570(v1, MON_DATA_172, NULL)) { + if (GetBoxMonData(v1, MON_DATA_172, NULL)) { ov19_021DA548(param0->unk_58F0, v1, param0->unk_5814[v3], param0->unk_57D8[v3], param0->unk_CD8[v3], param2, 40 + 24 * v2, 2, ov19_021D85B4(v3), v4, param1); } } @@ -433,7 +433,7 @@ static void ov19_021D813C (UnkStruct_ov19_021D8318 * param0, u32 param1) for (v2 = 0; v2 < (5 * 6); v2++) { v1 = sub_02079C9C(v0, param1, v2); - v3 = sub_02074570(v1, MON_DATA_SPECIES, NULL); + v3 = GetBoxMonData(v1, MON_DATA_SPECIES, NULL); if (v3) { param0->unk_5814[v2] = v3; @@ -601,7 +601,7 @@ void ov19_021D84E0 (UnkStruct_ov19_021D8318 * param0) for (v0 = 0; v0 < (5 * 6); v0++) { v2 = sub_02079C9C(param0->unk_58F8->unk_00, v1, v0); - if (sub_02074570(v2, MON_DATA_172, NULL)) { + if (GetBoxMonData(v2, MON_DATA_172, NULL)) { if (param0->unk_A8[param0->unk_02][v0].unk_00 == NULL) { int v3, v4, v5; @@ -665,7 +665,7 @@ static void ov19_021D85C4 (UnkStruct_ov19_021D8318 * param0, UnkStruct_ov19_021D for (v3 = 0; v3 < 5; v3++) { for (v2 = 0; v2 < 6; v2++) { v0 = sub_02079C9C(param1->unk_40->unk_00, param2, v4); - v1 = sub_02074570((BoxPokemon *)v0, MON_DATA_SPECIES, NULL); + v1 = GetBoxMonData((BoxPokemon *)v0, MON_DATA_SPECIES, NULL); if (v1 != 0) { ov19_021DA428(param1, v0, 112 + param0->unk_585C + 24 * v2 + param4, 40 + 24 * v3, 2, ov19_021D85B4(v4), v5, param5); diff --git a/src/overlay019/ov19_021DA270.c b/src/overlay019/ov19_021DA270.c index 7c2d948249..ffebea9988 100644 --- a/src/overlay019/ov19_021DA270.c +++ b/src/overlay019/ov19_021DA270.c @@ -15,7 +15,7 @@ #include "unk_02006E3C.h" #include "heap.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "overlay019/ov19_021D0D80.h" #include "overlay019/ov19_021D61B0.h" @@ -129,16 +129,16 @@ void ov19_021DA428 (UnkStruct_ov19_021DA384 * param0, BoxPokemon * param1, s32 p u8 v4; u8 v5; - v5 = sub_02073D20(param1); + v5 = DecryptBoxMon(param1); ov19_021D783C(&v1, NULL, ov19_021D77D0(param0->unk_44), param0->unk_10, param0->unk_04, param4); - v2 = sub_02074570(param1, MON_DATA_SPECIES, NULL); - v3 = sub_02074570(param1, MON_DATA_IS_EGG, NULL); - v4 = sub_02074570(param1, MON_DATA_FORM, NULL); + v2 = GetBoxMonData(param1, MON_DATA_SPECIES, NULL); + v3 = GetBoxMonData(param1, MON_DATA_IS_EGG, NULL); + v4 = GetBoxMonData(param1, MON_DATA_FORM, NULL); param7->unk_28 = sub_02079D40((BoxPokemon *)param1); param7->unk_2C = sub_02079EDC(v2, v4, v3); - param7->unk_30 = sub_02074570(param1, MON_DATA_HELD_ITEM, NULL); - param7->unk_2E = sub_02074570(param1, MON_DATA_11, NULL); + param7->unk_30 = GetBoxMonData(param1, MON_DATA_HELD_ITEM, NULL); + param7->unk_2E = GetBoxMonData(param1, MON_DATA_11, NULL); NNS_G2dInitImageProxy(&(param7->unk_04)); NARC_ReadFromMember(param0->unk_48, param7->unk_28, 0, ((4 * 4) * 0x20 + 0x80), param0->unk_4C); @@ -156,7 +156,7 @@ void ov19_021DA428 (UnkStruct_ov19_021DA384 * param0, BoxPokemon * param1, s32 p sub_02021E90(param7->unk_00, 2 + param7->unk_2C); ov19_021DA63C(param0, param7, ov19_021D5EC8(param0->unk_40)); - sub_02073D48(param1, v5); + EncryptBoxMon(param1, v5); } void ov19_021DA548 (UnkStruct_ov19_021DA384 * param0, BoxPokemon * param1, u32 param2, u32 param3, u8 * param4, s32 param5, s32 param6, u32 param7, u32 param8, u32 param9, UnkStruct_ov19_021DCD18 * param10) @@ -166,16 +166,16 @@ void ov19_021DA548 (UnkStruct_ov19_021DA384 * param0, BoxPokemon * param1, u32 p BOOL v2; u8 v3, v4; - v2 = sub_02073D20(param1); - v3 = sub_02074570(param1, MON_DATA_IS_EGG, NULL); - v4 = sub_02074570(param1, MON_DATA_FORM, NULL); + v2 = DecryptBoxMon(param1); + v3 = GetBoxMonData(param1, MON_DATA_IS_EGG, NULL); + v4 = GetBoxMonData(param1, MON_DATA_FORM, NULL); ov19_021D783C(&v1, NULL, ov19_021D77D0(param0->unk_44), param0->unk_10, param0->unk_04, param7); param10->unk_28 = param3; param10->unk_2C = sub_02079EDC(param2, v4, v3); - param10->unk_30 = sub_02074570(param1, MON_DATA_HELD_ITEM, NULL); - param10->unk_2E = sub_02074570(param1, MON_DATA_11, NULL); + param10->unk_30 = GetBoxMonData(param1, MON_DATA_HELD_ITEM, NULL); + param10->unk_2E = GetBoxMonData(param1, MON_DATA_11, NULL); NNS_G2dInitImageProxy(&(param10->unk_04)); NNS_G2dGetUnpackedCharacterData(param4, &v0); @@ -192,7 +192,7 @@ void ov19_021DA548 (UnkStruct_ov19_021DA384 * param0, BoxPokemon * param1, u32 p sub_02021E90(param10->unk_00, 2 + param10->unk_2C); ov19_021DA63C(param0, param10, ov19_021D5EC8(param0->unk_40)); - sub_02073D48(param1, v2); + EncryptBoxMon(param1, v2); } void ov19_021DA63C (UnkStruct_ov19_021DA384 * param0, UnkStruct_ov19_021DCD18 * param1, u32 param2) diff --git a/src/overlay019/ov19_021DA92C.c b/src/overlay019/ov19_021DA92C.c index 95b54a7dd7..578bf93bb4 100644 --- a/src/overlay019/ov19_021DA92C.c +++ b/src/overlay019/ov19_021DA92C.c @@ -28,7 +28,7 @@ #include "unk_0201D670.h" #include "unk_020218BC.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0207C908.h" #include "overlay019/ov19_021D0D80.h" #include "overlay019/ov19_021D61B0.h" diff --git a/src/overlay019/ov19_021DB8E4.c b/src/overlay019/ov19_021DB8E4.c index 990e36d84c..e2c1dc2eb8 100644 --- a/src/overlay019/ov19_021DB8E4.c +++ b/src/overlay019/ov19_021DB8E4.c @@ -27,7 +27,7 @@ #include "unk_0201D670.h" #include "unk_020218BC.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "item.h" #include "overlay019/ov19_021D0D80.h" @@ -250,14 +250,14 @@ void ov19_021DBBA8 (UnkStruct_ov19_021DBA9C * param0, u32 param1, u32 param2, NN for (v3 = 0, v4 = 0; v3 < 5; v3++) { for (v2 = 0; v2 < 6; v2++) { v1 = sub_02079C9C(v0, param1, v4++); - v7 = sub_02073D20(v1); - v5 = sub_02074570(v1, MON_DATA_SPECIES, NULL); + v7 = DecryptBoxMon(v1); + v5 = GetBoxMonData(v1, MON_DATA_SPECIES, NULL); if (v5) { - if (sub_02074570(v1, MON_DATA_IS_EGG, NULL) == 0) { - u16 v9 = sub_02074570(v1, MON_DATA_FORM, NULL); + if (GetBoxMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { + u16 v9 = GetBoxMonData(v1, MON_DATA_FORM, NULL); - v6 = sub_020759CC(v5, v9, 27); + v6 = GetMonFormPersonalDataAttribute(v5, v9, 27); } else { v6 = (v5 != 490) ? 8 : 1; } @@ -273,7 +273,7 @@ void ov19_021DBBA8 (UnkStruct_ov19_021DBA9C * param0, u32 param1, u32 param2, NN sub_0201A6D0(&(param0->unk_3C), 10 + v2 * 2, 11 + v3 * 2, 2, 2, v6); } - sub_02073D48(v1, v7); + EncryptBoxMon(v1, v7); } } diff --git a/src/overlay021/ov21_021D0D80.c b/src/overlay021/ov21_021D0D80.c index f28223d38b..44e9ecd320 100644 --- a/src/overlay021/ov21_021D0D80.c +++ b/src/overlay021/ov21_021D0D80.c @@ -53,7 +53,7 @@ #include "strbuf.h" #include "unk_0202419C.h" #include "unk_0202631C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02098988.h" #include "unk_0209ACBC.h" #include "overlay021/ov21_021D0D80.h" diff --git a/src/overlay021/ov21_021D1FA4.c b/src/overlay021/ov21_021D1FA4.c index 5a78d924b1..567622f545 100644 --- a/src/overlay021/ov21_021D1FA4.c +++ b/src/overlay021/ov21_021D1FA4.c @@ -39,7 +39,7 @@ #include "unk_02018340.h" #include "gx_layers.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay021/ov21_021D1FA4.h" #include "overlay021/ov21_021D4C0C.h" #include "overlay021/ov21_021D4EE4.h" @@ -175,7 +175,7 @@ void ov21_021D2188 (UnkStruct_ov21_021D13FC * param0, int param1, int param2, in } if (param2 == -1) { - param2 = sub_02075DAC(param1, 0); + param2 = GetMonPersonalityGender(param1, 0); } sub_02075FB4(&v0, param1, param2, param3, param4, param5, param6); diff --git a/src/overlay021/ov21_021DE668.c b/src/overlay021/ov21_021DE668.c index 64f53d7e98..98183221ca 100644 --- a/src/overlay021/ov21_021DE668.c +++ b/src/overlay021/ov21_021DE668.c @@ -36,7 +36,7 @@ #include "unk_0201D670.h" #include "unk_020218BC.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02098988.h" #include "overlay021/ov21_021D0D80.h" #include "overlay021/ov21_021D1F90.h" @@ -641,8 +641,8 @@ static void ov21_021DF098 (UnkStruct_ov21_021DF374 * param0, UnkStruct_ov21_021D int v4, v5; int v6 = ov21_021D33D4(param2->unk_04, v3); - v4 = sub_020759CC(v3, v6, 6); - v5 = sub_020759CC(v3, v6, 7); + v4 = GetMonFormPersonalDataAttribute(v3, v6, 6); + v5 = GetMonFormPersonalDataAttribute(v3, v6, 7); v4 = ov21_021DF180(v4); v5 = ov21_021DF180(v5); diff --git a/src/overlay021/ov21_021DF734.c b/src/overlay021/ov21_021DF734.c index 04eb08a3fe..874b657f50 100644 --- a/src/overlay021/ov21_021DF734.c +++ b/src/overlay021/ov21_021DF734.c @@ -30,7 +30,7 @@ #include "unk_02018340.h" #include "unk_0201F834.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay021/ov21_021D0D80.h" #include "overlay021/ov21_021D1FA4.h" #include "overlay021/ov21_021D3208.h" @@ -803,7 +803,7 @@ static int ov21_021E02F0 (int param0, const UnkStruct_ov21_021DF844 * param1) int v0; int v1; - v0 = sub_020759F0(param0, 18); + v0 = GetMonSpeciesPersonalDataAttribute(param0, 18); if (v0 == 0) { return 1; diff --git a/src/overlay021/ov21_021E8D48.c b/src/overlay021/ov21_021E8D48.c index 360fbf6383..2b2fb92a31 100644 --- a/src/overlay021/ov21_021E8D48.c +++ b/src/overlay021/ov21_021E8D48.c @@ -47,7 +47,7 @@ #include "gx_layers.h" #include "unk_020218BC.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02098988.h" #include "overlay021/ov21_021D0D80.h" #include "overlay021/ov21_021D1F90.h" @@ -603,8 +603,8 @@ static void ov21_021E95F8 (UnkStruct_ov21_021E968C * param0, UnkStruct_020218BC UnkStruct_ov19_021DA864 v1; int v2, v3; - v2 = sub_020759F0(param4, 6); - v3 = sub_020759F0(param4, 7); + v2 = GetMonSpeciesPersonalDataAttribute(param4, 6); + v3 = GetMonSpeciesPersonalDataAttribute(param4, 7); v2 = ov21_021DF180(v2); v3 = ov21_021DF180(v3); diff --git a/src/overlay022/ov22_02259098.c b/src/overlay022/ov22_02259098.c index f3b52e3658..6d32ad9a90 100644 --- a/src/overlay022/ov22_02259098.c +++ b/src/overlay022/ov22_02259098.c @@ -16,7 +16,7 @@ #include "unk_0200762C.h" #include "heap.h" #include "unk_02022594.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay022/ov22_02255094.h" #include "overlay022/ov22_02259098.h" diff --git a/src/overlay022/ov22_0225AF8C.c b/src/overlay022/ov22_0225AF8C.c index fe48e94e28..8aa357a26c 100644 --- a/src/overlay022/ov22_0225AF8C.c +++ b/src/overlay022/ov22_0225AF8C.c @@ -25,7 +25,7 @@ #include "unk_02018340.h" #include "unk_0202298C.h" #include "unk_020298BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay022/ov22_02254DE0.h" #include "overlay022/ov22_02255094.h" #include "overlay022/ov22_022578F4.h" diff --git a/src/overlay022/ov22_0225B660.c b/src/overlay022/ov22_0225B660.c index 3918606b8f..310d3999fe 100644 --- a/src/overlay022/ov22_0225B660.c +++ b/src/overlay022/ov22_0225B660.c @@ -34,7 +34,7 @@ #include "strbuf.h" #include "unk_0202419C.h" #include "unk_020298BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02094EDC.h" #include "overlay022/ov22_02255094.h" #include "overlay022/ov22_0225AF8C.h" @@ -352,7 +352,7 @@ static void ov22_0225BC18 (UnkStruct_ov22_0225B85C * param0) v5 = AllocMonZeroed(13); sub_0202A560(param0->unk_04, v5); - v6 = sub_02076B10(v5); + v6 = GetBoxMon(v5); sub_0200B5CC(v1, 4, v6); Heap_FreeToHeap(v5); diff --git a/src/overlay028/ov28_022561C0.c b/src/overlay028/ov28_022561C0.c index c2d38b4b7d..cd77c8907d 100644 --- a/src/overlay028/ov28_022561C0.c +++ b/src/overlay028/ov28_022561C0.c @@ -16,7 +16,7 @@ #include "unk_0200D9E8.h" #include "heap.h" #include "unk_0202631C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay025/ov25_02253CE0.h" #include "overlay025/ov25_02255ACC.h" #include "overlay028/ov28_0225697C.h" diff --git a/src/overlay032/ov32_022561C0.c b/src/overlay032/ov32_022561C0.c index b9aa5c0867..9b2c60c1b2 100644 --- a/src/overlay032/ov32_022561C0.c +++ b/src/overlay032/ov32_022561C0.c @@ -15,7 +15,7 @@ #include "unk_0200D9E8.h" #include "heap.h" #include "unk_02022594.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "party.h" #include "overlay025/ov25_02253CE0.h" @@ -207,17 +207,17 @@ static void ov32_022563C8 (UnkStruct_ov32_02256470_1 * param0, Party * param1) for (v1 = 0; v1 < param0->unk_00; v1++) { v0 = Party_GetPokemonBySlotIndex(param1, v1); - v2 = sub_02073C88(v0); + v2 = DecryptMon(v0); param0->unk_04[v1].unk_00 = sub_02079D40((const BoxPokemon *)v0); param0->unk_04[v1].unk_04 = GetMonData(v0, MON_DATA_SPECIES, NULL); - param0->unk_04[v1].unk_06 = GetMonData(v0, MON_DATA_163, NULL); - param0->unk_04[v1].unk_08 = GetMonData(v0, MON_DATA_164, NULL); + param0->unk_04[v1].unk_06 = GetMonData(v0, MON_DATA_CURRENT_HP, NULL); + param0->unk_04[v1].unk_08 = GetMonData(v0, MON_DATA_MAX_HP, NULL); param0->unk_04[v1].unk_0A = GetMonData(v0, MON_DATA_HELD_ITEM, NULL); param0->unk_04[v1].unk_0C = (GetMonData(v0, MON_DATA_160, NULL) != 0); param0->unk_04[v1].unk_0E = GetMonData(v0, MON_DATA_IS_EGG, NULL); param0->unk_04[v1].unk_0F = GetMonData(v0, MON_DATA_FORM, NULL); - sub_02073CD4(v0, v2); + EncryptMon(v0, v2); } } diff --git a/src/overlay033/ov33_022561C0.c b/src/overlay033/ov33_022561C0.c index 9fcecf4613..5c52f7e9eb 100644 --- a/src/overlay033/ov33_022561C0.c +++ b/src/overlay033/ov33_022561C0.c @@ -16,7 +16,7 @@ #include "heap.h" #include "unk_02022594.h" #include "unk_020244AC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "party.h" #include "overlay025/ov25_02253CE0.h" diff --git a/src/overlay033/ov33_02256474.c b/src/overlay033/ov33_02256474.c index 4a3937e1f9..f75bea7c03 100644 --- a/src/overlay033/ov33_02256474.c +++ b/src/overlay033/ov33_02256474.c @@ -24,7 +24,7 @@ #include "heap.h" #include "unk_02018340.h" #include "unk_0201D15C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "overlay025/ov25_02253CE0.h" #include "overlay025/ov25_02254560.h" @@ -293,7 +293,7 @@ static void ov33_02256634 (UnkStruct_ov33_02256474 * param0, const UnkStruct_ov3 GF_ASSERT(0); } - param0->unk_134[v5].unk_30 = sub_020759CC(param1->unk_04[v5].unk_04, param1->unk_04[v5].unk_08, 28); + param0->unk_134[v5].unk_30 = GetMonFormPersonalDataAttribute(param1->unk_04[v5].unk_04, param1->unk_04[v5].unk_08, 28); param0->unk_134[v5].unk_31 = 0; param0->unk_134[v5].unk_32 = 0; diff --git a/src/overlay040/ov40_022561C0.c b/src/overlay040/ov40_022561C0.c index 07eedc8005..b47ff8c3ef 100644 --- a/src/overlay040/ov40_022561C0.c +++ b/src/overlay040/ov40_022561C0.c @@ -16,7 +16,7 @@ #include "heap.h" #include "unk_02022594.h" #include "unk_020261E4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "overlay005/ov5_021E622C.h" #include "overlay025/ov25_02253CE0.h" @@ -217,14 +217,14 @@ static void ov40_022563D0 (UnkStruct_ov40_0225645C_1 * param0, UnkStruct_0202631 for (v2 = 0; v2 < param0->unk_00; v2++) { v0 = sub_02026218(param1, v2); v1 = sub_02026220(v0); - v3 = sub_02073D20(v1); + v3 = DecryptBoxMon(v1); param0->unk_04[v2] = sub_02079D40(v1); - param0->unk_1C[v2] = sub_02074570(v1, MON_DATA_SPECIES, NULL); - param0->unk_20[v2] = sub_02074570(v1, MON_DATA_FORM, NULL); + param0->unk_1C[v2] = GetBoxMonData(v1, MON_DATA_SPECIES, NULL); + param0->unk_20[v2] = GetBoxMonData(v1, MON_DATA_FORM, NULL); param0->unk_0C[v2] = ov5_021E6590(v0); - param0->unk_14[v2] = sub_02075D74(v1); + param0->unk_14[v2] = GetBoxMonGender(v1); - sub_02073D48(v1, v3); + EncryptBoxMon(v1, v3); } } diff --git a/src/overlay040/ov40_0225645C.c b/src/overlay040/ov40_0225645C.c index 0ee6c99334..576c1b7cd4 100644 --- a/src/overlay040/ov40_0225645C.c +++ b/src/overlay040/ov40_0225645C.c @@ -18,7 +18,7 @@ #include "unk_0200D9E8.h" #include "heap.h" #include "unk_02018340.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "overlay025/ov25_02253CE0.h" #include "overlay025/ov25_02254560.h" @@ -394,7 +394,7 @@ static void ov40_02256848 (UnkStruct_ov40_0225645C * param0, const UnkStruct_ov4 ov25_02255938(param0->unk_24[2], 1 + sub_02079EDC(1, 0, 1)); if (param1->unk_00 > 0) { - if (sub_020759CC(param1->unk_1C[0], param1->unk_20[0], 28)) { + if (GetMonFormPersonalDataAttribute(param1->unk_1C[0], param1->unk_20[0], 28)) { ov25_022558C4(param0->unk_24[0], 6); } else { ov25_022558C4(param0->unk_24[0], 7); diff --git a/src/overlay044/ov44_022561C0.c b/src/overlay044/ov44_022561C0.c index 679adf6198..31b1fd2276 100644 --- a/src/overlay044/ov44_022561C0.c +++ b/src/overlay044/ov44_022561C0.c @@ -16,7 +16,7 @@ #include "unk_0200D9E8.h" #include "heap.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "party.h" #include "overlay005/ov5_021E622C.h" diff --git a/src/overlay044/ov44_022565BC.c b/src/overlay044/ov44_022565BC.c index 98d4302326..684ee1f1a3 100644 --- a/src/overlay044/ov44_022565BC.c +++ b/src/overlay044/ov44_022565BC.c @@ -17,7 +17,7 @@ #include "unk_02006E3C.h" #include "heap.h" #include "unk_02018340.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "overlay025/ov25_02253CE0.h" #include "overlay025/ov25_02254560.h" @@ -330,7 +330,7 @@ static void ov44_02256954 (UnkStruct_ov44_022565BC * param0, u32 param1, u32 par if (param1 == 5) { v1 = 4; } else { - if (sub_020759CC(param3, param4, 28)) { + if (GetMonFormPersonalDataAttribute(param3, param4, 28)) { v1 = 4; } else { v1 = 5; diff --git a/src/overlay057/ov57_021D0D80.c b/src/overlay057/ov57_021D0D80.c index a6a0ebbd56..da1f41344d 100644 --- a/src/overlay057/ov57_021D0D80.c +++ b/src/overlay057/ov57_021D0D80.c @@ -33,7 +33,7 @@ #include "unk_0202B37C.h" #include "unk_0205C980.h" #include "unk_0206B9D8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay057/ov57_021D0F30.h" @@ -137,7 +137,7 @@ static int ov57_021D0E34 (UnkStruct_020067E8 * param0, int * param1) if (!sub_02025D10(v1) || !sub_02025D40(v1)) { sub_02025DE8(sub_02025CD8(v0)); sub_02025CE4(v1); - sub_02077B8C(Party_GetFromSavedata(v0)); + SetShayminLandForm(Party_GetFromSavedata(v0)); } sub_02017434(sub_02025E5C(v0)); diff --git a/src/overlay062/ov62_02239D60.c b/src/overlay062/ov62_02239D60.c index 6d246f93e9..8238a42029 100644 --- a/src/overlay062/ov62_02239D60.c +++ b/src/overlay062/ov62_02239D60.c @@ -10,7 +10,7 @@ #include "struct_decls/struct_0200C704_decl.h" #include "strbuf.h" #include "struct_decls/struct_02023FCC_decl.h" -#include "struct_decls/struct_02075874_decl.h" +#include "struct_defs/pokemon_personal_data.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_021C0794_decl.h" @@ -46,7 +46,7 @@ #include "unk_02023FCC.h" #include "unk_0202440C.h" #include "unk_02030A80.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "unk_02079D40.h" #include "unk_0208B284.h" @@ -1178,7 +1178,7 @@ static void ov62_0223AFEC (UnkStruct_0208C06C * param0) static void ov62_0223B050 (UnkStruct_0208C06C * param0) { UnkStruct_ov62_02239DBC * v0 = param0->unk_860; - UnkStruct_02075874 * v1; + PokemonPersonalData * v1; UnkStruct_02008A90 v2; u8 v3; u8 v4; @@ -1204,15 +1204,15 @@ static void ov62_0223B050 (UnkStruct_0208C06C * param0) v7 = 494; } - v1 = sub_02075894(v7, 102); - v3 = sub_02075DAC(v7, v8); - v4 = sub_02075E38(v5, v8); + v1 = GetMonPersonalData(v7, 102); + v3 = GetMonPersonalityGender(v7, v8); + v4 = GetMonPersonalityShininess(v5, v8); v9 = sub_02076648(v7, v3, v10, v6, v8); v9 = 0; sub_02075FB4(&v2, v7, v3, v10, v4, v6, v8); v0->unk_32C = sub_02007C34(param0->unk_14.unk_50, &v2, 42, 91 + v9, 0, 0, NULL, NULL); - sub_020759B8(v1); + FreeMonPersonalData(v1); } static void ov62_0223B124 (UnkStruct_0208C06C * param0, int param1) diff --git a/src/overlay062/ov62_02248408.c b/src/overlay062/ov62_02248408.c index 2aabb205b5..f7f7757cb0 100644 --- a/src/overlay062/ov62_02248408.c +++ b/src/overlay062/ov62_02248408.c @@ -18,7 +18,7 @@ #include "unk_0202440C.h" #include "unk_020244AC.h" #include "unk_0202F1D4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay062/ov62_02248408.h" @@ -82,7 +82,7 @@ void ov62_02248408 (UnkStruct_0202F264 * param0, BattleParams * param1, int para Strbuf_CopyChars(v6, v8); if (sub_02002DB4(0, v6, v7) == 0) { - sub_02074B30(v13, 179, NULL); + SetMonData(v13, 179, NULL); continue; } } diff --git a/src/overlay064/ov64_0222DCE0.c b/src/overlay064/ov64_0222DCE0.c index 8cc304ad94..9b39b1bbb8 100644 --- a/src/overlay064/ov64_0222DCE0.c +++ b/src/overlay064/ov64_0222DCE0.c @@ -85,7 +85,7 @@ #include "unk_0203909C.h" #include "unk_020507CC.h" #include "unk_0205C980.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0207D3B8.h" #include "unk_0208694C.h" #include "unk_020890F4.h" diff --git a/src/overlay065/ov65_0222DCE0.c b/src/overlay065/ov65_0222DCE0.c index 05a6bfa1c5..0a51154919 100644 --- a/src/overlay065/ov65_0222DCE0.c +++ b/src/overlay065/ov65_0222DCE0.c @@ -98,7 +98,7 @@ #include "unk_0203909C.h" #include "unk_020393C8.h" #include "unk_020507CC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "unk_0207DFAC.h" @@ -668,7 +668,7 @@ static int ov65_0222DF88 (UnkStruct_ov65_0222EBE0 * param0) for (v3 = 0; v3 < v2; v3++) { v1 = Party_GetPokemonBySlotIndex(v0, v3); - if (GetMonData(v1, MON_DATA_163, NULL) == 0) { + if (GetMonData(v1, MON_DATA_CURRENT_HP, NULL) == 0) { continue; } diff --git a/src/overlay066/ov66_0222DDF0.c b/src/overlay066/ov66_0222DDF0.c index fac47dd73c..ddfb8a3cdb 100644 --- a/src/overlay066/ov66_0222DDF0.c +++ b/src/overlay066/ov66_0222DDF0.c @@ -61,7 +61,7 @@ #include "unk_0202C858.h" #include "unk_0202CD50.h" #include "unk_02030EA4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207E060.h" #include "overlay066/ov66_0222DDF0.h" diff --git a/src/overlay070/ov70_0225D9A4.c b/src/overlay070/ov70_0225D9A4.c index 60b123c3d5..d9d2abdd81 100644 --- a/src/overlay070/ov70_0225D9A4.c +++ b/src/overlay070/ov70_0225D9A4.c @@ -88,7 +88,7 @@ #include "unk_020279FC.h" #include "unk_020366A0.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0207C908.h" #include "overlay066/ov66_0222DDF0.h" #include "overlay066/ov66_02231428.h" diff --git a/src/overlay073/ov73_021D0D80.c b/src/overlay073/ov73_021D0D80.c index e85cf05234..bdd6a9c04b 100644 --- a/src/overlay073/ov73_021D0D80.c +++ b/src/overlay073/ov73_021D0D80.c @@ -60,7 +60,7 @@ #include "unk_02025E68.h" #include "unk_020277A4.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0208694C.h" FS_EXTERN_OVERLAY(overlay57); diff --git a/src/overlay076/ov76_0223B870.c b/src/overlay076/ov76_0223B870.c index bd91509004..9403aacfd3 100644 --- a/src/overlay076/ov76_0223B870.c +++ b/src/overlay076/ov76_0223B870.c @@ -51,7 +51,7 @@ #include "unk_0202419C.h" #include "unk_02024220.h" #include "unk_0202C9F4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "unk_02097B18.h" #include "overlay012/ov12_02225864.h" @@ -873,12 +873,12 @@ void ov76_0223C80C (UnkStruct_ov76_0223DE00 * param0, int param1, int param2) if (v1 != 0xff) { v3 = param2 + 1; - sub_02074B30(param0->unk_00->unk_04[v1], 162, (u8 *)&v3); + SetMonData(param0->unk_00->unk_04[v1], 162, (u8 *)&v3); } if (v2 != 0xff) { v4 = param1 + 1; - sub_02074B30(param0->unk_00->unk_04[v2], 162, (u8 *)&v4); + SetMonData(param0->unk_00->unk_04[v2], 162, (u8 *)&v4); } v0 = param0->unk_04[param1].unk_00; diff --git a/src/overlay076/ov76_0223D338.c b/src/overlay076/ov76_0223D338.c index b357e9f8ea..c41e0b57d4 100644 --- a/src/overlay076/ov76_0223D338.c +++ b/src/overlay076/ov76_0223D338.c @@ -50,7 +50,7 @@ #include "unk_02023FCC.h" #include "unk_0202C9F4.h" #include "unk_0202CD50.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02097B18.h" #include "overlay012/ov12_02235E94.h" #include "overlay076/ov76_0223B140.h" @@ -732,7 +732,7 @@ static void ov76_0223DE00 (UnkStruct_ov76_0223DE00 * param0) int v1; v0 = GetMonData(param0->unk_428, MON_DATA_SPECIES, NULL); - v1 = sub_02075BCC(param0->unk_428); + v1 = GetMonNature(param0->unk_428); sub_02007B98(param0->unk_D4.unk_D4, 1); sub_020789F4(param0->unk_42C, param0->unk_D4.unk_188, param0->unk_D4.unk_D4, v0, 2, 0, 0); @@ -882,8 +882,8 @@ static BOOL ov76_0223DF94 (UnkStruct_ov76_0223DE00 * param0) v1 = param0->unk_3C4[0] + 1; ov76_0223B848(&v2, param0); - sub_02074B30(param0->unk_428, 162, (u8 *)&v1); - sub_02074B30(param0->unk_428, 171, &v2); + SetMonData(param0->unk_428, 162, (u8 *)&v1); + SetMonData(param0->unk_428, 171, &v2); param0->unk_D4.unk_154 = ov12_02236004(53, &v3); ov12_02236320(param0->unk_D4.unk_154); @@ -1015,7 +1015,7 @@ static BOOL ov76_0223DF94 (UnkStruct_ov76_0223DE00 * param0) if (param0->unk_264[param0->unk_3C4[0]].unk_00 != 0xff) { v8 = param0->unk_00->unk_04[param0->unk_264[param0->unk_3C4[0]].unk_00]; - sub_02074B30(v8, 171, sub_0202CA28(param0->unk_00->unk_20, param0->unk_3C4[0])); + SetMonData(v8, 171, sub_0202CA28(param0->unk_00->unk_20, param0->unk_3C4[0])); } } param0->unk_3D4 = 8; @@ -1244,7 +1244,7 @@ void ov76_0223E91C (UnkStruct_ov76_0223DE00 * param0, int param1) v1 = param0->unk_04[param1].unk_00; if (v1 != 0xff) { - sub_02074B30(param0->unk_00->unk_04[v1], 162, (u8 *)&v2); + SetMonData(param0->unk_00->unk_04[v1], 162, (u8 *)&v2); } param0->unk_04[param1].unk_00 = 0xff; diff --git a/src/overlay077/ov77_021D6C70.c b/src/overlay077/ov77_021D6C70.c index 2297a4146c..0921daa9c5 100644 --- a/src/overlay077/ov77_021D6C70.c +++ b/src/overlay077/ov77_021D6C70.c @@ -16,7 +16,7 @@ #include "heap.h" #include "unk_02020020.h" #include "unk_0202419C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay077/ov77_021D6C70.h" typedef struct UnkStruct_ov77_021D6CFC_t { diff --git a/src/overlay078/ov78_021D0D80.c b/src/overlay078/ov78_021D0D80.c index 9486361f49..ff03e08b2e 100644 --- a/src/overlay078/ov78_021D0D80.c +++ b/src/overlay078/ov78_021D0D80.c @@ -71,7 +71,7 @@ #include "strbuf.h" #include "unk_0202419C.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay078/ov78_021D0D80.h" typedef struct { @@ -663,7 +663,7 @@ static void ov78_021D1468 (UnkStruct_02007C7C ** param0, UnkStruct_ov78_021D107C UnkStruct_02008A90 v0; int v1; - v1 = sub_02075DAC(param2, 0); + v1 = GetMonPersonalityGender(param2, 0); sub_02075FB4(&v0, param2, v1, 2, 0, NULL, NULL); diff --git a/src/overlay079/ov79_021D2268.c b/src/overlay079/ov79_021D2268.c index 6ffdac3e1f..80308c0c75 100644 --- a/src/overlay079/ov79_021D2268.c +++ b/src/overlay079/ov79_021D2268.c @@ -54,7 +54,7 @@ #include "strbuf.h" #include "unk_02034198.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0208C098.h" #include "unk_020989DC.h" #include "unk_02098FFC.h" @@ -528,9 +528,9 @@ static void ov79_021D27D8 (UnkStruct_ov79_021D2928 * param0) { param0->unk_30.unk_00 = param0->unk_10->unk_00; param0->unk_30.unk_04 = GetMonData(param0->unk_10->unk_00, MON_DATA_SPECIES, NULL); - param0->unk_30.unk_07 = sub_02075D6C(param0->unk_10->unk_00); - param0->unk_30.unk_06 = sub_02075BCC(param0->unk_10->unk_00); - param0->unk_30.unk_08 = sub_020759CC(param0->unk_30.unk_04, GetMonData(param0->unk_10->unk_00, MON_DATA_FORM, NULL), 28) ^ 1; + param0->unk_30.unk_07 = GetMonGender(param0->unk_10->unk_00); + param0->unk_30.unk_06 = GetMonNature(param0->unk_10->unk_00); + param0->unk_30.unk_08 = GetMonFormPersonalDataAttribute(param0->unk_30.unk_04, GetMonData(param0->unk_10->unk_00, MON_DATA_FORM, NULL), 28) ^ 1; param0->unk_30.unk_0C = Strbuf_Init(12, param0->unk_00); GetMonData(param0->unk_10->unk_00, MON_DATA_119, param0->unk_30.unk_0C); diff --git a/src/overlay079/ov79_021D3768.c b/src/overlay079/ov79_021D3768.c index be65817311..74c7672616 100644 --- a/src/overlay079/ov79_021D3768.c +++ b/src/overlay079/ov79_021D3768.c @@ -12,7 +12,7 @@ #include "gx_layers.h" #include "unk_02020020.h" #include "unk_0202419C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay079/ov79_021D3768.h" static void ov79_021D3870(UnkStruct_ov79_021D3820 * param0, int param1); diff --git a/src/overlay081/ov81_021D1610.c b/src/overlay081/ov81_021D1610.c index 3ea67c3e9d..97accc13e5 100644 --- a/src/overlay081/ov81_021D1610.c +++ b/src/overlay081/ov81_021D1610.c @@ -22,7 +22,7 @@ #include "strbuf.h" #include "unk_0202B604.h" #include "map_header.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079170.h" #include "overlay081/ov81_021D1610.h" @@ -825,7 +825,7 @@ static void ov81_021D28C8 (UnkStruct_ov81_021D1610 * param0, u16 param1, u8 para Pokemon * v0 = AllocMonZeroed(42); sub_02074088(v0, param1, 1, 32, param2, 0, 0); - sub_0200B538(param0->unk_54, param3, sub_02076B10(v0)); + sub_0200B538(param0->unk_54, param3, GetBoxMon(v0)); Heap_FreeToHeap(v0); } diff --git a/src/overlay086/ov86_0223B140.c b/src/overlay086/ov86_0223B140.c index 6f76f61eb7..3cf23780d6 100644 --- a/src/overlay086/ov86_0223B140.c +++ b/src/overlay086/ov86_0223B140.c @@ -60,7 +60,7 @@ #include "strbuf.h" #include "unk_02025E68.h" #include "unk_0202CBE4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay086/ov86_0223B140.h" @@ -1303,10 +1303,10 @@ static void ov86_0223C47C (UnkStruct_ov86_0223C3E4 * param0, int param1) static void ov86_0223C4DC (UnkStruct_ov86_0223C3E4 * param0) { - sub_0200B538(param0->unk_14, 0, sub_02076B10(param0->unk_24)); - sub_0200B60C(param0->unk_14, 1, sub_02075B38(param0->unk_24), 3, 0, 1); + sub_0200B538(param0->unk_14, 0, GetBoxMon(param0->unk_24)); + sub_0200B60C(param0->unk_14, 1, GetMonLevel(param0->unk_24), 3, 0, 1); - switch (sub_02075D6C(param0->unk_24)) { + switch (GetMonGender(param0->unk_24)) { case 0: MessageLoader_GetStrbuf(param0->unk_20, 1, param0->unk_18); break; @@ -1364,7 +1364,7 @@ static void ov86_0223C58C (UnkStruct_0201CD38 * param0, void * param1) v0->unk_34++; break; case 2: - sub_0200B5EC(v0->unk_14, 0, sub_02076B10(v0->unk_24)); + sub_0200B5EC(v0->unk_14, 0, GetBoxMon(v0->unk_24)); MessageLoader_GetStrbuf(v0->unk_20, 4, v0->unk_18); sub_0200C388(v0->unk_14, v0->unk_1C, v0->unk_18); ov86_0223C47C(v0, 96); @@ -1921,7 +1921,7 @@ static int ov86_0223D2A8 (UnkStruct_ov86_0223B3C8 * param0, Pokemon * param1, co BOOL v0; int v1 = 6; - v0 = sub_02073C88(param1); + v0 = DecryptMon(param1); do { { @@ -1979,7 +1979,7 @@ static int ov86_0223D2A8 (UnkStruct_ov86_0223B3C8 * param0, Pokemon * param1, co } } while (0); - sub_02073CD4(param1, v0); + EncryptMon(param1, v0); return v1; } diff --git a/src/overlay087/ov87_021D106C.c b/src/overlay087/ov87_021D106C.c index 40bd2c0f5a..d718d3e3b0 100644 --- a/src/overlay087/ov87_021D106C.c +++ b/src/overlay087/ov87_021D106C.c @@ -42,7 +42,7 @@ #include "gx_layers.h" #include "unk_020218BC.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay087/ov87_021D106C.h" typedef struct UnkStruct_ov87_021D106C_t { @@ -411,7 +411,7 @@ static void ov87_021D1640 (UnkStruct_ov87_021D106C * param0) MessageLoader_GetStrbuf(param0->unk_1E8, v1->unk_10, param0->unk_1F4); sub_0201D738(v2, 0, param0->unk_1F4, 94, 0, 0xff, NULL); - switch (sub_02075DAC(v1->unk_10, v1->unk_08)) { + switch (GetMonPersonalityGender(v1->unk_10, v1->unk_08)) { case 0: MessageLoader_GetStrbuf(param0->unk_1E4, 3, param0->unk_1F4); break; @@ -552,7 +552,7 @@ static void ov87_021D1970 (UnkStruct_ov87_021D106C * param0) for (v3 = 0; v3 < v2->unk_14; v3++) { sub_02073D80(param0->unk_1FC, v2->unk_20[v3].unk_10, v2->unk_20[v3].unk_12, 32, 1, v2->unk_20[v3].unk_08, 1, v2->unk_20[v3].unk_0C); - sub_02074B30(param0->unk_1FC, 112, (void *)(&(v2->unk_20[v3].unk_13))); + SetMonData(param0->unk_1FC, 112, (void *)(&(v2->unk_20[v3].unk_13))); sub_02075EF4(&v1, param0->unk_1FC, 2); sub_02013720(v1.unk_00, v1.unk_02, 61, &v0, param0->unk_200, v2->unk_20[v3].unk_08, 0, 2, v2->unk_20[v3].unk_10); diff --git a/src/overlay088/ov88_0223B140.c b/src/overlay088/ov88_0223B140.c index de5e74c46f..637ea37dde 100644 --- a/src/overlay088/ov88_0223B140.c +++ b/src/overlay088/ov88_0223B140.c @@ -91,7 +91,7 @@ #include "unk_020393C8.h" #include "unk_020507CC.h" #include "unk_0206AFE0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "party.h" #include "item.h" @@ -516,7 +516,7 @@ static void ov88_0223B710 (UnkStruct_0200B358 * param0, Party * param1, int para int v0; for (v0 = 0; v0 < Party_GetCurrentCount(param1); v0++) { - sub_0200B5CC(param0, v0 + param2, sub_02076B10(Party_GetPokemonBySlotIndex(param1, v0))); + sub_0200B5CC(param0, v0 + param2, GetBoxMon(Party_GetPokemonBySlotIndex(param1, v0))); } } @@ -768,21 +768,21 @@ static void ov88_0223BD18 (Pokemon * param0, UnkStruct_ov88_0223C8AC * param1) { int v0, v1; - v0 = sub_02073C88(param0); + v0 = DecryptMon(param0); param1->unk_04 = GetMonData(param0, MON_DATA_POKEBALL, NULL); param1->unk_00 = GetMonData(param0, MON_DATA_SPECIES, NULL); param1->unk_06 = GetMonData(param0, MON_DATA_FORM, NULL); param1->unk_05 = GetMonData(param0, MON_DATA_IS_EGG, NULL); - param1->unk_08 = GetMonData(param0, MON_DATA_111, NULL); + param1->unk_08 = GetMonData(param0, MON_DATA_GENDER, NULL); param1->unk_0C = GetMonData(param0, MON_DATA_162, NULL); v1 = GetMonData(param0, MON_DATA_HELD_ITEM, NULL); - sub_02073CD4(param0, v0); + EncryptMon(param0, v0); if (param1->unk_00 != 0) { - param1->unk_0A = sub_020759CC(param1->unk_00, param1->unk_06, 28); + param1->unk_0A = GetMonFormPersonalDataAttribute(param1->unk_00, param1->unk_06, 28); } if (v1 != 0) { @@ -1373,7 +1373,7 @@ static void ov88_0223C8D8 (UnkStruct_0205AA50 * param0, int param1, Party * para MessageLoader_GetStrbuf(param4->unk_184, 41, v0); ov88_0223EC78(¶m0[28 + param1], v0, 9, 0xff, 6, 0); - v3 = GetMonData(Party_GetPokemonBySlotIndex(param2, param3), MON_DATA_161, NULL); + v3 = GetMonData(Party_GetPokemonBySlotIndex(param2, param3), MON_DATA_LEVEL, NULL); Strbuf_FormatInt(v0, v3, 3, 0, 1); ov88_0223EC78(¶m0[28 + param1], v0, 9, 0, 24 + 6, 0); Strbuf_Free(v0); @@ -2099,7 +2099,7 @@ static int ov88_0223DA3C (UnkStruct_02095E80 * param0) v0.unk_0B_4 = 0; v0.unk_0B_6 = 0; - sub_0200B5CC(param0->unk_17C, 0, sub_02076B10(Party_GetPokemonBySlotIndex(param0->unk_2270, param0->unk_88[0]))); + sub_0200B5CC(param0->unk_17C, 0, GetBoxMon(Party_GetPokemonBySlotIndex(param0->unk_2270, param0->unk_88[0]))); sub_02019CB8(param0->unk_174, 0, 0, 0, 0, 32, 24, 0); ov88_0223ECBC(¶m0->unk_49C[22], 16, 1, param0->unk_184, param0->unk_17C); @@ -2309,8 +2309,8 @@ static void ov88_0223DFF4 (UnkStruct_02095E80 * param0) static int ov88_0223E110 (UnkStruct_02095E80 * param0) { sub_02019CB8(param0->unk_174, 0, 0, 0, 0, 32, 24, 0); - sub_0200B5CC(param0->unk_17C, 0, sub_02076B10(Party_GetPokemonBySlotIndex(param0->unk_2270, param0->unk_88[0]))); - sub_0200B5CC(param0->unk_17C, 1, sub_02076B10(Party_GetPokemonBySlotIndex(param0->unk_2274, param0->unk_88[1] - 6))); + sub_0200B5CC(param0->unk_17C, 0, GetBoxMon(Party_GetPokemonBySlotIndex(param0->unk_2270, param0->unk_88[0]))); + sub_0200B5CC(param0->unk_17C, 1, GetBoxMon(Party_GetPokemonBySlotIndex(param0->unk_2274, param0->unk_88[1] - 6))); ov88_0223ECBC(¶m0->unk_49C[23], 21, 1, param0->unk_184, param0->unk_17C); param0->unk_226C = ov88_0223E20C; @@ -2447,7 +2447,7 @@ static int ov88_0223E4BC (UnkStruct_02095E80 * param0) v0.unk_0B_4 = 0; v0.unk_0B_6 = 0; - sub_0200B5CC(param0->unk_17C, 0, sub_02076B10(Party_GetPokemonBySlotIndex(param0->unk_2274, param0->unk_88[0] - 6))); + sub_0200B5CC(param0->unk_17C, 0, GetBoxMon(Party_GetPokemonBySlotIndex(param0->unk_2274, param0->unk_88[0] - 6))); sub_02019CB8(param0->unk_174, 0, 0, 0, 0, 32, 24, 0); ov88_0223ECBC(¶m0->unk_49C[22], 16, 1, param0->unk_184, param0->unk_17C); @@ -2512,11 +2512,11 @@ static void ov88_0223E694 (Party * param0, Party * param1, int param2, int param } } - sub_02074B30(v1, 111, NULL); + SetMonData(v1, 111, NULL); if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { u8 v3 = 70; - sub_02074B30(v1, 9, &v3); + SetMonData(v1, 9, &v3); } sub_0209304C(v1, sub_02032EE8(sub_0203608C()), 5, 0, 11); @@ -2548,7 +2548,7 @@ static void ov88_0223E7F0 (UnkStruct_0202B628 * param0, Pokemon * param1) u16 v2[10 + 1]; GetMonData(param1, MON_DATA_117, v2); - v0 = sub_0202C11C((u16 *)sub_02025EF0(v1), sub_02025F30(v1), v2, sub_02075D6C(param1), 26); + v0 = sub_0202C11C((u16 *)sub_02025EF0(v1), sub_02025F30(v1), v2, GetMonGender(param1), 26); sub_0202B758(param0, v0, 4); } diff --git a/src/overlay091/ov91_021D0D80.c b/src/overlay091/ov91_021D0D80.c index c1e0955656..053dfa44cb 100644 --- a/src/overlay091/ov91_021D0D80.c +++ b/src/overlay091/ov91_021D0D80.c @@ -56,7 +56,7 @@ #include "unk_020218BC.h" #include "strbuf.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "unk_0207C908.h" #include "unk_0208C098.h" @@ -756,13 +756,13 @@ static int ov91_021D13E4 (UnkStruct_ov91_021D0ED8 * param0) u32 v0; v0 = ov91_021D1DD0(param0); - sub_02074B30(param0->unk_00->unk_00, 54 + param0->unk_00->unk_17, &v0); + SetMonData(param0->unk_00->unk_00, 54 + param0->unk_00->unk_17, &v0); v0 = 0; - sub_02074B30(param0->unk_00->unk_00, 62 + param0->unk_00->unk_17, &v0); + SetMonData(param0->unk_00->unk_00, 62 + param0->unk_00->unk_17, &v0); v0 = MoveTable_CalcMaxPP(ov91_021D1DD0(param0), 0); - sub_02074B30(param0->unk_00->unk_00, 58 + param0->unk_00->unk_17, &v0); + SetMonData(param0->unk_00->unk_00, 58 + param0->unk_00->unk_17, &v0); param0->unk_00->unk_16 = 0; @@ -1107,35 +1107,35 @@ static void ov91_021D1C10 (UnkStruct_ov91_021D0ED8 * param0, u32 param1) switch (param1) { case 0: - sub_0200B5CC(param0->unk_FC, 0, sub_02076B10(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, GetBoxMon(param0->unk_00->unk_00)); break; case 1: sub_0200B630(param0->unk_FC, 1, ov91_021D1DD0(param0)); break; case 2: - sub_0200B5CC(param0->unk_FC, 0, sub_02076B10(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, GetBoxMon(param0->unk_00->unk_00)); break; case 3: - sub_0200B5CC(param0->unk_FC, 0, sub_02076B10(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, GetBoxMon(param0->unk_00->unk_00)); sub_0200B630(param0->unk_FC, 1, ov91_021D1DD0(param0)); break; case 4: - sub_0200B5CC(param0->unk_FC, 0, sub_02076B10(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, GetBoxMon(param0->unk_00->unk_00)); sub_0200B630(param0->unk_FC, 1, ov91_021D1DD0(param0)); break; case 5: - sub_0200B5CC(param0->unk_FC, 0, sub_02076B10(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, GetBoxMon(param0->unk_00->unk_00)); sub_0200B630(param0->unk_FC, 1, ov91_021D1DE0(param0)); break; case 6: - sub_0200B5CC(param0->unk_FC, 0, sub_02076B10(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, GetBoxMon(param0->unk_00->unk_00)); sub_0200B630(param0->unk_FC, 1, ov91_021D1DD0(param0)); break; case 7: sub_0200B630(param0->unk_FC, 1, ov91_021D1DD0(param0)); break; case 8: - sub_0200B5CC(param0->unk_FC, 0, sub_02076B10(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, GetBoxMon(param0->unk_00->unk_00)); sub_0200B630(param0->unk_FC, 1, ov91_021D1DD0(param0)); break; case 9: diff --git a/src/overlay094/ov94_0223D0C4.c b/src/overlay094/ov94_0223D0C4.c index 6d1f3710e0..887741fb7a 100644 --- a/src/overlay094/ov94_0223D0C4.c +++ b/src/overlay094/ov94_0223D0C4.c @@ -41,7 +41,7 @@ #include "strbuf.h" #include "unk_020279FC.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "item.h" #include "overlay094/ov94_0223BCB0.h" @@ -92,7 +92,7 @@ int ov94_0223D0C4 (UnkStruct_ov94_0223FD4C * param0, int param1) ov94_0223D2E8(param0); ov94_0223D438(param0); ov94_0223D3DC(param0); - ov94_0223D910(param0->unk_B90, param0->unk_B94, param0->unk_B8C, ¶m0->unk_FCC[0], sub_02076B10((Pokemon *)param0->unk_12C.unk_00.unk_00), ¶m0->unk_12C.unk_EC); + ov94_0223D910(param0->unk_B90, param0->unk_B94, param0->unk_B8C, ¶m0->unk_FCC[0], GetBoxMon((Pokemon *)param0->unk_12C.unk_00.unk_00), ¶m0->unk_12C.unk_EC); v0 = (Pokemon *)param0->unk_12C.unk_00.unk_00; @@ -506,7 +506,7 @@ static void ov94_0223D88C (UnkStruct_ov94_0223FD4C * param0, int param1, int par { Strbuf* v0; - sub_0200B538(param0->unk_B8C, 0, sub_02076B10(param5)); + sub_0200B538(param0->unk_B8C, 0, GetBoxMon(param5)); v0 = MessageLoader_GetNewStrbuf(param0->unk_B90, param1); sub_0200C388(param0->unk_B8C, param0->unk_BAC, v0); sub_0201ADA4(¶m0->unk_F5C, 0xf0f); @@ -530,12 +530,12 @@ void ov94_0223D910 (MessageLoader * param0, MessageLoader * param1, UnkStruct_02 Strbuf* v5 = Strbuf_Init((8 + 1) * 2, 62); int v6, v7, v8, v9, v10; - sub_02074570(param4, MON_DATA_119, v4); + GetBoxMonData(param4, MON_DATA_119, v4); v10 = param5->unk_00; v6 = param5->unk_02; v7 = param5->unk_03; - v8 = sub_02074570(param4, MON_DATA_HELD_ITEM, NULL); + v8 = GetBoxMonData(param4, MON_DATA_HELD_ITEM, NULL); v3 = MessageLoader_GetNewStrbuf(param0, 70); v1 = MessageLoader_GetNewStrbuf(param0, Unk_ov94_02245FD8[v6]); diff --git a/src/overlay094/ov94_0223DC04.c b/src/overlay094/ov94_0223DC04.c index 32d615ee37..a461e87a86 100644 --- a/src/overlay094/ov94_0223DC04.c +++ b/src/overlay094/ov94_0223DC04.c @@ -31,7 +31,7 @@ #include "strbuf.h" #include "unk_020279FC.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay094/ov94_0223BCB0.h" #include "overlay094/ov94_0223D0C4.h" #include "overlay094/ov94_0223DC04.h" @@ -80,7 +80,7 @@ int ov94_0223DC04 (UnkStruct_ov94_0223FD4C * param0, int param1) ov94_0223DE04(param0); ov94_0223DED8(param0); ov94_0223DE7C(param0); - ov94_0223D910(param0->unk_B90, param0->unk_B94, param0->unk_B8C, ¶m0->unk_FCC[0], sub_02076B10((Pokemon *)param0->unk_250[param0->unk_11C].unk_00.unk_00), ¶m0->unk_250[param0->unk_11C].unk_EC); + ov94_0223D910(param0->unk_B90, param0->unk_B94, param0->unk_B8C, ¶m0->unk_FCC[0], GetBoxMon((Pokemon *)param0->unk_250[param0->unk_11C].unk_00.unk_00), ¶m0->unk_250[param0->unk_11C].unk_EC); v0 = (Pokemon *)param0->unk_250[param0->unk_11C].unk_00.unk_00; diff --git a/src/overlay094/ov94_0223E46C.c b/src/overlay094/ov94_0223E46C.c index e1c632a05f..6ad98e8015 100644 --- a/src/overlay094/ov94_0223E46C.c +++ b/src/overlay094/ov94_0223E46C.c @@ -39,7 +39,7 @@ #include "unk_0202DA40.h" #include "unk_020366A0.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay094/ov94_0223B140.h" #include "overlay094/ov94_0223BCB0.h" #include "overlay094/ov94_0223E46C.h" @@ -428,7 +428,7 @@ static int ov94_0223EA84 (UnkStruct_ov94_0223FD4C * param0) break; case 1: if (param0->unk_B7A.unk_00 != 0) { - param0->unk_10E4->unk_20 = sub_020759F0(param0->unk_B7A.unk_00, 18); + param0->unk_10E4->unk_20 = GetMonSpeciesPersonalDataAttribute(param0->unk_B7A.unk_00, 18); if (ov94_02241B80(¶m0->unk_B7A, param0->unk_10E4->unk_20)) { sub_02005748(1500); @@ -843,7 +843,7 @@ static int ov94_0223F2B0 (UnkStruct_ov94_0223FD4C * param0) sub_0201ADA4(¶m0->unk_FCC[1], 0x0); ov94_02242158(¶m0->unk_FCC[1], param0->unk_B94, v0, 0, 0, (u32)(((1 & 0xff) << 16) | ((2 & 0xff) << 8) | ((0 & 0xff) << 0))); - param0->unk_10E4->unk_20 = sub_020759F0(v0, 18); + param0->unk_10E4->unk_20 = GetMonSpeciesPersonalDataAttribute(v0, 18); ov94_02242AC4(¶m0->unk_111C, param0->unk_10E4->unk_06 + param0->unk_10E4->unk_04, param0->unk_10E4->unk_0A, param0->unk_10E4->unk_08); if (ov94_02241B80(¶m0->unk_B7A, param0->unk_10E4->unk_20)) { diff --git a/src/overlay094/ov94_0223FB48.c b/src/overlay094/ov94_0223FB48.c index 5c2f197f0d..e07b9cad2f 100644 --- a/src/overlay094/ov94_0223FB48.c +++ b/src/overlay094/ov94_0223FB48.c @@ -42,7 +42,7 @@ #include "strbuf.h" #include "unk_020279FC.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "unk_02079D40.h" #include "party.h" @@ -1069,7 +1069,7 @@ static void ov94_02240DF8 (int param0, int param1, int param2, int param3, UnkSt static void ov94_02240E50 (BoxPokemon * param0, UnkStruct_ov94_0223BA88_sub2 * param1) { - param1->unk_03 = sub_02075B40(param0); + param1->unk_03 = GetBoxMonLevel(param0); } static void ov94_02240E5C (void * param0) @@ -1094,23 +1094,23 @@ static void ov94_02240EAC (BoxPokemon * param0, UnkStruct_02022550 * param1, Unk { int v0, v1, v2, v3; - sub_02073D20(param0); + DecryptBoxMon(param0); - v0 = sub_02074570(param0, MON_DATA_172, NULL); - *param3 = sub_02074570(param0, MON_DATA_SPECIES, NULL); + v0 = GetBoxMonData(param0, MON_DATA_172, NULL); + *param3 = GetBoxMonData(param0, MON_DATA_SPECIES, NULL); - v3 = sub_02074570(param0, MON_DATA_FORM, NULL); - v2 = sub_02074570(param0, MON_DATA_IS_EGG, NULL); - v1 = sub_02074570(param0, MON_DATA_HELD_ITEM, NULL); + v3 = GetBoxMonData(param0, MON_DATA_FORM, NULL); + v2 = GetBoxMonData(param0, MON_DATA_IS_EGG, NULL); + v1 = GetBoxMonData(param0, MON_DATA_HELD_ITEM, NULL); param6->unk_00 = *param3; - param6->unk_02 = sub_02074570(param0, MON_DATA_111, NULL) + 1; + param6->unk_02 = GetBoxMonData(param0, MON_DATA_GENDER, NULL) + 1; if (v2) { param6->unk_03 = 0; } - sub_02073D48(param0, 1); + EncryptBoxMon(param0, 1); if (v0) { ov94_02240DF8(*param3, v3, v2, param4, param1, param5, param7); @@ -1167,7 +1167,7 @@ static void ov94_02240FA0 (UnkStruct_ov94_0223FD4C * param0, int param1) for (v1 = 0; v1 < v8; v1++) { v3 = Party_GetPokemonBySlotIndex(param0->unk_00->unk_08, v1); - v4 = sub_02076B10(v3); + v4 = GetBoxMon(v3); ov94_02240E50(v4, ¶m0->unk_1108->unk_00[v1]); ov94_02240EAC(v4, param0->unk_E28[v1], param0->unk_EA0[v1], &v0[v1], v1, v6, ¶m0->unk_1108->unk_00[v1], &v7[v1]); @@ -1221,7 +1221,7 @@ BoxPokemon * ov94_022411DC (Party * param0, UnkStruct_020797DC * param1, int par return NULL; } - return sub_02076B10(Party_GetPokemonBySlotIndex(param0, param3)); + return GetBoxMon(Party_GetPokemonBySlotIndex(param0, param3)); } return sub_02079C9C(param1, param2, param3); @@ -1255,13 +1255,13 @@ static int ov94_0224123C (BoxPokemon * param0) { int v0, v1 = 0, v2; - v2 = sub_02073D20(param0); + v2 = DecryptBoxMon(param0); for (v0 = 0; v0 < 10; v0++) { - v1 += sub_02074570(param0, Unk_ov94_02245E34[v0], NULL); + v1 += GetBoxMonData(param0, Unk_ov94_02245E34[v0], NULL); } - sub_02073D48(param0, v2); + EncryptBoxMon(param0, v2); if (v1) { return 1; @@ -1275,14 +1275,14 @@ static int ov94_02241278 (BoxPokemon * param0) int v0; int v1, v2; - v0 = sub_02073D20(param0); + v0 = DecryptBoxMon(param0); { - v1 = sub_02074570(param0, MON_DATA_SPECIES, NULL); - v2 = sub_02074570(param0, MON_DATA_FORM, NULL); + v1 = GetBoxMonData(param0, MON_DATA_SPECIES, NULL); + v2 = GetBoxMonData(param0, MON_DATA_FORM, NULL); } - sub_02073D48(param0, v0); + EncryptBoxMon(param0, v0); if (v2 > 0) { switch (v1) { @@ -1301,13 +1301,13 @@ static int ov94_022412C8 (BoxPokemon * param0) int v0; int v1; - v0 = sub_02073D20(param0); + v0 = DecryptBoxMon(param0); { - v1 = sub_02074570(param0, MON_DATA_HELD_ITEM, NULL); + v1 = GetBoxMonData(param0, MON_DATA_HELD_ITEM, NULL); } - sub_02073D48(param0, v0); + EncryptBoxMon(param0, v0); switch (v1) { case 112: @@ -1325,11 +1325,11 @@ static int ov94_022412F4 (Party * param0, UnkStruct_020797DC * param1, int param return 0; } - if (!sub_02074570(v0, MON_DATA_172, NULL)) { + if (!GetBoxMonData(v0, MON_DATA_172, NULL)) { return 0; } - if (sub_02074570(v0, MON_DATA_173, NULL)) { + if (GetBoxMonData(v0, MON_DATA_173, NULL)) { return 2; } @@ -1371,9 +1371,9 @@ static int ov94_02241384 (BoxPokemon * param0, UnkStruct_ov94_0223BA88_sub3 * pa { UnkStruct_ov94_0223BA88_sub2 v0; - v0.unk_00 = sub_02074570(param0, MON_DATA_SPECIES, NULL); - v0.unk_02 = sub_02074570(param0, MON_DATA_111, NULL) + 1; - v0.unk_03 = sub_02075B40(param0); + v0.unk_00 = GetBoxMonData(param0, MON_DATA_SPECIES, NULL); + v0.unk_02 = GetBoxMonData(param0, MON_DATA_GENDER, NULL) + 1; + v0.unk_03 = GetBoxMonLevel(param0); return ov94_02241328(&v0, param1); } @@ -1384,18 +1384,18 @@ static void ov94_022413BC (UnkStruct_ov94_0223BA88 * param0, UnkStruct_ov94_0223 UnkStruct_ov94_0223BA88_sub3 v1; BoxPokemon * v2; - v0.unk_00 = sub_02074570(param1->unk_114, MON_DATA_SPECIES, NULL); - v0.unk_02 = sub_02074570(param1->unk_114, MON_DATA_111, NULL) + 1; - v0.unk_03 = sub_02075B40(param1->unk_114); + v0.unk_00 = GetBoxMonData(param1->unk_114, MON_DATA_SPECIES, NULL); + v0.unk_02 = GetBoxMonData(param1->unk_114, MON_DATA_GENDER, NULL) + 1; + v0.unk_03 = GetBoxMonLevel(param1->unk_114); param0->unk_EC = v0; ov94_022425A8(param0, param1); - v2 = sub_02076B10((Pokemon *)param1->unk_250[param1->unk_11C].unk_00.unk_00); + v2 = GetBoxMon((Pokemon *)param1->unk_250[param1->unk_11C].unk_00.unk_00); - v1.unk_00 = sub_02074570(v2, MON_DATA_SPECIES, NULL); - v1.unk_02 = sub_02074570(v2, MON_DATA_111, NULL) + 1; + v1.unk_00 = GetBoxMonData(v2, MON_DATA_SPECIES, NULL); + v1.unk_02 = GetBoxMonData(v2, MON_DATA_GENDER, NULL) + 1; v1.unk_03 = 0; v1.unk_04 = 0; diff --git a/src/overlay094/ov94_022414B8.c b/src/overlay094/ov94_022414B8.c index 63f42fbf7f..ae7b7a65c2 100644 --- a/src/overlay094/ov94_022414B8.c +++ b/src/overlay094/ov94_022414B8.c @@ -49,7 +49,7 @@ #include "unk_020279FC.h" #include "unk_0202C858.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay094/ov94_0223BCB0.h" #include "overlay094/ov94_0223FB48.h" #include "overlay094/ov94_022414B8.h" @@ -650,7 +650,7 @@ static int ov94_02241BAC (UnkStruct_ov94_0223FD4C * param0) sub_0201A8FC(¶m0->unk_F9C[1]); param0->unk_B74.unk_00 = v0; sub_02005748(1500); - param0->unk_10E4->unk_20 = sub_020759F0(v0, 18); + param0->unk_10E4->unk_20 = GetMonSpeciesPersonalDataAttribute(v0, 18); if (ov94_02241B80(¶m0->unk_B74, param0->unk_10E4->unk_20)) { param0->unk_2C = 10; @@ -1013,10 +1013,10 @@ static void ov94_022423FC (MessageLoader * param0, UnkStruct_0200B358 * param1, Strbuf* v3 = Strbuf_Init(10 + 1, 62); int v4, v5, v6; - sub_02074570(param3, MON_DATA_119, v2); + GetBoxMonData(param3, MON_DATA_119, v2); - v4 = sub_02074570(param3, MON_DATA_111, NULL) + 1; - v5 = sub_02075B40(param3); + v4 = GetBoxMonData(param3, MON_DATA_GENDER, NULL) + 1; + v5 = GetBoxMonLevel(param3); v0 = MessageLoader_GetNewStrbuf(param0, 100); sub_0200B60C(param1, 3, v5, 3, 0, 1); @@ -1038,7 +1038,7 @@ static void ov94_022423FC (MessageLoader * param0, UnkStruct_0200B358 * param1, ov94_02245900(¶m2[1], v3, 70, 0, 0, Unk_ov94_02246920[v4 - 1]); } - param4->unk_00 = sub_02074570(param3, MON_DATA_SPECIES, NULL); + param4->unk_00 = GetBoxMonData(param3, MON_DATA_SPECIES, NULL); param4->unk_02 = v4; param4->unk_03 = v5; diff --git a/src/overlay094/ov94_02242AD0.c b/src/overlay094/ov94_02242AD0.c index ab7e83705b..e29ff34078 100644 --- a/src/overlay094/ov94_02242AD0.c +++ b/src/overlay094/ov94_02242AD0.c @@ -43,7 +43,7 @@ #include "unk_020507CC.h" #include "unk_0206AFE0.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "party.h" #include "overlay094/ov94_0223B140.h" @@ -797,7 +797,7 @@ static int ov94_02243398 (UnkStruct_ov94_0223FD4C * param0) Pokemon * v1 = AllocMonZeroed(62); sub_0202DA70(param0->unk_00->unk_00, v1); - sub_0200B5CC(param0->unk_B8C, 0, sub_02076B10(v1)); + sub_0200B5CC(param0->unk_B8C, 0, GetBoxMon(v1)); param0->unk_28 = 2; param0->unk_2C = 34; @@ -817,7 +817,7 @@ static int ov94_02243398 (UnkStruct_ov94_0223FD4C * param0) Pokemon * v2 = AllocMonZeroed(62); sub_0202DA70(param0->unk_00->unk_00, v2); - sub_0200B5CC(param0->unk_B8C, 0, sub_02076B10(v2)); + sub_0200B5CC(param0->unk_B8C, 0, GetBoxMon(v2)); param0->unk_28 = 3; param0->unk_2C = 34; @@ -1298,8 +1298,8 @@ static void ov94_02243BC4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, i } } - sub_02074B30(param1, 9, &v1); - sub_02074B30(param1, 111, NULL); + SetMonData(param1, 9, &v1); + SetMonData(param1, 111, NULL); ov94_02243DE8(param0->unk_00->unk_00, 0); } @@ -1316,7 +1316,7 @@ static void ov94_02243BC4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, i int v4 = 0; sub_020799F0(param0->unk_00->unk_0C, ¶m2, &v4); - sub_020798A0(param0->unk_00->unk_0C, param2, sub_02076B10(param1)); + sub_020798A0(param0->unk_00->unk_0C, param2, GetBoxMon(param1)); param0->unk_124.unk_00 = param2; param0->unk_124.unk_04 = v4; @@ -1347,10 +1347,10 @@ static void ov94_02243CE4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, i { u8 v1 = 70; - sub_02074B30(param1, 9, &v1); + SetMonData(param1, 9, &v1); } - sub_02074B30(param1, 111, NULL); + SetMonData(param1, 111, NULL); if (param2 == 18) { int v2; @@ -1364,7 +1364,7 @@ static void ov94_02243CE4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, i int v3 = 0; sub_020799F0(param0->unk_00->unk_0C, ¶m2, &v3); - sub_020798A0(param0->unk_00->unk_0C, param2, sub_02076B10(param1)); + sub_020798A0(param0->unk_00->unk_0C, param2, GetBoxMon(param1)); param0->unk_124.unk_00 = param2; param0->unk_124.unk_04 = v3; @@ -1402,7 +1402,7 @@ static void ov94_02243E48 (UnkStruct_0202B628 * param0, UnkStruct_ov94_0223BA88 Pokemon * v2 = (Pokemon *)param1->unk_00.unk_00; GetMonData(v2, MON_DATA_117, v1); - v0 = sub_0202C1EC(param1->unk_10C, param1->unk_F6, v1, sub_02075D6C(v2), 62); + v0 = sub_0202C1EC(param1->unk_10C, param1->unk_F6, v1, GetMonGender(v2), 62); sub_0202B758(param0, v0, 4); } diff --git a/src/overlay094/ov94_022444C8.c b/src/overlay094/ov94_022444C8.c index 89d39ffa9c..b385d02eaf 100644 --- a/src/overlay094/ov94_022444C8.c +++ b/src/overlay094/ov94_022444C8.c @@ -15,7 +15,7 @@ #include "unk_02025E68.h" #include "unk_0202DA40.h" #include "unk_02056720.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "party.h" #include "unk_0207AE68.h" @@ -42,7 +42,7 @@ int ov94_022444C8 (UnkStruct_ov94_0223FD4C * param0, int param1) switch (param0->unk_24) { case 7: - param0->unk_E8.unk_00 = (BoxPokemon *)sub_02076B10((Pokemon *)param0->unk_12C.unk_00.unk_00); + param0->unk_E8.unk_00 = (BoxPokemon *)GetBoxMon((Pokemon *)param0->unk_12C.unk_00.unk_00); param0->unk_E8.unk_04 = param0->unk_E8.unk_00; param0->unk_120 = ov94_02244870(¶m0->unk_12C); param0->unk_E8.unk_08 = param0->unk_120; @@ -50,7 +50,7 @@ int ov94_022444C8 (UnkStruct_ov94_0223FD4C * param0, int param1) param0->unk_E8.unk_10 = 2; break; case 8: - param0->unk_E8.unk_04 = (BoxPokemon *)sub_02076B10((Pokemon *)param0->unk_12C.unk_00.unk_00); + param0->unk_E8.unk_04 = (BoxPokemon *)GetBoxMon((Pokemon *)param0->unk_12C.unk_00.unk_00); param0->unk_E8.unk_00 = param0->unk_E8.unk_04; param0->unk_120 = ov94_02244870(¶m0->unk_12C); param0->unk_E8.unk_08 = param0->unk_120; @@ -58,9 +58,9 @@ int ov94_022444C8 (UnkStruct_ov94_0223FD4C * param0, int param1) param0->unk_E8.unk_10 = 4; break; case 10: - param0->unk_E8.unk_04 = sub_02076B10((Pokemon *)param0->unk_12C.unk_00.unk_00); + param0->unk_E8.unk_04 = GetBoxMon((Pokemon *)param0->unk_12C.unk_00.unk_00); sub_0202DA70(param0->unk_00->unk_00, param0->unk_1104); - param0->unk_E8.unk_00 = sub_02076B10(param0->unk_1104); + param0->unk_E8.unk_00 = GetBoxMon(param0->unk_1104); param0->unk_120 = ov94_02244870(¶m0->unk_12C); param0->unk_E8.unk_08 = param0->unk_120; param0->unk_E8.unk_0C = 3; @@ -68,8 +68,8 @@ int ov94_022444C8 (UnkStruct_ov94_0223FD4C * param0, int param1) break; case 9: sub_0202DA70(param0->unk_00->unk_00, param0->unk_1104); - param0->unk_E8.unk_00 = sub_02076B10(param0->unk_1104); - param0->unk_E8.unk_04 = (BoxPokemon *)sub_02076B10((Pokemon *)param0->unk_250[param0->unk_11C].unk_00.unk_00); + param0->unk_E8.unk_00 = GetBoxMon(param0->unk_1104); + param0->unk_E8.unk_04 = (BoxPokemon *)GetBoxMon((Pokemon *)param0->unk_250[param0->unk_11C].unk_00.unk_00); param0->unk_120 = ov94_02244870(¶m0->unk_250[param0->unk_11C]); param0->unk_E8.unk_08 = param0->unk_120; param0->unk_E8.unk_0C = 3; @@ -200,6 +200,6 @@ static void ov94_022448E8 (UnkStruct_ov94_0223FD4C * param0) sub_02079968(param0->unk_00->unk_0C, param0->unk_124.unk_00, param0->unk_124.unk_04); sub_020799F0(param0->unk_00->unk_0C, &v1, &v2); - sub_020798A0(param0->unk_00->unk_0C, v1, sub_02076B10(v0)); + sub_020798A0(param0->unk_00->unk_0C, v1, GetBoxMon(v0)); } } diff --git a/src/overlay095/ov95_02246C20.c b/src/overlay095/ov95_02246C20.c index c8dbeb6d86..3e7330b521 100644 --- a/src/overlay095/ov95_02246C20.c +++ b/src/overlay095/ov95_02246C20.c @@ -42,7 +42,7 @@ #include "strbuf.h" #include "unk_020279FC.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay095/ov95_02246C20.h" #include "overlay095/ov95_02247B6C.h" #include "overlay095/ov95_02248590.h" @@ -177,10 +177,10 @@ int ov95_02246C20 (UnkStruct_020067E8 * param0, int * param1) v0->unk_18 = sub_020095C4(64, &v0->unk_1C, 57); sub_0200964C(&(v0->unk_1C), 0, (192 + 40 << FX32_SHIFT)); - v0->unk_1B0 = sub_02074570((BoxPokemon *)(v0->unk_00->unk_00), MON_DATA_SPECIES, NULL); - v0->unk_1B2 = sub_02074570((BoxPokemon *)(v0->unk_00->unk_00), MON_DATA_FORM, NULL); - v0->unk_1B4 = sub_02074570((BoxPokemon *)(v0->unk_00->unk_04), MON_DATA_SPECIES, NULL); - v0->unk_1B6 = sub_02074570((BoxPokemon *)(v0->unk_00->unk_04), MON_DATA_FORM, NULL); + v0->unk_1B0 = GetBoxMonData((BoxPokemon *)(v0->unk_00->unk_00), MON_DATA_SPECIES, NULL); + v0->unk_1B2 = GetBoxMonData((BoxPokemon *)(v0->unk_00->unk_00), MON_DATA_FORM, NULL); + v0->unk_1B4 = GetBoxMonData((BoxPokemon *)(v0->unk_00->unk_04), MON_DATA_SPECIES, NULL); + v0->unk_1B6 = GetBoxMonData((BoxPokemon *)(v0->unk_00->unk_04), MON_DATA_FORM, NULL); v0->unk_1B8 = NULL; sub_02017798(NULL, NULL); @@ -203,10 +203,10 @@ int ov95_02246C20 (UnkStruct_020067E8 * param0, int * param1) static BOOL ov95_02246DEC (BoxPokemon * param0) { - int v0 = sub_02074570(param0, MON_DATA_SPECIES, NULL); - int v1 = sub_02074570(param0, MON_DATA_FORM, NULL); + int v0 = GetBoxMonData(param0, MON_DATA_SPECIES, NULL); + int v1 = GetBoxMonData(param0, MON_DATA_FORM, NULL); - return sub_020759CC(v0, v1, 28) == 0; + return GetMonFormPersonalDataAttribute(v0, v1, 28) == 0; } int ov95_02246E1C (UnkStruct_020067E8 * param0, int * param1) @@ -574,12 +574,12 @@ void ov95_022473E8 (UnkStruct_ov95_02247628 * param0, int param1, u32 param2, u3 u16 v8; v5 = (BoxPokemon *)((param1 == 0) ? param0->unk_00->unk_00 : param0->unk_00->unk_04); - v6 = sub_02073D20(v5); + v6 = DecryptBoxMon(v5); sub_02075F0C(&v0, v5, 2, 0); - v7 = sub_02074570(v5, MON_DATA_PERSONALITY, NULL); - v8 = sub_02074570(v5, MON_DATA_SPECIES, NULL); + v7 = GetBoxMonData(v5, MON_DATA_PERSONALITY, NULL); + v8 = GetBoxMonData(v5, MON_DATA_SPECIES, NULL); if (param4) { v4.unk_08 *= 2; @@ -589,7 +589,7 @@ void ov95_022473E8 (UnkStruct_ov95_02247628 * param0, int param1, u32 param2, u3 DC_FlushRange(v3, v2); sub_0201958C(param0->unk_08, param2, v3, v2, 0); - sub_02073D48(v5, v6); + EncryptBoxMon(v5, v6); Heap_FreeToHeap(v3); } diff --git a/src/overlay095/ov95_02247B6C.c b/src/overlay095/ov95_02247B6C.c index 17f8332de4..3aff935d25 100644 --- a/src/overlay095/ov95_02247B6C.c +++ b/src/overlay095/ov95_02247B6C.c @@ -42,7 +42,7 @@ #include "strbuf.h" #include "unk_0202419C.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay095/ov95_02246C20.h" #include "overlay095/ov95_022476F0.h" #include "overlay095/ov95_02247B6C.h" @@ -360,7 +360,7 @@ static int ov95_02247F04 (UnkStruct_ov95_02247C6C * param0, int * param1) { const BoxPokemon * v6 = ov95_02247634(param0->unk_00); - if (sub_02074570((BoxPokemon *)v6, MON_DATA_IS_EGG, NULL) == 0) { + if (GetBoxMonData((BoxPokemon *)v6, MON_DATA_IS_EGG, NULL) == 0) { u8 v7; sub_02007B98(param0->unk_10, 1); diff --git a/src/overlay095/ov95_0224B3D8.c b/src/overlay095/ov95_0224B3D8.c index dd0e12ba9d..ef0c1e221a 100644 --- a/src/overlay095/ov95_0224B3D8.c +++ b/src/overlay095/ov95_0224B3D8.c @@ -43,7 +43,7 @@ #include "unk_020218BC.h" #include "strbuf.h" #include "unk_0202419C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay095/ov95_02246C20.h" #include "overlay095/ov95_022476F0.h" #include "overlay095/ov95_0224B3D8.h" @@ -373,7 +373,7 @@ static int ov95_0224B71C (UnkStruct_ov95_0224B4D4 * param0, int * param1) if (ov95_0224BC00(param0)) { const BoxPokemon * v0 = ov95_0224763C(param0->unk_00); - if (sub_02074570((BoxPokemon *)v0, MON_DATA_IS_EGG, NULL) == 0) { + if (GetBoxMonData((BoxPokemon *)v0, MON_DATA_IS_EGG, NULL) == 0) { u8 v1; sub_02078A4C(param0->unk_84, &v1, ov95_02247660(param0->unk_00), 1); diff --git a/src/overlay097/ov97_0222D30C.c b/src/overlay097/ov97_0222D30C.c index a744fc8efa..e7dadad8b2 100644 --- a/src/overlay097/ov97_0222D30C.c +++ b/src/overlay097/ov97_0222D30C.c @@ -69,7 +69,7 @@ #include "unk_020363E8.h" #include "unk_020366A0.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay097/ov97_0222D04C.h" #include "overlay097/ov97_0222D30C.h" #include "overlay097/ov97_02232054.h" diff --git a/src/overlay097/ov97_02233B18.c b/src/overlay097/ov97_02233B18.c index 613df34bbf..cfa128a275 100644 --- a/src/overlay097/ov97_02233B18.c +++ b/src/overlay097/ov97_02233B18.c @@ -71,7 +71,7 @@ #include "unk_02025E08.h" #include "unk_020279FC.h" #include "unk_0202EEC0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "item.h" #include "unk_0209A74C.h" @@ -398,7 +398,7 @@ static void ov97_02233D10 (UnkStruct_ov97_02234A2C * param0) UnkStruct_02024440 * v7; v7 = sub_02024440(param0->unk_10); - v4 = sub_02076B10(&v6); + v4 = GetBoxMon(&v6); for (v0 = 0; v0 < 6; v0++) { v2 = param0->unk_42C[v0].unk_04; diff --git a/src/overlay097/ov97_02236380.c b/src/overlay097/ov97_02236380.c index 93c8420a95..5e25bf2de0 100644 --- a/src/overlay097/ov97_02236380.c +++ b/src/overlay097/ov97_02236380.c @@ -6,7 +6,7 @@ #include "overlay097/box_pokemon_gba.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "item.h" #include "overlay097/ov97_02236380.h" #include "overlay097/ov97_022392E4.h" @@ -1314,7 +1314,7 @@ u32 ov97_02236E00 (BoxPokemonGBA * param0) v0 = ov97_02236DD0(GetGBABoxMonData(param0, 11, 0)); v1 = GetGBABoxMonData(param0, 25, 0); - return sub_02075B78(v0, v1); + return GetMonSpeciesLevel(v0, v1); } static int ov97_02236E28 (BoxPokemonGBA * param0, BoxPokemon * param1) @@ -1324,23 +1324,23 @@ static int ov97_02236E28 (BoxPokemonGBA * param0, BoxPokemon * param1) u16 v2; int v3; - v2 = sub_02074570(param1, MON_DATA_SPECIES, NULL); + v2 = GetBoxMonData(param1, MON_DATA_SPECIES, NULL); v3 = GetGBABoxMonData(param0, 46, NULL); - v1 = sub_020759F0(v2, 25); + v1 = GetMonSpeciesPersonalDataAttribute(v2, 25); if (v1) { for (v0 = 0; v0 < (sizeof(Unk_ov97_0223ECA0) / 2); v0++) { if (Unk_ov97_0223ECA0[v0] == v2) { - v1 = sub_020759F0(v2, 24); + v1 = GetMonSpeciesPersonalDataAttribute(v2, 24); break; } } if ((v0 == (sizeof(Unk_ov97_0223ECA0) / 2)) && ((v3 & 1) == 0)) { - v1 = sub_020759F0(v2, 24); + v1 = GetMonSpeciesPersonalDataAttribute(v2, 24); } } else { - v1 = sub_020759F0(v2, 24); + v1 = GetMonSpeciesPersonalDataAttribute(v2, 24); } return v1; @@ -1357,7 +1357,7 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) ZeroBoxMonData(param1); - v0 = sub_02073D20(param1); + v0 = DecryptBoxMon(param1); v1 = GetGBABoxMonData(param0, 0, NULL); SetBoxMonData(param1, 0, (u8 *)&v1); @@ -1443,7 +1443,7 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) SetBoxMonData(param1, 62 + v2, (u8 *)&v1); - v1 = sub_02074570(param1, 66 + v2, NULL); + v1 = GetBoxMonData(param1, 66 + v2, NULL); SetBoxMonData(param1, 58 + v2, (u8 *)&v1); } @@ -1552,17 +1552,17 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) v1 = GetGBABoxMonData(param0, 80, NULL); SetBoxMonData(param1, 110, (u8 *)&v1); - v1 = sub_02075D74(param1); + v1 = GetBoxMonGender(param1); SetBoxMonData(param1, 111, (u8 *)&v1); - if (sub_02074570(param1, MON_DATA_SPECIES, NULL) == 201) { + if (GetBoxMonData(param1, MON_DATA_SPECIES, NULL) == 201) { v1 = GetGBABoxMonData(param0, 0, NULL); v1 = (((v1 & 0x3000000) >> 18) | ((v1 & 0x30000) >> 12) | ((v1 & 0x300) >> 6) | (v1 & 0x3)) % 28; SetBoxMonData(param1, 112, (u8 *)&v1); } - if (sub_02074570(param1, MON_DATA_SPECIES, NULL) == 386) { + if (GetBoxMonData(param1, MON_DATA_SPECIES, NULL) == 386) { switch (Unk_021BF67C.unk_66) { default: case 2: @@ -1615,5 +1615,5 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) v1 = GetGBABoxMonData(param0, 49, NULL); SetBoxMonData(param1, 157, &v1); - sub_02073D48(param1, v0); + EncryptBoxMon(param1, v0); } diff --git a/src/overlay097/ov97_02237694.c b/src/overlay097/ov97_02237694.c index 96458d246e..a150f5b8f3 100644 --- a/src/overlay097/ov97_02237694.c +++ b/src/overlay097/ov97_02237694.c @@ -52,7 +52,7 @@ #include "strbuf.h" #include "unk_020244AC.h" #include "unk_02033200.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "item.h" #include "overlay097/ov97_02237694.h" @@ -579,8 +579,8 @@ static void ov97_02237EF8 (UnkStruct_02022550 * param0, Pokemon * param1, int pa u32 v2; UnkStruct_ov97_0223F550 * v3 = &Unk_ov97_0223F550; - v0 = sub_02075D6C(param1); - v1 = sub_02075E0C(param1); + v0 = GetMonGender(param1); + v1 = GetMonShininess(param1); sub_02075FB4(param5, param2, v0, 2, v1, param3, 0); diff --git a/src/overlay104/ov104_0222DCE0.c b/src/overlay104/ov104_0222DCE0.c index 97860b7376..84596b9bd8 100644 --- a/src/overlay104/ov104_0222DCE0.c +++ b/src/overlay104/ov104_0222DCE0.c @@ -34,7 +34,7 @@ #include "unk_02034198.h" #include "unk_02038F8C.h" #include "map_header.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0208C098.h" #include "unk_02092494.h" @@ -197,7 +197,7 @@ u32 ov104_0222DD6C (UnkStruct_ov104_0223A348_sub2 * param0, u16 param1, u32 para if (param3 == 0) { do { v2 = (LCRNG_Next() | LCRNG_Next() << 16); - } while ((v4.unk_0B != GetNatureFromPersonality(v2)) || (sub_02075E38(param2, v2) == 1)); + } while ((v4.unk_0B != GetNatureFromPersonality(v2)) || (GetMonPersonalityShininess(param2, v2) == 1)); param0->unk_10 = v2; } else { @@ -215,7 +215,7 @@ u32 ov104_0222DD6C (UnkStruct_ov104_0223A348_sub2 * param0, u16 param1, u32 para v1 = 0; for (v0 = 0; v0 < 6; v0++) { - if (v4.unk_0A & FlagIndex(v0)) { + if (v4.unk_0A & GetSingleBitMask(v0)) { v1++; } } @@ -227,7 +227,7 @@ u32 ov104_0222DD6C (UnkStruct_ov104_0223A348_sub2 * param0, u16 param1, u32 para } for (v0 = 0; v0 < 6; v0++) { - if (v4.unk_0A & FlagIndex(v0)) { + if (v4.unk_0A & GetSingleBitMask(v0)) { param0->unk_18_val2[v0] = v1; } } @@ -235,16 +235,16 @@ u32 ov104_0222DD6C (UnkStruct_ov104_0223A348_sub2 * param0, u16 param1, u32 para param0->unk_1E_val2 = 0; param0->unk_1F = Unk_020E4C44; - v0 = sub_020759F0(param0->unk_00_val1_0, 25); + v0 = GetMonSpeciesPersonalDataAttribute(param0->unk_00_val1_0, 25); if (v0) { if (param0->unk_10 & 1) { param0->unk_20 = v0; } else { - param0->unk_20 = sub_020759F0(param0->unk_00_val1_0, 24); + param0->unk_20 = GetMonSpeciesPersonalDataAttribute(param0->unk_00_val1_0, 24); } } else { - param0->unk_20 = sub_020759F0(param0->unk_00_val1_0, 24); + param0->unk_20 = GetMonSpeciesPersonalDataAttribute(param0->unk_00_val1_0, 24); } param0->unk_21 = v3; @@ -274,48 +274,48 @@ void ov104_0222DF40 (const UnkStruct_ov104_0223A348_sub2 * param0, Pokemon * par v1 = (param0->unk_14_val2 & 0x3FFFFFFF); sub_02073D80(param1, param0->unk_00_val1_0, v4, v1, 1, param0->unk_10, 2, 0); - sub_02074B30(param1, 175, &v1); - sub_0207418C(param1); + SetMonData(param1, 175, &v1); + CalculateMonLevelAndStats(param1); v2 = param0->unk_00_val1_11; - sub_02074B30(param1, 112, &v2); - sub_02074B30(param1, 6, ¶m0->unk_02); + SetMonData(param1, 112, &v2); + SetMonData(param1, 6, ¶m0->unk_02); for (v0 = 0; v0 < 4; v0++) { v5 = param0->unk_04[v0]; - sub_02074B30(param1, 54 + v0, &v5); + SetMonData(param1, 54 + v0, &v5); v2 = (param0->unk_1E_val2 >> (v0 * 2)) & 0x3; - sub_02074B30(param1, 62 + v0, &v2); + SetMonData(param1, 62 + v0, &v2); - v3 = (u8)GetMonData(param1, MON_DATA_66 + v0, NULL); - sub_02074B30(param1, 58 + v0, &v3); + v3 = (u8)GetMonData(param1, MON_DATA_MOVE1_MAX_PP + v0, NULL); + SetMonData(param1, 58 + v0, &v3); } v6 = param0->unk_0C; - sub_02074B30(param1, 7, &v6); + SetMonData(param1, 7, &v6); v2 = param0->unk_18_val1_00; - sub_02074B30(param1, 13, &v2); + SetMonData(param1, 13, &v2); v2 = param0->unk_18_val1_01; - sub_02074B30(param1, 14, &v2); + SetMonData(param1, 14, &v2); v2 = param0->unk_18_val1_02; - sub_02074B30(param1, 15, &v2); + SetMonData(param1, 15, &v2); v2 = param0->unk_18_val1_03; - sub_02074B30(param1, 16, &v2); + SetMonData(param1, 16, &v2); v2 = param0->unk_18_val1_04; - sub_02074B30(param1, 17, &v2); + SetMonData(param1, 17, &v2); v2 = param0->unk_18_val1_05; - sub_02074B30(param1, 18, &v2); + SetMonData(param1, 18, &v2); - sub_02074B30(param1, 10, ¶m0->unk_20); - sub_02074B30(param1, 9, ¶m0->unk_21); + SetMonData(param1, 10, ¶m0->unk_20); + SetMonData(param1, 9, ¶m0->unk_21); if (param0->unk_14_val1_30) { MessageLoader * v7; @@ -324,15 +324,15 @@ void ov104_0222DF40 (const UnkStruct_ov104_0223A348_sub2 * param0, Pokemon * par v7 = MessageLoader_Init(1, 26, 412, 4); v8 = MessageLoader_GetNewStrbuf(v7, param0->unk_00_val1_0); - sub_02074B30(param1, 119, v8); + SetMonData(param1, 119, v8); Strbuf_Free(v8); MessageLoader_Free(v7); } else { - sub_02074B30(param1, 117, param0->unk_22); + SetMonData(param1, 117, param0->unk_22); } - sub_02074B30(param1, 12, ¶m0->unk_1F); - sub_0207418C(param1); + SetMonData(param1, 12, ¶m0->unk_1F); + CalculateMonLevelAndStats(param1); } u16 ov104_0222E10C (u8 param0) @@ -368,8 +368,8 @@ void ov104_0222E134 (UnkStruct_021C0794 * param0, Pokemon * param1) v2 = MessageLoader_Init(0, 26, 363, 11); v1 = MessageLoader_GetNewStrbuf(v2, 0); - sub_02074B30(param1, 145, v1); - sub_02074B30(param1, 7, &v0); + SetMonData(param1, 145, v1); + SetMonData(param1, 7, &v0); Strbuf_Free(v1); MessageLoader_Free(v2); diff --git a/src/overlay104/ov104_0222ECE8.c b/src/overlay104/ov104_0222ECE8.c index 00bfdb50de..c34abbab79 100644 --- a/src/overlay104/ov104_0222ECE8.c +++ b/src/overlay104/ov104_0222ECE8.c @@ -19,7 +19,7 @@ #include "unk_0203061C.h" #include "unk_02034198.h" #include "unk_0205DFC4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay104/ov104_0222ECE8.h" #include "overlay104/ov104_0223A7F4.h" diff --git a/src/overlay104/ov104_02231F74.c b/src/overlay104/ov104_02231F74.c index b1680d22ea..ba4ed20650 100644 --- a/src/overlay104/ov104_02231F74.c +++ b/src/overlay104/ov104_02231F74.c @@ -60,7 +60,7 @@ #include "strbuf.h" #include "unk_02025E08.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "unk_0207E0B8.h" #include "unk_0209B6F8.h" diff --git a/src/overlay104/ov104_022332B4.c b/src/overlay104/ov104_022332B4.c index 265d9c3a45..e2921be4c8 100644 --- a/src/overlay104/ov104_022332B4.c +++ b/src/overlay104/ov104_022332B4.c @@ -23,7 +23,7 @@ #include "unk_02018340.h" #include "unk_0202FF4C.h" #include "unk_02051D8C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0209B6F8.h" #include "unk_0209BA80.h" @@ -404,7 +404,7 @@ BOOL ov104_022334DC (UnkStruct_ov104_0222E930 * param0) for (v10 = 0; v10 < v6; v10++) { v3 = Party_GetPokemonBySlotIndex(v4->unk_4D4, v10); - sub_0200B538(param0->unk_00->unk_44, v10, sub_02076B10(v3)); + sub_0200B538(param0->unk_00->unk_44, v10, GetBoxMon(v3)); } break; case 35: diff --git a/src/overlay104/ov104_022339B4.c b/src/overlay104/ov104_022339B4.c index f272826c68..4f8e53aa12 100644 --- a/src/overlay104/ov104_022339B4.c +++ b/src/overlay104/ov104_022339B4.c @@ -22,7 +22,7 @@ #include "unk_020507CC.h" #include "unk_0205DFC4.h" #include "unk_0206AFE0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay104/ov104_0222DCE0.h" #include "overlay104/ov104_0222ECE8.h" diff --git a/src/overlay104/ov104_02234838.c b/src/overlay104/ov104_02234838.c index cfd1207fbc..81149892c7 100644 --- a/src/overlay104/ov104_02234838.c +++ b/src/overlay104/ov104_02234838.c @@ -23,7 +23,7 @@ #include "unk_02030108.h" #include "unk_02051D8C.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0209B6F8.h" #include "unk_0209BA80.h" @@ -258,7 +258,7 @@ BOOL ov104_02234A1C (UnkStruct_ov104_0222E930 * param0) for (v7 = 0; v7 < v5; v7++) { v1 = Party_GetPokemonBySlotIndex(v2, v3->unk_260[v7]); - sub_02074B30(v1, 6, &v3->unk_728[v7]); + SetMonData(v1, 6, &v3->unk_728[v7]); } break; case 28: diff --git a/src/overlay104/ov104_02234DB4.c b/src/overlay104/ov104_02234DB4.c index 9aa1f55fe8..17c382545a 100644 --- a/src/overlay104/ov104_02234DB4.c +++ b/src/overlay104/ov104_02234DB4.c @@ -20,7 +20,7 @@ #include "unk_020507CC.h" #include "unk_0205DFC4.h" #include "unk_0206AFE0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay104/ov104_0222DCE0.h" #include "overlay104/ov104_0222ECE8.h" diff --git a/src/overlay104/ov104_022358E8.c b/src/overlay104/ov104_022358E8.c index a752cb9a65..9b121665ac 100644 --- a/src/overlay104/ov104_022358E8.c +++ b/src/overlay104/ov104_022358E8.c @@ -23,7 +23,7 @@ #include "unk_02034198.h" #include "unk_02051D8C.h" #include "unk_0205DFC4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0209B6F8.h" #include "unk_0209BA80.h" @@ -350,7 +350,7 @@ BOOL ov104_02235BC0 (UnkStruct_ov104_0222E930 * param0) for (v8 = 0; v8 < 3; v8++) { v1 = Party_GetPokemonBySlotIndex(v2, v3->unk_24[v8]); - sub_02074B30(v1, 6, &v3->unk_36A[v8]); + SetMonData(v1, 6, &v3->unk_36A[v8]); } break; case 19: diff --git a/src/overlay104/ov104_022361B4.c b/src/overlay104/ov104_022361B4.c index 49e8871f81..b386ad979a 100644 --- a/src/overlay104/ov104_022361B4.c +++ b/src/overlay104/ov104_022361B4.c @@ -38,7 +38,7 @@ #include "unk_020507CC.h" #include "unk_0205DFC4.h" #include "unk_0206AFE0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay104/ov104_0222DCE0.h" #include "overlay104/ov104_0222E63C.h" @@ -148,12 +148,12 @@ UnkStruct_ov104_0223BA10 * ov104_022361B4 (UnkStruct_021C0794 * param0, u16 para v3 = Party_GetPokemonBySlotIndex(v9->unk_28, v7); v0 = 0; - sub_02074B30(v3, 6, &v0); + SetMonData(v3, 6, &v0); - if (GetMonData(v3, MON_DATA_161, NULL) > 50) { - v1 = sub_02075AD0(GetMonData(v3, MON_DATA_SPECIES, NULL), 50); - sub_02074B30(v3, 8, &v1); - sub_0207418C(v3); + if (GetMonData(v3, MON_DATA_LEVEL, NULL) > 50) { + v1 = GetMonSpeciesLevelExp(GetMonData(v3, MON_DATA_SPECIES, NULL), 50); + SetMonData(v3, 8, &v1); + CalculateMonLevelAndStats(v3); } } @@ -190,10 +190,10 @@ static void ov104_02236528 (UnkStruct_ov104_0223BA10 * param0) for (v1 = 0; v1 < v0; v1++) { v3 = Party_GetPokemonBySlotIndex(param0->unk_28, v1); - param0->unk_394[v1][0] = GetMonData(v3, MON_DATA_58, NULL); - param0->unk_394[v1][1] = GetMonData(v3, MON_DATA_59, NULL); - param0->unk_394[v1][2] = GetMonData(v3, MON_DATA_60, NULL); - param0->unk_394[v1][3] = GetMonData(v3, MON_DATA_61, NULL); + param0->unk_394[v1][0] = GetMonData(v3, MON_DATA_MOVE1_PP, NULL); + param0->unk_394[v1][1] = GetMonData(v3, MON_DATA_MOVE2_PP, NULL); + param0->unk_394[v1][2] = GetMonData(v3, MON_DATA_MOVE3_PP, NULL); + param0->unk_394[v1][3] = GetMonData(v3, MON_DATA_MOVE4_PP, NULL); } ov104_0223B760(param0->unk_10, ov104_0223BB60(param0), param0->unk_30, (7 * 2)); @@ -262,25 +262,25 @@ static void ov104_022366A4 (UnkStruct_ov104_0223BA10 * param0) v5 = Party_GetPokemonBySlotIndex(param0->unk_28, v4); v2 = (u16)sub_02030398(param0->unk_08, 2, v4, 0, NULL); - sub_02074B30(v5, 163, &v2); + SetMonData(v5, 163, &v2); v3 = (u8)sub_02030398(param0->unk_08, 3, v4, 0, NULL); - sub_02074B30(v5, 58, &v3); + SetMonData(v5, 58, &v3); v3 = (u8)sub_02030398(param0->unk_08, 3, v4, 1, NULL); - sub_02074B30(v5, 59, &v3); + SetMonData(v5, 59, &v3); v3 = (u8)sub_02030398(param0->unk_08, 3, v4, 2, NULL); - sub_02074B30(v5, 60, &v3); + SetMonData(v5, 60, &v3); v3 = (u8)sub_02030398(param0->unk_08, 3, v4, 3, NULL); - sub_02074B30(v5, 61, &v3); + SetMonData(v5, 61, &v3); v1 = (u32)sub_02030398(param0->unk_08, 4, v4, 0, NULL); - sub_02074B30(v5, 160, &v1); + SetMonData(v5, 160, &v1); v2 = (u16)sub_02030398(param0->unk_08, 5, v4, 0, NULL); - sub_02074B30(v5, 6, &v2); + SetMonData(v5, 6, &v2); } return; @@ -409,19 +409,19 @@ void ov104_02236848 (UnkStruct_ov104_0223BA10 * param0, u8 param1) for (v0 = 0; v0 < v8; v0++) { v11 = Party_GetPokemonBySlotIndex(param0->unk_28, v0); - v5[0] = GetMonData(v11, MON_DATA_163, NULL); + v5[0] = GetMonData(v11, MON_DATA_CURRENT_HP, NULL); sub_02030308(param0->unk_08, 2, v0, 0, v5); - v4[0] = GetMonData(v11, MON_DATA_58, NULL); + v4[0] = GetMonData(v11, MON_DATA_MOVE1_PP, NULL); sub_02030308(param0->unk_08, 3, v0, 0, v4); - v4[0] = GetMonData(v11, MON_DATA_59, NULL); + v4[0] = GetMonData(v11, MON_DATA_MOVE2_PP, NULL); sub_02030308(param0->unk_08, 3, v0, 1, v4); - v4[0] = GetMonData(v11, MON_DATA_60, NULL); + v4[0] = GetMonData(v11, MON_DATA_MOVE3_PP, NULL); sub_02030308(param0->unk_08, 3, v0, 2, v4); - v4[0] = GetMonData(v11, MON_DATA_61, NULL); + v4[0] = GetMonData(v11, MON_DATA_MOVE4_PP, NULL); sub_02030308(param0->unk_08, 3, v0, 3, v4); v6[0] = GetMonData(v11, MON_DATA_160, NULL); @@ -536,10 +536,10 @@ void ov104_02236C50 (UnkStruct_ov104_0223BA10 * param0) for (v2 = v0; v2 < (v1 + v0); v2++) { v4 = Party_GetPokemonBySlotIndex(param0->unk_28, v2); - param0->unk_394[v2 - v0][0] = GetMonData(v4, MON_DATA_58, NULL); - param0->unk_394[v2 - v0][1] = GetMonData(v4, MON_DATA_59, NULL); - param0->unk_394[v2 - v0][2] = GetMonData(v4, MON_DATA_60, NULL); - param0->unk_394[v2 - v0][3] = GetMonData(v4, MON_DATA_61, NULL); + param0->unk_394[v2 - v0][0] = GetMonData(v4, MON_DATA_MOVE1_PP, NULL); + param0->unk_394[v2 - v0][1] = GetMonData(v4, MON_DATA_MOVE2_PP, NULL); + param0->unk_394[v2 - v0][2] = GetMonData(v4, MON_DATA_MOVE3_PP, NULL); + param0->unk_394[v2 - v0][3] = GetMonData(v4, MON_DATA_MOVE4_PP, NULL); } ov104_0223BA24(param0->unk_28); @@ -586,8 +586,8 @@ int ov104_02236D10 (UnkStruct_ov104_0223BA10 * param0) continue; } - v3 = GetMonData(v9, MON_DATA_163, NULL); - v4 = GetMonData(v9, MON_DATA_164, NULL); + v3 = GetMonData(v9, MON_DATA_CURRENT_HP, NULL); + v4 = GetMonData(v9, MON_DATA_MAX_HP, NULL); if (v3 > 0) { v10[0]++; @@ -609,10 +609,10 @@ int ov104_02236D10 (UnkStruct_ov104_0223BA10 * param0) param0->unk_12 = 1; } - v8 += GetMonData(v9, MON_DATA_58, NULL); - v8 += GetMonData(v9, MON_DATA_59, NULL); - v8 += GetMonData(v9, MON_DATA_60, NULL); - v8 += GetMonData(v9, MON_DATA_61, NULL); + v8 += GetMonData(v9, MON_DATA_MOVE1_PP, NULL); + v8 += GetMonData(v9, MON_DATA_MOVE2_PP, NULL); + v8 += GetMonData(v9, MON_DATA_MOVE3_PP, NULL); + v8 += GetMonData(v9, MON_DATA_MOVE4_PP, NULL); } for (v5 = 0; v5 < v1; v5++) { diff --git a/src/overlay104/ov104_02237378.c b/src/overlay104/ov104_02237378.c index ec255ca648..88d84f5b41 100644 --- a/src/overlay104/ov104_02237378.c +++ b/src/overlay104/ov104_02237378.c @@ -35,7 +35,7 @@ #include "unk_02030494.h" #include "unk_020329E0.h" #include "unk_02051D8C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0209B6F8.h" #include "unk_0209BA80.h" @@ -186,12 +186,12 @@ BOOL ov104_02237460 (UnkStruct_ov104_0222E930 * param0) for (v1 = 0; v1 < v0; v1++) { v11 = Party_GetPokemonBySlotIndex(v9->unk_70, v1); - v7 = GetMonData(v11, MON_DATA_161, NULL); + v7 = GetMonData(v11, MON_DATA_LEVEL, NULL); v7 -= 3; - v6 = sub_02075AD0(GetMonData(v11, MON_DATA_SPECIES, NULL), v7); + v6 = GetMonSpeciesLevelExp(GetMonData(v11, MON_DATA_SPECIES, NULL), v7); - sub_02074B30(v11, 8, &v6); - sub_0207418C(v11); + SetMonData(v11, 8, &v6); + CalculateMonLevelAndStats(v11); } } @@ -201,23 +201,23 @@ BOOL ov104_02237460 (UnkStruct_ov104_0222E930 * param0) v11 = Party_GetPokemonBySlotIndex(v9->unk_70, v1); v5 = v9->unk_94[v1]; - sub_02074B30(v11, 164, &v5); - sub_02074B30(v11, 163, &v5); + SetMonData(v11, 164, &v5); + SetMonData(v11, 163, &v5); v5 = v9->unk_A4[v1]; - sub_02074B30(v11, 165, &v5); + SetMonData(v11, 165, &v5); v5 = v9->unk_B4[v1]; - sub_02074B30(v11, 166, &v5); + SetMonData(v11, 166, &v5); v5 = v9->unk_C4[v1]; - sub_02074B30(v11, 167, &v5); + SetMonData(v11, 167, &v5); v5 = v9->unk_D4[v1]; - sub_02074B30(v11, 168, &v5); + SetMonData(v11, 168, &v5); v5 = v9->unk_E4[v1]; - sub_02074B30(v11, 169, &v5); + SetMonData(v11, 169, &v5); } sub_020520A4(v10); @@ -266,12 +266,12 @@ static void ov104_02237634 (UnkStruct_ov104_02238240 * param0, UnkStruct_ov104_0 for (v0 = 0; v0 < v1; v0++) { v2 = Party_GetPokemonBySlotIndex(param1->unk_70, v0); - param1->unk_94[v0] = GetMonData(v2, MON_DATA_164, NULL); - param1->unk_A4[v0] = GetMonData(v2, MON_DATA_165, NULL); - param1->unk_B4[v0] = GetMonData(v2, MON_DATA_166, NULL); - param1->unk_C4[v0] = GetMonData(v2, MON_DATA_167, NULL); - param1->unk_D4[v0] = GetMonData(v2, MON_DATA_168, NULL); - param1->unk_E4[v0] = GetMonData(v2, MON_DATA_169, NULL); + param1->unk_94[v0] = GetMonData(v2, MON_DATA_MAX_HP, NULL); + param1->unk_A4[v0] = GetMonData(v2, MON_DATA_ATK, NULL); + param1->unk_B4[v0] = GetMonData(v2, MON_DATA_DEF, NULL); + param1->unk_C4[v0] = GetMonData(v2, MON_DATA_SPEED, NULL); + param1->unk_D4[v0] = GetMonData(v2, MON_DATA_SP_ATK, NULL); + param1->unk_E4[v0] = GetMonData(v2, MON_DATA_SP_DEF, NULL); } return; @@ -378,7 +378,7 @@ BOOL ov104_02237748 (UnkStruct_ov104_0222E930 * param0) for (v11 = 0; v11 < 3; v11++) { v1 = Party_GetPokemonBySlotIndex(v2, v3->unk_2C[v11]); - sub_02074B30(v1, 6, &v3->unk_412[v11]); + SetMonData(v1, 6, &v3->unk_412[v11]); } break; case 19: diff --git a/src/overlay104/ov104_02237DD8.c b/src/overlay104/ov104_02237DD8.c index 6b352f7b03..5d7d2002c1 100644 --- a/src/overlay104/ov104_02237DD8.c +++ b/src/overlay104/ov104_02237DD8.c @@ -29,7 +29,7 @@ #include "unk_020507CC.h" #include "unk_0205DFC4.h" #include "unk_0206AFE0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay104/ov104_0222DCE0.h" #include "overlay104/ov104_0222ECE8.h" @@ -218,12 +218,12 @@ UnkStruct_ov104_0223BFFC * ov104_02237DD8 (UnkStruct_021C0794 * param0, u16 para v3 = Party_GetPokemonBySlotIndex(v9->unk_70, v7); v0 = 0; - sub_02074B30(v3, 6, &v0); + SetMonData(v3, 6, &v0); - if (GetMonData(v3, MON_DATA_161, NULL) > 50) { - v1 = sub_02075AD0(GetMonData(v3, MON_DATA_SPECIES, NULL), 50); - sub_02074B30(v3, 8, &v1); - sub_0207418C(v3); + if (GetMonData(v3, MON_DATA_LEVEL, NULL) > 50) { + v1 = GetMonSpeciesLevelExp(GetMonData(v3, MON_DATA_SPECIES, NULL), 50); + SetMonData(v3, 8, &v1); + CalculateMonLevelAndStats(v3); } } @@ -328,7 +328,7 @@ static void ov104_022381C4 (UnkStruct_ov104_0223BFFC * param0) v3 = Party_GetPokemonBySlotIndex(param0->unk_70, v2); v1 = (u16)sub_0203054C(param0->unk_08, 4, v2, 0, NULL); - sub_02074B30(v3, 6, &v1); + SetMonData(v3, 6, &v1); } return; @@ -590,7 +590,7 @@ static int ov104_02238584 (UnkStruct_ov104_0223BFFC * param0, Party * param1, Pa continue; } - v0 = GetMonData(v5, MON_DATA_163, NULL); + v0 = GetMonData(v5, MON_DATA_CURRENT_HP, NULL); if (v0 == 0) { v1++; @@ -609,7 +609,7 @@ static int ov104_02238584 (UnkStruct_ov104_0223BFFC * param0, Party * param1, Pa continue; } - v0 = GetMonData(v5, MON_DATA_163, NULL); + v0 = GetMonData(v5, MON_DATA_CURRENT_HP, NULL); if (v0 == 0) { v1++; @@ -1111,12 +1111,12 @@ static void ov104_02238BBC (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v0 = 0; v0 < param2; v0++) { v3 = Party_GetPokemonBySlotIndex(param1, v0); - v1 = GetMonData(v3, MON_DATA_164, NULL); + v1 = GetMonData(v3, MON_DATA_MAX_HP, NULL); v2 = (v1 * 1.2); v2 -= v1; v2 = (v1 - v2); - sub_02074B30(v3, 163, &v2); + SetMonData(v3, 163, &v2); } return; @@ -1134,13 +1134,13 @@ static void ov104_02238C18 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u v6 = Party_GetPokemonBySlotIndex(param1, v0); v3 = GetMonData(v6, MON_DATA_177, NULL); v4 = GetMonData(v6, MON_DATA_178, NULL); - v5 = GetMonData(v6, MON_DATA_10, NULL); + v5 = GetMonData(v6, MON_DATA_ABILITY, NULL); if ((v3 == 3) || (v4 == 3) || (v3 == 8) || (v4 == 8) || (v5 == 17)) { v1++; } else { v2 = 0x8; - sub_02074B30(v6, 160, &v2); + SetMonData(v6, 160, &v2); } } @@ -1163,13 +1163,13 @@ static void ov104_02238C9C (UnkStruct_ov104_0223BFFC * param0, Party * param1, u v6 = Party_GetPokemonBySlotIndex(param1, v0); v3 = GetMonData(v6, MON_DATA_177, NULL); v4 = GetMonData(v6, MON_DATA_178, NULL); - v5 = GetMonData(v6, MON_DATA_10, NULL); + v5 = GetMonData(v6, MON_DATA_ABILITY, NULL); if ((v3 == 4) || (v4 == 4) || (v5 == 7)) { v1++; } else { v2 = 0x40; - sub_02074B30(v6, 160, &v2); + SetMonData(v6, 160, &v2); } } @@ -1192,13 +1192,13 @@ static void ov104_02238D14 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u v6 = Party_GetPokemonBySlotIndex(param1, v0); v3 = GetMonData(v6, MON_DATA_177, NULL); v4 = GetMonData(v6, MON_DATA_178, NULL); - v5 = GetMonData(v6, MON_DATA_10, NULL); + v5 = GetMonData(v6, MON_DATA_ABILITY, NULL); if ((v3 == 10) || (v4 == 10) || (v5 == 41)) { v1++; } else { v2 = 0x10; - sub_02074B30(v6, 160, &v2); + SetMonData(v6, 160, &v2); } } @@ -1221,7 +1221,7 @@ static void ov104_02238D8C (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v1 = 0; v1 < param2; v1++) { v5 = Party_GetPokemonBySlotIndex(param1, v0); - v4 = GetMonData(v5, MON_DATA_10, NULL); + v4 = GetMonData(v5, MON_DATA_ABILITY, NULL); if ((v4 == 15) || (v4 == 72)) { v2++; @@ -1232,7 +1232,7 @@ static void ov104_02238D8C (UnkStruct_ov104_0223BFFC * param0, Party * param1, u } } else { v3 = (LCRNG_Next() % 4 + 2); - sub_02074B30(v5, 160, &v3); + SetMonData(v5, 160, &v3); break; } } @@ -1258,7 +1258,7 @@ static void ov104_02238E08 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u v7 = Party_GetPokemonBySlotIndex(param1, v0); v4 = GetMonData(v7, MON_DATA_177, NULL); v5 = GetMonData(v7, MON_DATA_178, NULL); - v6 = GetMonData(v7, MON_DATA_10, NULL); + v6 = GetMonData(v7, MON_DATA_ABILITY, NULL); if ((v4 == 15) || (v5 == 15) || (v6 == 40)) { v2++; @@ -1269,7 +1269,7 @@ static void ov104_02238E08 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u } } else { v3 = 0x20; - sub_02074B30(v7, 160, &v3); + SetMonData(v7, 160, &v3); break; } @@ -1306,7 +1306,7 @@ static void ov104_02238E9C (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v0 = 0; v0 < param2; v0++) { v5 = Party_GetPokemonBySlotIndex(param1, v0); - sub_02074B30(v5, 6, &v3); + SetMonData(v5, 6, &v3); } return; @@ -1336,7 +1336,7 @@ static void ov104_02238EF8 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v0 = 0; v0 < param2; v0++) { v5 = Party_GetPokemonBySlotIndex(param1, v0); - sub_02074B30(v5, 6, &v3); + SetMonData(v5, 6, &v3); } return; @@ -1350,7 +1350,7 @@ static void ov104_02238F54 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v0 = 0; v0 < param2; v0++) { v3 = Party_GetPokemonBySlotIndex(param1, v0); - v2 = GetMonData(v3, MON_DATA_161, NULL); + v2 = GetMonData(v3, MON_DATA_LEVEL, NULL); v2 += 3; if (v2 > 100) { @@ -1358,10 +1358,10 @@ static void ov104_02238F54 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u v2 = 100; } - v1 = sub_02075AD0(GetMonData(v3, MON_DATA_SPECIES, NULL), v2); + v1 = GetMonSpeciesLevelExp(GetMonData(v3, MON_DATA_SPECIES, NULL), v2); - sub_02074B30(v3, 8, &v1); - sub_0207418C(v3); + SetMonData(v3, 8, &v1); + CalculateMonLevelAndStats(v3); } return; @@ -1513,7 +1513,7 @@ void ov104_02239054 (Party * param0, Party * param1, int param2, int param3) v0 = GetMonData(v2, MON_DATA_HELD_ITEM, NULL); v1 = Party_GetPokemonBySlotIndex(param1, param3); - sub_02074B30(v1, 6, &v0); + SetMonData(v1, 6, &v0); return; } diff --git a/src/overlay104/ov104_0223A0C4.c b/src/overlay104/ov104_0223A0C4.c index fa58f6f7f6..99eb5768c0 100644 --- a/src/overlay104/ov104_0223A0C4.c +++ b/src/overlay104/ov104_0223A0C4.c @@ -24,7 +24,7 @@ #include "unk_020329E0.h" #include "unk_02049D08.h" #include "unk_02051D8C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay104/ov104_0222DCE0.h" #include "overlay104/ov104_0223A0C4.h" @@ -844,7 +844,7 @@ static u32 ov104_0223A3A8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348 if (param4 == 0) { do { v2 = (sub_0204AEC0(param0) | sub_0204AEC0(param0) << 16); - } while ((v4.unk_0B != GetNatureFromPersonality(v2)) || (sub_02075E38(param3, v2) == 1)); + } while ((v4.unk_0B != GetNatureFromPersonality(v2)) || (GetMonPersonalityShininess(param3, v2) == 1)); param1->unk_10 = v2; } else { @@ -862,7 +862,7 @@ static u32 ov104_0223A3A8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348 v1 = 0; for (v0 = 0; v0 < 6; v0++) { - if (v4.unk_0A & FlagIndex(v0)) { + if (v4.unk_0A & GetSingleBitMask(v0)) { v1++; } } @@ -874,7 +874,7 @@ static u32 ov104_0223A3A8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348 } for (v0 = 0; v0 < 6; v0++) { - if (v4.unk_0A & FlagIndex(v0)) { + if (v4.unk_0A & GetSingleBitMask(v0)) { param1->unk_18_val2[v0] = v1; } } @@ -882,16 +882,16 @@ static u32 ov104_0223A3A8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348 param1->unk_1E_val2 = 0; param1->unk_1F = Unk_020E4C44; - v0 = sub_020759F0(param1->unk_00_val1_0, 25); + v0 = GetMonSpeciesPersonalDataAttribute(param1->unk_00_val1_0, 25); if (v0) { if (param1->unk_10 & 1) { param1->unk_20 = v0; } else { - param1->unk_20 = sub_020759F0(param1->unk_00_val1_0, 24); + param1->unk_20 = GetMonSpeciesPersonalDataAttribute(param1->unk_00_val1_0, 24); } } else { - param1->unk_20 = sub_020759F0(param1->unk_00_val1_0, 24); + param1->unk_20 = GetMonSpeciesPersonalDataAttribute(param1->unk_00_val1_0, 24); } param1->unk_21 = v3; @@ -927,11 +927,11 @@ BattleParams * ov104_0223A580 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223 for (v0 = 0; v0 < param0->unk_0E; v0++) { sub_020775EC(Party_GetPokemonBySlotIndex(v5, param0->unk_2A[v0]), v6); - if (GetMonData(v6, MON_DATA_161, NULL) > v1) { - v2 = sub_02075AD0(GetMonData(v6, MON_DATA_SPECIES, NULL), v1); + if (GetMonData(v6, MON_DATA_LEVEL, NULL) > v1) { + v2 = GetMonSpeciesLevelExp(GetMonData(v6, MON_DATA_SPECIES, NULL), v1); - sub_02074B30(v6, 8, &v2); - sub_0207418C(v6); + SetMonData(v6, 8, &v2); + CalculateMonLevelAndStats(v6); } sub_0205213C(v3, v6, 0); diff --git a/src/overlay104/ov104_0223A7F4.c b/src/overlay104/ov104_0223A7F4.c index cc8218ec8b..0a2d45bfa6 100644 --- a/src/overlay104/ov104_0223A7F4.c +++ b/src/overlay104/ov104_0223A7F4.c @@ -21,7 +21,7 @@ #include "unk_020329E0.h" #include "unk_02034198.h" #include "unk_02051D8C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_02096420.h" #include "overlay104/ov104_0222DCE0.h" diff --git a/src/overlay104/ov104_0223AF58.c b/src/overlay104/ov104_0223AF58.c index 3cc49e9bc2..4d533914ab 100644 --- a/src/overlay104/ov104_0223AF58.c +++ b/src/overlay104/ov104_0223AF58.c @@ -19,7 +19,7 @@ #include "unk_020329E0.h" #include "unk_02034198.h" #include "unk_02051D8C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_02096420.h" #include "overlay104/ov104_0222DCE0.h" @@ -1638,7 +1638,7 @@ BattleParams * ov104_0223B250 (UnkStruct_ov104_0223B5C0 * param0, UnkStruct_ov10 ov104_0222DF40(¶m0->unk_290[v6], v9, ov104_0223B57C(param0, v7)); - sub_0207803C(v9); + CalculateMonAbility(v9); sub_0205213C(v8, v9, 1); } @@ -1668,7 +1668,7 @@ BattleParams * ov104_0223B250 (UnkStruct_ov104_0223B5C0 * param0, UnkStruct_ov10 ov104_0222DF40(¶m0->unk_290[v6], v9, ov104_0223B57C(param0, v7)); - sub_0207803C(v9); + CalculateMonAbility(v9); sub_0205213C(v8, v9, 3); Heap_FreeToHeap(v9); break; @@ -1685,7 +1685,7 @@ static BOOL ov104_0223B4A4 (UnkStruct_ov104_0223B5C0 * param0, u8 param1) param0->unk_290[param1].unk_10 += ((24 + 1) * 10001); } - return sub_02075E38(param0->unk_290[param1].unk_0C, param0->unk_290[param1].unk_10); + return GetMonPersonalityShininess(param0->unk_290[param1].unk_0C, param0->unk_290[param1].unk_10); } static u32 ov104_0223B4D4 (u8 param0) @@ -1810,7 +1810,7 @@ u8 ov104_0223B5C0 (UnkStruct_ov104_0223B5C0 * param0) v2 = Party_GetFromSavedata(param0->unk_6FC); v3 = Party_GetPokemonBySlotIndex(v2, param0->unk_260[0]); - v1 = GetMonData(v3, MON_DATA_161, NULL); + v1 = GetMonData(v3, MON_DATA_LEVEL, NULL); return v1 / 10; } @@ -1869,11 +1869,11 @@ u16 ov104_0223B64C (UnkStruct_ov104_0223B5C0 * param0) v0 = Party_GetFromSavedata(param0->unk_6FC); v1 = Party_GetPokemonBySlotIndex(v0, param0->unk_260[0]); - v2 = GetMonData(v1, MON_DATA_161, NULL); + v2 = GetMonData(v1, MON_DATA_LEVEL, NULL); if (ov104_0223B500(param0->unk_04) == 2) { v1 = Party_GetPokemonBySlotIndex(v0, param0->unk_260[1]); - v3 = GetMonData(v1, MON_DATA_161, NULL); + v3 = GetMonData(v1, MON_DATA_LEVEL, NULL); if (v2 > v3) { return v2; diff --git a/src/overlay104/ov104_0223B6F4.c b/src/overlay104/ov104_0223B6F4.c index 08456ed24f..3dea0f9dd2 100644 --- a/src/overlay104/ov104_0223B6F4.c +++ b/src/overlay104/ov104_0223B6F4.c @@ -25,7 +25,7 @@ #include "unk_02034198.h" #include "unk_02051D8C.h" #include "unk_0205DFC4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_02096420.h" #include "overlay104/ov104_0222DCE0.h" @@ -294,13 +294,13 @@ void ov104_0223BA24 (Party * param0) continue; } - if (GetMonData(v4, MON_DATA_163, NULL) == 0) { + if (GetMonData(v4, MON_DATA_CURRENT_HP, NULL) == 0) { v3 = 1; - sub_02074B30(v4, 163, &v3); + SetMonData(v4, 163, &v3); } v3 = 0; - sub_02074B30(v4, 160, &v3); + SetMonData(v4, 160, &v3); } return; diff --git a/src/overlay104/ov104_0223BCBC.c b/src/overlay104/ov104_0223BCBC.c index a8103a564b..00443e1f6d 100644 --- a/src/overlay104/ov104_0223BCBC.c +++ b/src/overlay104/ov104_0223BCBC.c @@ -20,7 +20,7 @@ #include "unk_020329E0.h" #include "unk_02034198.h" #include "unk_02051D8C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_02096420.h" #include "overlay104/ov104_0222DCE0.h" @@ -328,7 +328,7 @@ void ov104_0223C04C (UnkStruct_ov104_0223BFFC * param0) v6 = Party_GetPokemonBySlotIndex(param0->unk_74, v1); v0 = 0; - sub_02074B30(v6, 6, &v0); + SetMonData(v6, 6, &v0); } Heap_FreeToHeap(v5); diff --git a/src/overlay105/ov105_02241AE0.c b/src/overlay105/ov105_02241AE0.c index 4e373309b3..519e15e94d 100644 --- a/src/overlay105/ov105_02241AE0.c +++ b/src/overlay105/ov105_02241AE0.c @@ -69,7 +69,7 @@ #include "unk_02034198.h" #include "unk_020363E8.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207A274.h" #include "unk_0208C324.h" @@ -2166,12 +2166,12 @@ static BOOL ov105_02244424 (UnkStruct_ov105_02241FF4 * param0) ov104_0222E5D0(param0->unk_20, 0); v1 = Party_GetPokemonBySlotIndex(param0->unk_31C, (2 + param0->unk_324[0])); - v2 = sub_02076B10(v1); + v2 = GetBoxMon(v1); ov105_02244F00(param0, 1, v2); v1 = Party_GetPokemonBySlotIndex(param0->unk_320, param0->unk_324[1]); - v2 = sub_02076B10(v1); + v2 = GetBoxMon(v1); ov105_02244F00(param0, 2, v2); ov105_0224628C(¶m0->unk_50[5], sub_02027B50(param0->unk_138)); @@ -2779,7 +2779,7 @@ static void ov105_02244FF8 (UnkStruct_ov105_02241FF4 * param0, UnkStruct_0205AA5 sub_0201D78C(param1, param8, v4, param3, param4, 0xff, (u32)((((param5) & 0xff) << 16) | (((param6) & 0xff) << 8) | (((param7) & 0xff) << 0)), NULL); v0 = sub_0201C294(param1) - 1; - v1 = GetMonData(v5, MON_DATA_111, NULL); + v1 = GetMonData(v5, MON_DATA_GENDER, NULL); v2 = (v1 == 0) ? 25 : 26; v3 = (v1 == 0) ? ((u32)(((7 & 0xff) << 16) | ((8 & 0xff) << 8) | (((0 & 0xff) << 0)))) : ((u32)(((3 & 0xff) << 16) | ((4 & 0xff) << 8) | (((0 & 0xff) << 0)))); @@ -3092,7 +3092,7 @@ static void ov105_022455C4 (UnkStruct_ov105_02241FF4 * param0, u8 param1, Pokemo v0 = GetMonData(param2, MON_DATA_SPECIES, NULL); v1 = GetMonData(param2, MON_DATA_FORM, NULL); - if (sub_020759CC(v0, v1, 28) == 0) { + if (GetMonFormPersonalDataAttribute(v0, v1, 28) == 0) { ov105_02245DB8(param0->unk_12C[param1], param5); } @@ -3179,7 +3179,7 @@ void ov105_022456A8 (UnkStruct_ov105_02241FF4 * param0, u16 param1, u16 param2) for (v0 = 0; v0 < param0->unk_11; v0++) { v2 = Party_GetPokemonBySlotIndex(param0->unk_31C, param0->unk_324[v0]); - param0->unk_33C[v0 + v1] = GetMonData(v2, MON_DATA_111, NULL); + param0->unk_33C[v0 + v1] = GetMonData(v2, MON_DATA_GENDER, NULL); } v1 += param0->unk_11; diff --git a/src/overlay105/ov105_02245CD0.c b/src/overlay105/ov105_02245CD0.c index 9bee59eee9..3a4ea0cb59 100644 --- a/src/overlay105/ov105_02245CD0.c +++ b/src/overlay105/ov105_02245CD0.c @@ -10,7 +10,7 @@ #include "unk_0200762C.h" #include "gx_layers.h" #include "unk_0202419C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" void ov105_02245CD0(void); void ov105_02245D50(UnkStruct_02007768 * param0); diff --git a/src/overlay106/ov106_02241AE0.c b/src/overlay106/ov106_02241AE0.c index 597eac4a27..b719f3364d 100644 --- a/src/overlay106/ov106_02241AE0.c +++ b/src/overlay106/ov106_02241AE0.c @@ -62,7 +62,7 @@ #include "unk_02034198.h" #include "unk_020363E8.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207A274.h" #include "unk_0208C324.h" @@ -1565,7 +1565,7 @@ void ov106_0224313C (UnkStruct_ov106_02243118 * param0, u16 param1, u16 param2) param0->unk_2A0[2] = param0->unk_18; v2 = Party_GetPokemonBySlotIndex(param0->unk_290, 0); - param0->unk_2A0[3] = GetMonData(v2, MON_DATA_161, NULL); + param0->unk_2A0[3] = GetMonData(v2, MON_DATA_LEVEL, NULL); return; } diff --git a/src/overlay107/ov107_02241AE0.c b/src/overlay107/ov107_02241AE0.c index 48b44d6823..fcb577922b 100644 --- a/src/overlay107/ov107_02241AE0.c +++ b/src/overlay107/ov107_02241AE0.c @@ -71,7 +71,7 @@ #include "unk_020363E8.h" #include "unk_020393C8.h" #include "unk_0205DFC4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0208C098.h" #include "unk_02096420.h" @@ -873,7 +873,7 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) } if (param0->unk_16 == 0) { - if (GetMonData(v7, MON_DATA_163, NULL) == GetMonData(v7, MON_DATA_164, NULL)) { + if (GetMonData(v7, MON_DATA_CURRENT_HP, NULL) == GetMonData(v7, MON_DATA_MAX_HP, NULL)) { param0->unk_0A = ov107_02243918(param0, 37, 1); param0->unk_08 = 7; break; @@ -885,7 +885,7 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) break; } } else { - if ((GetMonData(v7, MON_DATA_163, NULL) == GetMonData(v7, MON_DATA_164, NULL)) && (ov107_02245210(v7) == 0)) { + if ((GetMonData(v7, MON_DATA_CURRENT_HP, NULL) == GetMonData(v7, MON_DATA_MAX_HP, NULL)) && (ov107_02245210(v7) == 0)) { param0->unk_0A = ov107_02243918(param0, 37, 1); param0->unk_08 = 7; break; @@ -1094,7 +1094,7 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) return 1; } } else { - ov107_02244A8C(param0, 0, sub_02076B10(v7)); + ov107_02244A8C(param0, 0, GetBoxMon(v7)); sub_0200B744(param0->unk_24, 1, GetMonData(v7, MON_DATA_HELD_ITEM, NULL)); param0->unk_0A = ov107_02243918(param0, 60, 1); param0->unk_08 = 16; @@ -1503,8 +1503,8 @@ static void ov107_02242F5C (UnkStruct_ov107_02241D6C * param0) ov107_02249BAC(param0->unk_404[v15], 0); } - v2 = GetMonData(v19, MON_DATA_163, NULL); - v3 = GetMonData(v19, MON_DATA_164, NULL); + v2 = GetMonData(v19, MON_DATA_CURRENT_HP, NULL); + v3 = GetMonData(v19, MON_DATA_MAX_HP, NULL); v4 = ov107_022450E8(param0, sub_0208C104(v2, v3, 48)); v5 = ov107_02245114(param0, sub_0208C104(v2, v3, 48)); @@ -2063,7 +2063,7 @@ asm static void ov107_02243950 (UnkStruct_ov107_02241D6C * param0, UnkStruct_020 mov r3, #0x40 bl ov107_02243B5C add r0, r6, #0 - bl sub_02075BCC + bl GetMonNature add r2, r0, #0 ldr r0, [r5, #0x24] mov r1, #0 @@ -2359,9 +2359,9 @@ static void ov107_02243CFC (UnkStruct_ov107_02241D6C * param0, UnkStruct_0205AA5 v4 = 0; } - sub_0200C5BC(param0->unk_1C4, GetMonData(v7, MON_DATA_163, NULL), 3, 1, param1, v1, v2); + sub_0200C5BC(param0->unk_1C4, GetMonData(v7, MON_DATA_CURRENT_HP, NULL), 3, 1, param1, v1, v2); sub_0200C578(param0->unk_1C4, 0, param1, v5, v6); - sub_0200C5BC(param0->unk_1C4, GetMonData(v7, MON_DATA_164, NULL), 3, 0, param1, v3, v4); + sub_0200C5BC(param0->unk_1C4, GetMonData(v7, MON_DATA_MAX_HP, NULL), 3, 0, param1, v3, v4); return; } @@ -2409,8 +2409,8 @@ static void ov107_02243DE4 (UnkStruct_ov107_02241D6C * param0, UnkStruct_0205AA5 v4 = 0; } - sub_0200C648(param0->unk_1C4, 1, GetMonData(v7, MON_DATA_161, NULL), 3, 0, param1, v1, v2); - v0 = GetMonData(v7, MON_DATA_111, NULL); + sub_0200C648(param0->unk_1C4, 1, GetMonData(v7, MON_DATA_LEVEL, NULL), 3, 0, param1, v1, v2); + v0 = GetMonData(v7, MON_DATA_GENDER, NULL); ov107_02244B8C(param0, param1, v3, v4, 0, v0); return; @@ -3346,8 +3346,8 @@ static BOOL ov107_02244E44 (UnkStruct_ov107_02241D6C * param0, u8 param1, u8 par v5 = ov107_02249C98(param0->unk_14, param1); v6 = Party_GetPokemonBySlotIndex(param0->unk_43C, v5); - v0 = GetMonData(v6, MON_DATA_163, NULL); - v1 = GetMonData(v6, MON_DATA_164, NULL); + v0 = GetMonData(v6, MON_DATA_CURRENT_HP, NULL); + v1 = GetMonData(v6, MON_DATA_MAX_HP, NULL); v2 = ov107_022450E8(param0, sub_0208C104(v0, v1, 48)); v3 = ov107_02245114(param0, sub_0208C104(v0, v1, 48)); @@ -3380,7 +3380,7 @@ static BOOL ov107_02244E44 (UnkStruct_ov107_02241D6C * param0, u8 param1, u8 par } if (param0->unk_414 == NULL) { - ov107_02243F4C(param0, ¶m0->unk_50[3], v5, GetMonData(v6, MON_DATA_163, NULL)); + ov107_02243F4C(param0, ¶m0->unk_50[3], v5, GetMonData(v6, MON_DATA_CURRENT_HP, NULL)); ov107_02249BEC(param0->unk_420[v5], v3); ov107_02249C1C(param0->unk_3F4[v5], v2); param0->unk_0E_2 = 0; @@ -3568,19 +3568,19 @@ static BOOL ov107_02245210 (Pokemon * param0) v0 = 0; - if (GetMonData(param0, MON_DATA_58, NULL) != GetMonData(param0, MON_DATA_66, NULL)) { + if (GetMonData(param0, MON_DATA_MOVE1_PP, NULL) != GetMonData(param0, MON_DATA_MOVE1_MAX_PP, NULL)) { v0 = 1; } - if (GetMonData(param0, MON_DATA_59, NULL) != GetMonData(param0, MON_DATA_67, NULL)) { + if (GetMonData(param0, MON_DATA_MOVE2_PP, NULL) != GetMonData(param0, MON_DATA_MOVE2_MAX_PP, NULL)) { v0 = 1; } - if (GetMonData(param0, MON_DATA_60, NULL) != GetMonData(param0, MON_DATA_68, NULL)) { + if (GetMonData(param0, MON_DATA_MOVE3_PP, NULL) != GetMonData(param0, MON_DATA_MOVE3_MAX_PP, NULL)) { v0 = 1; } - if (GetMonData(param0, MON_DATA_61, NULL) != GetMonData(param0, MON_DATA_69, NULL)) { + if (GetMonData(param0, MON_DATA_MOVE4_PP, NULL) != GetMonData(param0, MON_DATA_MOVE4_MAX_PP, NULL)) { v0 = 1; } @@ -3818,7 +3818,7 @@ static void ov107_022454F8 (UnkStruct_ov107_02241D6C * param0, u8 param1, u8 par v1 = Party_GetPokemonBySlotIndex(param0->unk_43C, ov107_02249C98(param0->unk_14, param1)); v0 = ov107_02249CAC(param0->unk_1CC, param0->unk_09, 0); - ov107_02244A8C(param0, 0, sub_02076B10(v1)); + ov107_02244A8C(param0, 0, GetBoxMon(v1)); ov107_02249DBC(¶m0->unk_50[6], sub_02027B50(param0->unk_1C8)); param0->unk_0A = ov107_02243918(param0, Unk_ov107_02249E00[param2 - 1], 1); @@ -3850,10 +3850,10 @@ static void ov107_022455A0 (UnkStruct_ov107_02241D6C * param0, u8 param1, u16 pa v0 = Party_GetPokemonBySlotIndex(param0->unk_43C, ov107_02249C98(param0->unk_14, param1)); - sub_02074B30(v0, 6, ¶m2); + SetMonData(v0, 6, ¶m2); ov107_02249BAC(param0->unk_404[ov107_02249C98(param0->unk_14, param1)], 1); - ov107_02244A8C(param0, 0, sub_02076B10(v0)); + ov107_02244A8C(param0, 0, GetBoxMon(v0)); sub_0200B70C(param0->unk_24, 1, param2); param0->unk_0A = ov107_02243918(param0, 59, 1); @@ -4334,7 +4334,7 @@ static void ov107_02245C00 (UnkStruct_ov107_02241D6C * param0) for (v0 = 0; v0 < v1; v0++) { v3 = Party_GetPokemonBySlotIndex(param0->unk_43C, v0); - v2 = ov104_0222E240(GetMonData(v3, MON_DATA_163, NULL), GetMonData(v3, MON_DATA_164, NULL)); + v2 = ov104_0222E240(GetMonData(v3, MON_DATA_CURRENT_HP, NULL), GetMonData(v3, MON_DATA_MAX_HP, NULL)); if (param0->unk_3F4[v0] != NULL) { ov107_02249C1C(param0->unk_3F4[v0], v2); diff --git a/src/overlay107/ov107_02245EB0.c b/src/overlay107/ov107_02245EB0.c index 629f1b2663..f7befc32cf 100644 --- a/src/overlay107/ov107_02245EB0.c +++ b/src/overlay107/ov107_02245EB0.c @@ -71,7 +71,7 @@ #include "unk_020363E8.h" #include "unk_020393C8.h" #include "unk_0205DFC4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0209BA80.h" #include "overlay104/ov104_0222DCE0.h" @@ -564,7 +564,7 @@ static BOOL ov107_022462CC (UnkStruct_ov107_02246170 * param0) v8 = Party_GetPokemonBySlotIndex(param0->unk_3DC, ov107_02249C98(param0->unk_14, param0->unk_0D)); ov107_02248BEC(param0); - ov107_02248104(param0, 0, sub_02076B10(v8)); + ov107_02248104(param0, 0, GetBoxMon(v8)); param0->unk_0A = ov107_022477CC(param0, 20, 1); param0->unk_08 = 15; @@ -577,7 +577,7 @@ static BOOL ov107_022462CC (UnkStruct_ov107_02246170 * param0) v8 = Party_GetPokemonBySlotIndex(param0->unk_3DC, ov107_02249C98(param0->unk_14, param0->unk_0D)); ov107_02248BEC(param0); - ov107_02248104(param0, 0, sub_02076B10(v8)); + ov107_02248104(param0, 0, GetBoxMon(v8)); param0->unk_0A = ov107_022477CC(param0, 21, 1); ov107_02247DF0(param0); @@ -1722,7 +1722,7 @@ asm static void ov107_02247804 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 mov r3, #0x48 bl ov107_02247A14 add r0, r6, #0 - bl sub_02075BCC + bl GetMonNature add r2, r0, #0 ldr r0, [r5, #0x24] mov r1, #0 @@ -2045,9 +2045,9 @@ static void ov107_02247B78 (UnkStruct_ov107_02246170 * param0, UnkStruct_0205AA5 v3 = Party_GetPokemonBySlotIndex(param0->unk_3DC, v2); - sub_0200C5BC(param0->unk_144, GetMonData(v3, MON_DATA_163, NULL), 3, 1, param1, v0 + (64 * v2), 1); + sub_0200C5BC(param0->unk_144, GetMonData(v3, MON_DATA_CURRENT_HP, NULL), 3, 1, param1, v0 + (64 * v2), 1); sub_0200C578(param0->unk_144, 0, param1, 24 + v0 + (64 * v2), 1); - sub_0200C5BC(param0->unk_144, GetMonData(v3, MON_DATA_164, NULL), 3, 0, param1, 32 + v0 + (64 * v2), 1); + sub_0200C5BC(param0->unk_144, GetMonData(v3, MON_DATA_MAX_HP, NULL), 3, 0, param1, 32 + v0 + (64 * v2), 1); } sub_0201A9A4(param1); @@ -2076,9 +2076,9 @@ static void ov107_02247C64 (UnkStruct_ov107_02246170 * param0, UnkStruct_0205AA5 for (v4 = 0; v4 < v3; v4++) { v5 = Party_GetPokemonBySlotIndex(param0->unk_3DC, v4); - sub_0200C648(param0->unk_144, 1, GetMonData(v5, MON_DATA_161, NULL), 3, 0, param1, v1 + (64 * v4), 1); + sub_0200C648(param0->unk_144, 1, GetMonData(v5, MON_DATA_LEVEL, NULL), 3, 0, param1, v1 + (64 * v4), 1); - v0 = GetMonData(v5, MON_DATA_111, NULL); + v0 = GetMonData(v5, MON_DATA_GENDER, NULL); ov107_022481FC(param0, param1, v2 + (64 * v4), 1, 0, v0); } @@ -3098,7 +3098,7 @@ static void ov107_02248A8C (UnkStruct_ov107_02246170 * param0, u8 param1) ov107_02249DBC(¶m0->unk_50[7], sub_02027B50(param0->unk_148)); v0 = Party_GetPokemonBySlotIndex(param0->unk_3DC, ov107_02249C98(param0->unk_14, param1)); - ov107_02248104(param0, 0, sub_02076B10(v0)); + ov107_02248104(param0, 0, GetBoxMon(v0)); param0->unk_0A = ov107_022477CC(param0, 47, 1); @@ -3138,7 +3138,7 @@ static void ov107_02248B50 (UnkStruct_ov107_02246170 * param0, u8 param1) ov107_02249DBC(¶m0->unk_50[7], sub_02027B50(param0->unk_148)); v0 = Party_GetPokemonBySlotIndex(param0->unk_3DC, ov107_02249C98(param0->unk_14, param1)); - ov107_02248104(param0, 0, sub_02076B10(v0)); + ov107_02248104(param0, 0, GetBoxMon(v0)); param0->unk_0A = ov107_022477CC(param0, 70, 1); @@ -3557,7 +3557,7 @@ static void ov107_02249024 (UnkStruct_ov107_02246170 * param0, u8 param1) v0 = Party_GetPokemonBySlotIndex(param0->unk_3DC, ov107_02249C98(param0->unk_14, param1)); ov107_02249DBC(¶m0->unk_50[7], sub_02027B50(param0->unk_148)); - ov107_02248104(param0, 0, sub_02076B10(v0)); + ov107_02248104(param0, 0, GetBoxMon(v0)); param0->unk_0A = ov107_022477CC(param0, 20, 1); param0->unk_3CC[ov107_02249C98(param0->unk_14, param1)] = 1; @@ -3581,7 +3581,7 @@ static void ov107_022490E8 (UnkStruct_ov107_02246170 * param0, u8 param1, u8 par ov107_02249DBC(¶m0->unk_50[7], sub_02027B50(param0->unk_148)); v1 = Party_GetPokemonBySlotIndex(param0->unk_3DC, ov107_02249C98(param0->unk_14, param1)); - ov107_02248104(param0, 0, sub_02076B10(v1)); + ov107_02248104(param0, 0, GetBoxMon(v1)); if (param2 == 1) { param0->unk_0A = ov107_022477CC(param0, 31, 1); @@ -3598,17 +3598,17 @@ static void ov107_022490E8 (UnkStruct_ov107_02246170 * param0, u8 param1, u8 par } if (param0->unk_3D0[ov107_02249C98(param0->unk_14, param1)] == 0) { - v0 = sub_02075AD0(GetMonData(v1, MON_DATA_SPECIES, NULL), 50); - sub_02074B30(v1, 8, &v0); - sub_0207418C(v1); + v0 = GetMonSpeciesLevelExp(GetMonData(v1, MON_DATA_SPECIES, NULL), 50); + SetMonData(v1, 8, &v0); + CalculateMonLevelAndStats(v1); } else if (param0->unk_3D0[ov107_02249C98(param0->unk_14, param1)] == 1) { - v0 = sub_02075AD0(GetMonData(v1, MON_DATA_SPECIES, NULL), 55); - sub_02074B30(v1, 8, &v0); - sub_0207418C(v1); + v0 = GetMonSpeciesLevelExp(GetMonData(v1, MON_DATA_SPECIES, NULL), 55); + SetMonData(v1, 8, &v0); + CalculateMonLevelAndStats(v1); } else { - v0 = sub_02075AD0(GetMonData(v1, MON_DATA_SPECIES, NULL), 45); - sub_02074B30(v1, 8, &v0); - sub_0207418C(v1); + v0 = GetMonSpeciesLevelExp(GetMonData(v1, MON_DATA_SPECIES, NULL), 45); + SetMonData(v1, 8, &v0); + CalculateMonLevelAndStats(v1); } ov107_02247B78(param0, ¶m0->unk_50[3]); @@ -3655,7 +3655,7 @@ static void ov107_022492A8 (UnkStruct_ov107_02246170 * param0) for (v0 = 0; v0 < v1; v0++) { v3 = Party_GetPokemonBySlotIndex(param0->unk_3DC, v0); - v2 = ov104_0222E240(GetMonData(v3, MON_DATA_163, NULL), GetMonData(v3, MON_DATA_164, NULL)); + v2 = ov104_0222E240(GetMonData(v3, MON_DATA_CURRENT_HP, NULL), GetMonData(v3, MON_DATA_MAX_HP, NULL)); if (param0->unk_368[v0] != NULL) { ov107_02249C1C(param0->unk_368[v0], v2); diff --git a/src/overlay108/ov108_02241AE0.c b/src/overlay108/ov108_02241AE0.c index 670f4470a2..8aa0f4fdee 100644 --- a/src/overlay108/ov108_02241AE0.c +++ b/src/overlay108/ov108_02241AE0.c @@ -60,7 +60,7 @@ #include "unk_02034198.h" #include "unk_020363E8.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0209BA80.h" #include "overlay104/ov104_0223BCBC.h" diff --git a/src/overlay109/ov109_021D0D80.c b/src/overlay109/ov109_021D0D80.c index a98a29ef56..62d2f3c2e4 100644 --- a/src/overlay109/ov109_021D0D80.c +++ b/src/overlay109/ov109_021D0D80.c @@ -74,7 +74,7 @@ #include "unk_02038ED4.h" #include "unk_020393C8.h" #include "unk_02073838.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "unk_02092494.h" diff --git a/src/overlay113/ov113_0225C700.c b/src/overlay113/ov113_0225C700.c index fab8470110..5391627380 100644 --- a/src/overlay113/ov113_0225C700.c +++ b/src/overlay113/ov113_0225C700.c @@ -80,7 +80,7 @@ #include "unk_02025E08.h" #include "unk_020279FC.h" #include "unk_020393C8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay066/ov66_0222DDF0.h" #include "overlay066/ov66_02231428.h" diff --git a/src/overlay113/ov113_0225E368.c b/src/overlay113/ov113_0225E368.c index d8fed3e62b..4aafce391d 100644 --- a/src/overlay113/ov113_0225E368.c +++ b/src/overlay113/ov113_0225E368.c @@ -32,7 +32,7 @@ #include "unk_0201C970.h" #include "unk_0201D15C.h" #include "unk_02020020.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay113/ov113_0225E368.h" #include "overlay113/ov113_02260620.h" diff --git a/src/overlay118/ov118_021D0D80.c b/src/overlay118/ov118_021D0D80.c index 63bd836278..e1fddd18b2 100644 --- a/src/overlay118/ov118_021D0D80.c +++ b/src/overlay118/ov118_021D0D80.c @@ -24,7 +24,7 @@ #include "unk_0202419C.h" #include "unk_0202631C.h" #include "unk_0203CC84.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207E0B8.h" #include "unk_020819DC.h" @@ -82,7 +82,7 @@ int ov118_021D0DBC (UnkStruct_0207F248 * param0) switch (v0->unk_0C) { case 487: - sub_02077A00(v1); + SetGiratinaForm(v1); v0->unk_08 = 65; v0->unk_10 = 0; break; @@ -146,7 +146,7 @@ int ov118_021D0DBC (UnkStruct_0207F248 * param0) v2 = MessageLoader_GetNewStrbuf(param0->unk_69C, 202); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v1)); + sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v1)); sub_0200C388(param0->unk_6A0, param0->unk_6A4, v2); Strbuf_Free(v2); sub_02082708(param0, 0xffffffff, 1); diff --git a/src/overlay119/ov119_021D0D80.c b/src/overlay119/ov119_021D0D80.c index 0baef6b4c9..4a57603049 100644 --- a/src/overlay119/ov119_021D0D80.c +++ b/src/overlay119/ov119_021D0D80.c @@ -53,7 +53,7 @@ #include "strbuf.h" #include "unk_0202419C.h" #include "unk_02024220.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay119/ov119_021D0D80.h" void ov119_021D0D80(void); @@ -323,7 +323,7 @@ int ov119_021D1158 (UnkStruct_0205AA50 * param0, int param1, Pokemon * param2, i v3 = sub_0200B358(71); v1 = MessageLoader_GetNewStrbuf(v5, param1); v2 = Strbuf_Init(255, 71); - v4 = sub_02076B10(param2); + v4 = GetBoxMon(param2); sub_0200B538(v3, 0, v4); sub_0200C388(v3, v2, v1); @@ -765,7 +765,7 @@ void ov119_021D1858 (UnkStruct_ov119_021D0FD0 * param0) { int v5 = 0; - sub_02074B30(v2, 76, &v5); + SetMonData(v2, 76, &v5); } sub_02075EF4(&v0, v2, 2); @@ -780,7 +780,7 @@ void ov119_021D18C0 (UnkStruct_ov119_021D0FD0 * param0) int v1; v0 = GetMonData(param0->unk_00->unk_0C.unk_00, MON_DATA_SPECIES, NULL); - v1 = sub_02075BCC(param0->unk_00->unk_0C.unk_00); + v1 = GetMonNature(param0->unk_00->unk_0C.unk_00); sub_02007B98(param0->unk_70, 1); sub_020789F4(param0->unk_04.unk_3C, param0->unk_04.unk_54, param0->unk_70, v0, 2, 0, 0); diff --git a/src/overlay119/ov119_021D191C.c b/src/overlay119/ov119_021D191C.c index 89e1a561e1..81a879bd92 100644 --- a/src/overlay119/ov119_021D191C.c +++ b/src/overlay119/ov119_021D191C.c @@ -17,7 +17,7 @@ #include "unk_0201F834.h" #include "gx_layers.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay119/ov119_021D0D80.h" #include "overlay119/ov119_021D191C.h" diff --git a/src/party.c b/src/party.c index 2506f0987a..5849ea4bbc 100644 --- a/src/party.c +++ b/src/party.c @@ -8,7 +8,7 @@ #include "heap.h" #include "unk_020244AC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #define PARTY_ASSERT_SLOT(party, slot) { \ diff --git a/src/pokemon.c b/src/pokemon.c new file mode 100644 index 0000000000..e79a7483a6 --- /dev/null +++ b/src/pokemon.c @@ -0,0 +1,5567 @@ +#include +#include + +#include "inlines.h" + +#include "struct_decls/struct_02002F38_decl.h" +#include "struct_decls/struct_02006C24_decl.h" +#include "struct_decls/struct_02007C7C_decl.h" +#include "struct_decls/struct_0200C6E4_decl.h" +#include "struct_decls/struct_0200C704_decl.h" +#include "struct_decls/struct_02015F84_decl.h" +#include "struct_decls/struct_02023790_decl.h" +#include "struct_decls/struct_02025E6C_decl.h" +#include "struct_decls/struct_0202CC84_decl.h" +#include "struct_decls/struct_party_decl.h" + +#include "struct_defs/struct_02007C10.h" +#include "struct_defs/struct_02008A90.h" +#include "struct_defs/struct_0200D0F4.h" +#include "struct_defs/struct_0202818C.h" +#include "struct_defs/struct_0202CA28.h" +#include "struct_defs/pokemon.h" +#include "struct_defs/box_pokemon.h" +#include "struct_defs/party_pokemon.h" +#include "struct_defs/pokemon_data_block_a.h" +#include "struct_defs/pokemon_data_block_b.h" +#include "struct_defs/pokemon_data_block_c.h" +#include "struct_defs/pokemon_data_block_d.h" +#include "struct_defs/pokemon_personal_data.h" +#include "struct_defs/pokemon_evolution_data.h" +#include "struct_defs/pokemon_data_block_shuffle_0.h" +#include "struct_defs/pokemon_data_block_shuffle_1.h" +#include "struct_defs/pokemon_data_block_shuffle_10.h" +#include "struct_defs/pokemon_data_block_shuffle_11.h" +#include "struct_defs/pokemon_data_block_shuffle_12.h" +#include "struct_defs/pokemon_data_block_shuffle_13.h" +#include "struct_defs/pokemon_data_block_shuffle_14.h" +#include "struct_defs/pokemon_data_block_shuffle_15.h" +#include "struct_defs/pokemon_data_block_shuffle_16.h" +#include "struct_defs/pokemon_data_block_shuffle_17.h" +#include "struct_defs/pokemon_data_block_shuffle_18.h" +#include "struct_defs/pokemon_data_block_shuffle_19.h" +#include "struct_defs/pokemon_data_block_shuffle_2.h" +#include "struct_defs/pokemon_data_block_shuffle_20.h" +#include "struct_defs/pokemon_data_block_shuffle_21.h" +#include "struct_defs/pokemon_data_block_shuffle_22.h" +#include "struct_defs/pokemon_data_block_shuffle_23.h" +#include "struct_defs/pokemon_data_block_shuffle_3.h" +#include "struct_defs/pokemon_data_block_shuffle_4.h" +#include "struct_defs/pokemon_data_block_shuffle_5.h" +#include "struct_defs/pokemon_data_block_shuffle_6.h" +#include "struct_defs/pokemon_data_block_shuffle_7.h" +#include "struct_defs/pokemon_data_block_shuffle_8.h" +#include "struct_defs/pokemon_data_block_shuffle_9.h" +#include "struct_defs/struct_020789BC.h" +#include "struct_defs/struct_020789F4.h" +#include "struct_defs/struct_02078B40.h" +#include "overlay005/struct_ov5_021DE5D0.h" +#include "overlay104/struct_ov104_0223F9E0.h" + +#include "unk_020021B0.h" +#include "unk_02005474.h" +#include "unk_02006224.h" +#include "narc.h" +#include "message.h" +#include "unk_0200B29C.h" +#include "unk_0200C6E4.h" +#include "unk_0201378C.h" +#include "unk_02015F84.h" +#include "unk_02017038.h" +#include "heap.h" +#include "unk_0201D15C.h" +#include "unk_020218BC.h" +#include "strbuf.h" +#include "unk_02025E68.h" +#include "unk_02028124.h" +#include "unk_0202C9F4.h" +#include "pokemon.h" +#include "move_table.h" +#include "unk_02079170.h" +#include "party.h" +#include "item.h" +#include "unk_02092494.h" + +#include "constants/pokemon.h" +#include "constants/species.h" +#include "constants/items.h" +#include "constants/moves.h" + +static const s8 Unk_020F0695[][5] = { + { 0x0, 0x0, 0x0, 0x0, 0x0 }, + { 0x1, 0x0, 0x0, 0x0, -0x1 }, + { 0x1, 0x0, -0x1, 0x0, 0x0 }, + { 0x1, -0x1, 0x0, 0x0, 0x0 }, + { 0x1, 0x0, 0x0, -0x1, 0x0 }, + { -0x1, 0x0, 0x0, 0x0, 0x1 }, + { 0x0, 0x0, 0x0, 0x0, 0x0 }, + { 0x0, 0x0, -0x1, 0x0, 0x1 }, + { 0x0, -0x1, 0x0, 0x0, 0x1 }, + { 0x0, 0x0, 0x0, -0x1, 0x1 }, + { -0x1, 0x0, 0x1, 0x0, 0x0 }, + { 0x0, 0x0, 0x1, 0x0, -0x1 }, + { 0x0, 0x0, 0x0, 0x0, 0x0 }, + { 0x0, -0x1, 0x1, 0x0, 0x0 }, + { 0x0, 0x0, 0x1, -0x1, 0x0 }, + { -0x1, 0x1, 0x0, 0x0, 0x0 }, + { 0x0, 0x1, 0x0, 0x0, -0x1 }, + { 0x0, 0x1, -0x1, 0x0, 0x0 }, + { 0x0, 0x0, 0x0, 0x0, 0x0 }, + { 0x0, 0x1, 0x0, -0x1, 0x0 }, + { -0x1, 0x0, 0x0, 0x1, 0x0 }, + { 0x0, 0x0, 0x0, 0x1, -0x1 }, + { 0x0, 0x0, -0x1, 0x1, 0x0 }, + { 0x0, -0x1, 0x0, 0x1, 0x0 }, + { 0x0, 0x0, 0x0, 0x0, 0x0 }, +}; + +void ZeroMonData(Pokemon * mon); +void ZeroBoxMonData(BoxPokemon * boxMon); +int PokemonStructSize(void); +Pokemon * AllocMonZeroed(u32 heapID); +BOOL DecryptMon(Pokemon * mon); +BOOL EncryptMon(Pokemon * mon, BOOL encrypt); +BOOL DecryptBoxMon(BoxPokemon * boxMon); +BOOL EncryptBoxMon(BoxPokemon * boxMon, BOOL encrypt); +void sub_02073D80(Pokemon * mon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); +void sub_02073E18(BoxPokemon * boxMon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); +void sub_02074044(Pokemon * mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monNature); +void sub_02074088(Pokemon * mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 param4, u8 param5, u8 param6); +u32 sub_02074128(u16 monSpecies, u8 param1, u8 param2); +void sub_02074158(Pokemon * mon, u16 monSpecies, u8 monLevel, u32 monCombinedIVs, u32 monPersonality); +void CalculateMonLevelAndStats(Pokemon * mon); +void CalculateMonStats(Pokemon * mon); +u32 GetMonData(Pokemon * mon, int monDataAttribute, void * dest); +static u32 GetMonDataAttribute(Pokemon * mon, int monDataAttribute, void * dest); +u32 GetBoxMonData(BoxPokemon * boxMon, int monDataAttribute, void * dest); +static u32 GetBoxMonDataAttribute(BoxPokemon * boxMon, int monDataAttribute, void * dest); +void SetMonData(Pokemon * mon, int monDataAttribute, const void * value); +static void SetMonDataAttribute(Pokemon * mon, int monDataAttribute, const void * value); +void SetBoxMonData(BoxPokemon * boxMon, int monDataAttribute, const void * value); +static void SetBoxMonDataAttribute(BoxPokemon * boxMon, int monDataAttribute, const void * value); +void IncreaseMonData(Pokemon * mon, int monDataAttribute, int value); +static void IncreaseMonDataAttribute(Pokemon * mon, int monDataAttribute, int value); +static void IncreaseBoxMonDataAttribute(BoxPokemon * boxMon, int monDataAttribute, int value); +u32 GetMonFormPersonalDataAttribute(int monSpecies, int monForm, int monPersonalDataAttribute); +u32 GetMonSpeciesPersonalDataAttribute(int monSpecies, int monPersonalDataAttribute); +u8 GetMonPercentToNextLevel(Pokemon * mon); +u32 GetMonExpToNextLevel(Pokemon * mon); +u32 GetBoxMonExpToNextLevel(BoxPokemon * boxMon); +u32 GetMonCurrentLevelExp(Pokemon * mon); +u32 GetMonSpeciesLevelExp(int monSpecies, int monLevel); +void LoadMonExperienceTable(int monExpRate, u32 * monExpTable); +u32 GetMonExpRateLevelExp(int monExpRate, int monLevel); +u32 GetMonLevel(Pokemon * mon); +u32 GetBoxMonLevel(BoxPokemon * boxMon); +u32 GetMonSpeciesLevel(u16 monSpecies, u32 monExp); +u8 GetMonNature(Pokemon * mon); +u8 GetBoxMonNature(BoxPokemon * boxMon); +u8 GetNatureFromPersonality(u32 monPersonality); +u16 GetNatureAdjustedStatValue(u8 monNature, u16 monStatValue, u8 statType); +s8 GetNatureStatAffinity(u8 monNature, u8 statType); +void sub_02075C74(Pokemon * mon, u8 param1, u16 param2); +u8 GetMonGender(Pokemon * mon); +u8 GetBoxMonGender(BoxPokemon * boxMon); +u8 GetMonPersonalityGender(u16 monSpecies, u32 monPersonality); +u8 GetMonShininess(Pokemon * mon); +u8 GetBoxMonShininess(BoxPokemon * boxMon); +u8 GetMonPersonalityShininess(u32 monOTID, u32 monPersonality); +u32 sub_02075E64(u32 param0); +void sub_02075EF4(UnkStruct_02008A90 * param0, Pokemon * mon, u8 param2); +void sub_02075F0C(UnkStruct_02008A90 * param0, BoxPokemon * boxMon, u8 param2, int param3); +void sub_02075FB4(UnkStruct_02008A90 * param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); +u8 SanitizeFormId(u16 monSpecies, u8 monForm); +u8 sub_020765AC(Pokemon * mon, u8 param1); +u8 sub_020765C4(BoxPokemon * boxMon, u8 param1, int param2); +u8 sub_02076648(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality); +void sub_0207697C(UnkStruct_02008A90 * param0, u16 param1); +UnkStruct_0200D0F4 * sub_02076994(UnkStruct_0200C6E4 * param0, UnkStruct_0200C704 * param1, UnkStruct_02002F38 * param2, int param3, int param4, int param5, int param6, int param7, int heapID); +void sub_02076AAC(int param0, int param1, UnkStruct_ov5_021DE5D0 * param2); +u32 GetPokemonStructSize(void); +u32 GetBoxPokemonStructSize(void); +u8 GetMonForm(Pokemon * mon); +u8 GetBoxMonForm(BoxPokemon * boxMon); +BoxPokemon * GetBoxMon(Pokemon * mon); +u8 sub_02076B14(Pokemon * mon); +u16 sub_02076B94(Party * party, Pokemon * mon, u8 evoTypeList, u16 evoParam, int * evoTypeResult); +void SetBoxMonDefaultMoves(BoxPokemon * boxMon); +u16 AddMonMove(Pokemon * mon, u16 moveID); +u16 AddBoxMonMove(BoxPokemon * boxMon, u16 moveID); +void ReplaceMonMove(Pokemon * mon, u16 moveID); +void ReplaceBoxMonMove(BoxPokemon * boxMon, u16 moveID); +void ResetMonMove(Pokemon * mon, u16 moveID, u8 moveSlot); +void SetMonMove(Pokemon * mon, u16 moveID, u8 moveSlot); +void SetBoxMonMove(BoxPokemon * boxMon, u16 moveID, u8 moveSlot); +u16 sub_0207727C(Pokemon * mon, int * index, u16 * moveID); +void SwapMonMoves(Pokemon * mon, int moveSlot1, int moveSlot2); +void SwapBoxMonMoves(BoxPokemon * boxMon, int moveSlot1, int moveSlot2); +void DeleteMonMove(Pokemon * mon, u32 moveSlot); +BOOL MonHasMove(Pokemon * mon, u16 moveID); +void sub_020774C8(BoxPokemon * boxMon, Pokemon * mon); +u8 GetPartyHighestLevel(Party * party); +u16 sub_020775A4(u16 param0); +u16 sub_020775C4(u16 param0); +void sub_020775EC(Pokemon * src, Pokemon * dest); +void sub_02077604(BoxPokemon * src, BoxPokemon * dest); +void sub_02077618(Pokemon * src, BoxPokemon * dest); +s8 sub_0207762C(Pokemon * mon, int param1); +s8 sub_02077634(BoxPokemon * boxMon, int param1); +s8 sub_02077648(u32 monPersonality, int param1); +void sub_020776B0(Party * party); +u8 sub_02077758(Party * party, u8 param1); +void sub_020777B4(Party * party, s32 param1); +void sub_0207782C(Party * party); +BOOL sub_020778D8(Pokemon * mon); +BOOL sub_020778E0(BoxPokemon * boxMon); +BOOL sub_020778F8(Pokemon * mon); +BOOL sub_02077900(BoxPokemon * boxMon); +void SetArceusForm(Pokemon * mon); +void SetBoxArceusForm(BoxPokemon * boxMon); +u8 GetArceusItemType(u16 itemHoldEffect); +int SetGiratinaForm(Pokemon * mon); +int SetBoxGiratinaForm(BoxPokemon * boxMon); +void SetShayminForm(Pokemon * mon, int monForm); +void SetBoxShayminForm(BoxPokemon * boxMon, int monForm); +void LoadMonLevelUpMoves(int monSpecies, int monForm, u16 * monLevelUpMoves); +void sub_02077D3C(UnkStruct_0202CC84 * param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7); +void sub_02077E64(Pokemon * mon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5); +void sub_02077EA4(BoxPokemon * boxMon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5); +void sub_02077EE4(Pokemon * mon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5); +void sub_02077EF8(BoxPokemon * boxMon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5); +void sub_02077F0C(Pokemon * mon, u32 param1, int param2); +BOOL sub_02077FB4(Pokemon * mon, u8 param1); +BOOL sub_02077FBC(BoxPokemon * boxMon, u8 param1); +BOOL sub_02077FE4(u16 monSpecies, int monForm, u8 tmID); +void CalculateMonAbility(Pokemon * mon); +void CalculateBoxMonAbility(BoxPokemon * boxMon); +void sub_020780C4(Pokemon * mon, u32 monPersonality); +static void LoadMonPersonalData(int monSpecies, PokemonPersonalData * monPersonalData); +static void LoadMonFormPersonalData(int monSpecies, int monForm, PokemonPersonalData * monPersonalData); +static void LoadMonEvolutionData(int monSpecies, PokemonEvolutionData * monEvolutionData); +static void EncryptMonData(void * data, u32 bytes, u32 seed); +static void DecryptMonData(void * data, u32 bytes, u32 seed); +static u16 GetMonDataChecksum(void * data, u32 bytes); +static void * GetBoxMonDataBlock(BoxPokemon * boxMon, u32 personality, u8 dataBlockID); +static int GetMonFormNarcIndex(int monSpecies, int monForm); +u32 GetSingleBitMask(int index); +int GetLowestSetBitIndex(u32 num); +BOOL sub_02078804(u16 param0); +BOOL sub_02078838(Pokemon * mon); +int sub_020788D0(int param0); +static void sub_02076300(UnkStruct_02008A90 * param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); +static u8 sub_020767BC(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality); + +void ZeroMonData (Pokemon * mon) +{ + MI_CpuClearFast(mon, sizeof(Pokemon)); + EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); +} + +void ZeroBoxMonData (BoxPokemon * boxMon) +{ + MI_CpuClearFast(boxMon, sizeof(BoxPokemon)); + EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4, boxMon->checksum); +} + +int PokemonStructSize (void) +{ + return sizeof(Pokemon); +} + +Pokemon * AllocMonZeroed (u32 heapID) +{ + Pokemon * mon = Heap_AllocFromHeap(heapID, sizeof(Pokemon)); + ZeroMonData(mon); + return mon; +} + +BOOL DecryptMon (Pokemon * mon) +{ + BOOL wasDecrypted; + + wasDecrypted = 0; + + if (mon->box.partyDecrypted == 0) { + wasDecrypted = 1; + GF_ASSERT(mon->box.boxDecrypted == 0); + + mon->box.partyDecrypted = 1; + mon->box.boxDecrypted = 1; + + DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + } + + return wasDecrypted; +} + +BOOL EncryptMon (Pokemon * mon, BOOL encrypt) +{ + BOOL wasEncrypted; + + wasEncrypted = 0; + + if ((mon->box.partyDecrypted == 1) && (encrypt == 1)) { + wasEncrypted = 1; + mon->box.partyDecrypted = 0; + mon->box.boxDecrypted = 0; + + EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4); + EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + } + + return wasEncrypted; +} + +BOOL DecryptBoxMon (BoxPokemon * boxMon) +{ + BOOL wasDecrypted; + + wasDecrypted = 0; + + if (boxMon->boxDecrypted == 0) { + wasDecrypted = 1; + boxMon->boxDecrypted = 1; + DecryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4, boxMon->checksum); + } + + return wasDecrypted; +} + +BOOL EncryptBoxMon (BoxPokemon * boxMon, BOOL encrypt) +{ + BOOL wasEncrypted; + + wasEncrypted = 0; + + if ((boxMon->boxDecrypted == 1) && (encrypt == 1)) { + wasEncrypted = 1; + + boxMon->boxDecrypted = 0; + boxMon->checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4); + + EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4, boxMon->checksum); + } + + return wasEncrypted; +} + +void sub_02073D80 (Pokemon * mon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) +{ + u32 zero; + UnkStruct_0202818C * v1; + UnkStruct_0202CA28 v2; + + ZeroMonData(mon); + + sub_02073E18((BoxPokemon *)&mon->box, monSpecies, monLevel, monIVs, useMonPersonalityParam, monPersonality, monOTIDSource, monOTID); + EncryptMonData(&mon->party, sizeof(PartyPokemon), 0); + EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + SetMonData(mon, MON_DATA_LEVEL, (u8 *)&monLevel); + + v1 = sub_0202818C(0); + + SetMonData(mon, MON_DATA_170, v1); + Heap_FreeToHeap(v1); + + zero = 0; + SetMonData(mon, MON_DATA_162, (u8 *)&zero); + + MI_CpuClearFast(&v2, sizeof(UnkStruct_0202CA28)); + + SetMonData(mon, MON_DATA_171, (UnkStruct_0202CA28 *)&v2); + CalculateMonLevelAndStats(mon); +} + +void sub_02073E18 (BoxPokemon * boxMon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) +{ + u16 unused_0; + u32 v1, v2; + BOOL reencrypt; + + ZeroBoxMonData(boxMon); + + reencrypt = DecryptBoxMon(boxMon); + + if (!useMonPersonalityParam) { + monPersonality = (LCRNG_Next() | (LCRNG_Next() << 16)); + } + + SetBoxMonData(boxMon, MON_DATA_PERSONALITY, (u8 *)&monPersonality); + + if (monOTIDSource == 2) { + do { + monOTID = (LCRNG_Next() | (LCRNG_Next() << 16)); + } while ((((monOTID & 0xffff0000) >> 16) ^ (monOTID & 0xffff) ^ ((monPersonality & 0xffff0000) >> 16) ^ (monPersonality & 0xffff)) < 8); + } else if (monOTIDSource != 1) { + monOTID = 0; + } + + SetBoxMonData(boxMon, MON_DATA_OT_ID, (u8 *)&monOTID); + SetBoxMonData(boxMon, MON_DATA_LANGUAGE, (u8 *)&Unk_020E4C44); + SetBoxMonData(boxMon, MON_DATA_SPECIES, (u8 *)&monSpecies); + SetBoxMonData(boxMon, MON_DATA_179, NULL); + + v1 = GetMonSpeciesLevelExp(monSpecies, monLevel); + SetBoxMonData(boxMon, MON_DATA_EXP, (u8 *)&v1); + + v1 = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_BASE_FRIENDSHIP); + SetBoxMonData(boxMon, MON_DATA_FRIENDSHIP, (u8 *)&v1); + + SetBoxMonData(boxMon, MON_DATA_MET_LEVEL, (u8 *)&monLevel); + SetBoxMonData(boxMon, MON_DATA_MET_GAME, (u8 *)&Unk_020E4C40); + + v1 = 4; + SetBoxMonData(boxMon, MON_DATA_POKEBALL, (u8 *)&v1); + + if (monIVs < 32) { + SetBoxMonData(boxMon, MON_DATA_HP_IV, (u8 *)&monIVs); + SetBoxMonData(boxMon, MON_DATA_ATK_IV, (u8 *)&monIVs); + SetBoxMonData(boxMon, MON_DATA_DEF_IV, (u8 *)&monIVs); + SetBoxMonData(boxMon, MON_DATA_SPEED_IV, (u8 *)&monIVs); + SetBoxMonData(boxMon, MON_DATA_SPATK_IV, (u8 *)&monIVs); + SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, (u8 *)&monIVs); + } else { + v1 = LCRNG_Next(); + v2 = (v1 & (0x1f << 0)) >> 0; + SetBoxMonData(boxMon, MON_DATA_HP_IV, (u8 *)&v2); + + v2 = (v1 & (0x1f << 5)) >> 5; + SetBoxMonData(boxMon, MON_DATA_ATK_IV, (u8 *)&v2); + + v2 = (v1 & (0x1f << 10)) >> 10; + SetBoxMonData(boxMon, MON_DATA_DEF_IV, (u8 *)&v2); + + v1 = LCRNG_Next(); + v2 = (v1 & (0x1f << 0)) >> 0; + SetBoxMonData(boxMon, MON_DATA_SPEED_IV, (u8 *)&v2); + + v2 = (v1 & (0x1f << 5)) >> 5; + SetBoxMonData(boxMon, MON_DATA_SPATK_IV, (u8 *)&v2); + + v2 = (v1 & (0x1f << 10)) >> 10; + SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, (u8 *)&v2); + } + + v1 = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_ABILITY_1); + v2 = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_ABILITY_2); + + if (v2 != 0) { + if (monPersonality & 1) { + SetBoxMonData(boxMon, MON_DATA_ABILITY, (u8 *)&v2); + } else { + SetBoxMonData(boxMon, MON_DATA_ABILITY, (u8 *)&v1); + } + } else { + SetBoxMonData(boxMon, MON_DATA_ABILITY, (u8 *)&v1); + } + + v1 = GetBoxMonGender(boxMon); + + SetBoxMonData(boxMon, MON_DATA_GENDER, (u8 *)&v1); + SetBoxMonDefaultMoves(boxMon); + EncryptBoxMon(boxMon, reencrypt); +} + +void sub_02074044 (Pokemon * mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monNature) +{ + u32 monPersonality; + + do { + monPersonality = (LCRNG_Next() | (LCRNG_Next() << 16)); + } while (monNature != GetNatureFromPersonality(monPersonality)); + + sub_02073D80(mon, monSpecies, monLevel, monIVs, 1, monPersonality, 0, 0); +} + +void sub_02074088 (Pokemon * mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 param4, u8 param5, u8 param6) +{ + u32 monPersonality; + u32 unused_0; + u16 unownLetter; + + if ((param6) && (param6 < 29)) { + do { + monPersonality = (LCRNG_Next() | (LCRNG_Next() << 16)); + unownLetter = (((monPersonality & 0x3000000) >> 18) | ((monPersonality & 0x30000) >> 12) | ((monPersonality & 0x300) >> 6) | (monPersonality & 0x3)) % 28; + } while ((param5 != GetNatureFromPersonality(monPersonality)) || (param4 != GetMonPersonalityGender(monSpecies, monPersonality)) || (unownLetter != (param6 - 1))); + } else { + monPersonality = sub_02074128(monSpecies, param4, param5); + } + + sub_02073D80(mon, monSpecies, monLevel, monIVs, 1, monPersonality, 0, 0); +} + +u32 sub_02074128 (u16 monSpecies, u8 param1, u8 param2) +{ + u8 monGenderChance; + u32 result; + + monGenderChance = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_GENDER); + + switch (monGenderChance) { + case 0: + case 254: + case 255: + result = param2; + break; + default: + if (param1 == 0) { + result = 25 * ((monGenderChance / 25) + 1); + result += param2; + } else { + result = param2; + } + break; + } + + return result; +} + +void sub_02074158 (Pokemon * mon, u16 monSpecies, u8 monLevel, u32 monCombinedIVs, u32 monPersonality) +{ + sub_02073D80(mon, monSpecies, monLevel, 0, 1, monPersonality, 0, 0); + SetMonData(mon, MON_DATA_COMBINED_IVS, (u8 *)&monCombinedIVs); + CalculateMonLevelAndStats(mon); +} + +void CalculateMonLevelAndStats (Pokemon * mon) +{ + int monLevel; + BOOL reencrypt; + + reencrypt = DecryptMon(mon); + monLevel = GetMonLevel(mon); + + SetMonData(mon, MON_DATA_LEVEL, (u8 *)&monLevel); + CalculateMonStats(mon); + EncryptMon(mon, reencrypt); +} + +void CalculateMonStats (Pokemon * mon) +{ + int monMaxHp, monCurrentHp, newMaxHp; + int newAtk, newDef, newSpeed, newSpAtk, newSpDef; + int monHpIV, monAtkIV, monDefIV, monSpeedIV, monSpAtkIV, monSpDefIV; + int monHpEV, monAtkEV, monDefEV, monSpeedEV, monSpAtkEV, monSpDefEV; + int monSpecies; + int monLevel; + int monForm; + int v23, v24, v25; + PokemonPersonalData * monPersonalData; + BOOL reencrypt; + + reencrypt = DecryptMon(mon); + + monLevel = GetMonData(mon, MON_DATA_LEVEL, 0); + monMaxHp = GetMonData(mon, MON_DATA_MAX_HP, 0); + monCurrentHp = GetMonData(mon, MON_DATA_CURRENT_HP, 0); + monHpIV = GetMonData(mon, MON_DATA_HP_IV, 0); + monHpEV = GetMonData(mon, MON_DATA_HP_EV, 0); + monAtkIV = GetMonData(mon, MON_DATA_ATK_IV, 0); + monAtkEV = GetMonData(mon, MON_DATA_ATK_EV, 0); + monDefIV = GetMonData(mon, MON_DATA_DEF_IV, 0); + monDefEV = GetMonData(mon, MON_DATA_DEF_EV, 0); + monSpeedIV = GetMonData(mon, MON_DATA_SPEED_IV, 0); + monSpeedEV = GetMonData(mon, MON_DATA_SPEED_EV, 0); + monSpAtkIV = GetMonData(mon, MON_DATA_SPATK_IV, 0); + monSpAtkEV = GetMonData(mon, MON_DATA_SPATK_EV, 0); + monSpDefIV = GetMonData(mon, MON_DATA_SPDEF_IV, 0); + monSpDefEV = GetMonData(mon, MON_DATA_SPDEF_EV, 0); + monForm = GetMonData(mon, MON_DATA_FORM, 0); + monSpecies = GetMonData(mon, MON_DATA_SPECIES, 0); + monPersonalData = Heap_AllocFromHeap(0, sizeof(PokemonPersonalData)); + + LoadMonFormPersonalData(monSpecies, monForm, monPersonalData); + + if (monSpecies == SPECIES_SHEDINJA) { + newMaxHp = 1; + } else { + newMaxHp = ((2 * monPersonalData->baseHp + monHpIV + monHpEV / 4) * monLevel / 100 + monLevel + 10); + } + + SetMonData(mon, MON_DATA_MAX_HP, (u8 *)&newMaxHp); + + newAtk = ((2 * monPersonalData->baseAtk + monAtkIV + monAtkEV / 4) * monLevel / 100 + 5); + newAtk = GetNatureAdjustedStatValue(GetMonNature(mon), newAtk, 0x1); + + SetMonData(mon, MON_DATA_ATK, (u8 *)&newAtk); + + newDef = ((2 * monPersonalData->baseDef + monDefIV + monDefEV / 4) * monLevel / 100 + 5); + newDef = GetNatureAdjustedStatValue(GetMonNature(mon), newDef, 0x2); + + SetMonData(mon, MON_DATA_DEF, (u8 *)&newDef); + + newSpeed = ((2 * monPersonalData->baseSpeed + monSpeedIV + monSpeedEV / 4) * monLevel / 100 + 5); + newSpeed = GetNatureAdjustedStatValue(GetMonNature(mon), newSpeed, 0x3); + + SetMonData(mon, MON_DATA_SPEED, (u8 *)&newSpeed); + + newSpAtk = ((2 * monPersonalData->baseSpAtk + monSpAtkIV + monSpAtkEV / 4) * monLevel / 100 + 5); + newSpAtk = GetNatureAdjustedStatValue(GetMonNature(mon), newSpAtk, 0x4); + + SetMonData(mon, MON_DATA_SP_ATK, (u8 *)&newSpAtk); + + newSpDef = ((2 * monPersonalData->baseSpDef + monSpDefIV + monSpDefEV / 4) * monLevel / 100 + 5); + newSpDef = GetNatureAdjustedStatValue(GetMonNature(mon), newSpDef, 0x5); + + SetMonData(mon, MON_DATA_SP_DEF, (u8 *)&newSpDef); + Heap_FreeToHeap(monPersonalData); + + if ((monCurrentHp == 0) && (monMaxHp != 0)) { + (void)0; + } else { + if (monSpecies == SPECIES_SHEDINJA) { + monCurrentHp = 1; + } else if (monCurrentHp == 0) { + monCurrentHp = newMaxHp; + } else { + monCurrentHp += (newMaxHp - monMaxHp); + } + } + + if (monCurrentHp) { + SetMonData(mon, MON_DATA_CURRENT_HP, (u8 *)&monCurrentHp); + } + + EncryptMon(mon, reencrypt); +} + +u32 GetMonData (Pokemon * mon, int monDataAttribute, void * dest) +{ + u32 result; + u16 checksum; + + if (mon->box.partyDecrypted == 0) { + DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + + checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4); + + if (checksum != mon->box.checksum) { + GF_ASSERT((checksum == mon->box.checksum)); + mon->box.invalidData = 1; + } + } + + result = GetMonDataAttribute(mon, monDataAttribute, dest); + + if (mon->box.partyDecrypted == 0) { + EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + } + + return result; +} + +static u32 GetMonDataAttribute (Pokemon * mon, int monDataAttribute, void * dest) +{ + u32 result = 0; + + switch (monDataAttribute) { + case MON_DATA_160: + result = mon->party.unk_00; + break; + case MON_DATA_LEVEL: + result = mon->party.level; + break; + case MON_DATA_162: + result = mon->party.unk_05; + break; + case MON_DATA_CURRENT_HP: + result = mon->party.unk_06; + break; + case MON_DATA_MAX_HP: + result = mon->party.unk_08; + break; + case MON_DATA_ATK: + result = mon->party.unk_0A; + break; + case MON_DATA_DEF: + result = mon->party.unk_0C; + break; + case MON_DATA_SPEED: + result = mon->party.unk_0E; + break; + case MON_DATA_SP_ATK: + result = mon->party.unk_10; + break; + case MON_DATA_SP_DEF: + result = mon->party.unk_12; + break; + case MON_DATA_170: + sub_020281A0(&mon->party.unk_14, (UnkStruct_0202818C *)dest); + result = 1; + break; + case MON_DATA_171: + sub_0202CA10(&mon->party.unk_4C, (UnkStruct_0202CA28 *)dest); + result = 1; + break; + default: + result = GetBoxMonDataAttribute((BoxPokemon *)&mon->box, monDataAttribute, dest); + break; + } + + return result; +} + +u32 GetBoxMonData (BoxPokemon * boxMon, int monDataAttribute, void * dest) +{ + u16 checksum; + u32 result; + + if (boxMon->boxDecrypted == 0) { + DecryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4, boxMon->checksum); + checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4); + + if (checksum != boxMon->checksum) { + GF_ASSERT((checksum == boxMon->checksum)); + boxMon->invalidData = 1; + } + } + + result = GetBoxMonDataAttribute(boxMon, monDataAttribute, dest); + + if (boxMon->boxDecrypted == 0) { + EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4, boxMon->checksum); + } + + return result; +} + +static u32 GetBoxMonDataAttribute (BoxPokemon * boxMon, int monDataAttribute, void * dest) +{ + u32 result = 0; + u64 v1; + PokemonDataBlockA * monDataBlockA; + PokemonDataBlockB * monDataBlockB; + PokemonDataBlockC * monDataBlockC; + PokemonDataBlockD * monDataBlockD; + + monDataBlockA = (PokemonDataBlockA *)GetBoxMonDataBlock(boxMon, boxMon->personality, 0); + monDataBlockB = (PokemonDataBlockB *)GetBoxMonDataBlock(boxMon, boxMon->personality, 1); + monDataBlockC = (PokemonDataBlockC *)GetBoxMonDataBlock(boxMon, boxMon->personality, 2); + monDataBlockD = (PokemonDataBlockD *)GetBoxMonDataBlock(boxMon, boxMon->personality, 3); + + switch (monDataAttribute) { + default: + result = 0; + break; + case MON_DATA_PERSONALITY: + result = boxMon->personality; + break; + case MON_DATA_1: + result = boxMon->partyDecrypted; + break; + case MON_DATA_2: + result = boxMon->boxDecrypted; + break; + case MON_DATA_3: + result = boxMon->invalidData; + break; + case MON_DATA_4: + result = boxMon->checksum; + break; + case MON_DATA_172: + result = (monDataBlockA->species != SPECIES_NONE); + break; + case MON_DATA_173: + if (boxMon->invalidData) { + result = boxMon->invalidData; + } else { + result = monDataBlockB->isEgg; + } + break; + case MON_DATA_SPECIES_EGG: + result = monDataBlockA->species; + + if (result == 0) { + break; + } else if ((monDataBlockB->isEgg) || (boxMon->invalidData)) { + result = SPECIES_EGG; + } + break; + case MON_DATA_LEVEL: + result = GetMonSpeciesLevel(monDataBlockA->species, monDataBlockA->exp); + break; + case MON_DATA_SPECIES: + if (boxMon->invalidData) { + result = SPECIES_EGG; + } else { + result = monDataBlockA->species; + } + break; + case MON_DATA_HELD_ITEM: + result = monDataBlockA->heldItem; + break; + case MON_DATA_OT_ID: + result = monDataBlockA->otID; + break; + case MON_DATA_EXP: + result = monDataBlockA->exp; + break; + case MON_DATA_FRIENDSHIP: + result = monDataBlockA->friendship; + break; + case MON_DATA_ABILITY: + result = monDataBlockA->ability; + break; + case MON_DATA_11: + result = monDataBlockA->unk_0E; + break; + case MON_DATA_LANGUAGE: + result = monDataBlockA->originLanguage; + break; + case MON_DATA_HP_EV: + result = monDataBlockA->hpEV; + break; + case MON_DATA_ATK_EV: + result = monDataBlockA->atkEV; + break; + case MON_DATA_DEF_EV: + result = monDataBlockA->defEV; + break; + case MON_DATA_SPEED_EV: + result = monDataBlockA->speedEV; + break; + case MON_DATA_SPATK_EV: + result = monDataBlockA->spAtkEV; + break; + case MON_DATA_SPDEF_EV: + result = monDataBlockA->spDefEV; + break; + case MON_DATA_COOL: + result = monDataBlockA->cool; + break; + case MON_DATA_BEAUTY: + result = monDataBlockA->beauty; + break; + case MON_DATA_CUTE: + result = monDataBlockA->cute; + break; + case MON_DATA_SMART: + result = monDataBlockA->smart; + break; + case MON_DATA_TOUGH: + result = monDataBlockA->tough; + break; + case MON_DATA_SHEEN: + result = monDataBlockA->sheen; + break; + case MON_DATA_25: + case MON_DATA_26: + case MON_DATA_27: + case MON_DATA_28: + case MON_DATA_29: + case MON_DATA_30: + case MON_DATA_31: + case MON_DATA_32: + case MON_DATA_33: + case MON_DATA_34: + case MON_DATA_35: + case MON_DATA_36: + case MON_DATA_37: + case MON_DATA_38: + case MON_DATA_39: + case MON_DATA_40: + case MON_DATA_41: + case MON_DATA_42: + case MON_DATA_43: + case MON_DATA_44: + case MON_DATA_45: + case MON_DATA_46: + case MON_DATA_47: + case MON_DATA_48: + case MON_DATA_49: + case MON_DATA_50: + case MON_DATA_51: + case MON_DATA_52: + case MON_DATA_53: + v1 = 1; + result = ((monDataBlockA->unk_1C & (v1 << monDataAttribute - MON_DATA_25)) != 0); + break; + case MON_DATA_MOVE1: + case MON_DATA_MOVE2: + case MON_DATA_MOVE3: + case MON_DATA_MOVE4: + result = monDataBlockB->unk_00[monDataAttribute - MON_DATA_MOVE1]; + break; + case MON_DATA_MOVE1_PP: + case MON_DATA_MOVE2_PP: + case MON_DATA_MOVE3_PP: + case MON_DATA_MOVE4_PP: + result = monDataBlockB->unk_08[monDataAttribute - MON_DATA_MOVE1_PP]; + break; + case MON_DATA_MOVE1_PP_UPS: + case MON_DATA_MOVE2_PP_UPS: + case MON_DATA_MOVE3_PP_UPS: + case MON_DATA_MOVE4_PP_UPS: + result = monDataBlockB->unk_0C[monDataAttribute - MON_DATA_MOVE1_PP_UPS]; + break; + case MON_DATA_MOVE1_MAX_PP: + case MON_DATA_MOVE2_MAX_PP: + case MON_DATA_MOVE3_MAX_PP: + case MON_DATA_MOVE4_MAX_PP: + result = MoveTable_CalcMaxPP(monDataBlockB->unk_00[monDataAttribute - MON_DATA_MOVE1_MAX_PP], monDataBlockB->unk_0C[monDataAttribute - MON_DATA_MOVE1_MAX_PP]); + break; + case MON_DATA_HP_IV: + result = monDataBlockB->hpIV; + break; + case MON_DATA_ATK_IV: + result = monDataBlockB->atkIV; + break; + case MON_DATA_DEF_IV: + result = monDataBlockB->defIV; + break; + case MON_DATA_SPEED_IV: + result = monDataBlockB->speedIV; + break; + case MON_DATA_SPATK_IV: + result = monDataBlockB->spAtkIV; + break; + case MON_DATA_SPDEF_IV: + result = monDataBlockB->spDefIV; + break; + case MON_DATA_IS_EGG: + if (boxMon->invalidData) { + result = boxMon->invalidData; + } else { + result = monDataBlockB->isEgg; + } + break; + case MON_DATA_77: + result = monDataBlockB->unk_10_31; + break; + case MON_DATA_78: + case MON_DATA_79: + case MON_DATA_80: + case MON_DATA_81: + case MON_DATA_82: + case MON_DATA_83: + case MON_DATA_84: + case MON_DATA_85: + case MON_DATA_86: + case MON_DATA_87: + case MON_DATA_88: + case MON_DATA_89: + case MON_DATA_90: + case MON_DATA_91: + case MON_DATA_92: + case MON_DATA_93: + case MON_DATA_94: + case MON_DATA_95: + case MON_DATA_96: + case MON_DATA_97: + case MON_DATA_CHAMPION_RIBBON: + case MON_DATA_WINNING_RIBBON: + case MON_DATA_VICTORY_RIBBON: + case MON_DATA_ARTIST_RIBBON: + case MON_DATA_EFFORT_RIBBON: + case MON_DATA_MARINE_RIBBON: + case MON_DATA_LAND_RIBBON: + case MON_DATA_SKY_RIBBON: + case MON_DATA_COUNTRY_RIBBON: + case MON_DATA_NATIONAL_RIBBON: + case MON_DATA_EARTH_RIBBON: + case MON_DATA_WORLD_RIBBON: + v1 = 1; + result = ((monDataBlockB->unk_14 & (v1 << monDataAttribute - MON_DATA_78)) != 0); + break; + case MON_DATA_FATEFUL_ENCOUNTER: + result = monDataBlockB->fatefulEncounter; + break; + case MON_DATA_GENDER: + result = GetMonPersonalityGender(monDataBlockA->species, boxMon->personality); + monDataBlockB->gender = result; + boxMon->checksum = GetMonDataChecksum(&boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4); + break; + case MON_DATA_FORM: + result = monDataBlockB->form; + break; + case MON_DATA_113: + result = monDataBlockB->unk_19; + break; + case MON_DATA_114: + result = monDataBlockB->unk_1A; + break; + case MON_DATA_117: + if (boxMon->invalidData) { + MessageLoader_GetSpeciesName(495, 0, dest); + } else { + { + u16 * v6 = dest; + + for (result = 0; result < 10; result++) { + v6[result] = monDataBlockC->unk_00[result]; + } + + v6[result] = 0xffff; + } + } + break; + case MON_DATA_120: + result = monDataBlockB->unk_10_31; + case MON_DATA_119: + if (boxMon->invalidData) { + Strbuf* strbuf = sub_0200B32C(495, 0); + + Strbuf_Copy((Strbuf *)dest, strbuf); + Strbuf_Free(strbuf); + } else { + Strbuf_CopyChars((Strbuf *)dest, monDataBlockC->unk_00); + } + break; + case MON_DATA_121: + result = monDataBlockC->unk_16; + break; + case MON_DATA_MET_GAME: + result = monDataBlockC->originGame; + break; + case MON_DATA_123: + case MON_DATA_124: + case MON_DATA_125: + case MON_DATA_126: + case MON_DATA_127: + case MON_DATA_128: + case MON_DATA_129: + case MON_DATA_130: + case MON_DATA_131: + case MON_DATA_132: + case MON_DATA_133: + case MON_DATA_134: + case MON_DATA_135: + case MON_DATA_136: + case MON_DATA_137: + case MON_DATA_138: + case MON_DATA_139: + case MON_DATA_140: + case MON_DATA_141: + case MON_DATA_142: + case MON_DATA_143: + v1 = 1; + result = ((monDataBlockC->unk_18 & (v1 << monDataAttribute - MON_DATA_123)) != 0); + break; + case MON_DATA_144: + { + u16 * v8 = dest; + + for (result = 0; result < 7; result++) { + v8[result] = monDataBlockD->unk_00[result]; + } + + v8[result] = 0xffff; + break; + } + case MON_DATA_145: + Strbuf_CopyChars((Strbuf *)dest, monDataBlockD->unk_00); + break; + case MON_DATA_146: + result = monDataBlockD->unk_10; + break; + case MON_DATA_147: + result = monDataBlockD->unk_11; + break; + case MON_DATA_148: + result = monDataBlockD->unk_12; + break; + case MON_DATA_149: + result = monDataBlockD->unk_13; + break; + case MON_DATA_150: + result = monDataBlockD->unk_14; + break; + case MON_DATA_151: + result = monDataBlockD->unk_15; + break; + case MON_DATA_152: + case MON_DATA_115: + if ((monDataBlockD->unk_16 == 3002) && (monDataBlockB->unk_1C)) { + result = monDataBlockB->unk_1C; + } else { + result = monDataBlockD->unk_16; + } + break; + case MON_DATA_153: + case MON_DATA_116: + if ((monDataBlockD->unk_18 == 3002) && (monDataBlockB->unk_1E)) { + result = monDataBlockB->unk_1E; + } else { + result = monDataBlockD->unk_18; + } + break; + case MON_DATA_POKERUS: + result = monDataBlockD->pokerus; + break; + case MON_DATA_POKEBALL: + result = monDataBlockD->pokeball; + break; + case MON_DATA_MET_LEVEL: + result = monDataBlockD->metLevel; + break; + case MON_DATA_OT_GENDER: + result = monDataBlockD->otGender; + break; + case MON_DATA_158: + result = monDataBlockD->unk_1D; + break; + case MON_DATA_159: + result = monDataBlockD->unk_1E; + break; + case MON_DATA_COMBINED_IVS: + result = (monDataBlockB->hpIV << 0) | (monDataBlockB->atkIV << 5) | (monDataBlockB->defIV << 10) | (monDataBlockB->speedIV << 15) | (monDataBlockB->spAtkIV << 20) | (monDataBlockB->spDefIV << 25); + break; + case MON_DATA_176: + if (((monDataBlockA->species == SPECIES_NIDORAN_F) || (monDataBlockA->species == SPECIES_NIDORAN_M)) && (monDataBlockB->unk_10_31 == 0)) { + result = 0; + } else { + result = 1; + } + break; + case MON_DATA_177: + case MON_DATA_178: + if ((monDataBlockA->species == SPECIES_ARCEUS) && (monDataBlockA->ability == 121)) { + result = GetArceusItemType(Item_LoadParam(monDataBlockA->heldItem, 1, 0)); + } else { + result = GetMonFormPersonalDataAttribute(monDataBlockA->species, monDataBlockB->form, 6 + (monDataAttribute - 177)); + } + break; + case MON_DATA_179: + MessageLoader_GetSpeciesName(monDataBlockA->species, 0, dest); + break; + } + + return result; +} + +void SetMonData (Pokemon * mon, int monDataAttribute, const void * value) +{ + u16 checksum; + + if (mon->box.partyDecrypted == 0) { + DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4); + + if (checksum != mon->box.checksum) { + GF_ASSERT((checksum == mon->box.checksum)); + mon->box.invalidData = 1; + EncryptMonData(mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + return; + } + } + + SetMonDataAttribute(mon, monDataAttribute, value); + + if (mon->box.partyDecrypted == 0) { + EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4); + EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + } +} + +static void SetMonDataAttribute (Pokemon * mon, int monDataAttribute, const void * value) +{ + u32 * u32Value = (u32 *)value; + u16 * u16Value = (u16 *)value; + u8 * u8Value = (u8 *)value; + + switch (monDataAttribute) { + case MON_DATA_160: + mon->party.unk_00 = u32Value[0]; + break; + case MON_DATA_LEVEL: + mon->party.level = u8Value[0]; + break; + case MON_DATA_162: + mon->party.unk_05 = u8Value[0]; + break; + case MON_DATA_CURRENT_HP: + mon->party.unk_06 = u16Value[0]; + break; + case MON_DATA_MAX_HP: + mon->party.unk_08 = u16Value[0]; + break; + case MON_DATA_ATK: + mon->party.unk_0A = u16Value[0]; + break; + case MON_DATA_DEF: + mon->party.unk_0C = u16Value[0]; + break; + case MON_DATA_SPEED: + mon->party.unk_0E = u16Value[0]; + break; + case MON_DATA_SP_ATK: + mon->party.unk_10 = u16Value[0]; + break; + case MON_DATA_SP_DEF: + mon->party.unk_12 = u16Value[0]; + break; + case MON_DATA_170: + sub_020281A0((UnkStruct_0202818C *)value, &mon->party.unk_14); + break; + case MON_DATA_171: + sub_0202CA10((UnkStruct_0202CA28 *)value, &mon->party.unk_4C); + break; + default: + SetBoxMonDataAttribute((BoxPokemon *)&mon->box, monDataAttribute, value); + break; + } +} + +void SetBoxMonData (BoxPokemon * boxMon, int monDataAttribute, const void * value) +{ + u16 checksum; + + if (boxMon->boxDecrypted == 0) { + DecryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4, boxMon->checksum); + checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4); + + if (checksum != boxMon->checksum) { + GF_ASSERT((checksum == boxMon->checksum)); + boxMon->invalidData = 1; + EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4, boxMon->checksum); + return; + } + } + + SetBoxMonDataAttribute(boxMon, monDataAttribute, value); + + if (boxMon->boxDecrypted == 0) { + boxMon->checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4); + EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4, boxMon->checksum); + } +} + +static void SetBoxMonDataAttribute (BoxPokemon * boxMon, int monDataAttribute, const void * value) +{ + int i; + u64 v1; + u16 v2; + u32 * u32Value = (u32 *)value; + u16 * u16Value = (u16 *)value; + u8 * u8Value = (u8 *)value; + PokemonDataBlockA * monDataBlockA; + PokemonDataBlockB * monDataBlockB; + PokemonDataBlockC * monDataBlockC; + PokemonDataBlockD * monDataBlockD; + + monDataBlockA = (PokemonDataBlockA *)GetBoxMonDataBlock(boxMon, boxMon->personality, 0); + monDataBlockB = (PokemonDataBlockB *)GetBoxMonDataBlock(boxMon, boxMon->personality, 1); + monDataBlockC = (PokemonDataBlockC *)GetBoxMonDataBlock(boxMon, boxMon->personality, 2); + monDataBlockD = (PokemonDataBlockD *)GetBoxMonDataBlock(boxMon, boxMon->personality, 3); + + switch (monDataAttribute) { + case MON_DATA_PERSONALITY: + boxMon->personality = u32Value[0]; + break; + case MON_DATA_1: + GF_ASSERT(0); + boxMon->partyDecrypted = u8Value[0]; + break; + case MON_DATA_2: + GF_ASSERT(0); + boxMon->boxDecrypted = u8Value[0]; + break; + case MON_DATA_3: + boxMon->invalidData = u8Value[0]; + break; + case MON_DATA_4: + boxMon->checksum = u16Value[0]; + break; + case MON_DATA_SPECIES: + monDataBlockA->species = u16Value[0]; + break; + case MON_DATA_HELD_ITEM: + monDataBlockA->heldItem = u16Value[0]; + break; + case MON_DATA_OT_ID: + monDataBlockA->otID = u32Value[0]; + break; + case MON_DATA_EXP: + monDataBlockA->exp = u32Value[0]; + break; + case MON_DATA_FRIENDSHIP: + monDataBlockA->friendship = u8Value[0]; + break; + case MON_DATA_ABILITY: + monDataBlockA->ability = u8Value[0]; + break; + case MON_DATA_11: + monDataBlockA->unk_0E = u8Value[0]; + break; + case MON_DATA_LANGUAGE: + monDataBlockA->originLanguage = u8Value[0]; + break; + case MON_DATA_HP_EV: + monDataBlockA->hpEV = u8Value[0]; + break; + case MON_DATA_ATK_EV: + monDataBlockA->atkEV = u8Value[0]; + break; + case MON_DATA_DEF_EV: + monDataBlockA->defEV = u8Value[0]; + break; + case MON_DATA_SPEED_EV: + monDataBlockA->speedEV = u8Value[0]; + break; + case MON_DATA_SPATK_EV: + monDataBlockA->spAtkEV = u8Value[0]; + break; + case MON_DATA_SPDEF_EV: + monDataBlockA->spDefEV = u8Value[0]; + break; + case MON_DATA_COOL: + monDataBlockA->cool = u8Value[0]; + break; + case MON_DATA_BEAUTY: + monDataBlockA->beauty = u8Value[0]; + break; + case MON_DATA_CUTE: + monDataBlockA->cute = u8Value[0]; + break; + case MON_DATA_SMART: + monDataBlockA->smart = u8Value[0]; + break; + case MON_DATA_TOUGH: + monDataBlockA->tough = u8Value[0]; + break; + case MON_DATA_SHEEN: + monDataBlockA->sheen = u8Value[0]; + break; + case MON_DATA_25: + case MON_DATA_26: + case MON_DATA_27: + case MON_DATA_28: + case MON_DATA_29: + case MON_DATA_30: + case MON_DATA_31: + case MON_DATA_32: + case MON_DATA_33: + case MON_DATA_34: + case MON_DATA_35: + case MON_DATA_36: + case MON_DATA_37: + case MON_DATA_38: + case MON_DATA_39: + case MON_DATA_40: + case MON_DATA_41: + case MON_DATA_42: + case MON_DATA_43: + case MON_DATA_44: + case MON_DATA_45: + case MON_DATA_46: + case MON_DATA_47: + case MON_DATA_48: + case MON_DATA_49: + case MON_DATA_50: + case MON_DATA_51: + case MON_DATA_52: + case MON_DATA_53: + v1 = 1 << (monDataAttribute - MON_DATA_25); + + if (u8Value[0]) { + monDataBlockA->unk_1C |= v1; + } else { + monDataBlockA->unk_1C &= (v1 ^ 0xffffffff); + } + break; + case MON_DATA_MOVE1: + case MON_DATA_MOVE2: + case MON_DATA_MOVE3: + case MON_DATA_MOVE4: + monDataBlockB->unk_00[monDataAttribute - MON_DATA_MOVE1] = u16Value[0]; + break; + case MON_DATA_MOVE1_PP: + case MON_DATA_MOVE2_PP: + case MON_DATA_MOVE3_PP: + case MON_DATA_MOVE4_PP: + monDataBlockB->unk_08[monDataAttribute - MON_DATA_MOVE1_PP] = u8Value[0]; + break; + case MON_DATA_MOVE1_PP_UPS: + case MON_DATA_MOVE2_PP_UPS: + case MON_DATA_MOVE3_PP_UPS: + case MON_DATA_MOVE4_PP_UPS: + monDataBlockB->unk_0C[monDataAttribute - MON_DATA_MOVE1_PP_UPS] = u8Value[0]; + break; + case MON_DATA_MOVE1_MAX_PP: + case MON_DATA_MOVE2_MAX_PP: + case MON_DATA_MOVE3_MAX_PP: + case MON_DATA_MOVE4_MAX_PP: + break; + case MON_DATA_HP_IV: + monDataBlockB->hpIV = u8Value[0]; + break; + case MON_DATA_ATK_IV: + monDataBlockB->atkIV = u8Value[0]; + break; + case MON_DATA_DEF_IV: + monDataBlockB->defIV = u8Value[0]; + break; + case MON_DATA_SPEED_IV: + monDataBlockB->speedIV = u8Value[0]; + break; + case MON_DATA_SPATK_IV: + monDataBlockB->spAtkIV = u8Value[0]; + break; + case MON_DATA_SPDEF_IV: + monDataBlockB->spDefIV = u8Value[0]; + break; + case MON_DATA_IS_EGG: + monDataBlockB->isEgg = u8Value[0]; + break; + case MON_DATA_77: + monDataBlockB->unk_10_31 = u8Value[0]; + break; + case MON_DATA_78: + case MON_DATA_79: + case MON_DATA_80: + case MON_DATA_81: + case MON_DATA_82: + case MON_DATA_83: + case MON_DATA_84: + case MON_DATA_85: + case MON_DATA_86: + case MON_DATA_87: + case MON_DATA_88: + case MON_DATA_89: + case MON_DATA_90: + case MON_DATA_91: + case MON_DATA_92: + case MON_DATA_93: + case MON_DATA_94: + case MON_DATA_95: + case MON_DATA_96: + case MON_DATA_97: + case MON_DATA_CHAMPION_RIBBON: + case MON_DATA_WINNING_RIBBON: + case MON_DATA_VICTORY_RIBBON: + case MON_DATA_ARTIST_RIBBON: + case MON_DATA_EFFORT_RIBBON: + case MON_DATA_MARINE_RIBBON: + case MON_DATA_LAND_RIBBON: + case MON_DATA_SKY_RIBBON: + case MON_DATA_COUNTRY_RIBBON: + case MON_DATA_NATIONAL_RIBBON: + case MON_DATA_EARTH_RIBBON: + case MON_DATA_WORLD_RIBBON: + v1 = 1 << (monDataAttribute - MON_DATA_78); + + if (u8Value[0]) { + monDataBlockB->unk_14 |= v1; + } else { + monDataBlockB->unk_14 &= (v1 ^ 0xffffffff); + } + break; + case MON_DATA_FATEFUL_ENCOUNTER: + monDataBlockB->fatefulEncounter = u8Value[0]; + break; + case MON_DATA_GENDER: + monDataBlockB->gender = GetMonPersonalityGender(monDataBlockA->species, boxMon->personality); + break; + case MON_DATA_FORM: + monDataBlockB->form = u8Value[0]; + break; + case MON_DATA_113: + monDataBlockB->unk_19 = u8Value[0]; + break; + case MON_DATA_114: + monDataBlockB->unk_1A = u16Value[0]; + break; + case MON_DATA_118: + { + u16 v10[10 + 1]; + + MessageLoader_GetSpeciesName(monDataBlockA->species, 0, &v10[0]); + monDataBlockB->unk_10_31 = sub_0200220C(v10, &u16Value[0]); + } + case MON_DATA_117: + for (i = 0; i < NELEMS(monDataBlockC->unk_00); i++) { + monDataBlockC->unk_00[i] = u16Value[i]; + } + break; + case MON_DATA_120: + { + u16 v11[10 + 1]; + u16 v12[10 + 1]; + + MessageLoader_GetSpeciesName(monDataBlockA->species, 0, &v11[0]); + Strbuf_ToChars((Strbuf *)value, &v12[0], NELEMS(v12)); + + monDataBlockB->unk_10_31 = sub_0200220C(v11, v12); + } + case MON_DATA_119: + Strbuf_ToChars((Strbuf *)value, monDataBlockC->unk_00, NELEMS(monDataBlockC->unk_00)); + break; + case MON_DATA_121: + monDataBlockC->unk_16 = u8Value[0]; + break; + case MON_DATA_MET_GAME: + monDataBlockC->originGame = u8Value[0]; + break; + case MON_DATA_123: + case MON_DATA_124: + case MON_DATA_125: + case MON_DATA_126: + case MON_DATA_127: + case MON_DATA_128: + case MON_DATA_129: + case MON_DATA_130: + case MON_DATA_131: + case MON_DATA_132: + case MON_DATA_133: + case MON_DATA_134: + case MON_DATA_135: + case MON_DATA_136: + case MON_DATA_137: + case MON_DATA_138: + case MON_DATA_139: + case MON_DATA_140: + case MON_DATA_141: + case MON_DATA_142: + case MON_DATA_143: + v1 = 1 << (monDataAttribute - MON_DATA_123); + + if (u8Value[0]) { + monDataBlockC->unk_18 |= v1; + } else { + monDataBlockC->unk_18 &= (v1 ^ 0xffffffffffffffff); + } + break; + case MON_DATA_144: + for (i = 0; i < NELEMS(monDataBlockD->unk_00); i++) { + monDataBlockD->unk_00[i] = u16Value[i]; + } + break; + case MON_DATA_145: + Strbuf_ToChars((Strbuf *)value, monDataBlockD->unk_00, NELEMS(monDataBlockD->unk_00)); + break; + case MON_DATA_146: + monDataBlockD->unk_10 = u8Value[0]; + break; + case MON_DATA_147: + monDataBlockD->unk_11 = u8Value[0]; + break; + case MON_DATA_148: + monDataBlockD->unk_12 = u8Value[0]; + break; + case MON_DATA_149: + monDataBlockD->unk_13 = u8Value[0]; + break; + case MON_DATA_150: + monDataBlockD->unk_14 = u8Value[0]; + break; + case MON_DATA_151: + monDataBlockD->unk_15 = u8Value[0]; + break; + case MON_DATA_152: + case MON_DATA_115: + if ((u16Value[0] == 0) || (sub_0201708C(u16Value[0]) == 1)) { + monDataBlockD->unk_16 = u16Value[0]; + monDataBlockB->unk_1C = u16Value[0]; + } else { + monDataBlockD->unk_16 = 3002; + monDataBlockB->unk_1C = u16Value[0]; + } + break; + case MON_DATA_153: + case MON_DATA_116: + if ((u16Value[0] == 0) || (sub_0201708C(u16Value[0]) == 1)) { + monDataBlockD->unk_18 = u16Value[0]; + monDataBlockB->unk_1E = u16Value[0]; + } else { + monDataBlockD->unk_18 = 3002; + monDataBlockB->unk_1E = u16Value[0]; + } + break; + case MON_DATA_POKERUS: + monDataBlockD->pokerus = u8Value[0]; + break; + case MON_DATA_POKEBALL: + monDataBlockD->pokeball = u8Value[0]; + break; + case MON_DATA_MET_LEVEL: + monDataBlockD->metLevel = u8Value[0]; + break; + case MON_DATA_OT_GENDER: + monDataBlockD->otGender = u8Value[0]; + break; + case MON_DATA_158: + monDataBlockD->unk_1D = u8Value[0]; + break; + case MON_DATA_159: + monDataBlockD->unk_1E = u16Value[0]; + break; + case MON_DATA_COMBINED_IVS: + monDataBlockB->hpIV = (u32Value[0] >> 0) & 0x1f; + monDataBlockB->atkIV = (u32Value[0] >> 5) & 0x1f; + monDataBlockB->defIV = (u32Value[0] >> 10) & 0x1f; + monDataBlockB->speedIV = (u32Value[0] >> 15) & 0x1f; + monDataBlockB->spAtkIV = (u32Value[0] >> 20) & 0x1f; + monDataBlockB->spDefIV = (u32Value[0] >> 25) & 0x1f; + break; + case MON_DATA_176: + case MON_DATA_177: + case MON_DATA_178: + break; + case MON_DATA_179: + { + Strbuf* strbuf; + + strbuf = sub_0200B32C(monDataBlockA->species, 0); + + Strbuf_ToChars(strbuf, monDataBlockC->unk_00, NELEMS(monDataBlockC->unk_00)); + Strbuf_Free(strbuf); + } + break; + } +} + +void IncreaseMonData (Pokemon * mon, int monDataAttribute, int value) +{ + u16 checksum; + + if (mon->box.partyDecrypted == 0) { + DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + + checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4); + + if (checksum != mon->box.checksum) { + GF_ASSERT((checksum == mon->box.checksum)); + EncryptMonData(mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + return; + } + } + + IncreaseMonDataAttribute(mon, monDataAttribute, value); + + if (mon->box.partyDecrypted == 0) { + EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4); + EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + } +} + +static void IncreaseMonDataAttribute (Pokemon * mon, int monDataAttribute, int value) +{ + switch (monDataAttribute) { + case MON_DATA_CURRENT_HP: + if ((mon->party.unk_06 + value) > mon->party.unk_08) { + mon->party.unk_06 = mon->party.unk_08; + } else { + mon->party.unk_06 += value; + } + break; + case MON_DATA_160: + case MON_DATA_LEVEL: + case MON_DATA_162: + case MON_DATA_MAX_HP: + case MON_DATA_ATK: + case MON_DATA_DEF: + case MON_DATA_SPEED: + case MON_DATA_SP_ATK: + case MON_DATA_SP_DEF: + case MON_DATA_170: + GF_ASSERT(0); + break; + default: + IncreaseBoxMonDataAttribute((BoxPokemon *)&mon->box, monDataAttribute, value); + break; + } +} + +static void IncreaseBoxMonDataAttribute (BoxPokemon * boxMon, int monDataAttribute, int value) +{ + int unused_0; + u16 unused_1; + PokemonDataBlockA * monDataBlockA; + PokemonDataBlockB * monDataBlockB; + PokemonDataBlockC * monDataBlockC; + PokemonDataBlockD * monDataBlockD; + + monDataBlockA = (PokemonDataBlockA *)GetBoxMonDataBlock(boxMon, boxMon->personality, 0); + monDataBlockB = (PokemonDataBlockB *)GetBoxMonDataBlock(boxMon, boxMon->personality, 1); + monDataBlockC = (PokemonDataBlockC *)GetBoxMonDataBlock(boxMon, boxMon->personality, 2); + monDataBlockD = (PokemonDataBlockD *)GetBoxMonDataBlock(boxMon, boxMon->personality, 3); + + switch (monDataAttribute) { + case MON_DATA_EXP: + if ((monDataBlockA->exp + value) > GetMonSpeciesLevelExp(monDataBlockA->species, 100)) { + monDataBlockA->exp = GetMonSpeciesLevelExp(monDataBlockA->species, 100); + } else { + monDataBlockA->exp += value; + } + break; + case MON_DATA_FRIENDSHIP: + { + int newValue; + + newValue = monDataBlockA->friendship; + + if ((newValue + value) > 255) { + newValue = 255; + } + + if ((newValue + value) < 0) { + newValue = 0; + } else { + newValue += value; + } + + monDataBlockA->friendship = newValue; + } + break; + case MON_DATA_HP_EV: + monDataBlockA->hpEV += value; + break; + case MON_DATA_ATK_EV: + monDataBlockA->atkEV += value; + break; + case MON_DATA_DEF_EV: + monDataBlockA->defEV += value; + break; + case MON_DATA_SPEED_EV: + monDataBlockA->speedEV += value; + break; + case MON_DATA_SPATK_EV: + monDataBlockA->spAtkEV += value; + break; + case MON_DATA_SPDEF_EV: + monDataBlockA->spDefEV += value; + break; + case MON_DATA_COOL: + if ((monDataBlockA->cool + value) > 255) { + monDataBlockA->cool = 255; + } else { + monDataBlockA->cool += value; + } + break; + case MON_DATA_BEAUTY: + if ((monDataBlockA->beauty + value) > 255) { + monDataBlockA->beauty = 255; + } else { + monDataBlockA->beauty += value; + } + break; + case MON_DATA_CUTE: + if ((monDataBlockA->cute + value) > 255) { + monDataBlockA->cute = 255; + } else { + monDataBlockA->cute += value; + } + break; + case MON_DATA_SMART: + if ((monDataBlockA->smart + value) > 255) { + monDataBlockA->smart = 255; + } else { + monDataBlockA->smart += value; + } + break; + case MON_DATA_TOUGH: + if ((monDataBlockA->tough + value) > 255) { + monDataBlockA->tough = 255; + } else { + monDataBlockA->tough += value; + } + break; + case MON_DATA_SHEEN: + if ((monDataBlockA->sheen + value) > 255) { + monDataBlockA->sheen = 255; + } else { + monDataBlockA->sheen += value; + } + break; + case MON_DATA_MOVE1_PP: + case MON_DATA_MOVE2_PP: + case MON_DATA_MOVE3_PP: + case MON_DATA_MOVE4_PP: + if ((monDataBlockB->unk_08[monDataAttribute - MON_DATA_MOVE1_PP] + value) > MoveTable_CalcMaxPP(monDataBlockB->unk_00[monDataAttribute - MON_DATA_MOVE1_PP], monDataBlockB->unk_0C[monDataAttribute - MON_DATA_MOVE1_PP])) { + monDataBlockB->unk_08[monDataAttribute - MON_DATA_MOVE1_PP] = MoveTable_CalcMaxPP(monDataBlockB->unk_00[monDataAttribute - MON_DATA_MOVE1_PP], monDataBlockB->unk_0C[monDataAttribute - MON_DATA_MOVE1_PP]); + } else { + monDataBlockB->unk_08[monDataAttribute - MON_DATA_MOVE1_PP] += value; + } + break; + case MON_DATA_MOVE1_PP_UPS: + case MON_DATA_MOVE2_PP_UPS: + case MON_DATA_MOVE3_PP_UPS: + case MON_DATA_MOVE4_PP_UPS: + if ((monDataBlockB->unk_0C[monDataAttribute - MON_DATA_MOVE1_PP_UPS] + value) > 3) { + monDataBlockB->unk_0C[monDataAttribute - MON_DATA_MOVE1_PP_UPS] = 3; + } else { + monDataBlockB->unk_0C[monDataAttribute - MON_DATA_MOVE1_PP_UPS] += value; + } + break; + case MON_DATA_MOVE1_MAX_PP: + case MON_DATA_MOVE2_MAX_PP: + case MON_DATA_MOVE3_MAX_PP: + case MON_DATA_MOVE4_MAX_PP: + break; + case MON_DATA_HP_IV: + if ((monDataBlockB->hpIV + value) > 31) { + monDataBlockB->hpIV = 31; + } else { + monDataBlockB->hpIV += value; + } + break; + case MON_DATA_ATK_IV: + if ((monDataBlockB->atkIV + value) > 31) { + monDataBlockB->atkIV = 31; + } else { + monDataBlockB->atkIV += value; + } + break; + case MON_DATA_DEF_IV: + if ((monDataBlockB->defIV + value) > 31) { + monDataBlockB->defIV = 31; + } else { + monDataBlockB->defIV += value; + } + break; + case MON_DATA_SPEED_IV: + if ((monDataBlockB->speedIV + value) > 31) { + monDataBlockB->speedIV = 31; + } else { + monDataBlockB->speedIV += value; + } + break; + case MON_DATA_SPATK_IV: + if ((monDataBlockB->spAtkIV + value) > 31) { + monDataBlockB->spAtkIV = 31; + } else { + monDataBlockB->spAtkIV += value; + } + break; + case MON_DATA_SPDEF_IV: + if ((monDataBlockB->spDefIV + value) > 31) { + monDataBlockB->spDefIV = 31; + } else { + monDataBlockB->spDefIV += value; + } + break; + case MON_DATA_PERSONALITY: + case MON_DATA_1: + case MON_DATA_2: + case MON_DATA_4: + case MON_DATA_SPECIES: + case MON_DATA_HELD_ITEM: + case MON_DATA_OT_ID: + case MON_DATA_ABILITY: + case MON_DATA_11: + case MON_DATA_LANGUAGE: + case MON_DATA_25: + case MON_DATA_26: + case MON_DATA_27: + case MON_DATA_28: + case MON_DATA_29: + case MON_DATA_30: + case MON_DATA_31: + case MON_DATA_32: + case MON_DATA_33: + case MON_DATA_34: + case MON_DATA_35: + case MON_DATA_36: + case MON_DATA_37: + case MON_DATA_38: + case MON_DATA_39: + case MON_DATA_40: + case MON_DATA_41: + case MON_DATA_42: + case MON_DATA_43: + case MON_DATA_44: + case MON_DATA_45: + case MON_DATA_46: + case MON_DATA_47: + case MON_DATA_48: + case MON_DATA_49: + case MON_DATA_50: + case MON_DATA_51: + case MON_DATA_52: + case MON_DATA_53: + case MON_DATA_MOVE1: + case MON_DATA_MOVE2: + case MON_DATA_MOVE3: + case MON_DATA_MOVE4: + case MON_DATA_IS_EGG: + case MON_DATA_77: + case MON_DATA_78: + case MON_DATA_79: + case MON_DATA_80: + case MON_DATA_81: + case MON_DATA_82: + case MON_DATA_83: + case MON_DATA_84: + case MON_DATA_85: + case MON_DATA_86: + case MON_DATA_87: + case MON_DATA_88: + case MON_DATA_89: + case MON_DATA_90: + case MON_DATA_91: + case MON_DATA_92: + case MON_DATA_93: + case MON_DATA_94: + case MON_DATA_95: + case MON_DATA_96: + case MON_DATA_97: + case MON_DATA_CHAMPION_RIBBON: + case MON_DATA_WINNING_RIBBON: + case MON_DATA_VICTORY_RIBBON: + case MON_DATA_ARTIST_RIBBON: + case MON_DATA_EFFORT_RIBBON: + case MON_DATA_MARINE_RIBBON: + case MON_DATA_LAND_RIBBON: + case MON_DATA_SKY_RIBBON: + case MON_DATA_COUNTRY_RIBBON: + case MON_DATA_NATIONAL_RIBBON: + case MON_DATA_EARTH_RIBBON: + case MON_DATA_WORLD_RIBBON: + case MON_DATA_FATEFUL_ENCOUNTER: + case MON_DATA_GENDER: + case MON_DATA_FORM: + case MON_DATA_113: + case MON_DATA_114: + case MON_DATA_117: + case MON_DATA_119: + case MON_DATA_120: + case MON_DATA_121: + case MON_DATA_MET_GAME: + case MON_DATA_123: + case MON_DATA_124: + case MON_DATA_125: + case MON_DATA_126: + case MON_DATA_127: + case MON_DATA_128: + case MON_DATA_129: + case MON_DATA_130: + case MON_DATA_131: + case MON_DATA_132: + case MON_DATA_133: + case MON_DATA_134: + case MON_DATA_135: + case MON_DATA_136: + case MON_DATA_137: + case MON_DATA_138: + case MON_DATA_139: + case MON_DATA_140: + case MON_DATA_141: + case MON_DATA_142: + case MON_DATA_143: + case MON_DATA_144: + case MON_DATA_145: + case MON_DATA_146: + case MON_DATA_147: + case MON_DATA_148: + case MON_DATA_149: + case MON_DATA_150: + case MON_DATA_151: + case MON_DATA_152: + case MON_DATA_153: + case MON_DATA_POKERUS: + case MON_DATA_POKEBALL: + case MON_DATA_MET_LEVEL: + case MON_DATA_OT_GENDER: + case MON_DATA_158: + case MON_DATA_159: + case MON_DATA_COMBINED_IVS: + case MON_DATA_176: + case MON_DATA_177: + case MON_DATA_178: + case MON_DATA_179: + default: + GF_ASSERT(0); + break; + } +} + +PokemonPersonalData * GetMonFormPersonalData (int monSpecies, int monForm, int heapID) +{ + PokemonPersonalData * monPersonalData; + + monPersonalData = Heap_AllocFromHeap(heapID, sizeof(PokemonPersonalData)); + LoadMonFormPersonalData(monSpecies, monForm, monPersonalData); + + return monPersonalData; +} + +PokemonPersonalData * GetMonPersonalData (int monSpecies, int heapID) +{ + PokemonPersonalData * monPersonalData; + + monPersonalData = Heap_AllocFromHeap(heapID, sizeof(PokemonPersonalData)); + LoadMonPersonalData(monSpecies, monPersonalData); + + return monPersonalData; +} + +u32 GetMonPersonalDataAttribute (PokemonPersonalData * monPersonalData, int monPersonalDataAttribute) +{ + u32 result; + + GF_ASSERT(monPersonalData); + + switch (monPersonalDataAttribute) { + case MON_DATA_PERSONAL_BASE_HP: + result = monPersonalData->baseHp; + break; + case MON_DATA_PERSONAL_BASE_ATK: + result = monPersonalData->baseAtk; + break; + case MON_DATA_PERSONAL_BASE_DEF: + result = monPersonalData->baseDef; + break; + case MON_DATA_PERSONAL_BASE_SPEED: + result = monPersonalData->baseSpeed; + break; + case MON_DATA_PERSONAL_BASE_SP_ATK: + result = monPersonalData->baseSpAtk; + break; + case MON_DATA_PERSONAL_BASE_SP_DEF: + result = monPersonalData->baseSpDef; + break; + case MON_DATA_PERSONAL_TYPE_1: + result = monPersonalData->type1; + break; + case MON_DATA_PERSONAL_TYPE_2: + result = monPersonalData->type2; + break; + case MON_DATA_PERSONAL_CATCH_RATE: + result = monPersonalData->catchRate; + break; + case MON_DATA_PERSONAL_BASE_EXP: + result = monPersonalData->baseExp; + break; + case MON_DATA_PERSONAL_EV_HP_YIELD: + result = monPersonalData->evHpYield; + break; + case MON_DATA_PERSONAL_EV_ATK_YIELD: + result = monPersonalData->evAtkYield; + break; + case MON_DATA_PERSONAL_EV_DEF_YIELD: + result = monPersonalData->evDefYield; + break; + case MON_DATA_PERSONAL_EV_SPEED_YIELD: + result = monPersonalData->evSpeedYield; + break; + case MON_DATA_PERSONAL_EV_SP_ATK_YIELD: + result = monPersonalData->evSpAtkYield; + break; + case MON_DATA_PERSONAL_EV_SP_DEF_YIELD: + result = monPersonalData->evSpDefYield; + break; + case MON_DATA_PERSONAL_ITEM1: + result = monPersonalData->item1; + break; + case MON_DATA_PERSONAL_ITEM2: + result = monPersonalData->item2; + break; + case MON_DATA_PERSONAL_GENDER: + result = monPersonalData->gender; + break; + case MON_DATA_PERSONAL_HATCH_CYCLE: + result = monPersonalData->hatchCycles; + break; + case MON_DATA_PERSONAL_BASE_FRIENDSHIP: + result = monPersonalData->baseFriendship; + break; + case MON_DATA_PERSONAL_EXP_RATE: + result = monPersonalData->expRate; + break; + case MON_DATA_PERSONAL_EGG_GROUP_1: + result = monPersonalData->eggGroup1; + break; + case MON_DATA_PERSONAL_EGG_GROUP_2: + result = monPersonalData->eggGroup2; + break; + case MON_DATA_PERSONAL_ABILITY_1: + result = monPersonalData->ability1; + break; + case MON_DATA_PERSONAL_ABILITY_2: + result = monPersonalData->ability2; + break; + case MON_DATA_PERSONAL_GREAT_MARSH_FLEE_RATE: + result = monPersonalData->greatMarshFleeRate; + break; + case MON_DATA_PERSONAL_COLOR: + result = monPersonalData->color; + break; + case MON_DATA_PERSONAL_INVERSE: + result = monPersonalData->inverse; + break; + case MON_DATA_PERSONAL_UNK_1C: + result = monPersonalData->unk_1C; + break; + case MON_DATA_PERSONAL_UNK_20: + result = monPersonalData->unk_20; + break; + case MON_DATA_PERSONAL_UNK_24: + result = monPersonalData->unk_24; + break; + case MON_DATA_PERSONAL_UNK_28: + result = monPersonalData->unk_28; + break; + } + + return result; +} + +void FreeMonPersonalData (PokemonPersonalData * monPersonalData) +{ + GF_ASSERT(monPersonalData); + Heap_FreeToHeap(monPersonalData); +} + +u32 GetMonFormPersonalDataAttribute (int monSpecies, int monForm, int monPersonalDataAttribute) +{ + u32 result; + PokemonPersonalData * monPersonalData; + + monSpecies = GetMonFormNarcIndex(monSpecies, monForm); + + monPersonalData = GetMonPersonalData(monSpecies, 0); + result = GetMonPersonalDataAttribute(monPersonalData, monPersonalDataAttribute); + + FreeMonPersonalData(monPersonalData); + + return result; +} + +u32 GetMonSpeciesPersonalDataAttribute (int monSpecies, int monPersonalDataAttribute) +{ + u32 result; + PokemonPersonalData * monPersonalData; + + monPersonalData = GetMonPersonalData(monSpecies, 0); + result = GetMonPersonalDataAttribute(monPersonalData, monPersonalDataAttribute); + + FreeMonPersonalData(monPersonalData); + + return result; +} + +u8 GetMonPercentToNextLevel (Pokemon * mon) +{ + u16 monSpecies; + u8 monLevel; + u32 monCurrentLevelExp; + u32 monExp; + u32 monNextLevelExp; + u8 monPercentToNextLevel; + BOOL recrypt; + + recrypt = DecryptMon(mon); + monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); + monCurrentLevelExp = GetMonSpeciesLevelExp(monSpecies, monLevel); + monNextLevelExp = GetMonSpeciesLevelExp(monSpecies, monLevel + 1); + monExp = GetMonData(mon, MON_DATA_EXP, NULL); + + EncryptMon(mon, recrypt); + monPercentToNextLevel = ((monExp - monCurrentLevelExp) * 100) / (monNextLevelExp - monCurrentLevelExp); + + return monPercentToNextLevel; +} + +u32 GetMonExpToNextLevel (Pokemon * mon) +{ + return GetBoxMonExpToNextLevel(&mon->box); +} + +u32 GetBoxMonExpToNextLevel (BoxPokemon * boxMon) +{ + u16 monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); + u16 monNextlevel = GetBoxMonLevel(boxMon) + 1; + u32 monExp = GetBoxMonData(boxMon, MON_DATA_EXP, NULL); + + return GetMonSpeciesLevelExp(monSpecies, monNextlevel) - monExp; +} + +u32 GetMonCurrentLevelExp (Pokemon * mon) +{ + return GetMonSpeciesLevelExp(GetMonData(mon, MON_DATA_SPECIES, NULL), GetMonData(mon, MON_DATA_LEVEL, NULL)); +} + +u32 GetMonSpeciesLevelExp (int monSpecies, int monLevel) +{ + return GetMonExpRateLevelExp(GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_EXP_RATE), monLevel); +} + +void LoadMonExperienceTable (int monExpRate, u32 * monExpTable) +{ + GF_ASSERT(monExpRate < 8); + NARC_ReadWholeMemberByIndexPair(monExpTable, NARC_INDEX_POKETOOL__PERSONAL__PL_GROWTBL, monExpRate); +} + +u32 GetMonExpRateLevelExp (int monExpRate, int monLevel) +{ + u32 result; + u32 * expTable; + + GF_ASSERT(monExpRate < 8); + GF_ASSERT(monLevel <= 101); + + expTable = Heap_AllocFromHeap(0, 101 * 4); + LoadMonExperienceTable(monExpRate, expTable); + + result = expTable[monLevel]; + Heap_FreeToHeap(expTable); + + return result; +} + +u32 GetMonLevel (Pokemon * mon) +{ + return GetBoxMonLevel(&mon->box); +} + +u32 GetBoxMonLevel (BoxPokemon * boxMon) +{ + int monSpecies; + u32 monExp; + BOOL reencrypt; + + reencrypt = DecryptBoxMon(boxMon); + monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, 0); + monExp = GetBoxMonData(boxMon, MON_DATA_EXP, 0); + + EncryptBoxMon(boxMon, reencrypt); + + return GetMonSpeciesLevel(monSpecies, monExp); +} + +u32 GetMonSpeciesLevel (u16 monSpecies, u32 monExp) +{ + int unused_0; + u32 monLevel; + u32 * unused_1; + PokemonPersonalData * monPersonalData = GetMonPersonalData(monSpecies, 0); + + monLevel = GetMonPersonalDataLevel(monPersonalData, monSpecies, monExp); + FreeMonPersonalData(monPersonalData); + + return monLevel; +} + +u32 GetMonPersonalDataLevel (PokemonPersonalData * monPersonalData, u16 unused_monSpecies, u32 monExp) +{ + static u32 monExpTable[101]; + int monExpRate, i; + + monExpRate = GetMonPersonalDataAttribute(monPersonalData, MON_DATA_PERSONAL_EXP_RATE); + LoadMonExperienceTable(monExpRate, monExpTable); + + for (i = 1; i < 101; i++) { + if (monExpTable[i] > monExp) { + break; + } + } + + return i - 1; +} + +u8 GetMonNature (Pokemon * mon) +{ + return GetBoxMonNature(&mon->box); +} + +u8 GetBoxMonNature (BoxPokemon * boxMon) +{ + BOOL reencrypt; + u32 monPersonality; + + reencrypt = DecryptBoxMon(boxMon); + monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, 0); + + EncryptBoxMon(boxMon, reencrypt); + + return GetNatureFromPersonality(monPersonality); +} + +u8 GetNatureFromPersonality (u32 monPersonality) +{ + return (u8)(monPersonality % 25); +} + +static const s8 sNatureStatAffinities[][5] = { + {0x0, 0x0, 0x0, 0x0, 0x0}, + {0x1, -1, 0x0, 0x0, 0x0}, + {0x1, 0x0, -1, 0x0, 0x0}, + {0x1, 0x0, 0x0, -1, 0x0}, + {0x1, 0x0, 0x0, 0x0, -1}, + {-1, 0x1, 0x0, 0x0, 0x0}, + {0x0, 0x0, 0x0, 0x0, 0x0}, + {0x0, 0x1, -1, 0x0, 0x0}, + {0x0, 0x1, 0x0, -1, 0x0}, + {0x0, 0x1, 0x0, 0x0, -1}, + {-1, 0x0, 0x1, 0x0, 0x0}, + {0x0, -1, 0x1, 0x0, 0x0}, + {0x0, 0x0, 0x0, 0x0, 0x0}, + {0x0, 0x0, 0x1, -1, 0x0}, + {0x0, 0x0, 0x1, 0x0, -1}, + {-1, 0x0, 0x0, 0x1, 0x0}, + {0x0, -1, 0x0, 0x1, 0x0}, + {0x0, 0x0, -1, 0x1, 0x0}, + {0x0, 0x0, 0x0, 0x0, 0x0}, + {0x0, 0x0, 0x0, 0x1, -1}, + {-1, 0x0, 0x0, 0x0, 0x1}, + {0x0, -1, 0x0, 0x0, 0x1}, + {0x0, 0x0, -1, 0x0, 0x1}, + {0x0, 0x0, 0x0, -1, 0x1}, + {0x0, 0x0, 0x0, 0x0, 0x0} +}; + +u16 GetNatureAdjustedStatValue (u8 monNature, u16 monStatValue, u8 statType) +{ + u16 result; + + if ((statType < 0x1) || (statType > 0x5)) { + return monStatValue; + } + + switch (sNatureStatAffinities[monNature][statType - 1]) { + case 1: + result = monStatValue * 110; + result /= 100; + break; + case -1: + result = monStatValue * 90; + result /= 100; + break; + default: + result = monStatValue; + break; + } + + return result; +} + +s8 GetNatureStatAffinity (u8 monNature, u8 statType) +{ + return sNatureStatAffinities[monNature][statType - 1]; +} + +static const s8 Unk_020F05A0[][3] = { + {0x5, 0x3, 0x2}, + {0x5, 0x3, 0x2}, + {0x1, 0x1, 0x0}, + {0x3, 0x2, 0x1}, + {0x1, 0x1, 0x0}, + {0x1, 0x1, 0x1}, + {-1, -1, -1}, + {-5, -5, -10}, + {-5, -5, -10}, + {0x3, 0x2, 0x1} +}; + +void sub_02075C74 (Pokemon * mon, u8 param1, u16 param2) +{ + u16 monSpeciesEgg; + u16 monHeldItem; + s16 monFriendship; + s8 v3; + u8 v4; + u8 itemHoldEffect; + + if (param1 == 5) { + if (LCRNG_Next() & 1) { + return; + } + } + + monSpeciesEgg = GetMonData(mon, MON_DATA_SPECIES_EGG, NULL); + + if ((monSpeciesEgg == SPECIES_NONE) || (monSpeciesEgg == SPECIES_EGG)) { + return; + } + + monHeldItem = GetMonData(mon, MON_DATA_HELD_ITEM, NULL); + itemHoldEffect = Item_LoadParam(monHeldItem, 1, 0); + v4 = 0; + monFriendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL); + + if (monFriendship >= 100) { + v4++; + } + + if (monFriendship >= 200) { + v4++; + } + + v3 = Unk_020F05A0[param1][v4]; + + if ((v3 > 0) && (GetMonData(mon, MON_DATA_POKEBALL, NULL) == 11)) { + v3++; + } + + if ((v3 > 0) && (GetMonData(mon, MON_DATA_152, NULL) == param2)) { + v3++; + } + + if (v3 > 0) { + if (itemHoldEffect == HOLD_EFFECT_FRIENDSHIP_UP) { + v3 = v3 * 150 / 100; + } + } + + monFriendship += v3; + + if (monFriendship < 0) { + monFriendship = 0; + } + + if (monFriendship > 255) { + monFriendship = 255; + } + + SetMonData(mon, MON_DATA_FRIENDSHIP, (u8 *)&monFriendship); +} + +u8 GetMonGender (Pokemon * mon) +{ + return GetBoxMonGender((BoxPokemon *)&mon->box); +} + +u8 GetBoxMonGender (BoxPokemon * boxMon) +{ + u16 monSpecies; + u32 monPersonality; + int reencrypt; + + reencrypt = DecryptBoxMon(boxMon); + monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, 0); + monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, 0); + + EncryptBoxMon(boxMon, reencrypt); + + return GetMonPersonalityGender(monSpecies, monPersonality); +} + +u8 GetMonPersonalityGender (u16 monSpecies, u32 monPersonality) +{ + PokemonPersonalData * monPersonalData; + u8 monGender; + + monPersonalData = GetMonPersonalData(monSpecies, 0); + monGender = GetMonPersonalDataGender(monPersonalData, monSpecies, monPersonality); + + FreeMonPersonalData(monPersonalData); + + return monGender; +} + +u8 GetMonPersonalDataGender (PokemonPersonalData * monPersonalData, u16 unused_monSpecies, u32 monPersonality) +{ + u8 monGender = GetMonPersonalDataAttribute(monPersonalData, MON_DATA_PERSONAL_GENDER); + + switch (monGender) { + case 0: + return 0; + case 254: + return 1; + case 255: + return 2; + } + + if (monGender > (monPersonality & 0xff)) { + return 1; + } else { + return 0; + } +} + +u8 GetMonShininess (Pokemon * mon) +{ + return GetBoxMonShininess(&mon->box); +} + +u8 GetBoxMonShininess (BoxPokemon * boxMon) +{ + u32 monOTID; + u32 monPersonality; + + monOTID = GetBoxMonData(boxMon, MON_DATA_OT_ID, 0); + monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, 0); + + return GetMonPersonalityShininess(monOTID, monPersonality); +} + +u8 GetMonPersonalityShininess (u32 monOTID, u32 monPersonality) +{ + return (((monOTID & 0xffff0000) >> 16) ^ (monOTID & 0xffff) ^ ((monPersonality & 0xffff0000) >> 16) ^ (monPersonality & 0xffff)) < 8; +} + +u32 sub_02075E64 (u32 param0) +{ + int i; + u32 result; + u16 v2; + u16 v3; + + param0 = (((param0 & 0xffff0000) >> 16) ^ (param0 & 0xffff)) >> 3; + + v2 = LCRNG_Next() & 0x7; + v3 = LCRNG_Next() & 0x7; + + for (i = 0; i < 13; i++) { + if (param0 & GetSingleBitMask(i)) { + if (LCRNG_Next() & 1) { + v2 |= GetSingleBitMask(i + 3); + } else { + v3 |= GetSingleBitMask(i + 3); + } + } else { + if (LCRNG_Next() & 1) { + v2 |= GetSingleBitMask(i + 3); + v3 |= GetSingleBitMask(i + 3); + } + } + } + + result = v2 | (v3 << 16); + + return result; +} + +void sub_02075EF4 (UnkStruct_02008A90 * param0, Pokemon * mon, u8 param2) +{ + sub_02075F0C(param0, &mon->box, param2, 0); +} + +void sub_02075F00 (UnkStruct_02008A90 * param0, Pokemon * mon, u8 param2) +{ + sub_02075F0C(param0, &mon->box, param2, 1); +} + +void sub_02075F0C (UnkStruct_02008A90 * param0, BoxPokemon * boxMon, u8 param2, int param3) +{ + BOOL reencrypt; + u16 monSpeciesEgg; + u8 monGender, monShininess, monForm; + u32 monPersonality; + + reencrypt = DecryptBoxMon(boxMon); + monSpeciesEgg = GetBoxMonData(boxMon, MON_DATA_SPECIES_EGG, NULL); + monGender = GetBoxMonGender(boxMon); + monShininess = GetBoxMonShininess(boxMon); + monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); + + if (monSpeciesEgg == SPECIES_EGG) { + if (GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL) == SPECIES_MANAPHY) { + monForm = 1; + } else { + monForm = 0; + } + } else { + monForm = GetBoxMonData(boxMon, MON_DATA_FORM, NULL); + } + + if (param3 == 1) { + sub_02076300(param0, monSpeciesEgg, monGender, param2, monShininess, monForm, monPersonality); + } else { + sub_02075FB4(param0, monSpeciesEgg, monGender, param2, monShininess, monForm, monPersonality); + } + + EncryptBoxMon(boxMon, reencrypt); +} + +void sub_02075FB4 (UnkStruct_02008A90 * param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality) +{ + param0->unk_06 = 0; + param0->unk_08 = 0; + param0->unk_0C = 0; + monForm = SanitizeFormId(monSpecies, monForm); + + switch (monSpecies) { + case SPECIES_BURMY: + param0->unk_00 = 117; + param0->unk_02 = 72 + (param3 / 2) + monForm * 2; + param0->unk_04 = 166 + monShininess + monForm * 2; + break; + case SPECIES_WORMADAM: + param0->unk_00 = 117; + param0->unk_02 = 78 + (param3 / 2) + monForm * 2; + param0->unk_04 = 172 + monShininess + monForm * 2; + break; + case SPECIES_SHELLOS: + param0->unk_00 = 117; + param0->unk_02 = 84 + param3 + monForm; + param0->unk_04 = 178 + monShininess + monForm * 2; + break; + case SPECIES_GASTRODON: + param0->unk_00 = 117; + param0->unk_02 = 88 + param3 + monForm; + param0->unk_04 = 182 + monShininess + monForm * 2; + break; + case SPECIES_CHERRIM: + param0->unk_00 = 117; + param0->unk_02 = 92 + param3 + monForm; + param0->unk_04 = 186 + (monShininess * 2) + monForm; + break; + case SPECIES_ARCEUS: + param0->unk_00 = 117; + param0->unk_02 = 96 + (param3 / 2) + monForm * 2; + param0->unk_04 = 190 + monShininess + monForm * 2; + break; + case SPECIES_CASTFORM: + param0->unk_00 = 117; + param0->unk_02 = 64 + (param3 * 2) + monForm; + param0->unk_04 = 158 + (monShininess * 4) + monForm; + break; + case SPECIES_DEOXYS: + param0->unk_00 = 117; + param0->unk_02 = 0 + (param3 / 2) + monForm * 2; + param0->unk_04 = 154 + monShininess; + break; + case SPECIES_UNOWN: + param0->unk_00 = 117; + param0->unk_02 = 8 + (param3 / 2) + monForm * 2; + param0->unk_04 = 156 + monShininess; + break; + case SPECIES_EGG: + param0->unk_00 = 117; + param0->unk_02 = 132 + monForm; + param0->unk_04 = 226 + monForm; + break; + case SPECIES_BAD_EGG: + param0->unk_00 = 117; + param0->unk_02 = 132; + param0->unk_04 = 226; + break; + case SPECIES_SHAYMIN: + param0->unk_00 = 117; + param0->unk_02 = 134 + (param3 / 2) + monForm * 2; + param0->unk_04 = 228 + monShininess + monForm * 2; + break; + case SPECIES_ROTOM: + param0->unk_00 = 117; + param0->unk_02 = 138 + (param3 / 2) + monForm * 2; + param0->unk_04 = 232 + monShininess + monForm * 2; + break; + case SPECIES_GIRATINA: + param0->unk_00 = 117; + param0->unk_02 = 150 + (param3 / 2) + monForm * 2; + param0->unk_04 = 244 + monShininess + monForm * 2; + break; + default: + param0->unk_00 = 4; + param0->unk_02 = monSpecies * 6 + param3 + ((monGender != 1) ? 1 : 0); + param0->unk_04 = monSpecies * 6 + 4 + monShininess; + + if ((monSpecies == SPECIES_SPINDA) && (param3 == 2)) { + param0->unk_06 = 327; + param0->unk_08 = 0; + param0->unk_0C = monPersonality; + } + + break; + } +} + +u8 SanitizeFormId (u16 monSpecies, u8 monForm) +{ + switch (monSpecies) { + case SPECIES_BURMY: + if (monForm > 2) { + monForm = 0; + } + break; + case SPECIES_WORMADAM: + + if (monForm > 2) { + monForm = 0; + } + break; + case SPECIES_SHELLOS: + if (monForm > 1) { + monForm = 0; + } + break; + case SPECIES_GASTRODON: + if (monForm > 1) { + monForm = 0; + } + break; + case SPECIES_CHERRIM: + if (monForm > 1) { + monForm = 0; + } + break; + case SPECIES_ARCEUS: + if (monForm > 17) { + monForm = 0; + } + break; + case SPECIES_CASTFORM: + if (monForm > 3) { + monForm = 0; + } + break; + case SPECIES_DEOXYS: + if (monForm > 3) { + monForm = 0; + } + break; + case SPECIES_UNOWN: + if (monForm >= 28) { + monForm = 0; + } + break; + case SPECIES_EGG: + if (monForm > 1) { + monForm = 0; + } + break; + case SPECIES_SHAYMIN: + if (monForm > 1) { + monForm = 0; + } + break; + case SPECIES_ROTOM: + if (monForm > 5) { + monForm = 0; + } + break; + case SPECIES_GIRATINA: + if (monForm > 1) { + monForm = 0; + } + break; + } + + return monForm; +} + +static void sub_02076300 (UnkStruct_02008A90 * param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality) +{ + param0->unk_06 = 0; + param0->unk_08 = 0; + param0->unk_0C = 0; + + monForm = SanitizeFormId(monSpecies, monForm); + + switch (monSpecies) { + case SPECIES_BURMY: + param0->unk_00 = 166; + param0->unk_02 = 72 + (param3 / 2) + monForm * 2; + param0->unk_04 = 146 + monShininess + monForm * 2; + break; + case SPECIES_WORMADAM: + param0->unk_00 = 166; + param0->unk_02 = 78 + (param3 / 2) + monForm * 2; + param0->unk_04 = 152 + monShininess + monForm * 2; + break; + case SPECIES_SHELLOS: + param0->unk_00 = 166; + param0->unk_02 = 84 + param3 + monForm; + param0->unk_04 = 158 + monShininess + monForm * 2; + break; + case SPECIES_GASTRODON: + param0->unk_00 = 166; + param0->unk_02 = 88 + param3 + monForm; + param0->unk_04 = 162 + monShininess + monForm * 2; + break; + case SPECIES_CHERRIM: + param0->unk_00 = 166; + param0->unk_02 = 92 + param3 + monForm; + param0->unk_04 = 166 + (monShininess * 2) + monForm; + break; + case SPECIES_ARCEUS: + param0->unk_00 = 166; + param0->unk_02 = 96 + (param3 / 2) + monForm * 2; + param0->unk_04 = 170 + monShininess + monForm * 2; + break; + case SPECIES_CASTFORM: + param0->unk_00 = 166; + param0->unk_02 = 64 + (param3 * 2) + monForm; + param0->unk_04 = 138 + (monShininess * 4) + monForm; + break; + case SPECIES_DEOXYS: + param0->unk_00 = 166; + param0->unk_02 = 0 + (param3 / 2) + monForm * 2; + param0->unk_04 = 134 + monShininess; + break; + case SPECIES_UNOWN: + param0->unk_00 = 166; + param0->unk_02 = 8 + (param3 / 2) + monForm * 2; + param0->unk_04 = 136 + monShininess; + break; + case SPECIES_EGG: + param0->unk_00 = 166; + param0->unk_02 = 132 + monForm; + param0->unk_04 = 206 + monForm; + break; + case SPECIES_BAD_EGG: + param0->unk_00 = 166; + param0->unk_02 = 132; + param0->unk_04 = 206; + break; + case SPECIES_SHAYMIN: + if (monForm > 0) { + param0->unk_00 = 117; + param0->unk_02 = 134 + (param3 / 2) + monForm * 2; + param0->unk_04 = 230 + monShininess; + } else { + param0->unk_00 = 165; + param0->unk_02 = monSpecies * 6 + param3 + ((monGender != 1) ? 1 : 0); + param0->unk_04 = monSpecies * 6 + 4 + monShininess; + } + break; + case SPECIES_ROTOM: + if (monForm > 0) { + param0->unk_00 = 117; + param0->unk_02 = 138 + (param3 / 2) + monForm * 2; + param0->unk_04 = 232 + monShininess + monForm * 2; + } else { + param0->unk_00 = 165; + param0->unk_02 = monSpecies * 6 + param3 + ((monGender != 1) ? 1 : 0); + param0->unk_04 = monSpecies * 6 + 4 + monShininess; + } + break; + case SPECIES_GIRATINA: + if (monForm > 0) { + param0->unk_00 = 117; + param0->unk_02 = 150 + (param3 / 2) + monForm * 2; + param0->unk_04 = 244 + monShininess + monForm * 2; + } else { + param0->unk_00 = 165; + param0->unk_02 = monSpecies * 6 + param3 + ((monGender != 1) ? 1 : 0); + param0->unk_04 = monSpecies * 6 + 4 + monShininess; + } + break; + default: + param0->unk_00 = 165; + param0->unk_02 = monSpecies * 6 + param3 + ((monGender != 1) ? 1 : 0); + param0->unk_04 = monSpecies * 6 + 4 + monShininess; + + if ((monSpecies == SPECIES_SPINDA) && (param3 == 2)) { + param0->unk_06 = 327; + param0->unk_08 = 0; + param0->unk_0C = monPersonality; + } + + break; + } +} + +u8 sub_020765AC (Pokemon * mon, u8 param1) +{ + return sub_020765C4(&mon->box, param1, 0); +} + +u8 sub_020765B8 (Pokemon * mon, u8 param1) +{ + return sub_020765C4(&mon->box, param1, 1); +} + +u8 sub_020765C4 (BoxPokemon * boxMon, u8 param1, int param2) +{ + u16 monSpeciesEgg; + u8 monGender; + u8 monForm; + u32 monPersonality; + + monSpeciesEgg = GetBoxMonData(boxMon, MON_DATA_SPECIES_EGG, NULL); + monGender = GetBoxMonGender(boxMon); + monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); + + if (monSpeciesEgg == SPECIES_EGG) { + if (GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL) == SPECIES_MANAPHY) { + monForm = 1; + } else { + monForm = 0; + } + } else { + monForm = GetBoxMonData(boxMon, MON_DATA_FORM, NULL); + } + + if (param2 == 1) { + return sub_020767BC(monSpeciesEgg, monGender, param1, monForm, monPersonality); + } + + return sub_02076648(monSpeciesEgg, monGender, param1, monForm, monPersonality); +} + +u8 sub_02076648 (u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality) +{ + int narcIndex; + int memberIndex; + u8 result; + + monForm = SanitizeFormId(monSpecies, monForm); + + switch (monSpecies) { + case SPECIES_BURMY: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 72 + (param2 / 2) + monForm * 2; + break; + case SPECIES_WORMADAM: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 78 + (param2 / 2) + monForm * 2; + break; + case SPECIES_SHELLOS: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 84 + param2 + monForm; + break; + case SPECIES_GASTRODON: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 88 + param2 + monForm; + break; + case SPECIES_CHERRIM: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 92 + param2 + monForm; + break; + case SPECIES_ARCEUS: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 96 + (param2 / 2) + monForm * 2; + break; + case SPECIES_CASTFORM: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 64 + param2 * 2 + monForm; + break; + case SPECIES_DEOXYS: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 0 + (param2 / 2) + monForm * 2; + break; + case SPECIES_UNOWN: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 8 + (param2 / 2) + monForm * 2; + break; + case SPECIES_EGG: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 132 + monForm; + break; + case SPECIES_BAD_EGG: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 132; + break; + case SPECIES_SHAYMIN: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 136 + (param2 / 2) + monForm * 2; + break; + case SPECIES_ROTOM: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 140 + (param2 / 2) + monForm * 2; + break; + case SPECIES_GIRATINA: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 152 + (param2 / 2) + monForm * 2; + break; + default: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT; + memberIndex = monSpecies * 4 + param2 + ((monGender != 1) ? 1 : 0); + break; + } + + NARC_ReadWholeMemberByIndexPair(&result, narcIndex, memberIndex); + + return result; +} + +static u8 sub_020767BC (u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality) +{ + int narcIndex; + int memberIndex; + u8 result; + + monForm = SanitizeFormId(monSpecies, monForm); + + switch (monSpecies) { + case SPECIES_BURMY: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 72 + (param2 / 2) + monForm * 2; + break; + case SPECIES_WORMADAM: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 78 + (param2 / 2) + monForm * 2; + break; + case SPECIES_SHELLOS: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 84 + param2 + monForm; + break; + case SPECIES_GASTRODON: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 88 + param2 + monForm; + break; + case SPECIES_CHERRIM: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 92 + param2 + monForm; + break; + case SPECIES_ARCEUS: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 96 + (param2 / 2) + monForm * 2; + break; + case SPECIES_CASTFORM: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 64 + param2 * 2 + monForm; + break; + case SPECIES_DEOXYS: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 0 + (param2 / 2) + monForm * 2; + break; + case SPECIES_UNOWN: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 8 + (param2 / 2) + monForm * 2; + break; + case SPECIES_EGG: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 132 + monForm; + break; + case SPECIES_BAD_EGG: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; + memberIndex = 132; + break; + case SPECIES_SHAYMIN: + if (monForm > 0) { + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 136 + (param2 / 2) + monForm * 2; + } else { + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT; + memberIndex = monSpecies * 4 + param2 + ((monGender != 1) ? 1 : 0); + } + break; + case SPECIES_ROTOM: + if (monForm > 0) { + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 140 + (param2 / 2) + monForm * 2; + } else { + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT; + memberIndex = monSpecies * 4 + param2 + ((monGender != 1) ? 1 : 0); + } + break; + case SPECIES_GIRATINA: + if (monForm > 0) { + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; + memberIndex = 152 + (param2 / 2) + monForm * 2; + } else { + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT; + memberIndex = monSpecies * 4 + param2 + ((monGender != 1) ? 1 : 0); + } + break; + default: + narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT; + memberIndex = monSpecies * 4 + param2 + ((monGender != 1) ? 1 : 0); + break; + } + + NARC_ReadWholeMemberByIndexPair(&result, narcIndex, memberIndex); + + return result; +} + +void sub_0207697C (UnkStruct_02008A90 * param0, u16 param1) +{ + param0->unk_00 = 60; + param0->unk_02 = param1 * 2; + param0->unk_04 = param1 * 2 + 1; + param0->unk_06 = 0; + param0->unk_08 = 0; + param0->unk_0C = 0; +} + +static const UnkStruct_ov104_0223F9E0 Unk_020F05E4 = { + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0, + NNS_G2D_VRAM_TYPE_2DMAIN, + {0x4E2F, 0x4E2A, 0x4E27, 0x4E27, 0xffffffff, 0xffffffff}, + 0x2, + 0x1 +}; + +static const int Unk_020F0588[] = { + 0x0, + 0x0, + 0x1, + 0x0, + 0x0, + 0x1 +}; + +UnkStruct_0200D0F4 * sub_02076994 (UnkStruct_0200C6E4 * param0, UnkStruct_0200C704 * param1, UnkStruct_02002F38 * param2, int param3, int param4, int param5, int param6, int param7, int heapID) +{ + UnkStruct_ov104_0223F9E0 v0; + UnkStruct_0200D0F4 * v1; + NARC * narc; + UnkStruct_ov5_021DE5D0 v3; + int v4 = 1; + + sub_02076AAC(param5, param6, &v3); + + if (param5 == 102) { + v4 = 2; + } + + narc = NARC_ctor(v3.unk_00, heapID); + + sub_0200CC3C(param0, param1, narc, v3.unk_04, 0, NNS_G2D_VRAM_TYPE_2DMAIN, 20015 + param7); + sub_0200CDC4(param2, 2, param0, param1, narc, v3.unk_08, 0, v4, NNS_G2D_VRAM_TYPE_2DMAIN, 20010 + param7); + sub_0200CE24(param0, param1, narc, v3.unk_0C, 0, 20007 + param7); + sub_0200CE54(param0, param1, narc, v3.unk_10, 0, 20007 + param7); + NARC_dtor(narc); + + v0 = Unk_020F05E4; + + v0.unk_14[0] = 20015 + param7; + v0.unk_14[1] = 20010 + param7; + v0.unk_14[2] = 20007 + param7; + v0.unk_14[3] = 20007 + param7; + v0.unk_08 = Unk_020F0588[param7]; + + v1 = sub_0200CE6C(param0, param1, &v0); + + sub_02021F24(v1->unk_00, 0); + sub_0200D4C4(v1, param3, param4); + sub_0200D330(v1); + sub_0200D390(v1, 1); + + return v1; +} + +void sub_02076AAC (int param0, int param1, UnkStruct_ov5_021DE5D0 * param2) +{ + if (param1 == 2) { + param2->unk_00 = 60; + param2->unk_04 = 0 + param0 * 5; + param2->unk_08 = 1 + param0 * 5; + param2->unk_0C = 2 + param0 * 5; + param2->unk_10 = 3 + param0 * 5; + param2->unk_14 = 4 + param0 * 5; + } else { + param2->unk_00 = 6; + param0 = sub_020788D0(param0); + param2->unk_04 = 0 + param0 * 5; + param2->unk_08 = 1 + param0 * 5; + param2->unk_0C = 2 + param0 * 5; + param2->unk_10 = 3 + param0 * 5; + param2->unk_14 = 4 + param0 * 5; + } +} + +u32 GetPokemonStructSize (void) +{ + return (u32)sizeof(Pokemon); +} + +u32 GetBoxPokemonStructSize (void) +{ + return (u32)sizeof(BoxPokemon); +} + +u8 GetMonForm (Pokemon * mon) +{ + return GetBoxMonForm((BoxPokemon *)&mon->box); +} + +u8 GetBoxMonForm (BoxPokemon * boxMon) +{ + return GetBoxMonData(boxMon, MON_DATA_FORM, NULL); +} + +BoxPokemon * GetBoxMon (Pokemon * mon) +{ + return &mon->box; +} + +u8 sub_02076B14 (Pokemon * mon) +{ + u16 monSpecies; + u8 monNextLevel; + u32 monExp; + u32 maxExp; + int monExpRate; + + monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + monNextLevel = GetMonData(mon, MON_DATA_LEVEL, NULL) + 1; + monExp = GetMonData(mon, MON_DATA_EXP, NULL); + monExpRate = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_EXP_RATE); + maxExp = GetMonExpRateLevelExp(monExpRate, 100); + + if (monExp > maxExp) { + monExp = maxExp; + SetMonData(mon, MON_DATA_EXP, (u8 *)&monExp); + } + + if (monNextLevel > 100) { + return 0; + } + + maxExp = GetMonExpRateLevelExp(monExpRate, monNextLevel); + + if (monExp >= maxExp) { + SetMonData(mon, MON_DATA_LEVEL, (u8 *)&monNextLevel); + return 1; + } + + return 0; +} + +u16 sub_02076B94 (Party * party, Pokemon * mon, u8 evoTypeList, u16 evoParam, int * evoTypeResult) +{ + u16 monSpecies; + u16 monHeldItem; + u8 monLevel; + int i; + u16 targetSpecies = 0; + u16 monFriendship; + u32 monPersonality; + u8 itemHoldEffect; + u8 monBeauty; + u16 monPersonalityUpper = 0; + PokemonEvolutionData * monEvolutionData; + int v11; + + monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + monHeldItem = GetMonData(mon, MON_DATA_HELD_ITEM, NULL); + monPersonality = GetMonData(mon, MON_DATA_PERSONALITY, NULL); + monBeauty = GetMonData(mon, MON_DATA_BEAUTY, NULL); + monPersonalityUpper = (monPersonality & 0xffff0000) >> 16; + itemHoldEffect = Item_LoadParam(monHeldItem, 1, 0); + + if (monSpecies != SPECIES_KADABRA) { + if ((itemHoldEffect == HOLD_EFFECT_NO_EVOLVE) && (evoTypeList != 3)) { + return 0; + } + } + + if (evoTypeResult == NULL) { + evoTypeResult = &v11; + } + + monEvolutionData = Heap_AllocFromHeap(0, sizeof(PokemonEvolutionData)); + LoadMonEvolutionData(monSpecies, monEvolutionData); + + switch (evoTypeList) { + case 0: + monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); + monFriendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL); + + for (i = 0; i < 7; i++) { + switch (monEvolutionData->methods[i].type) { + case 1: // high friendship + if (220 <= monFriendship) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 1; + } + break; + case 2: // high friendship && daytime + if ((sub_02013948() == 0) && (220 <= monFriendship)) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 2; + } + break; + case 3: // high friendship && nighttime + if ((sub_02013948() == 1) && (220 <= monFriendship)) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 3; + } + break; + case 4: // above level param + if (monEvolutionData->methods[i].param <= monLevel) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 4; + } + break; + case 8: // tyrogue evo to hitmonlee: above level param && attack > defense + if (monEvolutionData->methods[i].param <= monLevel) { + if ((GetMonData(mon, MON_DATA_ATK, NULL)) > (GetMonData(mon, MON_DATA_DEF, NULL))) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 8; + } + } + break; + case 9: // tyrogue evo to hitmontop: above level param && attack == defense + if (monEvolutionData->methods[i].param <= monLevel) { + if ((GetMonData(mon, MON_DATA_ATK, NULL)) == (GetMonData(mon, MON_DATA_DEF, NULL))) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 9; + } + } + break; + case 10: // tyrogue evo to hitmonchan: above level param && attack < defense + if (monEvolutionData->methods[i].param <= monLevel) { + if ((GetMonData(mon, MON_DATA_ATK, NULL)) < (GetMonData(mon, MON_DATA_DEF, NULL))) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 10; + } + } + break; + case 11: // wurmple evo to silcoon: above level param && upper16 of personality % 10 < 5 + if (monEvolutionData->methods[i].param <= monLevel) { + if ((monPersonalityUpper % 10) < 5) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 11; + } + } + break; + case 12: // wurmple evo to cascoon: above level param && upper16 of personality % 10 >= 5 + if (monEvolutionData->methods[i].param <= monLevel) { + if ((monPersonalityUpper % 10) >= 5) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 12; + } + } + break; + case 13: // nincada evo to ninjask: above level param + if (monEvolutionData->methods[i].param <= monLevel) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 13; + } + break; + case 14: // nincada evo to shedinja: ??? + evoTypeResult[0] = 14; + break; + case 15: // feebas evo: beauty > param + if (monEvolutionData->methods[i].param <= monBeauty) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 15; + } + break; + case 18: // happiny evo: hold param && daytime + if ((sub_02013948() == 0) && (monEvolutionData->methods[i].param == monHeldItem)) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 18; + } + break; + case 19: // sneasel and gligar evo: hold param && nighttime + if ((sub_02013948() == 1) && (monEvolutionData->methods[i].param == monHeldItem)) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 19; + } + break; + case 20: // lickitung, tangela etc. evo: after param learned + if (MonHasMove(mon, monEvolutionData->methods[i].param) == 1) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 20; + } + break; + case 21: // mantyke evo: have param in party + if (party != NULL) { + if (Party_HasSpecies(party, monEvolutionData->methods[i].param) == 1) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 21; + } + } + break; + case 22: // burmy evo to mothim: above level param && male + if ((GetMonData(mon, MON_DATA_GENDER, NULL) == 0) && (monEvolutionData->methods[i].param <= monLevel)) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 22; + } + break; + case 23: // burmy evo to wormadam, combee evo to vespiquen: above level param && female + if ((GetMonData(mon, MON_DATA_GENDER, NULL) == 1) && (monEvolutionData->methods[i].param <= monLevel)) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 23; + } + break; + case 24: // magneton and nosepass evo: custom check + if (monEvolutionData->methods[i].type == evoParam) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 24; + } + break; + case 25: // eevee evo to leafeon: custom check + if (monEvolutionData->methods[i].type == evoParam) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 25; + } + break; + case 26: // eevee evo to glaceon: custom check + if (monEvolutionData->methods[i].type == evoParam) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 26; + } + break; + } + + if (targetSpecies) { + break; + } + } + break; + case 1: + for (i = 0; i < 7; i++) { + switch (monEvolutionData->methods[i].type) { + case 5: // kadabra etc. evo: trade + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 5; + break; + case 6: // poliwhirl evo to politoed etc.: trade holding param + if (monEvolutionData->methods[i].param == monHeldItem) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 6; + } + break; + } + + if (targetSpecies) { + break; + } + } + break; + case 2: + case 3: + for (i = 0; i < 7; i++) { + // use param + if ((monEvolutionData->methods[i].type == 7) && (monEvolutionData->methods[i].param == evoParam)) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 0; + break; + } + // kirlia evo to gallade: use param && male + if ((monEvolutionData->methods[i].type == 16) && (GetMonData(mon, MON_DATA_GENDER, NULL) == 0) && (monEvolutionData->methods[i].param == evoParam)) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 0; + break; + } + // snorunt evo to froslass: use param && female + if ((monEvolutionData->methods[i].type == 17) && (GetMonData(mon, MON_DATA_GENDER, NULL) == 1) && (monEvolutionData->methods[i].param == evoParam)) { + targetSpecies = monEvolutionData->methods[i].targetSpecies; + evoTypeResult[0] = 0; + break; + } + + if (targetSpecies) { + break; + } + } + break; + } + + Heap_FreeToHeap(monEvolutionData); + return targetSpecies; +} + +u16 sub_02076F84 (const u16 monSpecies) +{ + FSFile file; + u16 result = 0; + + GF_ASSERT((493 + 1) > monSpecies); + + FS_InitFile(&file); + FS_OpenFile(&file, "poketool/personal/pms.narc"); + FS_SeekFile(&file, monSpecies * 2, FS_SEEK_SET); + FS_ReadFile(&file, &result, 2); + FS_CloseFile(&file); + + return result; +} + +u16 sub_02076FD4 (const u16 monSpecies) +{ + switch (monSpecies) { + case SPECIES_WOBBUFFET: + case SPECIES_MARILL: + case SPECIES_MR_MIME: + case SPECIES_SUDOWOODO: + case SPECIES_SNORLAX: + case SPECIES_MANTINE: + case SPECIES_ROSELIA: + case SPECIES_CHANSEY: + case SPECIES_CHIMECHO: + return monSpecies; + break; + } + + return sub_02076F84(monSpecies); +} + +void SetBoxMonDefaultMoves (BoxPokemon * boxMon) +{ + BOOL reencrypt; + int i; + u16 monSpecies; + u16 monLevelUpMoveID; + int monForm; + u16 moveID; + u8 monLevel; + u16 * monLevelUpMoves = Heap_AllocFromHeap(0, 44); + + reencrypt = DecryptBoxMon(boxMon); + monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, 0); + monForm = GetBoxMonData(boxMon, MON_DATA_FORM, 0); + monLevel = GetBoxMonLevel(boxMon); + + LoadMonLevelUpMoves(monSpecies, monForm, monLevelUpMoves); + + i = 0; + + while (monLevelUpMoves[i] != 0xffff) { + if ((monLevelUpMoves[i] & 0xfe00) <= (monLevel << 9)) { + monLevelUpMoveID = monLevelUpMoves[i] & 0x1ff; + moveID = AddBoxMonMove(boxMon, monLevelUpMoveID); + + if (moveID == 0xffff) { + ReplaceBoxMonMove(boxMon, monLevelUpMoveID); + } + } else { + break; + } + + i++; + } + + Heap_FreeToHeap(monLevelUpMoves); + EncryptBoxMon(boxMon, reencrypt); +} + +u16 AddMonMove (Pokemon * mon, u16 moveID) +{ + BoxPokemon * boxMon = GetBoxMon(mon); + return AddBoxMonMove(boxMon, moveID); +} + +u16 AddBoxMonMove (BoxPokemon * boxMon, u16 moveID) +{ + int i; + u8 unused_0; + u16 slotMove; + u16 result; + BOOL reencrypt; + + result = 0xffff; + + reencrypt = DecryptBoxMon(boxMon); + + for (i = 0; i < 4; i++) { + if ((slotMove = GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, NULL)) == 0) { + SetBoxMonMove(boxMon, moveID, i); + result = moveID; + break; + } else { + if (slotMove == moveID) { + result = 0xfffe; + break; + } + } + } + + EncryptBoxMon(boxMon, reencrypt); + + return result; +} + +void ReplaceMonMove (Pokemon * mon, u16 moveID) +{ + BoxPokemon * boxMon = GetBoxMon(mon); + ReplaceBoxMonMove(boxMon, moveID); +} + +void ReplaceBoxMonMove (BoxPokemon * boxMon, u16 moveID) +{ + int i; + u16 moveIDs[4]; + u8 movePPs[4]; + u8 movePPUps[4]; + BOOL reencrypt; + + reencrypt = DecryptBoxMon(boxMon); + + for (i = 0; i < 3; i++) { + moveIDs[i] = GetBoxMonData(boxMon, MON_DATA_MOVE2 + i, NULL); + movePPs[i] = GetBoxMonData(boxMon, MON_DATA_MOVE2_PP + i, NULL); + movePPUps[i] = GetBoxMonData(boxMon, MON_DATA_MOVE2_PP_UPS + i, NULL); + } + + moveIDs[3] = moveID; + movePPs[3] = MoveTable_LoadParam(moveID, 5); + movePPUps[3] = 0; + + for (i = 0; i < 4; i++) { + SetBoxMonData(boxMon, MON_DATA_MOVE1 + i, (u8 *)&moveIDs[i]); + SetBoxMonData(boxMon, MON_DATA_MOVE1_PP + i, (u8 *)&movePPs[i]); + SetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + i, (u8 *)&movePPUps[i]); + } + + EncryptBoxMon(boxMon, reencrypt); +} + +void ResetMonMove (Pokemon * mon, u16 moveID, u8 moveSlot) +{ + u32 moveMaxPP, movePPUps; + + SetMonMove(mon, moveID, moveSlot); + + movePPUps = 0; + SetMonData(mon, MON_DATA_MOVE1_PP_UPS + moveSlot, &movePPUps); + + moveMaxPP = MoveTable_CalcMaxPP(moveID, 0); + SetMonData(mon, MON_DATA_MOVE1_PP + moveSlot, (u8 *)&moveMaxPP); + + return; +} + +void SetMonMove (Pokemon * mon, u16 moveID, u8 moveSlot) +{ + SetBoxMonMove(&mon->box, moveID, moveSlot); +} + +void SetBoxMonMove (BoxPokemon * boxMon, u16 moveID, u8 moveSlot) +{ + u8 moveMaxPP; + u8 movePPUps; + + SetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot, (u8 *)&moveID); + + movePPUps = GetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot, NULL); + moveMaxPP = MoveTable_CalcMaxPP(moveID, movePPUps); + + SetBoxMonData(boxMon, MON_DATA_MOVE1_PP + moveSlot, (u8 *)&moveMaxPP); +} + +u16 sub_0207727C (Pokemon * mon, int * index, u16 * moveID) +{ + u16 result = 0x0; + u16 monSpecies; + int monForm; + u8 monLevel; + u16 * monLevelUpMoves = Heap_AllocFromHeap(0, 44); + + monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + monForm = GetMonData(mon, MON_DATA_FORM, NULL); + monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); + + LoadMonLevelUpMoves(monSpecies, monForm, monLevelUpMoves); + + if (monLevelUpMoves[index[0]] == 0xffff) { + Heap_FreeToHeap(monLevelUpMoves); + return 0x0; + } + + while ((monLevelUpMoves[index[0]] & 0xfe00) != (monLevel << 9)) { + index[0]++; + + if (monLevelUpMoves[index[0]] == 0xffff) { + Heap_FreeToHeap(monLevelUpMoves); + return 0x0; + } + } + + if ((monLevelUpMoves[index[0]] & 0xfe00) == (monLevel << 9)) { + moveID[0] = monLevelUpMoves[index[0]] & 0x1ff; + index[0]++; + + result = AddMonMove(mon, moveID[0]); + } + + Heap_FreeToHeap(monLevelUpMoves); + + return result; +} + +void SwapMonMoves (Pokemon * mon, int moveSlot1, int moveSlot2) +{ + SwapBoxMonMoves(&mon->box, moveSlot1, moveSlot2); +} + +void SwapBoxMonMoves (BoxPokemon * boxMon, int moveSlot1, int moveSlot2) +{ + u16 moveIDs[2]; + u8 movePPs[2]; + u8 movePPUps[2]; + + moveIDs[0] = GetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot1, NULL); + movePPs[0] = GetBoxMonData(boxMon, MON_DATA_MOVE1_PP + moveSlot1, NULL); + movePPUps[0] = GetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot1, NULL); + moveIDs[1] = GetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot2, NULL); + movePPs[1] = GetBoxMonData(boxMon, MON_DATA_MOVE1_PP + moveSlot2, NULL); + movePPUps[1] = GetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot2, NULL); + + SetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot1, (u8 *)&moveIDs[1]); + SetBoxMonData(boxMon, MON_DATA_MOVE1_PP + moveSlot1, (u8 *)&movePPs[1]); + SetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot1, (u8 *)&movePPUps[1]); + SetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot2, (u8 *)&moveIDs[0]); + SetBoxMonData(boxMon, MON_DATA_MOVE1_PP + moveSlot2, (u8 *)&movePPs[0]); + SetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot2, (u8 *)&movePPUps[0]); +} + +void DeleteMonMove (Pokemon * mon, u32 moveSlot) +{ + u32 i; + u16 moveID; + u8 movePP; + u8 movePPUps; + + for (i = moveSlot; i < 3; i++) { + moveID = GetMonData(mon, MON_DATA_MOVE1 + i + 1, NULL); + movePP = GetMonData(mon, MON_DATA_MOVE1_PP + i + 1, NULL); + movePPUps = GetMonData(mon, MON_DATA_MOVE1_PP_UPS + i + 1, NULL); + + SetMonData(mon, MON_DATA_MOVE1 + i, (u8 *)&moveID); + SetMonData(mon, MON_DATA_MOVE1_PP + i, (u8 *)&movePP); + SetMonData(mon, MON_DATA_MOVE1_PP_UPS + i, (u8 *)&movePPUps); + } + + moveID = 0; + movePP = 0; + movePPUps = 0; + + SetMonData(mon, MON_DATA_MOVE4, (u8 *)&moveID); + SetMonData(mon, MON_DATA_MOVE4_PP, (u8 *)&movePP); + SetMonData(mon, MON_DATA_MOVE4_PP_UPS, (u8 *)&movePPUps); +} + +BOOL MonHasMove (Pokemon * mon, u16 moveID) +{ + int i; + + for (i = 0; i < 4; i++) { + if (GetMonData(mon, MON_DATA_MOVE1 + i, NULL) == moveID) { + break; + } + } + + return i != 4; +} + +void sub_020774C8 (BoxPokemon * boxMon, Pokemon * mon) +{ + u32 zero = 0; + UnkStruct_0202818C * v1; + UnkStruct_0202CA28 v2; + + mon->box = *boxMon; + + if (mon->box.boxDecrypted) { + mon->box.partyDecrypted = 1; + } + + SetMonData(mon, MON_DATA_160, (u8 *)&zero); + SetMonData(mon, MON_DATA_CURRENT_HP, (u8 *)&zero); + SetMonData(mon, MON_DATA_MAX_HP, (u8 *)&zero); + + v1 = sub_0202818C(0); + + SetMonData(mon, MON_DATA_170, v1); + Heap_FreeToHeap(v1); + SetMonData(mon, MON_DATA_162, (u8 *)&zero); + + MI_CpuClearFast(&v2, sizeof(UnkStruct_0202CA28)); + + SetMonData(mon, MON_DATA_171, (UnkStruct_0202CA28 *)&v2); + CalculateMonLevelAndStats(mon); +} + +u8 GetPartyHighestLevel (Party * party) +{ + u8 result, monLevel; + int i, currentPartyCount; + Pokemon * mon; + + currentPartyCount = Party_GetCurrentCount(party); + result = 1; + + for (i = 0; i < currentPartyCount; i++) { + mon = Party_GetPokemonBySlotIndex(party, i); + + if ((GetMonData(mon, MON_DATA_SPECIES, NULL)) && (GetMonData(mon, MON_DATA_IS_EGG, NULL) == 0)) { + monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); + + if (monLevel > result) { + result = monLevel; + } + } + } + + return result; +} + +u16 sub_020775A4 (u16 param0) +{ + u16 result; + + NARC_ReadFromMemberByIndexPair(&result, NARC_INDEX_POKETOOL__PL_POKEZUKAN, 0, param0 * 2, 2); + + return result; +} + +u16 sub_020775C4 (u16 param0) +{ + u16 result = 0; + + if (param0 <= 210) { + NARC_ReadFromMemberByIndexPair(&result, NARC_INDEX_POKETOOL__SHINZUKAN, 0, param0 * 2, 2); + } + + return result; +} + +void sub_020775EC (Pokemon * src, Pokemon * dest) +{ + *dest = *src; + return; +} + +void sub_02077604 (BoxPokemon * src, BoxPokemon * dest) +{ + *dest = *src; + return; +} + +void sub_02077618 (Pokemon * src, BoxPokemon * dest) +{ + *dest = src->box; + return; +} + +s8 sub_0207762C (Pokemon * mon, int param1) +{ + return sub_02077634(&mon->box, param1); +} + +s8 sub_02077634 (BoxPokemon * boxMon, int param1) +{ + return sub_02077648(GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL), param1); +} + +s8 sub_02077648 (u32 monPersonality, int param1) +{ + u8 monNature; + + monNature = GetNatureFromPersonality(monPersonality); + return Unk_020F0695[monNature][param1]; +} + +int GetMonLevelUpMoveIDs (int monSpecies, int monForm, u16 * monLevelUpMoveIDs) +{ + int result; + u16 * monLevelUpMoves = Heap_AllocFromHeap(0, 44); + + LoadMonLevelUpMoves(monSpecies, monForm, monLevelUpMoves); + + result = 0; + + while (monLevelUpMoves[result] != 0xffff) { + monLevelUpMoveIDs[result] = monLevelUpMoves[result] & 0x1ff; + result++; + } + + Heap_FreeToHeap(monLevelUpMoves); + return result; +} + +void sub_020776B0 (Party * party) +{ + u16 rand; + u8 monPokerus; + Pokemon * mon; + int currentPartyCount; + int partySlot; + + currentPartyCount = Party_GetCurrentCount(party); + rand = LCRNG_Next(); + + if ((rand == 16384) || (rand == 32768) || (rand == 49152)) { + do { + partySlot = LCRNG_Next() % currentPartyCount; + mon = Party_GetPokemonBySlotIndex(party, partySlot); + + if ((GetMonData(mon, MON_DATA_SPECIES, NULL)) && (GetMonData(mon, MON_DATA_IS_EGG, NULL) == 0)) { + break; + } else { + partySlot = currentPartyCount; + } + } while (partySlot == currentPartyCount); + + if (sub_02077758(party, GetSingleBitMask(partySlot)) == 0) { + do { + monPokerus = LCRNG_Next() & 0xff; + } while ((monPokerus & 0x7) == 0); + + if (monPokerus & 0xf0) { + monPokerus &= 0x7; + } + + monPokerus |= (monPokerus << 4); + monPokerus &= 0xf3; + monPokerus++; + + SetMonData(mon, MON_DATA_POKERUS, (u8 *)&monPokerus); + } + } +} + +u8 sub_02077758 (Party * party, u8 param1) +{ + int partySlot = 0; + int v1 = 1; + u8 result = 0; + Pokemon * mon; + + if (param1) { + do { + if (param1 & 1) { + mon = Party_GetPokemonBySlotIndex(party, partySlot); + + if (GetMonData(mon, MON_DATA_POKERUS, NULL)) { + result |= v1; + } + } + + partySlot++; + v1 = v1 << 1; + param1 = param1 >> 1; + } while (param1 != 0); + } else { + mon = Party_GetPokemonBySlotIndex(party, partySlot); + + if (GetMonData(mon, MON_DATA_POKERUS, NULL)) { + result++; + } + } + + return result; +} + +void sub_020777B4 (Party * party, s32 param1) +{ + int i; + int currentPartyCount; + u8 monPokerus; + Pokemon * mon; + + currentPartyCount = Party_GetCurrentCount(party); + + for (i = 0; i < currentPartyCount; i++) { + mon = Party_GetPokemonBySlotIndex(party, i); + + if (GetMonData(mon, MON_DATA_SPECIES, NULL)) { + monPokerus = GetMonData(mon, MON_DATA_POKERUS, NULL); + + if (monPokerus & 0xf) { + if (((monPokerus & 0xf) < param1) || (param1 > 4)) { + monPokerus &= 0xf0; + } else { + monPokerus -= param1; + } + + if (monPokerus == 0) { + monPokerus = 0x10; + } + + SetMonData(mon, MON_DATA_POKERUS, (u8 *)&monPokerus); + } + } + } +} + +void sub_0207782C (Party * party) +{ + int i; + int currentPartyCount; + u8 monPokerus; + Pokemon * mon; + + currentPartyCount = Party_GetCurrentCount(party); + + if (LCRNG_Next() % 3 == 0) { + for (i = 0; i < currentPartyCount; i++) { + mon = Party_GetPokemonBySlotIndex(party, i); + + if (GetMonData(mon, MON_DATA_SPECIES, NULL)) { + monPokerus = GetMonData(mon, MON_DATA_POKERUS, NULL); + + if (monPokerus & 0xf) { + if (i != 0) { + mon = Party_GetPokemonBySlotIndex(party, i - 1); + + if ((GetMonData(mon, MON_DATA_POKERUS, NULL) & 0xf0) == 0) { + SetMonData(mon, MON_DATA_POKERUS, (u8 *)&monPokerus); + } + } + + if (i < currentPartyCount - 1) { + mon = Party_GetPokemonBySlotIndex(party, i + 1); + + if ((GetMonData(mon, MON_DATA_POKERUS, NULL) & 0xf0) == 0) { + SetMonData(mon, MON_DATA_POKERUS, (u8 *)&monPokerus); + i++; + } + } + } + } + } + } +} + +BOOL sub_020778D8 (Pokemon * mon) +{ + return sub_020778E0(&mon->box); +} + +BOOL sub_020778E0 (BoxPokemon * boxMon) +{ + return (GetBoxMonData(boxMon, MON_DATA_POKERUS, NULL) & 0xf) != 0; +} + +BOOL sub_020778F8 (Pokemon * mon) +{ + return sub_02077900(&mon->box); +} + +BOOL sub_02077900 (BoxPokemon * boxMon) +{ + u8 monPokerus; + + monPokerus = GetBoxMonData(boxMon, MON_DATA_POKERUS, NULL); + + if (monPokerus & 0xf) { + return 0; + } + + return (monPokerus & 0xf0) != 0; +} + +void SetArceusForm (Pokemon * mon) +{ + SetBoxArceusForm(&mon->box); +} + +void SetBoxArceusForm (BoxPokemon * boxMon) +{ + int monSpecies; + int monAbility; + int monHeldItem; + int monForm; + + monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); + monAbility = GetBoxMonData(boxMon, MON_DATA_ABILITY, NULL); + monHeldItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM, NULL); + + if ((monSpecies == SPECIES_ARCEUS) && (monAbility == 121)) { + monForm = GetArceusItemType(Item_LoadParam(monHeldItem, 1, 0)); + SetBoxMonData(boxMon, MON_DATA_FORM, &monForm); + } +} + +u8 GetArceusItemType (u16 itemHoldEffect) +{ + u8 type; + + switch (itemHoldEffect) { + case HOLD_EFFECT_ARCEUS_FIRE: + type = TYPE_FIRE; + break; + case HOLD_EFFECT_ARCEUS_WATER: + type = TYPE_WATER; + break; + case HOLD_EFFECT_ARCEUS_ELECTRIC: + type = TYPE_ELECTRIC; + break; + case HOLD_EFFECT_ARCEUS_GRASS: + type = TYPE_GRASS; + break; + case HOLD_EFFECT_ARCEUS_ICE: + type = TYPE_ICE; + break; + case HOLD_EFFECT_ARCEUS_FIGHT: + type = TYPE_FIGHTING; + break; + case HOLD_EFFECT_ARCEUS_POISON: + type = TYPE_POISON; + break; + case HOLD_EFFECT_ARCEUS_GROUND: + type = TYPE_GROUND; + break; + case HOLD_EFFECT_ARCEUS_FLYING: + type = TYPE_FLYING; + break; + case HOLD_EFFECT_ARCEUS_PSYCHIC: + type = TYPE_PSYCHIC; + break; + case HOLD_EFFECT_ARCEUS_BUG: + type = TYPE_BUG; + break; + case HOLD_EFFECT_ARCEUS_ROCK: + type = TYPE_ROCK; + break; + case HOLD_EFFECT_ARCEUS_GHOST: + type = TYPE_GHOST; + break; + case HOLD_EFFECT_ARCEUS_DRAGON: + type = TYPE_DRAGON; + break; + case HOLD_EFFECT_ARCEUS_DARK: + type = TYPE_DARK; + break; + case HOLD_EFFECT_ARCEUS_STEEL: + type = TYPE_STEEL; + break; + default: + type = TYPE_NORMAL; + break; + } + + return type; +} + +int SetGiratinaForm (Pokemon * mon) +{ + int result; + + result = SetBoxGiratinaForm(&mon->box); + + if (result != -1) { + CalculateMonLevelAndStats(mon); + } + + return result; +} + +int SetBoxGiratinaForm (BoxPokemon * boxMon) +{ + int monSpecies; + int monHeldItem; + int monForm; + + monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); + monHeldItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM, NULL); + + if (monSpecies == SPECIES_GIRATINA) { + monForm = (monHeldItem == ITEM_GRISEOUS_ORB) ? 1 : 0; + + SetBoxMonData(boxMon, MON_DATA_FORM, &monForm); + CalculateBoxMonAbility(boxMon); + + return monForm; + } + + return -1; +} + +void SetGiratinaOriginForm (Pokemon * mon) +{ + int monForm = 1; + + if (GetMonData(mon, MON_DATA_SPECIES, NULL) == SPECIES_GIRATINA) { + SetBoxMonData(&mon->box, MON_DATA_FORM, &monForm); + CalculateBoxMonAbility(&mon->box); + CalculateMonLevelAndStats(mon); + } +} + +void SetPartyGiratinaForm (Party * party, int param1) +{ + int i, currentPartyCount; + Pokemon * mon; + + currentPartyCount = Party_GetCurrentCount(party); + + for (i = 0; i < currentPartyCount; i++) { + mon = Party_GetPokemonBySlotIndex(party, i); + + if (param1) { + SetGiratinaOriginForm(mon); + } else { + SetGiratinaForm(mon); + } + } +} + +void SetShayminForm (Pokemon * mon, int monForm) +{ + SetBoxShayminForm(&mon->box, monForm); + CalculateMonLevelAndStats(mon); +} + +void SetBoxShayminForm (BoxPokemon * boxMon, int monForm) +{ + int monSpecies; + + monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); + + if (monSpecies == SPECIES_SHAYMIN) { + GF_ASSERT(monForm <= 1); + + SetBoxMonData(boxMon, MON_DATA_FORM, &monForm); + CalculateBoxMonAbility(boxMon); + } +} + +BOOL AllowShayminSkyForm (Pokemon * mon) +{ + u32 monSpecies, monForm, v2, monCurrentHP, monFatefulEncounter; + RTCTime rtcTime; + + monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + monForm = GetMonData(mon, MON_DATA_FORM, NULL); + v2 = GetMonData(mon, MON_DATA_160, NULL); + monCurrentHP = GetMonData(mon, MON_DATA_CURRENT_HP, NULL); + monFatefulEncounter = GetMonData(mon, MON_DATA_FATEFUL_ENCOUNTER, NULL); + + sub_02013880(&rtcTime); + + if ((monSpecies == SPECIES_SHAYMIN) && (monForm == 0) && (monCurrentHP > 0) && (monFatefulEncounter == 1) && ((v2 & 0x20) == 0) && ((rtcTime.hour >= 4) && (rtcTime.hour < 20))) { + return 1; + } + + return 0; +} + +void SetShayminLandForm (Party * party) +{ + int i, currentPartyCount, monSpecies, monForm; + Pokemon * mon; + int zero = 0; + + currentPartyCount = Party_GetCurrentCount(party); + + for (i = 0; i < currentPartyCount; i++) { + mon = Party_GetPokemonBySlotIndex(party, i); + monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + monForm = GetMonData(mon, MON_DATA_FORM, NULL); + + if ((monSpecies == SPECIES_SHAYMIN) && (monForm == 1)) { + SetShayminForm(mon, zero); + } + } +} + +BOOL SetPartyShayminForm (Party * party, int param1, const RTCTime * rtcTime) +{ + s32 hours, minutes; + + if ((rtcTime->hour >= 20) || (rtcTime->hour < 4)) { + hours = rtcTime->hour; + + if (hours < 4) { + hours += 24; + } + + hours -= 20; + minutes = rtcTime->minute + hours * 60; + + param1++; + + if (minutes < param1) { + SetShayminLandForm(party); + return 1; + } + + return 0; + } else { + minutes = rtcTime->minute + (rtcTime->hour - 4) * 60; + + if (minutes < param1) { + SetShayminLandForm(party); + return 1; + } + + return 0; + } +} + +BOOL SetRotomForm (Pokemon * mon, int monForm, int moveSlot) +{ + int monSpecies, currentMonForm; + + monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + + if (monSpecies != SPECIES_ROTOM) { + return 0; + } + + currentMonForm = GetMonData(mon, MON_DATA_FORM, NULL); + + { + int i, j, newFormMoveID, moveID; + static const u16 rotomFormMoves[] = { + MOVE_NONE, + MOVE_OVERHEAT, + MOVE_HYDRO_PUMP, + MOVE_BLIZZARD, + MOVE_AIR_SLASH, + MOVE_LEAF_STORM + }; + + newFormMoveID = rotomFormMoves[monForm]; + + for (i = 0; i < 4; i++) { + moveID = GetMonData(mon, MON_DATA_MOVE1 + i, NULL); + + for (j = 1; j < NELEMS(rotomFormMoves); j++) { + if ((moveID != 0) && (moveID == rotomFormMoves[j])) { + if (newFormMoveID != 0) { + ResetMonMove(mon, newFormMoveID, i); + newFormMoveID = 0; + break; + } else { + DeleteMonMove(mon, i); + i--; + break; + } + } + } + } + + if (newFormMoveID != 0) { + for (i = 0; i < 4; i++) { + if (GetMonData(mon, MON_DATA_MOVE1 + i, NULL) == 0) { + ResetMonMove(mon, newFormMoveID, i); + break; + } + } + + if (i == 4) { + ResetMonMove(mon, newFormMoveID, moveSlot); + } + } + + if (GetMonData(mon, MON_DATA_MOVE1, NULL) == 0) { + ResetMonMove(mon, MOVE_THUNDER_SHOCK, 0); + } + } + + SetMonData(mon, MON_DATA_FORM, &monForm); + CalculateMonAbility(mon); + CalculateMonLevelAndStats(mon); + + return 1; +} + +void LoadMonLevelUpMoves (int monSpecies, int monForm, u16 * monLevelUpMoves) +{ + monSpecies = GetMonFormNarcIndex(monSpecies, monForm); + NARC_ReadWholeMemberByIndexPair(monLevelUpMoves, NARC_INDEX_POKETOOL__PERSONAL__WOTBL, monSpecies); +} + +void sub_02077D3C (UnkStruct_0202CC84 * param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7) +{ + if (monSpecies == SPECIES_CHATOT) { + if (sub_020064C8(param1) == 0) { + sub_020063D4(1); + sub_020059D0(param1, monSpecies, param4, param5, param7, param3); + } else { + if (param6) { + sub_020063D4(1); + } + + sub_020063E4(param0, NULL, param5, param4); + } + } else { + sub_020059D0(param1, monSpecies, param4, param5, param7, param3); + } +} + +void sub_02077DB4 (UnkStruct_0202CC84 * param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7, u8 param8) +{ + if (monSpecies == SPECIES_CHATOT) { + if (sub_020064C8(param1) == 0) { + sub_020063D4(1); + sub_02005F4C(param1, monSpecies, param4, param5, param7, param8, param3); + } else { + if (param6) { + sub_020063D4(1); + } + + sub_02006438(param0, NULL, param5, param4, param8); + } + } else { + sub_02005F4C(param1, monSpecies, param4, param5, param7, param8, param3); + } +} + +BOOL sub_02077E3C (Pokemon * mon) +{ + int monSpecies, monForm; + + monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + monForm = GetMonData(mon, MON_DATA_FORM, NULL); + + return sub_02005844(monSpecies, monForm); +} + +void sub_02077E64 (Pokemon * mon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5) +{ + int monMaxHP; + + sub_02077EA4(&mon->box, param1, monPokeball, param3, param4, param5); + + if (monPokeball == ITEM_HEAL_BALL) { + monMaxHP = GetMonData(mon, MON_DATA_MAX_HP, NULL); + SetMonData(mon, MON_DATA_CURRENT_HP, &monMaxHP); + + monMaxHP = 0; + SetMonData(mon, MON_DATA_160, &monMaxHP); + } +} + +void sub_02077EA4 (BoxPokemon * boxMon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5) +{ + sub_0209305C(boxMon, param1, 0, param3, param5); + SetBoxMonData(boxMon, MON_DATA_MET_GAME, &Unk_020E4C40); + SetBoxMonData(boxMon, MON_DATA_POKEBALL, &monPokeball); + SetBoxMonData(boxMon, MON_DATA_158, ¶m4); +} + +void sub_02077EE4 (Pokemon * mon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5) +{ + sub_02077EF8(&mon->box, param1, monPokeball, param3, param4, param5); +} + +void sub_02077EF8 (BoxPokemon * boxMon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5) +{ + int unused_0; + sub_02077EA4(boxMon, param1, monPokeball, param3, param4, param5); +} + +static const u16 sHeldItemChance[][2] = { + {45, 95}, + {20, 80} +}; + +void sub_02077F0C (Pokemon * mon, u32 param1, int param2) +{ + int unused_0; + u32 rand; + u16 monSpecies; + u16 monForm; + u8 unused_1; + u16 monItem1, monItem2; + + if (param1 & ((0x1 | 0x80))) { + return; + } + + rand = LCRNG_Next() % 100; + monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + monForm = GetMonData(mon, MON_DATA_FORM, NULL); + monItem1 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ITEM1); + monItem2 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ITEM2); + + if ((monItem1 == monItem2) && (monItem1 != 0)) { + SetMonData(mon, MON_DATA_HELD_ITEM, &monItem1); + return; + } + + if (rand < sHeldItemChance[param2][0]) { + return; + } else if (rand < sHeldItemChance[param2][1]) { + SetMonData(mon, MON_DATA_HELD_ITEM, &monItem1); + } else { + SetMonData(mon, MON_DATA_HELD_ITEM, &monItem2); + } +} + +BOOL sub_02077FB4 (Pokemon * mon, u8 param1) +{ + return sub_02077FBC(&mon->box, param1); +} + +BOOL sub_02077FBC (BoxPokemon * boxMon, u8 param1) +{ + u16 monSpeciesEgg; + int monForm; + + monSpeciesEgg = GetBoxMonData(boxMon, MON_DATA_SPECIES_EGG, NULL); + monForm = GetBoxMonData(boxMon, MON_DATA_FORM, NULL); + + return sub_02077FE4(monSpeciesEgg, monForm, param1); +} + +BOOL sub_02077FE4 (u16 monSpecies, int monForm, u8 tmID) +{ + u32 tmFlag; + u8 monPersonalDataAttribute; + + if (monSpecies == SPECIES_EGG) { + return 0; + } + + if (tmID < 32) { + tmFlag = (1 << tmID); + monPersonalDataAttribute = MON_DATA_PERSONAL_UNK_1C; + } else if (tmID < 64) { + tmFlag = (1 << (tmID - 32)); + monPersonalDataAttribute = MON_DATA_PERSONAL_UNK_20; + } else if (tmID < 96) { + tmFlag = (1 << (tmID - 64)); + monPersonalDataAttribute = MON_DATA_PERSONAL_UNK_24; + } else { + tmFlag = (1 << (tmID - 96)); + monPersonalDataAttribute = MON_DATA_PERSONAL_UNK_28; + } + + return (GetMonFormPersonalDataAttribute(monSpecies, monForm, monPersonalDataAttribute) & tmFlag) != 0; +} + +void CalculateMonAbility (Pokemon * mon) +{ + CalculateBoxMonAbility(&mon->box); +} + +void CalculateBoxMonAbility (BoxPokemon * boxMon) +{ + BOOL reencrypt; + int monSpecies, monForm; + int monAbility1, monAbility2; + u32 monPersonality; + + reencrypt = DecryptBoxMon(boxMon); + monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); + monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); + monForm = GetBoxMonData(boxMon, MON_DATA_FORM, NULL); + monAbility1 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ABILITY_1); + monAbility2 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ABILITY_2); + + if (monAbility2 != 0) { + if (monPersonality & 1) { + SetBoxMonData(boxMon, MON_DATA_ABILITY, (u8 *)&monAbility2); + } else { + SetBoxMonData(boxMon, MON_DATA_ABILITY, (u8 *)&monAbility1); + } + } else { + SetBoxMonData(boxMon, MON_DATA_ABILITY, (u8 *)&monAbility1); + } + + EncryptBoxMon(boxMon, reencrypt); +} + +void sub_020780C4 (Pokemon * mon, u32 monPersonality) +{ + Pokemon * newMon; + PokemonDataBlockA * newMonBlockA; + PokemonDataBlockB * newMonBlockB; + PokemonDataBlockC * newMonBlockC; + PokemonDataBlockD * newMonBlockD; + PokemonDataBlockA * monBlockA; + PokemonDataBlockB * monBlockB; + PokemonDataBlockC * monBlockC; + PokemonDataBlockD * monBlockD; + + newMon = AllocMonZeroed(0); + + sub_020775EC(mon, newMon); + + newMonBlockA = (PokemonDataBlockA *)GetBoxMonDataBlock(&newMon->box, mon->box.personality, 0); + newMonBlockB = (PokemonDataBlockB *)GetBoxMonDataBlock(&newMon->box, mon->box.personality, 1); + newMonBlockC = (PokemonDataBlockC *)GetBoxMonDataBlock(&newMon->box, mon->box.personality, 2); + newMonBlockD = (PokemonDataBlockD *)GetBoxMonDataBlock(&newMon->box, mon->box.personality, 3); + monBlockA = (PokemonDataBlockA *)GetBoxMonDataBlock(&mon->box, monPersonality, 0); + monBlockB = (PokemonDataBlockB *)GetBoxMonDataBlock(&mon->box, monPersonality, 1); + monBlockC = (PokemonDataBlockC *)GetBoxMonDataBlock(&mon->box, monPersonality, 2); + monBlockD = (PokemonDataBlockD *)GetBoxMonDataBlock(&mon->box, monPersonality, 3); + + DecryptMonData(&newMon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, newMon->box.checksum); + DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + + mon->box.personality = monPersonality; + + *monBlockA = *newMonBlockA; + *monBlockB = *newMonBlockB; + *monBlockC = *newMonBlockC; + *monBlockD = *newMonBlockD; + + mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4); + + EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Heap_FreeToHeap(newMon); +} + +static void LoadMonPersonalData (int monSpecies, PokemonPersonalData * monPersonalData) +{ + NARC_ReadWholeMemberByIndexPair(monPersonalData, NARC_INDEX_POKETOOL__PERSONAL__PL_PERSONAL, monSpecies); +} + +static void LoadMonFormPersonalData (int monSpecies, int monForm, PokemonPersonalData * monPersonalData) +{ + monSpecies = GetMonFormNarcIndex(monSpecies, monForm); + NARC_ReadWholeMemberByIndexPair(monPersonalData, NARC_INDEX_POKETOOL__PERSONAL__PL_PERSONAL, monSpecies); +} + +static void LoadMonEvolutionData (int monSpecies, PokemonEvolutionData * monEvolutionData) +{ + NARC_ReadWholeMemberByIndexPair(monEvolutionData, NARC_INDEX_POKETOOL__PERSONAL__EVO, monSpecies); +} + +static void EncryptMonData (void * data, u32 bytes, u32 seed) +{ + EncryptData(data, bytes, seed); +} + +static void DecryptMonData (void * data, u32 bytes, u32 seed) +{ + DecryptData(data, bytes, seed); +} + +static u16 GetMonDataChecksum (void * data, u32 bytes) +{ + int i; + u16 * dataWords = (u16 *)data; + u16 checksum = 0; + + for (i = 0; i < bytes / 2; i++) { + checksum += dataWords[i]; + } + + return checksum; +} + +static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataBlockID) +{ + void * result; + + personality = (personality & 0x3e000) >> 13; + + GF_ASSERT(personality <= 31); + + switch (personality) { + case 0: + case 24: + { + PokemonDataBlocksShuffle0 * dataBlocks = (PokemonDataBlocksShuffle0 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 1: + case 25: + { + PokemonDataBlockShuffle1 * dataBlocks = (PokemonDataBlockShuffle1 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 2: + case 26: + { + PokemonDataBlockShuffle2 * dataBlocks = (PokemonDataBlockShuffle2 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 3: + case 27: + { + PokemonDataBlockShuffle3 * dataBlocks = (PokemonDataBlockShuffle3 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 4: + case 28: + { + PokemonDataBlockShuffle4 * dataBlocks = (PokemonDataBlockShuffle4 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 5: + case 29: + { + PokemonDataBlockShuffle5 * dataBlocks = (PokemonDataBlockShuffle5 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 6: + case 30: + { + PokemonDataBlockShuffle6 * dataBlocks = (PokemonDataBlockShuffle6 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 7: + case 31: + { + PokemonDataBlockShuffle7 * dataBlocks = (PokemonDataBlockShuffle7 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 8: + { + PokemonDataBlockShuffle8 * dataBlocks = (PokemonDataBlockShuffle8 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 9: + { + PokemonDataBlockShuffle9 * dataBlocks = (PokemonDataBlockShuffle9 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 10: + { + PokemonDataBlockShuffle10 * dataBlocks = (PokemonDataBlockShuffle10 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 11: + { + PokemonDataBlockShuffle11 * dataBlocks = (PokemonDataBlockShuffle11 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 12: + { + PokemonDataBlockShuffle12 * dataBlocks = (PokemonDataBlockShuffle12 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 13: + { + PokemonDataBlockShuffle13 * dataBlocks = (PokemonDataBlockShuffle13 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 14: + { + PokemonDataBlockShuffle14 * dataBlocks = (PokemonDataBlockShuffle14 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 15: + { + PokemonDataBlockShuffle15 * dataBlocks = (PokemonDataBlockShuffle15 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 16: + { + PokemonDataBlockShuffle16 * dataBlocks = (PokemonDataBlockShuffle16 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 17: + { + PokemonDataBlockShuffle17 * dataBlocks = (PokemonDataBlockShuffle17 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 18: + { + PokemonDataBlockShuffle18 * dataBlocks = (PokemonDataBlockShuffle18 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 19: + { + PokemonDataBlockShuffle19 * dataBlocks = (PokemonDataBlockShuffle19 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 20: + { + PokemonDataBlockShuffle20 * dataBlocks = (PokemonDataBlockShuffle20 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 21: + { + PokemonDataBlockShuffle21 * dataBlocks = (PokemonDataBlockShuffle21 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 22: + { + PokemonDataBlockShuffle22 * dataBlocks = (PokemonDataBlockShuffle22 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + case 23: + { + PokemonDataBlockShuffle23 * dataBlocks = (PokemonDataBlockShuffle23 *)&boxMon->dataBlocks; + + switch (dataBlockID) { + case 0: + result = &dataBlocks->dataBlockA; + break; + case 1: + result = &dataBlocks->dataBlockB; + break; + case 2: + result = &dataBlocks->dataBlockC; + break; + case 3: + result = &dataBlocks->dataBlockD; + break; + } + break; + } + } + + return result; +} + +static int GetMonFormNarcIndex (int monSpecies, int monForm) +{ + switch (monSpecies) { + case SPECIES_DEOXYS: + if ((monForm) && (monForm <= 3)) { + monSpecies = (496 - 1) + monForm; + } + break; + case SPECIES_WORMADAM: + if ((monForm) && (monForm <= 2)) { + monSpecies = (499 - 1) + monForm; + } + break; + case SPECIES_GIRATINA: + if ((monForm) && (monForm <= 1)) { + monSpecies = (501 - 1) + monForm; + } + break; + case SPECIES_SHAYMIN: + if ((monForm) && (monForm <= 1)) { + monSpecies = (502 - 1) + monForm; + } + break; + case SPECIES_ROTOM: + if ((monForm) && (monForm <= 5)) { + monSpecies = (503 - 1) + monForm; + } + break; + default: + break; + } + + return monSpecies; +} + +u32 GetSingleBitMask (int index) +{ + int i; + u32 bitMask = 1; + + GF_ASSERT(index < 32); + + for (i = 0; i < index; i++) { + bitMask <<= 1; + } + + return bitMask; +} + +int GetLowestSetBitIndex (u32 num) +{ + int i; + u32 bit = 1; + + for (i = 0; i < 32; i++) { + if (num & bit) { + break; + } + + bit <<= 1; + } + + return i; +} + +static const u16 Unk_020F05BE[18] = { + 0x96, + 0x97, + 0xF9, + 0xFA, + 0xFB, + 0x17E, + 0x17F, + 0x180, + 0x181, + 0x182, + 0x1E3, + 0x1E4, + 0x1E7, + 0x1E9, + 0x1EA, + 0x1EB, + 0x1EC, + 0x1ED +}; + +BOOL sub_02078804 (u16 param0) +{ + u32 i; + + for (i = 0; i < NELEMS(Unk_020F05BE); i++) { + if (param0 == Unk_020F05BE[i]) { + return 1; + } + } + + return 0; +} + +u16 sub_02078824 (u8 index) +{ + if (index >= NELEMS(Unk_020F05BE)) { + index = 0; + } + + return Unk_020F05BE[index]; +} + +BOOL sub_02078838 (Pokemon * mon) +{ + u16 monSpecies = (u16)GetMonData(mon, MON_DATA_SPECIES, NULL); + return sub_02078804(monSpecies); +} + +BOOL sub_0207884C (BoxPokemon * boxMon, UnkStruct_02025E6C * param1, int heapID) +{ + u32 v0 = sub_02025F20(param1); + u32 monOTID = GetBoxMonData(boxMon, MON_DATA_OT_ID, NULL); + u32 v2 = sub_02025F30(param1); + u32 monOtGender = GetBoxMonData(boxMon, MON_DATA_OT_GENDER, NULL); + Strbuf* v4 = sub_02025F04(param1, heapID); + Strbuf* v5 = Strbuf_Init(8, heapID); + BOOL v6 = 0; + + GetBoxMonData(boxMon, MON_DATA_145, v5); + + if ((v0 == monOTID) && (v2 == monOtGender) && (Strbuf_Compare(v4, v5) == 0)) { + v6 = 1; + } + + Strbuf_Free(v5); + Strbuf_Free(v4); + + return v6; +} + +int sub_020788D0 (int param0) +{ + switch (param0) { + case 0: + case 1: + break; + case 63: + param0 = 2; + break; + case 90: + case 91: + case 92: + case 93: + case 94: + param0 = 3 + (param0 - 90); + break; + case 103: + case 104: + param0 = 8 + (param0 - 103); + break; + default: + if (sub_020793AC(param0) == 1) { + param0 = 1; + } else { + param0 = 0; + } + break; + } + + return param0; +} + +void sub_0207893C (Pokemon * mon) +{ + u8 zero; + UnkStruct_0202CA28 v1; + + zero = 0; + + MI_CpuClearFast(&v1, sizeof(UnkStruct_0202CA28)); + + SetMonData(mon, MON_DATA_162, (u8 *)&zero); + SetMonData(mon, MON_DATA_171, (UnkStruct_0202CA28 *)&v1); +} + +void sub_0207896C (BoxPokemon * boxMon) +{ + BOOL reencrypt; + int i; + + reencrypt = DecryptBoxMon(boxMon); + + for (i = 0; i < 4; i++) { + if (GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, NULL)) { + u8 moveMaxPP = GetBoxMonData(boxMon, MON_DATA_MOVE1_MAX_PP + i, NULL); + + SetBoxMonData(boxMon, MON_DATA_MOVE1_PP + i, &moveMaxPP); + } + } + + EncryptBoxMon(boxMon, reencrypt); +} + +static inline int GetLowestBitInverse (int num) +{ + int result; + + result = (num & 0x1) ? 0 : 1; + return result; +} + +void sub_020789BC (NARC * narc, UnkStruct_02007C10 * param1, u16 param2, u16 param3) +{ + UnkStruct_020789BC v0; + int v1; + + v1 = GetLowestBitInverse(param3); + + NARC_ReadFromMember(narc, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); + MI_CpuCopy8(&v0.unk_00[v1].unk_03[0], param1, sizeof(UnkStruct_02007C10) * 10); +} + +void sub_020789F4 (NARC * narc, UnkStruct_02015F84 * param1, UnkStruct_02007C7C * param2, u16 param3, int param4, int param5, int param6) +{ + UnkStruct_020789F4 v0; + UnkStruct_020789BC v1; + int v2; + int v3; + + v3 = (param4 == 2) ? 0 : 1; + + NARC_ReadFromMember(narc, 0, param3 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v1); + + v0.unk_00 = v1.unk_00[v3].unk_01; + v0.unk_02 = v1.unk_00[v3].unk_02; + v0.unk_04 = param5; + + sub_02015FCC(param1, param2, &v0, param6); +} + +void sub_02078A4C (NARC * narc, u8 * param1, u16 param2, u16 param3) +{ + UnkStruct_020789BC v0; + int v1; + + v1 = GetLowestBitInverse(param3); + NARC_ReadFromMember(narc, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); + + *param1 = v0.unk_00[v1].unk_00; +} + +void sub_02078A80 (NARC * narc, s8 * param1, u16 param2) +{ + UnkStruct_020789BC v0; + + NARC_ReadFromMember(narc, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); + *param1 = v0.unk_56; +} + +void sub_02078AA4 (NARC * narc, s8 * param1, u16 param2) +{ + UnkStruct_020789BC v0; + + NARC_ReadFromMember(narc, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); + *param1 = v0.unk_57; +} + +void sub_02078AC8 (NARC * narc, u8 * param1, u16 param2) +{ + UnkStruct_020789BC v0; + + NARC_ReadFromMember(narc, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); + *param1 = v0.unk_58; +} + +BOOL sub_02078AEC (int param0, Pokemon * mon, int heapID) +{ + int v0; + int one; + UnkStruct_0202CA28 v2; + NARC * narc; + + v0 = param0; + + if (v0 == 0) { + return 0; + } + + narc = NARC_ctor(NARC_INDEX_APPLICATION__CUSTOM_BALL__EDIT__PL_CB_DATA, heapID); + v0 = v0 - 1; + one = 1; + + NARC_ReadFromMember(narc, 0, v0 * sizeof(UnkStruct_0202CA28), sizeof(UnkStruct_0202CA28), &v2); + SetMonData(mon, MON_DATA_162, &one); + SetMonData(mon, MON_DATA_171, &v2); + NARC_dtor(narc); + + return 1; +} + +void sub_02078B40 (Pokemon * mon, UnkStruct_02078B40 * param1) +{ + BoxPokemon * boxMon; + PokemonDataBlockA * monDataBlockA; + PokemonDataBlockB * monDataBlockB; + PokemonDataBlockC * monDataBlockC; + PokemonDataBlockD * monDataBlockD; + int i; + u16 unused_0; + + if (mon->box.partyDecrypted == 0) { + DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + } + + boxMon = GetBoxMon(mon); + monDataBlockA = (PokemonDataBlockA *)GetBoxMonDataBlock(boxMon, boxMon->personality, 0); + monDataBlockB = (PokemonDataBlockB *)GetBoxMonDataBlock(boxMon, boxMon->personality, 1); + monDataBlockC = (PokemonDataBlockC *)GetBoxMonDataBlock(boxMon, boxMon->personality, 2); + monDataBlockD = (PokemonDataBlockD *)GetBoxMonDataBlock(boxMon, boxMon->personality, 3); + + param1->personality = boxMon->personality; + param1->partyDecrypted = 0; + param1->boxDecrypted = 0; + param1->invalidData = boxMon->invalidData; + param1->species = monDataBlockA->species; + param1->heldItem = monDataBlockA->heldItem; + param1->otID = monDataBlockA->otID; + param1->exp = monDataBlockA->exp; + param1->friendship = monDataBlockA->friendship; + param1->ability = monDataBlockA->ability; + param1->hpEV = monDataBlockA->hpEV; + param1->atkEV = monDataBlockA->atkEV; + param1->defEV = monDataBlockA->defEV; + param1->speedEV = monDataBlockA->speedEV; + param1->spAtkEV = monDataBlockA->spAtkEV; + param1->spDefEV = monDataBlockA->spDefEV; + param1->originLanguage = monDataBlockA->originLanguage; + + for (i = 0; i < 4; i++) { + param1->unk_1C[i] = monDataBlockB->unk_00[i]; + param1->unk_24[i] = monDataBlockB->unk_08[i]; + param1->unk_28[i] = monDataBlockB->unk_0C[i]; + } + + param1->hpIV = monDataBlockB->hpIV; + param1->atkIV = monDataBlockB->atkIV; + param1->defIV = monDataBlockB->defIV; + param1->speedIV = monDataBlockB->speedIV; + param1->spAtkIV = monDataBlockB->spAtkIV; + param1->spDefIV = monDataBlockB->spDefIV; + param1->isEgg = monDataBlockB->isEgg; + param1->unk_2C_31 = monDataBlockB->unk_10_31; + param1->fatefulEncounter = monDataBlockB->fatefulEncounter; + param1->gender = monDataBlockB->gender; + param1->form = monDataBlockB->form; + + for (i = 0; i < 10 + 1; i++) { + param1->unk_32[i] = monDataBlockC->unk_00[i]; + } + + for (i = 0; i < 7 + 1; i++) { + param1->unk_48[i] = monDataBlockD->unk_00[i]; + } + + param1->pokeball = monDataBlockD->pokeball; + + param1->unk_5C = mon->party.unk_00; + param1->level = mon->party.level; + param1->unk_61 = mon->party.unk_05; + param1->unk_62 = mon->party.unk_06; + param1->unk_64 = mon->party.unk_08; + param1->unk_66 = mon->party.unk_0A; + param1->unk_68 = mon->party.unk_0C; + param1->unk_6A = mon->party.unk_0E; + param1->unk_6C = mon->party.unk_10; + param1->unk_6E = mon->party.unk_12; + + if (mon->box.partyDecrypted == 0) { + EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + } +} + +void sub_02078E0C (UnkStruct_02078B40 * param0, Pokemon * mon) +{ + BoxPokemon * boxMon; + PokemonDataBlockA * monDataBlockA; + PokemonDataBlockB * monDataBlockB; + PokemonDataBlockC * monDataBlockC; + PokemonDataBlockD * monDataBlockD; + int i; + + MI_CpuClearFast(mon, sizeof(Pokemon)); + + boxMon = GetBoxMon(mon); + monDataBlockA = (PokemonDataBlockA *)GetBoxMonDataBlock(boxMon, param0->personality, 0); + monDataBlockB = (PokemonDataBlockB *)GetBoxMonDataBlock(boxMon, param0->personality, 1); + monDataBlockC = (PokemonDataBlockC *)GetBoxMonDataBlock(boxMon, param0->personality, 2); + monDataBlockD = (PokemonDataBlockD *)GetBoxMonDataBlock(boxMon, param0->personality, 3); + + boxMon->personality = param0->personality; + boxMon->partyDecrypted = 0; + boxMon->boxDecrypted = 0; + boxMon->invalidData = param0->invalidData; + + monDataBlockA->species = param0->species; + monDataBlockA->heldItem = param0->heldItem; + monDataBlockA->otID = param0->otID; + monDataBlockA->exp = param0->exp; + monDataBlockA->friendship = param0->friendship; + monDataBlockA->ability = param0->ability; + monDataBlockA->hpEV = param0->hpEV; + monDataBlockA->atkEV = param0->atkEV; + monDataBlockA->defEV = param0->defEV; + monDataBlockA->speedEV = param0->speedEV; + monDataBlockA->spAtkEV = param0->spAtkEV; + monDataBlockA->spDefEV = param0->spDefEV; + monDataBlockA->originLanguage = param0->originLanguage; + + for (i = 0; i < 4; i++) { + monDataBlockB->unk_00[i] = param0->unk_1C[i]; + monDataBlockB->unk_08[i] = param0->unk_24[i]; + monDataBlockB->unk_0C[i] = param0->unk_28[i]; + } + + monDataBlockB->hpIV = param0->hpIV; + monDataBlockB->atkIV = param0->atkIV; + monDataBlockB->defIV = param0->defIV; + monDataBlockB->speedIV = param0->speedIV; + monDataBlockB->spAtkIV = param0->spAtkIV; + monDataBlockB->spDefIV = param0->spDefIV; + monDataBlockB->isEgg = param0->isEgg; + monDataBlockB->unk_10_31 = param0->unk_2C_31; + monDataBlockB->fatefulEncounter = param0->fatefulEncounter; + monDataBlockB->gender = param0->gender; + monDataBlockB->form = param0->form; + + for (i = 0; i < 10 + 1; i++) { + monDataBlockC->unk_00[i] = param0->unk_32[i]; + } + + for (i = 0; i < 7 + 1; i++) { + monDataBlockD->unk_00[i] = param0->unk_48[i]; + } + + monDataBlockD->pokeball = param0->pokeball; + + mon->party.unk_00 = param0->unk_5C; + mon->party.level = param0->level; + mon->party.unk_05 = param0->unk_61; + mon->party.unk_06 = param0->unk_62; + mon->party.unk_08 = param0->unk_64; + mon->party.unk_0A = param0->unk_66; + mon->party.unk_0C = param0->unk_68; + mon->party.unk_0E = param0->unk_6A; + mon->party.unk_10 = param0->unk_6C; + mon->party.unk_12 = param0->unk_6E; + + EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4); + EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); +} diff --git a/src/roaming_pokemon.c b/src/roaming_pokemon.c index 301a7a4a70..3173eb8f6c 100644 --- a/src/roaming_pokemon.c +++ b/src/roaming_pokemon.c @@ -17,7 +17,7 @@ #include "unk_02025E68.h" #include "unk_0202D7A8.h" #include "roaming_pokemon.h" -#include "unk_02073C2C.h" +#include "pokemon.h" typedef struct { u16 unk_00; @@ -297,9 +297,9 @@ void RoamingPokemon_ActivateSlot (UnkStruct_021C0794 * saveData, const u8 slot) sub_02073D80(v0, species, level, 32, 0, 0, 1, sub_02025F24(v4)); sub_0202D980(v1, 7, 0); sub_0202D980(v1, 8, 1); - sub_0202D980(v1, 2, GetMonData(v0, MON_DATA_175, NULL)); + sub_0202D980(v1, 2, GetMonData(v0, MON_DATA_COMBINED_IVS, NULL)); sub_0202D980(v1, 3, GetMonData(v0, MON_DATA_PERSONALITY, NULL)); - sub_0202D980(v1, 5, GetMonData(v0, MON_DATA_164, NULL)); + sub_0202D980(v1, 5, GetMonData(v0, MON_DATA_MAX_HP, NULL)); Heap_FreeToHeap(v0); previouslyVisitedMap = sub_0202D8BC(v2); diff --git a/src/unk_0200B358.c b/src/unk_0200B358.c index 6f7ec54707..683b0c7e3b 100644 --- a/src/unk_0200B358.c +++ b/src/unk_0200B358.c @@ -24,7 +24,7 @@ #include "unk_02025E68.h" #include "unk_020277A4.h" #include "unk_0202B37C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "unk_020996D0.h" @@ -209,7 +209,7 @@ void sub_0200B538 (UnkStruct_0200B358 * param0, u32 param1, BoxPokemon * param2) u32 v1; v0 = MessageLoader_Init(1, 26, 412, param0->unk_04); - v1 = sub_02074570(param2, MON_DATA_SPECIES, NULL); + v1 = GetBoxMonData(param2, MON_DATA_SPECIES, NULL); MessageLoader_GetStrbuf(v0, v1, param0->unk_0C); sub_0200B448(param0, param1, param0->unk_0C, NULL); @@ -220,7 +220,7 @@ void sub_0200B578 (UnkStruct_0200B358 * param0, u32 param1, BoxPokemon * param2) { u32 v0; - v0 = sub_02074570(param2, MON_DATA_SPECIES, NULL); + v0 = GetBoxMonData(param2, MON_DATA_SPECIES, NULL); sub_0200B594(param0, param1, v0); } @@ -237,13 +237,13 @@ void sub_0200B594 (UnkStruct_0200B358 * param0, u32 param1, u32 param2) void sub_0200B5CC (UnkStruct_0200B358 * param0, u32 param1, BoxPokemon * param2) { - sub_02074570(param2, MON_DATA_119, param0->unk_0C); + GetBoxMonData(param2, MON_DATA_119, param0->unk_0C); sub_0200B448(param0, param1, param0->unk_0C, NULL); } void sub_0200B5EC (UnkStruct_0200B358 * param0, u32 param1, BoxPokemon * param2) { - sub_02074570(param2, MON_DATA_145, param0->unk_0C); + GetBoxMonData(param2, MON_DATA_145, param0->unk_0C); sub_0200B448(param0, param1, param0->unk_0C, NULL); } diff --git a/src/unk_0200DA60.c b/src/unk_0200DA60.c index 8b6a727324..98b072295f 100644 --- a/src/unk_0200DA60.c +++ b/src/unk_0200DA60.c @@ -32,7 +32,7 @@ #include "unk_0201CCF0.h" #include "gx_layers.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay005/ov5_021D2F14.h" typedef struct { diff --git a/src/unk_0201D15C.c b/src/unk_0201D15C.c index fd8381f137..5fbc8982f9 100644 --- a/src/unk_0201D15C.c +++ b/src/unk_0201D15C.c @@ -229,19 +229,19 @@ u32 sub_0201D5B8 (const void * param0, u32 param1) return v0; } -void sub_0201D5D4 (void * param0, u32 param1, u32 param2) +void EncryptData (void * data, u32 bytes, u32 seed) { - int v0; - u16 * v1 = (u16 *)param0; + int i; + u16 * dataWords = (u16 *)data; - for (v0 = 0; v0 < param1 / 2; v0++) { - v1[v0] ^= LCRNG_NextFrom(¶m2); + for (i = 0; i < bytes / 2; i++) { + dataWords[i] ^= LCRNG_NextFrom(&seed); } } -void sub_0201D600 (void * param0, u32 param1, u32 param2) +void DecryptData (void * data, u32 bytes, u32 seed) { - sub_0201D5D4(param0, param1, param2); + EncryptData(data, bytes, seed); } static u16 LCRNG_NextFrom (u32 * seed) diff --git a/src/unk_020261E4.c b/src/unk_020261E4.c index f755549fba..f40fb577e3 100644 --- a/src/unk_020261E4.c +++ b/src/unk_020261E4.c @@ -8,7 +8,7 @@ #include "unk_020244AC.h" #include "unk_020261E4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" typedef struct UnkStruct_02026224_t { UnkStruct_0202818C unk_00; @@ -114,8 +114,8 @@ BOOL sub_02026280 (UnkStruct_02026310 * param0) { int v0, v1; - v0 = sub_02074570(¶m0->unk_00[0].unk_00, MON_DATA_LANGUAGE, NULL); - v1 = sub_02074570(¶m0->unk_00[1].unk_00, MON_DATA_LANGUAGE, NULL); + v0 = GetBoxMonData(¶m0->unk_00[0].unk_00, MON_DATA_LANGUAGE, NULL); + v1 = GetBoxMonData(¶m0->unk_00[1].unk_00, MON_DATA_LANGUAGE, NULL); if (v0 != v1) { return 1; diff --git a/src/unk_0202631C.c b/src/unk_0202631C.c index 2f0950731d..979beba0c0 100644 --- a/src/unk_0202631C.c +++ b/src/unk_0202631C.c @@ -9,7 +9,7 @@ #include "heap.h" #include "unk_020244AC.h" #include "unk_0202631C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020986CC.h" typedef struct UnkStruct_02026324_t { @@ -571,7 +571,7 @@ static void sub_02026A60 (UnkStruct_02026324 * param0, u16 param1, Pokemon * par switch (param1) { case 201: - v0 = sub_02076AF8(param2); + v0 = GetMonForm(param2); sub_0202643C(param0, v0); break; case 412: @@ -630,7 +630,7 @@ static u32 sub_02026BAC (const UnkStruct_02026324 * param0, u16 param1, int para u32 v0, v1; u32 v2; - if (sub_020759F0(param1, 18) == 255) { + if (GetMonSpeciesPersonalDataAttribute(param1, 18) == 255) { if (param2 == 0) { return 2; } else { @@ -1071,7 +1071,7 @@ void sub_020272A4 (UnkStruct_02026324 * param0, Pokemon * param1) { u16 v0 = GetMonData(param1, MON_DATA_SPECIES, NULL); u32 v1 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); - u32 v2 = sub_02075D6C(param1); + u32 v2 = GetMonGender(param1); u32 v3; inline_02026DD0(param0); @@ -1100,7 +1100,7 @@ void sub_0202736C (UnkStruct_02026324 * param0, Pokemon * param1) u16 v0 = GetMonData(param1, MON_DATA_SPECIES, NULL); u32 v1 = GetMonData(param1, MON_DATA_LANGUAGE, NULL); u32 v2 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); - u32 v3 = sub_02075D6C(param1); + u32 v3 = GetMonGender(param1); u32 v4; inline_02026DD0(param0); diff --git a/src/unk_02028124.c b/src/unk_02028124.c index b1a332e314..931af34f51 100644 --- a/src/unk_02028124.c +++ b/src/unk_02028124.c @@ -18,7 +18,7 @@ #include "unk_02025E08.h" #include "unk_02025E68.h" #include "unk_02028124.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "party.h" diff --git a/src/unk_020298BC.c b/src/unk_020298BC.c index 3af3807f9e..4313a33b5a 100644 --- a/src/unk_020298BC.c +++ b/src/unk_020298BC.c @@ -20,7 +20,7 @@ #include "strbuf.h" #include "unk_020244AC.h" #include "unk_020298BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay022/ov22_02259098.h" typedef struct UnkStruct_0202A138_t { @@ -154,8 +154,8 @@ static void sub_020299C0 (UnkStruct_0202A138 * param0, const Strbuf *param1, int static void sub_020299D8 (const UnkStruct_0202A138 * param0, Pokemon * param1) { sub_02073D80(param1, param0->unk_08, 0, 0, 1, param0->unk_00, 1, param0->unk_04); - sub_02074B30(param1, 117, param0->unk_0A); - sub_02074B30(param1, 112, ¶m0->unk_33); + SetMonData(param1, 117, param0->unk_0A); + SetMonData(param1, 112, ¶m0->unk_33); } static void sub_02029A18 (UnkStruct_0202A150 * param0, u8 param1, u8 param2, u8 param3, u8 param4) diff --git a/src/unk_0202CD50.c b/src/unk_0202CD50.c index 1ca0384162..f4ba9acb16 100644 --- a/src/unk_0202CD50.c +++ b/src/unk_0202CD50.c @@ -49,7 +49,7 @@ static void sub_0202CD94 (UnkStruct_0202CD88 * param0, int param1) } param0->unk_1B8.unk_00 = sub_0201D5B8(¶m0->unk_00[1], sizeof(UnkStruct_0202CD88) - sizeof(UnkStruct_0202CD88_sub1) - sizeof(u32)) & 0xffff; - sub_0201D5D4(¶m0->unk_00[1], sizeof(UnkStruct_0202CD88) - sizeof(UnkStruct_0202CD88_sub1) - sizeof(u32), param0->unk_1B8.unk_00 + (param0->unk_1B8.unk_02 << 16)); + EncryptData(¶m0->unk_00[1], sizeof(UnkStruct_0202CD88) - sizeof(UnkStruct_0202CD88_sub1) - sizeof(u32), param0->unk_1B8.unk_00 + (param0->unk_1B8.unk_02 << 16)); } static void sub_0202CDC0 (UnkStruct_0202CD88 * param0, int param1) @@ -58,7 +58,7 @@ static void sub_0202CDC0 (UnkStruct_0202CD88 * param0, int param1) return; } - sub_0201D600(¶m0->unk_00[1], sizeof(UnkStruct_0202CD88) - sizeof(UnkStruct_0202CD88_sub1) - sizeof(u32), param0->unk_1B8.unk_00 + (param0->unk_1B8.unk_02 << 16)); + DecryptData(¶m0->unk_00[1], sizeof(UnkStruct_0202CD88) - sizeof(UnkStruct_0202CD88_sub1) - sizeof(u32), param0->unk_1B8.unk_00 + (param0->unk_1B8.unk_02 << 16)); } static u32 sub_0202CDE0 (const UnkStruct_0202CD88 * param0, int param1) diff --git a/src/unk_0202DF8C.c b/src/unk_0202DF8C.c index 48edc3347f..c527becb2b 100644 --- a/src/unk_0202DF8C.c +++ b/src/unk_0202DF8C.c @@ -14,7 +14,7 @@ #include "strbuf.h" #include "unk_0202DF8C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" static int inline inline_0202E1A8(const UnkStruct_0202DF8C * param0, int param1); @@ -52,11 +52,11 @@ void sub_0202DFA8 (UnkStruct_0202DF8C * param0, const Party * param1, const RTCD for (v4 = 0, v5 = 0; v4 < v3; v4++) { v1 = Party_GetPokemonBySlotIndex(param1, v4); - v6 = sub_02073C88(v1); + v6 = DecryptMon(v1); if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { v0->unk_00[v5].unk_00 = GetMonData(v1, MON_DATA_SPECIES, NULL); - v0->unk_00[v5].unk_02 = GetMonData(v1, MON_DATA_161, NULL); + v0->unk_00[v5].unk_02 = GetMonData(v1, MON_DATA_LEVEL, NULL); v0->unk_00[v5].unk_03 = GetMonData(v1, MON_DATA_FORM, NULL); v0->unk_00[v5].unk_04 = GetMonData(v1, MON_DATA_PERSONALITY, NULL); v0->unk_00[v5].unk_08 = GetMonData(v1, MON_DATA_OT_ID, NULL); @@ -79,7 +79,7 @@ void sub_0202DFA8 (UnkStruct_0202DF8C * param0, const Party * param1, const RTCD v5++; } - sub_02073CD4(v1, v6); + EncryptMon(v1, v6); } v0->unk_168 = param2->year; diff --git a/src/unk_0202EEC0.c b/src/unk_0202EEC0.c index 5ec35e3b67..76bbe443ab 100644 --- a/src/unk_0202EEC0.c +++ b/src/unk_0202EEC0.c @@ -6,7 +6,7 @@ #include "unk_0201378C.h" #include "unk_0202EEC0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" typedef struct UnkStruct_02024440_t { Pokemon unk_00[6]; diff --git a/src/unk_0202F180.c b/src/unk_0202F180.c index 2d35e19d94..a07f43509b 100644 --- a/src/unk_0202F180.c +++ b/src/unk_0202F180.c @@ -10,7 +10,7 @@ #include "unk_0202CD50.h" #include "unk_0202F180.h" #include "unk_02056720.h" -#include "unk_02073C2C.h" +#include "pokemon.h" void sub_0202F180 (UnkStruct_021C0794 * param0, const Pokemon * param1) { diff --git a/src/unk_0202F1D4.c b/src/unk_0202F1D4.c index 41e788b6db..2fe5407d79 100644 --- a/src/unk_0202F1D4.c +++ b/src/unk_0202F1D4.c @@ -29,7 +29,7 @@ #include "unk_0202631C.h" #include "unk_020279FC.h" #include "unk_0202F1D4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" UnkStruct_0202F264 * Unk_021C07A4 = NULL; @@ -302,9 +302,9 @@ static void sub_0202F510 (UnkStruct_021C0794 * param0, UnkStruct_0202F41C * para for (v1 = 0; v1 < v3; v1++) { v7 = &(param2->unk_1150[v5].unk_04[v1]); - if ((v7->unk_2C_30 == 0) && (v7->unk_04_2 == 0)) { - param1->unk_00[v4] = v7->unk_06; - param1->unk_18[v4] = v7->unk_30_3; + if ((v7->isEgg == 0) && (v7->invalidData == 0)) { + param1->unk_00[v4] = v7->species; + param1->unk_18[v4] = v7->form; } v4++; @@ -393,11 +393,11 @@ static BOOL sub_0202F794 (UnkStruct_021C0794 * param0, const UnkStruct_0202F264 for (v4 = 0; v4 < 6; v4++) { v6 = &(v0->unk_1150[v3].unk_04[v4]); - if (v6->unk_06 > 495) { + if (v6->species > 495) { return 0; } - if (v6->unk_08 > 467) { + if (v6->heldItem > 467) { return 0; } @@ -415,12 +415,12 @@ static BOOL sub_0202F794 (UnkStruct_021C0794 * param0, const UnkStruct_0202F264 void sub_0202F858 (void * param0, u32 param1, u32 param2) { - sub_0201D5D4(param0, param1, param2); + EncryptData(param0, param1, param2); } static void sub_0202F860 (void * param0, u32 param1, u32 param2) { - sub_0201D600(param0, param1, param2); + DecryptData(param0, param1, param2); } void sub_0202F868 (int param0, int param1, u8 param2) @@ -607,7 +607,7 @@ static void sub_0202FD30 (UnkStruct_0202FD30 * param0, Party * param1) for (v0 = 0; v0 < param0->unk_02; v0++) { sub_02078E0C(¶m0->unk_04[v0], v1); - sub_02074B30(v1, 162, &v2); + SetMonData(v1, 162, &v2); Party_AddPokemon(param1, v1); } diff --git a/src/unk_02030A80.c b/src/unk_02030A80.c index 8ac5086b6e..0c820a723b 100644 --- a/src/unk_02030A80.c +++ b/src/unk_02030A80.c @@ -25,7 +25,7 @@ #include "unk_0202C858.h" #include "unk_02030A80.h" #include "unk_0205C980.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020996D0.h" UnkStruct_02030A80 * sub_02030A80 (int param0) diff --git a/src/unk_0203A9C8.c b/src/unk_0203A9C8.c index efbe7d9f5f..df8f65406b 100644 --- a/src/unk_0203A9C8.c +++ b/src/unk_0203A9C8.c @@ -90,7 +90,7 @@ #include "unk_0207064C.h" #include "unk_0207070C.h" #include "unk_02071D40.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207A274.h" #include "unk_0207AE68.h" diff --git a/src/unk_0203D1B8.c b/src/unk_0203D1B8.c index 62a7acd97f..d86e7189a2 100644 --- a/src/unk_0203D1B8.c +++ b/src/unk_0203D1B8.c @@ -108,7 +108,7 @@ #include "unk_0206AFE0.h" #include "unk_0206B70C.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207A274.h" #include "unk_0207AE68.h" @@ -1004,8 +1004,8 @@ static void sub_0203DB38 (UnkStruct_ov88_0223C370 * param0, UnkStruct_0203CDB0 * param0->unk_1C = param1->unk_9C; param0->unk_20 = sub_0202CD88(param1->unk_0C); param0->unk_38 = Heap_AllocFromHeap(32, sub_02025E68()); - param0->unk_3C = Heap_AllocFromHeap(32, sub_02076AF0()); - param0->unk_40 = Heap_AllocFromHeap(32, sub_02076AF0()); + param0->unk_3C = Heap_AllocFromHeap(32, GetPokemonStructSize()); + param0->unk_40 = Heap_AllocFromHeap(32, GetPokemonStructSize()); param0->unk_00 = param1; param0->unk_34 = 0; } @@ -1060,8 +1060,8 @@ BOOL sub_0203DBF0 (UnkStruct_020508D4 * param0) break; case 4: v2->unk_48.unk_08 = v2->unk_04.unk_38; - v2->unk_48.unk_00 = sub_02076B10(v2->unk_04.unk_3C); - v2->unk_48.unk_04 = sub_02076B10(v2->unk_04.unk_40); + v2->unk_48.unk_00 = GetBoxMon(v2->unk_04.unk_3C); + v2->unk_48.unk_04 = GetBoxMon(v2->unk_04.unk_40); v2->unk_48.unk_14 = sub_02025E44(v1->unk_0C); v2->unk_48.unk_10 = 1; @@ -1265,7 +1265,7 @@ static void sub_0203DF68 (UnkStruct_020508D4 * param0) int v4; v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v1->unk_04); - sub_02074B30(v3, 118, (u8 *)&v1->unk_0C->unk_1C); + SetMonData(v3, 118, (u8 *)&v1->unk_0C->unk_1C); } break; case 5: @@ -1300,7 +1300,7 @@ void sub_0203DFE8 (UnkStruct_020508D4 * param0, int param1, int param2, int para switch (param1) { case 1: v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v1->unk_0C), v2->unk_04); - v2->unk_0C->unk_10 = GetMonData(v0, MON_DATA_111, NULL); + v2->unk_0C->unk_10 = GetMonData(v0, MON_DATA_GENDER, NULL); v2->unk_0C->unk_08 = GetMonData(v0, MON_DATA_FORM, NULL); if (param5 != NULL) { diff --git a/src/unk_0203F6C4.c b/src/unk_0203F6C4.c index 088cfd7e79..fd889ff8c0 100644 --- a/src/unk_0203F6C4.c +++ b/src/unk_0203F6C4.c @@ -185,7 +185,7 @@ #include "unk_02071CD0.h" #include "unk_02071D40.h" #include "unk_020722AC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079170.h" #include "unk_020797C8.h" #include "party.h" @@ -3632,7 +3632,7 @@ static BOOL sub_0204174C (UnkStruct_0203E724 * param0) u16 * v2 = inline_0204FCAC(param0); v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v1); - *v2 = sub_02076AF8(v0); + *v2 = GetMonForm(v0); return 0; } @@ -7026,8 +7026,8 @@ static BOOL sub_02045384 (UnkStruct_0203E724 * param0) v3 = GetMonData(v5, MON_DATA_SPECIES, NULL); if (v3 == 386) { - sub_02074B30(v5, 112, &v0); - sub_0207418C(v5); + SetMonData(v5, 112, &v0); + CalculateMonLevelAndStats(v5); sub_0202736C(v6, v5); } } @@ -7049,7 +7049,7 @@ static BOOL sub_02045404 (UnkStruct_0203E724 * param0) for (v1 = 0; v1 < v9; v1++) { v0 = Party_GetPokemonBySlotIndex(v8, v1); v2 = GetMonData(v0, MON_DATA_SPECIES, NULL); - v6 = GetMonData(v0, MON_DATA_111, NULL); + v6 = GetMonData(v0, MON_DATA_GENDER, NULL); v5 = GetMonData(v0, MON_DATA_IS_EGG, NULL); if ((v2 == 415) && (v5 == 0)) { @@ -8313,8 +8313,8 @@ static u32 sub_0204676C (UnkStruct_021C0794 * param0) v7 = sub_02026218(v6, v0); v2 = sub_02026220(v7); - if ((sub_02074570(v2, 5, NULL) == 479) && (sub_02074570(v2, MON_DATA_IS_EGG, NULL) == 0)) { - v3 |= 1 << sub_02074570(v2, MON_DATA_FORM, NULL); + if ((GetBoxMonData(v2, 5, NULL) == 479) && (GetBoxMonData(v2, MON_DATA_IS_EGG, NULL) == 0)) { + v3 |= 1 << GetBoxMonData(v2, MON_DATA_FORM, NULL); } } } @@ -8329,8 +8329,8 @@ static u32 sub_0204676C (UnkStruct_021C0794 * param0) for (v0 = 0; v0 < (5 * 6); v0++) { v2 = sub_02079C9C(v8, v9, v0); - if ((sub_02074570(v2, 5, NULL) == 479) && (sub_02074570(v2, MON_DATA_IS_EGG, NULL) == 0)) { - v3 |= 1 << sub_02074570(v2, MON_DATA_FORM, NULL); + if ((GetBoxMonData(v2, 5, NULL) == 479) && (GetBoxMonData(v2, MON_DATA_IS_EGG, NULL) == 0)) { + v3 |= 1 << GetBoxMonData(v2, MON_DATA_FORM, NULL); } } } @@ -8455,7 +8455,7 @@ static BOOL sub_020469D0 (UnkStruct_0203E724 * param0) u16 v2 = inline_02049538(param0); v1 = Party_GetFromSavedata(param0->unk_34->unk_0C); - sub_02077A9C(v1, v2); + SetPartyGiratinaForm(v1, v2); { int v3, v4; Pokemon * v5; diff --git a/src/unk_020474B8.c b/src/unk_020474B8.c index ccef5b9516..214ed80d0f 100644 --- a/src/unk_020474B8.c +++ b/src/unk_020474B8.c @@ -31,7 +31,7 @@ #include "unk_0205DFC4.h" #include "unk_0206AFE0.h" #include "unk_02071CFC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "party.h" #include "item.h" diff --git a/src/unk_020480A8.c b/src/unk_020480A8.c index 5dfc4c6d03..23180542bf 100644 --- a/src/unk_020480A8.c +++ b/src/unk_020480A8.c @@ -16,7 +16,7 @@ #include "unk_020480A8.h" #include "unk_020507CC.h" #include "unk_0206AFE0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "party.h" @@ -71,11 +71,11 @@ BOOL sub_020480D8 (UnkStruct_0203E724 * param0) for (v13 = 0, v14 = 0, v18 = 0; v18 < 18; v18++) { for (v17 = 0; v17 < (5 * 6); v17++) { v2 = sub_02079C9C(v3, v18, v17); - v19 = sub_02074570(v2, MON_DATA_SPECIES, NULL); + v19 = GetBoxMonData(v2, MON_DATA_SPECIES, NULL); if (v19) { - if (sub_02074570(v2, MON_DATA_IS_EGG, NULL) == 0) { - v15 = (sub_02074570(v2, MON_DATA_OT_ID, NULL) & 0xffff); + if (GetBoxMonData(v2, MON_DATA_IS_EGG, NULL) == 0) { + v15 = (GetBoxMonData(v2, MON_DATA_OT_ID, NULL) & 0xffff); v16 = sub_02048268(v7, v15); diff --git a/src/unk_02048DD8.c b/src/unk_02048DD8.c index 16c8bdf637..7f7c37c4c8 100644 --- a/src/unk_02048DD8.c +++ b/src/unk_02048DD8.c @@ -37,7 +37,7 @@ #include "unk_02054884.h" #include "unk_02056720.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay006/ov6_022465FC.h" #include "overlay006/ov6_02246A30.h" @@ -290,7 +290,7 @@ static void sub_02049268 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * para Party * v0 = Party_GetFromSavedata(param0->unk_0C); Pokemon * v1 = sub_02054A74(v0); - sub_0200B538(param1, 0, sub_02076B10(v1)); + sub_0200B538(param1, 0, GetBoxMon(v1)); } static void sub_02049288 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param1) diff --git a/src/unk_02049D08.c b/src/unk_02049D08.c index 5094645b74..bac7ef8bee 100644 --- a/src/unk_02049D08.c +++ b/src/unk_02049D08.c @@ -41,7 +41,7 @@ #include "unk_0206AFE0.h" #include "unk_0206B9D8.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" typedef struct { @@ -964,7 +964,7 @@ static u16 sub_0204AC54 (UnkStruct_021C0794 * param0, u8 param1, UnkStruct_0204A continue; } - sub_02074B30(v4, param1, &v0); + SetMonData(v4, param1, &v0); sub_0206DDB8(param0, v4, param1); ++v1; } @@ -1004,19 +1004,19 @@ static void sub_0204ACFC (UnkStruct_ov104_0223A348_sub2 * param0, Pokemon * para for (v0 = 0; v0 < 4; v0++) { param0->unk_04[v0] = GetMonData(param1, MON_DATA_MOVE1 + v0, NULL); - param0->unk_1E_val2 |= ((GetMonData(param1, MON_DATA_62 + v0, NULL))<< (v0 * 2)); + param0->unk_1E_val2 |= ((GetMonData(param1, MON_DATA_MOVE1_PP_UPS + v0, NULL))<< (v0 * 2)); } param0->unk_1F = GetMonData(param1, MON_DATA_LANGUAGE, NULL); param0->unk_0C = GetMonData(param1, MON_DATA_OT_ID, NULL); param0->unk_10 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); - param0->unk_14_val2 = GetMonData(param1, MON_DATA_175, NULL); + param0->unk_14_val2 = GetMonData(param1, MON_DATA_COMBINED_IVS, NULL); for (v0 = 0; v0 < 6; v0++) { param0->unk_18_val2[v0] = GetMonData(param1, MON_DATA_HP_EV + v0, NULL); } - param0->unk_20 = GetMonData(param1, MON_DATA_10, NULL); + param0->unk_20 = GetMonData(param1, MON_DATA_ABILITY, NULL); param0->unk_21 = GetMonData(param1, MON_DATA_FRIENDSHIP, NULL); GetMonData(param1, MON_DATA_117, param0->unk_22); diff --git a/src/unk_0204AEE8.c b/src/unk_0204AEE8.c index 936b78feca..01625a2c6e 100644 --- a/src/unk_0204AEE8.c +++ b/src/unk_0204AEE8.c @@ -32,7 +32,7 @@ #include "unk_02034198.h" #include "unk_02049D08.h" #include "unk_0204AEE8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" static BOOL sub_0204B470(UnkStruct_0204AFC4 * param0, UnkStruct_0204B184 * param1, u16 param2, UnkStruct_ov104_0223A348_sub2 * param3, u8 param4, u16 * param5, u16 * param6, UnkStruct_0204B404 * param7, int param8); @@ -345,7 +345,7 @@ static u32 sub_0204B1E8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348_s if (param4 == 0) { do { v2 = (sub_0204AEC0(param0) | sub_0204AEC0(param0) << 16); - } while ((v4.unk_0B != GetNatureFromPersonality(v2)) || (sub_02075E38(param3, v2) == 1)); + } while ((v4.unk_0B != GetNatureFromPersonality(v2)) || (GetMonPersonalityShininess(param3, v2) == 1)); param1->unk_10 = v2; } else { @@ -363,7 +363,7 @@ static u32 sub_0204B1E8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348_s v1 = 0; for (v0 = 0; v0 < 6; v0++) { - if (v4.unk_0A & FlagIndex(v0)) { + if (v4.unk_0A & GetSingleBitMask(v0)) { v1++; } } @@ -375,7 +375,7 @@ static u32 sub_0204B1E8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348_s } for (v0 = 0; v0 < 6; v0++) { - if (v4.unk_0A & FlagIndex(v0)) { + if (v4.unk_0A & GetSingleBitMask(v0)) { param1->unk_18_val2[v0] = v1; } } @@ -383,16 +383,16 @@ static u32 sub_0204B1E8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348_s param1->unk_1E_val2 = 0; param1->unk_1F = Unk_020E4C44; - v0 = sub_020759F0(param1->unk_00_val1_0, 25); + v0 = GetMonSpeciesPersonalDataAttribute(param1->unk_00_val1_0, 25); if (v0) { if (param1->unk_10 & 1) { param1->unk_20 = v0; } else { - param1->unk_20 = sub_020759F0(param1->unk_00_val1_0, 24); + param1->unk_20 = GetMonSpeciesPersonalDataAttribute(param1->unk_00_val1_0, 24); } } else { - param1->unk_20 = sub_020759F0(param1->unk_00_val1_0, 24); + param1->unk_20 = GetMonSpeciesPersonalDataAttribute(param1->unk_00_val1_0, 24); } param1->unk_21 = v3; diff --git a/src/unk_0204B830.c b/src/unk_0204B830.c index c49d81810d..f3b138d2d1 100644 --- a/src/unk_0204B830.c +++ b/src/unk_0204B830.c @@ -39,7 +39,7 @@ #include "unk_02054884.h" #include "unk_02056720.h" #include "unk_0206AFE0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "unk_020923C0.h" @@ -210,7 +210,7 @@ static void sub_0204BAAC (UnkStruct_0203CDB0 * param0, void * param1) if (v8 == 0x0) { (void)0; } else if (v8 == 0x1) { - while (sub_02075E38(v7, v9)) { + while (GetMonPersonalityShininess(v7, v9)) { v9 = ARNG_Next(v9); } } else { @@ -218,32 +218,32 @@ static void sub_0204BAAC (UnkStruct_0203CDB0 * param0, void * param1) } sub_020780C4(v4, v9); - v10 = sub_02075D6C(v4); + v10 = GetMonGender(v4); - sub_02074B30(v4, 111, (u8 *)&v10); + SetMonData(v4, 111, (u8 *)&v10); v10 = GetMonData(v4, MON_DATA_HP_IV, 0) + GetMonData(v4, MON_DATA_ATK_IV, 0) + GetMonData(v4, MON_DATA_DEF_IV, 0) + GetMonData(v4, MON_DATA_SPEED_IV, 0) + GetMonData(v4, MON_DATA_SPATK_IV, 0) + GetMonData(v4, MON_DATA_SPDEF_IV, 0); if (v10 == 0) { v8 = LCRNG_Next(); v9 = (v8 & (0x1F << 0)) >> 0; - sub_02074B30(v4, 70, (u8 *)&v9); + SetMonData(v4, 70, (u8 *)&v9); v9 = (v8 & (0x1F << 5)) >> 5; - sub_02074B30(v4, 71, (u8 *)&v9); + SetMonData(v4, 71, (u8 *)&v9); v9 = (v8 & (0x1F << 10)) >> 10; - sub_02074B30(v4, 72, (u8 *)&v9); + SetMonData(v4, 72, (u8 *)&v9); v8 = LCRNG_Next(); v9 = (v8 & (0x1F << 0)) >> 0; - sub_02074B30(v4, 73, (u8 *)&v9); + SetMonData(v4, 73, (u8 *)&v9); v9 = (v8 & (0x1F << 5)) >> 5; - sub_02074B30(v4, 74, (u8 *)&v9); + SetMonData(v4, 74, (u8 *)&v9); v9 = (v8 & (0x1F << 10)) >> 10; - sub_02074B30(v4, 75, (u8 *)&v9); + SetMonData(v4, 75, (u8 *)&v9); } v13 = sub_0202D79C(param0->unk_0C); @@ -296,9 +296,9 @@ static void sub_0204BAAC (UnkStruct_0203CDB0 * param0, void * param1) v6 = AllocMonZeroed(32); sub_020775EC(v4, v6); - sub_02074B30(v6, 145, v15); - sub_02074B30(v6, 7, &v16); - sub_02074B30(v6, 157, &v17); + SetMonData(v6, 145, v15); + SetMonData(v6, 7, &v16); + SetMonData(v6, 157, &v17); v4 = v6; Strbuf_Free(v15); @@ -314,7 +314,7 @@ static void sub_0204BAAC (UnkStruct_0203CDB0 * param0, void * param1) } } - sub_0207418C(v4); + CalculateMonLevelAndStats(v4); v3 = Party_GetFromSavedata(param0->unk_0C); v5 = Party_AddPokemon(v3, v4); @@ -339,7 +339,7 @@ static void sub_0204BDEC (UnkStruct_0204B830 * param0, u16 * param1, u16 * param v1 = (Pokemon *)&v0->val1.unk_04; sub_0200B498(param0->unk_04, 0, sub_02025E38(param0->unk_00->unk_0C)); - sub_0200B578(param0->unk_04, 1, sub_02076B10(v1)); + sub_0200B578(param0->unk_04, 1, GetBoxMon(v1)); } static void sub_0204BE2C (UnkStruct_0204B830 * param0, u16 * param1, u16 * param2) @@ -364,7 +364,7 @@ static void sub_0204BE44 (UnkStruct_0204B830 * param0, u16 * param1, u16 * param v1 = (Pokemon *)v0->val2.unk_04; sub_0200B498(param0->unk_04, 0, sub_02025E38(param0->unk_00->unk_0C)); - sub_0200B538(param0->unk_04, 1, sub_02076B10(v1)); + sub_0200B538(param0->unk_04, 1, GetBoxMon(v1)); } static BOOL sub_0204BE84 (UnkStruct_0203CDB0 * param0, void * param1) diff --git a/src/unk_0204C500.c b/src/unk_0204C500.c index 5bddf58b13..08ad07b566 100644 --- a/src/unk_0204C500.c +++ b/src/unk_0204C500.c @@ -23,7 +23,7 @@ #include "unk_020507CC.h" #include "unk_020562F8.h" #include "unk_0206A8DC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "unk_02092494.h" @@ -74,7 +74,7 @@ BOOL sub_0204C59C (UnkStruct_0203E724 * param0) for (v6 = 0; v6 < 6; v6++) { sub_0202F000(v0, v6, v2); sub_0209304C(v2, v3, 2, 0, 32); - v5 = sub_02079868(v1, sub_02076B10(v2)); + v5 = sub_02079868(v1, GetBoxMon(v2)); GF_ASSERT(v5); sub_0202F180(param0->unk_34->unk_0C, v2); } diff --git a/src/unk_0204CFFC.c b/src/unk_0204CFFC.c index f24457b436..5635304fa0 100644 --- a/src/unk_0204CFFC.c +++ b/src/unk_0204CFFC.c @@ -23,7 +23,7 @@ #include "unk_02054884.h" #include "unk_0205DFC4.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "party.h" #include "item.h" @@ -207,7 +207,7 @@ BOOL sub_0204D3DC (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v4); if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - if (GetMonData(v1, MON_DATA_161, NULL) <= v3) { + if (GetMonData(v1, MON_DATA_LEVEL, NULL) <= v3) { v6++; } } @@ -229,7 +229,7 @@ BOOL sub_0204D470 (UnkStruct_0203E724 * param0) *v2 = 0; if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - *v2 = GetMonData(v1, MON_DATA_161, NULL); + *v2 = GetMonData(v1, MON_DATA_LEVEL, NULL); } return 0; @@ -257,7 +257,7 @@ BOOL sub_0204D4CC (UnkStruct_0203E724 * param0) return 0; } - *v2 = sub_02075BCC(v1); + *v2 = GetMonNature(v1); return 0; } @@ -277,7 +277,7 @@ BOOL sub_0204D540 (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v5); if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - if (sub_02075BCC(v1) == v3) { + if (GetMonNature(v1) == v3) { *v2 = v5; break; } @@ -332,7 +332,7 @@ BOOL sub_0204D614 (UnkStruct_0203E724 * param0) v4 = 255; } - sub_02074B30(v1, 9, &v4); + SetMonData(v1, 9, &v4); return 0; } @@ -353,7 +353,7 @@ BOOL sub_0204D6E4 (UnkStruct_0203E724 * param0) v4 -= v2; } - sub_02074B30(v1, 9, &v4); + SetMonData(v1, 9, &v4); return 0; } @@ -446,7 +446,7 @@ BOOL sub_0204D8C4 (UnkStruct_0203E724 * param0) v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v4->unk_0C), v2); if (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) { - if (GetMonData(v3, MON_DATA_163, NULL) != 0) { + if (GetMonData(v3, MON_DATA_CURRENT_HP, NULL) != 0) { v1++; } } @@ -471,7 +471,7 @@ BOOL sub_0204D94C (UnkStruct_0203E724 * param0) v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v4->unk_0C), v2); if (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) { - if (GetMonData(v3, MON_DATA_163, NULL) != 0) { + if (GetMonData(v3, MON_DATA_CURRENT_HP, NULL) != 0) { v1++; } } @@ -538,7 +538,7 @@ BOOL sub_0204DA84 (UnkStruct_0203E724 * param0) u16 * v2 = inline_0204FCAC(param0); v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v1); - *v2 = GetMonData(v0, MON_DATA_111, NULL); + *v2 = GetMonData(v0, MON_DATA_GENDER, NULL); return 0; } @@ -590,7 +590,7 @@ BOOL sub_0204DB74 (UnkStruct_0203E724 * param0) u16 v5 = inline_02049538(param0); v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v4); - sub_02077408(v1, v5); + DeleteMonMove(v1, v5); return 0; } @@ -632,7 +632,7 @@ BOOL sub_0204DC60 (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v2); v3 = 0; - sub_02074B30(v1, 6, &v3); + SetMonData(v1, 6, &v3); return 0; } @@ -813,7 +813,7 @@ BOOL sub_0204E01C (UnkStruct_0203E724 * param0) v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v1); - sub_02074B30(v0, sub_020923C0(v2, 0), &v3); + SetMonData(v0, sub_020923C0(v2, 0), &v3); sub_0206DDB8(param0->unk_34->unk_0C, v0, sub_020923C0(v2, 0)); return 0; diff --git a/src/unk_0204F13C.c b/src/unk_0204F13C.c index c1be8d26b7..5ce4d39a1e 100644 --- a/src/unk_0204F13C.c +++ b/src/unk_0204F13C.c @@ -43,7 +43,7 @@ #include "unk_0204FA34.h" #include "unk_020508D4.h" #include "unk_0205DFC4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207A274.h" #include "unk_0207D3B8.h" @@ -177,7 +177,7 @@ static BOOL sub_0204F268 (u16 param0, UnkStruct_021C0794 * param1) for (v0 = 0, v2 = 0; v0 < v3; v0++) { v7 = Party_GetPokemonBySlotIndex(v6, v0); v4 = GetMonData(v7, MON_DATA_SPECIES, NULL); - v5 = GetMonData(v7, MON_DATA_161, NULL); + v5 = GetMonData(v7, MON_DATA_LEVEL, NULL); if (GetMonData(v7, MON_DATA_IS_EGG, NULL) != 0) { continue; diff --git a/src/unk_02050A74.c b/src/unk_02050A74.c index fee93142f3..fd02d202f5 100644 --- a/src/unk_02050A74.c +++ b/src/unk_02050A74.c @@ -46,7 +46,7 @@ #include "unk_0206A8DC.h" #include "unk_0206AFE0.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079170.h" #include "unk_020797C8.h" #include "party.h" @@ -596,7 +596,7 @@ void sub_020512E4 (UnkStruct_020508D4 * param0, u16 param1, u8 param2, int * par v4 = 1; v3 = Party_GetPokemonBySlotIndex(v1->parties[1], 0); - sub_02074B30(v3, 110, &v4); + SetMonData(v3, 110, &v4); if (param4) { v1->unk_164 |= 0x8; @@ -985,7 +985,7 @@ static void sub_02051988 (UnkStruct_0203CDB0 * param0, BattleParams * param1) if (param0->unk_78.unk_02 >= 5) { v0 = Party_GetPokemonBySlotIndex(param1->parties[1], 0); - v3 = sub_0202BECC(sub_02025E5C(param0->unk_0C), GetMonData(v0, MON_DATA_SPECIES, 0), GetMonData(v0, MON_DATA_111, 0), param1->unk_138, 11); + v3 = sub_0202BECC(sub_02025E5C(param0->unk_0C), GetMonData(v0, MON_DATA_SPECIES, 0), GetMonData(v0, MON_DATA_GENDER, 0), param1->unk_138, 11); sub_0202B758(param0->unk_9C, v3, 2); } } else if (v2 == 0x4) { @@ -993,7 +993,7 @@ static void sub_02051988 (UnkStruct_0203CDB0 * param0, BattleParams * param1) v4 = param1->unk_148; v0 = Party_GetPokemonBySlotIndex(param1->parties[v4], 0); - v3 = sub_0202BE4C(sub_02025E5C(param0->unk_0C), GetMonData(v0, MON_DATA_SPECIES, 0), GetMonData(v0, MON_DATA_111, 0), param1->unk_138, 11); + v3 = sub_0202BE4C(sub_02025E5C(param0->unk_0C), GetMonData(v0, MON_DATA_SPECIES, 0), GetMonData(v0, MON_DATA_GENDER, 0), param1->unk_138, 11); sub_0202B758(param0->unk_9C, v3, 2); } @@ -1022,7 +1022,7 @@ void sub_02051ABC (UnkStruct_020508D4 * param0, u16 param1, u8 param2, int * par Pokemon * v3; v3 = Party_GetPokemonBySlotIndex(v1->parties[1], 0); - sub_02077A64(v3); + SetGiratinaOriginForm(v3); } if (param4) { diff --git a/src/unk_02051D8C.c b/src/unk_02051D8C.c index 304faa6d38..10f53115dc 100644 --- a/src/unk_02051D8C.c +++ b/src/unk_02051D8C.c @@ -57,7 +57,7 @@ #include "unk_0206A8DC.h" #include "unk_0206AFE0.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "unk_0208C324.h" @@ -325,11 +325,11 @@ void sub_02052348 (BattleParams * param0, const UnkStruct_0203CDB0 * param1, int for (v0 = 0; v0 < Party_GetCurrentCount(v3); v0++) { sub_020775EC(Party_GetPokemonBySlotIndex(v3, v0), v8); - if ((GetMonData(v8, MON_DATA_161, NULL) != param2) && (param2 != 0)) { - v1 = sub_02075AD0(GetMonData(v8, MON_DATA_SPECIES, NULL), param2); + if ((GetMonData(v8, MON_DATA_LEVEL, NULL) != param2) && (param2 != 0)) { + v1 = GetMonSpeciesLevelExp(GetMonData(v8, MON_DATA_SPECIES, NULL), param2); - sub_02074B30(v8, 8, &v1); - sub_0207418C(v8); + SetMonData(v8, 8, &v1); + CalculateMonLevelAndStats(v8); } sub_0205213C(param0, v8, 0); diff --git a/src/unk_020528D0.c b/src/unk_020528D0.c index b4f130d568..c891d26f66 100644 --- a/src/unk_020528D0.c +++ b/src/unk_020528D0.c @@ -42,7 +42,7 @@ #include "unk_020553DC.h" #include "unk_02055808.h" #include "unk_02070428.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" typedef struct { @@ -220,7 +220,7 @@ BOOL sub_02052B2C (UnkStruct_020508D4 * param0) case 0: { if ((v0 != NULL) && (v0->unk_0C != NULL)) { - sub_02077A9C(Party_GetFromSavedata(v0->unk_0C), 0); + SetPartyGiratinaForm(Party_GetFromSavedata(v0->unk_0C), 0); } } diff --git a/src/unk_02054884.c b/src/unk_02054884.c index 6ea1b3d68c..b76aa562de 100644 --- a/src/unk_02054884.c +++ b/src/unk_02054884.c @@ -11,13 +11,13 @@ #include "unk_02025E08.h" #include "unk_0202F180.h" #include "unk_02054884.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay005/ov5_021E622C.h" BOOL sub_02054884 (Pokemon * param0) { - if (GetMonData(param0, MON_DATA_163, NULL) == 0) { + if (GetMonData(param0, MON_DATA_CURRENT_HP, NULL) == 0) { return 0; } @@ -45,7 +45,7 @@ BOOL sub_020548B0 (int param0, UnkStruct_021C0794 * param1, u16 param2, u8 param sub_02077E64(v1, v4, 4, param5, param6, param0); v2 = param4; - sub_02074B30(v1, 6, &v2); + SetMonData(v1, 6, &v2); v0 = Party_AddPokemon(v3, v1); if (v0) { @@ -78,7 +78,7 @@ BOOL sub_02054930 (int param0, UnkStruct_021C0794 * param1, u16 param2, u8 param void sub_02054988 (Party * param0, int param1, int param2, u16 param3) { - sub_020771F8(Party_GetPokemonBySlotIndex(param0, param1), param3, param2); + ResetMonMove(Party_GetPokemonBySlotIndex(param0, param1), param3, param2); } int sub_020549A0 (Party * param0, u16 param1) @@ -181,7 +181,7 @@ void sub_02054AC4 (Party * param0) v3 = Party_GetPokemonBySlotIndex(param0, v0); if (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) { - sub_02074B30(v3, 25, &v2); + SetMonData(v3, 25, &v2); } } } @@ -200,13 +200,13 @@ int sub_02054B04 (Party * param0, u16 param1) if (sub_02054884(v4)) { if (GetMonData(v4, MON_DATA_160, NULL) & (0x80 | 0x8)) { - u32 v5 = GetMonData(v4, MON_DATA_163, NULL); + u32 v5 = GetMonData(v4, MON_DATA_CURRENT_HP, NULL); if (v5 > 1) { v5--; } - sub_02074B30(v4, 163, &v5); + SetMonData(v4, 163, &v5); if (v5 == 1) { v1++; @@ -229,10 +229,10 @@ int sub_02054B04 (Party * param0, u16 param1) BOOL sub_02054B94 (Pokemon * param0) { - if ((GetMonData(param0, MON_DATA_160, NULL) & (0x80 | 0x8)) && (GetMonData(param0, MON_DATA_163, NULL) == 1)) { + if ((GetMonData(param0, MON_DATA_160, NULL) & (0x80 | 0x8)) && (GetMonData(param0, MON_DATA_CURRENT_HP, NULL) == 1)) { u32 v0 = 0; - sub_02074B30(param0, 160, &v0); + SetMonData(param0, 160, &v0); return 1; } diff --git a/src/unk_020559DC.c b/src/unk_020559DC.c index b5586f814c..70c636cb71 100644 --- a/src/unk_020559DC.c +++ b/src/unk_020559DC.c @@ -27,7 +27,7 @@ #include "unk_0206B9D8.h" #include "unk_0206C2D0.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" static void sub_02055AC0(UnkStruct_0203CDB0 * param0, s32 param1); @@ -147,7 +147,7 @@ static void sub_02055B64 (UnkStruct_0203CDB0 * param0, s32 param1, const RTCTime Party * v1; v1 = Party_GetFromSavedata(param0->unk_0C); - sub_02077BD8(v1, param1, param2); + SetPartyShayminForm(v1, param1, param2); } } diff --git a/src/unk_020562F8.c b/src/unk_020562F8.c index 7f3366fd49..db1adb61c3 100644 --- a/src/unk_020562F8.c +++ b/src/unk_020562F8.c @@ -21,7 +21,7 @@ #include "unk_02054D00.h" #include "unk_020562F8.h" #include "unk_0205DAC8.h" -#include "unk_02073C2C.h" +#include "pokemon.h" typedef struct { u16 unk_00; diff --git a/src/unk_02056720.c b/src/unk_02056720.c index 03d5c63829..d976d8c42b 100644 --- a/src/unk_02056720.c +++ b/src/unk_02056720.c @@ -6,7 +6,7 @@ #include "unk_020244AC.h" #include "unk_02056720.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" typedef struct UnkStruct_02056B24_t { @@ -302,9 +302,9 @@ void sub_02056A48 (UnkStruct_02056B24 * param0, const BoxPokemon * param1) v0 = 12 - 1; } - param0->unk_B8[v0].unk_00 = sub_02074570((BoxPokemon *)param1, MON_DATA_SPECIES, NULL); + param0->unk_B8[v0].unk_00 = GetBoxMonData((BoxPokemon *)param1, MON_DATA_SPECIES, NULL); param0->unk_B8[v0].unk_02 = sub_02079E44(param1); - param0->unk_B8[v0].unk_04 = sub_02074570((BoxPokemon *)param1, MON_DATA_FORM, NULL); + param0->unk_B8[v0].unk_04 = GetBoxMonData((BoxPokemon *)param1, MON_DATA_FORM, NULL); } int sub_02056AAC (const UnkStruct_02056B24 * param0) diff --git a/src/unk_0205A0D8.c b/src/unk_0205A0D8.c index 99a35bd30c..14acdfa0e4 100644 --- a/src/unk_0205A0D8.c +++ b/src/unk_0205A0D8.c @@ -50,7 +50,7 @@ #include "unk_0205E7D0.h" #include "unk_02061804.h" #include "unk_020655F4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207A274.h" #include "unk_0207D3B8.h" @@ -520,7 +520,7 @@ static BOOL sub_0205A324 (UnkStruct_020508D4 * param0) } break; case 36: - sub_0200B538(v0->unk_28, 1, sub_02076B10(Party_GetPokemonBySlotIndex(v0->unk_50, v0->unk_84))); + sub_0200B538(v0->unk_28, 1, GetBoxMon(Party_GetPokemonBySlotIndex(v0->unk_50, v0->unk_84))); MessageLoader_GetStrbuf(v0->unk_2C, 18, v0->unk_0C); sub_0200C388(v0->unk_28, v0->unk_10, v0->unk_0C); v0->unk_30 = sub_0205AA50(v0, v0->unk_10); @@ -758,7 +758,7 @@ static void sub_0205AC80 (UnkStruct_0205A0D8 * param0, BOOL param1) v0 = Party_GetFromSavedata(param0->unk_24->unk_0C); v2 = param0->unk_4C; - v4 = sub_02076AF0(); + v4 = GetPokemonStructSize(); v1 = (UnkStruct_0205AD20 *)(v2 + v4 * 3); v1->unk_00 = param1; @@ -809,7 +809,7 @@ static BOOL sub_0205AD20 (UnkStruct_0205A0D8 * param0) { UnkStruct_0205AD20 * v0; - v0 = (UnkStruct_0205AD20 *)((u8 *)(param0->unk_48) + (sub_02076AF0() * 3)); + v0 = (UnkStruct_0205AD20 *)((u8 *)(param0->unk_48) + (GetPokemonStructSize() * 3)); return v0->unk_00; } @@ -844,7 +844,7 @@ static void sub_0205AD80 (UnkStruct_0205A0D8 * param0) u32 v0; int v1; - v0 = sub_02076AF0(); + v0 = GetPokemonStructSize(); Party_InitWithCapacity(param0->unk_50, 3); for (v1 = 0; v1 < 3; v1++) { @@ -858,7 +858,7 @@ static void sub_0205ADAC (UnkStruct_0205A0D8 * param0) u8 * v1, * v2; int v3; - v0 = sub_02076AF0(); + v0 = GetPokemonStructSize(); v1 = ¶m0->unk_4C[param0->unk_85 * v0]; v2 = ¶m0->unk_48[param0->unk_84 * v0]; @@ -880,7 +880,7 @@ static void sub_0205ADF8 (UnkStruct_0205A0D8 * param0, int param1) MessageLoader * v4; v4 = MessageLoader_Init(1, 26, 412, 4); - v3 = sub_02076AF0(); + v3 = GetPokemonStructSize(); sub_0201A7E8(param0->unk_24->unk_08, v0, 3, 21, 9, 10, 8, 13, 10); sub_0200DAA4(param0->unk_24->unk_08, 3, 1, 11, 0, 4); @@ -988,7 +988,7 @@ void sub_0205B0C0 (int param0, int param1, void * param2, void * param3) int sub_0205B0E4 (void) { - return sub_02076AF0() * 3 + sizeof(UnkStruct_0205AD20); + return GetPokemonStructSize() * 3 + sizeof(UnkStruct_0205AD20); } u8 * sub_0205B0F4 (int param0, void * param1, int param2) diff --git a/src/unk_0205DFC4.c b/src/unk_0205DFC4.c index 9536bdc8b6..86f42dfe4e 100644 --- a/src/unk_0205DFC4.c +++ b/src/unk_0205DFC4.c @@ -19,7 +19,7 @@ #include "unk_020508D4.h" #include "unk_0205DFC4.h" #include "unk_02061804.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "overlay004/ov4_021D0D80.h" diff --git a/src/unk_0206C660.c b/src/unk_0206C660.c index c163ec6320..b08558f62f 100644 --- a/src/unk_0206C660.c +++ b/src/unk_0206C660.c @@ -13,7 +13,7 @@ #include "unk_020508D4.h" #include "unk_02055808.h" #include "unk_0206C660.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "overlay006/ov6_02246184.h" #include "overlay095/ov95_02246C20.h" diff --git a/src/unk_0206CCB0.c b/src/unk_0206CCB0.c index 47c9e29cf0..0bcdbdc908 100644 --- a/src/unk_0206CCB0.c +++ b/src/unk_0206CCB0.c @@ -61,7 +61,7 @@ #include "roaming_pokemon.h" #include "unk_0206CCB0.h" #include "unk_02071CFC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "unk_020923C0.h" @@ -483,7 +483,7 @@ static void sub_0206CE08 (int param0, u16 * param1, Pokemon * param2) static void sub_0206CE38 (Pokemon * param0, u16 * param1, u8 * param2, u8 * param3, u8 * param4) { *param1 = GetMonData(param0, MON_DATA_SPECIES, NULL); - *param2 = GetMonData(param0, MON_DATA_111, NULL); + *param2 = GetMonData(param0, MON_DATA_GENDER, NULL); *param3 = GetMonData(param0, MON_DATA_LANGUAGE, NULL); *param4 = GetMonData(param0, MON_DATA_MET_GAME, NULL); } @@ -536,7 +536,7 @@ void sub_0206CF48 (UnkStruct_0202440C * param0, Pokemon * param1, int param2) v0->unk_00 = 1; v0->unk_1F = 0; - v0->unk_1E = sub_02075BCC(param1); + v0->unk_1E = GetMonNature(param1); sub_0206CE38(param1, &v0->unk_02, &v0->unk_04, &v0->unk_05, &v0->unk_06); v0->unk_07 = GetMonData(param1, MON_DATA_77, NULL); @@ -1053,7 +1053,7 @@ void sub_0206D7C4 (UnkStruct_0203CDB0 * param0) v6 = Party_GetPokemonBySlotIndex(v8, v5); if (GetMonData(v6, MON_DATA_IS_EGG, NULL) == 0) { - v3 = GetMonData(v6, MON_DATA_111, NULL); + v3 = GetMonData(v6, MON_DATA_GENDER, NULL); if (v3 == 0) { v0 = 1; @@ -2725,7 +2725,7 @@ static int sub_0206ED14 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param } for (v1 = 0; v1 < 5; v1++) { - if (sub_02075C60(v2, 1 + v1) > 0) { + if (GetNatureStatAffinity(v2, 1 + v1) > 0) { v6 = v1; break; } @@ -2758,7 +2758,7 @@ static int sub_0206EDAC (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param v4 = sub_0202D93C(v0, 4); v5 = sub_0202D93C(v0, 3); - sub_0206CE74(param1, 1, v4, sub_02075DAC(v4, v5), sub_02025FD8(v7), sub_02025FCC(v7)); + sub_0206CE74(param1, 1, v4, GetMonPersonalityGender(v4, v5), sub_02025FD8(v7), sub_02025FCC(v7)); break; } } @@ -2973,7 +2973,7 @@ static int sub_0206F160 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param v4 = Party_GetFromSavedata(param0->unk_0C); v3 = Party_GetPokemonBySlotIndex(v4, sub_0205E1B4(param0->unk_0C)); - sub_0206CE74(param1, 0, GetMonData(v3, MON_DATA_SPECIES, NULL), GetMonData(v3, MON_DATA_111, NULL), sub_02025FD8(v5), sub_02025FCC(v5)); + sub_0206CE74(param1, 0, GetMonData(v3, MON_DATA_SPECIES, NULL), GetMonData(v3, MON_DATA_GENDER, NULL), sub_02025FD8(v5), sub_02025FCC(v5)); sub_0200BFAC(param1, 1, (LCRNG_Next() % 100)); v1 = (LCRNG_Next() % (493 - 2) + 1); diff --git a/src/unk_02073C2C.c b/src/unk_02073C2C.c deleted file mode 100644 index a198f8dacf..0000000000 --- a/src/unk_02073C2C.c +++ /dev/null @@ -1,5564 +0,0 @@ -#include -#include - -#include "inlines.h" - -#include "struct_decls/struct_02002F38_decl.h" -#include "struct_decls/struct_02006C24_decl.h" -#include "struct_decls/struct_02007C7C_decl.h" -#include "struct_decls/struct_0200C6E4_decl.h" -#include "struct_decls/struct_0200C704_decl.h" -#include "struct_decls/struct_02015F84_decl.h" -#include "strbuf.h" -#include "struct_decls/struct_02025E6C_decl.h" -#include "struct_decls/struct_0202CC84_decl.h" -#include "struct_decls/party_pokemon.h" -#include "struct_decls/struct_party_decl.h" - -#include "struct_defs/struct_02007C10.h" -#include "struct_defs/struct_02008A90.h" -#include "struct_defs/struct_0200D0F4.h" -#include "struct_defs/struct_0202818C.h" -#include "struct_defs/struct_0202CA28.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" -#include "struct_defs/party_pokemon.h" -#include "struct_defs/pokemon_substruct_0.h" -#include "struct_defs/pokemon_substruct_1.h" -#include "struct_defs/pokemon_substruct_2.h" -#include "struct_defs/pokemon_substruct_3.h" -#include "struct_defs/struct_02075874.h" -#include "struct_defs/struct_0207821C.h" -#include "struct_defs/struct_0207825C.h" -#include "struct_defs/struct_0207825C_1.h" -#include "struct_defs/struct_0207825C_10.h" -#include "struct_defs/struct_0207825C_11.h" -#include "struct_defs/struct_0207825C_12.h" -#include "struct_defs/struct_0207825C_13.h" -#include "struct_defs/struct_0207825C_14.h" -#include "struct_defs/struct_0207825C_15.h" -#include "struct_defs/struct_0207825C_16.h" -#include "struct_defs/struct_0207825C_17.h" -#include "struct_defs/struct_0207825C_18.h" -#include "struct_defs/struct_0207825C_19.h" -#include "struct_defs/struct_0207825C_2.h" -#include "struct_defs/struct_0207825C_20.h" -#include "struct_defs/struct_0207825C_21.h" -#include "struct_defs/struct_0207825C_22.h" -#include "struct_defs/struct_0207825C_23.h" -#include "struct_defs/struct_0207825C_3.h" -#include "struct_defs/struct_0207825C_4.h" -#include "struct_defs/struct_0207825C_5.h" -#include "struct_defs/struct_0207825C_6.h" -#include "struct_defs/struct_0207825C_7.h" -#include "struct_defs/struct_0207825C_8.h" -#include "struct_defs/struct_0207825C_9.h" -#include "struct_defs/struct_020789BC.h" -#include "struct_defs/struct_020789F4.h" -#include "struct_defs/struct_02078B40.h" -#include "overlay005/struct_ov5_021DE5D0.h" -#include "overlay104/struct_ov104_0223F9E0.h" - -#include "unk_020021B0.h" -#include "unk_02005474.h" -#include "unk_02006224.h" -#include "narc.h" -#include "message.h" -#include "unk_0200B29C.h" -#include "unk_0200C6E4.h" -#include "unk_0201378C.h" -#include "unk_02015F84.h" -#include "unk_02017038.h" -#include "heap.h" -#include "unk_0201D15C.h" -#include "unk_020218BC.h" -#include "strbuf.h" -#include "unk_02025E68.h" -#include "unk_02028124.h" -#include "unk_0202C9F4.h" -#include "unk_02073C2C.h" -#include "move_table.h" -#include "unk_02079170.h" -#include "party.h" -#include "item.h" -#include "unk_02092494.h" - -#include "constants/species.h" - -static const s8 Unk_020F0695[][5] = { - { 0x0, 0x0, 0x0, 0x0, 0x0 }, - { 0x1, 0x0, 0x0, 0x0, -0x1 }, - { 0x1, 0x0, -0x1, 0x0, 0x0 }, - { 0x1, -0x1, 0x0, 0x0, 0x0 }, - { 0x1, 0x0, 0x0, -0x1, 0x0 }, - { -0x1, 0x0, 0x0, 0x0, 0x1 }, - { 0x0, 0x0, 0x0, 0x0, 0x0 }, - { 0x0, 0x0, -0x1, 0x0, 0x1 }, - { 0x0, -0x1, 0x0, 0x0, 0x1 }, - { 0x0, 0x0, 0x0, -0x1, 0x1 }, - { -0x1, 0x0, 0x1, 0x0, 0x0 }, - { 0x0, 0x0, 0x1, 0x0, -0x1 }, - { 0x0, 0x0, 0x0, 0x0, 0x0 }, - { 0x0, -0x1, 0x1, 0x0, 0x0 }, - { 0x0, 0x0, 0x1, -0x1, 0x0 }, - { -0x1, 0x1, 0x0, 0x0, 0x0 }, - { 0x0, 0x1, 0x0, 0x0, -0x1 }, - { 0x0, 0x1, -0x1, 0x0, 0x0 }, - { 0x0, 0x0, 0x0, 0x0, 0x0 }, - { 0x0, 0x1, 0x0, -0x1, 0x0 }, - { -0x1, 0x0, 0x0, 0x1, 0x0 }, - { 0x0, 0x0, 0x0, 0x1, -0x1 }, - { 0x0, 0x0, -0x1, 0x1, 0x0 }, - { 0x0, -0x1, 0x0, 0x1, 0x0 }, - { 0x0, 0x0, 0x0, 0x0, 0x0 }, -}; - -void ZeroMonData(Pokemon * param0); -void ZeroBoxMonData(BoxPokemon * param0); -int PokemonStructSize(void); -Pokemon * AllocMonZeroed(u32 heapID); -BOOL sub_02073C88(Pokemon * param0); -BOOL sub_02073CD4(Pokemon * param0, BOOL param1); -BOOL sub_02073D20(BoxPokemon * param0); -BOOL sub_02073D48(BoxPokemon * param0, BOOL param1); -void sub_02073D80(Pokemon * param0, int param1, int param2, int param3, int param4, u32 param5, int param6, u32 param7); -void sub_02073E18(BoxPokemon * param0, int param1, int param2, int param3, int param4, u32 param5, int param6, u32 param7); -void sub_02074044(Pokemon *, u16 param0, u8 param1, u8 param2, u8 param3); -void sub_02074088(Pokemon *, u16 param0, u8 param1, u8 param2, u8 param3, u8 param4, u8 param5); -u32 sub_02074128(u16 param0, u8 param1, u8 param2); -void sub_02074158(Pokemon *, u16 param0, u8 param1, u32 param2, u32 param3); -void sub_0207418C(Pokemon * param0); -void sub_020741B8(Pokemon * param0); -u32 GetMonData(Pokemon * param0, int param1, void * param2); -static u32 sub_020744E8(Pokemon * param0, int param1, void * param2); -u32 sub_02074570(BoxPokemon * param0, int param1, void * param2); -static u32 sub_020745D0(BoxPokemon * param0, int param1, void * param2); -void sub_02074B30(Pokemon * param0, int param1, const void * param2); -static void sub_02074BC0(Pokemon * param0, int param1, const void * param2); -void SetBoxMonData(BoxPokemon * param0, int param1, const void * param2); -static void sub_02074CD8(BoxPokemon * param0, int param1, const void * param2); -void sub_0207536C(Pokemon * param0, int param1, int param2); -static void sub_020753F4(Pokemon * param0, int param1, int param2); -static void sub_02075454(BoxPokemon * param0, int param1, int param2); -u32 sub_020759CC(int param0, int param1, int param2); -u32 sub_020759F0(int param0, int param1); -u8 sub_02075A10(Pokemon * param0); -u32 sub_02075A70(Pokemon * param0); -u32 sub_02075A78(BoxPokemon * param0); -u32 sub_02075AAC(Pokemon * param0); -u32 sub_02075AD0(int param0, int param1); -void sub_02075AE4(int param0, u32 * param1); -u32 sub_02075B00(int param0, int param1); -u32 sub_02075B38(Pokemon * param0); -u32 sub_02075B40(BoxPokemon * param0); -u32 sub_02075B78(u16 param0, u32 param1); -u8 sub_02075BCC(Pokemon * param0); -u8 sub_02075BD4(BoxPokemon * param0); -u8 GetNatureFromPersonality(u32 param0); -u16 sub_02075C0C(u8 param0, u16 param1, u8 param2); -s8 sub_02075C60(u8 param0, u8 param1); -void sub_02075C74(Pokemon * param0, u8 param1, u16 param2); -u8 sub_02075D6C(Pokemon * param0); -u8 sub_02075D74(BoxPokemon * param0); -u8 sub_02075DAC(u16 param0, u32 param1); -u8 sub_02075E0C(Pokemon * param0); -u8 sub_02075E14(BoxPokemon * param0); -u8 sub_02075E38(u32 param0, u32 param1); -u32 sub_02075E64(u32 param0); -void sub_02075EF4(UnkStruct_02008A90 * param0, Pokemon * param1, u8 param2); -void sub_02075F0C(UnkStruct_02008A90 * param0, BoxPokemon * param1, u8 param2, int param3); -void sub_02075FB4(UnkStruct_02008A90 * param0, u16 param1, u8 param2, u8 param3, u8 param4, u8 param5, u32 param6); -u8 SanitizeFormId(u16 param0, u8 param1); -u8 sub_020765AC(Pokemon * param0, u8 param1); -u8 sub_020765C4(BoxPokemon * param0, u8 param1, int param2); -u8 sub_02076648(u16 param0, u8 param1, u8 param2, u8 param3, u32 param4); -void sub_0207697C(UnkStruct_02008A90 * param0, u16 param1); -UnkStruct_0200D0F4 * sub_02076994(UnkStruct_0200C6E4 * param0, UnkStruct_0200C704 * param1, UnkStruct_02002F38 * param2, int param3, int param4, int param5, int param6, int param7, int param8); -void sub_02076AAC(int param0, int param1, UnkStruct_ov5_021DE5D0 * param2); -u32 sub_02076AF0(void); -u32 sub_02076AF4(void); -u8 sub_02076AF8(Pokemon * param0); -u8 sub_02076B00(BoxPokemon * param0); -BoxPokemon * sub_02076B10(Pokemon * param0); -u8 sub_02076B14(Pokemon * param0); -u16 sub_02076B94(Party * param0, Pokemon * param1, u8 param2, u16 param3, int * param4); -void sub_02077020(BoxPokemon * param0); -u16 sub_020770C4(Pokemon * param0, u16 param1); -u16 sub_020770D4(BoxPokemon * param0, u16 param1); -void sub_02077134(Pokemon * param0, u16 param1); -void sub_02077144(BoxPokemon * param0, u16 param1); -void sub_020771F8(Pokemon * param0, u16 param1, u8 param2); -void sub_02077230(Pokemon * param0, u16 param1, u8 param2); -void sub_02077238(BoxPokemon * param0, u16 param1, u8 param2); -u16 sub_0207727C(Pokemon * param0, int * param1, u16 * param2); -void sub_02077344(Pokemon * param0, int param1, int param2); -void sub_0207734C(BoxPokemon * param0, int param1, int param2); -void sub_02077408(Pokemon * param0, u32 param1); -BOOL sub_0207749C(Pokemon * param0, u16 param1); -void sub_020774C8(BoxPokemon * param0, Pokemon * param1); -u8 sub_02077550(Party * param0); -u16 sub_020775A4(u16 param0); -u16 sub_020775C4(u16 param0); -void sub_020775EC(Pokemon * param0, Pokemon * param1); -void sub_02077604(BoxPokemon * param0, BoxPokemon * param1); -void sub_02077618(Pokemon * param0, BoxPokemon * param1); -s8 sub_0207762C(Pokemon * param0, int param1); -s8 sub_02077634(BoxPokemon * param0, int param1); -s8 sub_02077648(u32 param0, int param1); -void sub_020776B0(Party * param0); -u8 sub_02077758(Party * param0, u8 param1); -void sub_020777B4(Party * param0, s32 param1); -void sub_0207782C(Party * param0); -BOOL sub_020778D8(Pokemon * param0); -BOOL sub_020778E0(BoxPokemon * param0); -BOOL sub_020778F8(Pokemon * param0); -BOOL sub_02077900(BoxPokemon * param0); -void sub_02077928(Pokemon * param0); -void sub_02077930(BoxPokemon * param0); -u8 sub_02077988(u16 param0); -int sub_02077A00(Pokemon * param0); -int sub_02077A1C(BoxPokemon * param0); -void SetShayminForm(Pokemon * param0, int param1); -void SetBoxShayminForm(BoxPokemon * param0, int param1); -void sub_02077D28(int param0, int param1, u16 * param2); -void sub_02077D3C(UnkStruct_0202CC84 * param0, int param1, u16 param2, int param3, int param4, int param5, int param6, int param7); -void sub_02077E64(Pokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5); -void sub_02077EA4(BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5); -void sub_02077EE4(Pokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5); -void sub_02077EF8(BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5); -void sub_02077F0C(Pokemon * param0, u32 param1, int param2); -BOOL sub_02077FB4(Pokemon * param0, u8 param1); -BOOL sub_02077FBC(BoxPokemon * param0, u8 param1); -BOOL sub_02077FE4(u16 param0, int param1, u8 param2); -void sub_0207803C(Pokemon * param0); -void sub_02078044(BoxPokemon * param0); -void sub_020780C4(Pokemon * param0, u32 param1); -static void sub_020781F8(int param0, UnkStruct_02075874 * param1); -static void sub_02078208(int param0, int param1, UnkStruct_02075874 * param2); -static void sub_0207821C(int param0, UnkStruct_0207821C * param1); -static void sub_0207822C(void * param0, u32 param1, u32 param2); -static void sub_02078234(void * param0, u32 param1, u32 param2); -static u16 sub_0207823C(void * param0, u32 param1); -static void * sub_0207825C(BoxPokemon * param0, u32 param1, u8 param2); -static int sub_02078740(int param0, int param1); -u32 FlagIndex(int flag); -int sub_020787EC(u32 param0); -BOOL sub_02078804(u16 param0); -BOOL sub_02078838(Pokemon * param0); -int sub_020788D0(int param0); -static void sub_02076300(UnkStruct_02008A90 * param0, u16 param1, u8 param2, u8 param3, u8 param4, u8 param5, u32 param6); -static u8 sub_020767BC(u16 param0, u8 param1, u8 param2, u8 param3, u32 param4); - -void ZeroMonData (Pokemon * mon) -{ - MI_CpuClearFast(mon, sizeof(Pokemon)); - sub_0207822C(&mon->box.unk_08, sizeof(PokemonSubstruct0) * 4, mon->box.unk_06); - sub_0207822C(&mon->party, sizeof(PartyPokemon), mon->box.unk_00); -} - -void ZeroBoxMonData (BoxPokemon * boxMon) -{ - MI_CpuClearFast(boxMon, sizeof(BoxPokemon)); - sub_0207822C(boxMon->unk_08, sizeof(PokemonSubstruct0) * 4, boxMon->unk_06); -} - -int PokemonStructSize (void) -{ - return sizeof(Pokemon); -} - -Pokemon * AllocMonZeroed (u32 heapID) -{ - Pokemon * mon = Heap_AllocFromHeap(heapID, sizeof(Pokemon)); - ZeroMonData(mon); - return mon; -} - -BOOL sub_02073C88 (Pokemon * param0) -{ - BOOL v0; - - v0 = 0; - - if (param0->box.unk_04_0 == 0) { - v0 = 1; - GF_ASSERT(param0->box.unk_04_1 == 0); - - param0->box.unk_04_0 = 1; - param0->box.unk_04_1 = 1; - - sub_02078234(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - sub_02078234(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - } - - return v0; -} - -BOOL sub_02073CD4 (Pokemon * param0, BOOL param1) -{ - BOOL v0; - - v0 = 0; - - if ((param0->box.unk_04_0 == 1) && (param1 == 1)) { - v0 = 1; - param0->box.unk_04_0 = 0; - param0->box.unk_04_1 = 0; - - sub_0207822C(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - param0->box.unk_06 = sub_0207823C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4); - sub_0207822C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - } - - return v0; -} - -BOOL sub_02073D20 (BoxPokemon * param0) -{ - BOOL v0; - - v0 = 0; - - if (param0->unk_04_1 == 0) { - v0 = 1; - param0->unk_04_1 = 1; - sub_02078234(param0->unk_08, sizeof(PokemonSubstruct0) * 4, param0->unk_06); - } - - return v0; -} - -BOOL sub_02073D48 (BoxPokemon * param0, BOOL param1) -{ - BOOL v0; - - v0 = 0; - - if ((param0->unk_04_1 == 1) && (param1 == 1)) { - v0 = 1; - - param0->unk_04_1 = 0; - param0->unk_06 = sub_0207823C(param0->unk_08, sizeof(PokemonSubstruct0) * 4); - - sub_0207822C(param0->unk_08, sizeof(PokemonSubstruct0) * 4, param0->unk_06); - } - - return v0; -} - -void sub_02073D80 (Pokemon * param0, int param1, int param2, int param3, int param4, u32 param5, int param6, u32 param7) -{ - u32 v0; - UnkStruct_0202818C * v1; - UnkStruct_0202CA28 v2; - - ZeroMonData(param0); - - sub_02073E18((BoxPokemon *)¶m0->box, param1, param2, param3, param4, param5, param6, param7); - sub_0207822C(¶m0->party, sizeof(PartyPokemon), 0); - sub_0207822C(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - sub_02074B30(param0, 161, (u8 *)¶m2); - - v1 = sub_0202818C(0); - - sub_02074B30(param0, 170, v1); - Heap_FreeToHeap(v1); - - v0 = 0; - sub_02074B30(param0, 162, (u8 *)&v0); - - MI_CpuClearFast(&v2, sizeof(UnkStruct_0202CA28)); - - sub_02074B30(param0, 171, (UnkStruct_0202CA28 *)&v2); - sub_0207418C(param0); -} - -void sub_02073E18 (BoxPokemon * param0, int param1, int param2, int param3, int param4, u32 param5, int param6, u32 param7) -{ - u16 v0; - u32 v1, v2; - BOOL v3; - - ZeroBoxMonData(param0); - - v3 = sub_02073D20(param0); - - if (!param4) { - param5 = (LCRNG_Next() | (LCRNG_Next() << 16)); - } - - SetBoxMonData(param0, 0, (u8 *)¶m5); - - if (param6 == 2) { - do { - param7 = (LCRNG_Next() | (LCRNG_Next() << 16)); - } while ((((param7 & 0xffff0000) >> 16) ^ (param7 & 0xffff) ^ ((param5 & 0xffff0000) >> 16) ^ (param5 & 0xffff)) < 8); - } else if (param6 != 1) { - param7 = 0; - } - - SetBoxMonData(param0, 7, (u8 *)¶m7); - SetBoxMonData(param0, 12, (u8 *)&Unk_020E4C44); - SetBoxMonData(param0, 5, (u8 *)¶m1); - SetBoxMonData(param0, 179, NULL); - - v1 = sub_02075AD0(param1, param2); - SetBoxMonData(param0, 8, (u8 *)&v1); - - v1 = sub_020759F0(param1, 20); - SetBoxMonData(param0, 9, (u8 *)&v1); - - SetBoxMonData(param0, 156, (u8 *)¶m2); - SetBoxMonData(param0, 122, (u8 *)&Unk_020E4C40); - - v1 = 4; - SetBoxMonData(param0, 155, (u8 *)&v1); - - if (param3 < 32) { - SetBoxMonData(param0, 70, (u8 *)¶m3); - SetBoxMonData(param0, 71, (u8 *)¶m3); - SetBoxMonData(param0, 72, (u8 *)¶m3); - SetBoxMonData(param0, 73, (u8 *)¶m3); - SetBoxMonData(param0, 74, (u8 *)¶m3); - SetBoxMonData(param0, 75, (u8 *)¶m3); - } else { - v1 = LCRNG_Next(); - v2 = (v1 & (0x1f << 0)) >> 0; - SetBoxMonData(param0, 70, (u8 *)&v2); - - v2 = (v1 & (0x1f << 5)) >> 5; - SetBoxMonData(param0, 71, (u8 *)&v2); - - v2 = (v1 & (0x1f << 10)) >> 10; - SetBoxMonData(param0, 72, (u8 *)&v2); - - v1 = LCRNG_Next(); - v2 = (v1 & (0x1f << 0)) >> 0; - SetBoxMonData(param0, 73, (u8 *)&v2); - - v2 = (v1 & (0x1f << 5)) >> 5; - SetBoxMonData(param0, 74, (u8 *)&v2); - - v2 = (v1 & (0x1f << 10)) >> 10; - SetBoxMonData(param0, 75, (u8 *)&v2); - } - - v1 = sub_020759F0(param1, 24); - v2 = sub_020759F0(param1, 25); - - if (v2 != 0) { - if (param5 & 1) { - SetBoxMonData(param0, 10, (u8 *)&v2); - } else { - SetBoxMonData(param0, 10, (u8 *)&v1); - } - } else { - SetBoxMonData(param0, 10, (u8 *)&v1); - } - - v1 = sub_02075D74(param0); - - SetBoxMonData(param0, 111, (u8 *)&v1); - sub_02077020(param0); - sub_02073D48(param0, v3); -} - -void sub_02074044 (Pokemon * param0, u16 param1, u8 param2, u8 param3, u8 param4) -{ - u32 v0; - - do { - v0 = (LCRNG_Next() | (LCRNG_Next() << 16)); - } while (param4 != GetNatureFromPersonality(v0)); - - sub_02073D80(param0, param1, param2, param3, 1, v0, 0, 0); -} - -void sub_02074088 (Pokemon * param0, u16 param1, u8 param2, u8 param3, u8 param4, u8 param5, u8 param6) -{ - u32 v0; - u32 v1; - u16 v2; - - if ((param6) && (param6 < 29)) { - do { - v0 = (LCRNG_Next() | (LCRNG_Next() << 16)); - v2 = (((v0 & 0x3000000) >> 18) | ((v0 & 0x30000) >> 12) | ((v0 & 0x300) >> 6) | (v0 & 0x3)) % 28; - } while ((param5 != GetNatureFromPersonality(v0)) || (param4 != sub_02075DAC(param1, v0)) || (v2 != (param6 - 1))); - } else { - v0 = sub_02074128(param1, param4, param5); - } - - sub_02073D80(param0, param1, param2, param3, 1, v0, 0, 0); -} - -u32 sub_02074128 (u16 param0, u8 param1, u8 param2) -{ - u8 v0; - u32 v1; - - v0 = sub_020759F0(param0, 18); - - switch (v0) { - case 0: - case 254: - case 255: - v1 = param2; - break; - default: - if (param1 == 0) { - v1 = 25 * ((v0 / 25) + 1); - v1 += param2; - } else { - v1 = param2; - } - break; - } - - return v1; -} - -void sub_02074158 (Pokemon * param0, u16 param1, u8 param2, u32 param3, u32 param4) -{ - sub_02073D80(param0, param1, param2, 0, 1, param4, 0, 0); - sub_02074B30(param0, 175, (u8 *)¶m3); - sub_0207418C(param0); -} - -void sub_0207418C (Pokemon * param0) -{ - int v0; - BOOL v1; - - v1 = sub_02073C88(param0); - v0 = sub_02075B38(param0); - - sub_02074B30(param0, 161, (u8 *)&v0); - sub_020741B8(param0); - sub_02073CD4(param0, v1); -} - -void sub_020741B8 (Pokemon * param0) -{ - int v0, v1, v2; - int v3, v4, v5, v6, v7; - int v8, v9, v10, v11, v12, v13; - int v14, v15, v16, v17, v18, v19; - int v20; - int v21; - int v22; - int v23, v24, v25; - UnkStruct_02075874 * v26; - BOOL v27; - - v27 = sub_02073C88(param0); - - v21 = GetMonData(param0, MON_DATA_161, 0); - v0 = GetMonData(param0, MON_DATA_164, 0); - v1 = GetMonData(param0, MON_DATA_163, 0); - v8 = GetMonData(param0, MON_DATA_HP_IV, 0); - v14 = GetMonData(param0, MON_DATA_HP_EV, 0); - v9 = GetMonData(param0, MON_DATA_ATK_IV, 0); - v15 = GetMonData(param0, MON_DATA_ATK_EV, 0); - v10 = GetMonData(param0, MON_DATA_DEF_IV, 0); - v16 = GetMonData(param0, MON_DATA_DEF_EV, 0); - v11 = GetMonData(param0, MON_DATA_SPEED_IV, 0); - v17 = GetMonData(param0, MON_DATA_SPEED_EV, 0); - v12 = GetMonData(param0, MON_DATA_SPATK_IV, 0); - v18 = GetMonData(param0, MON_DATA_SPATK_EV, 0); - v13 = GetMonData(param0, MON_DATA_SPDEF_IV, 0); - v19 = GetMonData(param0, MON_DATA_SPDEF_EV, 0); - v22 = GetMonData(param0, MON_DATA_FORM, 0); - v20 = GetMonData(param0, MON_DATA_SPECIES, 0); - v26 = Heap_AllocFromHeap(0, sizeof(UnkStruct_02075874)); - - sub_02078208(v20, v22, v26); - - if (v20 == 292) { - v2 = 1; - } else { - v2 = ((2 * v26->unk_00 + v8 + v14 / 4) * v21 / 100 + v21 + 10); - } - - sub_02074B30(param0, 164, (u8 *)&v2); - - v3 = ((2 * v26->unk_01 + v9 + v15 / 4) * v21 / 100 + 5); - v3 = sub_02075C0C(sub_02075BCC(param0), v3, 0x1); - - sub_02074B30(param0, 165, (u8 *)&v3); - - v4 = ((2 * v26->unk_02 + v10 + v16 / 4) * v21 / 100 + 5); - v4 = sub_02075C0C(sub_02075BCC(param0), v4, 0x2); - - sub_02074B30(param0, 166, (u8 *)&v4); - - v5 = ((2 * v26->unk_03 + v11 + v17 / 4) * v21 / 100 + 5); - v5 = sub_02075C0C(sub_02075BCC(param0), v5, 0x3); - - sub_02074B30(param0, 167, (u8 *)&v5); - - v6 = ((2 * v26->unk_04 + v12 + v18 / 4) * v21 / 100 + 5); - v6 = sub_02075C0C(sub_02075BCC(param0), v6, 0x4); - - sub_02074B30(param0, 168, (u8 *)&v6); - - v7 = ((2 * v26->unk_05 + v13 + v19 / 4) * v21 / 100 + 5); - v7 = sub_02075C0C(sub_02075BCC(param0), v7, 0x5); - - sub_02074B30(param0, 169, (u8 *)&v7); - Heap_FreeToHeap(v26); - - if ((v1 == 0) && (v0 != 0)) { - (void)0; - } else { - if (v20 == 292) { - v1 = 1; - } else if (v1 == 0) { - v1 = v2; - } else { - v1 += (v2 - v0); - } - } - - if (v1) { - sub_02074B30(param0, 163, (u8 *)&v1); - } - - sub_02073CD4(param0, v27); -} - -u32 GetMonData (Pokemon * param0, int param1, void * param2) -{ - u32 v0; - u16 v1; - - if (param0->box.unk_04_0 == 0) { - sub_02078234(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - sub_02078234(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - - v1 = sub_0207823C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4); - - if (v1 != param0->box.unk_06) { - GF_ASSERT((v1 == param0->box.unk_06)); - param0->box.unk_04_2 = 1; - } - } - - v0 = sub_020744E8(param0, param1, param2); - - if (param0->box.unk_04_0 == 0) { - sub_0207822C(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - sub_0207822C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - } - - return v0; -} - -static u32 sub_020744E8 (Pokemon * param0, int param1, void * param2) -{ - u32 v0 = 0; - - switch (param1) { - case 160: - v0 = param0->party.unk_00; - break; - case 161: - v0 = param0->party.unk_04; - break; - case 162: - v0 = param0->party.unk_05; - break; - case 163: - v0 = param0->party.unk_06; - break; - case 164: - v0 = param0->party.unk_08; - break; - case 165: - v0 = param0->party.unk_0A; - break; - case 166: - v0 = param0->party.unk_0C; - break; - case 167: - v0 = param0->party.unk_0E; - break; - case 168: - v0 = param0->party.unk_10; - break; - case 169: - v0 = param0->party.unk_12; - break; - case 170: - sub_020281A0(¶m0->party.unk_14, (UnkStruct_0202818C *)param2); - v0 = 1; - break; - case 171: - sub_0202CA10(¶m0->party.unk_4C, (UnkStruct_0202CA28 *)param2); - v0 = 1; - break; - default: - v0 = sub_020745D0((BoxPokemon *)¶m0->box, param1, param2); - break; - } - - return v0; -} - -u32 sub_02074570 (BoxPokemon * param0, int param1, void * param2) -{ - u16 v0; - u32 v1; - - if (param0->unk_04_1 == 0) { - sub_02078234(param0->unk_08, sizeof(PokemonSubstruct0) * 4, param0->unk_06); - v0 = sub_0207823C(param0->unk_08, sizeof(PokemonSubstruct0) * 4); - - if (v0 != param0->unk_06) { - GF_ASSERT((v0 == param0->unk_06)); - param0->unk_04_2 = 1; - } - } - - v1 = sub_020745D0(param0, param1, param2); - - if (param0->unk_04_1 == 0) { - sub_0207822C(param0->unk_08, sizeof(PokemonSubstruct0) * 4, param0->unk_06); - } - - return v1; -} - -static u32 sub_020745D0 (BoxPokemon * param0, int param1, void * param2) -{ - u32 v0 = 0; - u64 v1; - PokemonSubstruct0 * v2; - PokemonSubstruct1 * v3; - PokemonSubstruct2 * v4; - PokemonSubstruct3 * v5; - - v2 = (PokemonSubstruct0 *)sub_0207825C(param0, param0->unk_00, 0); - v3 = (PokemonSubstruct1 *)sub_0207825C(param0, param0->unk_00, 1); - v4 = (PokemonSubstruct2 *)sub_0207825C(param0, param0->unk_00, 2); - v5 = (PokemonSubstruct3 *)sub_0207825C(param0, param0->unk_00, 3); - - switch (param1) { - default: - v0 = 0; - break; - case MON_DATA_PERSONALITY: - v0 = param0->unk_00; - break; - case MON_DATA_1: - v0 = param0->unk_04_0; - break; - case MON_DATA_2: - v0 = param0->unk_04_1; - break; - case MON_DATA_3: - v0 = param0->unk_04_2; - break; - case MON_DATA_4: - v0 = param0->unk_06; - break; - case MON_DATA_172: - v0 = (v2->species != SPECIES_NONE); - break; - case MON_DATA_173: - if (param0->unk_04_2) { - v0 = param0->unk_04_2; - } else { - v0 = v3->unk_10_30; - } - break; - case MON_DATA_SPECIES_EGG: - v0 = v2->species; - - if (v0 == 0) { - break; - } else if ((v3->unk_10_30) || (param0->unk_04_2)) { - v0 = 494; - } - break; - case MON_DATA_161: - v0 = sub_02075B78(v2->species, v2->unk_08); - break; - case MON_DATA_SPECIES: - if (param0->unk_04_2) { - v0 = 494; - } else { - v0 = v2->species; - } - break; - case MON_DATA_HELD_ITEM: - v0 = v2->item; - break; - case MON_DATA_OT_ID: - v0 = v2->unk_04; - break; - case MON_DATA_EXP: - v0 = v2->unk_08; - break; - case MON_DATA_FRIENDSHIP: - v0 = v2->friendship; - break; - case MON_DATA_10: - v0 = v2->unk_0D; - break; - case MON_DATA_11: - v0 = v2->unk_0E; - break; - case MON_DATA_LANGUAGE: - v0 = v2->unk_0F; - break; - case MON_DATA_HP_EV: - v0 = v2->unk_10; - break; - case MON_DATA_ATK_EV: - v0 = v2->unk_11; - break; - case MON_DATA_DEF_EV: - v0 = v2->unk_12; - break; - case MON_DATA_SPEED_EV: - v0 = v2->unk_13; - break; - case MON_DATA_SPATK_EV: - v0 = v2->unk_14; - break; - case MON_DATA_SPDEF_EV: - v0 = v2->unk_15; - break; - case MON_DATA_COOL: - v0 = v2->unk_16; - break; - case MON_DATA_BEAUTY: - v0 = v2->unk_17; - break; - case MON_DATA_CUTE: - v0 = v2->unk_18; - break; - case MON_DATA_SMART: - v0 = v2->unk_19; - break; - case MON_DATA_TOUGH: - v0 = v2->unk_1A; - break; - case MON_DATA_SHEEN: - v0 = v2->unk_1B; - break; - case MON_DATA_25: - case MON_DATA_26: - case MON_DATA_27: - case MON_DATA_28: - case MON_DATA_29: - case MON_DATA_30: - case MON_DATA_31: - case MON_DATA_32: - case MON_DATA_33: - case MON_DATA_34: - case MON_DATA_35: - case MON_DATA_36: - case MON_DATA_37: - case MON_DATA_38: - case MON_DATA_39: - case MON_DATA_40: - case MON_DATA_41: - case MON_DATA_42: - case MON_DATA_43: - case MON_DATA_44: - case MON_DATA_45: - case MON_DATA_46: - case MON_DATA_47: - case MON_DATA_48: - case MON_DATA_49: - case MON_DATA_50: - case MON_DATA_51: - case MON_DATA_52: - case MON_DATA_53: - v1 = 1; - v0 = ((v2->unk_1C & (v1 << param1 - 25)) != 0); - break; - case MON_DATA_MOVE1: - case MON_DATA_MOVE2: - case MON_DATA_MOVE3: - case MON_DATA_MOVE4: - v0 = v3->unk_00[param1 - 54]; - break; - case MON_DATA_58: - case MON_DATA_59: - case MON_DATA_60: - case MON_DATA_61: - v0 = v3->unk_08[param1 - 58]; - break; - case MON_DATA_62: - case MON_DATA_63: - case MON_DATA_64: - case MON_DATA_65: - v0 = v3->unk_0C[param1 - 62]; - break; - case MON_DATA_66: - case MON_DATA_67: - case MON_DATA_68: - case MON_DATA_69: - v0 = MoveTable_CalcMaxPP(v3->unk_00[param1 - 66], v3->unk_0C[param1 - 66]); - break; - case MON_DATA_HP_IV: - v0 = v3->unk_10_0; - break; - case MON_DATA_ATK_IV: - v0 = v3->unk_10_5; - break; - case MON_DATA_DEF_IV: - v0 = v3->unk_10_10; - break; - case MON_DATA_SPEED_IV: - v0 = v3->unk_10_15; - break; - case MON_DATA_SPATK_IV: - v0 = v3->unk_10_20; - break; - case MON_DATA_SPDEF_IV: - v0 = v3->unk_10_25; - break; - case MON_DATA_IS_EGG: - if (param0->unk_04_2) { - v0 = param0->unk_04_2; - } else { - v0 = v3->unk_10_30; - } - break; - case MON_DATA_77: - v0 = v3->unk_10_31; - break; - case MON_DATA_78: - case MON_DATA_79: - case MON_DATA_80: - case MON_DATA_81: - case MON_DATA_82: - case MON_DATA_83: - case MON_DATA_84: - case MON_DATA_85: - case MON_DATA_86: - case MON_DATA_87: - case MON_DATA_88: - case MON_DATA_89: - case MON_DATA_90: - case MON_DATA_91: - case MON_DATA_92: - case MON_DATA_93: - case MON_DATA_94: - case MON_DATA_95: - case MON_DATA_96: - case MON_DATA_97: - case MON_DATA_CHAMPION_RIBBON: - case MON_DATA_WINNING_RIBBON: - case MON_DATA_VICTORY_RIBBON: - case MON_DATA_ARTIST_RIBBON: - case MON_DATA_EFFORT_RIBBON: - case MON_DATA_MARINE_RIBBON: - case MON_DATA_LAND_RIBBON: - case MON_DATA_SKY_RIBBON: - case MON_DATA_COUNTRY_RIBBON: - case MON_DATA_NATIONAL_RIBBON: - case MON_DATA_EARTH_RIBBON: - case MON_DATA_WORLD_RIBBON: - v1 = 1; - v0 = ((v3->unk_14 & (v1 << param1 - 78)) != 0); - break; - case MON_DATA_FATEFUL_ENCOUNTER: - v0 = v3->fatefulEncounter; - break; - case MON_DATA_111: - v0 = sub_02075DAC(v2->species, param0->unk_00); - v3->unk_18_1 = v0; - param0->unk_06 = sub_0207823C(¶m0->unk_08, sizeof(PokemonSubstruct0) * 4); - break; - case MON_DATA_FORM: - v0 = v3->form; - break; - case MON_DATA_113: - v0 = v3->unk_19; - break; - case MON_DATA_114: - v0 = v3->unk_1A; - break; - case MON_DATA_117: - if (param0->unk_04_2) { - MessageLoader_GetSpeciesName(495, 0, param2); - } else { - { - u16 * v6 = param2; - - for (v0 = 0; v0 < 10; v0++) { - v6[v0] = v4->unk_00[v0]; - } - - v6[v0] = 0xffff; - } - } - break; - case MON_DATA_120: - v0 = v3->unk_10_31; - case MON_DATA_119: - if (param0->unk_04_2) { - Strbuf* v7 = sub_0200B32C(495, 0); - - Strbuf_Copy((Strbuf *)param2, v7); - Strbuf_Free(v7); - } else { - Strbuf_CopyChars((Strbuf *)param2, v4->unk_00); - } - break; - case MON_DATA_121: - v0 = v4->unk_16; - break; - case MON_DATA_MET_GAME: - v0 = v4->unk_17; - break; - case MON_DATA_123: - case MON_DATA_124: - case MON_DATA_125: - case MON_DATA_126: - case MON_DATA_127: - case MON_DATA_128: - case MON_DATA_129: - case MON_DATA_130: - case MON_DATA_131: - case MON_DATA_132: - case MON_DATA_133: - case MON_DATA_134: - case MON_DATA_135: - case MON_DATA_136: - case MON_DATA_137: - case MON_DATA_138: - case MON_DATA_139: - case MON_DATA_140: - case MON_DATA_141: - case MON_DATA_142: - case MON_DATA_143: - v1 = 1; - v0 = ((v4->unk_18 & (v1 << param1 - 123)) != 0); - break; - case MON_DATA_144: - { - u16 * v8 = param2; - - for (v0 = 0; v0 < 7; v0++) { - v8[v0] = v5->unk_00[v0]; - } - - v8[v0] = 0xffff; - break; - } - case MON_DATA_145: - Strbuf_CopyChars((Strbuf *)param2, v5->unk_00); - break; - case MON_DATA_146: - v0 = v5->unk_10; - break; - case MON_DATA_147: - v0 = v5->unk_11; - break; - case MON_DATA_148: - v0 = v5->unk_12; - break; - case MON_DATA_149: - v0 = v5->unk_13; - break; - case MON_DATA_150: - v0 = v5->unk_14; - break; - case MON_DATA_151: - v0 = v5->unk_15; - break; - case MON_DATA_152: - case MON_DATA_115: - if ((v5->unk_16 == 3002) && (v3->unk_1C)) { - v0 = v3->unk_1C; - } else { - v0 = v5->unk_16; - } - break; - case MON_DATA_153: - case MON_DATA_116: - if ((v5->unk_18 == 3002) && (v3->unk_1E)) { - v0 = v3->unk_1E; - } else { - v0 = v5->unk_18; - } - break; - case MON_DATA_POKERUS: - v0 = v5->unk_1A; - break; - case MON_DATA_POKEBALL: - v0 = v5->unk_1B; - break; - case MON_DATA_MET_LEVEL: - v0 = v5->unk_1C_0; - break; - case MON_DATA_OT_GENDER: - v0 = v5->unk_1C_7; - break; - case MON_DATA_158: - v0 = v5->unk_1D; - break; - case MON_DATA_159: - v0 = v5->unk_1E; - break; - case MON_DATA_175: - v0 = (v3->unk_10_0 << 0) | (v3->unk_10_5 << 5) | (v3->unk_10_10 << 10) | (v3->unk_10_15 << 15) | (v3->unk_10_20 << 20) | (v3->unk_10_25 << 25); - break; - case MON_DATA_176: - if (((v2->species == SPECIES_NIDORAN_F) || (v2->species == SPECIES_NIDORAN_M)) && (v3->unk_10_31 == 0)) { - v0 = 0; - } else { - v0 = 1; - } - break; - case MON_DATA_177: - case MON_DATA_178: - if ((v2->species == SPECIES_ARCEUS) && (v2->unk_0D == 121)) { - v0 = sub_02077988(Item_LoadParam(v2->item, 1, 0)); - } else { - v0 = sub_020759CC(v2->species, v3->form, 6 + (param1 - 177)); - } - break; - case MON_DATA_179: - MessageLoader_GetSpeciesName(v2->species, 0, param2); - break; - } - - return v0; -} - -void sub_02074B30 (Pokemon * param0, int param1, const void * param2) -{ - u16 v0; - - if (param0->box.unk_04_0 == 0) { - sub_02078234(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - sub_02078234(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - v0 = sub_0207823C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4); - - if (v0 != param0->box.unk_06) { - GF_ASSERT((v0 == param0->box.unk_06)); - param0->box.unk_04_2 = 1; - sub_0207822C(param0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - return; - } - } - - sub_02074BC0(param0, param1, param2); - - if (param0->box.unk_04_0 == 0) { - sub_0207822C(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - param0->box.unk_06 = sub_0207823C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4); - sub_0207822C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - } -} - -static void sub_02074BC0 (Pokemon * param0, int param1, const void * param2) -{ - u32 * v0 = (u32 *)param2; - u16 * v1 = (u16 *)param2; - u8 * v2 = (u8 *)param2; - - switch (param1) { - case 160: - param0->party.unk_00 = v0[0]; - break; - case 161: - param0->party.unk_04 = v2[0]; - break; - case 162: - param0->party.unk_05 = v2[0]; - break; - case 163: - param0->party.unk_06 = v1[0]; - break; - case 164: - param0->party.unk_08 = v1[0]; - break; - case 165: - param0->party.unk_0A = v1[0]; - break; - case 166: - param0->party.unk_0C = v1[0]; - break; - case 167: - param0->party.unk_0E = v1[0]; - break; - case 168: - param0->party.unk_10 = v1[0]; - break; - case 169: - param0->party.unk_12 = v1[0]; - break; - case 170: - sub_020281A0((UnkStruct_0202818C *)param2, ¶m0->party.unk_14); - break; - case 171: - sub_0202CA10((UnkStruct_0202CA28 *)param2, ¶m0->party.unk_4C); - break; - default: - sub_02074CD8((BoxPokemon *)¶m0->box, param1, param2); - break; - } -} - -void SetBoxMonData (BoxPokemon * param0, int param1, const void * param2) -{ - u16 v0; - - if (param0->unk_04_1 == 0) { - sub_02078234(param0->unk_08, sizeof(PokemonSubstruct0) * 4, param0->unk_06); - v0 = sub_0207823C(param0->unk_08, sizeof(PokemonSubstruct0) * 4); - - if (v0 != param0->unk_06) { - GF_ASSERT((v0 == param0->unk_06)); - param0->unk_04_2 = 1; - sub_0207822C(param0->unk_08, sizeof(PokemonSubstruct0) * 4, param0->unk_06); - return; - } - } - - sub_02074CD8(param0, param1, param2); - - if (param0->unk_04_1 == 0) { - param0->unk_06 = sub_0207823C(param0->unk_08, sizeof(PokemonSubstruct0) * 4); - sub_0207822C(param0->unk_08, sizeof(PokemonSubstruct0) * 4, param0->unk_06); - } -} - -static void sub_02074CD8 (BoxPokemon * param0, int param1, const void * param2) -{ - int v0; - u64 v1; - u16 v2; - u32 * v3 = (u32 *)param2; - u16 * v4 = (u16 *)param2; - u8 * v5 = (u8 *)param2; - PokemonSubstruct0 * v6; - PokemonSubstruct1 * v7; - PokemonSubstruct2 * v8; - PokemonSubstruct3 * v9; - - v6 = (PokemonSubstruct0 *)sub_0207825C(param0, param0->unk_00, 0); - v7 = (PokemonSubstruct1 *)sub_0207825C(param0, param0->unk_00, 1); - v8 = (PokemonSubstruct2 *)sub_0207825C(param0, param0->unk_00, 2); - v9 = (PokemonSubstruct3 *)sub_0207825C(param0, param0->unk_00, 3); - - switch (param1) { - case MON_DATA_PERSONALITY: - param0->unk_00 = v3[0]; - break; - case MON_DATA_1: - GF_ASSERT(0); - param0->unk_04_0 = v5[0]; - break; - case MON_DATA_2: - GF_ASSERT(0); - param0->unk_04_1 = v5[0]; - break; - case MON_DATA_3: - param0->unk_04_2 = v5[0]; - break; - case MON_DATA_4: - param0->unk_06 = v4[0]; - break; - case MON_DATA_SPECIES: - v6->species = v4[0]; - break; - case MON_DATA_HELD_ITEM: - v6->item = v4[0]; - break; - case MON_DATA_OT_ID: - v6->unk_04 = v3[0]; - break; - case MON_DATA_EXP: - v6->unk_08 = v3[0]; - break; - case MON_DATA_FRIENDSHIP: - v6->friendship = v5[0]; - break; - case MON_DATA_10: - v6->unk_0D = v5[0]; - break; - case MON_DATA_11: - v6->unk_0E = v5[0]; - break; - case MON_DATA_LANGUAGE: - v6->unk_0F = v5[0]; - break; - case MON_DATA_HP_EV: - v6->unk_10 = v5[0]; - break; - case MON_DATA_ATK_EV: - v6->unk_11 = v5[0]; - break; - case MON_DATA_DEF_EV: - v6->unk_12 = v5[0]; - break; - case MON_DATA_SPEED_EV: - v6->unk_13 = v5[0]; - break; - case MON_DATA_SPATK_EV: - v6->unk_14 = v5[0]; - break; - case MON_DATA_SPDEF_EV: - v6->unk_15 = v5[0]; - break; - case MON_DATA_COOL: - v6->unk_16 = v5[0]; - break; - case MON_DATA_BEAUTY: - v6->unk_17 = v5[0]; - break; - case MON_DATA_CUTE: - v6->unk_18 = v5[0]; - break; - case MON_DATA_SMART: - v6->unk_19 = v5[0]; - break; - case MON_DATA_TOUGH: - v6->unk_1A = v5[0]; - break; - case MON_DATA_SHEEN: - v6->unk_1B = v5[0]; - break; - case MON_DATA_25: - case MON_DATA_26: - case MON_DATA_27: - case MON_DATA_28: - case MON_DATA_29: - case MON_DATA_30: - case MON_DATA_31: - case MON_DATA_32: - case MON_DATA_33: - case MON_DATA_34: - case MON_DATA_35: - case MON_DATA_36: - case MON_DATA_37: - case MON_DATA_38: - case MON_DATA_39: - case MON_DATA_40: - case MON_DATA_41: - case MON_DATA_42: - case MON_DATA_43: - case MON_DATA_44: - case MON_DATA_45: - case MON_DATA_46: - case MON_DATA_47: - case MON_DATA_48: - case MON_DATA_49: - case MON_DATA_50: - case MON_DATA_51: - case MON_DATA_52: - case MON_DATA_53: - v1 = 1 << (param1 - 25); - - if (v5[0]) { - v6->unk_1C |= v1; - } else { - v6->unk_1C &= (v1 ^ 0xffffffff); - } - break; - case MON_DATA_MOVE1: - case MON_DATA_MOVE2: - case MON_DATA_MOVE3: - case MON_DATA_MOVE4: - v7->unk_00[param1 - 54] = v4[0]; - break; - case MON_DATA_58: - case MON_DATA_59: - case MON_DATA_60: - case MON_DATA_61: - v7->unk_08[param1 - 58] = v5[0]; - break; - case MON_DATA_62: - case MON_DATA_63: - case MON_DATA_64: - case MON_DATA_65: - v7->unk_0C[param1 - 62] = v5[0]; - break; - case MON_DATA_66: - case MON_DATA_67: - case MON_DATA_68: - case MON_DATA_69: - break; - case MON_DATA_HP_IV: - v7->unk_10_0 = v5[0]; - break; - case MON_DATA_ATK_IV: - v7->unk_10_5 = v5[0]; - break; - case MON_DATA_DEF_IV: - v7->unk_10_10 = v5[0]; - break; - case MON_DATA_SPEED_IV: - v7->unk_10_15 = v5[0]; - break; - case MON_DATA_SPATK_IV: - v7->unk_10_20 = v5[0]; - break; - case MON_DATA_SPDEF_IV: - v7->unk_10_25 = v5[0]; - break; - case MON_DATA_IS_EGG: - v7->unk_10_30 = v5[0]; - break; - case MON_DATA_77: - v7->unk_10_31 = v5[0]; - break; - case MON_DATA_78: - case MON_DATA_79: - case MON_DATA_80: - case MON_DATA_81: - case MON_DATA_82: - case MON_DATA_83: - case MON_DATA_84: - case MON_DATA_85: - case MON_DATA_86: - case MON_DATA_87: - case MON_DATA_88: - case MON_DATA_89: - case MON_DATA_90: - case MON_DATA_91: - case MON_DATA_92: - case MON_DATA_93: - case MON_DATA_94: - case MON_DATA_95: - case MON_DATA_96: - case MON_DATA_97: - case MON_DATA_CHAMPION_RIBBON: - case MON_DATA_WINNING_RIBBON: - case MON_DATA_VICTORY_RIBBON: - case MON_DATA_ARTIST_RIBBON: - case MON_DATA_EFFORT_RIBBON: - case MON_DATA_MARINE_RIBBON: - case MON_DATA_LAND_RIBBON: - case MON_DATA_SKY_RIBBON: - case MON_DATA_COUNTRY_RIBBON: - case MON_DATA_NATIONAL_RIBBON: - case MON_DATA_EARTH_RIBBON: - case MON_DATA_WORLD_RIBBON: - v1 = 1 << (param1 - 78); - - if (v5[0]) { - v7->unk_14 |= v1; - } else { - v7->unk_14 &= (v1 ^ 0xffffffff); - } - break; - case MON_DATA_FATEFUL_ENCOUNTER: - v7->fatefulEncounter = v5[0]; - break; - case MON_DATA_111: - v7->unk_18_1 = sub_02075DAC(v6->species, param0->unk_00); - break; - case MON_DATA_FORM: - v7->form = v5[0]; - break; - case MON_DATA_113: - v7->unk_19 = v5[0]; - break; - case MON_DATA_114: - v7->unk_1A = v4[0]; - break; - case MON_DATA_118: - { - u16 v10[10 + 1]; - - MessageLoader_GetSpeciesName(v6->species, 0, &v10[0]); - v7->unk_10_31 = sub_0200220C(v10, &v4[0]); - } - case MON_DATA_117: - for (v0 = 0; v0 < NELEMS(v8->unk_00); v0++) { - v8->unk_00[v0] = v4[v0]; - } - break; - case MON_DATA_120: - { - u16 v11[10 + 1]; - u16 v12[10 + 1]; - - MessageLoader_GetSpeciesName(v6->species, 0, &v11[0]); - Strbuf_ToChars((Strbuf *)param2, &v12[0], NELEMS(v12)); - - v7->unk_10_31 = sub_0200220C(v11, v12); - } - case MON_DATA_119: - Strbuf_ToChars((Strbuf *)param2, v8->unk_00, NELEMS(v8->unk_00)); - break; - case MON_DATA_121: - v8->unk_16 = v5[0]; - break; - case MON_DATA_MET_GAME: - v8->unk_17 = v5[0]; - break; - case MON_DATA_123: - case MON_DATA_124: - case MON_DATA_125: - case MON_DATA_126: - case MON_DATA_127: - case MON_DATA_128: - case MON_DATA_129: - case MON_DATA_130: - case MON_DATA_131: - case MON_DATA_132: - case MON_DATA_133: - case MON_DATA_134: - case MON_DATA_135: - case MON_DATA_136: - case MON_DATA_137: - case MON_DATA_138: - case MON_DATA_139: - case MON_DATA_140: - case MON_DATA_141: - case MON_DATA_142: - case MON_DATA_143: - v1 = 1 << (param1 - 123); - - if (v5[0]) { - v8->unk_18 |= v1; - } else { - v8->unk_18 &= (v1 ^ 0xffffffffffffffff); - } - break; - case MON_DATA_144: - for (v0 = 0; v0 < NELEMS(v9->unk_00); v0++) { - v9->unk_00[v0] = v4[v0]; - } - break; - case MON_DATA_145: - Strbuf_ToChars((Strbuf *)param2, v9->unk_00, NELEMS(v9->unk_00)); - break; - case MON_DATA_146: - v9->unk_10 = v5[0]; - break; - case MON_DATA_147: - v9->unk_11 = v5[0]; - break; - case MON_DATA_148: - v9->unk_12 = v5[0]; - break; - case MON_DATA_149: - v9->unk_13 = v5[0]; - break; - case MON_DATA_150: - v9->unk_14 = v5[0]; - break; - case MON_DATA_151: - v9->unk_15 = v5[0]; - break; - case MON_DATA_152: - case MON_DATA_115: - if ((v4[0] == 0) || (sub_0201708C(v4[0]) == 1)) { - v9->unk_16 = v4[0]; - v7->unk_1C = v4[0]; - } else { - v9->unk_16 = 3002; - v7->unk_1C = v4[0]; - } - break; - case MON_DATA_153: - case MON_DATA_116: - if ((v4[0] == 0) || (sub_0201708C(v4[0]) == 1)) { - v9->unk_18 = v4[0]; - v7->unk_1E = v4[0]; - } else { - v9->unk_18 = 3002; - v7->unk_1E = v4[0]; - } - break; - case MON_DATA_POKERUS: - v9->unk_1A = v5[0]; - break; - case MON_DATA_POKEBALL: - v9->unk_1B = v5[0]; - break; - case MON_DATA_MET_LEVEL: - v9->unk_1C_0 = v5[0]; - break; - case MON_DATA_OT_GENDER: - v9->unk_1C_7 = v5[0]; - break; - case MON_DATA_158: - v9->unk_1D = v5[0]; - break; - case MON_DATA_159: - v9->unk_1E = v4[0]; - break; - case MON_DATA_175: - v7->unk_10_0 = (v3[0] >> 0) & 0x1f; - v7->unk_10_5 = (v3[0] >> 5) & 0x1f; - v7->unk_10_10 = (v3[0] >> 10) & 0x1f; - v7->unk_10_15 = (v3[0] >> 15) & 0x1f; - v7->unk_10_20 = (v3[0] >> 20) & 0x1f; - v7->unk_10_25 = (v3[0] >> 25) & 0x1f; - break; - case MON_DATA_176: - case MON_DATA_177: - case MON_DATA_178: - break; - case MON_DATA_179: - { - Strbuf* v13; - - v13 = sub_0200B32C(v6->species, 0); - - Strbuf_ToChars(v13, v8->unk_00, NELEMS(v8->unk_00)); - Strbuf_Free(v13); - } - break; - } -} - -void sub_0207536C (Pokemon * param0, int param1, int param2) -{ - u16 v0; - - if (param0->box.unk_04_0 == 0) { - sub_02078234(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - sub_02078234(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - - v0 = sub_0207823C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4); - - if (v0 != param0->box.unk_06) { - GF_ASSERT((v0 == param0->box.unk_06)); - sub_0207822C(param0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - return; - } - } - - sub_020753F4(param0, param1, param2); - - if (param0->box.unk_04_0 == 0) { - sub_0207822C(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - param0->box.unk_06 = sub_0207823C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4); - sub_0207822C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - } -} - -static void sub_020753F4 (Pokemon * param0, int param1, int param2) -{ - switch (param1) { - case 163: - if ((param0->party.unk_06 + param2) > param0->party.unk_08) { - param0->party.unk_06 = param0->party.unk_08; - } else { - param0->party.unk_06 += param2; - } - break; - case 160: - case 161: - case 162: - case 164: - case 165: - case 166: - case 167: - case 168: - case 169: - case 170: - GF_ASSERT(0); - break; - default: - sub_02075454((BoxPokemon *)¶m0->box, param1, param2); - break; - } -} - -static void sub_02075454 (BoxPokemon * param0, int param1, int param2) -{ - int v0; - u16 v1; - PokemonSubstruct0 * v2; - PokemonSubstruct1 * v3; - PokemonSubstruct2 * v4; - PokemonSubstruct3 * v5; - - v2 = (PokemonSubstruct0 *)sub_0207825C(param0, param0->unk_00, 0); - v3 = (PokemonSubstruct1 *)sub_0207825C(param0, param0->unk_00, 1); - v4 = (PokemonSubstruct2 *)sub_0207825C(param0, param0->unk_00, 2); - v5 = (PokemonSubstruct3 *)sub_0207825C(param0, param0->unk_00, 3); - - switch (param1) { - case MON_DATA_EXP: - if ((v2->unk_08 + param2) > sub_02075AD0(v2->species, 100)) { - v2->unk_08 = sub_02075AD0(v2->species, 100); - } else { - v2->unk_08 += param2; - } - break; - case MON_DATA_FRIENDSHIP: - { - int v6; - - v6 = v2->friendship; - - if ((v6 + param2) > 255) { - v6 = 255; - } - - if ((v6 + param2) < 0) { - v6 = 0; - } else { - v6 += param2; - } - - v2->friendship = v6; - } - break; - case MON_DATA_HP_EV: - v2->unk_10 += param2; - break; - case MON_DATA_ATK_EV: - v2->unk_11 += param2; - break; - case MON_DATA_DEF_EV: - v2->unk_12 += param2; - break; - case MON_DATA_SPEED_EV: - v2->unk_13 += param2; - break; - case MON_DATA_SPATK_EV: - v2->unk_14 += param2; - break; - case MON_DATA_SPDEF_EV: - v2->unk_15 += param2; - break; - case MON_DATA_COOL: - if ((v2->unk_16 + param2) > 255) { - v2->unk_16 = 255; - } else { - v2->unk_16 += param2; - } - break; - case MON_DATA_BEAUTY: - if ((v2->unk_17 + param2) > 255) { - v2->unk_17 = 255; - } else { - v2->unk_17 += param2; - } - break; - case MON_DATA_CUTE: - if ((v2->unk_18 + param2) > 255) { - v2->unk_18 = 255; - } else { - v2->unk_18 += param2; - } - break; - case MON_DATA_SMART: - if ((v2->unk_19 + param2) > 255) { - v2->unk_19 = 255; - } else { - v2->unk_19 += param2; - } - break; - case MON_DATA_TOUGH: - if ((v2->unk_1A + param2) > 255) { - v2->unk_1A = 255; - } else { - v2->unk_1A += param2; - } - break; - case MON_DATA_SHEEN: - if ((v2->unk_1B + param2) > 255) { - v2->unk_1B = 255; - } else { - v2->unk_1B += param2; - } - break; - case MON_DATA_58: - case MON_DATA_59: - case MON_DATA_60: - case MON_DATA_61: - if ((v3->unk_08[param1 - 58] + param2) > MoveTable_CalcMaxPP(v3->unk_00[param1 - 58], v3->unk_0C[param1 - 58])) { - v3->unk_08[param1 - 58] = MoveTable_CalcMaxPP(v3->unk_00[param1 - 58], v3->unk_0C[param1 - 58]); - } else { - v3->unk_08[param1 - 58] += param2; - } - break; - case MON_DATA_62: - case MON_DATA_63: - case MON_DATA_64: - case MON_DATA_65: - if ((v3->unk_0C[param1 - 62] + param2) > 3) { - v3->unk_0C[param1 - 62] = 3; - } else { - v3->unk_0C[param1 - 62] += param2; - } - break; - case MON_DATA_66: - case MON_DATA_67: - case MON_DATA_68: - case MON_DATA_69: - break; - case MON_DATA_HP_IV: - if ((v3->unk_10_0 + param2) > 31) { - v3->unk_10_0 = 31; - } else { - v3->unk_10_0 += param2; - } - break; - case MON_DATA_ATK_IV: - if ((v3->unk_10_5 + param2) > 31) { - v3->unk_10_5 = 31; - } else { - v3->unk_10_5 += param2; - } - break; - case MON_DATA_DEF_IV: - if ((v3->unk_10_10 + param2) > 31) { - v3->unk_10_10 = 31; - } else { - v3->unk_10_10 += param2; - } - break; - case MON_DATA_SPEED_IV: - if ((v3->unk_10_15 + param2) > 31) { - v3->unk_10_15 = 31; - } else { - v3->unk_10_15 += param2; - } - break; - case MON_DATA_SPATK_IV: - if ((v3->unk_10_20 + param2) > 31) { - v3->unk_10_20 = 31; - } else { - v3->unk_10_20 += param2; - } - break; - case MON_DATA_SPDEF_IV: - if ((v3->unk_10_25 + param2) > 31) { - v3->unk_10_25 = 31; - } else { - v3->unk_10_25 += param2; - } - break; - case MON_DATA_PERSONALITY: - case MON_DATA_1: - case MON_DATA_2: - case MON_DATA_4: - case MON_DATA_SPECIES: - case MON_DATA_HELD_ITEM: - case MON_DATA_OT_ID: - case MON_DATA_10: - case MON_DATA_11: - case MON_DATA_LANGUAGE: - case MON_DATA_25: - case MON_DATA_26: - case MON_DATA_27: - case MON_DATA_28: - case MON_DATA_29: - case MON_DATA_30: - case MON_DATA_31: - case MON_DATA_32: - case MON_DATA_33: - case MON_DATA_34: - case MON_DATA_35: - case MON_DATA_36: - case MON_DATA_37: - case MON_DATA_38: - case MON_DATA_39: - case MON_DATA_40: - case MON_DATA_41: - case MON_DATA_42: - case MON_DATA_43: - case MON_DATA_44: - case MON_DATA_45: - case MON_DATA_46: - case MON_DATA_47: - case MON_DATA_48: - case MON_DATA_49: - case MON_DATA_50: - case MON_DATA_51: - case MON_DATA_52: - case MON_DATA_53: - case MON_DATA_MOVE1: - case MON_DATA_MOVE2: - case MON_DATA_MOVE3: - case MON_DATA_MOVE4: - case MON_DATA_IS_EGG: - case MON_DATA_77: - case MON_DATA_78: - case MON_DATA_79: - case MON_DATA_80: - case MON_DATA_81: - case MON_DATA_82: - case MON_DATA_83: - case MON_DATA_84: - case MON_DATA_85: - case MON_DATA_86: - case MON_DATA_87: - case MON_DATA_88: - case MON_DATA_89: - case MON_DATA_90: - case MON_DATA_91: - case MON_DATA_92: - case MON_DATA_93: - case MON_DATA_94: - case MON_DATA_95: - case MON_DATA_96: - case MON_DATA_97: - case MON_DATA_CHAMPION_RIBBON: - case MON_DATA_WINNING_RIBBON: - case MON_DATA_VICTORY_RIBBON: - case MON_DATA_ARTIST_RIBBON: - case MON_DATA_EFFORT_RIBBON: - case MON_DATA_MARINE_RIBBON: - case MON_DATA_LAND_RIBBON: - case MON_DATA_SKY_RIBBON: - case MON_DATA_COUNTRY_RIBBON: - case MON_DATA_NATIONAL_RIBBON: - case MON_DATA_EARTH_RIBBON: - case MON_DATA_WORLD_RIBBON: - case MON_DATA_FATEFUL_ENCOUNTER: - case MON_DATA_111: - case MON_DATA_FORM: - case MON_DATA_113: - case MON_DATA_114: - case MON_DATA_117: - case MON_DATA_119: - case MON_DATA_120: - case MON_DATA_121: - case MON_DATA_MET_GAME: - case MON_DATA_123: - case MON_DATA_124: - case MON_DATA_125: - case MON_DATA_126: - case MON_DATA_127: - case MON_DATA_128: - case MON_DATA_129: - case MON_DATA_130: - case MON_DATA_131: - case MON_DATA_132: - case MON_DATA_133: - case MON_DATA_134: - case MON_DATA_135: - case MON_DATA_136: - case MON_DATA_137: - case MON_DATA_138: - case MON_DATA_139: - case MON_DATA_140: - case MON_DATA_141: - case MON_DATA_142: - case MON_DATA_143: - case MON_DATA_144: - case MON_DATA_145: - case MON_DATA_146: - case MON_DATA_147: - case MON_DATA_148: - case MON_DATA_149: - case MON_DATA_150: - case MON_DATA_151: - case MON_DATA_152: - case MON_DATA_153: - case MON_DATA_POKERUS: - case MON_DATA_POKEBALL: - case MON_DATA_MET_LEVEL: - case MON_DATA_OT_GENDER: - case MON_DATA_158: - case MON_DATA_159: - case MON_DATA_175: - case MON_DATA_176: - case MON_DATA_177: - case MON_DATA_178: - case MON_DATA_179: - default: - GF_ASSERT(0); - break; - } -} - -UnkStruct_02075874 * sub_02075874 (int param0, int param1, int param2) -{ - UnkStruct_02075874 * v0; - - v0 = Heap_AllocFromHeap(param2, sizeof(UnkStruct_02075874)); - sub_02078208(param0, param1, v0); - - return v0; -} - -UnkStruct_02075874 * sub_02075894 (int param0, int param1) -{ - UnkStruct_02075874 * v0; - - v0 = Heap_AllocFromHeap(param1, sizeof(UnkStruct_02075874)); - sub_020781F8(param0, v0); - - return v0; -} - -u32 sub_020758B0 (UnkStruct_02075874 * param0, int param1) -{ - u32 v0; - - GF_ASSERT(param0); - - switch (param1) { - case 0: - v0 = param0->unk_00; - break; - case 1: - v0 = param0->unk_01; - break; - case 2: - v0 = param0->unk_02; - break; - case 3: - v0 = param0->unk_03; - break; - case 4: - v0 = param0->unk_04; - break; - case 5: - v0 = param0->unk_05; - break; - case 6: - v0 = param0->unk_06; - break; - case 7: - v0 = param0->unk_07; - break; - case 8: - v0 = param0->unk_08; - break; - case 9: - v0 = param0->unk_09; - break; - case 10: - v0 = param0->unk_0A_0; - break; - case 11: - v0 = param0->unk_0A_2; - break; - case 12: - v0 = param0->unk_0A_4; - break; - case 13: - v0 = param0->unk_0A_6; - break; - case 14: - v0 = param0->unk_0A_8; - break; - case 15: - v0 = param0->unk_0A_10; - break; - case 16: - v0 = param0->unk_0C; - break; - case 17: - v0 = param0->unk_0E; - break; - case 18: - v0 = param0->unk_10; - break; - case 19: - v0 = param0->unk_11; - break; - case 20: - v0 = param0->unk_12; - break; - case 21: - v0 = param0->unk_13; - break; - case 22: - v0 = param0->unk_14; - break; - case 23: - v0 = param0->unk_15; - break; - case 24: - v0 = param0->unk_16; - break; - case 25: - v0 = param0->unk_17; - break; - case 26: - v0 = param0->unk_18; - break; - case 27: - v0 = param0->unk_19_0; - break; - case 28: - v0 = param0->unk_19_7; - break; - case 29: - v0 = param0->unk_1C; - break; - case 30: - v0 = param0->unk_20; - break; - case 31: - v0 = param0->unk_24; - break; - case 32: - v0 = param0->unk_28; - break; - } - - return v0; -} - -void sub_020759B8 (UnkStruct_02075874 * param0) -{ - GF_ASSERT(param0); - Heap_FreeToHeap(param0); -} - -u32 sub_020759CC (int param0, int param1, int param2) -{ - u32 v0; - UnkStruct_02075874 * v1; - - param0 = sub_02078740(param0, param1); - - v1 = sub_02075894(param0, 0); - v0 = sub_020758B0(v1, param2); - - sub_020759B8(v1); - - return v0; -} - -u32 sub_020759F0 (int param0, int param1) -{ - u32 v0; - UnkStruct_02075874 * v1; - - v1 = sub_02075894(param0, 0); - v0 = sub_020758B0(v1, param1); - - sub_020759B8(v1); - - return v0; -} - -u8 sub_02075A10 (Pokemon * param0) -{ - u16 v0; - u8 v1; - u32 v2; - u32 v3; - u32 v4; - u8 v5; - BOOL v6; - - v6 = sub_02073C88(param0); - v0 = GetMonData(param0, MON_DATA_SPECIES, NULL); - v1 = GetMonData(param0, MON_DATA_161, NULL); - v2 = sub_02075AD0(v0, v1); - v4 = sub_02075AD0(v0, v1 + 1); - v3 = GetMonData(param0, MON_DATA_EXP, NULL); - - sub_02073CD4(param0, v6); - v5 = ((v3 - v2) * 100) / (v4 - v2); - - return v5; -} - -u32 sub_02075A70 (Pokemon * param0) -{ - return sub_02075A78(¶m0->box); -} - -u32 sub_02075A78 (BoxPokemon * param0) -{ - u16 v0 = sub_02074570(param0, MON_DATA_SPECIES, NULL); - u16 v1 = sub_02075B40(param0) + 1; - u32 v2 = sub_02074570(param0, MON_DATA_EXP, NULL); - - return sub_02075AD0(v0, v1) - v2; -} - -u32 sub_02075AAC (Pokemon * param0) -{ - return sub_02075AD0(GetMonData(param0, MON_DATA_SPECIES, NULL), GetMonData(param0, MON_DATA_161, NULL)); -} - -u32 sub_02075AD0 (int param0, int param1) -{ - return sub_02075B00(sub_020759F0(param0, 21), param1); -} - -void sub_02075AE4 (int param0, u32 * param1) -{ - GF_ASSERT(param0 < 8); - NARC_ReadWholeMemberByIndexPair(param1, NARC_INDEX_POKETOOL__PERSONAL__PL_GROWTBL, param0); -} - -u32 sub_02075B00 (int param0, int param1) -{ - u32 v0; - u32 * v1; - - GF_ASSERT(param0 < 8); - GF_ASSERT(param1 <= 101); - - v1 = Heap_AllocFromHeap(0, 101 * 4); - sub_02075AE4(param0, v1); - - v0 = v1[param1]; - Heap_FreeToHeap(v1); - - return v0; -} - -u32 sub_02075B38 (Pokemon * param0) -{ - return sub_02075B40(¶m0->box); -} - -u32 sub_02075B40 (BoxPokemon * param0) -{ - int v0; - u32 v1; - BOOL v2; - - v2 = sub_02073D20(param0); - v0 = sub_02074570(param0, MON_DATA_SPECIES, 0); - v1 = sub_02074570(param0, MON_DATA_EXP, 0); - - sub_02073D48(param0, v2); - - return sub_02075B78(v0, v1); -} - -u32 sub_02075B78 (u16 param0, u32 param1) -{ - int v0; - u32 v1; - u32 * v2; - UnkStruct_02075874 * v3 = sub_02075894(param0, 0); - - v1 = sub_02075B9C(v3, param0, param1); - sub_020759B8(v3); - - return v1; -} - -u32 sub_02075B9C (UnkStruct_02075874 * param0, u16 param1, u32 param2) -{ - static u32 v0[101]; - int v1, v2; - - v1 = sub_020758B0(param0, 21); - sub_02075AE4(v1, v0); - - for (v2 = 1; v2 < 101; v2++) { - if (v0[v2] > param2) { - break; - } - } - - return v2 - 1; -} - -u8 sub_02075BCC (Pokemon * param0) -{ - return sub_02075BD4(¶m0->box); -} - -u8 sub_02075BD4 (BoxPokemon * param0) -{ - BOOL v0; - u32 v1; - - v0 = sub_02073D20(param0); - v1 = sub_02074570(param0, MON_DATA_PERSONALITY, 0); - - sub_02073D48(param0, v0); - - return GetNatureFromPersonality(v1); -} - -u8 GetNatureFromPersonality (u32 param0) -{ - return (u8)(param0 % 25); -} - -static const s8 Unk_020F0618[][5] = { - {0x0, 0x0, 0x0, 0x0, 0x0}, - {0x1, -1, 0x0, 0x0, 0x0}, - {0x1, 0x0, -1, 0x0, 0x0}, - {0x1, 0x0, 0x0, -1, 0x0}, - {0x1, 0x0, 0x0, 0x0, -1}, - {-1, 0x1, 0x0, 0x0, 0x0}, - {0x0, 0x0, 0x0, 0x0, 0x0}, - {0x0, 0x1, -1, 0x0, 0x0}, - {0x0, 0x1, 0x0, -1, 0x0}, - {0x0, 0x1, 0x0, 0x0, -1}, - {-1, 0x0, 0x1, 0x0, 0x0}, - {0x0, -1, 0x1, 0x0, 0x0}, - {0x0, 0x0, 0x0, 0x0, 0x0}, - {0x0, 0x0, 0x1, -1, 0x0}, - {0x0, 0x0, 0x1, 0x0, -1}, - {-1, 0x0, 0x0, 0x1, 0x0}, - {0x0, -1, 0x0, 0x1, 0x0}, - {0x0, 0x0, -1, 0x1, 0x0}, - {0x0, 0x0, 0x0, 0x0, 0x0}, - {0x0, 0x0, 0x0, 0x1, -1}, - {-1, 0x0, 0x0, 0x0, 0x1}, - {0x0, -1, 0x0, 0x0, 0x1}, - {0x0, 0x0, -1, 0x0, 0x1}, - {0x0, 0x0, 0x0, -1, 0x1}, - {0x0, 0x0, 0x0, 0x0, 0x0} -}; - -u16 sub_02075C0C (u8 param0, u16 param1, u8 param2) -{ - u16 v0; - - if ((param2 < 0x1) || (param2 > 0x5)) { - return param1; - } - - switch (Unk_020F0618[param0][param2 - 1]) { - case 1: - v0 = param1 * 110; - v0 /= 100; - break; - case -1: - v0 = param1 * 90; - v0 /= 100; - break; - default: - v0 = param1; - break; - } - - return v0; -} - -s8 sub_02075C60 (u8 param0, u8 param1) -{ - return Unk_020F0618[param0][param1 - 1]; -} - -static const s8 Unk_020F05A0[][3] = { - {0x5, 0x3, 0x2}, - {0x5, 0x3, 0x2}, - {0x1, 0x1, 0x0}, - {0x3, 0x2, 0x1}, - {0x1, 0x1, 0x0}, - {0x1, 0x1, 0x1}, - {-1, -1, -1}, - {-5, -5, -10}, - {-5, -5, -10}, - {0x3, 0x2, 0x1} -}; - -void sub_02075C74 (Pokemon * param0, u8 param1, u16 param2) -{ - u16 v0; - u16 v1; - s16 v2; - s8 v3; - u8 v4; - u8 v5; - - if (param1 == 5) { - if (LCRNG_Next() & 1) { - return; - } - } - - v0 = GetMonData(param0, MON_DATA_SPECIES_EGG, NULL); - - if ((v0 == 0) || (v0 == 494)) { - return; - } - - v1 = GetMonData(param0, MON_DATA_HELD_ITEM, NULL); - v5 = Item_LoadParam(v1, 1, 0); - v4 = 0; - v2 = GetMonData(param0, MON_DATA_FRIENDSHIP, NULL); - - if (v2 >= 100) { - v4++; - } - - if (v2 >= 200) { - v4++; - } - - v3 = Unk_020F05A0[param1][v4]; - - if ((v3 > 0) && (GetMonData(param0, MON_DATA_POKEBALL, NULL) == 11)) { - v3++; - } - - if ((v3 > 0) && (GetMonData(param0, MON_DATA_152, NULL) == param2)) { - v3++; - } - - if (v3 > 0) { - if (v5 == 53) { - v3 = v3 * 150 / 100; - } - } - - v2 += v3; - - if (v2 < 0) { - v2 = 0; - } - - if (v2 > 255) { - v2 = 255; - } - - sub_02074B30(param0, 9, (u8 *)&v2); -} - -u8 sub_02075D6C (Pokemon * param0) -{ - return sub_02075D74((BoxPokemon *)¶m0->box); -} - -u8 sub_02075D74 (BoxPokemon * param0) -{ - u16 v0; - u32 v1; - int v2; - - v2 = sub_02073D20(param0); - v0 = sub_02074570(param0, MON_DATA_SPECIES, 0); - v1 = sub_02074570(param0, MON_DATA_PERSONALITY, 0); - - sub_02073D48(param0, v2); - - return sub_02075DAC(v0, v1); -} - -u8 sub_02075DAC (u16 param0, u32 param1) -{ - UnkStruct_02075874 * v0; - u8 v1; - - v0 = sub_02075894(param0, 0); - v1 = sub_02075DD0(v0, param0, param1); - - sub_020759B8(v0); - - return v1; -} - -u8 sub_02075DD0 (UnkStruct_02075874 * param0, u16 param1, u32 param2) -{ - u8 v0 = sub_020758B0(param0, 18); - - switch (v0) { - case 0: - return 0; - case 254: - return 1; - case 255: - return 2; - } - - if (v0 > (param2 & 0xff)) { - return 1; - } else { - return 0; - } -} - -u8 sub_02075E0C (Pokemon * param0) -{ - return sub_02075E14(¶m0->box); -} - -u8 sub_02075E14 (BoxPokemon * param0) -{ - u32 v0; - u32 v1; - - v0 = sub_02074570(param0, MON_DATA_OT_ID, 0); - v1 = sub_02074570(param0, MON_DATA_PERSONALITY, 0); - - return sub_02075E38(v0, v1); -} - -u8 sub_02075E38 (u32 param0, u32 param1) -{ - return (((param0 & 0xffff0000) >> 16) ^ (param0 & 0xffff) ^ ((param1 & 0xffff0000) >> 16) ^ (param1 & 0xffff)) < 8; -} - -u32 sub_02075E64 (u32 param0) -{ - int v0; - u32 v1; - u16 v2; - u16 v3; - - param0 = (((param0 & 0xffff0000) >> 16) ^ (param0 & 0xffff)) >> 3; - - v2 = LCRNG_Next() & 0x7; - v3 = LCRNG_Next() & 0x7; - - for (v0 = 0; v0 < 13; v0++) { - if (param0 & FlagIndex(v0)) { - if (LCRNG_Next() & 1) { - v2 |= FlagIndex(v0 + 3); - } else { - v3 |= FlagIndex(v0 + 3); - } - } else { - if (LCRNG_Next() & 1) { - v2 |= FlagIndex(v0 + 3); - v3 |= FlagIndex(v0 + 3); - } - } - } - - v1 = v2 | (v3 << 16); - - return v1; -} - -void sub_02075EF4 (UnkStruct_02008A90 * param0, Pokemon * param1, u8 param2) -{ - sub_02075F0C(param0, ¶m1->box, param2, 0); -} - -void sub_02075F00 (UnkStruct_02008A90 * param0, Pokemon * param1, u8 param2) -{ - sub_02075F0C(param0, ¶m1->box, param2, 1); -} - -void sub_02075F0C (UnkStruct_02008A90 * param0, BoxPokemon * param1, u8 param2, int param3) -{ - BOOL v0; - u16 v1; - u8 v2, v3, v4; - u32 v5; - - v0 = sub_02073D20(param1); - v1 = sub_02074570(param1, MON_DATA_SPECIES_EGG, NULL); - v2 = sub_02075D74(param1); - v3 = sub_02075E14(param1); - v5 = sub_02074570(param1, MON_DATA_PERSONALITY, NULL); - - if (v1 == 494) { - if (sub_02074570(param1, MON_DATA_SPECIES, NULL) == 490) { - v4 = 1; - } else { - v4 = 0; - } - } else { - v4 = sub_02074570(param1, MON_DATA_FORM, NULL); - } - - if (param3 == 1) { - sub_02076300(param0, v1, v2, param2, v3, v4, v5); - } else { - sub_02075FB4(param0, v1, v2, param2, v3, v4, v5); - } - - sub_02073D48(param1, v0); -} - -void sub_02075FB4 (UnkStruct_02008A90 * param0, u16 param1, u8 param2, u8 param3, u8 param4, u8 param5, u32 param6) -{ - param0->unk_06 = 0; - param0->unk_08 = 0; - param0->unk_0C = 0; - param5 = SanitizeFormId(param1, param5); - - switch (param1) { - case 412: - param0->unk_00 = 117; - param0->unk_02 = 72 + (param3 / 2) + param5 * 2; - param0->unk_04 = 166 + param4 + param5 * 2; - break; - case 413: - param0->unk_00 = 117; - param0->unk_02 = 78 + (param3 / 2) + param5 * 2; - param0->unk_04 = 172 + param4 + param5 * 2; - break; - case 422: - param0->unk_00 = 117; - param0->unk_02 = 84 + param3 + param5; - param0->unk_04 = 178 + param4 + param5 * 2; - break; - case 423: - param0->unk_00 = 117; - param0->unk_02 = 88 + param3 + param5; - param0->unk_04 = 182 + param4 + param5 * 2; - break; - case 421: - param0->unk_00 = 117; - param0->unk_02 = 92 + param3 + param5; - param0->unk_04 = 186 + (param4 * 2) + param5; - break; - case 493: - param0->unk_00 = 117; - param0->unk_02 = 96 + (param3 / 2) + param5 * 2; - param0->unk_04 = 190 + param4 + param5 * 2; - break; - case 351: - param0->unk_00 = 117; - param0->unk_02 = 64 + (param3 * 2) + param5; - param0->unk_04 = 158 + (param4 * 4) + param5; - break; - case 386: - param0->unk_00 = 117; - param0->unk_02 = 0 + (param3 / 2) + param5 * 2; - param0->unk_04 = 154 + param4; - break; - case 201: - param0->unk_00 = 117; - param0->unk_02 = 8 + (param3 / 2) + param5 * 2; - param0->unk_04 = 156 + param4; - break; - case 494: - param0->unk_00 = 117; - param0->unk_02 = 132 + param5; - param0->unk_04 = 226 + param5; - break; - case 495: - param0->unk_00 = 117; - param0->unk_02 = 132; - param0->unk_04 = 226; - break; - case 492: - param0->unk_00 = 117; - param0->unk_02 = 134 + (param3 / 2) + param5 * 2; - param0->unk_04 = 228 + param4 + param5 * 2; - break; - case 479: - param0->unk_00 = 117; - param0->unk_02 = 138 + (param3 / 2) + param5 * 2; - param0->unk_04 = 232 + param4 + param5 * 2; - break; - case 487: - param0->unk_00 = 117; - param0->unk_02 = 150 + (param3 / 2) + param5 * 2; - param0->unk_04 = 244 + param4 + param5 * 2; - break; - default: - param0->unk_00 = 4; - param0->unk_02 = param1 * 6 + param3 + ((param2 != 1) ? 1 : 0); - param0->unk_04 = param1 * 6 + 4 + param4; - - if ((param1 == 327) && (param3 == 2)) { - param0->unk_06 = 327; - param0->unk_08 = 0; - param0->unk_0C = param6; - } - - break; - } -} - -u8 SanitizeFormId (u16 param0, u8 param1) -{ - switch (param0) { - case 412: - if (param1 > 2) { - param1 = 0; - } - break; - case 413: - - if (param1 > 2) { - param1 = 0; - } - break; - case 422: - if (param1 > 1) { - param1 = 0; - } - break; - case 423: - if (param1 > 1) { - param1 = 0; - } - break; - case 421: - if (param1 > 1) { - param1 = 0; - } - break; - case 493: - if (param1 > 17) { - param1 = 0; - } - break; - case 351: - if (param1 > 3) { - param1 = 0; - } - break; - case 386: - if (param1 > 3) { - param1 = 0; - } - break; - case 201: - if (param1 >= 28) { - param1 = 0; - } - break; - case 494: - if (param1 > 1) { - param1 = 0; - } - break; - case 492: - if (param1 > 1) { - param1 = 0; - } - break; - case 479: - if (param1 > 5) { - param1 = 0; - } - break; - case 487: - if (param1 > 1) { - param1 = 0; - } - break; - } - - return param1; -} - -static void sub_02076300 (UnkStruct_02008A90 * param0, u16 param1, u8 param2, u8 param3, u8 param4, u8 param5, u32 param6) -{ - param0->unk_06 = 0; - param0->unk_08 = 0; - param0->unk_0C = 0; - - param5 = SanitizeFormId(param1, param5); - - switch (param1) { - case 412: - param0->unk_00 = 166; - param0->unk_02 = 72 + (param3 / 2) + param5 * 2; - param0->unk_04 = 146 + param4 + param5 * 2; - break; - case 413: - param0->unk_00 = 166; - param0->unk_02 = 78 + (param3 / 2) + param5 * 2; - param0->unk_04 = 152 + param4 + param5 * 2; - break; - case 422: - param0->unk_00 = 166; - param0->unk_02 = 84 + param3 + param5; - param0->unk_04 = 158 + param4 + param5 * 2; - break; - case 423: - param0->unk_00 = 166; - param0->unk_02 = 88 + param3 + param5; - param0->unk_04 = 162 + param4 + param5 * 2; - break; - case 421: - param0->unk_00 = 166; - param0->unk_02 = 92 + param3 + param5; - param0->unk_04 = 166 + (param4 * 2) + param5; - break; - case 493: - param0->unk_00 = 166; - param0->unk_02 = 96 + (param3 / 2) + param5 * 2; - param0->unk_04 = 170 + param4 + param5 * 2; - break; - case 351: - param0->unk_00 = 166; - param0->unk_02 = 64 + (param3 * 2) + param5; - param0->unk_04 = 138 + (param4 * 4) + param5; - break; - case 386: - param0->unk_00 = 166; - param0->unk_02 = 0 + (param3 / 2) + param5 * 2; - param0->unk_04 = 134 + param4; - break; - case 201: - param0->unk_00 = 166; - param0->unk_02 = 8 + (param3 / 2) + param5 * 2; - param0->unk_04 = 136 + param4; - break; - case 494: - param0->unk_00 = 166; - param0->unk_02 = 132 + param5; - param0->unk_04 = 206 + param5; - break; - case 495: - param0->unk_00 = 166; - param0->unk_02 = 132; - param0->unk_04 = 206; - break; - case 492: - if (param5 > 0) { - param0->unk_00 = 117; - param0->unk_02 = 134 + (param3 / 2) + param5 * 2; - param0->unk_04 = 230 + param4; - } else { - param0->unk_00 = 165; - param0->unk_02 = param1 * 6 + param3 + ((param2 != 1) ? 1 : 0); - param0->unk_04 = param1 * 6 + 4 + param4; - } - break; - case 479: - if (param5 > 0) { - param0->unk_00 = 117; - param0->unk_02 = 138 + (param3 / 2) + param5 * 2; - param0->unk_04 = 232 + param4 + param5 * 2; - } else { - param0->unk_00 = 165; - param0->unk_02 = param1 * 6 + param3 + ((param2 != 1) ? 1 : 0); - param0->unk_04 = param1 * 6 + 4 + param4; - } - break; - case 487: - if (param5 > 0) { - param0->unk_00 = 117; - param0->unk_02 = 150 + (param3 / 2) + param5 * 2; - param0->unk_04 = 244 + param4 + param5 * 2; - } else { - param0->unk_00 = 165; - param0->unk_02 = param1 * 6 + param3 + ((param2 != 1) ? 1 : 0); - param0->unk_04 = param1 * 6 + 4 + param4; - } - break; - default: - param0->unk_00 = 165; - param0->unk_02 = param1 * 6 + param3 + ((param2 != 1) ? 1 : 0); - param0->unk_04 = param1 * 6 + 4 + param4; - - if ((param1 == 327) && (param3 == 2)) { - param0->unk_06 = 327; - param0->unk_08 = 0; - param0->unk_0C = param6; - } - - break; - } -} - -u8 sub_020765AC (Pokemon * param0, u8 param1) -{ - return sub_020765C4(¶m0->box, param1, 0); -} - -u8 sub_020765B8 (Pokemon * param0, u8 param1) -{ - return sub_020765C4(¶m0->box, param1, 1); -} - -u8 sub_020765C4 (BoxPokemon * param0, u8 param1, int param2) -{ - u16 v0; - u8 v1; - u8 v2; - u32 v3; - - v0 = sub_02074570(param0, MON_DATA_SPECIES_EGG, NULL); - v1 = sub_02075D74(param0); - v3 = sub_02074570(param0, MON_DATA_PERSONALITY, NULL); - - if (v0 == 494) { - if (sub_02074570(param0, MON_DATA_SPECIES, NULL) == 490) { - v2 = 1; - } else { - v2 = 0; - } - } else { - v2 = sub_02074570(param0, MON_DATA_FORM, NULL); - } - - if (param2 == 1) { - return sub_020767BC(v0, v1, param1, v2, v3); - } - - return sub_02076648(v0, v1, param1, v2, v3); -} - -u8 sub_02076648 (u16 param0, u8 param1, u8 param2, u8 param3, u32 param4) -{ - int v0; - int v1; - u8 v2; - - param3 = SanitizeFormId(param0, param3); - - switch (param0) { - case 412: - v0 = 121; - v1 = 72 + (param2 / 2) + param3 * 2; - break; - case 413: - v0 = 121; - v1 = 78 + (param2 / 2) + param3 * 2; - break; - case 422: - v0 = 121; - v1 = 84 + param2 + param3; - break; - case 423: - v0 = 121; - v1 = 88 + param2 + param3; - break; - case 421: - v0 = 121; - v1 = 92 + param2 + param3; - break; - case 493: - v0 = 121; - v1 = 96 + (param2 / 2) + param3 * 2; - break; - case 351: - v0 = 121; - v1 = 64 + param2 * 2 + param3; - break; - case 386: - v0 = 121; - v1 = 0 + (param2 / 2) + param3 * 2; - break; - case 201: - v0 = 121; - v1 = 8 + (param2 / 2) + param3 * 2; - break; - case 494: - v0 = 121; - v1 = 132 + param3; - break; - case 495: - v0 = 121; - v1 = 132; - break; - case 492: - v0 = 121; - v1 = 136 + (param2 / 2) + param3 * 2; - break; - case 479: - v0 = 121; - v1 = 140 + (param2 / 2) + param3 * 2; - break; - case 487: - v0 = 121; - v1 = 152 + (param2 / 2) + param3 * 2; - break; - default: - v0 = 5; - v1 = param0 * 4 + param2 + ((param1 != 1) ? 1 : 0); - break; - } - - NARC_ReadWholeMemberByIndexPair(&v2, v0, v1); - - return v2; -} - -static u8 sub_020767BC (u16 param0, u8 param1, u8 param2, u8 param3, u32 param4) -{ - int v0; - int v1; - u8 v2; - - param3 = SanitizeFormId(param0, param3); - - switch (param0) { - case 412: - v0 = 168; - v1 = 72 + (param2 / 2) + param3 * 2; - break; - case 413: - v0 = 168; - v1 = 78 + (param2 / 2) + param3 * 2; - break; - case 422: - v0 = 168; - v1 = 84 + param2 + param3; - break; - case 423: - v0 = 168; - v1 = 88 + param2 + param3; - break; - case 421: - v0 = 168; - v1 = 92 + param2 + param3; - break; - case 493: - v0 = 168; - v1 = 96 + (param2 / 2) + param3 * 2; - break; - case 351: - v0 = 168; - v1 = 64 + param2 * 2 + param3; - break; - case 386: - v0 = 168; - v1 = 0 + (param2 / 2) + param3 * 2; - break; - case 201: - v0 = 168; - v1 = 8 + (param2 / 2) + param3 * 2; - break; - case 494: - v0 = 168; - v1 = 132 + param3; - break; - case 495: - v0 = 168; - v1 = 132; - break; - case 492: - if (param3 > 0) { - v0 = 121; - v1 = 136 + (param2 / 2) + param3 * 2; - } else { - v0 = 167; - v1 = param0 * 4 + param2 + ((param1 != 1) ? 1 : 0); - } - break; - case 479: - if (param3 > 0) { - v0 = 121; - v1 = 140 + (param2 / 2) + param3 * 2; - } else { - v0 = 167; - v1 = param0 * 4 + param2 + ((param1 != 1) ? 1 : 0); - } - break; - case 487: - if (param3 > 0) { - v0 = 121; - v1 = 152 + (param2 / 2) + param3 * 2; - } else { - v0 = 167; - v1 = param0 * 4 + param2 + ((param1 != 1) ? 1 : 0); - } - break; - default: - v0 = 167; - v1 = param0 * 4 + param2 + ((param1 != 1) ? 1 : 0); - break; - } - - NARC_ReadWholeMemberByIndexPair(&v2, v0, v1); - - return v2; -} - -void sub_0207697C (UnkStruct_02008A90 * param0, u16 param1) -{ - param0->unk_00 = 60; - param0->unk_02 = param1 * 2; - param0->unk_04 = param1 * 2 + 1; - param0->unk_06 = 0; - param0->unk_08 = 0; - param0->unk_0C = 0; -} - -static const UnkStruct_ov104_0223F9E0 Unk_020F05E4 = { - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - 0x0, - NNS_G2D_VRAM_TYPE_2DMAIN, - {0x4E2F, 0x4E2A, 0x4E27, 0x4E27, 0xffffffff, 0xffffffff}, - 0x2, - 0x1 -}; - -static const int Unk_020F0588[] = { - 0x0, - 0x0, - 0x1, - 0x0, - 0x0, - 0x1 -}; - -UnkStruct_0200D0F4 * sub_02076994 (UnkStruct_0200C6E4 * param0, UnkStruct_0200C704 * param1, UnkStruct_02002F38 * param2, int param3, int param4, int param5, int param6, int param7, int param8) -{ - UnkStruct_ov104_0223F9E0 v0; - UnkStruct_0200D0F4 * v1; - NARC * v2; - UnkStruct_ov5_021DE5D0 v3; - int v4 = 1; - - sub_02076AAC(param5, param6, &v3); - - if (param5 == 102) { - v4 = 2; - } - - v2 = NARC_ctor(v3.unk_00, param8); - - sub_0200CC3C(param0, param1, v2, v3.unk_04, 0, NNS_G2D_VRAM_TYPE_2DMAIN, 20015 + param7); - sub_0200CDC4(param2, 2, param0, param1, v2, v3.unk_08, 0, v4, NNS_G2D_VRAM_TYPE_2DMAIN, 20010 + param7); - sub_0200CE24(param0, param1, v2, v3.unk_0C, 0, 20007 + param7); - sub_0200CE54(param0, param1, v2, v3.unk_10, 0, 20007 + param7); - NARC_dtor(v2); - - v0 = Unk_020F05E4; - - v0.unk_14[0] = 20015 + param7; - v0.unk_14[1] = 20010 + param7; - v0.unk_14[2] = 20007 + param7; - v0.unk_14[3] = 20007 + param7; - v0.unk_08 = Unk_020F0588[param7]; - - v1 = sub_0200CE6C(param0, param1, &v0); - - sub_02021F24(v1->unk_00, 0); - sub_0200D4C4(v1, param3, param4); - sub_0200D330(v1); - sub_0200D390(v1, 1); - - return v1; -} - -void sub_02076AAC (int param0, int param1, UnkStruct_ov5_021DE5D0 * param2) -{ - if (param1 == 2) { - param2->unk_00 = 60; - param2->unk_04 = 0 + param0 * 5; - param2->unk_08 = 1 + param0 * 5; - param2->unk_0C = 2 + param0 * 5; - param2->unk_10 = 3 + param0 * 5; - param2->unk_14 = 4 + param0 * 5; - } else { - param2->unk_00 = 6; - param0 = sub_020788D0(param0); - param2->unk_04 = 0 + param0 * 5; - param2->unk_08 = 1 + param0 * 5; - param2->unk_0C = 2 + param0 * 5; - param2->unk_10 = 3 + param0 * 5; - param2->unk_14 = 4 + param0 * 5; - } -} - -u32 sub_02076AF0 (void) -{ - return (u32)sizeof(Pokemon); -} - -u32 sub_02076AF4 (void) -{ - return (u32)sizeof(BoxPokemon); -} - -u8 sub_02076AF8 (Pokemon * param0) -{ - return sub_02076B00((BoxPokemon *)¶m0->box); -} - -u8 sub_02076B00 (BoxPokemon * param0) -{ - return sub_02074570(param0, MON_DATA_FORM, NULL); -} - -BoxPokemon * sub_02076B10 (Pokemon * param0) -{ - return ¶m0->box; -} - -u8 sub_02076B14 (Pokemon * param0) -{ - u16 v0; - u8 v1; - u32 v2; - u32 v3; - int v4; - - v0 = GetMonData(param0, MON_DATA_SPECIES, NULL); - v1 = GetMonData(param0, MON_DATA_161, NULL) + 1; - v2 = GetMonData(param0, MON_DATA_EXP, NULL); - v4 = sub_020759F0(v0, 21); - v3 = sub_02075B00(v4, 100); - - if (v2 > v3) { - v2 = v3; - sub_02074B30(param0, 8, (u8 *)&v2); - } - - if (v1 > 100) { - return 0; - } - - v3 = sub_02075B00(v4, v1); - - if (v2 >= v3) { - sub_02074B30(param0, 161, (u8 *)&v1); - return 1; - } - - return 0; -} - -u16 sub_02076B94 (Party * param0, Pokemon * param1, u8 param2, u16 param3, int * param4) -{ - u16 v0; - u16 v1; - u8 v2; - int v3; - u16 v4 = 0; - u16 v5; - u32 v6; - u8 v7; - u8 v8; - u16 v9 = 0; - UnkStruct_0207821C * v10; - int v11; - - v0 = GetMonData(param1, MON_DATA_SPECIES, NULL); - v1 = GetMonData(param1, MON_DATA_HELD_ITEM, NULL); - v6 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); - v8 = GetMonData(param1, MON_DATA_BEAUTY, NULL); - v9 = (v6 & 0xffff0000) >> 16; - v7 = Item_LoadParam(v1, 1, 0); - - if (v0 != 64) { - if ((v7 == 64) && (param2 != 3)) { - return 0; - } - } - - if (param4 == NULL) { - param4 = &v11; - } - - v10 = Heap_AllocFromHeap(0, sizeof(UnkStruct_0207821C)); - sub_0207821C(v0, v10); - - switch (param2) { - case 0: - v2 = GetMonData(param1, MON_DATA_161, NULL); - v5 = GetMonData(param1, MON_DATA_FRIENDSHIP, NULL); - - for (v3 = 0; v3 < 7; v3++) { - switch (v10->unk_00[v3].unk_00) { - case 1: - if (220 <= v5) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 1; - } - break; - case 2: - if ((sub_02013948() == 0) && (220 <= v5)) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 2; - } - break; - case 3: - if ((sub_02013948() == 1) && (220 <= v5)) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 3; - } - break; - case 4: - if (v10->unk_00[v3].unk_02 <= v2) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 4; - } - break; - case 8: - if (v10->unk_00[v3].unk_02 <= v2) { - if ((GetMonData(param1, MON_DATA_165, NULL)) > (GetMonData(param1, MON_DATA_166, NULL))) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 8; - } - } - break; - case 9: - if (v10->unk_00[v3].unk_02 <= v2) { - if ((GetMonData(param1, MON_DATA_165, NULL)) == (GetMonData(param1, MON_DATA_166, NULL))) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 9; - } - } - break; - case 10: - if (v10->unk_00[v3].unk_02 <= v2) { - if ((GetMonData(param1, MON_DATA_165, NULL)) < (GetMonData(param1, MON_DATA_166, NULL))) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 10; - } - } - break; - case 11: - if (v10->unk_00[v3].unk_02 <= v2) { - if ((v9 % 10) < 5) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 11; - } - } - break; - case 12: - if (v10->unk_00[v3].unk_02 <= v2) { - if ((v9 % 10) >= 5) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 12; - } - } - break; - case 13: - if (v10->unk_00[v3].unk_02 <= v2) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 13; - } - break; - case 14: - param4[0] = 14; - break; - case 15: - if (v10->unk_00[v3].unk_02 <= v8) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 15; - } - break; - case 18: - if ((sub_02013948() == 0) && (v10->unk_00[v3].unk_02 == v1)) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 18; - } - break; - case 19: - if ((sub_02013948() == 1) && (v10->unk_00[v3].unk_02 == v1)) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 19; - } - break; - case 20: - if (sub_0207749C(param1, v10->unk_00[v3].unk_02) == 1) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 20; - } - break; - case 21: - if (param0 != NULL) { - if (Party_HasSpecies(param0, v10->unk_00[v3].unk_02) == 1) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 21; - } - } - break; - case 22: - if ((GetMonData(param1, MON_DATA_111, NULL) == 0) && (v10->unk_00[v3].unk_02 <= v2)) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 22; - } - break; - case 23: - if ((GetMonData(param1, MON_DATA_111, NULL) == 1) && (v10->unk_00[v3].unk_02 <= v2)) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 23; - } - break; - case 24: - if (v10->unk_00[v3].unk_00 == param3) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 24; - } - break; - case 25: - if (v10->unk_00[v3].unk_00 == param3) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 25; - } - break; - case 26: - if (v10->unk_00[v3].unk_00 == param3) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 26; - } - break; - } - - if (v4) { - break; - } - } - break; - case 1: - for (v3 = 0; v3 < 7; v3++) { - switch (v10->unk_00[v3].unk_00) { - case 5: - v4 = v10->unk_00[v3].unk_04; - param4[0] = 5; - break; - case 6: - if (v10->unk_00[v3].unk_02 == v1) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 6; - } - break; - } - - if (v4) { - break; - } - } - break; - case 2: - case 3: - for (v3 = 0; v3 < 7; v3++) { - if ((v10->unk_00[v3].unk_00 == 7) && (v10->unk_00[v3].unk_02 == param3)) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 0; - break; - } - - if ((v10->unk_00[v3].unk_00 == 16) && (GetMonData(param1, MON_DATA_111, NULL) == 0) && (v10->unk_00[v3].unk_02 == param3)) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 0; - break; - } - - if ((v10->unk_00[v3].unk_00 == 17) && (GetMonData(param1, MON_DATA_111, NULL) == 1) && (v10->unk_00[v3].unk_02 == param3)) { - v4 = v10->unk_00[v3].unk_04; - param4[0] = 0; - break; - } - - if (v4) { - break; - } - } - break; - } - - Heap_FreeToHeap(v10); - return v4; -} - -u16 sub_02076F84 (const u16 param0) -{ - FSFile v0; - u16 v1 = 0; - - GF_ASSERT((493 + 1) > param0); - - FS_InitFile(&v0); - FS_OpenFile(&v0, "poketool/personal/pms.narc"); - FS_SeekFile(&v0, param0 * 2, FS_SEEK_SET); - FS_ReadFile(&v0, &v1, 2); - FS_CloseFile(&v0); - - return v1; -} - -u16 sub_02076FD4 (const u16 param0) -{ - switch (param0) { - case 202: - case 183: - case 122: - case 185: - case 143: - case 226: - case 315: - case 113: - case 358: - return param0; - break; - } - - return sub_02076F84(param0); -} - -void sub_02077020 (BoxPokemon * param0) -{ - BOOL v0; - int v1; - u16 v2; - u16 v3; - int v4; - u16 v5; - u8 v6; - u16 * v7 = Heap_AllocFromHeap(0, 44); - - v0 = sub_02073D20(param0); - v2 = sub_02074570(param0, MON_DATA_SPECIES, 0); - v4 = sub_02074570(param0, MON_DATA_FORM, 0); - v6 = sub_02075B40(param0); - - sub_02077D28(v2, v4, v7); - - v1 = 0; - - while (v7[v1] != 0xffff) { - if ((v7[v1] & 0xfe00) <= (v6 << 9)) { - v3 = v7[v1] & 0x1ff; - v5 = sub_020770D4(param0, v3); - - if (v5 == 0xffff) { - sub_02077144(param0, v3); - } - } else { - break; - } - - v1++; - } - - Heap_FreeToHeap(v7); - sub_02073D48(param0, v0); -} - -u16 sub_020770C4 (Pokemon * param0, u16 param1) -{ - BoxPokemon * v0 = sub_02076B10(param0); - return sub_020770D4(v0, param1); -} - -u16 sub_020770D4 (BoxPokemon * param0, u16 param1) -{ - int v0; - u8 v1; - u16 v2; - u16 v3; - BOOL v4; - - v3 = 0xffff; - - v4 = sub_02073D20(param0); - - for (v0 = 0; v0 < 4; v0++) { - if ((v2 = sub_02074570(param0, MON_DATA_MOVE1 + v0, NULL)) == 0) { - sub_02077238(param0, param1, v0); - v3 = param1; - break; - } else { - if (v2 == param1) { - v3 = 0xfffe; - break; - } - } - } - - sub_02073D48(param0, v4); - - return v3; -} - -void sub_02077134 (Pokemon * param0, u16 param1) -{ - BoxPokemon * v0 = sub_02076B10(param0); - sub_02077144(v0, param1); -} - -void sub_02077144 (BoxPokemon * param0, u16 param1) -{ - int v0; - u16 v1[4]; - u8 v2[4]; - u8 v3[4]; - BOOL v4; - - v4 = sub_02073D20(param0); - - for (v0 = 0; v0 < 3; v0++) { - v1[v0] = sub_02074570(param0, 55 + v0, NULL); - v2[v0] = sub_02074570(param0, 59 + v0, NULL); - v3[v0] = sub_02074570(param0, 63 + v0, NULL); - } - - v1[3] = param1; - v2[3] = MoveTable_LoadParam(param1, MOVEATTRIBUTE_PP); - v3[3] = 0; - - for (v0 = 0; v0 < 4; v0++) { - SetBoxMonData(param0, 54 + v0, (u8 *)&v1[v0]); - SetBoxMonData(param0, 58 + v0, (u8 *)&v2[v0]); - SetBoxMonData(param0, 62 + v0, (u8 *)&v3[v0]); - } - - sub_02073D48(param0, v4); -} - -void sub_020771F8 (Pokemon * param0, u16 param1, u8 param2) -{ - u32 v0, v1; - - sub_02077230(param0, param1, param2); - - v1 = 0; - sub_02074B30(param0, 62 + param2, &v1); - - v0 = MoveTable_CalcMaxPP(param1, 0); - sub_02074B30(param0, 58 + param2, (u8 *)&v0); - - return; -} - -void sub_02077230 (Pokemon * param0, u16 param1, u8 param2) -{ - sub_02077238(¶m0->box, param1, param2); -} - -void sub_02077238 (BoxPokemon * param0, u16 param1, u8 param2) -{ - u8 v0; - u8 v1; - - SetBoxMonData(param0, 54 + param2, (u8 *)¶m1); - - v1 = sub_02074570(param0, 62 + param2, NULL); - v0 = MoveTable_CalcMaxPP(param1, v1); - - SetBoxMonData(param0, 58 + param2, (u8 *)&v0); -} - -u16 sub_0207727C (Pokemon * param0, int * param1, u16 * param2) -{ - u16 v0 = 0x0; - u16 v1; - int v2; - u8 v3; - u16 * v4 = Heap_AllocFromHeap(0, 44); - - v1 = GetMonData(param0, MON_DATA_SPECIES, NULL); - v2 = GetMonData(param0, MON_DATA_FORM, NULL); - v3 = GetMonData(param0, MON_DATA_161, NULL); - - sub_02077D28(v1, v2, v4); - - if (v4[param1[0]] == 0xffff) { - Heap_FreeToHeap(v4); - return 0x0; - } - - while ((v4[param1[0]] & 0xfe00) != (v3 << 9)) { - param1[0]++; - - if (v4[param1[0]] == 0xffff) { - Heap_FreeToHeap(v4); - return 0x0; - } - } - - if ((v4[param1[0]] & 0xfe00) == (v3 << 9)) { - param2[0] = v4[param1[0]] & 0x1ff; - param1[0]++; - - v0 = sub_020770C4(param0, param2[0]); - } - - Heap_FreeToHeap(v4); - - return v0; -} - -void sub_02077344 (Pokemon * param0, int param1, int param2) -{ - sub_0207734C(¶m0->box, param1, param2); -} - -void sub_0207734C (BoxPokemon * param0, int param1, int param2) -{ - u16 v0[2]; - u8 v1[2]; - u8 v2[2]; - - v0[0] = sub_02074570(param0, 54 + param1, NULL); - v1[0] = sub_02074570(param0, 58 + param1, NULL); - v2[0] = sub_02074570(param0, 62 + param1, NULL); - v0[1] = sub_02074570(param0, 54 + param2, NULL); - v1[1] = sub_02074570(param0, 58 + param2, NULL); - v2[1] = sub_02074570(param0, 62 + param2, NULL); - - SetBoxMonData(param0, 54 + param1, (u8 *)&v0[1]); - SetBoxMonData(param0, 58 + param1, (u8 *)&v1[1]); - SetBoxMonData(param0, 62 + param1, (u8 *)&v2[1]); - SetBoxMonData(param0, 54 + param2, (u8 *)&v0[0]); - SetBoxMonData(param0, 58 + param2, (u8 *)&v1[0]); - SetBoxMonData(param0, 62 + param2, (u8 *)&v2[0]); -} - -void sub_02077408 (Pokemon * param0, u32 param1) -{ - u32 v0; - u16 v1; - u8 v2; - u8 v3; - - for (v0 = param1; v0 < 3; v0++) { - v1 = GetMonData(param0, 54 + v0 + 1, NULL); - v2 = GetMonData(param0, 58 + v0 + 1, NULL); - v3 = GetMonData(param0, 62 + v0 + 1, NULL); - - sub_02074B30(param0, 54 + v0, (u8 *)&v1); - sub_02074B30(param0, 58 + v0, (u8 *)&v2); - sub_02074B30(param0, 62 + v0, (u8 *)&v3); - } - - v1 = 0; - v2 = 0; - v3 = 0; - - sub_02074B30(param0, 57, (u8 *)&v1); - sub_02074B30(param0, 61, (u8 *)&v2); - sub_02074B30(param0, 65, (u8 *)&v3); -} - -BOOL sub_0207749C (Pokemon * param0, u16 param1) -{ - int v0; - - for (v0 = 0; v0 < 4; v0++) { - if (GetMonData(param0, MON_DATA_MOVE1 + v0, NULL) == param1) { - break; - } - } - - return v0 != 4; -} - -void sub_020774C8 (BoxPokemon * param0, Pokemon * param1) -{ - u32 v0 = 0; - UnkStruct_0202818C * v1; - UnkStruct_0202CA28 v2; - - param1->box = *param0; - - if (param1->box.unk_04_1) { - param1->box.unk_04_0 = 1; - } - - sub_02074B30(param1, 160, (u8 *)&v0); - sub_02074B30(param1, 163, (u8 *)&v0); - sub_02074B30(param1, 164, (u8 *)&v0); - - v1 = sub_0202818C(0); - - sub_02074B30(param1, 170, v1); - Heap_FreeToHeap(v1); - sub_02074B30(param1, 162, (u8 *)&v0); - - MI_CpuClearFast(&v2, sizeof(UnkStruct_0202CA28)); - - sub_02074B30(param1, 171, (UnkStruct_0202CA28 *)&v2); - sub_0207418C(param1); -} - -u8 sub_02077550 (Party * param0) -{ - u8 v0, v1; - int v2, v3; - Pokemon * v4; - - v3 = Party_GetCurrentCount(param0); - v0 = 1; - - for (v2 = 0; v2 < v3; v2++) { - v4 = Party_GetPokemonBySlotIndex(param0, v2); - - if ((GetMonData(v4, MON_DATA_SPECIES, NULL)) && (GetMonData(v4, MON_DATA_IS_EGG, NULL) == 0)) { - v1 = GetMonData(v4, MON_DATA_161, NULL); - - if (v1 > v0) { - v0 = v1; - } - } - } - - return v0; -} - -u16 sub_020775A4 (u16 param0) -{ - u16 v0; - - NARC_ReadFromMemberByIndexPair(&v0, NARC_INDEX_POKETOOL__PL_POKEZUKAN, 0, param0 * 2, 2); - - return v0; -} - -u16 sub_020775C4 (u16 param0) -{ - u16 v0 = 0; - - if (param0 <= 210) { - NARC_ReadFromMemberByIndexPair(&v0, NARC_INDEX_POKETOOL__SHINZUKAN, 0, param0 * 2, 2); - } - - return v0; -} - -void sub_020775EC (Pokemon * param0, Pokemon * param1) -{ - *param1 = *param0; - return; -} - -void sub_02077604 (BoxPokemon * param0, BoxPokemon * param1) -{ - *param1 = *param0; - return; -} - -void sub_02077618 (Pokemon * param0, BoxPokemon * param1) -{ - *param1 = param0->box; - return; -} - -s8 sub_0207762C (Pokemon * param0, int param1) -{ - return sub_02077634(¶m0->box, param1); -} - -s8 sub_02077634 (BoxPokemon * param0, int param1) -{ - return sub_02077648(sub_02074570(param0, MON_DATA_PERSONALITY, NULL), param1); -} - -s8 sub_02077648 (u32 param0, int param1) -{ - u8 v0; - - v0 = GetNatureFromPersonality(param0); - return Unk_020F0695[v0][param1]; -} - -int sub_02077660 (int param0, int param1, u16 * param2) -{ - int v0; - u16 * v1 = Heap_AllocFromHeap(0, 44); - - sub_02077D28(param0, param1, v1); - - v0 = 0; - - while (v1[v0] != 0xffff) { - param2[v0] = v1[v0] & 0x1ff; - v0++; - } - - Heap_FreeToHeap(v1); - return v0; -} - -void sub_020776B0 (Party * param0) -{ - u16 v0; - u8 v1; - Pokemon * v2; - int v3; - int v4; - - v3 = Party_GetCurrentCount(param0); - v0 = LCRNG_Next(); - - if ((v0 == 16384) || (v0 == 32768) || (v0 == 49152)) { - do { - v4 = LCRNG_Next() % v3; - v2 = Party_GetPokemonBySlotIndex(param0, v4); - - if ((GetMonData(v2, MON_DATA_SPECIES, NULL)) && (GetMonData(v2, MON_DATA_IS_EGG, NULL) == 0)) { - break; - } else { - v4 = v3; - } - } while (v4 == v3); - - if (sub_02077758(param0, FlagIndex(v4)) == 0) { - do { - v1 = LCRNG_Next() & 0xff; - } while ((v1 & 0x7) == 0); - - if (v1 & 0xf0) { - v1 &= 0x7; - } - - v1 |= (v1 << 4); - v1 &= 0xf3; - v1++; - - sub_02074B30(v2, 154, (u8 *)&v1); - } - } -} - -u8 sub_02077758 (Party * param0, u8 param1) -{ - int v0 = 0; - int v1 = 1; - u8 v2 = 0; - Pokemon * v3; - - if (param1) { - do { - if (param1 & 1) { - v3 = Party_GetPokemonBySlotIndex(param0, v0); - - if (GetMonData(v3, MON_DATA_POKERUS, NULL)) { - v2 |= v1; - } - } - - v0++; - v1 = v1 << 1; - param1 = param1 >> 1; - } while (param1 != 0); - } else { - v3 = Party_GetPokemonBySlotIndex(param0, v0); - - if (GetMonData(v3, MON_DATA_POKERUS, NULL)) { - v2++; - } - } - - return v2; -} - -void sub_020777B4 (Party * param0, s32 param1) -{ - int v0; - int v1; - u8 v2; - Pokemon * v3; - - v1 = Party_GetCurrentCount(param0); - - for (v0 = 0; v0 < v1; v0++) { - v3 = Party_GetPokemonBySlotIndex(param0, v0); - - if (GetMonData(v3, MON_DATA_SPECIES, NULL)) { - v2 = GetMonData(v3, MON_DATA_POKERUS, NULL); - - if (v2 & 0xf) { - if (((v2 & 0xf) < param1) || (param1 > 4)) { - v2 &= 0xf0; - } else { - v2 -= param1; - } - - if (v2 == 0) { - v2 = 0x10; - } - - sub_02074B30(v3, 154, (u8 *)&v2); - } - } - } -} - -void sub_0207782C (Party * param0) -{ - int v0; - int v1; - u8 v2; - Pokemon * v3; - - v1 = Party_GetCurrentCount(param0); - - if (LCRNG_Next() % 3 == 0) { - for (v0 = 0; v0 < v1; v0++) { - v3 = Party_GetPokemonBySlotIndex(param0, v0); - - if (GetMonData(v3, MON_DATA_SPECIES, NULL)) { - v2 = GetMonData(v3, MON_DATA_POKERUS, NULL); - - if (v2 & 0xf) { - if (v0 != 0) { - v3 = Party_GetPokemonBySlotIndex(param0, v0 - 1); - - if ((GetMonData(v3, MON_DATA_POKERUS, NULL) & 0xf0) == 0) { - sub_02074B30(v3, 154, (u8 *)&v2); - } - } - - if (v0 < v1 - 1) { - v3 = Party_GetPokemonBySlotIndex(param0, v0 + 1); - - if ((GetMonData(v3, MON_DATA_POKERUS, NULL) & 0xf0) == 0) { - sub_02074B30(v3, 154, (u8 *)&v2); - v0++; - } - } - } - } - } - } -} - -BOOL sub_020778D8 (Pokemon * param0) -{ - return sub_020778E0(¶m0->box); -} - -BOOL sub_020778E0 (BoxPokemon * param0) -{ - return (sub_02074570(param0, MON_DATA_POKERUS, NULL) & 0xf) != 0; -} - -BOOL sub_020778F8 (Pokemon * param0) -{ - return sub_02077900(¶m0->box); -} - -BOOL sub_02077900 (BoxPokemon * param0) -{ - u8 v0; - - v0 = sub_02074570(param0, MON_DATA_POKERUS, NULL); - - if (v0 & 0xf) { - return 0; - } - - return (v0 & 0xf0) != 0; -} - -void sub_02077928 (Pokemon * param0) -{ - sub_02077930(¶m0->box); -} - -void sub_02077930 (BoxPokemon * param0) -{ - int v0; - int v1; - int v2; - int v3; - - v0 = sub_02074570(param0, MON_DATA_SPECIES, NULL); - v1 = sub_02074570(param0, MON_DATA_10, NULL); - v2 = sub_02074570(param0, MON_DATA_HELD_ITEM, NULL); - - if ((v0 == 493) && (v1 == 121)) { - v3 = sub_02077988(Item_LoadParam(v2, 1, 0)); - SetBoxMonData(param0, 112, &v3); - } -} - -u8 sub_02077988 (u16 param0) -{ - u8 v0; - - switch (param0) { - case 126: - v0 = 10; - break; - case 127: - v0 = 11; - break; - case 128: - v0 = 13; - break; - case 129: - v0 = 12; - break; - case 130: - v0 = 15; - break; - case 131: - v0 = 1; - break; - case 132: - v0 = 3; - break; - case 133: - v0 = 4; - break; - case 134: - v0 = 2; - break; - case 135: - v0 = 14; - break; - case 136: - v0 = 6; - break; - case 137: - v0 = 5; - break; - case 138: - v0 = 7; - break; - case 139: - v0 = 16; - break; - case 140: - v0 = 17; - break; - case 141: - v0 = 8; - break; - default: - v0 = 0; - break; - } - - return v0; -} - -int sub_02077A00 (Pokemon * param0) -{ - int v0; - - v0 = sub_02077A1C(¶m0->box); - - if (v0 != -1) { - sub_0207418C(param0); - } - - return v0; -} - -int sub_02077A1C (BoxPokemon * param0) -{ - int v0; - int v1; - int v2; - - v0 = sub_02074570(param0, MON_DATA_SPECIES, NULL); - v1 = sub_02074570(param0, MON_DATA_HELD_ITEM, NULL); - - if (v0 == 487) { - v2 = (v1 == 112) ? 1 : 0; - - SetBoxMonData(param0, 112, &v2); - sub_02078044(param0); - - return v2; - } - - return -1; -} - -void sub_02077A64 (Pokemon * param0) -{ - int v0 = 1; - - if (GetMonData(param0, MON_DATA_SPECIES, NULL) == 487) { - SetBoxMonData(¶m0->box, 112, &v0); - sub_02078044(¶m0->box); - sub_0207418C(param0); - } -} - -void sub_02077A9C (Party * param0, int param1) -{ - int v0, v1; - Pokemon * v2; - - v1 = Party_GetCurrentCount(param0); - - for (v0 = 0; v0 < v1; v0++) { - v2 = Party_GetPokemonBySlotIndex(param0, v0); - - if (param1) { - sub_02077A64(v2); - } else { - sub_02077A00(v2); - } - } -} - -void SetShayminForm (Pokemon * param0, int param1) -{ - SetBoxShayminForm(¶m0->box, param1); - sub_0207418C(param0); -} - -void SetBoxShayminForm (BoxPokemon * param0, int param1) -{ - int v0; - - v0 = sub_02074570(param0, MON_DATA_SPECIES, NULL); - - if (v0 == 492) { - GF_ASSERT(param1 <= 1); - - SetBoxMonData(param0, 112, ¶m1); - sub_02078044(param0); - } -} - -BOOL sub_02077B14 (Pokemon * param0) -{ - u32 v0, v1, v2, v3, v4; - RTCTime v5; - - v0 = GetMonData(param0, MON_DATA_SPECIES, NULL); - v1 = GetMonData(param0, MON_DATA_FORM, NULL); - v2 = GetMonData(param0, MON_DATA_160, NULL); - v3 = GetMonData(param0, MON_DATA_163, NULL); - v4 = GetMonData(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL); - - sub_02013880(&v5); - - if ((v0 == 492) && (v1 == 0) && (v3 > 0) && (v4 == 1) && ((v2 & 0x20) == 0) && ((v5.hour >= 4) && (v5.hour < 20))) { - return 1; - } - - return 0; -} - -void sub_02077B8C (Party * param0) -{ - int v0, v1, v2, v3; - Pokemon * v4; - int v5 = 0; - - v1 = Party_GetCurrentCount(param0); - - for (v0 = 0; v0 < v1; v0++) { - v4 = Party_GetPokemonBySlotIndex(param0, v0); - v2 = GetMonData(v4, MON_DATA_SPECIES, NULL); - v3 = GetMonData(v4, MON_DATA_FORM, NULL); - - if ((v2 == 492) && (v3 == 1)) { - SetShayminForm(v4, v5); - } - } -} - -BOOL sub_02077BD8 (Party * param0, int param1, const RTCTime * param2) -{ - s32 v0, v1; - - if ((param2->hour >= 20) || (param2->hour < 4)) { - v0 = param2->hour; - - if (v0 < 4) { - v0 += 24; - } - - v0 -= 20; - v1 = param2->minute + v0 * 60; - - param1++; - - if (v1 < param1) { - sub_02077B8C(param0); - return 1; - } - - return 0; - } else { - v1 = param2->minute + (param2->hour - 4) * 60; - - if (v1 < param1) { - sub_02077B8C(param0); - return 1; - } - - return 0; - } -} - -BOOL SetRotomForm (Pokemon * param0, int param1, int param2) -{ - int v0, v1; - - v0 = GetMonData(param0, MON_DATA_SPECIES, NULL); - - if (v0 != 479) { - return 0; - } - - v1 = GetMonData(param0, MON_DATA_FORM, NULL); - - { - int v2, v3, v4, v5; - static const u16 v6[] = { - 0, - 315, - 56, - 59, - 403, - 437 - }; - - v4 = v6[param1]; - - for (v2 = 0; v2 < 4; v2++) { - v5 = GetMonData(param0, MON_DATA_MOVE1 + v2, NULL); - - for (v3 = 1; v3 < NELEMS(v6); v3++) { - if ((v5 != 0) && (v5 == v6[v3])) { - if (v4 != 0) { - sub_020771F8(param0, v4, v2); - v4 = 0; - break; - } else { - sub_02077408(param0, v2); - v2--; - break; - } - } - } - } - - if (v4 != 0) { - for (v2 = 0; v2 < 4; v2++) { - if (GetMonData(param0, MON_DATA_MOVE1 + v2, NULL) == 0) { - sub_020771F8(param0, v4, v2); - break; - } - } - - if (v2 == 4) { - sub_020771F8(param0, v4, param2); - } - } - - if (GetMonData(param0, MON_DATA_MOVE1, NULL) == 0) { - sub_020771F8(param0, 84, 0); - } - } - - sub_02074B30(param0, 112, ¶m1); - sub_0207803C(param0); - sub_0207418C(param0); - - return 1; -} - -void sub_02077D28 (int param0, int param1, u16 * param2) -{ - param0 = sub_02078740(param0, param1); - NARC_ReadWholeMemberByIndexPair(param2, NARC_INDEX_POKETOOL__PERSONAL__WOTBL, param0); -} - -void sub_02077D3C (UnkStruct_0202CC84 * param0, int param1, u16 param2, int param3, int param4, int param5, int param6, int param7) -{ - if (param2 == 441) { - if (sub_020064C8(param1) == 0) { - sub_020063D4(1); - sub_020059D0(param1, param2, param4, param5, param7, param3); - } else { - if (param6) { - sub_020063D4(1); - } - - sub_020063E4(param0, NULL, param5, param4); - } - } else { - sub_020059D0(param1, param2, param4, param5, param7, param3); - } -} - -void sub_02077DB4 (UnkStruct_0202CC84 * param0, int param1, u16 param2, int param3, int param4, int param5, int param6, int param7, u8 param8) -{ - if (param2 == 441) { - if (sub_020064C8(param1) == 0) { - sub_020063D4(1); - sub_02005F4C(param1, param2, param4, param5, param7, param8, param3); - } else { - if (param6) { - sub_020063D4(1); - } - - sub_02006438(param0, NULL, param5, param4, param8); - } - } else { - sub_02005F4C(param1, param2, param4, param5, param7, param8, param3); - } -} - -BOOL sub_02077E3C (Pokemon * param0) -{ - int v0, v1; - - v0 = GetMonData(param0, MON_DATA_SPECIES, NULL); - v1 = GetMonData(param0, MON_DATA_FORM, NULL); - - return sub_02005844(v0, v1); -} - -void sub_02077E64 (Pokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5) -{ - int v0; - - sub_02077EA4(¶m0->box, param1, param2, param3, param4, param5); - - if (param2 == 14) { - v0 = GetMonData(param0, MON_DATA_164, NULL); - sub_02074B30(param0, 163, &v0); - - v0 = 0; - sub_02074B30(param0, 160, &v0); - } -} - -void sub_02077EA4 (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5) -{ - sub_0209305C(param0, param1, 0, param3, param5); - SetBoxMonData(param0, 122, &Unk_020E4C40); - SetBoxMonData(param0, 155, ¶m2); - SetBoxMonData(param0, 158, ¶m4); -} - -void sub_02077EE4 (Pokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5) -{ - sub_02077EF8(¶m0->box, param1, param2, param3, param4, param5); -} - -void sub_02077EF8 (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, int param3, int param4, int param5) -{ - int v0; - sub_02077EA4(param0, param1, param2, param3, param4, param5); -} - -static const u16 Unk_020F0574[][2] = { - {0x2D, 0x5F}, - {0x14, 0x50} -}; - -void sub_02077F0C (Pokemon * param0, u32 param1, int param2) -{ - int v0; - u32 v1; - u16 v2; - u16 v3; - u8 v4; - u16 v5, v6; - - if (param1 & ((0x1 | 0x80))) { - return; - } - - v1 = LCRNG_Next() % 100; - v2 = GetMonData(param0, MON_DATA_SPECIES, NULL); - v3 = GetMonData(param0, MON_DATA_FORM, NULL); - v5 = sub_020759CC(v2, v3, 16); - v6 = sub_020759CC(v2, v3, 17); - - if ((v5 == v6) && (v5 != 0)) { - sub_02074B30(param0, 6, &v5); - return; - } - - if (v1 < Unk_020F0574[param2][0]) { - return; - } else if (v1 < Unk_020F0574[param2][1]) { - sub_02074B30(param0, 6, &v5); - } else { - sub_02074B30(param0, 6, &v6); - } -} - -BOOL sub_02077FB4 (Pokemon * param0, u8 param1) -{ - return sub_02077FBC(¶m0->box, param1); -} - -BOOL sub_02077FBC (BoxPokemon * param0, u8 param1) -{ - u16 v0; - int v1; - - v0 = sub_02074570(param0, MON_DATA_SPECIES_EGG, NULL); - v1 = sub_02074570(param0, MON_DATA_FORM, NULL); - - return sub_02077FE4(v0, v1, param1); -} - -BOOL sub_02077FE4 (u16 param0, int param1, u8 param2) -{ - u32 v0; - u8 v1; - - if (param0 == 494) { - return 0; - } - - if (param2 < 32) { - v0 = (1 << param2); - v1 = 29; - } else if (param2 < 64) { - v0 = (1 << (param2 - 32)); - v1 = 30; - } else if (param2 < 96) { - v0 = (1 << (param2 - 64)); - v1 = 31; - } else { - v0 = (1 << (param2 - 96)); - v1 = 32; - } - - return (sub_020759CC(param0, param1, v1) & v0) != 0; -} - -void sub_0207803C (Pokemon * param0) -{ - sub_02078044(¶m0->box); -} - -void sub_02078044 (BoxPokemon * param0) -{ - BOOL v0; - int v1, v2; - int v3, v4; - u32 v5; - - v0 = sub_02073D20(param0); - v1 = sub_02074570(param0, MON_DATA_SPECIES, NULL); - v5 = sub_02074570(param0, MON_DATA_PERSONALITY, NULL); - v2 = sub_02074570(param0, MON_DATA_FORM, NULL); - v3 = sub_020759CC(v1, v2, 24); - v4 = sub_020759CC(v1, v2, 25); - - if (v4 != 0) { - if (v5 & 1) { - SetBoxMonData(param0, 10, (u8 *)&v4); - } else { - SetBoxMonData(param0, 10, (u8 *)&v3); - } - } else { - SetBoxMonData(param0, 10, (u8 *)&v3); - } - - sub_02073D48(param0, v0); -} - -void sub_020780C4 (Pokemon * param0, u32 param1) -{ - Pokemon * v0; - PokemonSubstruct0 * v1; - PokemonSubstruct1 * v2; - PokemonSubstruct2 * v3; - PokemonSubstruct3 * v4; - PokemonSubstruct0 * v5; - PokemonSubstruct1 * v6; - PokemonSubstruct2 * v7; - PokemonSubstruct3 * v8; - - v0 = AllocMonZeroed(0); - - sub_020775EC(param0, v0); - - v1 = (PokemonSubstruct0 *)sub_0207825C(&v0->box, param0->box.unk_00, 0); - v2 = (PokemonSubstruct1 *)sub_0207825C(&v0->box, param0->box.unk_00, 1); - v3 = (PokemonSubstruct2 *)sub_0207825C(&v0->box, param0->box.unk_00, 2); - v4 = (PokemonSubstruct3 *)sub_0207825C(&v0->box, param0->box.unk_00, 3); - v5 = (PokemonSubstruct0 *)sub_0207825C(¶m0->box, param1, 0); - v6 = (PokemonSubstruct1 *)sub_0207825C(¶m0->box, param1, 1); - v7 = (PokemonSubstruct2 *)sub_0207825C(¶m0->box, param1, 2); - v8 = (PokemonSubstruct3 *)sub_0207825C(¶m0->box, param1, 3); - - sub_02078234(&v0->box.unk_08, sizeof(PokemonSubstruct0) * 4, v0->box.unk_06); - sub_02078234(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - sub_02078234(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - - param0->box.unk_00 = param1; - - *v5 = *v1; - *v6 = *v2; - *v7 = *v3; - *v8 = *v4; - - param0->box.unk_06 = sub_0207823C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4); - - sub_0207822C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - sub_0207822C(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - Heap_FreeToHeap(v0); -} - -static void sub_020781F8 (int param0, UnkStruct_02075874 * param1) -{ - NARC_ReadWholeMemberByIndexPair(param1, NARC_INDEX_POKETOOL__PERSONAL__PL_PERSONAL, param0); -} - -static void sub_02078208 (int param0, int param1, UnkStruct_02075874 * param2) -{ - param0 = sub_02078740(param0, param1); - NARC_ReadWholeMemberByIndexPair(param2, NARC_INDEX_POKETOOL__PERSONAL__PL_PERSONAL, param0); -} - -static void sub_0207821C (int param0, UnkStruct_0207821C * param1) -{ - NARC_ReadWholeMemberByIndexPair(param1, NARC_INDEX_POKETOOL__PERSONAL__EVO, param0); -} - -static void sub_0207822C (void * param0, u32 param1, u32 param2) -{ - sub_0201D5D4(param0, param1, param2); -} - -static void sub_02078234 (void * param0, u32 param1, u32 param2) -{ - sub_0201D600(param0, param1, param2); -} - -static u16 sub_0207823C (void * param0, u32 param1) -{ - int v0; - u16 * v1 = (u16 *)param0; - u16 v2 = 0; - - for (v0 = 0; v0 < param1 / 2; v0++) { - v2 += v1[v0]; - } - - return v2; -} - -static void * sub_0207825C (BoxPokemon * param0, u32 param1, u8 param2) -{ - void * v0; - - param1 = (param1 & 0x3e000) >> 13; - - GF_ASSERT(param1 <= 31); - - switch (param1) { - case 0: - case 24: - { - UnkStruct_0207825C * v1 = (UnkStruct_0207825C *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v1->unk_00; - break; - case 1: - v0 = &v1->unk_20; - break; - case 2: - v0 = &v1->unk_40; - break; - case 3: - v0 = &v1->unk_60; - break; - } - break; - } - case 1: - case 25: - { - UnkStruct_0207825C_1 * v2 = (UnkStruct_0207825C_1 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v2->unk_00; - break; - case 1: - v0 = &v2->unk_20; - break; - case 2: - v0 = &v2->unk_60; - break; - case 3: - v0 = &v2->unk_40; - break; - } - break; - } - case 2: - case 26: - { - UnkStruct_0207825C_2 * v3 = (UnkStruct_0207825C_2 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v3->unk_00; - break; - case 1: - v0 = &v3->unk_40; - break; - case 2: - v0 = &v3->unk_20; - break; - case 3: - v0 = &v3->unk_60; - break; - } - break; - } - case 3: - case 27: - { - UnkStruct_0207825C_3 * v4 = (UnkStruct_0207825C_3 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v4->unk_00; - break; - case 1: - v0 = &v4->unk_60; - break; - case 2: - v0 = &v4->unk_20; - break; - case 3: - v0 = &v4->unk_40; - break; - } - break; - } - case 4: - case 28: - { - UnkStruct_0207825C_4 * v5 = (UnkStruct_0207825C_4 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v5->unk_00; - break; - case 1: - v0 = &v5->unk_40; - break; - case 2: - v0 = &v5->unk_60; - break; - case 3: - v0 = &v5->unk_20; - break; - } - break; - } - case 5: - case 29: - { - UnkStruct_0207825C_5 * v6 = (UnkStruct_0207825C_5 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v6->unk_00; - break; - case 1: - v0 = &v6->unk_60; - break; - case 2: - v0 = &v6->unk_40; - break; - case 3: - v0 = &v6->unk_20; - break; - } - break; - } - case 6: - case 30: - { - UnkStruct_0207825C_6 * v7 = (UnkStruct_0207825C_6 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v7->unk_20; - break; - case 1: - v0 = &v7->unk_00; - break; - case 2: - v0 = &v7->unk_40; - break; - case 3: - v0 = &v7->unk_60; - break; - } - break; - } - case 7: - case 31: - { - UnkStruct_0207825C_7 * v8 = (UnkStruct_0207825C_7 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v8->unk_20; - break; - case 1: - v0 = &v8->unk_00; - break; - case 2: - v0 = &v8->unk_60; - break; - case 3: - v0 = &v8->unk_40; - break; - } - break; - } - case 8: - { - UnkStruct_0207825C_8 * v9 = (UnkStruct_0207825C_8 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v9->unk_40; - break; - case 1: - v0 = &v9->unk_00; - break; - case 2: - v0 = &v9->unk_20; - break; - case 3: - v0 = &v9->unk_60; - break; - } - break; - } - case 9: - { - UnkStruct_0207825C_9 * v10 = (UnkStruct_0207825C_9 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v10->unk_60; - break; - case 1: - v0 = &v10->unk_00; - break; - case 2: - v0 = &v10->unk_20; - break; - case 3: - v0 = &v10->unk_40; - break; - } - break; - } - case 10: - { - UnkStruct_0207825C_10 * v11 = (UnkStruct_0207825C_10 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v11->unk_40; - break; - case 1: - v0 = &v11->unk_00; - break; - case 2: - v0 = &v11->unk_60; - break; - case 3: - v0 = &v11->unk_20; - break; - } - break; - } - case 11: - { - UnkStruct_0207825C_11 * v12 = (UnkStruct_0207825C_11 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v12->unk_60; - break; - case 1: - v0 = &v12->unk_00; - break; - case 2: - v0 = &v12->unk_40; - break; - case 3: - v0 = &v12->unk_20; - break; - } - break; - } - case 12: - { - UnkStruct_0207825C_12 * v13 = (UnkStruct_0207825C_12 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v13->unk_20; - break; - case 1: - v0 = &v13->unk_40; - break; - case 2: - v0 = &v13->unk_00; - break; - case 3: - v0 = &v13->unk_60; - break; - } - break; - } - case 13: - { - UnkStruct_0207825C_13 * v14 = (UnkStruct_0207825C_13 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v14->unk_20; - break; - case 1: - v0 = &v14->unk_60; - break; - case 2: - v0 = &v14->unk_00; - break; - case 3: - v0 = &v14->unk_40; - break; - } - break; - } - case 14: - { - UnkStruct_0207825C_14 * v15 = (UnkStruct_0207825C_14 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v15->unk_40; - break; - case 1: - v0 = &v15->unk_20; - break; - case 2: - v0 = &v15->unk_00; - break; - case 3: - v0 = &v15->unk_60; - break; - } - break; - } - case 15: - { - UnkStruct_0207825C_15 * v16 = (UnkStruct_0207825C_15 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v16->unk_60; - break; - case 1: - v0 = &v16->unk_20; - break; - case 2: - v0 = &v16->unk_00; - break; - case 3: - v0 = &v16->unk_40; - break; - } - break; - } - case 16: - { - UnkStruct_0207825C_16 * v17 = (UnkStruct_0207825C_16 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v17->unk_40; - break; - case 1: - v0 = &v17->unk_60; - break; - case 2: - v0 = &v17->unk_00; - break; - case 3: - v0 = &v17->unk_20; - break; - } - break; - } - case 17: - { - UnkStruct_0207825C_17 * v18 = (UnkStruct_0207825C_17 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v18->unk_60; - break; - case 1: - v0 = &v18->unk_40; - break; - case 2: - v0 = &v18->unk_00; - break; - case 3: - v0 = &v18->unk_20; - break; - } - break; - } - case 18: - { - UnkStruct_0207825C_18 * v19 = (UnkStruct_0207825C_18 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v19->unk_20; - break; - case 1: - v0 = &v19->unk_40; - break; - case 2: - v0 = &v19->unk_60; - break; - case 3: - v0 = &v19->unk_00; - break; - } - break; - } - case 19: - { - UnkStruct_0207825C_19 * v20 = (UnkStruct_0207825C_19 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v20->unk_20; - break; - case 1: - v0 = &v20->unk_60; - break; - case 2: - v0 = &v20->unk_40; - break; - case 3: - v0 = &v20->unk_00; - break; - } - break; - } - case 20: - { - UnkStruct_0207825C_20 * v21 = (UnkStruct_0207825C_20 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v21->unk_40; - break; - case 1: - v0 = &v21->unk_20; - break; - case 2: - v0 = &v21->unk_60; - break; - case 3: - v0 = &v21->unk_00; - break; - } - break; - } - case 21: - { - UnkStruct_0207825C_21 * v22 = (UnkStruct_0207825C_21 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v22->unk_60; - break; - case 1: - v0 = &v22->unk_20; - break; - case 2: - v0 = &v22->unk_40; - break; - case 3: - v0 = &v22->unk_00; - break; - } - break; - } - case 22: - { - UnkStruct_0207825C_22 * v23 = (UnkStruct_0207825C_22 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v23->unk_40; - break; - case 1: - v0 = &v23->unk_60; - break; - case 2: - v0 = &v23->unk_20; - break; - case 3: - v0 = &v23->unk_00; - break; - } - break; - } - case 23: - { - UnkStruct_0207825C_23 * v24 = (UnkStruct_0207825C_23 *)¶m0->unk_08; - - switch (param2) { - case 0: - v0 = &v24->unk_60; - break; - case 1: - v0 = &v24->unk_40; - break; - case 2: - v0 = &v24->unk_20; - break; - case 3: - v0 = &v24->unk_00; - break; - } - break; - } - } - - return v0; -} - -static int sub_02078740 (int param0, int param1) -{ - switch (param0) { - case 386: - if ((param1) && (param1 <= 3)) { - param0 = (496 - 1) + param1; - } - break; - case 413: - if ((param1) && (param1 <= 2)) { - param0 = (499 - 1) + param1; - } - break; - case 487: - if ((param1) && (param1 <= 1)) { - param0 = (501 - 1) + param1; - } - break; - case 492: - if ((param1) && (param1 <= 1)) { - param0 = (502 - 1) + param1; - } - break; - case 479: - if ((param1) && (param1 <= 5)) { - param0 = (503 - 1) + param1; - } - break; - default: - break; - } - - return param0; -} - -u32 FlagIndex (int index) -{ - int i; // only matches when declared here - u32 flag = 1; - - GF_ASSERT(index < 32); - - for (i = 0; i < index; i++) { - flag <<= 1; - } - - return flag; -} - -int sub_020787EC (u32 param0) -{ - int v0; - u32 v1 = 1; - - for (v0 = 0; v0 < 32; v0++) { - if (param0 & v1) { - break; - } - - v1 <<= 1; - } - - return v0; -} - -static const u16 Unk_020F05BE[18] = { - 0x96, - 0x97, - 0xF9, - 0xFA, - 0xFB, - 0x17E, - 0x17F, - 0x180, - 0x181, - 0x182, - 0x1E3, - 0x1E4, - 0x1E7, - 0x1E9, - 0x1EA, - 0x1EB, - 0x1EC, - 0x1ED -}; - -BOOL sub_02078804 (u16 param0) -{ - u32 v0; - - for (v0 = 0; v0 < NELEMS(Unk_020F05BE); v0++) { - if (param0 == Unk_020F05BE[v0]) { - return 1; - } - } - - return 0; -} - -u16 sub_02078824 (u8 param0) -{ - if (param0 >= NELEMS(Unk_020F05BE)) { - param0 = 0; - } - - return Unk_020F05BE[param0]; -} - -BOOL sub_02078838 (Pokemon * param0) -{ - u16 v0 = (u16)GetMonData(param0, MON_DATA_SPECIES, NULL); - return sub_02078804(v0); -} - -BOOL sub_0207884C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2) -{ - u32 v0 = sub_02025F20(param1); - u32 v1 = sub_02074570(param0, MON_DATA_OT_ID, NULL); - u32 v2 = sub_02025F30(param1); - u32 v3 = sub_02074570(param0, MON_DATA_OT_GENDER, NULL); - Strbuf* v4 = sub_02025F04(param1, param2); - Strbuf* v5 = Strbuf_Init(8, param2); - BOOL v6 = 0; - - sub_02074570(param0, MON_DATA_145, v5); - - if ((v0 == v1) && (v2 == v3) && (Strbuf_Compare(v4, v5) == 0)) { - v6 = 1; - } - - Strbuf_Free(v5); - Strbuf_Free(v4); - - return v6; -} - -int sub_020788D0 (int param0) -{ - switch (param0) { - case 0: - case 1: - break; - case 63: - param0 = 2; - break; - case 90: - case 91: - case 92: - case 93: - case 94: - param0 = 3 + (param0 - 90); - break; - case 103: - case 104: - param0 = 8 + (param0 - 103); - break; - default: - if (sub_020793AC(param0) == 1) { - param0 = 1; - } else { - param0 = 0; - } - break; - } - - return param0; -} - -void sub_0207893C (Pokemon * param0) -{ - u8 v0; - UnkStruct_0202CA28 v1; - - v0 = 0; - - MI_CpuClearFast(&v1, sizeof(UnkStruct_0202CA28)); - - sub_02074B30(param0, 162, (u8 *)&v0); - sub_02074B30(param0, 171, (UnkStruct_0202CA28 *)&v1); -} - -void sub_0207896C (BoxPokemon * param0) -{ - BOOL v0; - int v1; - - v0 = sub_02073D20(param0); - - for (v1 = 0; v1 < 4; v1++) { - if (sub_02074570(param0, MON_DATA_MOVE1 + v1, NULL)) { - u8 v2 = sub_02074570(param0, 66 + v1, NULL); - - SetBoxMonData(param0, 58 + v1, &v2); - } - } - - sub_02073D48(param0, v0); -} - -static inline int inline_020789BC (int param0) -{ - int v0; - - v0 = (param0 & 0x1) ? 0 : 1; - return v0; -} - -void sub_020789BC (NARC * param0, UnkStruct_02007C10 * param1, u16 param2, u16 param3) -{ - UnkStruct_020789BC v0; - int v1; - - v1 = inline_020789BC(param3); - - NARC_ReadFromMember(param0, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); - MI_CpuCopy8(&v0.unk_00[v1].unk_03[0], param1, sizeof(UnkStruct_02007C10) * 10); -} - -void sub_020789F4 (NARC * param0, UnkStruct_02015F84 * param1, UnkStruct_02007C7C * param2, u16 param3, int param4, int param5, int param6) -{ - UnkStruct_020789F4 v0; - UnkStruct_020789BC v1; - int v2; - int v3; - - v3 = (param4 == 2) ? 0 : 1; - - NARC_ReadFromMember(param0, 0, param3 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v1); - - v0.unk_00 = v1.unk_00[v3].unk_01; - v0.unk_02 = v1.unk_00[v3].unk_02; - v0.unk_04 = param5; - - sub_02015FCC(param1, param2, &v0, param6); -} - -void sub_02078A4C (NARC * param0, u8 * param1, u16 param2, u16 param3) -{ - UnkStruct_020789BC v0; - int v1; - - v1 = inline_020789BC(param3); - NARC_ReadFromMember(param0, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); - - *param1 = v0.unk_00[v1].unk_00; -} - -void sub_02078A80 (NARC * param0, s8 * param1, u16 param2) -{ - UnkStruct_020789BC v0; - - NARC_ReadFromMember(param0, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); - *param1 = v0.unk_56; -} - -void sub_02078AA4 (NARC * param0, s8 * param1, u16 param2) -{ - UnkStruct_020789BC v0; - - NARC_ReadFromMember(param0, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); - *param1 = v0.unk_57; -} - -void sub_02078AC8 (NARC * param0, u8 * param1, u16 param2) -{ - UnkStruct_020789BC v0; - - NARC_ReadFromMember(param0, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); - *param1 = v0.unk_58; -} - -BOOL sub_02078AEC (int param0, Pokemon * param1, int param2) -{ - int v0; - int v1; - UnkStruct_0202CA28 v2; - NARC * v3; - - v0 = param0; - - if (v0 == 0) { - return 0; - } - - v3 = NARC_ctor(NARC_INDEX_APPLICATION__CUSTOM_BALL__EDIT__PL_CB_DATA, param2); - v0 = v0 - 1; - v1 = 1; - - NARC_ReadFromMember(v3, 0, v0 * sizeof(UnkStruct_0202CA28), sizeof(UnkStruct_0202CA28), &v2); - sub_02074B30(param1, 162, &v1); - sub_02074B30(param1, 171, &v2); - NARC_dtor(v3); - - return 1; -} - -void sub_02078B40 (Pokemon * param0, UnkStruct_02078B40 * param1) -{ - BoxPokemon * v0; - PokemonSubstruct0 * v1; - PokemonSubstruct1 * v2; - PokemonSubstruct2 * v3; - PokemonSubstruct3 * v4; - int v5; - u16 v6; - - if (param0->box.unk_04_0 == 0) { - sub_02078234(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - sub_02078234(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - } - - v0 = sub_02076B10(param0); - v1 = (PokemonSubstruct0 *)sub_0207825C(v0, v0->unk_00, 0); - v2 = (PokemonSubstruct1 *)sub_0207825C(v0, v0->unk_00, 1); - v3 = (PokemonSubstruct2 *)sub_0207825C(v0, v0->unk_00, 2); - v4 = (PokemonSubstruct3 *)sub_0207825C(v0, v0->unk_00, 3); - - param1->unk_00 = v0->unk_00; - param1->unk_04_0 = 0; - param1->unk_04_1 = 0; - param1->unk_04_2 = v0->unk_04_2; - param1->unk_06 = v1->species; - param1->unk_08 = v1->item; - param1->unk_0C = v1->unk_04; - param1->unk_10 = v1->unk_08; - param1->unk_14 = v1->friendship; - param1->unk_15 = v1->unk_0D; - param1->unk_16 = v1->unk_10; - param1->unk_17 = v1->unk_11; - param1->unk_18 = v1->unk_12; - param1->unk_19 = v1->unk_13; - param1->unk_1A = v1->unk_14; - param1->unk_1B = v1->unk_15; - param1->unk_59 = v1->unk_0F; - - for (v5 = 0; v5 < 4; v5++) { - param1->unk_1C[v5] = v2->unk_00[v5]; - param1->unk_24[v5] = v2->unk_08[v5]; - param1->unk_28[v5] = v2->unk_0C[v5]; - } - - param1->unk_2C_0 = v2->unk_10_0; - param1->unk_2C_5 = v2->unk_10_5; - param1->unk_2C_10 = v2->unk_10_10; - param1->unk_2C_15 = v2->unk_10_15; - param1->unk_2C_20 = v2->unk_10_20; - param1->unk_2C_25 = v2->unk_10_25; - param1->unk_2C_30 = v2->unk_10_30; - param1->unk_2C_31 = v2->unk_10_31; - param1->unk_30_0 = v2->fatefulEncounter; - param1->unk_30_1 = v2->unk_18_1; - param1->unk_30_3 = v2->form; - - for (v5 = 0; v5 < 10 + 1; v5++) { - param1->unk_32[v5] = v3->unk_00[v5]; - } - - for (v5 = 0; v5 < 7 + 1; v5++) { - param1->unk_48[v5] = v4->unk_00[v5]; - } - - param1->unk_58 = v4->unk_1B; - - param1->unk_5C = param0->party.unk_00; - param1->unk_60 = param0->party.unk_04; - param1->unk_61 = param0->party.unk_05; - param1->unk_62 = param0->party.unk_06; - param1->unk_64 = param0->party.unk_08; - param1->unk_66 = param0->party.unk_0A; - param1->unk_68 = param0->party.unk_0C; - param1->unk_6A = param0->party.unk_0E; - param1->unk_6C = param0->party.unk_10; - param1->unk_6E = param0->party.unk_12; - - if (param0->box.unk_04_0 == 0) { - sub_0207822C(¶m0->party, sizeof(PartyPokemon), param0->box.unk_00); - sub_0207822C(¶m0->box.unk_08, sizeof(PokemonSubstruct0) * 4, param0->box.unk_06); - } -} - -void sub_02078E0C (UnkStruct_02078B40 * param0, Pokemon * param1) -{ - BoxPokemon * v0; - PokemonSubstruct0 * v1; - PokemonSubstruct1 * v2; - PokemonSubstruct2 * v3; - PokemonSubstruct3 * v4; - int v5; - - MI_CpuClearFast(param1, sizeof(Pokemon)); - - v0 = sub_02076B10(param1); - v1 = (PokemonSubstruct0 *)sub_0207825C(v0, param0->unk_00, 0); - v2 = (PokemonSubstruct1 *)sub_0207825C(v0, param0->unk_00, 1); - v3 = (PokemonSubstruct2 *)sub_0207825C(v0, param0->unk_00, 2); - v4 = (PokemonSubstruct3 *)sub_0207825C(v0, param0->unk_00, 3); - - v0->unk_00 = param0->unk_00; - v0->unk_04_0 = 0; - v0->unk_04_1 = 0; - v0->unk_04_2 = param0->unk_04_2; - - v1->species = param0->unk_06; - v1->item = param0->unk_08; - v1->unk_04 = param0->unk_0C; - v1->unk_08 = param0->unk_10; - v1->friendship = param0->unk_14; - v1->unk_0D = param0->unk_15; - v1->unk_10 = param0->unk_16; - v1->unk_11 = param0->unk_17; - v1->unk_12 = param0->unk_18; - v1->unk_13 = param0->unk_19; - v1->unk_14 = param0->unk_1A; - v1->unk_15 = param0->unk_1B; - v1->unk_0F = param0->unk_59; - - for (v5 = 0; v5 < 4; v5++) { - v2->unk_00[v5] = param0->unk_1C[v5]; - v2->unk_08[v5] = param0->unk_24[v5]; - v2->unk_0C[v5] = param0->unk_28[v5]; - } - - v2->unk_10_0 = param0->unk_2C_0; - v2->unk_10_5 = param0->unk_2C_5; - v2->unk_10_10 = param0->unk_2C_10; - v2->unk_10_15 = param0->unk_2C_15; - v2->unk_10_20 = param0->unk_2C_20; - v2->unk_10_25 = param0->unk_2C_25; - v2->unk_10_30 = param0->unk_2C_30; - v2->unk_10_31 = param0->unk_2C_31; - v2->fatefulEncounter = param0->unk_30_0; - v2->unk_18_1 = param0->unk_30_1; - v2->form = param0->unk_30_3; - - for (v5 = 0; v5 < 10 + 1; v5++) { - v3->unk_00[v5] = param0->unk_32[v5]; - } - - for (v5 = 0; v5 < 7 + 1; v5++) { - v4->unk_00[v5] = param0->unk_48[v5]; - } - - v4->unk_1B = param0->unk_58; - - param1->party.unk_00 = param0->unk_5C; - param1->party.unk_04 = param0->unk_60; - param1->party.unk_05 = param0->unk_61; - param1->party.unk_06 = param0->unk_62; - param1->party.unk_08 = param0->unk_64; - param1->party.unk_0A = param0->unk_66; - param1->party.unk_0C = param0->unk_68; - param1->party.unk_0E = param0->unk_6A; - param1->party.unk_10 = param0->unk_6C; - param1->party.unk_12 = param0->unk_6E; - - sub_0207822C(¶m1->party, sizeof(PartyPokemon), param1->box.unk_00); - param1->box.unk_06 = sub_0207823C(¶m1->box.unk_08, sizeof(PokemonSubstruct0) * 4); - sub_0207822C(¶m1->box.unk_08, sizeof(PokemonSubstruct0) * 4, param1->box.unk_06); -} diff --git a/src/unk_02079170.c b/src/unk_02079170.c index 12ded1869c..63abafae73 100644 --- a/src/unk_02079170.c +++ b/src/unk_02079170.c @@ -21,7 +21,7 @@ #include "unk_0201D15C.h" #include "strbuf.h" #include "unk_020277A4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079170.h" #include "party.h" @@ -337,7 +337,7 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) sub_02073D80(v7, v9, v8[v1].unk_02, v6, 1, v4, 2, 0); sub_02078AEC(v8[v1].unk_06, v7, param2); - sub_02074B30(v7, 112, &v10); + SetMonData(v7, 112, &v10); Party_AddPokemon(param0->parties[param1], v7); } } @@ -367,11 +367,11 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) sub_02073D80(v7, v12, v11[v1].unk_02, v6, 1, v4, 2, 0); for (v2 = 0; v2 < 4; v2++) { - sub_02077230(v7, v11[v1].unk_06[v2], v2); + SetMonMove(v7, v11[v1].unk_06[v2], v2); } sub_02078AEC(v11[v1].unk_0E, v7, param2); - sub_02074B30(v7, 112, &v13); + SetMonData(v7, 112, &v13); Party_AddPokemon(param0->parties[param1], v7); } } @@ -399,9 +399,9 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) v6 = v14[v1].unk_00 * 31 / 255; sub_02073D80(v7, v15, v14[v1].unk_02, v6, 1, v4, 2, 0); - sub_02074B30(v7, 6, (u8 *)&v14[v1].unk_06); + SetMonData(v7, 6, (u8 *)&v14[v1].unk_06); sub_02078AEC(v14[v1].unk_08, v7, param2); - sub_02074B30(v7, 112, &v16); + SetMonData(v7, 112, &v16); Party_AddPokemon(param0->parties[param1], v7); } } @@ -429,14 +429,14 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) v6 = v17[v1].unk_00 * 31 / 255; sub_02073D80(v7, v18, v17[v1].unk_02, v6, 1, v4, 2, 0); - sub_02074B30(v7, 6, (u8 *)&v17[v1].unk_06); + SetMonData(v7, 6, (u8 *)&v17[v1].unk_06); for (v2 = 0; v2 < 4; v2++) { - sub_02077230(v7, v17[v1].unk_08[v2], v2); + SetMonMove(v7, v17[v1].unk_08[v2], v2); } sub_02078AEC(v17[v1].unk_10, v7, param2); - sub_02074B30(v7, 112, &v19); + SetMonData(v7, 112, &v19); Party_AddPokemon(param0->parties[param1], v7); } } diff --git a/src/unk_020797C8.c b/src/unk_020797C8.c index b802e61e3e..2e7f3f49da 100644 --- a/src/unk_020797C8.c +++ b/src/unk_020797C8.c @@ -6,7 +6,7 @@ #include "message.h" #include "strbuf.h" #include "unk_020244AC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" typedef struct UnkStruct_020797DC_t { @@ -97,7 +97,7 @@ BOOL sub_020798A0 (UnkStruct_020797DC * param0, u32 param1, BoxPokemon * param2) } for (v0 = 0; v0 < (5 * 6); v0++) { - if (sub_02074570(&(param0->unk_04[param1][v0]), MON_DATA_SPECIES, NULL) == 0) { + if (GetBoxMonData(&(param0->unk_04[param1][v0]), MON_DATA_SPECIES, NULL) == 0) { param0->unk_04[param1][v0] = *param2; sub_02024804(); return 1; @@ -154,7 +154,7 @@ u32 sub_020799A0 (const UnkStruct_020797DC * param0) while (TRUE) { for (v1 = 0; v1 < (5 * 6); v1++) { - if (sub_02074570((BoxPokemon *)(&(param0->unk_04[v0][v1])), MON_DATA_172, NULL) == 0) { + if (GetBoxMonData((BoxPokemon *)(&(param0->unk_04[v0][v1])), MON_DATA_172, NULL) == 0) { return v0; } } @@ -184,7 +184,7 @@ BOOL sub_020799F0 (const UnkStruct_020797DC * param0, int * param1, int * param2 while (TRUE) { for ( ; v1 < (5 * 6); v1++) { - if (sub_02074570((BoxPokemon *)(&(param0->unk_04[v0][v1])), MON_DATA_172, NULL) == 0) { + if (GetBoxMonData((BoxPokemon *)(&(param0->unk_04[v0][v1])), MON_DATA_172, NULL) == 0) { *param1 = v0; *param2 = v1; return 1; @@ -214,7 +214,7 @@ u32 sub_02079A50 (const UnkStruct_020797DC * param0) for (v0 = 0; v0 < 18; v0++) { for (v1 = 0; v1 < (5 * 6); v1++) { - if (sub_02074570((BoxPokemon *)(&(param0->unk_04[v0][v1])), MON_DATA_172, NULL) != 0) { + if (GetBoxMonData((BoxPokemon *)(&(param0->unk_04[v0][v1])), MON_DATA_172, NULL) != 0) { v2++; } } @@ -297,7 +297,7 @@ u32 sub_02079B54 (const UnkStruct_020797DC * param0, u32 param1) u32 v1 = 0; for (v0 = 0; v0 < (5 * 6); v0++) { - if (sub_02074570((BoxPokemon *)(&(param0->unk_04[param1][v0])), MON_DATA_172, NULL)) { + if (GetBoxMonData((BoxPokemon *)(&(param0->unk_04[param1][v0])), MON_DATA_172, NULL)) { v1++; } } @@ -321,8 +321,8 @@ u32 sub_02079B98 (const UnkStruct_020797DC * param0, u32 param1) u32 v1 = 0; for (v0 = 0; v0 < (5 * 6); v0++) { - if (sub_02074570((BoxPokemon *)(&(param0->unk_04[param1][v0])), MON_DATA_172, NULL)) { - if (sub_02074570((BoxPokemon *)(&(param0->unk_04[param1][v0])), MON_DATA_IS_EGG, NULL) == 0) { + if (GetBoxMonData((BoxPokemon *)(&(param0->unk_04[param1][v0])), MON_DATA_172, NULL)) { + if (GetBoxMonData((BoxPokemon *)(&(param0->unk_04[param1][v0])), MON_DATA_IS_EGG, NULL) == 0) { v1++; } } @@ -356,7 +356,7 @@ u32 sub_02079C08 (const UnkStruct_020797DC * param0, u32 param1, u32 param2, int param1 = param0->unk_00; } - return sub_02074570((BoxPokemon *)(¶m0->unk_04[param1][param2]), param3, param4); + return GetBoxMonData((BoxPokemon *)(¶m0->unk_04[param1][param2]), param3, param4); } void sub_02079C50 (UnkStruct_020797DC * param0, u32 param1, u32 param2, int param3, void * param4) diff --git a/src/unk_02079D40.c b/src/unk_02079D40.c index f8efeea900..f43d2f778e 100644 --- a/src/unk_02079D40.c +++ b/src/unk_02079D40.c @@ -4,7 +4,7 @@ #include "struct_defs/pokemon.h" #include "struct_defs/box_pokemon.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" const u8 Unk_020F0780[] = { @@ -559,19 +559,19 @@ u32 sub_02079D40 (const BoxPokemon * param0) u32 v3; u32 v4; - v2 = sub_02073D20((BoxPokemon *)param0); - v0 = sub_02074570((BoxPokemon *)param0, MON_DATA_SPECIES, NULL); - v4 = sub_02074570((BoxPokemon *)param0, MON_DATA_IS_EGG, NULL); + v2 = DecryptBoxMon((BoxPokemon *)param0); + v0 = GetBoxMonData((BoxPokemon *)param0, MON_DATA_SPECIES, NULL); + v4 = GetBoxMonData((BoxPokemon *)param0, MON_DATA_IS_EGG, NULL); v3 = sub_02079E44((BoxPokemon *)param0); v1 = sub_02079D8C(v0, v4, v3); - sub_02073D48((BoxPokemon *)param0, v2); + EncryptBoxMon((BoxPokemon *)param0, v2); return v1; } u32 sub_02079D80 (Pokemon * param0) { - return sub_02079D40((const BoxPokemon *)sub_02076B10(param0)); + return sub_02079D40((const BoxPokemon *)GetBoxMon(param0)); } u32 sub_02079D8C (u32 param0, u32 param1, u32 param2) @@ -635,11 +635,11 @@ u16 sub_02079E44 (const BoxPokemon * param0) { u32 v0; - v0 = sub_02074570((BoxPokemon *)param0, MON_DATA_SPECIES_EGG, NULL); + v0 = GetBoxMonData((BoxPokemon *)param0, MON_DATA_SPECIES_EGG, NULL); switch (v0) { case 201: - return sub_02076B00((BoxPokemon *)param0); + return GetBoxMonForm((BoxPokemon *)param0); case 386: case 412: case 413: @@ -648,7 +648,7 @@ u16 sub_02079E44 (const BoxPokemon * param0) case 487: case 492: case 479: - return sub_02074570((BoxPokemon *)param0, MON_DATA_FORM, NULL); + return GetBoxMonData((BoxPokemon *)param0, MON_DATA_FORM, NULL); default: return 0; } @@ -698,19 +698,19 @@ const u8 sub_02079F84 (const BoxPokemon * param0) u32 v2; u32 v3; - v0 = sub_02073D20((BoxPokemon *)param0); + v0 = DecryptBoxMon((BoxPokemon *)param0); v2 = sub_02079E44(param0); - v1 = sub_02074570((BoxPokemon *)param0, MON_DATA_SPECIES, NULL); - v3 = sub_02074570((BoxPokemon *)param0, MON_DATA_IS_EGG, NULL); + v1 = GetBoxMonData((BoxPokemon *)param0, MON_DATA_SPECIES, NULL); + v3 = GetBoxMonData((BoxPokemon *)param0, MON_DATA_IS_EGG, NULL); - sub_02073D48((BoxPokemon *)param0, v0); + EncryptBoxMon((BoxPokemon *)param0, v0); return sub_02079EDC(v1, v2, v3); } const u8 sub_02079FC4 (Pokemon * param0) { - return sub_02079F84((const BoxPokemon *)sub_02076B10(param0)); + return sub_02079F84((const BoxPokemon *)GetBoxMon(param0)); } u32 sub_02079FD0 (void) diff --git a/src/unk_0207A274.c b/src/unk_0207A274.c index 748cc8f854..b4311468d2 100644 --- a/src/unk_0207A274.c +++ b/src/unk_0207A274.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_021C0794_decl.h" #include "unk_0202631C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0207A274.h" u32 sub_0207A274 (UnkStruct_021C0794 * param0) diff --git a/src/unk_0207A2A8.c b/src/unk_0207A2A8.c index 88e372bb77..99d41f2aa8 100644 --- a/src/unk_0207A2A8.c +++ b/src/unk_0207A2A8.c @@ -8,7 +8,7 @@ #include "struct_defs/struct_0202610C.h" #include "unk_0202602C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207A2A8.h" #include "unk_02098700.h" @@ -38,7 +38,7 @@ BOOL sub_0207A2D0 (const UnkStruct_0202610C * param0, Pokemon * param1, const Un v1 = sub_02026074(param0, 2); - if (GetMonData(param1, MON_DATA_161, NULL) > v1) { + if (GetMonData(param1, MON_DATA_LEVEL, NULL) > v1) { return 0; } @@ -135,7 +135,7 @@ int sub_0207A3AC (const UnkStruct_0202610C * param0, Party * param1, const UnkSt v6[v4] = (u16)GetMonData(v0, MON_DATA_SPECIES, NULL); v7[v4] = (u16)GetMonData(v0, MON_DATA_HELD_ITEM, NULL); - v5 += GetMonData(v0, MON_DATA_161, NULL); + v5 += GetMonData(v0, MON_DATA_LEVEL, NULL); } } @@ -219,7 +219,7 @@ int sub_0207A594 (const UnkStruct_0202610C * param0, Party * param1, const UnkSt for (v4 = 0; v4 < v2; v4++) { v0 = Party_GetPokemonBySlotIndex(param1, v4); v6[v4] = (u16)GetMonData(v0, MON_DATA_SPECIES, NULL); - v7[v4] = GetMonData(v0, MON_DATA_161, NULL); + v7[v4] = GetMonData(v0, MON_DATA_LEVEL, NULL); if (sub_0207A2D0(param0, v0, param2) == 0) { v6[v4] = 0; diff --git a/src/unk_0207AE68.c b/src/unk_0207AE68.c index 13a22989f2..dbab447297 100644 --- a/src/unk_0207AE68.c +++ b/src/unk_0207AE68.c @@ -61,7 +61,7 @@ #include "unk_0202CD50.h" #include "unk_020393C8.h" #include "unk_02056720.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207AE68.h" #include "unk_0207C63C.h" @@ -295,7 +295,7 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) } sub_0200590C(param0->unk_60, param0->unk_84, param0->unk_86); - sub_0200B5CC(param0->unk_0C, 0, sub_02076B10(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, GetBoxMon(param0->unk_28)); if (param0->unk_7C & 0x2) { param0->unk_65 = sub_0207C584(param0, 917); @@ -404,11 +404,11 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) break; case 11: if ((sub_0200598C() == 0) && (sub_020160F4(param0->unk_44, 0) == 1) && (sub_02007C24(param0->unk_1C[1]) == 0)) { - sub_02074B30(param0->unk_28, 5, (u8 *)¶m0->unk_62); - sub_0207803C(param0->unk_28); - sub_0207418C(param0->unk_28); - sub_0200B5CC(param0->unk_0C, 0, sub_02076B10(param0->unk_28)); - sub_0200B538(param0->unk_0C, 1, sub_02076B10(param0->unk_28)); + SetMonData(param0->unk_28, 5, (u8 *)¶m0->unk_62); + CalculateMonAbility(param0->unk_28); + CalculateMonLevelAndStats(param0->unk_28); + sub_0200B5CC(param0->unk_0C, 0, GetBoxMon(param0->unk_28)); + sub_0200B538(param0->unk_0C, 1, GetBoxMon(param0->unk_28)); param0->unk_65 = sub_0207C584(param0, 918); param0->unk_66 = 40; param0->unk_64++; @@ -420,10 +420,10 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) sub_0202736C(param0->unk_48, param0->unk_28); sub_0202CF28(param0->unk_50, (1 + 11)); sub_0202CFEC(param0->unk_50, 22); - sub_02056A48(param0->unk_54, sub_02076B10(param0->unk_28)); + sub_02056A48(param0->unk_54, GetBoxMon(param0->unk_28)); if (GetMonData(param0->unk_28, MON_DATA_77, NULL) == 0) { - sub_02074B30(param0->unk_28, 179, NULL); + SetMonData(param0->unk_28, 179, NULL); } param0->unk_64++; @@ -445,7 +445,7 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) param0->unk_64 = 14; break; default: - sub_0200B5CC(param0->unk_0C, 0, sub_02076B10(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, GetBoxMon(param0->unk_28)); sub_0200B630(param0->unk_0C, 1, v3); param0->unk_65 = sub_0207C584(param0, 4); param0->unk_66 = 30; @@ -455,14 +455,14 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) } break; case 14: - sub_0200B5CC(param0->unk_0C, 0, sub_02076B10(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, GetBoxMon(param0->unk_28)); sub_0200B630(param0->unk_0C, 1, param0->unk_6C); param0->unk_65 = sub_0207C584(param0, 1193); param0->unk_66 = 30; param0->unk_64++; break; case 16: - sub_0200B5CC(param0->unk_0C, 0, sub_02076B10(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, GetBoxMon(param0->unk_28)); param0->unk_65 = sub_0207C584(param0, 1194); param0->unk_66 = 30; param0->unk_64++; @@ -562,7 +562,7 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) case 35: switch (sub_02002114(param0->unk_40, param0->unk_5C)) { case 0: - sub_0200B5CC(param0->unk_0C, 0, sub_02076B10(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, GetBoxMon(param0->unk_28)); sub_0200B630(param0->unk_0C, 1, param0->unk_6C); param0->unk_65 = sub_0207C584(param0, 1198); param0->unk_66 = 30; @@ -587,7 +587,7 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) param0->unk_64++; break; case 27: - sub_0200B5CC(param0->unk_0C, 0, sub_02076B10(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, GetBoxMon(param0->unk_28)); sub_0200B630(param0->unk_0C, 1, GetMonData(param0->unk_28, 54 + param0->unk_6E, NULL)); param0->unk_65 = sub_0207C584(param0, 1200); param0->unk_66 = 30; @@ -599,12 +599,12 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) param0->unk_64++; break; case 31: - sub_0200B5CC(param0->unk_0C, 0, sub_02076B10(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, GetBoxMon(param0->unk_28)); sub_0200B630(param0->unk_0C, 1, param0->unk_6C); param0->unk_65 = sub_0207C584(param0, 1202); param0->unk_66 = 0; - sub_02074B30(param0->unk_28, 62 + param0->unk_6E, ¶m0->unk_66); - sub_02077230(param0->unk_28, param0->unk_6C, param0->unk_6E); + SetMonData(param0->unk_28, 62 + param0->unk_6E, ¶m0->unk_66); + SetMonMove(param0->unk_28, param0->unk_6C, param0->unk_6E); param0->unk_66 = 30; param0->unk_64 = 37; break; @@ -668,7 +668,7 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) break; case 43: if ((sub_0200598C() == 0) && (sub_020160F4(param0->unk_44, 0) == 1) && (sub_02007C24(param0->unk_1C[0]) == 0)) { - sub_0200B5CC(param0->unk_0C, 0, sub_02076B10(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, GetBoxMon(param0->unk_28)); param0->unk_65 = sub_0207C584(param0, 919); param0->unk_66 = 20; param0->unk_64++; @@ -709,50 +709,50 @@ static void sub_0207C028 (UnkStruct_0207AE68 * param0) sub_020775EC(param0->unk_28, v1); v2 = 292; - sub_02074B30(v1, 5, &v2); + SetMonData(v1, 5, &v2); v2 = 4; - sub_02074B30(v1, 155, &v2); + SetMonData(v1, 155, &v2); v2 = 0; - sub_02074B30(v1, 6, &v2); - sub_02074B30(v1, 11, &v2); + SetMonData(v1, 6, &v2); + SetMonData(v1, 11, &v2); for (v0 = 25; v0 < 53 + 1; v0++) { - sub_02074B30(v1, v0, &v2); + SetMonData(v1, v0, &v2); } for (v0 = 78; v0 < 109 + 1; v0++) { - sub_02074B30(v1, v0, &v2); + SetMonData(v1, v0, &v2); } for (v0 = 123; v0 < 143 + 1; v0++) { - sub_02074B30(v1, v0, &v2); + SetMonData(v1, v0, &v2); } - sub_02074B30(v1, 179, NULL); - sub_02074B30(v1, 77, &v2); - sub_02074B30(v1, 160, &v2); + SetMonData(v1, 179, NULL); + SetMonData(v1, 77, &v2); + SetMonData(v1, 160, &v2); v3 = sub_0202818C(param0->unk_5C); - sub_02074B30(v1, 170, v3); + SetMonData(v1, 170, v3); Heap_FreeToHeap(v3); - sub_02074B30(v1, 162, &v2); + SetMonData(v1, 162, &v2); MI_CpuClearFast(&v4, sizeof(UnkStruct_0202CA28)); - sub_02074B30(v1, 171, (UnkStruct_0202CA28 *)&v4); - sub_0207803C(v1); + SetMonData(v1, 171, (UnkStruct_0202CA28 *)&v4); + CalculateMonAbility(v1); - v0 = sub_02075D6C(v1); - sub_02074B30(v1, 111, &v0); + v0 = GetMonGender(v1); + SetMonData(v1, 111, &v0); - sub_0207418C(v1); + CalculateMonLevelAndStats(v1); Party_AddPokemon(param0->unk_24, v1); sub_0202736C(param0->unk_48, v1); sub_0202CF28(param0->unk_50, (1 + 11)); sub_0202CFEC(param0->unk_50, 22); - sub_02056A48(param0->unk_54, sub_02076B10(v1)); + sub_02056A48(param0->unk_54, GetBoxMon(v1)); Heap_FreeToHeap(v1); sub_0207D60C(param0->unk_4C, 4, 1, param0->unk_5C); } @@ -762,7 +762,7 @@ static void sub_0207C028 (UnkStruct_0207AE68 * param0) case 18: case 19: v0 = 0; - sub_02074B30(param0->unk_28, 6, &v0); + SetMonData(param0->unk_28, 6, &v0); break; } } @@ -955,8 +955,8 @@ static void sub_0207C498 (UnkStruct_0207AE68 * param0) v1 = AllocMonZeroed(param0->unk_5C); sub_020775EC(param0->unk_28, v1); - sub_02074B30(v1, 5, (u8 *)¶m0->unk_62); - sub_0207418C(v1); + SetMonData(v1, 5, (u8 *)¶m0->unk_62); + CalculateMonLevelAndStats(v1); sub_02075EF4(&v0, v1, 2); Heap_FreeToHeap(v1); diff --git a/src/unk_0207E0B8.c b/src/unk_0207E0B8.c index 63fdebd329..d2cbaac702 100644 --- a/src/unk_0207E0B8.c +++ b/src/unk_0207E0B8.c @@ -56,7 +56,7 @@ #include "unk_020393C8.h" #include "unk_0206B9D8.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207A2A8.h" #include "item.h" @@ -1064,9 +1064,9 @@ u8 sub_0207EF14 (UnkStruct_0207F248 * param0, u8 param1) sub_02081ED8(param0, v0, param1); param0->unk_704[param1].unk_04 = v2; - param0->unk_704[param1].unk_06 = (u16)GetMonData(v0, MON_DATA_163, NULL); - param0->unk_704[param1].unk_08 = (u16)GetMonData(v0, MON_DATA_164, NULL); - param0->unk_704[param1].unk_0A = (u16)GetMonData(v0, MON_DATA_161, NULL); + param0->unk_704[param1].unk_06 = (u16)GetMonData(v0, MON_DATA_CURRENT_HP, NULL); + param0->unk_704[param1].unk_08 = (u16)GetMonData(v0, MON_DATA_MAX_HP, NULL); + param0->unk_704[param1].unk_0A = (u16)GetMonData(v0, MON_DATA_LEVEL, NULL); param0->unk_704[param1].unk_0C = (u16)GetMonData(v0, MON_DATA_HELD_ITEM, NULL); param0->unk_704[param1].unk_12 = (u16)GetMonData(v0, MON_DATA_162, NULL); param0->unk_704[param1].unk_10 = (u8)GetMonData(v0, MON_DATA_IS_EGG, NULL); @@ -1078,7 +1078,7 @@ u8 sub_0207EF14 (UnkStruct_0207F248 * param0, u8 param1) param0->unk_704[param1].unk_0E_12 = 1; } - param0->unk_704[param1].unk_0E_13 = sub_02075D6C(v0); + param0->unk_704[param1].unk_0E_13 = GetMonGender(v0); param0->unk_704[param1].unk_29 = 1; param0->unk_704[param1].unk_0E_0 = (u8)sub_0208E9F0(v0); @@ -1376,7 +1376,7 @@ void sub_0207F8F8 (UnkStruct_0207F248 * param0, u8 param1) v1 = 0; } - if (GetMonData(v0, MON_DATA_163, 0) == 0) { + if (GetMonData(v0, MON_DATA_CURRENT_HP, 0) == 0) { v1 += 2; } else if (sub_0207F984(param0, param1) == 1) { v1 += 1; @@ -2464,7 +2464,7 @@ static int sub_02080BF4 (UnkStruct_0207F248 * param0) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); v1 = MessageLoader_GetNewStrbuf(param0->unk_69C, 64); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); sub_0200B60C(param0->unk_6A0, 1, param0->unk_B14[2], 3, 0, 1); sub_0200C388(param0->unk_6A0, param0->unk_6A4, v1); Strbuf_Free(v1); @@ -2527,7 +2527,7 @@ static BOOL sub_02080F3C (UnkStruct_0207F248 * param0, u8 param1, s8 param2) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param1); v1 = param0->unk_704[param1].unk_06; - sub_02074B30(v0, 163, &v1); + SetMonData(v0, 163, &v1); return 1; } @@ -2584,7 +2584,7 @@ static int sub_0208107C (UnkStruct_0207F248 * param0) v0 = Item_Load(param0->unk_5A4->unk_24, 0, 12); - if ((param0->unk_5A4->unk_24 == 466) && (sub_02077B14(Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11)) == 1)) { + if ((param0->unk_5A4->unk_24 == 466) && (AllowShayminSkyForm(Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11)) == 1)) { param0->unk_5A4->unk_38 = 1; Heap_FreeToHeap(v0); sub_020819B4(param0); @@ -2656,7 +2656,7 @@ static int sub_02081224 (UnkStruct_0207F248 * param0) if (param0->unk_5A4->unk_24 == 112) { if (GetMonData(v0, MON_DATA_SPECIES, NULL) != 487) { MessageLoader_GetStrbuf(param0->unk_69C, 203, param0->unk_6A8); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); sub_0200B744(param0->unk_6A0, 1, param0->unk_5A4->unk_24); sub_0200C388(param0->unk_6A0, param0->unk_6A4, param0->unk_6A8); v2 = 11; @@ -2681,13 +2681,13 @@ static int sub_02081224 (UnkStruct_0207F248 * param0) v2 = sub_02081408(param0, v0, &v3); MessageLoader_GetStrbuf(param0->unk_69C, 118, param0->unk_6A8); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); sub_0200B70C(param0->unk_6A0, 1, param0->unk_5A4->unk_24); sub_0200C388(param0->unk_6A0, param0->unk_6A4, param0->unk_6A8); break; case 1: MessageLoader_GetStrbuf(param0->unk_69C, 78, param0->unk_6A8); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); sub_0200B744(param0->unk_6A0, 1, param0->unk_704[param0->unk_B11].unk_0C); sub_0200C388(param0->unk_6A0, param0->unk_6A4, param0->unk_6A8); v2 = 9; @@ -2714,11 +2714,11 @@ static int sub_02081408 (UnkStruct_0207F248 * param0, Pokemon * param1, int * pa v1 = param0->unk_5A4->unk_1C; sub_0207D60C(param0->unk_5A4->unk_04, param0->unk_5A4->unk_24, 1, 12); - sub_02074B30(param1, 6, &v0); - sub_02077928(param1); + SetMonData(param1, 6, &v0); + SetArceusForm(param1); if ((v1 == NULL) || (v1->unk_1C->unk_00 < 573) || (v1->unk_1C->unk_00 > 583)) { - *param2 = sub_02077A00(param1); + *param2 = SetGiratinaForm(param1); } else { *param2 = -1; } @@ -2736,9 +2736,9 @@ static int sub_02081408 (UnkStruct_0207F248 * param0, Pokemon * param1, int * pa static void sub_020814A8 (UnkStruct_0207F248 * param0, Pokemon * param1, u32 param2, u32 param3) { sub_0207D570(param0->unk_5A4->unk_04, (u16)param2, 1, 12); - sub_02074B30(param1, 6, ¶m3); - sub_02077928(param1); - sub_02077A00(param1); + SetMonData(param1, 6, ¶m3); + SetArceusForm(param1); + SetGiratinaForm(param1); param0->unk_704[param0->unk_B11].unk_0C = (u16)param3; sub_02083040(param0, param0->unk_B11, param0->unk_704[param0->unk_B11].unk_0C); } @@ -2875,7 +2875,7 @@ static int sub_02081760 (UnkStruct_0207F248 * param0) if (v3 == 0) { MessageLoader_GetStrbuf(param0->unk_69C, 118, param0->unk_6A8); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); sub_0200B70C(param0->unk_6A0, 1, param0->unk_5A4->unk_24); sub_0200C388(param0->unk_6A0, param0->unk_6A4, param0->unk_6A8); } else { diff --git a/src/unk_020819DC.c b/src/unk_020819DC.c index 1f0166e34f..a9f4799816 100644 --- a/src/unk_020819DC.c +++ b/src/unk_020819DC.c @@ -24,7 +24,7 @@ #include "unk_0201D670.h" #include "strbuf.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207E0B8.h" #include "unk_020819DC.h" @@ -249,7 +249,7 @@ void sub_02081E08 (UnkStruct_0207F248 * param0) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); v1 = MessageLoader_GetNewStrbuf(param0->unk_69C, 37); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); sub_0200C388(param0->unk_6A0, param0->unk_6A4, v1); Strbuf_Free(v1); } @@ -275,7 +275,7 @@ void sub_02081ED8 (UnkStruct_0207F248 * param0, Pokemon * param1, u32 param2) v0 = MessageLoader_GetNewStrbuf(param0->unk_69C, Unk_020F1EA0[param2][0]); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(param1)); + sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(param1)); sub_0200C388(param0->unk_6A0, param0->unk_704[param2].unk_00, v0); Strbuf_Free(v0); } @@ -749,12 +749,12 @@ void sub_020829DC (UnkStruct_0207F248 * param0) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - v3[0] = (u16)GetMonData(v0, MON_DATA_164, NULL); - v3[1] = (u16)GetMonData(v0, MON_DATA_165, NULL); - v3[2] = (u16)GetMonData(v0, MON_DATA_166, NULL); - v3[3] = (u16)GetMonData(v0, MON_DATA_168, NULL); - v3[4] = (u16)GetMonData(v0, MON_DATA_169, NULL); - v3[5] = (u16)GetMonData(v0, MON_DATA_167, NULL); + v3[0] = (u16)GetMonData(v0, MON_DATA_MAX_HP, NULL); + v3[1] = (u16)GetMonData(v0, MON_DATA_ATK, NULL); + v3[2] = (u16)GetMonData(v0, MON_DATA_DEF, NULL); + v3[3] = (u16)GetMonData(v0, MON_DATA_SP_ATK, NULL); + v3[4] = (u16)GetMonData(v0, MON_DATA_SP_DEF, NULL); + v3[5] = (u16)GetMonData(v0, MON_DATA_SPEED, NULL); sub_0201A7E8(param0->unk_00, ¶m0->unk_254[0], 0, 1, 1, 14, 12, 0, 576); sub_0200DC48(¶m0->unk_254[0], 1, 1, 14); diff --git a/src/unk_02082C2C.c b/src/unk_02082C2C.c index d459c0f64d..eb12fe70a3 100644 --- a/src/unk_02082C2C.c +++ b/src/unk_02082C2C.c @@ -22,7 +22,7 @@ #include "unk_0201E010.h" #include "gx_layers.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02079D40.h" #include "party.h" #include "item.h" diff --git a/src/unk_02083370.c b/src/unk_02083370.c index 7f1a79bc14..ba11ea36a5 100644 --- a/src/unk_02083370.c +++ b/src/unk_02083370.c @@ -25,7 +25,7 @@ #include "unk_0201D670.h" #include "unk_020218BC.h" #include "unk_0207070C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "unk_0207E0B8.h" @@ -177,7 +177,7 @@ static void sub_020834B0 (UnkStruct_0207F248 * param0, int * param1) if (param0->unk_704[param0->unk_B11].unk_0C == 0) { v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); MessageLoader_GetStrbuf(param0->unk_69C, 81, param0->unk_6A8); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); sub_0200C388(param0->unk_6A0, param0->unk_6A4, param0->unk_6A8); } else if (sub_0207D570(param0->unk_5A4->unk_04, param0->unk_704[param0->unk_B11].unk_0C, 1, 12) == 1) { u32 v4; @@ -185,11 +185,11 @@ static void sub_020834B0 (UnkStruct_0207F248 * param0, int * param1) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); v4 = 0; - sub_02074B30(v0, 6, &v4); - sub_02077928(v0); + SetMonData(v0, 6, &v4); + SetArceusForm(v0); if ((v3 == NULL) || (v3->unk_1C->unk_00 < 573) || (v3->unk_1C->unk_00 > 583)) { - v1 = sub_02077A00(v0); + v1 = SetGiratinaForm(v0); if ((param0->unk_704[param0->unk_B11].unk_0C == 112) && (v1 == 0)) { v2 = 18; @@ -197,7 +197,7 @@ static void sub_020834B0 (UnkStruct_0207F248 * param0, int * param1) } MessageLoader_GetStrbuf(param0->unk_69C, 82, param0->unk_6A8); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); sub_0200B70C(param0->unk_6A0, 1, param0->unk_704[param0->unk_B11].unk_0C); sub_0200C388(param0->unk_6A0, param0->unk_6A4, param0->unk_6A8); @@ -347,9 +347,9 @@ static int sub_020838F4 (void * param0) v1 = Party_GetPokemonBySlotIndex(v0->unk_5A4->unk_00, v0->unk_B11); v2 = 0; - sub_02074B30(v1, 6, &v2); - sub_02077928(v1); - sub_02077A00(v1); + SetMonData(v1, 6, &v2); + SetArceusForm(v1); + SetGiratinaForm(v1); v0->unk_704[v0->unk_B11].unk_0C = 0; diff --git a/src/unk_02084B70.c b/src/unk_02084B70.c index 318e8eaace..dce6de0960 100644 --- a/src/unk_02084B70.c +++ b/src/unk_02084B70.c @@ -21,7 +21,7 @@ #include "unk_0201D670.h" #include "strbuf.h" #include "map_header.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "party.h" #include "item.h" @@ -225,7 +225,7 @@ static void sub_02084E58 (UnkStruct_0207F248 * param0, u16 param1, u32 param2) Strbuf* v1; v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); switch (sub_02084B70(param1)) { case 4: @@ -485,7 +485,7 @@ static int sub_020855C4 (void * param0) sub_02096F14(v0->unk_5A4->unk_00, v0->unk_5A4->unk_24, v0->unk_B11, 0, sub_02086930(v0), 12); v1 = Party_GetPokemonBySlotIndex(v0->unk_5A4->unk_00, v0->unk_B11); - v3 = GetMonData(v1, MON_DATA_163, NULL); + v3 = GetMonData(v1, MON_DATA_CURRENT_HP, NULL); if (v0->unk_704[v0->unk_B11].unk_06 == 0) { v2 = MessageLoader_GetNewStrbuf(v0->unk_69C, 70); @@ -495,7 +495,7 @@ static int sub_020855C4 (void * param0) v2 = MessageLoader_GetNewStrbuf(v0->unk_69C, 64); } - sub_0200B5CC(v0->unk_6A0, 0, sub_02076B10(v1)); + sub_0200B5CC(v0->unk_6A0, 0, GetBoxMon(v1)); sub_0200B60C(v0->unk_6A0, 1, v3 - v0->unk_704[v0->unk_B11].unk_06, 3, 0, 1); sub_0200C388(v0->unk_6A0, v0->unk_6A4, v2); Strbuf_Free(v2); @@ -522,7 +522,7 @@ static int sub_02085704 (void * param0) u32 v2; v1 = Party_GetPokemonBySlotIndex(v0->unk_5A4->unk_00, v0->unk_B11); - v2 = GetMonData(v1, MON_DATA_163, NULL); + v2 = GetMonData(v1, MON_DATA_CURRENT_HP, NULL); if (v0->unk_704[v0->unk_B11].unk_06 != v2) { v0->unk_704[v0->unk_B11].unk_06++; @@ -596,10 +596,10 @@ int sub_02085804 (UnkStruct_0207F248 * param0) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); sub_02096954(v0, param0->unk_5A4->unk_24, 0, sub_02086930(param0), 12); - v2 = GetMonData(v0, MON_DATA_163, NULL); + v2 = GetMonData(v0, MON_DATA_CURRENT_HP, NULL); v1 = MessageLoader_GetNewStrbuf(param0->unk_69C, 70); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); sub_0200C388(param0->unk_6A0, param0->unk_6A4, v1); Strbuf_Free(v1); @@ -615,7 +615,7 @@ int sub_02085804 (UnkStruct_0207F248 * param0) break; case 2: v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - v2 = GetMonData(v0, MON_DATA_163, NULL); + v2 = GetMonData(v0, MON_DATA_CURRENT_HP, NULL); param0->unk_704[param0->unk_B11].unk_06++; @@ -667,22 +667,22 @@ static int sub_02085A70 (void * param0) v0 = (UnkStruct_0207F248 *)param0; v1 = Party_GetPokemonBySlotIndex(v0->unk_5A4->unk_00, v0->unk_B11); - v0->unk_B14[0] = (u16)GetMonData(v1, MON_DATA_164, NULL); - v0->unk_B14[1] = (u16)GetMonData(v1, MON_DATA_165, NULL); - v0->unk_B14[2] = (u16)GetMonData(v1, MON_DATA_166, NULL); - v0->unk_B14[3] = (u16)GetMonData(v1, MON_DATA_168, NULL); - v0->unk_B14[4] = (u16)GetMonData(v1, MON_DATA_169, NULL); - v0->unk_B14[5] = (u16)GetMonData(v1, MON_DATA_167, NULL); + v0->unk_B14[0] = (u16)GetMonData(v1, MON_DATA_MAX_HP, NULL); + v0->unk_B14[1] = (u16)GetMonData(v1, MON_DATA_ATK, NULL); + v0->unk_B14[2] = (u16)GetMonData(v1, MON_DATA_DEF, NULL); + v0->unk_B14[3] = (u16)GetMonData(v1, MON_DATA_SP_ATK, NULL); + v0->unk_B14[4] = (u16)GetMonData(v1, MON_DATA_SP_DEF, NULL); + v0->unk_B14[5] = (u16)GetMonData(v1, MON_DATA_SPEED, NULL); sub_02096F14(v0->unk_5A4->unk_00, v0->unk_5A4->unk_24, v0->unk_B11, 0, sub_02086930(v0), 12); - v0->unk_704[v0->unk_B11].unk_0A = GetMonData(v1, MON_DATA_161, NULL); - v0->unk_704[v0->unk_B11].unk_06 = GetMonData(v1, MON_DATA_163, NULL); - v0->unk_704[v0->unk_B11].unk_08 = GetMonData(v1, MON_DATA_164, NULL); + v0->unk_704[v0->unk_B11].unk_0A = GetMonData(v1, MON_DATA_LEVEL, NULL); + v0->unk_704[v0->unk_B11].unk_06 = GetMonData(v1, MON_DATA_CURRENT_HP, NULL); + v0->unk_704[v0->unk_B11].unk_08 = GetMonData(v1, MON_DATA_MAX_HP, NULL); v2 = MessageLoader_GetNewStrbuf(v0->unk_69C, 193); - sub_0200B5CC(v0->unk_6A0, 0, sub_02076B10(v1)); + sub_0200B5CC(v0->unk_6A0, 0, GetBoxMon(v1)); sub_0200B60C(v0->unk_6A0, 1, v0->unk_704[v0->unk_B11].unk_0A, 3, 0, 1); sub_0200C388(v0->unk_6A0, v0->unk_6A4, v2); Strbuf_Free(v2); @@ -750,7 +750,7 @@ static int sub_02085C50 (void * param0) v0->unk_B13 = 6; break; case 0xffff: - sub_0200B5CC(v0->unk_6A0, 0, sub_02076B10(v1)); + sub_0200B5CC(v0->unk_6A0, 0, GetBoxMon(v1)); sub_0200B630(v0->unk_6A0, 1, v0->unk_5A4->unk_26); v2 = MessageLoader_GetNewStrbuf(v0->unk_69C, 52); @@ -767,7 +767,7 @@ static int sub_02085C50 (void * param0) case 0xfffe: break; default: - sub_0200B5CC(v0->unk_6A0, 0, sub_02076B10(v1)); + sub_0200B5CC(v0->unk_6A0, 0, GetBoxMon(v1)); sub_0200B630(v0->unk_6A0, 1, v0->unk_5A4->unk_26); v2 = MessageLoader_GetNewStrbuf(v0->unk_69C, 194); @@ -833,7 +833,7 @@ int sub_02085EF4 (UnkStruct_0207F248 * param0) param0->unk_B13 = 3; v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); if (param0->unk_5A4->unk_28 == 4) { sub_0200B630(param0->unk_6A0, 1, param0->unk_5A4->unk_26); @@ -963,7 +963,7 @@ int sub_0208615C (UnkStruct_0207F248 * param0) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); v2 = sub_02086104(param0, v0); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); sub_0200B630(param0->unk_6A0, 1, param0->unk_5A4->unk_26); switch (v2) { @@ -1017,7 +1017,7 @@ int sub_020862F8 (UnkStruct_0207F248 * param0) Strbuf* v1; v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - sub_0200B5CC(param0->unk_6A0, 0, sub_02076B10(v0)); + sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); if (param0->unk_5A4->unk_28 == 4) { sub_0200B630(param0->unk_6A0, 1, param0->unk_5A4->unk_26); @@ -1137,13 +1137,13 @@ static void sub_02086590 (UnkStruct_0207F248 * param0, Pokemon * param1, u32 par u32 v0; v0 = param0->unk_5A4->unk_26; - sub_02074B30(param1, 54 + param2, &v0); + SetMonData(param1, 54 + param2, &v0); v0 = 0; - sub_02074B30(param1, 62 + param2, &v0); + SetMonData(param1, 62 + param2, &v0); v0 = MoveTable_CalcMaxPP(param0->unk_5A4->unk_26, 0); - sub_02074B30(param1, 58 + param2, &v0); + SetMonData(param1, 58 + param2, &v0); if (param0->unk_5A4->unk_24 != 0) { if (Item_IsHMMove(param0->unk_5A4->unk_26) == 0) { diff --git a/src/unk_0208694C.c b/src/unk_0208694C.c index d5aed3b635..f087ee19ea 100644 --- a/src/unk_0208694C.c +++ b/src/unk_0208694C.c @@ -63,7 +63,7 @@ #include "unk_020218BC.h" #include "strbuf.h" #include "unk_020279FC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020797C8.h" #include "unk_02079D40.h" #include "unk_0208694C.h" @@ -1421,7 +1421,7 @@ static void sub_0208737C (UnkStruct_02087A10 * param0, UnkStruct_020067E8 * para v1 = AllocMonZeroed(18); sub_02073D80(v1, param0->unk_04, 5, 10, 10, 10, 10, 10); - sub_0200B538(param0->unk_168, 0, sub_02076B10(v1)); + sub_0200B538(param0->unk_168, 0, GetBoxMon(v1)); Heap_FreeToHeap(v1); } @@ -1488,7 +1488,7 @@ static void sub_02087544 (UnkStruct_02087A10 * param0, UnkStruct_020067E8 * para Pokemon * v4 = AllocMonZeroed(18); sub_02073D80(v4, param0->unk_04, 1, 0, 0, 0, 0, 0); - sub_0200B538(param0->unk_168, 0, sub_02076B10(v4)); + sub_0200B538(param0->unk_168, 0, GetBoxMon(v4)); Heap_FreeToHeap(v4); } else { param0->unk_D8[param0->unk_158] = 0xffff; diff --git a/src/unk_0208C324.c b/src/unk_0208C324.c index 261869dc7c..77687ba0b9 100644 --- a/src/unk_0208C324.c +++ b/src/unk_0208C324.c @@ -49,7 +49,7 @@ #include "unk_020393C8.h" #include "unk_020507CC.h" #include "unk_0206A8DC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "party.h" #include "item.h" @@ -1026,11 +1026,11 @@ static void sub_0208D200 (UnkStruct_0208D7BC * param0, Pokemon * param1, UnkStru u8 v2; BOOL v3; - v3 = sub_02073C88(param1); + v3 = DecryptMon(param1); param2->unk_0C = (u16)GetMonData(param1, MON_DATA_SPECIES, NULL); - v0 = sub_02076B10(param1); + v0 = GetBoxMon(param1); MessageLoader_GetStrbuf(param0->unk_688, 11, param0->unk_694); sub_0200B538(param0->unk_690, 0, v0); @@ -1045,7 +1045,7 @@ static void sub_0208D200 (UnkStruct_0208D7BC * param0, Pokemon * param1, UnkStru sub_0200C388(param0->unk_690, param0->unk_250.unk_08, param0->unk_694); param2->unk_0E = (u16)GetMonData(param1, MON_DATA_HELD_ITEM, NULL); - param2->unk_12_0 = (u8)GetMonData(param1, MON_DATA_161, NULL); + param2->unk_12_0 = (u8)GetMonData(param1, MON_DATA_LEVEL, NULL); param2->unk_50_28 = GetMonData(param1, MON_DATA_IS_EGG, NULL); if ((GetMonData(param1, MON_DATA_176, NULL) == 1) && (param2->unk_50_28 == 0)) { @@ -1054,35 +1054,35 @@ static void sub_0208D200 (UnkStruct_0208D7BC * param0, Pokemon * param1, UnkStru param2->unk_12_7 = 1; } - param2->unk_13_0 = sub_02075D6C(param1); + param2->unk_13_0 = GetMonGender(param1); param2->unk_13_2 = (u8)GetMonData(param1, MON_DATA_POKEBALL, NULL); param2->unk_10 = (u8)GetMonData(param1, MON_DATA_177, NULL); param2->unk_11 = (u8)GetMonData(param1, MON_DATA_178, NULL); param2->unk_14 = GetMonData(param1, MON_DATA_OT_ID, NULL); param2->unk_18 = GetMonData(param1, MON_DATA_EXP, NULL); param2->unk_44 = (u8)GetMonData(param1, MON_DATA_OT_GENDER, NULL); - param2->unk_1C = sub_02075AD0(param2->unk_0C, param2->unk_12_0); + param2->unk_1C = GetMonSpeciesLevelExp(param2->unk_0C, param2->unk_12_0); if (param2->unk_12_0 == 100) { param2->unk_20 = param2->unk_1C; } else { - param2->unk_20 = sub_02075AD0(param2->unk_0C, param2->unk_12_0 + 1); + param2->unk_20 = GetMonSpeciesLevelExp(param2->unk_0C, param2->unk_12_0 + 1); } - param2->unk_24 = (u16)GetMonData(param1, MON_DATA_163, NULL); - param2->unk_26 = (u16)GetMonData(param1, MON_DATA_164, NULL); - param2->unk_28 = (u16)GetMonData(param1, MON_DATA_165, NULL); - param2->unk_2A = (u16)GetMonData(param1, MON_DATA_166, NULL); - param2->unk_2C = (u16)GetMonData(param1, MON_DATA_168, NULL); - param2->unk_2E = (u16)GetMonData(param1, MON_DATA_169, NULL); - param2->unk_30 = (u16)GetMonData(param1, MON_DATA_167, NULL); - param2->unk_32 = (u8)GetMonData(param1, MON_DATA_10, NULL); - param2->unk_33 = sub_02075BCC(param1); + param2->unk_24 = (u16)GetMonData(param1, MON_DATA_CURRENT_HP, NULL); + param2->unk_26 = (u16)GetMonData(param1, MON_DATA_MAX_HP, NULL); + param2->unk_28 = (u16)GetMonData(param1, MON_DATA_ATK, NULL); + param2->unk_2A = (u16)GetMonData(param1, MON_DATA_DEF, NULL); + param2->unk_2C = (u16)GetMonData(param1, MON_DATA_SP_ATK, NULL); + param2->unk_2E = (u16)GetMonData(param1, MON_DATA_SP_DEF, NULL); + param2->unk_30 = (u16)GetMonData(param1, MON_DATA_SPEED, NULL); + param2->unk_32 = (u8)GetMonData(param1, MON_DATA_ABILITY, NULL); + param2->unk_33 = GetMonNature(param1); for (v1 = 0; v1 < 4; v1++) { param2->unk_34[v1] = (u16)GetMonData(param1, MON_DATA_MOVE1 + v1, NULL); - param2->unk_3C[v1] = (u8)GetMonData(param1, MON_DATA_58 + v1, NULL); - v2 = (u8)GetMonData(param1, MON_DATA_62 + v1, NULL); + param2->unk_3C[v1] = (u8)GetMonData(param1, MON_DATA_MOVE1_PP + v1, NULL); + v2 = (u8)GetMonData(param1, MON_DATA_MOVE1_PP_UPS + v1, NULL); param2->unk_40[v1] = MoveTable_CalcMaxPP(param2->unk_34[v1], v2); } @@ -1117,7 +1117,7 @@ static void sub_0208D200 (UnkStruct_0208D7BC * param0, Pokemon * param1, UnkStru param2->unk_50_30 = 0; } - if (sub_02075E0C(param1) == 1) { + if (GetMonShininess(param1) == 1) { param2->unk_50_29 = 1; } else { param2->unk_50_29 = 0; @@ -1136,7 +1136,7 @@ static void sub_0208D200 (UnkStruct_0208D7BC * param0, Pokemon * param1, UnkStru } } - sub_02073CD4(param1, v3); + EncryptMon(param1, v3); } static void sub_0208D618 (UnkStruct_0208D7BC * param0) @@ -1525,7 +1525,7 @@ static s8 sub_0208DC1C (UnkStruct_0208D7BC * param0, s8 param1) return -1; } - v0 = (Pokemon *)((u32)param0->unk_24C->unk_00 + sub_02076AF0() * v1); + v0 = (Pokemon *)((u32)param0->unk_24C->unk_00 + GetPokemonStructSize() * v1); if (GetMonData(v0, MON_DATA_SPECIES, NULL) != 0) { if (GetMonData(v0, MON_DATA_IS_EGG, NULL) != 0) { @@ -1586,10 +1586,10 @@ static s8 sub_0208DCE0 (UnkStruct_0208D7BC * param0, s8 param1) return -1; } - v0 = (BoxPokemon *)((u32)param0->unk_24C->unk_00 + sub_02076AF4() * v1); + v0 = (BoxPokemon *)((u32)param0->unk_24C->unk_00 + GetBoxPokemonStructSize() * v1); - if (sub_02074570(v0, MON_DATA_SPECIES, NULL) != 0) { - if (sub_02074570(v0, MON_DATA_IS_EGG, NULL) != 0) { + if (GetBoxMonData(v0, MON_DATA_SPECIES, NULL) != 0) { + if (GetBoxMonData(v0, MON_DATA_IS_EGG, NULL) != 0) { if (sub_0208DBF4(param0) == 1) { break; } @@ -1606,11 +1606,11 @@ void * sub_0208DD48 (UnkStruct_0208D7BC * param0) { switch (param0->unk_24C->unk_11) { case 0: - return (void *)((u32)param0->unk_24C->unk_00 + (sub_02076AF0() * param0->unk_24C->unk_14)); + return (void *)((u32)param0->unk_24C->unk_00 + (GetPokemonStructSize() * param0->unk_24C->unk_14)); case 1: return (void *)Party_GetPokemonBySlotIndex(param0->unk_24C->unk_00, param0->unk_24C->unk_14); case 2: - return (void *)((u32)param0->unk_24C->unk_00 + (sub_02076AF4() * param0->unk_24C->unk_14)); + return (void *)((u32)param0->unk_24C->unk_00 + (GetBoxPokemonStructSize() * param0->unk_24C->unk_14)); } return NULL; @@ -1793,9 +1793,9 @@ static void sub_0208E0DC (UnkStruct_0208D7BC * param0) v0 = sub_0208DD48(param0); if (param0->unk_24C->unk_11 == 2) { - sub_0207734C(v0, param0->unk_6A5_0, param0->unk_6A5_4); + SwapBoxMonMoves(v0, param0->unk_6A5_0, param0->unk_6A5_4); } else { - sub_02077344(v0, param0->unk_6A5_0, param0->unk_6A5_4); + SwapMonMoves(v0, param0->unk_6A5_0, param0->unk_6A5_4); } v1 = param0->unk_250.unk_34[param0->unk_6A5_0]; @@ -2220,7 +2220,7 @@ u32 sub_0208E9F0 (Pokemon * param0) { u32 v0 = GetMonData(param0, MON_DATA_160, NULL); - if (GetMonData(param0, MON_DATA_163, NULL) == 0) { + if (GetMonData(param0, MON_DATA_CURRENT_HP, NULL) == 0) { return 6; } else if ((v0 & (0x8 | 0x80)) != 0) { return 4; diff --git a/src/unk_0208EA44.c b/src/unk_0208EA44.c index e1b05185e5..8ce392b348 100644 --- a/src/unk_0208EA44.c +++ b/src/unk_0208EA44.c @@ -15,7 +15,7 @@ #include "unk_0201DBEC.h" #include "gx_layers.h" #include "unk_020218BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "unk_02079D40.h" #include "unk_0207C908.h" @@ -672,7 +672,7 @@ void sub_0208F71C (UnkStruct_0208D7BC * param0) sub_0200D948(param0->unk_414, param0->unk_418, 19, v1, 0, 11); sub_0200D414(param0->unk_41C[19], sub_02079EDC(param0->unk_250.unk_0C, param0->unk_250.unk_4E, param0->unk_250.unk_50_28) + 7); - sub_02021D0C(param0->unk_41C[19], (sub_020759CC(param0->unk_250.unk_0C, param0->unk_250.unk_4E, 28) ^ 1)); + sub_02021D0C(param0->unk_41C[19], (GetMonFormPersonalDataAttribute(param0->unk_250.unk_0C, param0->unk_250.unk_4E, 28) ^ 1)); } void sub_0208F7A4 (UnkStruct_0208D7BC * param0) diff --git a/src/unk_0208FCF8.c b/src/unk_0208FCF8.c index eee31008ac..9c352e6cba 100644 --- a/src/unk_0208FCF8.c +++ b/src/unk_0208FCF8.c @@ -17,7 +17,7 @@ #include "unk_02018340.h" #include "unk_0201D670.h" #include "strbuf.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "unk_0207A274.h" #include "unk_0208C324.h" diff --git a/src/unk_020916B4.c b/src/unk_020916B4.c index b624e637f6..193f620074 100644 --- a/src/unk_020916B4.c +++ b/src/unk_020916B4.c @@ -11,7 +11,7 @@ #include "gx_layers.h" #include "unk_02020020.h" #include "unk_0202419C.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0208C324.h" #include "unk_0208EA44.h" #include "unk_020916B4.h" @@ -349,7 +349,7 @@ void sub_02091F8C (UnkStruct_0208D7BC * param0) sub_020789BC(param0->unk_6A0, param0->unk_2B4.unk_08, param0->unk_250.unk_0C, 1); - param0->unk_2B4.unk_38 = sub_020759CC(param0->unk_250.unk_0C, param0->unk_250.unk_4E, 28) ^ 1; + param0->unk_2B4.unk_38 = GetMonFormPersonalDataAttribute(param0->unk_250.unk_0C, param0->unk_250.unk_4E, 28) ^ 1; param0->unk_2B4.unk_34 = sub_02007C34(param0->unk_2B4.unk_04, &v0, 52, 104, 0, 0, param0->unk_2B4.unk_08, NULL); sub_02007DEC(param0->unk_2B4.unk_34, 35, param0->unk_2B4.unk_38); diff --git a/src/unk_02092494.c b/src/unk_02092494.c index 980621fae6..29c0dbc198 100644 --- a/src/unk_02092494.c +++ b/src/unk_02092494.c @@ -15,7 +15,7 @@ #include "heap.h" #include "strbuf.h" #include "unk_02025E68.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_02092494.h" static int sub_02092E8C(Pokemon * param0, BOOL param1, int param2); @@ -320,7 +320,7 @@ void sub_0209282C (UnkStruct_02090800 * param0) static void sub_02092878 (UnkStruct_02090800 * param0) { - int v0 = sub_02075BCC(param0->unk_0C); + int v0 = GetMonNature(param0->unk_0C); if (v0 > 24) { return; @@ -734,7 +734,7 @@ void sub_0209305C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, param3 = (sub_02017070(2, 2)); } - if (sub_02074570(param0, MON_DATA_IS_EGG, NULL) == 0) { + if (GetBoxMonData(param0, MON_DATA_IS_EGG, NULL) == 0) { sub_02093368(param0, 0); sub_020932F0(param0, param3, 1); sub_020933C8(param0); @@ -746,7 +746,7 @@ void sub_0209305C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, sub_020932A4(param0, param1, param4); break; case 1: - if (sub_02074570(param0, MON_DATA_IS_EGG, NULL) == 0) { + if (GetBoxMonData(param0, MON_DATA_IS_EGG, NULL) == 0) { sub_02093368(param0, 0); sub_020932F0(param0, (sub_02017070(1, 1)), 1); sub_020933C8(param0); @@ -767,7 +767,7 @@ void sub_0209305C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, break; case 4: if (sub_0207884C(param0, param1, param4) == 1) { - if (sub_02074570(param0, MON_DATA_IS_EGG, NULL) == 0) { + if (GetBoxMonData(param0, MON_DATA_IS_EGG, NULL) == 0) { sub_02093368(param0, 0); sub_020932F0(param0, param3, 1); sub_020933C8(param0); @@ -776,7 +776,7 @@ void sub_0209305C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, sub_02093368(param0, 1); } } else { - if (sub_02074570(param0, MON_DATA_IS_EGG, NULL) == 0) { + if (GetBoxMonData(param0, MON_DATA_IS_EGG, NULL) == 0) { sub_02093368(param0, 0); sub_020932F0(param0, param3, 1); sub_020933C8(param0); @@ -789,7 +789,7 @@ void sub_0209305C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, sub_020933E8(param0); break; case 5: - if (sub_02074570(param0, MON_DATA_IS_EGG, NULL) == 0) { + if (GetBoxMonData(param0, MON_DATA_IS_EGG, NULL) == 0) { (void)0; } else { sub_020932F0(param0, (sub_02017070(1, 2)), 1); @@ -804,16 +804,16 @@ void sub_0209305C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, { int v0; - v0 = sub_02074570(param0, MON_DATA_153, NULL); + v0 = GetBoxMonData(param0, MON_DATA_153, NULL); SetBoxMonData(param0, 152, &v0); - v0 = sub_02074570(param0, MON_DATA_149, NULL); + v0 = GetBoxMonData(param0, MON_DATA_149, NULL); SetBoxMonData(param0, 146, &v0); - v0 = sub_02074570(param0, MON_DATA_150, NULL); + v0 = GetBoxMonData(param0, MON_DATA_150, NULL); SetBoxMonData(param0, 147, &v0); - v0 = sub_02074570(param0, MON_DATA_151, NULL); + v0 = GetBoxMonData(param0, MON_DATA_151, NULL); SetBoxMonData(param0, 148, &v0); } } @@ -874,7 +874,7 @@ static void sub_02093368 (BoxPokemon * param0, int param1) static void sub_020933C8 (BoxPokemon * param0) { - int v0 = sub_02074570(param0, MON_DATA_161, NULL); + int v0 = GetBoxMonData(param0, MON_DATA_LEVEL, NULL); SetBoxMonData(param0, 156, &v0); } diff --git a/src/unk_020933F8.c b/src/unk_020933F8.c index 4e630a1285..2eb0ca0096 100644 --- a/src/unk_020933F8.c +++ b/src/unk_020933F8.c @@ -56,7 +56,7 @@ #include "unk_02055808.h" #include "unk_0206A8DC.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_020923C0.h" #include "unk_020933F8.h" @@ -1149,7 +1149,7 @@ void sub_02094680 (UnkStruct_02095C48 * param0, int param1, UnkStruct_0200B358 * int v1; v1 = sub_02095904(param1); - v0 = sub_02076B10(param0->unk_00.unk_00[v1]); + v0 = GetBoxMon(param0->unk_00.unk_00[v1]); sub_0200B5CC(param2, param3, v0); } @@ -1622,7 +1622,7 @@ void sub_02094C44 (UnkStruct_02095C48 * param0, UnkStruct_021C0794 * param1, u32 v0 = 1; } - sub_02074B30(param0->unk_1974, v2, &v3); + SetMonData(param0->unk_1974, v2, &v3); sub_0206DDB8(param0->unk_1970, param0->unk_1974, v2); } diff --git a/src/unk_02094EDC.c b/src/unk_02094EDC.c index 188bd5e61a..00d6728184 100644 --- a/src/unk_02094EDC.c +++ b/src/unk_02094EDC.c @@ -23,7 +23,7 @@ #include "unk_0201D15C.h" #include "strbuf.h" #include "unk_020298BC.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020933F8.h" #include "unk_02094EDC.h" @@ -626,7 +626,7 @@ void sub_02095380 (const UnkStruct_ov6_02248BE8 * param0, Pokemon * param1, int for (v0 = 0; v0 < 4; v0++) { v1 = param0->unk_0C[v0]; - sub_02074B30(param1, 54 + v0, &v1); + SetMonData(param1, 54 + v0, &v1); } { @@ -637,8 +637,8 @@ void sub_02095380 (const UnkStruct_ov6_02248BE8 * param0, Pokemon * param1, int v3 = MessageLoader_GetNewStrbuf(v5, param0->unk_16); v4 = MessageLoader_GetNewStrbuf(v5, param0->unk_18); - sub_02074B30(param1, 119, v3); - sub_02074B30(param1, 145, v4); + SetMonData(param1, 119, v3); + SetMonData(param1, 145, v4); Strbuf_Free(v3); Strbuf_Free(v4); @@ -655,12 +655,12 @@ void sub_02095380 (const UnkStruct_ov6_02248BE8 * param0, Pokemon * param1, int v10 = param0->unk_1E; v11 = param0->unk_1F; - sub_02074B30(param1, 19, &v6); - sub_02074B30(param1, 20, &v7); - sub_02074B30(param1, 21, &v8); - sub_02074B30(param1, 22, &v9); - sub_02074B30(param1, 23, &v10); - sub_02074B30(param1, 24, &v11); + SetMonData(param1, 19, &v6); + SetMonData(param1, 20, &v7); + SetMonData(param1, 21, &v8); + SetMonData(param1, 22, &v9); + SetMonData(param1, 23, &v10); + SetMonData(param1, 24, &v11); } } diff --git a/src/unk_02096420.c b/src/unk_02096420.c index 07d795128f..bea6d18825 100644 --- a/src/unk_02096420.c +++ b/src/unk_02096420.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_party_decl.h" #include "heap.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "move_table.h" #include "party.h" #include "item.h" @@ -68,7 +68,7 @@ u8 sub_02096420 (Pokemon * param0, u16 param1, u16 param2, u32 param3) } } - v1[0] = GetMonData(param0, MON_DATA_163, NULL); + v1[0] = GetMonData(param0, MON_DATA_CURRENT_HP, NULL); if (((Item_Get(v0, 23) != 0) || (Item_Get(v0, 24) != 0)) && (Item_Get(v0, 25) == 0)) { if (v1[0] == 0) { @@ -76,14 +76,14 @@ u8 sub_02096420 (Pokemon * param0, u16 param1, u16 param2, u32 param3) return 1; } } else if (Item_Get(v0, 38) != 0) { - if ((v1[0] != 0) && (v1[0] < GetMonData(param0, MON_DATA_164, NULL))) { + if ((v1[0] != 0) && (v1[0] < GetMonData(param0, MON_DATA_MAX_HP, NULL))) { Heap_FreeToHeap(v0); return 1; } } if (Item_Get(v0, 25) != 0) { - if (GetMonData(param0, MON_DATA_161, NULL) < 100) { + if (GetMonData(param0, MON_DATA_LEVEL, NULL) < 100) { Heap_FreeToHeap(v0); return 1; } @@ -97,7 +97,7 @@ u8 sub_02096420 (Pokemon * param0, u16 param1, u16 param2, u32 param3) } if ((Item_Get(v0, 34) != 0) || (Item_Get(v0, 35) != 0)) { - if ((GetMonData(param0, MON_DATA_62 + param2, NULL) < 3) && (MoveTable_CalcMaxPP(GetMonData(param0, MON_DATA_MOVE1 + param2, NULL), 0) >= 5)) { + if ((GetMonData(param0, MON_DATA_MOVE1_PP_UPS + param2, NULL) < 3) && (MoveTable_CalcMaxPP(GetMonData(param0, MON_DATA_MOVE1 + param2, NULL), 0) >= 5)) { Heap_FreeToHeap(v0); return 1; } @@ -311,12 +311,12 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param } if (v1[0] != v1[1]) { - sub_02074B30(param0, 160, &v1[1]); + SetMonData(param0, 160, &v1[1]); v2 = 1; } - v1[0] = GetMonData(param0, MON_DATA_163, NULL); - v1[1] = GetMonData(param0, MON_DATA_164, NULL); + v1[0] = GetMonData(param0, MON_DATA_CURRENT_HP, NULL); + v1[1] = GetMonData(param0, MON_DATA_MAX_HP, NULL); if (((Item_Get(v0, 23) != 0) || (Item_Get(v0, 24) != 0)) && (Item_Get(v0, 25) != 0)) { if (v1[0] == 0) { @@ -334,15 +334,15 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param v3 = 1; } - v1[2] = GetMonData(param0, MON_DATA_161, NULL); + v1[2] = GetMonData(param0, MON_DATA_LEVEL, NULL); if (Item_Get(v0, 25) != 0) { if (v1[2] < 100) { - sub_0207536C(param0, MON_DATA_EXP, sub_02075A70(param0)); - sub_0207418C(param0); + IncreaseMonData(param0, MON_DATA_EXP, GetMonExpToNextLevel(param0)); + CalculateMonLevelAndStats(param0); if (v1[0] == 0) { - v1[3] = GetMonData(param0, MON_DATA_164, NULL); + v1[3] = GetMonData(param0, MON_DATA_MAX_HP, NULL); sub_020970AC(param0, v1[0], v1[3], v1[3] - v1[1]); } @@ -400,8 +400,8 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param if (v1[6] != -1) { v1[0] = v1[6]; - sub_02074B30(param0, 13, &v1[0]); - sub_0207418C(param0); + SetMonData(param0, 13, &v1[0]); + CalculateMonLevelAndStats(param0); v2 = 1; } @@ -417,8 +417,8 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param if (v1[6] != -1) { v1[1] = v1[6]; - sub_02074B30(param0, 14, &v1[1]); - sub_0207418C(param0); + SetMonData(param0, 14, &v1[1]); + CalculateMonLevelAndStats(param0); v2 = 1; } @@ -433,8 +433,8 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param if (v1[6] != -1) { v1[2] = v1[6]; - sub_02074B30(param0, 15, &v1[2]); - sub_0207418C(param0); + SetMonData(param0, 15, &v1[2]); + CalculateMonLevelAndStats(param0); v2 = 1; } @@ -449,8 +449,8 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param if (v1[6] != -1) { v1[3] = v1[6]; - sub_02074B30(param0, 16, &v1[3]); - sub_0207418C(param0); + SetMonData(param0, 16, &v1[3]); + CalculateMonLevelAndStats(param0); v2 = 1; } @@ -465,8 +465,8 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param if (v1[6] != -1) { v1[4] = v1[6]; - sub_02074B30(param0, 17, &v1[4]); - sub_0207418C(param0); + SetMonData(param0, 17, &v1[4]); + CalculateMonLevelAndStats(param0); v2 = 1; } @@ -481,8 +481,8 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param if (v1[6] != -1) { v1[5] = v1[6]; - sub_02074B30(param0, 18, &v1[5]); - sub_0207418C(param0); + SetMonData(param0, 18, &v1[5]); + CalculateMonLevelAndStats(param0); v2 = 1; } @@ -544,8 +544,8 @@ static u8 sub_02096F34 (Pokemon * param0, u32 param1) return 0; } - v1 = (u8)GetMonData(param0, MON_DATA_58 + param1, NULL); - v2 = (u8)GetMonData(param0, MON_DATA_62 + param1, NULL); + v1 = (u8)GetMonData(param0, MON_DATA_MOVE1_PP + param1, NULL); + v2 = (u8)GetMonData(param0, MON_DATA_MOVE1_PP_UPS + param1, NULL); if (v1 < MoveTable_CalcMaxPP(v0, v2)) { return 1; @@ -566,8 +566,8 @@ static u8 sub_02096F84 (Pokemon * param0, u32 param1, u32 param2) return 0; } - v1 = (u8)GetMonData(param0, MON_DATA_58 + param1, NULL); - v2 = (u8)MoveTable_CalcMaxPP(v0, GetMonData(param0, MON_DATA_62 + param1, NULL)); + v1 = (u8)GetMonData(param0, MON_DATA_MOVE1_PP + param1, NULL); + v2 = (u8)MoveTable_CalcMaxPP(v0, GetMonData(param0, MON_DATA_MOVE1_PP_UPS + param1, NULL)); if (v1 < v2) { if (param2 == 127) { @@ -580,7 +580,7 @@ static u8 sub_02096F84 (Pokemon * param0, u32 param1, u32 param2) } } - sub_02074B30(param0, 58 + param1, &v1); + SetMonData(param0, 58 + param1, &v1); return 1; } @@ -594,7 +594,7 @@ static u8 sub_02097004 (Pokemon * param0, u32 param1, u32 param2) u8 v2; u8 v3; - v2 = GetMonData(param0, MON_DATA_62 + param1, NULL); + v2 = GetMonData(param0, MON_DATA_MOVE1_PP_UPS + param1, NULL); if (v2 == 3) { return 0; @@ -606,7 +606,7 @@ static u8 sub_02097004 (Pokemon * param0, u32 param1, u32 param2) return 0; } - v1 = (u8)GetMonData(param0, MON_DATA_58 + param1, NULL); + v1 = (u8)GetMonData(param0, MON_DATA_MOVE1_PP + param1, NULL); v3 = (u8)MoveTable_CalcMaxPP(v0, v2); if (v2 + param2 > 3) { @@ -617,8 +617,8 @@ static u8 sub_02097004 (Pokemon * param0, u32 param1, u32 param2) v1 = v1 + MoveTable_CalcMaxPP(v0, v2) - v3; - sub_02074B30(param0, 62 + param1, &v2); - sub_02074B30(param0, 58 + param1, &v1); + SetMonData(param0, 62 + param1, &v2); + SetMonData(param0, 58 + param1, &v1); return 1; } @@ -641,7 +641,7 @@ static void sub_020970AC (Pokemon * param0, u32 param1, u32 param2, u32 param3) param1 += param3; } - sub_02074B30(param0, 163, ¶m1); + SetMonData(param0, 163, ¶m1); } static s32 sub_020970EC (s32 param0, s32 param1, s32 param2) @@ -747,7 +747,7 @@ static u8 sub_020971D0 (Pokemon * param0, s32 param1, s32 param2, u16 param3, u3 param2 = 0; } - sub_02074B30(param0, 9, ¶m2); + SetMonData(param0, 9, ¶m2); return 1; } @@ -766,11 +766,11 @@ void sub_02097284 (Party * param0) continue; } - v3 = GetMonData(v4, MON_DATA_164, NULL); - sub_02074B30(v4, 163, &v3); + v3 = GetMonData(v4, MON_DATA_MAX_HP, NULL); + SetMonData(v4, 163, &v3); v3 = 0; - sub_02074B30(v4, 160, &v3); + SetMonData(v4, 160, &v3); for (v1 = 0; v1 < 4; v1++) { if (sub_02096F34(v4, v1) == 1) { diff --git a/src/unk_02097624.c b/src/unk_02097624.c index 69e9707952..d91c3f1f8a 100644 --- a/src/unk_02097624.c +++ b/src/unk_02097624.c @@ -19,7 +19,7 @@ #include "unk_02025E08.h" #include "unk_02028124.h" #include "unk_0202CD50.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "item.h" #include "unk_0209747C.h" #include "overlay020/ov20_021D0D80.h" @@ -160,7 +160,7 @@ int sub_02097750 (UnkStruct_02097728 * param0, Pokemon * param1) return 0; } - sub_02074B30(param1, 170, param0->unk_14); + SetMonData(param1, 170, param0->unk_14); return 1; } @@ -190,8 +190,8 @@ int sub_02097788 (UnkStruct_02028430 * param0, Pokemon * param1, int param2) GetMonData(param1, MON_DATA_170, v2); sub_02028480(param0, 0, v0, v2); sub_02028124(v2); - sub_02074B30(param1, 170, v2); - sub_02074B30(param1, 6, &v1); + SetMonData(param1, 170, v2); + SetMonData(param1, 6, &v1); Heap_FreeToHeap(v2); return v0; @@ -210,8 +210,8 @@ int sub_020977E4 (UnkStruct_02028430 * param0, u16 param1, Pokemon * param2, int v0 = Item_ForMailNumber(sub_02028314(v1)); - sub_02074B30(param2, 170, v1); - sub_02074B30(param2, 6, &v0); + SetMonData(param2, 170, v1); + SetMonData(param2, 6, &v0); sub_02028470(param0, 0, param1); Heap_FreeToHeap(v1); diff --git a/src/unk_02097B18.c b/src/unk_02097B18.c index 93c5e9441e..7a5a607a62 100644 --- a/src/unk_02097B18.c +++ b/src/unk_02097B18.c @@ -42,7 +42,7 @@ #include "unk_020508D4.h" #include "unk_02055808.h" #include "unk_0206CCB0.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "unk_02097B18.h" @@ -398,8 +398,8 @@ static BOOL sub_02097F38 (UnkStruct_020508D4 * param0) if (v7->unk_22 != 7) { v8 = sub_02097F00(v0->unk_08, v7->unk_22); - sub_02074B30(v8, 162, (u8 *)&v13); - sub_02074B30(v8, 171, sub_0202CA28(v1->unk_20, v13 - 1)); + SetMonData(v8, 162, (u8 *)&v13); + SetMonData(v8, 171, sub_0202CA28(v1->unk_20, v13 - 1)); v9 = sub_0202CA28(v1->unk_20, v13 - 1); v10 = sub_0202CA64(v9, 0); diff --git a/src/unk_02098218.c b/src/unk_02098218.c index db5d884f0a..f7b14b7da3 100644 --- a/src/unk_02098218.c +++ b/src/unk_02098218.c @@ -37,7 +37,7 @@ #include "unk_0203CC84.h" #include "unk_020508D4.h" #include "unk_02055808.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_0208694C.h" #include "unk_02092494.h" #include "unk_02098218.h" @@ -224,9 +224,9 @@ static BOOL sub_0209843C (UnkStruct_020508D4 * param0) int v6 = 11; int v7 = 0; - sub_02074B30(v2, 76, &v7); + SetMonData(v2, 76, &v7); sub_0209304C(v2, v3, v4, v5, v6); - sub_02074B30(v2, 179, NULL); + SetMonData(v2, 179, NULL); } { @@ -248,7 +248,7 @@ static BOOL sub_0209843C (UnkStruct_020508D4 * param0) v9 = GetMonData(v0->unk_0C.unk_00, MON_DATA_SPECIES, 0); v0->unk_08 = sub_0208712C(11, 1, v9, 10, sub_02025E44(sub_0203D174(v8))); - v0->unk_08->unk_10 = GetMonData(v0->unk_0C.unk_00, MON_DATA_111, NULL); + v0->unk_08->unk_10 = GetMonData(v0->unk_0C.unk_00, MON_DATA_GENDER, NULL); v0->unk_08->unk_08 = GetMonData(v0->unk_0C.unk_00, MON_DATA_FORM, NULL); sub_02050A38(param0, &Unk_020F2DAC, v0->unk_08); v0->unk_00++; @@ -256,7 +256,7 @@ static BOOL sub_0209843C (UnkStruct_020508D4 * param0) break; case 4: if (v0->unk_08->unk_14 == 0) { - sub_02074B30(v0->unk_0C.unk_00, 120, v0->unk_08->unk_18); + SetMonData(v0->unk_0C.unk_00, 120, v0->unk_08->unk_18); { UnkStruct_0203CDB0 * v10 = sub_02050A60(param0); diff --git a/src/unk_020989DC.c b/src/unk_020989DC.c index adf61f523e..5dcdc24450 100644 --- a/src/unk_020989DC.c +++ b/src/unk_020989DC.c @@ -26,7 +26,7 @@ #include "unk_02025E08.h" #include "unk_020279FC.h" #include "poffin.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0207D3B8.h" #include "unk_0208C324.h" @@ -504,7 +504,7 @@ void sub_02098EF8 (Poffin * param0, Pokemon * param1) u8 v8[7]; u8 v9[7]; - v2 = sub_02075BCC(param1); + v2 = GetMonNature(param1); v4 = Unk_020F685C[v2][0]; v5 = Unk_020F685C[v2][1]; @@ -534,13 +534,13 @@ void sub_02098EF8 (Poffin * param0, Pokemon * param1) v7[v0] = 255; } - sub_02074B30(param1, 19 + v0, &v7[v0]); + SetMonData(param1, 19 + v0, &v7[v0]); } v3 = GetMonData(param1, MON_DATA_FRIENDSHIP, NULL); if (v3 < 255) { ++v3; - sub_02074B30(param1, 9, &v3); + SetMonData(param1, 9, &v3); } } diff --git a/src/unk_020997B8.c b/src/unk_020997B8.c index 5c420f9197..d1474b667f 100644 --- a/src/unk_020997B8.c +++ b/src/unk_020997B8.c @@ -6,7 +6,7 @@ #include "struct_defs/struct_020997B8.h" #include "heap.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "unk_020997B8.h" UnkStruct_020997B8 * sub_020997B8 (u32 param0) @@ -34,7 +34,7 @@ u16 * sub_020997D8 (Pokemon * param0, u32 param1) v3 = (u16)GetMonData(param0, MON_DATA_SPECIES, NULL); v5 = (u8)GetMonData(param0, MON_DATA_FORM, NULL); - v4 = (u8)GetMonData(param0, MON_DATA_161, NULL); + v4 = (u8)GetMonData(param0, MON_DATA_LEVEL, NULL); for (v7 = 0; v7 < 4; v7++) { v2[v7] = (u16)GetMonData(param0, MON_DATA_MOVE1 + v7, NULL); @@ -43,7 +43,7 @@ u16 * sub_020997D8 (Pokemon * param0, u32 param1) v0 = Heap_AllocFromHeap(param1, (44 / 2) * 2); v1 = Heap_AllocFromHeap(param1, (44 / 2) * 2); - sub_02077D28(v3, v5, v0); + LoadMonLevelUpMoves(v3, v5, v0); v8 = 0; diff --git a/src/unk_0209BA80.c b/src/unk_0209BA80.c index 7ad8a8b447..efd0062dd2 100644 --- a/src/unk_0209BA80.c +++ b/src/unk_0209BA80.c @@ -12,7 +12,7 @@ #include "unk_02032798.h" #include "unk_02034198.h" #include "unk_0205DFC4.h" -#include "unk_02073C2C.h" +#include "pokemon.h" #include "party.h" #include "unk_0209BA80.h" #include "overlay104/ov104_0222ECE8.h" From dccc1ff94cfd8b34016e8837a9f32ee25972e1c5 Mon Sep 17 00:00:00 2001 From: wildfire Date: Wed, 6 Sep 2023 20:22:35 +0100 Subject: [PATCH 03/11] Fix pointer-var style --- include/pokemon.h | 238 +++++++-------- include/unk_0201D15C.h | 4 +- src/pokemon.c | 662 ++++++++++++++++++++--------------------- src/unk_0201D15C.c | 10 +- 4 files changed, 457 insertions(+), 457 deletions(-) diff --git a/include/pokemon.h b/include/pokemon.h index 7ad6352573..7f36888595 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -26,14 +26,14 @@ * * @param mon */ -void ZeroMonData(Pokemon * mon); +void ZeroMonData(Pokemon *mon); /** * @brief Zeros out a BoxPokemon data structure, then encrypts the result * * @param boxMon */ -void ZeroBoxMonData(BoxPokemon * boxMon); +void ZeroBoxMonData(BoxPokemon *boxMon); /** * @brief Returns the size in bytes of a Pokemon struct as an int @@ -56,7 +56,7 @@ Pokemon * AllocMonZeroed(u32 heapID); * @param mon * @return Whether the pokemons data was decrypted by this call. Passed to EncryptMon() to decide whether to reencrypt the data or not */ -BOOL DecryptMon(Pokemon * mon); +BOOL DecryptMon(Pokemon *mon); /** * @brief Encrypts a Pokemon data structure. PartyPokemon data is encrypted using the pokemons personality value, BoxPokemon data using a checksum value @@ -65,7 +65,7 @@ BOOL DecryptMon(Pokemon * mon); * @param encrypt Whether to encrypt the data or not. If this is false, the function does nothing and returns false. * @return Whether the pokemons data was encrypted by this call. */ -BOOL EncryptMon(Pokemon * mon, BOOL encrypt); +BOOL EncryptMon(Pokemon *mon, BOOL encrypt); /** * @brief Decrypts a BoxPokemon data structure @@ -73,7 +73,7 @@ BOOL EncryptMon(Pokemon * mon, BOOL encrypt); * @param boxMon * @return Whether the pokemons data was decrypted by this call. Passed to EncryptBoxMon() to decide whether to reencrypt the data or not */ -BOOL DecryptBoxMon(BoxPokemon * boxMon); +BOOL DecryptBoxMon(BoxPokemon *boxMon); /** * @brief Encrypts a BoxPokemon data structure @@ -82,28 +82,28 @@ BOOL DecryptBoxMon(BoxPokemon * boxMon); * @param encrypt Whether to encrypt the data or not. If this is false, the function does nothing and returns false. * @return Whether the pokemons data was encrypted by this call. */ -BOOL EncryptBoxMon(BoxPokemon * boxMon, BOOL encrypt); +BOOL EncryptBoxMon(BoxPokemon *boxMon, BOOL encrypt); -void sub_02073D80(Pokemon * mon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); -void sub_02073E18(BoxPokemon * boxMon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); -void sub_02074044(Pokemon * mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monNature); -void sub_02074088(Pokemon * mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 param4, u8 param5, u8 param6); +void sub_02073D80(Pokemon *mon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); +void sub_02073E18(BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); +void sub_02074044(Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monNature); +void sub_02074088(Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 param4, u8 param5, u8 param6); u32 sub_02074128(u16 monSpecies, u8 param1, u8 param2); -void sub_02074158(Pokemon * mon, u16 monSpecies, u8 monLevel, u32 monCombinedIVs, u32 monPersonality); +void sub_02074158(Pokemon *mon, u16 monSpecies, u8 monLevel, u32 monCombinedIVs, u32 monPersonality); /** * @brief Calculates and stores the current level and stats for a given Pokemon based on its IVs, EVs etc. * * @param mon */ -void CalculateMonLevelAndStats(Pokemon * mon); +void CalculateMonLevelAndStats(Pokemon *mon); /** * @brief Calculates and stores the current stats for a given Pokemon based on its IVs, EVs etc. * * @param mon */ -void CalculateMonStats(Pokemon * mon); +void CalculateMonStats(Pokemon *mon); /** * @brief Gets a value from a Pokemon, storing it in dest if neccessary @@ -113,7 +113,7 @@ void CalculateMonStats(Pokemon * mon); * @param[out] dest Pointer for storing longer data * @return The requested value */ -u32 GetMonData(Pokemon * mon, int monDataAttribute, void * dest); +u32 GetMonData(Pokemon *mon, int monDataAttribute, void *dest); /** * @brief Gets a value from a Pokemon, storing it in dest if neccessary @@ -123,7 +123,7 @@ u32 GetMonData(Pokemon * mon, int monDataAttribute, void * dest); * @param[out] dest Pointer for storing longer data * @return The requested value */ -u32 GetBoxMonData(BoxPokemon * boxMon, int monDataAttribute, void * dest); +u32 GetBoxMonData(BoxPokemon *boxMon, int monDataAttribute, void *dest); /** * @brief Sets a value in a Pokemon, reading it from value if neccessary @@ -132,7 +132,7 @@ u32 GetBoxMonData(BoxPokemon * boxMon, int monDataAttribute, void * dest); * @param monDataAttribute * @param value */ -void SetMonData(Pokemon * mon, int monDataAttribute, const void * value); +void SetMonData(Pokemon *mon, int monDataAttribute, const void *value); /** * @brief Sets a value in a BoxPokemon, reading it from value if neccessary @@ -141,7 +141,7 @@ void SetMonData(Pokemon * mon, int monDataAttribute, const void * value); * @param monDataAttribute * @param value */ -void SetBoxMonData(BoxPokemon * boxMon, int monDataAttribute, const void * value); +void SetBoxMonData(BoxPokemon *boxMon, int monDataAttribute, const void *value); /** * @brief Increases some numerical fields in a Pokemon by the given value. Does nothing if the field is not supported @@ -152,7 +152,7 @@ void SetBoxMonData(BoxPokemon * boxMon, int monDataAttribute, const void * value * @param monDataAttribute * @param value */ -void IncreaseMonData(Pokemon * mon, int monDataAttribute, int value); +void IncreaseMonData(Pokemon *mon, int monDataAttribute, int value); /** * @brief Gets a PokemonPersonalData based on a pokemon species and form @@ -180,14 +180,14 @@ PokemonPersonalData * GetMonPersonalData(int monSpecies, int heapID); * @param monPersonalDataAttribute What value to get * @return The requested value */ -u32 GetMonPersonalDataAttribute(PokemonPersonalData * monPersonalData, int monPersonalDataAttribute); +u32 GetMonPersonalDataAttribute(PokemonPersonalData *monPersonalData, int monPersonalDataAttribute); /** * @brief Frees a PokemonPersonalData structure from the heap * * @param monPersonalData */ -void FreeMonPersonalData(PokemonPersonalData * monPersonalData); +void FreeMonPersonalData(PokemonPersonalData *monPersonalData); /** * @brief Loads a PokemonPersonalData based on its species and form and gets a value from it @@ -214,7 +214,7 @@ u32 GetMonSpeciesPersonalDataAttribute(int monSpecies, int monPersonalDataAttrib * @param mon * @return how much progress a Pokemon has made towards its next level as a percentage */ -u8 GetMonPercentToNextLevel(Pokemon * mon); +u8 GetMonPercentToNextLevel(Pokemon *mon); /** * @brief Gets how much experience is needed for the given Pokemon to level up @@ -222,7 +222,7 @@ u8 GetMonPercentToNextLevel(Pokemon * mon); * @param boxMon * @return The amount of exp. needed for the given Pokemon to level up */ -u32 GetMonExpToNextLevel(Pokemon * mon); +u32 GetMonExpToNextLevel(Pokemon *mon); /** * @brief Gets how much experience is needed for the given BoxPokemon to level up @@ -230,7 +230,7 @@ u32 GetMonExpToNextLevel(Pokemon * mon); * @param boxMon * @return The amount of exp. needed for the given BoxPokemon to level up */ -u32 GetBoxMonExpToNextLevel(BoxPokemon * boxMon); +u32 GetBoxMonExpToNextLevel(BoxPokemon *boxMon); /** * @brief Gets the amount of expeirence needed for the given Pokemon to reach its current level @@ -238,7 +238,7 @@ u32 GetBoxMonExpToNextLevel(BoxPokemon * boxMon); * @param mon * @return The amount of exp. needed for the given Pokemon to reach its current level */ -u32 GetMonCurrentLevelExp(Pokemon * mon); +u32 GetMonCurrentLevelExp(Pokemon *mon); /** * @brief Gets the amount of expeirence needed for a pokemon species to reach a specified level @@ -255,7 +255,7 @@ u32 GetMonSpeciesLevelExp(int monSpecies, int monLevel); * @param mon * @return The pokemons level */ -u32 GetMonLevel(Pokemon * mon); +u32 GetMonLevel(Pokemon *mon); /** * @copybrief GetMonSpeciesLevel() @@ -263,7 +263,7 @@ u32 GetMonLevel(Pokemon * mon); * @param boxMon * @return The pokemons level */ -u32 GetBoxMonLevel(BoxPokemon * boxMon); +u32 GetBoxMonLevel(BoxPokemon *boxMon); /** * @brief Gets the level of a pokemon based on its species and exp @@ -282,7 +282,7 @@ u32 GetMonSpeciesLevel(u16 monSpecies, u32 monExp); * @param monExp * @return The pokemons level */ -u32 GetMonPersonalDataLevel(PokemonPersonalData * monPersonalData, u16 unused_monSpecies, u32 monExp); +u32 GetMonPersonalDataLevel(PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monExp); /** * @brief Gets the nature of a Pokemon based on its personality value @@ -290,7 +290,7 @@ u32 GetMonPersonalDataLevel(PokemonPersonalData * monPersonalData, u16 unused_mo * @param mon * @return The pokemons nature */ -u8 GetMonNature(Pokemon * mon); +u8 GetMonNature(Pokemon *mon); /** * @brief Gets the nature of a BoxPokemon based on its personality value @@ -298,7 +298,7 @@ u8 GetMonNature(Pokemon * mon); * @param boxMon * @return The pokemons nature */ -u8 GetBoxMonNature(BoxPokemon * boxMon); +u8 GetBoxMonNature(BoxPokemon *boxMon); /** * @brief Gets the nature of a pokemon based on its personality value @@ -317,7 +317,7 @@ u8 GetNatureFromPersonality(u32 monPersonality); */ s8 GetNatureStatAffinity(u8 monNature, u8 statType); -void sub_02075C74(Pokemon * mon, u8 param1, u16 param2); +void sub_02075C74(Pokemon *mon, u8 param1, u16 param2); /** * @brief Gets the gender of a Pokemon based on its species and personality value @@ -325,7 +325,7 @@ void sub_02075C74(Pokemon * mon, u8 param1, u16 param2); * @param boxMon * @return The pokemons gender */ -u8 GetMonGender(Pokemon * mon); +u8 GetMonGender(Pokemon *mon); /** * @brief Gets the gender of a BoxPokemon based on its species and personality value @@ -333,7 +333,7 @@ u8 GetMonGender(Pokemon * mon); * @param boxMon * @return The pokemons gender */ -u8 GetBoxMonGender(BoxPokemon * boxMon); +u8 GetBoxMonGender(BoxPokemon *boxMon); /** * @brief Gets the gender of a pokemon based on its species and personality value @@ -352,7 +352,7 @@ u8 GetMonPersonalityGender(u16 monSpecies, u32 monPersonality); * @param monPersonality * @return The pokemons gender */ -u8 GetMonPersonalDataGender(PokemonPersonalData * monPersonalData, u16 unused_monSpecies, u32 monPersonality); +u8 GetMonPersonalDataGender(PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monPersonality); /** * @brief Gets whether a BoxPokemon is shiny based on its Original Trainer ID and its personality value @@ -360,7 +360,7 @@ u8 GetMonPersonalDataGender(PokemonPersonalData * monPersonalData, u16 unused_mo * @param mon * @return Whether the pokemon is shiny or not */ -u8 GetMonShininess(Pokemon * mon); +u8 GetMonShininess(Pokemon *mon); /** * @brief Gets whether a BoxPokemon is shiny based on its Original Trainer ID and its personality value @@ -368,7 +368,7 @@ u8 GetMonShininess(Pokemon * mon); * @param boxMon * @return Whether the pokemon is shiny or not */ -u8 GetBoxMonShininess(BoxPokemon * boxMon); +u8 GetBoxMonShininess(BoxPokemon *boxMon); /** * @brief Gets whether a pokemon is shiny based on its Original Trainer ID and its personality value @@ -380,10 +380,10 @@ u8 GetBoxMonShininess(BoxPokemon * boxMon); u8 GetMonPersonalityShininess(u32 monOTID, u32 monPersonality); u32 sub_02075E64(u32 param0); -void sub_02075EF4(UnkStruct_02008A90 * param0, Pokemon * mon, u8 param2); -void sub_02075F00(UnkStruct_02008A90 * param0, Pokemon * mon, u8 param2); -void sub_02075F0C(UnkStruct_02008A90 * param0, BoxPokemon * boxMon, u8 param2, int param3); -void sub_02075FB4(UnkStruct_02008A90 * param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); +void sub_02075EF4(UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2); +void sub_02075F00(UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2); +void sub_02075F0C(UnkStruct_02008A90 *param0, BoxPokemon *boxMon, u8 param2, int param3); +void sub_02075FB4(UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); /** * @brief Sanitizes a pokemon form. If the given form is greater than the max for the given species, returns zero, else returns the form unchanged @@ -394,13 +394,13 @@ void sub_02075FB4(UnkStruct_02008A90 * param0, u16 monSpecies, u8 monGender, u8 */ u8 SanitizeFormId(u16 monSpecies, u8 monForm); -u8 sub_020765AC(Pokemon * mon, u8 param1); -u8 sub_020765B8(Pokemon * mon, u8 param1); -u8 sub_020765C4(BoxPokemon * boxMon, u8 param1, int param2); +u8 sub_020765AC(Pokemon *mon, u8 param1); +u8 sub_020765B8(Pokemon *mon, u8 param1); +u8 sub_020765C4(BoxPokemon *boxMon, u8 param1, int param2); u8 sub_02076648(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality); -void sub_0207697C(UnkStruct_02008A90 * param0, u16 param1); -UnkStruct_0200D0F4 * sub_02076994(UnkStruct_0200C6E4 * param0, UnkStruct_0200C704 * param1, UnkStruct_02002F38 * param2, int param3, int param4, int param5, int param6, int param7, int heapID); -void sub_02076AAC(int param0, int param1, UnkStruct_ov5_021DE5D0 * param2); +void sub_0207697C(UnkStruct_02008A90 *param0, u16 param1); +UnkStruct_0200D0F4 * sub_02076994(UnkStruct_0200C6E4 *param0, UnkStruct_0200C704 *param1, UnkStruct_02002F38 *param2, int param3, int param4, int param5, int param6, int param7, int heapID); +void sub_02076AAC(int param0, int param1, UnkStruct_ov5_021DE5D0 *param2); /** * @brief Returns the size in bytes of a Pokemon struct as a u32 @@ -422,7 +422,7 @@ u32 GetBoxPokemonStructSize(void); * @param mon * @return The pokemons form */ -u8 GetMonForm(Pokemon * mon); +u8 GetMonForm(Pokemon *mon); /** * @brief Gets the form of a BoxPokemon @@ -430,7 +430,7 @@ u8 GetMonForm(Pokemon * mon); * @param boxMon * @return The pokemons form */ -u8 GetBoxMonForm(BoxPokemon * boxMon); +u8 GetBoxMonForm(BoxPokemon *boxMon); /** * @brief Gets the BoxPokemon data for a given Pokemon @@ -438,10 +438,10 @@ u8 GetBoxMonForm(BoxPokemon * boxMon); * @param mon * @return The BoxPokemon data for a given Pokemon */ -BoxPokemon * GetBoxMon(Pokemon * mon); +BoxPokemon * GetBoxMon(Pokemon *mon); -u8 sub_02076B14(Pokemon * mon); -u16 sub_02076B94(Party * party, Pokemon * mon, u8 evoTypeList, u16 evoParam, int * evoTypeResult); +u8 sub_02076B14(Pokemon *mon); +u16 sub_02076B94(Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int *evoTypeResult); u16 sub_02076F84(const u16 monSpecies); u16 sub_02076FD4(const u16 monSpecies); @@ -450,7 +450,7 @@ u16 sub_02076FD4(const u16 monSpecies); * * @param boxMon */ -void SetBoxMonDefaultMoves(BoxPokemon * boxMon); +void SetBoxMonDefaultMoves(BoxPokemon *boxMon); /** * @brief Adds a move to the moveset of a Pokemon @@ -459,7 +459,7 @@ void SetBoxMonDefaultMoves(BoxPokemon * boxMon); * @param moveID * @return The given moveID if successful, 0xfffe if already known, 0xffff if there is no room for the move */ -u16 AddMonMove(Pokemon * mon, u16 moveID); +u16 AddMonMove(Pokemon *mon, u16 moveID); /** * @brief Adds a move to the moveset of a BoxPokemon @@ -468,7 +468,7 @@ u16 AddMonMove(Pokemon * mon, u16 moveID); * @param moveID * @return u16 */ -u16 AddBoxMonMove(BoxPokemon * boxMon, u16 moveID); +u16 AddBoxMonMove(BoxPokemon *boxMon, u16 moveID); /** * @brief Deletes the first move of a Pokemon and adds the given move to the end of its moveset @@ -476,7 +476,7 @@ u16 AddBoxMonMove(BoxPokemon * boxMon, u16 moveID); * @param mon * @param moveID */ -void ReplaceMonMove(Pokemon * mon, u16 moveID); +void ReplaceMonMove(Pokemon *mon, u16 moveID); /** * @brief Deletes the first move of a BoxPokemon and adds the given move to the end of its moveset @@ -484,7 +484,7 @@ void ReplaceMonMove(Pokemon * mon, u16 moveID); * @param boxMon * @param moveID */ -void ReplaceBoxMonMove(BoxPokemon * boxMon, u16 moveID); +void ReplaceBoxMonMove(BoxPokemon *boxMon, u16 moveID); /** * @brief Sets the given moveSlot of a Pokemon, removing its PP Ups @@ -493,7 +493,7 @@ void ReplaceBoxMonMove(BoxPokemon * boxMon, u16 moveID); * @param moveID * @param moveSlot */ -void ResetMonMove(Pokemon * mon, u16 moveID, u8 moveSlot); +void ResetMonMove(Pokemon *mon, u16 moveID, u8 moveSlot); /** * @brief Sets the given moveSlot of a Pokemon, retaining the PP Ups for that slot @@ -502,7 +502,7 @@ void ResetMonMove(Pokemon * mon, u16 moveID, u8 moveSlot); * @param moveID * @param moveSlot */ -void SetMonMove(Pokemon * mon, u16 moveID, u8 moveSlot); +void SetMonMove(Pokemon *mon, u16 moveID, u8 moveSlot); /** * @brief Sets the given moveSlot of a BoxPokemon, retaining the PP Ups for that slot @@ -511,9 +511,9 @@ void SetMonMove(Pokemon * mon, u16 moveID, u8 moveSlot); * @param moveID * @param moveSlot */ -void SetBoxMonMove(BoxPokemon * boxMon, u16 moveID, u8 moveSlot); +void SetBoxMonMove(BoxPokemon *boxMon, u16 moveID, u8 moveSlot); -u16 sub_0207727C(Pokemon * mon, int * index, u16 * moveID); +u16 sub_0207727C(Pokemon *mon, int *index, u16 *moveID); /** * @brief Swaps the places of two moves on a Pokemon @@ -522,7 +522,7 @@ u16 sub_0207727C(Pokemon * mon, int * index, u16 * moveID); * @param moveSlot1 * @param moveSlot2 */ -void SwapMonMoves(Pokemon * mon, int moveSlot1, int moveSlot2); +void SwapMonMoves(Pokemon *mon, int moveSlot1, int moveSlot2); /** * @brief Swaps the places of two moves on a BoxPokemon @@ -531,7 +531,7 @@ void SwapMonMoves(Pokemon * mon, int moveSlot1, int moveSlot2); * @param moveSlot1 * @param moveSlot2 */ -void SwapBoxMonMoves(BoxPokemon * boxMon, int moveSlot1, int moveSlot2); +void SwapBoxMonMoves(BoxPokemon *boxMon, int moveSlot1, int moveSlot2); /** * @brief Deletes the given moveSlot of a Pokemon, shifting the ones above it down @@ -539,7 +539,7 @@ void SwapBoxMonMoves(BoxPokemon * boxMon, int moveSlot1, int moveSlot2); * @param mon * @param moveSlot */ -void DeleteMonMove(Pokemon * mon, u32 moveSlot); +void DeleteMonMove(Pokemon *mon, u32 moveSlot); /** * @brief Checks whether a Pokemon has a given move @@ -548,9 +548,9 @@ void DeleteMonMove(Pokemon * mon, u32 moveSlot); * @param moveID * @return Whether the given Pokemon has the given move */ -BOOL MonHasMove(Pokemon * mon, u16 moveID); +BOOL MonHasMove(Pokemon *mon, u16 moveID); -void sub_020774C8(BoxPokemon * boxMon, Pokemon * mon); +void sub_020774C8(BoxPokemon *boxMon, Pokemon *mon); /** * @brief Gets the level of the highest level pokemon in the Party @@ -558,15 +558,15 @@ void sub_020774C8(BoxPokemon * boxMon, Pokemon * mon); * @param party * @return The level of the highest level pokemon in the Party */ -u8 GetPartyHighestLevel(Party * party); +u8 GetPartyHighestLevel(Party *party); u16 sub_020775A4(u16 param0); u16 sub_020775C4(u16 param0); -void sub_020775EC(Pokemon * src, Pokemon * dest); -void sub_02077604(BoxPokemon * src, BoxPokemon * dest); -void sub_02077618(Pokemon * src, BoxPokemon * dest); -s8 sub_0207762C(Pokemon * mon, int param1); -s8 sub_02077634(BoxPokemon * boxMon, int param1); +void sub_020775EC(Pokemon *src, Pokemon *dest); +void sub_02077604(BoxPokemon *src, BoxPokemon *dest); +void sub_02077618(Pokemon *src, BoxPokemon *dest); +s8 sub_0207762C(Pokemon *mon, int param1); +s8 sub_02077634(BoxPokemon *boxMon, int param1); s8 sub_02077648(u32 monPersonality, int param1); /** @@ -577,30 +577,30 @@ s8 sub_02077648(u32 monPersonality, int param1); * @param[out] monLevelUpMoveIDs Pointer to a u16 array for storing the level up moves * @return int */ -int GetMonLevelUpMoveIDs(int monSpecies, int monForm, u16 * monLevelUpMoveIDs); +int GetMonLevelUpMoveIDs(int monSpecies, int monForm, u16 *monLevelUpMoveIDs); -void sub_020776B0(Party * party); -u8 sub_02077758(Party * party, u8 param1); -void sub_020777B4(Party * party, s32 param1); -void sub_0207782C(Party * party); -BOOL sub_020778D8(Pokemon * mon); -BOOL sub_020778E0(BoxPokemon * boxMon); -BOOL sub_020778F8(Pokemon * mon); -BOOL sub_02077900(BoxPokemon * boxMon); +void sub_020776B0(Party *party); +u8 sub_02077758(Party *party, u8 param1); +void sub_020777B4(Party *party, s32 param1); +void sub_0207782C(Party *party); +BOOL sub_020778D8(Pokemon *mon); +BOOL sub_020778E0(BoxPokemon *boxMon); +BOOL sub_020778F8(Pokemon *mon); +BOOL sub_02077900(BoxPokemon *boxMon); /** * @brief Sets Arceus' form based on its held item. Has no effect if the given Pokemon is not an Arceus * * @param mon */ -void SetArceusForm(Pokemon * mon); +void SetArceusForm(Pokemon *mon); /** * @brief Sets Arceus' form based on its held item. Has no effect if the given Pokemon is not an Arceus * * @param boxMon */ -void SetBoxArceusForm(BoxPokemon * boxMon); +void SetBoxArceusForm(BoxPokemon *boxMon); /** * @brief Get Arceus' form given an items hold effect @@ -616,7 +616,7 @@ u8 GetArceusItemType(u16 itemHoldEffect); * @param mon * @return The form Giratina was set to, or -1 if the given BoxPokemon was not a Giratina */ -int SetGiratinaForm(Pokemon * mon); +int SetGiratinaForm(Pokemon *mon); /** * @brief Sets Giratina's form based on its held item. Has no effect if the given BoxPokemon is not a Giratina @@ -624,14 +624,14 @@ int SetGiratinaForm(Pokemon * mon); * @param boxMon * @return The form Giratina was set to, or -1 if the given BoxPokemon was not a Giratina */ -int SetBoxGiratinaForm(BoxPokemon * boxMon); +int SetBoxGiratinaForm(BoxPokemon *boxMon); /** * @brief Set Giratina to its Origin form. Has no effect if the given Pokemon is not a Giratina * * @param mon */ -void SetGiratinaOriginForm(Pokemon * mon); +void SetGiratinaOriginForm(Pokemon *mon); /** * @brief Iterates over all the Pokemon in Party, setting the form of any Giratina. @@ -640,7 +640,7 @@ void SetGiratinaOriginForm(Pokemon * mon); * @param party * @param param1 */ -void SetPartyGiratinaForm(Party * party, int param1); +void SetPartyGiratinaForm(Party *party, int param1); /** * @brief Sets Shaymin to the given form. Has no effect if the given Pokemon is not a Shaymin @@ -648,7 +648,7 @@ void SetPartyGiratinaForm(Party * party, int param1); * @param mon * @param monForm */ -void SetShayminForm(Pokemon * mon, int monForm); +void SetShayminForm(Pokemon *mon, int monForm); /** * @brief Sets Shaymin to the given form. Has no effect if the given BoxPokemon is not a Shaymin @@ -656,7 +656,7 @@ void SetShayminForm(Pokemon * mon, int monForm); * @param boxMon * @param monForm */ -void SetBoxShayminForm(BoxPokemon * boxMon, int monForm); +void SetBoxShayminForm(BoxPokemon *boxMon, int monForm); /** * @brief Checks whether Shaymin is allowed to change into Sky Form. Always returns false if the given Pokemon is not a Shaymin @@ -664,14 +664,14 @@ void SetBoxShayminForm(BoxPokemon * boxMon, int monForm); * @param mon * @return Whether Shaymin is allowed to change into Sky Form */ -BOOL AllowShayminSkyForm(Pokemon * mon); +BOOL AllowShayminSkyForm(Pokemon *mon); /** * @brief Iterates over all the Pokemon in Party, setting the form of any Shaymin to land form. * * @param party */ -void SetShayminLandForm(Party * party); +void SetShayminLandForm(Party *party); /** * @brief Sets all Shaymin in the party to Land form at night @@ -683,7 +683,7 @@ void SetShayminLandForm(Party * party); * @param rtcTime * @return Whether Shaymin should be set to Land form */ -BOOL SetPartyShayminForm(Party * party, int param1, const RTCTime * rtcTime); +BOOL SetPartyShayminForm(Party *party, int param1, const RTCTime *rtcTime); /** * @brief Sets Rotom to the given form. Has no effect if the given Pokemon is not a Rotom @@ -694,7 +694,7 @@ BOOL SetPartyShayminForm(Party * party, int param1, const RTCTime * rtcTime); * @param moveSlot * @return Whether the given pokemon was a Rotom */ -BOOL SetRotomForm(Pokemon * mon, int monForm, int moveSlot); +BOOL SetRotomForm(Pokemon *mon, int monForm, int moveSlot); /** * @brief Loads a Level-Up move table based on a pokemon species and form into the pointed to array @@ -703,18 +703,18 @@ BOOL SetRotomForm(Pokemon * mon, int monForm, int moveSlot); * @param monForm * @param[out] monLevelUpMoves Pointer to a u16 array to store the move table */ -void LoadMonLevelUpMoves(int monSpecies, int monForm, u16 * monLevelUpMoves); - -void sub_02077D3C(UnkStruct_0202CC84 * param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7); -void sub_02077DB4(UnkStruct_0202CC84 * param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7, u8 param8); -BOOL sub_02077E3C(Pokemon * mon); -void sub_02077E64(Pokemon * mon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5); -void sub_02077EA4(BoxPokemon * boxMon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5); -void sub_02077EE4(Pokemon * mon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5); -void sub_02077EF8(BoxPokemon * boxMon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5); -void sub_02077F0C(Pokemon * mon, u32 param1, int param2); -BOOL sub_02077FB4(Pokemon * mon, u8 param1); -BOOL sub_02077FBC(BoxPokemon * boxMon, u8 param1); +void LoadMonLevelUpMoves(int monSpecies, int monForm, u16 *monLevelUpMoves); + +void sub_02077D3C(UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7); +void sub_02077DB4(UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7, u8 param8); +BOOL sub_02077E3C(Pokemon *mon); +void sub_02077E64(Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); +void sub_02077EA4(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); +void sub_02077EE4(Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); +void sub_02077EF8(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); +void sub_02077F0C(Pokemon *mon, u32 param1, int param2); +BOOL sub_02077FB4(Pokemon *mon, u8 param1); +BOOL sub_02077FBC(BoxPokemon *boxMon, u8 param1); BOOL sub_02077FE4(u16 monSpecies, int monForm, u8 tmID); /** @@ -722,16 +722,16 @@ BOOL sub_02077FE4(u16 monSpecies, int monForm, u8 tmID); * * @param mon */ -void CalculateMonAbility(Pokemon * mon); +void CalculateMonAbility(Pokemon *mon); /** * @brief Sets the ability of a BoxPokemon based on its species, form and peronsality value * * @param boxMon */ -void CalculateBoxMonAbility(BoxPokemon * boxMon); +void CalculateBoxMonAbility(BoxPokemon *boxMon); -void sub_020780C4(Pokemon * mon, u32 monPersonality); +void sub_020780C4(Pokemon *mon, u32 monPersonality); /** * @brief Gets a bitmask with a single bit set at the specified index. @@ -751,19 +751,19 @@ int GetLowestSetBitIndex(u32 num); BOOL sub_02078804(u16 param0); u16 sub_02078824(u8 index); -BOOL sub_02078838(Pokemon * mon); -BOOL sub_0207884C(BoxPokemon * boxMon, UnkStruct_02025E6C * param1, int heapID); +BOOL sub_02078838(Pokemon *mon); +BOOL sub_0207884C(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int heapID); int sub_020788D0(int param0); -void sub_0207893C(Pokemon * mon); -void sub_0207896C(BoxPokemon * boxMon); -void sub_020789BC(NARC * narc, UnkStruct_02007C10 * param1, u16 param2, u16 param3); -void sub_020789F4(NARC * narc, UnkStruct_02015F84 * param1, UnkStruct_02007C7C * param2, u16 param3, int param4, int param5, int param6); -void sub_02078A4C(NARC * narc, u8 * param1, u16 param2, u16 param3); -void sub_02078A80(NARC * narc, s8 * param1, u16 param2); -void sub_02078AA4(NARC * narc, s8 * param1, u16 param2); -void sub_02078AC8(NARC * narc, u8 * param1, u16 param2); -BOOL sub_02078AEC(int param0, Pokemon * mon, int heapID); -void sub_02078B40(Pokemon * mon, UnkStruct_02078B40 * param1); -void sub_02078E0C(UnkStruct_02078B40 * param0, Pokemon * mon); +void sub_0207893C(Pokemon *mon); +void sub_0207896C(BoxPokemon *boxMon); +void sub_020789BC(NARC *narc, UnkStruct_02007C10 *param1, u16 param2, u16 param3); +void sub_020789F4(NARC *narc, UnkStruct_02015F84 *param1, UnkStruct_02007C7C *param2, u16 param3, int param4, int param5, int param6); +void sub_02078A4C(NARC *narc, u8 *param1, u16 param2, u16 param3); +void sub_02078A80(NARC *narc, s8 *param1, u16 param2); +void sub_02078AA4(NARC *narc, s8 *param1, u16 param2); +void sub_02078AC8(NARC *narc, u8 *param1, u16 param2); +BOOL sub_02078AEC(int param0, Pokemon *mon, int heapID); +void sub_02078B40(Pokemon *mon, UnkStruct_02078B40 *param1); +void sub_02078E0C(UnkStruct_02078B40 *param0, Pokemon *mon); #endif // POKEPLATINUM_UNK_02073C2C_H diff --git a/include/unk_0201D15C.h b/include/unk_0201D15C.h index a380e2c3ca..fb22c6c177 100644 --- a/include/unk_0201D15C.h +++ b/include/unk_0201D15C.h @@ -22,8 +22,8 @@ void sub_0201D470(MtxFx22 * param0, u16 param1, fx32 param2, fx32 param3, u8 par s32 sub_0201D4CC(s32 param0, s32 param1, s32 param2, s32 param3, u32 param4); s32 sub_0201D580(u16 param0, s32 param1); u32 sub_0201D5B8(const void * param0, u32 param1); -void EncryptData(void * data, u32 bytes, u32 seed); -void DecryptData(void * data, u32 bytes, u32 seed); +void EncryptData(void *data, u32 bytes, u32 seed); +void DecryptData(void *data, u32 bytes, u32 seed); u16 sub_0201D628(const void * param0, u32 param1); void sub_0201D640(int param0); diff --git a/src/pokemon.c b/src/pokemon.c index e79a7483a6..75c1e60760 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -115,150 +115,150 @@ static const s8 Unk_020F0695[][5] = { { 0x0, 0x0, 0x0, 0x0, 0x0 }, }; -void ZeroMonData(Pokemon * mon); -void ZeroBoxMonData(BoxPokemon * boxMon); +void ZeroMonData(Pokemon *mon); +void ZeroBoxMonData(BoxPokemon *boxMon); int PokemonStructSize(void); Pokemon * AllocMonZeroed(u32 heapID); -BOOL DecryptMon(Pokemon * mon); -BOOL EncryptMon(Pokemon * mon, BOOL encrypt); -BOOL DecryptBoxMon(BoxPokemon * boxMon); -BOOL EncryptBoxMon(BoxPokemon * boxMon, BOOL encrypt); -void sub_02073D80(Pokemon * mon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); -void sub_02073E18(BoxPokemon * boxMon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); -void sub_02074044(Pokemon * mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monNature); -void sub_02074088(Pokemon * mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 param4, u8 param5, u8 param6); +BOOL DecryptMon(Pokemon *mon); +BOOL EncryptMon(Pokemon *mon, BOOL encrypt); +BOOL DecryptBoxMon(BoxPokemon *boxMon); +BOOL EncryptBoxMon(BoxPokemon *boxMon, BOOL encrypt); +void sub_02073D80(Pokemon *mon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); +void sub_02073E18(BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); +void sub_02074044(Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monNature); +void sub_02074088(Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 param4, u8 param5, u8 param6); u32 sub_02074128(u16 monSpecies, u8 param1, u8 param2); -void sub_02074158(Pokemon * mon, u16 monSpecies, u8 monLevel, u32 monCombinedIVs, u32 monPersonality); -void CalculateMonLevelAndStats(Pokemon * mon); -void CalculateMonStats(Pokemon * mon); -u32 GetMonData(Pokemon * mon, int monDataAttribute, void * dest); -static u32 GetMonDataAttribute(Pokemon * mon, int monDataAttribute, void * dest); -u32 GetBoxMonData(BoxPokemon * boxMon, int monDataAttribute, void * dest); -static u32 GetBoxMonDataAttribute(BoxPokemon * boxMon, int monDataAttribute, void * dest); -void SetMonData(Pokemon * mon, int monDataAttribute, const void * value); -static void SetMonDataAttribute(Pokemon * mon, int monDataAttribute, const void * value); -void SetBoxMonData(BoxPokemon * boxMon, int monDataAttribute, const void * value); -static void SetBoxMonDataAttribute(BoxPokemon * boxMon, int monDataAttribute, const void * value); -void IncreaseMonData(Pokemon * mon, int monDataAttribute, int value); -static void IncreaseMonDataAttribute(Pokemon * mon, int monDataAttribute, int value); -static void IncreaseBoxMonDataAttribute(BoxPokemon * boxMon, int monDataAttribute, int value); +void sub_02074158(Pokemon *mon, u16 monSpecies, u8 monLevel, u32 monCombinedIVs, u32 monPersonality); +void CalculateMonLevelAndStats(Pokemon *mon); +void CalculateMonStats(Pokemon *mon); +u32 GetMonData(Pokemon *mon, int monDataAttribute, void *dest); +static u32 GetMonDataAttribute(Pokemon *mon, int monDataAttribute, void *dest); +u32 GetBoxMonData(BoxPokemon *boxMon, int monDataAttribute, void *dest); +static u32 GetBoxMonDataAttribute(BoxPokemon *boxMon, int monDataAttribute, void *dest); +void SetMonData(Pokemon *mon, int monDataAttribute, const void *value); +static void SetMonDataAttribute(Pokemon *mon, int monDataAttribute, const void *value); +void SetBoxMonData(BoxPokemon *boxMon, int monDataAttribute, const void *value); +static void SetBoxMonDataAttribute(BoxPokemon *boxMon, int monDataAttribute, const void *value); +void IncreaseMonData(Pokemon *mon, int monDataAttribute, int value); +static void IncreaseMonDataAttribute(Pokemon *mon, int monDataAttribute, int value); +static void IncreaseBoxMonDataAttribute(BoxPokemon *boxMon, int monDataAttribute, int value); u32 GetMonFormPersonalDataAttribute(int monSpecies, int monForm, int monPersonalDataAttribute); u32 GetMonSpeciesPersonalDataAttribute(int monSpecies, int monPersonalDataAttribute); -u8 GetMonPercentToNextLevel(Pokemon * mon); -u32 GetMonExpToNextLevel(Pokemon * mon); -u32 GetBoxMonExpToNextLevel(BoxPokemon * boxMon); -u32 GetMonCurrentLevelExp(Pokemon * mon); +u8 GetMonPercentToNextLevel(Pokemon *mon); +u32 GetMonExpToNextLevel(Pokemon *mon); +u32 GetBoxMonExpToNextLevel(BoxPokemon *boxMon); +u32 GetMonCurrentLevelExp(Pokemon *mon); u32 GetMonSpeciesLevelExp(int monSpecies, int monLevel); -void LoadMonExperienceTable(int monExpRate, u32 * monExpTable); +void LoadMonExperienceTable(int monExpRate, u32 *monExpTable); u32 GetMonExpRateLevelExp(int monExpRate, int monLevel); -u32 GetMonLevel(Pokemon * mon); -u32 GetBoxMonLevel(BoxPokemon * boxMon); +u32 GetMonLevel(Pokemon *mon); +u32 GetBoxMonLevel(BoxPokemon *boxMon); u32 GetMonSpeciesLevel(u16 monSpecies, u32 monExp); -u8 GetMonNature(Pokemon * mon); -u8 GetBoxMonNature(BoxPokemon * boxMon); +u8 GetMonNature(Pokemon *mon); +u8 GetBoxMonNature(BoxPokemon *boxMon); u8 GetNatureFromPersonality(u32 monPersonality); u16 GetNatureAdjustedStatValue(u8 monNature, u16 monStatValue, u8 statType); s8 GetNatureStatAffinity(u8 monNature, u8 statType); -void sub_02075C74(Pokemon * mon, u8 param1, u16 param2); -u8 GetMonGender(Pokemon * mon); -u8 GetBoxMonGender(BoxPokemon * boxMon); +void sub_02075C74(Pokemon *mon, u8 param1, u16 param2); +u8 GetMonGender(Pokemon *mon); +u8 GetBoxMonGender(BoxPokemon *boxMon); u8 GetMonPersonalityGender(u16 monSpecies, u32 monPersonality); -u8 GetMonShininess(Pokemon * mon); -u8 GetBoxMonShininess(BoxPokemon * boxMon); +u8 GetMonShininess(Pokemon *mon); +u8 GetBoxMonShininess(BoxPokemon *boxMon); u8 GetMonPersonalityShininess(u32 monOTID, u32 monPersonality); u32 sub_02075E64(u32 param0); -void sub_02075EF4(UnkStruct_02008A90 * param0, Pokemon * mon, u8 param2); -void sub_02075F0C(UnkStruct_02008A90 * param0, BoxPokemon * boxMon, u8 param2, int param3); -void sub_02075FB4(UnkStruct_02008A90 * param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); +void sub_02075EF4(UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2); +void sub_02075F0C(UnkStruct_02008A90 *param0, BoxPokemon *boxMon, u8 param2, int param3); +void sub_02075FB4(UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); u8 SanitizeFormId(u16 monSpecies, u8 monForm); -u8 sub_020765AC(Pokemon * mon, u8 param1); -u8 sub_020765C4(BoxPokemon * boxMon, u8 param1, int param2); +u8 sub_020765AC(Pokemon *mon, u8 param1); +u8 sub_020765C4(BoxPokemon *boxMon, u8 param1, int param2); u8 sub_02076648(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality); -void sub_0207697C(UnkStruct_02008A90 * param0, u16 param1); -UnkStruct_0200D0F4 * sub_02076994(UnkStruct_0200C6E4 * param0, UnkStruct_0200C704 * param1, UnkStruct_02002F38 * param2, int param3, int param4, int param5, int param6, int param7, int heapID); -void sub_02076AAC(int param0, int param1, UnkStruct_ov5_021DE5D0 * param2); +void sub_0207697C(UnkStruct_02008A90 *param0, u16 param1); +UnkStruct_0200D0F4 * sub_02076994(UnkStruct_0200C6E4 *param0, UnkStruct_0200C704 *param1, UnkStruct_02002F38 *param2, int param3, int param4, int param5, int param6, int param7, int heapID); +void sub_02076AAC(int param0, int param1, UnkStruct_ov5_021DE5D0 *param2); u32 GetPokemonStructSize(void); u32 GetBoxPokemonStructSize(void); -u8 GetMonForm(Pokemon * mon); -u8 GetBoxMonForm(BoxPokemon * boxMon); -BoxPokemon * GetBoxMon(Pokemon * mon); -u8 sub_02076B14(Pokemon * mon); -u16 sub_02076B94(Party * party, Pokemon * mon, u8 evoTypeList, u16 evoParam, int * evoTypeResult); -void SetBoxMonDefaultMoves(BoxPokemon * boxMon); -u16 AddMonMove(Pokemon * mon, u16 moveID); -u16 AddBoxMonMove(BoxPokemon * boxMon, u16 moveID); -void ReplaceMonMove(Pokemon * mon, u16 moveID); -void ReplaceBoxMonMove(BoxPokemon * boxMon, u16 moveID); -void ResetMonMove(Pokemon * mon, u16 moveID, u8 moveSlot); -void SetMonMove(Pokemon * mon, u16 moveID, u8 moveSlot); -void SetBoxMonMove(BoxPokemon * boxMon, u16 moveID, u8 moveSlot); -u16 sub_0207727C(Pokemon * mon, int * index, u16 * moveID); -void SwapMonMoves(Pokemon * mon, int moveSlot1, int moveSlot2); -void SwapBoxMonMoves(BoxPokemon * boxMon, int moveSlot1, int moveSlot2); -void DeleteMonMove(Pokemon * mon, u32 moveSlot); -BOOL MonHasMove(Pokemon * mon, u16 moveID); -void sub_020774C8(BoxPokemon * boxMon, Pokemon * mon); -u8 GetPartyHighestLevel(Party * party); +u8 GetMonForm(Pokemon *mon); +u8 GetBoxMonForm(BoxPokemon *boxMon); +BoxPokemon * GetBoxMon(Pokemon *mon); +u8 sub_02076B14(Pokemon *mon); +u16 sub_02076B94(Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int *evoTypeResult); +void SetBoxMonDefaultMoves(BoxPokemon *boxMon); +u16 AddMonMove(Pokemon *mon, u16 moveID); +u16 AddBoxMonMove(BoxPokemon *boxMon, u16 moveID); +void ReplaceMonMove(Pokemon *mon, u16 moveID); +void ReplaceBoxMonMove(BoxPokemon *boxMon, u16 moveID); +void ResetMonMove(Pokemon *mon, u16 moveID, u8 moveSlot); +void SetMonMove(Pokemon *mon, u16 moveID, u8 moveSlot); +void SetBoxMonMove(BoxPokemon *boxMon, u16 moveID, u8 moveSlot); +u16 sub_0207727C(Pokemon *mon, int *index, u16 *moveID); +void SwapMonMoves(Pokemon *mon, int moveSlot1, int moveSlot2); +void SwapBoxMonMoves(BoxPokemon *boxMon, int moveSlot1, int moveSlot2); +void DeleteMonMove(Pokemon *mon, u32 moveSlot); +BOOL MonHasMove(Pokemon *mon, u16 moveID); +void sub_020774C8(BoxPokemon *boxMon, Pokemon *mon); +u8 GetPartyHighestLevel(Party *party); u16 sub_020775A4(u16 param0); u16 sub_020775C4(u16 param0); -void sub_020775EC(Pokemon * src, Pokemon * dest); -void sub_02077604(BoxPokemon * src, BoxPokemon * dest); -void sub_02077618(Pokemon * src, BoxPokemon * dest); -s8 sub_0207762C(Pokemon * mon, int param1); -s8 sub_02077634(BoxPokemon * boxMon, int param1); +void sub_020775EC(Pokemon *src, Pokemon *dest); +void sub_02077604(BoxPokemon *src, BoxPokemon *dest); +void sub_02077618(Pokemon *src, BoxPokemon *dest); +s8 sub_0207762C(Pokemon *mon, int param1); +s8 sub_02077634(BoxPokemon *boxMon, int param1); s8 sub_02077648(u32 monPersonality, int param1); -void sub_020776B0(Party * party); -u8 sub_02077758(Party * party, u8 param1); -void sub_020777B4(Party * party, s32 param1); -void sub_0207782C(Party * party); -BOOL sub_020778D8(Pokemon * mon); -BOOL sub_020778E0(BoxPokemon * boxMon); -BOOL sub_020778F8(Pokemon * mon); -BOOL sub_02077900(BoxPokemon * boxMon); -void SetArceusForm(Pokemon * mon); -void SetBoxArceusForm(BoxPokemon * boxMon); +void sub_020776B0(Party *party); +u8 sub_02077758(Party *party, u8 param1); +void sub_020777B4(Party *party, s32 param1); +void sub_0207782C(Party *party); +BOOL sub_020778D8(Pokemon *mon); +BOOL sub_020778E0(BoxPokemon *boxMon); +BOOL sub_020778F8(Pokemon *mon); +BOOL sub_02077900(BoxPokemon *boxMon); +void SetArceusForm(Pokemon *mon); +void SetBoxArceusForm(BoxPokemon *boxMon); u8 GetArceusItemType(u16 itemHoldEffect); -int SetGiratinaForm(Pokemon * mon); -int SetBoxGiratinaForm(BoxPokemon * boxMon); -void SetShayminForm(Pokemon * mon, int monForm); -void SetBoxShayminForm(BoxPokemon * boxMon, int monForm); -void LoadMonLevelUpMoves(int monSpecies, int monForm, u16 * monLevelUpMoves); -void sub_02077D3C(UnkStruct_0202CC84 * param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7); -void sub_02077E64(Pokemon * mon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5); -void sub_02077EA4(BoxPokemon * boxMon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5); -void sub_02077EE4(Pokemon * mon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5); -void sub_02077EF8(BoxPokemon * boxMon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5); -void sub_02077F0C(Pokemon * mon, u32 param1, int param2); -BOOL sub_02077FB4(Pokemon * mon, u8 param1); -BOOL sub_02077FBC(BoxPokemon * boxMon, u8 param1); +int SetGiratinaForm(Pokemon *mon); +int SetBoxGiratinaForm(BoxPokemon *boxMon); +void SetShayminForm(Pokemon *mon, int monForm); +void SetBoxShayminForm(BoxPokemon *boxMon, int monForm); +void LoadMonLevelUpMoves(int monSpecies, int monForm, u16 *monLevelUpMoves); +void sub_02077D3C(UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7); +void sub_02077E64(Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); +void sub_02077EA4(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); +void sub_02077EE4(Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); +void sub_02077EF8(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); +void sub_02077F0C(Pokemon *mon, u32 param1, int param2); +BOOL sub_02077FB4(Pokemon *mon, u8 param1); +BOOL sub_02077FBC(BoxPokemon *boxMon, u8 param1); BOOL sub_02077FE4(u16 monSpecies, int monForm, u8 tmID); -void CalculateMonAbility(Pokemon * mon); -void CalculateBoxMonAbility(BoxPokemon * boxMon); -void sub_020780C4(Pokemon * mon, u32 monPersonality); -static void LoadMonPersonalData(int monSpecies, PokemonPersonalData * monPersonalData); -static void LoadMonFormPersonalData(int monSpecies, int monForm, PokemonPersonalData * monPersonalData); -static void LoadMonEvolutionData(int monSpecies, PokemonEvolutionData * monEvolutionData); -static void EncryptMonData(void * data, u32 bytes, u32 seed); -static void DecryptMonData(void * data, u32 bytes, u32 seed); -static u16 GetMonDataChecksum(void * data, u32 bytes); -static void * GetBoxMonDataBlock(BoxPokemon * boxMon, u32 personality, u8 dataBlockID); +void CalculateMonAbility(Pokemon *mon); +void CalculateBoxMonAbility(BoxPokemon *boxMon); +void sub_020780C4(Pokemon *mon, u32 monPersonality); +static void LoadMonPersonalData(int monSpecies, PokemonPersonalData *monPersonalData); +static void LoadMonFormPersonalData(int monSpecies, int monForm, PokemonPersonalData *monPersonalData); +static void LoadMonEvolutionData(int monSpecies, PokemonEvolutionData *monEvolutionData); +static void EncryptMonData(void *data, u32 bytes, u32 seed); +static void DecryptMonData(void *data, u32 bytes, u32 seed); +static u16 GetMonDataChecksum(void *data, u32 bytes); +static void * GetBoxMonDataBlock(BoxPokemon *boxMon, u32 personality, u8 dataBlockID); static int GetMonFormNarcIndex(int monSpecies, int monForm); u32 GetSingleBitMask(int index); int GetLowestSetBitIndex(u32 num); BOOL sub_02078804(u16 param0); -BOOL sub_02078838(Pokemon * mon); +BOOL sub_02078838(Pokemon *mon); int sub_020788D0(int param0); -static void sub_02076300(UnkStruct_02008A90 * param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); +static void sub_02076300(UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); static u8 sub_020767BC(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality); -void ZeroMonData (Pokemon * mon) +void ZeroMonData (Pokemon *mon) { MI_CpuClearFast(mon, sizeof(Pokemon)); EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); } -void ZeroBoxMonData (BoxPokemon * boxMon) +void ZeroBoxMonData (BoxPokemon *boxMon) { MI_CpuClearFast(boxMon, sizeof(BoxPokemon)); EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4, boxMon->checksum); @@ -276,7 +276,7 @@ Pokemon * AllocMonZeroed (u32 heapID) return mon; } -BOOL DecryptMon (Pokemon * mon) +BOOL DecryptMon (Pokemon *mon) { BOOL wasDecrypted; @@ -296,7 +296,7 @@ BOOL DecryptMon (Pokemon * mon) return wasDecrypted; } -BOOL EncryptMon (Pokemon * mon, BOOL encrypt) +BOOL EncryptMon (Pokemon *mon, BOOL encrypt) { BOOL wasEncrypted; @@ -315,7 +315,7 @@ BOOL EncryptMon (Pokemon * mon, BOOL encrypt) return wasEncrypted; } -BOOL DecryptBoxMon (BoxPokemon * boxMon) +BOOL DecryptBoxMon (BoxPokemon *boxMon) { BOOL wasDecrypted; @@ -330,7 +330,7 @@ BOOL DecryptBoxMon (BoxPokemon * boxMon) return wasDecrypted; } -BOOL EncryptBoxMon (BoxPokemon * boxMon, BOOL encrypt) +BOOL EncryptBoxMon (BoxPokemon *boxMon, BOOL encrypt) { BOOL wasEncrypted; @@ -348,10 +348,10 @@ BOOL EncryptBoxMon (BoxPokemon * boxMon, BOOL encrypt) return wasEncrypted; } -void sub_02073D80 (Pokemon * mon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) +void sub_02073D80 (Pokemon *mon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) { u32 zero; - UnkStruct_0202818C * v1; + UnkStruct_0202818C *v1; UnkStruct_0202CA28 v2; ZeroMonData(mon); @@ -375,7 +375,7 @@ void sub_02073D80 (Pokemon * mon, int monSpecies, int monLevel, int monIVs, int CalculateMonLevelAndStats(mon); } -void sub_02073E18 (BoxPokemon * boxMon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) +void sub_02073E18 (BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) { u16 unused_0; u32 v1, v2; @@ -465,7 +465,7 @@ void sub_02073E18 (BoxPokemon * boxMon, int monSpecies, int monLevel, int monIVs EncryptBoxMon(boxMon, reencrypt); } -void sub_02074044 (Pokemon * mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monNature) +void sub_02074044 (Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monNature) { u32 monPersonality; @@ -476,7 +476,7 @@ void sub_02074044 (Pokemon * mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 mon sub_02073D80(mon, monSpecies, monLevel, monIVs, 1, monPersonality, 0, 0); } -void sub_02074088 (Pokemon * mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 param4, u8 param5, u8 param6) +void sub_02074088 (Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 param4, u8 param5, u8 param6) { u32 monPersonality; u32 unused_0; @@ -520,14 +520,14 @@ u32 sub_02074128 (u16 monSpecies, u8 param1, u8 param2) return result; } -void sub_02074158 (Pokemon * mon, u16 monSpecies, u8 monLevel, u32 monCombinedIVs, u32 monPersonality) +void sub_02074158 (Pokemon *mon, u16 monSpecies, u8 monLevel, u32 monCombinedIVs, u32 monPersonality) { sub_02073D80(mon, monSpecies, monLevel, 0, 1, monPersonality, 0, 0); SetMonData(mon, MON_DATA_COMBINED_IVS, (u8 *)&monCombinedIVs); CalculateMonLevelAndStats(mon); } -void CalculateMonLevelAndStats (Pokemon * mon) +void CalculateMonLevelAndStats (Pokemon *mon) { int monLevel; BOOL reencrypt; @@ -540,7 +540,7 @@ void CalculateMonLevelAndStats (Pokemon * mon) EncryptMon(mon, reencrypt); } -void CalculateMonStats (Pokemon * mon) +void CalculateMonStats (Pokemon *mon) { int monMaxHp, monCurrentHp, newMaxHp; int newAtk, newDef, newSpeed, newSpAtk, newSpDef; @@ -550,7 +550,7 @@ void CalculateMonStats (Pokemon * mon) int monLevel; int monForm; int v23, v24, v25; - PokemonPersonalData * monPersonalData; + PokemonPersonalData *monPersonalData; BOOL reencrypt; reencrypt = DecryptMon(mon); @@ -629,7 +629,7 @@ void CalculateMonStats (Pokemon * mon) EncryptMon(mon, reencrypt); } -u32 GetMonData (Pokemon * mon, int monDataAttribute, void * dest) +u32 GetMonData (Pokemon *mon, int monDataAttribute, void *dest) { u32 result; u16 checksum; @@ -656,7 +656,7 @@ u32 GetMonData (Pokemon * mon, int monDataAttribute, void * dest) return result; } -static u32 GetMonDataAttribute (Pokemon * mon, int monDataAttribute, void * dest) +static u32 GetMonDataAttribute (Pokemon *mon, int monDataAttribute, void *dest) { u32 result = 0; @@ -707,7 +707,7 @@ static u32 GetMonDataAttribute (Pokemon * mon, int monDataAttribute, void * dest return result; } -u32 GetBoxMonData (BoxPokemon * boxMon, int monDataAttribute, void * dest) +u32 GetBoxMonData (BoxPokemon *boxMon, int monDataAttribute, void *dest) { u16 checksum; u32 result; @@ -731,14 +731,14 @@ u32 GetBoxMonData (BoxPokemon * boxMon, int monDataAttribute, void * dest) return result; } -static u32 GetBoxMonDataAttribute (BoxPokemon * boxMon, int monDataAttribute, void * dest) +static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, void *dest) { u32 result = 0; u64 v1; - PokemonDataBlockA * monDataBlockA; - PokemonDataBlockB * monDataBlockB; - PokemonDataBlockC * monDataBlockC; - PokemonDataBlockD * monDataBlockD; + PokemonDataBlockA *monDataBlockA; + PokemonDataBlockB *monDataBlockB; + PokemonDataBlockC *monDataBlockC; + PokemonDataBlockD *monDataBlockD; monDataBlockA = (PokemonDataBlockA *)GetBoxMonDataBlock(boxMon, boxMon->personality, 0); monDataBlockB = (PokemonDataBlockB *)GetBoxMonDataBlock(boxMon, boxMon->personality, 1); @@ -991,7 +991,7 @@ static u32 GetBoxMonDataAttribute (BoxPokemon * boxMon, int monDataAttribute, vo MessageLoader_GetSpeciesName(495, 0, dest); } else { { - u16 * v6 = dest; + u16 *v6 = dest; for (result = 0; result < 10; result++) { v6[result] = monDataBlockC->unk_00[result]; @@ -1045,7 +1045,7 @@ static u32 GetBoxMonDataAttribute (BoxPokemon * boxMon, int monDataAttribute, vo break; case MON_DATA_144: { - u16 * v8 = dest; + u16 *v8 = dest; for (result = 0; result < 7; result++) { v8[result] = monDataBlockD->unk_00[result]; @@ -1135,7 +1135,7 @@ static u32 GetBoxMonDataAttribute (BoxPokemon * boxMon, int monDataAttribute, vo return result; } -void SetMonData (Pokemon * mon, int monDataAttribute, const void * value) +void SetMonData (Pokemon *mon, int monDataAttribute, const void *value) { u16 checksum; @@ -1161,11 +1161,11 @@ void SetMonData (Pokemon * mon, int monDataAttribute, const void * value) } } -static void SetMonDataAttribute (Pokemon * mon, int monDataAttribute, const void * value) +static void SetMonDataAttribute (Pokemon *mon, int monDataAttribute, const void *value) { - u32 * u32Value = (u32 *)value; - u16 * u16Value = (u16 *)value; - u8 * u8Value = (u8 *)value; + u32 *u32Value = (u32 *)value; + u16 *u16Value = (u16 *)value; + u8 *u8Value = (u8 *)value; switch (monDataAttribute) { case MON_DATA_160: @@ -1210,7 +1210,7 @@ static void SetMonDataAttribute (Pokemon * mon, int monDataAttribute, const void } } -void SetBoxMonData (BoxPokemon * boxMon, int monDataAttribute, const void * value) +void SetBoxMonData (BoxPokemon *boxMon, int monDataAttribute, const void *value) { u16 checksum; @@ -1234,18 +1234,18 @@ void SetBoxMonData (BoxPokemon * boxMon, int monDataAttribute, const void * valu } } -static void SetBoxMonDataAttribute (BoxPokemon * boxMon, int monDataAttribute, const void * value) +static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, const void *value) { int i; u64 v1; u16 v2; - u32 * u32Value = (u32 *)value; - u16 * u16Value = (u16 *)value; - u8 * u8Value = (u8 *)value; - PokemonDataBlockA * monDataBlockA; - PokemonDataBlockB * monDataBlockB; - PokemonDataBlockC * monDataBlockC; - PokemonDataBlockD * monDataBlockD; + u32 *u32Value = (u32 *)value; + u16 *u16Value = (u16 *)value; + u8 *u8Value = (u8 *)value; + PokemonDataBlockA *monDataBlockA; + PokemonDataBlockB *monDataBlockB; + PokemonDataBlockC *monDataBlockC; + PokemonDataBlockD *monDataBlockD; monDataBlockA = (PokemonDataBlockA *)GetBoxMonDataBlock(boxMon, boxMon->personality, 0); monDataBlockB = (PokemonDataBlockB *)GetBoxMonDataBlock(boxMon, boxMon->personality, 1); @@ -1618,7 +1618,7 @@ static void SetBoxMonDataAttribute (BoxPokemon * boxMon, int monDataAttribute, c } } -void IncreaseMonData (Pokemon * mon, int monDataAttribute, int value) +void IncreaseMonData (Pokemon *mon, int monDataAttribute, int value) { u16 checksum; @@ -1644,7 +1644,7 @@ void IncreaseMonData (Pokemon * mon, int monDataAttribute, int value) } } -static void IncreaseMonDataAttribute (Pokemon * mon, int monDataAttribute, int value) +static void IncreaseMonDataAttribute (Pokemon *mon, int monDataAttribute, int value) { switch (monDataAttribute) { case MON_DATA_CURRENT_HP: @@ -1672,14 +1672,14 @@ static void IncreaseMonDataAttribute (Pokemon * mon, int monDataAttribute, int v } } -static void IncreaseBoxMonDataAttribute (BoxPokemon * boxMon, int monDataAttribute, int value) +static void IncreaseBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, int value) { int unused_0; u16 unused_1; - PokemonDataBlockA * monDataBlockA; - PokemonDataBlockB * monDataBlockB; - PokemonDataBlockC * monDataBlockC; - PokemonDataBlockD * monDataBlockD; + PokemonDataBlockA *monDataBlockA; + PokemonDataBlockB *monDataBlockB; + PokemonDataBlockC *monDataBlockC; + PokemonDataBlockD *monDataBlockD; monDataBlockA = (PokemonDataBlockA *)GetBoxMonDataBlock(boxMon, boxMon->personality, 0); monDataBlockB = (PokemonDataBlockB *)GetBoxMonDataBlock(boxMon, boxMon->personality, 1); @@ -1977,7 +1977,7 @@ static void IncreaseBoxMonDataAttribute (BoxPokemon * boxMon, int monDataAttribu PokemonPersonalData * GetMonFormPersonalData (int monSpecies, int monForm, int heapID) { - PokemonPersonalData * monPersonalData; + PokemonPersonalData *monPersonalData; monPersonalData = Heap_AllocFromHeap(heapID, sizeof(PokemonPersonalData)); LoadMonFormPersonalData(monSpecies, monForm, monPersonalData); @@ -1987,7 +1987,7 @@ PokemonPersonalData * GetMonFormPersonalData (int monSpecies, int monForm, int h PokemonPersonalData * GetMonPersonalData (int monSpecies, int heapID) { - PokemonPersonalData * monPersonalData; + PokemonPersonalData *monPersonalData; monPersonalData = Heap_AllocFromHeap(heapID, sizeof(PokemonPersonalData)); LoadMonPersonalData(monSpecies, monPersonalData); @@ -1995,7 +1995,7 @@ PokemonPersonalData * GetMonPersonalData (int monSpecies, int heapID) return monPersonalData; } -u32 GetMonPersonalDataAttribute (PokemonPersonalData * monPersonalData, int monPersonalDataAttribute) +u32 GetMonPersonalDataAttribute (PokemonPersonalData *monPersonalData, int monPersonalDataAttribute) { u32 result; @@ -2106,7 +2106,7 @@ u32 GetMonPersonalDataAttribute (PokemonPersonalData * monPersonalData, int monP return result; } -void FreeMonPersonalData (PokemonPersonalData * monPersonalData) +void FreeMonPersonalData (PokemonPersonalData *monPersonalData) { GF_ASSERT(monPersonalData); Heap_FreeToHeap(monPersonalData); @@ -2115,7 +2115,7 @@ void FreeMonPersonalData (PokemonPersonalData * monPersonalData) u32 GetMonFormPersonalDataAttribute (int monSpecies, int monForm, int monPersonalDataAttribute) { u32 result; - PokemonPersonalData * monPersonalData; + PokemonPersonalData *monPersonalData; monSpecies = GetMonFormNarcIndex(monSpecies, monForm); @@ -2130,7 +2130,7 @@ u32 GetMonFormPersonalDataAttribute (int monSpecies, int monForm, int monPersona u32 GetMonSpeciesPersonalDataAttribute (int monSpecies, int monPersonalDataAttribute) { u32 result; - PokemonPersonalData * monPersonalData; + PokemonPersonalData *monPersonalData; monPersonalData = GetMonPersonalData(monSpecies, 0); result = GetMonPersonalDataAttribute(monPersonalData, monPersonalDataAttribute); @@ -2140,7 +2140,7 @@ u32 GetMonSpeciesPersonalDataAttribute (int monSpecies, int monPersonalDataAttri return result; } -u8 GetMonPercentToNextLevel (Pokemon * mon) +u8 GetMonPercentToNextLevel (Pokemon *mon) { u16 monSpecies; u8 monLevel; @@ -2163,12 +2163,12 @@ u8 GetMonPercentToNextLevel (Pokemon * mon) return monPercentToNextLevel; } -u32 GetMonExpToNextLevel (Pokemon * mon) +u32 GetMonExpToNextLevel (Pokemon *mon) { return GetBoxMonExpToNextLevel(&mon->box); } -u32 GetBoxMonExpToNextLevel (BoxPokemon * boxMon) +u32 GetBoxMonExpToNextLevel (BoxPokemon *boxMon) { u16 monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); u16 monNextlevel = GetBoxMonLevel(boxMon) + 1; @@ -2177,7 +2177,7 @@ u32 GetBoxMonExpToNextLevel (BoxPokemon * boxMon) return GetMonSpeciesLevelExp(monSpecies, monNextlevel) - monExp; } -u32 GetMonCurrentLevelExp (Pokemon * mon) +u32 GetMonCurrentLevelExp (Pokemon *mon) { return GetMonSpeciesLevelExp(GetMonData(mon, MON_DATA_SPECIES, NULL), GetMonData(mon, MON_DATA_LEVEL, NULL)); } @@ -2187,7 +2187,7 @@ u32 GetMonSpeciesLevelExp (int monSpecies, int monLevel) return GetMonExpRateLevelExp(GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_EXP_RATE), monLevel); } -void LoadMonExperienceTable (int monExpRate, u32 * monExpTable) +void LoadMonExperienceTable (int monExpRate, u32 *monExpTable) { GF_ASSERT(monExpRate < 8); NARC_ReadWholeMemberByIndexPair(monExpTable, NARC_INDEX_POKETOOL__PERSONAL__PL_GROWTBL, monExpRate); @@ -2196,7 +2196,7 @@ void LoadMonExperienceTable (int monExpRate, u32 * monExpTable) u32 GetMonExpRateLevelExp (int monExpRate, int monLevel) { u32 result; - u32 * expTable; + u32 *expTable; GF_ASSERT(monExpRate < 8); GF_ASSERT(monLevel <= 101); @@ -2210,12 +2210,12 @@ u32 GetMonExpRateLevelExp (int monExpRate, int monLevel) return result; } -u32 GetMonLevel (Pokemon * mon) +u32 GetMonLevel (Pokemon *mon) { return GetBoxMonLevel(&mon->box); } -u32 GetBoxMonLevel (BoxPokemon * boxMon) +u32 GetBoxMonLevel (BoxPokemon *boxMon) { int monSpecies; u32 monExp; @@ -2234,8 +2234,8 @@ u32 GetMonSpeciesLevel (u16 monSpecies, u32 monExp) { int unused_0; u32 monLevel; - u32 * unused_1; - PokemonPersonalData * monPersonalData = GetMonPersonalData(monSpecies, 0); + u32 *unused_1; + PokemonPersonalData *monPersonalData = GetMonPersonalData(monSpecies, 0); monLevel = GetMonPersonalDataLevel(monPersonalData, monSpecies, monExp); FreeMonPersonalData(monPersonalData); @@ -2243,7 +2243,7 @@ u32 GetMonSpeciesLevel (u16 monSpecies, u32 monExp) return monLevel; } -u32 GetMonPersonalDataLevel (PokemonPersonalData * monPersonalData, u16 unused_monSpecies, u32 monExp) +u32 GetMonPersonalDataLevel (PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monExp) { static u32 monExpTable[101]; int monExpRate, i; @@ -2260,12 +2260,12 @@ u32 GetMonPersonalDataLevel (PokemonPersonalData * monPersonalData, u16 unused_m return i - 1; } -u8 GetMonNature (Pokemon * mon) +u8 GetMonNature (Pokemon *mon) { return GetBoxMonNature(&mon->box); } -u8 GetBoxMonNature (BoxPokemon * boxMon) +u8 GetBoxMonNature (BoxPokemon *boxMon) { BOOL reencrypt; u32 monPersonality; @@ -2354,7 +2354,7 @@ static const s8 Unk_020F05A0[][3] = { {0x3, 0x2, 0x1} }; -void sub_02075C74 (Pokemon * mon, u8 param1, u16 param2) +void sub_02075C74 (Pokemon *mon, u8 param1, u16 param2) { u16 monSpeciesEgg; u16 monHeldItem; @@ -2417,12 +2417,12 @@ void sub_02075C74 (Pokemon * mon, u8 param1, u16 param2) SetMonData(mon, MON_DATA_FRIENDSHIP, (u8 *)&monFriendship); } -u8 GetMonGender (Pokemon * mon) +u8 GetMonGender (Pokemon *mon) { return GetBoxMonGender((BoxPokemon *)&mon->box); } -u8 GetBoxMonGender (BoxPokemon * boxMon) +u8 GetBoxMonGender (BoxPokemon *boxMon) { u16 monSpecies; u32 monPersonality; @@ -2439,7 +2439,7 @@ u8 GetBoxMonGender (BoxPokemon * boxMon) u8 GetMonPersonalityGender (u16 monSpecies, u32 monPersonality) { - PokemonPersonalData * monPersonalData; + PokemonPersonalData *monPersonalData; u8 monGender; monPersonalData = GetMonPersonalData(monSpecies, 0); @@ -2450,7 +2450,7 @@ u8 GetMonPersonalityGender (u16 monSpecies, u32 monPersonality) return monGender; } -u8 GetMonPersonalDataGender (PokemonPersonalData * monPersonalData, u16 unused_monSpecies, u32 monPersonality) +u8 GetMonPersonalDataGender (PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monPersonality) { u8 monGender = GetMonPersonalDataAttribute(monPersonalData, MON_DATA_PERSONAL_GENDER); @@ -2470,12 +2470,12 @@ u8 GetMonPersonalDataGender (PokemonPersonalData * monPersonalData, u16 unused_m } } -u8 GetMonShininess (Pokemon * mon) +u8 GetMonShininess (Pokemon *mon) { return GetBoxMonShininess(&mon->box); } -u8 GetBoxMonShininess (BoxPokemon * boxMon) +u8 GetBoxMonShininess (BoxPokemon *boxMon) { u32 monOTID; u32 monPersonality; @@ -2523,17 +2523,17 @@ u32 sub_02075E64 (u32 param0) return result; } -void sub_02075EF4 (UnkStruct_02008A90 * param0, Pokemon * mon, u8 param2) +void sub_02075EF4 (UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2) { sub_02075F0C(param0, &mon->box, param2, 0); } -void sub_02075F00 (UnkStruct_02008A90 * param0, Pokemon * mon, u8 param2) +void sub_02075F00 (UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2) { sub_02075F0C(param0, &mon->box, param2, 1); } -void sub_02075F0C (UnkStruct_02008A90 * param0, BoxPokemon * boxMon, u8 param2, int param3) +void sub_02075F0C (UnkStruct_02008A90 *param0, BoxPokemon *boxMon, u8 param2, int param3) { BOOL reencrypt; u16 monSpeciesEgg; @@ -2565,7 +2565,7 @@ void sub_02075F0C (UnkStruct_02008A90 * param0, BoxPokemon * boxMon, u8 param2, EncryptBoxMon(boxMon, reencrypt); } -void sub_02075FB4 (UnkStruct_02008A90 * param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality) +void sub_02075FB4 (UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality) { param0->unk_06 = 0; param0->unk_08 = 0; @@ -2732,7 +2732,7 @@ u8 SanitizeFormId (u16 monSpecies, u8 monForm) return monForm; } -static void sub_02076300 (UnkStruct_02008A90 * param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality) +static void sub_02076300 (UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality) { param0->unk_06 = 0; param0->unk_08 = 0; @@ -2844,17 +2844,17 @@ static void sub_02076300 (UnkStruct_02008A90 * param0, u16 monSpecies, u8 monGen } } -u8 sub_020765AC (Pokemon * mon, u8 param1) +u8 sub_020765AC (Pokemon *mon, u8 param1) { return sub_020765C4(&mon->box, param1, 0); } -u8 sub_020765B8 (Pokemon * mon, u8 param1) +u8 sub_020765B8 (Pokemon *mon, u8 param1) { return sub_020765C4(&mon->box, param1, 1); } -u8 sub_020765C4 (BoxPokemon * boxMon, u8 param1, int param2) +u8 sub_020765C4 (BoxPokemon *boxMon, u8 param1, int param2) { u16 monSpeciesEgg; u8 monGender; @@ -3049,7 +3049,7 @@ static u8 sub_020767BC (u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 return result; } -void sub_0207697C (UnkStruct_02008A90 * param0, u16 param1) +void sub_0207697C (UnkStruct_02008A90 *param0, u16 param1) { param0->unk_00 = 60; param0->unk_02 = param1 * 2; @@ -3081,11 +3081,11 @@ static const int Unk_020F0588[] = { 0x1 }; -UnkStruct_0200D0F4 * sub_02076994 (UnkStruct_0200C6E4 * param0, UnkStruct_0200C704 * param1, UnkStruct_02002F38 * param2, int param3, int param4, int param5, int param6, int param7, int heapID) +UnkStruct_0200D0F4 * sub_02076994 (UnkStruct_0200C6E4 *param0, UnkStruct_0200C704 *param1, UnkStruct_02002F38 *param2, int param3, int param4, int param5, int param6, int param7, int heapID) { UnkStruct_ov104_0223F9E0 v0; - UnkStruct_0200D0F4 * v1; - NARC * narc; + UnkStruct_0200D0F4 *v1; + NARC *narc; UnkStruct_ov5_021DE5D0 v3; int v4 = 1; @@ -3121,7 +3121,7 @@ UnkStruct_0200D0F4 * sub_02076994 (UnkStruct_0200C6E4 * param0, UnkStruct_0200C7 return v1; } -void sub_02076AAC (int param0, int param1, UnkStruct_ov5_021DE5D0 * param2) +void sub_02076AAC (int param0, int param1, UnkStruct_ov5_021DE5D0 *param2) { if (param1 == 2) { param2->unk_00 = 60; @@ -3151,22 +3151,22 @@ u32 GetBoxPokemonStructSize (void) return (u32)sizeof(BoxPokemon); } -u8 GetMonForm (Pokemon * mon) +u8 GetMonForm (Pokemon *mon) { return GetBoxMonForm((BoxPokemon *)&mon->box); } -u8 GetBoxMonForm (BoxPokemon * boxMon) +u8 GetBoxMonForm (BoxPokemon *boxMon) { return GetBoxMonData(boxMon, MON_DATA_FORM, NULL); } -BoxPokemon * GetBoxMon (Pokemon * mon) +BoxPokemon * GetBoxMon (Pokemon *mon) { return &mon->box; } -u8 sub_02076B14 (Pokemon * mon) +u8 sub_02076B14 (Pokemon *mon) { u16 monSpecies; u8 monNextLevel; @@ -3199,7 +3199,7 @@ u8 sub_02076B14 (Pokemon * mon) return 0; } -u16 sub_02076B94 (Party * party, Pokemon * mon, u8 evoTypeList, u16 evoParam, int * evoTypeResult) +u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int *evoTypeResult) { u16 monSpecies; u16 monHeldItem; @@ -3211,7 +3211,7 @@ u16 sub_02076B94 (Party * party, Pokemon * mon, u8 evoTypeList, u16 evoParam, in u8 itemHoldEffect; u8 monBeauty; u16 monPersonalityUpper = 0; - PokemonEvolutionData * monEvolutionData; + PokemonEvolutionData *monEvolutionData; int v11; monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); @@ -3471,7 +3471,7 @@ u16 sub_02076FD4 (const u16 monSpecies) return sub_02076F84(monSpecies); } -void SetBoxMonDefaultMoves (BoxPokemon * boxMon) +void SetBoxMonDefaultMoves (BoxPokemon *boxMon) { BOOL reencrypt; int i; @@ -3480,7 +3480,7 @@ void SetBoxMonDefaultMoves (BoxPokemon * boxMon) int monForm; u16 moveID; u8 monLevel; - u16 * monLevelUpMoves = Heap_AllocFromHeap(0, 44); + u16 *monLevelUpMoves = Heap_AllocFromHeap(0, 44); reencrypt = DecryptBoxMon(boxMon); monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, 0); @@ -3510,13 +3510,13 @@ void SetBoxMonDefaultMoves (BoxPokemon * boxMon) EncryptBoxMon(boxMon, reencrypt); } -u16 AddMonMove (Pokemon * mon, u16 moveID) +u16 AddMonMove (Pokemon *mon, u16 moveID) { - BoxPokemon * boxMon = GetBoxMon(mon); + BoxPokemon *boxMon = GetBoxMon(mon); return AddBoxMonMove(boxMon, moveID); } -u16 AddBoxMonMove (BoxPokemon * boxMon, u16 moveID) +u16 AddBoxMonMove (BoxPokemon *boxMon, u16 moveID) { int i; u8 unused_0; @@ -3546,13 +3546,13 @@ u16 AddBoxMonMove (BoxPokemon * boxMon, u16 moveID) return result; } -void ReplaceMonMove (Pokemon * mon, u16 moveID) +void ReplaceMonMove (Pokemon *mon, u16 moveID) { - BoxPokemon * boxMon = GetBoxMon(mon); + BoxPokemon *boxMon = GetBoxMon(mon); ReplaceBoxMonMove(boxMon, moveID); } -void ReplaceBoxMonMove (BoxPokemon * boxMon, u16 moveID) +void ReplaceBoxMonMove (BoxPokemon *boxMon, u16 moveID) { int i; u16 moveIDs[4]; @@ -3581,7 +3581,7 @@ void ReplaceBoxMonMove (BoxPokemon * boxMon, u16 moveID) EncryptBoxMon(boxMon, reencrypt); } -void ResetMonMove (Pokemon * mon, u16 moveID, u8 moveSlot) +void ResetMonMove (Pokemon *mon, u16 moveID, u8 moveSlot) { u32 moveMaxPP, movePPUps; @@ -3596,12 +3596,12 @@ void ResetMonMove (Pokemon * mon, u16 moveID, u8 moveSlot) return; } -void SetMonMove (Pokemon * mon, u16 moveID, u8 moveSlot) +void SetMonMove (Pokemon *mon, u16 moveID, u8 moveSlot) { SetBoxMonMove(&mon->box, moveID, moveSlot); } -void SetBoxMonMove (BoxPokemon * boxMon, u16 moveID, u8 moveSlot) +void SetBoxMonMove (BoxPokemon *boxMon, u16 moveID, u8 moveSlot) { u8 moveMaxPP; u8 movePPUps; @@ -3614,13 +3614,13 @@ void SetBoxMonMove (BoxPokemon * boxMon, u16 moveID, u8 moveSlot) SetBoxMonData(boxMon, MON_DATA_MOVE1_PP + moveSlot, (u8 *)&moveMaxPP); } -u16 sub_0207727C (Pokemon * mon, int * index, u16 * moveID) +u16 sub_0207727C (Pokemon *mon, int *index, u16 *moveID) { u16 result = 0x0; u16 monSpecies; int monForm; u8 monLevel; - u16 * monLevelUpMoves = Heap_AllocFromHeap(0, 44); + u16 *monLevelUpMoves = Heap_AllocFromHeap(0, 44); monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); monForm = GetMonData(mon, MON_DATA_FORM, NULL); @@ -3654,12 +3654,12 @@ u16 sub_0207727C (Pokemon * mon, int * index, u16 * moveID) return result; } -void SwapMonMoves (Pokemon * mon, int moveSlot1, int moveSlot2) +void SwapMonMoves (Pokemon *mon, int moveSlot1, int moveSlot2) { SwapBoxMonMoves(&mon->box, moveSlot1, moveSlot2); } -void SwapBoxMonMoves (BoxPokemon * boxMon, int moveSlot1, int moveSlot2) +void SwapBoxMonMoves (BoxPokemon *boxMon, int moveSlot1, int moveSlot2) { u16 moveIDs[2]; u8 movePPs[2]; @@ -3680,7 +3680,7 @@ void SwapBoxMonMoves (BoxPokemon * boxMon, int moveSlot1, int moveSlot2) SetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot2, (u8 *)&movePPUps[0]); } -void DeleteMonMove (Pokemon * mon, u32 moveSlot) +void DeleteMonMove (Pokemon *mon, u32 moveSlot) { u32 i; u16 moveID; @@ -3706,7 +3706,7 @@ void DeleteMonMove (Pokemon * mon, u32 moveSlot) SetMonData(mon, MON_DATA_MOVE4_PP_UPS, (u8 *)&movePPUps); } -BOOL MonHasMove (Pokemon * mon, u16 moveID) +BOOL MonHasMove (Pokemon *mon, u16 moveID) { int i; @@ -3719,10 +3719,10 @@ BOOL MonHasMove (Pokemon * mon, u16 moveID) return i != 4; } -void sub_020774C8 (BoxPokemon * boxMon, Pokemon * mon) +void sub_020774C8 (BoxPokemon *boxMon, Pokemon *mon) { u32 zero = 0; - UnkStruct_0202818C * v1; + UnkStruct_0202818C *v1; UnkStruct_0202CA28 v2; mon->box = *boxMon; @@ -3747,11 +3747,11 @@ void sub_020774C8 (BoxPokemon * boxMon, Pokemon * mon) CalculateMonLevelAndStats(mon); } -u8 GetPartyHighestLevel (Party * party) +u8 GetPartyHighestLevel (Party *party) { u8 result, monLevel; int i, currentPartyCount; - Pokemon * mon; + Pokemon *mon; currentPartyCount = Party_GetCurrentCount(party); result = 1; @@ -3791,30 +3791,30 @@ u16 sub_020775C4 (u16 param0) return result; } -void sub_020775EC (Pokemon * src, Pokemon * dest) +void sub_020775EC (Pokemon *src, Pokemon *dest) { *dest = *src; return; } -void sub_02077604 (BoxPokemon * src, BoxPokemon * dest) +void sub_02077604 (BoxPokemon *src, BoxPokemon *dest) { *dest = *src; return; } -void sub_02077618 (Pokemon * src, BoxPokemon * dest) +void sub_02077618 (Pokemon *src, BoxPokemon *dest) { *dest = src->box; return; } -s8 sub_0207762C (Pokemon * mon, int param1) +s8 sub_0207762C (Pokemon *mon, int param1) { return sub_02077634(&mon->box, param1); } -s8 sub_02077634 (BoxPokemon * boxMon, int param1) +s8 sub_02077634 (BoxPokemon *boxMon, int param1) { return sub_02077648(GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL), param1); } @@ -3827,10 +3827,10 @@ s8 sub_02077648 (u32 monPersonality, int param1) return Unk_020F0695[monNature][param1]; } -int GetMonLevelUpMoveIDs (int monSpecies, int monForm, u16 * monLevelUpMoveIDs) +int GetMonLevelUpMoveIDs (int monSpecies, int monForm, u16 *monLevelUpMoveIDs) { int result; - u16 * monLevelUpMoves = Heap_AllocFromHeap(0, 44); + u16 *monLevelUpMoves = Heap_AllocFromHeap(0, 44); LoadMonLevelUpMoves(monSpecies, monForm, monLevelUpMoves); @@ -3845,11 +3845,11 @@ int GetMonLevelUpMoveIDs (int monSpecies, int monForm, u16 * monLevelUpMoveIDs) return result; } -void sub_020776B0 (Party * party) +void sub_020776B0 (Party *party) { u16 rand; u8 monPokerus; - Pokemon * mon; + Pokemon *mon; int currentPartyCount; int partySlot; @@ -3886,12 +3886,12 @@ void sub_020776B0 (Party * party) } } -u8 sub_02077758 (Party * party, u8 param1) +u8 sub_02077758 (Party *party, u8 param1) { int partySlot = 0; int v1 = 1; u8 result = 0; - Pokemon * mon; + Pokemon *mon; if (param1) { do { @@ -3918,12 +3918,12 @@ u8 sub_02077758 (Party * party, u8 param1) return result; } -void sub_020777B4 (Party * party, s32 param1) +void sub_020777B4 (Party *party, s32 param1) { int i; int currentPartyCount; u8 monPokerus; - Pokemon * mon; + Pokemon *mon; currentPartyCount = Party_GetCurrentCount(party); @@ -3950,12 +3950,12 @@ void sub_020777B4 (Party * party, s32 param1) } } -void sub_0207782C (Party * party) +void sub_0207782C (Party *party) { int i; int currentPartyCount; u8 monPokerus; - Pokemon * mon; + Pokemon *mon; currentPartyCount = Party_GetCurrentCount(party); @@ -3989,22 +3989,22 @@ void sub_0207782C (Party * party) } } -BOOL sub_020778D8 (Pokemon * mon) +BOOL sub_020778D8 (Pokemon *mon) { return sub_020778E0(&mon->box); } -BOOL sub_020778E0 (BoxPokemon * boxMon) +BOOL sub_020778E0 (BoxPokemon *boxMon) { return (GetBoxMonData(boxMon, MON_DATA_POKERUS, NULL) & 0xf) != 0; } -BOOL sub_020778F8 (Pokemon * mon) +BOOL sub_020778F8 (Pokemon *mon) { return sub_02077900(&mon->box); } -BOOL sub_02077900 (BoxPokemon * boxMon) +BOOL sub_02077900 (BoxPokemon *boxMon) { u8 monPokerus; @@ -4017,12 +4017,12 @@ BOOL sub_02077900 (BoxPokemon * boxMon) return (monPokerus & 0xf0) != 0; } -void SetArceusForm (Pokemon * mon) +void SetArceusForm (Pokemon *mon) { SetBoxArceusForm(&mon->box); } -void SetBoxArceusForm (BoxPokemon * boxMon) +void SetBoxArceusForm (BoxPokemon *boxMon) { int monSpecies; int monAbility; @@ -4100,7 +4100,7 @@ u8 GetArceusItemType (u16 itemHoldEffect) return type; } -int SetGiratinaForm (Pokemon * mon) +int SetGiratinaForm (Pokemon *mon) { int result; @@ -4113,7 +4113,7 @@ int SetGiratinaForm (Pokemon * mon) return result; } -int SetBoxGiratinaForm (BoxPokemon * boxMon) +int SetBoxGiratinaForm (BoxPokemon *boxMon) { int monSpecies; int monHeldItem; @@ -4134,7 +4134,7 @@ int SetBoxGiratinaForm (BoxPokemon * boxMon) return -1; } -void SetGiratinaOriginForm (Pokemon * mon) +void SetGiratinaOriginForm (Pokemon *mon) { int monForm = 1; @@ -4145,10 +4145,10 @@ void SetGiratinaOriginForm (Pokemon * mon) } } -void SetPartyGiratinaForm (Party * party, int param1) +void SetPartyGiratinaForm (Party *party, int param1) { int i, currentPartyCount; - Pokemon * mon; + Pokemon *mon; currentPartyCount = Party_GetCurrentCount(party); @@ -4163,13 +4163,13 @@ void SetPartyGiratinaForm (Party * party, int param1) } } -void SetShayminForm (Pokemon * mon, int monForm) +void SetShayminForm (Pokemon *mon, int monForm) { SetBoxShayminForm(&mon->box, monForm); CalculateMonLevelAndStats(mon); } -void SetBoxShayminForm (BoxPokemon * boxMon, int monForm) +void SetBoxShayminForm (BoxPokemon *boxMon, int monForm) { int monSpecies; @@ -4183,7 +4183,7 @@ void SetBoxShayminForm (BoxPokemon * boxMon, int monForm) } } -BOOL AllowShayminSkyForm (Pokemon * mon) +BOOL AllowShayminSkyForm (Pokemon *mon) { u32 monSpecies, monForm, v2, monCurrentHP, monFatefulEncounter; RTCTime rtcTime; @@ -4203,10 +4203,10 @@ BOOL AllowShayminSkyForm (Pokemon * mon) return 0; } -void SetShayminLandForm (Party * party) +void SetShayminLandForm (Party *party) { int i, currentPartyCount, monSpecies, monForm; - Pokemon * mon; + Pokemon *mon; int zero = 0; currentPartyCount = Party_GetCurrentCount(party); @@ -4222,7 +4222,7 @@ void SetShayminLandForm (Party * party) } } -BOOL SetPartyShayminForm (Party * party, int param1, const RTCTime * rtcTime) +BOOL SetPartyShayminForm (Party *party, int param1, const RTCTime *rtcTime) { s32 hours, minutes; @@ -4256,7 +4256,7 @@ BOOL SetPartyShayminForm (Party * party, int param1, const RTCTime * rtcTime) } } -BOOL SetRotomForm (Pokemon * mon, int monForm, int moveSlot) +BOOL SetRotomForm (Pokemon *mon, int monForm, int moveSlot) { int monSpecies, currentMonForm; @@ -4324,13 +4324,13 @@ BOOL SetRotomForm (Pokemon * mon, int monForm, int moveSlot) return 1; } -void LoadMonLevelUpMoves (int monSpecies, int monForm, u16 * monLevelUpMoves) +void LoadMonLevelUpMoves (int monSpecies, int monForm, u16 *monLevelUpMoves) { monSpecies = GetMonFormNarcIndex(monSpecies, monForm); NARC_ReadWholeMemberByIndexPair(monLevelUpMoves, NARC_INDEX_POKETOOL__PERSONAL__WOTBL, monSpecies); } -void sub_02077D3C (UnkStruct_0202CC84 * param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7) +void sub_02077D3C (UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7) { if (monSpecies == SPECIES_CHATOT) { if (sub_020064C8(param1) == 0) { @@ -4348,7 +4348,7 @@ void sub_02077D3C (UnkStruct_0202CC84 * param0, int param1, u16 monSpecies, int } } -void sub_02077DB4 (UnkStruct_0202CC84 * param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7, u8 param8) +void sub_02077DB4 (UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7, u8 param8) { if (monSpecies == SPECIES_CHATOT) { if (sub_020064C8(param1) == 0) { @@ -4366,7 +4366,7 @@ void sub_02077DB4 (UnkStruct_0202CC84 * param0, int param1, u16 monSpecies, int } } -BOOL sub_02077E3C (Pokemon * mon) +BOOL sub_02077E3C (Pokemon *mon) { int monSpecies, monForm; @@ -4376,7 +4376,7 @@ BOOL sub_02077E3C (Pokemon * mon) return sub_02005844(monSpecies, monForm); } -void sub_02077E64 (Pokemon * mon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5) +void sub_02077E64 (Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) { int monMaxHP; @@ -4391,7 +4391,7 @@ void sub_02077E64 (Pokemon * mon, UnkStruct_02025E6C * param1, int monPokeball, } } -void sub_02077EA4 (BoxPokemon * boxMon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5) +void sub_02077EA4 (BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) { sub_0209305C(boxMon, param1, 0, param3, param5); SetBoxMonData(boxMon, MON_DATA_MET_GAME, &Unk_020E4C40); @@ -4399,12 +4399,12 @@ void sub_02077EA4 (BoxPokemon * boxMon, UnkStruct_02025E6C * param1, int monPoke SetBoxMonData(boxMon, MON_DATA_158, ¶m4); } -void sub_02077EE4 (Pokemon * mon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5) +void sub_02077EE4 (Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) { sub_02077EF8(&mon->box, param1, monPokeball, param3, param4, param5); } -void sub_02077EF8 (BoxPokemon * boxMon, UnkStruct_02025E6C * param1, int monPokeball, int param3, int param4, int param5) +void sub_02077EF8 (BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) { int unused_0; sub_02077EA4(boxMon, param1, monPokeball, param3, param4, param5); @@ -4415,7 +4415,7 @@ static const u16 sHeldItemChance[][2] = { {20, 80} }; -void sub_02077F0C (Pokemon * mon, u32 param1, int param2) +void sub_02077F0C (Pokemon *mon, u32 param1, int param2) { int unused_0; u32 rand; @@ -4448,12 +4448,12 @@ void sub_02077F0C (Pokemon * mon, u32 param1, int param2) } } -BOOL sub_02077FB4 (Pokemon * mon, u8 param1) +BOOL sub_02077FB4 (Pokemon *mon, u8 param1) { return sub_02077FBC(&mon->box, param1); } -BOOL sub_02077FBC (BoxPokemon * boxMon, u8 param1) +BOOL sub_02077FBC (BoxPokemon *boxMon, u8 param1) { u16 monSpeciesEgg; int monForm; @@ -4490,12 +4490,12 @@ BOOL sub_02077FE4 (u16 monSpecies, int monForm, u8 tmID) return (GetMonFormPersonalDataAttribute(monSpecies, monForm, monPersonalDataAttribute) & tmFlag) != 0; } -void CalculateMonAbility (Pokemon * mon) +void CalculateMonAbility (Pokemon *mon) { CalculateBoxMonAbility(&mon->box); } -void CalculateBoxMonAbility (BoxPokemon * boxMon) +void CalculateBoxMonAbility (BoxPokemon *boxMon) { BOOL reencrypt; int monSpecies, monForm; @@ -4522,17 +4522,17 @@ void CalculateBoxMonAbility (BoxPokemon * boxMon) EncryptBoxMon(boxMon, reencrypt); } -void sub_020780C4 (Pokemon * mon, u32 monPersonality) +void sub_020780C4 (Pokemon *mon, u32 monPersonality) { - Pokemon * newMon; - PokemonDataBlockA * newMonBlockA; - PokemonDataBlockB * newMonBlockB; - PokemonDataBlockC * newMonBlockC; - PokemonDataBlockD * newMonBlockD; - PokemonDataBlockA * monBlockA; - PokemonDataBlockB * monBlockB; - PokemonDataBlockC * monBlockC; - PokemonDataBlockD * monBlockD; + Pokemon *newMon; + PokemonDataBlockA *newMonBlockA; + PokemonDataBlockB *newMonBlockB; + PokemonDataBlockC *newMonBlockC; + PokemonDataBlockD *newMonBlockD; + PokemonDataBlockA *monBlockA; + PokemonDataBlockB *monBlockB; + PokemonDataBlockC *monBlockC; + PokemonDataBlockD *monBlockD; newMon = AllocMonZeroed(0); @@ -4565,36 +4565,36 @@ void sub_020780C4 (Pokemon * mon, u32 monPersonality) Heap_FreeToHeap(newMon); } -static void LoadMonPersonalData (int monSpecies, PokemonPersonalData * monPersonalData) +static void LoadMonPersonalData (int monSpecies, PokemonPersonalData *monPersonalData) { NARC_ReadWholeMemberByIndexPair(monPersonalData, NARC_INDEX_POKETOOL__PERSONAL__PL_PERSONAL, monSpecies); } -static void LoadMonFormPersonalData (int monSpecies, int monForm, PokemonPersonalData * monPersonalData) +static void LoadMonFormPersonalData (int monSpecies, int monForm, PokemonPersonalData *monPersonalData) { monSpecies = GetMonFormNarcIndex(monSpecies, monForm); NARC_ReadWholeMemberByIndexPair(monPersonalData, NARC_INDEX_POKETOOL__PERSONAL__PL_PERSONAL, monSpecies); } -static void LoadMonEvolutionData (int monSpecies, PokemonEvolutionData * monEvolutionData) +static void LoadMonEvolutionData (int monSpecies, PokemonEvolutionData *monEvolutionData) { NARC_ReadWholeMemberByIndexPair(monEvolutionData, NARC_INDEX_POKETOOL__PERSONAL__EVO, monSpecies); } -static void EncryptMonData (void * data, u32 bytes, u32 seed) +static void EncryptMonData (void *data, u32 bytes, u32 seed) { EncryptData(data, bytes, seed); } -static void DecryptMonData (void * data, u32 bytes, u32 seed) +static void DecryptMonData (void *data, u32 bytes, u32 seed) { DecryptData(data, bytes, seed); } -static u16 GetMonDataChecksum (void * data, u32 bytes) +static u16 GetMonDataChecksum (void *data, u32 bytes) { int i; - u16 * dataWords = (u16 *)data; + u16 *dataWords = (u16 *)data; u16 checksum = 0; for (i = 0; i < bytes / 2; i++) { @@ -4604,9 +4604,9 @@ static u16 GetMonDataChecksum (void * data, u32 bytes) return checksum; } -static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataBlockID) +static void * GetBoxMonDataBlock (BoxPokemon *boxMon, u32 personality, u8 dataBlockID) { - void * result; + void *result; personality = (personality & 0x3e000) >> 13; @@ -4616,7 +4616,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB case 0: case 24: { - PokemonDataBlocksShuffle0 * dataBlocks = (PokemonDataBlocksShuffle0 *)&boxMon->dataBlocks; + PokemonDataBlocksShuffle0 *dataBlocks = (PokemonDataBlocksShuffle0 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -4637,7 +4637,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB case 1: case 25: { - PokemonDataBlockShuffle1 * dataBlocks = (PokemonDataBlockShuffle1 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle1 *dataBlocks = (PokemonDataBlockShuffle1 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -4658,7 +4658,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB case 2: case 26: { - PokemonDataBlockShuffle2 * dataBlocks = (PokemonDataBlockShuffle2 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle2 *dataBlocks = (PokemonDataBlockShuffle2 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -4679,7 +4679,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB case 3: case 27: { - PokemonDataBlockShuffle3 * dataBlocks = (PokemonDataBlockShuffle3 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle3 *dataBlocks = (PokemonDataBlockShuffle3 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -4700,7 +4700,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB case 4: case 28: { - PokemonDataBlockShuffle4 * dataBlocks = (PokemonDataBlockShuffle4 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle4 *dataBlocks = (PokemonDataBlockShuffle4 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -4721,7 +4721,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB case 5: case 29: { - PokemonDataBlockShuffle5 * dataBlocks = (PokemonDataBlockShuffle5 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle5 *dataBlocks = (PokemonDataBlockShuffle5 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -4742,7 +4742,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB case 6: case 30: { - PokemonDataBlockShuffle6 * dataBlocks = (PokemonDataBlockShuffle6 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle6 *dataBlocks = (PokemonDataBlockShuffle6 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -4763,7 +4763,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB case 7: case 31: { - PokemonDataBlockShuffle7 * dataBlocks = (PokemonDataBlockShuffle7 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle7 *dataBlocks = (PokemonDataBlockShuffle7 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -4783,7 +4783,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB } case 8: { - PokemonDataBlockShuffle8 * dataBlocks = (PokemonDataBlockShuffle8 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle8 *dataBlocks = (PokemonDataBlockShuffle8 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -4803,7 +4803,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB } case 9: { - PokemonDataBlockShuffle9 * dataBlocks = (PokemonDataBlockShuffle9 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle9 *dataBlocks = (PokemonDataBlockShuffle9 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -4823,7 +4823,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB } case 10: { - PokemonDataBlockShuffle10 * dataBlocks = (PokemonDataBlockShuffle10 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle10 *dataBlocks = (PokemonDataBlockShuffle10 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -4843,7 +4843,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB } case 11: { - PokemonDataBlockShuffle11 * dataBlocks = (PokemonDataBlockShuffle11 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle11 *dataBlocks = (PokemonDataBlockShuffle11 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -4863,7 +4863,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB } case 12: { - PokemonDataBlockShuffle12 * dataBlocks = (PokemonDataBlockShuffle12 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle12 *dataBlocks = (PokemonDataBlockShuffle12 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -4883,7 +4883,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB } case 13: { - PokemonDataBlockShuffle13 * dataBlocks = (PokemonDataBlockShuffle13 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle13 *dataBlocks = (PokemonDataBlockShuffle13 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -4903,7 +4903,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB } case 14: { - PokemonDataBlockShuffle14 * dataBlocks = (PokemonDataBlockShuffle14 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle14 *dataBlocks = (PokemonDataBlockShuffle14 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -4923,7 +4923,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB } case 15: { - PokemonDataBlockShuffle15 * dataBlocks = (PokemonDataBlockShuffle15 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle15 *dataBlocks = (PokemonDataBlockShuffle15 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -4943,7 +4943,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB } case 16: { - PokemonDataBlockShuffle16 * dataBlocks = (PokemonDataBlockShuffle16 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle16 *dataBlocks = (PokemonDataBlockShuffle16 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -4963,7 +4963,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB } case 17: { - PokemonDataBlockShuffle17 * dataBlocks = (PokemonDataBlockShuffle17 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle17 *dataBlocks = (PokemonDataBlockShuffle17 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -4983,7 +4983,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB } case 18: { - PokemonDataBlockShuffle18 * dataBlocks = (PokemonDataBlockShuffle18 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle18 *dataBlocks = (PokemonDataBlockShuffle18 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -5003,7 +5003,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB } case 19: { - PokemonDataBlockShuffle19 * dataBlocks = (PokemonDataBlockShuffle19 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle19 *dataBlocks = (PokemonDataBlockShuffle19 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -5023,7 +5023,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB } case 20: { - PokemonDataBlockShuffle20 * dataBlocks = (PokemonDataBlockShuffle20 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle20 *dataBlocks = (PokemonDataBlockShuffle20 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -5043,7 +5043,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB } case 21: { - PokemonDataBlockShuffle21 * dataBlocks = (PokemonDataBlockShuffle21 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle21 *dataBlocks = (PokemonDataBlockShuffle21 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -5063,7 +5063,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB } case 22: { - PokemonDataBlockShuffle22 * dataBlocks = (PokemonDataBlockShuffle22 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle22 *dataBlocks = (PokemonDataBlockShuffle22 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -5083,7 +5083,7 @@ static void * GetBoxMonDataBlock (BoxPokemon * boxMon, u32 personality, u8 dataB } case 23: { - PokemonDataBlockShuffle23 * dataBlocks = (PokemonDataBlockShuffle23 *)&boxMon->dataBlocks; + PokemonDataBlockShuffle23 *dataBlocks = (PokemonDataBlockShuffle23 *)&boxMon->dataBlocks; switch (dataBlockID) { case 0: @@ -5214,13 +5214,13 @@ u16 sub_02078824 (u8 index) return Unk_020F05BE[index]; } -BOOL sub_02078838 (Pokemon * mon) +BOOL sub_02078838 (Pokemon *mon) { u16 monSpecies = (u16)GetMonData(mon, MON_DATA_SPECIES, NULL); return sub_02078804(monSpecies); } -BOOL sub_0207884C (BoxPokemon * boxMon, UnkStruct_02025E6C * param1, int heapID) +BOOL sub_0207884C (BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int heapID) { u32 v0 = sub_02025F20(param1); u32 monOTID = GetBoxMonData(boxMon, MON_DATA_OT_ID, NULL); @@ -5274,7 +5274,7 @@ int sub_020788D0 (int param0) return param0; } -void sub_0207893C (Pokemon * mon) +void sub_0207893C (Pokemon *mon) { u8 zero; UnkStruct_0202CA28 v1; @@ -5287,7 +5287,7 @@ void sub_0207893C (Pokemon * mon) SetMonData(mon, MON_DATA_171, (UnkStruct_0202CA28 *)&v1); } -void sub_0207896C (BoxPokemon * boxMon) +void sub_0207896C (BoxPokemon *boxMon) { BOOL reencrypt; int i; @@ -5313,7 +5313,7 @@ static inline int GetLowestBitInverse (int num) return result; } -void sub_020789BC (NARC * narc, UnkStruct_02007C10 * param1, u16 param2, u16 param3) +void sub_020789BC (NARC *narc, UnkStruct_02007C10 *param1, u16 param2, u16 param3) { UnkStruct_020789BC v0; int v1; @@ -5324,7 +5324,7 @@ void sub_020789BC (NARC * narc, UnkStruct_02007C10 * param1, u16 param2, u16 par MI_CpuCopy8(&v0.unk_00[v1].unk_03[0], param1, sizeof(UnkStruct_02007C10) * 10); } -void sub_020789F4 (NARC * narc, UnkStruct_02015F84 * param1, UnkStruct_02007C7C * param2, u16 param3, int param4, int param5, int param6) +void sub_020789F4 (NARC *narc, UnkStruct_02015F84 *param1, UnkStruct_02007C7C *param2, u16 param3, int param4, int param5, int param6) { UnkStruct_020789F4 v0; UnkStruct_020789BC v1; @@ -5342,7 +5342,7 @@ void sub_020789F4 (NARC * narc, UnkStruct_02015F84 * param1, UnkStruct_02007C7C sub_02015FCC(param1, param2, &v0, param6); } -void sub_02078A4C (NARC * narc, u8 * param1, u16 param2, u16 param3) +void sub_02078A4C (NARC *narc, u8 *param1, u16 param2, u16 param3) { UnkStruct_020789BC v0; int v1; @@ -5353,7 +5353,7 @@ void sub_02078A4C (NARC * narc, u8 * param1, u16 param2, u16 param3) *param1 = v0.unk_00[v1].unk_00; } -void sub_02078A80 (NARC * narc, s8 * param1, u16 param2) +void sub_02078A80 (NARC *narc, s8 *param1, u16 param2) { UnkStruct_020789BC v0; @@ -5361,7 +5361,7 @@ void sub_02078A80 (NARC * narc, s8 * param1, u16 param2) *param1 = v0.unk_56; } -void sub_02078AA4 (NARC * narc, s8 * param1, u16 param2) +void sub_02078AA4 (NARC *narc, s8 *param1, u16 param2) { UnkStruct_020789BC v0; @@ -5369,7 +5369,7 @@ void sub_02078AA4 (NARC * narc, s8 * param1, u16 param2) *param1 = v0.unk_57; } -void sub_02078AC8 (NARC * narc, u8 * param1, u16 param2) +void sub_02078AC8 (NARC *narc, u8 *param1, u16 param2) { UnkStruct_020789BC v0; @@ -5377,12 +5377,12 @@ void sub_02078AC8 (NARC * narc, u8 * param1, u16 param2) *param1 = v0.unk_58; } -BOOL sub_02078AEC (int param0, Pokemon * mon, int heapID) +BOOL sub_02078AEC (int param0, Pokemon *mon, int heapID) { int v0; int one; UnkStruct_0202CA28 v2; - NARC * narc; + NARC *narc; v0 = param0; @@ -5402,13 +5402,13 @@ BOOL sub_02078AEC (int param0, Pokemon * mon, int heapID) return 1; } -void sub_02078B40 (Pokemon * mon, UnkStruct_02078B40 * param1) +void sub_02078B40 (Pokemon *mon, UnkStruct_02078B40 *param1) { - BoxPokemon * boxMon; - PokemonDataBlockA * monDataBlockA; - PokemonDataBlockB * monDataBlockB; - PokemonDataBlockC * monDataBlockC; - PokemonDataBlockD * monDataBlockD; + BoxPokemon *boxMon; + PokemonDataBlockA *monDataBlockA; + PokemonDataBlockB *monDataBlockB; + PokemonDataBlockC *monDataBlockC; + PokemonDataBlockD *monDataBlockD; int i; u16 unused_0; @@ -5486,13 +5486,13 @@ void sub_02078B40 (Pokemon * mon, UnkStruct_02078B40 * param1) } } -void sub_02078E0C (UnkStruct_02078B40 * param0, Pokemon * mon) +void sub_02078E0C (UnkStruct_02078B40 *param0, Pokemon *mon) { - BoxPokemon * boxMon; - PokemonDataBlockA * monDataBlockA; - PokemonDataBlockB * monDataBlockB; - PokemonDataBlockC * monDataBlockC; - PokemonDataBlockD * monDataBlockD; + BoxPokemon *boxMon; + PokemonDataBlockA *monDataBlockA; + PokemonDataBlockB *monDataBlockB; + PokemonDataBlockC *monDataBlockC; + PokemonDataBlockD *monDataBlockD; int i; MI_CpuClearFast(mon, sizeof(Pokemon)); diff --git a/src/unk_0201D15C.c b/src/unk_0201D15C.c index 5fbc8982f9..76fa13413c 100644 --- a/src/unk_0201D15C.c +++ b/src/unk_0201D15C.c @@ -10,7 +10,7 @@ typedef struct { MATHCRC16Table unk_00; } UnkStruct_021BFB10; -static u16 LCRNG_NextFrom(u32 * seed); +static u16 LCRNG_NextFrom(u32 *seed); fx32 sub_0201D15C (u16 param0) { @@ -229,22 +229,22 @@ u32 sub_0201D5B8 (const void * param0, u32 param1) return v0; } -void EncryptData (void * data, u32 bytes, u32 seed) +void EncryptData (void *data, u32 bytes, u32 seed) { int i; - u16 * dataWords = (u16 *)data; + u16 *dataWords = (u16 *)data; for (i = 0; i < bytes / 2; i++) { dataWords[i] ^= LCRNG_NextFrom(&seed); } } -void DecryptData (void * data, u32 bytes, u32 seed) +void DecryptData (void *data, u32 bytes, u32 seed) { EncryptData(data, bytes, seed); } -static u16 LCRNG_NextFrom (u32 * seed) +static u16 LCRNG_NextFrom (u32 *seed) { seed[0] = seed[0] * 1103515245L + 24691; return (u16)(seed[0] / 65536L); From 37979510447f232e32231982a287707d8464fc1c Mon Sep 17 00:00:00 2001 From: wildfire Date: Wed, 6 Sep 2023 20:31:39 +0100 Subject: [PATCH 04/11] Cleanup of pokemon.c and a couple renames --- include/constants/pokemon.h | 16 +- include/pokemon.h | 10 +- include/struct_defs/box_pokemon.h | 14 +- include/struct_defs/pokemon.h | 2 +- include/struct_defs/pokemon_data_block_b.h | 6 +- .../pokemon_data_block_shuffle_0.h | 16 - .../pokemon_data_block_shuffle_1.h | 16 - .../pokemon_data_block_shuffle_10.h | 16 - .../pokemon_data_block_shuffle_11.h | 16 - .../pokemon_data_block_shuffle_12.h | 16 - .../pokemon_data_block_shuffle_13.h | 16 - .../pokemon_data_block_shuffle_14.h | 16 - .../pokemon_data_block_shuffle_15.h | 16 - .../pokemon_data_block_shuffle_16.h | 16 - .../pokemon_data_block_shuffle_17.h | 16 - .../pokemon_data_block_shuffle_18.h | 16 - .../pokemon_data_block_shuffle_19.h | 16 - .../pokemon_data_block_shuffle_2.h | 16 - .../pokemon_data_block_shuffle_20.h | 16 - .../pokemon_data_block_shuffle_21.h | 16 - .../pokemon_data_block_shuffle_22.h | 16 - .../pokemon_data_block_shuffle_23.h | 16 - .../pokemon_data_block_shuffle_3.h | 16 - .../pokemon_data_block_shuffle_4.h | 16 - .../pokemon_data_block_shuffle_5.h | 16 - .../pokemon_data_block_shuffle_6.h | 16 - .../pokemon_data_block_shuffle_7.h | 16 - .../pokemon_data_block_shuffle_8.h | 16 - .../pokemon_data_block_shuffle_9.h | 16 - include/struct_defs/pokemon_personal_data.h | 8 +- src/overlay005/ov5_021E622C.c | 4 +- src/overlay013/ov13_0221FC20.c | 4 +- src/overlay014/ov14_0221FC20.c | 2 +- src/overlay016/ov16_0223DF00.c | 8 +- src/overlay016/ov16_0225177C.c | 4 +- src/overlay104/ov104_022361B4.c | 32 +- src/overlay107/ov107_02241AE0.c | 8 +- src/pokemon.c | 1184 +++++------------ src/unk_0207E0B8.c | 2 +- src/unk_02084B70.c | 2 +- src/unk_0208C324.c | 2 +- src/unk_02096420.c | 6 +- 42 files changed, 373 insertions(+), 1325 deletions(-) delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_0.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_1.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_10.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_11.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_12.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_13.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_14.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_15.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_16.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_17.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_18.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_19.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_2.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_20.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_21.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_22.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_23.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_3.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_4.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_5.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_6.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_7.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_8.h delete mode 100644 include/struct_defs/pokemon_data_block_shuffle_9.h diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 56bd1764f1..9d0cbf0137 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -85,10 +85,10 @@ enum { MON_DATA_MOVE2, MON_DATA_MOVE3, MON_DATA_MOVE4, - MON_DATA_MOVE1_PP, - MON_DATA_MOVE2_PP, - MON_DATA_MOVE3_PP, - MON_DATA_MOVE4_PP, + MON_DATA_MOVE1_CUR_PP, + MON_DATA_MOVE2_CUR_PP, + MON_DATA_MOVE3_CUR_PP, + MON_DATA_MOVE4_CUR_PP, MON_DATA_MOVE1_PP_UPS, MON_DATA_MOVE2_PP_UPS, MON_DATA_MOVE3_PP_UPS, @@ -239,10 +239,10 @@ enum { MON_DATA_PERSONAL_GREAT_MARSH_FLEE_RATE, MON_DATA_PERSONAL_COLOR, MON_DATA_PERSONAL_INVERSE, - MON_DATA_PERSONAL_UNK_1C, - MON_DATA_PERSONAL_UNK_20, - MON_DATA_PERSONAL_UNK_24, - MON_DATA_PERSONAL_UNK_28, + MON_DATA_PERSONAL_TM_LEARNSET_MASK_1, + MON_DATA_PERSONAL_TM_LEARNSET_MASK_2, + MON_DATA_PERSONAL_TM_LEARNSET_MASK_3, + MON_DATA_PERSONAL_TM_LEARNSET_MASK_4, }; #endif // POKEPLATINUM_CONSTANTS_POKEMON_H diff --git a/include/pokemon.h b/include/pokemon.h index 7f36888595..a093b05d87 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -664,7 +664,7 @@ void SetBoxShayminForm(BoxPokemon *boxMon, int monForm); * @param mon * @return Whether Shaymin is allowed to change into Sky Form */ -BOOL AllowShayminSkyForm(Pokemon *mon); +BOOL CanShayminSkyForm(Pokemon *mon); /** * @brief Iterates over all the Pokemon in Party, setting the form of any Shaymin to land form. @@ -687,7 +687,7 @@ BOOL SetPartyShayminForm(Party *party, int param1, const RTCTime *rtcTime); /** * @brief Sets Rotom to the given form. Has no effect if the given Pokemon is not a Rotom - * If Rotom should learn a form specific move and there is no room, overwrites moveSlot with the new move + * If Rotom should learn a form specific move and there is no room, overwrites moveSlot with the new move * * @param mon * @param monForm @@ -713,9 +713,9 @@ void sub_02077EA4(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokebal void sub_02077EE4(Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); void sub_02077EF8(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); void sub_02077F0C(Pokemon *mon, u32 param1, int param2); -BOOL sub_02077FB4(Pokemon *mon, u8 param1); -BOOL sub_02077FBC(BoxPokemon *boxMon, u8 param1); -BOOL sub_02077FE4(u16 monSpecies, int monForm, u8 tmID); +BOOL CanMonLearnTM(Pokemon *mon, u8 tmID); +BOOL CanBoxMonLearnTM(BoxPokemon *boxMon, u8 tmID); +BOOL CanMonSpeciesLearnTM(u16 monSpecies, int monForm, u8 tmID); /** * @brief Sets the ability of a Pokemon based on its species, form and peronsality value diff --git a/include/struct_defs/box_pokemon.h b/include/struct_defs/box_pokemon.h index 51a5782fbc..2bd1f1b301 100644 --- a/include/struct_defs/box_pokemon.h +++ b/include/struct_defs/box_pokemon.h @@ -6,20 +6,24 @@ #include "struct_defs/pokemon_data_block_d.h" #include "struct_defs/pokemon_data_block_a.h" +typedef union { + PokemonDataBlockA blockA; + PokemonDataBlockB blockB; + PokemonDataBlockC blockC; + PokemonDataBlockD blockD; +} PokemonDataBlock; + /** * @brief Boxed Pokemon data structure */ -typedef struct { +typedef struct BoxPokemon { u32 personality; //!< The personality value of the pokemon u16 partyDecrypted : 1; //!< Whether the pokemons party data is currently decrypted u16 boxDecrypted : 1; //!< Whether the pokemons boxed data is currently decrypted u16 invalidData : 1; //!< Set if the pokemons data is invalid (failed checksum). This will make the mon appear as a Bad Egg in game u16 unk_04_3 : 13; u16 checksum; //!< Checksum for the pokemons data - u8 dataBlocks[sizeof(PokemonDataBlockA) - + sizeof(PokemonDataBlockB) - + sizeof(PokemonDataBlockC) - + sizeof(PokemonDataBlockD)]; //!< Data blocks containing the pokemons boxed data, stored encrypted + PokemonDataBlock dataBlocks[4]; //!< Data blocks containing the pokemons boxed data, stored encrypted } BoxPokemon; #endif // POKEPLATINUM_BOX_POKEMON_H diff --git a/include/struct_defs/pokemon.h b/include/struct_defs/pokemon.h index ab5345a985..62277dda48 100644 --- a/include/struct_defs/pokemon.h +++ b/include/struct_defs/pokemon.h @@ -7,7 +7,7 @@ /** * @brief The main Pokemon data structure */ -typedef struct { +typedef struct Pokemon { BoxPokemon box; //!< Contains the pokemons boxed data PartyPokemon party; //!< Contains the pokemons extra data while it is in the players party } Pokemon; diff --git a/include/struct_defs/pokemon_data_block_b.h b/include/struct_defs/pokemon_data_block_b.h index 570507c909..356780f0c5 100644 --- a/include/struct_defs/pokemon_data_block_b.h +++ b/include/struct_defs/pokemon_data_block_b.h @@ -5,9 +5,9 @@ * @brief Block B of the BoxPokemon data structure */ typedef struct PokemonDataBlockB { - u16 unk_00[4]; - u8 unk_08[4]; - u8 unk_0C[4]; + u16 moves[4]; //!< The ID of each move the pokemon knows + u8 moveCurrentPPs[4]; //!< The current PP of each move + u8 movePPUps[4]; //!< The number of PP Ups used on each move u32 hpIV : 5; //!< The pokemons HP IVs u32 atkIV : 5; //!< The pokemons Attack IVs u32 defIV : 5; //!< The pokemons Defense IVs diff --git a/include/struct_defs/pokemon_data_block_shuffle_0.h b/include/struct_defs/pokemon_data_block_shuffle_0.h deleted file mode 100644 index 10565bd548..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_0.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_H -#define POKEPLATINUM_STRUCT_0207825C_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlocksShuffle0 { - PokemonDataBlockA dataBlockA; - PokemonDataBlockB dataBlockB; - PokemonDataBlockC dataBlockC; - PokemonDataBlockD dataBlockD; -} PokemonDataBlocksShuffle0; - -#endif // POKEPLATINUM_STRUCT_0207825C_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_1.h b/include/struct_defs/pokemon_data_block_shuffle_1.h deleted file mode 100644 index bb957c09d3..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_1.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_1_H -#define POKEPLATINUM_STRUCT_0207825C_1_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle1 { - PokemonDataBlockA dataBlockA; - PokemonDataBlockB dataBlockB; - PokemonDataBlockD dataBlockD; - PokemonDataBlockC dataBlockC; -} PokemonDataBlockShuffle1; - -#endif // POKEPLATINUM_STRUCT_0207825C_1_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_10.h b/include/struct_defs/pokemon_data_block_shuffle_10.h deleted file mode 100644 index 89ca560b37..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_10.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_10_H -#define POKEPLATINUM_STRUCT_0207825C_10_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle10 { - PokemonDataBlockB dataBlockB; - PokemonDataBlockD dataBlockD; - PokemonDataBlockA dataBlockA; - PokemonDataBlockC dataBlockC; -} PokemonDataBlockShuffle10; - -#endif // POKEPLATINUM_STRUCT_0207825C_10_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_11.h b/include/struct_defs/pokemon_data_block_shuffle_11.h deleted file mode 100644 index 2c86be02a5..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_11.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_11_H -#define POKEPLATINUM_STRUCT_0207825C_11_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle11 { - PokemonDataBlockB dataBlockB; - PokemonDataBlockD dataBlockD; - PokemonDataBlockC dataBlockC; - PokemonDataBlockA dataBlockA; -} PokemonDataBlockShuffle11; - -#endif // POKEPLATINUM_STRUCT_0207825C_11_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_12.h b/include/struct_defs/pokemon_data_block_shuffle_12.h deleted file mode 100644 index 6ca248d472..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_12.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_12_H -#define POKEPLATINUM_STRUCT_0207825C_12_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle12 { - PokemonDataBlockC dataBlockC; - PokemonDataBlockA dataBlockA; - PokemonDataBlockB dataBlockB; - PokemonDataBlockD dataBlockD; -} PokemonDataBlockShuffle12; - -#endif // POKEPLATINUM_STRUCT_0207825C_12_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_13.h b/include/struct_defs/pokemon_data_block_shuffle_13.h deleted file mode 100644 index e07a2fed2a..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_13.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_13_H -#define POKEPLATINUM_STRUCT_0207825C_13_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle13 { - PokemonDataBlockC dataBlockC; - PokemonDataBlockA dataBlockA; - PokemonDataBlockD dataBlockD; - PokemonDataBlockB dataBlockB; -} PokemonDataBlockShuffle13; - -#endif // POKEPLATINUM_STRUCT_0207825C_13_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_14.h b/include/struct_defs/pokemon_data_block_shuffle_14.h deleted file mode 100644 index 96562f51de..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_14.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_14_H -#define POKEPLATINUM_STRUCT_0207825C_14_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle14 { - PokemonDataBlockC dataBlockC; - PokemonDataBlockB dataBlockB; - PokemonDataBlockA dataBlockA; - PokemonDataBlockD dataBlockD; -} PokemonDataBlockShuffle14; - -#endif // POKEPLATINUM_STRUCT_0207825C_14_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_15.h b/include/struct_defs/pokemon_data_block_shuffle_15.h deleted file mode 100644 index c6a80ed5fe..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_15.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_15_H -#define POKEPLATINUM_STRUCT_0207825C_15_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle15 { - PokemonDataBlockC dataBlockC; - PokemonDataBlockB dataBlockB; - PokemonDataBlockD dataBlockD; - PokemonDataBlockA dataBlockA; -} PokemonDataBlockShuffle15; - -#endif // POKEPLATINUM_STRUCT_0207825C_15_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_16.h b/include/struct_defs/pokemon_data_block_shuffle_16.h deleted file mode 100644 index a98f2bc225..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_16.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_16_H -#define POKEPLATINUM_STRUCT_0207825C_16_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle16 { - PokemonDataBlockC dataBlockC; - PokemonDataBlockD dataBlockD; - PokemonDataBlockA dataBlockA; - PokemonDataBlockB dataBlockB; -} PokemonDataBlockShuffle16; - -#endif // POKEPLATINUM_STRUCT_0207825C_16_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_17.h b/include/struct_defs/pokemon_data_block_shuffle_17.h deleted file mode 100644 index 086ae99c96..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_17.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_17_H -#define POKEPLATINUM_STRUCT_0207825C_17_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle17 { - PokemonDataBlockC dataBlockC; - PokemonDataBlockD dataBlockD; - PokemonDataBlockB dataBlockB; - PokemonDataBlockA dataBlockA; -} PokemonDataBlockShuffle17; - -#endif // POKEPLATINUM_STRUCT_0207825C_17_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_18.h b/include/struct_defs/pokemon_data_block_shuffle_18.h deleted file mode 100644 index 508c685334..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_18.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_18_H -#define POKEPLATINUM_STRUCT_0207825C_18_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle18 { - PokemonDataBlockD dataBlockD; - PokemonDataBlockA dataBlockA; - PokemonDataBlockB dataBlockB; - PokemonDataBlockC dataBlockC; -} PokemonDataBlockShuffle18; - -#endif // POKEPLATINUM_STRUCT_0207825C_18_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_19.h b/include/struct_defs/pokemon_data_block_shuffle_19.h deleted file mode 100644 index 4f49a550ba..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_19.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_19_H -#define POKEPLATINUM_STRUCT_0207825C_19_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle19 { - PokemonDataBlockD dataBlockD; - PokemonDataBlockA dataBlockA; - PokemonDataBlockC dataBlockC; - PokemonDataBlockB dataBlockB; -} PokemonDataBlockShuffle19; - -#endif // POKEPLATINUM_STRUCT_0207825C_19_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_2.h b/include/struct_defs/pokemon_data_block_shuffle_2.h deleted file mode 100644 index 010b6955ec..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_2.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_2_H -#define POKEPLATINUM_STRUCT_0207825C_2_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle2 { - PokemonDataBlockA dataBlockA; - PokemonDataBlockC dataBlockC; - PokemonDataBlockB dataBlockB; - PokemonDataBlockD dataBlockD; -} PokemonDataBlockShuffle2; - -#endif // POKEPLATINUM_STRUCT_0207825C_2_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_20.h b/include/struct_defs/pokemon_data_block_shuffle_20.h deleted file mode 100644 index 868470cf9e..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_20.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_20_H -#define POKEPLATINUM_STRUCT_0207825C_20_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle20 { - PokemonDataBlockD dataBlockD; - PokemonDataBlockB dataBlockB; - PokemonDataBlockA dataBlockA; - PokemonDataBlockC dataBlockC; -} PokemonDataBlockShuffle20; - -#endif // POKEPLATINUM_STRUCT_0207825C_20_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_21.h b/include/struct_defs/pokemon_data_block_shuffle_21.h deleted file mode 100644 index f50606d38e..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_21.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_21_H -#define POKEPLATINUM_STRUCT_0207825C_21_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle21 { - PokemonDataBlockD dataBlockD; - PokemonDataBlockB dataBlockB; - PokemonDataBlockC dataBlockC; - PokemonDataBlockA dataBlockA; -} PokemonDataBlockShuffle21; - -#endif // POKEPLATINUM_STRUCT_0207825C_21_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_22.h b/include/struct_defs/pokemon_data_block_shuffle_22.h deleted file mode 100644 index fe4e41d1cf..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_22.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_22_H -#define POKEPLATINUM_STRUCT_0207825C_22_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle22 { - PokemonDataBlockD dataBlockD; - PokemonDataBlockC dataBlockC; - PokemonDataBlockA dataBlockA; - PokemonDataBlockB dataBlockB; -} PokemonDataBlockShuffle22; - -#endif // POKEPLATINUM_STRUCT_0207825C_22_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_23.h b/include/struct_defs/pokemon_data_block_shuffle_23.h deleted file mode 100644 index 3ec7826565..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_23.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_23_H -#define POKEPLATINUM_STRUCT_0207825C_23_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle23 { - PokemonDataBlockD dataBlockD; - PokemonDataBlockC dataBlockC; - PokemonDataBlockB dataBlockB; - PokemonDataBlockA dataBlockA; -} PokemonDataBlockShuffle23; - -#endif // POKEPLATINUM_STRUCT_0207825C_23_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_3.h b/include/struct_defs/pokemon_data_block_shuffle_3.h deleted file mode 100644 index d9dca0e99f..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_3.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_3_H -#define POKEPLATINUM_STRUCT_0207825C_3_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle3 { - PokemonDataBlockA dataBlockA; - PokemonDataBlockC dataBlockC; - PokemonDataBlockD dataBlockD; - PokemonDataBlockB dataBlockB; -} PokemonDataBlockShuffle3; - -#endif // POKEPLATINUM_STRUCT_0207825C_3_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_4.h b/include/struct_defs/pokemon_data_block_shuffle_4.h deleted file mode 100644 index 1dc4ee8cb5..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_4.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_4_H -#define POKEPLATINUM_STRUCT_0207825C_4_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle4 { - PokemonDataBlockA dataBlockA; - PokemonDataBlockD dataBlockD; - PokemonDataBlockB dataBlockB; - PokemonDataBlockC dataBlockC; -} PokemonDataBlockShuffle4; - -#endif // POKEPLATINUM_STRUCT_0207825C_4_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_5.h b/include/struct_defs/pokemon_data_block_shuffle_5.h deleted file mode 100644 index 7f2905a6fc..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_5.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_5_H -#define POKEPLATINUM_STRUCT_0207825C_5_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle5 { - PokemonDataBlockA dataBlockA; - PokemonDataBlockD dataBlockD; - PokemonDataBlockC dataBlockC; - PokemonDataBlockB dataBlockB; -} PokemonDataBlockShuffle5; - -#endif // POKEPLATINUM_STRUCT_0207825C_5_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_6.h b/include/struct_defs/pokemon_data_block_shuffle_6.h deleted file mode 100644 index ca94f709b5..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_6.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_6_H -#define POKEPLATINUM_STRUCT_0207825C_6_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle6 { - PokemonDataBlockB dataBlockB; - PokemonDataBlockA dataBlockA; - PokemonDataBlockC dataBlockC; - PokemonDataBlockD dataBlockD; -} PokemonDataBlockShuffle6; - -#endif // POKEPLATINUM_STRUCT_0207825C_6_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_7.h b/include/struct_defs/pokemon_data_block_shuffle_7.h deleted file mode 100644 index 7a671a6354..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_7.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_7_H -#define POKEPLATINUM_STRUCT_0207825C_7_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle7 { - PokemonDataBlockB dataBlockB; - PokemonDataBlockA dataBlockA; - PokemonDataBlockD dataBlockD; - PokemonDataBlockC dataBlockC; -} PokemonDataBlockShuffle7; - -#endif // POKEPLATINUM_STRUCT_0207825C_7_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_8.h b/include/struct_defs/pokemon_data_block_shuffle_8.h deleted file mode 100644 index 381edca876..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_8.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_8_H -#define POKEPLATINUM_STRUCT_0207825C_8_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle8 { - PokemonDataBlockB dataBlockB; - PokemonDataBlockC dataBlockC; - PokemonDataBlockA dataBlockA; - PokemonDataBlockD dataBlockD; -} PokemonDataBlockShuffle8; - -#endif // POKEPLATINUM_STRUCT_0207825C_8_H diff --git a/include/struct_defs/pokemon_data_block_shuffle_9.h b/include/struct_defs/pokemon_data_block_shuffle_9.h deleted file mode 100644 index 66c0074567..0000000000 --- a/include/struct_defs/pokemon_data_block_shuffle_9.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207825C_9_H -#define POKEPLATINUM_STRUCT_0207825C_9_H - -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" - -typedef struct PokemonDataBlockShuffle9 { - PokemonDataBlockB dataBlockB; - PokemonDataBlockC dataBlockC; - PokemonDataBlockD dataBlockD; - PokemonDataBlockA dataBlockA; -} PokemonDataBlockShuffle9; - -#endif // POKEPLATINUM_STRUCT_0207825C_9_H diff --git a/include/struct_defs/pokemon_personal_data.h b/include/struct_defs/pokemon_personal_data.h index e46b09c13d..ee685ec380 100644 --- a/include/struct_defs/pokemon_personal_data.h +++ b/include/struct_defs/pokemon_personal_data.h @@ -35,10 +35,10 @@ typedef struct PokemonPersonalData { u8 greatMarshFleeRate; //!< The pokemons base flee rate in the Great Marsh safari zone u8 color : 7; //!< The pokemons color category u8 inverse : 1; - u32 unk_1C; - u32 unk_20; - u32 unk_24; - u32 unk_28; + u32 tmLearnsetMask1; + u32 tmLearnsetMask2; + u32 tmLearnsetMask3; + u32 tmLearnsetMask4; } PokemonPersonalData; #endif // POKEPLATINUM_STRUCT_02075874_H diff --git a/src/overlay005/ov5_021E622C.c b/src/overlay005/ov5_021E622C.c index 09edcb330d..848d855dda 100644 --- a/src/overlay005/ov5_021E622C.c +++ b/src/overlay005/ov5_021E622C.c @@ -2442,7 +2442,7 @@ static void ov5_021E6948 (Pokemon * param0, BoxPokemon * param1, BoxPokemon * pa if (v7->unk_00[v0] != 0) { for (v1 = 0; v1 < 100; v1++) { if (v7->unk_00[v0] == Item_MoveForTMHM(328 + v1)) { - if (sub_02077FE4(v3, v6, v1)) { + if (CanMonSpeciesLearnTM(v3, v6, v1)) { if (AddMonMove(param0, v7->unk_00[v0]) == 0xffff) { ReplaceMonMove(param0, v7->unk_00[v0]); } @@ -3042,7 +3042,7 @@ static void ov5_021E742C (Pokemon * param0, int param1) for (v7 = 0; v7 < 4; v7++) { v1[v7] = GetMonData(param0, MON_DATA_MOVE1 + v7, NULL); - v2[v7] = GetMonData(param0, MON_DATA_MOVE1_PP + v7, NULL); + v2[v7] = GetMonData(param0, MON_DATA_MOVE1_CUR_PP + v7, NULL); } v3 = GetMonData(param0, MON_DATA_PERSONALITY, NULL); diff --git a/src/overlay013/ov13_0221FC20.c b/src/overlay013/ov13_0221FC20.c index d3e663edc0..0253a0b22f 100644 --- a/src/overlay013/ov13_0221FC20.c +++ b/src/overlay013/ov13_0221FC20.c @@ -954,7 +954,7 @@ static u8 ov13_02220A4C (UnkStruct_ov13_022213F0 * param0) continue; } - param0->unk_207C[v1] = (u16)GetMonData(param0->unk_04[v0->unk_11].unk_00, MON_DATA_MOVE1_PP + v1, NULL); + param0->unk_207C[v1] = (u16)GetMonData(param0->unk_04[v0->unk_11].unk_00, MON_DATA_MOVE1_CUR_PP + v1, NULL); } ov13_02224144(param0); @@ -1260,7 +1260,7 @@ static void ov13_02220F98 (UnkStruct_ov13_022213F0 * param0) continue; } - v2->unk_02 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_MOVE1_PP + v1, NULL); + v2->unk_02 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_MOVE1_CUR_PP + v1, NULL); v2->unk_03 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_MOVE1_PP_UPS + v1, NULL); v2->unk_03 = MoveTable_CalcMaxPP(v2->unk_00, v2->unk_03); v2->unk_04 = MoveTable_LoadParam(v2->unk_00, MOVEATTRIBUTE_TYPE); diff --git a/src/overlay014/ov14_0221FC20.c b/src/overlay014/ov14_0221FC20.c index be6b87a59c..1aaff92c20 100644 --- a/src/overlay014/ov14_0221FC20.c +++ b/src/overlay014/ov14_0221FC20.c @@ -2262,7 +2262,7 @@ static void ov14_02221E18 (BattleSystem * param0, BattleContext * param1) if (v3 != param1->selectedPartySlot[v0]) { for (v4 = 0; v4 < 4; v4++) { - if (GetMonData(v5, MON_DATA_MOVE1_PP + v4, NULL) != GetMonData(v5, MON_DATA_MOVE1_MAX_PP + v4, NULL)) { + if (GetMonData(v5, MON_DATA_MOVE1_CUR_PP + v4, NULL) != GetMonData(v5, MON_DATA_MOVE1_MAX_PP + v4, NULL)) { ov14_02222D24(param1, v2); break; } diff --git a/src/overlay016/ov16_0223DF00.c b/src/overlay016/ov16_0223DF00.c index 66524f62b5..be530a234a 100644 --- a/src/overlay016/ov16_0223DF00.c +++ b/src/overlay016/ov16_0223DF00.c @@ -780,8 +780,8 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i if (Item_LoadParam(param4, 36, 5)) { v3 = Item_LoadParam(param4, 55, 5); - if (GetMonData(v1, MON_DATA_MOVE1_PP + param3, NULL) != GetMonData(v1, MON_DATA_MOVE1_MAX_PP + param3, NULL)) { - IncreaseMonData(v1, MON_DATA_MOVE1_PP + param3, v3); + if (GetMonData(v1, MON_DATA_MOVE1_CUR_PP + param3, NULL) != GetMonData(v1, MON_DATA_MOVE1_MAX_PP + param3, NULL)) { + IncreaseMonData(v1, MON_DATA_MOVE1_CUR_PP + param3, v3); if ((v4 == param2) || (v5 == param2)) { if (((ov16_02252060(v0, param1, 53, NULL) & 0x200000) == 0) && ((ov16_02252060(v0, param1, 75, NULL) & GetSingleBitMask(param3)) == 0)) { @@ -797,8 +797,8 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i v3 = Item_LoadParam(param4, 55, 5); for (param3 = 0; param3 < 4; param3++) { - if (GetMonData(v1, MON_DATA_MOVE1_PP + param3, NULL) != GetMonData(v1, MON_DATA_MOVE1_MAX_PP + param3, NULL)) { - IncreaseMonData(v1, MON_DATA_MOVE1_PP + param3, v3); + if (GetMonData(v1, MON_DATA_MOVE1_CUR_PP + param3, NULL) != GetMonData(v1, MON_DATA_MOVE1_MAX_PP + param3, NULL)) { + IncreaseMonData(v1, MON_DATA_MOVE1_CUR_PP + param3, v3); if ((v4 == param2) || (v5 == param2)) { if (((ov16_02252060(v0, param1, 53, NULL) & 0x200000) == 0) && ((ov16_02252060(v0, param1, 75, NULL) & GetSingleBitMask(param3)) == 0)) { diff --git a/src/overlay016/ov16_0225177C.c b/src/overlay016/ov16_0225177C.c index da34fd0b12..d0e0d9cd36 100644 --- a/src/overlay016/ov16_0225177C.c +++ b/src/overlay016/ov16_0225177C.c @@ -200,7 +200,7 @@ void BattleSystem_InitBattleMon (BattleSystem *battleSys, BattleContext *battleC for (v1 = 0; v1 < 4; v1++) { battleCtx->battleMons[battler].moves[v1] = GetMonData(v0, MON_DATA_MOVE1 + v1, 0); - battleCtx->battleMons[battler].ppCur[v1] = GetMonData(v0, MON_DATA_MOVE1_PP + v1, 0); + battleCtx->battleMons[battler].ppCur[v1] = GetMonData(v0, MON_DATA_MOVE1_CUR_PP + v1, 0); battleCtx->battleMons[battler].ppUps[v1] = GetMonData(v0, MON_DATA_MOVE1_PP_UPS + v1, 0); } @@ -307,7 +307,7 @@ void ov16_02251C94 (BattleSystem * param0, BattleContext * param1, int param2, i for (v1 = 0; v1 < 4; v1++) { if ((param1->battleMons[param2].moveEffectsData.mimickedMoveSlot & GetSingleBitMask(v1)) == 0) { param1->battleMons[param2].moves[v1] = GetMonData(v0, MON_DATA_MOVE1 + v1, 0); - param1->battleMons[param2].ppCur[v1] = GetMonData(v0, MON_DATA_MOVE1_PP + v1, 0); + param1->battleMons[param2].ppCur[v1] = GetMonData(v0, MON_DATA_MOVE1_CUR_PP + v1, 0); param1->battleMons[param2].ppUps[v1] = GetMonData(v0, MON_DATA_MOVE1_PP_UPS + v1, 0); } } diff --git a/src/overlay104/ov104_022361B4.c b/src/overlay104/ov104_022361B4.c index b386ad979a..1a17d9768c 100644 --- a/src/overlay104/ov104_022361B4.c +++ b/src/overlay104/ov104_022361B4.c @@ -190,10 +190,10 @@ static void ov104_02236528 (UnkStruct_ov104_0223BA10 * param0) for (v1 = 0; v1 < v0; v1++) { v3 = Party_GetPokemonBySlotIndex(param0->unk_28, v1); - param0->unk_394[v1][0] = GetMonData(v3, MON_DATA_MOVE1_PP, NULL); - param0->unk_394[v1][1] = GetMonData(v3, MON_DATA_MOVE2_PP, NULL); - param0->unk_394[v1][2] = GetMonData(v3, MON_DATA_MOVE3_PP, NULL); - param0->unk_394[v1][3] = GetMonData(v3, MON_DATA_MOVE4_PP, NULL); + param0->unk_394[v1][0] = GetMonData(v3, MON_DATA_MOVE1_CUR_PP, NULL); + param0->unk_394[v1][1] = GetMonData(v3, MON_DATA_MOVE2_CUR_PP, NULL); + param0->unk_394[v1][2] = GetMonData(v3, MON_DATA_MOVE3_CUR_PP, NULL); + param0->unk_394[v1][3] = GetMonData(v3, MON_DATA_MOVE4_CUR_PP, NULL); } ov104_0223B760(param0->unk_10, ov104_0223BB60(param0), param0->unk_30, (7 * 2)); @@ -412,16 +412,16 @@ void ov104_02236848 (UnkStruct_ov104_0223BA10 * param0, u8 param1) v5[0] = GetMonData(v11, MON_DATA_CURRENT_HP, NULL); sub_02030308(param0->unk_08, 2, v0, 0, v5); - v4[0] = GetMonData(v11, MON_DATA_MOVE1_PP, NULL); + v4[0] = GetMonData(v11, MON_DATA_MOVE1_CUR_PP, NULL); sub_02030308(param0->unk_08, 3, v0, 0, v4); - v4[0] = GetMonData(v11, MON_DATA_MOVE2_PP, NULL); + v4[0] = GetMonData(v11, MON_DATA_MOVE2_CUR_PP, NULL); sub_02030308(param0->unk_08, 3, v0, 1, v4); - v4[0] = GetMonData(v11, MON_DATA_MOVE3_PP, NULL); + v4[0] = GetMonData(v11, MON_DATA_MOVE3_CUR_PP, NULL); sub_02030308(param0->unk_08, 3, v0, 2, v4); - v4[0] = GetMonData(v11, MON_DATA_MOVE4_PP, NULL); + v4[0] = GetMonData(v11, MON_DATA_MOVE4_CUR_PP, NULL); sub_02030308(param0->unk_08, 3, v0, 3, v4); v6[0] = GetMonData(v11, MON_DATA_160, NULL); @@ -536,10 +536,10 @@ void ov104_02236C50 (UnkStruct_ov104_0223BA10 * param0) for (v2 = v0; v2 < (v1 + v0); v2++) { v4 = Party_GetPokemonBySlotIndex(param0->unk_28, v2); - param0->unk_394[v2 - v0][0] = GetMonData(v4, MON_DATA_MOVE1_PP, NULL); - param0->unk_394[v2 - v0][1] = GetMonData(v4, MON_DATA_MOVE2_PP, NULL); - param0->unk_394[v2 - v0][2] = GetMonData(v4, MON_DATA_MOVE3_PP, NULL); - param0->unk_394[v2 - v0][3] = GetMonData(v4, MON_DATA_MOVE4_PP, NULL); + param0->unk_394[v2 - v0][0] = GetMonData(v4, MON_DATA_MOVE1_CUR_PP, NULL); + param0->unk_394[v2 - v0][1] = GetMonData(v4, MON_DATA_MOVE2_CUR_PP, NULL); + param0->unk_394[v2 - v0][2] = GetMonData(v4, MON_DATA_MOVE3_CUR_PP, NULL); + param0->unk_394[v2 - v0][3] = GetMonData(v4, MON_DATA_MOVE4_CUR_PP, NULL); } ov104_0223BA24(param0->unk_28); @@ -609,10 +609,10 @@ int ov104_02236D10 (UnkStruct_ov104_0223BA10 * param0) param0->unk_12 = 1; } - v8 += GetMonData(v9, MON_DATA_MOVE1_PP, NULL); - v8 += GetMonData(v9, MON_DATA_MOVE2_PP, NULL); - v8 += GetMonData(v9, MON_DATA_MOVE3_PP, NULL); - v8 += GetMonData(v9, MON_DATA_MOVE4_PP, NULL); + v8 += GetMonData(v9, MON_DATA_MOVE1_CUR_PP, NULL); + v8 += GetMonData(v9, MON_DATA_MOVE2_CUR_PP, NULL); + v8 += GetMonData(v9, MON_DATA_MOVE3_CUR_PP, NULL); + v8 += GetMonData(v9, MON_DATA_MOVE4_CUR_PP, NULL); } for (v5 = 0; v5 < v1; v5++) { diff --git a/src/overlay107/ov107_02241AE0.c b/src/overlay107/ov107_02241AE0.c index fcb577922b..3844fb2347 100644 --- a/src/overlay107/ov107_02241AE0.c +++ b/src/overlay107/ov107_02241AE0.c @@ -3568,19 +3568,19 @@ static BOOL ov107_02245210 (Pokemon * param0) v0 = 0; - if (GetMonData(param0, MON_DATA_MOVE1_PP, NULL) != GetMonData(param0, MON_DATA_MOVE1_MAX_PP, NULL)) { + if (GetMonData(param0, MON_DATA_MOVE1_CUR_PP, NULL) != GetMonData(param0, MON_DATA_MOVE1_MAX_PP, NULL)) { v0 = 1; } - if (GetMonData(param0, MON_DATA_MOVE2_PP, NULL) != GetMonData(param0, MON_DATA_MOVE2_MAX_PP, NULL)) { + if (GetMonData(param0, MON_DATA_MOVE2_CUR_PP, NULL) != GetMonData(param0, MON_DATA_MOVE2_MAX_PP, NULL)) { v0 = 1; } - if (GetMonData(param0, MON_DATA_MOVE3_PP, NULL) != GetMonData(param0, MON_DATA_MOVE3_MAX_PP, NULL)) { + if (GetMonData(param0, MON_DATA_MOVE3_CUR_PP, NULL) != GetMonData(param0, MON_DATA_MOVE3_MAX_PP, NULL)) { v0 = 1; } - if (GetMonData(param0, MON_DATA_MOVE4_PP, NULL) != GetMonData(param0, MON_DATA_MOVE4_MAX_PP, NULL)) { + if (GetMonData(param0, MON_DATA_MOVE4_CUR_PP, NULL) != GetMonData(param0, MON_DATA_MOVE4_MAX_PP, NULL)) { v0 = 1; } diff --git a/src/pokemon.c b/src/pokemon.c index 75c1e60760..80ddb41afd 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -28,30 +28,6 @@ #include "struct_defs/pokemon_data_block_d.h" #include "struct_defs/pokemon_personal_data.h" #include "struct_defs/pokemon_evolution_data.h" -#include "struct_defs/pokemon_data_block_shuffle_0.h" -#include "struct_defs/pokemon_data_block_shuffle_1.h" -#include "struct_defs/pokemon_data_block_shuffle_10.h" -#include "struct_defs/pokemon_data_block_shuffle_11.h" -#include "struct_defs/pokemon_data_block_shuffle_12.h" -#include "struct_defs/pokemon_data_block_shuffle_13.h" -#include "struct_defs/pokemon_data_block_shuffle_14.h" -#include "struct_defs/pokemon_data_block_shuffle_15.h" -#include "struct_defs/pokemon_data_block_shuffle_16.h" -#include "struct_defs/pokemon_data_block_shuffle_17.h" -#include "struct_defs/pokemon_data_block_shuffle_18.h" -#include "struct_defs/pokemon_data_block_shuffle_19.h" -#include "struct_defs/pokemon_data_block_shuffle_2.h" -#include "struct_defs/pokemon_data_block_shuffle_20.h" -#include "struct_defs/pokemon_data_block_shuffle_21.h" -#include "struct_defs/pokemon_data_block_shuffle_22.h" -#include "struct_defs/pokemon_data_block_shuffle_23.h" -#include "struct_defs/pokemon_data_block_shuffle_3.h" -#include "struct_defs/pokemon_data_block_shuffle_4.h" -#include "struct_defs/pokemon_data_block_shuffle_5.h" -#include "struct_defs/pokemon_data_block_shuffle_6.h" -#include "struct_defs/pokemon_data_block_shuffle_7.h" -#include "struct_defs/pokemon_data_block_shuffle_8.h" -#include "struct_defs/pokemon_data_block_shuffle_9.h" #include "struct_defs/struct_020789BC.h" #include "struct_defs/struct_020789F4.h" #include "struct_defs/struct_02078B40.h" @@ -115,126 +91,14 @@ static const s8 Unk_020F0695[][5] = { { 0x0, 0x0, 0x0, 0x0, 0x0 }, }; -void ZeroMonData(Pokemon *mon); -void ZeroBoxMonData(BoxPokemon *boxMon); -int PokemonStructSize(void); -Pokemon * AllocMonZeroed(u32 heapID); -BOOL DecryptMon(Pokemon *mon); -BOOL EncryptMon(Pokemon *mon, BOOL encrypt); -BOOL DecryptBoxMon(BoxPokemon *boxMon); -BOOL EncryptBoxMon(BoxPokemon *boxMon, BOOL encrypt); -void sub_02073D80(Pokemon *mon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); -void sub_02073E18(BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); -void sub_02074044(Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monNature); -void sub_02074088(Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 param4, u8 param5, u8 param6); -u32 sub_02074128(u16 monSpecies, u8 param1, u8 param2); -void sub_02074158(Pokemon *mon, u16 monSpecies, u8 monLevel, u32 monCombinedIVs, u32 monPersonality); -void CalculateMonLevelAndStats(Pokemon *mon); -void CalculateMonStats(Pokemon *mon); -u32 GetMonData(Pokemon *mon, int monDataAttribute, void *dest); static u32 GetMonDataAttribute(Pokemon *mon, int monDataAttribute, void *dest); -u32 GetBoxMonData(BoxPokemon *boxMon, int monDataAttribute, void *dest); static u32 GetBoxMonDataAttribute(BoxPokemon *boxMon, int monDataAttribute, void *dest); -void SetMonData(Pokemon *mon, int monDataAttribute, const void *value); static void SetMonDataAttribute(Pokemon *mon, int monDataAttribute, const void *value); -void SetBoxMonData(BoxPokemon *boxMon, int monDataAttribute, const void *value); static void SetBoxMonDataAttribute(BoxPokemon *boxMon, int monDataAttribute, const void *value); -void IncreaseMonData(Pokemon *mon, int monDataAttribute, int value); static void IncreaseMonDataAttribute(Pokemon *mon, int monDataAttribute, int value); static void IncreaseBoxMonDataAttribute(BoxPokemon *boxMon, int monDataAttribute, int value); -u32 GetMonFormPersonalDataAttribute(int monSpecies, int monForm, int monPersonalDataAttribute); -u32 GetMonSpeciesPersonalDataAttribute(int monSpecies, int monPersonalDataAttribute); -u8 GetMonPercentToNextLevel(Pokemon *mon); -u32 GetMonExpToNextLevel(Pokemon *mon); -u32 GetBoxMonExpToNextLevel(BoxPokemon *boxMon); -u32 GetMonCurrentLevelExp(Pokemon *mon); -u32 GetMonSpeciesLevelExp(int monSpecies, int monLevel); -void LoadMonExperienceTable(int monExpRate, u32 *monExpTable); -u32 GetMonExpRateLevelExp(int monExpRate, int monLevel); -u32 GetMonLevel(Pokemon *mon); -u32 GetBoxMonLevel(BoxPokemon *boxMon); -u32 GetMonSpeciesLevel(u16 monSpecies, u32 monExp); -u8 GetMonNature(Pokemon *mon); -u8 GetBoxMonNature(BoxPokemon *boxMon); -u8 GetNatureFromPersonality(u32 monPersonality); -u16 GetNatureAdjustedStatValue(u8 monNature, u16 monStatValue, u8 statType); -s8 GetNatureStatAffinity(u8 monNature, u8 statType); -void sub_02075C74(Pokemon *mon, u8 param1, u16 param2); -u8 GetMonGender(Pokemon *mon); -u8 GetBoxMonGender(BoxPokemon *boxMon); -u8 GetMonPersonalityGender(u16 monSpecies, u32 monPersonality); -u8 GetMonShininess(Pokemon *mon); -u8 GetBoxMonShininess(BoxPokemon *boxMon); -u8 GetMonPersonalityShininess(u32 monOTID, u32 monPersonality); -u32 sub_02075E64(u32 param0); -void sub_02075EF4(UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2); -void sub_02075F0C(UnkStruct_02008A90 *param0, BoxPokemon *boxMon, u8 param2, int param3); -void sub_02075FB4(UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); -u8 SanitizeFormId(u16 monSpecies, u8 monForm); -u8 sub_020765AC(Pokemon *mon, u8 param1); -u8 sub_020765C4(BoxPokemon *boxMon, u8 param1, int param2); -u8 sub_02076648(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality); -void sub_0207697C(UnkStruct_02008A90 *param0, u16 param1); -UnkStruct_0200D0F4 * sub_02076994(UnkStruct_0200C6E4 *param0, UnkStruct_0200C704 *param1, UnkStruct_02002F38 *param2, int param3, int param4, int param5, int param6, int param7, int heapID); -void sub_02076AAC(int param0, int param1, UnkStruct_ov5_021DE5D0 *param2); -u32 GetPokemonStructSize(void); -u32 GetBoxPokemonStructSize(void); -u8 GetMonForm(Pokemon *mon); -u8 GetBoxMonForm(BoxPokemon *boxMon); -BoxPokemon * GetBoxMon(Pokemon *mon); -u8 sub_02076B14(Pokemon *mon); -u16 sub_02076B94(Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int *evoTypeResult); -void SetBoxMonDefaultMoves(BoxPokemon *boxMon); -u16 AddMonMove(Pokemon *mon, u16 moveID); -u16 AddBoxMonMove(BoxPokemon *boxMon, u16 moveID); -void ReplaceMonMove(Pokemon *mon, u16 moveID); -void ReplaceBoxMonMove(BoxPokemon *boxMon, u16 moveID); -void ResetMonMove(Pokemon *mon, u16 moveID, u8 moveSlot); -void SetMonMove(Pokemon *mon, u16 moveID, u8 moveSlot); -void SetBoxMonMove(BoxPokemon *boxMon, u16 moveID, u8 moveSlot); -u16 sub_0207727C(Pokemon *mon, int *index, u16 *moveID); -void SwapMonMoves(Pokemon *mon, int moveSlot1, int moveSlot2); -void SwapBoxMonMoves(BoxPokemon *boxMon, int moveSlot1, int moveSlot2); -void DeleteMonMove(Pokemon *mon, u32 moveSlot); -BOOL MonHasMove(Pokemon *mon, u16 moveID); -void sub_020774C8(BoxPokemon *boxMon, Pokemon *mon); -u8 GetPartyHighestLevel(Party *party); -u16 sub_020775A4(u16 param0); -u16 sub_020775C4(u16 param0); -void sub_020775EC(Pokemon *src, Pokemon *dest); -void sub_02077604(BoxPokemon *src, BoxPokemon *dest); -void sub_02077618(Pokemon *src, BoxPokemon *dest); -s8 sub_0207762C(Pokemon *mon, int param1); -s8 sub_02077634(BoxPokemon *boxMon, int param1); -s8 sub_02077648(u32 monPersonality, int param1); -void sub_020776B0(Party *party); -u8 sub_02077758(Party *party, u8 param1); -void sub_020777B4(Party *party, s32 param1); -void sub_0207782C(Party *party); -BOOL sub_020778D8(Pokemon *mon); -BOOL sub_020778E0(BoxPokemon *boxMon); -BOOL sub_020778F8(Pokemon *mon); -BOOL sub_02077900(BoxPokemon *boxMon); -void SetArceusForm(Pokemon *mon); -void SetBoxArceusForm(BoxPokemon *boxMon); -u8 GetArceusItemType(u16 itemHoldEffect); -int SetGiratinaForm(Pokemon *mon); -int SetBoxGiratinaForm(BoxPokemon *boxMon); -void SetShayminForm(Pokemon *mon, int monForm); -void SetBoxShayminForm(BoxPokemon *boxMon, int monForm); -void LoadMonLevelUpMoves(int monSpecies, int monForm, u16 *monLevelUpMoves); -void sub_02077D3C(UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7); -void sub_02077E64(Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); -void sub_02077EA4(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); -void sub_02077EE4(Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); -void sub_02077EF8(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); -void sub_02077F0C(Pokemon *mon, u32 param1, int param2); -BOOL sub_02077FB4(Pokemon *mon, u8 param1); -BOOL sub_02077FBC(BoxPokemon *boxMon, u8 param1); -BOOL sub_02077FE4(u16 monSpecies, int monForm, u8 tmID); -void CalculateMonAbility(Pokemon *mon); -void CalculateBoxMonAbility(BoxPokemon *boxMon); -void sub_020780C4(Pokemon *mon, u32 monPersonality); +static u32 GetMonExpRateLevelExp(int monExpRate, int monLevel); +static u16 GetNatureAdjustedStatValue(u8 monNature, u16 monStatValue, u8 statType); static void LoadMonPersonalData(int monSpecies, PokemonPersonalData *monPersonalData); static void LoadMonFormPersonalData(int monSpecies, int monForm, PokemonPersonalData *monPersonalData); static void LoadMonEvolutionData(int monSpecies, PokemonEvolutionData *monEvolutionData); @@ -243,25 +107,20 @@ static void DecryptMonData(void *data, u32 bytes, u32 seed); static u16 GetMonDataChecksum(void *data, u32 bytes); static void * GetBoxMonDataBlock(BoxPokemon *boxMon, u32 personality, u8 dataBlockID); static int GetMonFormNarcIndex(int monSpecies, int monForm); -u32 GetSingleBitMask(int index); -int GetLowestSetBitIndex(u32 num); -BOOL sub_02078804(u16 param0); -BOOL sub_02078838(Pokemon *mon); -int sub_020788D0(int param0); static void sub_02076300(UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); static u8 sub_020767BC(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality); void ZeroMonData (Pokemon *mon) { MI_CpuClearFast(mon, sizeof(Pokemon)); - EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); } void ZeroBoxMonData (BoxPokemon *boxMon) { MI_CpuClearFast(boxMon, sizeof(BoxPokemon)); - EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4, boxMon->checksum); + EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); } int PokemonStructSize (void) @@ -290,7 +149,7 @@ BOOL DecryptMon (Pokemon *mon) mon->box.boxDecrypted = 1; DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } return wasDecrypted; @@ -308,8 +167,8 @@ BOOL EncryptMon (Pokemon *mon, BOOL encrypt) mon->box.boxDecrypted = 0; EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4); - EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } return wasEncrypted; @@ -324,7 +183,7 @@ BOOL DecryptBoxMon (BoxPokemon *boxMon) if (boxMon->boxDecrypted == 0) { wasDecrypted = 1; boxMon->boxDecrypted = 1; - DecryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4, boxMon->checksum); + DecryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); } return wasDecrypted; @@ -340,9 +199,9 @@ BOOL EncryptBoxMon (BoxPokemon *boxMon, BOOL encrypt) wasEncrypted = 1; boxMon->boxDecrypted = 0; - boxMon->checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4); + boxMon->checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); - EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4, boxMon->checksum); + EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); } return wasEncrypted; @@ -356,10 +215,10 @@ void sub_02073D80 (Pokemon *mon, int monSpecies, int monLevel, int monIVs, int u ZeroMonData(mon); - sub_02073E18((BoxPokemon *)&mon->box, monSpecies, monLevel, monIVs, useMonPersonalityParam, monPersonality, monOTIDSource, monOTID); + sub_02073E18(&mon->box, monSpecies, monLevel, monIVs, useMonPersonalityParam, monPersonality, monOTIDSource, monOTID); EncryptMonData(&mon->party, sizeof(PartyPokemon), 0); EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - SetMonData(mon, MON_DATA_LEVEL, (u8 *)&monLevel); + SetMonData(mon, MON_DATA_LEVEL, &monLevel); v1 = sub_0202818C(0); @@ -367,17 +226,16 @@ void sub_02073D80 (Pokemon *mon, int monSpecies, int monLevel, int monIVs, int u Heap_FreeToHeap(v1); zero = 0; - SetMonData(mon, MON_DATA_162, (u8 *)&zero); + SetMonData(mon, MON_DATA_162, &zero); MI_CpuClearFast(&v2, sizeof(UnkStruct_0202CA28)); - SetMonData(mon, MON_DATA_171, (UnkStruct_0202CA28 *)&v2); + SetMonData(mon, MON_DATA_171, &v2); CalculateMonLevelAndStats(mon); } void sub_02073E18 (BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) { - u16 unused_0; u32 v1, v2; BOOL reencrypt; @@ -389,7 +247,7 @@ void sub_02073E18 (BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, monPersonality = (LCRNG_Next() | (LCRNG_Next() << 16)); } - SetBoxMonData(boxMon, MON_DATA_PERSONALITY, (u8 *)&monPersonality); + SetBoxMonData(boxMon, MON_DATA_PERSONALITY, &monPersonality); if (monOTIDSource == 2) { do { @@ -399,50 +257,50 @@ void sub_02073E18 (BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, monOTID = 0; } - SetBoxMonData(boxMon, MON_DATA_OT_ID, (u8 *)&monOTID); - SetBoxMonData(boxMon, MON_DATA_LANGUAGE, (u8 *)&Unk_020E4C44); - SetBoxMonData(boxMon, MON_DATA_SPECIES, (u8 *)&monSpecies); + SetBoxMonData(boxMon, MON_DATA_OT_ID, &monOTID); + SetBoxMonData(boxMon, MON_DATA_LANGUAGE, &Unk_020E4C44); + SetBoxMonData(boxMon, MON_DATA_SPECIES, &monSpecies); SetBoxMonData(boxMon, MON_DATA_179, NULL); v1 = GetMonSpeciesLevelExp(monSpecies, monLevel); - SetBoxMonData(boxMon, MON_DATA_EXP, (u8 *)&v1); + SetBoxMonData(boxMon, MON_DATA_EXP, &v1); v1 = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_BASE_FRIENDSHIP); - SetBoxMonData(boxMon, MON_DATA_FRIENDSHIP, (u8 *)&v1); + SetBoxMonData(boxMon, MON_DATA_FRIENDSHIP, &v1); - SetBoxMonData(boxMon, MON_DATA_MET_LEVEL, (u8 *)&monLevel); - SetBoxMonData(boxMon, MON_DATA_MET_GAME, (u8 *)&Unk_020E4C40); + SetBoxMonData(boxMon, MON_DATA_MET_LEVEL, &monLevel); + SetBoxMonData(boxMon, MON_DATA_MET_GAME, &Unk_020E4C40); v1 = 4; - SetBoxMonData(boxMon, MON_DATA_POKEBALL, (u8 *)&v1); + SetBoxMonData(boxMon, MON_DATA_POKEBALL, &v1); if (monIVs < 32) { - SetBoxMonData(boxMon, MON_DATA_HP_IV, (u8 *)&monIVs); - SetBoxMonData(boxMon, MON_DATA_ATK_IV, (u8 *)&monIVs); - SetBoxMonData(boxMon, MON_DATA_DEF_IV, (u8 *)&monIVs); - SetBoxMonData(boxMon, MON_DATA_SPEED_IV, (u8 *)&monIVs); - SetBoxMonData(boxMon, MON_DATA_SPATK_IV, (u8 *)&monIVs); - SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, (u8 *)&monIVs); + SetBoxMonData(boxMon, MON_DATA_HP_IV, &monIVs); + SetBoxMonData(boxMon, MON_DATA_ATK_IV, &monIVs); + SetBoxMonData(boxMon, MON_DATA_DEF_IV, &monIVs); + SetBoxMonData(boxMon, MON_DATA_SPEED_IV, &monIVs); + SetBoxMonData(boxMon, MON_DATA_SPATK_IV, &monIVs); + SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &monIVs); } else { v1 = LCRNG_Next(); v2 = (v1 & (0x1f << 0)) >> 0; - SetBoxMonData(boxMon, MON_DATA_HP_IV, (u8 *)&v2); + SetBoxMonData(boxMon, MON_DATA_HP_IV, &v2); v2 = (v1 & (0x1f << 5)) >> 5; - SetBoxMonData(boxMon, MON_DATA_ATK_IV, (u8 *)&v2); + SetBoxMonData(boxMon, MON_DATA_ATK_IV, &v2); v2 = (v1 & (0x1f << 10)) >> 10; - SetBoxMonData(boxMon, MON_DATA_DEF_IV, (u8 *)&v2); + SetBoxMonData(boxMon, MON_DATA_DEF_IV, &v2); v1 = LCRNG_Next(); v2 = (v1 & (0x1f << 0)) >> 0; - SetBoxMonData(boxMon, MON_DATA_SPEED_IV, (u8 *)&v2); + SetBoxMonData(boxMon, MON_DATA_SPEED_IV, &v2); v2 = (v1 & (0x1f << 5)) >> 5; - SetBoxMonData(boxMon, MON_DATA_SPATK_IV, (u8 *)&v2); + SetBoxMonData(boxMon, MON_DATA_SPATK_IV, &v2); v2 = (v1 & (0x1f << 10)) >> 10; - SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, (u8 *)&v2); + SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &v2); } v1 = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_ABILITY_1); @@ -450,17 +308,17 @@ void sub_02073E18 (BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, if (v2 != 0) { if (monPersonality & 1) { - SetBoxMonData(boxMon, MON_DATA_ABILITY, (u8 *)&v2); + SetBoxMonData(boxMon, MON_DATA_ABILITY, &v2); } else { - SetBoxMonData(boxMon, MON_DATA_ABILITY, (u8 *)&v1); + SetBoxMonData(boxMon, MON_DATA_ABILITY, &v1); } } else { - SetBoxMonData(boxMon, MON_DATA_ABILITY, (u8 *)&v1); + SetBoxMonData(boxMon, MON_DATA_ABILITY, &v1); } v1 = GetBoxMonGender(boxMon); - SetBoxMonData(boxMon, MON_DATA_GENDER, (u8 *)&v1); + SetBoxMonData(boxMon, MON_DATA_GENDER, &v1); SetBoxMonDefaultMoves(boxMon); EncryptBoxMon(boxMon, reencrypt); } @@ -479,7 +337,6 @@ void sub_02074044 (Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monN void sub_02074088 (Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 param4, u8 param5, u8 param6) { u32 monPersonality; - u32 unused_0; u16 unownLetter; if ((param6) && (param6 < 29)) { @@ -523,7 +380,7 @@ u32 sub_02074128 (u16 monSpecies, u8 param1, u8 param2) void sub_02074158 (Pokemon *mon, u16 monSpecies, u8 monLevel, u32 monCombinedIVs, u32 monPersonality) { sub_02073D80(mon, monSpecies, monLevel, 0, 1, monPersonality, 0, 0); - SetMonData(mon, MON_DATA_COMBINED_IVS, (u8 *)&monCombinedIVs); + SetMonData(mon, MON_DATA_COMBINED_IVS, &monCombinedIVs); CalculateMonLevelAndStats(mon); } @@ -535,7 +392,7 @@ void CalculateMonLevelAndStats (Pokemon *mon) reencrypt = DecryptMon(mon); monLevel = GetMonLevel(mon); - SetMonData(mon, MON_DATA_LEVEL, (u8 *)&monLevel); + SetMonData(mon, MON_DATA_LEVEL, &monLevel); CalculateMonStats(mon); EncryptMon(mon, reencrypt); } @@ -549,7 +406,6 @@ void CalculateMonStats (Pokemon *mon) int monSpecies; int monLevel; int monForm; - int v23, v24, v25; PokemonPersonalData *monPersonalData; BOOL reencrypt; @@ -582,48 +438,46 @@ void CalculateMonStats (Pokemon *mon) newMaxHp = ((2 * monPersonalData->baseHp + monHpIV + monHpEV / 4) * monLevel / 100 + monLevel + 10); } - SetMonData(mon, MON_DATA_MAX_HP, (u8 *)&newMaxHp); + SetMonData(mon, MON_DATA_MAX_HP, &newMaxHp); newAtk = ((2 * monPersonalData->baseAtk + monAtkIV + monAtkEV / 4) * monLevel / 100 + 5); newAtk = GetNatureAdjustedStatValue(GetMonNature(mon), newAtk, 0x1); - SetMonData(mon, MON_DATA_ATK, (u8 *)&newAtk); + SetMonData(mon, MON_DATA_ATK, &newAtk); newDef = ((2 * monPersonalData->baseDef + monDefIV + monDefEV / 4) * monLevel / 100 + 5); newDef = GetNatureAdjustedStatValue(GetMonNature(mon), newDef, 0x2); - SetMonData(mon, MON_DATA_DEF, (u8 *)&newDef); + SetMonData(mon, MON_DATA_DEF, &newDef); newSpeed = ((2 * monPersonalData->baseSpeed + monSpeedIV + monSpeedEV / 4) * monLevel / 100 + 5); newSpeed = GetNatureAdjustedStatValue(GetMonNature(mon), newSpeed, 0x3); - SetMonData(mon, MON_DATA_SPEED, (u8 *)&newSpeed); + SetMonData(mon, MON_DATA_SPEED, &newSpeed); newSpAtk = ((2 * monPersonalData->baseSpAtk + monSpAtkIV + monSpAtkEV / 4) * monLevel / 100 + 5); newSpAtk = GetNatureAdjustedStatValue(GetMonNature(mon), newSpAtk, 0x4); - SetMonData(mon, MON_DATA_SP_ATK, (u8 *)&newSpAtk); + SetMonData(mon, MON_DATA_SP_ATK, &newSpAtk); newSpDef = ((2 * monPersonalData->baseSpDef + monSpDefIV + monSpDefEV / 4) * monLevel / 100 + 5); newSpDef = GetNatureAdjustedStatValue(GetMonNature(mon), newSpDef, 0x5); - SetMonData(mon, MON_DATA_SP_DEF, (u8 *)&newSpDef); + SetMonData(mon, MON_DATA_SP_DEF, &newSpDef); Heap_FreeToHeap(monPersonalData); - if ((monCurrentHp == 0) && (monMaxHp != 0)) { - (void)0; - } else { + if (monCurrentHp != 0 || monMaxHp == 0) { if (monSpecies == SPECIES_SHEDINJA) { monCurrentHp = 1; } else if (monCurrentHp == 0) { monCurrentHp = newMaxHp; } else { - monCurrentHp += (newMaxHp - monMaxHp); + monCurrentHp += newMaxHp - monMaxHp; } } if (monCurrentHp) { - SetMonData(mon, MON_DATA_CURRENT_HP, (u8 *)&monCurrentHp); + SetMonData(mon, MON_DATA_CURRENT_HP, &monCurrentHp); } EncryptMon(mon, reencrypt); @@ -636,9 +490,9 @@ u32 GetMonData (Pokemon *mon, int monDataAttribute, void *dest) if (mon->box.partyDecrypted == 0) { DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); - checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4); + checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != mon->box.checksum) { GF_ASSERT((checksum == mon->box.checksum)); @@ -650,7 +504,7 @@ u32 GetMonData (Pokemon *mon, int monDataAttribute, void *dest) if (mon->box.partyDecrypted == 0) { EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } return result; @@ -692,15 +546,15 @@ static u32 GetMonDataAttribute (Pokemon *mon, int monDataAttribute, void *dest) result = mon->party.unk_12; break; case MON_DATA_170: - sub_020281A0(&mon->party.unk_14, (UnkStruct_0202818C *)dest); + sub_020281A0(&mon->party.unk_14, dest); result = 1; break; case MON_DATA_171: - sub_0202CA10(&mon->party.unk_4C, (UnkStruct_0202CA28 *)dest); + sub_0202CA10(&mon->party.unk_4C, dest); result = 1; break; default: - result = GetBoxMonDataAttribute((BoxPokemon *)&mon->box, monDataAttribute, dest); + result = GetBoxMonDataAttribute(&mon->box, monDataAttribute, dest); break; } @@ -713,8 +567,8 @@ u32 GetBoxMonData (BoxPokemon *boxMon, int monDataAttribute, void *dest) u32 result; if (boxMon->boxDecrypted == 0) { - DecryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4, boxMon->checksum); - checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4); + DecryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); + checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != boxMon->checksum) { GF_ASSERT((checksum == boxMon->checksum)); @@ -725,7 +579,7 @@ u32 GetBoxMonData (BoxPokemon *boxMon, int monDataAttribute, void *dest) result = GetBoxMonDataAttribute(boxMon, monDataAttribute, dest); if (boxMon->boxDecrypted == 0) { - EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4, boxMon->checksum); + EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); } return result; @@ -740,10 +594,10 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi PokemonDataBlockC *monDataBlockC; PokemonDataBlockD *monDataBlockD; - monDataBlockA = (PokemonDataBlockA *)GetBoxMonDataBlock(boxMon, boxMon->personality, 0); - monDataBlockB = (PokemonDataBlockB *)GetBoxMonDataBlock(boxMon, boxMon->personality, 1); - monDataBlockC = (PokemonDataBlockC *)GetBoxMonDataBlock(boxMon, boxMon->personality, 2); - monDataBlockD = (PokemonDataBlockD *)GetBoxMonDataBlock(boxMon, boxMon->personality, 3); + monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); + monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); + monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); + monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); switch (monDataAttribute) { default: @@ -886,25 +740,25 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi case MON_DATA_MOVE2: case MON_DATA_MOVE3: case MON_DATA_MOVE4: - result = monDataBlockB->unk_00[monDataAttribute - MON_DATA_MOVE1]; + result = monDataBlockB->moves[monDataAttribute - MON_DATA_MOVE1]; break; - case MON_DATA_MOVE1_PP: - case MON_DATA_MOVE2_PP: - case MON_DATA_MOVE3_PP: - case MON_DATA_MOVE4_PP: - result = monDataBlockB->unk_08[monDataAttribute - MON_DATA_MOVE1_PP]; + case MON_DATA_MOVE1_CUR_PP: + case MON_DATA_MOVE2_CUR_PP: + case MON_DATA_MOVE3_CUR_PP: + case MON_DATA_MOVE4_CUR_PP: + result = monDataBlockB->moveCurrentPPs[monDataAttribute - MON_DATA_MOVE1_CUR_PP]; break; case MON_DATA_MOVE1_PP_UPS: case MON_DATA_MOVE2_PP_UPS: case MON_DATA_MOVE3_PP_UPS: case MON_DATA_MOVE4_PP_UPS: - result = monDataBlockB->unk_0C[monDataAttribute - MON_DATA_MOVE1_PP_UPS]; + result = monDataBlockB->movePPUps[monDataAttribute - MON_DATA_MOVE1_PP_UPS]; break; case MON_DATA_MOVE1_MAX_PP: case MON_DATA_MOVE2_MAX_PP: case MON_DATA_MOVE3_MAX_PP: case MON_DATA_MOVE4_MAX_PP: - result = MoveTable_CalcMaxPP(monDataBlockB->unk_00[monDataAttribute - MON_DATA_MOVE1_MAX_PP], monDataBlockB->unk_0C[monDataAttribute - MON_DATA_MOVE1_MAX_PP]); + result = MoveTable_CalcMaxPP(monDataBlockB->moves[monDataAttribute - MON_DATA_MOVE1_MAX_PP], monDataBlockB->movePPUps[monDataAttribute - MON_DATA_MOVE1_MAX_PP]); break; case MON_DATA_HP_IV: result = monDataBlockB->hpIV; @@ -975,7 +829,7 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi case MON_DATA_GENDER: result = GetMonPersonalityGender(monDataBlockA->species, boxMon->personality); monDataBlockB->gender = result; - boxMon->checksum = GetMonDataChecksum(&boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4); + boxMon->checksum = GetMonDataChecksum(&boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); break; case MON_DATA_FORM: result = monDataBlockB->form; @@ -990,27 +844,25 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi if (boxMon->invalidData) { MessageLoader_GetSpeciesName(495, 0, dest); } else { - { - u16 *v6 = dest; - - for (result = 0; result < 10; result++) { - v6[result] = monDataBlockC->unk_00[result]; - } + u16 *v6 = dest; - v6[result] = 0xffff; + for (result = 0; result < 10; result++) { + v6[result] = monDataBlockC->unk_00[result]; } + + v6[result] = 0xffff; } break; case MON_DATA_120: result = monDataBlockB->unk_10_31; case MON_DATA_119: if (boxMon->invalidData) { - Strbuf* strbuf = sub_0200B32C(495, 0); + Strbuf *strbuf = sub_0200B32C(495, 0); - Strbuf_Copy((Strbuf *)dest, strbuf); + Strbuf_Copy(dest, strbuf); Strbuf_Free(strbuf); } else { - Strbuf_CopyChars((Strbuf *)dest, monDataBlockC->unk_00); + Strbuf_CopyChars(dest, monDataBlockC->unk_00); } break; case MON_DATA_121: @@ -1044,7 +896,6 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi result = ((monDataBlockC->unk_18 & (v1 << monDataAttribute - MON_DATA_123)) != 0); break; case MON_DATA_144: - { u16 *v8 = dest; for (result = 0; result < 7; result++) { @@ -1053,9 +904,8 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi v8[result] = 0xffff; break; - } case MON_DATA_145: - Strbuf_CopyChars((Strbuf *)dest, monDataBlockD->unk_00); + Strbuf_CopyChars(dest, monDataBlockD->unk_00); break; case MON_DATA_146: result = monDataBlockD->unk_10; @@ -1141,13 +991,13 @@ void SetMonData (Pokemon *mon, int monDataAttribute, const void *value) if (mon->box.partyDecrypted == 0) { DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); - checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4); + DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != mon->box.checksum) { GF_ASSERT((checksum == mon->box.checksum)); mon->box.invalidData = 1; - EncryptMonData(mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + EncryptMonData(mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); return; } } @@ -1156,16 +1006,16 @@ void SetMonData (Pokemon *mon, int monDataAttribute, const void *value) if (mon->box.partyDecrypted == 0) { EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4); - EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } } static void SetMonDataAttribute (Pokemon *mon, int monDataAttribute, const void *value) { - u32 *u32Value = (u32 *)value; - u16 *u16Value = (u16 *)value; - u8 *u8Value = (u8 *)value; + u32 *u32Value = value; + u16 *u16Value = value; + u8 *u8Value = value; switch (monDataAttribute) { case MON_DATA_160: @@ -1199,13 +1049,13 @@ static void SetMonDataAttribute (Pokemon *mon, int monDataAttribute, const void mon->party.unk_12 = u16Value[0]; break; case MON_DATA_170: - sub_020281A0((UnkStruct_0202818C *)value, &mon->party.unk_14); + sub_020281A0(value, &mon->party.unk_14); break; case MON_DATA_171: - sub_0202CA10((UnkStruct_0202CA28 *)value, &mon->party.unk_4C); + sub_0202CA10(value, &mon->party.unk_4C); break; default: - SetBoxMonDataAttribute((BoxPokemon *)&mon->box, monDataAttribute, value); + SetBoxMonDataAttribute(&mon->box, monDataAttribute, value); break; } } @@ -1215,13 +1065,13 @@ void SetBoxMonData (BoxPokemon *boxMon, int monDataAttribute, const void *value) u16 checksum; if (boxMon->boxDecrypted == 0) { - DecryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4, boxMon->checksum); - checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4); + DecryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); + checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != boxMon->checksum) { GF_ASSERT((checksum == boxMon->checksum)); boxMon->invalidData = 1; - EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4, boxMon->checksum); + EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); return; } } @@ -1229,8 +1079,8 @@ void SetBoxMonData (BoxPokemon *boxMon, int monDataAttribute, const void *value) SetBoxMonDataAttribute(boxMon, monDataAttribute, value); if (boxMon->boxDecrypted == 0) { - boxMon->checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4); - EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlockA) * 4, boxMon->checksum); + boxMon->checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); + EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); } } @@ -1239,18 +1089,18 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, co int i; u64 v1; u16 v2; - u32 *u32Value = (u32 *)value; - u16 *u16Value = (u16 *)value; - u8 *u8Value = (u8 *)value; + u32 *u32Value = value; + u16 *u16Value = value; + u8 *u8Value = value; PokemonDataBlockA *monDataBlockA; PokemonDataBlockB *monDataBlockB; PokemonDataBlockC *monDataBlockC; PokemonDataBlockD *monDataBlockD; - monDataBlockA = (PokemonDataBlockA *)GetBoxMonDataBlock(boxMon, boxMon->personality, 0); - monDataBlockB = (PokemonDataBlockB *)GetBoxMonDataBlock(boxMon, boxMon->personality, 1); - monDataBlockC = (PokemonDataBlockC *)GetBoxMonDataBlock(boxMon, boxMon->personality, 2); - monDataBlockD = (PokemonDataBlockD *)GetBoxMonDataBlock(boxMon, boxMon->personality, 3); + monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); + monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); + monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); + monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); switch (monDataAttribute) { case MON_DATA_PERSONALITY: @@ -1371,19 +1221,19 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, co case MON_DATA_MOVE2: case MON_DATA_MOVE3: case MON_DATA_MOVE4: - monDataBlockB->unk_00[monDataAttribute - MON_DATA_MOVE1] = u16Value[0]; + monDataBlockB->moves[monDataAttribute - MON_DATA_MOVE1] = u16Value[0]; break; - case MON_DATA_MOVE1_PP: - case MON_DATA_MOVE2_PP: - case MON_DATA_MOVE3_PP: - case MON_DATA_MOVE4_PP: - monDataBlockB->unk_08[monDataAttribute - MON_DATA_MOVE1_PP] = u8Value[0]; + case MON_DATA_MOVE1_CUR_PP: + case MON_DATA_MOVE2_CUR_PP: + case MON_DATA_MOVE3_CUR_PP: + case MON_DATA_MOVE4_CUR_PP: + monDataBlockB->moveCurrentPPs[monDataAttribute - MON_DATA_MOVE1_CUR_PP] = u8Value[0]; break; case MON_DATA_MOVE1_PP_UPS: case MON_DATA_MOVE2_PP_UPS: case MON_DATA_MOVE3_PP_UPS: case MON_DATA_MOVE4_PP_UPS: - monDataBlockB->unk_0C[monDataAttribute - MON_DATA_MOVE1_PP_UPS] = u8Value[0]; + monDataBlockB->movePPUps[monDataAttribute - MON_DATA_MOVE1_PP_UPS] = u8Value[0]; break; case MON_DATA_MOVE1_MAX_PP: case MON_DATA_MOVE2_MAX_PP: @@ -1487,12 +1337,12 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, co u16 v12[10 + 1]; MessageLoader_GetSpeciesName(monDataBlockA->species, 0, &v11[0]); - Strbuf_ToChars((Strbuf *)value, &v12[0], NELEMS(v12)); + Strbuf_ToChars(value, &v12[0], NELEMS(v12)); monDataBlockB->unk_10_31 = sub_0200220C(v11, v12); } case MON_DATA_119: - Strbuf_ToChars((Strbuf *)value, monDataBlockC->unk_00, NELEMS(monDataBlockC->unk_00)); + Strbuf_ToChars(value, monDataBlockC->unk_00, NELEMS(monDataBlockC->unk_00)); break; case MON_DATA_121: monDataBlockC->unk_16 = u8Value[0]; @@ -1535,7 +1385,7 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, co } break; case MON_DATA_145: - Strbuf_ToChars((Strbuf *)value, monDataBlockD->unk_00, NELEMS(monDataBlockD->unk_00)); + Strbuf_ToChars(value, monDataBlockD->unk_00, NELEMS(monDataBlockD->unk_00)); break; case MON_DATA_146: monDataBlockD->unk_10 = u8Value[0]; @@ -1607,7 +1457,7 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, co break; case MON_DATA_179: { - Strbuf* strbuf; + Strbuf *strbuf; strbuf = sub_0200B32C(monDataBlockA->species, 0); @@ -1624,13 +1474,13 @@ void IncreaseMonData (Pokemon *mon, int monDataAttribute, int value) if (mon->box.partyDecrypted == 0) { DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); - checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4); + checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != mon->box.checksum) { GF_ASSERT((checksum == mon->box.checksum)); - EncryptMonData(mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + EncryptMonData(mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); return; } } @@ -1639,8 +1489,8 @@ void IncreaseMonData (Pokemon *mon, int monDataAttribute, int value) if (mon->box.partyDecrypted == 0) { EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4); - EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } } @@ -1667,24 +1517,22 @@ static void IncreaseMonDataAttribute (Pokemon *mon, int monDataAttribute, int va GF_ASSERT(0); break; default: - IncreaseBoxMonDataAttribute((BoxPokemon *)&mon->box, monDataAttribute, value); + IncreaseBoxMonDataAttribute(&mon->box, monDataAttribute, value); break; } } static void IncreaseBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, int value) { - int unused_0; - u16 unused_1; PokemonDataBlockA *monDataBlockA; PokemonDataBlockB *monDataBlockB; PokemonDataBlockC *monDataBlockC; PokemonDataBlockD *monDataBlockD; - monDataBlockA = (PokemonDataBlockA *)GetBoxMonDataBlock(boxMon, boxMon->personality, 0); - monDataBlockB = (PokemonDataBlockB *)GetBoxMonDataBlock(boxMon, boxMon->personality, 1); - monDataBlockC = (PokemonDataBlockC *)GetBoxMonDataBlock(boxMon, boxMon->personality, 2); - monDataBlockD = (PokemonDataBlockD *)GetBoxMonDataBlock(boxMon, boxMon->personality, 3); + monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); + monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); + monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); + monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); switch (monDataAttribute) { case MON_DATA_EXP: @@ -1695,7 +1543,6 @@ static void IncreaseBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribut } break; case MON_DATA_FRIENDSHIP: - { int newValue; newValue = monDataBlockA->friendship; @@ -1711,8 +1558,7 @@ static void IncreaseBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribut } monDataBlockA->friendship = newValue; - } - break; + break; case MON_DATA_HP_EV: monDataBlockA->hpEV += value; break; @@ -1773,24 +1619,24 @@ static void IncreaseBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribut monDataBlockA->sheen += value; } break; - case MON_DATA_MOVE1_PP: - case MON_DATA_MOVE2_PP: - case MON_DATA_MOVE3_PP: - case MON_DATA_MOVE4_PP: - if ((monDataBlockB->unk_08[monDataAttribute - MON_DATA_MOVE1_PP] + value) > MoveTable_CalcMaxPP(monDataBlockB->unk_00[monDataAttribute - MON_DATA_MOVE1_PP], monDataBlockB->unk_0C[monDataAttribute - MON_DATA_MOVE1_PP])) { - monDataBlockB->unk_08[monDataAttribute - MON_DATA_MOVE1_PP] = MoveTable_CalcMaxPP(monDataBlockB->unk_00[monDataAttribute - MON_DATA_MOVE1_PP], monDataBlockB->unk_0C[monDataAttribute - MON_DATA_MOVE1_PP]); + case MON_DATA_MOVE1_CUR_PP: + case MON_DATA_MOVE2_CUR_PP: + case MON_DATA_MOVE3_CUR_PP: + case MON_DATA_MOVE4_CUR_PP: + if ((monDataBlockB->moveCurrentPPs[monDataAttribute - MON_DATA_MOVE1_CUR_PP] + value) > MoveTable_CalcMaxPP(monDataBlockB->moves[monDataAttribute - MON_DATA_MOVE1_CUR_PP], monDataBlockB->movePPUps[monDataAttribute - MON_DATA_MOVE1_CUR_PP])) { + monDataBlockB->moveCurrentPPs[monDataAttribute - MON_DATA_MOVE1_CUR_PP] = MoveTable_CalcMaxPP(monDataBlockB->moves[monDataAttribute - MON_DATA_MOVE1_CUR_PP], monDataBlockB->movePPUps[monDataAttribute - MON_DATA_MOVE1_CUR_PP]); } else { - monDataBlockB->unk_08[monDataAttribute - MON_DATA_MOVE1_PP] += value; + monDataBlockB->moveCurrentPPs[monDataAttribute - MON_DATA_MOVE1_CUR_PP] += value; } break; case MON_DATA_MOVE1_PP_UPS: case MON_DATA_MOVE2_PP_UPS: case MON_DATA_MOVE3_PP_UPS: case MON_DATA_MOVE4_PP_UPS: - if ((monDataBlockB->unk_0C[monDataAttribute - MON_DATA_MOVE1_PP_UPS] + value) > 3) { - monDataBlockB->unk_0C[monDataAttribute - MON_DATA_MOVE1_PP_UPS] = 3; + if ((monDataBlockB->movePPUps[monDataAttribute - MON_DATA_MOVE1_PP_UPS] + value) > 3) { + monDataBlockB->movePPUps[monDataAttribute - MON_DATA_MOVE1_PP_UPS] = 3; } else { - monDataBlockB->unk_0C[monDataAttribute - MON_DATA_MOVE1_PP_UPS] += value; + monDataBlockB->movePPUps[monDataAttribute - MON_DATA_MOVE1_PP_UPS] += value; } break; case MON_DATA_MOVE1_MAX_PP: @@ -2089,17 +1935,17 @@ u32 GetMonPersonalDataAttribute (PokemonPersonalData *monPersonalData, int monPe case MON_DATA_PERSONAL_INVERSE: result = monPersonalData->inverse; break; - case MON_DATA_PERSONAL_UNK_1C: - result = monPersonalData->unk_1C; + case MON_DATA_PERSONAL_TM_LEARNSET_MASK_1: + result = monPersonalData->tmLearnsetMask1; break; - case MON_DATA_PERSONAL_UNK_20: - result = monPersonalData->unk_20; + case MON_DATA_PERSONAL_TM_LEARNSET_MASK_2: + result = monPersonalData->tmLearnsetMask2; break; - case MON_DATA_PERSONAL_UNK_24: - result = monPersonalData->unk_24; + case MON_DATA_PERSONAL_TM_LEARNSET_MASK_3: + result = monPersonalData->tmLearnsetMask3; break; - case MON_DATA_PERSONAL_UNK_28: - result = monPersonalData->unk_28; + case MON_DATA_PERSONAL_TM_LEARNSET_MASK_4: + result = monPersonalData->tmLearnsetMask4; break; } @@ -2232,9 +2078,7 @@ u32 GetBoxMonLevel (BoxPokemon *boxMon) u32 GetMonSpeciesLevel (u16 monSpecies, u32 monExp) { - int unused_0; u32 monLevel; - u32 *unused_1; PokemonPersonalData *monPersonalData = GetMonPersonalData(monSpecies, 0); monLevel = GetMonPersonalDataLevel(monPersonalData, monSpecies, monExp); @@ -2284,31 +2128,31 @@ u8 GetNatureFromPersonality (u32 monPersonality) } static const s8 sNatureStatAffinities[][5] = { - {0x0, 0x0, 0x0, 0x0, 0x0}, - {0x1, -1, 0x0, 0x0, 0x0}, - {0x1, 0x0, -1, 0x0, 0x0}, - {0x1, 0x0, 0x0, -1, 0x0}, - {0x1, 0x0, 0x0, 0x0, -1}, - {-1, 0x1, 0x0, 0x0, 0x0}, - {0x0, 0x0, 0x0, 0x0, 0x0}, - {0x0, 0x1, -1, 0x0, 0x0}, - {0x0, 0x1, 0x0, -1, 0x0}, - {0x0, 0x1, 0x0, 0x0, -1}, - {-1, 0x0, 0x1, 0x0, 0x0}, - {0x0, -1, 0x1, 0x0, 0x0}, - {0x0, 0x0, 0x0, 0x0, 0x0}, - {0x0, 0x0, 0x1, -1, 0x0}, - {0x0, 0x0, 0x1, 0x0, -1}, - {-1, 0x0, 0x0, 0x1, 0x0}, - {0x0, -1, 0x0, 0x1, 0x0}, - {0x0, 0x0, -1, 0x1, 0x0}, - {0x0, 0x0, 0x0, 0x0, 0x0}, - {0x0, 0x0, 0x0, 0x1, -1}, - {-1, 0x0, 0x0, 0x0, 0x1}, - {0x0, -1, 0x0, 0x0, 0x1}, - {0x0, 0x0, -1, 0x0, 0x1}, - {0x0, 0x0, 0x0, -1, 0x1}, - {0x0, 0x0, 0x0, 0x0, 0x0} + {0, 0, 0, 0, 0}, + {1, -1, 0, 0, 0}, + {1, 0, -1, 0, 0}, + {1, 0, 0, -1, 0}, + {1, 0, 0, 0, -1}, + {-1, 1, 0, 0, 0}, + {0, 0, 0, 0, 0}, + {0, 1, -1, 0, 0}, + {0, 1, 0, -1, 0}, + {0, 1, 0, 0, -1}, + {-1, 0, 1, 0, 0}, + {0, -1, 1, 0, 0}, + {0, 0, 0, 0, 0}, + {0, 0, 1, -1, 0}, + {0, 0, 1, 0, -1}, + {-1, 0, 0, 1, 0}, + {0, -1, 0, 1, 0}, + {0, 0, -1, 1, 0}, + {0, 0, 0, 0, 0}, + {0, 0, 0, 1, -1}, + {-1, 0, 0, 0, 1}, + {0, -1, 0, 0, 1}, + {0, 0, -1, 0, 1}, + {0, 0, 0, -1, 1}, + {0, 0, 0, 0, 0} }; u16 GetNatureAdjustedStatValue (u8 monNature, u16 monStatValue, u8 statType) @@ -2414,12 +2258,12 @@ void sub_02075C74 (Pokemon *mon, u8 param1, u16 param2) monFriendship = 255; } - SetMonData(mon, MON_DATA_FRIENDSHIP, (u8 *)&monFriendship); + SetMonData(mon, MON_DATA_FRIENDSHIP, &monFriendship); } u8 GetMonGender (Pokemon *mon) { - return GetBoxMonGender((BoxPokemon *)&mon->box); + return GetBoxMonGender(&mon->box); } u8 GetBoxMonGender (BoxPokemon *boxMon) @@ -3153,7 +2997,7 @@ u32 GetBoxPokemonStructSize (void) u8 GetMonForm (Pokemon *mon) { - return GetBoxMonForm((BoxPokemon *)&mon->box); + return GetBoxMonForm(&mon->box); } u8 GetBoxMonForm (BoxPokemon *boxMon) @@ -3182,7 +3026,7 @@ u8 sub_02076B14 (Pokemon *mon) if (monExp > maxExp) { monExp = maxExp; - SetMonData(mon, MON_DATA_EXP, (u8 *)&monExp); + SetMonData(mon, MON_DATA_EXP, &monExp); } if (monNextLevel > 100) { @@ -3192,7 +3036,7 @@ u8 sub_02076B14 (Pokemon *mon) maxExp = GetMonExpRateLevelExp(monExpRate, monNextLevel); if (monExp >= maxExp) { - SetMonData(mon, MON_DATA_LEVEL, (u8 *)&monNextLevel); + SetMonData(mon, MON_DATA_LEVEL, &monNextLevel); return 1; } @@ -3519,7 +3363,6 @@ u16 AddMonMove (Pokemon *mon, u16 moveID) u16 AddBoxMonMove (BoxPokemon *boxMon, u16 moveID) { int i; - u8 unused_0; u16 slotMove; u16 result; BOOL reencrypt; @@ -3564,7 +3407,7 @@ void ReplaceBoxMonMove (BoxPokemon *boxMon, u16 moveID) for (i = 0; i < 3; i++) { moveIDs[i] = GetBoxMonData(boxMon, MON_DATA_MOVE2 + i, NULL); - movePPs[i] = GetBoxMonData(boxMon, MON_DATA_MOVE2_PP + i, NULL); + movePPs[i] = GetBoxMonData(boxMon, MON_DATA_MOVE2_CUR_PP + i, NULL); movePPUps[i] = GetBoxMonData(boxMon, MON_DATA_MOVE2_PP_UPS + i, NULL); } @@ -3573,9 +3416,9 @@ void ReplaceBoxMonMove (BoxPokemon *boxMon, u16 moveID) movePPUps[3] = 0; for (i = 0; i < 4; i++) { - SetBoxMonData(boxMon, MON_DATA_MOVE1 + i, (u8 *)&moveIDs[i]); - SetBoxMonData(boxMon, MON_DATA_MOVE1_PP + i, (u8 *)&movePPs[i]); - SetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + i, (u8 *)&movePPUps[i]); + SetBoxMonData(boxMon, MON_DATA_MOVE1 + i, &moveIDs[i]); + SetBoxMonData(boxMon, MON_DATA_MOVE1_CUR_PP + i, &movePPs[i]); + SetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + i, &movePPUps[i]); } EncryptBoxMon(boxMon, reencrypt); @@ -3591,7 +3434,7 @@ void ResetMonMove (Pokemon *mon, u16 moveID, u8 moveSlot) SetMonData(mon, MON_DATA_MOVE1_PP_UPS + moveSlot, &movePPUps); moveMaxPP = MoveTable_CalcMaxPP(moveID, 0); - SetMonData(mon, MON_DATA_MOVE1_PP + moveSlot, (u8 *)&moveMaxPP); + SetMonData(mon, MON_DATA_MOVE1_CUR_PP + moveSlot, &moveMaxPP); return; } @@ -3606,12 +3449,12 @@ void SetBoxMonMove (BoxPokemon *boxMon, u16 moveID, u8 moveSlot) u8 moveMaxPP; u8 movePPUps; - SetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot, (u8 *)&moveID); + SetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot, &moveID); movePPUps = GetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot, NULL); moveMaxPP = MoveTable_CalcMaxPP(moveID, movePPUps); - SetBoxMonData(boxMon, MON_DATA_MOVE1_PP + moveSlot, (u8 *)&moveMaxPP); + SetBoxMonData(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot, &moveMaxPP); } u16 sub_0207727C (Pokemon *mon, int *index, u16 *moveID) @@ -3666,18 +3509,18 @@ void SwapBoxMonMoves (BoxPokemon *boxMon, int moveSlot1, int moveSlot2) u8 movePPUps[2]; moveIDs[0] = GetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot1, NULL); - movePPs[0] = GetBoxMonData(boxMon, MON_DATA_MOVE1_PP + moveSlot1, NULL); + movePPs[0] = GetBoxMonData(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot1, NULL); movePPUps[0] = GetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot1, NULL); moveIDs[1] = GetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot2, NULL); - movePPs[1] = GetBoxMonData(boxMon, MON_DATA_MOVE1_PP + moveSlot2, NULL); + movePPs[1] = GetBoxMonData(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot2, NULL); movePPUps[1] = GetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot2, NULL); - SetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot1, (u8 *)&moveIDs[1]); - SetBoxMonData(boxMon, MON_DATA_MOVE1_PP + moveSlot1, (u8 *)&movePPs[1]); - SetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot1, (u8 *)&movePPUps[1]); - SetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot2, (u8 *)&moveIDs[0]); - SetBoxMonData(boxMon, MON_DATA_MOVE1_PP + moveSlot2, (u8 *)&movePPs[0]); - SetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot2, (u8 *)&movePPUps[0]); + SetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot1, &moveIDs[1]); + SetBoxMonData(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot1, &movePPs[1]); + SetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot1, &movePPUps[1]); + SetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot2, &moveIDs[0]); + SetBoxMonData(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot2, &movePPs[0]); + SetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot2, &movePPUps[0]); } void DeleteMonMove (Pokemon *mon, u32 moveSlot) @@ -3689,21 +3532,21 @@ void DeleteMonMove (Pokemon *mon, u32 moveSlot) for (i = moveSlot; i < 3; i++) { moveID = GetMonData(mon, MON_DATA_MOVE1 + i + 1, NULL); - movePP = GetMonData(mon, MON_DATA_MOVE1_PP + i + 1, NULL); + movePP = GetMonData(mon, MON_DATA_MOVE1_CUR_PP + i + 1, NULL); movePPUps = GetMonData(mon, MON_DATA_MOVE1_PP_UPS + i + 1, NULL); - SetMonData(mon, MON_DATA_MOVE1 + i, (u8 *)&moveID); - SetMonData(mon, MON_DATA_MOVE1_PP + i, (u8 *)&movePP); - SetMonData(mon, MON_DATA_MOVE1_PP_UPS + i, (u8 *)&movePPUps); + SetMonData(mon, MON_DATA_MOVE1 + i, &moveID); + SetMonData(mon, MON_DATA_MOVE1_CUR_PP + i, &movePP); + SetMonData(mon, MON_DATA_MOVE1_PP_UPS + i, &movePPUps); } moveID = 0; movePP = 0; movePPUps = 0; - SetMonData(mon, MON_DATA_MOVE4, (u8 *)&moveID); - SetMonData(mon, MON_DATA_MOVE4_PP, (u8 *)&movePP); - SetMonData(mon, MON_DATA_MOVE4_PP_UPS, (u8 *)&movePPUps); + SetMonData(mon, MON_DATA_MOVE4, &moveID); + SetMonData(mon, MON_DATA_MOVE4_CUR_PP, &movePP); + SetMonData(mon, MON_DATA_MOVE4_PP_UPS, &movePPUps); } BOOL MonHasMove (Pokemon *mon, u16 moveID) @@ -3731,19 +3574,19 @@ void sub_020774C8 (BoxPokemon *boxMon, Pokemon *mon) mon->box.partyDecrypted = 1; } - SetMonData(mon, MON_DATA_160, (u8 *)&zero); - SetMonData(mon, MON_DATA_CURRENT_HP, (u8 *)&zero); - SetMonData(mon, MON_DATA_MAX_HP, (u8 *)&zero); + SetMonData(mon, MON_DATA_160, &zero); + SetMonData(mon, MON_DATA_CURRENT_HP, &zero); + SetMonData(mon, MON_DATA_MAX_HP, &zero); v1 = sub_0202818C(0); SetMonData(mon, MON_DATA_170, v1); Heap_FreeToHeap(v1); - SetMonData(mon, MON_DATA_162, (u8 *)&zero); + SetMonData(mon, MON_DATA_162, &zero); MI_CpuClearFast(&v2, sizeof(UnkStruct_0202CA28)); - SetMonData(mon, MON_DATA_171, (UnkStruct_0202CA28 *)&v2); + SetMonData(mon, MON_DATA_171, &v2); CalculateMonLevelAndStats(mon); } @@ -3881,7 +3724,7 @@ void sub_020776B0 (Party *party) monPokerus &= 0xf3; monPokerus++; - SetMonData(mon, MON_DATA_POKERUS, (u8 *)&monPokerus); + SetMonData(mon, MON_DATA_POKERUS, &monPokerus); } } } @@ -3944,7 +3787,7 @@ void sub_020777B4 (Party *party, s32 param1) monPokerus = 0x10; } - SetMonData(mon, MON_DATA_POKERUS, (u8 *)&monPokerus); + SetMonData(mon, MON_DATA_POKERUS, &monPokerus); } } } @@ -3971,7 +3814,7 @@ void sub_0207782C (Party *party) mon = Party_GetPokemonBySlotIndex(party, i - 1); if ((GetMonData(mon, MON_DATA_POKERUS, NULL) & 0xf0) == 0) { - SetMonData(mon, MON_DATA_POKERUS, (u8 *)&monPokerus); + SetMonData(mon, MON_DATA_POKERUS, &monPokerus); } } @@ -3979,7 +3822,7 @@ void sub_0207782C (Party *party) mon = Party_GetPokemonBySlotIndex(party, i + 1); if ((GetMonData(mon, MON_DATA_POKERUS, NULL) & 0xf0) == 0) { - SetMonData(mon, MON_DATA_POKERUS, (u8 *)&monPokerus); + SetMonData(mon, MON_DATA_POKERUS, &monPokerus); i++; } } @@ -4183,7 +4026,7 @@ void SetBoxShayminForm (BoxPokemon *boxMon, int monForm) } } -BOOL AllowShayminSkyForm (Pokemon *mon) +BOOL CanShayminSkyForm (Pokemon *mon) { u32 monSpecies, monForm, v2, monCurrentHP, monFatefulEncounter; RTCTime rtcTime; @@ -4406,7 +4249,6 @@ void sub_02077EE4 (Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, in void sub_02077EF8 (BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) { - int unused_0; sub_02077EA4(boxMon, param1, monPokeball, param3, param4, param5); } @@ -4417,11 +4259,9 @@ static const u16 sHeldItemChance[][2] = { void sub_02077F0C (Pokemon *mon, u32 param1, int param2) { - int unused_0; u32 rand; u16 monSpecies; u16 monForm; - u8 unused_1; u16 monItem1, monItem2; if (param1 & ((0x1 | 0x80))) { @@ -4448,12 +4288,12 @@ void sub_02077F0C (Pokemon *mon, u32 param1, int param2) } } -BOOL sub_02077FB4 (Pokemon *mon, u8 param1) +BOOL CanMonLearnTM (Pokemon *mon, u8 tmID) { - return sub_02077FBC(&mon->box, param1); + return CanBoxMonLearnTM(&mon->box, tmID); } -BOOL sub_02077FBC (BoxPokemon *boxMon, u8 param1) +BOOL CanBoxMonLearnTM (BoxPokemon *boxMon, u8 tmID) { u16 monSpeciesEgg; int monForm; @@ -4461,10 +4301,10 @@ BOOL sub_02077FBC (BoxPokemon *boxMon, u8 param1) monSpeciesEgg = GetBoxMonData(boxMon, MON_DATA_SPECIES_EGG, NULL); monForm = GetBoxMonData(boxMon, MON_DATA_FORM, NULL); - return sub_02077FE4(monSpeciesEgg, monForm, param1); + return CanMonSpeciesLearnTM(monSpeciesEgg, monForm, tmID); } -BOOL sub_02077FE4 (u16 monSpecies, int monForm, u8 tmID) +BOOL CanMonSpeciesLearnTM (u16 monSpecies, int monForm, u8 tmID) { u32 tmFlag; u8 monPersonalDataAttribute; @@ -4475,16 +4315,16 @@ BOOL sub_02077FE4 (u16 monSpecies, int monForm, u8 tmID) if (tmID < 32) { tmFlag = (1 << tmID); - monPersonalDataAttribute = MON_DATA_PERSONAL_UNK_1C; + monPersonalDataAttribute = MON_DATA_PERSONAL_TM_LEARNSET_MASK_1; } else if (tmID < 64) { tmFlag = (1 << (tmID - 32)); - monPersonalDataAttribute = MON_DATA_PERSONAL_UNK_20; + monPersonalDataAttribute = MON_DATA_PERSONAL_TM_LEARNSET_MASK_2; } else if (tmID < 96) { tmFlag = (1 << (tmID - 64)); - monPersonalDataAttribute = MON_DATA_PERSONAL_UNK_24; + monPersonalDataAttribute = MON_DATA_PERSONAL_TM_LEARNSET_MASK_3; } else { tmFlag = (1 << (tmID - 96)); - monPersonalDataAttribute = MON_DATA_PERSONAL_UNK_28; + monPersonalDataAttribute = MON_DATA_PERSONAL_TM_LEARNSET_MASK_4; } return (GetMonFormPersonalDataAttribute(monSpecies, monForm, monPersonalDataAttribute) & tmFlag) != 0; @@ -4511,12 +4351,12 @@ void CalculateBoxMonAbility (BoxPokemon *boxMon) if (monAbility2 != 0) { if (monPersonality & 1) { - SetBoxMonData(boxMon, MON_DATA_ABILITY, (u8 *)&monAbility2); + SetBoxMonData(boxMon, MON_DATA_ABILITY, &monAbility2); } else { - SetBoxMonData(boxMon, MON_DATA_ABILITY, (u8 *)&monAbility1); + SetBoxMonData(boxMon, MON_DATA_ABILITY, &monAbility1); } } else { - SetBoxMonData(boxMon, MON_DATA_ABILITY, (u8 *)&monAbility1); + SetBoxMonData(boxMon, MON_DATA_ABILITY, &monAbility1); } EncryptBoxMon(boxMon, reencrypt); @@ -4538,18 +4378,18 @@ void sub_020780C4 (Pokemon *mon, u32 monPersonality) sub_020775EC(mon, newMon); - newMonBlockA = (PokemonDataBlockA *)GetBoxMonDataBlock(&newMon->box, mon->box.personality, 0); - newMonBlockB = (PokemonDataBlockB *)GetBoxMonDataBlock(&newMon->box, mon->box.personality, 1); - newMonBlockC = (PokemonDataBlockC *)GetBoxMonDataBlock(&newMon->box, mon->box.personality, 2); - newMonBlockD = (PokemonDataBlockD *)GetBoxMonDataBlock(&newMon->box, mon->box.personality, 3); - monBlockA = (PokemonDataBlockA *)GetBoxMonDataBlock(&mon->box, monPersonality, 0); - monBlockB = (PokemonDataBlockB *)GetBoxMonDataBlock(&mon->box, monPersonality, 1); - monBlockC = (PokemonDataBlockC *)GetBoxMonDataBlock(&mon->box, monPersonality, 2); - monBlockD = (PokemonDataBlockD *)GetBoxMonDataBlock(&mon->box, monPersonality, 3); + newMonBlockA = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 0); + newMonBlockB = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 1); + newMonBlockC = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 2); + newMonBlockD = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 3); + monBlockA = GetBoxMonDataBlock(&mon->box, monPersonality, 0); + monBlockB = GetBoxMonDataBlock(&mon->box, monPersonality, 1); + monBlockC = GetBoxMonDataBlock(&mon->box, monPersonality, 2); + monBlockD = GetBoxMonDataBlock(&mon->box, monPersonality, 3); - DecryptMonData(&newMon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, newMon->box.checksum); + DecryptMonData(&newMon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, newMon->box.checksum); DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); mon->box.personality = monPersonality; @@ -4558,9 +4398,9 @@ void sub_020780C4 (Pokemon *mon, u32 monPersonality) *monBlockC = *newMonBlockC; *monBlockD = *newMonBlockD; - mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4); + mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); - EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); Heap_FreeToHeap(newMon); } @@ -4594,7 +4434,7 @@ static void DecryptMonData (void *data, u32 bytes, u32 seed) static u16 GetMonDataChecksum (void *data, u32 bytes) { int i; - u16 *dataWords = (u16 *)data; + u16 *dataWords = data; u16 checksum = 0; for (i = 0; i < bytes / 2; i++) { @@ -4604,6 +4444,27 @@ static u16 GetMonDataChecksum (void *data, u32 bytes) return checksum; } +#define DATA_BLOCK_SHUFFLE_CASE(v1, v2, v3, v4) \ +{ \ + PokemonDataBlock *dataBlocks = boxMon->dataBlocks; \ + switch (dataBlockID) \ + { \ + case 0: \ + result = &dataBlocks[v1]; \ + break; \ + case 1: \ + result = &dataBlocks[v2]; \ + break; \ + case 2: \ + result = &dataBlocks[v3]; \ + break; \ + case 3: \ + result = &dataBlocks[v4]; \ + break; \ + } \ + break; \ +} + static void * GetBoxMonDataBlock (BoxPokemon *boxMon, u32 personality, u8 dataBlockID) { void *result; @@ -4615,492 +4476,60 @@ static void * GetBoxMonDataBlock (BoxPokemon *boxMon, u32 personality, u8 dataBl switch (personality) { case 0: case 24: - { - PokemonDataBlocksShuffle0 *dataBlocks = (PokemonDataBlocksShuffle0 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } + DATA_BLOCK_SHUFFLE_CASE(0,1,2,3) case 1: case 25: - { - PokemonDataBlockShuffle1 *dataBlocks = (PokemonDataBlockShuffle1 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } + DATA_BLOCK_SHUFFLE_CASE(0,1,3,2) case 2: case 26: - { - PokemonDataBlockShuffle2 *dataBlocks = (PokemonDataBlockShuffle2 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } - case 3: + DATA_BLOCK_SHUFFLE_CASE(0,2,1,3) + case 3: case 27: - { - PokemonDataBlockShuffle3 *dataBlocks = (PokemonDataBlockShuffle3 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } - case 4: + DATA_BLOCK_SHUFFLE_CASE(0,3,1,2) + case 4: case 28: - { - PokemonDataBlockShuffle4 *dataBlocks = (PokemonDataBlockShuffle4 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } - case 5: + DATA_BLOCK_SHUFFLE_CASE(0,2,3,1) + case 5: case 29: - { - PokemonDataBlockShuffle5 *dataBlocks = (PokemonDataBlockShuffle5 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } - case 6: + DATA_BLOCK_SHUFFLE_CASE(0,3,2,1) + case 6: case 30: - { - PokemonDataBlockShuffle6 *dataBlocks = (PokemonDataBlockShuffle6 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } - case 7: + DATA_BLOCK_SHUFFLE_CASE(1,0,2,3) + case 7: case 31: - { - PokemonDataBlockShuffle7 *dataBlocks = (PokemonDataBlockShuffle7 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } - case 8: - { - PokemonDataBlockShuffle8 *dataBlocks = (PokemonDataBlockShuffle8 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } - case 9: - { - PokemonDataBlockShuffle9 *dataBlocks = (PokemonDataBlockShuffle9 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } + DATA_BLOCK_SHUFFLE_CASE(1,0,3,2) + case 8: + DATA_BLOCK_SHUFFLE_CASE(2,0,1,3) + case 9: + DATA_BLOCK_SHUFFLE_CASE(3,0,1,2) case 10: - { - PokemonDataBlockShuffle10 *dataBlocks = (PokemonDataBlockShuffle10 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } + DATA_BLOCK_SHUFFLE_CASE(2,0,3,1) case 11: - { - PokemonDataBlockShuffle11 *dataBlocks = (PokemonDataBlockShuffle11 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } + DATA_BLOCK_SHUFFLE_CASE(3,0,2,1) case 12: - { - PokemonDataBlockShuffle12 *dataBlocks = (PokemonDataBlockShuffle12 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } + DATA_BLOCK_SHUFFLE_CASE(1,2,0,3) case 13: - { - PokemonDataBlockShuffle13 *dataBlocks = (PokemonDataBlockShuffle13 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } + DATA_BLOCK_SHUFFLE_CASE(1,3,0,2) case 14: - { - PokemonDataBlockShuffle14 *dataBlocks = (PokemonDataBlockShuffle14 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } + DATA_BLOCK_SHUFFLE_CASE(2,1,0,3) case 15: - { - PokemonDataBlockShuffle15 *dataBlocks = (PokemonDataBlockShuffle15 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } + DATA_BLOCK_SHUFFLE_CASE(3,1,0,2) case 16: - { - PokemonDataBlockShuffle16 *dataBlocks = (PokemonDataBlockShuffle16 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } + DATA_BLOCK_SHUFFLE_CASE(2,3,0,1) case 17: - { - PokemonDataBlockShuffle17 *dataBlocks = (PokemonDataBlockShuffle17 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } + DATA_BLOCK_SHUFFLE_CASE(3,2,0,1) case 18: - { - PokemonDataBlockShuffle18 *dataBlocks = (PokemonDataBlockShuffle18 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } + DATA_BLOCK_SHUFFLE_CASE(1,2,3,0) case 19: - { - PokemonDataBlockShuffle19 *dataBlocks = (PokemonDataBlockShuffle19 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } + DATA_BLOCK_SHUFFLE_CASE(1,3,2,0) case 20: - { - PokemonDataBlockShuffle20 *dataBlocks = (PokemonDataBlockShuffle20 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } + DATA_BLOCK_SHUFFLE_CASE(2,1,3,0) case 21: - { - PokemonDataBlockShuffle21 *dataBlocks = (PokemonDataBlockShuffle21 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } + DATA_BLOCK_SHUFFLE_CASE(3,1,2,0) case 22: - { - PokemonDataBlockShuffle22 *dataBlocks = (PokemonDataBlockShuffle22 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } + DATA_BLOCK_SHUFFLE_CASE(2,3,1,0) case 23: - { - PokemonDataBlockShuffle23 *dataBlocks = (PokemonDataBlockShuffle23 *)&boxMon->dataBlocks; - - switch (dataBlockID) { - case 0: - result = &dataBlocks->dataBlockA; - break; - case 1: - result = &dataBlocks->dataBlockB; - break; - case 2: - result = &dataBlocks->dataBlockC; - break; - case 3: - result = &dataBlocks->dataBlockD; - break; - } - break; - } + DATA_BLOCK_SHUFFLE_CASE(3,2,1,0) } return result; @@ -5226,8 +4655,8 @@ BOOL sub_0207884C (BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int heapID) u32 monOTID = GetBoxMonData(boxMon, MON_DATA_OT_ID, NULL); u32 v2 = sub_02025F30(param1); u32 monOtGender = GetBoxMonData(boxMon, MON_DATA_OT_GENDER, NULL); - Strbuf* v4 = sub_02025F04(param1, heapID); - Strbuf* v5 = Strbuf_Init(8, heapID); + Strbuf *v4 = sub_02025F04(param1, heapID); + Strbuf *v5 = Strbuf_Init(8, heapID); BOOL v6 = 0; GetBoxMonData(boxMon, MON_DATA_145, v5); @@ -5283,8 +4712,8 @@ void sub_0207893C (Pokemon *mon) MI_CpuClearFast(&v1, sizeof(UnkStruct_0202CA28)); - SetMonData(mon, MON_DATA_162, (u8 *)&zero); - SetMonData(mon, MON_DATA_171, (UnkStruct_0202CA28 *)&v1); + SetMonData(mon, MON_DATA_162, &zero); + SetMonData(mon, MON_DATA_171, &v1); } void sub_0207896C (BoxPokemon *boxMon) @@ -5298,7 +4727,7 @@ void sub_0207896C (BoxPokemon *boxMon) if (GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, NULL)) { u8 moveMaxPP = GetBoxMonData(boxMon, MON_DATA_MOVE1_MAX_PP + i, NULL); - SetBoxMonData(boxMon, MON_DATA_MOVE1_PP + i, &moveMaxPP); + SetBoxMonData(boxMon, MON_DATA_MOVE1_CUR_PP + i, &moveMaxPP); } } @@ -5410,18 +4839,17 @@ void sub_02078B40 (Pokemon *mon, UnkStruct_02078B40 *param1) PokemonDataBlockC *monDataBlockC; PokemonDataBlockD *monDataBlockD; int i; - u16 unused_0; if (mon->box.partyDecrypted == 0) { DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } boxMon = GetBoxMon(mon); - monDataBlockA = (PokemonDataBlockA *)GetBoxMonDataBlock(boxMon, boxMon->personality, 0); - monDataBlockB = (PokemonDataBlockB *)GetBoxMonDataBlock(boxMon, boxMon->personality, 1); - monDataBlockC = (PokemonDataBlockC *)GetBoxMonDataBlock(boxMon, boxMon->personality, 2); - monDataBlockD = (PokemonDataBlockD *)GetBoxMonDataBlock(boxMon, boxMon->personality, 3); + monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); + monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); + monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); + monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); param1->personality = boxMon->personality; param1->partyDecrypted = 0; @@ -5442,9 +4870,9 @@ void sub_02078B40 (Pokemon *mon, UnkStruct_02078B40 *param1) param1->originLanguage = monDataBlockA->originLanguage; for (i = 0; i < 4; i++) { - param1->unk_1C[i] = monDataBlockB->unk_00[i]; - param1->unk_24[i] = monDataBlockB->unk_08[i]; - param1->unk_28[i] = monDataBlockB->unk_0C[i]; + param1->unk_1C[i] = monDataBlockB->moves[i]; + param1->unk_24[i] = monDataBlockB->moveCurrentPPs[i]; + param1->unk_28[i] = monDataBlockB->movePPUps[i]; } param1->hpIV = monDataBlockB->hpIV; @@ -5482,7 +4910,7 @@ void sub_02078B40 (Pokemon *mon, UnkStruct_02078B40 *param1) if (mon->box.partyDecrypted == 0) { EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } } @@ -5498,10 +4926,10 @@ void sub_02078E0C (UnkStruct_02078B40 *param0, Pokemon *mon) MI_CpuClearFast(mon, sizeof(Pokemon)); boxMon = GetBoxMon(mon); - monDataBlockA = (PokemonDataBlockA *)GetBoxMonDataBlock(boxMon, param0->personality, 0); - monDataBlockB = (PokemonDataBlockB *)GetBoxMonDataBlock(boxMon, param0->personality, 1); - monDataBlockC = (PokemonDataBlockC *)GetBoxMonDataBlock(boxMon, param0->personality, 2); - monDataBlockD = (PokemonDataBlockD *)GetBoxMonDataBlock(boxMon, param0->personality, 3); + monDataBlockA = GetBoxMonDataBlock(boxMon, param0->personality, 0); + monDataBlockB = GetBoxMonDataBlock(boxMon, param0->personality, 1); + monDataBlockC = GetBoxMonDataBlock(boxMon, param0->personality, 2); + monDataBlockD = GetBoxMonDataBlock(boxMon, param0->personality, 3); boxMon->personality = param0->personality; boxMon->partyDecrypted = 0; @@ -5523,9 +4951,9 @@ void sub_02078E0C (UnkStruct_02078B40 *param0, Pokemon *mon) monDataBlockA->originLanguage = param0->originLanguage; for (i = 0; i < 4; i++) { - monDataBlockB->unk_00[i] = param0->unk_1C[i]; - monDataBlockB->unk_08[i] = param0->unk_24[i]; - monDataBlockB->unk_0C[i] = param0->unk_28[i]; + monDataBlockB->moves[i] = param0->unk_1C[i]; + monDataBlockB->moveCurrentPPs[i] = param0->unk_24[i]; + monDataBlockB->movePPUps[i] = param0->unk_28[i]; } monDataBlockB->hpIV = param0->hpIV; @@ -5562,6 +4990,6 @@ void sub_02078E0C (UnkStruct_02078B40 *param0, Pokemon *mon) mon->party.unk_12 = param0->unk_6E; EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4); - EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlockA) * 4, mon->box.checksum); + mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } diff --git a/src/unk_0207E0B8.c b/src/unk_0207E0B8.c index d2cbaac702..896863b351 100644 --- a/src/unk_0207E0B8.c +++ b/src/unk_0207E0B8.c @@ -2584,7 +2584,7 @@ static int sub_0208107C (UnkStruct_0207F248 * param0) v0 = Item_Load(param0->unk_5A4->unk_24, 0, 12); - if ((param0->unk_5A4->unk_24 == 466) && (AllowShayminSkyForm(Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11)) == 1)) { + if ((param0->unk_5A4->unk_24 == 466) && (CanShayminSkyForm(Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11)) == 1)) { param0->unk_5A4->unk_38 = 1; Heap_FreeToHeap(v0); sub_020819B4(param0); diff --git a/src/unk_02084B70.c b/src/unk_02084B70.c index dce6de0960..da6bbceb5c 100644 --- a/src/unk_02084B70.c +++ b/src/unk_02084B70.c @@ -943,7 +943,7 @@ u8 sub_02086104 (UnkStruct_0207F248 * param0, Pokemon * param1) } } - if (sub_02077FB4(param1, Item_TMHMNumber(param0->unk_5A4->unk_24)) == 0) { + if (CanMonLearnTM(param1, Item_TMHMNumber(param0->unk_5A4->unk_24)) == 0) { return 0xff; } diff --git a/src/unk_0208C324.c b/src/unk_0208C324.c index 77687ba0b9..49891f8bd4 100644 --- a/src/unk_0208C324.c +++ b/src/unk_0208C324.c @@ -1081,7 +1081,7 @@ static void sub_0208D200 (UnkStruct_0208D7BC * param0, Pokemon * param1, UnkStru for (v1 = 0; v1 < 4; v1++) { param2->unk_34[v1] = (u16)GetMonData(param1, MON_DATA_MOVE1 + v1, NULL); - param2->unk_3C[v1] = (u8)GetMonData(param1, MON_DATA_MOVE1_PP + v1, NULL); + param2->unk_3C[v1] = (u8)GetMonData(param1, MON_DATA_MOVE1_CUR_PP + v1, NULL); v2 = (u8)GetMonData(param1, MON_DATA_MOVE1_PP_UPS + v1, NULL); param2->unk_40[v1] = MoveTable_CalcMaxPP(param2->unk_34[v1], v2); } diff --git a/src/unk_02096420.c b/src/unk_02096420.c index bea6d18825..9bdea05ac1 100644 --- a/src/unk_02096420.c +++ b/src/unk_02096420.c @@ -544,7 +544,7 @@ static u8 sub_02096F34 (Pokemon * param0, u32 param1) return 0; } - v1 = (u8)GetMonData(param0, MON_DATA_MOVE1_PP + param1, NULL); + v1 = (u8)GetMonData(param0, MON_DATA_MOVE1_CUR_PP + param1, NULL); v2 = (u8)GetMonData(param0, MON_DATA_MOVE1_PP_UPS + param1, NULL); if (v1 < MoveTable_CalcMaxPP(v0, v2)) { @@ -566,7 +566,7 @@ static u8 sub_02096F84 (Pokemon * param0, u32 param1, u32 param2) return 0; } - v1 = (u8)GetMonData(param0, MON_DATA_MOVE1_PP + param1, NULL); + v1 = (u8)GetMonData(param0, MON_DATA_MOVE1_CUR_PP + param1, NULL); v2 = (u8)MoveTable_CalcMaxPP(v0, GetMonData(param0, MON_DATA_MOVE1_PP_UPS + param1, NULL)); if (v1 < v2) { @@ -606,7 +606,7 @@ static u8 sub_02097004 (Pokemon * param0, u32 param1, u32 param2) return 0; } - v1 = (u8)GetMonData(param0, MON_DATA_MOVE1_PP + param1, NULL); + v1 = (u8)GetMonData(param0, MON_DATA_MOVE1_CUR_PP + param1, NULL); v3 = (u8)MoveTable_CalcMaxPP(v0, v2); if (v2 + param2 > 3) { From 3392bdc21d6b157cc609cb1312be92ba8056792a Mon Sep 17 00:00:00 2001 From: wildfire Date: Wed, 6 Sep 2023 20:34:17 +0100 Subject: [PATCH 05/11] Move var definitions to usages --- src/pokemon.c | 898 +++++++++++++++++++------------------------------- 1 file changed, 330 insertions(+), 568 deletions(-) diff --git a/src/pokemon.c b/src/pokemon.c index 80ddb41afd..dd35f08606 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -137,9 +137,7 @@ Pokemon * AllocMonZeroed (u32 heapID) BOOL DecryptMon (Pokemon *mon) { - BOOL wasDecrypted; - - wasDecrypted = 0; + BOOL wasDecrypted = 0; if (mon->box.partyDecrypted == 0) { wasDecrypted = 1; @@ -157,9 +155,7 @@ BOOL DecryptMon (Pokemon *mon) BOOL EncryptMon (Pokemon *mon, BOOL encrypt) { - BOOL wasEncrypted; - - wasEncrypted = 0; + BOOL wasEncrypted = 0; if ((mon->box.partyDecrypted == 1) && (encrypt == 1)) { wasEncrypted = 1; @@ -176,9 +172,7 @@ BOOL EncryptMon (Pokemon *mon, BOOL encrypt) BOOL DecryptBoxMon (BoxPokemon *boxMon) { - BOOL wasDecrypted; - - wasDecrypted = 0; + BOOL wasDecrypted = 0; if (boxMon->boxDecrypted == 0) { wasDecrypted = 1; @@ -191,9 +185,7 @@ BOOL DecryptBoxMon (BoxPokemon *boxMon) BOOL EncryptBoxMon (BoxPokemon *boxMon, BOOL encrypt) { - BOOL wasEncrypted; - - wasEncrypted = 0; + BOOL wasEncrypted = 0; if ((boxMon->boxDecrypted == 1) && (encrypt == 1)) { wasEncrypted = 1; @@ -209,10 +201,6 @@ BOOL EncryptBoxMon (BoxPokemon *boxMon, BOOL encrypt) void sub_02073D80 (Pokemon *mon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) { - u32 zero; - UnkStruct_0202818C *v1; - UnkStruct_0202CA28 v2; - ZeroMonData(mon); sub_02073E18(&mon->box, monSpecies, monLevel, monIVs, useMonPersonalityParam, monPersonality, monOTIDSource, monOTID); @@ -220,14 +208,15 @@ void sub_02073D80 (Pokemon *mon, int monSpecies, int monLevel, int monIVs, int u EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); SetMonData(mon, MON_DATA_LEVEL, &monLevel); - v1 = sub_0202818C(0); + UnkStruct_0202818C *v1 = sub_0202818C(0); SetMonData(mon, MON_DATA_170, v1); Heap_FreeToHeap(v1); - zero = 0; + u32 zero = 0; SetMonData(mon, MON_DATA_162, &zero); + UnkStruct_0202CA28 v2; MI_CpuClearFast(&v2, sizeof(UnkStruct_0202CA28)); SetMonData(mon, MON_DATA_171, &v2); @@ -236,12 +225,9 @@ void sub_02073D80 (Pokemon *mon, int monSpecies, int monLevel, int monIVs, int u void sub_02073E18 (BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) { - u32 v1, v2; - BOOL reencrypt; - ZeroBoxMonData(boxMon); - reencrypt = DecryptBoxMon(boxMon); + BOOL reencrypt = DecryptBoxMon(boxMon); if (!useMonPersonalityParam) { monPersonality = (LCRNG_Next() | (LCRNG_Next() << 16)); @@ -262,6 +248,8 @@ void sub_02073E18 (BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, SetBoxMonData(boxMon, MON_DATA_SPECIES, &monSpecies); SetBoxMonData(boxMon, MON_DATA_179, NULL); + u32 v1, v2; // TODO rename, these are used/reused as temp vars through the whole function. + v1 = GetMonSpeciesLevelExp(monSpecies, monLevel); SetBoxMonData(boxMon, MON_DATA_EXP, &v1); @@ -353,11 +341,9 @@ void sub_02074088 (Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 para u32 sub_02074128 (u16 monSpecies, u8 param1, u8 param2) { - u8 monGenderChance; - u32 result; - - monGenderChance = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_GENDER); + u8 monGenderChance = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_GENDER); + u32 result; switch (monGenderChance) { case 0: case 254: @@ -386,11 +372,8 @@ void sub_02074158 (Pokemon *mon, u16 monSpecies, u8 monLevel, u32 monCombinedIVs void CalculateMonLevelAndStats (Pokemon *mon) { - int monLevel; - BOOL reencrypt; - - reencrypt = DecryptMon(mon); - monLevel = GetMonLevel(mon); + BOOL reencrypt = DecryptMon(mon); + int monLevel = GetMonLevel(mon); SetMonData(mon, MON_DATA_LEVEL, &monLevel); CalculateMonStats(mon); @@ -399,21 +382,19 @@ void CalculateMonLevelAndStats (Pokemon *mon) void CalculateMonStats (Pokemon *mon) { - int monMaxHp, monCurrentHp, newMaxHp; - int newAtk, newDef, newSpeed, newSpAtk, newSpDef; + int monMaxHp; + int monCurrentHp; int monHpIV, monAtkIV, monDefIV, monSpeedIV, monSpAtkIV, monSpDefIV; int monHpEV, monAtkEV, monDefEV, monSpeedEV, monSpAtkEV, monSpDefEV; - int monSpecies; - int monLevel; - int monForm; - PokemonPersonalData *monPersonalData; - BOOL reencrypt; - - reencrypt = DecryptMon(mon); + + BOOL reencrypt = DecryptMon(mon); + int monLevel; monLevel = GetMonData(mon, MON_DATA_LEVEL, 0); + monMaxHp = GetMonData(mon, MON_DATA_MAX_HP, 0); monCurrentHp = GetMonData(mon, MON_DATA_CURRENT_HP, 0); + monHpIV = GetMonData(mon, MON_DATA_HP_IV, 0); monHpEV = GetMonData(mon, MON_DATA_HP_EV, 0); monAtkIV = GetMonData(mon, MON_DATA_ATK_IV, 0); @@ -426,12 +407,14 @@ void CalculateMonStats (Pokemon *mon) monSpAtkEV = GetMonData(mon, MON_DATA_SPATK_EV, 0); monSpDefIV = GetMonData(mon, MON_DATA_SPDEF_IV, 0); monSpDefEV = GetMonData(mon, MON_DATA_SPDEF_EV, 0); - monForm = GetMonData(mon, MON_DATA_FORM, 0); - monSpecies = GetMonData(mon, MON_DATA_SPECIES, 0); - monPersonalData = Heap_AllocFromHeap(0, sizeof(PokemonPersonalData)); + + int monForm = GetMonData(mon, MON_DATA_FORM, 0); + int monSpecies = GetMonData(mon, MON_DATA_SPECIES, 0); + PokemonPersonalData *monPersonalData = Heap_AllocFromHeap(0, sizeof(PokemonPersonalData)); LoadMonFormPersonalData(monSpecies, monForm, monPersonalData); + int newMaxHp; if (monSpecies == SPECIES_SHEDINJA) { newMaxHp = 1; } else { @@ -440,27 +423,27 @@ void CalculateMonStats (Pokemon *mon) SetMonData(mon, MON_DATA_MAX_HP, &newMaxHp); - newAtk = ((2 * monPersonalData->baseAtk + monAtkIV + monAtkEV / 4) * monLevel / 100 + 5); + int newAtk = ((2 * monPersonalData->baseAtk + monAtkIV + monAtkEV / 4) * monLevel / 100 + 5); newAtk = GetNatureAdjustedStatValue(GetMonNature(mon), newAtk, 0x1); SetMonData(mon, MON_DATA_ATK, &newAtk); - newDef = ((2 * monPersonalData->baseDef + monDefIV + monDefEV / 4) * monLevel / 100 + 5); + int newDef = ((2 * monPersonalData->baseDef + monDefIV + monDefEV / 4) * monLevel / 100 + 5); newDef = GetNatureAdjustedStatValue(GetMonNature(mon), newDef, 0x2); SetMonData(mon, MON_DATA_DEF, &newDef); - newSpeed = ((2 * monPersonalData->baseSpeed + monSpeedIV + monSpeedEV / 4) * monLevel / 100 + 5); + int newSpeed = ((2 * monPersonalData->baseSpeed + monSpeedIV + monSpeedEV / 4) * monLevel / 100 + 5); newSpeed = GetNatureAdjustedStatValue(GetMonNature(mon), newSpeed, 0x3); SetMonData(mon, MON_DATA_SPEED, &newSpeed); - newSpAtk = ((2 * monPersonalData->baseSpAtk + monSpAtkIV + monSpAtkEV / 4) * monLevel / 100 + 5); + int newSpAtk = ((2 * monPersonalData->baseSpAtk + monSpAtkIV + monSpAtkEV / 4) * monLevel / 100 + 5); newSpAtk = GetNatureAdjustedStatValue(GetMonNature(mon), newSpAtk, 0x4); SetMonData(mon, MON_DATA_SP_ATK, &newSpAtk); - newSpDef = ((2 * monPersonalData->baseSpDef + monSpDefIV + monSpDefEV / 4) * monLevel / 100 + 5); + int newSpDef = ((2 * monPersonalData->baseSpDef + monSpDefIV + monSpDefEV / 4) * monLevel / 100 + 5); newSpDef = GetNatureAdjustedStatValue(GetMonNature(mon), newSpDef, 0x5); SetMonData(mon, MON_DATA_SP_DEF, &newSpDef); @@ -485,14 +468,11 @@ void CalculateMonStats (Pokemon *mon) u32 GetMonData (Pokemon *mon, int monDataAttribute, void *dest) { - u32 result; - u16 checksum; - if (mon->box.partyDecrypted == 0) { DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); - checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + u16 checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != mon->box.checksum) { GF_ASSERT((checksum == mon->box.checksum)); @@ -500,7 +480,7 @@ u32 GetMonData (Pokemon *mon, int monDataAttribute, void *dest) } } - result = GetMonDataAttribute(mon, monDataAttribute, dest); + u32 result = GetMonDataAttribute(mon, monDataAttribute, dest); if (mon->box.partyDecrypted == 0) { EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); @@ -563,12 +543,9 @@ static u32 GetMonDataAttribute (Pokemon *mon, int monDataAttribute, void *dest) u32 GetBoxMonData (BoxPokemon *boxMon, int monDataAttribute, void *dest) { - u16 checksum; - u32 result; - if (boxMon->boxDecrypted == 0) { DecryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); - checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); + u16 checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != boxMon->checksum) { GF_ASSERT((checksum == boxMon->checksum)); @@ -576,7 +553,7 @@ u32 GetBoxMonData (BoxPokemon *boxMon, int monDataAttribute, void *dest) } } - result = GetBoxMonDataAttribute(boxMon, monDataAttribute, dest); + u32 result = GetBoxMonDataAttribute(boxMon, monDataAttribute, dest); if (boxMon->boxDecrypted == 0) { EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); @@ -588,16 +565,11 @@ u32 GetBoxMonData (BoxPokemon *boxMon, int monDataAttribute, void *dest) static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, void *dest) { u32 result = 0; - u64 v1; - PokemonDataBlockA *monDataBlockA; - PokemonDataBlockB *monDataBlockB; - PokemonDataBlockC *monDataBlockC; - PokemonDataBlockD *monDataBlockD; - monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); - monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); - monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); - monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); + PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); + PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); + PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); + PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); switch (monDataAttribute) { default: @@ -733,9 +705,11 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi case MON_DATA_51: case MON_DATA_52: case MON_DATA_53: - v1 = 1; - result = ((monDataBlockA->unk_1C & (v1 << monDataAttribute - MON_DATA_25)) != 0); + { + u64 bitMask = 1; + result = ((monDataBlockA->unk_1C & (bitMask << monDataAttribute - MON_DATA_25)) != 0); break; + } case MON_DATA_MOVE1: case MON_DATA_MOVE2: case MON_DATA_MOVE3: @@ -820,9 +794,11 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi case MON_DATA_NATIONAL_RIBBON: case MON_DATA_EARTH_RIBBON: case MON_DATA_WORLD_RIBBON: - v1 = 1; - result = ((monDataBlockB->unk_14 & (v1 << monDataAttribute - MON_DATA_78)) != 0); + { + u64 bitMask = 1; + result = ((monDataBlockB->unk_14 & (bitMask << monDataAttribute - MON_DATA_78)) != 0); break; + } case MON_DATA_FATEFUL_ENCOUNTER: result = monDataBlockB->fatefulEncounter; break; @@ -892,9 +868,11 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi case MON_DATA_141: case MON_DATA_142: case MON_DATA_143: - v1 = 1; - result = ((monDataBlockC->unk_18 & (v1 << monDataAttribute - MON_DATA_123)) != 0); + { + u64 bitMask = 1; + result = ((monDataBlockC->unk_18 & (bitMask << monDataAttribute - MON_DATA_123)) != 0); break; + } case MON_DATA_144: u16 *v8 = dest; @@ -987,12 +965,10 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi void SetMonData (Pokemon *mon, int monDataAttribute, const void *value) { - u16 checksum; - if (mon->box.partyDecrypted == 0) { DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); - checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + u16 checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != mon->box.checksum) { GF_ASSERT((checksum == mon->box.checksum)); @@ -1062,11 +1038,9 @@ static void SetMonDataAttribute (Pokemon *mon, int monDataAttribute, const void void SetBoxMonData (BoxPokemon *boxMon, int monDataAttribute, const void *value) { - u16 checksum; - if (boxMon->boxDecrypted == 0) { DecryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); - checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); + u16 checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != boxMon->checksum) { GF_ASSERT((checksum == boxMon->checksum)); @@ -1086,21 +1060,14 @@ void SetBoxMonData (BoxPokemon *boxMon, int monDataAttribute, const void *value) static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, const void *value) { - int i; - u64 v1; - u16 v2; u32 *u32Value = value; u16 *u16Value = value; u8 *u8Value = value; - PokemonDataBlockA *monDataBlockA; - PokemonDataBlockB *monDataBlockB; - PokemonDataBlockC *monDataBlockC; - PokemonDataBlockD *monDataBlockD; - monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); - monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); - monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); - monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); + PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); + PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); + PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); + PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); switch (monDataAttribute) { case MON_DATA_PERSONALITY: @@ -1209,14 +1176,16 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, co case MON_DATA_51: case MON_DATA_52: case MON_DATA_53: - v1 = 1 << (monDataAttribute - MON_DATA_25); + { + u64 bitMask = 1 << (monDataAttribute - MON_DATA_25); if (u8Value[0]) { - monDataBlockA->unk_1C |= v1; + monDataBlockA->unk_1C |= bitMask; } else { - monDataBlockA->unk_1C &= (v1 ^ 0xffffffff); + monDataBlockA->unk_1C &= (bitMask ^ 0xffffffff); } break; + } case MON_DATA_MOVE1: case MON_DATA_MOVE2: case MON_DATA_MOVE3: @@ -1296,14 +1265,16 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, co case MON_DATA_NATIONAL_RIBBON: case MON_DATA_EARTH_RIBBON: case MON_DATA_WORLD_RIBBON: - v1 = 1 << (monDataAttribute - MON_DATA_78); + { + u64 bitMask = 1 << (monDataAttribute - MON_DATA_78); if (u8Value[0]) { - monDataBlockB->unk_14 |= v1; + monDataBlockB->unk_14 |= bitMask; } else { - monDataBlockB->unk_14 &= (v1 ^ 0xffffffff); + monDataBlockB->unk_14 &= (bitMask ^ 0xffffffff); } break; + } case MON_DATA_FATEFUL_ENCOUNTER: monDataBlockB->fatefulEncounter = u8Value[0]; break; @@ -1327,7 +1298,7 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, co monDataBlockB->unk_10_31 = sub_0200220C(v10, &u16Value[0]); } case MON_DATA_117: - for (i = 0; i < NELEMS(monDataBlockC->unk_00); i++) { + for (int i = 0; i < NELEMS(monDataBlockC->unk_00); i++) { monDataBlockC->unk_00[i] = u16Value[i]; } break; @@ -1371,16 +1342,18 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, co case MON_DATA_141: case MON_DATA_142: case MON_DATA_143: - v1 = 1 << (monDataAttribute - MON_DATA_123); + { + u64 bitMask = 1 << (monDataAttribute - MON_DATA_123); if (u8Value[0]) { - monDataBlockC->unk_18 |= v1; + monDataBlockC->unk_18 |= bitMask; } else { - monDataBlockC->unk_18 &= (v1 ^ 0xffffffffffffffff); + monDataBlockC->unk_18 &= (bitMask ^ 0xffffffffffffffff); } break; + } case MON_DATA_144: - for (i = 0; i < NELEMS(monDataBlockD->unk_00); i++) { + for (int i = 0; i < NELEMS(monDataBlockD->unk_00); i++) { monDataBlockD->unk_00[i] = u16Value[i]; } break; @@ -1470,13 +1443,11 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, co void IncreaseMonData (Pokemon *mon, int monDataAttribute, int value) { - u16 checksum; - if (mon->box.partyDecrypted == 0) { DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); - checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + u16 checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != mon->box.checksum) { GF_ASSERT((checksum == mon->box.checksum)); @@ -1524,15 +1495,10 @@ static void IncreaseMonDataAttribute (Pokemon *mon, int monDataAttribute, int va static void IncreaseBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, int value) { - PokemonDataBlockA *monDataBlockA; - PokemonDataBlockB *monDataBlockB; - PokemonDataBlockC *monDataBlockC; - PokemonDataBlockD *monDataBlockD; - - monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); - monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); - monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); - monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); + PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); + PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); + PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); + PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); switch (monDataAttribute) { case MON_DATA_EXP: @@ -1823,9 +1789,7 @@ static void IncreaseBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribut PokemonPersonalData * GetMonFormPersonalData (int monSpecies, int monForm, int heapID) { - PokemonPersonalData *monPersonalData; - - monPersonalData = Heap_AllocFromHeap(heapID, sizeof(PokemonPersonalData)); + PokemonPersonalData *monPersonalData = Heap_AllocFromHeap(heapID, sizeof(PokemonPersonalData)); LoadMonFormPersonalData(monSpecies, monForm, monPersonalData); return monPersonalData; @@ -1833,9 +1797,7 @@ PokemonPersonalData * GetMonFormPersonalData (int monSpecies, int monForm, int h PokemonPersonalData * GetMonPersonalData (int monSpecies, int heapID) { - PokemonPersonalData *monPersonalData; - - monPersonalData = Heap_AllocFromHeap(heapID, sizeof(PokemonPersonalData)); + PokemonPersonalData *monPersonalData = Heap_AllocFromHeap(heapID, sizeof(PokemonPersonalData)); LoadMonPersonalData(monSpecies, monPersonalData); return monPersonalData; @@ -1960,13 +1922,10 @@ void FreeMonPersonalData (PokemonPersonalData *monPersonalData) u32 GetMonFormPersonalDataAttribute (int monSpecies, int monForm, int monPersonalDataAttribute) { - u32 result; - PokemonPersonalData *monPersonalData; - monSpecies = GetMonFormNarcIndex(monSpecies, monForm); - monPersonalData = GetMonPersonalData(monSpecies, 0); - result = GetMonPersonalDataAttribute(monPersonalData, monPersonalDataAttribute); + PokemonPersonalData *monPersonalData = GetMonPersonalData(monSpecies, 0); + u32 result = GetMonPersonalDataAttribute(monPersonalData, monPersonalDataAttribute); FreeMonPersonalData(monPersonalData); @@ -1975,11 +1934,8 @@ u32 GetMonFormPersonalDataAttribute (int monSpecies, int monForm, int monPersona u32 GetMonSpeciesPersonalDataAttribute (int monSpecies, int monPersonalDataAttribute) { - u32 result; - PokemonPersonalData *monPersonalData; - - monPersonalData = GetMonPersonalData(monSpecies, 0); - result = GetMonPersonalDataAttribute(monPersonalData, monPersonalDataAttribute); + PokemonPersonalData *monPersonalData = GetMonPersonalData(monSpecies, 0); + u32 result = GetMonPersonalDataAttribute(monPersonalData, monPersonalDataAttribute); FreeMonPersonalData(monPersonalData); @@ -1988,23 +1944,15 @@ u32 GetMonSpeciesPersonalDataAttribute (int monSpecies, int monPersonalDataAttri u8 GetMonPercentToNextLevel (Pokemon *mon) { - u16 monSpecies; - u8 monLevel; - u32 monCurrentLevelExp; - u32 monExp; - u32 monNextLevelExp; - u8 monPercentToNextLevel; - BOOL recrypt; - - recrypt = DecryptMon(mon); - monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); - monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); - monCurrentLevelExp = GetMonSpeciesLevelExp(monSpecies, monLevel); - monNextLevelExp = GetMonSpeciesLevelExp(monSpecies, monLevel + 1); - monExp = GetMonData(mon, MON_DATA_EXP, NULL); + BOOL recrypt = DecryptMon(mon); + u16 monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + u8 monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); + u32 monCurrentLevelExp = GetMonSpeciesLevelExp(monSpecies, monLevel); + u32 monNextLevelExp = GetMonSpeciesLevelExp(monSpecies, monLevel + 1); + u32 monExp = GetMonData(mon, MON_DATA_EXP, NULL); EncryptMon(mon, recrypt); - monPercentToNextLevel = ((monExp - monCurrentLevelExp) * 100) / (monNextLevelExp - monCurrentLevelExp); + u8 monPercentToNextLevel = ((monExp - monCurrentLevelExp) * 100) / (monNextLevelExp - monCurrentLevelExp); return monPercentToNextLevel; } @@ -2041,16 +1989,13 @@ void LoadMonExperienceTable (int monExpRate, u32 *monExpTable) u32 GetMonExpRateLevelExp (int monExpRate, int monLevel) { - u32 result; - u32 *expTable; - GF_ASSERT(monExpRate < 8); GF_ASSERT(monLevel <= 101); - expTable = Heap_AllocFromHeap(0, 101 * 4); + u32 *expTable = Heap_AllocFromHeap(0, 101 * 4); LoadMonExperienceTable(monExpRate, expTable); - result = expTable[monLevel]; + u32 result = expTable[monLevel]; Heap_FreeToHeap(expTable); return result; @@ -2063,13 +2008,9 @@ u32 GetMonLevel (Pokemon *mon) u32 GetBoxMonLevel (BoxPokemon *boxMon) { - int monSpecies; - u32 monExp; - BOOL reencrypt; - - reencrypt = DecryptBoxMon(boxMon); - monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, 0); - monExp = GetBoxMonData(boxMon, MON_DATA_EXP, 0); + BOOL reencrypt = DecryptBoxMon(boxMon); + int monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, 0); + u32 monExp = GetBoxMonData(boxMon, MON_DATA_EXP, 0); EncryptBoxMon(boxMon, reencrypt); @@ -2078,10 +2019,9 @@ u32 GetBoxMonLevel (BoxPokemon *boxMon) u32 GetMonSpeciesLevel (u16 monSpecies, u32 monExp) { - u32 monLevel; PokemonPersonalData *monPersonalData = GetMonPersonalData(monSpecies, 0); - monLevel = GetMonPersonalDataLevel(monPersonalData, monSpecies, monExp); + u32 monLevel = GetMonPersonalDataLevel(monPersonalData, monSpecies, monExp); FreeMonPersonalData(monPersonalData); return monLevel; @@ -2090,11 +2030,11 @@ u32 GetMonSpeciesLevel (u16 monSpecies, u32 monExp) u32 GetMonPersonalDataLevel (PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monExp) { static u32 monExpTable[101]; - int monExpRate, i; - monExpRate = GetMonPersonalDataAttribute(monPersonalData, MON_DATA_PERSONAL_EXP_RATE); + int monExpRate = GetMonPersonalDataAttribute(monPersonalData, MON_DATA_PERSONAL_EXP_RATE); LoadMonExperienceTable(monExpRate, monExpTable); + int i; for (i = 1; i < 101; i++) { if (monExpTable[i] > monExp) { break; @@ -2111,11 +2051,8 @@ u8 GetMonNature (Pokemon *mon) u8 GetBoxMonNature (BoxPokemon *boxMon) { - BOOL reencrypt; - u32 monPersonality; - - reencrypt = DecryptBoxMon(boxMon); - monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, 0); + BOOL reencrypt = DecryptBoxMon(boxMon); + u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, 0); EncryptBoxMon(boxMon, reencrypt); @@ -2157,12 +2094,11 @@ static const s8 sNatureStatAffinities[][5] = { u16 GetNatureAdjustedStatValue (u8 monNature, u16 monStatValue, u8 statType) { - u16 result; - if ((statType < 0x1) || (statType > 0x5)) { return monStatValue; } + u16 result; switch (sNatureStatAffinities[monNature][statType - 1]) { case 1: result = monStatValue * 110; @@ -2200,29 +2136,22 @@ static const s8 Unk_020F05A0[][3] = { void sub_02075C74 (Pokemon *mon, u8 param1, u16 param2) { - u16 monSpeciesEgg; - u16 monHeldItem; - s16 monFriendship; - s8 v3; - u8 v4; - u8 itemHoldEffect; - if (param1 == 5) { if (LCRNG_Next() & 1) { return; } } - monSpeciesEgg = GetMonData(mon, MON_DATA_SPECIES_EGG, NULL); + u16 monSpeciesEgg = GetMonData(mon, MON_DATA_SPECIES_EGG, NULL); if ((monSpeciesEgg == SPECIES_NONE) || (monSpeciesEgg == SPECIES_EGG)) { return; } - monHeldItem = GetMonData(mon, MON_DATA_HELD_ITEM, NULL); - itemHoldEffect = Item_LoadParam(monHeldItem, 1, 0); - v4 = 0; - monFriendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL); + u16 monHeldItem = GetMonData(mon, MON_DATA_HELD_ITEM, NULL); + u8 itemHoldEffect = Item_LoadParam(monHeldItem, 1, 0); + u8 v4 = 0; + s16 monFriendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL); if (monFriendship >= 100) { v4++; @@ -2232,7 +2161,7 @@ void sub_02075C74 (Pokemon *mon, u8 param1, u16 param2) v4++; } - v3 = Unk_020F05A0[param1][v4]; + s8 v3 = Unk_020F05A0[param1][v4]; if ((v3 > 0) && (GetMonData(mon, MON_DATA_POKEBALL, NULL) == 11)) { v3++; @@ -2268,13 +2197,9 @@ u8 GetMonGender (Pokemon *mon) u8 GetBoxMonGender (BoxPokemon *boxMon) { - u16 monSpecies; - u32 monPersonality; - int reencrypt; - - reencrypt = DecryptBoxMon(boxMon); - monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, 0); - monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, 0); + BOOL reencrypt = DecryptBoxMon(boxMon); + u16 monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, 0); + u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, 0); EncryptBoxMon(boxMon, reencrypt); @@ -2283,11 +2208,8 @@ u8 GetBoxMonGender (BoxPokemon *boxMon) u8 GetMonPersonalityGender (u16 monSpecies, u32 monPersonality) { - PokemonPersonalData *monPersonalData; - u8 monGender; - - monPersonalData = GetMonPersonalData(monSpecies, 0); - monGender = GetMonPersonalDataGender(monPersonalData, monSpecies, monPersonality); + PokemonPersonalData *monPersonalData = GetMonPersonalData(monSpecies, 0); + u8 monGender = GetMonPersonalDataGender(monPersonalData, monSpecies, monPersonality); FreeMonPersonalData(monPersonalData); @@ -2321,11 +2243,8 @@ u8 GetMonShininess (Pokemon *mon) u8 GetBoxMonShininess (BoxPokemon *boxMon) { - u32 monOTID; - u32 monPersonality; - - monOTID = GetBoxMonData(boxMon, MON_DATA_OT_ID, 0); - monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, 0); + u32 monOTID = GetBoxMonData(boxMon, MON_DATA_OT_ID, 0); + u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, 0); return GetMonPersonalityShininess(monOTID, monPersonality); } @@ -2337,15 +2256,11 @@ u8 GetMonPersonalityShininess (u32 monOTID, u32 monPersonality) u32 sub_02075E64 (u32 param0) { - int i; - u32 result; - u16 v2; - u16 v3; - param0 = (((param0 & 0xffff0000) >> 16) ^ (param0 & 0xffff)) >> 3; - v2 = LCRNG_Next() & 0x7; - v3 = LCRNG_Next() & 0x7; + int i; + u16 v2 = LCRNG_Next() & 0x7; + u16 v3 = LCRNG_Next() & 0x7; for (i = 0; i < 13; i++) { if (param0 & GetSingleBitMask(i)) { @@ -2362,7 +2277,7 @@ u32 sub_02075E64 (u32 param0) } } - result = v2 | (v3 << 16); + u32 result = v2 | (v3 << 16); return result; } @@ -2379,17 +2294,14 @@ void sub_02075F00 (UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2) void sub_02075F0C (UnkStruct_02008A90 *param0, BoxPokemon *boxMon, u8 param2, int param3) { - BOOL reencrypt; - u16 monSpeciesEgg; - u8 monGender, monShininess, monForm; - u32 monPersonality; + BOOL reencrypt = DecryptBoxMon(boxMon); - reencrypt = DecryptBoxMon(boxMon); - monSpeciesEgg = GetBoxMonData(boxMon, MON_DATA_SPECIES_EGG, NULL); - monGender = GetBoxMonGender(boxMon); - monShininess = GetBoxMonShininess(boxMon); - monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); + u16 monSpeciesEgg = GetBoxMonData(boxMon, MON_DATA_SPECIES_EGG, NULL); + u8 monGender = GetBoxMonGender(boxMon); + u8 monShininess = GetBoxMonShininess(boxMon); + u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); + u8 monForm; if (monSpeciesEgg == SPECIES_EGG) { if (GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL) == SPECIES_MANAPHY) { monForm = 1; @@ -2700,15 +2612,11 @@ u8 sub_020765B8 (Pokemon *mon, u8 param1) u8 sub_020765C4 (BoxPokemon *boxMon, u8 param1, int param2) { - u16 monSpeciesEgg; - u8 monGender; - u8 monForm; - u32 monPersonality; - - monSpeciesEgg = GetBoxMonData(boxMon, MON_DATA_SPECIES_EGG, NULL); - monGender = GetBoxMonGender(boxMon); - monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); + u16 monSpeciesEgg = GetBoxMonData(boxMon, MON_DATA_SPECIES_EGG, NULL); + u8 monGender = GetBoxMonGender(boxMon); + u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); + u8 monForm; if (monSpeciesEgg == SPECIES_EGG) { if (GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL) == SPECIES_MANAPHY) { monForm = 1; @@ -2728,12 +2636,10 @@ u8 sub_020765C4 (BoxPokemon *boxMon, u8 param1, int param2) u8 sub_02076648 (u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality) { - int narcIndex; - int memberIndex; - u8 result; - monForm = SanitizeFormId(monSpecies, monForm); + int narcIndex; + int memberIndex; switch (monSpecies) { case SPECIES_BURMY: narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT_O; @@ -2797,19 +2703,17 @@ u8 sub_02076648 (u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPer break; } + u8 result; NARC_ReadWholeMemberByIndexPair(&result, narcIndex, memberIndex); - return result; } static u8 sub_020767BC (u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality) { - int narcIndex; - int memberIndex; - u8 result; - monForm = SanitizeFormId(monSpecies, monForm); + int narcIndex; + int memberIndex; switch (monSpecies) { case SPECIES_BURMY: narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT_O; @@ -2888,8 +2792,8 @@ static u8 sub_020767BC (u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 break; } + u8 result; NARC_ReadWholeMemberByIndexPair(&result, narcIndex, memberIndex); - return result; } @@ -3012,17 +2916,11 @@ BoxPokemon * GetBoxMon (Pokemon *mon) u8 sub_02076B14 (Pokemon *mon) { - u16 monSpecies; - u8 monNextLevel; - u32 monExp; - u32 maxExp; - int monExpRate; - - monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); - monNextLevel = GetMonData(mon, MON_DATA_LEVEL, NULL) + 1; - monExp = GetMonData(mon, MON_DATA_EXP, NULL); - monExpRate = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_EXP_RATE); - maxExp = GetMonExpRateLevelExp(monExpRate, 100); + u16 monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + u8 monNextLevel = GetMonData(mon, MON_DATA_LEVEL, NULL) + 1; + u32 monExp = GetMonData(mon, MON_DATA_EXP, NULL); + int monExpRate = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_EXP_RATE); + u32 maxExp = GetMonExpRateLevelExp(monExpRate, 100); if (monExp > maxExp) { monExp = maxExp; @@ -3045,25 +2943,18 @@ u8 sub_02076B14 (Pokemon *mon) u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int *evoTypeResult) { - u16 monSpecies; - u16 monHeldItem; - u8 monLevel; - int i; u16 targetSpecies = 0; - u16 monFriendship; - u32 monPersonality; - u8 itemHoldEffect; - u8 monBeauty; - u16 monPersonalityUpper = 0; - PokemonEvolutionData *monEvolutionData; - int v11; + + u16 monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + u16 monHeldItem = GetMonData(mon, MON_DATA_HELD_ITEM, NULL); + u32 monPersonality = GetMonData(mon, MON_DATA_PERSONALITY, NULL); + u8 monBeauty = GetMonData(mon, MON_DATA_BEAUTY, NULL); - monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); - monHeldItem = GetMonData(mon, MON_DATA_HELD_ITEM, NULL); - monPersonality = GetMonData(mon, MON_DATA_PERSONALITY, NULL); - monBeauty = GetMonData(mon, MON_DATA_BEAUTY, NULL); - monPersonalityUpper = (monPersonality & 0xffff0000) >> 16; - itemHoldEffect = Item_LoadParam(monHeldItem, 1, 0); + int i; + u16 monFriendship; + + u16 monPersonalityUpper = (monPersonality & 0xffff0000) >> 16; + u8 itemHoldEffect = Item_LoadParam(monHeldItem, 1, 0); if (monSpecies != SPECIES_KADABRA) { if ((itemHoldEffect == HOLD_EFFECT_NO_EVOLVE) && (evoTypeList != 3)) { @@ -3071,16 +2962,17 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int } } + int v11; if (evoTypeResult == NULL) { evoTypeResult = &v11; } - monEvolutionData = Heap_AllocFromHeap(0, sizeof(PokemonEvolutionData)); + PokemonEvolutionData *monEvolutionData = Heap_AllocFromHeap(0, sizeof(PokemonEvolutionData)); LoadMonEvolutionData(monSpecies, monEvolutionData); switch (evoTypeList) { case 0: - monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); + u8 monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); monFriendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL); for (i = 0; i < 7; i++) { @@ -3282,11 +3174,10 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int u16 sub_02076F84 (const u16 monSpecies) { - FSFile file; u16 result = 0; - GF_ASSERT((493 + 1) > monSpecies); + FSFile file; FS_InitFile(&file); FS_OpenFile(&file, "poketool/personal/pms.narc"); FS_SeekFile(&file, monSpecies * 2, FS_SEEK_SET); @@ -3318,27 +3209,22 @@ u16 sub_02076FD4 (const u16 monSpecies) void SetBoxMonDefaultMoves (BoxPokemon *boxMon) { BOOL reencrypt; - int i; - u16 monSpecies; - u16 monLevelUpMoveID; - int monForm; - u16 moveID; - u8 monLevel; u16 *monLevelUpMoves = Heap_AllocFromHeap(0, 44); reencrypt = DecryptBoxMon(boxMon); - monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, 0); - monForm = GetBoxMonData(boxMon, MON_DATA_FORM, 0); - monLevel = GetBoxMonLevel(boxMon); + + u16 monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, 0); + int monForm = GetBoxMonData(boxMon, MON_DATA_FORM, 0); + u8 monLevel = GetBoxMonLevel(boxMon); LoadMonLevelUpMoves(monSpecies, monForm, monLevelUpMoves); - i = 0; + int i = 0; while (monLevelUpMoves[i] != 0xffff) { if ((monLevelUpMoves[i] & 0xfe00) <= (monLevel << 9)) { - monLevelUpMoveID = monLevelUpMoves[i] & 0x1ff; - moveID = AddBoxMonMove(boxMon, monLevelUpMoveID); + u16 monLevelUpMoveID = monLevelUpMoves[i] & 0x1ff; + u16 moveID = AddBoxMonMove(boxMon, monLevelUpMoveID); if (moveID == 0xffff) { ReplaceBoxMonMove(boxMon, monLevelUpMoveID); @@ -3362,16 +3248,12 @@ u16 AddMonMove (Pokemon *mon, u16 moveID) u16 AddBoxMonMove (BoxPokemon *boxMon, u16 moveID) { - int i; - u16 slotMove; - u16 result; - BOOL reencrypt; - - result = 0xffff; + u16 result = 0xffff; - reencrypt = DecryptBoxMon(boxMon); + BOOL reencrypt = DecryptBoxMon(boxMon); - for (i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { + u16 slotMove; if ((slotMove = GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, NULL)) == 0) { SetBoxMonMove(boxMon, moveID, i); result = moveID; @@ -3397,15 +3279,13 @@ void ReplaceMonMove (Pokemon *mon, u16 moveID) void ReplaceBoxMonMove (BoxPokemon *boxMon, u16 moveID) { - int i; + BOOL reencrypt = DecryptBoxMon(boxMon); + u16 moveIDs[4]; u8 movePPs[4]; u8 movePPUps[4]; - BOOL reencrypt; - reencrypt = DecryptBoxMon(boxMon); - - for (i = 0; i < 3; i++) { + for (int i = 0; i < 3; i++) { moveIDs[i] = GetBoxMonData(boxMon, MON_DATA_MOVE2 + i, NULL); movePPs[i] = GetBoxMonData(boxMon, MON_DATA_MOVE2_CUR_PP + i, NULL); movePPUps[i] = GetBoxMonData(boxMon, MON_DATA_MOVE2_PP_UPS + i, NULL); @@ -3415,7 +3295,7 @@ void ReplaceBoxMonMove (BoxPokemon *boxMon, u16 moveID) movePPs[3] = MoveTable_LoadParam(moveID, 5); movePPUps[3] = 0; - for (i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { SetBoxMonData(boxMon, MON_DATA_MOVE1 + i, &moveIDs[i]); SetBoxMonData(boxMon, MON_DATA_MOVE1_CUR_PP + i, &movePPs[i]); SetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + i, &movePPUps[i]); @@ -3426,11 +3306,10 @@ void ReplaceBoxMonMove (BoxPokemon *boxMon, u16 moveID) void ResetMonMove (Pokemon *mon, u16 moveID, u8 moveSlot) { - u32 moveMaxPP, movePPUps; - SetMonMove(mon, moveID, moveSlot); - movePPUps = 0; + u32 moveMaxPP; + u32 movePPUps = 0; SetMonData(mon, MON_DATA_MOVE1_PP_UPS + moveSlot, &movePPUps); moveMaxPP = MoveTable_CalcMaxPP(moveID, 0); @@ -3446,13 +3325,10 @@ void SetMonMove (Pokemon *mon, u16 moveID, u8 moveSlot) void SetBoxMonMove (BoxPokemon *boxMon, u16 moveID, u8 moveSlot) { - u8 moveMaxPP; - u8 movePPUps; - SetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot, &moveID); - movePPUps = GetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot, NULL); - moveMaxPP = MoveTable_CalcMaxPP(moveID, movePPUps); + u8 movePPUps = GetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot, NULL); + u8 moveMaxPP = MoveTable_CalcMaxPP(moveID, movePPUps); SetBoxMonData(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot, &moveMaxPP); } @@ -3460,14 +3336,11 @@ void SetBoxMonMove (BoxPokemon *boxMon, u16 moveID, u8 moveSlot) u16 sub_0207727C (Pokemon *mon, int *index, u16 *moveID) { u16 result = 0x0; - u16 monSpecies; - int monForm; - u8 monLevel; u16 *monLevelUpMoves = Heap_AllocFromHeap(0, 44); - monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); - monForm = GetMonData(mon, MON_DATA_FORM, NULL); - monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); + u16 monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + int monForm = GetMonData(mon, MON_DATA_FORM, NULL); + u8 monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); LoadMonLevelUpMoves(monSpecies, monForm, monLevelUpMoves); @@ -3525,12 +3398,11 @@ void SwapBoxMonMoves (BoxPokemon *boxMon, int moveSlot1, int moveSlot2) void DeleteMonMove (Pokemon *mon, u32 moveSlot) { - u32 i; u16 moveID; u8 movePP; u8 movePPUps; - for (i = moveSlot; i < 3; i++) { + for (u32 i = moveSlot; i < 3; i++) { moveID = GetMonData(mon, MON_DATA_MOVE1 + i + 1, NULL); movePP = GetMonData(mon, MON_DATA_MOVE1_CUR_PP + i + 1, NULL); movePPUps = GetMonData(mon, MON_DATA_MOVE1_PP_UPS + i + 1, NULL); @@ -3552,7 +3424,6 @@ void DeleteMonMove (Pokemon *mon, u32 moveSlot) BOOL MonHasMove (Pokemon *mon, u16 moveID) { int i; - for (i = 0; i < 4; i++) { if (GetMonData(mon, MON_DATA_MOVE1 + i, NULL) == moveID) { break; @@ -3565,11 +3436,8 @@ BOOL MonHasMove (Pokemon *mon, u16 moveID) void sub_020774C8 (BoxPokemon *boxMon, Pokemon *mon) { u32 zero = 0; - UnkStruct_0202818C *v1; - UnkStruct_0202CA28 v2; mon->box = *boxMon; - if (mon->box.boxDecrypted) { mon->box.partyDecrypted = 1; } @@ -3578,32 +3446,30 @@ void sub_020774C8 (BoxPokemon *boxMon, Pokemon *mon) SetMonData(mon, MON_DATA_CURRENT_HP, &zero); SetMonData(mon, MON_DATA_MAX_HP, &zero); - v1 = sub_0202818C(0); - + UnkStruct_0202818C *v1 = sub_0202818C(0); SetMonData(mon, MON_DATA_170, v1); Heap_FreeToHeap(v1); + SetMonData(mon, MON_DATA_162, &zero); + UnkStruct_0202CA28 v2; MI_CpuClearFast(&v2, sizeof(UnkStruct_0202CA28)); - SetMonData(mon, MON_DATA_171, &v2); + CalculateMonLevelAndStats(mon); } u8 GetPartyHighestLevel (Party *party) { - u8 result, monLevel; - int i, currentPartyCount; - Pokemon *mon; + int currentPartyCount = Party_GetCurrentCount(party); - currentPartyCount = Party_GetCurrentCount(party); - result = 1; + u8 result = 1; - for (i = 0; i < currentPartyCount; i++) { - mon = Party_GetPokemonBySlotIndex(party, i); + for (int i = 0; i < currentPartyCount; i++) { + Pokemon *mon = Party_GetPokemonBySlotIndex(party, i); if ((GetMonData(mon, MON_DATA_SPECIES, NULL)) && (GetMonData(mon, MON_DATA_IS_EGG, NULL) == 0)) { - monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); + u8 monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); if (monLevel > result) { result = monLevel; @@ -3664,20 +3530,17 @@ s8 sub_02077634 (BoxPokemon *boxMon, int param1) s8 sub_02077648 (u32 monPersonality, int param1) { - u8 monNature; - - monNature = GetNatureFromPersonality(monPersonality); + u8 monNature = GetNatureFromPersonality(monPersonality); return Unk_020F0695[monNature][param1]; } int GetMonLevelUpMoveIDs (int monSpecies, int monForm, u16 *monLevelUpMoveIDs) { - int result; u16 *monLevelUpMoves = Heap_AllocFromHeap(0, 44); LoadMonLevelUpMoves(monSpecies, monForm, monLevelUpMoves); - result = 0; + int result = 0; while (monLevelUpMoves[result] != 0xffff) { monLevelUpMoveIDs[result] = monLevelUpMoves[result] & 0x1ff; @@ -3690,16 +3553,12 @@ int GetMonLevelUpMoveIDs (int monSpecies, int monForm, u16 *monLevelUpMoveIDs) void sub_020776B0 (Party *party) { - u16 rand; - u8 monPokerus; - Pokemon *mon; - int currentPartyCount; - int partySlot; - - currentPartyCount = Party_GetCurrentCount(party); - rand = LCRNG_Next(); + int currentPartyCount = Party_GetCurrentCount(party); + u16 rand = LCRNG_Next(); if ((rand == 16384) || (rand == 32768) || (rand == 49152)) { + int partySlot; + Pokemon *mon; do { partySlot = LCRNG_Next() % currentPartyCount; mon = Party_GetPokemonBySlotIndex(party, partySlot); @@ -3712,6 +3571,7 @@ void sub_020776B0 (Party *party) } while (partySlot == currentPartyCount); if (sub_02077758(party, GetSingleBitMask(partySlot)) == 0) { + u8 monPokerus; do { monPokerus = LCRNG_Next() & 0xff; } while ((monPokerus & 0x7) == 0); @@ -3733,13 +3593,12 @@ u8 sub_02077758 (Party *party, u8 param1) { int partySlot = 0; int v1 = 1; - u8 result = 0; - Pokemon *mon; + u8 result = 0; if (param1) { do { if (param1 & 1) { - mon = Party_GetPokemonBySlotIndex(party, partySlot); + Pokemon *mon = Party_GetPokemonBySlotIndex(party, partySlot); if (GetMonData(mon, MON_DATA_POKERUS, NULL)) { result |= v1; @@ -3751,7 +3610,7 @@ u8 sub_02077758 (Party *party, u8 param1) param1 = param1 >> 1; } while (param1 != 0); } else { - mon = Party_GetPokemonBySlotIndex(party, partySlot); + Pokemon *mon = Party_GetPokemonBySlotIndex(party, partySlot); if (GetMonData(mon, MON_DATA_POKERUS, NULL)) { result++; @@ -3763,18 +3622,13 @@ u8 sub_02077758 (Party *party, u8 param1) void sub_020777B4 (Party *party, s32 param1) { - int i; - int currentPartyCount; - u8 monPokerus; - Pokemon *mon; - - currentPartyCount = Party_GetCurrentCount(party); - - for (i = 0; i < currentPartyCount; i++) { - mon = Party_GetPokemonBySlotIndex(party, i); + int currentPartyCount = Party_GetCurrentCount(party); + for (int i = 0; i < currentPartyCount; i++) { + Pokemon *mon = Party_GetPokemonBySlotIndex(party, i); + if (GetMonData(mon, MON_DATA_SPECIES, NULL)) { - monPokerus = GetMonData(mon, MON_DATA_POKERUS, NULL); + u8 monPokerus = GetMonData(mon, MON_DATA_POKERUS, NULL); if (monPokerus & 0xf) { if (((monPokerus & 0xf) < param1) || (param1 > 4)) { @@ -3795,19 +3649,14 @@ void sub_020777B4 (Party *party, s32 param1) void sub_0207782C (Party *party) { - int i; - int currentPartyCount; - u8 monPokerus; - Pokemon *mon; - - currentPartyCount = Party_GetCurrentCount(party); + int currentPartyCount = Party_GetCurrentCount(party); if (LCRNG_Next() % 3 == 0) { - for (i = 0; i < currentPartyCount; i++) { - mon = Party_GetPokemonBySlotIndex(party, i); + for (int i = 0; i < currentPartyCount; i++) { + Pokemon *mon = Party_GetPokemonBySlotIndex(party, i); if (GetMonData(mon, MON_DATA_SPECIES, NULL)) { - monPokerus = GetMonData(mon, MON_DATA_POKERUS, NULL); + u8 monPokerus = GetMonData(mon, MON_DATA_POKERUS, NULL); if (monPokerus & 0xf) { if (i != 0) { @@ -3849,9 +3698,7 @@ BOOL sub_020778F8 (Pokemon *mon) BOOL sub_02077900 (BoxPokemon *boxMon) { - u8 monPokerus; - - monPokerus = GetBoxMonData(boxMon, MON_DATA_POKERUS, NULL); + u8 monPokerus = GetBoxMonData(boxMon, MON_DATA_POKERUS, NULL); if (monPokerus & 0xf) { return 0; @@ -3867,17 +3714,12 @@ void SetArceusForm (Pokemon *mon) void SetBoxArceusForm (BoxPokemon *boxMon) { - int monSpecies; - int monAbility; - int monHeldItem; - int monForm; - - monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); - monAbility = GetBoxMonData(boxMon, MON_DATA_ABILITY, NULL); - monHeldItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM, NULL); + int monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); + int monAbility = GetBoxMonData(boxMon, MON_DATA_ABILITY, NULL); + int monHeldItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM, NULL); if ((monSpecies == SPECIES_ARCEUS) && (monAbility == 121)) { - monForm = GetArceusItemType(Item_LoadParam(monHeldItem, 1, 0)); + int monForm = GetArceusItemType(Item_LoadParam(monHeldItem, 1, 0)); SetBoxMonData(boxMon, MON_DATA_FORM, &monForm); } } @@ -3945,9 +3787,7 @@ u8 GetArceusItemType (u16 itemHoldEffect) int SetGiratinaForm (Pokemon *mon) { - int result; - - result = SetBoxGiratinaForm(&mon->box); + int result = SetBoxGiratinaForm(&mon->box); if (result != -1) { CalculateMonLevelAndStats(mon); @@ -3958,15 +3798,11 @@ int SetGiratinaForm (Pokemon *mon) int SetBoxGiratinaForm (BoxPokemon *boxMon) { - int monSpecies; - int monHeldItem; - int monForm; - - monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); - monHeldItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM, NULL); + int monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); + int monHeldItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM, NULL); if (monSpecies == SPECIES_GIRATINA) { - monForm = (monHeldItem == ITEM_GRISEOUS_ORB) ? 1 : 0; + int monForm = (monHeldItem == ITEM_GRISEOUS_ORB) ? 1 : 0; SetBoxMonData(boxMon, MON_DATA_FORM, &monForm); CalculateBoxMonAbility(boxMon); @@ -3990,13 +3826,10 @@ void SetGiratinaOriginForm (Pokemon *mon) void SetPartyGiratinaForm (Party *party, int param1) { - int i, currentPartyCount; - Pokemon *mon; + int currentPartyCount = Party_GetCurrentCount(party); - currentPartyCount = Party_GetCurrentCount(party); - - for (i = 0; i < currentPartyCount; i++) { - mon = Party_GetPokemonBySlotIndex(party, i); + for (int i = 0; i < currentPartyCount; i++) { + Pokemon *mon = Party_GetPokemonBySlotIndex(party, i); if (param1) { SetGiratinaOriginForm(mon); @@ -4014,9 +3847,7 @@ void SetShayminForm (Pokemon *mon, int monForm) void SetBoxShayminForm (BoxPokemon *boxMon, int monForm) { - int monSpecies; - - monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); + int monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); if (monSpecies == SPECIES_SHAYMIN) { GF_ASSERT(monForm <= 1); @@ -4028,15 +3859,13 @@ void SetBoxShayminForm (BoxPokemon *boxMon, int monForm) BOOL CanShayminSkyForm (Pokemon *mon) { - u32 monSpecies, monForm, v2, monCurrentHP, monFatefulEncounter; - RTCTime rtcTime; - - monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); - monForm = GetMonData(mon, MON_DATA_FORM, NULL); - v2 = GetMonData(mon, MON_DATA_160, NULL); - monCurrentHP = GetMonData(mon, MON_DATA_CURRENT_HP, NULL); - monFatefulEncounter = GetMonData(mon, MON_DATA_FATEFUL_ENCOUNTER, NULL); + u32 monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + u32 monForm = GetMonData(mon, MON_DATA_FORM, NULL); + u32 v2 = GetMonData(mon, MON_DATA_160, NULL); + u32 monCurrentHP = GetMonData(mon, MON_DATA_CURRENT_HP, NULL); + u32 monFatefulEncounter = GetMonData(mon, MON_DATA_FATEFUL_ENCOUNTER, NULL); + RTCTime rtcTime; sub_02013880(&rtcTime); if ((monSpecies == SPECIES_SHAYMIN) && (monForm == 0) && (monCurrentHP > 0) && (monFatefulEncounter == 1) && ((v2 & 0x20) == 0) && ((rtcTime.hour >= 4) && (rtcTime.hour < 20))) { @@ -4048,18 +3877,15 @@ BOOL CanShayminSkyForm (Pokemon *mon) void SetShayminLandForm (Party *party) { - int i, currentPartyCount, monSpecies, monForm; - Pokemon *mon; - int zero = 0; - - currentPartyCount = Party_GetCurrentCount(party); + int currentPartyCount = Party_GetCurrentCount(party); - for (i = 0; i < currentPartyCount; i++) { - mon = Party_GetPokemonBySlotIndex(party, i); - monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); - monForm = GetMonData(mon, MON_DATA_FORM, NULL); + for (int i = 0; i < currentPartyCount; i++) { + Pokemon *mon = Party_GetPokemonBySlotIndex(party, i); + int monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + int monForm = GetMonData(mon, MON_DATA_FORM, NULL); if ((monSpecies == SPECIES_SHAYMIN) && (monForm == 1)) { + int zero = 0; SetShayminForm(mon, zero); } } @@ -4067,17 +3893,15 @@ void SetShayminLandForm (Party *party) BOOL SetPartyShayminForm (Party *party, int param1, const RTCTime *rtcTime) { - s32 hours, minutes; - if ((rtcTime->hour >= 20) || (rtcTime->hour < 4)) { - hours = rtcTime->hour; + s32 hours = rtcTime->hour; if (hours < 4) { hours += 24; } hours -= 20; - minutes = rtcTime->minute + hours * 60; + s32 minutes = rtcTime->minute + hours * 60; param1++; @@ -4088,7 +3912,7 @@ BOOL SetPartyShayminForm (Party *party, int param1, const RTCTime *rtcTime) return 0; } else { - minutes = rtcTime->minute + (rtcTime->hour - 4) * 60; + s32 minutes = rtcTime->minute + (rtcTime->hour - 4) * 60; if (minutes < param1) { SetShayminLandForm(party); @@ -4101,65 +3925,62 @@ BOOL SetPartyShayminForm (Party *party, int param1, const RTCTime *rtcTime) BOOL SetRotomForm (Pokemon *mon, int monForm, int moveSlot) { - int monSpecies, currentMonForm; - - monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + int monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); if (monSpecies != SPECIES_ROTOM) { return 0; } - currentMonForm = GetMonData(mon, MON_DATA_FORM, NULL); + int currentMonForm = GetMonData(mon, MON_DATA_FORM, NULL); - { - int i, j, newFormMoveID, moveID; - static const u16 rotomFormMoves[] = { - MOVE_NONE, - MOVE_OVERHEAT, - MOVE_HYDRO_PUMP, - MOVE_BLIZZARD, - MOVE_AIR_SLASH, - MOVE_LEAF_STORM - }; - - newFormMoveID = rotomFormMoves[monForm]; + static const u16 rotomFormMoves[] = { + MOVE_NONE, + MOVE_OVERHEAT, + MOVE_HYDRO_PUMP, + MOVE_BLIZZARD, + MOVE_AIR_SLASH, + MOVE_LEAF_STORM + }; - for (i = 0; i < 4; i++) { - moveID = GetMonData(mon, MON_DATA_MOVE1 + i, NULL); - - for (j = 1; j < NELEMS(rotomFormMoves); j++) { - if ((moveID != 0) && (moveID == rotomFormMoves[j])) { - if (newFormMoveID != 0) { - ResetMonMove(mon, newFormMoveID, i); - newFormMoveID = 0; - break; - } else { - DeleteMonMove(mon, i); - i--; - break; - } - } - } - } + int newFormMoveID = rotomFormMoves[monForm]; - if (newFormMoveID != 0) { - for (i = 0; i < 4; i++) { - if (GetMonData(mon, MON_DATA_MOVE1 + i, NULL) == 0) { + int i; + for (i = 0; i < 4; i++) { + int j; + int moveID = GetMonData(mon, MON_DATA_MOVE1 + i, NULL); + + for (j = 1; j < NELEMS(rotomFormMoves); j++) { + if ((moveID != 0) && (moveID == rotomFormMoves[j])) { + if (newFormMoveID != 0) { ResetMonMove(mon, newFormMoveID, i); + newFormMoveID = 0; + break; + } else { + DeleteMonMove(mon, i); + i--; break; } } + } + } - if (i == 4) { - ResetMonMove(mon, newFormMoveID, moveSlot); + if (newFormMoveID != 0) { + for (i = 0; i < 4; i++) { + if (GetMonData(mon, MON_DATA_MOVE1 + i, NULL) == 0) { + ResetMonMove(mon, newFormMoveID, i); + break; } } - if (GetMonData(mon, MON_DATA_MOVE1, NULL) == 0) { - ResetMonMove(mon, MOVE_THUNDER_SHOCK, 0); + if (i == 4) { + ResetMonMove(mon, newFormMoveID, moveSlot); } } + if (GetMonData(mon, MON_DATA_MOVE1, NULL) == 0) { + ResetMonMove(mon, MOVE_THUNDER_SHOCK, 0); + } + SetMonData(mon, MON_DATA_FORM, &monForm); CalculateMonAbility(mon); CalculateMonLevelAndStats(mon); @@ -4211,22 +4032,18 @@ void sub_02077DB4 (UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int p BOOL sub_02077E3C (Pokemon *mon) { - int monSpecies, monForm; - - monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); - monForm = GetMonData(mon, MON_DATA_FORM, NULL); + int monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + int monForm = GetMonData(mon, MON_DATA_FORM, NULL); return sub_02005844(monSpecies, monForm); } void sub_02077E64 (Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) { - int monMaxHP; - sub_02077EA4(&mon->box, param1, monPokeball, param3, param4, param5); if (monPokeball == ITEM_HEAL_BALL) { - monMaxHP = GetMonData(mon, MON_DATA_MAX_HP, NULL); + int monMaxHP = GetMonData(mon, MON_DATA_MAX_HP, NULL); SetMonData(mon, MON_DATA_CURRENT_HP, &monMaxHP); monMaxHP = 0; @@ -4259,20 +4076,15 @@ static const u16 sHeldItemChance[][2] = { void sub_02077F0C (Pokemon *mon, u32 param1, int param2) { - u32 rand; - u16 monSpecies; - u16 monForm; - u16 monItem1, monItem2; - if (param1 & ((0x1 | 0x80))) { return; } - rand = LCRNG_Next() % 100; - monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); - monForm = GetMonData(mon, MON_DATA_FORM, NULL); - monItem1 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ITEM1); - monItem2 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ITEM2); + u32 rand = LCRNG_Next() % 100; + u16 monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + u16 monForm = GetMonData(mon, MON_DATA_FORM, NULL); + u16 monItem1 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ITEM1); + u16 monItem2 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ITEM2); if ((monItem1 == monItem2) && (monItem1 != 0)) { SetMonData(mon, MON_DATA_HELD_ITEM, &monItem1); @@ -4295,24 +4107,20 @@ BOOL CanMonLearnTM (Pokemon *mon, u8 tmID) BOOL CanBoxMonLearnTM (BoxPokemon *boxMon, u8 tmID) { - u16 monSpeciesEgg; - int monForm; - - monSpeciesEgg = GetBoxMonData(boxMon, MON_DATA_SPECIES_EGG, NULL); - monForm = GetBoxMonData(boxMon, MON_DATA_FORM, NULL); + u16 monSpeciesEgg = GetBoxMonData(boxMon, MON_DATA_SPECIES_EGG, NULL); + int monForm = GetBoxMonData(boxMon, MON_DATA_FORM, NULL); return CanMonSpeciesLearnTM(monSpeciesEgg, monForm, tmID); } BOOL CanMonSpeciesLearnTM (u16 monSpecies, int monForm, u8 tmID) { - u32 tmFlag; - u8 monPersonalDataAttribute; - if (monSpecies == SPECIES_EGG) { return 0; } + u32 tmFlag; + u8 monPersonalDataAttribute; if (tmID < 32) { tmFlag = (1 << tmID); monPersonalDataAttribute = MON_DATA_PERSONAL_TM_LEARNSET_MASK_1; @@ -4337,17 +4145,12 @@ void CalculateMonAbility (Pokemon *mon) void CalculateBoxMonAbility (BoxPokemon *boxMon) { - BOOL reencrypt; - int monSpecies, monForm; - int monAbility1, monAbility2; - u32 monPersonality; - - reencrypt = DecryptBoxMon(boxMon); - monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); - monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); - monForm = GetBoxMonData(boxMon, MON_DATA_FORM, NULL); - monAbility1 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ABILITY_1); - monAbility2 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ABILITY_2); + BOOL reencrypt = DecryptBoxMon(boxMon); + int monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); + u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); + int monForm = GetBoxMonData(boxMon, MON_DATA_FORM, NULL); + int monAbility1 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ABILITY_1); + int monAbility2 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ABILITY_2); if (monAbility2 != 0) { if (monPersonality & 1) { @@ -4364,28 +4167,18 @@ void CalculateBoxMonAbility (BoxPokemon *boxMon) void sub_020780C4 (Pokemon *mon, u32 monPersonality) { - Pokemon *newMon; - PokemonDataBlockA *newMonBlockA; - PokemonDataBlockB *newMonBlockB; - PokemonDataBlockC *newMonBlockC; - PokemonDataBlockD *newMonBlockD; - PokemonDataBlockA *monBlockA; - PokemonDataBlockB *monBlockB; - PokemonDataBlockC *monBlockC; - PokemonDataBlockD *monBlockD; - - newMon = AllocMonZeroed(0); + Pokemon *newMon = AllocMonZeroed(0); sub_020775EC(mon, newMon); - newMonBlockA = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 0); - newMonBlockB = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 1); - newMonBlockC = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 2); - newMonBlockD = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 3); - monBlockA = GetBoxMonDataBlock(&mon->box, monPersonality, 0); - monBlockB = GetBoxMonDataBlock(&mon->box, monPersonality, 1); - monBlockC = GetBoxMonDataBlock(&mon->box, monPersonality, 2); - monBlockD = GetBoxMonDataBlock(&mon->box, monPersonality, 3); + PokemonDataBlockA *newMonBlockA = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 0); + PokemonDataBlockB *newMonBlockB = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 1); + PokemonDataBlockC *newMonBlockC = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 2); + PokemonDataBlockD *newMonBlockD = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 3); + PokemonDataBlockA *monBlockA = GetBoxMonDataBlock(&mon->box, monPersonality, 0); + PokemonDataBlockB *monBlockB = GetBoxMonDataBlock(&mon->box, monPersonality, 1); + PokemonDataBlockC *monBlockC = GetBoxMonDataBlock(&mon->box, monPersonality, 2); + PokemonDataBlockD *monBlockD = GetBoxMonDataBlock(&mon->box, monPersonality, 3); DecryptMonData(&newMon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, newMon->box.checksum); DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); @@ -4434,9 +4227,10 @@ static void DecryptMonData (void *data, u32 bytes, u32 seed) static u16 GetMonDataChecksum (void *data, u32 bytes) { int i; - u16 *dataWords = data; u16 checksum = 0; + u16 *dataWords = data; + for (i = 0; i < bytes / 2; i++) { checksum += dataWords[i]; } @@ -4467,12 +4261,10 @@ static u16 GetMonDataChecksum (void *data, u32 bytes) static void * GetBoxMonDataBlock (BoxPokemon *boxMon, u32 personality, u8 dataBlockID) { - void *result; - personality = (personality & 0x3e000) >> 13; - GF_ASSERT(personality <= 31); + void *result; switch (personality) { case 0: case 24: @@ -4623,9 +4415,7 @@ static const u16 Unk_020F05BE[18] = { BOOL sub_02078804 (u16 param0) { - u32 i; - - for (i = 0; i < NELEMS(Unk_020F05BE); i++) { + for (u32 i = 0; i < NELEMS(Unk_020F05BE); i++) { if (param0 == Unk_020F05BE[i]) { return 1; } @@ -4705,11 +4495,9 @@ int sub_020788D0 (int param0) void sub_0207893C (Pokemon *mon) { - u8 zero; - UnkStruct_0202CA28 v1; - - zero = 0; + u8 zero = 0; + UnkStruct_0202CA28 v1; MI_CpuClearFast(&v1, sizeof(UnkStruct_0202CA28)); SetMonData(mon, MON_DATA_162, &zero); @@ -4718,12 +4506,9 @@ void sub_0207893C (Pokemon *mon) void sub_0207896C (BoxPokemon *boxMon) { - BOOL reencrypt; - int i; + BOOL reencrypt = DecryptBoxMon(boxMon); - reencrypt = DecryptBoxMon(boxMon); - - for (i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { if (GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, NULL)) { u8 moveMaxPP = GetBoxMonData(boxMon, MON_DATA_MOVE1_MAX_PP + i, NULL); @@ -4736,34 +4521,27 @@ void sub_0207896C (BoxPokemon *boxMon) static inline int GetLowestBitInverse (int num) { - int result; - - result = (num & 0x1) ? 0 : 1; + int result = (num & 0x1) ? 0 : 1; return result; } void sub_020789BC (NARC *narc, UnkStruct_02007C10 *param1, u16 param2, u16 param3) { - UnkStruct_020789BC v0; - int v1; - - v1 = GetLowestBitInverse(param3); + int v1 = GetLowestBitInverse(param3); + UnkStruct_020789BC v0; NARC_ReadFromMember(narc, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); MI_CpuCopy8(&v0.unk_00[v1].unk_03[0], param1, sizeof(UnkStruct_02007C10) * 10); } void sub_020789F4 (NARC *narc, UnkStruct_02015F84 *param1, UnkStruct_02007C7C *param2, u16 param3, int param4, int param5, int param6) { - UnkStruct_020789F4 v0; - UnkStruct_020789BC v1; - int v2; - int v3; - - v3 = (param4 == 2) ? 0 : 1; + int v3 = (param4 == 2) ? 0 : 1; + UnkStruct_020789BC v1; NARC_ReadFromMember(narc, 0, param3 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v1); + UnkStruct_020789F4 v0; v0.unk_00 = v1.unk_00[v3].unk_01; v0.unk_02 = v1.unk_00[v3].unk_02; v0.unk_04 = param5; @@ -4773,10 +4551,9 @@ void sub_020789F4 (NARC *narc, UnkStruct_02015F84 *param1, UnkStruct_02007C7C *p void sub_02078A4C (NARC *narc, u8 *param1, u16 param2, u16 param3) { - UnkStruct_020789BC v0; - int v1; + int v1 = GetLowestBitInverse(param3); - v1 = GetLowestBitInverse(param3); + UnkStruct_020789BC v0; NARC_ReadFromMember(narc, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); *param1 = v0.unk_00[v1].unk_00; @@ -4808,21 +4585,18 @@ void sub_02078AC8 (NARC *narc, u8 *param1, u16 param2) BOOL sub_02078AEC (int param0, Pokemon *mon, int heapID) { - int v0; - int one; - UnkStruct_0202CA28 v2; - NARC *narc; - v0 = param0; + int v0 = param0; if (v0 == 0) { return 0; } - narc = NARC_ctor(NARC_INDEX_APPLICATION__CUSTOM_BALL__EDIT__PL_CB_DATA, heapID); + NARC *narc = NARC_ctor(NARC_INDEX_APPLICATION__CUSTOM_BALL__EDIT__PL_CB_DATA, heapID); v0 = v0 - 1; - one = 1; + int one = 1; + UnkStruct_0202CA28 v2; NARC_ReadFromMember(narc, 0, v0 * sizeof(UnkStruct_0202CA28), sizeof(UnkStruct_0202CA28), &v2); SetMonData(mon, MON_DATA_162, &one); SetMonData(mon, MON_DATA_171, &v2); @@ -4833,23 +4607,16 @@ BOOL sub_02078AEC (int param0, Pokemon *mon, int heapID) void sub_02078B40 (Pokemon *mon, UnkStruct_02078B40 *param1) { - BoxPokemon *boxMon; - PokemonDataBlockA *monDataBlockA; - PokemonDataBlockB *monDataBlockB; - PokemonDataBlockC *monDataBlockC; - PokemonDataBlockD *monDataBlockD; - int i; - if (mon->box.partyDecrypted == 0) { DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } - boxMon = GetBoxMon(mon); - monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); - monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); - monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); - monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); + BoxPokemon *boxMon = GetBoxMon(mon); + PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); + PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); + PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); + PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); param1->personality = boxMon->personality; param1->partyDecrypted = 0; @@ -4869,6 +4636,7 @@ void sub_02078B40 (Pokemon *mon, UnkStruct_02078B40 *param1) param1->spDefEV = monDataBlockA->spDefEV; param1->originLanguage = monDataBlockA->originLanguage; + int i; for (i = 0; i < 4; i++) { param1->unk_1C[i] = monDataBlockB->moves[i]; param1->unk_24[i] = monDataBlockB->moveCurrentPPs[i]; @@ -4916,20 +4684,13 @@ void sub_02078B40 (Pokemon *mon, UnkStruct_02078B40 *param1) void sub_02078E0C (UnkStruct_02078B40 *param0, Pokemon *mon) { - BoxPokemon *boxMon; - PokemonDataBlockA *monDataBlockA; - PokemonDataBlockB *monDataBlockB; - PokemonDataBlockC *monDataBlockC; - PokemonDataBlockD *monDataBlockD; - int i; - MI_CpuClearFast(mon, sizeof(Pokemon)); - boxMon = GetBoxMon(mon); - monDataBlockA = GetBoxMonDataBlock(boxMon, param0->personality, 0); - monDataBlockB = GetBoxMonDataBlock(boxMon, param0->personality, 1); - monDataBlockC = GetBoxMonDataBlock(boxMon, param0->personality, 2); - monDataBlockD = GetBoxMonDataBlock(boxMon, param0->personality, 3); + BoxPokemon *boxMon = GetBoxMon(mon); + PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, param0->personality, 0); + PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, param0->personality, 1); + PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, param0->personality, 2); + PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, param0->personality, 3); boxMon->personality = param0->personality; boxMon->partyDecrypted = 0; @@ -4950,6 +4711,7 @@ void sub_02078E0C (UnkStruct_02078B40 *param0, Pokemon *mon) monDataBlockA->spDefEV = param0->spDefEV; monDataBlockA->originLanguage = param0->originLanguage; + int i; for (i = 0; i < 4; i++) { monDataBlockB->moves[i] = param0->unk_1C[i]; monDataBlockB->moveCurrentPPs[i] = param0->unk_24[i]; From eb95f78914406acfd94f8cdd50d753dd2ad9f6c7 Mon Sep 17 00:00:00 2001 From: wildfire Date: Sat, 9 Sep 2023 23:09:24 +0100 Subject: [PATCH 06/11] More cleanup of pokemon.c --- include/constants/pokemon.h | 74 ++- include/pokemon.h | 49 +- include/struct_defs/pokemon_personal_data.h | 9 +- src/pokemon.c | 630 +++++++++++--------- 4 files changed, 433 insertions(+), 329 deletions(-) diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index 9d0cbf0137..d741c47a96 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -1,32 +1,57 @@ #ifndef POKEPLATINUM_CONSTANTS_POKEMON_H #define POKEPLATINUM_CONSTANTS_POKEMON_H -// Pokemon types -#define TYPE_NONE 255 -#define TYPE_NORMAL 0 -#define TYPE_FIGHTING 1 -#define TYPE_FLYING 2 -#define TYPE_POISON 3 -#define TYPE_GROUND 4 -#define TYPE_ROCK 5 -#define TYPE_BUG 6 -#define TYPE_GHOST 7 -#define TYPE_STEEL 8 -#define TYPE_MYSTERY 9 -#define TYPE_FIRE 10 -#define TYPE_WATER 11 -#define TYPE_GRASS 12 -#define TYPE_ELECTRIC 13 -#define TYPE_PSYCHIC 14 -#define TYPE_ICE 15 -#define TYPE_DRAGON 16 -#define TYPE_DARK 17 -#define NUMBER_OF_MON_TYPES 18 +/** + * @brief Pokemon Types + */ +enum PokemonType { + TYPE_NORMAL = 0, + TYPE_FIGHTING, + TYPE_FLYING, + TYPE_POISON, + TYPE_GROUND, + TYPE_ROCK, + TYPE_BUG, + TYPE_GHOST, + TYPE_STEEL, + TYPE_MYSTERY, + TYPE_FIRE, + TYPE_WATER, + TYPE_GRASS, + TYPE_ELECTRIC, + TYPE_PSYCHIC, + TYPE_ICE, + TYPE_DRAGON, + TYPE_DARK, + NUMBER_OF_MON_TYPES, + TYPE_NONE = 255, +}; + +/** + * @brief Pokemon Stats + */ +enum PokemonStats { + STAT_HP = 0, + STAT_ATTACK, + STAT_DEFENSE, + STAT_SPEED, + STAT_SPECIAL_ATTACK, + STAT_SPECIAL_DEFENSE +}; #define MAX_PARTY_SIZE 6 #define NUM_BOOSTABLE_STATS 8 -enum { +enum PokemonGender { + MON_GENDER_MALE, + MON_GENDER_FEMALE, + MON_GENDER_NONE +}; + +/** + * @brief Pokemon Data Parameters + */ +enum PokemonDataParam { MON_DATA_PERSONALITY, MON_DATA_1, MON_DATA_2, @@ -209,7 +234,10 @@ enum { MON_DATA_179, }; -enum { +/** + * @brief PokemonPersonalData Parameters + */ +enum PokemonPersonalDataParam { MON_DATA_PERSONAL_BASE_HP = 0, MON_DATA_PERSONAL_BASE_ATK, MON_DATA_PERSONAL_BASE_DEF, diff --git a/include/pokemon.h b/include/pokemon.h index a093b05d87..454f78aefd 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -48,7 +48,7 @@ int PokemonStructSize(void); * @param heapID * @return A new empty but encrypted Pokemon struct */ -Pokemon * AllocMonZeroed(u32 heapID); +Pokemon *AllocMonZeroed(u32 heapID); /** * @brief Decrypts a Pokemon data structure. PartyPokemon data is encrypted using the pokemons personality value, BoxPokemon data using a checksum value @@ -84,8 +84,11 @@ BOOL DecryptBoxMon(BoxPokemon *boxMon); */ BOOL EncryptBoxMon(BoxPokemon *boxMon, BOOL encrypt); -void sub_02073D80(Pokemon *mon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); -void sub_02073E18(BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); +void sub_02073D80(Pokemon *mon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); + +// TODO make this static? +void sub_02073E18(BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); + void sub_02074044(Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monNature); void sub_02074088(Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 param4, u8 param5, u8 param6); u32 sub_02074128(u16 monSpecies, u8 param1, u8 param2); @@ -109,39 +112,39 @@ void CalculateMonStats(Pokemon *mon); * @brief Gets a value from a Pokemon, storing it in dest if neccessary * * @param mon - * @param monDataAttribute + * @param param * @param[out] dest Pointer for storing longer data * @return The requested value */ -u32 GetMonData(Pokemon *mon, int monDataAttribute, void *dest); +u32 GetMonData(Pokemon *mon, enum PokemonDataParam param, void *dest); /** * @brief Gets a value from a Pokemon, storing it in dest if neccessary * * @param boxMon - * @param monDataAttribute + * @param param * @param[out] dest Pointer for storing longer data * @return The requested value */ -u32 GetBoxMonData(BoxPokemon *boxMon, int monDataAttribute, void *dest); +u32 GetBoxMonData(BoxPokemon *boxMon, enum PokemonDataParam param, void *dest); /** * @brief Sets a value in a Pokemon, reading it from value if neccessary * * @param mon - * @param monDataAttribute + * @param param * @param value */ -void SetMonData(Pokemon *mon, int monDataAttribute, const void *value); +void SetMonData(Pokemon *mon, enum PokemonDataParam param, const void *value); /** * @brief Sets a value in a BoxPokemon, reading it from value if neccessary * * @param boxMon - * @param monDataAttribute + * @param param * @param value */ -void SetBoxMonData(BoxPokemon *boxMon, int monDataAttribute, const void *value); +void SetBoxMonData(BoxPokemon *boxMon, enum PokemonDataParam param, const void *value); /** * @brief Increases some numerical fields in a Pokemon by the given value. Does nothing if the field is not supported @@ -149,10 +152,10 @@ void SetBoxMonData(BoxPokemon *boxMon, int monDataAttribute, const void *value); * @todo list of supported fields? * * @param mon - * @param monDataAttribute + * @param param * @param value */ -void IncreaseMonData(Pokemon *mon, int monDataAttribute, int value); +void IncreaseMonData(Pokemon *mon, enum PokemonDataParam param, int value); /** * @brief Gets a PokemonPersonalData based on a pokemon species and form @@ -162,7 +165,7 @@ void IncreaseMonData(Pokemon *mon, int monDataAttribute, int value); * @param heapID The index of the heap that the PokemonPersonalData should be loaded into * @return PokemonPersonalData* */ -PokemonPersonalData * GetMonFormPersonalData(int monSpecies, int monForm, int heapID); +PokemonPersonalData *GetMonFormPersonalData(int monSpecies, int monForm, int heapID); /** * @brief Gets a PokemonPersonalData based on a pokemon species @@ -171,16 +174,16 @@ PokemonPersonalData * GetMonFormPersonalData(int monSpecies, int monForm, int he * @param heapID The index of the heap that the PokemonPersonalData should be loaded into * @return PokemonPersonalData* */ -PokemonPersonalData * GetMonPersonalData(int monSpecies, int heapID); +PokemonPersonalData *GetMonPersonalData(int monSpecies, int heapID); /** * @brief Gets a value from a PokemonPersonalData structure * * @param monPersonalData - * @param monPersonalDataAttribute What value to get + * @param param What value to get * @return The requested value */ -u32 GetMonPersonalDataAttribute(PokemonPersonalData *monPersonalData, int monPersonalDataAttribute); +u32 GetMonPersonalDataAttribute(PokemonPersonalData *monPersonalData, enum PokemonPersonalDataParam param); /** * @brief Frees a PokemonPersonalData structure from the heap @@ -194,19 +197,19 @@ void FreeMonPersonalData(PokemonPersonalData *monPersonalData); * * @param monSpecies * @param monForm - * @param monPersonalDataAttribute What value to get + * @param param What value to get * @return The requested value */ -u32 GetMonFormPersonalDataAttribute(int monSpecies, int monForm, int monPersonalDataAttribute); +u32 GetMonFormPersonalDataAttribute(int monSpecies, int monForm, enum PokemonPersonalDataParam param); /** * @brief Loads a PokemonPersonalData based on its species and gets a value from it * * @param monSpecies - * @param monPersonalDataAttribute What value to get + * @param param What value to get * @return The requested value */ -u32 GetMonSpeciesPersonalDataAttribute(int monSpecies, int monPersonalDataAttribute); +u32 GetMonSpeciesPersonalDataAttribute(int monSpecies, enum PokemonPersonalDataParam param); /** * @brief Gets how much progress a Pokemon has made towards its next level as a percentage @@ -399,7 +402,7 @@ u8 sub_020765B8(Pokemon *mon, u8 param1); u8 sub_020765C4(BoxPokemon *boxMon, u8 param1, int param2); u8 sub_02076648(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality); void sub_0207697C(UnkStruct_02008A90 *param0, u16 param1); -UnkStruct_0200D0F4 * sub_02076994(UnkStruct_0200C6E4 *param0, UnkStruct_0200C704 *param1, UnkStruct_02002F38 *param2, int param3, int param4, int param5, int param6, int param7, int heapID); +UnkStruct_0200D0F4 *sub_02076994(UnkStruct_0200C6E4 *param0, UnkStruct_0200C704 *param1, UnkStruct_02002F38 *param2, int param3, int param4, int param5, int param6, int param7, int heapID); void sub_02076AAC(int param0, int param1, UnkStruct_ov5_021DE5D0 *param2); /** @@ -438,7 +441,7 @@ u8 GetBoxMonForm(BoxPokemon *boxMon); * @param mon * @return The BoxPokemon data for a given Pokemon */ -BoxPokemon * GetBoxMon(Pokemon *mon); +BoxPokemon *GetBoxMon(Pokemon *mon); u8 sub_02076B14(Pokemon *mon); u16 sub_02076B94(Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int *evoTypeResult); diff --git a/include/struct_defs/pokemon_personal_data.h b/include/struct_defs/pokemon_personal_data.h index ee685ec380..d0c8d6eccc 100644 --- a/include/struct_defs/pokemon_personal_data.h +++ b/include/struct_defs/pokemon_personal_data.h @@ -22,6 +22,7 @@ typedef struct PokemonPersonalData { u16 evSpAtkYield : 2; //!< How many Special Attack EVs will be gained when defeating this pokemon u16 evSpDefYield : 2; //!< How many Special Defense EVs will be gained when defeating this pokemon u16 padding : 4; + u16 item1; //!< Common held item when this pokemon is encountered in the wild u16 item2; //!< Rare held item when this pokemon is encountered in the wild u8 gender; //!< The pokemons gender ratio, except for special values, a higher value will result in more females and a lower value will result in more males appearing @@ -35,10 +36,10 @@ typedef struct PokemonPersonalData { u8 greatMarshFleeRate; //!< The pokemons base flee rate in the Great Marsh safari zone u8 color : 7; //!< The pokemons color category u8 inverse : 1; - u32 tmLearnsetMask1; - u32 tmLearnsetMask2; - u32 tmLearnsetMask3; - u32 tmLearnsetMask4; + u32 tmLearnsetMask1; //!< Bitflags for whether this pokemon can learn a TM (TM1 -> TM32) + u32 tmLearnsetMask2; //!< Bitflags for whether this pokemon can learn a TM (TM33 -> TM64) + u32 tmLearnsetMask3; //!< Bitflags for whether this pokemon can learn a TM (TM65 -> TM92, HM1 -> HM4) + u32 tmLearnsetMask4; //!< Bitflags for whether this pokemon can learn a TM (HM5 -> HM8, rest unused) } PokemonPersonalData; #endif // POKEPLATINUM_STRUCT_02075874_H diff --git a/src/pokemon.c b/src/pokemon.c index dd35f08606..17a28d245e 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -91,12 +91,12 @@ static const s8 Unk_020F0695[][5] = { { 0x0, 0x0, 0x0, 0x0, 0x0 }, }; -static u32 GetMonDataAttribute(Pokemon *mon, int monDataAttribute, void *dest); -static u32 GetBoxMonDataAttribute(BoxPokemon *boxMon, int monDataAttribute, void *dest); -static void SetMonDataAttribute(Pokemon *mon, int monDataAttribute, const void *value); -static void SetBoxMonDataAttribute(BoxPokemon *boxMon, int monDataAttribute, const void *value); -static void IncreaseMonDataAttribute(Pokemon *mon, int monDataAttribute, int value); -static void IncreaseBoxMonDataAttribute(BoxPokemon *boxMon, int monDataAttribute, int value); +static u32 GetMonDataAttribute(Pokemon *mon, enum PokemonDataParam param, void *dest); +static u32 GetBoxMonDataAttribute(BoxPokemon *boxMon, enum PokemonDataParam param, void *dest); +static void SetMonDataAttribute(Pokemon *mon, enum PokemonDataParam param, const void *value); +static void SetBoxMonDataAttribute(BoxPokemon *boxMon, enum PokemonDataParam param, const void *value); +static void IncreaseMonDataAttribute(Pokemon *mon, enum PokemonDataParam param, int value); +static void IncreaseBoxMonDataAttribute(BoxPokemon *boxMon, enum PokemonDataParam param, int value); static u32 GetMonExpRateLevelExp(int monExpRate, int monLevel); static u16 GetNatureAdjustedStatValue(u8 monNature, u16 monStatValue, u8 statType); static void LoadMonPersonalData(int monSpecies, PokemonPersonalData *monPersonalData); @@ -105,7 +105,7 @@ static void LoadMonEvolutionData(int monSpecies, PokemonEvolutionData *monEvolut static void EncryptMonData(void *data, u32 bytes, u32 seed); static void DecryptMonData(void *data, u32 bytes, u32 seed); static u16 GetMonDataChecksum(void *data, u32 bytes); -static void * GetBoxMonDataBlock(BoxPokemon *boxMon, u32 personality, u8 dataBlockID); +static void *GetBoxMonDataBlock(BoxPokemon *boxMon, u32 personality, u8 dataBlockID); static int GetMonFormNarcIndex(int monSpecies, int monForm); static void sub_02076300(UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); static u8 sub_020767BC(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality); @@ -128,7 +128,7 @@ int PokemonStructSize (void) return sizeof(Pokemon); } -Pokemon * AllocMonZeroed (u32 heapID) +Pokemon *AllocMonZeroed (u32 heapID) { Pokemon * mon = Heap_AllocFromHeap(heapID, sizeof(Pokemon)); ZeroMonData(mon); @@ -137,14 +137,14 @@ Pokemon * AllocMonZeroed (u32 heapID) BOOL DecryptMon (Pokemon *mon) { - BOOL wasDecrypted = 0; + BOOL wasDecrypted = FALSE; - if (mon->box.partyDecrypted == 0) { - wasDecrypted = 1; - GF_ASSERT(mon->box.boxDecrypted == 0); + if (mon->box.partyDecrypted == FALSE) { + wasDecrypted = TRUE; + GF_ASSERT(mon->box.boxDecrypted == FALSE); - mon->box.partyDecrypted = 1; - mon->box.boxDecrypted = 1; + mon->box.partyDecrypted = TRUE; + mon->box.boxDecrypted = TRUE; DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); @@ -155,12 +155,12 @@ BOOL DecryptMon (Pokemon *mon) BOOL EncryptMon (Pokemon *mon, BOOL encrypt) { - BOOL wasEncrypted = 0; + BOOL wasEncrypted = FALSE; - if ((mon->box.partyDecrypted == 1) && (encrypt == 1)) { - wasEncrypted = 1; - mon->box.partyDecrypted = 0; - mon->box.boxDecrypted = 0; + if (mon->box.partyDecrypted == TRUE && encrypt == TRUE) { + wasEncrypted = TRUE; + mon->box.partyDecrypted = FALSE; + mon->box.boxDecrypted = FALSE; EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); @@ -172,11 +172,11 @@ BOOL EncryptMon (Pokemon *mon, BOOL encrypt) BOOL DecryptBoxMon (BoxPokemon *boxMon) { - BOOL wasDecrypted = 0; + BOOL wasDecrypted = FALSE; - if (boxMon->boxDecrypted == 0) { - wasDecrypted = 1; - boxMon->boxDecrypted = 1; + if (boxMon->boxDecrypted == FALSE) { + wasDecrypted = TRUE; + boxMon->boxDecrypted = TRUE; DecryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); } @@ -185,12 +185,12 @@ BOOL DecryptBoxMon (BoxPokemon *boxMon) BOOL EncryptBoxMon (BoxPokemon *boxMon, BOOL encrypt) { - BOOL wasEncrypted = 0; + BOOL wasEncrypted = FALSE; - if ((boxMon->boxDecrypted == 1) && (encrypt == 1)) { - wasEncrypted = 1; + if (boxMon->boxDecrypted == TRUE && encrypt == TRUE) { + wasEncrypted = TRUE; - boxMon->boxDecrypted = 0; + boxMon->boxDecrypted = FALSE; boxMon->checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); @@ -199,7 +199,7 @@ BOOL EncryptBoxMon (BoxPokemon *boxMon, BOOL encrypt) return wasEncrypted; } -void sub_02073D80 (Pokemon *mon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) +void sub_02073D80 (Pokemon *mon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) { ZeroMonData(mon); @@ -223,7 +223,8 @@ void sub_02073D80 (Pokemon *mon, int monSpecies, int monLevel, int monIVs, int u CalculateMonLevelAndStats(mon); } -void sub_02073E18 (BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, int useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) +// TODO make this static? +void sub_02073E18 (BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) { ZeroBoxMonData(boxMon); @@ -235,6 +236,7 @@ void sub_02073E18 (BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, SetBoxMonData(boxMon, MON_DATA_PERSONALITY, &monPersonality); + // TODO likely should be an enum if (monOTIDSource == 2) { do { monOTID = (LCRNG_Next() | (LCRNG_Next() << 16)); @@ -259,7 +261,7 @@ void sub_02073E18 (BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, SetBoxMonData(boxMon, MON_DATA_MET_LEVEL, &monLevel); SetBoxMonData(boxMon, MON_DATA_MET_GAME, &Unk_020E4C40); - v1 = 4; + v1 = ITEM_POKE_BALL; SetBoxMonData(boxMon, MON_DATA_POKEBALL, &v1); if (monIVs < 32) { @@ -294,6 +296,7 @@ void sub_02073E18 (BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, v1 = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_ABILITY_1); v2 = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_ABILITY_2); + // TODO enum value if (v2 != 0) { if (monPersonality & 1) { SetBoxMonData(boxMon, MON_DATA_ABILITY, &v2); @@ -319,7 +322,8 @@ void sub_02074044 (Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monN monPersonality = (LCRNG_Next() | (LCRNG_Next() << 16)); } while (monNature != GetNatureFromPersonality(monPersonality)); - sub_02073D80(mon, monSpecies, monLevel, monIVs, 1, monPersonality, 0, 0); + // TODO monOTIDSource probably an enum? + sub_02073D80(mon, monSpecies, monLevel, monIVs, TRUE, monPersonality, 0, 0); } void sub_02074088 (Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 param4, u8 param5, u8 param6) @@ -327,30 +331,39 @@ void sub_02074088 (Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 para u32 monPersonality; u16 unownLetter; - if ((param6) && (param6 < 29)) { + // TODO enum value + if (param6 && param6 < 29) { do { monPersonality = (LCRNG_Next() | (LCRNG_Next() << 16)); unownLetter = (((monPersonality & 0x3000000) >> 18) | ((monPersonality & 0x30000) >> 12) | ((monPersonality & 0x300) >> 6) | (monPersonality & 0x3)) % 28; - } while ((param5 != GetNatureFromPersonality(monPersonality)) || (param4 != GetMonPersonalityGender(monSpecies, monPersonality)) || (unownLetter != (param6 - 1))); + } while (param5 != GetNatureFromPersonality(monPersonality) || param4 != GetMonPersonalityGender(monSpecies, monPersonality) || unownLetter != param6 - 1); } else { monPersonality = sub_02074128(monSpecies, param4, param5); } - sub_02073D80(mon, monSpecies, monLevel, monIVs, 1, monPersonality, 0, 0); + // TODO monOTIDSource probably an enum? + sub_02073D80(mon, monSpecies, monLevel, monIVs, TRUE, monPersonality, 0, 0); } +enum { + GENDER_ALWAYS_MALE = 0, + GENDER_ALWAYS_FEMALE = 254, + GENDER_NONE = 255 +}; + u32 sub_02074128 (u16 monSpecies, u8 param1, u8 param2) { u8 monGenderChance = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_GENDER); u32 result; switch (monGenderChance) { - case 0: - case 254: - case 255: + case GENDER_ALWAYS_MALE: + case GENDER_ALWAYS_FEMALE: + case GENDER_NONE: result = param2; break; default: + // TODO gender enum value? if (param1 == 0) { result = 25 * ((monGenderChance / 25) + 1); result += param2; @@ -365,7 +378,8 @@ u32 sub_02074128 (u16 monSpecies, u8 param1, u8 param2) void sub_02074158 (Pokemon *mon, u16 monSpecies, u8 monLevel, u32 monCombinedIVs, u32 monPersonality) { - sub_02073D80(mon, monSpecies, monLevel, 0, 1, monPersonality, 0, 0); + // TODO monOTIDSource probably an enum? + sub_02073D80(mon, monSpecies, monLevel, 0, TRUE, monPersonality, 0, 0); SetMonData(mon, MON_DATA_COMBINED_IVS, &monCombinedIVs); CalculateMonLevelAndStats(mon); } @@ -389,27 +403,26 @@ void CalculateMonStats (Pokemon *mon) BOOL reencrypt = DecryptMon(mon); - int monLevel; - monLevel = GetMonData(mon, MON_DATA_LEVEL, 0); - - monMaxHp = GetMonData(mon, MON_DATA_MAX_HP, 0); - monCurrentHp = GetMonData(mon, MON_DATA_CURRENT_HP, 0); - - monHpIV = GetMonData(mon, MON_DATA_HP_IV, 0); - monHpEV = GetMonData(mon, MON_DATA_HP_EV, 0); - monAtkIV = GetMonData(mon, MON_DATA_ATK_IV, 0); - monAtkEV = GetMonData(mon, MON_DATA_ATK_EV, 0); - monDefIV = GetMonData(mon, MON_DATA_DEF_IV, 0); - monDefEV = GetMonData(mon, MON_DATA_DEF_EV, 0); - monSpeedIV = GetMonData(mon, MON_DATA_SPEED_IV, 0); - monSpeedEV = GetMonData(mon, MON_DATA_SPEED_EV, 0); - monSpAtkIV = GetMonData(mon, MON_DATA_SPATK_IV, 0); - monSpAtkEV = GetMonData(mon, MON_DATA_SPATK_EV, 0); - monSpDefIV = GetMonData(mon, MON_DATA_SPDEF_IV, 0); - monSpDefEV = GetMonData(mon, MON_DATA_SPDEF_EV, 0); + int monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); + + monMaxHp = GetMonData(mon, MON_DATA_MAX_HP, NULL); + monCurrentHp = GetMonData(mon, MON_DATA_CURRENT_HP, NULL); + + monHpIV = GetMonData(mon, MON_DATA_HP_IV, NULL); + monHpEV = GetMonData(mon, MON_DATA_HP_EV, NULL); + monAtkIV = GetMonData(mon, MON_DATA_ATK_IV, NULL); + monAtkEV = GetMonData(mon, MON_DATA_ATK_EV, NULL); + monDefIV = GetMonData(mon, MON_DATA_DEF_IV, NULL); + monDefEV = GetMonData(mon, MON_DATA_DEF_EV, NULL); + monSpeedIV = GetMonData(mon, MON_DATA_SPEED_IV, NULL); + monSpeedEV = GetMonData(mon, MON_DATA_SPEED_EV, NULL); + monSpAtkIV = GetMonData(mon, MON_DATA_SPATK_IV, NULL); + monSpAtkEV = GetMonData(mon, MON_DATA_SPATK_EV, NULL); + monSpDefIV = GetMonData(mon, MON_DATA_SPDEF_IV, NULL); + monSpDefEV = GetMonData(mon, MON_DATA_SPDEF_EV, NULL); - int monForm = GetMonData(mon, MON_DATA_FORM, 0); - int monSpecies = GetMonData(mon, MON_DATA_SPECIES, 0); + int monForm = GetMonData(mon, MON_DATA_FORM, NULL); + int monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); PokemonPersonalData *monPersonalData = Heap_AllocFromHeap(0, sizeof(PokemonPersonalData)); LoadMonFormPersonalData(monSpecies, monForm, monPersonalData); @@ -423,28 +436,29 @@ void CalculateMonStats (Pokemon *mon) SetMonData(mon, MON_DATA_MAX_HP, &newMaxHp); + // TODO inline func maybe int newAtk = ((2 * monPersonalData->baseAtk + monAtkIV + monAtkEV / 4) * monLevel / 100 + 5); - newAtk = GetNatureAdjustedStatValue(GetMonNature(mon), newAtk, 0x1); + newAtk = GetNatureAdjustedStatValue(GetMonNature(mon), newAtk, STAT_ATTACK); SetMonData(mon, MON_DATA_ATK, &newAtk); int newDef = ((2 * monPersonalData->baseDef + monDefIV + monDefEV / 4) * monLevel / 100 + 5); - newDef = GetNatureAdjustedStatValue(GetMonNature(mon), newDef, 0x2); + newDef = GetNatureAdjustedStatValue(GetMonNature(mon), newDef, STAT_DEFENSE); SetMonData(mon, MON_DATA_DEF, &newDef); int newSpeed = ((2 * monPersonalData->baseSpeed + monSpeedIV + monSpeedEV / 4) * monLevel / 100 + 5); - newSpeed = GetNatureAdjustedStatValue(GetMonNature(mon), newSpeed, 0x3); + newSpeed = GetNatureAdjustedStatValue(GetMonNature(mon), newSpeed, STAT_SPEED); SetMonData(mon, MON_DATA_SPEED, &newSpeed); int newSpAtk = ((2 * monPersonalData->baseSpAtk + monSpAtkIV + monSpAtkEV / 4) * monLevel / 100 + 5); - newSpAtk = GetNatureAdjustedStatValue(GetMonNature(mon), newSpAtk, 0x4); + newSpAtk = GetNatureAdjustedStatValue(GetMonNature(mon), newSpAtk, STAT_SPECIAL_ATTACK); SetMonData(mon, MON_DATA_SP_ATK, &newSpAtk); int newSpDef = ((2 * monPersonalData->baseSpDef + monSpDefIV + monSpDefEV / 4) * monLevel / 100 + 5); - newSpDef = GetNatureAdjustedStatValue(GetMonNature(mon), newSpDef, 0x5); + newSpDef = GetNatureAdjustedStatValue(GetMonNature(mon), newSpDef, STAT_SPECIAL_DEFENSE); SetMonData(mon, MON_DATA_SP_DEF, &newSpDef); Heap_FreeToHeap(monPersonalData); @@ -466,23 +480,23 @@ void CalculateMonStats (Pokemon *mon) EncryptMon(mon, reencrypt); } -u32 GetMonData (Pokemon *mon, int monDataAttribute, void *dest) +u32 GetMonData (Pokemon *mon, enum PokemonDataParam param, void *dest) { - if (mon->box.partyDecrypted == 0) { + if (mon->box.partyDecrypted == FALSE) { DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); u16 checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != mon->box.checksum) { - GF_ASSERT((checksum == mon->box.checksum)); - mon->box.invalidData = 1; + GF_ASSERT(checksum == mon->box.checksum); + mon->box.invalidData = TRUE; } } - u32 result = GetMonDataAttribute(mon, monDataAttribute, dest); + u32 result = GetMonDataAttribute(mon, param, dest); - if (mon->box.partyDecrypted == 0) { + if (mon->box.partyDecrypted == FALSE) { EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } @@ -490,11 +504,11 @@ u32 GetMonData (Pokemon *mon, int monDataAttribute, void *dest) return result; } -static u32 GetMonDataAttribute (Pokemon *mon, int monDataAttribute, void *dest) +static u32 GetMonDataAttribute (Pokemon *mon, enum PokemonDataParam param, void *dest) { u32 result = 0; - switch (monDataAttribute) { + switch (param) { case MON_DATA_160: result = mon->party.unk_00; break; @@ -534,44 +548,45 @@ static u32 GetMonDataAttribute (Pokemon *mon, int monDataAttribute, void *dest) result = 1; break; default: - result = GetBoxMonDataAttribute(&mon->box, monDataAttribute, dest); + result = GetBoxMonDataAttribute(&mon->box, param, dest); break; } return result; } -u32 GetBoxMonData (BoxPokemon *boxMon, int monDataAttribute, void *dest) +u32 GetBoxMonData (BoxPokemon *boxMon, enum PokemonDataParam param, void *dest) { - if (boxMon->boxDecrypted == 0) { + if (boxMon->boxDecrypted == FALSE) { DecryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); u16 checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != boxMon->checksum) { - GF_ASSERT((checksum == boxMon->checksum)); - boxMon->invalidData = 1; + GF_ASSERT(checksum == boxMon->checksum); + boxMon->invalidData = TRUE; } } - u32 result = GetBoxMonDataAttribute(boxMon, monDataAttribute, dest); + u32 result = GetBoxMonDataAttribute(boxMon, param, dest); - if (boxMon->boxDecrypted == 0) { + if (boxMon->boxDecrypted == FALSE) { EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); } return result; } -static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, void *dest) +static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, enum PokemonDataParam param, void *dest) { u32 result = 0; + // TODO enum? PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); - switch (monDataAttribute) { + switch (param) { default: result = 0; break; @@ -603,9 +618,9 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi case MON_DATA_SPECIES_EGG: result = monDataBlockA->species; - if (result == 0) { + if (result == SPECIES_NONE) { break; - } else if ((monDataBlockB->isEgg) || (boxMon->invalidData)) { + } else if (monDataBlockB->isEgg || boxMon->invalidData) { result = SPECIES_EGG; } break; @@ -706,33 +721,34 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi case MON_DATA_52: case MON_DATA_53: { + // TODO is there a way to make this more intuitave? u64 bitMask = 1; - result = ((monDataBlockA->unk_1C & (bitMask << monDataAttribute - MON_DATA_25)) != 0); + result = ((monDataBlockA->unk_1C & (bitMask << param - MON_DATA_25)) != 0); break; } case MON_DATA_MOVE1: case MON_DATA_MOVE2: case MON_DATA_MOVE3: case MON_DATA_MOVE4: - result = monDataBlockB->moves[monDataAttribute - MON_DATA_MOVE1]; + result = monDataBlockB->moves[param - MON_DATA_MOVE1]; break; case MON_DATA_MOVE1_CUR_PP: case MON_DATA_MOVE2_CUR_PP: case MON_DATA_MOVE3_CUR_PP: case MON_DATA_MOVE4_CUR_PP: - result = monDataBlockB->moveCurrentPPs[monDataAttribute - MON_DATA_MOVE1_CUR_PP]; + result = monDataBlockB->moveCurrentPPs[param - MON_DATA_MOVE1_CUR_PP]; break; case MON_DATA_MOVE1_PP_UPS: case MON_DATA_MOVE2_PP_UPS: case MON_DATA_MOVE3_PP_UPS: case MON_DATA_MOVE4_PP_UPS: - result = monDataBlockB->movePPUps[monDataAttribute - MON_DATA_MOVE1_PP_UPS]; + result = monDataBlockB->movePPUps[param - MON_DATA_MOVE1_PP_UPS]; break; case MON_DATA_MOVE1_MAX_PP: case MON_DATA_MOVE2_MAX_PP: case MON_DATA_MOVE3_MAX_PP: case MON_DATA_MOVE4_MAX_PP: - result = MoveTable_CalcMaxPP(monDataBlockB->moves[monDataAttribute - MON_DATA_MOVE1_MAX_PP], monDataBlockB->movePPUps[monDataAttribute - MON_DATA_MOVE1_MAX_PP]); + result = MoveTable_CalcMaxPP(monDataBlockB->moves[param - MON_DATA_MOVE1_MAX_PP], monDataBlockB->movePPUps[param - MON_DATA_MOVE1_MAX_PP]); break; case MON_DATA_HP_IV: result = monDataBlockB->hpIV; @@ -795,8 +811,9 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi case MON_DATA_EARTH_RIBBON: case MON_DATA_WORLD_RIBBON: { + // TODO is there a way to make this more intuitave? u64 bitMask = 1; - result = ((monDataBlockB->unk_14 & (bitMask << monDataAttribute - MON_DATA_78)) != 0); + result = ((monDataBlockB->unk_14 & (bitMask << param - MON_DATA_78)) != 0); break; } case MON_DATA_FATEFUL_ENCOUNTER: @@ -818,7 +835,8 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi break; case MON_DATA_117: if (boxMon->invalidData) { - MessageLoader_GetSpeciesName(495, 0, dest); + // TODO confirm this should be SPECIES_BAD_EGG (lines up with checksum failure check but not throughly checked this call tree) + MessageLoader_GetSpeciesName(SPECIES_BAD_EGG, 0, dest); } else { u16 *v6 = dest; @@ -833,7 +851,8 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi result = monDataBlockB->unk_10_31; case MON_DATA_119: if (boxMon->invalidData) { - Strbuf *strbuf = sub_0200B32C(495, 0); + // TODO confirm this should be SPECIES_BAD_EGG (lines up with checksum failure check but not throughly checked this call tree) + Strbuf *strbuf = sub_0200B32C(SPECIES_BAD_EGG, 0); Strbuf_Copy(dest, strbuf); Strbuf_Free(strbuf); @@ -869,8 +888,9 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi case MON_DATA_142: case MON_DATA_143: { + // TODO is there a way to make this more intuitave? u64 bitMask = 1; - result = ((monDataBlockC->unk_18 & (bitMask << monDataAttribute - MON_DATA_123)) != 0); + result = ((monDataBlockC->unk_18 & (bitMask << param - MON_DATA_123)) != 0); break; } case MON_DATA_144: @@ -905,7 +925,8 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi break; case MON_DATA_152: case MON_DATA_115: - if ((monDataBlockD->unk_16 == 3002) && (monDataBlockB->unk_1C)) { + // TODO enum value? + if (monDataBlockD->unk_16 == 3002 && monDataBlockB->unk_1C) { result = monDataBlockB->unk_1C; } else { result = monDataBlockD->unk_16; @@ -913,7 +934,8 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi break; case MON_DATA_153: case MON_DATA_116: - if ((monDataBlockD->unk_18 == 3002) && (monDataBlockB->unk_1E)) { + // TODO enum value? + if (monDataBlockD->unk_18 == 3002 && monDataBlockB->unk_1E) { result = monDataBlockB->unk_1E; } else { result = monDataBlockD->unk_18; @@ -941,7 +963,7 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi result = (monDataBlockB->hpIV << 0) | (monDataBlockB->atkIV << 5) | (monDataBlockB->defIV << 10) | (monDataBlockB->speedIV << 15) | (monDataBlockB->spAtkIV << 20) | (monDataBlockB->spDefIV << 25); break; case MON_DATA_176: - if (((monDataBlockA->species == SPECIES_NIDORAN_F) || (monDataBlockA->species == SPECIES_NIDORAN_M)) && (monDataBlockB->unk_10_31 == 0)) { + if ((monDataBlockA->species == SPECIES_NIDORAN_F || monDataBlockA->species == SPECIES_NIDORAN_M) && monDataBlockB->unk_10_31 == FALSE) { result = 0; } else { result = 1; @@ -949,10 +971,11 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi break; case MON_DATA_177: case MON_DATA_178: - if ((monDataBlockA->species == SPECIES_ARCEUS) && (monDataBlockA->ability == 121)) { + // TODO enum values + if (monDataBlockA->species == SPECIES_ARCEUS && monDataBlockA->ability == 121) { result = GetArceusItemType(Item_LoadParam(monDataBlockA->heldItem, 1, 0)); } else { - result = GetMonFormPersonalDataAttribute(monDataBlockA->species, monDataBlockB->form, 6 + (monDataAttribute - 177)); + result = GetMonFormPersonalDataAttribute(monDataBlockA->species, monDataBlockB->form, 6 + (param - 177)); } break; case MON_DATA_179: @@ -963,37 +986,38 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, voi return result; } -void SetMonData (Pokemon *mon, int monDataAttribute, const void *value) +void SetMonData (Pokemon *mon, enum PokemonDataParam param, const void *value) { - if (mon->box.partyDecrypted == 0) { + if (mon->box.partyDecrypted == FALSE) { DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); u16 checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != mon->box.checksum) { - GF_ASSERT((checksum == mon->box.checksum)); - mon->box.invalidData = 1; + GF_ASSERT(checksum == mon->box.checksum); + mon->box.invalidData = TRUE; EncryptMonData(mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); return; } } - SetMonDataAttribute(mon, monDataAttribute, value); + SetMonDataAttribute(mon, param, value); - if (mon->box.partyDecrypted == 0) { + if (mon->box.partyDecrypted == FALSE) { EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } } -static void SetMonDataAttribute (Pokemon *mon, int monDataAttribute, const void *value) +static void SetMonDataAttribute (Pokemon *mon, enum PokemonDataParam param, const void *value) { + // TODO can this be restructured better? u32 *u32Value = value; u16 *u16Value = value; u8 *u8Value = value; - switch (monDataAttribute) { + switch (param) { case MON_DATA_160: mon->party.unk_00 = u32Value[0]; break; @@ -1031,45 +1055,47 @@ static void SetMonDataAttribute (Pokemon *mon, int monDataAttribute, const void sub_0202CA10(value, &mon->party.unk_4C); break; default: - SetBoxMonDataAttribute(&mon->box, monDataAttribute, value); + SetBoxMonDataAttribute(&mon->box, param, value); break; } } -void SetBoxMonData (BoxPokemon *boxMon, int monDataAttribute, const void *value) +void SetBoxMonData (BoxPokemon *boxMon, enum PokemonDataParam param, const void *value) { - if (boxMon->boxDecrypted == 0) { + if (boxMon->boxDecrypted == FALSE) { DecryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); u16 checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != boxMon->checksum) { - GF_ASSERT((checksum == boxMon->checksum)); - boxMon->invalidData = 1; + GF_ASSERT(checksum == boxMon->checksum); + boxMon->invalidData = TRUE; EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); return; } } - SetBoxMonDataAttribute(boxMon, monDataAttribute, value); + SetBoxMonDataAttribute(boxMon, param, value); - if (boxMon->boxDecrypted == 0) { + if (boxMon->boxDecrypted == FALSE) { boxMon->checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); } } -static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, const void *value) +static void SetBoxMonDataAttribute (BoxPokemon *boxMon, enum PokemonDataParam param, const void *value) { + // TODO can this be restructured better? u32 *u32Value = value; u16 *u16Value = value; u8 *u8Value = value; + // TODO enum values? PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); - switch (monDataAttribute) { + switch (param) { case MON_DATA_PERSONALITY: boxMon->personality = u32Value[0]; break; @@ -1177,7 +1203,7 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, co case MON_DATA_52: case MON_DATA_53: { - u64 bitMask = 1 << (monDataAttribute - MON_DATA_25); + u64 bitMask = 1 << (param - MON_DATA_25); if (u8Value[0]) { monDataBlockA->unk_1C |= bitMask; @@ -1190,19 +1216,19 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, co case MON_DATA_MOVE2: case MON_DATA_MOVE3: case MON_DATA_MOVE4: - monDataBlockB->moves[monDataAttribute - MON_DATA_MOVE1] = u16Value[0]; + monDataBlockB->moves[param - MON_DATA_MOVE1] = u16Value[0]; break; case MON_DATA_MOVE1_CUR_PP: case MON_DATA_MOVE2_CUR_PP: case MON_DATA_MOVE3_CUR_PP: case MON_DATA_MOVE4_CUR_PP: - monDataBlockB->moveCurrentPPs[monDataAttribute - MON_DATA_MOVE1_CUR_PP] = u8Value[0]; + monDataBlockB->moveCurrentPPs[param - MON_DATA_MOVE1_CUR_PP] = u8Value[0]; break; case MON_DATA_MOVE1_PP_UPS: case MON_DATA_MOVE2_PP_UPS: case MON_DATA_MOVE3_PP_UPS: case MON_DATA_MOVE4_PP_UPS: - monDataBlockB->movePPUps[monDataAttribute - MON_DATA_MOVE1_PP_UPS] = u8Value[0]; + monDataBlockB->movePPUps[param - MON_DATA_MOVE1_PP_UPS] = u8Value[0]; break; case MON_DATA_MOVE1_MAX_PP: case MON_DATA_MOVE2_MAX_PP: @@ -1266,7 +1292,7 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, co case MON_DATA_EARTH_RIBBON: case MON_DATA_WORLD_RIBBON: { - u64 bitMask = 1 << (monDataAttribute - MON_DATA_78); + u64 bitMask = 1 << (param - MON_DATA_78); if (u8Value[0]) { monDataBlockB->unk_14 |= bitMask; @@ -1343,7 +1369,7 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, co case MON_DATA_142: case MON_DATA_143: { - u64 bitMask = 1 << (monDataAttribute - MON_DATA_123); + u64 bitMask = 1 << (param - MON_DATA_123); if (u8Value[0]) { monDataBlockC->unk_18 |= bitMask; @@ -1380,7 +1406,7 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, co break; case MON_DATA_152: case MON_DATA_115: - if ((u16Value[0] == 0) || (sub_0201708C(u16Value[0]) == 1)) { + if (u16Value[0] == 0 || sub_0201708C(u16Value[0]) == 1) { monDataBlockD->unk_16 = u16Value[0]; monDataBlockB->unk_1C = u16Value[0]; } else { @@ -1390,7 +1416,7 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, co break; case MON_DATA_153: case MON_DATA_116: - if ((u16Value[0] == 0) || (sub_0201708C(u16Value[0]) == 1)) { + if (u16Value[0] == 0 || sub_0201708C(u16Value[0]) == 1) { monDataBlockD->unk_18 = u16Value[0]; monDataBlockB->unk_1E = u16Value[0]; } else { @@ -1441,35 +1467,35 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, co } } -void IncreaseMonData (Pokemon *mon, int monDataAttribute, int value) +void IncreaseMonData (Pokemon *mon, enum PokemonDataParam param, int value) { - if (mon->box.partyDecrypted == 0) { + if (mon->box.partyDecrypted == FALSE) { DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); u16 checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != mon->box.checksum) { - GF_ASSERT((checksum == mon->box.checksum)); + GF_ASSERT(checksum == mon->box.checksum); EncryptMonData(mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); return; } } - IncreaseMonDataAttribute(mon, monDataAttribute, value); + IncreaseMonDataAttribute(mon, param, value); - if (mon->box.partyDecrypted == 0) { + if (mon->box.partyDecrypted == FALSE) { EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } } -static void IncreaseMonDataAttribute (Pokemon *mon, int monDataAttribute, int value) +static void IncreaseMonDataAttribute (Pokemon *mon, enum PokemonDataParam param, int value) { - switch (monDataAttribute) { + switch (param) { case MON_DATA_CURRENT_HP: - if ((mon->party.unk_06 + value) > mon->party.unk_08) { + if (mon->party.unk_06 + value > mon->party.unk_08) { mon->party.unk_06 = mon->party.unk_08; } else { mon->party.unk_06 += value; @@ -1488,21 +1514,23 @@ static void IncreaseMonDataAttribute (Pokemon *mon, int monDataAttribute, int va GF_ASSERT(0); break; default: - IncreaseBoxMonDataAttribute(&mon->box, monDataAttribute, value); + IncreaseBoxMonDataAttribute(&mon->box, param, value); break; } } -static void IncreaseBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribute, int value) +static void IncreaseBoxMonDataAttribute (BoxPokemon *boxMon, enum PokemonDataParam param, int value) { + // TODO enum values? PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); - switch (monDataAttribute) { + // TODO consts for various maximum values? + switch (param) { case MON_DATA_EXP: - if ((monDataBlockA->exp + value) > GetMonSpeciesLevelExp(monDataBlockA->species, 100)) { + if (monDataBlockA->exp + value > GetMonSpeciesLevelExp(monDataBlockA->species, 100)) { monDataBlockA->exp = GetMonSpeciesLevelExp(monDataBlockA->species, 100); } else { monDataBlockA->exp += value; @@ -1513,11 +1541,11 @@ static void IncreaseBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribut newValue = monDataBlockA->friendship; - if ((newValue + value) > 255) { + if (newValue + value > 255) { newValue = 255; } - if ((newValue + value) < 0) { + if (newValue + value < 0) { newValue = 0; } else { newValue += value; @@ -1544,42 +1572,42 @@ static void IncreaseBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribut monDataBlockA->spDefEV += value; break; case MON_DATA_COOL: - if ((monDataBlockA->cool + value) > 255) { + if (monDataBlockA->cool + value > 255) { monDataBlockA->cool = 255; } else { monDataBlockA->cool += value; } break; case MON_DATA_BEAUTY: - if ((monDataBlockA->beauty + value) > 255) { + if (monDataBlockA->beauty + value > 255) { monDataBlockA->beauty = 255; } else { monDataBlockA->beauty += value; } break; case MON_DATA_CUTE: - if ((monDataBlockA->cute + value) > 255) { + if (monDataBlockA->cute + value > 255) { monDataBlockA->cute = 255; } else { monDataBlockA->cute += value; } break; case MON_DATA_SMART: - if ((monDataBlockA->smart + value) > 255) { + if (monDataBlockA->smart + value > 255) { monDataBlockA->smart = 255; } else { monDataBlockA->smart += value; } break; case MON_DATA_TOUGH: - if ((monDataBlockA->tough + value) > 255) { + if (monDataBlockA->tough + value > 255) { monDataBlockA->tough = 255; } else { monDataBlockA->tough += value; } break; case MON_DATA_SHEEN: - if ((monDataBlockA->sheen + value) > 255) { + if (monDataBlockA->sheen + value > 255) { monDataBlockA->sheen = 255; } else { monDataBlockA->sheen += value; @@ -1589,20 +1617,20 @@ static void IncreaseBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribut case MON_DATA_MOVE2_CUR_PP: case MON_DATA_MOVE3_CUR_PP: case MON_DATA_MOVE4_CUR_PP: - if ((monDataBlockB->moveCurrentPPs[monDataAttribute - MON_DATA_MOVE1_CUR_PP] + value) > MoveTable_CalcMaxPP(monDataBlockB->moves[monDataAttribute - MON_DATA_MOVE1_CUR_PP], monDataBlockB->movePPUps[monDataAttribute - MON_DATA_MOVE1_CUR_PP])) { - monDataBlockB->moveCurrentPPs[monDataAttribute - MON_DATA_MOVE1_CUR_PP] = MoveTable_CalcMaxPP(monDataBlockB->moves[monDataAttribute - MON_DATA_MOVE1_CUR_PP], monDataBlockB->movePPUps[monDataAttribute - MON_DATA_MOVE1_CUR_PP]); + if (monDataBlockB->moveCurrentPPs[param - MON_DATA_MOVE1_CUR_PP] + value > MoveTable_CalcMaxPP(monDataBlockB->moves[param - MON_DATA_MOVE1_CUR_PP], monDataBlockB->movePPUps[param - MON_DATA_MOVE1_CUR_PP])) { + monDataBlockB->moveCurrentPPs[param - MON_DATA_MOVE1_CUR_PP] = MoveTable_CalcMaxPP(monDataBlockB->moves[param - MON_DATA_MOVE1_CUR_PP], monDataBlockB->movePPUps[param - MON_DATA_MOVE1_CUR_PP]); } else { - monDataBlockB->moveCurrentPPs[monDataAttribute - MON_DATA_MOVE1_CUR_PP] += value; + monDataBlockB->moveCurrentPPs[param - MON_DATA_MOVE1_CUR_PP] += value; } break; case MON_DATA_MOVE1_PP_UPS: case MON_DATA_MOVE2_PP_UPS: case MON_DATA_MOVE3_PP_UPS: case MON_DATA_MOVE4_PP_UPS: - if ((monDataBlockB->movePPUps[monDataAttribute - MON_DATA_MOVE1_PP_UPS] + value) > 3) { - monDataBlockB->movePPUps[monDataAttribute - MON_DATA_MOVE1_PP_UPS] = 3; + if (monDataBlockB->movePPUps[param - MON_DATA_MOVE1_PP_UPS] + value > 3) { + monDataBlockB->movePPUps[param - MON_DATA_MOVE1_PP_UPS] = 3; } else { - monDataBlockB->movePPUps[monDataAttribute - MON_DATA_MOVE1_PP_UPS] += value; + monDataBlockB->movePPUps[param - MON_DATA_MOVE1_PP_UPS] += value; } break; case MON_DATA_MOVE1_MAX_PP: @@ -1611,42 +1639,42 @@ static void IncreaseBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribut case MON_DATA_MOVE4_MAX_PP: break; case MON_DATA_HP_IV: - if ((monDataBlockB->hpIV + value) > 31) { + if (monDataBlockB->hpIV + value > 31) { monDataBlockB->hpIV = 31; } else { monDataBlockB->hpIV += value; } break; case MON_DATA_ATK_IV: - if ((monDataBlockB->atkIV + value) > 31) { + if (monDataBlockB->atkIV + value > 31) { monDataBlockB->atkIV = 31; } else { monDataBlockB->atkIV += value; } break; case MON_DATA_DEF_IV: - if ((monDataBlockB->defIV + value) > 31) { + if (monDataBlockB->defIV + value > 31) { monDataBlockB->defIV = 31; } else { monDataBlockB->defIV += value; } break; case MON_DATA_SPEED_IV: - if ((monDataBlockB->speedIV + value) > 31) { + if (monDataBlockB->speedIV + value > 31) { monDataBlockB->speedIV = 31; } else { monDataBlockB->speedIV += value; } break; case MON_DATA_SPATK_IV: - if ((monDataBlockB->spAtkIV + value) > 31) { + if (monDataBlockB->spAtkIV + value > 31) { monDataBlockB->spAtkIV = 31; } else { monDataBlockB->spAtkIV += value; } break; case MON_DATA_SPDEF_IV: - if ((monDataBlockB->spDefIV + value) > 31) { + if (monDataBlockB->spDefIV + value > 31) { monDataBlockB->spDefIV = 31; } else { monDataBlockB->spDefIV += value; @@ -1787,7 +1815,7 @@ static void IncreaseBoxMonDataAttribute (BoxPokemon *boxMon, int monDataAttribut } } -PokemonPersonalData * GetMonFormPersonalData (int monSpecies, int monForm, int heapID) +PokemonPersonalData *GetMonFormPersonalData (int monSpecies, int monForm, int heapID) { PokemonPersonalData *monPersonalData = Heap_AllocFromHeap(heapID, sizeof(PokemonPersonalData)); LoadMonFormPersonalData(monSpecies, monForm, monPersonalData); @@ -1795,7 +1823,7 @@ PokemonPersonalData * GetMonFormPersonalData (int monSpecies, int monForm, int h return monPersonalData; } -PokemonPersonalData * GetMonPersonalData (int monSpecies, int heapID) +PokemonPersonalData *GetMonPersonalData (int monSpecies, int heapID) { PokemonPersonalData *monPersonalData = Heap_AllocFromHeap(heapID, sizeof(PokemonPersonalData)); LoadMonPersonalData(monSpecies, monPersonalData); @@ -1803,13 +1831,13 @@ PokemonPersonalData * GetMonPersonalData (int monSpecies, int heapID) return monPersonalData; } -u32 GetMonPersonalDataAttribute (PokemonPersonalData *monPersonalData, int monPersonalDataAttribute) +u32 GetMonPersonalDataAttribute (PokemonPersonalData *monPersonalData, enum PokemonPersonalDataParam param) { u32 result; GF_ASSERT(monPersonalData); - switch (monPersonalDataAttribute) { + switch (param) { case MON_DATA_PERSONAL_BASE_HP: result = monPersonalData->baseHp; break; @@ -1920,22 +1948,22 @@ void FreeMonPersonalData (PokemonPersonalData *monPersonalData) Heap_FreeToHeap(monPersonalData); } -u32 GetMonFormPersonalDataAttribute (int monSpecies, int monForm, int monPersonalDataAttribute) +u32 GetMonFormPersonalDataAttribute (int monSpecies, int monForm, enum PokemonPersonalDataParam param) { monSpecies = GetMonFormNarcIndex(monSpecies, monForm); PokemonPersonalData *monPersonalData = GetMonPersonalData(monSpecies, 0); - u32 result = GetMonPersonalDataAttribute(monPersonalData, monPersonalDataAttribute); + u32 result = GetMonPersonalDataAttribute(monPersonalData, param); FreeMonPersonalData(monPersonalData); return result; } -u32 GetMonSpeciesPersonalDataAttribute (int monSpecies, int monPersonalDataAttribute) +u32 GetMonSpeciesPersonalDataAttribute (int monSpecies, enum PokemonPersonalDataParam param) { PokemonPersonalData *monPersonalData = GetMonPersonalData(monSpecies, 0); - u32 result = GetMonPersonalDataAttribute(monPersonalData, monPersonalDataAttribute); + u32 result = GetMonPersonalDataAttribute(monPersonalData, param); FreeMonPersonalData(monPersonalData); @@ -1983,12 +2011,14 @@ u32 GetMonSpeciesLevelExp (int monSpecies, int monLevel) void LoadMonExperienceTable (int monExpRate, u32 *monExpTable) { + // TODO enum for exp rate types? GF_ASSERT(monExpRate < 8); NARC_ReadWholeMemberByIndexPair(monExpTable, NARC_INDEX_POKETOOL__PERSONAL__PL_GROWTBL, monExpRate); } u32 GetMonExpRateLevelExp (int monExpRate, int monLevel) { + // TODO enum for exp rate types? GF_ASSERT(monExpRate < 8); GF_ASSERT(monLevel <= 101); @@ -2009,8 +2039,8 @@ u32 GetMonLevel (Pokemon *mon) u32 GetBoxMonLevel (BoxPokemon *boxMon) { BOOL reencrypt = DecryptBoxMon(boxMon); - int monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, 0); - u32 monExp = GetBoxMonData(boxMon, MON_DATA_EXP, 0); + int monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); + u32 monExp = GetBoxMonData(boxMon, MON_DATA_EXP, NULL); EncryptBoxMon(boxMon, reencrypt); @@ -2029,6 +2059,7 @@ u32 GetMonSpeciesLevel (u16 monSpecies, u32 monExp) u32 GetMonPersonalDataLevel (PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monExp) { + // TODO const for table size? static u32 monExpTable[101]; int monExpRate = GetMonPersonalDataAttribute(monPersonalData, MON_DATA_PERSONAL_EXP_RATE); @@ -2052,7 +2083,7 @@ u8 GetMonNature (Pokemon *mon) u8 GetBoxMonNature (BoxPokemon *boxMon) { BOOL reencrypt = DecryptBoxMon(boxMon); - u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, 0); + u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); EncryptBoxMon(boxMon, reencrypt); @@ -2061,9 +2092,11 @@ u8 GetBoxMonNature (BoxPokemon *boxMon) u8 GetNatureFromPersonality (u32 monPersonality) { + // TODO const for nature count/enum for natures? return (u8)(monPersonality % 25); } +// TODO enum here? static const s8 sNatureStatAffinities[][5] = { {0, 0, 0, 0, 0}, {1, -1, 0, 0, 0}, @@ -2094,7 +2127,7 @@ static const s8 sNatureStatAffinities[][5] = { u16 GetNatureAdjustedStatValue (u8 monNature, u16 monStatValue, u8 statType) { - if ((statType < 0x1) || (statType > 0x5)) { + if (statType < STAT_ATTACK || statType > STAT_SPECIAL_DEFENSE) { return monStatValue; } @@ -2122,20 +2155,21 @@ s8 GetNatureStatAffinity (u8 monNature, u8 statType) } static const s8 Unk_020F05A0[][3] = { - {0x5, 0x3, 0x2}, - {0x5, 0x3, 0x2}, - {0x1, 0x1, 0x0}, - {0x3, 0x2, 0x1}, - {0x1, 0x1, 0x0}, - {0x1, 0x1, 0x1}, - {-1, -1, -1}, - {-5, -5, -10}, - {-5, -5, -10}, - {0x3, 0x2, 0x1} + {5, 3, 2}, // ??? in overlay16 + {5, 3, 2}, // unused? + {1, 1, 0}, // unused? + {3, 2, 1}, // ??? in overlay16 + {1, 1, 0}, // ??? in unk_02084B70.c + {1, 1, 1}, // walking 128 steps + {-1, -1, -1}, // fainting (opponent level difference < 30) + {-5, -5, -10}, // letting poison tick mon to 1HP + {-5, -5, -10}, // fainting (opponent level difference >= 30) + {3, 2, 1} // ??? in unk_020933F8.c }; void sub_02075C74 (Pokemon *mon, u8 param1, u16 param2) { + // TODO enum value (param 1 is method of gaining/losing friendship) if (param1 == 5) { if (LCRNG_Next() & 1) { return; @@ -2144,12 +2178,12 @@ void sub_02075C74 (Pokemon *mon, u8 param1, u16 param2) u16 monSpeciesEgg = GetMonData(mon, MON_DATA_SPECIES_EGG, NULL); - if ((monSpeciesEgg == SPECIES_NONE) || (monSpeciesEgg == SPECIES_EGG)) { + if (monSpeciesEgg == SPECIES_NONE || monSpeciesEgg == SPECIES_EGG) { return; } u16 monHeldItem = GetMonData(mon, MON_DATA_HELD_ITEM, NULL); - u8 itemHoldEffect = Item_LoadParam(monHeldItem, 1, 0); + u8 itemHoldEffect = Item_LoadParam(monHeldItem, ITEM_PARAM_HOLD_EFFECT, 0); u8 v4 = 0; s16 monFriendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL); @@ -2163,11 +2197,11 @@ void sub_02075C74 (Pokemon *mon, u8 param1, u16 param2) s8 v3 = Unk_020F05A0[param1][v4]; - if ((v3 > 0) && (GetMonData(mon, MON_DATA_POKEBALL, NULL) == 11)) { + if (v3 > 0 && GetMonData(mon, MON_DATA_POKEBALL, NULL) == ITEM_LUXURY_BALL) { v3++; } - if ((v3 > 0) && (GetMonData(mon, MON_DATA_152, NULL) == param2)) { + if (v3 > 0 && GetMonData(mon, MON_DATA_152, NULL) == param2) { v3++; } @@ -2198,8 +2232,8 @@ u8 GetMonGender (Pokemon *mon) u8 GetBoxMonGender (BoxPokemon *boxMon) { BOOL reencrypt = DecryptBoxMon(boxMon); - u16 monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, 0); - u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, 0); + u16 monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); + u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); EncryptBoxMon(boxMon, reencrypt); @@ -2217,22 +2251,22 @@ u8 GetMonPersonalityGender (u16 monSpecies, u32 monPersonality) } u8 GetMonPersonalDataGender (PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monPersonality) -{ +{ u8 monGender = GetMonPersonalDataAttribute(monPersonalData, MON_DATA_PERSONAL_GENDER); switch (monGender) { - case 0: - return 0; - case 254: - return 1; - case 255: - return 2; + case GENDER_ALWAYS_MALE: + return MON_GENDER_MALE; + case GENDER_ALWAYS_FEMALE: + return MON_GENDER_FEMALE; + case GENDER_NONE: + return MON_GENDER_NONE; } if (monGender > (monPersonality & 0xff)) { - return 1; + return MON_GENDER_FEMALE; } else { - return 0; + return MON_GENDER_MALE; } } @@ -2243,8 +2277,8 @@ u8 GetMonShininess (Pokemon *mon) u8 GetBoxMonShininess (BoxPokemon *boxMon) { - u32 monOTID = GetBoxMonData(boxMon, MON_DATA_OT_ID, 0); - u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, 0); + u32 monOTID = GetBoxMonData(boxMon, MON_DATA_OT_ID, NULL); + u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); return GetMonPersonalityShininess(monOTID, monPersonality); } @@ -2284,14 +2318,15 @@ u32 sub_02075E64 (u32 param0) void sub_02075EF4 (UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2) { - sub_02075F0C(param0, &mon->box, param2, 0); + sub_02075F0C(param0, &mon->box, param2, FALSE); } void sub_02075F00 (UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2) { - sub_02075F0C(param0, &mon->box, param2, 1); + sub_02075F0C(param0, &mon->box, param2, TRUE); } +// TODO change param3 to BOOL void sub_02075F0C (UnkStruct_02008A90 *param0, BoxPokemon *boxMon, u8 param2, int param3) { BOOL reencrypt = DecryptBoxMon(boxMon); @@ -2312,7 +2347,7 @@ void sub_02075F0C (UnkStruct_02008A90 *param0, BoxPokemon *boxMon, u8 param2, in monForm = GetBoxMonData(boxMon, MON_DATA_FORM, NULL); } - if (param3 == 1) { + if (param3 == TRUE) { sub_02076300(param0, monSpeciesEgg, monGender, param2, monShininess, monForm, monPersonality); } else { sub_02075FB4(param0, monSpeciesEgg, monGender, param2, monShininess, monForm, monPersonality); @@ -2323,6 +2358,7 @@ void sub_02075F0C (UnkStruct_02008A90 *param0, BoxPokemon *boxMon, u8 param2, in void sub_02075FB4 (UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality) { + // TODO enum values? param0->unk_06 = 0; param0->unk_08 = 0; param0->unk_0C = 0; @@ -2401,10 +2437,10 @@ void sub_02075FB4 (UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 break; default: param0->unk_00 = 4; - param0->unk_02 = monSpecies * 6 + param3 + ((monGender != 1) ? 1 : 0); + param0->unk_02 = monSpecies * 6 + param3 + (monGender != 1 ? 1 : 0); param0->unk_04 = monSpecies * 6 + 4 + monShininess; - if ((monSpecies == SPECIES_SPINDA) && (param3 == 2)) { + if (monSpecies == SPECIES_SPINDA && param3 == 2) { param0->unk_06 = 327; param0->unk_08 = 0; param0->unk_0C = monPersonality; @@ -2416,6 +2452,7 @@ void sub_02075FB4 (UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 u8 SanitizeFormId (u16 monSpecies, u8 monForm) { + // TODO enum values? switch (monSpecies) { case SPECIES_BURMY: if (monForm > 2) { @@ -2490,6 +2527,7 @@ u8 SanitizeFormId (u16 monSpecies, u8 monForm) static void sub_02076300 (UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality) { + // TODO enum values? param0->unk_06 = 0; param0->unk_08 = 0; param0->unk_0C = 0; @@ -2559,7 +2597,7 @@ static void sub_02076300 (UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGend param0->unk_04 = 230 + monShininess; } else { param0->unk_00 = 165; - param0->unk_02 = monSpecies * 6 + param3 + ((monGender != 1) ? 1 : 0); + param0->unk_02 = monSpecies * 6 + param3 + (monGender != 1 ? 1 : 0); param0->unk_04 = monSpecies * 6 + 4 + monShininess; } break; @@ -2570,7 +2608,7 @@ static void sub_02076300 (UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGend param0->unk_04 = 232 + monShininess + monForm * 2; } else { param0->unk_00 = 165; - param0->unk_02 = monSpecies * 6 + param3 + ((monGender != 1) ? 1 : 0); + param0->unk_02 = monSpecies * 6 + param3 + (monGender != 1 ? 1 : 0); param0->unk_04 = monSpecies * 6 + 4 + monShininess; } break; @@ -2581,16 +2619,16 @@ static void sub_02076300 (UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGend param0->unk_04 = 244 + monShininess + monForm * 2; } else { param0->unk_00 = 165; - param0->unk_02 = monSpecies * 6 + param3 + ((monGender != 1) ? 1 : 0); + param0->unk_02 = monSpecies * 6 + param3 + (monGender != 1 ? 1 : 0); param0->unk_04 = monSpecies * 6 + 4 + monShininess; } break; default: param0->unk_00 = 165; - param0->unk_02 = monSpecies * 6 + param3 + ((monGender != 1) ? 1 : 0); + param0->unk_02 = monSpecies * 6 + param3 + (monGender != 1 ? 1 : 0); param0->unk_04 = monSpecies * 6 + 4 + monShininess; - if ((monSpecies == SPECIES_SPINDA) && (param3 == 2)) { + if (monSpecies == SPECIES_SPINDA && param3 == 2) { param0->unk_06 = 327; param0->unk_08 = 0; param0->unk_0C = monPersonality; @@ -2602,14 +2640,15 @@ static void sub_02076300 (UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGend u8 sub_020765AC (Pokemon *mon, u8 param1) { - return sub_020765C4(&mon->box, param1, 0); + return sub_020765C4(&mon->box, param1, FALSE); } u8 sub_020765B8 (Pokemon *mon, u8 param1) { - return sub_020765C4(&mon->box, param1, 1); + return sub_020765C4(&mon->box, param1, TRUE); } +// TODO change param2 to BOOL u8 sub_020765C4 (BoxPokemon *boxMon, u8 param1, int param2) { u16 monSpeciesEgg = GetBoxMonData(boxMon, MON_DATA_SPECIES_EGG, NULL); @@ -2617,6 +2656,7 @@ u8 sub_020765C4 (BoxPokemon *boxMon, u8 param1, int param2) u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); u8 monForm; + // TODO enum values? if (monSpeciesEgg == SPECIES_EGG) { if (GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL) == SPECIES_MANAPHY) { monForm = 1; @@ -2627,7 +2667,7 @@ u8 sub_020765C4 (BoxPokemon *boxMon, u8 param1, int param2) monForm = GetBoxMonData(boxMon, MON_DATA_FORM, NULL); } - if (param2 == 1) { + if (param2 == TRUE) { return sub_020767BC(monSpeciesEgg, monGender, param1, monForm, monPersonality); } @@ -2636,6 +2676,7 @@ u8 sub_020765C4 (BoxPokemon *boxMon, u8 param1, int param2) u8 sub_02076648 (u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality) { + // TODO enum values? monForm = SanitizeFormId(monSpecies, monForm); int narcIndex; @@ -2699,7 +2740,7 @@ u8 sub_02076648 (u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPer break; default: narcIndex = NARC_INDEX_POKETOOL__POKEGRA__HEIGHT; - memberIndex = monSpecies * 4 + param2 + ((monGender != 1) ? 1 : 0); + memberIndex = monSpecies * 4 + param2 + (monGender != 1 ? 1 : 0); break; } @@ -2710,6 +2751,7 @@ u8 sub_02076648 (u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPer static u8 sub_020767BC (u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality) { + // TODO enum values? monForm = SanitizeFormId(monSpecies, monForm); int narcIndex; @@ -2765,7 +2807,7 @@ static u8 sub_020767BC (u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 memberIndex = 136 + (param2 / 2) + monForm * 2; } else { narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT; - memberIndex = monSpecies * 4 + param2 + ((monGender != 1) ? 1 : 0); + memberIndex = monSpecies * 4 + param2 + (monGender != 1 ? 1 : 0); } break; case SPECIES_ROTOM: @@ -2774,7 +2816,7 @@ static u8 sub_020767BC (u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 memberIndex = 140 + (param2 / 2) + monForm * 2; } else { narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT; - memberIndex = monSpecies * 4 + param2 + ((monGender != 1) ? 1 : 0); + memberIndex = monSpecies * 4 + param2 + (monGender != 1 ? 1 : 0); } break; case SPECIES_GIRATINA: @@ -2783,12 +2825,12 @@ static u8 sub_020767BC (u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 memberIndex = 152 + (param2 / 2) + monForm * 2; } else { narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT; - memberIndex = monSpecies * 4 + param2 + ((monGender != 1) ? 1 : 0); + memberIndex = monSpecies * 4 + param2 + (monGender != 1 ? 1 : 0); } break; default: narcIndex = NARC_INDEX_POKETOOL__POKEGRA__DP_HEIGHT; - memberIndex = monSpecies * 4 + param2 + ((monGender != 1) ? 1 : 0); + memberIndex = monSpecies * 4 + param2 + (monGender != 1 ? 1 : 0); break; } @@ -2829,7 +2871,7 @@ static const int Unk_020F0588[] = { 0x1 }; -UnkStruct_0200D0F4 * sub_02076994 (UnkStruct_0200C6E4 *param0, UnkStruct_0200C704 *param1, UnkStruct_02002F38 *param2, int param3, int param4, int param5, int param6, int param7, int heapID) +UnkStruct_0200D0F4 *sub_02076994 (UnkStruct_0200C6E4 *param0, UnkStruct_0200C704 *param1, UnkStruct_02002F38 *param2, int param3, int param4, int param5, int param6, int param7, int heapID) { UnkStruct_ov104_0223F9E0 v0; UnkStruct_0200D0F4 *v1; @@ -2839,6 +2881,7 @@ UnkStruct_0200D0F4 * sub_02076994 (UnkStruct_0200C6E4 *param0, UnkStruct_0200C70 sub_02076AAC(param5, param6, &v3); + // TODO enum values? if (param5 == 102) { v4 = 2; } @@ -2853,6 +2896,7 @@ UnkStruct_0200D0F4 * sub_02076994 (UnkStruct_0200C6E4 *param0, UnkStruct_0200C70 v0 = Unk_020F05E4; + // TODO enum values? v0.unk_14[0] = 20015 + param7; v0.unk_14[1] = 20010 + param7; v0.unk_14[2] = 20007 + param7; @@ -2871,6 +2915,7 @@ UnkStruct_0200D0F4 * sub_02076994 (UnkStruct_0200C6E4 *param0, UnkStruct_0200C70 void sub_02076AAC (int param0, int param1, UnkStruct_ov5_021DE5D0 *param2) { + // TODO enum values? if (param1 == 2) { param2->unk_00 = 60; param2->unk_04 = 0 + param0 * 5; @@ -2909,17 +2954,19 @@ u8 GetBoxMonForm (BoxPokemon *boxMon) return GetBoxMonData(boxMon, MON_DATA_FORM, NULL); } -BoxPokemon * GetBoxMon (Pokemon *mon) +BoxPokemon *GetBoxMon (Pokemon *mon) { return &mon->box; } +// TODO return BOOL u8 sub_02076B14 (Pokemon *mon) { u16 monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); u8 monNextLevel = GetMonData(mon, MON_DATA_LEVEL, NULL) + 1; u32 monExp = GetMonData(mon, MON_DATA_EXP, NULL); int monExpRate = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_EXP_RATE); + // TODO const value? u32 maxExp = GetMonExpRateLevelExp(monExpRate, 100); if (monExp > maxExp) { @@ -2927,23 +2974,25 @@ u8 sub_02076B14 (Pokemon *mon) SetMonData(mon, MON_DATA_EXP, &monExp); } + // TODO const value? if (monNextLevel > 100) { - return 0; + return FALSE; } maxExp = GetMonExpRateLevelExp(monExpRate, monNextLevel); if (monExp >= maxExp) { SetMonData(mon, MON_DATA_LEVEL, &monNextLevel); - return 1; + return TRUE; } - return 0; + return FALSE; } +// TODO return species enum (TODO: replace species id defines with enum) u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int *evoTypeResult) { - u16 targetSpecies = 0; + u16 targetSpecies = SPECIES_NONE; u16 monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); u16 monHeldItem = GetMonData(mon, MON_DATA_HELD_ITEM, NULL); @@ -2954,10 +3003,10 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int u16 monFriendship; u16 monPersonalityUpper = (monPersonality & 0xffff0000) >> 16; - u8 itemHoldEffect = Item_LoadParam(monHeldItem, 1, 0); + u8 itemHoldEffect = Item_LoadParam(monHeldItem, ITEM_PARAM_HOLD_EFFECT, 0); if (monSpecies != SPECIES_KADABRA) { - if ((itemHoldEffect == HOLD_EFFECT_NO_EVOLVE) && (evoTypeList != 3)) { + if (itemHoldEffect == HOLD_EFFECT_NO_EVOLVE && evoTypeList != 3) { return 0; } } @@ -2970,6 +3019,7 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int PokemonEvolutionData *monEvolutionData = Heap_AllocFromHeap(0, sizeof(PokemonEvolutionData)); LoadMonEvolutionData(monSpecies, monEvolutionData); + // TODO enum? switch (evoTypeList) { case 0: u8 monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); @@ -2984,13 +3034,13 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int } break; case 2: // high friendship && daytime - if ((sub_02013948() == 0) && (220 <= monFriendship)) { + if (sub_02013948() == 0 && 220 <= monFriendship) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 2; } break; case 3: // high friendship && nighttime - if ((sub_02013948() == 1) && (220 <= monFriendship)) { + if (sub_02013948() == 1 && 220 <= monFriendship) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 3; } @@ -3003,7 +3053,7 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int break; case 8: // tyrogue evo to hitmonlee: above level param && attack > defense if (monEvolutionData->methods[i].param <= monLevel) { - if ((GetMonData(mon, MON_DATA_ATK, NULL)) > (GetMonData(mon, MON_DATA_DEF, NULL))) { + if (GetMonData(mon, MON_DATA_ATK, NULL) > GetMonData(mon, MON_DATA_DEF, NULL)) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 8; } @@ -3011,7 +3061,7 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int break; case 9: // tyrogue evo to hitmontop: above level param && attack == defense if (monEvolutionData->methods[i].param <= monLevel) { - if ((GetMonData(mon, MON_DATA_ATK, NULL)) == (GetMonData(mon, MON_DATA_DEF, NULL))) { + if (GetMonData(mon, MON_DATA_ATK, NULL) == GetMonData(mon, MON_DATA_DEF, NULL)) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 9; } @@ -3019,7 +3069,7 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int break; case 10: // tyrogue evo to hitmonchan: above level param && attack < defense if (monEvolutionData->methods[i].param <= monLevel) { - if ((GetMonData(mon, MON_DATA_ATK, NULL)) < (GetMonData(mon, MON_DATA_DEF, NULL))) { + if (GetMonData(mon, MON_DATA_ATK, NULL) < GetMonData(mon, MON_DATA_DEF, NULL)) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 10; } @@ -3027,7 +3077,7 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int break; case 11: // wurmple evo to silcoon: above level param && upper16 of personality % 10 < 5 if (monEvolutionData->methods[i].param <= monLevel) { - if ((monPersonalityUpper % 10) < 5) { + if (monPersonalityUpper % 10 < 5) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 11; } @@ -3035,7 +3085,7 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int break; case 12: // wurmple evo to cascoon: above level param && upper16 of personality % 10 >= 5 if (monEvolutionData->methods[i].param <= monLevel) { - if ((monPersonalityUpper % 10) >= 5) { + if (monPersonalityUpper % 10 >= 5) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 12; } @@ -3057,13 +3107,13 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int } break; case 18: // happiny evo: hold param && daytime - if ((sub_02013948() == 0) && (monEvolutionData->methods[i].param == monHeldItem)) { + if (sub_02013948() == 0 && monEvolutionData->methods[i].param == monHeldItem) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 18; } break; case 19: // sneasel and gligar evo: hold param && nighttime - if ((sub_02013948() == 1) && (monEvolutionData->methods[i].param == monHeldItem)) { + if (sub_02013948() == 1 && monEvolutionData->methods[i].param == monHeldItem) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 19; } @@ -3083,13 +3133,13 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int } break; case 22: // burmy evo to mothim: above level param && male - if ((GetMonData(mon, MON_DATA_GENDER, NULL) == 0) && (monEvolutionData->methods[i].param <= monLevel)) { + if (GetMonData(mon, MON_DATA_GENDER, NULL) == 0 && monEvolutionData->methods[i].param <= monLevel) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 22; } break; case 23: // burmy evo to wormadam, combee evo to vespiquen: above level param && female - if ((GetMonData(mon, MON_DATA_GENDER, NULL) == 1) && (monEvolutionData->methods[i].param <= monLevel)) { + if (GetMonData(mon, MON_DATA_GENDER, NULL) == 1 && monEvolutionData->methods[i].param <= monLevel) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 23; } @@ -3143,19 +3193,19 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int case 3: for (i = 0; i < 7; i++) { // use param - if ((monEvolutionData->methods[i].type == 7) && (monEvolutionData->methods[i].param == evoParam)) { + if (monEvolutionData->methods[i].type == 7 && monEvolutionData->methods[i].param == evoParam) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 0; break; } // kirlia evo to gallade: use param && male - if ((monEvolutionData->methods[i].type == 16) && (GetMonData(mon, MON_DATA_GENDER, NULL) == 0) && (monEvolutionData->methods[i].param == evoParam)) { + if (monEvolutionData->methods[i].type == 16 && GetMonData(mon, MON_DATA_GENDER, NULL) == 0 && monEvolutionData->methods[i].param == evoParam) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 0; break; } // snorunt evo to froslass: use param && female - if ((monEvolutionData->methods[i].type == 17) && (GetMonData(mon, MON_DATA_GENDER, NULL) == 1) && (monEvolutionData->methods[i].param == evoParam)) { + if (monEvolutionData->methods[i].type == 17 && GetMonData(mon, MON_DATA_GENDER, NULL) == 1 && monEvolutionData->methods[i].param == evoParam) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 0; break; @@ -3175,7 +3225,7 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int u16 sub_02076F84 (const u16 monSpecies) { u16 result = 0; - GF_ASSERT((493 + 1) > monSpecies); + GF_ASSERT(NATIONAL_DEX_COUNT + 1 > monSpecies); FSFile file; FS_InitFile(&file); @@ -3209,6 +3259,7 @@ u16 sub_02076FD4 (const u16 monSpecies) void SetBoxMonDefaultMoves (BoxPokemon *boxMon) { BOOL reencrypt; + // TODO const value? u16 *monLevelUpMoves = Heap_AllocFromHeap(0, 44); reencrypt = DecryptBoxMon(boxMon); @@ -3221,8 +3272,9 @@ void SetBoxMonDefaultMoves (BoxPokemon *boxMon) int i = 0; + // TODO const values for sentinels? while (monLevelUpMoves[i] != 0xffff) { - if ((monLevelUpMoves[i] & 0xfe00) <= (monLevel << 9)) { + if ((monLevelUpMoves[i] & 0xfe00) <= monLevel << 9) { u16 monLevelUpMoveID = monLevelUpMoves[i] & 0x1ff; u16 moveID = AddBoxMonMove(boxMon, monLevelUpMoveID); @@ -3248,6 +3300,7 @@ u16 AddMonMove (Pokemon *mon, u16 moveID) u16 AddBoxMonMove (BoxPokemon *boxMon, u16 moveID) { + // TODO const values for sentinels? u16 result = 0xffff; BOOL reencrypt = DecryptBoxMon(boxMon); @@ -3292,7 +3345,7 @@ void ReplaceBoxMonMove (BoxPokemon *boxMon, u16 moveID) } moveIDs[3] = moveID; - movePPs[3] = MoveTable_LoadParam(moveID, 5); + movePPs[3] = MoveTable_LoadParam(moveID, MOVEATTRIBUTE_PP); movePPUps[3] = 0; for (int i = 0; i < 4; i++) { @@ -3336,6 +3389,7 @@ void SetBoxMonMove (BoxPokemon *boxMon, u16 moveID, u8 moveSlot) u16 sub_0207727C (Pokemon *mon, int *index, u16 *moveID) { u16 result = 0x0; + // TODO const value? u16 *monLevelUpMoves = Heap_AllocFromHeap(0, 44); u16 monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); @@ -3344,12 +3398,13 @@ u16 sub_0207727C (Pokemon *mon, int *index, u16 *moveID) LoadMonLevelUpMoves(monSpecies, monForm, monLevelUpMoves); + // TODO const values for sentinels? if (monLevelUpMoves[index[0]] == 0xffff) { Heap_FreeToHeap(monLevelUpMoves); return 0x0; } - while ((monLevelUpMoves[index[0]] & 0xfe00) != (monLevel << 9)) { + while ((monLevelUpMoves[index[0]] & 0xfe00) != monLevel << 9) { index[0]++; if (monLevelUpMoves[index[0]] == 0xffff) { @@ -3358,7 +3413,7 @@ u16 sub_0207727C (Pokemon *mon, int *index, u16 *moveID) } } - if ((monLevelUpMoves[index[0]] & 0xfe00) == (monLevel << 9)) { + if ((monLevelUpMoves[index[0]] & 0xfe00) == monLevel << 9) { moveID[0] = monLevelUpMoves[index[0]] & 0x1ff; index[0]++; @@ -3439,7 +3494,7 @@ void sub_020774C8 (BoxPokemon *boxMon, Pokemon *mon) mon->box = *boxMon; if (mon->box.boxDecrypted) { - mon->box.partyDecrypted = 1; + mon->box.partyDecrypted = TRUE; } SetMonData(mon, MON_DATA_160, &zero); @@ -3468,7 +3523,7 @@ u8 GetPartyHighestLevel (Party *party) for (int i = 0; i < currentPartyCount; i++) { Pokemon *mon = Party_GetPokemonBySlotIndex(party, i); - if ((GetMonData(mon, MON_DATA_SPECIES, NULL)) && (GetMonData(mon, MON_DATA_IS_EGG, NULL) == 0)) { + if (GetMonData(mon, MON_DATA_SPECIES, NULL) && GetMonData(mon, MON_DATA_IS_EGG, NULL) == 0) { u8 monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); if (monLevel > result) { @@ -3493,6 +3548,7 @@ u16 sub_020775C4 (u16 param0) { u16 result = 0; + // TODO enum value? if (param0 <= 210) { NARC_ReadFromMemberByIndexPair(&result, NARC_INDEX_POKETOOL__SHINZUKAN, 0, param0 * 2, 2); } @@ -3542,6 +3598,7 @@ int GetMonLevelUpMoveIDs (int monSpecies, int monForm, u16 *monLevelUpMoveIDs) int result = 0; + // TODO const values for sentinels? while (monLevelUpMoves[result] != 0xffff) { monLevelUpMoveIDs[result] = monLevelUpMoves[result] & 0x1ff; result++; @@ -3556,14 +3613,14 @@ void sub_020776B0 (Party *party) int currentPartyCount = Party_GetCurrentCount(party); u16 rand = LCRNG_Next(); - if ((rand == 16384) || (rand == 32768) || (rand == 49152)) { + if (rand == 16384 || rand == 32768 || rand == 49152) { int partySlot; Pokemon *mon; do { partySlot = LCRNG_Next() % currentPartyCount; mon = Party_GetPokemonBySlotIndex(party, partySlot); - if ((GetMonData(mon, MON_DATA_SPECIES, NULL)) && (GetMonData(mon, MON_DATA_IS_EGG, NULL) == 0)) { + if (GetMonData(mon, MON_DATA_SPECIES, NULL) && GetMonData(mon, MON_DATA_IS_EGG, NULL) == 0) { break; } else { partySlot = currentPartyCount; @@ -3718,7 +3775,8 @@ void SetBoxArceusForm (BoxPokemon *boxMon) int monAbility = GetBoxMonData(boxMon, MON_DATA_ABILITY, NULL); int monHeldItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM, NULL); - if ((monSpecies == SPECIES_ARCEUS) && (monAbility == 121)) { + // TODO enum values + if (monSpecies == SPECIES_ARCEUS && monAbility == 121) { int monForm = GetArceusItemType(Item_LoadParam(monHeldItem, 1, 0)); SetBoxMonData(boxMon, MON_DATA_FORM, &monForm); } @@ -3789,6 +3847,7 @@ int SetGiratinaForm (Pokemon *mon) { int result = SetBoxGiratinaForm(&mon->box); + // TODO enum value? if (result != -1) { CalculateMonLevelAndStats(mon); } @@ -3801,6 +3860,7 @@ int SetBoxGiratinaForm (BoxPokemon *boxMon) int monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); int monHeldItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM, NULL); + // TODO enum? if (monSpecies == SPECIES_GIRATINA) { int monForm = (monHeldItem == ITEM_GRISEOUS_ORB) ? 1 : 0; @@ -3815,6 +3875,7 @@ int SetBoxGiratinaForm (BoxPokemon *boxMon) void SetGiratinaOriginForm (Pokemon *mon) { + // TODO enum? int monForm = 1; if (GetMonData(mon, MON_DATA_SPECIES, NULL) == SPECIES_GIRATINA) { @@ -3850,6 +3911,7 @@ void SetBoxShayminForm (BoxPokemon *boxMon, int monForm) int monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); if (monSpecies == SPECIES_SHAYMIN) { + // TODO enum? GF_ASSERT(monForm <= 1); SetBoxMonData(boxMon, MON_DATA_FORM, &monForm); @@ -3868,11 +3930,12 @@ BOOL CanShayminSkyForm (Pokemon *mon) RTCTime rtcTime; sub_02013880(&rtcTime); - if ((monSpecies == SPECIES_SHAYMIN) && (monForm == 0) && (monCurrentHP > 0) && (monFatefulEncounter == 1) && ((v2 & 0x20) == 0) && ((rtcTime.hour >= 4) && (rtcTime.hour < 20))) { - return 1; + // TODO refactor + if (monSpecies == SPECIES_SHAYMIN && monForm == 0 && monCurrentHP > 0 && monFatefulEncounter == TRUE && (v2 & 0x20) == 0 && rtcTime.hour >= 4 && rtcTime.hour < 20) { + return TRUE; } - return 0; + return FALSE; } void SetShayminLandForm (Party *party) @@ -3884,7 +3947,8 @@ void SetShayminLandForm (Party *party) int monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); int monForm = GetMonData(mon, MON_DATA_FORM, NULL); - if ((monSpecies == SPECIES_SHAYMIN) && (monForm == 1)) { + if (monSpecies == SPECIES_SHAYMIN && monForm == 1) { + // TODO enum? int zero = 0; SetShayminForm(mon, zero); } @@ -3893,7 +3957,7 @@ void SetShayminLandForm (Party *party) BOOL SetPartyShayminForm (Party *party, int param1, const RTCTime *rtcTime) { - if ((rtcTime->hour >= 20) || (rtcTime->hour < 4)) { + if (rtcTime->hour >= 20 || rtcTime->hour < 4) { s32 hours = rtcTime->hour; if (hours < 4) { @@ -3907,19 +3971,19 @@ BOOL SetPartyShayminForm (Party *party, int param1, const RTCTime *rtcTime) if (minutes < param1) { SetShayminLandForm(party); - return 1; + return TRUE; } - return 0; + return FALSE; } else { s32 minutes = rtcTime->minute + (rtcTime->hour - 4) * 60; if (minutes < param1) { SetShayminLandForm(party); - return 1; + return TRUE; } - return 0; + return FALSE; } } @@ -3928,7 +3992,7 @@ BOOL SetRotomForm (Pokemon *mon, int monForm, int moveSlot) int monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); if (monSpecies != SPECIES_ROTOM) { - return 0; + return FALSE; } int currentMonForm = GetMonData(mon, MON_DATA_FORM, NULL); @@ -3950,10 +4014,10 @@ BOOL SetRotomForm (Pokemon *mon, int monForm, int moveSlot) int moveID = GetMonData(mon, MON_DATA_MOVE1 + i, NULL); for (j = 1; j < NELEMS(rotomFormMoves); j++) { - if ((moveID != 0) && (moveID == rotomFormMoves[j])) { - if (newFormMoveID != 0) { + if (moveID != MOVE_NONE && moveID == rotomFormMoves[j]) { + if (newFormMoveID != MOVE_NONE) { ResetMonMove(mon, newFormMoveID, i); - newFormMoveID = 0; + newFormMoveID = MOVE_NONE; break; } else { DeleteMonMove(mon, i); @@ -3964,9 +4028,9 @@ BOOL SetRotomForm (Pokemon *mon, int monForm, int moveSlot) } } - if (newFormMoveID != 0) { + if (newFormMoveID != MOVE_NONE) { for (i = 0; i < 4; i++) { - if (GetMonData(mon, MON_DATA_MOVE1 + i, NULL) == 0) { + if (GetMonData(mon, MON_DATA_MOVE1 + i, NULL) == MOVE_NONE) { ResetMonMove(mon, newFormMoveID, i); break; } @@ -3977,7 +4041,7 @@ BOOL SetRotomForm (Pokemon *mon, int monForm, int moveSlot) } } - if (GetMonData(mon, MON_DATA_MOVE1, NULL) == 0) { + if (GetMonData(mon, MON_DATA_MOVE1, NULL) == MOVE_NONE) { ResetMonMove(mon, MOVE_THUNDER_SHOCK, 0); } @@ -3985,7 +4049,7 @@ BOOL SetRotomForm (Pokemon *mon, int monForm, int moveSlot) CalculateMonAbility(mon); CalculateMonLevelAndStats(mon); - return 1; + return TRUE; } void LoadMonLevelUpMoves (int monSpecies, int monForm, u16 *monLevelUpMoves) @@ -4076,7 +4140,7 @@ static const u16 sHeldItemChance[][2] = { void sub_02077F0C (Pokemon *mon, u32 param1, int param2) { - if (param1 & ((0x1 | 0x80))) { + if (param1 & (0x1 | 0x80)) { return; } @@ -4086,7 +4150,7 @@ void sub_02077F0C (Pokemon *mon, u32 param1, int param2) u16 monItem1 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ITEM1); u16 monItem2 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ITEM2); - if ((monItem1 == monItem2) && (monItem1 != 0)) { + if (monItem1 == monItem2 && monItem1 != 0) { SetMonData(mon, MON_DATA_HELD_ITEM, &monItem1); return; } @@ -4116,7 +4180,7 @@ BOOL CanBoxMonLearnTM (BoxPokemon *boxMon, u8 tmID) BOOL CanMonSpeciesLearnTM (u16 monSpecies, int monForm, u8 tmID) { if (monSpecies == SPECIES_EGG) { - return 0; + return FALSE; } u32 tmFlag; @@ -4152,6 +4216,7 @@ void CalculateBoxMonAbility (BoxPokemon *boxMon) int monAbility1 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ABILITY_1); int monAbility2 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ABILITY_2); + // TODO enum value? if (monAbility2 != 0) { if (monPersonality & 1) { SetBoxMonData(boxMon, MON_DATA_ABILITY, &monAbility2); @@ -4171,6 +4236,7 @@ void sub_020780C4 (Pokemon *mon, u32 monPersonality) sub_020775EC(mon, newMon); + // TODO enum values? PokemonDataBlockA *newMonBlockA = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 0); PokemonDataBlockB *newMonBlockB = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 1); PokemonDataBlockC *newMonBlockC = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 2); @@ -4259,7 +4325,7 @@ static u16 GetMonDataChecksum (void *data, u32 bytes) break; \ } -static void * GetBoxMonDataBlock (BoxPokemon *boxMon, u32 personality, u8 dataBlockID) +static void *GetBoxMonDataBlock (BoxPokemon *boxMon, u32 personality, u8 dataBlockID) { personality = (personality & 0x3e000) >> 13; GF_ASSERT(personality <= 31); @@ -4329,29 +4395,30 @@ static void * GetBoxMonDataBlock (BoxPokemon *boxMon, u32 personality, u8 dataBl static int GetMonFormNarcIndex (int monSpecies, int monForm) { + // TODO enum values? switch (monSpecies) { case SPECIES_DEOXYS: - if ((monForm) && (monForm <= 3)) { + if (monForm && monForm <= 3) { monSpecies = (496 - 1) + monForm; } break; case SPECIES_WORMADAM: - if ((monForm) && (monForm <= 2)) { + if (monForm && monForm <= 2) { monSpecies = (499 - 1) + monForm; } break; case SPECIES_GIRATINA: - if ((monForm) && (monForm <= 1)) { + if (monForm && monForm <= 1) { monSpecies = (501 - 1) + monForm; } break; case SPECIES_SHAYMIN: - if ((monForm) && (monForm <= 1)) { + if (monForm && monForm <= 1) { monSpecies = (502 - 1) + monForm; } break; case SPECIES_ROTOM: - if ((monForm) && (monForm <= 5)) { + if (monForm && monForm <= 5) { monSpecies = (503 - 1) + monForm; } break; @@ -4446,13 +4513,14 @@ BOOL sub_0207884C (BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int heapID) u32 v2 = sub_02025F30(param1); u32 monOtGender = GetBoxMonData(boxMon, MON_DATA_OT_GENDER, NULL); Strbuf *v4 = sub_02025F04(param1, heapID); + // TODO enum/const value? Strbuf *v5 = Strbuf_Init(8, heapID); - BOOL v6 = 0; + BOOL v6 = FALSE; GetBoxMonData(boxMon, MON_DATA_145, v5); - if ((v0 == monOTID) && (v2 == monOtGender) && (Strbuf_Compare(v4, v5) == 0)) { - v6 = 1; + if (v0 == monOTID && v2 == monOtGender && Strbuf_Compare(v4, v5) == 0) { + v6 = TRUE; } Strbuf_Free(v5); @@ -4463,6 +4531,7 @@ BOOL sub_0207884C (BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int heapID) int sub_020788D0 (int param0) { + // TODO enum values? switch (param0) { case 0: case 1: @@ -4586,10 +4655,11 @@ void sub_02078AC8 (NARC *narc, u8 *param1, u16 param2) BOOL sub_02078AEC (int param0, Pokemon *mon, int heapID) { + // TODO restructure this int v0 = param0; if (v0 == 0) { - return 0; + return FALSE; } NARC *narc = NARC_ctor(NARC_INDEX_APPLICATION__CUSTOM_BALL__EDIT__PL_CB_DATA, heapID); @@ -4602,25 +4672,26 @@ BOOL sub_02078AEC (int param0, Pokemon *mon, int heapID) SetMonData(mon, MON_DATA_171, &v2); NARC_dtor(narc); - return 1; + return TRUE; } void sub_02078B40 (Pokemon *mon, UnkStruct_02078B40 *param1) { - if (mon->box.partyDecrypted == 0) { + if (mon->box.partyDecrypted == FALSE) { DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } BoxPokemon *boxMon = GetBoxMon(mon); + // TODO enum values? PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); param1->personality = boxMon->personality; - param1->partyDecrypted = 0; - param1->boxDecrypted = 0; + param1->partyDecrypted = FALSE; + param1->boxDecrypted = FALSE; param1->invalidData = boxMon->invalidData; param1->species = monDataBlockA->species; param1->heldItem = monDataBlockA->heldItem; @@ -4676,7 +4747,7 @@ void sub_02078B40 (Pokemon *mon, UnkStruct_02078B40 *param1) param1->unk_6C = mon->party.unk_10; param1->unk_6E = mon->party.unk_12; - if (mon->box.partyDecrypted == 0) { + if (mon->box.partyDecrypted == FALSE) { EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } @@ -4687,14 +4758,15 @@ void sub_02078E0C (UnkStruct_02078B40 *param0, Pokemon *mon) MI_CpuClearFast(mon, sizeof(Pokemon)); BoxPokemon *boxMon = GetBoxMon(mon); + // TODO enum values? PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, param0->personality, 0); PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, param0->personality, 1); PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, param0->personality, 2); PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, param0->personality, 3); boxMon->personality = param0->personality; - boxMon->partyDecrypted = 0; - boxMon->boxDecrypted = 0; + boxMon->partyDecrypted = FALSE; + boxMon->boxDecrypted = FALSE; boxMon->invalidData = param0->invalidData; monDataBlockA->species = param0->species; From 81852038e84e1ba65dc2be17cb57954642d92b5a Mon Sep 17 00:00:00 2001 From: wildfire Date: Sun, 10 Sep 2023 15:34:56 +0100 Subject: [PATCH 07/11] Misc. renames and cleanup, move data block structs --- include/pokemon.h | 40 +++++-- include/struct_defs/box_pokemon.h | 86 +++++++++++++- include/struct_defs/pokemon_data_block_a.h | 31 ----- include/struct_defs/pokemon_data_block_b.h | 29 ----- include/struct_defs/pokemon_data_block_c.h | 14 --- include/struct_defs/pokemon_data_block_d.h | 25 ---- src/overlay016/ov16_0225177C.c | 40 +++---- src/pokemon.c | 128 +++++++++++---------- src/unk_0206CCB0.c | 2 +- src/unk_0208C324.c | 2 +- src/unk_02092494.c | 2 +- 11 files changed, 202 insertions(+), 197 deletions(-) delete mode 100644 include/struct_defs/pokemon_data_block_a.h delete mode 100644 include/struct_defs/pokemon_data_block_b.h delete mode 100644 include/struct_defs/pokemon_data_block_c.h delete mode 100644 include/struct_defs/pokemon_data_block_d.h diff --git a/include/pokemon.h b/include/pokemon.h index 454f78aefd..3d0e365a21 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -85,10 +85,6 @@ BOOL DecryptBoxMon(BoxPokemon *boxMon); BOOL EncryptBoxMon(BoxPokemon *boxMon, BOOL encrypt); void sub_02073D80(Pokemon *mon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); - -// TODO make this static? -void sub_02073E18(BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); - void sub_02074044(Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monNature); void sub_02074088(Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 param4, u8 param5, u8 param6); u32 sub_02074128(u16 monSpecies, u8 param1, u8 param2); @@ -385,7 +381,7 @@ u8 GetMonPersonalityShininess(u32 monOTID, u32 monPersonality); u32 sub_02075E64(u32 param0); void sub_02075EF4(UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2); void sub_02075F00(UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2); -void sub_02075F0C(UnkStruct_02008A90 *param0, BoxPokemon *boxMon, u8 param2, int param3); +void sub_02075F0C(UnkStruct_02008A90 *param0, BoxPokemon *boxMon, u8 param2, BOOL param3); void sub_02075FB4(UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); /** @@ -399,7 +395,7 @@ u8 SanitizeFormId(u16 monSpecies, u8 monForm); u8 sub_020765AC(Pokemon *mon, u8 param1); u8 sub_020765B8(Pokemon *mon, u8 param1); -u8 sub_020765C4(BoxPokemon *boxMon, u8 param1, int param2); +u8 sub_020765C4(BoxPokemon *boxMon, u8 param1, BOOL param2); u8 sub_02076648(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality); void sub_0207697C(UnkStruct_02008A90 *param0, u16 param1); UnkStruct_0200D0F4 *sub_02076994(UnkStruct_0200C6E4 *param0, UnkStruct_0200C704 *param1, UnkStruct_02002F38 *param2, int param3, int param4, int param5, int param6, int param7, int heapID); @@ -443,7 +439,7 @@ u8 GetBoxMonForm(BoxPokemon *boxMon); */ BoxPokemon *GetBoxMon(Pokemon *mon); -u8 sub_02076B14(Pokemon *mon); +BOOL sub_02076B14(Pokemon *mon); u16 sub_02076B94(Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int *evoTypeResult); u16 sub_02076F84(const u16 monSpecies); u16 sub_02076FD4(const u16 monSpecies); @@ -568,9 +564,33 @@ u16 sub_020775C4(u16 param0); void sub_020775EC(Pokemon *src, Pokemon *dest); void sub_02077604(BoxPokemon *src, BoxPokemon *dest); void sub_02077618(Pokemon *src, BoxPokemon *dest); -s8 sub_0207762C(Pokemon *mon, int param1); -s8 sub_02077634(BoxPokemon *boxMon, int param1); -s8 sub_02077648(u32 monPersonality, int param1); + +/** + * @brief Gets the affinitiy of a given Pokemon to a given flavor + * + * @param mon + * @param flavor + * @return 1 if liked flavor, -1 if disliked flavor, else 0 + */ +s8 GetMonFlavorAffinity(Pokemon *mon, int flavor); + +/** + * @brief Gets the affinitiy of a given BoxPokemon to a given flavor + * + * @param boxMon + * @param flavor + * @return 1 if liked flavor, -1 if disliked flavor, else 0 + */ +s8 GetBoxMonFlavorAffinity(BoxPokemon *boxMon, int flavor); + +/** + * @brief Gets the affinitiy of a given Pokemon personality to a given flavor + * + * @param monPersonality + * @param flavor + * @return 1 if liked flavor, -1 if disliked flavor, else 0 + */ +s8 GetMonPersonalityFlavorAffinity(u32 monPersonality, int flavor); /** * @brief Gets all moves that the given pokemon species and form can learn by leveling up diff --git a/include/struct_defs/box_pokemon.h b/include/struct_defs/box_pokemon.h index 2bd1f1b301..4c57fe604c 100644 --- a/include/struct_defs/box_pokemon.h +++ b/include/struct_defs/box_pokemon.h @@ -1,10 +1,88 @@ #ifndef POKEPLATINUM_BOX_POKEMON_H #define POKEPLATINUM_BOX_POKEMON_H -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" -#include "struct_defs/pokemon_data_block_a.h" +/** + * @brief Block A of the BoxPokemon data structure + */ +typedef struct PokemonDataBlockA { + u16 species; //!< The pokemons species + u16 heldItem; //!< The pokemons currently held item + u32 otID; //!< The pokemons Original Trainer ID + u32 exp; //!< The pokemons experience points + u8 friendship; //!< The pokemons friendship stat + u8 ability; //!< The pokemons ability + u8 unk_0E; + u8 originLanguage; //!< The language of the game this pokemon was caught in + u8 hpEV; //!< The pokemons HP EVs + u8 atkEV; //!< The pokemons Attack EVs + u8 defEV; //!< The pokemons Defense EVs + u8 speedEV; //!< The pokemons Speed EVs + u8 spAtkEV; //!< The pokemons Special Attack EVs + u8 spDefEV; //!< The pokemons Special Defense EVs + u8 cool; //!< The pokemons Cool contest stat + u8 beauty; //!< The pokemons Beauty contest stat + u8 cute; //!< The pokemons Cute contest stat + u8 smart; //!< The pokemons Smart contest stat + u8 tough; //!< The pokemons Tough contest stat + u8 sheen; //!< The pokemons Sheen + u32 unk_1C; +} PokemonDataBlockA; + +/** + * @brief Block B of the BoxPokemon data structure + */ +typedef struct PokemonDataBlockB { + u16 moves[4]; //!< The ID of each move the pokemon knows + u8 moveCurrentPPs[4]; //!< The current PP of each move + u8 movePPUps[4]; //!< The number of PP Ups used on each move + u32 hpIV : 5; //!< The pokemons HP IVs + u32 atkIV : 5; //!< The pokemons Attack IVs + u32 defIV : 5; //!< The pokemons Defense IVs + u32 speedIV : 5; //!< The pokemons Speed IVs + u32 spAtkIV : 5; //!< The pokemons Special Attack IVs + u32 spDefIV : 5; //!< The pokemons Special Defense IVs + u32 isEgg : 1; //!< Whether this pokemon is an egg or not + u32 unk_10_31 : 1; + u32 unk_14; + u8 fatefulEncounter:1; //!< The pokemons "Fateful Encounter" flag + u8 gender : 2; //!< The pokemons gender + u8 form:5; //!< The pokemons form + u8 unk_19; + u16 unk_1A; + u16 unk_1C; + u16 unk_1E; +} PokemonDataBlockB; + +/** + * @brief Block C of the BoxPokemon data structure + */ +typedef struct PokemonDataBlockC { + u16 unk_00[11]; + u8 unk_16; + u8 originGame; //!< The game this pokemon was caught in + u64 unk_18; +} PokemonDataBlockC; + +/** + * @brief Block D of the BoxPokemon data structure + */ +typedef struct PokemonDataBlockD { + u16 unk_00[8]; + u8 unk_10; + u8 unk_11; + u8 unk_12; + u8 unk_13; + u8 unk_14; + u8 unk_15; + u16 unk_16; + u16 unk_18; + u8 pokerus; //!< The pokemons Pokerus value + u8 pokeball; //!< What pokeball this pokemon was caught in + u8 metLevel : 7; //!< What level this pokemon was originally met at + u8 otGender : 1; //!< The gender of this pokemons Original Trainer + u8 unk_1D; + u16 unk_1E; +} PokemonDataBlockD; typedef union { PokemonDataBlockA blockA; diff --git a/include/struct_defs/pokemon_data_block_a.h b/include/struct_defs/pokemon_data_block_a.h deleted file mode 100644 index 4ab865b15e..0000000000 --- a/include/struct_defs/pokemon_data_block_a.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef POKEPLATINUM_POKEMON_SUBSTRUCT_0_H -#define POKEPLATINUM_POKEMON_SUBSTRUCT_0_H - -/** - * @brief Block A of the BoxPokemon data structure - */ -typedef struct PokemonDataBlockA { - u16 species; //!< The pokemons species - u16 heldItem; //!< The pokemons currently held item - u32 otID; //!< The pokemons Original Trainer ID - u32 exp; //!< The pokemons experience points - u8 friendship; //!< The pokemons friendship stat - u8 ability; //!< The pokemons ability - u8 unk_0E; - u8 originLanguage; //!< The language of the game this pokemon was caught in - u8 hpEV; //!< The pokemons HP EVs - u8 atkEV; //!< The pokemons Attack EVs - u8 defEV; //!< The pokemons Defense EVs - u8 speedEV; //!< The pokemons Speed EVs - u8 spAtkEV; //!< The pokemons Special Attack EVs - u8 spDefEV; //!< The pokemons Special Defense EVs - u8 cool; //!< The pokemons Cool contest stat - u8 beauty; //!< The pokemons Beauty contest stat - u8 cute; //!< The pokemons Cute contest stat - u8 smart; //!< The pokemons Smart contest stat - u8 tough; //!< The pokemons Tough contest stat - u8 sheen; //!< The pokemons Sheen - u32 unk_1C; -} PokemonDataBlockA; - -#endif // POKEPLATINUM_POKEMON_SUBSTRUCT_0_H diff --git a/include/struct_defs/pokemon_data_block_b.h b/include/struct_defs/pokemon_data_block_b.h deleted file mode 100644 index 356780f0c5..0000000000 --- a/include/struct_defs/pokemon_data_block_b.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef POKEPLATINUM_POKEMON_SUBSTRUCT_1_H -#define POKEPLATINUM_POKEMON_SUBSTRUCT_1_H - -/** - * @brief Block B of the BoxPokemon data structure - */ -typedef struct PokemonDataBlockB { - u16 moves[4]; //!< The ID of each move the pokemon knows - u8 moveCurrentPPs[4]; //!< The current PP of each move - u8 movePPUps[4]; //!< The number of PP Ups used on each move - u32 hpIV : 5; //!< The pokemons HP IVs - u32 atkIV : 5; //!< The pokemons Attack IVs - u32 defIV : 5; //!< The pokemons Defense IVs - u32 speedIV : 5; //!< The pokemons Speed IVs - u32 spAtkIV : 5; //!< The pokemons Special Attack IVs - u32 spDefIV : 5; //!< The pokemons Special Defense IVs - u32 isEgg : 1; //!< Whether this pokemon is an egg or not - u32 unk_10_31 : 1; - u32 unk_14; - u8 fatefulEncounter:1; //!< The pokemons "Fateful Encounter" flag - u8 gender : 2; //!< The pokemons gender - u8 form:5; //!< The pokemons form - u8 unk_19; - u16 unk_1A; - u16 unk_1C; - u16 unk_1E; -} PokemonDataBlockB; - -#endif // POKEPLATINUM_POKEMON_SUBSTRUCT_1_H diff --git a/include/struct_defs/pokemon_data_block_c.h b/include/struct_defs/pokemon_data_block_c.h deleted file mode 100644 index 3d9c7552c4..0000000000 --- a/include/struct_defs/pokemon_data_block_c.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef POKEPLATINUM_POKEMON_SUBSTRUCT_2_H -#define POKEPLATINUM_POKEMON_SUBSTRUCT_2_H - -/** - * @brief Block C of the BoxPokemon data structure - */ -typedef struct PokemonDataBlockC { - u16 unk_00[11]; - u8 unk_16; - u8 originGame; //!< The game this pokemon was caught in - u64 unk_18; -} PokemonDataBlockC; - -#endif // POKEPLATINUM_POKEMON_SUBSTRUCT_2_H diff --git a/include/struct_defs/pokemon_data_block_d.h b/include/struct_defs/pokemon_data_block_d.h deleted file mode 100644 index e3641fa637..0000000000 --- a/include/struct_defs/pokemon_data_block_d.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef POKEPLATINUM_POKEMON_SUBSTRUCT_3_H -#define POKEPLATINUM_POKEMON_SUBSTRUCT_3_H - -/** - * @brief Block D of the BoxPokemon data structure - */ -typedef struct PokemonDataBlockD { - u16 unk_00[8]; - u8 unk_10; - u8 unk_11; - u8 unk_12; - u8 unk_13; - u8 unk_14; - u8 unk_15; - u16 unk_16; - u16 unk_18; - u8 pokerus; //!< The pokemons Pokerus value - u8 pokeball; //!< What pokeball this pokemon was caught in - u8 metLevel : 7; //!< What level this pokemon was originally met at - u8 otGender : 1; //!< The gender of this pokemons Original Trainer - u8 unk_1D; - u16 unk_1E; -} PokemonDataBlockD; - -#endif // POKEPLATINUM_POKEMON_SUBSTRUCT_3_H diff --git a/src/overlay016/ov16_0225177C.c b/src/overlay016/ov16_0225177C.c index d0e0d9cd36..abadc99c19 100644 --- a/src/overlay016/ov16_0225177C.c +++ b/src/overlay016/ov16_0225177C.c @@ -4534,7 +4534,7 @@ BOOL BattleSystem_TriggerHeldItem (BattleSystem * param0, BattleContext * param1 param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 0; - if (sub_02077648(param1->battleMons[param2].pid, 0) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 0) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -4548,7 +4548,7 @@ BOOL BattleSystem_TriggerHeldItem (BattleSystem * param0, BattleContext * param1 param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 1; - if (sub_02077648(param1->battleMons[param2].pid, 1) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 1) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -4562,7 +4562,7 @@ BOOL BattleSystem_TriggerHeldItem (BattleSystem * param0, BattleContext * param1 param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 2; - if (sub_02077648(param1->battleMons[param2].pid, 2) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 2) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -4576,7 +4576,7 @@ BOOL BattleSystem_TriggerHeldItem (BattleSystem * param0, BattleContext * param1 param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 3; - if (sub_02077648(param1->battleMons[param2].pid, 3) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 3) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -4590,7 +4590,7 @@ BOOL BattleSystem_TriggerHeldItem (BattleSystem * param0, BattleContext * param1 param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 4; - if (sub_02077648(param1->battleMons[param2].pid, 4) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 4) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -4943,7 +4943,7 @@ BOOL BattleSystem_TriggerHeldItemOnStatus (BattleSystem * param0, BattleContext param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 0; - if (sub_02077648(param1->battleMons[param2].pid, 0) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 0) == -1) { param3[0] = (0 + 207); } else { param3[0] = (0 + 198); @@ -4957,7 +4957,7 @@ BOOL BattleSystem_TriggerHeldItemOnStatus (BattleSystem * param0, BattleContext param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 1; - if (sub_02077648(param1->battleMons[param2].pid, 1) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 1) == -1) { param3[0] = (0 + 207); } else { param3[0] = (0 + 198); @@ -4971,7 +4971,7 @@ BOOL BattleSystem_TriggerHeldItemOnStatus (BattleSystem * param0, BattleContext param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 2; - if (sub_02077648(param1->battleMons[param2].pid, 2) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 2) == -1) { param3[0] = (0 + 207); } else { param3[0] = (0 + 198); @@ -4985,7 +4985,7 @@ BOOL BattleSystem_TriggerHeldItemOnStatus (BattleSystem * param0, BattleContext param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 3; - if (sub_02077648(param1->battleMons[param2].pid, 3) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 3) == -1) { param3[0] = (0 + 207); } else { param3[0] = (0 + 198); @@ -4999,7 +4999,7 @@ BOOL BattleSystem_TriggerHeldItemOnStatus (BattleSystem * param0, BattleContext param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 4; - if (sub_02077648(param1->battleMons[param2].pid, 4) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 4) == -1) { param3[0] = (0 + 207); } else { param3[0] = (0 + 198); @@ -5476,7 +5476,7 @@ BOOL ov16_02258CB4 (BattleSystem * param0, BattleContext * param1, int param2) param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param1->attacker].maxHP, v3); param1->msgTemp = 0; - if (sub_02077648(param1->battleMons[param1->attacker].pid, 0) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->attacker].pid, 0) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -5490,7 +5490,7 @@ BOOL ov16_02258CB4 (BattleSystem * param0, BattleContext * param1, int param2) param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param1->attacker].maxHP, v3); param1->msgTemp = 1; - if (sub_02077648(param1->battleMons[param1->attacker].pid, 1) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->attacker].pid, 1) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -5504,7 +5504,7 @@ BOOL ov16_02258CB4 (BattleSystem * param0, BattleContext * param1, int param2) param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param1->attacker].maxHP, v3); param1->msgTemp = 2; - if (sub_02077648(param1->battleMons[param1->attacker].pid, 2) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->attacker].pid, 2) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -5518,7 +5518,7 @@ BOOL ov16_02258CB4 (BattleSystem * param0, BattleContext * param1, int param2) param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param1->attacker].maxHP, v3); param1->msgTemp = 3; - if (sub_02077648(param1->battleMons[param1->attacker].pid, 3) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->attacker].pid, 3) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -5532,7 +5532,7 @@ BOOL ov16_02258CB4 (BattleSystem * param0, BattleContext * param1, int param2) param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param1->attacker].maxHP, v3); param1->msgTemp = 4; - if (sub_02077648(param1->battleMons[param1->attacker].pid, 4) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->attacker].pid, 4) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -5755,7 +5755,7 @@ BOOL ov16_02259204 (BattleSystem * param0, BattleContext * param1, int param2) param1->flingTemp = BattleSystem_Divide(param1->battleMons[param1->defender].maxHP, v2); param1->msgTemp = 0; - if (sub_02077648(param1->battleMons[param1->defender].pid, 0) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->defender].pid, 0) == -1) { param1->flingScript = (0 + 207); } else { param1->flingScript = (0 + 198); @@ -5765,7 +5765,7 @@ BOOL ov16_02259204 (BattleSystem * param0, BattleContext * param1, int param2) param1->flingTemp = BattleSystem_Divide(param1->battleMons[param1->defender].maxHP, v2); param1->msgTemp = 1; - if (sub_02077648(param1->battleMons[param1->defender].pid, 1) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->defender].pid, 1) == -1) { param1->flingScript = (0 + 207); } else { param1->flingScript = (0 + 198); @@ -5775,7 +5775,7 @@ BOOL ov16_02259204 (BattleSystem * param0, BattleContext * param1, int param2) param1->flingTemp = BattleSystem_Divide(param1->battleMons[param1->defender].maxHP, v2); param1->msgTemp = 2; - if (sub_02077648(param1->battleMons[param1->defender].pid, 2) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->defender].pid, 2) == -1) { param1->flingScript = (0 + 207); } else { param1->flingScript = (0 + 198); @@ -5785,7 +5785,7 @@ BOOL ov16_02259204 (BattleSystem * param0, BattleContext * param1, int param2) param1->flingTemp = BattleSystem_Divide(param1->battleMons[param1->defender].maxHP, v2); param1->msgTemp = 3; - if (sub_02077648(param1->battleMons[param1->defender].pid, 3) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->defender].pid, 3) == -1) { param1->flingScript = (0 + 207); } else { param1->flingScript = (0 + 198); @@ -5795,7 +5795,7 @@ BOOL ov16_02259204 (BattleSystem * param0, BattleContext * param1, int param2) param1->flingTemp = BattleSystem_Divide(param1->battleMons[param1->defender].maxHP, v2); param1->msgTemp = 4; - if (sub_02077648(param1->battleMons[param1->defender].pid, 4) == -1) { + if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->defender].pid, 4) == -1) { param1->flingScript = (0 + 207); } else { param1->flingScript = (0 + 198); diff --git a/src/pokemon.c b/src/pokemon.c index 17a28d245e..eacc7ce902 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -22,10 +22,6 @@ #include "struct_defs/pokemon.h" #include "struct_defs/box_pokemon.h" #include "struct_defs/party_pokemon.h" -#include "struct_defs/pokemon_data_block_a.h" -#include "struct_defs/pokemon_data_block_b.h" -#include "struct_defs/pokemon_data_block_c.h" -#include "struct_defs/pokemon_data_block_d.h" #include "struct_defs/pokemon_personal_data.h" #include "struct_defs/pokemon_evolution_data.h" #include "struct_defs/struct_020789BC.h" @@ -63,7 +59,9 @@ #include "constants/items.h" #include "constants/moves.h" -static const s8 Unk_020F0695[][5] = { +// Columns: Spicy, Dry, Sweet, Bitter, Sour +// TODO enum here? +static const s8 sNatureFlavorAffinities[][5] = { { 0x0, 0x0, 0x0, 0x0, 0x0 }, { 0x1, 0x0, 0x0, 0x0, -0x1 }, { 0x1, 0x0, -0x1, 0x0, 0x0 }, @@ -91,6 +89,14 @@ static const s8 Unk_020F0695[][5] = { { 0x0, 0x0, 0x0, 0x0, 0x0 }, }; +static enum PokemonDataBlockID { + DATA_BLOCK_A = 0, + DATA_BLOCK_B, + DATA_BLOCK_C, + DATA_BLOCK_D +}; + +static void sub_02073E18(BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); static u32 GetMonDataAttribute(Pokemon *mon, enum PokemonDataParam param, void *dest); static u32 GetBoxMonDataAttribute(BoxPokemon *boxMon, enum PokemonDataParam param, void *dest); static void SetMonDataAttribute(Pokemon *mon, enum PokemonDataParam param, const void *value); @@ -99,13 +105,14 @@ static void IncreaseMonDataAttribute(Pokemon *mon, enum PokemonDataParam param, static void IncreaseBoxMonDataAttribute(BoxPokemon *boxMon, enum PokemonDataParam param, int value); static u32 GetMonExpRateLevelExp(int monExpRate, int monLevel); static u16 GetNatureAdjustedStatValue(u8 monNature, u16 monStatValue, u8 statType); +static inline BOOL IsMonPersonalityShiny(u32 monOTID, u32 monPersonality); static void LoadMonPersonalData(int monSpecies, PokemonPersonalData *monPersonalData); static void LoadMonFormPersonalData(int monSpecies, int monForm, PokemonPersonalData *monPersonalData); static void LoadMonEvolutionData(int monSpecies, PokemonEvolutionData *monEvolutionData); static void EncryptMonData(void *data, u32 bytes, u32 seed); static void DecryptMonData(void *data, u32 bytes, u32 seed); static u16 GetMonDataChecksum(void *data, u32 bytes); -static void *GetBoxMonDataBlock(BoxPokemon *boxMon, u32 personality, u8 dataBlockID); +static void *GetBoxMonDataBlock(BoxPokemon *boxMon, u32 personality, enum PokemonDataBlockID dataBlockID); static int GetMonFormNarcIndex(int monSpecies, int monForm); static void sub_02076300(UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); static u8 sub_020767BC(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality); @@ -223,8 +230,7 @@ void sub_02073D80 (Pokemon *mon, int monSpecies, int monLevel, int monIVs, BOOL CalculateMonLevelAndStats(mon); } -// TODO make this static? -void sub_02073E18 (BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) +static void sub_02073E18 (BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) { ZeroBoxMonData(boxMon); @@ -240,7 +246,7 @@ void sub_02073E18 (BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, if (monOTIDSource == 2) { do { monOTID = (LCRNG_Next() | (LCRNG_Next() << 16)); - } while ((((monOTID & 0xffff0000) >> 16) ^ (monOTID & 0xffff) ^ ((monPersonality & 0xffff0000) >> 16) ^ (monPersonality & 0xffff)) < 8); + } while (IsMonPersonalityShiny(monOTID, monPersonality)); } else if (monOTIDSource != 1) { monOTID = 0; } @@ -580,11 +586,10 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, enum PokemonDataParam par { u32 result = 0; - // TODO enum? - PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); - PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); - PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); - PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); + PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_A); + PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_B); + PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_C); + PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_D); switch (param) { default: @@ -1089,11 +1094,10 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, enum PokemonDataParam pa u16 *u16Value = value; u8 *u8Value = value; - // TODO enum values? - PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); - PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); - PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); - PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); + PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_A); + PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_B); + PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_C); + PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_D); switch (param) { case MON_DATA_PERSONALITY: @@ -1521,11 +1525,10 @@ static void IncreaseMonDataAttribute (Pokemon *mon, enum PokemonDataParam param, static void IncreaseBoxMonDataAttribute (BoxPokemon *boxMon, enum PokemonDataParam param, int value) { - // TODO enum values? - PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); - PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); - PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); - PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); + PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_A); + PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_B); + PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_C); + PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_D); // TODO consts for various maximum values? switch (param) { @@ -2283,9 +2286,13 @@ u8 GetBoxMonShininess (BoxPokemon *boxMon) return GetMonPersonalityShininess(monOTID, monPersonality); } +static inline BOOL IsMonPersonalityShiny(u32 monOTID, u32 monPersonality) { + return (((monOTID & 0xffff0000) >> 16) ^ (monOTID & 0xffff) ^ ((monPersonality & 0xffff0000) >> 16) ^ (monPersonality & 0xffff)) < 8; +} + u8 GetMonPersonalityShininess (u32 monOTID, u32 monPersonality) { - return (((monOTID & 0xffff0000) >> 16) ^ (monOTID & 0xffff) ^ ((monPersonality & 0xffff0000) >> 16) ^ (monPersonality & 0xffff)) < 8; + return IsMonPersonalityShiny(monOTID, monPersonality); } u32 sub_02075E64 (u32 param0) @@ -2326,8 +2333,7 @@ void sub_02075F00 (UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2) sub_02075F0C(param0, &mon->box, param2, TRUE); } -// TODO change param3 to BOOL -void sub_02075F0C (UnkStruct_02008A90 *param0, BoxPokemon *boxMon, u8 param2, int param3) +void sub_02075F0C (UnkStruct_02008A90 *param0, BoxPokemon *boxMon, u8 param2, BOOL param3) { BOOL reencrypt = DecryptBoxMon(boxMon); @@ -2648,8 +2654,7 @@ u8 sub_020765B8 (Pokemon *mon, u8 param1) return sub_020765C4(&mon->box, param1, TRUE); } -// TODO change param2 to BOOL -u8 sub_020765C4 (BoxPokemon *boxMon, u8 param1, int param2) +u8 sub_020765C4 (BoxPokemon *boxMon, u8 param1, BOOL param2) { u16 monSpeciesEgg = GetBoxMonData(boxMon, MON_DATA_SPECIES_EGG, NULL); u8 monGender = GetBoxMonGender(boxMon); @@ -2959,8 +2964,7 @@ BoxPokemon *GetBoxMon (Pokemon *mon) return &mon->box; } -// TODO return BOOL -u8 sub_02076B14 (Pokemon *mon) +BOOL sub_02076B14 (Pokemon *mon) { u16 monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); u8 monNextLevel = GetMonData(mon, MON_DATA_LEVEL, NULL) + 1; @@ -3574,20 +3578,23 @@ void sub_02077618 (Pokemon *src, BoxPokemon *dest) return; } -s8 sub_0207762C (Pokemon *mon, int param1) +// TODO enums +s8 GetMonFlavorAffinity (Pokemon *mon, int flavor) { - return sub_02077634(&mon->box, param1); + return GetBoxMonFlavorAffinity(&mon->box, flavor); } -s8 sub_02077634 (BoxPokemon *boxMon, int param1) +// TODO enums +s8 GetBoxMonFlavorAffinity (BoxPokemon *boxMon, int flavor) { - return sub_02077648(GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL), param1); + return GetMonPersonalityFlavorAffinity(GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL), flavor); } -s8 sub_02077648 (u32 monPersonality, int param1) +// TODO enums +s8 GetMonPersonalityFlavorAffinity (u32 monPersonality, int flavor) { u8 monNature = GetNatureFromPersonality(monPersonality); - return Unk_020F0695[monNature][param1]; + return sNatureFlavorAffinities[monNature][flavor]; } int GetMonLevelUpMoveIDs (int monSpecies, int monForm, u16 *monLevelUpMoveIDs) @@ -4236,15 +4243,14 @@ void sub_020780C4 (Pokemon *mon, u32 monPersonality) sub_020775EC(mon, newMon); - // TODO enum values? - PokemonDataBlockA *newMonBlockA = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 0); - PokemonDataBlockB *newMonBlockB = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 1); - PokemonDataBlockC *newMonBlockC = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 2); - PokemonDataBlockD *newMonBlockD = GetBoxMonDataBlock(&newMon->box, mon->box.personality, 3); - PokemonDataBlockA *monBlockA = GetBoxMonDataBlock(&mon->box, monPersonality, 0); - PokemonDataBlockB *monBlockB = GetBoxMonDataBlock(&mon->box, monPersonality, 1); - PokemonDataBlockC *monBlockC = GetBoxMonDataBlock(&mon->box, monPersonality, 2); - PokemonDataBlockD *monBlockD = GetBoxMonDataBlock(&mon->box, monPersonality, 3); + PokemonDataBlockA *newMonBlockA = GetBoxMonDataBlock(&newMon->box, mon->box.personality, DATA_BLOCK_A); + PokemonDataBlockB *newMonBlockB = GetBoxMonDataBlock(&newMon->box, mon->box.personality, DATA_BLOCK_B); + PokemonDataBlockC *newMonBlockC = GetBoxMonDataBlock(&newMon->box, mon->box.personality, DATA_BLOCK_C); + PokemonDataBlockD *newMonBlockD = GetBoxMonDataBlock(&newMon->box, mon->box.personality, DATA_BLOCK_D); + PokemonDataBlockA *monBlockA = GetBoxMonDataBlock(&mon->box, monPersonality, DATA_BLOCK_A); + PokemonDataBlockB *monBlockB = GetBoxMonDataBlock(&mon->box, monPersonality, DATA_BLOCK_B); + PokemonDataBlockC *monBlockC = GetBoxMonDataBlock(&mon->box, monPersonality, DATA_BLOCK_C); + PokemonDataBlockD *monBlockD = GetBoxMonDataBlock(&mon->box, monPersonality, DATA_BLOCK_D); DecryptMonData(&newMon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, newMon->box.checksum); DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); @@ -4309,23 +4315,23 @@ static u16 GetMonDataChecksum (void *data, u32 bytes) PokemonDataBlock *dataBlocks = boxMon->dataBlocks; \ switch (dataBlockID) \ { \ - case 0: \ + case DATA_BLOCK_A: \ result = &dataBlocks[v1]; \ break; \ - case 1: \ + case DATA_BLOCK_B: \ result = &dataBlocks[v2]; \ break; \ - case 2: \ + case DATA_BLOCK_C: \ result = &dataBlocks[v3]; \ break; \ - case 3: \ + case DATA_BLOCK_D: \ result = &dataBlocks[v4]; \ break; \ } \ break; \ } -static void *GetBoxMonDataBlock (BoxPokemon *boxMon, u32 personality, u8 dataBlockID) +static void *GetBoxMonDataBlock (BoxPokemon *boxMon, u32 personality, enum PokemonDataBlockID dataBlockID) { personality = (personality & 0x3e000) >> 13; GF_ASSERT(personality <= 31); @@ -4683,11 +4689,11 @@ void sub_02078B40 (Pokemon *mon, UnkStruct_02078B40 *param1) } BoxPokemon *boxMon = GetBoxMon(mon); - // TODO enum values? - PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, 0); - PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, 1); - PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, 2); - PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, 3); + + PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_A); + PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_B); + PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_C); + PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_D); param1->personality = boxMon->personality; param1->partyDecrypted = FALSE; @@ -4758,11 +4764,11 @@ void sub_02078E0C (UnkStruct_02078B40 *param0, Pokemon *mon) MI_CpuClearFast(mon, sizeof(Pokemon)); BoxPokemon *boxMon = GetBoxMon(mon); - // TODO enum values? - PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, param0->personality, 0); - PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, param0->personality, 1); - PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, param0->personality, 2); - PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, param0->personality, 3); + + PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, param0->personality, DATA_BLOCK_A); + PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, param0->personality, DATA_BLOCK_B); + PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, param0->personality, DATA_BLOCK_C); + PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, param0->personality, DATA_BLOCK_D); boxMon->personality = param0->personality; boxMon->partyDecrypted = FALSE; diff --git a/src/unk_0206CCB0.c b/src/unk_0206CCB0.c index 0bcdbdc908..027cc866ab 100644 --- a/src/unk_0206CCB0.c +++ b/src/unk_0206CCB0.c @@ -2714,7 +2714,7 @@ static int sub_0206ED14 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param if ((v0 % 2) == 0) { for (v1 = 0; v1 < 5; v1++) { - if (sub_02077648(v0, v1) == 1) { + if (GetMonPersonalityFlavorAffinity(v0, v1) == 1) { v5 = v1; break; } diff --git a/src/unk_0208C324.c b/src/unk_0208C324.c index 49891f8bd4..2f9ca2c119 100644 --- a/src/unk_0208C324.c +++ b/src/unk_0208C324.c @@ -1095,7 +1095,7 @@ static void sub_0208D200 (UnkStruct_0208D7BC * param0, Pokemon * param1, UnkStru param2->unk_4B = 5; for (v1 = 0; v1 < 5; v1++) { - if (sub_0207762C(param1, v1) == 1) { + if (GetMonFlavorAffinity(param1, v1) == 1) { param2->unk_4B = v1; break; } diff --git a/src/unk_02092494.c b/src/unk_02092494.c index 29c0dbc198..dc10f75fb4 100644 --- a/src/unk_02092494.c +++ b/src/unk_02092494.c @@ -609,7 +609,7 @@ static void sub_02092E10 (UnkStruct_02090800 * param0) v1 = 0; for (v0 = 0; v0 < 5; v0++) { - if (sub_0207762C(param0->unk_0C, v0) == 1) { + if (GetMonFlavorAffinity(param0->unk_0C, v0) == 1) { v1 = v0 + 1; } } From 39a3bb306a75e34899e5130046cd0c10438ac307 Mon Sep 17 00:00:00 2001 From: wildfire Date: Sun, 10 Sep 2023 17:51:19 +0100 Subject: [PATCH 08/11] Move structs into `pokemon.h` and `pokemon.c` --- include/overlay005/ov5_021E622C.h | 3 +- include/overlay006/ov6_02243258.h | 2 +- include/overlay006/ov6_02246184.h | 2 +- include/overlay006/ov6_02247100.h | 2 +- include/overlay006/ov6_022489E4.h | 2 +- include/overlay006/struct_ov6_02246254.h | 2 +- include/overlay012/struct_ov12_02236030.h | 2 +- include/overlay013/struct_ov13_02221ED0.h | 2 +- include/overlay016/ov16_0223DF00.h | 2 +- include/overlay016/ov16_0225177C.h | 2 +- include/overlay017/struct_ov17_022489C8.h | 2 +- include/overlay017/struct_ov17_0224E1F4.h | 2 +- include/overlay019/ov19_021D0D80.h | 2 +- include/overlay019/ov19_021DA270.h | 2 +- include/overlay019/struct_ov19_021D5594.h | 2 +- include/overlay021/struct_ov21_021E8E0C.h | 2 +- include/overlay022/ov22_022578F4.h | 2 +- include/overlay022/ov22_02259098.h | 2 +- include/overlay076/struct_ov76_0223DE00.h | 2 +- include/overlay079/struct_ov79_021D38D0.h | 2 +- include/overlay088/struct_ov88_0223C370.h | 2 +- include/overlay094/ov94_0223D0C4.h | 3 +- include/overlay094/ov94_0223FB48.h | 3 +- include/overlay094/struct_ov94_0223FD4C.h | 3 +- include/overlay095/ov95_02246C20.h | 2 +- include/overlay096/struct_ov96_0223BF40_t.h | 2 +- include/overlay104/ov104_0222DCE0.h | 2 +- include/overlay104/ov104_02231F74.h | 2 +- include/overlay104/ov104_0223B6F4.h | 2 +- include/overlay104/ov104_0223BCBC.h | 2 +- include/overlay104/struct_ov104_0223B5C0.h | 2 +- include/overlay105/ov105_02245CD0.h | 2 +- include/overlay106/ov106_02243310.h | 2 +- include/overlay106/ov106_022435FC.h | 2 +- include/overlay107/ov107_02249B1C.h | 2 +- include/overlay108/ov108_0224351C.h | 2 +- include/overlay119/ov119_021D0D80.h | 2 +- include/party.h | 2 +- include/pokemon.h | 176 +++++++++++++++++- include/struct_defs/box_pokemon.h | 107 ----------- include/struct_defs/party_pokemon.h | 25 --- include/struct_defs/pokemon.h | 15 -- include/struct_defs/pokemon_evolution_data.h | 10 - .../struct_defs/pokemon_evolution_method.h | 10 - include/struct_defs/pokemon_personal_data.h | 45 ----- include/struct_defs/struct_020298D8.h | 2 +- include/struct_defs/struct_0203DA00.h | 2 +- include/struct_defs/struct_0203E2FC.h | 2 +- include/struct_defs/struct_020711C8.h | 2 +- include/struct_defs/struct_0207AE68_t.h | 2 +- include/struct_defs/struct_02090800.h | 2 +- include/struct_defs/struct_02093800.h | 2 +- include/struct_defs/struct_02093BBC.h | 2 +- include/struct_defs/struct_02095C48.h | 2 +- include/struct_defs/struct_02095C48_sub1.h | 2 +- include/struct_defs/struct_02097F18.h | 2 +- include/struct_defs/struct_02098DE8.h | 2 +- include/struct_defs/struct_020997B8.h | 2 +- include/struct_defs/struct_party.h | 2 +- include/unk_0200B358.h | 2 +- include/unk_0200DA60.h | 2 +- include/unk_020261E4.h | 2 +- include/unk_0202631C.h | 2 +- include/unk_020298BC.h | 2 +- include/unk_0202DA40.h | 2 +- include/unk_0202EEC0.h | 3 +- include/unk_0202F180.h | 2 +- include/unk_0203D1B8.h | 2 +- include/unk_02051D8C.h | 2 +- include/unk_02054884.h | 2 +- include/unk_02056720.h | 2 +- include/unk_0206CCB0.h | 2 +- include/unk_0207064C.h | 2 +- include/unk_020797C8.h | 2 +- include/unk_02079D40.h | 3 +- include/unk_0207A2A8.h | 2 +- include/unk_0207AE68.h | 2 +- include/unk_020819DC.h | 2 +- include/unk_02084B70.h | 2 +- include/unk_0208C324.h | 2 +- include/unk_02092494.h | 3 +- include/unk_02094EDC.h | 2 +- include/unk_02096420.h | 2 +- include/unk_02097624.h | 2 +- include/unk_02097B18.h | 2 +- include/unk_020989DC.h | 2 +- include/unk_020997B8.h | 2 +- src/enc_effects.c | 2 +- src/overlay005/ov5_021D1C30.c | 2 +- src/overlay005/ov5_021DDBE8.c | 2 +- src/overlay005/ov5_021DFB54.c | 2 +- src/overlay005/ov5_021E622C.c | 3 +- src/overlay005/ov5_021EE7D4.c | 2 +- src/overlay005/ov5_021F08CC.c | 2 +- src/overlay005/ov5_021F6454.c | 2 +- src/overlay005/ov5_021F77A8.c | 2 +- src/overlay006/ov6_02240C9C.c | 2 +- src/overlay006/ov6_02243258.c | 2 +- src/overlay006/ov6_02246034.c | 2 +- src/overlay006/ov6_02246184.c | 2 +- src/overlay006/ov6_02247100.c | 2 +- src/overlay006/ov6_022489E4.c | 2 +- src/overlay010/ov10_0221F800.c | 2 +- src/overlay013/ov13_02221A88.c | 2 +- src/overlay013/ov13_022264F4.c | 2 +- src/overlay014/ov14_0221FC20.c | 2 +- src/overlay016/battle_controller.c | 2 +- src/overlay016/ov16_0223B140.c | 2 +- src/overlay016/ov16_0223DF00.c | 2 +- src/overlay016/ov16_022405FC.c | 3 +- src/overlay016/ov16_0225177C.c | 2 +- src/overlay016/ov16_0225BFFC.c | 2 +- src/overlay016/ov16_0225CBB8.c | 2 +- src/overlay016/ov16_0226485C.c | 2 +- src/overlay016/ov16_02266F1C.c | 3 +- src/overlay016/ov16_0226871C.c | 3 +- src/overlay019/ov19_021D0D80.c | 4 +- src/overlay019/ov19_021D79F8.c | 2 +- src/overlay019/ov19_021DA270.c | 2 +- src/overlay019/ov19_021DB8E4.c | 2 +- src/overlay019/ov19_021DC5F0.c | 3 +- src/overlay019/ov19_021DEC04.c | 2 +- src/overlay021/ov21_021E8D48.c | 2 +- src/overlay022/ov22_02255D44.c | 2 +- src/overlay022/ov22_022578F4.c | 2 +- src/overlay022/ov22_02259098.c | 2 +- src/overlay022/ov22_0225AF8C.c | 2 +- src/overlay022/ov22_0225B660.c | 3 +- src/overlay032/ov32_022561C0.c | 3 +- src/overlay033/ov33_022561C0.c | 3 +- src/overlay040/ov40_022561C0.c | 2 +- src/overlay044/ov44_022561C0.c | 3 +- src/overlay062/ov62_02239D60.c | 1 - src/overlay062/ov62_02248408.c | 2 +- src/overlay065/ov65_0222DCE0.c | 2 +- src/overlay066/ov66_0222DDF0.c | 2 +- src/overlay076/ov76_0223B870.c | 2 +- src/overlay076/ov76_0223D338.c | 2 +- src/overlay081/ov81_021D1610.c | 2 +- src/overlay086/ov86_0223B140.c | 2 +- src/overlay087/ov87_021D106C.c | 2 +- src/overlay088/ov88_0223B140.c | 2 +- src/overlay094/ov94_0223D0C4.c | 3 +- src/overlay094/ov94_0223DC04.c | 2 +- src/overlay094/ov94_0223FB48.c | 3 +- src/overlay094/ov94_022414B8.c | 3 +- src/overlay094/ov94_02242AD0.c | 2 +- src/overlay094/ov94_022444C8.c | 3 +- src/overlay095/ov95_02246C20.c | 2 +- src/overlay095/ov95_02247B6C.c | 2 +- src/overlay095/ov95_0224B3D8.c | 2 +- src/overlay097/ov97_0222D30C.c | 2 +- src/overlay097/ov97_02233B18.c | 3 +- src/overlay097/ov97_02236380.c | 2 +- src/overlay097/ov97_02237694.c | 2 +- src/overlay104/ov104_0222DCE0.c | 2 +- src/overlay104/ov104_0222ECE8.c | 2 +- src/overlay104/ov104_0222FBE4.c | 2 +- src/overlay104/ov104_02231F74.c | 2 +- src/overlay104/ov104_022332B4.c | 2 +- src/overlay104/ov104_022339B4.c | 2 +- src/overlay104/ov104_02234838.c | 2 +- src/overlay104/ov104_02234DB4.c | 2 +- src/overlay104/ov104_022358E8.c | 2 +- src/overlay104/ov104_022361B4.c | 2 +- src/overlay104/ov104_02237378.c | 2 +- src/overlay104/ov104_02237DD8.c | 2 +- src/overlay104/ov104_02239130.c | 2 +- src/overlay104/ov104_0223A0C4.c | 2 +- src/overlay104/ov104_0223A7F4.c | 2 +- src/overlay104/ov104_0223AF58.c | 2 +- src/overlay104/ov104_0223B6F4.c | 2 +- src/overlay104/ov104_0223BCBC.c | 2 +- src/overlay105/ov105_02241AE0.c | 3 +- src/overlay105/ov105_02245CD0.c | 2 +- src/overlay106/ov106_02241AE0.c | 2 +- src/overlay106/ov106_02243310.c | 2 +- src/overlay106/ov106_022435FC.c | 2 +- src/overlay107/ov107_02241AE0.c | 3 +- src/overlay107/ov107_02245EB0.c | 3 +- src/overlay107/ov107_02249604.c | 2 +- src/overlay107/ov107_02249B1C.c | 2 +- src/overlay108/ov108_02241AE0.c | 2 +- src/overlay108/ov108_02243030.c | 2 +- src/overlay108/ov108_0224351C.c | 2 +- src/overlay109/ov109_021D0D80.c | 2 +- src/overlay113/ov113_0225C700.c | 2 +- src/overlay118/ov118_021D0D80.c | 2 +- src/overlay119/ov119_021D0D80.c | 3 +- src/party.c | 2 +- src/pokemon.c | 16 +- src/roaming_pokemon.c | 2 +- src/unk_0200B358.c | 2 +- src/unk_0200DA60.c | 2 +- src/unk_020261E4.c | 2 +- src/unk_0202631C.c | 2 +- src/unk_02028124.c | 2 +- src/unk_020298BC.c | 2 +- src/unk_0202DA40.c | 2 +- src/unk_0202DF8C.c | 2 +- src/unk_0202EEC0.c | 3 +- src/unk_0202F180.c | 3 +- src/unk_0202F1D4.c | 2 +- src/unk_0203A9C8.c | 2 +- src/unk_0203D1B8.c | 2 +- src/unk_0203F6C4.c | 3 +- src/unk_02046C7C.c | 2 +- src/unk_020474B8.c | 3 +- src/unk_020480A8.c | 3 +- src/unk_02048DD8.c | 2 +- src/unk_02049D08.c | 2 +- src/unk_0204AEE8.c | 2 +- src/unk_0204B830.c | 2 +- src/unk_0204C500.c | 2 +- src/unk_0204CFFC.c | 2 +- src/unk_0204EDA4.c | 2 +- src/unk_0204F13C.c | 2 +- src/unk_02050A74.c | 2 +- src/unk_02051D8C.c | 2 +- src/unk_02054884.c | 2 +- src/unk_020562F8.c | 2 +- src/unk_02056720.c | 2 +- src/unk_0205A0D8.c | 2 +- src/unk_0205DFC4.c | 2 +- src/unk_0206C660.c | 2 +- src/unk_0206CCB0.c | 3 +- src/unk_0207064C.c | 2 +- src/unk_020722AC.c | 2 +- src/unk_02079170.c | 2 +- src/unk_020797C8.c | 2 - src/unk_02079D40.c | 3 +- src/unk_0207A2A8.c | 2 +- src/unk_0207AE68.c | 2 +- src/unk_0207E0B8.c | 2 +- src/unk_020819DC.c | 2 +- src/unk_02082C2C.c | 2 +- src/unk_02083370.c | 2 +- src/unk_02084B70.c | 2 +- src/unk_0208694C.c | 2 +- src/unk_0208C324.c | 3 +- src/unk_0208FCF8.c | 2 +- src/unk_02092494.c | 3 +- src/unk_020933F8.c | 3 +- src/unk_02094EDC.c | 4 +- src/unk_02096420.c | 2 +- src/unk_02097624.c | 2 +- src/unk_02097B18.c | 2 +- src/unk_02098218.c | 2 +- src/unk_020989DC.c | 2 +- src/unk_020997B8.c | 2 +- src/unk_0209BA80.c | 2 +- 251 files changed, 427 insertions(+), 501 deletions(-) delete mode 100644 include/struct_defs/box_pokemon.h delete mode 100644 include/struct_defs/party_pokemon.h delete mode 100644 include/struct_defs/pokemon.h delete mode 100644 include/struct_defs/pokemon_evolution_data.h delete mode 100644 include/struct_defs/pokemon_evolution_method.h delete mode 100644 include/struct_defs/pokemon_personal_data.h diff --git a/include/overlay005/ov5_021E622C.h b/include/overlay005/ov5_021E622C.h index a8dfc82d16..e6ea3748cd 100644 --- a/include/overlay005/ov5_021E622C.h +++ b/include/overlay005/ov5_021E622C.h @@ -6,8 +6,7 @@ #include "struct_decls/struct_02026218_decl.h" #include "struct_decls/struct_02026310_decl.h" #include "struct_decls/struct_0203CDB0_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/include/overlay006/ov6_02243258.h b/include/overlay006/ov6_02243258.h index 9f997e6f03..4e3536130a 100644 --- a/include/overlay006/ov6_02243258.h +++ b/include/overlay006/ov6_02243258.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_0203CDB0_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" UnkStruct_0201CD38 * ov6_02243F88(UnkStruct_0203CDB0 * param0, u32 param1, Pokemon * param2, int param3); int ov6_02243FBC(UnkStruct_0201CD38 * param0); diff --git a/include/overlay006/ov6_02246184.h b/include/overlay006/ov6_02246184.h index 9a5e704a3f..6892e250ef 100644 --- a/include/overlay006/ov6_02246184.h +++ b/include/overlay006/ov6_02246184.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_OV6_02246184_H #include "struct_decls/struct_0203CDB0_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay006/struct_ov6_02246204_decl.h" #include "overlay006/struct_ov6_02246254.h" diff --git a/include/overlay006/ov6_02247100.h b/include/overlay006/ov6_02247100.h index 632b5e211f..bb98b8cb07 100644 --- a/include/overlay006/ov6_02247100.h +++ b/include/overlay006/ov6_02247100.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_0203CDB0_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" void * ov6_02247100(UnkStruct_0203CDB0 * param0, u32 param1); BOOL ov6_02247120(UnkStruct_020508D4 * param0); diff --git a/include/overlay006/ov6_022489E4.h b/include/overlay006/ov6_022489E4.h index 4f208da876..d1310b85d7 100644 --- a/include/overlay006/ov6_022489E4.h +++ b/include/overlay006/ov6_022489E4.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_OV6_022489E4_H #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_020954F0.h" #include "struct_defs/struct_02095C48.h" #include "overlay006/struct_ov6_02248BE8.h" diff --git a/include/overlay006/struct_ov6_02246254.h b/include/overlay006/struct_ov6_02246254.h index a2e0b235f1..0af49f85a9 100644 --- a/include/overlay006/struct_ov6_02246254.h +++ b/include/overlay006/struct_ov6_02246254.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_defs/struct_020279FC.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" typedef struct { const BoxPokemon * unk_00; diff --git a/include/overlay012/struct_ov12_02236030.h b/include/overlay012/struct_ov12_02236030.h index d72258f720..0228b1a1d2 100644 --- a/include/overlay012/struct_ov12_02236030.h +++ b/include/overlay012/struct_ov12_02236030.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_STRUCT_OV12_02236030_H #define POKEPLATINUM_STRUCT_OV12_02236030_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" typedef struct { int unk_00; diff --git a/include/overlay013/struct_ov13_02221ED0.h b/include/overlay013/struct_ov13_02221ED0.h index d4ba54c6d1..f15999867d 100644 --- a/include/overlay013/struct_ov13_02221ED0.h +++ b/include/overlay013/struct_ov13_02221ED0.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_STRUCT_OV13_02221ED0_H #define POKEPLATINUM_STRUCT_OV13_02221ED0_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay013/struct_ov13_022236B8.h" typedef struct { diff --git a/include/overlay016/ov16_0223DF00.h b/include/overlay016/ov16_0223DF00.h index 8d21fb376c..0799f8aaa7 100644 --- a/include/overlay016/ov16_0223DF00.h +++ b/include/overlay016/ov16_0223DF00.h @@ -17,7 +17,7 @@ #include "struct_defs/struct_020279FC.h" #include "struct_decls/struct_0202CC84_decl.h" #include "struct_defs/struct_0205AA50.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/trainer_data.h" diff --git a/include/overlay016/ov16_0225177C.h b/include/overlay016/ov16_0225177C.h index c224321e6a..49eb22192c 100644 --- a/include/overlay016/ov16_0225177C.h +++ b/include/overlay016/ov16_0225177C.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_OV16_0225177C_H #define POKEPLATINUM_OV16_0225177C_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/battle_system.h" #include "battle/battle_context.h" #include "battle/battle_mon.h" diff --git a/include/overlay017/struct_ov17_022489C8.h b/include/overlay017/struct_ov17_022489C8.h index 7a5ae1353a..b7cb31cb11 100644 --- a/include/overlay017/struct_ov17_022489C8.h +++ b/include/overlay017/struct_ov17_022489C8.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_STRUCT_OV17_022489C8_H #define POKEPLATINUM_STRUCT_OV17_022489C8_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay012/struct_ov12_02235FE0_decl.h" #include "overlay012/struct_ov12_02236030.h" diff --git a/include/overlay017/struct_ov17_0224E1F4.h b/include/overlay017/struct_ov17_0224E1F4.h index 99ed41d0d5..8a2903526a 100644 --- a/include/overlay017/struct_ov17_0224E1F4.h +++ b/include/overlay017/struct_ov17_0224E1F4.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_STRUCT_OV17_0224E1F4_H #include "struct_decls/struct_02007C7C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay017/struct_ov17_0224B09C.h" typedef struct { diff --git a/include/overlay019/ov19_021D0D80.h b/include/overlay019/ov19_021D0D80.h index 6b77b0b92b..6352cc9e37 100644 --- a/include/overlay019/ov19_021D0D80.h +++ b/include/overlay019/ov19_021D0D80.h @@ -4,7 +4,7 @@ #include "struct_decls/struct_020067E8_decl.h" #include "message.h" #include "struct_decls/struct_0200B358_decl.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "overlay019/struct_ov19_021D4DF0.h" #include "overlay019/struct_ov19_021D4F5C.h" diff --git a/include/overlay019/ov19_021DA270.h b/include/overlay019/ov19_021DA270.h index 3b13d65c31..e07a358916 100644 --- a/include/overlay019/ov19_021DA270.h +++ b/include/overlay019/ov19_021DA270.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_020218BC_decl.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay019/struct_ov19_021D4DF0.h" #include "overlay019/struct_ov19_021D61B0_decl.h" #include "overlay019/struct_ov19_021DA384.h" diff --git a/include/overlay019/struct_ov19_021D5594.h b/include/overlay019/struct_ov19_021D5594.h index 502ca92e9d..273cf227d1 100644 --- a/include/overlay019/struct_ov19_021D5594.h +++ b/include/overlay019/struct_ov19_021D5594.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_STRUCT_OV19_021D5594_H #define POKEPLATINUM_STRUCT_OV19_021D5594_H -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" typedef struct { BoxPokemon * unk_00; diff --git a/include/overlay021/struct_ov21_021E8E0C.h b/include/overlay021/struct_ov21_021E8E0C.h index c6c3d3e91a..a0283a07fd 100644 --- a/include/overlay021/struct_ov21_021E8E0C.h +++ b/include/overlay021/struct_ov21_021E8E0C.h @@ -4,7 +4,7 @@ #include "struct_decls/struct_02002F38_decl.h" #include "struct_decls/struct_02007768_decl.h" #include "struct_decls/struct_02018340_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" typedef struct { UnkStruct_02018340 * unk_00; diff --git a/include/overlay022/ov22_022578F4.h b/include/overlay022/ov22_022578F4.h index 7badcd2260..ef881e13d6 100644 --- a/include/overlay022/ov22_022578F4.h +++ b/include/overlay022/ov22_022578F4.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_OV22_022578F4_H #include "struct_defs/struct_02008A90.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay022/struct_ov22_02257964.h" #include "overlay022/struct_ov22_02259560.h" #include "overlay022/struct_ov22_0225B388.h" diff --git a/include/overlay022/ov22_02259098.h b/include/overlay022/ov22_02259098.h index 8ff74b4b22..504e9e1ef0 100644 --- a/include/overlay022/ov22_02259098.h +++ b/include/overlay022/ov22_02259098.h @@ -4,7 +4,7 @@ #include "struct_decls/struct_02007768_decl.h" #include "struct_defs/struct_02008A90.h" #include "struct_defs/struct_020298D8.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay022/struct_ov22_022596B0.h" #include "overlay022/struct_ov22_0225A0E4.h" diff --git a/include/overlay076/struct_ov76_0223DE00.h b/include/overlay076/struct_ov76_0223DE00.h index 69c6e520a1..b33a17c826 100644 --- a/include/overlay076/struct_ov76_0223DE00.h +++ b/include/overlay076/struct_ov76_0223DE00.h @@ -5,7 +5,7 @@ #include "struct_decls/struct_0200D0F4_decl.h" #include "struct_defs/struct_0202CA28.h" #include "struct_decls/struct_0202CA88_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02097F18.h" #include "overlay076/struct_ov76_0223B52C.h" #include "overlay076/struct_ov76_0223BBAC.h" diff --git a/include/overlay079/struct_ov79_021D38D0.h b/include/overlay079/struct_ov79_021D38D0.h index 08ca59b6f4..4b6834d0e6 100644 --- a/include/overlay079/struct_ov79_021D38D0.h +++ b/include/overlay079/struct_ov79_021D38D0.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_STRUCT_OV79_021D38D0_H #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" typedef struct { Pokemon * unk_00; diff --git a/include/overlay088/struct_ov88_0223C370.h b/include/overlay088/struct_ov88_0223C370.h index 6824883cce..d017504364 100644 --- a/include/overlay088/struct_ov88_0223C370.h +++ b/include/overlay088/struct_ov88_0223C370.h @@ -9,7 +9,7 @@ #include "struct_decls/struct_0202C878_decl.h" #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_0203CDB0_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/include/overlay094/ov94_0223D0C4.h b/include/overlay094/ov94_0223D0C4.h index e1925b0f70..a310a84074 100644 --- a/include/overlay094/ov94_0223D0C4.h +++ b/include/overlay094/ov94_0223D0C4.h @@ -4,8 +4,7 @@ #include "message.h" #include "struct_decls/struct_0200B358_decl.h" #include "struct_defs/struct_0205AA50.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay094/struct_ov94_0223BA88_sub2.h" #include "overlay094/struct_ov94_0223FD4C_decl.h" diff --git a/include/overlay094/ov94_0223FB48.h b/include/overlay094/ov94_0223FB48.h index c0a8a2cc3e..d87ab77ce8 100644 --- a/include/overlay094/ov94_0223FB48.h +++ b/include/overlay094/ov94_0223FB48.h @@ -1,8 +1,7 @@ #ifndef POKEPLATINUM_OV94_0223FB48_H #define POKEPLATINUM_OV94_0223FB48_H -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_party_decl.h" #include "overlay094/struct_ov94_0223FD4C_decl.h" diff --git a/include/overlay094/struct_ov94_0223FD4C.h b/include/overlay094/struct_ov94_0223FD4C.h index e3975a1c18..7eb1a338d5 100644 --- a/include/overlay094/struct_ov94_0223FD4C.h +++ b/include/overlay094/struct_ov94_0223FD4C.h @@ -19,8 +19,7 @@ #include "struct_decls/struct_0202B370_decl.h" #include "struct_defs/struct_0203E0FC.h" #include "struct_defs/struct_0205AA50.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_0207AE68_decl.h" #include "struct_defs/struct_02098D38.h" #include "overlay006/struct_ov6_02246254.h" diff --git a/include/overlay095/ov95_02246C20.h b/include/overlay095/ov95_02246C20.h index 2813450781..e0613b2b0e 100644 --- a/include/overlay095/ov95_02246C20.h +++ b/include/overlay095/ov95_02246C20.h @@ -6,7 +6,7 @@ #include "struct_decls/struct_0200B358_decl.h" #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay019/struct_ov19_021DA864.h" #include "overlay095/struct_ov95_02247004_decl.h" #include "overlay095/struct_ov95_022472C4_decl.h" diff --git a/include/overlay096/struct_ov96_0223BF40_t.h b/include/overlay096/struct_ov96_0223BF40_t.h index db86d0c439..ab9a6b8246 100644 --- a/include/overlay096/struct_ov96_0223BF40_t.h +++ b/include/overlay096/struct_ov96_0223BF40_t.h @@ -13,7 +13,7 @@ #include "strbuf.h" #include "struct_defs/struct_0205AA50.h" #include "struct_defs/struct_0206BC70.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay019/struct_ov19_021DA864.h" #include "overlay061/struct_ov61_0222C3B0.h" #include "overlay096/struct_ov96_0223B450.h" diff --git a/include/overlay104/ov104_0222DCE0.h b/include/overlay104/ov104_0222DCE0.h index 9b57d5a864..49ba5631a8 100644 --- a/include/overlay104/ov104_0222DCE0.h +++ b/include/overlay104/ov104_0222DCE0.h @@ -6,7 +6,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_defs/struct_0204B184.h" #include "struct_defs/struct_0204B1E8.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay006/battle_params.h" diff --git a/include/overlay104/ov104_02231F74.h b/include/overlay104/ov104_02231F74.h index 47a4e63d06..f63eaa669f 100644 --- a/include/overlay104/ov104_02231F74.h +++ b/include/overlay104/ov104_02231F74.h @@ -5,7 +5,7 @@ #include "struct_decls/struct_0200B358_decl.h" #include "struct_decls/struct_0200D0F4_decl.h" #include "struct_decls/struct_0201CD38_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay063/struct_ov63_0222BEC0_decl.h" #include "overlay063/struct_ov63_0222CCB8.h" #include "overlay104/struct_ov104_0222E930_decl.h" diff --git a/include/overlay104/ov104_0223B6F4.h b/include/overlay104/ov104_0223B6F4.h index c2479039f1..e6264d5d94 100644 --- a/include/overlay104/ov104_0223B6F4.h +++ b/include/overlay104/ov104_0223B6F4.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0203068C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay006/battle_params.h" #include "overlay104/struct_ov104_02230BE4.h" diff --git a/include/overlay104/ov104_0223BCBC.h b/include/overlay104/ov104_0223BCBC.h index 8940803f1a..759c8beb34 100644 --- a/include/overlay104/ov104_0223BCBC.h +++ b/include/overlay104/ov104_0223BCBC.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_OV104_0223BCBC_H #define POKEPLATINUM_OV104_0223BCBC_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay006/battle_params.h" #include "overlay104/struct_ov104_02230BE4.h" diff --git a/include/overlay104/struct_ov104_0223B5C0.h b/include/overlay104/struct_ov104_0223B5C0.h index aacc35676d..5166a16fc8 100644 --- a/include/overlay104/struct_ov104_0223B5C0.h +++ b/include/overlay104/struct_ov104_0223B5C0.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_STRUCT_OV104_0223B5C0_H #include "struct_decls/struct_02030114_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay104/struct_ov104_0223A348.h" diff --git a/include/overlay105/ov105_02245CD0.h b/include/overlay105/ov105_02245CD0.h index bd40c01ee7..0697c4ac72 100644 --- a/include/overlay105/ov105_02245CD0.h +++ b/include/overlay105/ov105_02245CD0.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_02007768_decl.h" #include "struct_decls/struct_02007C7C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" void ov105_02245CD0(void); void ov105_02245D50(UnkStruct_02007768 * param0); diff --git a/include/overlay106/ov106_02243310.h b/include/overlay106/ov106_02243310.h index 1ced5bd9b2..ca4ed60edf 100644 --- a/include/overlay106/ov106_02243310.h +++ b/include/overlay106/ov106_02243310.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_OV106_02243310_H #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay106/struct_ov106_02243310.h" void ov106_02243310(UnkStruct_ov106_02243310 * param0, Pokemon * param1); diff --git a/include/overlay106/ov106_022435FC.h b/include/overlay106/ov106_022435FC.h index 0b078dc681..d26645329b 100644 --- a/include/overlay106/ov106_022435FC.h +++ b/include/overlay106/ov106_022435FC.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_OV106_022435FC_H #define POKEPLATINUM_OV106_022435FC_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay106/struct_ov106_02243310.h" #include "overlay106/struct_ov106_02243650_decl.h" diff --git a/include/overlay107/ov107_02249B1C.h b/include/overlay107/ov107_02249B1C.h index 0f716f9ea4..b8bc850dd9 100644 --- a/include/overlay107/ov107_02249B1C.h +++ b/include/overlay107/ov107_02249B1C.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_OV107_02249B1C_H #define POKEPLATINUM_OV107_02249B1C_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay107/struct_ov107_02249954.h" #include "overlay107/struct_ov107_02249B8C_decl.h" diff --git a/include/overlay108/ov108_0224351C.h b/include/overlay108/ov108_0224351C.h index c93452bd4a..33485c9f88 100644 --- a/include/overlay108/ov108_0224351C.h +++ b/include/overlay108/ov108_0224351C.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_OV108_0224351C_H #define POKEPLATINUM_OV108_0224351C_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay108/struct_ov108_02243030.h" #include "overlay108/struct_ov108_02243594_decl.h" diff --git a/include/overlay119/ov119_021D0D80.h b/include/overlay119/ov119_021D0D80.h index 3be5b69783..17468c0b78 100644 --- a/include/overlay119/ov119_021D0D80.h +++ b/include/overlay119/ov119_021D0D80.h @@ -5,7 +5,7 @@ #include "struct_decls/struct_02014014_decl.h" #include "struct_decls/struct_02018340_decl.h" #include "struct_defs/struct_0205AA50.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0207C690.h" #include "overlay119/struct_ov119_021D0FD0.h" #include "overlay119/struct_ov119_021D14DC.h" diff --git a/include/party.h b/include/party.h index 0c8ce86b67..82d9cfe140 100644 --- a/include/party.h +++ b/include/party.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_UNK_02079FEC_H #define POKEPLATINUM_UNK_02079FEC_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/include/pokemon.h b/include/pokemon.h index 3d0e365a21..5072ed123e 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -12,15 +12,185 @@ #include "struct_decls/struct_02015F84_decl.h" #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0202CC84_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" -#include "struct_defs/pokemon_personal_data.h" #include "struct_decls/struct_02078B40_decl.h" #include "struct_decls/struct_party_decl.h" #include "overlay005/struct_ov5_021DE5D0.h" #include +/** + * @brief Pokemon Personal data structure. This contains data that is the same across all pokemon of the same species/form + */ +typedef struct PokemonPersonalData { + u8 baseHp; //!< The pokemons base HP stat + u8 baseAtk; //!< The pokemons base Attack stat + u8 baseDef; //!< The pokemons base Defense stat + u8 baseSpeed; //!< The pokemons base Speed stat + u8 baseSpAtk; //!< The pokemons base Special Attack stat + u8 baseSpDef; //!< The pokemons base Special Defense stat + u8 type1; //!< The pokemons first type + u8 type2; //!< The pokemons second type + u8 catchRate; //!< The pokemons catch rate + u8 baseExp; //!< A factor in determining experience yield when defeating this pokemon + u16 evHpYield : 2; //!< How many HP EVs will be gained when defeating this pokemon + u16 evAtkYield : 2; //!< How many Attack EVs will be gained when defeating this pokemon + u16 evDefYield : 2; //!< How many Defense EVs will be gained when defeating this pokemon + u16 evSpeedYield : 2; //!< How many Speed EVs will be gained when defeating this pokemon + u16 evSpAtkYield : 2; //!< How many Special Attack EVs will be gained when defeating this pokemon + u16 evSpDefYield : 2; //!< How many Special Defense EVs will be gained when defeating this pokemon + u16 padding : 4; + + u16 item1; //!< Common held item when this pokemon is encountered in the wild + u16 item2; //!< Rare held item when this pokemon is encountered in the wild + u8 gender; //!< The pokemons gender ratio, except for special values, a higher value will result in more females and a lower value will result in more males appearing + u8 hatchCycles; //!< How long eggs of this pokemon will take to hatch. In Gen.IV One cycle is 255 steps + u8 baseFriendship; //!< The pokemons base Friendship stat + u8 expRate; //!< The experience rate category of the pokemon. This sets which formula is used to determine the pokemons level based on its experience + u8 eggGroup1; //!< The pokemons first egg group + u8 eggGroup2; //!< The pokemons second egg group + u8 ability1; //!< The pokemons first possible ability + u8 ability2; //!< The pokemons second possible ability + u8 greatMarshFleeRate; //!< The pokemons base flee rate in the Great Marsh safari zone + u8 color : 7; //!< The pokemons color category + u8 inverse : 1; + u32 tmLearnsetMask1; //!< Bitflags for whether this pokemon can learn a TM (TM1 -> TM32) + u32 tmLearnsetMask2; //!< Bitflags for whether this pokemon can learn a TM (TM33 -> TM64) + u32 tmLearnsetMask3; //!< Bitflags for whether this pokemon can learn a TM (TM65 -> TM92, HM1 -> HM4) + u32 tmLearnsetMask4; //!< Bitflags for whether this pokemon can learn a TM (HM5 -> HM8, rest unused) +} PokemonPersonalData; + +/** + * @brief Block A of the BoxPokemon data structure + */ +typedef struct PokemonDataBlockA { + u16 species; //!< The pokemons species + u16 heldItem; //!< The pokemons currently held item + u32 otID; //!< The pokemons Original Trainer ID + u32 exp; //!< The pokemons experience points + u8 friendship; //!< The pokemons friendship stat + u8 ability; //!< The pokemons ability + u8 unk_0E; + u8 originLanguage; //!< The language of the game this pokemon was caught in + u8 hpEV; //!< The pokemons HP EVs + u8 atkEV; //!< The pokemons Attack EVs + u8 defEV; //!< The pokemons Defense EVs + u8 speedEV; //!< The pokemons Speed EVs + u8 spAtkEV; //!< The pokemons Special Attack EVs + u8 spDefEV; //!< The pokemons Special Defense EVs + u8 cool; //!< The pokemons Cool contest stat + u8 beauty; //!< The pokemons Beauty contest stat + u8 cute; //!< The pokemons Cute contest stat + u8 smart; //!< The pokemons Smart contest stat + u8 tough; //!< The pokemons Tough contest stat + u8 sheen; //!< The pokemons Sheen + u32 unk_1C; +} PokemonDataBlockA; + +/** + * @brief Block B of the BoxPokemon data structure + */ +typedef struct PokemonDataBlockB { + u16 moves[4]; //!< The ID of each move the pokemon knows + u8 moveCurrentPPs[4]; //!< The current PP of each move + u8 movePPUps[4]; //!< The number of PP Ups used on each move + u32 hpIV : 5; //!< The pokemons HP IVs + u32 atkIV : 5; //!< The pokemons Attack IVs + u32 defIV : 5; //!< The pokemons Defense IVs + u32 speedIV : 5; //!< The pokemons Speed IVs + u32 spAtkIV : 5; //!< The pokemons Special Attack IVs + u32 spDefIV : 5; //!< The pokemons Special Defense IVs + u32 isEgg : 1; //!< Whether this pokemon is an egg or not + u32 unk_10_31 : 1; + u32 unk_14; + u8 fatefulEncounter:1; //!< The pokemons "Fateful Encounter" flag + u8 gender : 2; //!< The pokemons gender + u8 form:5; //!< The pokemons form + u8 unk_19; + u16 unk_1A; + u16 unk_1C; + u16 unk_1E; +} PokemonDataBlockB; + +/** + * @brief Block C of the BoxPokemon data structure + */ +typedef struct PokemonDataBlockC { + u16 unk_00[11]; + u8 unk_16; + u8 originGame; //!< The game this pokemon was caught in + u64 unk_18; +} PokemonDataBlockC; + +/** + * @brief Block D of the BoxPokemon data structure + */ +typedef struct PokemonDataBlockD { + u16 unk_00[8]; + u8 unk_10; + u8 unk_11; + u8 unk_12; + u8 unk_13; + u8 unk_14; + u8 unk_15; + u16 unk_16; + u16 unk_18; + u8 pokerus; //!< The pokemons Pokerus value + u8 pokeball; //!< What pokeball this pokemon was caught in + u8 metLevel : 7; //!< What level this pokemon was originally met at + u8 otGender : 1; //!< The gender of this pokemons Original Trainer + u8 unk_1D; + u16 unk_1E; +} PokemonDataBlockD; + +typedef union { + PokemonDataBlockA blockA; + PokemonDataBlockB blockB; + PokemonDataBlockC blockC; + PokemonDataBlockD blockD; +} PokemonDataBlock; + +/** + * @brief Boxed Pokemon data structure + */ +typedef struct BoxPokemon { + u32 personality; //!< The personality value of the pokemon + u16 partyDecrypted : 1; //!< Whether the pokemons party data is currently decrypted + u16 boxDecrypted : 1; //!< Whether the pokemons boxed data is currently decrypted + u16 invalidData : 1; //!< Set if the pokemons data is invalid (failed checksum). This will make the mon appear as a Bad Egg in game + u16 unk_04_3 : 13; + u16 checksum; //!< Checksum for the pokemons data + PokemonDataBlock dataBlocks[4]; //!< Data blocks containing the pokemons boxed data, stored encrypted +} BoxPokemon; + +#include "struct_defs/struct_0202818C.h" +#include "struct_defs/struct_0202CA28.h" + +/** + * @brief Party Pokemon data structure + */ +typedef struct PartyPokemon { + u32 unk_00; + u8 level; //!< The pokemons level + u8 unk_05; + u16 unk_06; + u16 unk_08; + u16 unk_0A; + u16 unk_0C; + u16 unk_0E; + u16 unk_10; + u16 unk_12; + UnkStruct_0202818C unk_14; + UnkStruct_0202CA28 unk_4C; +} PartyPokemon; + +/** + * @brief The main Pokemon data structure + */ +typedef struct Pokemon { + BoxPokemon box; //!< Contains the pokemons boxed data + PartyPokemon party; //!< Contains the pokemons extra data while it is in the players party +} Pokemon; + /** * @brief Zeros out a Pokemon data structure, then encrypts the result * diff --git a/include/struct_defs/box_pokemon.h b/include/struct_defs/box_pokemon.h deleted file mode 100644 index 4c57fe604c..0000000000 --- a/include/struct_defs/box_pokemon.h +++ /dev/null @@ -1,107 +0,0 @@ -#ifndef POKEPLATINUM_BOX_POKEMON_H -#define POKEPLATINUM_BOX_POKEMON_H - -/** - * @brief Block A of the BoxPokemon data structure - */ -typedef struct PokemonDataBlockA { - u16 species; //!< The pokemons species - u16 heldItem; //!< The pokemons currently held item - u32 otID; //!< The pokemons Original Trainer ID - u32 exp; //!< The pokemons experience points - u8 friendship; //!< The pokemons friendship stat - u8 ability; //!< The pokemons ability - u8 unk_0E; - u8 originLanguage; //!< The language of the game this pokemon was caught in - u8 hpEV; //!< The pokemons HP EVs - u8 atkEV; //!< The pokemons Attack EVs - u8 defEV; //!< The pokemons Defense EVs - u8 speedEV; //!< The pokemons Speed EVs - u8 spAtkEV; //!< The pokemons Special Attack EVs - u8 spDefEV; //!< The pokemons Special Defense EVs - u8 cool; //!< The pokemons Cool contest stat - u8 beauty; //!< The pokemons Beauty contest stat - u8 cute; //!< The pokemons Cute contest stat - u8 smart; //!< The pokemons Smart contest stat - u8 tough; //!< The pokemons Tough contest stat - u8 sheen; //!< The pokemons Sheen - u32 unk_1C; -} PokemonDataBlockA; - -/** - * @brief Block B of the BoxPokemon data structure - */ -typedef struct PokemonDataBlockB { - u16 moves[4]; //!< The ID of each move the pokemon knows - u8 moveCurrentPPs[4]; //!< The current PP of each move - u8 movePPUps[4]; //!< The number of PP Ups used on each move - u32 hpIV : 5; //!< The pokemons HP IVs - u32 atkIV : 5; //!< The pokemons Attack IVs - u32 defIV : 5; //!< The pokemons Defense IVs - u32 speedIV : 5; //!< The pokemons Speed IVs - u32 spAtkIV : 5; //!< The pokemons Special Attack IVs - u32 spDefIV : 5; //!< The pokemons Special Defense IVs - u32 isEgg : 1; //!< Whether this pokemon is an egg or not - u32 unk_10_31 : 1; - u32 unk_14; - u8 fatefulEncounter:1; //!< The pokemons "Fateful Encounter" flag - u8 gender : 2; //!< The pokemons gender - u8 form:5; //!< The pokemons form - u8 unk_19; - u16 unk_1A; - u16 unk_1C; - u16 unk_1E; -} PokemonDataBlockB; - -/** - * @brief Block C of the BoxPokemon data structure - */ -typedef struct PokemonDataBlockC { - u16 unk_00[11]; - u8 unk_16; - u8 originGame; //!< The game this pokemon was caught in - u64 unk_18; -} PokemonDataBlockC; - -/** - * @brief Block D of the BoxPokemon data structure - */ -typedef struct PokemonDataBlockD { - u16 unk_00[8]; - u8 unk_10; - u8 unk_11; - u8 unk_12; - u8 unk_13; - u8 unk_14; - u8 unk_15; - u16 unk_16; - u16 unk_18; - u8 pokerus; //!< The pokemons Pokerus value - u8 pokeball; //!< What pokeball this pokemon was caught in - u8 metLevel : 7; //!< What level this pokemon was originally met at - u8 otGender : 1; //!< The gender of this pokemons Original Trainer - u8 unk_1D; - u16 unk_1E; -} PokemonDataBlockD; - -typedef union { - PokemonDataBlockA blockA; - PokemonDataBlockB blockB; - PokemonDataBlockC blockC; - PokemonDataBlockD blockD; -} PokemonDataBlock; - -/** - * @brief Boxed Pokemon data structure - */ -typedef struct BoxPokemon { - u32 personality; //!< The personality value of the pokemon - u16 partyDecrypted : 1; //!< Whether the pokemons party data is currently decrypted - u16 boxDecrypted : 1; //!< Whether the pokemons boxed data is currently decrypted - u16 invalidData : 1; //!< Set if the pokemons data is invalid (failed checksum). This will make the mon appear as a Bad Egg in game - u16 unk_04_3 : 13; - u16 checksum; //!< Checksum for the pokemons data - PokemonDataBlock dataBlocks[4]; //!< Data blocks containing the pokemons boxed data, stored encrypted -} BoxPokemon; - -#endif // POKEPLATINUM_BOX_POKEMON_H diff --git a/include/struct_defs/party_pokemon.h b/include/struct_defs/party_pokemon.h deleted file mode 100644 index 7581303fde..0000000000 --- a/include/struct_defs/party_pokemon.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef POKEPLATINUM_PARTY_POKEMON_DATA_T_H -#define POKEPLATINUM_PARTY_POKEMON_DATA_T_H - -#include "struct_defs/struct_0202818C.h" -#include "struct_defs/struct_0202CA28.h" - -/** - * @brief Party Pokemon data structure - */ -typedef struct PartyPokemon { - u32 unk_00; - u8 level; //!< The pokemons level - u8 unk_05; - u16 unk_06; - u16 unk_08; - u16 unk_0A; - u16 unk_0C; - u16 unk_0E; - u16 unk_10; - u16 unk_12; - UnkStruct_0202818C unk_14; - UnkStruct_0202CA28 unk_4C; -} PartyPokemon; - -#endif // POKEPLATINUM_PARTY_POKEMON_DATA_T_H diff --git a/include/struct_defs/pokemon.h b/include/struct_defs/pokemon.h deleted file mode 100644 index 62277dda48..0000000000 --- a/include/struct_defs/pokemon.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_POKEMON_H -#define POKEPLATINUM_STRUCT_POKEMON_H - -#include "struct_defs/box_pokemon.h" -#include "struct_defs/party_pokemon.h" - -/** - * @brief The main Pokemon data structure - */ -typedef struct Pokemon { - BoxPokemon box; //!< Contains the pokemons boxed data - PartyPokemon party; //!< Contains the pokemons extra data while it is in the players party -} Pokemon; - -#endif // POKEPLATINUM_STRUCT_POKEMON_H diff --git a/include/struct_defs/pokemon_evolution_data.h b/include/struct_defs/pokemon_evolution_data.h deleted file mode 100644 index 9c901757dd..0000000000 --- a/include/struct_defs/pokemon_evolution_data.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207821C_H -#define POKEPLATINUM_STRUCT_0207821C_H - -#include "struct_defs/pokemon_evolution_method.h" - -typedef struct PokemonEvolutionData { - PokemonEvolutionMethod methods[7]; -} PokemonEvolutionData; - -#endif // POKEPLATINUM_STRUCT_0207821C_H diff --git a/include/struct_defs/pokemon_evolution_method.h b/include/struct_defs/pokemon_evolution_method.h deleted file mode 100644 index 34eb93d652..0000000000 --- a/include/struct_defs/pokemon_evolution_method.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_0207821C_SUB1_H -#define POKEPLATINUM_STRUCT_0207821C_SUB1_H - -typedef struct PokemonEvolutionMethod { - u16 type; - u16 param; - u16 targetSpecies; -} PokemonEvolutionMethod; - -#endif // POKEPLATINUM_STRUCT_0207821C_SUB1_H diff --git a/include/struct_defs/pokemon_personal_data.h b/include/struct_defs/pokemon_personal_data.h deleted file mode 100644 index d0c8d6eccc..0000000000 --- a/include/struct_defs/pokemon_personal_data.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef POKEPLATINUM_STRUCT_02075874_H -#define POKEPLATINUM_STRUCT_02075874_H - -/** - * @brief Pokemon Personal data structure. This contains data that is the same across all pokemon of the same species/form - */ -typedef struct PokemonPersonalData { - u8 baseHp; //!< The pokemons base HP stat - u8 baseAtk; //!< The pokemons base Attack stat - u8 baseDef; //!< The pokemons base Defense stat - u8 baseSpeed; //!< The pokemons base Speed stat - u8 baseSpAtk; //!< The pokemons base Special Attack stat - u8 baseSpDef; //!< The pokemons base Special Defense stat - u8 type1; //!< The pokemons first type - u8 type2; //!< The pokemons second type - u8 catchRate; //!< The pokemons catch rate - u8 baseExp; //!< A factor in determining experience yield when defeating this pokemon - u16 evHpYield : 2; //!< How many HP EVs will be gained when defeating this pokemon - u16 evAtkYield : 2; //!< How many Attack EVs will be gained when defeating this pokemon - u16 evDefYield : 2; //!< How many Defense EVs will be gained when defeating this pokemon - u16 evSpeedYield : 2; //!< How many Speed EVs will be gained when defeating this pokemon - u16 evSpAtkYield : 2; //!< How many Special Attack EVs will be gained when defeating this pokemon - u16 evSpDefYield : 2; //!< How many Special Defense EVs will be gained when defeating this pokemon - u16 padding : 4; - - u16 item1; //!< Common held item when this pokemon is encountered in the wild - u16 item2; //!< Rare held item when this pokemon is encountered in the wild - u8 gender; //!< The pokemons gender ratio, except for special values, a higher value will result in more females and a lower value will result in more males appearing - u8 hatchCycles; //!< How long eggs of this pokemon will take to hatch. In Gen.IV One cycle is 255 steps - u8 baseFriendship; //!< The pokemons base Friendship stat - u8 expRate; //!< The experience rate category of the pokemon. This sets which formula is used to determine the pokemons level based on its experience - u8 eggGroup1; //!< The pokemons first egg group - u8 eggGroup2; //!< The pokemons second egg group - u8 ability1; //!< The pokemons first possible ability - u8 ability2; //!< The pokemons second possible ability - u8 greatMarshFleeRate; //!< The pokemons base flee rate in the Great Marsh safari zone - u8 color : 7; //!< The pokemons color category - u8 inverse : 1; - u32 tmLearnsetMask1; //!< Bitflags for whether this pokemon can learn a TM (TM1 -> TM32) - u32 tmLearnsetMask2; //!< Bitflags for whether this pokemon can learn a TM (TM33 -> TM64) - u32 tmLearnsetMask3; //!< Bitflags for whether this pokemon can learn a TM (TM65 -> TM92, HM1 -> HM4) - u32 tmLearnsetMask4; //!< Bitflags for whether this pokemon can learn a TM (HM5 -> HM8, rest unused) -} PokemonPersonalData; - -#endif // POKEPLATINUM_STRUCT_02075874_H diff --git a/include/struct_defs/struct_020298D8.h b/include/struct_defs/struct_020298D8.h index 470a8d1bf4..a22bc76f83 100644 --- a/include/struct_defs/struct_020298D8.h +++ b/include/struct_defs/struct_020298D8.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_02007C7C_decl.h" #include "struct_defs/union_02022594_020225E0.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay022/struct_ov22_022596B0.h" typedef struct { diff --git a/include/struct_defs/struct_0203DA00.h b/include/struct_defs/struct_0203DA00.h index 0c29abe7cd..1abf04a29a 100644 --- a/include/struct_defs/struct_0203DA00.h +++ b/include/struct_defs/struct_0203DA00.h @@ -6,7 +6,7 @@ #include "struct_decls/struct_02029C68_decl.h" #include "struct_decls/struct_02029D04_decl.h" #include "struct_decls/struct_0202CD88_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" typedef struct { Pokemon * unk_00; diff --git a/include/struct_defs/struct_0203E2FC.h b/include/struct_defs/struct_0203E2FC.h index 085556b266..82d73255c1 100644 --- a/include/struct_defs/struct_0203E2FC.h +++ b/include/struct_defs/struct_0203E2FC.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_defs/struct_020279FC.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" typedef struct { Pokemon * unk_00; diff --git a/include/struct_defs/struct_020711C8.h b/include/struct_defs/struct_020711C8.h index c81175b72f..4b08ff50d2 100644 --- a/include/struct_defs/struct_020711C8.h +++ b/include/struct_defs/struct_020711C8.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_STRUCT_020711C8_H #define POKEPLATINUM_STRUCT_020711C8_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" typedef struct { Pokemon * unk_00; diff --git a/include/struct_defs/struct_0207AE68_t.h b/include/struct_defs/struct_0207AE68_t.h index 616bf70eb4..a16f458888 100644 --- a/include/struct_defs/struct_0207AE68_t.h +++ b/include/struct_defs/struct_0207AE68_t.h @@ -16,7 +16,7 @@ #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_02056B24_decl.h" #include "struct_defs/struct_0205AA50.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0207C690.h" #include "struct_defs/struct_0207C8C4.h" diff --git a/include/struct_defs/struct_02090800.h b/include/struct_defs/struct_02090800.h index 07a8cd04c2..e3317b8381 100644 --- a/include/struct_defs/struct_02090800.h +++ b/include/struct_defs/struct_02090800.h @@ -3,7 +3,7 @@ #include "message.h" #include "struct_decls/struct_0200B358_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02090800_sub1.h" typedef struct { diff --git a/include/struct_defs/struct_02093800.h b/include/struct_defs/struct_02093800.h index 415923f0ba..b6ccd5489a 100644 --- a/include/struct_defs/struct_02093800.h +++ b/include/struct_defs/struct_02093800.h @@ -5,7 +5,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_defs/struct_020279FC.h" #include "struct_decls/struct_0202A750_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" typedef struct { diff --git a/include/struct_defs/struct_02093BBC.h b/include/struct_defs/struct_02093BBC.h index 5f74591078..312f00c6db 100644 --- a/include/struct_defs/struct_02093BBC.h +++ b/include/struct_defs/struct_02093BBC.h @@ -5,7 +5,7 @@ #include "struct_defs/struct_020279FC.h" #include "struct_decls/struct_02029C88_decl.h" #include "struct_decls/struct_02029D04_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02095C60.h" typedef struct { diff --git a/include/struct_defs/struct_02095C48.h b/include/struct_defs/struct_02095C48.h index e9bc446193..9b977d4776 100644 --- a/include/struct_defs/struct_02095C48.h +++ b/include/struct_defs/struct_02095C48.h @@ -5,7 +5,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_defs/struct_020279FC.h" #include "struct_decls/struct_0202A750_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_02094A58.h" #include "struct_defs/struct_02095C48_sub1.h" diff --git a/include/struct_defs/struct_02095C48_sub1.h b/include/struct_defs/struct_02095C48_sub1.h index be2ef96b0e..346d179876 100644 --- a/include/struct_defs/struct_02095C48_sub1.h +++ b/include/struct_defs/struct_02095C48_sub1.h @@ -3,7 +3,7 @@ #include "strbuf.h" #include "struct_decls/struct_02029C88_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_020954F0.h" #include "struct_defs/struct_02095C48_sub1_sub1.h" #include "overlay006/struct_ov6_02248BE8.h" diff --git a/include/struct_defs/struct_02097F18.h b/include/struct_defs/struct_02097F18.h index a4e21caf26..2a391df0fb 100644 --- a/include/struct_defs/struct_02097F18.h +++ b/include/struct_defs/struct_02097F18.h @@ -3,7 +3,7 @@ #include "struct_defs/struct_020279FC.h" #include "struct_decls/struct_0202CA1C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/include/struct_defs/struct_02098DE8.h b/include/struct_defs/struct_02098DE8.h index 66667a6f78..88262e40e3 100644 --- a/include/struct_defs/struct_02098DE8.h +++ b/include/struct_defs/struct_02098DE8.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_STRUCT_02098DE8_H #include "struct_defs/struct_0202A93C.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" typedef struct { Pokemon * unk_00; diff --git a/include/struct_defs/struct_020997B8.h b/include/struct_defs/struct_020997B8.h index 877324ca63..a9749bf510 100644 --- a/include/struct_defs/struct_020997B8.h +++ b/include/struct_defs/struct_020997B8.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_defs/struct_020279FC.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" typedef struct { Pokemon * unk_00; diff --git a/include/struct_defs/struct_party.h b/include/struct_defs/struct_party.h index b4093e81b2..ef7cb32a90 100644 --- a/include/struct_defs/struct_party.h +++ b/include/struct_defs/struct_party.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_STRUCT_PARTY_H #define POKEPLATINUM_STRUCT_PARTY_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" typedef struct Party { int capacity; diff --git a/include/unk_0200B358.h b/include/unk_0200B358.h index 3fd6c07471..1eec557bb4 100644 --- a/include/unk_0200B358.h +++ b/include/unk_0200B358.h @@ -4,7 +4,7 @@ #include "struct_decls/struct_0200B358_decl.h" #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_defs/trainer_data.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/include/unk_0200DA60.h b/include/unk_0200DA60.h index 15a64875f7..b5a34b267e 100644 --- a/include/unk_0200DA60.h +++ b/include/unk_0200DA60.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_defs/struct_0205AA50.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" void sub_0200DA60(UnkStruct_02018340 * param0, u8 param1, u16 param2, u8 param3, u32 param4); u32 sub_0200DAA0(void); diff --git a/include/unk_020261E4.h b/include/unk_020261E4.h index 6d66d04c1e..a1d641cc49 100644 --- a/include/unk_020261E4.h +++ b/include/unk_020261E4.h @@ -5,7 +5,7 @@ #include "struct_decls/struct_02026224_decl.h" #include "struct_decls/struct_02026310_decl.h" #include "struct_defs/struct_0202818C.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" int sub_020261E4(void); diff --git a/include/unk_0202631C.h b/include/unk_0202631C.h index 10bb710a97..1207d7265b 100644 --- a/include/unk_0202631C.h +++ b/include/unk_0202631C.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_UNK_0202631C_H #include "struct_decls/struct_02026324_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" int sub_0202631C(void); diff --git a/include/unk_020298BC.h b/include/unk_020298BC.h index 3c56b27799..71deb4e282 100644 --- a/include/unk_020298BC.h +++ b/include/unk_020298BC.h @@ -9,7 +9,7 @@ #include "struct_decls/struct_0202A138_decl.h" #include "struct_decls/struct_0202A150_decl.h" #include "struct_decls/struct_0202A750_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay022/struct_ov22_02255040.h" #include "overlay061/struct_ov61_0222AE80.h" diff --git a/include/unk_0202DA40.h b/include/unk_0202DA40.h index 365c7f4ff7..f17d723b75 100644 --- a/include/unk_0202DA40.h +++ b/include/unk_0202DA40.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_UNK_0202DA40_H #include "struct_decls/struct_0202DA40_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" UnkStruct_0202DA40 * sub_0202DA40(UnkStruct_021C0794 * param0); diff --git a/include/unk_0202EEC0.h b/include/unk_0202EEC0.h index a263fe76a9..e730c6c799 100644 --- a/include/unk_0202EEC0.h +++ b/include/unk_0202EEC0.h @@ -2,8 +2,7 @@ #define POKEPLATINUM_UNK_0202EEC0_H #include "struct_decls/struct_02024440_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" int sub_0202EEC0(void); void sub_0202EEC8(UnkStruct_02024440 * param0); diff --git a/include/unk_0202F180.h b/include/unk_0202F180.h index 283b1db0ac..2a9466b47d 100644 --- a/include/unk_0202F180.h +++ b/include/unk_0202F180.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_UNK_0202F180_H #define POKEPLATINUM_UNK_0202F180_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" void sub_0202F180(UnkStruct_021C0794 * param0, const Pokemon * param1); diff --git a/include/unk_0203D1B8.h b/include/unk_0203D1B8.h index bb1cbaa2ff..00ef8de24f 100644 --- a/include/unk_0203D1B8.h +++ b/include/unk_0203D1B8.h @@ -13,7 +13,7 @@ #include "struct_defs/struct_020684D0.h" #include "struct_decls/struct_02070950_decl.h" #include "struct_defs/struct_02072014.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_0209747C_decl.h" #include "struct_defs/struct_02097728.h" #include "struct_defs/struct_02098C44.h" diff --git a/include/unk_02051D8C.h b/include/unk_02051D8C.h index 831189010e..817cdbe638 100644 --- a/include/unk_02051D8C.h +++ b/include/unk_02051D8C.h @@ -5,7 +5,7 @@ #include "struct_decls/struct_0202B628_decl.h" #include "struct_decls/struct_0202CC84_decl.h" #include "struct_decls/struct_0203CDB0_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207D99C_decl.h" #include "struct_defs/struct_0209C370.h" diff --git a/include/unk_02054884.h b/include/unk_02054884.h index 1ca58dc971..714b5a61f2 100644 --- a/include/unk_02054884.h +++ b/include/unk_02054884.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_UNK_02054884_H #define POKEPLATINUM_UNK_02054884_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/include/unk_02056720.h b/include/unk_02056720.h index b87489e168..33e51773e8 100644 --- a/include/unk_02056720.h +++ b/include/unk_02056720.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_UNK_02056720_H #include "struct_decls/struct_02056B24_decl.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" int sub_02056720(void); diff --git a/include/unk_0206CCB0.h b/include/unk_0206CCB0.h index e4b7a5b776..f9422c80b2 100644 --- a/include/unk_0206CCB0.h +++ b/include/unk_0206CCB0.h @@ -6,7 +6,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0203CDB0_decl.h" #include "struct_decls/struct_0206D140_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay006/struct_ov6_022465F4_decl.h" diff --git a/include/unk_0207064C.h b/include/unk_0207064C.h index 0ade37cfbb..ecb4dd2b29 100644 --- a/include/unk_0207064C.h +++ b/include/unk_0207064C.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_0203CDB0_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" void * sub_0207064C(u32 param0, UnkStruct_0203CDB0 * param1, Pokemon * param2, u16 param3, s16 param4, s16 param5); BOOL sub_02070680(UnkStruct_020508D4 * param0); diff --git a/include/unk_020797C8.h b/include/unk_020797C8.h index 7f4cadb620..9c2e1283e3 100644 --- a/include/unk_020797C8.h +++ b/include/unk_020797C8.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_UNK_020797C8_H #include "strbuf.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" void sub_020797C8(UnkStruct_020797DC * param0); diff --git a/include/unk_02079D40.h b/include/unk_02079D40.h index 5d4122e5e5..a03f2148b4 100644 --- a/include/unk_02079D40.h +++ b/include/unk_02079D40.h @@ -1,8 +1,7 @@ #ifndef POKEPLATINUM_UNK_02079D40_H #define POKEPLATINUM_UNK_02079D40_H -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" u32 sub_02079D40(const BoxPokemon * param0); u32 sub_02079D80(Pokemon * param0); diff --git a/include/unk_0207A2A8.h b/include/unk_0207A2A8.h index 798fd42b8b..061a7732d0 100644 --- a/include/unk_0207A2A8.h +++ b/include/unk_0207A2A8.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_UNK_0207A2A8_H #include "struct_defs/struct_0202610C.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_02098700_decl.h" diff --git a/include/unk_0207AE68.h b/include/unk_0207AE68.h index 2cadaea0b8..fea8803d55 100644 --- a/include/unk_0207AE68.h +++ b/include/unk_0207AE68.h @@ -5,7 +5,7 @@ #include "struct_defs/struct_020279FC.h" #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_02056B24_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207AE68_decl.h" #include "struct_decls/struct_0207D3C0_decl.h" diff --git a/include/unk_020819DC.h b/include/unk_020819DC.h index 585039f55f..d11864531d 100644 --- a/include/unk_020819DC.h +++ b/include/unk_020819DC.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_UNK_020819DC_H #define POKEPLATINUM_UNK_020819DC_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0207F248.h" void sub_02081A24(UnkStruct_0207F248 * param0); diff --git a/include/unk_02084B70.h b/include/unk_02084B70.h index 8ba68caa6b..75e5d05f9e 100644 --- a/include/unk_02084B70.h +++ b/include/unk_02084B70.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_UNK_02084B70_H #define POKEPLATINUM_UNK_02084B70_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0207F248.h" void sub_020852B8(UnkStruct_0207F248 * param0); diff --git a/include/unk_0208C324.h b/include/unk_0208C324.h index 8456ef9ab2..e35d1675fd 100644 --- a/include/unk_0208C324.h +++ b/include/unk_0208C324.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_UNK_0208C324_H #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0208D7BC.h" #include "struct_defs/struct_02098D38.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/include/unk_02092494.h b/include/unk_02092494.h index bd379fd93d..e79e4f8688 100644 --- a/include/unk_02092494.h +++ b/include/unk_02092494.h @@ -2,8 +2,7 @@ #define POKEPLATINUM_UNK_02092494_H #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02090800.h" UnkStruct_02090800 * sub_02092494(Pokemon * param0, BOOL param1, int param2); diff --git a/include/unk_02094EDC.h b/include/unk_02094EDC.h index 953934fde4..ad99689ce7 100644 --- a/include/unk_02094EDC.h +++ b/include/unk_02094EDC.h @@ -3,7 +3,7 @@ #include "struct_decls/struct_02007768_decl.h" #include "struct_decls/struct_02007C7C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02095C48.h" #include "overlay006/struct_ov6_02248BE8.h" #include "overlay016/struct_ov16_0223E0C8.h" diff --git a/include/unk_02096420.h b/include/unk_02096420.h index 7c5a9abbc5..509e9c43e1 100644 --- a/include/unk_02096420.h +++ b/include/unk_02096420.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_UNK_02096420_H #define POKEPLATINUM_UNK_02096420_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" u8 sub_02096420(Pokemon * param0, u16 param1, u16 param2, u32 param3); diff --git a/include/unk_02097624.h b/include/unk_02097624.h index e4c94eaa1e..c997203ae9 100644 --- a/include/unk_02097624.h +++ b/include/unk_02097624.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_UNK_02097624_H #include "struct_decls/struct_02028430_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02097728.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/include/unk_02097B18.h b/include/unk_02097B18.h index 23be22f88e..11ebe4e557 100644 --- a/include/unk_02097B18.h +++ b/include/unk_02097B18.h @@ -2,7 +2,7 @@ #define POKEPLATINUM_UNK_02097B18_H #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02097F18.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/include/unk_020989DC.h b/include/unk_020989DC.h index 4d7eb0890d..aacdf27f60 100644 --- a/include/unk_020989DC.h +++ b/include/unk_020989DC.h @@ -3,7 +3,7 @@ #include "struct_defs/struct_0202A93C.h" #include "struct_defs/struct_0203D9B8.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "enums.h" diff --git a/include/unk_020997B8.h b/include/unk_020997B8.h index d1c73cbea5..08d94c5512 100644 --- a/include/unk_020997B8.h +++ b/include/unk_020997B8.h @@ -1,7 +1,7 @@ #ifndef POKEPLATINUM_UNK_020997B8_H #define POKEPLATINUM_UNK_020997B8_H -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_020997B8.h" UnkStruct_020997B8 * sub_020997B8(u32 param0); diff --git a/src/enc_effects.c b/src/enc_effects.c index 35250c19d1..0c9822a17a 100644 --- a/src/enc_effects.c +++ b/src/enc_effects.c @@ -7,7 +7,7 @@ #include "constants/species.h" #include "constants/trainer.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay006/battle_params.h" diff --git a/src/overlay005/ov5_021D1C30.c b/src/overlay005/ov5_021D1C30.c index 1626ad5c2f..197b9be617 100644 --- a/src/overlay005/ov5_021D1C30.c +++ b/src/overlay005/ov5_021D1C30.c @@ -9,7 +9,7 @@ #include "struct_decls/struct_0203A790_decl.h" #include "struct_decls/struct_020507E4_decl.h" #include "struct_decls/struct_02061AB4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0203A55C.h" diff --git a/src/overlay005/ov5_021DDBE8.c b/src/overlay005/ov5_021DDBE8.c index 9e3e6bf417..a1738215f7 100644 --- a/src/overlay005/ov5_021DDBE8.c +++ b/src/overlay005/ov5_021DDBE8.c @@ -11,7 +11,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_020203AC_decl.h" #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay005/struct_ov5_021DE6BC_decl.h" #include "overlay005/struct_ov5_021DE79C_decl.h" #include "overlay005/struct_ov5_021DE928_decl.h" diff --git a/src/overlay005/ov5_021DFB54.c b/src/overlay005/ov5_021DFB54.c index 7986ae6388..e603ac26e3 100644 --- a/src/overlay005/ov5_021DFB54.c +++ b/src/overlay005/ov5_021DFB54.c @@ -9,7 +9,7 @@ #include "struct_decls/struct_0205E884_decl.h" #include "struct_decls/struct_02061830_decl.h" #include "struct_decls/struct_02061AB4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay005/struct_ov5_021D1BEC_decl.h" #include "overlay009/struct_ov9_0224F6EC_decl.h" #include "overlay101/struct_ov101_021D5D90_decl.h" diff --git a/src/overlay005/ov5_021E622C.c b/src/overlay005/ov5_021E622C.c index 848d855dda..754afc6566 100644 --- a/src/overlay005/ov5_021E622C.c +++ b/src/overlay005/ov5_021E622C.c @@ -9,8 +9,7 @@ #include "struct_decls/struct_02026310_decl.h" #include "struct_decls/struct_0202CC84_decl.h" #include "struct_decls/struct_0202CD88_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/overlay005/ov5_021EE7D4.c b/src/overlay005/ov5_021EE7D4.c index 803129e7c6..1cd031fa0a 100644 --- a/src/overlay005/ov5_021EE7D4.c +++ b/src/overlay005/ov5_021EE7D4.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_0200B358_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_02098700_decl.h" #include "struct_defs/struct_0203CDB0.h" diff --git a/src/overlay005/ov5_021F08CC.c b/src/overlay005/ov5_021F08CC.c index a41530b32e..2ae8725998 100644 --- a/src/overlay005/ov5_021F08CC.c +++ b/src/overlay005/ov5_021F08CC.c @@ -11,7 +11,7 @@ #include "struct_decls/struct_020508D4_decl.h" #include "struct_decls/struct_0205E884_decl.h" #include "struct_decls/struct_02061AB4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay101/struct_ov101_021D5D90_decl.h" #include "struct_defs/struct_0203CDB0.h" diff --git a/src/overlay005/ov5_021F6454.c b/src/overlay005/ov5_021F6454.c index f1596d0aaa..1938fed575 100644 --- a/src/overlay005/ov5_021F6454.c +++ b/src/overlay005/ov5_021F6454.c @@ -18,7 +18,7 @@ #include "struct_decls/struct_020507E4_decl.h" #include "struct_decls/struct_02061830_decl.h" #include "struct_decls/struct_02061AB4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay005/struct_ov5_021F6704_decl.h" diff --git a/src/overlay005/ov5_021F77A8.c b/src/overlay005/ov5_021F77A8.c index 54c85d8fbe..a91d1420bf 100644 --- a/src/overlay005/ov5_021F77A8.c +++ b/src/overlay005/ov5_021F77A8.c @@ -10,7 +10,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "strbuf.h" #include "struct_decls/struct_0203E724_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_0207D3C0_decl.h" #include "overlay005/struct_ov5_021DC1A4_decl.h" #include "overlay005/struct_ov5_021F7ED8_decl.h" diff --git a/src/overlay006/ov6_02240C9C.c b/src/overlay006/ov6_02240C9C.c index bbf7d8c097..c00da8357b 100644 --- a/src/overlay006/ov6_02240C9C.c +++ b/src/overlay006/ov6_02240C9C.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0202D7B0.h" diff --git a/src/overlay006/ov6_02243258.c b/src/overlay006/ov6_02243258.c index 95ad5a38b1..8701ddb944 100644 --- a/src/overlay006/ov6_02243258.c +++ b/src/overlay006/ov6_02243258.c @@ -10,7 +10,7 @@ #include "struct_decls/struct_02022550_decl.h" #include "struct_decls/struct_02061AB4_decl.h" #include "struct_decls/struct_020711EC_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay101/struct_ov101_021D5D90_decl.h" #include "struct_defs/struct_02008A90.h" diff --git a/src/overlay006/ov6_02246034.c b/src/overlay006/ov6_02246034.c index 73bd15f3b2..b229faf630 100644 --- a/src/overlay006/ov6_02246034.c +++ b/src/overlay006/ov6_02246034.c @@ -3,7 +3,7 @@ #include "inlines.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0202D7B0.h" diff --git a/src/overlay006/ov6_02246184.c b/src/overlay006/ov6_02246184.c index c7b6e6c78b..27032e914f 100644 --- a/src/overlay006/ov6_02246184.c +++ b/src/overlay006/ov6_02246184.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay006/struct_ov6_02246204_decl.h" diff --git a/src/overlay006/ov6_02247100.c b/src/overlay006/ov6_02247100.c index f22a85a519..3b0eb12d43 100644 --- a/src/overlay006/ov6_02247100.c +++ b/src/overlay006/ov6_02247100.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_0203A790_decl.h" #include "struct_decls/struct_020508D4_decl.h" #include "struct_decls/struct_02061AB4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0203CDB0.h" #include "struct_defs/struct_02049FA8.h" diff --git a/src/overlay006/ov6_022489E4.c b/src/overlay006/ov6_022489E4.c index c6e0edfc46..44981d5f54 100644 --- a/src/overlay006/ov6_022489E4.c +++ b/src/overlay006/ov6_022489E4.c @@ -2,7 +2,7 @@ #include #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_020954F0.h" #include "struct_defs/struct_02095C48.h" diff --git a/src/overlay010/ov10_0221F800.c b/src/overlay010/ov10_0221F800.c index d719c57e37..15f74cf2ef 100644 --- a/src/overlay010/ov10_0221F800.c +++ b/src/overlay010/ov10_0221F800.c @@ -19,7 +19,7 @@ #include "struct_decls/struct_020203AC_decl.h" #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0200D0F4.h" diff --git a/src/overlay013/ov13_02221A88.c b/src/overlay013/ov13_02221A88.c index c34926b774..47d095946e 100644 --- a/src/overlay013/ov13_02221A88.c +++ b/src/overlay013/ov13_02221A88.c @@ -1,7 +1,7 @@ #include #include -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0205AA50.h" #include "overlay013/struct_ov13_0221FC20.h" #include "overlay013/struct_ov13_022213F0.h" diff --git a/src/overlay013/ov13_022264F4.c b/src/overlay013/ov13_022264F4.c index 7fc069a79f..37f8cf9840 100644 --- a/src/overlay013/ov13_022264F4.c +++ b/src/overlay013/ov13_022264F4.c @@ -8,7 +8,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/battle_system.h" diff --git a/src/overlay014/ov14_0221FC20.c b/src/overlay014/ov14_0221FC20.c index 1aaff92c20..2ade0aca60 100644 --- a/src/overlay014/ov14_0221FC20.c +++ b/src/overlay014/ov14_0221FC20.c @@ -8,7 +8,7 @@ #include "battle/battle_context.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/battle_system.h" #include "battle/ai_context.h" #include "battle/battle_context.h" diff --git a/src/overlay016/battle_controller.c b/src/overlay016/battle_controller.c index dac2910540..ef43855117 100644 --- a/src/overlay016/battle_controller.c +++ b/src/overlay016/battle_controller.c @@ -16,7 +16,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/battle_system.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/trainer_data.h" #include "battle/ai_context.h" diff --git a/src/overlay016/ov16_0223B140.c b/src/overlay016/ov16_0223B140.c index 07d78da4c6..6624f833f0 100644 --- a/src/overlay016/ov16_0223B140.c +++ b/src/overlay016/ov16_0223B140.c @@ -16,7 +16,7 @@ #include "overlay016/struct_ov16_0225BFFC_decl.h" #include "struct_defs/struct_02008A90.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0207A778.h" #include "struct_defs/battle_system.h" #include "struct_defs/struct_0207C690.h" diff --git a/src/overlay016/ov16_0223DF00.c b/src/overlay016/ov16_0223DF00.c index be530a234a..91f57fe445 100644 --- a/src/overlay016/ov16_0223DF00.c +++ b/src/overlay016/ov16_0223DF00.c @@ -34,7 +34,7 @@ #include "struct_defs/struct_0201D738.h" #include "struct_defs/struct_020279FC.h" #include "struct_defs/struct_0205AA50.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/trainer_data.h" #include "struct_defs/battle_system.h" #include "overlay006/battle_params.h" diff --git a/src/overlay016/ov16_022405FC.c b/src/overlay016/ov16_022405FC.c index 6186b3ec41..788ad0b989 100644 --- a/src/overlay016/ov16_022405FC.c +++ b/src/overlay016/ov16_022405FC.c @@ -30,8 +30,7 @@ #include "struct_defs/struct_020127E8.h" #include "struct_defs/struct_0201EE28.h" #include "struct_defs/struct_0205AA50.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/pokemon_personal_data.h" +#include "pokemon.h" #include "struct_defs/trainer_data.h" #include "struct_defs/battle_system.h" #include "struct_defs/struct_0208737C.h" diff --git a/src/overlay016/ov16_0225177C.c b/src/overlay016/ov16_0225177C.c index abadc99c19..c044568b06 100644 --- a/src/overlay016/ov16_0225177C.c +++ b/src/overlay016/ov16_0225177C.c @@ -3,7 +3,7 @@ #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/battle_system.h" #include "struct_decls/struct_02098700_decl.h" diff --git a/src/overlay016/ov16_0225BFFC.c b/src/overlay016/ov16_0225BFFC.c index 0ba85e1bf9..5da4ed77b2 100644 --- a/src/overlay016/ov16_0225BFFC.c +++ b/src/overlay016/ov16_0225BFFC.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_0200C6E4_decl.h" #include "struct_decls/struct_0200C704_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/battle_system.h" #include "overlay016/struct_ov16_0225BFFC_decl.h" diff --git a/src/overlay016/ov16_0225CBB8.c b/src/overlay016/ov16_0225CBB8.c index c5cb90f7b0..72cc20de0c 100644 --- a/src/overlay016/ov16_0225CBB8.c +++ b/src/overlay016/ov16_0225CBB8.c @@ -15,7 +15,7 @@ #include "struct_decls/struct_0200C704_decl.h" #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/battle_system.h" #include "overlay012/struct_ov12_0221FCDC_decl.h" diff --git a/src/overlay016/ov16_0226485C.c b/src/overlay016/ov16_0226485C.c index 02bc075379..e11699ddbe 100644 --- a/src/overlay016/ov16_0226485C.c +++ b/src/overlay016/ov16_0226485C.c @@ -7,7 +7,7 @@ #include "struct_decls/battle_system.h" #include "battle/battle_context.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0207A81C.h" #include "struct_defs/battle_system.h" #include "battle/battle_context.h" diff --git a/src/overlay016/ov16_02266F1C.c b/src/overlay016/ov16_02266F1C.c index a67f5c95d5..62c823b22c 100644 --- a/src/overlay016/ov16_02266F1C.c +++ b/src/overlay016/ov16_02266F1C.c @@ -14,8 +14,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0200D0F4.h" #include "struct_defs/struct_0205AA50.h" diff --git a/src/overlay016/ov16_0226871C.c b/src/overlay016/ov16_0226871C.c index fe350baa82..e54a3f5514 100644 --- a/src/overlay016/ov16_0226871C.c +++ b/src/overlay016/ov16_0226871C.c @@ -18,8 +18,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/battle_system.h" #include "overlay016/struct_ov16_0226DC24_decl.h" #include "overlay016/struct_ov16_0226DEEC_decl.h" diff --git a/src/overlay019/ov19_021D0D80.c b/src/overlay019/ov19_021D0D80.c index d27c86e431..8ff02ae7b0 100644 --- a/src/overlay019/ov19_021D0D80.c +++ b/src/overlay019/ov19_021D0D80.c @@ -12,9 +12,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_02023FCC_decl.h" #include "struct_decls/struct_0202CC84_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" -#include "struct_defs/pokemon_personal_data.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207CB08_decl.h" diff --git a/src/overlay019/ov19_021D79F8.c b/src/overlay019/ov19_021D79F8.c index 46a9c32d8f..4c79918ef1 100644 --- a/src/overlay019/ov19_021D79F8.c +++ b/src/overlay019/ov19_021D79F8.c @@ -4,7 +4,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_020218BC_decl.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "overlay019/struct_ov19_021D5DF8_decl.h" #include "overlay019/struct_ov19_021D61B0_decl.h" diff --git a/src/overlay019/ov19_021DA270.c b/src/overlay019/ov19_021DA270.c index ffebea9988..d83397a4ca 100644 --- a/src/overlay019/ov19_021DA270.c +++ b/src/overlay019/ov19_021DA270.c @@ -3,7 +3,7 @@ #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_020218BC_decl.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay019/struct_ov19_021D61B0_decl.h" #include "overlay019/struct_ov19_021D4DF0.h" diff --git a/src/overlay019/ov19_021DB8E4.c b/src/overlay019/ov19_021DB8E4.c index e2c1dc2eb8..9ea03402f9 100644 --- a/src/overlay019/ov19_021DB8E4.c +++ b/src/overlay019/ov19_021DB8E4.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_020218BC_decl.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "overlay019/struct_ov19_021D61B0_decl.h" diff --git a/src/overlay019/ov19_021DC5F0.c b/src/overlay019/ov19_021DC5F0.c index ebc2443ae7..43209cdd96 100644 --- a/src/overlay019/ov19_021DC5F0.c +++ b/src/overlay019/ov19_021DC5F0.c @@ -5,8 +5,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_020218BC_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay019/struct_ov19_021D5DF8_decl.h" #include "overlay019/struct_ov19_021D61B0_decl.h" diff --git a/src/overlay019/ov19_021DEC04.c b/src/overlay019/ov19_021DEC04.c index 56f6341b23..e5487117b4 100644 --- a/src/overlay019/ov19_021DEC04.c +++ b/src/overlay019/ov19_021DEC04.c @@ -10,7 +10,7 @@ #include "struct_decls/struct_020218BC_decl.h" #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay019/struct_ov19_021D61B0_decl.h" #include "overlay019/struct_ov19_021DEC04_decl.h" diff --git a/src/overlay021/ov21_021E8D48.c b/src/overlay021/ov21_021E8D48.c index 2b2fb92a31..826649bbc3 100644 --- a/src/overlay021/ov21_021E8D48.c +++ b/src/overlay021/ov21_021E8D48.c @@ -13,7 +13,7 @@ #include "struct_decls/struct_020218BC_decl.h" #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay021/struct_ov21_021D4C0C_decl.h" #include "struct_defs/struct_02008A90.h" diff --git a/src/overlay022/ov22_02255D44.c b/src/overlay022/ov22_02255D44.c index 2bdc31215e..2b66620340 100644 --- a/src/overlay022/ov22_02255D44.c +++ b/src/overlay022/ov22_02255D44.c @@ -12,7 +12,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_02029C68_decl.h" #include "struct_decls/struct_02029C88_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02008A90.h" #include "struct_defs/struct_02015958.h" diff --git a/src/overlay022/ov22_022578F4.c b/src/overlay022/ov22_022578F4.c index 7b06445ea4..e67dd63c4c 100644 --- a/src/overlay022/ov22_022578F4.c +++ b/src/overlay022/ov22_022578F4.c @@ -1,7 +1,7 @@ #include #include -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02008A90.h" #include "struct_defs/union_02022594_020225E0.h" diff --git a/src/overlay022/ov22_02259098.c b/src/overlay022/ov22_02259098.c index 6d32ad9a90..a15b11cc51 100644 --- a/src/overlay022/ov22_02259098.c +++ b/src/overlay022/ov22_02259098.c @@ -4,7 +4,7 @@ #include "data_021BF67C.h" #include "struct_decls/struct_02007768_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02008A90.h" #include "struct_defs/union_02022594_020225E0.h" diff --git a/src/overlay022/ov22_0225AF8C.c b/src/overlay022/ov22_0225AF8C.c index 8aa357a26c..09a9dd52f6 100644 --- a/src/overlay022/ov22_0225AF8C.c +++ b/src/overlay022/ov22_0225AF8C.c @@ -6,7 +6,7 @@ #include "struct_decls/struct_02029C88_decl.h" #include "struct_decls/struct_0202A138_decl.h" #include "struct_decls/struct_0202A150_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02008A90.h" #include "overlay022/struct_ov22_02254DE0.h" diff --git a/src/overlay022/ov22_0225B660.c b/src/overlay022/ov22_0225B660.c index 310d3999fe..bc230fac91 100644 --- a/src/overlay022/ov22_0225B660.c +++ b/src/overlay022/ov22_0225B660.c @@ -10,8 +10,7 @@ #include "strbuf.h" #include "struct_decls/struct_02029C68_decl.h" #include "struct_decls/struct_02029C88_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay022/struct_ov22_0225B1BC_decl.h" #include "struct_defs/struct_02041DC8.h" diff --git a/src/overlay032/ov32_022561C0.c b/src/overlay032/ov32_022561C0.c index 9b2c60c1b2..d51431afe8 100644 --- a/src/overlay032/ov32_022561C0.c +++ b/src/overlay032/ov32_022561C0.c @@ -4,8 +4,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay025/struct_ov25_0225424C_decl.h" #include "overlay032/struct_ov32_02256470_decl.h" diff --git a/src/overlay033/ov33_022561C0.c b/src/overlay033/ov33_022561C0.c index 5c52f7e9eb..477cf02f99 100644 --- a/src/overlay033/ov33_022561C0.c +++ b/src/overlay033/ov33_022561C0.c @@ -4,8 +4,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay025/struct_ov25_0225424C_decl.h" #include "overlay033/struct_ov33_02256474_decl.h" diff --git a/src/overlay040/ov40_022561C0.c b/src/overlay040/ov40_022561C0.c index b47ff8c3ef..a328107c91 100644 --- a/src/overlay040/ov40_022561C0.c +++ b/src/overlay040/ov40_022561C0.c @@ -6,7 +6,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_02026218_decl.h" #include "struct_decls/struct_02026310_decl.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay025/struct_ov25_0225424C_decl.h" #include "overlay040/struct_ov40_0225645C_decl.h" diff --git a/src/overlay044/ov44_022561C0.c b/src/overlay044/ov44_022561C0.c index 31b1fd2276..70731878cc 100644 --- a/src/overlay044/ov44_022561C0.c +++ b/src/overlay044/ov44_022561C0.c @@ -4,8 +4,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay025/struct_ov25_0225424C_decl.h" #include "overlay025/struct_ov25_02255B34_decl.h" diff --git a/src/overlay062/ov62_02239D60.c b/src/overlay062/ov62_02239D60.c index 8238a42029..ec2b688ba9 100644 --- a/src/overlay062/ov62_02239D60.c +++ b/src/overlay062/ov62_02239D60.c @@ -10,7 +10,6 @@ #include "struct_decls/struct_0200C704_decl.h" #include "strbuf.h" #include "struct_decls/struct_02023FCC_decl.h" -#include "struct_defs/pokemon_personal_data.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/overlay062/ov62_02248408.c b/src/overlay062/ov62_02248408.c index f7f7757cb0..bbf4e4f95a 100644 --- a/src/overlay062/ov62_02248408.c +++ b/src/overlay062/ov62_02248408.c @@ -7,7 +7,7 @@ #include "struct_defs/struct_0202F298.h" #include "struct_defs/struct_0202F298_sub1.h" #include "struct_defs/struct_0202F41C.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay006/battle_params.h" #include "unk_02002B7C.h" diff --git a/src/overlay065/ov65_0222DCE0.c b/src/overlay065/ov65_0222DCE0.c index 0a51154919..c2240bfa1b 100644 --- a/src/overlay065/ov65_0222DCE0.c +++ b/src/overlay065/ov65_0222DCE0.c @@ -20,7 +20,7 @@ #include "struct_decls/struct_0202B628_decl.h" #include "struct_decls/struct_0202C878_decl.h" #include "struct_decls/struct_0203068C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay065/struct_ov65_0222EBE0_decl.h" diff --git a/src/overlay066/ov66_0222DDF0.c b/src/overlay066/ov66_0222DDF0.c index ddfb8a3cdb..3a8523f2da 100644 --- a/src/overlay066/ov66_0222DDF0.c +++ b/src/overlay066/ov66_0222DDF0.c @@ -16,7 +16,7 @@ #include "struct_decls/struct_0202C878_decl.h" #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_02030EC4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207E060_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/overlay076/ov76_0223B870.c b/src/overlay076/ov76_0223B870.c index 9403aacfd3..2a0395fa63 100644 --- a/src/overlay076/ov76_0223B870.c +++ b/src/overlay076/ov76_0223B870.c @@ -9,7 +9,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay076/const_ov76_0223EF3C.h" diff --git a/src/overlay076/ov76_0223D338.c b/src/overlay076/ov76_0223D338.c index c41e0b57d4..89869c77fb 100644 --- a/src/overlay076/ov76_0223D338.c +++ b/src/overlay076/ov76_0223D338.c @@ -8,7 +8,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_0202CD88_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay076/const_ov76_0223EF3C.h" diff --git a/src/overlay081/ov81_021D1610.c b/src/overlay081/ov81_021D1610.c index 97accc13e5..78fd750b5d 100644 --- a/src/overlay081/ov81_021D1610.c +++ b/src/overlay081/ov81_021D1610.c @@ -2,7 +2,7 @@ #include #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0202BC58.h" #include "struct_defs/struct_0202BCC8.h" diff --git a/src/overlay086/ov86_0223B140.c b/src/overlay086/ov86_0223B140.c index 3cf23780d6..8a392a3068 100644 --- a/src/overlay086/ov86_0223B140.c +++ b/src/overlay086/ov86_0223B140.c @@ -16,7 +16,7 @@ #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02007C10.h" #include "struct_defs/struct_02008900.h" diff --git a/src/overlay087/ov87_021D106C.c b/src/overlay087/ov87_021D106C.c index d718d3e3b0..8521c11532 100644 --- a/src/overlay087/ov87_021D106C.c +++ b/src/overlay087/ov87_021D106C.c @@ -9,7 +9,7 @@ #include "struct_decls/struct_020218BC_decl.h" #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay087/struct_ov87_021D0D80_decl.h" #include "struct_defs/struct_02008A90.h" diff --git a/src/overlay088/ov88_0223B140.c b/src/overlay088/ov88_0223B140.c index 637ea37dde..6f5bcf3275 100644 --- a/src/overlay088/ov88_0223B140.c +++ b/src/overlay088/ov88_0223B140.c @@ -16,7 +16,7 @@ #include "struct_decls/struct_0202B628_decl.h" #include "struct_decls/struct_0202CC84_decl.h" #include "struct_decls/struct_020507E4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_02095E80_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/overlay094/ov94_0223D0C4.c b/src/overlay094/ov94_0223D0C4.c index 887741fb7a..9a1879b445 100644 --- a/src/overlay094/ov94_0223D0C4.c +++ b/src/overlay094/ov94_0223D0C4.c @@ -9,8 +9,7 @@ #include "struct_decls/struct_0200B358_decl.h" #include "struct_decls/struct_02018340_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay094/const_ov94_02245FD8.h" diff --git a/src/overlay094/ov94_0223DC04.c b/src/overlay094/ov94_0223DC04.c index a461e87a86..aead2b2981 100644 --- a/src/overlay094/ov94_0223DC04.c +++ b/src/overlay094/ov94_0223DC04.c @@ -7,7 +7,7 @@ #include "message.h" #include "struct_decls/struct_02018340_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0205AA50.h" #include "overlay094/struct_ov94_0223BA88.h" diff --git a/src/overlay094/ov94_0223FB48.c b/src/overlay094/ov94_0223FB48.c index e07b9cad2f..70597ded8b 100644 --- a/src/overlay094/ov94_0223FB48.c +++ b/src/overlay094/ov94_0223FB48.c @@ -8,8 +8,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_party_decl.h" diff --git a/src/overlay094/ov94_022414B8.c b/src/overlay094/ov94_022414B8.c index ae7b7a65c2..188e786cd3 100644 --- a/src/overlay094/ov94_022414B8.c +++ b/src/overlay094/ov94_022414B8.c @@ -11,8 +11,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "strbuf.h" #include "struct_decls/struct_02026324_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay094/const_ov94_02245FD8.h" #include "overlay094/const_ov94_02245FD4.h" diff --git a/src/overlay094/ov94_02242AD0.c b/src/overlay094/ov94_02242AD0.c index e29ff34078..db929f33bf 100644 --- a/src/overlay094/ov94_02242AD0.c +++ b/src/overlay094/ov94_02242AD0.c @@ -11,7 +11,7 @@ #include "struct_decls/struct_0202CC84_decl.h" #include "struct_decls/struct_0202DA40_decl.h" #include "struct_decls/struct_020507E4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay084/struct_ov84_0223BA5C.h" #include "overlay094/struct_ov94_0223BA88.h" diff --git a/src/overlay094/ov94_022444C8.c b/src/overlay094/ov94_022444C8.c index b385d02eaf..b6cef3f4ea 100644 --- a/src/overlay094/ov94_022444C8.c +++ b/src/overlay094/ov94_022444C8.c @@ -3,8 +3,7 @@ #include #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0208BE5C.h" #include "overlay094/struct_ov94_0223BA88.h" diff --git a/src/overlay095/ov95_02246C20.c b/src/overlay095/ov95_02246C20.c index 3e7330b521..a8fabca41e 100644 --- a/src/overlay095/ov95_02246C20.c +++ b/src/overlay095/ov95_02246C20.c @@ -9,7 +9,7 @@ #include "struct_decls/struct_020218BC_decl.h" #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay095/struct_ov95_02247004_decl.h" #include "overlay095/struct_ov95_022472C4_decl.h" #include "overlay095/struct_ov95_02247628_decl.h" diff --git a/src/overlay095/ov95_02247B6C.c b/src/overlay095/ov95_02247B6C.c index 3aff935d25..b460a93e47 100644 --- a/src/overlay095/ov95_02247B6C.c +++ b/src/overlay095/ov95_02247B6C.c @@ -10,7 +10,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay095/struct_ov95_02247628_decl.h" #include "overlay095/struct_ov95_0224773C_decl.h" #include "overlay095/struct_ov95_02247958_decl.h" diff --git a/src/overlay095/ov95_0224B3D8.c b/src/overlay095/ov95_0224B3D8.c index ef0c1e221a..e177b8a048 100644 --- a/src/overlay095/ov95_0224B3D8.c +++ b/src/overlay095/ov95_0224B3D8.c @@ -12,7 +12,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay095/struct_ov95_02247628_decl.h" #include "overlay095/struct_ov95_0224773C_decl.h" #include "overlay095/struct_ov95_02247958_decl.h" diff --git a/src/overlay097/ov97_0222D30C.c b/src/overlay097/ov97_0222D30C.c index e7dadad8b2..803f31aef8 100644 --- a/src/overlay097/ov97_0222D30C.c +++ b/src/overlay097/ov97_0222D30C.c @@ -13,7 +13,7 @@ #include "strbuf.h" #include "struct_decls/struct_0202442C_decl.h" #include "struct_decls/struct_02025CCC_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay077/const_ov77_021D742C.h" diff --git a/src/overlay097/ov97_02233B18.c b/src/overlay097/ov97_02233B18.c index cfa128a275..af0da16353 100644 --- a/src/overlay097/ov97_02233B18.c +++ b/src/overlay097/ov97_02233B18.c @@ -26,8 +26,7 @@ #include "struct_defs/struct_020279FC.h" #include "struct_defs/struct_0203CC84.h" #include "struct_defs/struct_0205AA50.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0208BE5C.h" #include "struct_defs/struct_02099F80.h" #include "overlay019/struct_ov19_021DA864.h" diff --git a/src/overlay097/ov97_02236380.c b/src/overlay097/ov97_02236380.c index 5e25bf2de0..9629a7f0c4 100644 --- a/src/overlay097/ov97_02236380.c +++ b/src/overlay097/ov97_02236380.c @@ -2,7 +2,7 @@ #include #include "data_021BF67C.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "overlay097/box_pokemon_gba.h" diff --git a/src/overlay097/ov97_02237694.c b/src/overlay097/ov97_02237694.c index a150f5b8f3..670b7bb2c4 100644 --- a/src/overlay097/ov97_02237694.c +++ b/src/overlay097/ov97_02237694.c @@ -11,7 +11,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "struct_defs/struct_02008A90.h" diff --git a/src/overlay104/ov104_0222DCE0.c b/src/overlay104/ov104_0222DCE0.c index 84596b9bd8..58bd6c5418 100644 --- a/src/overlay104/ov104_0222DCE0.c +++ b/src/overlay104/ov104_0222DCE0.c @@ -7,7 +7,7 @@ #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0202C878_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/overlay104/ov104_0222ECE8.c b/src/overlay104/ov104_0222ECE8.c index c34abbab79..922e0616eb 100644 --- a/src/overlay104/ov104_0222ECE8.c +++ b/src/overlay104/ov104_0222ECE8.c @@ -4,7 +4,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0203041C_decl.h" #include "struct_decls/struct_020305B8_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay104/struct_ov104_0223ADA0.h" diff --git a/src/overlay104/ov104_0222FBE4.c b/src/overlay104/ov104_0222FBE4.c index 8ac6f61f4d..0670456905 100644 --- a/src/overlay104/ov104_0222FBE4.c +++ b/src/overlay104/ov104_0222FBE4.c @@ -17,7 +17,7 @@ #include "struct_decls/struct_0202440C_decl.h" #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0202B370_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay063/struct_ov63_0222BEC0_decl.h" #include "overlay063/struct_ov63_0222D77C_decl.h" diff --git a/src/overlay104/ov104_02231F74.c b/src/overlay104/ov104_02231F74.c index ba4ed20650..35b739406f 100644 --- a/src/overlay104/ov104_02231F74.c +++ b/src/overlay104/ov104_02231F74.c @@ -14,7 +14,7 @@ #include "struct_decls/struct_02013A04_decl.h" #include "struct_decls/struct_0201CD38_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay063/struct_ov63_0222BEC0_decl.h" #include "overlay104/struct_ov104_0222E930_decl.h" #include "overlay104/struct_ov104_022320B4_decl.h" diff --git a/src/overlay104/ov104_022332B4.c b/src/overlay104/ov104_022332B4.c index e2921be4c8..6070f6ef95 100644 --- a/src/overlay104/ov104_022332B4.c +++ b/src/overlay104/ov104_022332B4.c @@ -3,7 +3,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay104/struct_ov104_0222E930_decl.h" #include "constdata/const_020EA358.h" diff --git a/src/overlay104/ov104_022339B4.c b/src/overlay104/ov104_022339B4.c index 4f8e53aa12..9a464f5ff8 100644 --- a/src/overlay104/ov104_022339B4.c +++ b/src/overlay104/ov104_022339B4.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_0203068C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "struct_defs/struct_0202FF58.h" diff --git a/src/overlay104/ov104_02234838.c b/src/overlay104/ov104_02234838.c index 81149892c7..4db5ef1d03 100644 --- a/src/overlay104/ov104_02234838.c +++ b/src/overlay104/ov104_02234838.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_0202440C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay104/struct_ov104_0222E930_decl.h" diff --git a/src/overlay104/ov104_02234DB4.c b/src/overlay104/ov104_02234DB4.c index 17c382545a..bf4a722c1b 100644 --- a/src/overlay104/ov104_02234DB4.c +++ b/src/overlay104/ov104_02234DB4.c @@ -4,7 +4,7 @@ #include "struct_decls/struct_02030114_decl.h" #include "struct_decls/struct_0203026C_decl.h" #include "struct_decls/struct_0203068C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "struct_defs/struct_0204B184.h" diff --git a/src/overlay104/ov104_022358E8.c b/src/overlay104/ov104_022358E8.c index 9b121665ac..67aabc0c84 100644 --- a/src/overlay104/ov104_022358E8.c +++ b/src/overlay104/ov104_022358E8.c @@ -2,7 +2,7 @@ #include #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay104/struct_ov104_0222E930_decl.h" diff --git a/src/overlay104/ov104_022361B4.c b/src/overlay104/ov104_022361B4.c index 1a17d9768c..6e8a89c489 100644 --- a/src/overlay104/ov104_022361B4.c +++ b/src/overlay104/ov104_022361B4.c @@ -8,7 +8,7 @@ #include "struct_decls/struct_020302DC_decl.h" #include "struct_decls/struct_0203041C_decl.h" #include "struct_decls/struct_0203068C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay104/struct_ov104_022320B4_decl.h" diff --git a/src/overlay104/ov104_02237378.c b/src/overlay104/ov104_02237378.c index 88d84f5b41..5fbd7b9959 100644 --- a/src/overlay104/ov104_02237378.c +++ b/src/overlay104/ov104_02237378.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay104/struct_ov104_0222E930_decl.h" #include "overlay104/struct_ov104_022320B4_decl.h" diff --git a/src/overlay104/ov104_02237DD8.c b/src/overlay104/ov104_02237DD8.c index 5d7d2002c1..f4a0c861dc 100644 --- a/src/overlay104/ov104_02237DD8.c +++ b/src/overlay104/ov104_02237DD8.c @@ -4,7 +4,7 @@ #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_020304A0_decl.h" #include "struct_decls/struct_020305B8_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/overlay104/ov104_02239130.c b/src/overlay104/ov104_02239130.c index 9e41373666..b2d9ded3bb 100644 --- a/src/overlay104/ov104_02239130.c +++ b/src/overlay104/ov104_02239130.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_0202440C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay104/struct_ov104_0222E930_decl.h" diff --git a/src/overlay104/ov104_0223A0C4.c b/src/overlay104/ov104_0223A0C4.c index 99eb5768c0..27207483ad 100644 --- a/src/overlay104/ov104_0223A0C4.c +++ b/src/overlay104/ov104_0223A0C4.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/overlay104/ov104_0223A7F4.c b/src/overlay104/ov104_0223A7F4.c index 0a2d45bfa6..7800cb2874 100644 --- a/src/overlay104/ov104_0223A7F4.c +++ b/src/overlay104/ov104_0223A7F4.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0204B184.h" #include "struct_defs/struct_0204B1E8.h" diff --git a/src/overlay104/ov104_0223AF58.c b/src/overlay104/ov104_0223AF58.c index 4d533914ab..bfca71473a 100644 --- a/src/overlay104/ov104_0223AF58.c +++ b/src/overlay104/ov104_0223AF58.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0204B184.h" diff --git a/src/overlay104/ov104_0223B6F4.c b/src/overlay104/ov104_0223B6F4.c index 3dea0f9dd2..c261d42f34 100644 --- a/src/overlay104/ov104_0223B6F4.c +++ b/src/overlay104/ov104_0223B6F4.c @@ -6,7 +6,7 @@ #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0203068C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0204B184.h" diff --git a/src/overlay104/ov104_0223BCBC.c b/src/overlay104/ov104_0223BCBC.c index 00443e1f6d..d97948129b 100644 --- a/src/overlay104/ov104_0223BCBC.c +++ b/src/overlay104/ov104_0223BCBC.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0204B184.h" diff --git a/src/overlay105/ov105_02241AE0.c b/src/overlay105/ov105_02241AE0.c index 519e15e94d..4faf8904db 100644 --- a/src/overlay105/ov105_02241AE0.c +++ b/src/overlay105/ov105_02241AE0.c @@ -15,8 +15,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay105/struct_ov105_02241FF4_decl.h" diff --git a/src/overlay105/ov105_02245CD0.c b/src/overlay105/ov105_02245CD0.c index 3a4ea0cb59..0ac9752a0c 100644 --- a/src/overlay105/ov105_02245CD0.c +++ b/src/overlay105/ov105_02245CD0.c @@ -3,7 +3,7 @@ #include "struct_decls/struct_02007768_decl.h" #include "struct_decls/struct_02007C7C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02008A90.h" diff --git a/src/overlay106/ov106_02241AE0.c b/src/overlay106/ov106_02241AE0.c index b719f3364d..31b60d1841 100644 --- a/src/overlay106/ov106_02241AE0.c +++ b/src/overlay106/ov106_02241AE0.c @@ -14,7 +14,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay106/struct_ov106_02243118_decl.h" diff --git a/src/overlay106/ov106_02243310.c b/src/overlay106/ov106_02243310.c index 21d2bd0c5e..0f86c45127 100644 --- a/src/overlay106/ov106_02243310.c +++ b/src/overlay106/ov106_02243310.c @@ -3,7 +3,7 @@ #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay019/struct_ov19_021DA864.h" #include "overlay022/struct_ov22_022559F8.h" diff --git a/src/overlay106/ov106_022435FC.c b/src/overlay106/ov106_022435FC.c index c9ff1db132..b7fd384ffd 100644 --- a/src/overlay106/ov106_022435FC.c +++ b/src/overlay106/ov106_022435FC.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay106/struct_ov106_02243650_decl.h" #include "overlay106/struct_ov106_02243310.h" diff --git a/src/overlay107/ov107_02241AE0.c b/src/overlay107/ov107_02241AE0.c index 3844fb2347..309ac10df9 100644 --- a/src/overlay107/ov107_02241AE0.c +++ b/src/overlay107/ov107_02241AE0.c @@ -18,8 +18,7 @@ #include "struct_decls/struct_020302DC_decl.h" #include "struct_decls/struct_0203041C_decl.h" #include "struct_decls/struct_0203068C_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay107/struct_ov107_02241D6C_decl.h" diff --git a/src/overlay107/ov107_02245EB0.c b/src/overlay107/ov107_02245EB0.c index f7befc32cf..91fe7fcf83 100644 --- a/src/overlay107/ov107_02245EB0.c +++ b/src/overlay107/ov107_02245EB0.c @@ -18,8 +18,7 @@ #include "struct_decls/struct_020302DC_decl.h" #include "struct_decls/struct_0203041C_decl.h" #include "struct_decls/struct_0203068C_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay107/struct_ov107_02246170_decl.h" diff --git a/src/overlay107/ov107_02249604.c b/src/overlay107/ov107_02249604.c index e717bb005e..93b530ca2d 100644 --- a/src/overlay107/ov107_02249604.c +++ b/src/overlay107/ov107_02249604.c @@ -4,7 +4,7 @@ #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_02009DC8_decl.h" #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay019/struct_ov19_021DA864.h" diff --git a/src/overlay107/ov107_02249B1C.c b/src/overlay107/ov107_02249B1C.c index ab4d8856f9..5633d896ee 100644 --- a/src/overlay107/ov107_02249B1C.c +++ b/src/overlay107/ov107_02249B1C.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay107/struct_ov107_02249B8C_decl.h" #include "overlay107/struct_ov107_02249954.h" diff --git a/src/overlay108/ov108_02241AE0.c b/src/overlay108/ov108_02241AE0.c index 8aa0f4fdee..9d8cce16c1 100644 --- a/src/overlay108/ov108_02241AE0.c +++ b/src/overlay108/ov108_02241AE0.c @@ -16,7 +16,7 @@ #include "struct_decls/struct_020304A0_decl.h" #include "struct_decls/struct_020305B8_decl.h" #include "struct_decls/struct_0203068C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay108/struct_ov108_02241DB0_decl.h" diff --git a/src/overlay108/ov108_02243030.c b/src/overlay108/ov108_02243030.c index 45e2f54e2b..ff4a45a9f5 100644 --- a/src/overlay108/ov108_02243030.c +++ b/src/overlay108/ov108_02243030.c @@ -3,7 +3,7 @@ #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "overlay019/struct_ov19_021DA864.h" diff --git a/src/overlay108/ov108_0224351C.c b/src/overlay108/ov108_0224351C.c index 28d86d9948..8237263cec 100644 --- a/src/overlay108/ov108_0224351C.c +++ b/src/overlay108/ov108_0224351C.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay108/struct_ov108_02243594_decl.h" #include "overlay108/struct_ov108_02243030.h" diff --git a/src/overlay109/ov109_021D0D80.c b/src/overlay109/ov109_021D0D80.c index 62d2f3c2e4..6829167d5a 100644 --- a/src/overlay109/ov109_021D0D80.c +++ b/src/overlay109/ov109_021D0D80.c @@ -15,7 +15,7 @@ #include "struct_decls/struct_020203AC_decl.h" #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0200D0F4.h" diff --git a/src/overlay113/ov113_0225C700.c b/src/overlay113/ov113_0225C700.c index 5391627380..c6fe5abf8e 100644 --- a/src/overlay113/ov113_0225C700.c +++ b/src/overlay113/ov113_0225C700.c @@ -18,7 +18,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_020203AC_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/overlay118/ov118_021D0D80.c b/src/overlay118/ov118_021D0D80.c index e1fddd18b2..c6705ab370 100644 --- a/src/overlay118/ov118_021D0D80.c +++ b/src/overlay118/ov118_021D0D80.c @@ -6,7 +6,7 @@ #include "struct_decls/struct_02014014_decl.h" #include "struct_decls/struct_020203AC_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0207F248.h" diff --git a/src/overlay119/ov119_021D0D80.c b/src/overlay119/ov119_021D0D80.c index 4a57603049..479eb63e86 100644 --- a/src/overlay119/ov119_021D0D80.c +++ b/src/overlay119/ov119_021D0D80.c @@ -10,8 +10,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_020203AC_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02007C10.h" #include "struct_defs/struct_02008A90.h" diff --git a/src/party.c b/src/party.c index 5849ea4bbc..1da1d404fb 100644 --- a/src/party.c +++ b/src/party.c @@ -3,7 +3,7 @@ #include "struct_decls/struct_021C0794_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_party.h" #include "heap.h" diff --git a/src/pokemon.c b/src/pokemon.c index eacc7ce902..112aa3e68b 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -19,11 +19,7 @@ #include "struct_defs/struct_0200D0F4.h" #include "struct_defs/struct_0202818C.h" #include "struct_defs/struct_0202CA28.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" -#include "struct_defs/party_pokemon.h" -#include "struct_defs/pokemon_personal_data.h" -#include "struct_defs/pokemon_evolution_data.h" +#include "pokemon.h" #include "struct_defs/struct_020789BC.h" #include "struct_defs/struct_020789F4.h" #include "struct_defs/struct_02078B40.h" @@ -89,6 +85,16 @@ static const s8 sNatureFlavorAffinities[][5] = { { 0x0, 0x0, 0x0, 0x0, 0x0 }, }; +typedef struct PokemonEvolutionMethod { + u16 type; + u16 param; + u16 targetSpecies; +} PokemonEvolutionMethod; + +typedef struct PokemonEvolutionData { + PokemonEvolutionMethod methods[7]; +} PokemonEvolutionData; + static enum PokemonDataBlockID { DATA_BLOCK_A = 0, DATA_BLOCK_B, diff --git a/src/roaming_pokemon.c b/src/roaming_pokemon.c index 3173eb8f6c..be9c357f94 100644 --- a/src/roaming_pokemon.c +++ b/src/roaming_pokemon.c @@ -6,7 +6,7 @@ #include "constants/species.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "struct_defs/struct_0202D7B0.h" diff --git a/src/unk_0200B358.c b/src/unk_0200B358.c index 683b0c7e3b..89303f4a2b 100644 --- a/src/unk_0200B358.c +++ b/src/unk_0200B358.c @@ -7,7 +7,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0202B4A0_decl.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/unk_0200DA60.c b/src/unk_0200DA60.c index 98b072295f..a1df00dc08 100644 --- a/src/unk_0200DA60.c +++ b/src/unk_0200DA60.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_02009DC8_decl.h" #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_0201CD38_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02008A90.h" #include "struct_defs/struct_0200D0F4.h" diff --git a/src/unk_020261E4.c b/src/unk_020261E4.c index f40fb577e3..1703e3776e 100644 --- a/src/unk_020261E4.c +++ b/src/unk_020261E4.c @@ -4,7 +4,7 @@ #include "struct_decls/struct_021C0794_decl.h" #include "struct_defs/struct_0202818C.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "unk_020244AC.h" #include "unk_020261E4.h" diff --git a/src/unk_0202631C.c b/src/unk_0202631C.c index 979beba0c0..b45f563b4d 100644 --- a/src/unk_0202631C.c +++ b/src/unk_0202631C.c @@ -3,7 +3,7 @@ #include "inlines.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "heap.h" diff --git a/src/unk_02028124.c b/src/unk_02028124.c index 931af34f51..aa0a7c6677 100644 --- a/src/unk_02028124.c +++ b/src/unk_02028124.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/unk_020298BC.c b/src/unk_020298BC.c index 4313a33b5a..c26113e135 100644 --- a/src/unk_020298BC.c +++ b/src/unk_020298BC.c @@ -4,7 +4,7 @@ #include "inlines.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "struct_defs/struct_02014A84.h" diff --git a/src/unk_0202DA40.c b/src/unk_0202DA40.c index 0d50ec7f53..0d57b630dd 100644 --- a/src/unk_0202DA40.c +++ b/src/unk_0202DA40.c @@ -1,7 +1,7 @@ #include #include -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "unk_020244AC.h" diff --git a/src/unk_0202DF8C.c b/src/unk_0202DF8C.c index c527becb2b..53e64e2828 100644 --- a/src/unk_0202DF8C.c +++ b/src/unk_0202DF8C.c @@ -4,7 +4,7 @@ #include "inlines.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0202DF8C.h" diff --git a/src/unk_0202EEC0.c b/src/unk_0202EEC0.c index 76bbe443ab..0878bc054d 100644 --- a/src/unk_0202EEC0.c +++ b/src/unk_0202EEC0.c @@ -1,8 +1,7 @@ #include #include -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "unk_0201378C.h" #include "unk_0202EEC0.h" diff --git a/src/unk_0202F180.c b/src/unk_0202F180.c index a07f43509b..f8b6e8a9d1 100644 --- a/src/unk_0202F180.c +++ b/src/unk_0202F180.c @@ -2,8 +2,7 @@ #include #include "struct_decls/struct_02026324_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "unk_0202631C.h" diff --git a/src/unk_0202F1D4.c b/src/unk_0202F1D4.c index 2fe5407d79..0c844e780a 100644 --- a/src/unk_0202F1D4.c +++ b/src/unk_0202F1D4.c @@ -12,7 +12,7 @@ #include "struct_defs/struct_0202FAA8.h" #include "struct_defs/struct_0202FD30.h" #include "struct_defs/struct_02030A80.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02078B40.h" #include "struct_defs/struct_party.h" #include "overlay006/battle_params.h" diff --git a/src/unk_0203A9C8.c b/src/unk_0203A9C8.c index df8f65406b..c898f8b5d9 100644 --- a/src/unk_0203A9C8.c +++ b/src/unk_0203A9C8.c @@ -10,7 +10,7 @@ #include "struct_decls/struct_02026324_decl.h" #include "struct_decls/struct_020507E4_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207AE68_decl.h" #include "struct_decls/struct_0207CB08_decl.h" diff --git a/src/unk_0203D1B8.c b/src/unk_0203D1B8.c index d86e7189a2..6df0537a5d 100644 --- a/src/unk_0203D1B8.c +++ b/src/unk_0203D1B8.c @@ -13,7 +13,7 @@ #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_020507E4_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207AE68_decl.h" #include "struct_decls/struct_0207D3C0_decl.h" diff --git a/src/unk_0203F6C4.c b/src/unk_0203F6C4.c index fd889ff8c0..3ffb4ec03f 100644 --- a/src/unk_0203F6C4.c +++ b/src/unk_0203F6C4.c @@ -33,8 +33,7 @@ #include "struct_decls/struct_0205E884_decl.h" #include "struct_decls/struct_02061830_decl.h" #include "struct_decls/struct_02061AB4_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/unk_02046C7C.c b/src/unk_02046C7C.c index 8a35ca8c4f..7a0a83cb43 100644 --- a/src/unk_02046C7C.c +++ b/src/unk_02046C7C.c @@ -7,7 +7,7 @@ #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0203E724_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0203CDB0_sub2_t.h" #include "struct_defs/struct_0203E724_t.h" diff --git a/src/unk_020474B8.c b/src/unk_020474B8.c index 214ed80d0f..b57d925970 100644 --- a/src/unk_020474B8.c +++ b/src/unk_020474B8.c @@ -8,8 +8,7 @@ #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0203E724_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_defs/struct_0203CDB0.h" diff --git a/src/unk_020480A8.c b/src/unk_020480A8.c index 23180542bf..5972ebfc8a 100644 --- a/src/unk_020480A8.c +++ b/src/unk_020480A8.c @@ -5,8 +5,7 @@ #include "struct_decls/struct_0203E724_decl.h" #include "struct_decls/struct_020507E4_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_defs/struct_0203CDB0.h" diff --git a/src/unk_02048DD8.c b/src/unk_02048DD8.c index 7f7c37c4c8..3f1803f635 100644 --- a/src/unk_02048DD8.c +++ b/src/unk_02048DD8.c @@ -10,7 +10,7 @@ #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_0203E724_decl.h" #include "struct_decls/struct_02056B24_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_0202E7D8.h" diff --git a/src/unk_02049D08.c b/src/unk_02049D08.c index bac7ef8bee..a75a58a8a4 100644 --- a/src/unk_02049D08.c +++ b/src/unk_02049D08.c @@ -12,7 +12,7 @@ #include "struct_decls/struct_0202D764_decl.h" #include "struct_decls/struct_0203068C_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/unk_0204AEE8.c b/src/unk_0204AEE8.c index 01625a2c6e..06ef125f19 100644 --- a/src/unk_0204AEE8.c +++ b/src/unk_0204AEE8.c @@ -8,7 +8,7 @@ #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_02026324_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/unk_0204B830.c b/src/unk_0204B830.c index f3b138d2d1..3fb3857efa 100644 --- a/src/unk_0204B830.c +++ b/src/unk_0204B830.c @@ -9,7 +9,7 @@ #include "struct_decls/struct_0203E724_decl.h" #include "struct_decls/struct_020507E4_decl.h" #include "struct_decls/struct_02056B24_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207D3C0_decl.h" diff --git a/src/unk_0204C500.c b/src/unk_0204C500.c index 08ad07b566..b82192889e 100644 --- a/src/unk_0204C500.c +++ b/src/unk_0204C500.c @@ -8,7 +8,7 @@ #include "struct_decls/struct_02026324_decl.h" #include "struct_decls/struct_0203E724_decl.h" #include "struct_decls/struct_020507E4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_defs/struct_0203E724_t.h" diff --git a/src/unk_0204CFFC.c b/src/unk_0204CFFC.c index 5635304fa0..f4998248f2 100644 --- a/src/unk_0204CFFC.c +++ b/src/unk_0204CFFC.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0203E724_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_party_decl.h" diff --git a/src/unk_0204EDA4.c b/src/unk_0204EDA4.c index 751b6efd6e..0672b431d7 100644 --- a/src/unk_0204EDA4.c +++ b/src/unk_0204EDA4.c @@ -4,7 +4,7 @@ #include "inlines.h" #include "struct_decls/struct_0203E724_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0203E724_t.h" #include "struct_defs/struct_020997B8.h" diff --git a/src/unk_0204F13C.c b/src/unk_0204F13C.c index 5ce4d39a1e..bfbe4fce46 100644 --- a/src/unk_0204F13C.c +++ b/src/unk_0204F13C.c @@ -10,7 +10,7 @@ #include "struct_decls/struct_020308A0_decl.h" #include "struct_decls/struct_0203E724_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/unk_02050A74.c b/src/unk_02050A74.c index fd02d202f5..5d42bc8df6 100644 --- a/src/unk_02050A74.c +++ b/src/unk_02050A74.c @@ -8,7 +8,7 @@ #include "struct_decls/struct_0202440C_decl.h" #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_020797DC_decl.h" #include "struct_decls/struct_party_decl.h" diff --git a/src/unk_02051D8C.c b/src/unk_02051D8C.c index 10f53115dc..a612357999 100644 --- a/src/unk_02051D8C.c +++ b/src/unk_02051D8C.c @@ -10,7 +10,7 @@ #include "struct_decls/struct_0202B628_decl.h" #include "struct_decls/struct_0202CC84_decl.h" #include "struct_decls/struct_0203A790_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207D3C0_decl.h" #include "struct_decls/struct_0207D99C_decl.h" diff --git a/src/unk_02054884.c b/src/unk_02054884.c index b76aa562de..ddcaeb4dff 100644 --- a/src/unk_02054884.c +++ b/src/unk_02054884.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/unk_020562F8.c b/src/unk_020562F8.c index db1adb61c3..e694b4e1f9 100644 --- a/src/unk_020562F8.c +++ b/src/unk_020562F8.c @@ -6,7 +6,7 @@ #include "struct_decls/struct_02024440_decl.h" #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_020564B4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0203CDB0.h" #include "overlay006/battle_params.h" diff --git a/src/unk_02056720.c b/src/unk_02056720.c index d976d8c42b..ffa186dc3b 100644 --- a/src/unk_02056720.c +++ b/src/unk_02056720.c @@ -1,7 +1,7 @@ #include #include -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "unk_020244AC.h" diff --git a/src/unk_0205A0D8.c b/src/unk_0205A0D8.c index 14acdfa0e4..6d51271ff4 100644 --- a/src/unk_0205A0D8.c +++ b/src/unk_0205A0D8.c @@ -9,7 +9,7 @@ #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/unk_0205DFC4.c b/src/unk_0205DFC4.c index 86f42dfe4e..1367eab11f 100644 --- a/src/unk_0205DFC4.c +++ b/src/unk_0205DFC4.c @@ -4,7 +4,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_020508D4_decl.h" #include "struct_decls/struct_02061AB4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/unk_0206C660.c b/src/unk_0206C660.c index b08558f62f..818c755720 100644 --- a/src/unk_0206C660.c +++ b/src/unk_0206C660.c @@ -2,7 +2,7 @@ #include #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "overlay006/struct_ov6_02246204_decl.h" #include "struct_defs/struct_0203CDB0.h" diff --git a/src/unk_0206CCB0.c b/src/unk_0206CCB0.c index 027cc866ab..9031bea118 100644 --- a/src/unk_0206CCB0.c +++ b/src/unk_0206CCB0.c @@ -14,8 +14,7 @@ #include "struct_decls/struct_0202A750_decl.h" #include "struct_decls/struct_0202B4A0_decl.h" #include "struct_decls/struct_020507E4_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_021C0794_decl.h" #include "overlay006/struct_ov6_022465F4_decl.h" diff --git a/src/unk_0207064C.c b/src/unk_0207064C.c index d6344ec0b1..89b054942d 100644 --- a/src/unk_0207064C.c +++ b/src/unk_0207064C.c @@ -3,7 +3,7 @@ #include "struct_decls/struct_0201CD38_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0203CDB0.h" #include "struct_defs/struct_02049FA8.h" diff --git a/src/unk_020722AC.c b/src/unk_020722AC.c index 7858373f5c..8d930b0fd6 100644 --- a/src/unk_020722AC.c +++ b/src/unk_020722AC.c @@ -13,7 +13,7 @@ #include "strbuf.h" #include "struct_decls/struct_02028430_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207D3C0_decl.h" #include "struct_decls/struct_021C0794_decl.h" diff --git a/src/unk_02079170.c b/src/unk_02079170.c index 63abafae73..d60d469f33 100644 --- a/src/unk_02079170.c +++ b/src/unk_02079170.c @@ -4,7 +4,7 @@ #include "constants/trainer.h" #include "struct_decls/struct_02006C24_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "struct_defs/trainer_data.h" diff --git a/src/unk_020797C8.c b/src/unk_020797C8.c index 2e7f3f49da..91fc4cbb1a 100644 --- a/src/unk_020797C8.c +++ b/src/unk_020797C8.c @@ -1,8 +1,6 @@ #include #include -#include "struct_defs/box_pokemon.h" - #include "message.h" #include "strbuf.h" #include "unk_020244AC.h" diff --git a/src/unk_02079D40.c b/src/unk_02079D40.c index f43d2f778e..d7a372c21b 100644 --- a/src/unk_02079D40.c +++ b/src/unk_02079D40.c @@ -1,8 +1,7 @@ #include #include -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "pokemon.h" #include "unk_02079D40.h" diff --git a/src/unk_0207A2A8.c b/src/unk_0207A2A8.c index 99d41f2aa8..8173892a27 100644 --- a/src/unk_0207A2A8.c +++ b/src/unk_0207A2A8.c @@ -1,7 +1,7 @@ #include #include -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_02098700_decl.h" diff --git a/src/unk_0207AE68.c b/src/unk_0207AE68.c index dbab447297..2c1fa3b061 100644 --- a/src/unk_0207AE68.c +++ b/src/unk_0207AE68.c @@ -9,7 +9,7 @@ #include "struct_decls/struct_02026324_decl.h" #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_02056B24_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_decls/struct_0207AE68_decl.h" #include "struct_decls/struct_0207D3C0_decl.h" diff --git a/src/unk_0207E0B8.c b/src/unk_0207E0B8.c index 896863b351..26a701abd1 100644 --- a/src/unk_0207E0B8.c +++ b/src/unk_0207E0B8.c @@ -7,7 +7,7 @@ #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_02018340_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "constdata/const_020F1E88.h" diff --git a/src/unk_020819DC.c b/src/unk_020819DC.c index a9f4799816..ea2dc1ad10 100644 --- a/src/unk_020819DC.c +++ b/src/unk_020819DC.c @@ -3,7 +3,7 @@ #include "struct_decls/struct_02018340_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0201D738.h" #include "struct_defs/struct_0205AA50.h" diff --git a/src/unk_02082C2C.c b/src/unk_02082C2C.c index eb12fe70a3..64660c9bea 100644 --- a/src/unk_02082C2C.c +++ b/src/unk_02082C2C.c @@ -3,7 +3,7 @@ #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_02022550_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0200C738.h" #include "struct_defs/struct_0207F248.h" diff --git a/src/unk_02083370.c b/src/unk_02083370.c index ba11ea36a5..dc265bec0d 100644 --- a/src/unk_02083370.c +++ b/src/unk_02083370.c @@ -3,7 +3,7 @@ #include "data_021BF67C.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0200D0F4.h" #include "struct_defs/struct_0203CDB0.h" diff --git a/src/unk_02084B70.c b/src/unk_02084B70.c index da6bbceb5c..9a9c7665a8 100644 --- a/src/unk_02084B70.c +++ b/src/unk_02084B70.c @@ -4,7 +4,7 @@ #include "data_021BF67C.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0203CDB0.h" #include "struct_defs/struct_0207F248.h" diff --git a/src/unk_0208694C.c b/src/unk_0208694C.c index f087ee19ea..50493064eb 100644 --- a/src/unk_0208694C.c +++ b/src/unk_0208694C.c @@ -14,7 +14,7 @@ #include "struct_decls/struct_020218BC_decl.h" #include "struct_decls/struct_02022550_decl.h" #include "strbuf.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_02087A10_decl.h" #include "constdata/const_020F2DAC.h" diff --git a/src/unk_0208C324.c b/src/unk_0208C324.c index 2f9ca2c119..d85f24b2c1 100644 --- a/src/unk_0208C324.c +++ b/src/unk_0208C324.c @@ -7,8 +7,7 @@ #include "struct_decls/struct_02006C24_decl.h" #include "struct_decls/struct_02018340_decl.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "constdata/const_020F410C.h" diff --git a/src/unk_0208FCF8.c b/src/unk_0208FCF8.c index 9c352e6cba..859dfc67b3 100644 --- a/src/unk_0208FCF8.c +++ b/src/unk_0208FCF8.c @@ -1,7 +1,7 @@ #include #include -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_0205AA50.h" #include "struct_defs/struct_0208D7BC.h" diff --git a/src/unk_02092494.c b/src/unk_02092494.c index dc10f75fb4..f6f7d0e39a 100644 --- a/src/unk_02092494.c +++ b/src/unk_02092494.c @@ -4,8 +4,7 @@ #include "strbuf.h" #include "struct_decls/struct_02025E6C_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02090800.h" #include "message.h" diff --git a/src/unk_020933F8.c b/src/unk_020933F8.c index 2eb0ca0096..056089dab0 100644 --- a/src/unk_020933F8.c +++ b/src/unk_020933F8.c @@ -15,8 +15,7 @@ #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_020507E4_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" -#include "struct_defs/box_pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "constdata/const_020F55EC.h" diff --git a/src/unk_02094EDC.c b/src/unk_02094EDC.c index 00d6728184..1d2d90c62a 100644 --- a/src/unk_02094EDC.c +++ b/src/unk_02094EDC.c @@ -3,8 +3,10 @@ #include "struct_decls/struct_02007768_decl.h" #include "struct_decls/struct_02007C7C_decl.h" +#include "strbuf.h" +#include "pokemon.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_02008A90.h" #include "struct_defs/struct_020951B0.h" #include "struct_defs/struct_020954F0.h" diff --git a/src/unk_02096420.c b/src/unk_02096420.c index 9bdea05ac1..ef711044b6 100644 --- a/src/unk_02096420.c +++ b/src/unk_02096420.c @@ -1,7 +1,7 @@ #include #include -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "heap.h" diff --git a/src/unk_02097624.c b/src/unk_02097624.c index d91c3f1f8a..56ab8368e0 100644 --- a/src/unk_02097624.c +++ b/src/unk_02097624.c @@ -3,7 +3,7 @@ #include "struct_decls/struct_020067E8_decl.h" #include "struct_decls/struct_02028430_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "struct_defs/struct_02014A84.h" diff --git a/src/unk_02097B18.c b/src/unk_02097B18.c index 7a5a607a62..ed782d6e2d 100644 --- a/src/unk_02097B18.c +++ b/src/unk_02097B18.c @@ -4,7 +4,7 @@ #include "struct_decls/struct_020067E8_decl.h" #include "struct_decls/struct_0202440C_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "constdata/const_020F1E88.h" diff --git a/src/unk_02098218.c b/src/unk_02098218.c index f7b14b7da3..2fbb8979dd 100644 --- a/src/unk_02098218.c +++ b/src/unk_02098218.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_02025E6C_decl.h" #include "struct_decls/struct_0202CD88_decl.h" #include "struct_decls/struct_020508D4_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "constdata/const_020F2DAC.h" #include "constdata/const_020F67FC.h" diff --git a/src/unk_020989DC.c b/src/unk_020989DC.c index 5dcdc24450..6dfafd2605 100644 --- a/src/unk_020989DC.c +++ b/src/unk_020989DC.c @@ -5,7 +5,7 @@ #include "struct_decls/struct_020067E8_decl.h" #include "struct_decls/struct_0200B358_decl.h" -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_021C0794_decl.h" #include "constdata/const_020F1E88.h" diff --git a/src/unk_020997B8.c b/src/unk_020997B8.c index d1474b667f..4e0ae0dd1d 100644 --- a/src/unk_020997B8.c +++ b/src/unk_020997B8.c @@ -1,7 +1,7 @@ #include #include -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_defs/struct_020997B8.h" diff --git a/src/unk_0209BA80.c b/src/unk_0209BA80.c index efd0062dd2..681ef11814 100644 --- a/src/unk_0209BA80.c +++ b/src/unk_0209BA80.c @@ -1,7 +1,7 @@ #include #include -#include "struct_defs/pokemon.h" +#include "pokemon.h" #include "struct_decls/struct_party_decl.h" #include "struct_defs/struct_02039A58.h" From b7ae7f24e91b36bae6910414a398bacc84b4a29c Mon Sep 17 00:00:00 2001 From: wildfire Date: Mon, 11 Sep 2023 16:58:45 +0100 Subject: [PATCH 09/11] Misc. cleanup in `pokemon.h` and `pokemon.c` --- include/pokemon.h | 79 -------------------------------------------- src/pokemon.c | 83 ++++++++++++++++++++++++++++++----------------- 2 files changed, 53 insertions(+), 109 deletions(-) diff --git a/include/pokemon.h b/include/pokemon.h index 5072ed123e..42c384a1b0 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -393,14 +393,6 @@ u8 GetMonPercentToNextLevel(Pokemon *mon); */ u32 GetMonExpToNextLevel(Pokemon *mon); -/** - * @brief Gets how much experience is needed for the given BoxPokemon to level up - * - * @param boxMon - * @return The amount of exp. needed for the given BoxPokemon to level up - */ -u32 GetBoxMonExpToNextLevel(BoxPokemon *boxMon); - /** * @brief Gets the amount of expeirence needed for the given Pokemon to reach its current level * @@ -531,14 +523,6 @@ u8 GetMonPersonalDataGender(PokemonPersonalData *monPersonalData, u16 unused_mon */ u8 GetMonShininess(Pokemon *mon); -/** - * @brief Gets whether a BoxPokemon is shiny based on its Original Trainer ID and its personality value - * - * @param boxMon - * @return Whether the pokemon is shiny or not - */ -u8 GetBoxMonShininess(BoxPokemon *boxMon); - /** * @brief Gets whether a pokemon is shiny based on its Original Trainer ID and its personality value * @@ -614,13 +598,6 @@ u16 sub_02076B94(Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int * u16 sub_02076F84(const u16 monSpecies); u16 sub_02076FD4(const u16 monSpecies); -/** - * @brief Sets the moveset of a BoxPokemon to the highest 4 available to that pokemon in its level up movelist - * - * @param boxMon - */ -void SetBoxMonDefaultMoves(BoxPokemon *boxMon); - /** * @brief Adds a move to the moveset of a Pokemon * @@ -630,15 +607,6 @@ void SetBoxMonDefaultMoves(BoxPokemon *boxMon); */ u16 AddMonMove(Pokemon *mon, u16 moveID); -/** - * @brief Adds a move to the moveset of a BoxPokemon - * - * @param boxMon - * @param moveID - * @return u16 - */ -u16 AddBoxMonMove(BoxPokemon *boxMon, u16 moveID); - /** * @brief Deletes the first move of a Pokemon and adds the given move to the end of its moveset * @@ -647,14 +615,6 @@ u16 AddBoxMonMove(BoxPokemon *boxMon, u16 moveID); */ void ReplaceMonMove(Pokemon *mon, u16 moveID); -/** - * @brief Deletes the first move of a BoxPokemon and adds the given move to the end of its moveset - * - * @param boxMon - * @param moveID - */ -void ReplaceBoxMonMove(BoxPokemon *boxMon, u16 moveID); - /** * @brief Sets the given moveSlot of a Pokemon, removing its PP Ups * @@ -673,15 +633,6 @@ void ResetMonMove(Pokemon *mon, u16 moveID, u8 moveSlot); */ void SetMonMove(Pokemon *mon, u16 moveID, u8 moveSlot); -/** - * @brief Sets the given moveSlot of a BoxPokemon, retaining the PP Ups for that slot - * - * @param boxMon - * @param moveID - * @param moveSlot - */ -void SetBoxMonMove(BoxPokemon *boxMon, u16 moveID, u8 moveSlot); - u16 sub_0207727C(Pokemon *mon, int *index, u16 *moveID); /** @@ -710,15 +661,6 @@ void SwapBoxMonMoves(BoxPokemon *boxMon, int moveSlot1, int moveSlot2); */ void DeleteMonMove(Pokemon *mon, u32 moveSlot); -/** - * @brief Checks whether a Pokemon has a given move - * - * @param mon - * @param moveID - * @return Whether the given Pokemon has the given move - */ -BOOL MonHasMove(Pokemon *mon, u16 moveID); - void sub_020774C8(BoxPokemon *boxMon, Pokemon *mon); /** @@ -744,15 +686,6 @@ void sub_02077618(Pokemon *src, BoxPokemon *dest); */ s8 GetMonFlavorAffinity(Pokemon *mon, int flavor); -/** - * @brief Gets the affinitiy of a given BoxPokemon to a given flavor - * - * @param boxMon - * @param flavor - * @return 1 if liked flavor, -1 if disliked flavor, else 0 - */ -s8 GetBoxMonFlavorAffinity(BoxPokemon *boxMon, int flavor); - /** * @brief Gets the affinitiy of a given Pokemon personality to a given flavor * @@ -777,9 +710,7 @@ u8 sub_02077758(Party *party, u8 param1); void sub_020777B4(Party *party, s32 param1); void sub_0207782C(Party *party); BOOL sub_020778D8(Pokemon *mon); -BOOL sub_020778E0(BoxPokemon *boxMon); BOOL sub_020778F8(Pokemon *mon); -BOOL sub_02077900(BoxPokemon *boxMon); /** * @brief Sets Arceus' form based on its held item. Has no effect if the given Pokemon is not an Arceus @@ -902,12 +833,9 @@ void sub_02077D3C(UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int pa void sub_02077DB4(UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7, u8 param8); BOOL sub_02077E3C(Pokemon *mon); void sub_02077E64(Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); -void sub_02077EA4(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); void sub_02077EE4(Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); -void sub_02077EF8(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); void sub_02077F0C(Pokemon *mon, u32 param1, int param2); BOOL CanMonLearnTM(Pokemon *mon, u8 tmID); -BOOL CanBoxMonLearnTM(BoxPokemon *boxMon, u8 tmID); BOOL CanMonSpeciesLearnTM(u16 monSpecies, int monForm, u8 tmID); /** @@ -917,13 +845,6 @@ BOOL CanMonSpeciesLearnTM(u16 monSpecies, int monForm, u8 tmID); */ void CalculateMonAbility(Pokemon *mon); -/** - * @brief Sets the ability of a BoxPokemon based on its species, form and peronsality value - * - * @param boxMon - */ -void CalculateBoxMonAbility(BoxPokemon *boxMon); - void sub_020780C4(Pokemon *mon, u32 monPersonality); /** diff --git a/src/pokemon.c b/src/pokemon.c index 112aa3e68b..a68b398cc5 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -109,9 +109,26 @@ static void SetMonDataAttribute(Pokemon *mon, enum PokemonDataParam param, const static void SetBoxMonDataAttribute(BoxPokemon *boxMon, enum PokemonDataParam param, const void *value); static void IncreaseMonDataAttribute(Pokemon *mon, enum PokemonDataParam param, int value); static void IncreaseBoxMonDataAttribute(BoxPokemon *boxMon, enum PokemonDataParam param, int value); +static u32 GetBoxMonExpToNextLevel(BoxPokemon *boxMon); +static void LoadMonExperienceTable (int monExpRate, u32 *monExpTable); static u32 GetMonExpRateLevelExp(int monExpRate, int monLevel); static u16 GetNatureAdjustedStatValue(u8 monNature, u16 monStatValue, u8 statType); +static u8 GetBoxMonShininess(BoxPokemon *boxMon); static inline BOOL IsMonPersonalityShiny(u32 monOTID, u32 monPersonality); +static void sub_02076300(UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); +static u8 sub_020767BC(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality); +static void SetBoxMonDefaultMoves(BoxPokemon *boxMon); +static u16 AddBoxMonMove(BoxPokemon *boxMon, u16 moveID); +static void ReplaceBoxMonMove(BoxPokemon *boxMon, u16 moveID); +static void SetBoxMonMove(BoxPokemon *boxMon, u16 moveID, u8 moveSlot); +static BOOL MonHasMove(Pokemon *mon, u16 moveID); +static s8 GetBoxMonFlavorAffinity(BoxPokemon *boxMon, int flavor); +static BOOL sub_020778E0(BoxPokemon *boxMon); +static BOOL sub_02077900(BoxPokemon *boxMon); +static void sub_02077EA4(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); +static void sub_02077EF8(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); +static BOOL CanBoxMonLearnTM(BoxPokemon *boxMon, u8 tmID); +static void CalculateBoxMonAbility(BoxPokemon *boxMon); static void LoadMonPersonalData(int monSpecies, PokemonPersonalData *monPersonalData); static void LoadMonFormPersonalData(int monSpecies, int monForm, PokemonPersonalData *monPersonalData); static void LoadMonEvolutionData(int monSpecies, PokemonEvolutionData *monEvolutionData); @@ -120,8 +137,7 @@ static void DecryptMonData(void *data, u32 bytes, u32 seed); static u16 GetMonDataChecksum(void *data, u32 bytes); static void *GetBoxMonDataBlock(BoxPokemon *boxMon, u32 personality, enum PokemonDataBlockID dataBlockID); static int GetMonFormNarcIndex(int monSpecies, int monForm); -static void sub_02076300(UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); -static u8 sub_020767BC(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality); +static inline int GetLowestBitInverse (int num); void ZeroMonData (Pokemon *mon) { @@ -1999,7 +2015,7 @@ u32 GetMonExpToNextLevel (Pokemon *mon) return GetBoxMonExpToNextLevel(&mon->box); } -u32 GetBoxMonExpToNextLevel (BoxPokemon *boxMon) +static u32 GetBoxMonExpToNextLevel (BoxPokemon *boxMon) { u16 monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); u16 monNextlevel = GetBoxMonLevel(boxMon) + 1; @@ -2018,16 +2034,16 @@ u32 GetMonSpeciesLevelExp (int monSpecies, int monLevel) return GetMonExpRateLevelExp(GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_EXP_RATE), monLevel); } -void LoadMonExperienceTable (int monExpRate, u32 *monExpTable) +static void LoadMonExperienceTable (int monExpRate, u32 *monExpTable) { - // TODO enum for exp rate types? + // TODO const for table size, enum for exp rate types GF_ASSERT(monExpRate < 8); NARC_ReadWholeMemberByIndexPair(monExpTable, NARC_INDEX_POKETOOL__PERSONAL__PL_GROWTBL, monExpRate); } -u32 GetMonExpRateLevelExp (int monExpRate, int monLevel) +static u32 GetMonExpRateLevelExp (int monExpRate, int monLevel) { - // TODO enum for exp rate types? + // TODO const for table size, enum for exp rate types GF_ASSERT(monExpRate < 8); GF_ASSERT(monLevel <= 101); @@ -2068,7 +2084,7 @@ u32 GetMonSpeciesLevel (u16 monSpecies, u32 monExp) u32 GetMonPersonalDataLevel (PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monExp) { - // TODO const for table size? + // TODO const for table size, enum for exp rate types static u32 monExpTable[101]; int monExpRate = GetMonPersonalDataAttribute(monPersonalData, MON_DATA_PERSONAL_EXP_RATE); @@ -2134,7 +2150,7 @@ static const s8 sNatureStatAffinities[][5] = { {0, 0, 0, 0, 0} }; -u16 GetNatureAdjustedStatValue (u8 monNature, u16 monStatValue, u8 statType) +static u16 GetNatureAdjustedStatValue (u8 monNature, u16 monStatValue, u8 statType) { if (statType < STAT_ATTACK || statType > STAT_SPECIAL_DEFENSE) { return monStatValue; @@ -2284,7 +2300,7 @@ u8 GetMonShininess (Pokemon *mon) return GetBoxMonShininess(&mon->box); } -u8 GetBoxMonShininess (BoxPokemon *boxMon) +static u8 GetBoxMonShininess (BoxPokemon *boxMon) { u32 monOTID = GetBoxMonData(boxMon, MON_DATA_OT_ID, NULL); u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); @@ -3266,7 +3282,7 @@ u16 sub_02076FD4 (const u16 monSpecies) return sub_02076F84(monSpecies); } -void SetBoxMonDefaultMoves (BoxPokemon *boxMon) +static void SetBoxMonDefaultMoves (BoxPokemon *boxMon) { BOOL reencrypt; // TODO const value? @@ -3308,7 +3324,7 @@ u16 AddMonMove (Pokemon *mon, u16 moveID) return AddBoxMonMove(boxMon, moveID); } -u16 AddBoxMonMove (BoxPokemon *boxMon, u16 moveID) +static u16 AddBoxMonMove (BoxPokemon *boxMon, u16 moveID) { // TODO const values for sentinels? u16 result = 0xffff; @@ -3340,7 +3356,7 @@ void ReplaceMonMove (Pokemon *mon, u16 moveID) ReplaceBoxMonMove(boxMon, moveID); } -void ReplaceBoxMonMove (BoxPokemon *boxMon, u16 moveID) +static void ReplaceBoxMonMove (BoxPokemon *boxMon, u16 moveID) { BOOL reencrypt = DecryptBoxMon(boxMon); @@ -3386,7 +3402,7 @@ void SetMonMove (Pokemon *mon, u16 moveID, u8 moveSlot) SetBoxMonMove(&mon->box, moveID, moveSlot); } -void SetBoxMonMove (BoxPokemon *boxMon, u16 moveID, u8 moveSlot) +static void SetBoxMonMove (BoxPokemon *boxMon, u16 moveID, u8 moveSlot) { SetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot, &moveID); @@ -3486,7 +3502,7 @@ void DeleteMonMove (Pokemon *mon, u32 moveSlot) SetMonData(mon, MON_DATA_MOVE4_PP_UPS, &movePPUps); } -BOOL MonHasMove (Pokemon *mon, u16 moveID) +static BOOL MonHasMove (Pokemon *mon, u16 moveID) { int i; for (i = 0; i < 4; i++) { @@ -3591,7 +3607,7 @@ s8 GetMonFlavorAffinity (Pokemon *mon, int flavor) } // TODO enums -s8 GetBoxMonFlavorAffinity (BoxPokemon *boxMon, int flavor) +static s8 GetBoxMonFlavorAffinity (BoxPokemon *boxMon, int flavor) { return GetMonPersonalityFlavorAffinity(GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL), flavor); } @@ -3756,7 +3772,7 @@ BOOL sub_020778D8 (Pokemon *mon) return sub_020778E0(&mon->box); } -BOOL sub_020778E0 (BoxPokemon *boxMon) +static BOOL sub_020778E0 (BoxPokemon *boxMon) { return (GetBoxMonData(boxMon, MON_DATA_POKERUS, NULL) & 0xf) != 0; } @@ -3766,7 +3782,7 @@ BOOL sub_020778F8 (Pokemon *mon) return sub_02077900(&mon->box); } -BOOL sub_02077900 (BoxPokemon *boxMon) +static BOOL sub_02077900 (BoxPokemon *boxMon) { u8 monPokerus = GetBoxMonData(boxMon, MON_DATA_POKERUS, NULL); @@ -3943,12 +3959,13 @@ BOOL CanShayminSkyForm (Pokemon *mon) RTCTime rtcTime; sub_02013880(&rtcTime); - // TODO refactor - if (monSpecies == SPECIES_SHAYMIN && monForm == 0 && monCurrentHP > 0 && monFatefulEncounter == TRUE && (v2 & 0x20) == 0 && rtcTime.hour >= 4 && rtcTime.hour < 20) { - return TRUE; - } - - return FALSE; + return (monSpecies == SPECIES_SHAYMIN + && monForm == 0 + && monCurrentHP > 0 + && monFatefulEncounter == TRUE + && (v2 & 0x20) == 0 + && rtcTime.hour >= 4 + && rtcTime.hour < 20); } void SetShayminLandForm (Party *party) @@ -4065,6 +4082,14 @@ BOOL SetRotomForm (Pokemon *mon, int monForm, int moveSlot) return TRUE; } +/* TODO: + This function is annoying. + It's used in exactly one other file (`unk_020997B8.c`), so it has to be public. + The data structure of the NARC uses bitmasks that should probably be a struct, + and calling code uses sentinel values that should probably be consts, + but then we'd be polluting namespace for the sake of two .c files. + Could define in each .c file, but then there's risk of these becoming desynced (This is the worse option imo). +*/ void LoadMonLevelUpMoves (int monSpecies, int monForm, u16 *monLevelUpMoves) { monSpecies = GetMonFormNarcIndex(monSpecies, monForm); @@ -4128,7 +4153,7 @@ void sub_02077E64 (Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, in } } -void sub_02077EA4 (BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) +static void sub_02077EA4 (BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) { sub_0209305C(boxMon, param1, 0, param3, param5); SetBoxMonData(boxMon, MON_DATA_MET_GAME, &Unk_020E4C40); @@ -4141,7 +4166,7 @@ void sub_02077EE4 (Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, in sub_02077EF8(&mon->box, param1, monPokeball, param3, param4, param5); } -void sub_02077EF8 (BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) +static void sub_02077EF8 (BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) { sub_02077EA4(boxMon, param1, monPokeball, param3, param4, param5); } @@ -4182,7 +4207,7 @@ BOOL CanMonLearnTM (Pokemon *mon, u8 tmID) return CanBoxMonLearnTM(&mon->box, tmID); } -BOOL CanBoxMonLearnTM (BoxPokemon *boxMon, u8 tmID) +static BOOL CanBoxMonLearnTM (BoxPokemon *boxMon, u8 tmID) { u16 monSpeciesEgg = GetBoxMonData(boxMon, MON_DATA_SPECIES_EGG, NULL); int monForm = GetBoxMonData(boxMon, MON_DATA_FORM, NULL); @@ -4220,7 +4245,7 @@ void CalculateMonAbility (Pokemon *mon) CalculateBoxMonAbility(&mon->box); } -void CalculateBoxMonAbility (BoxPokemon *boxMon) +static void CalculateBoxMonAbility (BoxPokemon *boxMon) { BOOL reencrypt = DecryptBoxMon(boxMon); int monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); @@ -4666,8 +4691,6 @@ void sub_02078AC8 (NARC *narc, u8 *param1, u16 param2) BOOL sub_02078AEC (int param0, Pokemon *mon, int heapID) { - - // TODO restructure this int v0 = param0; if (v0 == 0) { From c563f45f7c0a3eb066f08822684b0d485739e6e7 Mon Sep 17 00:00:00 2001 From: wildfire Date: Wed, 13 Sep 2023 23:08:16 +0100 Subject: [PATCH 10/11] Rename functions in pokemon.h and pokemon.c --- include/pokemon.h | 158 ++-- src/enc_effects.c | 2 +- src/overlay005/ov5_021DDBE8.c | 4 +- src/overlay005/ov5_021E622C.c | 330 +++---- src/overlay005/ov5_021EE7D4.c | 18 +- src/overlay005/ov5_021F6454.c | 70 +- src/overlay005/ov5_021F77A8.c | 10 +- src/overlay006/ov6_02240C9C.c | 56 +- src/overlay006/ov6_022426AC.c | 2 +- src/overlay006/ov6_02243258.c | 2 +- src/overlay006/ov6_02246034.c | 6 +- src/overlay006/ov6_02246184.c | 50 +- src/overlay006/ov6_022489E4.c | 8 +- src/overlay010/ov10_0221F800.c | 24 +- src/overlay012/ov12_02235E94.c | 6 +- src/overlay013/ov13_0221FC20.c | 76 +- src/overlay013/ov13_02221A88.c | 28 +- src/overlay013/ov13_022264F4.c | 2 +- src/overlay014/ov14_0221FC20.c | 88 +- src/overlay016/battle_controller.c | 74 +- src/overlay016/ov16_0223B140.c | 32 +- src/overlay016/ov16_0223DF00.c | 82 +- src/overlay016/ov16_022405FC.c | 214 ++--- src/overlay016/ov16_0225177C.c | 270 +++--- src/overlay016/ov16_0225BFFC.c | 30 +- src/overlay016/ov16_0225CBB8.c | 36 +- src/overlay016/ov16_0226485C.c | 84 +- src/overlay016/ov16_02266F1C.c | 2 +- src/overlay016/ov16_0226871C.c | 2 +- src/overlay017/ov17_0223B140.c | 4 +- src/overlay017/ov17_0223DAD0.c | 2 +- src/overlay017/ov17_0223F118.c | 34 +- src/overlay017/ov17_0223F7E4.c | 8 +- src/overlay017/ov17_022413D8.c | 62 +- src/overlay017/ov17_02243C28.c | 24 +- src/overlay017/ov17_02246ECC.c | 2 +- src/overlay017/ov17_022476F8.c | 2 +- src/overlay017/ov17_02247A48.c | 4 +- src/overlay017/ov17_0224A0FC.c | 8 +- src/overlay017/ov17_02250744.c | 6 +- src/overlay017/ov17_02251D6C.c | 4 +- src/overlay019/ov19_021D0D80.c | 158 ++-- src/overlay019/ov19_021D79F8.c | 8 +- src/overlay019/ov19_021DA270.c | 26 +- src/overlay019/ov19_021DB8E4.c | 12 +- src/overlay021/ov21_021D1FA4.c | 2 +- src/overlay021/ov21_021DE668.c | 4 +- src/overlay021/ov21_021DF734.c | 2 +- src/overlay021/ov21_021E8D48.c | 12 +- src/overlay022/ov22_02259098.c | 2 +- src/overlay022/ov22_0225AF8C.c | 4 +- src/overlay022/ov22_0225B660.c | 4 +- src/overlay032/ov32_022561C0.c | 20 +- src/overlay033/ov33_022561C0.c | 8 +- src/overlay033/ov33_02256474.c | 2 +- src/overlay040/ov40_022561C0.c | 10 +- src/overlay040/ov40_0225645C.c | 2 +- src/overlay044/ov44_022561C0.c | 6 +- src/overlay044/ov44_022565BC.c | 2 +- src/overlay057/ov57_021D0D80.c | 2 +- src/overlay062/ov62_02239D60.c | 8 +- src/overlay062/ov62_02248408.c | 6 +- src/overlay065/ov65_0222DCE0.c | 8 +- src/overlay066/ov66_0222DDF0.c | 6 +- src/overlay076/ov76_0223B870.c | 10 +- src/overlay076/ov76_0223D338.c | 24 +- src/overlay078/ov78_021D0D80.c | 2 +- src/overlay079/ov79_021D2268.c | 12 +- src/overlay081/ov81_021D1610.c | 4 +- src/overlay086/ov86_0223B140.c | 38 +- src/overlay087/ov87_021D106C.c | 6 +- src/overlay088/ov88_0223B140.c | 82 +- src/overlay091/ov91_021D0D80.c | 24 +- src/overlay094/ov94_0223D0C4.c | 14 +- src/overlay094/ov94_0223DC04.c | 2 +- src/overlay094/ov94_0223E46C.c | 4 +- src/overlay094/ov94_0223FB48.c | 72 +- src/overlay094/ov94_022414B8.c | 18 +- src/overlay094/ov94_02242AD0.c | 38 +- src/overlay094/ov94_022444C8.c | 26 +- src/overlay095/ov95_02246C20.c | 22 +- src/overlay095/ov95_02247B6C.c | 2 +- src/overlay095/ov95_0224B3D8.c | 2 +- src/overlay097/ov97_0222D30C.c | 2 +- src/overlay097/ov97_02233B18.c | 2 +- src/overlay097/ov97_02236380.c | 148 +-- src/overlay097/ov97_02237694.c | 8 +- src/overlay104/ov104_0222DCE0.c | 62 +- src/overlay104/ov104_0222ECE8.c | 20 +- src/overlay104/ov104_02231F74.c | 4 +- src/overlay104/ov104_022332B4.c | 12 +- src/overlay104/ov104_022339B4.c | 26 +- src/overlay104/ov104_02234838.c | 6 +- src/overlay104/ov104_02234DB4.c | 10 +- src/overlay104/ov104_022358E8.c | 2 +- src/overlay104/ov104_022361B4.c | 74 +- src/overlay104/ov104_02237378.c | 38 +- src/overlay104/ov104_02237DD8.c | 94 +- src/overlay104/ov104_0223A0C4.c | 26 +- src/overlay104/ov104_0223A7F4.c | 16 +- src/overlay104/ov104_0223AF58.c | 20 +- src/overlay104/ov104_0223B6F4.c | 22 +- src/overlay104/ov104_0223BCBC.c | 16 +- src/overlay105/ov105_02241AE0.c | 18 +- src/overlay106/ov106_02241AE0.c | 4 +- src/overlay107/ov107_02241AE0.c | 68 +- src/overlay107/ov107_02245EB0.c | 62 +- src/overlay108/ov108_02241AE0.c | 4 +- src/overlay109/ov109_021D0D80.c | 6 +- src/overlay113/ov113_0225C700.c | 8 +- src/overlay113/ov113_0225E368.c | 2 +- src/overlay118/ov118_021D0D80.c | 8 +- src/overlay119/ov119_021D0D80.c | 10 +- src/overlay119/ov119_021D191C.c | 8 +- src/party.c | 8 +- src/pokemon.c | 1360 ++++++++++++++-------------- src/roaming_pokemon.c | 10 +- src/unk_0200B358.c | 8 +- src/unk_020261E4.c | 10 +- src/unk_0202631C.c | 34 +- src/unk_02028124.c | 6 +- src/unk_020298BC.c | 14 +- src/unk_0202DF8C.c | 30 +- src/unk_0202EEC0.c | 12 +- src/unk_0202F180.c | 4 +- src/unk_0202F1D4.c | 4 +- src/unk_02030A80.c | 2 +- src/unk_0203A9C8.c | 2 +- src/unk_0203D1B8.c | 18 +- src/unk_0203F6C4.c | 62 +- src/unk_020474B8.c | 2 +- src/unk_020480A8.c | 10 +- src/unk_02048DD8.c | 2 +- src/unk_02049D08.c | 44 +- src/unk_0204AEE8.c | 14 +- src/unk_0204B830.c | 66 +- src/unk_0204C500.c | 6 +- src/unk_0204CFFC.c | 124 +-- src/unk_0204F13C.c | 6 +- src/unk_02050A74.c | 12 +- src/unk_02051D8C.c | 18 +- src/unk_020528D0.c | 2 +- src/unk_02054884.c | 36 +- src/unk_020559DC.c | 2 +- src/unk_020562F8.c | 10 +- src/unk_02056720.c | 4 +- src/unk_0205A0D8.c | 16 +- src/unk_0205DFC4.c | 4 +- src/unk_0206C660.c | 4 +- src/unk_0206CCB0.c | 38 +- src/unk_02079170.c | 18 +- src/unk_020797C8.c | 26 +- src/unk_02079D40.c | 28 +- src/unk_0207A2A8.c | 16 +- src/unk_0207AE68.c | 92 +- src/unk_0207E0B8.c | 96 +- src/unk_020819DC.c | 16 +- src/unk_02082C2C.c | 6 +- src/unk_02083370.c | 18 +- src/unk_02084B70.c | 80 +- src/unk_0208694C.c | 10 +- src/unk_0208C324.c | 128 +-- src/unk_0208EA44.c | 2 +- src/unk_0208FCF8.c | 4 +- src/unk_020916B4.c | 2 +- src/unk_02092494.c | 158 ++-- src/unk_020933F8.c | 24 +- src/unk_02094EDC.c | 18 +- src/unk_02096420.c | 124 +-- src/unk_02097624.c | 14 +- src/unk_02097B18.c | 8 +- src/unk_02098218.c | 14 +- src/unk_020989DC.c | 10 +- src/unk_020997B8.c | 10 +- src/unk_0209BA80.c | 8 +- 175 files changed, 3192 insertions(+), 3190 deletions(-) diff --git a/include/pokemon.h b/include/pokemon.h index 42c384a1b0..2909917856 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -196,21 +196,21 @@ typedef struct Pokemon { * * @param mon */ -void ZeroMonData(Pokemon *mon); +void Pokemon_Init(Pokemon *mon); /** * @brief Zeros out a BoxPokemon data structure, then encrypts the result * * @param boxMon */ -void ZeroBoxMonData(BoxPokemon *boxMon); +void BoxPokemon_Init(BoxPokemon *boxMon); /** * @brief Returns the size in bytes of a Pokemon struct as an int * * @return Size in bytes of a Pokemon struct */ -int PokemonStructSize(void); +int Pokemon_StructSize(void); /** * @brief Allocates a Pokemon struct on the given heap, then calls ZeroMonData() on it @@ -218,7 +218,7 @@ int PokemonStructSize(void); * @param heapID * @return A new empty but encrypted Pokemon struct */ -Pokemon *AllocMonZeroed(u32 heapID); +Pokemon *Pokemon_New(u32 heapID); /** * @brief Decrypts a Pokemon data structure. PartyPokemon data is encrypted using the pokemons personality value, BoxPokemon data using a checksum value @@ -226,7 +226,7 @@ Pokemon *AllocMonZeroed(u32 heapID); * @param mon * @return Whether the pokemons data was decrypted by this call. Passed to EncryptMon() to decide whether to reencrypt the data or not */ -BOOL DecryptMon(Pokemon *mon); +BOOL Pokemon_EnterDecryptionContext(Pokemon *mon); /** * @brief Encrypts a Pokemon data structure. PartyPokemon data is encrypted using the pokemons personality value, BoxPokemon data using a checksum value @@ -235,7 +235,7 @@ BOOL DecryptMon(Pokemon *mon); * @param encrypt Whether to encrypt the data or not. If this is false, the function does nothing and returns false. * @return Whether the pokemons data was encrypted by this call. */ -BOOL EncryptMon(Pokemon *mon, BOOL encrypt); +BOOL Pokemon_ExitDecryptionContext(Pokemon *mon, BOOL encrypt); /** * @brief Decrypts a BoxPokemon data structure @@ -243,7 +243,7 @@ BOOL EncryptMon(Pokemon *mon, BOOL encrypt); * @param boxMon * @return Whether the pokemons data was decrypted by this call. Passed to EncryptBoxMon() to decide whether to reencrypt the data or not */ -BOOL DecryptBoxMon(BoxPokemon *boxMon); +BOOL BoxPokemon_EnterDecryptionContext(BoxPokemon *boxMon); /** * @brief Encrypts a BoxPokemon data structure @@ -252,7 +252,7 @@ BOOL DecryptBoxMon(BoxPokemon *boxMon); * @param encrypt Whether to encrypt the data or not. If this is false, the function does nothing and returns false. * @return Whether the pokemons data was encrypted by this call. */ -BOOL EncryptBoxMon(BoxPokemon *boxMon, BOOL encrypt); +BOOL BoxPokemon_ExitDecryptionContext(BoxPokemon *boxMon, BOOL encrypt); void sub_02073D80(Pokemon *mon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); void sub_02074044(Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monNature); @@ -265,14 +265,14 @@ void sub_02074158(Pokemon *mon, u16 monSpecies, u8 monLevel, u32 monCombinedIVs, * * @param mon */ -void CalculateMonLevelAndStats(Pokemon *mon); +void Pokemon_CalcLevelAndStats(Pokemon *mon); /** * @brief Calculates and stores the current stats for a given Pokemon based on its IVs, EVs etc. * * @param mon */ -void CalculateMonStats(Pokemon *mon); +void Pokemon_CalcStats(Pokemon *mon); /** * @brief Gets a value from a Pokemon, storing it in dest if neccessary @@ -282,7 +282,7 @@ void CalculateMonStats(Pokemon *mon); * @param[out] dest Pointer for storing longer data * @return The requested value */ -u32 GetMonData(Pokemon *mon, enum PokemonDataParam param, void *dest); +u32 Pokemon_GetValue(Pokemon *mon, enum PokemonDataParam param, void *dest); /** * @brief Gets a value from a Pokemon, storing it in dest if neccessary @@ -292,7 +292,7 @@ u32 GetMonData(Pokemon *mon, enum PokemonDataParam param, void *dest); * @param[out] dest Pointer for storing longer data * @return The requested value */ -u32 GetBoxMonData(BoxPokemon *boxMon, enum PokemonDataParam param, void *dest); +u32 BoxPokemon_GetValue(BoxPokemon *boxMon, enum PokemonDataParam param, void *dest); /** * @brief Sets a value in a Pokemon, reading it from value if neccessary @@ -301,7 +301,7 @@ u32 GetBoxMonData(BoxPokemon *boxMon, enum PokemonDataParam param, void *dest); * @param param * @param value */ -void SetMonData(Pokemon *mon, enum PokemonDataParam param, const void *value); +void Pokemon_SetValue(Pokemon *mon, enum PokemonDataParam param, const void *value); /** * @brief Sets a value in a BoxPokemon, reading it from value if neccessary @@ -310,7 +310,7 @@ void SetMonData(Pokemon *mon, enum PokemonDataParam param, const void *value); * @param param * @param value */ -void SetBoxMonData(BoxPokemon *boxMon, enum PokemonDataParam param, const void *value); +void BoxPokemon_SetValue(BoxPokemon *boxMon, enum PokemonDataParam param, const void *value); /** * @brief Increases some numerical fields in a Pokemon by the given value. Does nothing if the field is not supported @@ -321,7 +321,7 @@ void SetBoxMonData(BoxPokemon *boxMon, enum PokemonDataParam param, const void * * @param param * @param value */ -void IncreaseMonData(Pokemon *mon, enum PokemonDataParam param, int value); +void Pokemon_IncreaseValue(Pokemon *mon, enum PokemonDataParam param, int value); /** * @brief Gets a PokemonPersonalData based on a pokemon species and form @@ -331,7 +331,7 @@ void IncreaseMonData(Pokemon *mon, enum PokemonDataParam param, int value); * @param heapID The index of the heap that the PokemonPersonalData should be loaded into * @return PokemonPersonalData* */ -PokemonPersonalData *GetMonFormPersonalData(int monSpecies, int monForm, int heapID); +PokemonPersonalData *PokemonPersonalData_FromMonForm(int monSpecies, int monForm, int heapID); /** * @brief Gets a PokemonPersonalData based on a pokemon species @@ -340,7 +340,7 @@ PokemonPersonalData *GetMonFormPersonalData(int monSpecies, int monForm, int hea * @param heapID The index of the heap that the PokemonPersonalData should be loaded into * @return PokemonPersonalData* */ -PokemonPersonalData *GetMonPersonalData(int monSpecies, int heapID); +PokemonPersonalData *PokemonPersonalData_FromMonSpecies(int monSpecies, int heapID); /** * @brief Gets a value from a PokemonPersonalData structure @@ -349,14 +349,14 @@ PokemonPersonalData *GetMonPersonalData(int monSpecies, int heapID); * @param param What value to get * @return The requested value */ -u32 GetMonPersonalDataAttribute(PokemonPersonalData *monPersonalData, enum PokemonPersonalDataParam param); +u32 PokemonPersonalData_GetValue(PokemonPersonalData *monPersonalData, enum PokemonPersonalDataParam param); /** * @brief Frees a PokemonPersonalData structure from the heap * * @param monPersonalData */ -void FreeMonPersonalData(PokemonPersonalData *monPersonalData); +void PokemonPersonalData_Free(PokemonPersonalData *monPersonalData); /** * @brief Loads a PokemonPersonalData based on its species and form and gets a value from it @@ -366,7 +366,7 @@ void FreeMonPersonalData(PokemonPersonalData *monPersonalData); * @param param What value to get * @return The requested value */ -u32 GetMonFormPersonalDataAttribute(int monSpecies, int monForm, enum PokemonPersonalDataParam param); +u32 PokemonPersonalData_GetFormValue(int monSpecies, int monForm, enum PokemonPersonalDataParam param); /** * @brief Loads a PokemonPersonalData based on its species and gets a value from it @@ -375,7 +375,7 @@ u32 GetMonFormPersonalDataAttribute(int monSpecies, int monForm, enum PokemonPer * @param param What value to get * @return The requested value */ -u32 GetMonSpeciesPersonalDataAttribute(int monSpecies, enum PokemonPersonalDataParam param); +u32 PokemonPersonalData_GetSpeciesValue(int monSpecies, enum PokemonPersonalDataParam param); /** * @brief Gets how much progress a Pokemon has made towards its next level as a percentage @@ -383,7 +383,7 @@ u32 GetMonSpeciesPersonalDataAttribute(int monSpecies, enum PokemonPersonalDataP * @param mon * @return how much progress a Pokemon has made towards its next level as a percentage */ -u8 GetMonPercentToNextLevel(Pokemon *mon); +u8 Pokemon_GetPercentToNextLevel(Pokemon *mon); /** * @brief Gets how much experience is needed for the given Pokemon to level up @@ -391,7 +391,7 @@ u8 GetMonPercentToNextLevel(Pokemon *mon); * @param boxMon * @return The amount of exp. needed for the given Pokemon to level up */ -u32 GetMonExpToNextLevel(Pokemon *mon); +u32 Pokemon_GetExpToNextLevel(Pokemon *mon); /** * @brief Gets the amount of expeirence needed for the given Pokemon to reach its current level @@ -399,7 +399,7 @@ u32 GetMonExpToNextLevel(Pokemon *mon); * @param mon * @return The amount of exp. needed for the given Pokemon to reach its current level */ -u32 GetMonCurrentLevelExp(Pokemon *mon); +u32 Pokemon_GetCurrentLevelBaseExp(Pokemon *mon); /** * @brief Gets the amount of expeirence needed for a pokemon species to reach a specified level @@ -408,7 +408,7 @@ u32 GetMonCurrentLevelExp(Pokemon *mon); * @param monLevel * @return The amount of exp. needed for the given pokemon species to reach the specified level */ -u32 GetMonSpeciesLevelExp(int monSpecies, int monLevel); +u32 Pokemon_GetSpeciesBaseExpAt(int monSpecies, int monLevel); /** * @copybrief GetMonSpeciesLevel() @@ -416,7 +416,7 @@ u32 GetMonSpeciesLevelExp(int monSpecies, int monLevel); * @param mon * @return The pokemons level */ -u32 GetMonLevel(Pokemon *mon); +u32 Pokemon_GetLevel(Pokemon *mon); /** * @copybrief GetMonSpeciesLevel() @@ -424,7 +424,7 @@ u32 GetMonLevel(Pokemon *mon); * @param boxMon * @return The pokemons level */ -u32 GetBoxMonLevel(BoxPokemon *boxMon); +u32 BoxPokemon_GetLevel(BoxPokemon *boxMon); /** * @brief Gets the level of a pokemon based on its species and exp @@ -433,7 +433,7 @@ u32 GetBoxMonLevel(BoxPokemon *boxMon); * @param monExp * @return The pokemons level */ -u32 GetMonSpeciesLevel(u16 monSpecies, u32 monExp); +u32 Pokemon_GetSpeciesLevelAt(u16 monSpecies, u32 monExp); /** * @brief Gets the level of a pokemon based on its personal data and exp @@ -443,7 +443,7 @@ u32 GetMonSpeciesLevel(u16 monSpecies, u32 monExp); * @param monExp * @return The pokemons level */ -u32 GetMonPersonalDataLevel(PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monExp); +u32 PokemonPersonalData_GetLevelAt(PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monExp); /** * @brief Gets the nature of a Pokemon based on its personality value @@ -451,7 +451,7 @@ u32 GetMonPersonalDataLevel(PokemonPersonalData *monPersonalData, u16 unused_mon * @param mon * @return The pokemons nature */ -u8 GetMonNature(Pokemon *mon); +u8 Pokemon_GetNature(Pokemon *mon); /** * @brief Gets the nature of a BoxPokemon based on its personality value @@ -459,7 +459,7 @@ u8 GetMonNature(Pokemon *mon); * @param boxMon * @return The pokemons nature */ -u8 GetBoxMonNature(BoxPokemon *boxMon); +u8 BoxPokemon_GetNature(BoxPokemon *boxMon); /** * @brief Gets the nature of a pokemon based on its personality value @@ -467,7 +467,7 @@ u8 GetBoxMonNature(BoxPokemon *boxMon); * @param monPersonality * @return The pokemons nature */ -u8 GetNatureFromPersonality(u32 monPersonality); +u8 Pokemon_GetNatureOf(u32 monPersonality); /** * @brief Gets the affinitiy of a given pokemon nature to a given stat @@ -476,7 +476,7 @@ u8 GetNatureFromPersonality(u32 monPersonality); * @param statType * @return 1 if stat is increased, -1 if stat is decreased, else 0 */ -s8 GetNatureStatAffinity(u8 monNature, u8 statType); +s8 Pokemon_GetStatAffinityOf(u8 monNature, u8 statType); void sub_02075C74(Pokemon *mon, u8 param1, u16 param2); @@ -486,7 +486,7 @@ void sub_02075C74(Pokemon *mon, u8 param1, u16 param2); * @param boxMon * @return The pokemons gender */ -u8 GetMonGender(Pokemon *mon); +u8 Pokemon_GetGender(Pokemon *mon); /** * @brief Gets the gender of a BoxPokemon based on its species and personality value @@ -494,7 +494,7 @@ u8 GetMonGender(Pokemon *mon); * @param boxMon * @return The pokemons gender */ -u8 GetBoxMonGender(BoxPokemon *boxMon); +u8 BoxPokemon_GetGender(BoxPokemon *boxMon); /** * @brief Gets the gender of a pokemon based on its species and personality value @@ -503,7 +503,7 @@ u8 GetBoxMonGender(BoxPokemon *boxMon); * @param monPersonality * @return The pokemons gender */ -u8 GetMonPersonalityGender(u16 monSpecies, u32 monPersonality); +u8 Pokemon_GetGenderOf(u16 monSpecies, u32 monPersonality); /** * @brief Gets the gender of a pokemon based on its PokemonPersonalData and personality value @@ -513,7 +513,7 @@ u8 GetMonPersonalityGender(u16 monSpecies, u32 monPersonality); * @param monPersonality * @return The pokemons gender */ -u8 GetMonPersonalDataGender(PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monPersonality); +u8 PokemonPersonalData_GetGenderOf(PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monPersonality); /** * @brief Gets whether a BoxPokemon is shiny based on its Original Trainer ID and its personality value @@ -521,7 +521,7 @@ u8 GetMonPersonalDataGender(PokemonPersonalData *monPersonalData, u16 unused_mon * @param mon * @return Whether the pokemon is shiny or not */ -u8 GetMonShininess(Pokemon *mon); +u8 Pokemon_IsShiny(Pokemon *mon); /** * @brief Gets whether a pokemon is shiny based on its Original Trainer ID and its personality value @@ -530,7 +530,7 @@ u8 GetMonShininess(Pokemon *mon); * @param monPersonality * @return Whether the pokemon is shiny or not */ -u8 GetMonPersonalityShininess(u32 monOTID, u32 monPersonality); +u8 Pokemon_IsPersonalityShiny(u32 monOTID, u32 monPersonality); u32 sub_02075E64(u32 param0); void sub_02075EF4(UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2); @@ -545,7 +545,7 @@ void sub_02075FB4(UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 p * @param monForm * @return The sanitized pokemon form */ -u8 SanitizeFormId(u16 monSpecies, u8 monForm); +u8 Pokemon_SanitizeFormId(u16 monSpecies, u8 monForm); u8 sub_020765AC(Pokemon *mon, u8 param1); u8 sub_020765B8(Pokemon *mon, u8 param1); @@ -560,14 +560,14 @@ void sub_02076AAC(int param0, int param1, UnkStruct_ov5_021DE5D0 *param2); * * @return Size in bytes of a Pokemon struct */ -u32 GetPokemonStructSize(void); +u32 Pokemon_GetStructSize(void); /** * @brief Returns the size in bytes of a BoxPokemon struct as a u32 * * @return Size in bytes of a BoxPokemon struct */ -u32 GetBoxPokemonStructSize(void); +u32 BoxPokemon_GetStructSize(void); /** * @brief Gets the form of a Pokemon @@ -575,7 +575,7 @@ u32 GetBoxPokemonStructSize(void); * @param mon * @return The pokemons form */ -u8 GetMonForm(Pokemon *mon); +u8 Pokemon_GetForm(Pokemon *mon); /** * @brief Gets the form of a BoxPokemon @@ -583,7 +583,7 @@ u8 GetMonForm(Pokemon *mon); * @param boxMon * @return The pokemons form */ -u8 GetBoxMonForm(BoxPokemon *boxMon); +u8 BoxPokemon_GetForm(BoxPokemon *boxMon); /** * @brief Gets the BoxPokemon data for a given Pokemon @@ -591,7 +591,7 @@ u8 GetBoxMonForm(BoxPokemon *boxMon); * @param mon * @return The BoxPokemon data for a given Pokemon */ -BoxPokemon *GetBoxMon(Pokemon *mon); +BoxPokemon *Pokemon_GetBoxPokemon(Pokemon *mon); BOOL sub_02076B14(Pokemon *mon); u16 sub_02076B94(Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int *evoTypeResult); @@ -605,7 +605,7 @@ u16 sub_02076FD4(const u16 monSpecies); * @param moveID * @return The given moveID if successful, 0xfffe if already known, 0xffff if there is no room for the move */ -u16 AddMonMove(Pokemon *mon, u16 moveID); +u16 Pokemon_AddMove(Pokemon *mon, u16 moveID); /** * @brief Deletes the first move of a Pokemon and adds the given move to the end of its moveset @@ -613,7 +613,7 @@ u16 AddMonMove(Pokemon *mon, u16 moveID); * @param mon * @param moveID */ -void ReplaceMonMove(Pokemon *mon, u16 moveID); +void Pokemon_ReplaceMove(Pokemon *mon, u16 moveID); /** * @brief Sets the given moveSlot of a Pokemon, removing its PP Ups @@ -622,7 +622,7 @@ void ReplaceMonMove(Pokemon *mon, u16 moveID); * @param moveID * @param moveSlot */ -void ResetMonMove(Pokemon *mon, u16 moveID, u8 moveSlot); +void Pokemon_ResetMoveSlot(Pokemon *mon, u16 moveID, u8 moveSlot); /** * @brief Sets the given moveSlot of a Pokemon, retaining the PP Ups for that slot @@ -631,7 +631,7 @@ void ResetMonMove(Pokemon *mon, u16 moveID, u8 moveSlot); * @param moveID * @param moveSlot */ -void SetMonMove(Pokemon *mon, u16 moveID, u8 moveSlot); +void Pokemon_SetMoveSlot(Pokemon *mon, u16 moveID, u8 moveSlot); u16 sub_0207727C(Pokemon *mon, int *index, u16 *moveID); @@ -642,7 +642,7 @@ u16 sub_0207727C(Pokemon *mon, int *index, u16 *moveID); * @param moveSlot1 * @param moveSlot2 */ -void SwapMonMoves(Pokemon *mon, int moveSlot1, int moveSlot2); +void Pokemon_SwapMoveSlots(Pokemon *mon, int moveSlot1, int moveSlot2); /** * @brief Swaps the places of two moves on a BoxPokemon @@ -651,7 +651,7 @@ void SwapMonMoves(Pokemon *mon, int moveSlot1, int moveSlot2); * @param moveSlot1 * @param moveSlot2 */ -void SwapBoxMonMoves(BoxPokemon *boxMon, int moveSlot1, int moveSlot2); +void BoxPokemon_SwapMoveSlots(BoxPokemon *boxMon, int moveSlot1, int moveSlot2); /** * @brief Deletes the given moveSlot of a Pokemon, shifting the ones above it down @@ -659,9 +659,9 @@ void SwapBoxMonMoves(BoxPokemon *boxMon, int moveSlot1, int moveSlot2); * @param mon * @param moveSlot */ -void DeleteMonMove(Pokemon *mon, u32 moveSlot); +void Pokemon_ClearMoveSlot(Pokemon *mon, u32 moveSlot); -void sub_020774C8(BoxPokemon *boxMon, Pokemon *mon); +void Pokemon_FromBoxPokemon(BoxPokemon *boxMon, Pokemon *mon); /** * @brief Gets the level of the highest level pokemon in the Party @@ -669,13 +669,13 @@ void sub_020774C8(BoxPokemon *boxMon, Pokemon *mon); * @param party * @return The level of the highest level pokemon in the Party */ -u8 GetPartyHighestLevel(Party *party); +u8 Party_GetMaxLevel(Party *party); u16 sub_020775A4(u16 param0); u16 sub_020775C4(u16 param0); -void sub_020775EC(Pokemon *src, Pokemon *dest); -void sub_02077604(BoxPokemon *src, BoxPokemon *dest); -void sub_02077618(Pokemon *src, BoxPokemon *dest); +void Pokemon_Copy(Pokemon *src, Pokemon *dest); +void BoxPokemon_Copy(BoxPokemon *src, BoxPokemon *dest); +void BoxPokemon_FromPokemon(Pokemon *src, BoxPokemon *dest); /** * @brief Gets the affinitiy of a given Pokemon to a given flavor @@ -684,7 +684,7 @@ void sub_02077618(Pokemon *src, BoxPokemon *dest); * @param flavor * @return 1 if liked flavor, -1 if disliked flavor, else 0 */ -s8 GetMonFlavorAffinity(Pokemon *mon, int flavor); +s8 Pokemon_GetFlavorAffinity(Pokemon *mon, int flavor); /** * @brief Gets the affinitiy of a given Pokemon personality to a given flavor @@ -693,7 +693,7 @@ s8 GetMonFlavorAffinity(Pokemon *mon, int flavor); * @param flavor * @return 1 if liked flavor, -1 if disliked flavor, else 0 */ -s8 GetMonPersonalityFlavorAffinity(u32 monPersonality, int flavor); +s8 Pokemon_GetFlavorAffinityOf(u32 monPersonality, int flavor); /** * @brief Gets all moves that the given pokemon species and form can learn by leveling up @@ -703,7 +703,7 @@ s8 GetMonPersonalityFlavorAffinity(u32 monPersonality, int flavor); * @param[out] monLevelUpMoveIDs Pointer to a u16 array for storing the level up moves * @return int */ -int GetMonLevelUpMoveIDs(int monSpecies, int monForm, u16 *monLevelUpMoveIDs); +int Pokemon_LoadLevelUpMoveIdsOf(int monSpecies, int monForm, u16 *monLevelUpMoveIDs); void sub_020776B0(Party *party); u8 sub_02077758(Party *party, u8 param1); @@ -717,14 +717,14 @@ BOOL sub_020778F8(Pokemon *mon); * * @param mon */ -void SetArceusForm(Pokemon *mon); +void Pokemon_SetArceusForm(Pokemon *mon); /** * @brief Sets Arceus' form based on its held item. Has no effect if the given Pokemon is not an Arceus * * @param boxMon */ -void SetBoxArceusForm(BoxPokemon *boxMon); +void BoxPokemon_SetArceusForm(BoxPokemon *boxMon); /** * @brief Get Arceus' form given an items hold effect @@ -732,7 +732,7 @@ void SetBoxArceusForm(BoxPokemon *boxMon); * @param itemHoldEffect * @return The form arceus should be in */ -u8 GetArceusItemType(u16 itemHoldEffect); +u8 Pokemon_GetArceusTypeOf(u16 itemHoldEffect); /** * @brief Sets Giratina's form based on its held item. Has no effect if the given Pokemon is not a Giratina @@ -740,7 +740,7 @@ u8 GetArceusItemType(u16 itemHoldEffect); * @param mon * @return The form Giratina was set to, or -1 if the given BoxPokemon was not a Giratina */ -int SetGiratinaForm(Pokemon *mon); +int Pokemon_SetGiratinaForm(Pokemon *mon); /** * @brief Sets Giratina's form based on its held item. Has no effect if the given BoxPokemon is not a Giratina @@ -748,14 +748,14 @@ int SetGiratinaForm(Pokemon *mon); * @param boxMon * @return The form Giratina was set to, or -1 if the given BoxPokemon was not a Giratina */ -int SetBoxGiratinaForm(BoxPokemon *boxMon); +int BoxPokemon_SetGiratinaForm(BoxPokemon *boxMon); /** * @brief Set Giratina to its Origin form. Has no effect if the given Pokemon is not a Giratina * * @param mon */ -void SetGiratinaOriginForm(Pokemon *mon); +void Pokemon_SetGiratinaOriginForm(Pokemon *mon); /** * @brief Iterates over all the Pokemon in Party, setting the form of any Giratina. @@ -764,7 +764,7 @@ void SetGiratinaOriginForm(Pokemon *mon); * @param party * @param param1 */ -void SetPartyGiratinaForm(Party *party, int param1); +void Party_SetGiratinaForm(Party *party, int param1); /** * @brief Sets Shaymin to the given form. Has no effect if the given Pokemon is not a Shaymin @@ -772,7 +772,7 @@ void SetPartyGiratinaForm(Party *party, int param1); * @param mon * @param monForm */ -void SetShayminForm(Pokemon *mon, int monForm); +void Pokemon_SetShayminForm(Pokemon *mon, int monForm); /** * @brief Sets Shaymin to the given form. Has no effect if the given BoxPokemon is not a Shaymin @@ -780,7 +780,7 @@ void SetShayminForm(Pokemon *mon, int monForm); * @param boxMon * @param monForm */ -void SetBoxShayminForm(BoxPokemon *boxMon, int monForm); +void BoxPokemon_SetShayminForm(BoxPokemon *boxMon, int monForm); /** * @brief Checks whether Shaymin is allowed to change into Sky Form. Always returns false if the given Pokemon is not a Shaymin @@ -788,14 +788,14 @@ void SetBoxShayminForm(BoxPokemon *boxMon, int monForm); * @param mon * @return Whether Shaymin is allowed to change into Sky Form */ -BOOL CanShayminSkyForm(Pokemon *mon); +BOOL Pokemon_CanShayminSkyForm(Pokemon *mon); /** * @brief Iterates over all the Pokemon in Party, setting the form of any Shaymin to land form. * * @param party */ -void SetShayminLandForm(Party *party); +void Party_SetShayminLandForm(Party *party); /** * @brief Sets all Shaymin in the party to Land form at night @@ -807,7 +807,7 @@ void SetShayminLandForm(Party *party); * @param rtcTime * @return Whether Shaymin should be set to Land form */ -BOOL SetPartyShayminForm(Party *party, int param1, const RTCTime *rtcTime); +BOOL Party_SetShayminForm(Party *party, int param1, const RTCTime *rtcTime); /** * @brief Sets Rotom to the given form. Has no effect if the given Pokemon is not a Rotom @@ -818,7 +818,7 @@ BOOL SetPartyShayminForm(Party *party, int param1, const RTCTime *rtcTime); * @param moveSlot * @return Whether the given pokemon was a Rotom */ -BOOL SetRotomForm(Pokemon *mon, int monForm, int moveSlot); +BOOL Pokemon_SetRotomForm(Pokemon *mon, int monForm, int moveSlot); /** * @brief Loads a Level-Up move table based on a pokemon species and form into the pointed to array @@ -827,7 +827,7 @@ BOOL SetRotomForm(Pokemon *mon, int monForm, int moveSlot); * @param monForm * @param[out] monLevelUpMoves Pointer to a u16 array to store the move table */ -void LoadMonLevelUpMoves(int monSpecies, int monForm, u16 *monLevelUpMoves); +void Pokemon_LoadLevelUpMovesOf(int monSpecies, int monForm, u16 *monLevelUpMoves); void sub_02077D3C(UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7); void sub_02077DB4(UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7, u8 param8); @@ -835,15 +835,15 @@ BOOL sub_02077E3C(Pokemon *mon); void sub_02077E64(Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); void sub_02077EE4(Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); void sub_02077F0C(Pokemon *mon, u32 param1, int param2); -BOOL CanMonLearnTM(Pokemon *mon, u8 tmID); -BOOL CanMonSpeciesLearnTM(u16 monSpecies, int monForm, u8 tmID); +BOOL Pokemon_CanLearnTM(Pokemon *mon, u8 tmID); +BOOL Pokemon_CanFormLearnTM(u16 monSpecies, int monForm, u8 tmID); /** * @brief Sets the ability of a Pokemon based on its species, form and peronsality value * * @param mon */ -void CalculateMonAbility(Pokemon *mon); +void Pokemon_CalcAbility(Pokemon *mon); void sub_020780C4(Pokemon *mon, u32 monPersonality); @@ -853,7 +853,7 @@ void sub_020780C4(Pokemon *mon, u32 monPersonality); * @param index * @return A bitmask with a single bit set at the specified index. */ -u32 GetSingleBitMask(int index); +u32 Pokemon_GetFlagMaskOf(int index); /** * @brief Gets the index of the lowest set bit of the given number @@ -861,7 +861,7 @@ u32 GetSingleBitMask(int index); * @param num * @return The index of the lowest set bit of the given number */ -int GetLowestSetBitIndex(u32 num); +int Pokemon_GetLowestFlagIndex(u32 num); BOOL sub_02078804(u16 param0); u16 sub_02078824(u8 index); diff --git a/src/enc_effects.c b/src/enc_effects.c index 0c9822a17a..a472dc1b62 100644 --- a/src/enc_effects.c +++ b/src/enc_effects.c @@ -285,7 +285,7 @@ static u32 EncEffects_WildPokemonEffect (Party *wildParty, int mapHeaderID) u32 result = ENCEFF_NORMAL_WILD; Pokemon *wildPokemon = Party_FirstBattler(wildParty); - u32 wildSpecies = GetMonData(wildPokemon, MON_DATA_SPECIES, NULL); + u32 wildSpecies = Pokemon_GetValue(wildPokemon, MON_DATA_SPECIES, NULL); switch (wildSpecies) { case SPECIES_SHAYMIN: diff --git a/src/overlay005/ov5_021DDBE8.c b/src/overlay005/ov5_021DDBE8.c index a1738215f7..e39d142a77 100644 --- a/src/overlay005/ov5_021DDBE8.c +++ b/src/overlay005/ov5_021DDBE8.c @@ -1421,8 +1421,8 @@ u32 CutInEffects_ForBattle (const BattleParams * param0) v3 = Party_FirstBattler(param0->parties[0]); v4 = Party_FirstBattler(param0->parties[1]); - v5 = GetMonData(v3, MON_DATA_LEVEL, NULL); - v6 = GetMonData(v4, MON_DATA_LEVEL, NULL); + v5 = Pokemon_GetValue(v3, MON_DATA_LEVEL, NULL); + v6 = Pokemon_GetValue(v4, MON_DATA_LEVEL, NULL); v0 = v6 - v5; switch (param0->unk_12C) { diff --git a/src/overlay005/ov5_021E622C.c b/src/overlay005/ov5_021E622C.c index 754afc6566..04e8cf0302 100644 --- a/src/overlay005/ov5_021E622C.c +++ b/src/overlay005/ov5_021E622C.c @@ -1986,7 +1986,7 @@ u8 ov5_021E6238 (UnkStruct_02026310 * param0) for (v1 = 0; v1 < 2; v1++) { v2 = sub_02026220(sub_02026218(param0, v1)); - if (GetBoxMonData(v2, MON_DATA_SPECIES, NULL) != 0) { + if (BoxPokemon_GetValue(v2, MON_DATA_SPECIES, NULL) != 0) { v0++; } } @@ -2004,7 +2004,7 @@ int ov5_021E6270 (UnkStruct_02026310 * param0) for (v0 = 0; v0 < 2; v0++) { v1 = sub_02026220(sub_02026218(param0, v0)); - if (GetBoxMonData(v1, MON_DATA_SPECIES, NULL) == 0) { + if (BoxPokemon_GetValue(v1, MON_DATA_SPECIES, NULL) == 0) { return v0; } } @@ -2014,7 +2014,7 @@ int ov5_021E6270 (UnkStruct_02026310 * param0) static int ov5_021E62B0 (BoxPokemon * param0) { - int v0 = GetBoxMonData(param0, MON_DATA_HELD_ITEM, NULL); + int v0 = BoxPokemon_GetValue(param0, MON_DATA_HELD_ITEM, NULL); return Item_IsMail(v0); } @@ -2029,14 +2029,14 @@ static void ov5_021E62C4 (Party * param0, int param1, UnkStruct_02026218 * param UnkStruct_02025E6C * v6 = sub_02025E38(param3); v2 = sub_02025EF0(v6); - GetMonData(v1, MON_DATA_117, v3); + Pokemon_GetValue(v1, MON_DATA_117, v3); - if (ov5_021E62B0(GetBoxMon(v1))) { - GetMonData(v1, MON_DATA_170, sub_02026230(v4)); + if (ov5_021E62B0(Pokemon_GetBoxPokemon(v1))) { + Pokemon_GetValue(v1, MON_DATA_170, sub_02026230(v4)); } - sub_02077618(v1, v5); - SetBoxShayminForm(v5, 0); + BoxPokemon_FromPokemon(v1, v5); + BoxPokemon_SetShayminForm(v5, 0); sub_02026258(param2, 0); Party_RemovePokemonBySlotIndex(param0, param1); @@ -2066,8 +2066,8 @@ static void ov5_021E638C (UnkStruct_02026310 * param0) v2 = sub_02026220(v0); v3 = sub_02026220(v1); - if (GetBoxMonData(v2, MON_DATA_SPECIES, NULL) == 0) { - if (GetBoxMonData(v3, MON_DATA_SPECIES, NULL) != 0) { + if (BoxPokemon_GetValue(v2, MON_DATA_SPECIES, NULL) == 0) { + if (BoxPokemon_GetValue(v3, MON_DATA_SPECIES, NULL) != 0) { sub_020262A8(v0, v1); sub_020262F4(v1); } @@ -2086,7 +2086,7 @@ static void ov5_021E63E0 (Pokemon * param0) while ((v4 = sub_0207727C(param0, &v1, &v3)) != 0) { if (v4 == 0xffff) { - ReplaceMonMove(param0, v3); + Pokemon_ReplaceMove(param0, v3); } } } else { @@ -2094,34 +2094,34 @@ static void ov5_021E63E0 (Pokemon * param0) } } - CalculateMonLevelAndStats(param0); + Pokemon_CalcLevelAndStats(param0); } static int ov5_021E6444 (Party * param0, UnkStruct_02026218 * param1, UnkStruct_0200B358 * param2) { - Pokemon * v0 = AllocMonZeroed(4); + Pokemon * v0 = Pokemon_New(4); BoxPokemon * v1 = sub_02026220(param1); UnkStruct_02026224 * v2 = sub_02026224(param1); u32 v3; u16 v4; sub_0200B5CC(param2, 0, v1); - v4 = GetBoxMonData(v1, MON_DATA_SPECIES, NULL); - sub_020774C8(v1, v0); + v4 = BoxPokemon_GetValue(v1, MON_DATA_SPECIES, NULL); + Pokemon_FromBoxPokemon(v1, v0); - if (GetMonData(v0, MON_DATA_LEVEL, NULL) != 100) { - v3 = GetMonData(v0, MON_DATA_EXP, NULL); + if (Pokemon_GetValue(v0, MON_DATA_LEVEL, NULL) != 100) { + v3 = Pokemon_GetValue(v0, MON_DATA_EXP, NULL); v3 += sub_02026228(param1); - SetMonData(v0, 8, (u8 *)&v3); + Pokemon_SetValue(v0, 8, (u8 *)&v3); ov5_021E63E0(v0); } if (ov5_021E62B0(v1)) { - SetMonData(v0, 170, sub_02026230(v2)); + Pokemon_SetValue(v0, 170, sub_02026230(v2)); } Party_AddPokemon(param0, v0); - ZeroBoxMonData(v1); + BoxPokemon_Init(v1); sub_02026258(param1, 0); Heap_FreeToHeap(v0); @@ -2141,18 +2141,18 @@ u16 ov5_021E64F8 (Party * param0, UnkStruct_0200B358 * param1, UnkStruct_0202631 int ov5_021E6520 (BoxPokemon * param0, u32 param1) { - Pokemon * v0 = AllocMonZeroed(4); - BoxPokemon * v1 = GetBoxMon(v0); + Pokemon * v0 = Pokemon_New(4); + BoxPokemon * v1 = Pokemon_GetBoxPokemon(v0); int v2; u32 v3; - sub_02077604(param0, v1); + BoxPokemon_Copy(param0, v1); - v3 = GetBoxMonData(v1, MON_DATA_EXP, NULL); + v3 = BoxPokemon_GetValue(v1, MON_DATA_EXP, NULL); v3 += param1; - SetBoxMonData(v1, 8, (u8 *)&v3); - v2 = GetBoxMonLevel(v1); + BoxPokemon_SetValue(v1, 8, (u8 *)&v3); + v2 = BoxPokemon_GetLevel(v1); Heap_FreeToHeap(v0); return v2; @@ -2164,7 +2164,7 @@ int ov5_021E6568 (UnkStruct_02026218 * param0) BoxPokemon * v2; v2 = sub_02026220(param0); - v0 = GetBoxMonLevel(v2); + v0 = BoxPokemon_GetLevel(v2); v1 = ov5_021E6520(v2, sub_02026228(param0)); return v1 - v0; @@ -2223,7 +2223,7 @@ u8 ov5_021E6640 (UnkStruct_02026310 * param0, int param1, UnkStruct_0200B358 * p UnkStruct_02026218 * v0 = sub_02026218(param0, param1); BoxPokemon * v1 = sub_02026220(v0); - if (GetBoxMonData(v1, MON_DATA_SPECIES, NULL)) { + if (BoxPokemon_GetValue(v1, MON_DATA_SPECIES, NULL)) { return ov5_021E65B0(v0, param2); } @@ -2245,13 +2245,13 @@ static int ov5_021E6684 (UnkStruct_02026310 * param0) ov5_021E6668(param0, v4); for (v0 = 0; v0 < 2; v0++) { - if (GetBoxMonGender(v4[v0]) == 1) { + if (BoxPokemon_GetGender(v4[v0]) == 1) { v2 = v0; } } for (v3 = 0, v0 = 0; v0 < 2; v0++) { - if ((v1[v0] = GetBoxMonData(v4[v0], MON_DATA_SPECIES, NULL)) == 132) { + if ((v1[v0] = BoxPokemon_GetValue(v4[v0], MON_DATA_SPECIES, NULL)) == 132) { v3++; v2 = v0; } @@ -2265,7 +2265,7 @@ static int ov5_021E6684 (UnkStruct_02026310 * param0) } } - if (GetBoxMonData(v4[v2], MON_DATA_HELD_ITEM, NULL) == 229) { + if (BoxPokemon_GetValue(v4[v2], MON_DATA_HELD_ITEM, NULL) == 229) { if (LCRNG_Next() >= (0xffff / 2)) { return -1; } @@ -2287,13 +2287,13 @@ void ov5_021E6720 (UnkStruct_02026310 * param0) } else { BoxPokemon * v5 = ov5_021E622C(param0, v2); - v0 = GetBoxMonData(v5, MON_DATA_PERSONALITY, NULL); - v3 = GetNatureFromPersonality(v0); + v0 = BoxPokemon_GetValue(v5, MON_DATA_PERSONALITY, NULL); + v3 = Pokemon_GetNatureOf(v0); while (TRUE) { v1 = MTRNG_Next(); - if ((v3 == GetNatureFromPersonality(v1)) && (v1 != 0)) { + if ((v3 == Pokemon_GetNatureOf(v1)) && (v1 != 0)) { break; } @@ -2348,28 +2348,28 @@ static void ov5_021E67B0 (Pokemon * param0, UnkStruct_02026310 * param1) switch (v0[v1]) { case 0: - v4 = GetBoxMonData(v5, MON_DATA_HP_IV, NULL); - SetMonData(param0, 70, (u8 *)&v4); + v4 = BoxPokemon_GetValue(v5, MON_DATA_HP_IV, NULL); + Pokemon_SetValue(param0, 70, (u8 *)&v4); break; case 1: - v4 = GetBoxMonData(v5, MON_DATA_ATK_IV, NULL); - SetMonData(param0, 71, (u8 *)&v4); + v4 = BoxPokemon_GetValue(v5, MON_DATA_ATK_IV, NULL); + Pokemon_SetValue(param0, 71, (u8 *)&v4); break; case 2: - v4 = GetBoxMonData(v5, MON_DATA_DEF_IV, NULL); - SetMonData(param0, 72, (u8 *)&v4); + v4 = BoxPokemon_GetValue(v5, MON_DATA_DEF_IV, NULL); + Pokemon_SetValue(param0, 72, (u8 *)&v4); break; case 3: - v4 = GetBoxMonData(v5, MON_DATA_SPEED_IV, NULL); - SetMonData(param0, 73, (u8 *)&v4); + v4 = BoxPokemon_GetValue(v5, MON_DATA_SPEED_IV, NULL); + Pokemon_SetValue(param0, 73, (u8 *)&v4); break; case 4: - v4 = GetBoxMonData(v5, MON_DATA_SPATK_IV, NULL); - SetMonData(param0, 74, (u8 *)&v4); + v4 = BoxPokemon_GetValue(v5, MON_DATA_SPATK_IV, NULL); + Pokemon_SetValue(param0, 74, (u8 *)&v4); break; case 5: - v4 = GetBoxMonData(v5, MON_DATA_SPDEF_IV, NULL); - SetMonData(param0, 75, (u8 *)&v4); + v4 = BoxPokemon_GetValue(v5, MON_DATA_SPDEF_IV, NULL); + Pokemon_SetValue(param0, 75, (u8 *)&v4); break; } } @@ -2381,7 +2381,7 @@ static u8 ov5_021E68D8 (Pokemon * param0, u16 * param1) v2 = 0; v1 = 0; - v0 = GetMonData(param0, MON_DATA_SPECIES, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); for (v3 = 0; v3 < 1909; v3++) { if (Unk_ov5_021F9FA2[v3] == (20000 + v0)) { @@ -2411,13 +2411,13 @@ static void ov5_021E6948 (Pokemon * param0, BoxPokemon * param1, BoxPokemon * pa MI_CpuClearFast(v7, sizeof(UnkStruct_ov5_021E6948)); - v3 = GetMonData(param0, MON_DATA_SPECIES, NULL); - v6 = GetMonData(param0, MON_DATA_FORM, NULL); - v4 = GetMonLevelUpMoveIDs(v3, v6, v7->unk_30); + v3 = Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); + v6 = Pokemon_GetValue(param0, MON_DATA_FORM, NULL); + v4 = Pokemon_LoadLevelUpMoveIdsOf(v3, v6, v7->unk_30); for (v0 = 0; v0 < 4; v0++) { - v7->unk_00[v0] = GetBoxMonData(param1, 54 + v0, NULL); - v7->unk_20[v0] = GetBoxMonData(param2, 54 + v0, NULL); + v7->unk_00[v0] = BoxPokemon_GetValue(param1, 54 + v0, NULL); + v7->unk_20[v0] = BoxPokemon_GetValue(param2, 54 + v0, NULL); } v5 = ov5_021E68D8(param0, v7->unk_94); @@ -2426,8 +2426,8 @@ static void ov5_021E6948 (Pokemon * param0, BoxPokemon * param1, BoxPokemon * pa if (v7->unk_00[v0] != 0) { for (v1 = 0; v1 < v5; v1++) { if (v7->unk_00[v0] == v7->unk_94[v1]) { - if (AddMonMove(param0, v7->unk_00[v0]) == 0xffff) { - ReplaceMonMove(param0, v7->unk_00[v0]); + if (Pokemon_AddMove(param0, v7->unk_00[v0]) == 0xffff) { + Pokemon_ReplaceMove(param0, v7->unk_00[v0]); } break; } @@ -2441,9 +2441,9 @@ static void ov5_021E6948 (Pokemon * param0, BoxPokemon * param1, BoxPokemon * pa if (v7->unk_00[v0] != 0) { for (v1 = 0; v1 < 100; v1++) { if (v7->unk_00[v0] == Item_MoveForTMHM(328 + v1)) { - if (CanMonSpeciesLearnTM(v3, v6, v1)) { - if (AddMonMove(param0, v7->unk_00[v0]) == 0xffff) { - ReplaceMonMove(param0, v7->unk_00[v0]); + if (Pokemon_CanFormLearnTM(v3, v6, v1)) { + if (Pokemon_AddMove(param0, v7->unk_00[v0]) == 0xffff) { + Pokemon_ReplaceMove(param0, v7->unk_00[v0]); } } } @@ -2471,8 +2471,8 @@ static void ov5_021E6948 (Pokemon * param0, BoxPokemon * param1, BoxPokemon * pa for (v1 = 0; v1 < v4; v1++) { if (v7->unk_30[v1] != 0) { if (v7->unk_10[v0] == v7->unk_30[v1]) { - if (AddMonMove(param0, v7->unk_10[v0]) == 0xffff) { - ReplaceMonMove(param0, v7->unk_10[v0]); + if (Pokemon_AddMove(param0, v7->unk_10[v0]) == 0xffff) { + Pokemon_ReplaceMove(param0, v7->unk_10[v0]); } break; } @@ -2519,8 +2519,8 @@ static u16 ov5_021E6B54 (u16 param0, UnkStruct_02026310 * param1) return param0; } - v0 = GetBoxMonData(v4[0], MON_DATA_HELD_ITEM, NULL); - v1 = GetBoxMonData(v4[1], MON_DATA_HELD_ITEM, NULL); + v0 = BoxPokemon_GetValue(v4[0], MON_DATA_HELD_ITEM, NULL); + v1 = BoxPokemon_GetValue(v4[1], MON_DATA_HELD_ITEM, NULL); if ((v0 != Unk_ov5_021F9F6C[v2][1]) && (v1 != Unk_ov5_021F9F6C[v2][1])) { param0 = Unk_ov5_021F9F6C[v2][2]; @@ -2536,12 +2536,12 @@ static void ov5_021E6BD0 (Pokemon * param0, UnkStruct_02026310 * param1) ov5_021E6668(param1, v2); - v0 = GetBoxMonData(v2[0], MON_DATA_HELD_ITEM, NULL); - v1 = GetBoxMonData(v2[1], MON_DATA_HELD_ITEM, NULL); + v0 = BoxPokemon_GetValue(v2[0], MON_DATA_HELD_ITEM, NULL); + v1 = BoxPokemon_GetValue(v2[1], MON_DATA_HELD_ITEM, NULL); if ((v0 == 236) || (v1 == 236)) { - if (AddMonMove(param0, 344) == 0xffff) { - ReplaceMonMove(param0, 344); + if (Pokemon_AddMove(param0, 344) == 0xffff) { + Pokemon_ReplaceMove(param0, 344); } } } @@ -2556,10 +2556,10 @@ static u16 ov5_021E6C20 (UnkStruct_02026310 * param0, u8 param1[]) v2 = 0; for (v1 = 0; v1 < 2; v1++) { - if ((v0[v1] = GetBoxMonData(v6[v1], MON_DATA_SPECIES, NULL)) == 132) { + if ((v0[v1] = BoxPokemon_GetValue(v6[v1], MON_DATA_SPECIES, NULL)) == 132) { param1[0] = v1 ^ 1; param1[1] = v1; - } else if (GetBoxMonGender(v6[v1]) == 1) { + } else if (BoxPokemon_GetGender(v6[v1]) == 1) { param1[0] = v1; param1[1] = v1 ^ 1; } @@ -2588,7 +2588,7 @@ static u16 ov5_021E6C20 (UnkStruct_02026310 * param0, u8 param1[]) v4 = 489; } - if ((v0[param1[1]] == 132) && (GetBoxMonGender(v6[param1[0]]) != 1)) { + if ((v0[param1[1]] == 132) && (BoxPokemon_GetGender(v6[param1[0]]) != 1)) { v5 = param1[1]; param1[1] = param1[0]; param1[0] = v5; @@ -2601,7 +2601,7 @@ void ov5_021E6CF0 (Pokemon * param0, u16 param1, u8 param2, UnkStruct_02025E6C * { u8 v0, v1, v2; u16 v3; - u8 v4 = GetMonSpeciesPersonalDataAttribute(param1, 19); + u8 v4 = PokemonPersonalData_GetSpeciesValue(param1, 19); Strbuf* v5; sub_02073D80(param0, param1, 1, 32, 0, 0, 0, 0); @@ -2609,19 +2609,19 @@ void ov5_021E6CF0 (Pokemon * param0, u16 param1, u8 param2, UnkStruct_02025E6C * v0 = 0; v3 = 4; - SetMonData(param0, 155, &v3); - SetMonData(param0, 9, &v4); - SetMonData(param0, 156, &v0); + Pokemon_SetValue(param0, 155, &v3); + Pokemon_SetValue(param0, 9, &v4); + Pokemon_SetValue(param0, 156, &v0); if (param2) { - SetMonData(param0, 152, ¶m2); + Pokemon_SetValue(param0, 152, ¶m2); } v2 = 1; - SetMonData(param0, 76, &v2); + Pokemon_SetValue(param0, 76, &v2); v5 = sub_0200B32C(494, 4); - SetMonData(param0, 119, v5); + Pokemon_SetValue(param0, 119, v5); Strbuf_Free(v5); if (param4 == 4) { @@ -2629,9 +2629,9 @@ void ov5_021E6CF0 (Pokemon * param0, u16 param1, u8 param2, UnkStruct_02025E6C * u32 v7 = sub_02025F30(param3); Strbuf* v8 = sub_02025F04(param3, 32); - SetMonData(param0, 145, v8); - SetMonData(param0, 7, &v6); - SetMonData(param0, 157, &v7); + Pokemon_SetValue(param0, 145, v8); + Pokemon_SetValue(param0, 7, &v6); + Pokemon_SetValue(param0, 157, &v7); Strbuf_Free(v8); } @@ -2644,18 +2644,18 @@ void ov5_021E6DE8 (Pokemon * param0, u16 param1, UnkStruct_02026310 * param2, u3 u16 v1; u32 v2; Strbuf* v3; - u8 v4 = GetMonSpeciesPersonalDataAttribute(param1, 19); + u8 v4 = PokemonPersonalData_GetSpeciesValue(param1, 19); v2 = sub_02026248(param2); if (sub_02026280(param2)) { int v5; - if (GetMonPersonalityShininess(param3, v2) == 0) { + if (Pokemon_IsPersonalityShiny(param3, v2) == 0) { for (v5 = 0; v5 < 4; v5++) { v2 = ARNG_Next(v2); - if (GetMonPersonalityShininess(param3, v2)) { + if (Pokemon_IsPersonalityShiny(param3, v2)) { break; } } @@ -2669,14 +2669,14 @@ void ov5_021E6DE8 (Pokemon * param0, u16 param1, UnkStruct_02026310 * param2, u3 v0 = 0; v1 = 4; - SetMonData(param0, 155, &v1); - SetMonData(param0, 9, &v4); - SetMonData(param0, 156, &v0); - SetMonData(param0, 112, ¶m4); + Pokemon_SetValue(param0, 155, &v1); + Pokemon_SetValue(param0, 9, &v4); + Pokemon_SetValue(param0, 156, &v0); + Pokemon_SetValue(param0, 112, ¶m4); v3 = sub_0200B32C(494, 4); - SetMonData(param0, 119, v3); + Pokemon_SetValue(param0, 119, v3); Strbuf_Free(v3); } @@ -2684,7 +2684,7 @@ void ov5_021E6EA8 (UnkStruct_02026310 * param0, Party * param1, UnkStruct_02025E { u16 v0; u8 v1[2], v2; - Pokemon * v3 = AllocMonZeroed(4); + Pokemon * v3 = Pokemon_New(4); v0 = ov5_021E6C20(param0, v1); v0 = ov5_021E6B54(v0, param0); @@ -2692,7 +2692,7 @@ void ov5_021E6EA8 (UnkStruct_02026310 * param0, Party * param1, UnkStruct_02025E { u32 v4 = sub_02025F20(param2); BoxPokemon * v5 = ov5_021E622C(param0, v1[0]); - u8 v6 = GetBoxMonData(v5, MON_DATA_FORM, NULL); + u8 v6 = BoxPokemon_GetValue(v5, MON_DATA_FORM, NULL); ov5_021E6DE8(v3, v0, param0, v4, v6); } @@ -2707,7 +2707,7 @@ void ov5_021E6EA8 (UnkStruct_02026310 * param0, Party * param1, UnkStruct_02025E } v2 = 1; - SetMonData(v3, 76, &v2); + Pokemon_SetValue(v3, 76, &v2); Party_AddPokemon(param1, v3); ov5_021E6B40(param0); @@ -2723,8 +2723,8 @@ static int ov5_021E6F6C (Party * param0) v2 = Party_GetCurrentCount(param0); for (v0 = 0; v0 < v2; v0++) { - if (GetMonData(Party_GetPokemonBySlotIndex(param0, v0), MON_DATA_173, NULL) == 0) { - v1 = GetMonData(Party_GetPokemonBySlotIndex(param0, v0), MON_DATA_ABILITY, NULL); + if (Pokemon_GetValue(Party_GetPokemonBySlotIndex(param0, v0), MON_DATA_173, NULL) == 0) { + v1 = Pokemon_GetValue(Party_GetPokemonBySlotIndex(param0, v0), MON_DATA_ABILITY, NULL); if ((v1 == 40) || (v1 == 49)) { return 2; @@ -2756,12 +2756,12 @@ static u8 ov5_021E6FF0 (BoxPokemon ** param0) u32 v2[2], v3[2], v4, v5; for (v5 = 0; v5 < 2; v5++) { - v1[v5] = GetBoxMonData(param0[v5], MON_DATA_SPECIES, NULL); - v2[v5] = GetBoxMonData(param0[v5], MON_DATA_OT_ID, NULL); - v4 = GetBoxMonData(param0[v5], MON_DATA_PERSONALITY, NULL); - v3[v5] = GetMonPersonalityGender(v1[v5], v4); - v0[v5][0] = GetMonSpeciesPersonalDataAttribute(v1[v5], 22); - v0[v5][1] = GetMonSpeciesPersonalDataAttribute(v1[v5], 23); + v1[v5] = BoxPokemon_GetValue(param0[v5], MON_DATA_SPECIES, NULL); + v2[v5] = BoxPokemon_GetValue(param0[v5], MON_DATA_OT_ID, NULL); + v4 = BoxPokemon_GetValue(param0[v5], MON_DATA_PERSONALITY, NULL); + v3[v5] = Pokemon_GetGenderOf(v1[v5], v4); + v0[v5][0] = PokemonPersonalData_GetSpeciesValue(v1[v5], 22); + v0[v5][1] = PokemonPersonalData_GetSpeciesValue(v1[v5], 23); } if ((v0[0][0] == 15) || (v0[1][0] == 15)) { @@ -2862,7 +2862,7 @@ BOOL ov5_021E7154 (UnkStruct_02026310 * param0, Party * param1, UnkStruct_0203CD v2 = 0; for (v0 = 0; v0 < 2; v0++) { - if (GetBoxMonData(v8[v0], MON_DATA_172, NULL) != 0) { + if (BoxPokemon_GetValue(v8[v0], MON_DATA_172, NULL) != 0) { sub_02026260(sub_02026218(param0, v0), 1); v2++; } @@ -2890,12 +2890,12 @@ BOOL ov5_021E7154 (UnkStruct_02026310 * param0, Party * param1, UnkStruct_0203CD for (v0 = 0; v0 < Party_GetCurrentCount(param1); v0++) { Pokemon * v9 = Party_GetPokemonBySlotIndex(param1, v0); - if (GetMonData(v9, MON_DATA_IS_EGG, NULL)) { - if (GetMonData(v9, MON_DATA_3, NULL)) { + if (Pokemon_GetValue(v9, MON_DATA_IS_EGG, NULL)) { + if (Pokemon_GetValue(v9, MON_DATA_3, NULL)) { continue; } - v1 = GetMonData(v9, MON_DATA_FRIENDSHIP, NULL); + v1 = Pokemon_GetValue(v9, MON_DATA_FRIENDSHIP, NULL); if (v1 != 0) { if (v1 >= v7) { @@ -2904,7 +2904,7 @@ BOOL ov5_021E7154 (UnkStruct_02026310 * param0, Party * param1, UnkStruct_0203CD v1--; } - SetMonData(v9, 9, (u8 *)&v1); + Pokemon_SetValue(v9, 9, (u8 *)&v1); } else { return 1; } @@ -2924,8 +2924,8 @@ Pokemon * ov5_021E7278 (Party * param0) for (v0 = 0; v0 < v2; v0++) { v1 = Party_GetPokemonBySlotIndex(param0, v0); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) - && (GetMonData(v1, MON_DATA_FRIENDSHIP, NULL) == 0)) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) + && (Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL) == 0)) { return v1; } } @@ -2940,12 +2940,12 @@ void ov5_021E72BC (UnkStruct_02026310 * param0, UnkStruct_0200B358 * param1) ov5_021E6668(param0, v0); - if (GetBoxMonData(v0[0], MON_DATA_SPECIES, NULL) != 0) { + if (BoxPokemon_GetValue(v0[0], MON_DATA_SPECIES, NULL) != 0) { sub_0200B5CC(param1, 0, v0[0]); sub_0200B5EC(param1, 2, v0[0]); } - if (GetBoxMonData(v0[1], MON_DATA_SPECIES, NULL) != 0) { + if (BoxPokemon_GetValue(v0[1], MON_DATA_SPECIES, NULL) != 0) { sub_0200B5CC(param1, 1, v0[1]); } } @@ -2964,12 +2964,12 @@ void ov5_021E7308 (UnkStruct_02026310 * param0, u32 param1, u32 param2, u32 para v2 = ov5_021E6520(v1, sub_02026228(v0)); sub_0200B60C(param5, param2, v2, 3, 0, 1); - v3 = GetBoxMonData(v1, MON_DATA_GENDER, NULL); + v3 = BoxPokemon_GetValue(v1, MON_DATA_GENDER, NULL); if (v3 != 2) { - v4 = GetBoxMonData(v1, MON_DATA_SPECIES, NULL); + v4 = BoxPokemon_GetValue(v1, MON_DATA_SPECIES, NULL); - if (((v4 == 29) || (v4 == 32)) && (GetBoxMonData(v1, MON_DATA_77, NULL) == 0)) { + if (((v4 == 29) || (v4 == 32)) && (BoxPokemon_GetValue(v1, MON_DATA_77, NULL) == 0)) { v3 = 2; } } @@ -2981,8 +2981,8 @@ u16 ov5_021E73A0 (Party * param0, int param1, UnkStruct_0200B358 * param2) { Pokemon * v0 = Party_GetPokemonBySlotIndex(param0, param1); - sub_0200B5CC(param2, 0, GetBoxMon(v0)); - return GetMonData(v0, MON_DATA_SPECIES, NULL); + sub_0200B5CC(param2, 0, Pokemon_GetBoxPokemon(v0)); + return Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); } u8 ov5_021E73C8 (UnkStruct_02026310 * param0) @@ -3035,38 +3035,38 @@ static void ov5_021E742C (Pokemon * param0, int param1) u8 v5[6], v6; u8 v7, v8, v9, v10, v11, v12, v13, v14; Strbuf* v15 = Strbuf_Init(7 + 1, param1); - Pokemon * v16 = AllocMonZeroed(param1); + Pokemon * v16 = Pokemon_New(param1); - v0 = GetMonData(param0, MON_DATA_SPECIES, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); for (v7 = 0; v7 < 4; v7++) { - v1[v7] = GetMonData(param0, MON_DATA_MOVE1 + v7, NULL); - v2[v7] = GetMonData(param0, MON_DATA_MOVE1_CUR_PP + v7, NULL); + v1[v7] = Pokemon_GetValue(param0, MON_DATA_MOVE1 + v7, NULL); + v2[v7] = Pokemon_GetValue(param0, MON_DATA_MOVE1_CUR_PP + v7, NULL); } - v3 = GetMonData(param0, MON_DATA_PERSONALITY, NULL); + v3 = Pokemon_GetValue(param0, MON_DATA_PERSONALITY, NULL); for (v7 = 0; v7 < 6; v7++) { - v5[v7] = GetMonData(param0, MON_DATA_HP_IV + v7, NULL); + v5[v7] = Pokemon_GetValue(param0, MON_DATA_HP_IV + v7, NULL); } - v8 = GetMonData(param0, MON_DATA_LANGUAGE, NULL); - v9 = GetMonData(param0, MON_DATA_MET_GAME, NULL); - v10 = GetMonData(param0, MON_DATA_11, NULL); - v6 = GetMonData(param0, MON_DATA_POKERUS, NULL); - v12 = GetMonData(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL); + v8 = Pokemon_GetValue(param0, MON_DATA_LANGUAGE, NULL); + v9 = Pokemon_GetValue(param0, MON_DATA_MET_GAME, NULL); + v10 = Pokemon_GetValue(param0, MON_DATA_11, NULL); + v6 = Pokemon_GetValue(param0, MON_DATA_POKERUS, NULL); + v12 = Pokemon_GetValue(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL); - GetMonData(param0, MON_DATA_145, v15); + Pokemon_GetValue(param0, MON_DATA_145, v15); - v14 = GetMonData(param0, MON_DATA_OT_GENDER, NULL); - v4 = GetMonData(param0, MON_DATA_OT_ID, NULL); - v13 = GetMonData(param0, MON_DATA_FORM, NULL); + v14 = Pokemon_GetValue(param0, MON_DATA_OT_GENDER, NULL); + v4 = Pokemon_GetValue(param0, MON_DATA_OT_ID, NULL); + v13 = Pokemon_GetValue(param0, MON_DATA_FORM, NULL); if (v0 == 490) { - int v17 = GetMonData(param0, MON_DATA_152, NULL); + int v17 = Pokemon_GetValue(param0, MON_DATA_152, NULL); if (v17 == sub_02017070(2, 1)) { - while (GetMonPersonalityShininess(v4, v3)) { + while (Pokemon_IsPersonalityShiny(v4, v3)) { v3 = ARNG_Next(v3); } } @@ -3075,54 +3075,54 @@ static void ov5_021E742C (Pokemon * param0, int param1) sub_02073D80(v16, v0, 1, 32, 1, v3, 0, 0); for (v7 = 0; v7 < 4; v7++) { - SetMonData(v16, 54 + v7, &(v1[v7])); - SetMonData(v16, 58 + v7, &(v2[v7])); + Pokemon_SetValue(v16, 54 + v7, &(v1[v7])); + Pokemon_SetValue(v16, 58 + v7, &(v2[v7])); } for (v7 = 0; v7 < 6; v7++) { - SetMonData(v16, 70 + v7, &(v5[v7])); + Pokemon_SetValue(v16, 70 + v7, &(v5[v7])); } - SetMonData(v16, 12, &v8); - SetMonData(v16, 122, &v9); - SetMonData(v16, 11, &v10); + Pokemon_SetValue(v16, 12, &v8); + Pokemon_SetValue(v16, 122, &v9); + Pokemon_SetValue(v16, 11, &v10); v11 = 120; - SetMonData(v16, 9, &v11); - SetMonData(v16, 154, &v6); - SetMonData(v16, 110, &v12); - SetMonData(v16, 145, v15); - SetMonData(v16, 157, &v14); - SetMonData(v16, 7, &v4); - SetMonData(v16, 112, &v13); + Pokemon_SetValue(v16, 9, &v11); + Pokemon_SetValue(v16, 154, &v6); + Pokemon_SetValue(v16, 110, &v12); + Pokemon_SetValue(v16, 145, v15); + Pokemon_SetValue(v16, 157, &v14); + Pokemon_SetValue(v16, 7, &v4); + Pokemon_SetValue(v16, 112, &v13); { u16 v18; u8 v19, v20, v21; - v18 = GetMonData(param0, MON_DATA_152, NULL); - v19 = GetMonData(param0, MON_DATA_146, NULL); - v20 = GetMonData(param0, MON_DATA_147, NULL); - v21 = GetMonData(param0, MON_DATA_148, NULL); + v18 = Pokemon_GetValue(param0, MON_DATA_152, NULL); + v19 = Pokemon_GetValue(param0, MON_DATA_146, NULL); + v20 = Pokemon_GetValue(param0, MON_DATA_147, NULL); + v21 = Pokemon_GetValue(param0, MON_DATA_148, NULL); - SetMonData(v16, 152, &v18); - SetMonData(v16, 146, &v19); - SetMonData(v16, 147, &v20); - SetMonData(v16, 148, &v21); + Pokemon_SetValue(v16, 152, &v18); + Pokemon_SetValue(v16, 146, &v19); + Pokemon_SetValue(v16, 147, &v20); + Pokemon_SetValue(v16, 148, &v21); - v18 = GetMonData(param0, MON_DATA_153, NULL); - v19 = GetMonData(param0, MON_DATA_149, NULL); - v20 = GetMonData(param0, MON_DATA_150, NULL); - v21 = GetMonData(param0, MON_DATA_151, NULL); + v18 = Pokemon_GetValue(param0, MON_DATA_153, NULL); + v19 = Pokemon_GetValue(param0, MON_DATA_149, NULL); + v20 = Pokemon_GetValue(param0, MON_DATA_150, NULL); + v21 = Pokemon_GetValue(param0, MON_DATA_151, NULL); - SetMonData(v16, 153, &v18); - SetMonData(v16, 149, &v19); - SetMonData(v16, 150, &v20); - SetMonData(v16, 151, &v21); + Pokemon_SetValue(v16, 153, &v18); + Pokemon_SetValue(v16, 149, &v19); + Pokemon_SetValue(v16, 150, &v20); + Pokemon_SetValue(v16, 151, &v21); } - sub_020775EC(v16, param0); + Pokemon_Copy(v16, param0); Strbuf_Free(v15); Heap_FreeToHeap(v16); } @@ -3140,16 +3140,16 @@ void ov5_021E771C (Pokemon * param0, int param1) v3 = 0; ov5_021E742C(param0, param1); - SetMonData(param0, 76, &v0); + Pokemon_SetValue(param0, 76, &v0); - v4 = GetMonData(param0, MON_DATA_SPECIES, NULL); + v4 = Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); MessageLoader_GetSpeciesName(v4, 0, v5); - SetMonData(param0, 117, v5); - SetMonData(param0, 77, &v1); - SetMonData(param0, 155, &v2); - SetMonData(param0, 156, &v3); - CalculateMonLevelAndStats(param0); + Pokemon_SetValue(param0, 117, v5); + Pokemon_SetValue(param0, 77, &v1); + Pokemon_SetValue(param0, 155, &v2); + Pokemon_SetValue(param0, 156, &v3); + Pokemon_CalcLevelAndStats(param0); } u32 ov5_021E7790 (BoxPokemon ** param0) diff --git a/src/overlay005/ov5_021EE7D4.c b/src/overlay005/ov5_021EE7D4.c index 1cd031fa0a..3fd5fd84f1 100644 --- a/src/overlay005/ov5_021EE7D4.c +++ b/src/overlay005/ov5_021EE7D4.c @@ -50,13 +50,13 @@ static int ov5_021EE7D4 (Pokemon * param0) u16 v4, v5, v6; u16 v7, v8; - v0 = GetMonData(param0, MON_DATA_PERSONALITY, NULL) & 0xffff; - v1 = GetMonData(param0, MON_DATA_HP_IV, NULL) & 0xf; - v2 = GetMonData(param0, MON_DATA_ATK_IV, NULL) & 0xf; - v3 = GetMonData(param0, MON_DATA_DEF_IV, NULL) & 0xf; - v4 = GetMonData(param0, MON_DATA_SPEED_IV, NULL) & 0xf; - v5 = GetMonData(param0, MON_DATA_SPATK_IV, NULL) & 0xf; - v6 = GetMonData(param0, MON_DATA_SPDEF_IV, NULL) & 0xf; + v0 = Pokemon_GetValue(param0, MON_DATA_PERSONALITY, NULL) & 0xffff; + v1 = Pokemon_GetValue(param0, MON_DATA_HP_IV, NULL) & 0xf; + v2 = Pokemon_GetValue(param0, MON_DATA_ATK_IV, NULL) & 0xf; + v3 = Pokemon_GetValue(param0, MON_DATA_DEF_IV, NULL) & 0xf; + v4 = Pokemon_GetValue(param0, MON_DATA_SPEED_IV, NULL) & 0xf; + v5 = Pokemon_GetValue(param0, MON_DATA_SPATK_IV, NULL) & 0xf; + v6 = Pokemon_GetValue(param0, MON_DATA_SPDEF_IV, NULL) & 0xf; v7 = ((v2 ^ v3) * v1) ^ (v0 & 0xff); v8 = ((v5 ^ v6) * v4) ^ (v0 >> 8); @@ -109,7 +109,7 @@ u8 ov5_021EE920 (UnkStruct_0203CDB0 * param0, u16 param1) u32 v5; v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_0C), param1); - v3 = GetMonData(v0, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); v1 = ov5_021EE7D4(v0); v4 = ov5_021EE8A8(v3, v1); v2 = sub_0206B0B4(sub_020507E4(param0->unk_0C)); @@ -174,7 +174,7 @@ void ov5_021EEA84 (UnkStruct_0203CDB0 * param0, u8 param1, u8 param2, u16 param3 vu16 v2; v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_0C), param3); - v1 = GetMonData(v0, MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); v2 = ov5_021EE7D4(v0); ov5_021EE9E8(param0, param1, param2, v1, v2); diff --git a/src/overlay005/ov5_021F6454.c b/src/overlay005/ov5_021F6454.c index 1938fed575..3925386290 100644 --- a/src/overlay005/ov5_021F6454.c +++ b/src/overlay005/ov5_021F6454.c @@ -465,12 +465,12 @@ BOOL ov5_021F6B3C (UnkStruct_0203E724 * param0) v2 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v3->unk_0C), v4); - v1[0] = GetMonData(v2, MON_DATA_HP_IV, NULL); - v1[1] = GetMonData(v2, MON_DATA_ATK_IV, NULL); - v1[2] = GetMonData(v2, MON_DATA_DEF_IV, NULL); - v1[3] = GetMonData(v2, MON_DATA_SPEED_IV, NULL); - v1[4] = GetMonData(v2, MON_DATA_SPATK_IV, NULL); - v1[5] = GetMonData(v2, MON_DATA_SPDEF_IV, NULL); + v1[0] = Pokemon_GetValue(v2, MON_DATA_HP_IV, NULL); + v1[1] = Pokemon_GetValue(v2, MON_DATA_ATK_IV, NULL); + v1[2] = Pokemon_GetValue(v2, MON_DATA_DEF_IV, NULL); + v1[3] = Pokemon_GetValue(v2, MON_DATA_SPEED_IV, NULL); + v1[4] = Pokemon_GetValue(v2, MON_DATA_SPATK_IV, NULL); + v1[5] = Pokemon_GetValue(v2, MON_DATA_SPDEF_IV, NULL); *v5 = 0; @@ -515,7 +515,7 @@ BOOL ov5_021F6C60 (UnkStruct_0203E724 * param0) for (v3 = 0; v3 < v2; v3++) { v0 = Party_GetPokemonBySlotIndex(v1, v3); - v8[v3] = GetMonData(v0, MON_DATA_HELD_ITEM, NULL); + v8[v3] = Pokemon_GetValue(v0, MON_DATA_HELD_ITEM, NULL); if (v8[v3] == 112) { v9++; @@ -535,27 +535,27 @@ BOOL ov5_021F6C60 (UnkStruct_0203E724 * param0) for (v3 = 0; v3 < v2; v3++) { if (v8[v3] == 112) { v0 = Party_GetPokemonBySlotIndex(v1, v3); - SetMonData(v0, 6, &v7); + Pokemon_SetValue(v0, 6, &v7); } } } for (v3 = 0; v3 < v2; v3++) { v0 = Party_GetPokemonBySlotIndex(v1, v3); - v6 = GetMonData(v0, MON_DATA_FORM, NULL); + v6 = Pokemon_GetValue(v0, MON_DATA_FORM, NULL); if (v6 > 0) { - v5 = GetMonData(v0, MON_DATA_SPECIES, NULL); + v5 = Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); switch (v5) { case 487: - SetGiratinaForm(v0); + Pokemon_SetGiratinaForm(v0); break; case 479: - SetRotomForm(v0, 0, 0); + Pokemon_SetRotomForm(v0, 0, 0); break; case 492: - SetShayminForm(v0, 0); + Pokemon_SetShayminForm(v0, 0); break; } } @@ -585,7 +585,7 @@ BOOL ov5_021F6D80 (UnkStruct_0203E724 * param0) return 0; } - v5 = GetMonData(v0, MON_DATA_HELD_ITEM, NULL); + v5 = Pokemon_GetValue(v0, MON_DATA_HELD_ITEM, NULL); if (v5 == 112) { v6 = sub_0207D570(sub_0207D990(v7->unk_0C), 112, 1, 4); @@ -596,23 +596,23 @@ BOOL ov5_021F6D80 (UnkStruct_0203E724 * param0) } v4 = 0; - SetMonData(v0, 6, &v4); + Pokemon_SetValue(v0, 6, &v4); } - v3 = GetMonData(v0, MON_DATA_FORM, NULL); + v3 = Pokemon_GetValue(v0, MON_DATA_FORM, NULL); if (v3 > 0) { - v2 = GetMonData(v0, MON_DATA_SPECIES, NULL); + v2 = Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); switch (v2) { case 487: - SetGiratinaForm(v0); + Pokemon_SetGiratinaForm(v0); break; case 479: - SetRotomForm(v0, 0, 0); + Pokemon_SetRotomForm(v0, 0, 0); break; case 492: - SetShayminForm(v0, 0); + Pokemon_SetShayminForm(v0, 0); break; } } @@ -628,7 +628,7 @@ BOOL ov5_021F6E50 (UnkStruct_0203E724 * param0) u16 v3 = inline_02049538(param0); v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v1->unk_0C), v2); - SetMonData(v0, 112, &v3); + Pokemon_SetValue(v0, 112, &v3); return 0; } @@ -650,9 +650,9 @@ BOOL ov5_021F6E9C (UnkStruct_0203E724 * param0) for (v4 = 0; v4 < v3; v4++) { v6 = Party_GetPokemonBySlotIndex(v7, v4); - v0 = GetMonData(v6, MON_DATA_SPECIES, NULL); - v1 = GetMonData(v6, MON_DATA_FORM, NULL); - v2 = GetMonData(v6, MON_DATA_IS_EGG, NULL); + v0 = Pokemon_GetValue(v6, MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetValue(v6, MON_DATA_FORM, NULL); + v2 = Pokemon_GetValue(v6, MON_DATA_IS_EGG, NULL); if ((v0 == 479) && (v1 != 0) && (v2 == 0)) { if (*v10 == 0xff) { @@ -682,7 +682,7 @@ BOOL ov5_021F6F44 (UnkStruct_0203E724 * param0) v5 = Party_GetFromSavedata(v6->unk_0C); v4 = Party_GetPokemonBySlotIndex(v5, v7); - SetRotomForm(v4, v10, v8); + Pokemon_SetRotomForm(v4, v10, v8); sub_0202736C(sub_02027560(v6->unk_0C), v4); return 0; @@ -698,9 +698,9 @@ BOOL ov5_021F6FC0 (UnkStruct_0203E724 * param0) u16 * v6 = inline_0204FCAC(param0); v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v4->unk_0C), v5); - v0 = GetMonData(v3, MON_DATA_SPECIES, NULL); + v0 = Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL); - if (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) { switch (v0) { case 10: case 11: @@ -738,12 +738,12 @@ static void ov5_021F70CC (Pokemon * param0, int * param1, int * param2) int v4; int v5; - v0 = GetMonData(param0, MON_DATA_HP_IV, NULL); - v1 = GetMonData(param0, MON_DATA_ATK_IV, NULL); - v2 = GetMonData(param0, MON_DATA_DEF_IV, NULL); - v3 = GetMonData(param0, MON_DATA_SPEED_IV, NULL); - v4 = GetMonData(param0, MON_DATA_SPATK_IV, NULL); - v5 = GetMonData(param0, MON_DATA_SPDEF_IV, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_HP_IV, NULL); + v1 = Pokemon_GetValue(param0, MON_DATA_ATK_IV, NULL); + v2 = Pokemon_GetValue(param0, MON_DATA_DEF_IV, NULL); + v3 = Pokemon_GetValue(param0, MON_DATA_SPEED_IV, NULL); + v4 = Pokemon_GetValue(param0, MON_DATA_SPATK_IV, NULL); + v5 = Pokemon_GetValue(param0, MON_DATA_SPDEF_IV, NULL); if (param1 != NULL) { *param1 = ((v0 & 2) >> 1) | ((v1 & 2) >> 0) | ((v2 & 2) << 1) | ((v3 & 2) << 2) | ((v4 & 2) << 3) | ((v5 & 2) << 4); @@ -769,7 +769,7 @@ BOOL ov5_021F71B8 (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v2->unk_0C), 0); v0 = sub_0202783C(v2->unk_0C); - sub_020278DC(v0, GetMonData(v1, MON_DATA_SPECIES, NULL), GetMonData(v1, MON_DATA_FORM, NULL), GetMonData(v1, MON_DATA_IS_EGG, NULL)); + sub_020278DC(v0, Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL), Pokemon_GetValue(v1, MON_DATA_FORM, NULL), Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL)); return 0; } @@ -803,7 +803,7 @@ BOOL ov5_021F7270 (UnkStruct_0203E724 * param0) v1 = Party_GetFromSavedata(v2->unk_0C); v0 = Party_GetPokemonBySlotIndex(v1, v3); - *v4 = GetMonData(v0, MON_DATA_FORM, NULL); + *v4 = Pokemon_GetValue(v0, MON_DATA_FORM, NULL); return 0; } diff --git a/src/overlay005/ov5_021F77A8.c b/src/overlay005/ov5_021F77A8.c index a91d1420bf..6a469e85ec 100644 --- a/src/overlay005/ov5_021F77A8.c +++ b/src/overlay005/ov5_021F77A8.c @@ -816,8 +816,8 @@ static u8 ov5_021F7A74 (Pokemon * param0, u8 param1) u16 v0; u32 v1, v2; - v2 = GetMonData(param0, MON_DATA_SPECIES, NULL); - v1 = GetMonData(param0, MON_DATA_FORM, NULL); + v2 = Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetValue(param0, MON_DATA_FORM, NULL); v0 = v2; switch (v2) { @@ -872,10 +872,10 @@ static u16 ov5_021F7B60 (Pokemon * param0, u16 param1) u32 v5; u16 v6[4]; - v5 = GetMonData(param0, MON_DATA_SPECIES, NULL); + v5 = Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); for (v2 = 0; v2 < 4; v2++) { - v6[v2] = GetMonData(param0, MON_DATA_MOVE1 + v2, NULL); + v6[v2] = Pokemon_GetValue(param0, MON_DATA_MOVE1 + v2, NULL); } for (v0 = 0; v0 < 5; v0++) { @@ -934,7 +934,7 @@ BOOL ov5_021F7C04 (UnkStruct_0203E724 * param0) if (v14 != 0xff) { for (v5 = 0; v5 < 4; v5++) { - v11[v5] = GetMonData(v6, (54 + v5), NULL); + v11[v5] = Pokemon_GetValue(v6, (54 + v5), NULL); } for (v2 = 0; v2 < 5; v2++) { diff --git a/src/overlay006/ov6_02240C9C.c b/src/overlay006/ov6_02240C9C.c index c00da8357b..862e6bf985 100644 --- a/src/overlay006/ov6_02240C9C.c +++ b/src/overlay006/ov6_02240C9C.c @@ -270,7 +270,7 @@ BOOL ov6_02240D5C (UnkStruct_0203CDB0 * param0) v16 = Party_FirstBattler(v11); v14.unk_04 = 1; - v14.unk_0C = GetMonData(v16, MON_DATA_LEVEL, NULL); + v14.unk_0C = Pokemon_GetValue(v16, MON_DATA_LEVEL, NULL); } } @@ -649,7 +649,7 @@ BOOL ov6_022413E4 (UnkStruct_0203CDB0 * param0, BattleParams ** param1) v15 = Party_FirstBattler(v10); v13.unk_04 = 1; - v13.unk_0C = GetMonData(v15, MON_DATA_LEVEL, NULL); + v13.unk_0C = Pokemon_GetValue(v15, MON_DATA_LEVEL, NULL); } } @@ -1054,7 +1054,7 @@ static void ov6_02241A90 (Pokemon * param0, u8 * param1) { u16 v0; - v0 = GetMonData(param0, MON_DATA_HELD_ITEM, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_HELD_ITEM, NULL); if ((v0 == 224) || (v0 == 320)) { (*param1) = ((*param1) * 2) / 3; @@ -1081,7 +1081,7 @@ static u8 ov6_02241AE4 (Pokemon * param0, const UnkStruct_ov6_022422D0 * param1) if (param1->unk_0D == 0) { if (param1->unk_0E == 28) { if (inline_020564D0(2) == 0) { - v0 = (u32)GetMonData(param0, MON_DATA_PERSONALITY, NULL); + v0 = (u32)Pokemon_GetValue(param0, MON_DATA_PERSONALITY, NULL); v0 = v0 % 25; return (u8)v0; } @@ -1131,8 +1131,8 @@ static void ov6_02241BAC (const u16 param0, const u8 param1, const int param2, c u8 v4; Pokemon * v5; - v5 = AllocMonZeroed(11); - ZeroMonData(v5); + v5 = Pokemon_New(11); + Pokemon_Init(v5); v2 = 0; @@ -1140,7 +1140,7 @@ static void ov6_02241BAC (const u16 param0, const u8 param1, const int param2, c if (param4->unk_0E == 56) { u32 v6; - v6 = GetMonSpeciesPersonalDataAttribute(param0, 18); + v6 = PokemonPersonalData_GetSpeciesValue(param0, 18); switch (v6) { case 0: @@ -1149,13 +1149,13 @@ static void ov6_02241BAC (const u16 param0, const u8 param1, const int param2, c break; default: if (inline_020564D0(3) > 0) { - v3 = GetMonData(param5, MON_DATA_GENDER, NULL); + v3 = Pokemon_GetValue(param5, MON_DATA_GENDER, NULL); v2 = 1; } } } else if (param4->unk_0E == 28) { if (inline_020564D0(2) == 0) { - v4 = GetMonNature(param5); + v4 = Pokemon_GetNature(param5); v2 = 1; } } @@ -1168,7 +1168,7 @@ static void ov6_02241BAC (const u16 param0, const u8 param1, const int param2, c do { if (param4->unk_0E == 56) { - v7 = GetMonPersonalityGender(param0, v1); + v7 = Pokemon_GetGenderOf(param0, v1); GF_ASSERT(v7 != 2); if (v7 != v3) { @@ -1177,7 +1177,7 @@ static void ov6_02241BAC (const u16 param0, const u8 param1, const int param2, c v1 = sub_02075E64(param3); } } else if (param4->unk_0E == 28) { - v8 = GetNatureFromPersonality(v1); + v8 = Pokemon_GetNatureOf(v1); if (v8 == v4) { break; @@ -1202,14 +1202,14 @@ static void ov6_02241CC0 (u16 param0, u8 param1, const int param2, const UnkStru BOOL v2; Pokemon * v3; - v3 = AllocMonZeroed(11); - ZeroMonData(v3); + v3 = Pokemon_New(11); + Pokemon_Init(v3); v0 = 1; { u32 v4; - v4 = GetMonSpeciesPersonalDataAttribute(param0, 18); + v4 = PokemonPersonalData_GetSpeciesValue(param0, 18); switch (v4) { case 0: @@ -1223,7 +1223,7 @@ static void ov6_02241CC0 (u16 param0, u8 param1, const int param2, const UnkStru if (param3->unk_0D == 0) { if (param3->unk_0E == 56) { if (inline_020564D0(3) > 0) { - v1 = GetMonData(param4, MON_DATA_GENDER, NULL); + v1 = Pokemon_GetValue(param4, MON_DATA_GENDER, NULL); if (v1 == 1) { v1 = 0; @@ -1234,7 +1234,7 @@ static void ov6_02241CC0 (u16 param0, u8 param1, const int param2, const UnkStru } sub_02074088(v3, param0, param1, 32, v1, ov6_02241AE4(param4, param3), 0); - SetMonData(v3, 7, ¶m3->unk_00); + Pokemon_SetValue(v3, 7, ¶m3->unk_00); v2 = ov6_02242514(param2, param3, v3, param5); GF_ASSERT(v2); @@ -1246,7 +1246,7 @@ static void ov6_02241CC0 (u16 param0, u8 param1, const int param2, const UnkStru } sub_02074044(v3, param0, param1, 32, ov6_02241AE4(param4, param3)); - SetMonData(v3, 7, ¶m3->unk_00); + Pokemon_SetValue(v3, 7, ¶m3->unk_00); v2 = ov6_02242514(param2, param3, v3, param5); GF_ASSERT(v2); @@ -1490,8 +1490,8 @@ static BOOL ov6_0224219C (const UnkStruct_ov6_0224222C * param0, const u8 param1 v1 = 0; for (v2 = 0; v2 < param1; v2++) { - v3 = GetMonSpeciesPersonalDataAttribute(param0[v2].unk_00, 6); - v4 = GetMonSpeciesPersonalDataAttribute(param0[v2].unk_00, 7); + v3 = PokemonPersonalData_GetSpeciesValue(param0[v2].unk_00, 6); + v4 = PokemonPersonalData_GetSpeciesValue(param0[v2].unk_00, 7); if ((v3 == param2) || (v4 == param2)) { v0[v1++] = v2; @@ -1564,7 +1564,7 @@ static BOOL ov6_022422D0 (const UnkStruct_ov6_022422D0 * param0, Pokemon * param if (param0->unk_0D == 0) { if ((param0->unk_0E == 51) || (param0->unk_0E == 22)) { - v0 = GetMonData(param1, MON_DATA_LEVEL, NULL); + v0 = Pokemon_GetValue(param1, MON_DATA_LEVEL, NULL); if (v0 <= 5) { return 0; @@ -1620,7 +1620,7 @@ static void ov6_0224239C (const u32 param0, UnkStruct_0206C638 * param1, BattleP BOOL v6; Pokemon * v7; - v7 = AllocMonZeroed(4); + v7 = Pokemon_New(4); v0 = sub_0202D93C(param1, 4); v1 = sub_0202D93C(param1, 6); v2 = sub_0202D93C(param1, 2); @@ -1629,9 +1629,9 @@ static void ov6_0224239C (const u32 param0, UnkStruct_0206C638 * param1, BattleP v5 = sub_0202D93C(param1, 5); sub_02074158(v7, v0, v1, v2, v3); - SetMonData(v7, 7, ¶m0); - SetMonData(v7, 160, &v4); - SetMonData(v7, 163, &v5); + Pokemon_SetValue(v7, 7, ¶m0); + Pokemon_SetValue(v7, 160, &v4); + Pokemon_SetValue(v7, 163, &v5); v6 = Party_AddPokemon(param2->parties[1], v7); @@ -1694,7 +1694,7 @@ static BOOL ov6_02242514 (const int param0, const UnkStruct_ov6_022422D0 * param int v3; v1 = 0; - v3 = GetMonData(param2, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(param2, MON_DATA_SPECIES, NULL); if (v3 == 422) { v1 = 1; @@ -1721,7 +1721,7 @@ static BOOL ov6_02242514 (const int param0, const UnkStruct_ov6_022422D0 * param } if (v1) { - SetMonData(param2, 112, (u8 *)&v2); + Pokemon_SetValue(param2, 112, (u8 *)&v2); } } @@ -1758,9 +1758,9 @@ static u8 ov6_022425D4 (const UnkStruct_ov6_0224222C * param0, const UnkStruct_o static void ov6_02242634 (UnkStruct_0203CDB0 * param0, Pokemon * param1, UnkStruct_ov6_02242634 * param2, UnkStruct_ov6_022422D0 * param3) { - if (GetMonData(param1, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(param1, MON_DATA_IS_EGG, NULL) == 0) { param3->unk_0D = 0; - param3->unk_0E = GetMonData(param1, MON_DATA_ABILITY, NULL); + param3->unk_0E = Pokemon_GetValue(param1, MON_DATA_ABILITY, NULL); } else { param3->unk_0D = 1; param3->unk_0E = 123; diff --git a/src/overlay006/ov6_022426AC.c b/src/overlay006/ov6_022426AC.c index 0781ddbe6a..9feb027bc3 100644 --- a/src/overlay006/ov6_022426AC.c +++ b/src/overlay006/ov6_022426AC.c @@ -73,7 +73,7 @@ void ov6_022426C0 (UnkStruct_ov6_022426B8 * param0, const int param1) int v2; u8 v3; - v3 = GetMonSpeciesPersonalDataAttribute(param1, 18); + v3 = PokemonPersonalData_GetSpeciesValue(param1, 18); switch (v3) { case 0: diff --git a/src/overlay006/ov6_02243258.c b/src/overlay006/ov6_02243258.c index 8701ddb944..ddfbd3db7a 100644 --- a/src/overlay006/ov6_02243258.c +++ b/src/overlay006/ov6_02243258.c @@ -2069,7 +2069,7 @@ static void * ov6_0224509C (Pokemon * param0, UnkStruct_02008A90 * param1, u32 p GF_ASSERT(v0 != NULL); { - int v1 = GetMonData(param0, MON_DATA_PERSONALITY, NULL); + int v1 = Pokemon_GetValue(param0, MON_DATA_PERSONALITY, NULL); sub_02013750(param1->unk_00, param1->unk_02, param2, v0, v1, 0, 2, param1->unk_06); } diff --git a/src/overlay006/ov6_02246034.c b/src/overlay006/ov6_02246034.c index b229faf630..21a9862cad 100644 --- a/src/overlay006/ov6_02246034.c +++ b/src/overlay006/ov6_02246034.c @@ -35,12 +35,12 @@ void ov6_02246034 (UnkStruct_0203CDB0 * param0, BattleParams * param1) v5 = param1->parties[1]; v6 = Party_GetPokemonBySlotIndex(v5, 0); v3 = sub_0202D834(param0->unk_0C); - v2 = GetMonData(v6, MON_DATA_SPECIES, NULL); + v2 = Pokemon_GetValue(v6, MON_DATA_SPECIES, NULL); v4 = ov6_02246148(v3, v2); if (v4 != NULL) { - v0 = (u16)(GetMonData(v6, MON_DATA_CURRENT_HP, NULL)); - v1 = (u8)(GetMonData(v6, MON_DATA_160, NULL)); + v0 = (u16)(Pokemon_GetValue(v6, MON_DATA_CURRENT_HP, NULL)); + v1 = (u8)(Pokemon_GetValue(v6, MON_DATA_160, NULL)); if (((param1->unk_14 == 0x1) && (v0 == 0))) { sub_0202D914(&v4); diff --git a/src/overlay006/ov6_02246184.c b/src/overlay006/ov6_02246184.c index 27032e914f..6c7acf3ce2 100644 --- a/src/overlay006/ov6_02246184.c +++ b/src/overlay006/ov6_02246184.c @@ -71,7 +71,7 @@ UnkStruct_ov6_02246204 * ov6_02246184 (u32 param0, u32 param1) v0->unk_00 = sub_02006FE8(115, param1, 0, param0, 0); v0->unk_10 = param0; v0->unk_0C = param1; - v0->unk_04 = AllocMonZeroed(param0); + v0->unk_04 = Pokemon_New(param0); v0->unk_08 = sub_02025E6C(param0); sub_02025E8C(v0->unk_08); @@ -120,15 +120,15 @@ void ov6_02246254 (UnkStruct_0203CDB0 * param0, UnkStruct_ov6_02246204 * param1, int v4; v1 = Party_GetPokemonBySlotIndex(v0, param2); - v3 = GetMonData(v1, MON_DATA_LEVEL, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); ov6_0224630C(param1->unk_04, param1->unk_00, v3, param1->unk_0C, param1->unk_10, param0->unk_1C->unk_00); - sub_020775EC(v1, param4); - sub_020775EC(param1->unk_04, param5); + Pokemon_Copy(v1, param4); + Pokemon_Copy(param1->unk_04, param5); - param3->unk_00 = GetBoxMon(param4); - param3->unk_04 = GetBoxMon(param5); + param3->unk_00 = Pokemon_GetBoxPokemon(param4); + param3->unk_04 = Pokemon_GetBoxPokemon(param5); param3->unk_08 = param1->unk_08; param3->unk_10 = 1; param3->unk_14 = sub_02025E44(param0->unk_0C); @@ -164,36 +164,36 @@ static void ov6_0224630C (Pokemon * param0, UnkStruct_ov6_0224630C * param1, u32 v0 = ov6_022462E4(param4, param3); - SetMonData(param0, 119, v0); + Pokemon_SetValue(param0, 119, v0); Strbuf_Free(v0); v1 = 1; - SetMonData(param0, 77, &v1); - SetMonData(param0, 70, ¶m1->unk_04); - SetMonData(param0, 71, ¶m1->unk_08); - SetMonData(param0, 72, ¶m1->unk_0C); - SetMonData(param0, 73, ¶m1->unk_10); - SetMonData(param0, 74, ¶m1->unk_14); - SetMonData(param0, 75, ¶m1->unk_18); - SetMonData(param0, 19, ¶m1->unk_24); - SetMonData(param0, 20, ¶m1->unk_28); - SetMonData(param0, 21, ¶m1->unk_2C); - SetMonData(param0, 22, ¶m1->unk_30); - SetMonData(param0, 23, ¶m1->unk_34); - SetMonData(param0, 6, ¶m1->unk_3C); + Pokemon_SetValue(param0, 77, &v1); + Pokemon_SetValue(param0, 70, ¶m1->unk_04); + Pokemon_SetValue(param0, 71, ¶m1->unk_08); + Pokemon_SetValue(param0, 72, ¶m1->unk_0C); + Pokemon_SetValue(param0, 73, ¶m1->unk_10); + Pokemon_SetValue(param0, 74, ¶m1->unk_14); + Pokemon_SetValue(param0, 75, ¶m1->unk_18); + Pokemon_SetValue(param0, 19, ¶m1->unk_24); + Pokemon_SetValue(param0, 20, ¶m1->unk_28); + Pokemon_SetValue(param0, 21, ¶m1->unk_2C); + Pokemon_SetValue(param0, 22, ¶m1->unk_30); + Pokemon_SetValue(param0, 23, ¶m1->unk_34); + Pokemon_SetValue(param0, 6, ¶m1->unk_3C); v0 = ov6_022462E4(param4, 4 + param3); - SetMonData(param0, 145, v0); + Pokemon_SetValue(param0, 145, v0); Strbuf_Free(v0); - SetMonData(param0, 157, ¶m1->unk_40); - SetMonData(param0, 12, ¶m1->unk_48); + Pokemon_SetValue(param0, 157, ¶m1->unk_40); + Pokemon_SetValue(param0, 12, ¶m1->unk_48); v2 = sub_0203A138(param5); sub_0209304C(param0, NULL, 1, v2, param4); - CalculateMonLevelAndStats(param0); + Pokemon_CalcLevelAndStats(param0); - GF_ASSERT(GetMonShininess(param0) == 0); + GF_ASSERT(Pokemon_IsShiny(param0) == 0); } diff --git a/src/overlay006/ov6_022489E4.c b/src/overlay006/ov6_022489E4.c index 44981d5f54..5f6a2dd428 100644 --- a/src/overlay006/ov6_022489E4.c +++ b/src/overlay006/ov6_022489E4.c @@ -85,7 +85,7 @@ void ov6_02248AC8 (int param0, int param1, void * param2, void * param3) int v2; u8 * v3; - v1 = PokemonStructSize(); + v1 = Pokemon_StructSize(); v3 = param2; v2 = v3[v1]; @@ -100,7 +100,7 @@ BOOL ov6_02248AF0 (UnkStruct_02095C48 * param0, int param1, const Pokemon * para int v1; int v2; - v1 = PokemonStructSize(); + v1 = Pokemon_StructSize(); v0 = Heap_AllocFromHeap(20, v1 + 1); MI_CpuCopy8(param2, v0, v1); v0[v1] = param1; @@ -122,7 +122,7 @@ void ov6_02248B30 (int param0, int param1, void * param2, void * param3) u8 * v3; int v4; - v1 = PokemonStructSize(); + v1 = Pokemon_StructSize(); v2 = v1 * 4; v3 = param2; @@ -140,7 +140,7 @@ BOOL ov6_02248B70 (UnkStruct_02095C48 * param0, Pokemon ** param1) int v3; int v4; - v1 = PokemonStructSize(); + v1 = Pokemon_StructSize(); v2 = v1 * 4; v0 = param0->unk_569; diff --git a/src/overlay010/ov10_0221F800.c b/src/overlay010/ov10_0221F800.c index 15f74cf2ef..cee7564ac7 100644 --- a/src/overlay010/ov10_0221F800.c +++ b/src/overlay010/ov10_0221F800.c @@ -1541,7 +1541,7 @@ static void ov10_022211F0 (UnkStruct_ov10_0221FB28 * param0, Party * param1, u16 if (v3 > v1) { v0 = Party_GetPokemonBySlotIndex(param1, v1); - if ((GetMonData(v0, MON_DATA_SPECIES, NULL) == 0) || (GetMonData(v0, MON_DATA_IS_EGG, NULL) != 0)) { + if ((Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL) == 0) || (Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL) != 0)) { continue; } @@ -2044,27 +2044,27 @@ static void ov10_02221D14 (UnkStruct_ov10_0221FB28 * param0, Party * param1, u8 v0 = Party_GetPokemonBySlotIndex(param1, v1); param0->unk_214[v1 + param2].unk_00 = sub_02079D80(v0); - param0->unk_214[v1 + param2].unk_04 = (u16)GetMonData(v0, MON_DATA_SPECIES, NULL); + param0->unk_214[v1 + param2].unk_04 = (u16)Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); if (param0->unk_214[v1 + param2].unk_04 == 0) { continue; } - param0->unk_214[v1 + param2].unk_0F = (u16)GetMonData(v0, MON_DATA_IS_EGG, NULL); - param0->unk_214[v1 + param2].unk_06 = (u16)GetMonData(v0, MON_DATA_CURRENT_HP, NULL); - param0->unk_214[v1 + param2].unk_08 = (u16)GetMonData(v0, MON_DATA_MAX_HP, NULL); - param0->unk_214[v1 + param2].unk_0C = (u16)GetMonData(v0, MON_DATA_LEVEL, NULL); - param0->unk_214[v1 + param2].unk_0A = (u16)GetMonData(v0, MON_DATA_HELD_ITEM, NULL); - param0->unk_214[v1 + param2].unk_10 = (u8)GetMonData(v0, MON_DATA_162, NULL); - param0->unk_214[v1 + param2].unk_11 = (u8)GetMonData(v0, MON_DATA_FORM, NULL); + param0->unk_214[v1 + param2].unk_0F = (u16)Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL); + param0->unk_214[v1 + param2].unk_06 = (u16)Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, NULL); + param0->unk_214[v1 + param2].unk_08 = (u16)Pokemon_GetValue(v0, MON_DATA_MAX_HP, NULL); + param0->unk_214[v1 + param2].unk_0C = (u16)Pokemon_GetValue(v0, MON_DATA_LEVEL, NULL); + param0->unk_214[v1 + param2].unk_0A = (u16)Pokemon_GetValue(v0, MON_DATA_HELD_ITEM, NULL); + param0->unk_214[v1 + param2].unk_10 = (u8)Pokemon_GetValue(v0, MON_DATA_162, NULL); + param0->unk_214[v1 + param2].unk_11 = (u8)Pokemon_GetValue(v0, MON_DATA_FORM, NULL); - if (GetMonData(v0, MON_DATA_176, NULL) == 1) { + if (Pokemon_GetValue(v0, MON_DATA_176, NULL) == 1) { param0->unk_214[v1 + param2].unk_0E = 0; } else { param0->unk_214[v1 + param2].unk_0E = 1; } - param0->unk_214[v1 + param2].unk_0D = GetMonGender(v0); + param0->unk_214[v1 + param2].unk_0D = Pokemon_GetGender(v0); param0->unk_214[v1 + param2].unk_14 = (u8)sub_0208E9F0(v0); } } @@ -2273,7 +2273,7 @@ static void ov10_02222400 (UnkStruct_ov10_0221FB28 * param0, MessageLoader * par v2 = MessageLoader_GetNewStrbuf(param1, 8 + param5); - sub_0200B5CC(param3, 0, GetBoxMon(v0)); + sub_0200B5CC(param3, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param3, param4, v2); Strbuf_Free(v2); sub_0201D78C(v1, 0, param4, 0, 0, 0xff, ((u32)(((15 & 0xff) << 16) | ((14 & 0xff) << 8) | ((0 & 0xff) << 0))), NULL); diff --git a/src/overlay012/ov12_02235E94.c b/src/overlay012/ov12_02235E94.c index 18cf050db3..8ae51dfc82 100644 --- a/src/overlay012/ov12_02235E94.c +++ b/src/overlay012/ov12_02235E94.c @@ -369,7 +369,7 @@ UnkStruct_ov12_02235FE0 * ov12_02236004 (int param0, const UnkStruct_ov12_022360 void ov12_02236030 (UnkStruct_ov12_02235FE0 * param0, const UnkStruct_ov12_02236030 * param1) { param0->unk_04 = *param1; - param0->unk_9C = GetMonData(param0->unk_04.unk_08, MON_DATA_162, NULL); + param0->unk_9C = Pokemon_GetValue(param0->unk_04.unk_08, MON_DATA_162, NULL); GF_ASSERT(param0->unk_9C < 12 + 1); @@ -379,11 +379,11 @@ void ov12_02236030 (UnkStruct_ov12_02235FE0 * param0, const UnkStruct_ov12_02236 if (param0->unk_04.unk_04 != 0) { param0->unk_98 = param0->unk_04.unk_04; } else { - param0->unk_98 = GetMonData(param0->unk_04.unk_08, MON_DATA_POKEBALL, NULL); + param0->unk_98 = Pokemon_GetValue(param0->unk_04.unk_08, MON_DATA_POKEBALL, NULL); } } else { param0->unk_94 = 1; - GetMonData(param0->unk_04.unk_08, MON_DATA_171, ¶m0->unk_A0); + Pokemon_GetValue(param0->unk_04.unk_08, MON_DATA_171, ¶m0->unk_A0); } } diff --git a/src/overlay013/ov13_0221FC20.c b/src/overlay013/ov13_0221FC20.c index 0253a0b22f..7560ccd729 100644 --- a/src/overlay013/ov13_0221FC20.c +++ b/src/overlay013/ov13_0221FC20.c @@ -394,7 +394,7 @@ static u8 ov13_0221FFDC (UnkStruct_ov13_022213F0 * param0) if ((ov13_022213F0(param0, v0->unk_11) == 1) && (Item_LoadParam(v0->unk_22, 23, v0->unk_0C) == 0)) { ov13_02221A54(v0->unk_08, v0->unk_22, v0->unk_33, v0->unk_0C); param0->unk_04[v0->unk_11].unk_00 = ov16_0223DFAC(v0->unk_08, v0->unk_28, v0->unk_2C[v0->unk_11]); - v0->unk_20 = GetMonData(param0->unk_04[v0->unk_11].unk_00, MON_DATA_CURRENT_HP, NULL); + v0->unk_20 = Pokemon_GetValue(param0->unk_04[v0->unk_11].unk_00, MON_DATA_CURRENT_HP, NULL); v0->unk_20 -= param0->unk_04[v0->unk_11].unk_10; param0->unk_2075 = 25; } else { @@ -887,7 +887,7 @@ static u8 ov13_022208A4 (UnkStruct_ov13_022213F0 * param0) ov13_02224144(param0); if (param0->unk_2076 == 5) { - param0->unk_207C[0] = (u16)GetMonData(param0->unk_04[v0->unk_11].unk_00, 58 + v0->unk_34, NULL); + param0->unk_207C[0] = (u16)Pokemon_GetValue(param0->unk_04[v0->unk_11].unk_00, 58 + v0->unk_34, NULL); param0->unk_2078 = 2; } else { param0->unk_04[v0->unk_11].unk_17_3 = sub_0208E9F0(param0->unk_04[v0->unk_11].unk_00); @@ -897,7 +897,7 @@ static u8 ov13_022208A4 (UnkStruct_ov13_022213F0 * param0) ov13_022234A8(param0, v0->unk_11); } - param0->unk_207A = GetMonData(param0->unk_04[v0->unk_11].unk_00, MON_DATA_CURRENT_HP, NULL); + param0->unk_207A = Pokemon_GetValue(param0->unk_04[v0->unk_11].unk_00, MON_DATA_CURRENT_HP, NULL); param0->unk_2078 = 4; } @@ -954,7 +954,7 @@ static u8 ov13_02220A4C (UnkStruct_ov13_022213F0 * param0) continue; } - param0->unk_207C[v1] = (u16)GetMonData(param0->unk_04[v0->unk_11].unk_00, MON_DATA_MOVE1_CUR_PP + v1, NULL); + param0->unk_207C[v1] = (u16)Pokemon_GetValue(param0->unk_04[v0->unk_11].unk_00, MON_DATA_MOVE1_CUR_PP + v1, NULL); } ov13_02224144(param0); @@ -1206,62 +1206,62 @@ static void ov13_02220F98 (UnkStruct_ov13_022213F0 * param0) for (v0 = 0; v0 < Party_GetCurrentCount(param0->unk_00->unk_00); v0++) { param0->unk_04[v0].unk_00 = Party_GetPokemonBySlotIndex(param0->unk_00->unk_00, v0); - param0->unk_04[v0].unk_04 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_SPECIES, NULL); + param0->unk_04[v0].unk_04 = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_SPECIES, NULL); if (param0->unk_04[v0].unk_04 == 0) { continue; } - param0->unk_04[v0].unk_06 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_ATK, NULL); - param0->unk_04[v0].unk_08 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_DEF, NULL); - param0->unk_04[v0].unk_0A = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_SPEED, NULL); - param0->unk_04[v0].unk_0C = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_SP_ATK, NULL); - param0->unk_04[v0].unk_0E = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_SP_DEF, NULL); - param0->unk_04[v0].unk_10 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_CURRENT_HP, NULL); - param0->unk_04[v0].unk_12 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_MAX_HP, NULL); - param0->unk_04[v0].unk_14 = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_177, NULL); - param0->unk_04[v0].unk_15 = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_178, NULL); - param0->unk_04[v0].unk_16_0 = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_LEVEL, NULL); - - if (GetMonData(param0->unk_04[v0].unk_00, MON_DATA_176, NULL) == 1) { + param0->unk_04[v0].unk_06 = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_ATK, NULL); + param0->unk_04[v0].unk_08 = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_DEF, NULL); + param0->unk_04[v0].unk_0A = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_SPEED, NULL); + param0->unk_04[v0].unk_0C = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_SP_ATK, NULL); + param0->unk_04[v0].unk_0E = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_SP_DEF, NULL); + param0->unk_04[v0].unk_10 = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_CURRENT_HP, NULL); + param0->unk_04[v0].unk_12 = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_MAX_HP, NULL); + param0->unk_04[v0].unk_14 = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_177, NULL); + param0->unk_04[v0].unk_15 = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_178, NULL); + param0->unk_04[v0].unk_16_0 = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_LEVEL, NULL); + + if (Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_176, NULL) == 1) { param0->unk_04[v0].unk_16_7 = 0; } else { param0->unk_04[v0].unk_16_7 = 1; } - param0->unk_04[v0].unk_17_0 = GetMonGender(param0->unk_04[v0].unk_00); + param0->unk_04[v0].unk_17_0 = Pokemon_GetGender(param0->unk_04[v0].unk_00); param0->unk_04[v0].unk_17_3 = sub_0208E9F0(param0->unk_04[v0].unk_00); - param0->unk_04[v0].unk_17_7 = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_IS_EGG, NULL); - param0->unk_04[v0].unk_18 = (u16)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_ABILITY, NULL); - param0->unk_04[v0].unk_1A = (u16)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_HELD_ITEM, NULL); - param0->unk_04[v0].unk_1C = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_EXP, NULL); - param0->unk_04[v0].unk_20 = GetMonSpeciesLevelExp(param0->unk_04[v0].unk_04, param0->unk_04[v0].unk_16_0); + param0->unk_04[v0].unk_17_7 = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_IS_EGG, NULL); + param0->unk_04[v0].unk_18 = (u16)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_ABILITY, NULL); + param0->unk_04[v0].unk_1A = (u16)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_HELD_ITEM, NULL); + param0->unk_04[v0].unk_1C = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_EXP, NULL); + param0->unk_04[v0].unk_20 = Pokemon_GetSpeciesBaseExpAt(param0->unk_04[v0].unk_04, param0->unk_04[v0].unk_16_0); if (param0->unk_04[v0].unk_16_0 == 100) { param0->unk_04[v0].unk_24 = param0->unk_04[v0].unk_20; } else { - param0->unk_04[v0].unk_24 = GetMonSpeciesLevelExp(param0->unk_04[v0].unk_04, param0->unk_04[v0].unk_16_0 + 1); + param0->unk_04[v0].unk_24 = Pokemon_GetSpeciesBaseExpAt(param0->unk_04[v0].unk_04, param0->unk_04[v0].unk_16_0 + 1); } - param0->unk_04[v0].unk_28 = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_COOL, NULL); - param0->unk_04[v0].unk_29 = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_BEAUTY, NULL); - param0->unk_04[v0].unk_2A = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_CUTE, NULL); - param0->unk_04[v0].unk_2B = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_SMART, NULL); - param0->unk_04[v0].unk_2C = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_TOUGH, NULL); - param0->unk_04[v0].unk_2D = (u16)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_162, NULL); - param0->unk_04[v0].unk_2E = (u8)GetMonData(param0->unk_04[v0].unk_00, MON_DATA_FORM, NULL); + param0->unk_04[v0].unk_28 = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_COOL, NULL); + param0->unk_04[v0].unk_29 = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_BEAUTY, NULL); + param0->unk_04[v0].unk_2A = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_CUTE, NULL); + param0->unk_04[v0].unk_2B = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_SMART, NULL); + param0->unk_04[v0].unk_2C = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_TOUGH, NULL); + param0->unk_04[v0].unk_2D = (u16)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_162, NULL); + param0->unk_04[v0].unk_2E = (u8)Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_FORM, NULL); for (v1 = 0; v1 < 4; v1++) { UnkStruct_ov13_022236B8 * v2 = ¶m0->unk_04[v0].unk_30[v1]; - v2->unk_00 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_MOVE1 + v1, NULL); + v2->unk_00 = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_MOVE1 + v1, NULL); if (v2->unk_00 == 0) { continue; } - v2->unk_02 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_MOVE1_CUR_PP + v1, NULL); - v2->unk_03 = GetMonData(param0->unk_04[v0].unk_00, MON_DATA_MOVE1_PP_UPS + v1, NULL); + v2->unk_02 = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_MOVE1_CUR_PP + v1, NULL); + v2->unk_03 = Pokemon_GetValue(param0->unk_04[v0].unk_00, MON_DATA_MOVE1_PP_UPS + v1, NULL); v2->unk_03 = MoveTable_CalcMaxPP(v2->unk_00, v2->unk_03); v2->unk_04 = MoveTable_LoadParam(v2->unk_00, MOVEATTRIBUTE_TYPE); v2->unk_05 = MoveTable_LoadParam(v2->unk_00, MOVEATTRIBUTE_CLASS); @@ -1620,7 +1620,7 @@ static u8 ov13_022217A4 (UnkStruct_ov13_022213F0 * param0) if (v0->unk_10 == 0) { v1 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 77); - sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0->unk_00)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0->unk_00)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v1); Strbuf_Free(v1); return 0; @@ -1628,7 +1628,7 @@ static u8 ov13_022217A4 (UnkStruct_ov13_022213F0 * param0) if ((param0->unk_00->unk_2C[param0->unk_00->unk_11] == param0->unk_00->unk_14) || (param0->unk_00->unk_2C[param0->unk_00->unk_11] == param0->unk_00->unk_15)) { v1 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 76); - sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0->unk_00)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0->unk_00)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v1); Strbuf_Free(v1); return 0; @@ -1643,7 +1643,7 @@ static u8 ov13_022217A4 (UnkStruct_ov13_022213F0 * param0) v0 = ¶m0->unk_04[param0->unk_00->unk_11]; v1 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 93); - sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0->unk_00)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0->unk_00)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v1); Strbuf_Free(v1); return 0; @@ -1653,7 +1653,7 @@ static u8 ov13_022217A4 (UnkStruct_ov13_022213F0 * param0) v0 = ¶m0->unk_04[param0->unk_2072]; v1 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 78); - sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0->unk_00)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0->unk_00)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v1); Strbuf_Free(v1); return 0; diff --git a/src/overlay013/ov13_02221A88.c b/src/overlay013/ov13_02221A88.c index 47d095946e..7565e53792 100644 --- a/src/overlay013/ov13_02221A88.c +++ b/src/overlay013/ov13_02221A88.c @@ -318,7 +318,7 @@ static void ov13_02221C54 (UnkStruct_ov13_022213F0 * param0, u32 param1, u32 par v2 = Strbuf_Init(12, param0->unk_00->unk_0C); v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, Unk_ov13_02228EC4[param3]); - sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v1->unk_00)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v1->unk_00)); sub_0200C388(param0->unk_1FA8, v2, v3); if (param2 == 0) { @@ -1204,7 +1204,7 @@ static void ov13_02223550 (UnkStruct_ov13_022213F0 * param0, u32 param1) v2 = Strbuf_Init(12, param0->unk_00->unk_0C); v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, Unk_ov13_02228EC4[param1]); - sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v1->unk_00)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v1->unk_00)); sub_0200C388(param0->unk_1FA8, v2, v3); Strbuf_Free(v3); @@ -1564,7 +1564,7 @@ void ov13_02224144 (UnkStruct_ov13_022213F0 * param0) v1 = param0->unk_00; v2 = Item_Load(v1->unk_22, 0, v1->unk_0C); v0 = ov16_0223DFAC(v1->unk_08, v1->unk_28, v1->unk_2C[v1->unk_11]); - v4 = GetMonData(v0, MON_DATA_CURRENT_HP, NULL); + v4 = Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, NULL); v5 = 0; if (Item_Get(v2, 15) != 0) { @@ -1597,12 +1597,12 @@ void ov13_02224144 (UnkStruct_ov13_022213F0 * param0) if ((param0->unk_04[v1->unk_11].unk_10 == 0) && (v4 != 0)) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 88); - sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (param0->unk_04[v1->unk_11].unk_10 != v4) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 82); - sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B60C(param0->unk_1FA8, 1, v4 - param0->unk_04[v1->unk_11].unk_10, 3, 0, 1); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); @@ -1610,42 +1610,42 @@ void ov13_02224144 (UnkStruct_ov13_022213F0 * param0) MessageLoader_GetStrbuf(param0->unk_1FA4, 87, param0->unk_1FAC); } else if (v5 == 0x1) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 92); - sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (v5 == 0x2) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 83); - sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (v5 == 0x4) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 85); - sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (v5 == 0x8) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 86); - sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (v5 == 0x10) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 84); - sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (v5 == 0x20) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 90); - sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else if (v5 == 0x40) { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 91); - sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } else { v3 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 89); - sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v3); Strbuf_Free(v3); } @@ -1663,7 +1663,7 @@ void ov13_0222449C (UnkStruct_ov13_022213F0 * param0) v0 = ov16_0223DFAC(v1->unk_08, v1->unk_28, v1->unk_2C[v1->unk_11]); v2 = MessageLoader_GetNewStrbuf(param0->unk_1FA4, 95); - sub_0200B5CC(param0->unk_1FA8, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_1FA8, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B630(param0->unk_1FA8, 1, 373); sub_0200C388(param0->unk_1FA8, param0->unk_1FAC, v2); Strbuf_Free(v2); diff --git a/src/overlay013/ov13_022264F4.c b/src/overlay013/ov13_022264F4.c index 37f8cf9840..b03e62e5dd 100644 --- a/src/overlay013/ov13_022264F4.c +++ b/src/overlay013/ov13_022264F4.c @@ -415,7 +415,7 @@ static u8 ov13_02226A5C (UnkStruct_ov13_02227244 * param0) v3 = ov16_0223DFAC(v0->unk_00, v0->unk_10, v1); v4 = MessageLoader_GetNewStrbuf(param0->unk_10, 46); - sub_0200B5CC(param0->unk_14, 0, GetBoxMon(v3)); + sub_0200B5CC(param0->unk_14, 0, Pokemon_GetBoxPokemon(v3)); sub_0200B630(param0->unk_14, 1, 373); sub_0200C388(param0->unk_14, param0->unk_18, v4); Strbuf_Free(v4); diff --git a/src/overlay014/ov14_0221FC20.c b/src/overlay014/ov14_0221FC20.c index 2ade0aca60..5bbe2c577e 100644 --- a/src/overlay014/ov14_0221FC20.c +++ b/src/overlay014/ov14_0221FC20.c @@ -327,7 +327,7 @@ void ov14_0221FC20 (BattleSystem * param0, BattleContext * param1, u8 param2, u8 v1 = BattleSystem_CheckStruggling(param0, param1, param2, 0, 0xffffffff); for (v0 = 0; v0 < LEARNED_MOVES_MAX; v0++) { - if (v1 & GetSingleBitMask(v0)) { + if (v1 & Pokemon_GetFlagMaskOf(v0)) { param1->aiContext.moveCurPP[v0] = 0; } @@ -1337,7 +1337,7 @@ static void ov14_02220D8C (BattleSystem * param0, BattleContext * param1) for (v2 = 0; v2 < ov16_0223DF60(param0, v3); v2++) { v1 = Party_GetPokemonBySlotIndex(v0, v2); - if ((v2 != v4) && (v2 != v5) && (GetMonData(v1, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 494)) { + if ((v2 != v4) && (v2 != v5) && (Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v1, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v1, MON_DATA_SPECIES_EGG, NULL) != 494)) { param1->aiContext.calcTemp++; } } @@ -1375,8 +1375,8 @@ static void ov14_02220EA8 (BattleSystem * param0, BattleContext * param1) if ((param1->battleMons[v0].ability == 23) || (param1->battleMons[v0].ability == 42) || (param1->battleMons[v0].ability == 71)) { param1->aiContext.calcTemp = param1->battleMons[v0].ability; } else { - v2 = GetMonSpeciesPersonalDataAttribute(param1->battleMons[v0].species, 24); - v3 = GetMonSpeciesPersonalDataAttribute(param1->battleMons[v0].species, 25); + v2 = PokemonPersonalData_GetSpeciesValue(param1->battleMons[v0].species, 24); + v3 = PokemonPersonalData_GetSpeciesValue(param1->battleMons[v0].species, 25); if ((v2) && (v3)) { if (BattleSystem_RandNext(param0) & 1) { @@ -1420,8 +1420,8 @@ static void ov14_02220F88 (BattleSystem * param0, BattleContext * param1) if ((param1->battleMons[v0].ability == 23) || (param1->battleMons[v0].ability == 42) || (param1->battleMons[v0].ability == 71)) { v3 = param1->battleMons[v0].ability; } else { - v4 = GetMonSpeciesPersonalDataAttribute(param1->battleMons[v0].species, 24); - v5 = GetMonSpeciesPersonalDataAttribute(param1->battleMons[v0].species, 25); + v4 = PokemonPersonalData_GetSpeciesValue(param1->battleMons[v0].species, 24); + v5 = PokemonPersonalData_GetSpeciesValue(param1->battleMons[v0].species, 25); if ((v4) && (v5)) { if ((v4 != v2) && (v5 != v2)) { @@ -1555,7 +1555,7 @@ static void ov14_022211AC (BattleSystem * param0, BattleContext * param1) for (v2 = 0; v2 < ov16_0223DF60(param0, v3); v2++) { v1 = Party_GetPokemonBySlotIndex(v0, v2); - if ((v2 != v4) && (v2 != v5) && (GetMonData(v1, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 494) && (GetMonData(v1, MON_DATA_160, NULL) & v7)) { + if ((v2 != v4) && (v2 != v5) && (Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v1, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v1, MON_DATA_SPECIES_EGG, NULL) != 494) && (Pokemon_GetValue(v1, MON_DATA_160, NULL) & v7)) { ov14_02222D24(param1, v8); return; } @@ -1592,7 +1592,7 @@ static void ov14_022212A0 (BattleSystem * param0, BattleContext * param1) for (v2 = 0; v2 < ov16_0223DF60(param0, v3); v2++) { v1 = Party_GetPokemonBySlotIndex(v0, v2); - if ((v2 != v4) && (v2 != v5) && (GetMonData(v1, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) != 494) && ((GetMonData(v1, MON_DATA_160, NULL) & v7) == 0)) { + if ((v2 != v4) && (v2 != v5) && (Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v1, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v1, MON_DATA_SPECIES_EGG, NULL) != 494) && ((Pokemon_GetValue(v1, MON_DATA_160, NULL) & v7) == 0)) { ov14_02222D24(param1, v8); return; } @@ -2235,7 +2235,7 @@ static void ov14_02221D88 (BattleSystem * param0, BattleContext * param1) v4 = ov16_0223DFAC(param0, v0, v3); if (v3 != param1->selectedPartySlot[v0]) { - if (GetMonData(v4, MON_DATA_CURRENT_HP, NULL) != GetMonData(v4, MON_DATA_MAX_HP, NULL)) { + if (Pokemon_GetValue(v4, MON_DATA_CURRENT_HP, NULL) != Pokemon_GetValue(v4, MON_DATA_MAX_HP, NULL)) { ov14_02222D24(param1, v2); break; } @@ -2262,7 +2262,7 @@ static void ov14_02221E18 (BattleSystem * param0, BattleContext * param1) if (v3 != param1->selectedPartySlot[v0]) { for (v4 = 0; v4 < 4; v4++) { - if (GetMonData(v5, MON_DATA_MOVE1_CUR_PP + v4, NULL) != GetMonData(v5, MON_DATA_MOVE1_MAX_PP + v4, NULL)) { + if (Pokemon_GetValue(v5, MON_DATA_MOVE1_CUR_PP + v4, NULL) != Pokemon_GetValue(v5, MON_DATA_MOVE1_MAX_PP + v4, NULL)) { ov14_02222D24(param1, v2); break; } @@ -2406,16 +2406,16 @@ static void ov14_022220CC (BattleSystem * param0, BattleContext * param1) if (v0 != param1->selectedPartySlot[v4]) { v10 = ov16_0223DFAC(param0, v4, v0); - if ((GetMonData(v10, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v10, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v10, MON_DATA_SPECIES_EGG, NULL) != 494)) { + if ((Pokemon_GetValue(v10, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v10, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v10, MON_DATA_SPECIES_EGG, NULL) != 494)) { for (v1 = 0; v1 < 4; v1++) { - v8[v1] = GetMonData(v10, MON_DATA_MOVE1 + v1, NULL); + v8[v1] = Pokemon_GetValue(v10, MON_DATA_MOVE1 + v1, NULL); } for (v1 = 0; v1 < 6; v1++) { - v9[v1] = GetMonData(v10, MON_DATA_HP_IV + v1, NULL); + v9[v1] = Pokemon_GetValue(v10, MON_DATA_HP_IV + v1, NULL); } - v6 = ov14_02222D7C(param0, param1, param1->aiContext.attacker, &v8[0], &v7[0], GetMonData(v10, MON_DATA_HELD_ITEM, NULL), &v9[0], GetMonData(v10, MON_DATA_ABILITY, NULL), MON_DATA_PERSONALITY, v2); + v6 = ov14_02222D7C(param0, param1, param1->aiContext.attacker, &v8[0], &v7[0], Pokemon_GetValue(v10, MON_DATA_HELD_ITEM, NULL), &v9[0], Pokemon_GetValue(v10, MON_DATA_ABILITY, NULL), MON_DATA_PERSONALITY, v2); if (v6 > v5) { ov14_02222D24(param1, v3); @@ -2697,7 +2697,7 @@ static void ov14_022227A4 (BattleSystem * param0, BattleContext * param1) v2 = ov14_02222D34(param1, v0); - if (param1->battlersSwitchingMask & GetSingleBitMask(v2)) { + if (param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v2)) { ov14_02222D24(param1, v1); } } @@ -2718,7 +2718,7 @@ static void ov14_022227F4 (BattleSystem * param0, BattleContext * param1) v2 = ov14_02222D34(param1, v0); - if ((param1->battlersSwitchingMask & GetSingleBitMask(v2)) == 0) { + if ((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v2)) == 0) { ov14_02222D24(param1, v1); } } @@ -3423,14 +3423,14 @@ static BOOL ov14_0222342C (BattleSystem * param0, BattleContext * param1, int pa for (v0 = 0; v0 < ov16_0223DF60(param0, param2); v0++) { v5 = ov16_0223DFAC(param0, param2, v0); - if ((GetMonData(v5, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[param2])) { + if ((Pokemon_GetValue(v5, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v5, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v5, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[param2])) { for (v1 = 0; v1 < 4; v1++) { - v2 = GetMonData(v5, MON_DATA_MOVE1 + v1, NULL); + v2 = Pokemon_GetValue(v5, MON_DATA_MOVE1 + v1, NULL); v3 = ov16_0225BE3C(param0, param1, v5, v2); if (v2) { v4 = 0; - ov16_022552D4(param1, v2, v3, GetMonData(v5, MON_DATA_ABILITY, NULL), Battler_Ability(param1, param2 ^ 1), ov16_02258AB8(param1, param2 ^ 1), ov16_02252060(param1, param2 ^ 1, 27, NULL), ov16_02252060(param1, param2 ^ 1, 28, NULL), &v4); + ov16_022552D4(param1, v2, v3, Pokemon_GetValue(v5, MON_DATA_ABILITY, NULL), Battler_Ability(param1, param2 ^ 1), ov16_02258AB8(param1, param2 ^ 1), ov16_02252060(param1, param2 ^ 1, 27, NULL), ov16_02252060(param1, param2 ^ 1, 28, NULL), &v4); if (v4 & 0x2) { if ((BattleSystem_RandNext(param0) % 3) < 2) { @@ -3515,16 +3515,16 @@ static BOOL ov14_022235F0 (BattleSystem * param0, BattleContext * param1, int pa for (v0 = v9; v0 < v10; v0++) { v12 = ov16_0223DFAC(param0, param2, v0); - if ((GetMonData(v12, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v12, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v12, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v4]) && (v0 != param1->selectedPartySlot[v5]) && (v0 != param1->aiSwitchedPartySlot[v4]) && (v0 != param1->aiSwitchedPartySlot[v5])) { + if ((Pokemon_GetValue(v12, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v12, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v12, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v4]) && (v0 != param1->selectedPartySlot[v5]) && (v0 != param1->aiSwitchedPartySlot[v4]) && (v0 != param1->aiSwitchedPartySlot[v5])) { for (v1 = 0; v1 < 4; v1++) { - v6 = GetMonData(v12, MON_DATA_MOVE1 + v1, NULL); + v6 = Pokemon_GetValue(v12, MON_DATA_MOVE1 + v1, NULL); v7 = ov16_0225BE3C(param0, param1, v12, v6); if ((v6) && (param1->aiContext.moveTable[v6].power)) { v8 = 0; if (param1->battleMons[v2].curHP) { - ov16_022552D4(param1, v6, v7, GetMonData(v12, MON_DATA_ABILITY, NULL), Battler_Ability(param1, v2), ov16_02258AB8(param1, v2), ov16_02252060(param1, v2, 27, NULL), ov16_02252060(param1, v2, 28, NULL), &v8); + ov16_022552D4(param1, v6, v7, Pokemon_GetValue(v12, MON_DATA_ABILITY, NULL), Battler_Ability(param1, v2), ov16_02258AB8(param1, v2), ov16_02252060(param1, v2, 27, NULL), ov16_02252060(param1, v2, 28, NULL), &v8); } if (v8 & 0x2) { @@ -3537,7 +3537,7 @@ static BOOL ov14_022235F0 (BattleSystem * param0, BattleContext * param1, int pa v8 = 0; if (param1->battleMons[v3].curHP) { - ov16_022552D4(param1, v6, v7, GetMonData(v12, MON_DATA_ABILITY, NULL), Battler_Ability(param1, v3), ov16_02258AB8(param1, v3), ov16_02252060(param1, v3, 27, NULL), ov16_02252060(param1, v3, 28, NULL), &v8); + ov16_022552D4(param1, v6, v7, Pokemon_GetValue(v12, MON_DATA_ABILITY, NULL), Battler_Ability(param1, v3), ov16_02258AB8(param1, v3), ov16_02252060(param1, v3, 27, NULL), ov16_02252060(param1, v3, 28, NULL), &v8); } if (v8 & 0x2) { @@ -3554,16 +3554,16 @@ static BOOL ov14_022235F0 (BattleSystem * param0, BattleContext * param1, int pa for (v0 = v9; v0 < v10; v0++) { v12 = ov16_0223DFAC(param0, param2, v0); - if ((GetMonData(v12, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v12, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v12, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v4]) && (v0 != param1->selectedPartySlot[v5]) && (v0 != param1->aiSwitchedPartySlot[v4]) && (v0 != param1->aiSwitchedPartySlot[v5])) { + if ((Pokemon_GetValue(v12, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v12, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v12, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v4]) && (v0 != param1->selectedPartySlot[v5]) && (v0 != param1->aiSwitchedPartySlot[v4]) && (v0 != param1->aiSwitchedPartySlot[v5])) { for (v1 = 0; v1 < 4; v1++) { - v6 = GetMonData(v12, MON_DATA_MOVE1 + v1, NULL); + v6 = Pokemon_GetValue(v12, MON_DATA_MOVE1 + v1, NULL); v7 = ov16_0225BE3C(param0, param1, v12, v6); if ((v6) && (param1->aiContext.moveTable[v6].power)) { v8 = 0; if (param1->battleMons[v2].curHP) { - ov16_022552D4(param1, v6, v7, GetMonData(v12, MON_DATA_ABILITY, NULL), Battler_Ability(param1, v2), ov16_02258AB8(param1, v2), ov16_02252060(param1, v2, 27, NULL), ov16_02252060(param1, v2, 28, NULL), &v8); + ov16_022552D4(param1, v6, v7, Pokemon_GetValue(v12, MON_DATA_ABILITY, NULL), Battler_Ability(param1, v2), ov16_02258AB8(param1, v2), ov16_02252060(param1, v2, 27, NULL), ov16_02252060(param1, v2, 28, NULL), &v8); } if (v8 == 0) { @@ -3576,7 +3576,7 @@ static BOOL ov14_022235F0 (BattleSystem * param0, BattleContext * param1, int pa v8 = 0; if (param1->battleMons[v3].curHP) { - ov16_022552D4(param1, v6, v7, GetMonData(v12, MON_DATA_ABILITY, NULL), Battler_Ability(param1, v3), ov16_02258AB8(param1, v3), ov16_02252060(param1, v3, 27, NULL), ov16_02252060(param1, v3, 28, NULL), &v8); + ov16_022552D4(param1, v6, v7, Pokemon_GetValue(v12, MON_DATA_ABILITY, NULL), Battler_Ability(param1, v3), ov16_02258AB8(param1, v3), ov16_02252060(param1, v3, 27, NULL), ov16_02252060(param1, v3, 28, NULL), &v8); } if (v8 == 0) { @@ -3605,7 +3605,7 @@ static BOOL ov14_02223B34 (BattleSystem * param0, BattleContext * param1, int pa v3 = BattleSystem_BattlerSlot(param0, param2) ^ 1; v2 = ov16_0223E1C4(param0, v3); - if ((param1->battlersSwitchingMask & GetSingleBitMask(v2)) == 0) { + if ((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v2)) == 0) { for (v0 = 0; v0 < 4; v0++) { v4 = param1->battleMons[param2].moves[v0]; v5 = ov14_0222327C(param0, param1, param2, v4); @@ -3633,7 +3633,7 @@ static BOOL ov14_02223B34 (BattleSystem * param0, BattleContext * param1, int pa v2 = BattleSystem_Partner(param0, v2); - if ((param1->battlersSwitchingMask & GetSingleBitMask(v2)) == 0) { + if ((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v2)) == 0) { for (v0 = 0; v0 < 4; v0++) { v4 = param1->battleMons[param2].moves[v0]; v5 = ov14_0222327C(param0, param1, param2, v4); @@ -3710,8 +3710,8 @@ static BOOL ov14_02223C8C (BattleSystem * param0, BattleContext * param1, int pa for (v0 = v6; v0 < v7; v0++) { v8 = ov16_0223DFAC(param0, param2, v0); - if ((GetMonData(v8, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v8, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v8, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v1]) && (v0 != param1->selectedPartySlot[v2]) && (v0 != param1->aiSwitchedPartySlot[v1]) && (v0 != param1->aiSwitchedPartySlot[v2])) { - v4 = GetMonData(v8, MON_DATA_ABILITY, NULL); + if ((Pokemon_GetValue(v8, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v8, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v8, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v1]) && (v0 != param1->selectedPartySlot[v2]) && (v0 != param1->aiSwitchedPartySlot[v1]) && (v0 != param1->aiSwitchedPartySlot[v2])) { + v4 = Pokemon_GetValue(v8, MON_DATA_ABILITY, NULL); if ((v5 == v4) && (BattleSystem_RandNext(param0) & 1)) { param1->aiSwitchedPartySlot[param2] = v0; @@ -3755,20 +3755,20 @@ static BOOL ov14_02223E10 (BattleSystem * param0, BattleContext * param1, int pa for (v0 = v7; v0 < v8; v0++) { v9 = ov16_0223DFAC(param0, param2, v0); - if ((GetMonData(v9, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v9, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v9, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v2]) && (v0 != param1->selectedPartySlot[v3]) && (v0 != param1->aiSwitchedPartySlot[v2]) && (v0 != param1->aiSwitchedPartySlot[v3])) { + if ((Pokemon_GetValue(v9, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v9, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v9, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v2]) && (v0 != param1->selectedPartySlot[v3]) && (v0 != param1->aiSwitchedPartySlot[v2]) && (v0 != param1->aiSwitchedPartySlot[v3])) { v6 = 0; v5 = ov14_0222327C(param0, param1, param1->moveHitBattler[param2], param1->moveHit[param2]); - ov16_022552D4(param1, param1->moveHit[param2], v5, Battler_Ability(param1, param1->moveHitBattler[param2]), GetMonData(v9, MON_DATA_ABILITY, NULL), ov16_0225B0FC(param1, GetMonData(v9, MON_DATA_HELD_ITEM, NULL), 1), GetMonData(v9, MON_DATA_177, NULL), GetMonData(v9, MON_DATA_178, NULL), &v6); + ov16_022552D4(param1, param1->moveHit[param2], v5, Battler_Ability(param1, param1->moveHitBattler[param2]), Pokemon_GetValue(v9, MON_DATA_ABILITY, NULL), ov16_0225B0FC(param1, Pokemon_GetValue(v9, MON_DATA_HELD_ITEM, NULL), 1), Pokemon_GetValue(v9, MON_DATA_177, NULL), Pokemon_GetValue(v9, MON_DATA_178, NULL), &v6); if (v6 & param3) { for (v1 = 0; v1 < 4; v1++) { - v4 = GetMonData(v9, MON_DATA_MOVE1 + v1, NULL); + v4 = Pokemon_GetValue(v9, MON_DATA_MOVE1 + v1, NULL); v5 = ov16_0225BE3C(param0, param1, v9, v4); if (v4) { v6 = 0; - ov16_022552D4(param1, v4, v5, GetMonData(v9, MON_DATA_ABILITY, NULL), Battler_Ability(param1, param1->moveHitBattler[param2]), ov16_02258AB8(param1, param1->moveHitBattler[param2]), ov16_02252060(param1, param1->moveHitBattler[param2], 27, NULL), ov16_02252060(param1, param1->moveHitBattler[param2], 28, NULL), &v6); + ov16_022552D4(param1, v4, v5, Pokemon_GetValue(v9, MON_DATA_ABILITY, NULL), Battler_Ability(param1, param1->moveHitBattler[param2]), ov16_02258AB8(param1, param1->moveHitBattler[param2]), ov16_02252060(param1, param1->moveHitBattler[param2], 27, NULL), ov16_02252060(param1, param1->moveHitBattler[param2], 28, NULL), &v6); if (v6 & 0x2) { if ((BattleSystem_RandNext(param0) % param4) == 0) { @@ -3864,7 +3864,7 @@ static BOOL ov14_022241A4 (BattleSystem * param0, BattleContext * param1, int pa for (v0 = v5; v0 < v6; v0++) { v7 = ov16_0223DFAC(param0, param2, v0); - if ((GetMonData(v7, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v2]) && (v0 != param1->selectedPartySlot[v3]) && (v0 != param1->aiSwitchedPartySlot[v2]) && (v0 != param1->aiSwitchedPartySlot[v3])) { + if ((Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL) != 494) && (v0 != param1->selectedPartySlot[v2]) && (v0 != param1->selectedPartySlot[v3]) && (v0 != param1->aiSwitchedPartySlot[v2]) && (v0 != param1->aiSwitchedPartySlot[v3])) { v1++; } } @@ -3940,7 +3940,7 @@ int ov14_022243BC (BattleSystem * param0, int param1) for (v0 = v4; v0 < v5; v0++) { v6 = ov16_0223DFAC(param0, param1, v0); - if ((GetMonData(v6, MON_DATA_CURRENT_HP, NULL) != 0) && (v0 != v7->selectedPartySlot[v1]) && (v0 != v7->selectedPartySlot[v2]) && (v0 != v7->aiSwitchedPartySlot[v1]) && (v0 != v7->aiSwitchedPartySlot[v2])) { + if ((Pokemon_GetValue(v6, MON_DATA_CURRENT_HP, NULL) != 0) && (v0 != v7->selectedPartySlot[v1]) && (v0 != v7->selectedPartySlot[v2]) && (v0 != v7->aiSwitchedPartySlot[v1]) && (v0 != v7->aiSwitchedPartySlot[v2])) { break; } } @@ -3990,7 +3990,7 @@ BOOL ov14_022244B0 (BattleSystem * param0, int param1) for (v0 = 0; v0 < Party_GetCurrentCount(v6); v0++) { v7 = Party_GetPokemonBySlotIndex(v6, v0); - if ((GetMonData(v7, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 494)) { + if ((Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL) != 494)) { v1++; } } @@ -4019,37 +4019,37 @@ BOOL ov14_022244B0 (BattleSystem * param0, int param1) } } else if (ov16_0225B0FC(v8, v2, 15)) { if (v8->battleMons[param1].status & 0x7) { - v8->aiContext.usedItemCondition[param1 >> 1] |= GetSingleBitMask(5); + v8->aiContext.usedItemCondition[param1 >> 1] |= Pokemon_GetFlagMaskOf(5); v8->aiContext.usedItemType[param1 >> 1] = 2; v4 = 1; } } else if (ov16_0225B0FC(v8, v2, 16)) { if ((v8->battleMons[param1].status & 0x8) || (v8->battleMons[param1].status & 0x80)) { - v8->aiContext.usedItemCondition[param1 >> 1] |= GetSingleBitMask(4); + v8->aiContext.usedItemCondition[param1 >> 1] |= Pokemon_GetFlagMaskOf(4); v8->aiContext.usedItemType[param1 >> 1] = 2; v4 = 1; } } else if (ov16_0225B0FC(v8, v2, 17)) { if (v8->battleMons[param1].status & 0x10) { - v8->aiContext.usedItemCondition[param1 >> 1] |= GetSingleBitMask(3); + v8->aiContext.usedItemCondition[param1 >> 1] |= Pokemon_GetFlagMaskOf(3); v8->aiContext.usedItemType[param1 >> 1] = 2; v4 = 1; } } else if (ov16_0225B0FC(v8, v2, 18)) { if (v8->battleMons[param1].status & 0x20) { - v8->aiContext.usedItemCondition[param1 >> 1] |= GetSingleBitMask(2); + v8->aiContext.usedItemCondition[param1 >> 1] |= Pokemon_GetFlagMaskOf(2); v8->aiContext.usedItemType[param1 >> 1] = 2; v4 = 1; } } else if (ov16_0225B0FC(v8, v2, 19)) { if (v8->battleMons[param1].status & 0x40) { - v8->aiContext.usedItemCondition[param1 >> 1] |= GetSingleBitMask(1); + v8->aiContext.usedItemCondition[param1 >> 1] |= Pokemon_GetFlagMaskOf(1); v8->aiContext.usedItemType[param1 >> 1] = 2; v4 = 1; } } else if (ov16_0225B0FC(v8, v2, 20)) { if (v8->battleMons[param1].statusVolatile & 0x7) { - v8->aiContext.usedItemCondition[param1 >> 1] |= GetSingleBitMask(0); + v8->aiContext.usedItemCondition[param1 >> 1] |= Pokemon_GetFlagMaskOf(0); v8->aiContext.usedItemType[param1 >> 1] = 2; v4 = 1; } diff --git a/src/overlay016/battle_controller.c b/src/overlay016/battle_controller.c index ef43855117..4f11599027 100644 --- a/src/overlay016/battle_controller.c +++ b/src/overlay016/battle_controller.c @@ -369,7 +369,7 @@ static void BattleController_CommandSelectionInput (BattleSystem *battleSys, Bat break; } - if (battleCtx->battlersSwitchingMask & GetSingleBitMask(i)) { + if (battleCtx->battlersSwitchingMask & Pokemon_GetFlagMaskOf(i)) { battleCtx->curCommandState[i] = COMMAND_SELECTION_WAIT; battleCtx->battlerActions[i][BATTLE_ACTION_PICK_COMMAND] = BATTLE_CONTROL_AFTER_MOVE; break; @@ -860,7 +860,7 @@ static void BattleController_CheckPreMoveActions(BattleSystem *battleSys, Battle while (battleCtx->turnStartCheckTemp < maxBattlers) { battler = battleCtx->battlerActionOrder[battleCtx->turnStartCheckTemp]; - if (battleCtx->battlersSwitchingMask & GetSingleBitMask(battler)) { + if (battleCtx->battlersSwitchingMask & Pokemon_GetFlagMaskOf(battler)) { battleCtx->turnStartCheckTemp++; continue; } @@ -1349,7 +1349,7 @@ static void BattleController_CheckMonConditions(BattleSystem *battleSys, BattleC while (battleCtx->monConditionCheckTemp < maxBattlers) { battler = battleCtx->monSpeedOrder[battleCtx->monConditionCheckTemp]; - if (battleCtx->battlersSwitchingMask & GetSingleBitMask(battler)) { + if (battleCtx->battlersSwitchingMask & Pokemon_GetFlagMaskOf(battler)) { battleCtx->monConditionCheckTemp++; continue; } @@ -1573,13 +1573,13 @@ static void BattleController_CheckMonConditions(BattleSystem *battleSys, BattleC if (BattleContext_MoveFailed(battleCtx, battler)) { i = BATTLE_SUBSEQ_UPROAR_END; battleCtx->battleMons[battler].statusVolatile &= ~VOLATILE_CONDITION_UPROAR; - battleCtx->fieldConditionsMask &= ((GetSingleBitMask(battler) << FIELD_CONDITION_UPROAR_SHIFT) ^ 0xFFFFFFFF); + battleCtx->fieldConditionsMask &= ((Pokemon_GetFlagMaskOf(battler) << FIELD_CONDITION_UPROAR_SHIFT) ^ 0xFFFFFFFF); } else if (battleCtx->battleMons[battler].statusVolatile & VOLATILE_CONDITION_UPROAR) { i = BATTLE_SUBSEQ_UPROAR_CONTINUES; } else { i = BATTLE_SUBSEQ_UPROAR_END; battleCtx->battleMons[battler].statusVolatile &= ~VOLATILE_CONDITION_UPROAR; - battleCtx->fieldConditionsMask &= ((GetSingleBitMask(battler) << FIELD_CONDITION_UPROAR_SHIFT) ^ 0xFFFFFFFF); + battleCtx->fieldConditionsMask &= ((Pokemon_GetFlagMaskOf(battler) << FIELD_CONDITION_UPROAR_SHIFT) ^ 0xFFFFFFFF); } battleCtx->msgBattlerTemp = battler; @@ -1806,7 +1806,7 @@ static void BattleController_CheckSideConditions(BattleSystem *battleSys, Battle case SIDE_COND_CHECK_FUTURE_SIGHT: while (battleCtx->sideConditionCheckTemp < maxBattlers) { battler = battleCtx->monSpeedOrder[battleCtx->sideConditionCheckTemp]; - if (battleCtx->battlersSwitchingMask & GetSingleBitMask(battler)) { + if (battleCtx->battlersSwitchingMask & Pokemon_GetFlagMaskOf(battler)) { battleCtx->sideConditionCheckTemp++; continue; } @@ -1837,7 +1837,7 @@ static void BattleController_CheckSideConditions(BattleSystem *battleSys, Battle case SIDE_COND_CHECK_PERISH_SONG: while (battleCtx->sideConditionCheckTemp < maxBattlers) { battler = battleCtx->monSpeedOrder[battleCtx->sideConditionCheckTemp]; - if (battleCtx->battlersSwitchingMask & GetSingleBitMask(battler)) { + if (battleCtx->battlersSwitchingMask & Pokemon_GetFlagMaskOf(battler)) { battleCtx->sideConditionCheckTemp++; continue; } @@ -1959,7 +1959,7 @@ static void ov16_0224DDA8 (BattleSystem * param0, BattleContext * param1) if ((param1->aiContext.usedItemCondition[param1->attacker >> 1] & 1) && (param1->aiContext.usedItemCondition[param1->attacker >> 1] & 0x3e)) { param1->msgTemp = 6; } else { - param1->msgTemp = GetLowestSetBitIndex(param1->aiContext.usedItemCondition[param1->attacker >> 1]); + param1->msgTemp = Pokemon_GetLowestFlagIndex(param1->aiContext.usedItemCondition[param1->attacker >> 1]); } v1 = (0 + 268); @@ -2196,7 +2196,7 @@ static int ov16_0224E13C (BattleSystem * param0, BattleContext * param1, int * p v0 = ((BattleSystem_RandNext(param0) & 0xff) * (param1->battleMons[param1->attacker].level + v3)) >> 8; if (v0 < v3) { - v0 = BattleSystem_CheckStruggling(param0, param1, param1->attacker, GetSingleBitMask(param1->moveSlot[param1->attacker]), 0xffffffff); + v0 = BattleSystem_CheckStruggling(param0, param1, param1->attacker, Pokemon_GetFlagMaskOf(param1->moveSlot[param1->attacker]), 0xffffffff); if (v0 == 0xf) { param2[0] = (0 + 255); @@ -2205,7 +2205,7 @@ static int ov16_0224E13C (BattleSystem * param0, BattleContext * param1, int * p do { v1 = BattleSystem_RandNext(param0) & 3; - } while (v0 & GetSingleBitMask(v1)); + } while (v0 & Pokemon_GetFlagMaskOf(v1)); param1->moveSlot[param1->attacker] = v1; param1->moveTemp = param1->battleMons[param1->attacker].moves[param1->moveSlot[param1->attacker]]; @@ -2301,7 +2301,7 @@ static BOOL ov16_0224E458 (BattleSystem * param0, BattleContext * param1) } else { param1->moveStatusFlags |= 0x200; } - } else if ((param1->battleMons[param1->attacker].ppCur[v1] == 0) && ((param1->battleStatusMask & 0x200) == 0) && ((param1->battleMons[param1->attacker].statusVolatile & 0x1000) == 0) && ((param1->battleMons[param1->attacker].statusVolatile & 0xc00) == 0) && ((param1->fieldConditionsMask & (GetSingleBitMask(param1->attacker) << 8)) == 0) && (v1 < 4)) { + } else if ((param1->battleMons[param1->attacker].ppCur[v1] == 0) && ((param1->battleStatusMask & 0x200) == 0) && ((param1->battleMons[param1->attacker].statusVolatile & 0x1000) == 0) && ((param1->battleMons[param1->attacker].statusVolatile & 0xc00) == 0) && ((param1->fieldConditionsMask & (Pokemon_GetFlagMaskOf(param1->attacker) << 8)) == 0) && (v1 < 4)) { param1->moveStatusFlags |= 0x200; } @@ -2574,7 +2574,7 @@ static BOOL ov16_0224E784 (BattleSystem * param0, BattleContext * param1) break; case 13: if (param1->battleMons[param1->attacker].statusVolatile & 0xf0000) { - param1->msgBattlerTemp = GetLowestSetBitIndex((param1->battleMons[param1->attacker].statusVolatile & 0xf0000) >> 16); + param1->msgBattlerTemp = Pokemon_GetLowestFlagIndex((param1->battleMons[param1->attacker].statusVolatile & 0xf0000) >> 16); if (BattleSystem_RandNext(param0) & 1) { BattleSystem_LoadScript(param1, 1, (0 + 107)); @@ -3218,13 +3218,13 @@ static void ov16_0224F8EC (BattleSystem * param0, BattleContext * param1) if (param1->aiContext.moveTable[param1->moveCur].class == 0) { param1->turnFlags[param1->defender].physicalDamageTakenFrom[param1->attacker] = param1->damage; param1->turnFlags[param1->defender].physicalDamageLastAttacker = param1->attacker; - param1->turnFlags[param1->defender].physicalDamageAttackerMask |= GetSingleBitMask(param1->attacker); + param1->turnFlags[param1->defender].physicalDamageAttackerMask |= Pokemon_GetFlagMaskOf(param1->attacker); param1->selfTurnFlags[param1->defender].physicalDamageTaken = param1->damage; param1->selfTurnFlags[param1->defender].physicalDamageLastAttacker = param1->attacker; } else if (param1->aiContext.moveTable[param1->moveCur].class == 1) { param1->turnFlags[param1->defender].specialDamageTakenFrom[param1->attacker] = param1->damage; param1->turnFlags[param1->defender].specialDamageLastAttacker = param1->attacker; - param1->turnFlags[param1->defender].specialDamageAttackerMask |= GetSingleBitMask(param1->attacker); + param1->turnFlags[param1->defender].specialDamageAttackerMask |= Pokemon_GetFlagMaskOf(param1->attacker); param1->selfTurnFlags[param1->defender].specialDamageTaken = param1->damage; param1->selfTurnFlags[param1->defender].specialDamageLastAttacker = param1->attacker; } @@ -3495,7 +3495,7 @@ static void ov16_0224FEE4 (BattleSystem * param0, BattleContext * param1) while (param1->afterMoveEffectTemp < BattleSystem_MaxBattlers(param0)) { v4 = param1->monSpeedOrder[param1->afterMoveEffectTemp]; - if (param1->battlersSwitchingMask & GetSingleBitMask(v4)) { + if (param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v4)) { param1->afterMoveEffectTemp++; continue; } @@ -3604,7 +3604,7 @@ static void ov16_02250298 (BattleSystem * param0, BattleContext * param1) do { v0 = param1->monSpeedOrder[param1->battlerCounter++]; - if (((param1->battlersSwitchingMask & GetSingleBitMask(v0)) == 0) && (param1->battleMons[v0].curHP)) { + if (((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v0)) == 0) && (param1->battleMons[v0].curHP)) { v2 = BattleSystem_BattlerData(param0, v0); if (((v3 & 0x1) && ((ov16_02263AE4(v2) & 0x1) == 0)) || ((v3 & 0x1) == 0) && (ov16_02263AE4(v2) & 0x1)) { @@ -3626,7 +3626,7 @@ static void ov16_02250298 (BattleSystem * param0, BattleContext * param1) do { v4 = param1->monSpeedOrder[param1->battlerCounter++]; - if (((param1->battlersSwitchingMask & GetSingleBitMask(v4)) == 0) && (param1->battleMons[v4].curHP)) { + if (((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v4)) == 0) && (param1->battleMons[v4].curHP)) { if (v4 != param1->attacker) { ov16_02255F94(param0, param1); param1->defender = v4; @@ -3645,7 +3645,7 @@ static void ov16_02250298 (BattleSystem * param0, BattleContext * param1) static void ov16_02250438 (BattleSystem * param0, BattleContext * param1) { if (param1->battleStatusMask & 0xf0000000) { - param1->faintedMon = GetLowestSetBitIndex((param1->battleStatusMask & 0xf0000000) >> 28); + param1->faintedMon = Pokemon_GetLowestFlagIndex((param1->battleStatusMask & 0xf0000000) >> 28); param1->battleStatusMask &= (0xf0000000 ^ 0xffffffff); BattleSystem_LoadScript(param1, 1, (0 + 277)); @@ -3871,8 +3871,8 @@ static BOOL BattleController_CheckAnySwitches (BattleSystem * param0, BattleCont for (v5 = 0; v5 < Party_GetCurrentCount(v9); v5++) { v10 = Party_GetPokemonBySlotIndex(v9, v5); - if ((GetMonData(v10, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v10, MON_DATA_SPECIES_EGG, NULL) != 494)) { - if (v6 = GetMonData(v10, MON_DATA_CURRENT_HP, NULL)) { + if ((Pokemon_GetValue(v10, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v10, MON_DATA_SPECIES_EGG, NULL) != 494)) { + if (v6 = Pokemon_GetValue(v10, MON_DATA_CURRENT_HP, NULL)) { v8++; if (param1->selectedPartySlot[v1 ^ 2] != v5) { @@ -3883,7 +3883,7 @@ static BOOL BattleController_CheckAnySwitches (BattleSystem * param0, BattleCont } if (v7 == 0) { - param1->battlersSwitchingMask |= GetSingleBitMask(v1); + param1->battlersSwitchingMask |= Pokemon_GetFlagMaskOf(v1); param1->selectedPartySlot[v1] = 6; } else { param1->commandNext = v4; @@ -3907,13 +3907,13 @@ static BOOL BattleController_CheckAnySwitches (BattleSystem * param0, BattleCont for (v12 = 0; v12 < Party_GetCurrentCount(v14); v12++) { v15 = Party_GetPokemonBySlotIndex(v14, v12); - if ((GetMonData(v15, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v15, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v13 += GetMonData(v15, MON_DATA_CURRENT_HP, NULL); + if ((Pokemon_GetValue(v15, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v15, MON_DATA_SPECIES_EGG, NULL) != 494)) { + v13 += Pokemon_GetValue(v15, MON_DATA_CURRENT_HP, NULL); } } if (v13 == 0) { - param1->battlersSwitchingMask |= GetSingleBitMask(v1); + param1->battlersSwitchingMask |= Pokemon_GetFlagMaskOf(v1); param1->selectedPartySlot[v1] = 6; } else { param1->commandNext = v4; @@ -3972,8 +3972,8 @@ static BOOL BattleController_CheckBattleOver (BattleSystem * param0, BattleConte for (v4 = 0; v4 < Party_GetCurrentCount(v6); v4++) { v7 = Party_GetPokemonBySlotIndex(v6, v4); - if ((GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v5 += GetMonData(v7, MON_DATA_CURRENT_HP, NULL); + if ((Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL) != 494)) { + v5 += Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL); } } @@ -4000,16 +4000,16 @@ static BOOL BattleController_CheckBattleOver (BattleSystem * param0, BattleConte for (v9 = 0; v9 < Party_GetCurrentCount(v11); v9++) { v13 = Party_GetPokemonBySlotIndex(v11, v9); - if ((GetMonData(v13, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v13, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v10 += GetMonData(v13, MON_DATA_CURRENT_HP, NULL); + if ((Pokemon_GetValue(v13, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v13, MON_DATA_SPECIES_EGG, NULL) != 494)) { + v10 += Pokemon_GetValue(v13, MON_DATA_CURRENT_HP, NULL); } } for (v9 = 0; v9 < Party_GetCurrentCount(v12); v9++) { v13 = Party_GetPokemonBySlotIndex(v12, v9); - if ((GetMonData(v13, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v13, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v10 += GetMonData(v13, MON_DATA_CURRENT_HP, NULL); + if ((Pokemon_GetValue(v13, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v13, MON_DATA_SPECIES_EGG, NULL) != 494)) { + v10 += Pokemon_GetValue(v13, MON_DATA_CURRENT_HP, NULL); } } @@ -4037,8 +4037,8 @@ static BOOL BattleController_CheckBattleOver (BattleSystem * param0, BattleConte for (v15 = 0; v15 < Party_GetCurrentCount(v17); v15++) { v18 = Party_GetPokemonBySlotIndex(v17, v15); - if ((GetMonData(v18, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v18, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v16 += GetMonData(v18, MON_DATA_CURRENT_HP, NULL); + if ((Pokemon_GetValue(v18, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v18, MON_DATA_SPECIES_EGG, NULL) != 494)) { + v16 += Pokemon_GetValue(v18, MON_DATA_CURRENT_HP, NULL); } } @@ -4120,7 +4120,7 @@ static BOOL BattleController_CheckRange (BattleSystem *battleSys, BattleContext if (battleType & 0x2) { if (*range == 0x100) { - if ((battleCtx->battlersSwitchingMask & GetSingleBitMask(BattleSystem_Partner(battleSys, battler))) == 0) { + if ((battleCtx->battlersSwitchingMask & Pokemon_GetFlagMaskOf(BattleSystem_Partner(battleSys, battler))) == 0) { return 1; } else { return 0; @@ -4161,16 +4161,16 @@ static BOOL BattleController_CheckAnyFainted (BattleContext * param0, int param1 int v1; v0 = 0; - v1 = GetSingleBitMask(param0->monSpeedOrder[v0]) << 24; + v1 = Pokemon_GetFlagMaskOf(param0->monSpeedOrder[v0]) << 24; if (param0->battleStatusMask & 0xf000000) { while ((param0->battleStatusMask & v1) == 0) { v0++; - v1 = GetSingleBitMask(param0->monSpeedOrder[v0]) << 24; + v1 = Pokemon_GetFlagMaskOf(param0->monSpeedOrder[v0]) << 24; } param0->battleStatusMask &= (v1 ^ 0xffffffff); - param0->faintedMon = GetLowestSetBitIndex(v1 >> 24); + param0->faintedMon = Pokemon_GetLowestFlagIndex(v1 >> 24); if (param3 == 1) { BattleSystem_LoadScript(param0, 1, (0 + 6)); @@ -4202,7 +4202,7 @@ static BOOL BattleController_CheckExpPayout (BattleContext * param0, int param1, } param0->battleStatusMask2 &= (v0 ^ 0xffffffff); - param0->faintedMon = GetLowestSetBitIndex(v0 >> 28); + param0->faintedMon = Pokemon_GetLowestFlagIndex(v0 >> 28); BattleSystem_LoadScript(param0, 1, (0 + 276)); diff --git a/src/overlay016/ov16_0223B140.c b/src/overlay016/ov16_0223B140.c index 6624f833f0..4c02f4ebab 100644 --- a/src/overlay016/ov16_0223B140.c +++ b/src/overlay016/ov16_0223B140.c @@ -978,7 +978,7 @@ static void ov16_0223C210 (BattleSystem * param0) for (v1 = 0; v1 < param0->maxBattlers; v1++) { v2 = ov16_0225B45C(param0, v3, 2, v1); v4 = ov16_0223DFAC(param0, v1, v2); - ov16_0225C038(param0, param0->battlers[v1], GetMonData(v4, MON_DATA_POKEBALL, NULL), v2); + ov16_0225C038(param0, param0->battlers[v1], Pokemon_GetValue(v4, MON_DATA_POKEBALL, NULL), v2); } ov16_0223DECC(); @@ -1134,8 +1134,8 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) for (v0 = 0; v0 < 4; v0++) { for (v1 = 0; v1 < Party_GetCurrentCount(param1->parties[v0]); v1++) { v3 = Party_GetPokemonBySlotIndex(param1->parties[v0], v1); - v5 = GetMonGender(v3); - SetMonData(v3, 111, &v5); + v5 = Pokemon_GetGender(v3); + Pokemon_SetValue(v3, 111, &v5); } } } @@ -1166,7 +1166,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) for (v1 = 0; v1 < Party_GetCurrentCount(param0->parties[v0]); v1++) { v3 = Party_GetPokemonBySlotIndex(param0->parties[v0], v1); - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1193,7 +1193,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) for (v1 = 0; v1 < Party_GetCurrentCount(param0->parties[v0]); v1++) { v3 = Party_GetPokemonBySlotIndex(param0->parties[v0], v1); - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1221,11 +1221,11 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) v3 = Party_GetPokemonBySlotIndex(param0->parties[v0 & 1], v1); if (v0 > 1) { - if ((ov16_0225B45C(param0, param0->battleCtx, 2, v0 & 1) != v1) && (GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { + if ((ov16_0225B45C(param0, param0->battleCtx, 2, v0 & 1) != v1) && (Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } else { - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1249,7 +1249,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) for (v1 = 0; v1 < Party_GetCurrentCount(param0->parties[v0]); v1++) { v3 = Party_GetPokemonBySlotIndex(param0->parties[v0], v1); - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1281,11 +1281,11 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) v3 = ov16_0223DFAC(param0, v0, v1); if (v0 == 2) { - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL)) && (v8 != v1)) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL)) && (v8 != v1)) { break; } } else { - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1318,7 +1318,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) for (v1 = 0; v1 < Party_GetCurrentCount(param0->parties[v0]); v1++) { v3 = Party_GetPokemonBySlotIndex(param0->parties[v0], v1); - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1347,11 +1347,11 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) v3 = Party_GetPokemonBySlotIndex(param0->parties[v0 & 1], v1); if (v0 > 1) { - if ((ov16_0225B45C(param0, param0->battleCtx, 2, v0 & 1) != v1) && (GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { + if ((ov16_0225B45C(param0, param0->battleCtx, 2, v0 & 1) != v1) && (Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } else { - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1378,7 +1378,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) for (v1 = 0; v1 < Party_GetCurrentCount(param0->parties[v0]); v1++) { v3 = Party_GetPokemonBySlotIndex(param0->parties[v0], v1); - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { break; } } @@ -1392,7 +1392,7 @@ static void ov16_0223C2C0 (BattleSystem * param0, BattleParams * param1) if (param0->battleType & 0x200) { v3 = Party_GetPokemonBySlotIndex(param0->parties[1], 0); - GetMonData(v3, MON_DATA_144, (u8 *)¶m0->trainers[1].unk_14); + Pokemon_GetValue(v3, MON_DATA_144, (u8 *)¶m0->trainers[1].unk_14); } if (param0->battleType & 0x1) { @@ -1603,7 +1603,7 @@ static void ov16_0223CF8C (UnkStruct_0201CD38 * param0, void * param1) if (v2 != NULL) { if (sub_0208C104(v2->unk_28, v2->unk_2C, (8 * 6)) == 1) { - v5 |= GetSingleBitMask(v3); + v5 |= Pokemon_GetFlagMaskOf(v3); } } } diff --git a/src/overlay016/ov16_0223DF00.c b/src/overlay016/ov16_0223DF00.c index 91f57fe445..e6a6729209 100644 --- a/src/overlay016/ov16_0223DF00.c +++ b/src/overlay016/ov16_0223DF00.c @@ -588,11 +588,11 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i v6 = 0; if (Item_LoadParam(param4, 15, 5)) { - v3 = GetMonData(v1, MON_DATA_160, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_160, NULL); if (v3 & 0x7) { v3 &= (0x7 ^ 0xffffffff); - SetMonData(v1, 160, &v3); + Pokemon_SetValue(v1, 160, &v3); if ((v4 == param2) || (v5 == param2)) { v3 = ov16_02252060(v0, param1, 52, NULL); @@ -608,11 +608,11 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i } if (Item_LoadParam(param4, 16, 5)) { - v3 = GetMonData(v1, MON_DATA_160, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_160, NULL); if (v3 & 0xf88) { v3 &= ((0x8 | 0x80 | 0xf00) ^ 0xffffffff); - SetMonData(v1, 160, &v3); + Pokemon_SetValue(v1, 160, &v3); if ((v4 == param2) || (v5 == param2)) { v3 = ov16_02252060(v0, param1, 52, NULL); @@ -625,11 +625,11 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i } if (Item_LoadParam(param4, 17, 5)) { - v3 = GetMonData(v1, MON_DATA_160, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_160, NULL); if (v3 & 0x10) { v3 &= (0x10 ^ 0xffffffff); - SetMonData(v1, 160, &v3); + Pokemon_SetValue(v1, 160, &v3); if ((v4 == param2) || (v5 == param2)) { v3 = ov16_02252060(v0, param1, 52, NULL); @@ -642,11 +642,11 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i } if (Item_LoadParam(param4, 18, 5)) { - v3 = GetMonData(v1, MON_DATA_160, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_160, NULL); if (v3 & 0x20) { v3 &= (0x20 ^ 0xffffffff); - SetMonData(v1, 160, &v3); + Pokemon_SetValue(v1, 160, &v3); if ((v4 == param2) || (v5 == param2)) { v3 = ov16_02252060(v0, param1, 52, NULL); @@ -659,11 +659,11 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i } if (Item_LoadParam(param4, 19, 5)) { - v3 = GetMonData(v1, MON_DATA_160, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_160, NULL); if (v3 & 0x40) { v3 &= (0x40 ^ 0xffffffff); - SetMonData(v1, 160, &v3); + Pokemon_SetValue(v1, 160, &v3); if ((v4 == param2) || (v5 == param2)) { v3 = ov16_02252060(v0, param1, 52, NULL); @@ -780,11 +780,11 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i if (Item_LoadParam(param4, 36, 5)) { v3 = Item_LoadParam(param4, 55, 5); - if (GetMonData(v1, MON_DATA_MOVE1_CUR_PP + param3, NULL) != GetMonData(v1, MON_DATA_MOVE1_MAX_PP + param3, NULL)) { - IncreaseMonData(v1, MON_DATA_MOVE1_CUR_PP + param3, v3); + if (Pokemon_GetValue(v1, MON_DATA_MOVE1_CUR_PP + param3, NULL) != Pokemon_GetValue(v1, MON_DATA_MOVE1_MAX_PP + param3, NULL)) { + Pokemon_IncreaseValue(v1, MON_DATA_MOVE1_CUR_PP + param3, v3); if ((v4 == param2) || (v5 == param2)) { - if (((ov16_02252060(v0, param1, 53, NULL) & 0x200000) == 0) && ((ov16_02252060(v0, param1, 75, NULL) & GetSingleBitMask(param3)) == 0)) { + if (((ov16_02252060(v0, param1, 53, NULL) & 0x200000) == 0) && ((ov16_02252060(v0, param1, 75, NULL) & Pokemon_GetFlagMaskOf(param3)) == 0)) { ov16_02252A14(v0, param1, 31 + param3, v3); } } @@ -797,11 +797,11 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i v3 = Item_LoadParam(param4, 55, 5); for (param3 = 0; param3 < 4; param3++) { - if (GetMonData(v1, MON_DATA_MOVE1_CUR_PP + param3, NULL) != GetMonData(v1, MON_DATA_MOVE1_MAX_PP + param3, NULL)) { - IncreaseMonData(v1, MON_DATA_MOVE1_CUR_PP + param3, v3); + if (Pokemon_GetValue(v1, MON_DATA_MOVE1_CUR_PP + param3, NULL) != Pokemon_GetValue(v1, MON_DATA_MOVE1_MAX_PP + param3, NULL)) { + Pokemon_IncreaseValue(v1, MON_DATA_MOVE1_CUR_PP + param3, v3); if ((v4 == param2) || (v5 == param2)) { - if (((ov16_02252060(v0, param1, 53, NULL) & 0x200000) == 0) && ((ov16_02252060(v0, param1, 75, NULL) & GetSingleBitMask(param3)) == 0)) { + if (((ov16_02252060(v0, param1, 53, NULL) & 0x200000) == 0) && ((ov16_02252060(v0, param1, 75, NULL) & Pokemon_GetFlagMaskOf(param3)) == 0)) { ov16_02252A14(v0, param1, 31 + param3, v3); } } @@ -815,29 +815,29 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i v3 = 0; if (Item_LoadParam(param4, 23, 5)) { - if (GetMonData(v1, MON_DATA_CURRENT_HP, NULL) == 0) { + if (Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL) == 0) { v3 = 1; } } else { - v3 = GetMonData(v1, MON_DATA_CURRENT_HP, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL); } - if ((v3) && (GetMonData(v1, MON_DATA_CURRENT_HP, NULL) != GetMonData(v1, MON_DATA_MAX_HP, NULL))) { + if ((v3) && (Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL) != Pokemon_GetValue(v1, MON_DATA_MAX_HP, NULL))) { v3 = Item_LoadParam(param4, 54, 5); switch (v3) { case 255: - v3 = GetMonData(v1, MON_DATA_MAX_HP, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_MAX_HP, NULL); break; case 254: - v3 = GetMonData(v1, MON_DATA_MAX_HP, NULL) / 2; + v3 = Pokemon_GetValue(v1, MON_DATA_MAX_HP, NULL) / 2; if (v3 == 0) { v3 = 1; } break; case 253: - v3 = GetMonData(v1, MON_DATA_MAX_HP, NULL) * 25 / 100; + v3 = Pokemon_GetValue(v1, MON_DATA_MAX_HP, NULL) * 25 / 100; if (v3 == 0) { v3 = 1; @@ -847,7 +847,7 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i break; } - IncreaseMonData(v1, MON_DATA_CURRENT_HP, v3); + Pokemon_IncreaseValue(v1, MON_DATA_CURRENT_HP, v3); if (!Item_LoadParam(param4, 23, 5)) { if (Battler_Side(param0, param1)) { @@ -864,41 +864,41 @@ BOOL ov16_0223E30C (BattleSystem * param0, int param1, int param2, int param3, i } if (Item_LoadParam(param4, 45, 5)) { - if ((GetMonData(v1, MON_DATA_FRIENDSHIP, NULL) < 100) && (v2 == 1)) { + if ((Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL) < 100) && (v2 == 1)) { v6 = Item_LoadParam(param4, 56, 5); } } if (Item_LoadParam(param4, 46, 5)) { - if ((GetMonData(v1, MON_DATA_FRIENDSHIP, NULL) >= 100) && (GetMonData(v1, MON_DATA_FRIENDSHIP, NULL) < 200) && (v2 == 1)) { + if ((Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL) >= 100) && (Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL) < 200) && (v2 == 1)) { v6 = Item_LoadParam(param4, 57, 5); } } if (Item_LoadParam(param4, 47, 5)) { - if ((GetMonData(v1, MON_DATA_FRIENDSHIP, NULL) >= 200) && (v2 == 1)) { + if ((Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL) >= 200) && (v2 == 1)) { v6 = Item_LoadParam(param4, 58, 5); } } if (v6) { if (v6 > 0) { - if (GetMonData(v1, MON_DATA_POKEBALL, NULL) == 11) { + if (Pokemon_GetValue(v1, MON_DATA_POKEBALL, NULL) == 11) { v6++; } - if (GetMonData(v1, MON_DATA_152, NULL) == ov16_0223E24C(param0)) { + if (Pokemon_GetValue(v1, MON_DATA_152, NULL) == ov16_0223E24C(param0)) { v6++; } - v3 = GetMonData(v1, MON_DATA_HELD_ITEM, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_HELD_ITEM, NULL); if (Item_LoadParam(param4, 1, 5) == 53) { v6 = v6 * 150 / 100; } } - IncreaseMonData(v1, MON_DATA_FRIENDSHIP, v6); + Pokemon_IncreaseValue(v1, MON_DATA_FRIENDSHIP, v6); if ((v4 == param2) || (v5 == param2)) { ov16_02252A14(v0, param1, 44, v6); @@ -957,13 +957,13 @@ u8 ov16_0223EC58 (BattleSystem * param0, int param1, u8 param2) if (((BattleSystem_BattlerSlot(param0, param1) == 4) && ((param0->battleType & 0x8) == 0))) { if (param0->battleType & 0x4) { - if ((param2 & GetSingleBitMask(BattleSystem_Partner(param0, param1))) == 0) { + if ((param2 & Pokemon_GetFlagMaskOf(BattleSystem_Partner(param0, param1))) == 0) { return 1; } } else { v0 = ov16_0225B45C(param0, param0->battleCtx, 12, 0) & 0xffff; - if (((ov16_0225B45C(param0, param0->battleCtx, 8, 0) == 14) && (v0 > 16)) || (param2 & GetSingleBitMask(0))) { + if (((ov16_0225B45C(param0, param0->battleCtx, 8, 0) == 14) && (v0 > 16)) || (param2 & Pokemon_GetFlagMaskOf(0))) { return 0; } else { return 1; @@ -987,8 +987,8 @@ u16 ov16_0223ECC4 (BattleParams * param0, int * param1, int * param2) while (param0->unk_150) { for (param1[0] = 0; param1[0] < 6; param1[0]++) { - if (param0->unk_150 & GetSingleBitMask(param1[0])) { - param0->unk_150 &= (GetSingleBitMask(param1[0]) ^ 0xffffffff); + if (param0->unk_150 & Pokemon_GetFlagMaskOf(param1[0])) { + param0->unk_150 &= (Pokemon_GetFlagMaskOf(param1[0]) ^ 0xffffffff); break; } } @@ -1087,9 +1087,9 @@ void ov16_0223EE70 (BattleSystem * param0) for (v0 = 0; v0 < ov16_0223DF60(param0, 0); v0++) { v2 = ov16_0223DFAC(param0, 0, v0); - v3 = GetMonData(v2, MON_DATA_SPECIES_EGG, NULL); + v3 = Pokemon_GetValue(v2, MON_DATA_SPECIES_EGG, NULL); - if ((v3 == 412) && (param0->unk_2414[0] & GetSingleBitMask(v0))) { + if ((v3 == 412) && (param0->unk_2414[0] & Pokemon_GetFlagMaskOf(v0))) { switch (ov16_0223E22C(param0)) { default: case 2: @@ -1119,20 +1119,20 @@ void ov16_0223EE70 (BattleSystem * param0) break; } - SetMonData(v2, 112, &v1); + Pokemon_SetValue(v2, 112, &v1); } } } void ov16_0223EF2C (BattleSystem * param0, int param1, int param2) { - param0->unk_2414[param1] |= GetSingleBitMask(param2); + param0->unk_2414[param1] |= Pokemon_GetFlagMaskOf(param2); } void ov16_0223EF48 (BattleSystem * param0, Pokemon * param1) { if (param0->unk_98) { - sub_02056A48(param0->unk_98, GetBoxMon(param1)); + sub_02056A48(param0->unk_98, Pokemon_GetBoxPokemon(param1)); } } @@ -1678,7 +1678,7 @@ u32 ov16_0223F904 (Party * param0, UnkStruct_02025E6C * param1) u8 v3; v3 = sub_02025F58(param1); - v1 = GetPartyHighestLevel(param0) * 4 * v0[v3]; + v1 = Party_GetMaxLevel(param0) * 4 * v0[v3]; v2 = sub_02025F74(param1); if (v1 > v2) { @@ -1704,7 +1704,7 @@ void ov16_0223F938 (BattleSystem * param0, int param1) } } - if (((v0 & 0x1) == 0) && (GetMonData(v1, MON_DATA_SPECIES_EGG, NULL) == 412)) { + if (((v0 & 0x1) == 0) && (Pokemon_GetValue(v1, MON_DATA_SPECIES_EGG, NULL) == 412)) { sub_0202736C(param0->unk_60, v1); } } diff --git a/src/overlay016/ov16_022405FC.c b/src/overlay016/ov16_022405FC.c index 788ad0b989..bd9f45a76c 100644 --- a/src/overlay016/ov16_022405FC.c +++ b/src/overlay016/ov16_022405FC.c @@ -843,7 +843,7 @@ static BOOL ov16_02240A7C (BattleSystem * param0, BattleContext * param1) for (v0 = 0; v0 < v2; v0++) { v3 = BattleSystem_BattlerData(param0, v0); - if ((v3->unk_191 & 0x1) && ((param1->battlersSwitchingMask & GetSingleBitMask(v0)) == 0)) { + if ((v3->unk_191 & 0x1) && ((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v0)) == 0)) { ov16_02264EF8(param0, param1, v0); } } @@ -1305,7 +1305,7 @@ static BOOL ov16_02241288 (BattleSystem * param0, BattleContext * param1) for (v0 = 0; v0 < v2; v0++) { v3 = BattleSystem_BattlerData(param0, v0); - if (((v3->unk_191 & 0x1) == 0) && ((param1->battlersSwitchingMask & GetSingleBitMask(v0)) == 0)) { + if (((v3->unk_191 & 0x1) == 0) && ((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v0)) == 0)) { ov16_02265314(param0, v0); } } @@ -1617,7 +1617,7 @@ static BOOL ov16_022418C0 (BattleSystem * param0, BattleContext * param1) if (param1->battleMons[v1].curHP == 0) { param1->faintedMon = v1; - param1->battleStatusMask |= (GetSingleBitMask(v1) << 24); + param1->battleStatusMask |= (Pokemon_GetFlagMaskOf(v1) << 24); param1->totalFainted[v1]++; ov16_0224B850(param0, param1, v1); @@ -1631,8 +1631,8 @@ static BOOL ov16_02241924 (BattleSystem * param0, BattleContext * param1) ov16_02248AF0(param1, 1); ov16_02265D98(param0, param1, param1->faintedMon); - param1->battleStatusMask &= (GetSingleBitMask(param1->faintedMon) << 24) ^ 0xffffffff; - param1->battleStatusMask2 |= GetSingleBitMask(param1->faintedMon) << 28; + param1->battleStatusMask &= (Pokemon_GetFlagMaskOf(param1->faintedMon) << 24) ^ 0xffffffff; + param1->battleStatusMask2 |= Pokemon_GetFlagMaskOf(param1->faintedMon) << 28; param1->battlerActions[param1->faintedMon][0] = 39; ov16_02254744(param0, param1, param1->faintedMon); @@ -1916,12 +1916,12 @@ static BOOL ov16_02241D34 (BattleSystem * param0, BattleContext * param1) for (v3 = 0; v3 < Party_GetCurrentCount(ov16_0223DF20(param0, 0)); v3++) { v10 = ov16_0223DFAC(param0, 0, v3); - if ((GetMonData(v10, MON_DATA_SPECIES, NULL)) && (GetMonData(v10, MON_DATA_CURRENT_HP, NULL))) { - if (param1->monsGainingExp[(param1->faintedMon >> 1) & 1] & GetSingleBitMask(v3)) { + if ((Pokemon_GetValue(v10, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v10, MON_DATA_CURRENT_HP, NULL))) { + if (param1->monsGainingExp[(param1->faintedMon >> 1) & 1] & Pokemon_GetFlagMaskOf(v3)) { v5++; } - v7 = GetMonData(v10, MON_DATA_HELD_ITEM, NULL); + v7 = Pokemon_GetValue(v10, MON_DATA_HELD_ITEM, NULL); v9 = ov16_0225B0FC(param1, v7, 1); if (v9 == 51) { @@ -1930,7 +1930,7 @@ static BOOL ov16_02241D34 (BattleSystem * param0, BattleContext * param1) } } - v8 = GetMonSpeciesPersonalDataAttribute(param1->battleMons[param1->faintedMon].species, 9); + v8 = PokemonPersonalData_GetSpeciesValue(param1->battleMons[param1->faintedMon].species, 9); v8 = (v8 * param1->battleMons[param1->faintedMon].level) / 7; if (v6) { @@ -2012,7 +2012,7 @@ static BOOL ov16_02241F34 (BattleSystem * param0, BattleContext * param1) for (v0 = 0; v0 < v3; v0++) { if (param1->battlerStatusFlags[v0] & 0x1) { - v2 |= GetSingleBitMask(v0); + v2 |= Pokemon_GetFlagMaskOf(v0); BattleIO_ShowPartyScreen(param0, param1, v0, 1, 0, 6); } } @@ -2021,12 +2021,12 @@ static BOOL ov16_02241F34 (BattleSystem * param0, BattleContext * param1) if (BattleSystem_BattleType(param0) == ((0x4 | 0x1) | 0x2)) { v1 = BattleSystem_Partner(param0, v0); - if (((v2 & GetSingleBitMask(v0)) == 0) && ((v2 & GetSingleBitMask(v1)) == 0)) { - v2 |= GetSingleBitMask(v0); + if (((v2 & Pokemon_GetFlagMaskOf(v0)) == 0) && ((v2 & Pokemon_GetFlagMaskOf(v1)) == 0)) { + v2 |= Pokemon_GetFlagMaskOf(v0); BattleIO_LinkWaitMessage(param0, v0); } } else { - if ((v2 & GetSingleBitMask(v0)) == 0) { + if ((v2 & Pokemon_GetFlagMaskOf(v0)) == 0) { BattleIO_LinkWaitMessage(param0, v0); } } @@ -2062,8 +2062,8 @@ static BOOL ov16_0224200C (BattleSystem * param0, BattleContext * param1) param1->switchedPartySlot[v0] = param1->ioBuffer[v0][0] - 1; v2--; - if ((param1->battleStatusMask2 & (GetSingleBitMask(v0) << 24)) == 0) { - param1->battleStatusMask2 |= (GetSingleBitMask(v0) << 24); + if ((param1->battleStatusMask2 & (Pokemon_GetFlagMaskOf(v0) << 24)) == 0) { + param1->battleStatusMask2 |= (Pokemon_GetFlagMaskOf(v0) << 24); BattleIO_LinkWaitMessage(param0, v0); } } @@ -2108,7 +2108,7 @@ static BOOL ov16_02242134 (BattleSystem * param0, BattleContext * param1) } param1->battlerStatusFlags[v0] &= 0x1 ^ 0xffffffff; - param1->battlersSwitchingMask &= (GetSingleBitMask(v0) ^ 0xffffffff); + param1->battlersSwitchingMask &= (Pokemon_GetFlagMaskOf(v0) ^ 0xffffffff); param1->selectedPartySlot[v0] = param1->switchedPartySlot[v0]; param1->switchedPartySlot[v0] = 6; @@ -2250,7 +2250,7 @@ static BOOL ov16_0224230C (BattleSystem * param0, BattleContext * param1) v3[0] = v4; break; case ((6 + 1) + 9): - v3[0] = GetSingleBitMask(v2); + v3[0] = Pokemon_GetFlagMaskOf(v2); break; case ((6 + 1) + 10): GF_ASSERT(0); @@ -2515,7 +2515,7 @@ static BOOL ov16_02242A14 (BattleSystem * param0, BattleContext * param1) v5 = v6; break; case ((6 + 1) + 9): - v5 = GetSingleBitMask(v3); + v5 = Pokemon_GetFlagMaskOf(v3); break; case ((6 + 1) + 10): GF_ASSERT(0); @@ -2700,7 +2700,7 @@ static BOOL ov16_02242CA4 (BattleSystem * param0, BattleContext * param1) v3[0] = v5; break; case ((6 + 1) + 9): - v3[0] = GetSingleBitMask(v4[0]); + v3[0] = Pokemon_GetFlagMaskOf(v4[0]); break; case ((6 + 1) + 10): v4[0] = v3[0]; @@ -2778,7 +2778,7 @@ static BOOL ov16_02242DBC (BattleSystem * param0, BattleContext * param1) v5 = v7; break; case ((6 + 1) + 9): - v5 = GetSingleBitMask(v6[0]); + v5 = Pokemon_GetFlagMaskOf(v6[0]); break; case ((6 + 1) + 10): v6[0] = v5; @@ -3764,7 +3764,7 @@ static BOOL ov16_02243DBC (BattleSystem * param0, BattleContext * param1) param1->battleMons[param1->attacker].ppCur[v2] = 5; } - param1->battleMons[param1->attacker].moveEffectsData.mimickedMoveSlot |= GetSingleBitMask(v2); + param1->battleMons[param1->attacker].moveEffectsData.mimickedMoveSlot |= Pokemon_GetFlagMaskOf(v2); if (param1->msgMoveTemp == 387) { param1->battleMons[param1->attacker].moveEffectsData.lastResortCount = 0; @@ -4044,7 +4044,7 @@ static BOOL ov16_022445D4 (BattleSystem * param0, BattleContext * param1) for (v0 = 0; v0 < 4; v0++) { if ((ov16_02255918(param1->battleMons[param1->attacker].moves[v0])) || (param1->battleMons[param1->attacker].moves[v0] == 264) || (param1->battleMons[param1->attacker].moves[v0] == 253) || (param1->battleMons[param1->attacker].moves[v0] == 448) || (ov16_0225582C(param1, param1->battleMons[param1->attacker].moves[v0]))) { - v1 |= GetSingleBitMask(v0); + v1 |= Pokemon_GetFlagMaskOf(v0); } } @@ -4055,7 +4055,7 @@ static BOOL ov16_022445D4 (BattleSystem * param0, BattleContext * param1) } else { do { v0 = BattleSystem_RandNext(param0) % 4; - } while ((v1 & GetSingleBitMask(v0))); + } while ((v1 & Pokemon_GetFlagMaskOf(v0))); param1->msgMoveTemp = param1->battleMons[param1->attacker].moves[v0]; } @@ -4148,7 +4148,7 @@ static BOOL ov16_02244798 (BattleSystem * param0, BattleContext * param1) if (v0 & 0x2) { v1 = ov16_0224A984(param0, param1, 0x10); - if ((param1->battlersSwitchingMask & GetSingleBitMask(v1)) == 0) { + if ((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v1)) == 0) { if (ov16_02255AB4(param1, param1->attacker, v1, 43) == 0) { param1->battleMons[v1].status = 0; param1->battleMons[v1].statusVolatile &= (0x8000000 ^ 0xffffffff); @@ -4167,7 +4167,7 @@ static BOOL ov16_02244798 (BattleSystem * param0, BattleContext * param1) if (v0 & 0x2) { v1 = ov16_0224A984(param0, param1, 0x10); - if ((param1->battlersSwitchingMask & GetSingleBitMask(v1)) == 0) { + if ((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v1)) == 0) { param1->battleMons[v1].status = 0; param1->battleMons[v1].statusVolatile &= (0x8000000 ^ 0xffffffff); } @@ -4197,7 +4197,7 @@ static BOOL ov16_022448E8 (BattleSystem * param0, BattleContext * param1) if ((Battler_Side(param0, param1->attacker)) && ((v2 & (0x4 | 0x80)) == 0)) { ov16_02248AF0(param1, v0); - } else if (param1->sideConditions[v3].knockedOffItemsMask & GetSingleBitMask(param1->selectedPartySlot[param1->attacker])) { + } else if (param1->sideConditions[v3].knockedOffItemsMask & Pokemon_GetFlagMaskOf(param1->selectedPartySlot[param1->attacker])) { ov16_02248AF0(param1, v0); } else if ((Battler_Ability(param1, param1->attacker) == 121) || (Battler_Ability(param1, param1->defender) == 121)) { ov16_02248AF0(param1, v0); @@ -4335,7 +4335,7 @@ static BOOL ov16_02244BC4 (BattleSystem * param0, BattleContext * param1) for (v7 = v8; v7 < v9; v7++) { v3 = Party_GetPokemonBySlotIndex(v2, v7); - if ((GetMonData(v3, MON_DATA_SPECIES, NULL)) && (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL))) { + if ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL))) { v5++; } } @@ -4351,7 +4351,7 @@ static BOOL ov16_02244BC4 (BattleSystem * param0, BattleContext * param1) } while ((v7 == v11) || (v7 == v12)); v3 = Party_GetPokemonBySlotIndex(v2, v7); - } while ((GetMonData(v3, MON_DATA_SPECIES, NULL) == 0) || (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 1) || (GetMonData(v3, MON_DATA_CURRENT_HP, NULL) == 0)); + } while ((Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL) == 0) || (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 1) || (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL) == 0)); param1->switchedPartySlot[param1->defender] = v7; } else { @@ -4670,7 +4670,7 @@ static BOOL ov16_022455F8 (BattleSystem * param0, BattleContext * param1) if ((param1->battleMons[param1->msgBattlerTemp].gender == param1->battleMons[param1->sideEffectMon].gender) || (param1->battleMons[param1->sideEffectMon].statusVolatile & 0xf0000) || (param1->battleMons[param1->msgBattlerTemp].gender == 2) || (param1->battleMons[param1->sideEffectMon].gender == 2)) { ov16_02248AF0(param1, v0); } else { - param1->battleMons[param1->sideEffectMon].statusVolatile |= GetSingleBitMask(param1->msgBattlerTemp) << 16; + param1->battleMons[param1->sideEffectMon].statusVolatile |= Pokemon_GetFlagMaskOf(param1->msgBattlerTemp) << 16; } return 0; @@ -4978,7 +4978,7 @@ static BOOL ov16_02245D68 (BattleSystem * param0, BattleContext * param1) while (TRUE) { v5 = ov16_0223DFAC(param0, param1->attacker, param1->beatUpCounter); - if ((param1->beatUpCounter == param1->selectedPartySlot[param1->attacker]) || ((GetMonData(v5, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 494) && (GetMonData(v5, MON_DATA_160, NULL) == 0))) { + if ((param1->beatUpCounter == param1->selectedPartySlot[param1->attacker]) || ((Pokemon_GetValue(v5, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v5, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v5, MON_DATA_SPECIES_EGG, NULL) != 494) && (Pokemon_GetValue(v5, MON_DATA_160, NULL) == 0))) { break; } @@ -4987,14 +4987,14 @@ static BOOL ov16_02245D68 (BattleSystem * param0, BattleContext * param1) } v5 = ov16_0223DFAC(param0, param1->attacker, param1->beatUpCounter); - v2 = GetMonData(v5, MON_DATA_SPECIES, NULL); - v3 = GetMonData(v5, MON_DATA_FORM, NULL); - v4 = GetMonData(v5, MON_DATA_LEVEL, NULL); + v2 = Pokemon_GetValue(v5, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v5, MON_DATA_FORM, NULL); + v4 = Pokemon_GetValue(v5, MON_DATA_LEVEL, NULL); - param1->damage = GetMonFormPersonalDataAttribute(v2, v3, 1); + param1->damage = PokemonPersonalData_GetFormValue(v2, v3, 1); param1->damage *= param1->aiContext.moveTable[param1->moveCur].power; param1->damage *= ((v4 * 2 / 5) + 2); - param1->damage /= GetMonFormPersonalDataAttribute(param1->battleMons[param1->defender].species, param1->battleMons[param1->defender].formNum, 2); + param1->damage /= PokemonPersonalData_GetFormValue(param1->battleMons[param1->defender].species, param1->battleMons[param1->defender].formNum, 2); param1->damage /= 50; param1->damage += 2; param1->damage *= param1->criticalMul; @@ -5015,7 +5015,7 @@ static BOOL ov16_02245D68 (BattleSystem * param0, BattleContext * param1) while (TRUE) { v5 = ov16_0223DFAC(param0, param1->attacker, param1->beatUpCounter); - if ((param1->beatUpCounter == param1->selectedPartySlot[param1->attacker]) || ((GetMonData(v5, MON_DATA_CURRENT_HP, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v5, MON_DATA_SPECIES_EGG, NULL) != 494) && (GetMonData(v5, MON_DATA_160, NULL) == 0))) { + if ((param1->beatUpCounter == param1->selectedPartySlot[param1->attacker]) || ((Pokemon_GetValue(v5, MON_DATA_CURRENT_HP, NULL) != 0) && (Pokemon_GetValue(v5, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v5, MON_DATA_SPECIES_EGG, NULL) != 494) && (Pokemon_GetValue(v5, MON_DATA_160, NULL) == 0))) { break; } @@ -5061,7 +5061,7 @@ static BOOL ov16_02246004 (BattleSystem * param0, BattleContext * param1) if (v2 & 0x2) { v1 = ov16_0224A984(param0, param1, 0x10); - if (((param1->battlersSwitchingMask & GetSingleBitMask(v1)) == 0) && (param1->battlerActions[v1][0] != 39) && (param1->battleMons[v1].curHP) && (param1->turnFlags[param1->attacker].helpingHand == 0) && (param1->turnFlags[v1].helpingHand == 0)) { + if (((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v1)) == 0) && (param1->battlerActions[v1][0] != 39) && (param1->battleMons[v1].curHP) && (param1->turnFlags[param1->attacker].helpingHand == 0) && (param1->turnFlags[v1].helpingHand == 0)) { param1->msgBattlerTemp = v1; param1->turnFlags[v1].helpingHand = 1; } else { @@ -5092,7 +5092,7 @@ static BOOL ov16_022460A8 (BattleSystem * param0, BattleContext * param1) if ((Battler_Side(param0, param1->attacker)) && ((v2 & (0x4 | 0x80)) == 0)) { ov16_02248AF0(param1, v0); - } else if ((param1->sideConditions[v3].knockedOffItemsMask & GetSingleBitMask(param1->selectedPartySlot[param1->attacker])) || (param1->sideConditions[v4].knockedOffItemsMask & GetSingleBitMask(param1->selectedPartySlot[param1->defender]))) { + } else if ((param1->sideConditions[v3].knockedOffItemsMask & Pokemon_GetFlagMaskOf(param1->selectedPartySlot[param1->attacker])) || (param1->sideConditions[v4].knockedOffItemsMask & Pokemon_GetFlagMaskOf(param1->selectedPartySlot[param1->defender]))) { ov16_02248AF0(param1, v0); } else if (((param1->battleMons[param1->attacker].heldItem == 0) && (param1->battleMons[param1->defender].heldItem == 0)) || (ov16_022559DC(param1, param1->attacker) == 0) || (ov16_022559DC(param1, param1->defender) == 0)) { ov16_02248AF0(param1, v0); @@ -5144,9 +5144,9 @@ static BOOL ov16_022461F4 (BattleSystem * param0, BattleContext * param1) if (v3 != param1->selectedPartySlot[param1->attacker]) { v7 = ov16_0223DFAC(param0, param1->attacker, v3); - if ((GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v7, MON_DATA_SPECIES_EGG, NULL) != 494)) { + if ((Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL) != 494)) { for (v4 = 0; v4 < 4; v4++) { - v2 = GetMonData(v7, MON_DATA_MOVE1 + v4, NULL); + v2 = Pokemon_GetValue(v7, MON_DATA_MOVE1 + v4, NULL); if ((ov16_02255918(v2) == 0) && (ov16_0225B02C(param0, param1, param1->attacker, v2) == 1)) { v1[v6] = v2; @@ -5228,7 +5228,7 @@ static BOOL ov16_022463E8 (BattleSystem * param0, BattleContext * param1) { ov16_02248AF0(param1, 1); - if (((param1->turnFlags[param1->attacker].physicalDamageTakenFrom[param1->defender]) && (param1->turnFlags[param1->attacker].physicalDamageAttackerMask & GetSingleBitMask(param1->defender))) || ((param1->turnFlags[param1->attacker].specialDamageTakenFrom[param1->defender]) && (param1->turnFlags[param1->attacker].specialDamageAttackerMask & GetSingleBitMask(param1->defender)))) { + if (((param1->turnFlags[param1->attacker].physicalDamageTakenFrom[param1->defender]) && (param1->turnFlags[param1->attacker].physicalDamageAttackerMask & Pokemon_GetFlagMaskOf(param1->defender))) || ((param1->turnFlags[param1->attacker].specialDamageTakenFrom[param1->defender]) && (param1->turnFlags[param1->attacker].specialDamageAttackerMask & Pokemon_GetFlagMaskOf(param1->defender)))) { param1->powerMul = 20; } else { param1->powerMul = 10; @@ -5299,7 +5299,7 @@ static BOOL ov16_0224650C (BattleSystem * param0, BattleContext * param1) param1->msgBuffer.params[1] = BattleSystem_NicknameTag(param1, param1->defender); param1->msgBuffer.params[2] = param1->battleMons[param1->defender].heldItem; param1->battleMons[param1->defender].heldItem = 0; - param1->sideConditions[v1].knockedOffItemsMask |= GetSingleBitMask(param1->selectedPartySlot[param1->defender]); + param1->sideConditions[v1].knockedOffItemsMask |= Pokemon_GetFlagMaskOf(param1->selectedPartySlot[param1->defender]); } else { ov16_02248AF0(param1, v0); } @@ -6201,13 +6201,13 @@ static BOOL ov16_022476F8 (BattleSystem * param0, BattleContext * param1) for (v1 = 0; v1 < ov16_0223DF60(param0, 0); v1++) { v8 = ov16_0223DFAC(param0, 0, v1); - v4 = GetMonData(v8, MON_DATA_SPECIES_EGG, NULL); - v5 = GetMonData(v8, MON_DATA_HELD_ITEM, NULL); - v6 = GetMonData(v8, MON_DATA_ABILITY, NULL); + v4 = Pokemon_GetValue(v8, MON_DATA_SPECIES_EGG, NULL); + v5 = Pokemon_GetValue(v8, MON_DATA_HELD_ITEM, NULL); + v6 = Pokemon_GetValue(v8, MON_DATA_ABILITY, NULL); if ((v6 == 53) && (v4 != 0) && (v4 != 494) && (v5 == 0) && ((BattleSystem_RandNext(param0) % 10) == 0)) { v0 = BattleSystem_RandNext(param0) % 100; - v7 = (GetMonData(v8, MON_DATA_LEVEL, NULL) - 1) / 10; + v7 = (Pokemon_GetValue(v8, MON_DATA_LEVEL, NULL) - 1) / 10; if (v7 >= 10) { v7 = 9; @@ -6215,10 +6215,10 @@ static BOOL ov16_022476F8 (BattleSystem * param0, BattleContext * param1) for (v2 = 0; v2 < 9; v2++) { if (Unk_ov16_0226EAA8[v2] > v0) { - SetMonData(v8, 6, (u8 *)&Unk_ov16_0226E66C[v7 + v2]); + Pokemon_SetValue(v8, 6, (u8 *)&Unk_ov16_0226E66C[v7 + v2]); break; } else if ((v0 >= 98) && (v0 <= 99)) { - SetMonData(v8, 6, (u8 *)&Unk_ov16_0226E590[v7 + (99 - v0)]); + Pokemon_SetValue(v8, 6, (u8 *)&Unk_ov16_0226E590[v7 + (99 - v0)]); break; } } @@ -6227,7 +6227,7 @@ static BOOL ov16_022476F8 (BattleSystem * param0, BattleContext * param1) if ((v6 == 118) && (v4 != 0) && (v4 != 494) && (v5 == 0)) { v2 = 0; v3 = 10; - v7 = GetMonData(v8, MON_DATA_LEVEL, NULL); + v7 = Pokemon_GetValue(v8, MON_DATA_LEVEL, NULL); while (v7 > v3) { v2++; @@ -6238,7 +6238,7 @@ static BOOL ov16_022476F8 (BattleSystem * param0, BattleContext * param1) if (BattleSystem_RandNext(param0) % 100 < Unk_ov16_0226EAB4[v2]) { v2 = 94; - SetMonData(v8, 6, (u8 *)&v2); + Pokemon_SetValue(v8, 6, (u8 *)&v2); } } } @@ -7042,8 +7042,8 @@ static BOOL ov16_02248324 (BattleSystem * param0, BattleContext * param1) for (v3 = 0; v3 < Party_GetCurrentCount(v8); v3++) { v6 = Party_GetPokemonBySlotIndex(v8, v3); - if ((GetMonData(v6, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v6, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v4 += GetMonData(v6, MON_DATA_CURRENT_HP, NULL); + if ((Pokemon_GetValue(v6, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v6, MON_DATA_SPECIES_EGG, NULL) != 494)) { + v4 += Pokemon_GetValue(v6, MON_DATA_CURRENT_HP, NULL); } } @@ -7053,8 +7053,8 @@ static BOOL ov16_02248324 (BattleSystem * param0, BattleContext * param1) for (v3 = 0; v3 < Party_GetCurrentCount(v9); v3++) { v6 = Party_GetPokemonBySlotIndex(v9, v3); - if ((GetMonData(v6, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v6, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v4 += GetMonData(v6, MON_DATA_CURRENT_HP, NULL); + if ((Pokemon_GetValue(v6, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v6, MON_DATA_SPECIES_EGG, NULL) != 494)) { + v4 += Pokemon_GetValue(v6, MON_DATA_CURRENT_HP, NULL); } } } @@ -7073,8 +7073,8 @@ static BOOL ov16_02248324 (BattleSystem * param0, BattleContext * param1) for (v3 = 0; v3 < Party_GetCurrentCount(v10); v3++) { v6 = Party_GetPokemonBySlotIndex(v10, v3); - if ((GetMonData(v6, MON_DATA_SPECIES_EGG, NULL) != 0) && (GetMonData(v6, MON_DATA_SPECIES_EGG, NULL) != 494)) { - v4 += GetMonData(v6, MON_DATA_CURRENT_HP, NULL); + if ((Pokemon_GetValue(v6, MON_DATA_SPECIES_EGG, NULL) != 0) && (Pokemon_GetValue(v6, MON_DATA_SPECIES_EGG, NULL) != 494)) { + v4 += Pokemon_GetValue(v6, MON_DATA_CURRENT_HP, NULL); } } @@ -7239,8 +7239,8 @@ static BOOL ov16_02248708 (BattleSystem * param0, BattleContext * param1) if ((param1->battleMons[v1].curHP) && (param1->selectedPartySlot[v1] != 6)) { v3 = ov16_0223DFAC(param0, v1, param1->selectedPartySlot[v1]); - v4 = GetMonData(v3, MON_DATA_ABILITY, NULL); - v5 = GetMonData(v3, MON_DATA_160, NULL); + v4 = Pokemon_GetValue(v3, MON_DATA_ABILITY, NULL); + v5 = Pokemon_GetValue(v3, MON_DATA_160, NULL); if ((param1->battleMons[v1].ability != 30) && (ov16_022577A4(param1, v4, v5) == 0)) { ov16_02248AF0(param1, v2); @@ -7440,7 +7440,7 @@ static BOOL ov16_02248A34 (BattleSystem * param0, BattleContext * param1) v2 = ov16_02248AD0(param1); v3 = ov16_02248B10(param0, param1, v1); - param1->calcTemp = GetMonFormPersonalDataAttribute(v0, v3[0], v2); + param1->calcTemp = PokemonPersonalData_GetFormValue(v0, v3[0], v2); return 0; } @@ -7662,10 +7662,10 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) for (v1 = v2->unk_30[6]; v1 < ov16_0223DF60(v2->unk_00, v6); v1++) { v3 = ov16_0223DFAC(v2->unk_00, v6, v1); - v9 = GetMonData(v3, MON_DATA_HELD_ITEM, NULL); + v9 = Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL); v10 = Item_LoadParam(v9, 1, 5); - if ((v10 == 51) || (v2->unk_04->monsGainingExp[v5] & GetSingleBitMask(v1))) { + if ((v10 == 51) || (v2->unk_04->monsGainingExp[v5] & Pokemon_GetFlagMaskOf(v1))) { break; } } @@ -7684,10 +7684,10 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) u32 v11; u32 v12; - v9 = GetMonData(v3, MON_DATA_HELD_ITEM, NULL); + v9 = Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL); v10 = Item_LoadParam(v9, 1, 5); - if (((v8 & 0x1) == 0) && ((v2->unk_04->battleMons[1].curHP + v2->unk_04->battleMons[3].curHP) == 0) && (GetMonData(v3, MON_DATA_CURRENT_HP, NULL)) && (v2->unk_04->expJinglePlayed == 0)) { + if (((v8 & 0x1) == 0) && ((v2->unk_04->battleMons[1].curHP + v2->unk_04->battleMons[3].curHP) == 0) && (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL)) && (v2->unk_04->expJinglePlayed == 0)) { sub_0200549C(1127); v2->unk_04->expJinglePlayed = 1; ov16_0223F460(v2->unk_00, 2); @@ -7696,8 +7696,8 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) v11 = 0; v4.id = 1; - if ((GetMonData(v3, MON_DATA_CURRENT_HP, NULL)) && (GetMonData(v3, MON_DATA_LEVEL, NULL) != 100)) { - if (v2->unk_04->monsGainingExp[v5] & GetSingleBitMask(v1)) { + if ((Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL)) && (Pokemon_GetValue(v3, MON_DATA_LEVEL, NULL) != 100)) { + if (v2->unk_04->monsGainingExp[v5] & Pokemon_GetFlagMaskOf(v1)) { v11 = v2->unk_04->gainedExp; } @@ -7714,7 +7714,7 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) } if (ov16_02259B38(v2->unk_00, v3) == 0) { - if (GetMonData(v3, MON_DATA_LANGUAGE, NULL) != Unk_020E4C44) { + if (Pokemon_GetValue(v3, MON_DATA_LANGUAGE, NULL) != Unk_020E4C44) { v11 = v11 * 170 / 100; } else { v11 = v11 * 150 / 100; @@ -7723,15 +7723,15 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) v4.id = 2; } - v12 = GetMonData(v3, MON_DATA_EXP, NULL); - v2->unk_30[3] = v12 - GetMonCurrentLevelExp(v3); + v12 = Pokemon_GetValue(v3, MON_DATA_EXP, NULL); + v2->unk_30[3] = v12 - Pokemon_GetCurrentLevelBaseExp(v3); v12 += v11; if (v1 == v2->unk_04->selectedPartySlot[v6]) { v2->unk_04->battleMons[v6].exp = v12; } - SetMonData(v3, 8, (u8 *)&v12); + Pokemon_SetValue(v3, 8, (u8 *)&v12); ov16_022499C0(ov16_0223DF20(v2->unk_00, v6), v1, v2->unk_04->battleMons[v2->unk_04->faintedMon].species, v2->unk_04->battleMons[v2->unk_04->faintedMon].formNum); } @@ -7790,22 +7790,22 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) int v14[6] = {164, 165, 166, 168, 169, 167}; UnkStruct_ov16_02248E74 * v15; - v13 = GetMonData(v3, MON_DATA_LEVEL, NULL); + v13 = Pokemon_GetValue(v3, MON_DATA_LEVEL, NULL); v2->unk_04->unk_17C = Heap_AllocFromHeap(5, sizeof(UnkStruct_ov16_02248E74)); v15 = (UnkStruct_ov16_02248E74 *)v2->unk_04->unk_17C; for (v0 = 0; v0 < 6; v0++) { - v15->unk_00[v0] = GetMonData(v3, v14[v0], NULL); + v15->unk_00[v0] = Pokemon_GetValue(v3, v14[v0], NULL); } sub_02075C74(v3, 0, ov16_0223E24C(v2->unk_00)); - CalculateMonStats(v3); + Pokemon_CalcStats(v3); if (v2->unk_04->selectedPartySlot[v6] == v1) { ov16_02251C94(v2->unk_00, v2->unk_04, v6, v2->unk_04->selectedPartySlot[v6]); } - v2->unk_04->levelUpMons |= GetSingleBitMask(v1); + v2->unk_04->levelUpMons |= Pokemon_GetFlagMaskOf(v1); ov16_022661CC(v2->unk_00, v2->unk_04, v6); v4.id = 3; @@ -7875,7 +7875,7 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) v4.id = 948; v4.tags = 7; - v4.params[0] = GetMonData(v3, v20[v0], NULL) - v22->unk_00[v0]; + v4.params[0] = Pokemon_GetValue(v3, v20[v0], NULL) - v22->unk_00[v0]; v4.digits = 2; ov16_0223FB78(v2->unk_00, v21, v7, &v4, 80, 16 * v0, 0x2, 28, 0); @@ -7899,7 +7899,7 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) for (v0 = 0; v0 < 6; v0++) { v4.id = 949; v4.tags = 7; - v4.params[0] = GetMonData(v3, v24[v0], NULL); + v4.params[0] = Pokemon_GetValue(v3, v24[v0], NULL); v4.digits = 3; ov16_0223FB78(v2->unk_00, v25, v7, &v4, 72, 16 * v0, 0x2, 36, 0); @@ -8064,7 +8064,7 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) v4.id = 1190; v4.tags = 10; v4.params[0] = v6 | (v1 << 8); - v4.params[1] = GetMonData(v3, 54 + v2->unk_30[5], NULL); + v4.params[1] = Pokemon_GetValue(v3, 54 + v2->unk_30[5], NULL); v2->unk_30[0] = ov16_0223FB24(v2->unk_00, v7, &v4, ov16_0223EDF0(v2->unk_00)); v2->unk_28++; break; @@ -8082,8 +8082,8 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) v2->unk_30[0] = ov16_0223FB24(v2->unk_00, v7, &v4, ov16_0223EDF0(v2->unk_00)); v0 = 0; - SetMonData(v3, 62 + v2->unk_30[5], &v0); - SetMonMove(v3, v2->unk_30[4], v2->unk_30[5]); + Pokemon_SetValue(v3, 62 + v2->unk_30[5], &v0); + Pokemon_SetMoveSlot(v3, v2->unk_30[4], v2->unk_30[5]); if (v2->unk_04->selectedPartySlot[v6] == v1) { ov16_02251C94(v2->unk_00, v2->unk_04, v6, v2->unk_04->selectedPartySlot[v6]); @@ -8097,7 +8097,7 @@ static void ov16_02248E74 (UnkStruct_0201CD38 * param0, void * param1) } break; case 37: - v2->unk_04->monsGainingExp[v5] &= (GetSingleBitMask(v1) ^ 0xffffffff); + v2->unk_04->monsGainingExp[v5] &= (Pokemon_GetFlagMaskOf(v1) ^ 0xffffffff); v2->unk_30[6] = v1 + 1; v2->unk_28 = 0; break; @@ -8121,15 +8121,15 @@ static void ov16_022499C0 (Party * param0, int param1, int param2, int param3) Pokemon * v7; PokemonPersonalData * v8; - v8 = GetMonFormPersonalData(param2, param3, 5); + v8 = PokemonPersonalData_FromMonForm(param2, param3, 5); v7 = Party_GetPokemonBySlotIndex(param0, param1); - v4 = GetMonData(v7, MON_DATA_HELD_ITEM, NULL); + v4 = Pokemon_GetValue(v7, MON_DATA_HELD_ITEM, NULL); v5 = Item_LoadParam(v4, 1, 5); v6 = Item_LoadParam(v4, 2, 5); v3 = 0; for (v0 = 0; v0 < 6; v0++) { - v2[v0] = GetMonData(v7, MON_DATA_HP_EV + v0, NULL); + v2[v0] = Pokemon_GetValue(v7, MON_DATA_HP_EV + v0, NULL); v3 += v2[v0]; } @@ -8140,42 +8140,42 @@ static void ov16_022499C0 (Party * param0, int param1, int param2, int param3) switch (v0) { case 0: - v1 = GetMonPersonalDataAttribute(v8, 10); + v1 = PokemonPersonalData_GetValue(v8, 10); if (v5 == 122) { v1 += v6; } break; case 1: - v1 = GetMonPersonalDataAttribute(v8, 11); + v1 = PokemonPersonalData_GetValue(v8, 11); if (v5 == 117) { v1 += v6; } break; case 2: - v1 = GetMonPersonalDataAttribute(v8, 12); + v1 = PokemonPersonalData_GetValue(v8, 12); if (v5 == 118) { v1 += v6; } break; case 3: - v1 = GetMonPersonalDataAttribute(v8, 13); + v1 = PokemonPersonalData_GetValue(v8, 13); if (v5 == 121) { v1 += v6; } break; case 4: - v1 = GetMonPersonalDataAttribute(v8, 14); + v1 = PokemonPersonalData_GetValue(v8, 14); if (v5 == 119) { v1 += v6; } break; case 5: - v1 = GetMonPersonalDataAttribute(v8, 15); + v1 = PokemonPersonalData_GetValue(v8, 15); if (v5 == 120) { v1 += v6; @@ -8183,7 +8183,7 @@ static void ov16_022499C0 (Party * param0, int param1, int param2, int param3) break; } - if (sub_02077758(param0, GetSingleBitMask(param1))) { + if (sub_02077758(param0, Pokemon_GetFlagMaskOf(param1))) { v1 = v1 * 2; } @@ -8201,10 +8201,10 @@ static void ov16_022499C0 (Party * param0, int param1, int param2, int param3) v2[v0] += v1; v3 += v1; - SetMonData(v7, 13 + v0, (u8 *)&v2[v0]); + Pokemon_SetValue(v7, 13 + v0, (u8 *)&v2[v0]); } - FreeMonPersonalData(v8); + PokemonPersonalData_Free(v8); } static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) @@ -8222,7 +8222,7 @@ static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) v5 = ov16_0223E000(v2->unk_00); v1 = 1; - if (v2->unk_04->battlersSwitchingMask & GetSingleBitMask(v1)) { + if (v2->unk_04->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v1)) { v1 = 3; } @@ -8388,7 +8388,7 @@ static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) sub_02003178(v4, (0x1 | 0x2 | 0x4 | 0x8), 0xffff, 1, 0, 16, 0x0); sub_0200872C(v5, 0, 16, 0, 0x0); v2->unk_28 = 32; - } else if (ov16_0223F9E0(v2->unk_00, GetMonData(v3, MON_DATA_SPECIES, NULL))) { + } else if (ov16_0223F9E0(v2->unk_00, Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL))) { sub_02015738(ov16_0223E220(v2->unk_00), 1); sub_02003178(v4, (0x1 | 0x4), 0xffff, 1, 0, 16, 0x0); sub_0200872C(v5, 0, 16, 0, 0x0); @@ -8540,7 +8540,7 @@ static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) sub_0200F344(1, 0x0); v3 = ov16_0223DFAC(v2->unk_00, v1, v2->unk_04->selectedPartySlot[v1]); - v16 = sub_0208712C(5, 1, GetMonData(v3, MON_DATA_SPECIES, NULL), 10, ov16_0223EDA4(v2->unk_00)); + v16 = sub_0208712C(5, 1, Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL), 10, ov16_0223EDA4(v2->unk_00)); v2->unk_50[1] = v16; if (ov16_0223DF60(v2->unk_00, 0) < 6) { @@ -8549,9 +8549,9 @@ static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) v16->unk_44 = 1174 + ov16_0223F240(v2->unk_00); } - v16->unk_08 = GetMonData(v3, MON_DATA_FORM, NULL); + v16->unk_08 = Pokemon_GetValue(v3, MON_DATA_FORM, NULL); v16->unk_48 = ov16_0223E228(v2->unk_00); - v16->unk_10 = GetMonData(v3, MON_DATA_GENDER, NULL); + v16->unk_10 = Pokemon_GetValue(v3, MON_DATA_GENDER, NULL); v2->unk_50[0] = sub_020067E8(&Unk_020F2DAC, v16, 5); v2->unk_28 = 21; @@ -8586,7 +8586,7 @@ static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) v3 = ov16_0223DFAC(v2->unk_00, v1, v2->unk_04->selectedPartySlot[v1]); if (v19->unk_14 == 0) { - SetMonData(v3, 120, v19->unk_18); + Pokemon_SetValue(v3, 120, v19->unk_18); ov16_0223F24C(v2->unk_00, (1 + 48)); } @@ -8639,15 +8639,15 @@ static void ov16_02249B80 (UnkStruct_0201CD38 * param0, void * param1) sub_02079A94(v24, v26); for (v27 = 0; v27 < 4; v27++) { - v28 = GetMonData(v3, MON_DATA_MOVE1_MAX_PP + v27, NULL); - SetMonData(v3, 58 + v27, &v28); + v28 = Pokemon_GetValue(v3, MON_DATA_MOVE1_MAX_PP + v27, NULL); + Pokemon_SetValue(v3, 58 + v27, &v28); } - if (SetGiratinaForm(v3) != -1) { + if (Pokemon_SetGiratinaForm(v3) != -1) { ov16_0223F9A0(v2->unk_00, v1); } - sub_020798A0(v24, v26, GetBoxMon(v3)); + sub_020798A0(v24, v26, Pokemon_GetBoxPokemon(v3)); if (v2->unk_28 == 22) { if (v25 == v26) { @@ -8815,10 +8815,10 @@ static int ov16_0224A724 (BattleSystem * param0, BattleContext * param1) } if (param1->msgItemTemp == 5) { - v3 = GetMonSpeciesPersonalDataAttribute(param1->battleMons[param1->defender].species, 8); + v3 = PokemonPersonalData_GetSpeciesValue(param1->battleMons[param1->defender].species, 8); v3 = v3 * Unk_ov16_0226E638[param1->safariCatchCount][0] / Unk_ov16_0226E638[param1->safariCatchCount][1]; } else { - v3 = GetMonSpeciesPersonalDataAttribute(param1->battleMons[param1->defender].species, 8); + v3 = PokemonPersonalData_GetSpeciesValue(param1->battleMons[param1->defender].species, 8); } v4 = 10; @@ -9770,10 +9770,10 @@ static void ov16_0224B520 (BattleSystem * param0, UnkStruct_ov16_0224B7CC * para param1->unk_50[0] = sub_02012744(1, 5); - if (GetMonData(param2, MON_DATA_176, NULL) == 0) { + if (Pokemon_GetValue(param2, MON_DATA_176, NULL) == 0) { v13 = 2; } else { - v13 = GetMonData(param2, MON_DATA_GENDER, NULL); + v13 = Pokemon_GetValue(param2, MON_DATA_GENDER, NULL); } if (v13 == 0) { @@ -9784,8 +9784,8 @@ static void ov16_0224B520 (BattleSystem * param0, UnkStruct_ov16_0224B7CC * para v6 = MessageLoader_GetNewStrbuf(v4, 946); } - sub_0200B5CC(v5, 0, GetBoxMon(param2)); - sub_0200B60C(v5, 1, GetMonData(param2, MON_DATA_LEVEL, NULL), 3, 0, 1); + sub_0200B5CC(v5, 0, Pokemon_GetBoxPokemon(param2)); + sub_0200B60C(v5, 1, Pokemon_GetValue(param2, MON_DATA_LEVEL, NULL), 3, 0, 1); sub_0200C388(v5, v7, v6); Strbuf_Free(v6); sub_0201A7A0(&v9); diff --git a/src/overlay016/ov16_0225177C.c b/src/overlay016/ov16_0225177C.c index c044568b06..91a4c770ab 100644 --- a/src/overlay016/ov16_0225177C.c +++ b/src/overlay016/ov16_0225177C.c @@ -191,27 +191,27 @@ void BattleSystem_InitBattleMon (BattleSystem *battleSys, BattleContext *battleC int v2; UnkStruct_02098700 * v3; - battleCtx->battleMons[battler].species = GetMonData(v0, MON_DATA_SPECIES, 0); - battleCtx->battleMons[battler].attack = GetMonData(v0, MON_DATA_ATK, 0); - battleCtx->battleMons[battler].defense = GetMonData(v0, MON_DATA_DEF, 0); - battleCtx->battleMons[battler].speed = GetMonData(v0, MON_DATA_SPEED, 0); - battleCtx->battleMons[battler].spAttack = GetMonData(v0, MON_DATA_SP_ATK, 0); - battleCtx->battleMons[battler].spDefense = GetMonData(v0, MON_DATA_SP_DEF, 0); + battleCtx->battleMons[battler].species = Pokemon_GetValue(v0, MON_DATA_SPECIES, 0); + battleCtx->battleMons[battler].attack = Pokemon_GetValue(v0, MON_DATA_ATK, 0); + battleCtx->battleMons[battler].defense = Pokemon_GetValue(v0, MON_DATA_DEF, 0); + battleCtx->battleMons[battler].speed = Pokemon_GetValue(v0, MON_DATA_SPEED, 0); + battleCtx->battleMons[battler].spAttack = Pokemon_GetValue(v0, MON_DATA_SP_ATK, 0); + battleCtx->battleMons[battler].spDefense = Pokemon_GetValue(v0, MON_DATA_SP_DEF, 0); for (v1 = 0; v1 < 4; v1++) { - battleCtx->battleMons[battler].moves[v1] = GetMonData(v0, MON_DATA_MOVE1 + v1, 0); - battleCtx->battleMons[battler].ppCur[v1] = GetMonData(v0, MON_DATA_MOVE1_CUR_PP + v1, 0); - battleCtx->battleMons[battler].ppUps[v1] = GetMonData(v0, MON_DATA_MOVE1_PP_UPS + v1, 0); + battleCtx->battleMons[battler].moves[v1] = Pokemon_GetValue(v0, MON_DATA_MOVE1 + v1, 0); + battleCtx->battleMons[battler].ppCur[v1] = Pokemon_GetValue(v0, MON_DATA_MOVE1_CUR_PP + v1, 0); + battleCtx->battleMons[battler].ppUps[v1] = Pokemon_GetValue(v0, MON_DATA_MOVE1_PP_UPS + v1, 0); } - battleCtx->battleMons[battler].hpIV = GetMonData(v0, MON_DATA_HP_IV, 0); - battleCtx->battleMons[battler].attackIV = GetMonData(v0, MON_DATA_ATK_IV, 0); - battleCtx->battleMons[battler].defenseIV = GetMonData(v0, MON_DATA_DEF_IV, 0); - battleCtx->battleMons[battler].speedIV = GetMonData(v0, MON_DATA_SPEED_IV, 0); - battleCtx->battleMons[battler].spAttackIV = GetMonData(v0, MON_DATA_SPATK_IV, 0); - battleCtx->battleMons[battler].spDefenseIV = GetMonData(v0, MON_DATA_SPDEF_IV, 0); - battleCtx->battleMons[battler].isEgg = GetMonData(v0, MON_DATA_IS_EGG, 0); - battleCtx->battleMons[battler].hasNickname = GetMonData(v0, MON_DATA_77, 0); + battleCtx->battleMons[battler].hpIV = Pokemon_GetValue(v0, MON_DATA_HP_IV, 0); + battleCtx->battleMons[battler].attackIV = Pokemon_GetValue(v0, MON_DATA_ATK_IV, 0); + battleCtx->battleMons[battler].defenseIV = Pokemon_GetValue(v0, MON_DATA_DEF_IV, 0); + battleCtx->battleMons[battler].speedIV = Pokemon_GetValue(v0, MON_DATA_SPEED_IV, 0); + battleCtx->battleMons[battler].spAttackIV = Pokemon_GetValue(v0, MON_DATA_SPATK_IV, 0); + battleCtx->battleMons[battler].spDefenseIV = Pokemon_GetValue(v0, MON_DATA_SPDEF_IV, 0); + battleCtx->battleMons[battler].isEgg = Pokemon_GetValue(v0, MON_DATA_IS_EGG, 0); + battleCtx->battleMons[battler].hasNickname = Pokemon_GetValue(v0, MON_DATA_77, 0); if ((battleCtx->battleStatusMask & 0x100) == 0) { for (v1 = 0; v1 < 0x8; v1++) { @@ -230,36 +230,36 @@ void BattleSystem_InitBattleMon (BattleSystem *battleSys, BattleContext *battleC battleCtx->battleMons[battler].friskAnnounced = 0; battleCtx->battleMons[battler].moldBreakerAnnounced = 0; battleCtx->battleMons[battler].pressureAnnounced = 0; - battleCtx->battleMons[battler].type1 = GetMonData(v0, MON_DATA_177, 0); - battleCtx->battleMons[battler].type2 = GetMonData(v0, MON_DATA_178, 0); - battleCtx->battleMons[battler].gender = GetMonGender(v0); - battleCtx->battleMons[battler].isShiny = GetMonShininess(v0); + battleCtx->battleMons[battler].type1 = Pokemon_GetValue(v0, MON_DATA_177, 0); + battleCtx->battleMons[battler].type2 = Pokemon_GetValue(v0, MON_DATA_178, 0); + battleCtx->battleMons[battler].gender = Pokemon_GetGender(v0); + battleCtx->battleMons[battler].isShiny = Pokemon_IsShiny(v0); if (BattleSystem_BattleType(battleSys) & (0x20 | 0x200)) { battleCtx->battleMons[battler].ability = 0; battleCtx->battleMons[battler].status = 0; battleCtx->battleMons[battler].heldItem = 0; } else { - battleCtx->battleMons[battler].ability = GetMonData(v0, MON_DATA_ABILITY, 0); - battleCtx->battleMons[battler].status = GetMonData(v0, MON_DATA_160, 0); - battleCtx->battleMons[battler].heldItem = GetMonData(v0, MON_DATA_HELD_ITEM, 0); + battleCtx->battleMons[battler].ability = Pokemon_GetValue(v0, MON_DATA_ABILITY, 0); + battleCtx->battleMons[battler].status = Pokemon_GetValue(v0, MON_DATA_160, 0); + battleCtx->battleMons[battler].heldItem = Pokemon_GetValue(v0, MON_DATA_HELD_ITEM, 0); } if ((BattleSystem_BattleType(battleSys) & (0x20 | 0x200)) && (Battler_Side(battleSys, battler) == 0)) { battleCtx->battleMons[battler].formNum = 0; } else { - battleCtx->battleMons[battler].formNum = GetMonData(v0, MON_DATA_FORM, 0); + battleCtx->battleMons[battler].formNum = Pokemon_GetValue(v0, MON_DATA_FORM, 0); } - battleCtx->battleMons[battler].level = GetMonData(v0, MON_DATA_LEVEL, 0); - battleCtx->battleMons[battler].friendship = GetMonData(v0, MON_DATA_FRIENDSHIP, 0); - battleCtx->battleMons[battler].curHP = GetMonData(v0, MON_DATA_CURRENT_HP, 0); - battleCtx->battleMons[battler].maxHP = GetMonData(v0, MON_DATA_MAX_HP, 0); - battleCtx->battleMons[battler].exp = GetMonData(v0, MON_DATA_EXP, 0); - battleCtx->battleMons[battler].pid = GetMonData(v0, MON_DATA_PERSONALITY, 0); - battleCtx->battleMons[battler].OTId = GetMonData(v0, MON_DATA_OT_ID, 0); - battleCtx->battleMons[battler].OTGender = GetMonData(v0, MON_DATA_OT_GENDER, 0); - battleCtx->battleMons[battler].capturedBall = GetMonData(v0, MON_DATA_POKEBALL, 0); + battleCtx->battleMons[battler].level = Pokemon_GetValue(v0, MON_DATA_LEVEL, 0); + battleCtx->battleMons[battler].friendship = Pokemon_GetValue(v0, MON_DATA_FRIENDSHIP, 0); + battleCtx->battleMons[battler].curHP = Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, 0); + battleCtx->battleMons[battler].maxHP = Pokemon_GetValue(v0, MON_DATA_MAX_HP, 0); + battleCtx->battleMons[battler].exp = Pokemon_GetValue(v0, MON_DATA_EXP, 0); + battleCtx->battleMons[battler].pid = Pokemon_GetValue(v0, MON_DATA_PERSONALITY, 0); + battleCtx->battleMons[battler].OTId = Pokemon_GetValue(v0, MON_DATA_OT_ID, 0); + battleCtx->battleMons[battler].OTGender = Pokemon_GetValue(v0, MON_DATA_OT_GENDER, 0); + battleCtx->battleMons[battler].capturedBall = Pokemon_GetValue(v0, MON_DATA_POKEBALL, 0); sub_02098988(battleCtx->battleMons[battler].formNum); v3 = sub_02098700(5); @@ -269,15 +269,15 @@ void BattleSystem_InitBattleMon (BattleSystem *battleSys, BattleContext *battleC sub_020987BC(v3); sub_02098718(v3); - GetMonData(v0, MON_DATA_117, &battleCtx->battleMons[battler].nickname[0]); - GetMonData(v0, MON_DATA_144, &battleCtx->battleMons[battler].OTName[0]); + Pokemon_GetValue(v0, MON_DATA_117, &battleCtx->battleMons[battler].nickname[0]); + Pokemon_GetValue(v0, MON_DATA_144, &battleCtx->battleMons[battler].OTName[0]); battleCtx->battleMons[battler].timesDamaged = 0; battleCtx->battleMons[battler].trainerMessageFlags = 0; v2 = Battler_Side(battleSys, battler); - if (battleCtx->sideConditions[v2].knockedOffItemsMask & GetSingleBitMask(battleCtx->selectedPartySlot[battler])) { + if (battleCtx->sideConditions[v2].knockedOffItemsMask & Pokemon_GetFlagMaskOf(battleCtx->selectedPartySlot[battler])) { battleCtx->battleMons[battler].heldItem = 0; battleCtx->battleMons[battler].moveEffectsData.canUnburden = 0; } else { @@ -293,26 +293,26 @@ void ov16_02251C94 (BattleSystem * param0, BattleContext * param1, int param2, i int v1; int v2; - param1->battleMons[param2].attack = GetMonData(v0, MON_DATA_ATK, 0); - param1->battleMons[param2].defense = GetMonData(v0, MON_DATA_DEF, 0); - param1->battleMons[param2].speed = GetMonData(v0, MON_DATA_SPEED, 0); - param1->battleMons[param2].spAttack = GetMonData(v0, MON_DATA_SP_ATK, 0); - param1->battleMons[param2].spDefense = GetMonData(v0, MON_DATA_SP_DEF, 0); - param1->battleMons[param2].level = GetMonData(v0, MON_DATA_LEVEL, 0); - param1->battleMons[param2].friendship = GetMonData(v0, MON_DATA_FRIENDSHIP, 0); - param1->battleMons[param2].curHP = GetMonData(v0, MON_DATA_CURRENT_HP, 0); - param1->battleMons[param2].maxHP = GetMonData(v0, MON_DATA_MAX_HP, 0); + param1->battleMons[param2].attack = Pokemon_GetValue(v0, MON_DATA_ATK, 0); + param1->battleMons[param2].defense = Pokemon_GetValue(v0, MON_DATA_DEF, 0); + param1->battleMons[param2].speed = Pokemon_GetValue(v0, MON_DATA_SPEED, 0); + param1->battleMons[param2].spAttack = Pokemon_GetValue(v0, MON_DATA_SP_ATK, 0); + param1->battleMons[param2].spDefense = Pokemon_GetValue(v0, MON_DATA_SP_DEF, 0); + param1->battleMons[param2].level = Pokemon_GetValue(v0, MON_DATA_LEVEL, 0); + param1->battleMons[param2].friendship = Pokemon_GetValue(v0, MON_DATA_FRIENDSHIP, 0); + param1->battleMons[param2].curHP = Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, 0); + param1->battleMons[param2].maxHP = Pokemon_GetValue(v0, MON_DATA_MAX_HP, 0); if ((param1->battleMons[param2].statusVolatile & 0x200000) == 0) { for (v1 = 0; v1 < 4; v1++) { - if ((param1->battleMons[param2].moveEffectsData.mimickedMoveSlot & GetSingleBitMask(v1)) == 0) { - param1->battleMons[param2].moves[v1] = GetMonData(v0, MON_DATA_MOVE1 + v1, 0); - param1->battleMons[param2].ppCur[v1] = GetMonData(v0, MON_DATA_MOVE1_CUR_PP + v1, 0); - param1->battleMons[param2].ppUps[v1] = GetMonData(v0, MON_DATA_MOVE1_PP_UPS + v1, 0); + if ((param1->battleMons[param2].moveEffectsData.mimickedMoveSlot & Pokemon_GetFlagMaskOf(v1)) == 0) { + param1->battleMons[param2].moves[v1] = Pokemon_GetValue(v0, MON_DATA_MOVE1 + v1, 0); + param1->battleMons[param2].ppCur[v1] = Pokemon_GetValue(v0, MON_DATA_MOVE1_CUR_PP + v1, 0); + param1->battleMons[param2].ppUps[v1] = Pokemon_GetValue(v0, MON_DATA_MOVE1_PP_UPS + v1, 0); } } - param1->battleMons[param2].exp = GetMonData(v0, MON_DATA_EXP, 0); + param1->battleMons[param2].exp = Pokemon_GetValue(v0, MON_DATA_EXP, 0); } } @@ -1499,8 +1499,8 @@ void ov16_022535F0 (BattleSystem * param0, BattleContext * param1, int param2) v1 = BattleSystem_BattleType(param0); while (v0 <= 2) { - if (((param1->battlersSwitchingMask & GetSingleBitMask(v0)) == 0) && ((param1->battlersSwitchingMask & GetSingleBitMask(param2)) == 0) && (param1->battleMons[param2].curHP)) { - param1->monsGainingExp[(param2 >> 1) & 1] |= GetSingleBitMask(param1->selectedPartySlot[v0]); + if (((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(v0)) == 0) && ((param1->battlersSwitchingMask & Pokemon_GetFlagMaskOf(param2)) == 0) && (param1->battleMons[param2].curHP)) { + param1->monsGainingExp[(param2 >> 1) & 1] |= Pokemon_GetFlagMaskOf(param1->selectedPartySlot[v0]); } v0 += 2; @@ -1972,7 +1972,7 @@ BOOL BattleSystem_CheckTrainerMessage (BattleSystem * param0, BattleContext * pa for (v3 = 0; v3 < Party_GetCurrentCount(v5); v3++) { v6 = Party_GetPokemonBySlotIndex(v5, v3); - if (GetMonData(v6, MON_DATA_CURRENT_HP, NULL)) { + if (Pokemon_GetValue(v6, MON_DATA_CURRENT_HP, NULL)) { v4++; } } @@ -2003,7 +2003,7 @@ BOOL BattleSystem_CheckTrainerMessage (BattleSystem * param0, BattleContext * pa for (v7 = 0; v7 < Party_GetCurrentCount(v9); v7++) { v10 = Party_GetPokemonBySlotIndex(v9, v7); - if (GetMonData(v10, MON_DATA_CURRENT_HP, NULL)) { + if (Pokemon_GetValue(v10, MON_DATA_CURRENT_HP, NULL)) { v8++; } } @@ -2092,8 +2092,8 @@ void BattleContext_InitCounters (BattleSystem * param0, BattleContext * param1) v0 = BattleSystem_BattleType(param0); if ((v0 & 0x2) == 0) { - param1->battlersSwitchingMask |= GetSingleBitMask(2); - param1->battlersSwitchingMask |= GetSingleBitMask(3); + param1->battlersSwitchingMask |= Pokemon_GetFlagMaskOf(2); + param1->battlersSwitchingMask |= Pokemon_GetFlagMaskOf(3); } param1->safariCatchCount = 6; @@ -2141,8 +2141,8 @@ void ov16_0225433C (BattleSystem * param0, BattleContext * param1, int param2) } for (v0 = 0; v0 < v1; v0++) { - if (param1->battleMons[v0].statusVolatile & (GetSingleBitMask(param2) << 16)) { - param1->battleMons[v0].statusVolatile &= ((GetSingleBitMask(param2) << 16) ^ 0xffffffff); + if (param1->battleMons[v0].statusVolatile & (Pokemon_GetFlagMaskOf(param2) << 16)) { + param1->battleMons[v0].statusVolatile &= ((Pokemon_GetFlagMaskOf(param2) << 16) ^ 0xffffffff); } if ((param1->battleMons[v0].statusVolatile & 0xe000) && (param1->battleMons[v0].moveEffectsData.bindTarget == param2)) { @@ -2184,7 +2184,7 @@ void ov16_0225433C (BattleSystem * param0, BattleContext * param1, int param2) param1->conversion2Battler[param2] = 0; param1->conversion2Type[param2] = 0; param1->metronomeMove[param2] = 0; - param1->fieldConditionsMask &= ((GetSingleBitMask(param2) << 8) ^ 0xffffffff); + param1->fieldConditionsMask &= ((Pokemon_GetFlagMaskOf(param2) << 8) ^ 0xffffffff); if (param1->battleMons[param2].moveEffectsMask & 0x800000) { v0 = param1->battleMons[param2].attack; @@ -2226,8 +2226,8 @@ void ov16_02254744 (BattleSystem * param0, BattleContext * param1, int param2) param1->battleMons[v0].statusVolatile &= (0x4000000 ^ 0xffffffff); } - if (param1->battleMons[v0].statusVolatile & (GetSingleBitMask(param2) << 16)) { - param1->battleMons[v0].statusVolatile &= ((GetSingleBitMask(param2) << 16) ^ 0xffffffff); + if (param1->battleMons[v0].statusVolatile & (Pokemon_GetFlagMaskOf(param2) << 16)) { + param1->battleMons[v0].statusVolatile &= ((Pokemon_GetFlagMaskOf(param2) << 16) ^ 0xffffffff); } if ((param1->battleMons[v0].statusVolatile & 0xe000) && (param1->battleMons[v0].moveEffectsData.bindTarget == param2)) { @@ -2265,7 +2265,7 @@ void ov16_02254744 (BattleSystem * param0, BattleContext * param1, int param2) param1->conversion2Battler[param2] = 0; param1->conversion2Type[param2] = 0; param1->metronomeMove[param2] = 0; - param1->fieldConditionsMask &= ((GetSingleBitMask(param2) << 8) ^ 0xffffffff); + param1->fieldConditionsMask &= ((Pokemon_GetFlagMaskOf(param2) << 8) ^ 0xffffffff); for (v0 = 0; v0 < v1; v0++) { if ((v0 != param2) && (Battler_Side(param0, v0) != Battler_Side(param0, param2))) { @@ -2318,39 +2318,39 @@ int BattleSystem_CheckStruggling (BattleSystem *battleSys, BattleContext *battle for (v0 = 0; v0 < 4; v0++) { if ((battleCtx->battleMons[battler].moves[v0] == 0) && (struggleChecksMask & 0x1)) { - moveFlags |= GetSingleBitMask(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } if ((battleCtx->battleMons[battler].ppCur[v0] == 0) && (struggleChecksMask & 0x2)) { - moveFlags |= GetSingleBitMask(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } if ((battleCtx->battleMons[battler].moves[v0] == battleCtx->battleMons[battler].moveEffectsData.disabledMove) && (struggleChecksMask & 0x4)) { - moveFlags |= GetSingleBitMask(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } if ((battleCtx->battleMons[battler].moves[v0] == battleCtx->movePrevByBattler[battler]) && (struggleChecksMask & 0x8) && (battleCtx->battleMons[battler].statusVolatile & 0x80000000)) { - moveFlags |= GetSingleBitMask(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } if ((battleCtx->battleMons[battler].moveEffectsData.tauntedTurns) && (struggleChecksMask & 0x10) && (battleCtx->aiContext.moveTable[battleCtx->battleMons[battler].moves[v0]].power == 0)) { - moveFlags |= GetSingleBitMask(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } if ((ov16_02255EF4(battleSys, battleCtx, battler, battleCtx->battleMons[battler].moves[v0])) && (struggleChecksMask & 0x20)) { - moveFlags |= GetSingleBitMask(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } if ((ov16_02256044(battleSys, battleCtx, battler, battleCtx->battleMons[battler].moves[v0])) && (struggleChecksMask & 0x40)) { - moveFlags |= GetSingleBitMask(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } if ((ov16_02256078(battleSys, battleCtx, battler, battleCtx->battleMons[battler].moves[v0])) && (struggleChecksMask & 0x80)) { - moveFlags |= GetSingleBitMask(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } if ((battleCtx->battleMons[battler].moveEffectsData.encoredMove) && (battleCtx->battleMons[battler].moveEffectsData.encoredMove != battleCtx->battleMons[battler].moves[v0])) { - moveFlags |= GetSingleBitMask(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } if (((v1 == 55) || (v1 == 115) || (v1 == 125)) && (struggleChecksMask & 0x200)) { @@ -2358,7 +2358,7 @@ int BattleSystem_CheckStruggling (BattleSystem *battleSys, BattleContext *battle battleCtx->battleMons[battler].moveEffectsData.choiceLockedMove = 0; } else { if ((battleCtx->battleMons[battler].moveEffectsData.choiceLockedMove) && (battleCtx->battleMons[battler].moveEffectsData.choiceLockedMove != battleCtx->battleMons[battler].moves[v0])) { - moveFlags |= GetSingleBitMask(v0); + moveFlags |= Pokemon_GetFlagMaskOf(v0); } } } @@ -2371,49 +2371,49 @@ BOOL BattleSystem_CanUseMove (BattleSystem *battleSys, BattleContext *battleCtx, { BOOL result = TRUE; - if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x4) & GetSingleBitMask(moveSlot)) { + if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x4) & Pokemon_GetFlagMaskOf(moveSlot)) { msgOut->tags = 10; msgOut->id = 609; msgOut->params[0] = BattleSystem_NicknameTag(battleCtx, battler); msgOut->params[1] = battleCtx->battleMons[battler].moves[moveSlot]; result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x8) & GetSingleBitMask(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x8) & Pokemon_GetFlagMaskOf(moveSlot)) { msgOut->tags = 2; msgOut->id = 612; msgOut->params[0] = BattleSystem_NicknameTag(battleCtx, battler); result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x10) & GetSingleBitMask(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x10) & Pokemon_GetFlagMaskOf(moveSlot)) { msgOut->tags = 10; msgOut->id = 613; msgOut->params[0] = BattleSystem_NicknameTag(battleCtx, battler); msgOut->params[1] = battleCtx->battleMons[battler].moves[moveSlot]; result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x20) & GetSingleBitMask(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x20) & Pokemon_GetFlagMaskOf(moveSlot)) { msgOut->tags = 10; msgOut->id = 616; msgOut->params[0] = BattleSystem_NicknameTag(battleCtx, battler); msgOut->params[1] = battleCtx->battleMons[battler].moves[moveSlot]; result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x40) & GetSingleBitMask(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x40) & Pokemon_GetFlagMaskOf(moveSlot)) { msgOut->tags = 10; msgOut->id = 1001; msgOut->params[0] = BattleSystem_NicknameTag(battleCtx, battler); msgOut->params[1] = battleCtx->battleMons[battler].moves[moveSlot]; result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x80) & GetSingleBitMask(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x80) & Pokemon_GetFlagMaskOf(moveSlot)) { msgOut->tags = 34; msgOut->id = 1057; msgOut->params[0] = BattleSystem_NicknameTag(battleCtx, battler); msgOut->params[1] = 377; msgOut->params[2] = battleCtx->battleMons[battler].moves[moveSlot]; result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x200) & GetSingleBitMask(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x200) & Pokemon_GetFlagMaskOf(moveSlot)) { msgOut->tags = 24; msgOut->id = 911; msgOut->params[0] = battleCtx->battleMons[battler].heldItem; msgOut->params[1] = battleCtx->battleMons[battler].moveEffectsData.choiceLockedMove; result = FALSE; - } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x2) & GetSingleBitMask(moveSlot)) { + } else if (BattleSystem_CheckStruggling(battleSys, battleCtx, battler, 0, 0x2) & Pokemon_GetFlagMaskOf(moveSlot)) { msgOut->tags = 0; msgOut->id = 823; result = FALSE; @@ -2898,7 +2898,7 @@ int BattleSystem_CountAbility (BattleSystem * param0, BattleContext * param1, in case 4: for (v1 = 0; v1 < v2; v1++) { if ((Battler_Side(param0, v1) != Battler_Side(param0, param3)) && (param1->battleMons[v1].curHP) && (Battler_Ability(param1, v1) == param4)) { - v0 |= GetSingleBitMask(v1); + v0 |= Pokemon_GetFlagMaskOf(v1); } } break; @@ -3028,7 +3028,7 @@ BOOL ov16_02255980 (BattleSystem * param0, BattleContext * param1, int param2) v0 = 0; v1 = Battler_Side(param0, param2); - if ((param1->battleMons[param2].heldItem) && ((param1->sideConditions[v1].knockedOffItemsMask & GetSingleBitMask(param1->selectedPartySlot[param2])) == 0) && (Item_IsMail(param1->battleMons[param2].heldItem) == 0)) { + if ((param1->battleMons[param2].heldItem) && ((param1->sideConditions[v1].knockedOffItemsMask & Pokemon_GetFlagMaskOf(param1->selectedPartySlot[param2])) == 0) && (Item_IsMail(param1->battleMons[param2].heldItem) == 0)) { v0 = 1; } @@ -3137,7 +3137,7 @@ BOOL ov16_02255B10 (BattleSystem * param0, BattleContext * param1, int param2) for (v6 = v7; v6 < v8; v6++) { v2 = Party_GetPokemonBySlotIndex(v1, v6); - if ((GetMonData(v2, MON_DATA_SPECIES, NULL)) && (GetMonData(v2, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v2, MON_DATA_CURRENT_HP, NULL)) && (v10 != v6) && (v11 != v6)) { + if ((Pokemon_GetValue(v2, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v2, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v2, MON_DATA_CURRENT_HP, NULL)) && (v10 != v6) && (v11 != v6)) { v4++; } } @@ -4534,7 +4534,7 @@ BOOL BattleSystem_TriggerHeldItem (BattleSystem * param0, BattleContext * param1 param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 0; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 0) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 0) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -4548,7 +4548,7 @@ BOOL BattleSystem_TriggerHeldItem (BattleSystem * param0, BattleContext * param1 param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 1; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 1) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 1) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -4562,7 +4562,7 @@ BOOL BattleSystem_TriggerHeldItem (BattleSystem * param0, BattleContext * param1 param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 2; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 2) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 2) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -4576,7 +4576,7 @@ BOOL BattleSystem_TriggerHeldItem (BattleSystem * param0, BattleContext * param1 param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 3; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 3) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 3) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -4590,7 +4590,7 @@ BOOL BattleSystem_TriggerHeldItem (BattleSystem * param0, BattleContext * param1 param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 4; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 4) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 4) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -4943,7 +4943,7 @@ BOOL BattleSystem_TriggerHeldItemOnStatus (BattleSystem * param0, BattleContext param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 0; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 0) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 0) == -1) { param3[0] = (0 + 207); } else { param3[0] = (0 + 198); @@ -4957,7 +4957,7 @@ BOOL BattleSystem_TriggerHeldItemOnStatus (BattleSystem * param0, BattleContext param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 1; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 1) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 1) == -1) { param3[0] = (0 + 207); } else { param3[0] = (0 + 198); @@ -4971,7 +4971,7 @@ BOOL BattleSystem_TriggerHeldItemOnStatus (BattleSystem * param0, BattleContext param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 2; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 2) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 2) == -1) { param3[0] = (0 + 207); } else { param3[0] = (0 + 198); @@ -4985,7 +4985,7 @@ BOOL BattleSystem_TriggerHeldItemOnStatus (BattleSystem * param0, BattleContext param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 3; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 3) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 3) == -1) { param3[0] = (0 + 207); } else { param3[0] = (0 + 198); @@ -4999,7 +4999,7 @@ BOOL BattleSystem_TriggerHeldItemOnStatus (BattleSystem * param0, BattleContext param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param2].maxHP, v3); param1->msgTemp = 4; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param2].pid, 4) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param2].pid, 4) == -1) { param3[0] = (0 + 207); } else { param3[0] = (0 + 198); @@ -5203,7 +5203,7 @@ BOOL ov16_022588BC (BattleSystem * param0, BattleContext * param1, int * param2) switch (v2) { case 116: - if ((param1->battleMons[param1->attacker].curHP) && (param1->battleMons[param1->attacker].heldItem == 0) && ((param1->sideConditions[v4].knockedOffItemsMask & GetSingleBitMask(param1->selectedPartySlot[param1->attacker])) == 0) && (param1->moveCur != 282) && ((param1->selfTurnFlags[param1->defender].physicalDamageTaken) || (param1->selfTurnFlags[param1->defender].specialDamageTaken)) && ((param1->battleStatusMask2 & 0x10) == 0) && (param1->aiContext.moveTable[param1->moveCur].flags & 0x1)) { + if ((param1->battleMons[param1->attacker].curHP) && (param1->battleMons[param1->attacker].heldItem == 0) && ((param1->sideConditions[v4].knockedOffItemsMask & Pokemon_GetFlagMaskOf(param1->selectedPartySlot[param1->attacker])) == 0) && (param1->moveCur != 282) && ((param1->selfTurnFlags[param1->defender].physicalDamageTaken) || (param1->selfTurnFlags[param1->defender].specialDamageTaken)) && ((param1->battleStatusMask2 & 0x10) == 0) && (param1->aiContext.moveTable[param1->moveCur].flags & 0x1)) { param2[0] = (0 + 216); v0 = 1; } @@ -5476,7 +5476,7 @@ BOOL ov16_02258CB4 (BattleSystem * param0, BattleContext * param1, int param2) param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param1->attacker].maxHP, v3); param1->msgTemp = 0; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->attacker].pid, 0) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->attacker].pid, 0) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -5490,7 +5490,7 @@ BOOL ov16_02258CB4 (BattleSystem * param0, BattleContext * param1, int param2) param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param1->attacker].maxHP, v3); param1->msgTemp = 1; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->attacker].pid, 1) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->attacker].pid, 1) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -5504,7 +5504,7 @@ BOOL ov16_02258CB4 (BattleSystem * param0, BattleContext * param1, int param2) param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param1->attacker].maxHP, v3); param1->msgTemp = 2; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->attacker].pid, 2) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->attacker].pid, 2) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -5518,7 +5518,7 @@ BOOL ov16_02258CB4 (BattleSystem * param0, BattleContext * param1, int param2) param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param1->attacker].maxHP, v3); param1->msgTemp = 3; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->attacker].pid, 3) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->attacker].pid, 3) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -5532,7 +5532,7 @@ BOOL ov16_02258CB4 (BattleSystem * param0, BattleContext * param1, int param2) param1->hpCalcTemp = BattleSystem_Divide(param1->battleMons[param1->attacker].maxHP, v3); param1->msgTemp = 4; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->attacker].pid, 4) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->attacker].pid, 4) == -1) { v1 = (0 + 207); } else { v1 = (0 + 198); @@ -5755,7 +5755,7 @@ BOOL ov16_02259204 (BattleSystem * param0, BattleContext * param1, int param2) param1->flingTemp = BattleSystem_Divide(param1->battleMons[param1->defender].maxHP, v2); param1->msgTemp = 0; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->defender].pid, 0) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->defender].pid, 0) == -1) { param1->flingScript = (0 + 207); } else { param1->flingScript = (0 + 198); @@ -5765,7 +5765,7 @@ BOOL ov16_02259204 (BattleSystem * param0, BattleContext * param1, int param2) param1->flingTemp = BattleSystem_Divide(param1->battleMons[param1->defender].maxHP, v2); param1->msgTemp = 1; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->defender].pid, 1) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->defender].pid, 1) == -1) { param1->flingScript = (0 + 207); } else { param1->flingScript = (0 + 198); @@ -5775,7 +5775,7 @@ BOOL ov16_02259204 (BattleSystem * param0, BattleContext * param1, int param2) param1->flingTemp = BattleSystem_Divide(param1->battleMons[param1->defender].maxHP, v2); param1->msgTemp = 2; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->defender].pid, 2) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->defender].pid, 2) == -1) { param1->flingScript = (0 + 207); } else { param1->flingScript = (0 + 198); @@ -5785,7 +5785,7 @@ BOOL ov16_02259204 (BattleSystem * param0, BattleContext * param1, int param2) param1->flingTemp = BattleSystem_Divide(param1->battleMons[param1->defender].maxHP, v2); param1->msgTemp = 3; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->defender].pid, 3) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->defender].pid, 3) == -1) { param1->flingScript = (0 + 207); } else { param1->flingScript = (0 + 198); @@ -5795,7 +5795,7 @@ BOOL ov16_02259204 (BattleSystem * param0, BattleContext * param1, int param2) param1->flingTemp = BattleSystem_Divide(param1->battleMons[param1->defender].maxHP, v2); param1->msgTemp = 4; - if (GetMonPersonalityFlavorAffinity(param1->battleMons[param1->defender].pid, 4) == -1) { + if (Pokemon_GetFlavorAffinityOf(param1->battleMons[param1->defender].pid, 4) == -1) { param1->flingScript = (0 + 207); } else { param1->flingScript = (0 + 198); @@ -6007,7 +6007,7 @@ void ov16_02259A5C (BattleSystem * param0, BattleContext * param1, Pokemon * par v2 = ov16_0223E22C(param0); if (BattleSystem_BattleType(param0) & 0x200) { - v3 = GetMonData(param2, MON_DATA_POKEBALL, NULL); + v3 = Pokemon_GetValue(param2, MON_DATA_POKEBALL, NULL); } else { v3 = param1->msgItemTemp; } @@ -6063,9 +6063,9 @@ BOOL ov16_02259B38 (BattleSystem * param0, Pokemon * param1) v2 = sub_02025F30(v0); v3 = sub_02025EF0(v0); - GetMonData(param1, MON_DATA_144, &v4[0]); + Pokemon_GetValue(param1, MON_DATA_144, &v4[0]); - if ((v1 == GetMonData(param1, MON_DATA_OT_ID, NULL)) && (v2 == GetMonData(param1, MON_DATA_OT_GENDER, NULL)) && (sub_02002238(v3, &v4[0], 7) == 0)) { + if ((v1 == Pokemon_GetValue(param1, MON_DATA_OT_ID, NULL)) && (v2 == Pokemon_GetValue(param1, MON_DATA_OT_GENDER, NULL)) && (sub_02002238(v3, &v4[0], 7) == 0)) { return 1; } @@ -6158,7 +6158,7 @@ BOOL ov16_02259B9C (BattleSystem * param0, BattleContext * param1, int * param2) } if ((param1->battleMons[param1->msgBattlerTemp].species == 493) && (param1->battleMons[param1->msgBattlerTemp].curHP) && (Battler_Ability(param1, param1->msgBattlerTemp) == 121)) { - v1 = GetArceusItemType(Item_LoadParam(param1->battleMons[param1->msgBattlerTemp].heldItem, 1, 5)); + v1 = Pokemon_GetArceusTypeOf(Item_LoadParam(param1->battleMons[param1->msgBattlerTemp].heldItem, 1, 5)); if (param1->battleMons[param1->msgBattlerTemp].formNum != v1) { param1->battleMons[param1->msgBattlerTemp].formNum = v1; @@ -6175,7 +6175,7 @@ BOOL ov16_02259B9C (BattleSystem * param0, BattleContext * param1, int * param2) int v4; int v5; - v3 = AllocMonZeroed(5); + v3 = Pokemon_New(5); if (BattleSystem_BattleType(param0) & 0x2) { v4 = param1->battlerActions[param1->msgBattlerTemp][1]; @@ -6183,21 +6183,21 @@ BOOL ov16_02259B9C (BattleSystem * param0, BattleContext * param1, int * param2) v4 = param1->msgBattlerTemp ^ 1; } - sub_020775EC(ov16_0223DFAC(param0, v4, param1->selectedPartySlot[v4]), v3); + Pokemon_Copy(ov16_0223DFAC(param0, v4, param1->selectedPartySlot[v4]), v3); v5 = 0; - SetMonData(v3, 6, &v5); + Pokemon_SetValue(v3, 6, &v5); v5 = 0; - SetMonData(v3, 112, &v5); - SetGiratinaForm(v3); + Pokemon_SetValue(v3, 112, &v5); + Pokemon_SetGiratinaForm(v3); - param1->battleMons[param1->msgBattlerTemp].attack = GetMonData(v3, MON_DATA_ATK, 0); - param1->battleMons[param1->msgBattlerTemp].defense = GetMonData(v3, MON_DATA_DEF, 0); - param1->battleMons[param1->msgBattlerTemp].speed = GetMonData(v3, MON_DATA_SPEED, 0); - param1->battleMons[param1->msgBattlerTemp].spAttack = GetMonData(v3, MON_DATA_SP_ATK, 0); - param1->battleMons[param1->msgBattlerTemp].spDefense = GetMonData(v3, MON_DATA_SP_DEF, 0); - param1->battleMons[param1->msgBattlerTemp].ability = GetMonData(v3, MON_DATA_ABILITY, 0); + param1->battleMons[param1->msgBattlerTemp].attack = Pokemon_GetValue(v3, MON_DATA_ATK, 0); + param1->battleMons[param1->msgBattlerTemp].defense = Pokemon_GetValue(v3, MON_DATA_DEF, 0); + param1->battleMons[param1->msgBattlerTemp].speed = Pokemon_GetValue(v3, MON_DATA_SPEED, 0); + param1->battleMons[param1->msgBattlerTemp].spAttack = Pokemon_GetValue(v3, MON_DATA_SP_ATK, 0); + param1->battleMons[param1->msgBattlerTemp].spDefense = Pokemon_GetValue(v3, MON_DATA_SP_DEF, 0); + param1->battleMons[param1->msgBattlerTemp].ability = Pokemon_GetValue(v3, MON_DATA_ABILITY, 0); param1->battleMons[param1->msgBattlerTemp].formNum = 0; param1->battleStatusMask2 |= 0x4000000; @@ -7082,7 +7082,7 @@ BOOL ov16_0225B228 (BattleSystem * param0, BattleContext * param1, int * param2) v0 = 1; } - if ((v4 == 116) && (param1->battleMons[param1->attacker].curHP) && (param1->battleMons[param1->attacker].heldItem == 0) && ((param1->sideConditions[v6].knockedOffItemsMask & GetSingleBitMask(param1->selectedPartySlot[param1->attacker])) == 0) && ((param1->selfTurnFlags[param1->defender].physicalDamageTaken) || (param1->selfTurnFlags[param1->defender].specialDamageTaken)) && (param1->aiContext.moveTable[param1->moveCur].flags & 0x1)) { + if ((v4 == 116) && (param1->battleMons[param1->attacker].curHP) && (param1->battleMons[param1->attacker].heldItem == 0) && ((param1->sideConditions[v6].knockedOffItemsMask & Pokemon_GetFlagMaskOf(param1->selectedPartySlot[param1->attacker])) == 0) && ((param1->selfTurnFlags[param1->defender].physicalDamageTaken) || (param1->selfTurnFlags[param1->defender].specialDamageTaken)) && (param1->aiContext.moveTable[param1->moveCur].flags & 0x1)) { param2[0] = (0 + 216); v0 = 1; } @@ -7692,13 +7692,13 @@ int ov16_0225BA88 (BattleSystem * param0, int param1) for (v0 = v17; v0 < v18; v0++) { v19 = ov16_0223DFAC(param0, param1, v0); - v7 = GetMonData(v19, MON_DATA_SPECIES_EGG, NULL); + v7 = Pokemon_GetValue(v19, MON_DATA_SPECIES_EGG, NULL); - if ((v7 != 0) && (v7 != 494) && (GetMonData(v19, MON_DATA_CURRENT_HP, NULL)) && ((v10 & GetSingleBitMask(v0)) == 0) && (v20->selectedPartySlot[v14] != v0) && (v20->selectedPartySlot[v15] != v0) && (v0 != v20->aiSwitchedPartySlot[v14]) && (v0 != v20->aiSwitchedPartySlot[v15])) { + if ((v7 != 0) && (v7 != 494) && (Pokemon_GetValue(v19, MON_DATA_CURRENT_HP, NULL)) && ((v10 & Pokemon_GetFlagMaskOf(v0)) == 0) && (v20->selectedPartySlot[v14] != v0) && (v20->selectedPartySlot[v15] != v0) && (v0 != v20->aiSwitchedPartySlot[v14]) && (v0 != v20->aiSwitchedPartySlot[v15])) { v3 = ov16_02252060(v20, v2, 27, NULL); v4 = ov16_02252060(v20, v2, 28, NULL); - v5 = GetMonData(v19, MON_DATA_177, NULL); - v6 = GetMonData(v19, MON_DATA_178, NULL); + v5 = Pokemon_GetValue(v19, MON_DATA_177, NULL); + v6 = Pokemon_GetValue(v19, MON_DATA_178, NULL); v11 = ov16_022558CC(v5, v3, v4); v11 += ov16_022558CC(v6, v3, v4); @@ -7707,7 +7707,7 @@ int ov16_0225BA88 (BattleSystem * param0, int param1) v13 = v0; } } else { - v10 |= GetSingleBitMask(v0); + v10 |= Pokemon_GetFlagMaskOf(v0); } } @@ -7715,12 +7715,12 @@ int ov16_0225BA88 (BattleSystem * param0, int param1) v19 = ov16_0223DFAC(param0, param1, v13); for (v0 = 0; v0 < 4; v0++) { - v8 = GetMonData(v19, MON_DATA_MOVE1 + v0, NULL); + v8 = Pokemon_GetValue(v19, MON_DATA_MOVE1 + v0, NULL); v9 = ov16_0225BE3C(param0, v20, v19, v8); if (v8) { v16 = 0; - ov16_022552D4(v20, v8, v9, GetMonData(v19, MON_DATA_ABILITY, NULL), Battler_Ability(v20, v2), ov16_02258AB8(v20, v2), ov16_02252060(v20, v2, 27, NULL), ov16_02252060(v20, v2, 28, NULL), &v16); + ov16_022552D4(v20, v8, v9, Pokemon_GetValue(v19, MON_DATA_ABILITY, NULL), Battler_Ability(v20, v2), ov16_02258AB8(v20, v2), ov16_02252060(v20, v2, 27, NULL), ov16_02252060(v20, v2, 28, NULL), &v16); if (v16 & 0x2) { break; @@ -7729,7 +7729,7 @@ int ov16_0225BA88 (BattleSystem * param0, int param1) } if (v0 == 4) { - v10 |= GetSingleBitMask(v13); + v10 |= Pokemon_GetFlagMaskOf(v13); } else { return v13; } @@ -7743,11 +7743,11 @@ int ov16_0225BA88 (BattleSystem * param0, int param1) for (v0 = v17; v0 < v18; v0++) { v19 = ov16_0223DFAC(param0, param1, v0); - v7 = GetMonData(v19, MON_DATA_SPECIES_EGG, NULL); + v7 = Pokemon_GetValue(v19, MON_DATA_SPECIES_EGG, NULL); - if ((v7 != 0) && (v7 != 494) && (GetMonData(v19, MON_DATA_CURRENT_HP, NULL)) && (v20->selectedPartySlot[v14] != v0) && (v20->selectedPartySlot[v15] != v0) && (v0 != v20->aiSwitchedPartySlot[v14]) && (v0 != v20->aiSwitchedPartySlot[v15])) { + if ((v7 != 0) && (v7 != 494) && (Pokemon_GetValue(v19, MON_DATA_CURRENT_HP, NULL)) && (v20->selectedPartySlot[v14] != v0) && (v20->selectedPartySlot[v15] != v0) && (v0 != v20->aiSwitchedPartySlot[v14]) && (v0 != v20->aiSwitchedPartySlot[v15])) { for (v1 = 0; v1 < 4; v1++) { - v8 = GetMonData(v19, MON_DATA_MOVE1 + v1, NULL); + v8 = Pokemon_GetValue(v19, MON_DATA_MOVE1 + v1, NULL); v9 = ov16_0225BE3C(param0, v20, v19, v8); if ((v8) && (v20->aiContext.moveTable[v8].power != 1)) { @@ -7785,10 +7785,10 @@ int ov16_0225BE3C (BattleSystem * param0, BattleContext * param1, Pokemon * para switch (param3) { case 363: - v0 = ov16_0225B0FC(param1, GetMonData(param2, MON_DATA_HELD_ITEM, NULL), 12); + v0 = ov16_0225B0FC(param1, Pokemon_GetValue(param2, MON_DATA_HELD_ITEM, NULL), 12); break; case 449: - switch (ov16_0225B0FC(param1, GetMonData(param2, MON_DATA_HELD_ITEM, NULL), 1)) { + switch (ov16_0225B0FC(param1, Pokemon_GetValue(param2, MON_DATA_HELD_ITEM, NULL), 1)) { case 131: v0 = 1; break; @@ -7843,7 +7843,7 @@ int ov16_0225BE3C (BattleSystem * param0, BattleContext * param1, Pokemon * para } break; case 237: - v0 = ((GetMonData(param2, MON_DATA_HP_IV, NULL) & 1) >> 0) | ((GetMonData(param2, MON_DATA_ATK_IV, NULL) & 1) << 1) | ((GetMonData(param2, MON_DATA_DEF_IV, NULL) & 1) << 2) | ((GetMonData(param2, MON_DATA_SPEED_IV, NULL) & 1) << 3) | ((GetMonData(param2, MON_DATA_SPATK_IV, NULL) & 1) << 4) | ((GetMonData(param2, MON_DATA_SPDEF_IV, NULL) & 1) << 5); + v0 = ((Pokemon_GetValue(param2, MON_DATA_HP_IV, NULL) & 1) >> 0) | ((Pokemon_GetValue(param2, MON_DATA_ATK_IV, NULL) & 1) << 1) | ((Pokemon_GetValue(param2, MON_DATA_DEF_IV, NULL) & 1) << 2) | ((Pokemon_GetValue(param2, MON_DATA_SPEED_IV, NULL) & 1) << 3) | ((Pokemon_GetValue(param2, MON_DATA_SPATK_IV, NULL) & 1) << 4) | ((Pokemon_GetValue(param2, MON_DATA_SPDEF_IV, NULL) & 1) << 5); v0 = (v0 * 15 / 63) + 1; if (v0 >= 9) { diff --git a/src/overlay016/ov16_0225BFFC.c b/src/overlay016/ov16_0225BFFC.c index 5da4ed77b2..7d81bea51d 100644 --- a/src/overlay016/ov16_0225BFFC.c +++ b/src/overlay016/ov16_0225BFFC.c @@ -611,27 +611,27 @@ static void ov16_0225C47C (BattleSystem * param0, UnkStruct_ov16_0225BFFC * para if ((v0->unk_18 & 0x200000) == 0) { for (v1 = 0; v1 < 4; v1++) { - if ((v0->unk_01_4 & GetSingleBitMask(v1)) == 0) { - SetMonData(v2, 54 + v1, (u8 *)&v0->unk_0E[v1]); - SetMonData(v2, 58 + v1, (u8 *)&v0->unk_12[v1]); + if ((v0->unk_01_4 & Pokemon_GetFlagMaskOf(v1)) == 0) { + Pokemon_SetValue(v2, 54 + v1, (u8 *)&v0->unk_0E[v1]); + Pokemon_SetValue(v2, 58 + v1, (u8 *)&v0->unk_12[v1]); } } } - if ((v0->unk_08 & GetSingleBitMask(v0->unk_01_0)) == 0) { - SetMonData(v2, 6, (u8 *)&v0->unk_0C); + if ((v0->unk_08 & Pokemon_GetFlagMaskOf(v0->unk_01_0)) == 0) { + Pokemon_SetValue(v2, 6, (u8 *)&v0->unk_0C); } - SetMonData(v2, 163, (u8 *)&v0->unk_02); - SetMonData(v2, 160, (u8 *)&v0->unk_04); + Pokemon_SetValue(v2, 163, (u8 *)&v0->unk_02); + Pokemon_SetValue(v2, 160, (u8 *)&v0->unk_04); if (v0->unk_26) { - SetMonData(v2, 112, (u8 *)&v0->unk_1C); + Pokemon_SetValue(v2, 112, (u8 *)&v0->unk_1C); } if (v0->unk_24) { - SetMonData(v2, 10, (u8 *)&v0->unk_20); - CalculateMonLevelAndStats(v2); + Pokemon_SetValue(v2, 10, (u8 *)&v0->unk_20); + Pokemon_CalcLevelAndStats(v2); } ov16_02266ABC(param0, param1->unk_190, v0->unk_00); @@ -680,11 +680,11 @@ static void ov16_0225C5E0 (BattleSystem * param0, UnkStruct_ov16_0225BFFC * para if (v0->unk_01 == 104) { v4 = 0; } else { - v4 = GetMonData(v1, MON_DATA_ABILITY, NULL); + v4 = Pokemon_GetValue(v1, MON_DATA_ABILITY, NULL); } if ((v0->unk_02 != 215) || ((v0->unk_02 == 215) && (v4 != 43))) { - SetMonData(v1, 160, (u8 *)&v5); + Pokemon_SetValue(v1, 160, (u8 *)&v5); } } @@ -972,11 +972,11 @@ static void ov16_0225CA74 (BattleSystem * param0, UnkStruct_ov16_0225BFFC * para for (v3 = 0; v3 < Party_GetCurrentCount(v1); v3++) { v2 = Party_GetPokemonBySlotIndex(v1, v3); - if ((GetMonData(v2, MON_DATA_SPECIES, NULL)) && (GetMonData(v2, MON_DATA_IS_EGG, NULL) == 0)) { + if ((Pokemon_GetValue(v2, MON_DATA_SPECIES, NULL)) && (Pokemon_GetValue(v2, MON_DATA_IS_EGG, NULL) == 0)) { if (Battler_Side(param0, v4)) { - v6 += GetMonData(v2, MON_DATA_CURRENT_HP, NULL); + v6 += Pokemon_GetValue(v2, MON_DATA_CURRENT_HP, NULL); } else { - v5 += GetMonData(v2, MON_DATA_CURRENT_HP, NULL); + v5 += Pokemon_GetValue(v2, MON_DATA_CURRENT_HP, NULL); } } } diff --git a/src/overlay016/ov16_0225CBB8.c b/src/overlay016/ov16_0225CBB8.c index 72cc20de0c..3b33c15499 100644 --- a/src/overlay016/ov16_0225CBB8.c +++ b/src/overlay016/ov16_0225CBB8.c @@ -393,7 +393,7 @@ void ov16_0225CBDC (BattleSystem * param0, UnkStruct_ov16_0225BFFC * param1, Unk v4->unk_2C = param2->unk_01_3; v4->unk_18 = param2->unk_08; v4->unk_1C = param1->unk_191; - v4->unk_24 = GetNatureFromPersonality(param2->unk_04); + v4->unk_24 = Pokemon_GetNatureOf(param2->unk_04); v4->unk_28 = param2->unk_01_2; if ((v4->unk_13 == 2) && (BattleSystem_BattleStatus(param0) & 0x40)) { @@ -446,7 +446,7 @@ void ov16_0225CE1C (BattleSystem * param0, UnkStruct_ov16_0225BFFC * param1, Unk v1->unk_82 = param1->unk_191; v1->unk_88 = param2->unk_08; v1->unk_8C = param2->unk_0C; - v1->unk_8D = GetNatureFromPersonality(param2->unk_04); + v1->unk_8D = Pokemon_GetNatureOf(param2->unk_04); v1->unk_8E = param2->unk_10; v1->unk_92 = param2->unk_01_2; v1->unk_94 = 0; @@ -496,7 +496,7 @@ void ov16_0225CF70 (BattleSystem * param0, UnkStruct_ov16_0225BFFC * param1, Unk v2->unk_82 = param1->unk_191; v2->unk_88 = param2->unk_08; v2->unk_8C = param2->unk_0C; - v2->unk_8D = GetNatureFromPersonality(param2->unk_04); + v2->unk_8D = Pokemon_GetNatureOf(param2->unk_04); v2->unk_8E = param2->unk_10; v2->unk_92 = param2->unk_01_2; v2->unk_94 = param2->unk_14; @@ -3231,7 +3231,7 @@ static void ov16_02260B04 (UnkStruct_0201CD38 * param0, void * param1) v3 = ov16_0223ED6C(v0->unk_00); v2 = ov16_02252060(BattleSystem_Context(v0->unk_00), v0->unk_09, 0, NULL); - v1 = GetMonSpeciesPersonalDataAttribute(v2, 26); + v1 = PokemonPersonalData_GetSpeciesValue(v2, 26); v1 = v1 * Unk_ov16_0226F194[v3][0] / Unk_ov16_0226F194[v3][1]; if ((BattleSystem_RandNext(v0->unk_00) % 255) <= v1) { @@ -3402,7 +3402,7 @@ static void ov16_02260DB0 (UnkStruct_0201CD38 * param0, void * param1) v6 = 0; for (v4 = 0; v4 < 4; v4++) { - if ((v0->unk_22 & GetSingleBitMask(v4)) == 0) { + if ((v0->unk_22 & Pokemon_GetFlagMaskOf(v4)) == 0) { v5[v6] = v4 + 1; v6++; } @@ -4004,11 +4004,11 @@ static void ov16_022611DC (UnkStruct_0201CD38 * param0, void * param1) v18->unk_25 = ov16_0226825C(BattleSystem_BattlerSlot(v0->unk_00, v20), BattleSystem_BattleType(v0->unk_00)); v19 = ov16_0223DFAC(v0->unk_00, v20, v21); - v18->unk_28 = GetMonData(v19, MON_DATA_CURRENT_HP, NULL) - v0->unk_08->unk_04->unk_20; - v18->unk_2C = GetMonData(v19, MON_DATA_MAX_HP, NULL); + v18->unk_28 = Pokemon_GetValue(v19, MON_DATA_CURRENT_HP, NULL) - v0->unk_08->unk_04->unk_20; + v18->unk_2C = Pokemon_GetValue(v19, MON_DATA_MAX_HP, NULL); v18->unk_30 = v0->unk_08->unk_04->unk_20; - if (GetMonData(v19, MON_DATA_160, NULL) == 0) { + if (Pokemon_GetValue(v19, MON_DATA_160, NULL) == 0) { v18->unk_4A = 0; } @@ -4072,7 +4072,7 @@ static void ov16_022611DC (UnkStruct_0201CD38 * param0, void * param1) v34 = v0->unk_08->unk_04->unk_2C[v0->unk_08->unk_04->unk_11]; v33 = ov16_0223DFAC(v0->unk_00, v28, v34); - if (GetMonData(v33, MON_DATA_160, NULL) == 0) { + if (Pokemon_GetValue(v33, MON_DATA_160, NULL) == 0) { v27->unk_4A = 0; } @@ -4289,7 +4289,7 @@ static void ov16_02261E8C (UnkStruct_0201CD38 * param0, void * param1) v7 = v0->unk_09; } - v9 = AllocMonZeroed(5); + v9 = Pokemon_New(5); for (v3 = 0; v3 < 6; v3++) { Party_AddPokemon(v0->unk_04->unk_00, v9); @@ -4300,14 +4300,14 @@ static void ov16_02261E8C (UnkStruct_0201CD38 * param0, void * param1) for (v3 = 0; v3 < ov16_0223DF60(v0->unk_00, v6); v3++) { v9 = ov16_0223DFAC(v0->unk_00, v6, v0->unk_1C[v6][v3]); v10 = Party_GetPokemonBySlotIndex(v0->unk_04->unk_00, v3 * 2); - sub_020775EC(v9, v10); + Pokemon_Copy(v9, v10); v0->unk_04->unk_2C[v3 * 2] = v0->unk_1C[v6][v3]; } for (v3 = 0; v3 < ov16_0223DF60(v0->unk_00, v7); v3++) { v9 = ov16_0223DFAC(v0->unk_00, v7, v0->unk_1C[v7][v3]); v10 = Party_GetPokemonBySlotIndex(v0->unk_04->unk_00, v3 * 2 + 1); - sub_020775EC(v9, v10); + Pokemon_Copy(v9, v10); v0->unk_04->unk_2C[v3 * 2 + 1] = v0->unk_1C[v7][v3]; } @@ -4348,7 +4348,7 @@ static void ov16_02261E8C (UnkStruct_0201CD38 * param0, void * param1) v0->unk_04->unk_28 = v0->unk_09; v0->unk_04->unk_32 = v0->unk_17; - if ((v0->unk_18 & GetSingleBitMask(v0->unk_09)) == 0) { + if ((v0->unk_18 & Pokemon_GetFlagMaskOf(v0->unk_09)) == 0) { v0->unk_04->unk_14 = v0->unk_0C[v0->unk_09]; } else { v0->unk_04->unk_14 = 6; @@ -4356,7 +4356,7 @@ static void ov16_02261E8C (UnkStruct_0201CD38 * param0, void * param1) if (BattleSystem_BattleType(v0->unk_00) & 0x8) { v0->unk_04->unk_15 = 6; - } else if ((v0->unk_18 & GetSingleBitMask(BattleSystem_Partner(v0->unk_00, v0->unk_09))) == 0) { + } else if ((v0->unk_18 & Pokemon_GetFlagMaskOf(BattleSystem_Partner(v0->unk_00, v0->unk_09))) == 0) { v0->unk_04->unk_15 = v0->unk_0C[BattleSystem_Partner(v0->unk_00, v0->unk_09)]; } else { v0->unk_04->unk_15 = 6; @@ -4425,7 +4425,7 @@ static void ov16_02262258 (UnkStruct_0201CD38 * param0, void * param1) for (v1 = 0; v1 < Party_GetCurrentCount(v2); v1++) { v3 = ov16_0223DFAC(v0->unk_00, v0->unk_09, v1); - if ((GetMonData(v3, MON_DATA_CURRENT_HP, NULL)) && (v0->unk_0C[v4] != v1) && (v0->unk_0C[v5] != v1)) { + if ((Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL)) && (v0->unk_0C[v4] != v1) && (v0->unk_0C[v5] != v1)) { break; } } @@ -4475,11 +4475,11 @@ static void ov16_0226232C (UnkStruct_0201CD38 * param0, void * param1) } else { v3 = ov16_0223DFAC(v0->unk_00, v0->unk_09, v1 - 1); - if (GetMonData(v3, MON_DATA_CURRENT_HP, NULL) == 0) { + if (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL) == 0) { ov16_02264730(v0->unk_00); } - if (GetMonData(v3, MON_DATA_SPECIES_EGG, NULL) == 494) { + if (Pokemon_GetValue(v3, MON_DATA_SPECIES_EGG, NULL) == 494) { ov16_02264730(v0->unk_00); } } @@ -6158,7 +6158,7 @@ static void ov16_02264270 (BattleSystem * param0, UnkStruct_ov16_0225BFFC * para int v2 = 0; for (v0 = 0; v0 < BattleSystem_MaxBattlers(param0); v0++) { - if (param2->unk_01 & GetSingleBitMask(v0)) { + if (param2->unk_01 & Pokemon_GetFlagMaskOf(v0)) { if (Battler_Side(param0, v0)) { v2++; } else { diff --git a/src/overlay016/ov16_0226485C.c b/src/overlay016/ov16_0226485C.c index e11699ddbe..732aa5d035 100644 --- a/src/overlay016/ov16_0226485C.c +++ b/src/overlay016/ov16_0226485C.c @@ -545,8 +545,8 @@ void ov16_022651DC (BattleSystem * param0, BattleContext * param1, int param2, i int v3; v1 = ov16_0223DFAC(param0, param2, param1->selectedPartySlot[param2]); - v2 = GetMonData(v1, MON_DATA_SPECIES, NULL); - v3 = GetMonData(v1, MON_DATA_LEVEL, NULL); + v2 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); v0.unk_00 = 12; v0.unk_01 = param1->battleMons[param2].level; @@ -561,8 +561,8 @@ void ov16_022651DC (BattleSystem * param0, BattleContext * param1, int param2, i v0.unk_07_5 = param1->battleMons[param2].gender; } - v0.unk_08 = param1->battleMons[param2].exp - GetMonSpeciesLevelExp(v2, v3); - v0.unk_0C = GetMonSpeciesLevelExp(v2, v3 + 1) - GetMonSpeciesLevelExp(v2, v3); + v0.unk_08 = param1->battleMons[param2].exp - Pokemon_GetSpeciesBaseExpAt(v2, v3); + v0.unk_0C = Pokemon_GetSpeciesBaseExpAt(v2, v3 + 1) - Pokemon_GetSpeciesBaseExpAt(v2, v3); v0.unk_07_7 = ov16_0223F9E0(param0, param1->battleMons[param2].species); v0.unk_10 = ov16_0223ED8C(param0); v0.unk_14 = param3; @@ -596,7 +596,7 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl for (v1 = 0; v1 < BattleSystem_MaxBattlers(battleSys); v1++) { if (BattleSystem_CanPickCommand(battleCtx, v1) == 0) { - v10 |= GetSingleBitMask(v1); + v10 |= Pokemon_GetFlagMaskOf(v1); } } @@ -617,11 +617,11 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl for (v1 = 0; v1 < Party_GetCurrentCount(v7); v1++) { v8 = Party_GetPokemonBySlotIndex(v7, battleCtx->partyOrder[v2][v1]); - v5 = GetMonData(v8, MON_DATA_SPECIES_EGG, NULL); + v5 = Pokemon_GetValue(v8, MON_DATA_SPECIES_EGG, NULL); if ((v5) && (v5 != 494)) { - if (GetMonData(v8, MON_DATA_CURRENT_HP, NULL)) { - if (GetMonData(v8, MON_DATA_160, NULL)) { + if (Pokemon_GetValue(v8, MON_DATA_CURRENT_HP, NULL)) { + if (Pokemon_GetValue(v8, MON_DATA_160, NULL)) { v0.unk_08[0][v6] = 3; } else { v0.unk_08[0][v6] = 1; @@ -633,7 +633,7 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl if (v9 & (0x4 | 0x20 | 0x80 | 0x200)) { v0.unk_02[v6] = 0; } else { - v0.unk_02[v6] = GetMonPercentToNextLevel(v8); + v0.unk_02[v6] = Pokemon_GetPercentToNextLevel(v8); } v6++; @@ -652,11 +652,11 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl for (v1 = 0; v1 < Party_GetCurrentCount(v7); v1++) { v8 = Party_GetPokemonBySlotIndex(v7, battleCtx->partyOrder[v2][v1]); - v5 = GetMonData(v8, MON_DATA_SPECIES_EGG, NULL); + v5 = Pokemon_GetValue(v8, MON_DATA_SPECIES_EGG, NULL); if ((v5) && (v5 != 494)) { - if (GetMonData(v8, MON_DATA_CURRENT_HP, NULL)) { - if (GetMonData(v8, MON_DATA_160, NULL)) { + if (Pokemon_GetValue(v8, MON_DATA_CURRENT_HP, NULL)) { + if (Pokemon_GetValue(v8, MON_DATA_160, NULL)) { v0.unk_08[1][v6] = 3; } else { v0.unk_08[1][v6] = 1; @@ -680,11 +680,11 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl for (v1 = 0; v1 < Party_GetCurrentCount(v7); v1++) { v8 = Party_GetPokemonBySlotIndex(v7, battleCtx->partyOrder[v2][v1]); - v5 = GetMonData(v8, MON_DATA_SPECIES_EGG, NULL); + v5 = Pokemon_GetValue(v8, MON_DATA_SPECIES_EGG, NULL); if ((v5) && (v5 != 494)) { - if (GetMonData(v8, MON_DATA_CURRENT_HP, NULL)) { - if (GetMonData(v8, MON_DATA_160, NULL)) { + if (Pokemon_GetValue(v8, MON_DATA_CURRENT_HP, NULL)) { + if (Pokemon_GetValue(v8, MON_DATA_160, NULL)) { v0.unk_08[1][v6] = 3; } else { v0.unk_08[1][v6] = 1; @@ -703,11 +703,11 @@ void BattleIO_SetCommandSelection (BattleSystem *battleSys, BattleContext *battl for (v1 = 0; v1 < Party_GetCurrentCount(v7); v1++) { v8 = Party_GetPokemonBySlotIndex(v7, battleCtx->partyOrder[v2][v1]); - v5 = GetMonData(v8, MON_DATA_SPECIES_EGG, NULL); + v5 = Pokemon_GetValue(v8, MON_DATA_SPECIES_EGG, NULL); if ((v5) && (v5 != 494)) { - if (GetMonData(v8, MON_DATA_CURRENT_HP, NULL)) { - if (GetMonData(v8, MON_DATA_160, NULL)) { + if (Pokemon_GetValue(v8, MON_DATA_CURRENT_HP, NULL)) { + if (Pokemon_GetValue(v8, MON_DATA_160, NULL)) { v0.unk_08[1][v6] = 3; } else { v0.unk_08[1][v6] = 1; @@ -844,11 +844,11 @@ void BattleIO_ShowBagScreen (BattleSystem *battleSys, BattleContext *battleCtx, } if (BattleSystem_BattleType(battleSys) == (0x2 | 0x8 | 0x40)) { - if (((battleCtx->battlersSwitchingMask & GetSingleBitMask(1)) == 0) && ((battleCtx->battlersSwitchingMask & GetSingleBitMask(3)) == 0)) { + if (((battleCtx->battlersSwitchingMask & Pokemon_GetFlagMaskOf(1)) == 0) && ((battleCtx->battlersSwitchingMask & Pokemon_GetFlagMaskOf(3)) == 0)) { v0.unk_01 = 1; v0.unk_02 = 0; v0.unk_03 = 0; - } else if ((battleCtx->battlersSwitchingMask & GetSingleBitMask(1)) == 0) { + } else if ((battleCtx->battlersSwitchingMask & Pokemon_GetFlagMaskOf(1)) == 0) { v0.unk_01 = 0; if (battleCtx->battleMons[1].moveEffectsMask & (0x40 | 0x80 | 0x40000 | 0x20000000)) { @@ -994,8 +994,8 @@ void ov16_02265C38 (BattleSystem * param0, BattleContext * param1, int param2) int v3; v1 = ov16_0223DFAC(param0, param2, param1->selectedPartySlot[param2]); - v2 = GetMonData(v1, MON_DATA_SPECIES, NULL); - v3 = GetMonData(v1, MON_DATA_LEVEL, NULL); + v2 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); v0.unk_00 = 24; v0.unk_01 = param1->battleMons[param2].level; @@ -1009,8 +1009,8 @@ void ov16_02265C38 (BattleSystem * param0, BattleContext * param1, int param2) v0.unk_07 = param1->battleMons[param2].gender; } - v0.unk_0C = param1->battleMons[param2].exp - GetMonSpeciesLevelExp(v2, v3); - v0.unk_10 = GetMonSpeciesLevelExp(v2, v3 + 1) - GetMonSpeciesLevelExp(v2, v3); + v0.unk_0C = param1->battleMons[param2].exp - Pokemon_GetSpeciesBaseExpAt(v2, v3); + v0.unk_10 = Pokemon_GetSpeciesBaseExpAt(v2, v3 + 1) - Pokemon_GetSpeciesBaseExpAt(v2, v3); ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C35C)); } @@ -1023,13 +1023,13 @@ void ov16_02265D14 (BattleSystem * param0, BattleContext * param1, int param2, i int v3; v1 = ov16_0223DFAC(param0, param2, param1->selectedPartySlot[param2]); - v2 = GetMonData(v1, MON_DATA_SPECIES, NULL); - v3 = GetMonData(v1, MON_DATA_LEVEL, NULL); + v2 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); v0.unk_00 = 25; v0.unk_04 = param3; - v0.unk_08 = param1->battleMons[param2].exp - GetMonSpeciesLevelExp(v2, v3); - v0.unk_0C = GetMonSpeciesLevelExp(v2, v3 + 1) - GetMonSpeciesLevelExp(v2, v3); + v0.unk_08 = param1->battleMons[param2].exp - Pokemon_GetSpeciesBaseExpAt(v2, v3); + v0.unk_0C = Pokemon_GetSpeciesBaseExpAt(v2, v3 + 1) - Pokemon_GetSpeciesBaseExpAt(v2, v3); ov16_02264A04(param0, 1, param2, &v0, sizeof(UnkStruct_ov16_0225C370)); } @@ -1232,8 +1232,8 @@ void ov16_022661CC (BattleSystem * param0, BattleContext * param1, int param2) int v3; v1 = ov16_0223DFAC(param0, param2, param1->selectedPartySlot[param2]); - v2 = GetMonData(v1, MON_DATA_SPECIES, NULL); - v3 = GetMonData(v1, MON_DATA_LEVEL, NULL); + v2 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); v0.unk_00 = 38; v0.unk_01 = param1->battleMons[param2].level; @@ -1248,8 +1248,8 @@ void ov16_022661CC (BattleSystem * param0, BattleContext * param1, int param2) v0.unk_07_5 = param1->battleMons[param2].gender; } - v0.unk_08 = param1->battleMons[param2].exp - GetMonSpeciesLevelExp(v2, v3); - v0.unk_0C = GetMonSpeciesLevelExp(v2, v3 + 1) - GetMonSpeciesLevelExp(v2, v3); + v0.unk_08 = param1->battleMons[param2].exp - Pokemon_GetSpeciesBaseExpAt(v2, v3); + v0.unk_0C = Pokemon_GetSpeciesBaseExpAt(v2, v3 + 1) - Pokemon_GetSpeciesBaseExpAt(v2, v3); v0.unk_07_7 = ov16_0223F9E0(param0, param1->battleMons[param2].species); v0.unk_10 = ov16_0223ED8C(param0); @@ -1505,7 +1505,7 @@ void ov16_0226683C (BattleSystem * param0, BattleContext * param1) for (v1 = 0; v1 < BattleSystem_MaxBattlers(param0); v1++) { if (param1->battlerActions[v1][0] == 16) { - v0.unk_01 |= GetSingleBitMask(v1); + v0.unk_01 |= Pokemon_GetFlagMaskOf(v1); } } @@ -1744,11 +1744,11 @@ static void ov16_02266CF0 (BattleSystem * param0, BattleContext * param1, UnkStr for (v0 = 0; v0 < Party_GetCurrentCount(v6); v0++) { v7 = Party_GetPokemonBySlotIndex(v6, param1->partyOrder[v1][v0]); - v3 = GetMonData(v7, MON_DATA_SPECIES_EGG, NULL); + v3 = Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL); if ((v3) && (v3 != 494)) { - if (GetMonData(v7, MON_DATA_CURRENT_HP, NULL)) { - if (GetMonData(v7, MON_DATA_160, NULL)) { + if (Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL)) { + if (Pokemon_GetValue(v7, MON_DATA_160, NULL)) { param2->unk_02[v4] = 3; } else { param2->unk_02[v4] = 1; @@ -1766,11 +1766,11 @@ static void ov16_02266CF0 (BattleSystem * param0, BattleContext * param1, UnkStr for (v0 = 0; v0 < Party_GetCurrentCount(v6); v0++) { v7 = Party_GetPokemonBySlotIndex(v6, param1->partyOrder[v2][v0]); - v3 = GetMonData(v7, MON_DATA_SPECIES_EGG, NULL); + v3 = Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL); if ((v3) && (v3 != 494)) { - if (GetMonData(v7, MON_DATA_CURRENT_HP, NULL)) { - if (GetMonData(v7, MON_DATA_160, NULL)) { + if (Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL)) { + if (Pokemon_GetValue(v7, MON_DATA_160, NULL)) { param2->unk_02[v4] = 3; } else { param2->unk_02[v4] = 1; @@ -1794,11 +1794,11 @@ static void ov16_02266CF0 (BattleSystem * param0, BattleContext * param1, UnkStr for (v0 = 0; v0 < Party_GetCurrentCount(v6); v0++) { v7 = Party_GetPokemonBySlotIndex(v6, param1->partyOrder[param4][v0]); - v3 = GetMonData(v7, MON_DATA_SPECIES_EGG, NULL); + v3 = Pokemon_GetValue(v7, MON_DATA_SPECIES_EGG, NULL); if ((v3) && (v3 != 494)) { - if (GetMonData(v7, MON_DATA_CURRENT_HP, NULL)) { - if (GetMonData(v7, MON_DATA_160, NULL)) { + if (Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL)) { + if (Pokemon_GetValue(v7, MON_DATA_160, NULL)) { param2->unk_02[v4] = 3; } else { param2->unk_02[v4] = 1; diff --git a/src/overlay016/ov16_02266F1C.c b/src/overlay016/ov16_02266F1C.c index 62c823b22c..657097ab69 100644 --- a/src/overlay016/ov16_02266F1C.c +++ b/src/overlay016/ov16_02266F1C.c @@ -960,7 +960,7 @@ static void ov16_02267864 (UnkStruct_ov16_022674C4 * param0) v5 = Strbuf_Init((12 + (5 * 2)), 5); v6 = MessageLoader_GetNewStrbuf(v4, 964); v7 = ov16_0223DFAC(param0->unk_0C, param0->unk_24, param0->unk_26); - v8 = GetBoxMon(v7); + v8 = Pokemon_GetBoxPokemon(v7); sub_0200B5CC(v9, 0, v8); sub_0200C388(v9, v5, v6); diff --git a/src/overlay016/ov16_0226871C.c b/src/overlay016/ov16_0226871C.c index e54a3f5514..31d41d3d5a 100644 --- a/src/overlay016/ov16_0226871C.c +++ b/src/overlay016/ov16_0226871C.c @@ -2165,7 +2165,7 @@ static void ov16_0226A12C (UnkStruct_ov16_02268A14 * param0, int param1, int par } v6 = ov16_0223DFAC(param0->unk_00, v12, v0->unk_00[v12].unk_00); - v7 = GetBoxMon(v6); + v7 = Pokemon_GetBoxPokemon(v6); sub_0200B5CC(v8, 0, v7); sub_0200C388(v8, v4, v5); diff --git a/src/overlay017/ov17_0223B140.c b/src/overlay017/ov17_0223B140.c index 3b6cadff80..759fa4dea7 100644 --- a/src/overlay017/ov17_0223B140.c +++ b/src/overlay017/ov17_0223B140.c @@ -242,7 +242,7 @@ int ov17_0223B140 (UnkStruct_020067E8 * param0, int * param1) int v4; for (v4 = 0; v4 < 4; v4++) { - v3[v4] = GetMonData(v0->unk_00->unk_00.unk_00[v0->unk_00->unk_00.unk_113], MON_DATA_MOVE1 + v4, NULL); + v3[v4] = Pokemon_GetValue(v0->unk_00->unk_00.unk_00[v0->unk_00->unk_00.unk_113], MON_DATA_MOVE1 + v4, NULL); } ov17_02240A80(v0->unk_7E4, v3); @@ -609,7 +609,7 @@ static void ov17_0223BA10 (UnkStruct_ov17_02246F24 * param0, NARC * param1) int v0, v1, v2; for (v0 = 0; v0 < 4; v0++) { - v2 = GetMonData(param0->unk_00->unk_00.unk_00[param0->unk_00->unk_00.unk_113], MON_DATA_MOVE1 + v0, NULL); + v2 = Pokemon_GetValue(param0->unk_00->unk_00.unk_00[param0->unk_00->unk_00.unk_113], MON_DATA_MOVE1 + v0, NULL); if (v2 != 0) { v1 = MoveTable_LoadParam(v2, MOVEATTRIBUTE_CONTEST_TYPE); diff --git a/src/overlay017/ov17_0223DAD0.c b/src/overlay017/ov17_0223DAD0.c index 296ed01e05..2d09d0c4d9 100644 --- a/src/overlay017/ov17_0223DAD0.c +++ b/src/overlay017/ov17_0223DAD0.c @@ -723,7 +723,7 @@ static void ov17_0223E458 (UnkStruct_ov17_0224DF54 * param0) ov17_0224CFB8(param0); for (v0 = 0; v0 < 4; v0++) { - param0->unk_14.unk_A14[v0] = ov17_0224CFA8(GetMonData(param0->unk_00->unk_00.unk_00[v0], MON_DATA_SPECIES, NULL)); + param0->unk_14.unk_A14[v0] = ov17_0224CFA8(Pokemon_GetValue(param0->unk_00->unk_00.unk_00[v0], MON_DATA_SPECIES, NULL)); } } diff --git a/src/overlay017/ov17_0223F118.c b/src/overlay017/ov17_0223F118.c index 6fd0206c5b..ce39870df6 100644 --- a/src/overlay017/ov17_0223F118.c +++ b/src/overlay017/ov17_0223F118.c @@ -221,14 +221,14 @@ void ov17_0223F374 (UnkStruct_02095C48 * param0) s32 v6, v7; for (v0 = 0; v0 < 4; v0++) { - v5 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_HELD_ITEM, NULL); + v5 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_HELD_ITEM, NULL); v6 = 100; switch (param0->unk_00.unk_10F) { case 0: - v1 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_COOL, NULL); - v2 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_TOUGH, NULL); - v3 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_BEAUTY, NULL); + v1 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_COOL, NULL); + v2 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_TOUGH, NULL); + v3 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_BEAUTY, NULL); switch (v5) { case 260: @@ -241,9 +241,9 @@ void ov17_0223F374 (UnkStruct_02095C48 * param0) } break; case 1: - v1 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_BEAUTY, NULL); - v2 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_COOL, NULL); - v3 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_CUTE, NULL); + v1 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_BEAUTY, NULL); + v2 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_COOL, NULL); + v3 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_CUTE, NULL); switch (v5) { case 261: @@ -256,9 +256,9 @@ void ov17_0223F374 (UnkStruct_02095C48 * param0) } break; case 2: - v1 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_CUTE, NULL); - v2 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_BEAUTY, NULL); - v3 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_SMART, NULL); + v1 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_CUTE, NULL); + v2 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_BEAUTY, NULL); + v3 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_SMART, NULL); switch (v5) { case 262: @@ -271,9 +271,9 @@ void ov17_0223F374 (UnkStruct_02095C48 * param0) } break; case 3: - v1 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_SMART, NULL); - v2 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_CUTE, NULL); - v3 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_TOUGH, NULL); + v1 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_SMART, NULL); + v2 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_CUTE, NULL); + v3 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_TOUGH, NULL); switch (v5) { case 263: @@ -286,9 +286,9 @@ void ov17_0223F374 (UnkStruct_02095C48 * param0) } break; case 4: - v1 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_TOUGH, NULL); - v2 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_SMART, NULL); - v3 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_COOL, NULL); + v1 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_TOUGH, NULL); + v2 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_SMART, NULL); + v3 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_COOL, NULL); switch (v5) { case 264: @@ -306,7 +306,7 @@ void ov17_0223F374 (UnkStruct_02095C48 * param0) return; } - v4 = GetMonData(param0->unk_00.unk_00[v0], MON_DATA_SHEEN, NULL); + v4 = Pokemon_GetValue(param0->unk_00.unk_00[v0], MON_DATA_SHEEN, NULL); v7 = v1 + ((v2 + v3 + v4) / 2); v7 = v7 * v6 / 100; diff --git a/src/overlay017/ov17_0223F7E4.c b/src/overlay017/ov17_0223F7E4.c index 6948c78962..5a2910fc00 100644 --- a/src/overlay017/ov17_0223F7E4.c +++ b/src/overlay017/ov17_0223F7E4.c @@ -785,7 +785,7 @@ static void ov17_0223FCAC (UnkStruct_ov17_0223F7E4 * param0, int param1, int par param0->unk_2C9 = 0xff; for (v2 = 0; v2 < 4; v2++) { - v0[v2] = GetMonData(param0->unk_04->unk_00->unk_00[param0->unk_04->unk_00->unk_113], MON_DATA_MOVE1 + v2, NULL); + v0[v2] = Pokemon_GetValue(param0->unk_04->unk_00->unk_00[param0->unk_04->unk_00->unk_113], MON_DATA_MOVE1 + v2, NULL); if (v0[v2] != 0) { v1[v2] = v8->unk_12C[v2]; @@ -889,7 +889,7 @@ static int ov17_0223FFF4 (UnkStruct_ov17_0223F7E4 * param0, int param1, int para case 1: case 2: case 3: - v1 = GetMonData(param0->unk_04->unk_00->unk_00[param0->unk_04->unk_00->unk_113], MON_DATA_MOVE1 + param1, NULL); + v1 = Pokemon_GetValue(param0->unk_04->unk_00->unk_00[param0->unk_04->unk_00->unk_113], MON_DATA_MOVE1 + param1, NULL); if ((v1 == 0) || (param0->unk_2C9 == (param1 - 0))) { return 0xffffffff; @@ -1239,7 +1239,7 @@ static void ov17_02240658 (UnkStruct_0201CD38 * param0, void * param1) v1 = v0->unk_04->unk_24; for (v10 = 0; v10 < 4; v10++) { - v9[v10] = GetMonData(v0->unk_04->unk_00->unk_00[v0->unk_04->unk_00->unk_113], MON_DATA_MOVE1 + v10, NULL); + v9[v10] = Pokemon_GetValue(v0->unk_04->unk_00->unk_00[v0->unk_04->unk_00->unk_113], MON_DATA_MOVE1 + v10, NULL); } switch (v0->unk_2CC.unk_04_val1.unk_14) { @@ -1572,7 +1572,7 @@ static int ov17_02240D04 (UnkStruct_ov17_0223F7E4 * param0, int param1) v2 = &Unk_ov17_02253558[param0->unk_2C8]; for (v4 = 0; v4 < 4; v4++) { - v7[v4] = GetMonData(param0->unk_04->unk_00->unk_00[param0->unk_04->unk_00->unk_113], MON_DATA_MOVE1 + v4, NULL); + v7[v4] = Pokemon_GetValue(param0->unk_04->unk_00->unk_00[param0->unk_04->unk_00->unk_113], MON_DATA_MOVE1 + v4, NULL); } if (param1 == 1) { diff --git a/src/overlay017/ov17_022413D8.c b/src/overlay017/ov17_022413D8.c index b70a92c2a5..db4dacd0c3 100644 --- a/src/overlay017/ov17_022413D8.c +++ b/src/overlay017/ov17_022413D8.c @@ -490,8 +490,8 @@ void ov17_02241524 (UnkStruct_ov17_0223F88C * param0, int param1) { u32 v0, v1; - v0 = GetMonData(param0->unk_00->unk_00[param1], MON_DATA_SPECIES, NULL); - v1 = GetMonData(param0->unk_00->unk_00[param1], MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param0->unk_00->unk_00[param1], MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetValue(param0->unk_00->unk_00[param1], MON_DATA_FORM, NULL); if (IsFormSymmetrical(v0, v1) == 1) { sub_02007DEC(param0->unk_08[param1], 35, 1); @@ -515,8 +515,8 @@ void ov17_022415E4 (UnkStruct_ov17_0223F88C * param0) { u32 v1, v2; - v1 = GetMonData(param0->unk_00->unk_00[v0], MON_DATA_SPECIES, NULL); - v2 = GetMonData(param0->unk_00->unk_00[v0], MON_DATA_FORM, NULL); + v1 = Pokemon_GetValue(param0->unk_00->unk_00[v0], MON_DATA_SPECIES, NULL); + v2 = Pokemon_GetValue(param0->unk_00->unk_00[v0], MON_DATA_FORM, NULL); if (IsFormSymmetrical(v1, v2) == 1) { sub_02007DEC(param0->unk_08[v0], 35, 1); @@ -1381,13 +1381,13 @@ static void ov17_0224290C (UnkStruct_ov17_02246F24 * param0, int param1, const U case 0: break; case 1: - sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param0->unk_304.unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param0->unk_304.unk_00])); break; case 2: - sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 3: - sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); break; case 4: sub_0200B630(param0->unk_0C.unk_48, 0, param2->unk_02); @@ -1399,44 +1399,44 @@ static void ov17_0224290C (UnkStruct_ov17_02246F24 * param0, int param1, const U sub_0200BB74(param0->unk_0C.unk_48, 0, param0->unk_0C.unk_00->unk_C0[param2->unk_05].unk_00); break; case 7: - sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); - sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); break; case 8: - sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); sub_0200B630(param0->unk_0C.unk_48, 1, param2->unk_02); break; case 9: - sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); sub_0200B60C(param0->unk_0C.unk_48, 1, param2->unk_04, 1, 0, 1); break; case 10: - sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); sub_0200BB74(param0->unk_0C.unk_48, 1, param0->unk_0C.unk_00->unk_C0[param2->unk_05].unk_00); break; case 11: - sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); - sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 12: - sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); sub_0200B630(param0->unk_0C.unk_48, 1, param2->unk_02); break; case 13: - sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); sub_0200B60C(param0->unk_0C.unk_48, 1, param2->unk_04, 1, 0, 1); break; case 14: - sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); - sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 15: sub_0200B630(param0->unk_0C.unk_48, 0, param2->unk_02); - sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 16: sub_0200B630(param0->unk_0C.unk_48, 0, param2->unk_02); - sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); break; case 17: sub_0200B630(param0->unk_0C.unk_48, 0, param2->unk_02); @@ -1444,15 +1444,15 @@ static void ov17_0224290C (UnkStruct_ov17_02246F24 * param0, int param1, const U break; case 18: sub_0200B630(param0->unk_0C.unk_48, 0, param2->unk_02); - sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 19: sub_0200B60C(param0->unk_0C.unk_48, 0, param2->unk_04, 1, 0, 1); - sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 20: sub_0200B60C(param0->unk_0C.unk_48, 0, param2->unk_04, 1, 0, 1); - sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); break; case 21: sub_0200B60C(param0->unk_0C.unk_48, 0, param2->unk_04, 1, 0, 1); @@ -1460,15 +1460,15 @@ static void ov17_0224290C (UnkStruct_ov17_02246F24 * param0, int param1, const U break; case 22: sub_0200B60C(param0->unk_0C.unk_48, 0, param2->unk_04, 1, 0, 1); - sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 23: sub_0200BB74(param0->unk_0C.unk_48, 0, param0->unk_0C.unk_00->unk_C0[param2->unk_05].unk_00); - sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; case 24: sub_0200BB74(param0->unk_0C.unk_48, 0, param0->unk_0C.unk_00->unk_C0[param2->unk_05].unk_00); - sub_0200B5CC(param0->unk_0C.unk_48, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); + sub_0200B5CC(param0->unk_0C.unk_48, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_01])); break; case 25: sub_0200BB74(param0->unk_0C.unk_48, 0, param0->unk_0C.unk_00->unk_C0[param2->unk_05].unk_00); @@ -1479,7 +1479,7 @@ static void ov17_0224290C (UnkStruct_ov17_02246F24 * param0, int param1, const U sub_0200B60C(param0->unk_0C.unk_48, 1, param2->unk_04, 1, 0, 1); break; case 27: - sub_0200B5CC(param0->unk_0C.unk_48, 0, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_48, 0, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); sub_0200BB74(param0->unk_0C.unk_48, 1, param0->unk_0C.unk_00->unk_C0[param2->unk_05].unk_00); sub_0200B630(param0->unk_0C.unk_48, 2, param2->unk_02); break; @@ -1495,7 +1495,7 @@ static void ov17_0224290C (UnkStruct_ov17_02246F24 * param0, int param1, const U break; } - sub_0200B5CC(param0->unk_0C.unk_48, 1 + v1, GetBoxMon(param0->unk_0C.unk_00->unk_00[v0->unk_01[v1]])); + sub_0200B5CC(param0->unk_0C.unk_48, 1 + v1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[v0->unk_01[v1]])); } } break; @@ -1583,7 +1583,7 @@ void ov17_02242EE4 (UnkStruct_ov17_02246F24 * param0, int param1) v0 = Strbuf_Init(12, 21); - GetMonData(param0->unk_0C.unk_00->unk_00[param1], MON_DATA_119, v0); + Pokemon_GetValue(param0->unk_0C.unk_00->unk_00[param1], MON_DATA_119, v0); if (param1 == param0->unk_00->unk_00.unk_113) { v1 = ((u32)(((1 & 0xff) << 16) | ((2 & 0xff) << 8) | ((0 & 0xff) << 0))); @@ -2127,8 +2127,8 @@ void ov17_022439C8 (UnkStruct_02095C48 * param0, int param1, int param2, UnkStru { int v0, v1; - v0 = GetMonData(param0->unk_00.unk_00[param1], MON_DATA_177, NULL); - v1 = GetMonData(param0->unk_00.unk_00[param1], MON_DATA_178, NULL); + v0 = Pokemon_GetValue(param0->unk_00.unk_00[param1], MON_DATA_177, NULL); + v1 = Pokemon_GetValue(param0->unk_00.unk_00[param1], MON_DATA_178, NULL); if ((v0 == 7) || (v1 == 7)) { param3->unk_07 = 1; diff --git a/src/overlay017/ov17_02243C28.c b/src/overlay017/ov17_02243C28.c index 1680562fee..efcc4c087a 100644 --- a/src/overlay017/ov17_02243C28.c +++ b/src/overlay017/ov17_02243C28.c @@ -680,17 +680,17 @@ static void ov17_022444BC (UnkStruct_0201CD38 * param0, void * param1) MI_CpuClear8(&v3, sizeof(UnkStruct_ov16_02265BBC)); MI_CpuClear8(&v4, sizeof(UnkStruct_ov16_02264408)); - v6 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_SPECIES, NULL); - v7 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_GENDER, NULL); - v8 = GetMonShininess(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D]); - v9 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_FORM, NULL); - v14 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_PERSONALITY, NULL); - - v10 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_SPECIES, NULL); - v11 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_GENDER, NULL); - v12 = GetMonShininess(v0->unk_00->unk_0C.unk_00->unk_00[v16]); - v13 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_FORM, NULL); - v15 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_PERSONALITY, NULL); + v6 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_SPECIES, NULL); + v7 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_GENDER, NULL); + v8 = Pokemon_IsShiny(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D]); + v9 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_FORM, NULL); + v14 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_PERSONALITY, NULL); + + v10 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_SPECIES, NULL); + v11 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_GENDER, NULL); + v12 = Pokemon_IsShiny(v0->unk_00->unk_0C.unk_00->unk_00[v16]); + v13 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_FORM, NULL); + v15 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v16], MON_DATA_PERSONALITY, NULL); v3.unk_00 = 0; v3.unk_01 = 0; @@ -889,7 +889,7 @@ static void ov17_022449B8 (UnkStruct_0201CD38 * param0, void * param1) v1 = ov17_0223FAF8(v0->unk_00->unk_7E4); if (v1 != 0xffffffff) { - v0->unk_10.unk_00 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_MOVE1 + v1, NULL); + v0->unk_10.unk_00 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0D], MON_DATA_MOVE1 + v1, NULL); sub_02005748(1501); v0->unk_0C++; } diff --git a/src/overlay017/ov17_02246ECC.c b/src/overlay017/ov17_02246ECC.c index ba83654500..654324bdd3 100644 --- a/src/overlay017/ov17_02246ECC.c +++ b/src/overlay017/ov17_02246ECC.c @@ -1281,7 +1281,7 @@ static void ov17_02246F24 (UnkStruct_ov17_02246F24 * param0, UnkStruct_ov17_0224 MI_CpuClear8(param1, sizeof(UnkStruct_ov17_02246F9C)); for (v0 = 0; v0 < 4; v0++) { - param1->unk_00[v0].unk_00 = GetMonData(param0->unk_00->unk_00.unk_00[param2], MON_DATA_MOVE1 + v0, NULL); + param1->unk_00[v0].unk_00 = Pokemon_GetValue(param0->unk_00->unk_00.unk_00[param2], MON_DATA_MOVE1 + v0, NULL); if (ov17_02243A98(¶m0->unk_220, param2, param1->unk_00[v0].unk_00) == 1) { param1->unk_00[v0].unk_0A = MoveTable_LoadParam(param1->unk_00[v0].unk_00, MOVEATTRIBUTE_CONTEST_EFFECT); diff --git a/src/overlay017/ov17_022476F8.c b/src/overlay017/ov17_022476F8.c index 4f52ecae55..09a505798e 100644 --- a/src/overlay017/ov17_022476F8.c +++ b/src/overlay017/ov17_022476F8.c @@ -196,7 +196,7 @@ static void ov17_0224792C (UnkStruct_ov17_02247A48 * param0, int param1, const U break; case 1: sub_0200B48C(param0->unk_0C.unk_3C, 0, param0->unk_00->unk_00.unk_D8[param2->unk_00], param0->unk_00->unk_00.unk_F8[param2->unk_00], 1, GAME_LANGUAGE); - sub_0200B5CC(param0->unk_0C.unk_3C, 1, GetBoxMon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_0C.unk_3C, 1, Pokemon_GetBoxPokemon(param0->unk_0C.unk_00->unk_00[param2->unk_00])); break; default: GF_ASSERT(FALSE); diff --git a/src/overlay017/ov17_02247A48.c b/src/overlay017/ov17_02247A48.c index 1b8c711741..4af4a56425 100644 --- a/src/overlay017/ov17_02247A48.c +++ b/src/overlay017/ov17_02247A48.c @@ -1086,8 +1086,8 @@ static void ov17_02248AA4 (UnkStruct_0201CD38 * param0, void * param1) ov22_0225B158(v0->unk_00->unk_F18[v0->unk_0E].unk_00, v0->unk_00->unk_F18[v0->unk_0E].unk_04, v0->unk_00->unk_F18[v0->unk_0E].unk_08, v1); if (v0->unk_04 >= FX32_ONE) { - v2 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0E], MON_DATA_SPECIES, NULL); - v3 = GetMonData(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0E], MON_DATA_FORM, NULL); + v2 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0E], MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00->unk_00[v0->unk_0E], MON_DATA_FORM, NULL); sub_02077D3C(v0->unk_00->unk_00->unk_14C[v0->unk_0E], 0, v2, v3, 0, 127, NULL, 22); v0->unk_0C++; } diff --git a/src/overlay017/ov17_0224A0FC.c b/src/overlay017/ov17_0224A0FC.c index 2bebbc28ac..3ebefbce58 100644 --- a/src/overlay017/ov17_0224A0FC.c +++ b/src/overlay017/ov17_0224A0FC.c @@ -1900,7 +1900,7 @@ static void ov17_0224C0C0 (UnkStruct_ov17_0224DF54 * param0, int param1, const U case 0: break; case 1: - sub_0200B5CC(param0->unk_14.unk_88, 0, GetBoxMon(param0->unk_14.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_14.unk_88, 0, Pokemon_GetBoxPokemon(param0->unk_14.unk_00->unk_00[param2->unk_00])); break; case 2: v0 = sub_02095848(param0->unk_00->unk_00.unk_110, param0->unk_00->unk_00.unk_111, param0->unk_00->unk_155); @@ -1911,10 +1911,10 @@ static void ov17_0224C0C0 (UnkStruct_ov17_0224DF54 * param0, int param1, const U break; case 4: sub_0200B48C(param0->unk_14.unk_88, 0, param0->unk_00->unk_00.unk_D8[param2->unk_00], param0->unk_00->unk_00.unk_F8[param2->unk_00], 1, GAME_LANGUAGE); - sub_0200B5CC(param0->unk_14.unk_88, 1, GetBoxMon(param0->unk_14.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_14.unk_88, 1, Pokemon_GetBoxPokemon(param0->unk_14.unk_00->unk_00[param2->unk_00])); break; case 5: - sub_0200B5CC(param0->unk_14.unk_88, 0, GetBoxMon(param0->unk_14.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_14.unk_88, 0, Pokemon_GetBoxPokemon(param0->unk_14.unk_00->unk_00[param2->unk_00])); sub_0200B60C(param0->unk_14.unk_88, 1, param2->unk_04, 1, 0, 1); break; case 6: @@ -1922,7 +1922,7 @@ static void ov17_0224C0C0 (UnkStruct_ov17_0224DF54 * param0, int param1, const U sub_0200BBA8(param0->unk_14.unk_88, 0, v0); sub_0200B60C(param0->unk_14.unk_88, 1, param2->unk_04, 1, 0, 1); sub_0200B48C(param0->unk_14.unk_88, 2, param0->unk_00->unk_00.unk_D8[param2->unk_00], param0->unk_00->unk_00.unk_F8[param2->unk_00], 1, GAME_LANGUAGE); - sub_0200B5CC(param0->unk_14.unk_88, 3, GetBoxMon(param0->unk_14.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_14.unk_88, 3, Pokemon_GetBoxPokemon(param0->unk_14.unk_00->unk_00[param2->unk_00])); break; default: GF_ASSERT(FALSE); diff --git a/src/overlay017/ov17_02250744.c b/src/overlay017/ov17_02250744.c index 8228a546c7..5b1cd14f0d 100644 --- a/src/overlay017/ov17_02250744.c +++ b/src/overlay017/ov17_02250744.c @@ -226,12 +226,12 @@ static void ov17_022507F0 (UnkStruct_ov17_0224FCA0 * param0, int param1, const U break; case 2: sub_0200B48C(param0->unk_10.unk_B8, 0, param0->unk_00->unk_00.unk_D8[param2->unk_00], param0->unk_00->unk_00.unk_F8[param2->unk_00], 1, GAME_LANGUAGE); - sub_0200B5CC(param0->unk_10.unk_B8, 1, GetBoxMon(param0->unk_10.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_10.unk_B8, 1, Pokemon_GetBoxPokemon(param0->unk_10.unk_00->unk_00[param2->unk_00])); break; case 3: sub_0200B60C(param0->unk_10.unk_B8, 0, param2->unk_04, 1, 0, 1); sub_0200B48C(param0->unk_10.unk_B8, 1, param0->unk_00->unk_00.unk_D8[param2->unk_00], param0->unk_00->unk_00.unk_F8[param2->unk_00], 1, GAME_LANGUAGE); - sub_0200B5CC(param0->unk_10.unk_B8, 2, GetBoxMon(param0->unk_10.unk_00->unk_00[param2->unk_00])); + sub_0200B5CC(param0->unk_10.unk_B8, 2, Pokemon_GetBoxPokemon(param0->unk_10.unk_00->unk_00[param2->unk_00])); break; default: GF_ASSERT(FALSE); @@ -343,7 +343,7 @@ void ov17_02250B00 (UnkStruct_ov17_0224FCA0 * param0) for (v3 = 0; v3 < 4; v3++) { v4 = param0->unk_39A.unk_30[v3]; - GetMonData(param0->unk_10.unk_00->unk_00[v4], MON_DATA_119, v2); + Pokemon_GetValue(param0->unk_10.unk_00->unk_00[v4], MON_DATA_119, v2); sub_0201ADA4(¶m0->unk_10.unk_24[1 + v3], 0x0); sub_0201ADA4(¶m0->unk_10.unk_24[5 + v3], 0x0); sub_0201D78C(¶m0->unk_10.unk_24[1 + v3], 0, v2, 0, 3, 0, ((u32)(((1 & 0xff) << 16) | ((2 & 0xff) << 8) | ((0 & 0xff) << 0))), NULL); diff --git a/src/overlay017/ov17_02251D6C.c b/src/overlay017/ov17_02251D6C.c index dd0ce0a35b..7f8acc61fe 100644 --- a/src/overlay017/ov17_02251D6C.c +++ b/src/overlay017/ov17_02251D6C.c @@ -677,8 +677,8 @@ static void ov17_0225266C (UnkStruct_0201CD38 * param0, void * param1) { int v1, v2; - v1 = GetMonData(v0->unk_00->unk_10.unk_00->unk_00[v0->unk_11], MON_DATA_SPECIES, NULL); - v2 = GetMonData(v0->unk_00->unk_10.unk_00->unk_00[v0->unk_11], MON_DATA_FORM, NULL); + v1 = Pokemon_GetValue(v0->unk_00->unk_10.unk_00->unk_00[v0->unk_11], MON_DATA_SPECIES, NULL); + v2 = Pokemon_GetValue(v0->unk_00->unk_10.unk_00->unk_00[v0->unk_11], MON_DATA_FORM, NULL); sub_02077D3C(v0->unk_00->unk_00->unk_14C[v0->unk_11], 0, v1, v2, 0, 127, NULL, 24); } v0->unk_10++; diff --git a/src/overlay019/ov19_021D0D80.c b/src/overlay019/ov19_021D0D80.c index 8ff02ae7b0..0274627792 100644 --- a/src/overlay019/ov19_021D0D80.c +++ b/src/overlay019/ov19_021D0D80.c @@ -1206,7 +1206,7 @@ static void ov19_021D2308 (UnkStruct_ov19_021D5DF8 * param0, u32 * param1) case 3: switch (param0->unk_1B8) { case UnkEnum_021DFB94_46: - if ((ov19_021D5F7C(¶m0->unk_00) == 112) && (GetBoxMonData(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { + if ((ov19_021D5F7C(¶m0->unk_00) == 112) && (BoxPokemon_GetValue(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { sub_0200B70C(param0->unk_19C, 0, 112); ov19_021D5408(¶m0->unk_00, 45); ov19_021D6594(param0->unk_114, 24); @@ -1246,7 +1246,7 @@ static void ov19_021D2308 (UnkStruct_ov19_021D5DF8 * param0, u32 * param1) ov19_021D5408(¶m0->unk_00, 24); ov19_021D6594(param0->unk_114, 24); (*param1) = 7; - } else if ((param0->unk_00.unk_112 == 112) && (GetBoxMonData(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { + } else if ((param0->unk_00.unk_112 == 112) && (BoxPokemon_GetValue(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { sub_0200B70C(param0->unk_19C, 0, 112); ov19_021D5408(¶m0->unk_00, 45); ov19_021D6594(param0->unk_114, 24); @@ -1833,7 +1833,7 @@ static BOOL ov19_021D2DD0 (const UnkStruct_ov19_021D4DF0 * param0) v4 = v3 + (v6->unk_0C[v1] - v2); v0 = sub_02079C9C(param0->unk_00, 0xffffffff, v4); - if (GetBoxMonData(v0, MON_DATA_172, NULL)) { + if (BoxPokemon_GetValue(v0, MON_DATA_172, NULL)) { return 0; } } @@ -2175,13 +2175,13 @@ static BOOL ov19_021D34E4 (UnkStruct_ov19_021D5DF8 * param0) for (v1 = 0, v2 = 0; v1 < v3; v1++) { v0 = Party_GetPokemonBySlotIndex(param0->unk_124, v1); - v4 = DecryptMon(v0); + v4 = Pokemon_EnterDecryptionContext(v0); - if ((GetMonData(v0, MON_DATA_173, NULL) == 0) && (GetMonData(v0, MON_DATA_CURRENT_HP, NULL) != 0)) { + if ((Pokemon_GetValue(v0, MON_DATA_173, NULL) == 0) && (Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, NULL) != 0)) { v2++; } - EncryptMon(v0, v4); + Pokemon_ExitDecryptionContext(v0, v4); if (v2 >= 2) { return 0; @@ -2429,7 +2429,7 @@ static void ov19_021D3978 (UnkStruct_0201CD38 * param0, void * param1) for (v2 = v0->unk_03; v2 < v4; v2++) { v1 = sub_02079C9C(v0->unk_14, v0->unk_02, v2); - if (GetBoxMonData(v1, MON_DATA_172, NULL)) { + if (BoxPokemon_GetValue(v1, MON_DATA_172, NULL)) { for (v3 = 0; v3 < (NELEMS(Unk_ov19_021DFDF0)); v3++) { if (ov19_021D3AC8(v1, Unk_ov19_021DFDF0[v3])) { v0->unk_08[v3]++; @@ -2484,20 +2484,20 @@ static BOOL ov19_021D3AC8 (BoxPokemon * param0, u16 param1) BOOL v0, v1; v0 = 0; - v1 = DecryptBoxMon(param0); + v1 = BoxPokemon_EnterDecryptionContext(param0); - if (GetBoxMonData(param0, MON_DATA_173, NULL) == 0) { + if (BoxPokemon_GetValue(param0, MON_DATA_173, NULL) == 0) { int v2; for (v2 = 0; v2 < 4; v2++) { - if (GetBoxMonData(param0, MON_DATA_MOVE1 + v2, NULL) == param1) { + if (BoxPokemon_GetValue(param0, MON_DATA_MOVE1 + v2, NULL) == param1) { v0 = 1; break; } } } - EncryptBoxMon(param0, v1); + BoxPokemon_ExitDecryptionContext(param0, v1); return v0; } @@ -2641,7 +2641,7 @@ static void ov19_021D3D44 (UnkStruct_ov19_021D5DF8 * param0, u32 * param1) Heap_FreeToHeap(param0->unk_214); Overlay_UnloadByID(FS_OVERLAY_ID(overlay84)); - if ((v1 == 112) && (GetBoxMonData(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { + if ((v1 == 112) && (BoxPokemon_GetValue(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { (void)0; } else if (v1 != 0) { sub_0207D60C(sub_0207D990(param0->unk_11C), v1, 1, 9); @@ -2665,7 +2665,7 @@ static void ov19_021D3D44 (UnkStruct_ov19_021D5DF8 * param0, u32 * param1) if (ov19_021D6600(param0->unk_114, 2)) { if (v1 == 0) { ov19_021D0EC0(param0); - } else if ((v1 == 112) && (GetBoxMonData(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { + } else if ((v1 == 112) && (BoxPokemon_GetValue(param0->unk_00.unk_4C.unk_00, MON_DATA_SPECIES, NULL) != 487)) { sub_0200B70C(param0->unk_19C, 0, v1); ov19_021D5408(¶m0->unk_00, 45); ov19_021D6594(param0->unk_114, 24); @@ -3320,7 +3320,7 @@ static void ov19_021D4BE0 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_02042434 param0->unk_194 = MessageLoader_Init(0, 26, 202, 9); param0->unk_198 = MessageLoader_Init(0, 26, 610, 9); param0->unk_19C = sub_0200B358(9); - param0->unk_1A0 = Heap_AllocFromHeap(9, PokemonStructSize()); + param0->unk_1A0 = Heap_AllocFromHeap(9, Pokemon_StructSize()); GF_ASSERT(param0->unk_19C); param0->unk_128 = sub_0208712C(9, 2, 0, 8, param0->unk_1A4); @@ -3405,7 +3405,7 @@ static void ov19_021D4DF0 (UnkStruct_ov19_021D5DF8 * param0) static void ov19_021D4E30 (UnkStruct_ov19_021D5594 * param0) { - param0->unk_00 = Heap_AllocFromHeap(9, (5 * 6) * GetBoxPokemonStructSize()); + param0->unk_00 = Heap_AllocFromHeap(9, (5 * 6) * BoxPokemon_GetStructSize()); param0->unk_08 = 0; param0->unk_0B = 0; } @@ -3824,7 +3824,7 @@ static BOOL ov19_021D52F4 (UnkStruct_ov19_021D5DF8 * param0) } if (v2->unk_00) { - if (GetBoxMonData(v2->unk_00, MON_DATA_172, NULL)) { + if (BoxPokemon_GetValue(v2->unk_00, MON_DATA_172, NULL)) { v2->unk_0A = 1; if (!(ov19_021D5E38(v0) & 6)) { @@ -3888,11 +3888,11 @@ static void ov19_021D5420 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D UnkStruct_ov19_021D3CFC * v1 = ¶m1->unk_08; if (ov19_021D5E10(param1) == 0) { - MI_CpuCopy32(v1->unk_00, v0->unk_00, GetBoxPokemonStructSize()); + MI_CpuCopy32(v1->unk_00, v0->unk_00, BoxPokemon_GetStructSize()); sub_02079968(param0->unk_120, 0xffffffff, v1->unk_07); v0->unk_0B = 0; } else { - MI_CpuCopy32(v1->unk_00, v0->unk_00, GetPokemonStructSize()); + MI_CpuCopy32(v1->unk_00, v0->unk_00, Pokemon_GetStructSize()); Party_RemovePokemonBySlotIndex(param0->unk_124, v1->unk_08); v0->unk_0B = 1; } @@ -3917,7 +3917,7 @@ static void ov19_021D54A4 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D v11->unk_0A = 1; v7 = ov19_021D5E24(param1); - v9 = GetBoxPokemonStructSize(); + v9 = BoxPokemon_GetStructSize(); v8 = 0; v12 = (void *)(v11->unk_00); @@ -3929,7 +3929,7 @@ static void ov19_021D54A4 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D for (v0 = v2; v0 <= v3; v0++) { v10 = sub_02079C9C(param0->unk_120, 0xffffffff, v6); - if (GetBoxMonData(v10, MON_DATA_172, NULL)) { + if (BoxPokemon_GetValue(v10, MON_DATA_172, NULL)) { MI_CpuCopy32(v10, v12, v9); sub_02079968(param0->unk_120, 0xffffffff, v6); (u8 *)v12 += v9; @@ -3978,18 +3978,18 @@ static void ov19_021D55C4 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D BOOL v5; if (ov19_021D5E10(param1) == 0) { - v4 = GetBoxMonData(v0->unk_00, MON_DATA_FORM, NULL); + v4 = BoxPokemon_GetValue(v0->unk_00, MON_DATA_FORM, NULL); sub_02079914(param0->unk_120, 0xffffffff, v1->unk_07, v0->unk_00); v2 = sub_02079C9C(param0->unk_120, 0xffffffff, v1->unk_07); - if ((GetBoxMonData(v2, MON_DATA_SPECIES, NULL) == 492) && (v4 == 1)) { + if ((BoxPokemon_GetValue(v2, MON_DATA_SPECIES, NULL) == 492) && (v4 == 1)) { v3 = 1; } } else { if (v0->unk_0B) { Party_AddPokemon(param0->unk_124, (Pokemon *)(v0->unk_00)); } else { - sub_020774C8(v0->unk_00, param0->unk_1A0); + Pokemon_FromBoxPokemon(v0->unk_00, param0->unk_1A0); Party_AddPokemon(param0->unk_124, param0->unk_1A0); } @@ -4017,7 +4017,7 @@ static void ov19_021D56AC (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D v3 = ov19_021D5F3C(param1); v2 = v7->unk_09; - v5 = GetBoxPokemonStructSize(); + v5 = BoxPokemon_GetStructSize(); v0 = v7->unk_00; for (v1 = 0; v1 < v7->unk_08; v1++) { @@ -4041,7 +4041,7 @@ static void ov19_021D5734 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D UnkStruct_ov19_021D3CFC * v3; v2 = ¶m1->unk_14; - v0 = GetPokemonStructSize(); + v0 = Pokemon_GetStructSize(); v1 = (u8 *)(v2->unk_00) + v0; v3 = ¶m1->unk_08; @@ -4053,7 +4053,7 @@ static void ov19_021D5734 (UnkStruct_ov19_021D5DF8 * param0, UnkStruct_ov19_021D v2->unk_0B = 0; } else { if (v2->unk_0B == 0) { - sub_020774C8(v1, param0->unk_1A0); + Pokemon_FromBoxPokemon(v1, param0->unk_1A0); } else { MI_CpuCopy32(v1, param0->unk_1A0, v0); } @@ -4111,7 +4111,7 @@ static void ov19_021D5834 (UnkStruct_ov19_021D5DF8 * param0) v1 = &v0->unk_08; v2 = &v0->unk_14; - ZeroBoxMonData(v2->unk_00); + BoxPokemon_Init(v2->unk_00); v1->unk_0B = 1; ov19_021D52F4(param0); } @@ -4142,27 +4142,27 @@ static void ov19_021D5888 (UnkStruct_ov19_021D4DF0 * param0, BoxPokemon * param1 static void ov19_021D58AC (UnkStruct_ov19_021D4DF0 * param0, BoxPokemon * param1, UnkStruct_ov19_021D5DF8 * param2) { UnkStruct_ov19_021D5BAC * v0 = &(param0->unk_4C); - BOOL v1 = DecryptBoxMon(param1); + BOOL v1 = BoxPokemon_EnterDecryptionContext(param1); PokemonPersonalData * v2; v0->unk_00 = param1; - v0->unk_04 = GetBoxMonData(param1, MON_DATA_SPECIES, NULL); - v0->unk_06 = GetBoxMonData(param1, MON_DATA_HELD_ITEM, NULL); + v0->unk_04 = BoxPokemon_GetValue(param1, MON_DATA_SPECIES, NULL); + v0->unk_06 = BoxPokemon_GetValue(param1, MON_DATA_HELD_ITEM, NULL); v0->unk_08 = sub_0207A294(sub_0207A274(param2->unk_11C), v0->unk_04); - v0->unk_0F = GetBoxMonData(param1, MON_DATA_173, NULL); - v2 = GetMonPersonalData(v0->unk_04, 9); - v0->unk_0A = GetMonPersonalDataLevel(v2, v0->unk_04, GetBoxMonData(param1, MON_DATA_EXP, NULL)); - v0->unk_0B = GetBoxMonData(param1, MON_DATA_11, NULL); - v0->unk_0C = GetBoxMonData(param1, MON_DATA_177, NULL); - v0->unk_0D = GetBoxMonData(param1, MON_DATA_178, NULL); - - if ((v0->unk_0F == 0) && GetBoxMonData(param1, MON_DATA_176, NULL)) { - v0->unk_0E = GetMonPersonalDataGender(v2, v0->unk_04, GetBoxMonData(param1, MON_DATA_PERSONALITY, NULL)); + v0->unk_0F = BoxPokemon_GetValue(param1, MON_DATA_173, NULL); + v2 = PokemonPersonalData_FromMonSpecies(v0->unk_04, 9); + v0->unk_0A = PokemonPersonalData_GetLevelAt(v2, v0->unk_04, BoxPokemon_GetValue(param1, MON_DATA_EXP, NULL)); + v0->unk_0B = BoxPokemon_GetValue(param1, MON_DATA_11, NULL); + v0->unk_0C = BoxPokemon_GetValue(param1, MON_DATA_177, NULL); + v0->unk_0D = BoxPokemon_GetValue(param1, MON_DATA_178, NULL); + + if ((v0->unk_0F == 0) && BoxPokemon_GetValue(param1, MON_DATA_176, NULL)) { + v0->unk_0E = PokemonPersonalData_GetGenderOf(v2, v0->unk_04, BoxPokemon_GetValue(param1, MON_DATA_PERSONALITY, NULL)); } else { v0->unk_0E = 255; } - GetBoxMonData(param1, MON_DATA_119, v0->unk_14); + BoxPokemon_GetValue(param1, MON_DATA_119, v0->unk_14); if (v0->unk_0F == 0) { MessageLoader_GetStrbuf(param2->unk_190, v0->unk_04, v0->unk_18); @@ -4178,15 +4178,15 @@ static void ov19_021D58AC (UnkStruct_ov19_021D4DF0 * param0, BoxPokemon * param1 } { - u32 v3 = GetBoxMonNature(param1); + u32 v3 = BoxPokemon_GetNature(param1); MessageLoader_GetStrbuf(param2->unk_194, v3, v0->unk_20); - v3 = GetBoxMonData(param1, MON_DATA_ABILITY, NULL); + v3 = BoxPokemon_GetValue(param1, MON_DATA_ABILITY, NULL); MessageLoader_GetStrbuf(param2->unk_198, v3, v0->unk_24); } - FreeMonPersonalData(v2); - EncryptBoxMon(param1, v1); + PokemonPersonalData_Free(v2); + BoxPokemon_ExitDecryptionContext(param1, v1); } static void ov19_021D59F4 (UnkStruct_ov19_021D4DF0 * param0, BoxPokemon * param1, UnkStruct_ov19_021D5DF8 * param2) @@ -4207,28 +4207,28 @@ static void ov19_021D59F4 (UnkStruct_ov19_021D4DF0 * param0, BoxPokemon * param1 } Strbuf_Copy(v1->unk_2C, v0->unk_20); - sub_020774C8(param1, param2->unk_1A0); - - v2 = DecryptMon(param2->unk_1A0); - - v1->unk_0A = GetMonData(param2->unk_1A0, MON_DATA_MAX_HP, NULL); - v1->unk_0C = GetMonData(param2->unk_1A0, MON_DATA_ATK, NULL); - v1->unk_0E = GetMonData(param2->unk_1A0, MON_DATA_DEF, NULL); - v1->unk_10 = GetMonData(param2->unk_1A0, MON_DATA_SP_ATK, NULL); - v1->unk_12 = GetMonData(param2->unk_1A0, MON_DATA_SP_DEF, NULL); - v1->unk_14 = GetMonData(param2->unk_1A0, MON_DATA_SPEED, NULL); - v1->unk_16 = GetMonData(param2->unk_1A0, MON_DATA_COOL, NULL); - v1->unk_18 = GetMonData(param2->unk_1A0, MON_DATA_BEAUTY, NULL); - v1->unk_1A = GetMonData(param2->unk_1A0, MON_DATA_CUTE, NULL); - v1->unk_1C = GetMonData(param2->unk_1A0, MON_DATA_SMART, NULL); - v1->unk_1E = GetMonData(param2->unk_1A0, MON_DATA_TOUGH, NULL); - v1->unk_20[0] = GetMonData(param2->unk_1A0, MON_DATA_MOVE1, NULL); - v1->unk_20[1] = GetMonData(param2->unk_1A0, MON_DATA_MOVE2, NULL); - v1->unk_20[2] = GetMonData(param2->unk_1A0, MON_DATA_MOVE3, NULL); - v1->unk_20[3] = GetMonData(param2->unk_1A0, MON_DATA_MOVE4, NULL); - v1->unk_07 = GetMonData(param2->unk_1A0, MON_DATA_FORM, NULL); - - EncryptMon(param2->unk_1A0, v2); + Pokemon_FromBoxPokemon(param1, param2->unk_1A0); + + v2 = Pokemon_EnterDecryptionContext(param2->unk_1A0); + + v1->unk_0A = Pokemon_GetValue(param2->unk_1A0, MON_DATA_MAX_HP, NULL); + v1->unk_0C = Pokemon_GetValue(param2->unk_1A0, MON_DATA_ATK, NULL); + v1->unk_0E = Pokemon_GetValue(param2->unk_1A0, MON_DATA_DEF, NULL); + v1->unk_10 = Pokemon_GetValue(param2->unk_1A0, MON_DATA_SP_ATK, NULL); + v1->unk_12 = Pokemon_GetValue(param2->unk_1A0, MON_DATA_SP_DEF, NULL); + v1->unk_14 = Pokemon_GetValue(param2->unk_1A0, MON_DATA_SPEED, NULL); + v1->unk_16 = Pokemon_GetValue(param2->unk_1A0, MON_DATA_COOL, NULL); + v1->unk_18 = Pokemon_GetValue(param2->unk_1A0, MON_DATA_BEAUTY, NULL); + v1->unk_1A = Pokemon_GetValue(param2->unk_1A0, MON_DATA_CUTE, NULL); + v1->unk_1C = Pokemon_GetValue(param2->unk_1A0, MON_DATA_SMART, NULL); + v1->unk_1E = Pokemon_GetValue(param2->unk_1A0, MON_DATA_TOUGH, NULL); + v1->unk_20[0] = Pokemon_GetValue(param2->unk_1A0, MON_DATA_MOVE1, NULL); + v1->unk_20[1] = Pokemon_GetValue(param2->unk_1A0, MON_DATA_MOVE2, NULL); + v1->unk_20[2] = Pokemon_GetValue(param2->unk_1A0, MON_DATA_MOVE3, NULL); + v1->unk_20[3] = Pokemon_GetValue(param2->unk_1A0, MON_DATA_MOVE4, NULL); + v1->unk_07 = Pokemon_GetValue(param2->unk_1A0, MON_DATA_FORM, NULL); + + Pokemon_ExitDecryptionContext(param2->unk_1A0, v2); param0->unk_A4.unk_02[param0->unk_A4.unk_00] = 1; } @@ -4264,7 +4264,7 @@ static void ov19_021D5BAC (UnkStruct_ov19_021D4DF0 * param0) v1 = param0->unk_74.unk_22; v0->unk_0B = v1; - SetBoxMonData(v0->unk_00, 11, &(v1)); + BoxPokemon_SetValue(v0->unk_00, 11, &(v1)); if ((ov19_021D5E10(param0) == 0) && (ov19_021D5E38(param0) == 1)) { sub_02024804(); @@ -4289,20 +4289,20 @@ static void ov19_021D5BE8 (UnkStruct_ov19_021D4DF0 * param0, u16 param1, UnkStru sub_02079C50(param2->unk_120, 0xffffffff, v1, 6, ¶m1); } - SetBoxMonData(v0->unk_00, 6, ¶m1); + BoxPokemon_SetValue(v0->unk_00, 6, ¶m1); { - int v2 = GetBoxMonData(v0->unk_00, MON_DATA_SPECIES, NULL); + int v2 = BoxPokemon_GetValue(v0->unk_00, MON_DATA_SPECIES, NULL); if (v2 == 493) { - SetBoxArceusForm(v0->unk_00); - v0->unk_0C = GetBoxMonData(v0->unk_00, MON_DATA_177, NULL); - v0->unk_0D = GetBoxMonData(v0->unk_00, MON_DATA_178, NULL); + BoxPokemon_SetArceusForm(v0->unk_00); + v0->unk_0C = BoxPokemon_GetValue(v0->unk_00, MON_DATA_177, NULL); + v0->unk_0D = BoxPokemon_GetValue(v0->unk_00, MON_DATA_178, NULL); } else if (v2 == 487) { int v3; - SetBoxGiratinaForm(v0->unk_00); - v3 = GetBoxMonData(v0->unk_00, MON_DATA_ABILITY, NULL); + BoxPokemon_SetGiratinaForm(v0->unk_00); + v3 = BoxPokemon_GetValue(v0->unk_00, MON_DATA_ABILITY, NULL); MessageLoader_GetStrbuf(param2->unk_198, v3, v0->unk_24); } } @@ -4691,24 +4691,24 @@ static u32 ov19_021D5FD0 (UnkStruct_ov19_021D4DF0 * param0, int param1, void * p { if (ov19_021D5E38(param0) == 1) { if (ov19_021D5E10(param0) == 0) { - return GetBoxMonData(param0->unk_4C.unk_00, param1, param2); + return BoxPokemon_GetValue(param0->unk_4C.unk_00, param1, param2); } } else { UnkStruct_ov19_021D5594 * v0 = ¶m0->unk_14; if (v0->unk_0B == 0) { - return GetBoxMonData(param0->unk_4C.unk_00, param1, param2); + return BoxPokemon_GetValue(param0->unk_4C.unk_00, param1, param2); } } - return GetMonData(param0->unk_4C.unk_00, param1, param2); + return Pokemon_GetValue(param0->unk_4C.unk_00, param1, param2); } static u32 ov19_021D6014 (UnkStruct_ov19_021D4DF0 * param0, int param1, void * param2) { if (ov19_021D5E10(param0) == 0) { - return GetBoxMonData(param0->unk_4C.unk_00, param1, param2); + return BoxPokemon_GetValue(param0->unk_4C.unk_00, param1, param2); } else { - return GetMonData(param0->unk_08.unk_00, param1, param2); + return Pokemon_GetValue(param0->unk_08.unk_00, param1, param2); } } diff --git a/src/overlay019/ov19_021D79F8.c b/src/overlay019/ov19_021D79F8.c index 4c79918ef1..81c31c2330 100644 --- a/src/overlay019/ov19_021D79F8.c +++ b/src/overlay019/ov19_021D79F8.c @@ -396,7 +396,7 @@ static void ov19_021D803C (UnkStruct_ov19_021D8318 * param0, UnkStruct_ov19_021D if (param1->unk_00 == NULL) { v1 = sub_02079C9C(v0, param0->unk_30, v3); - if (GetBoxMonData(v1, MON_DATA_172, NULL)) { + if (BoxPokemon_GetValue(v1, MON_DATA_172, NULL)) { ov19_021DA548(param0->unk_58F0, v1, param0->unk_5814[v3], param0->unk_57D8[v3], param0->unk_CD8[v3], param2, 40 + 24 * v2, 2, ov19_021D85B4(v3), v4, param1); } } @@ -433,7 +433,7 @@ static void ov19_021D813C (UnkStruct_ov19_021D8318 * param0, u32 param1) for (v2 = 0; v2 < (5 * 6); v2++) { v1 = sub_02079C9C(v0, param1, v2); - v3 = GetBoxMonData(v1, MON_DATA_SPECIES, NULL); + v3 = BoxPokemon_GetValue(v1, MON_DATA_SPECIES, NULL); if (v3) { param0->unk_5814[v2] = v3; @@ -601,7 +601,7 @@ void ov19_021D84E0 (UnkStruct_ov19_021D8318 * param0) for (v0 = 0; v0 < (5 * 6); v0++) { v2 = sub_02079C9C(param0->unk_58F8->unk_00, v1, v0); - if (GetBoxMonData(v2, MON_DATA_172, NULL)) { + if (BoxPokemon_GetValue(v2, MON_DATA_172, NULL)) { if (param0->unk_A8[param0->unk_02][v0].unk_00 == NULL) { int v3, v4, v5; @@ -665,7 +665,7 @@ static void ov19_021D85C4 (UnkStruct_ov19_021D8318 * param0, UnkStruct_ov19_021D for (v3 = 0; v3 < 5; v3++) { for (v2 = 0; v2 < 6; v2++) { v0 = sub_02079C9C(param1->unk_40->unk_00, param2, v4); - v1 = GetBoxMonData((BoxPokemon *)v0, MON_DATA_SPECIES, NULL); + v1 = BoxPokemon_GetValue((BoxPokemon *)v0, MON_DATA_SPECIES, NULL); if (v1 != 0) { ov19_021DA428(param1, v0, 112 + param0->unk_585C + 24 * v2 + param4, 40 + 24 * v3, 2, ov19_021D85B4(v4), v5, param5); diff --git a/src/overlay019/ov19_021DA270.c b/src/overlay019/ov19_021DA270.c index d83397a4ca..58f57a357e 100644 --- a/src/overlay019/ov19_021DA270.c +++ b/src/overlay019/ov19_021DA270.c @@ -129,16 +129,16 @@ void ov19_021DA428 (UnkStruct_ov19_021DA384 * param0, BoxPokemon * param1, s32 p u8 v4; u8 v5; - v5 = DecryptBoxMon(param1); + v5 = BoxPokemon_EnterDecryptionContext(param1); ov19_021D783C(&v1, NULL, ov19_021D77D0(param0->unk_44), param0->unk_10, param0->unk_04, param4); - v2 = GetBoxMonData(param1, MON_DATA_SPECIES, NULL); - v3 = GetBoxMonData(param1, MON_DATA_IS_EGG, NULL); - v4 = GetBoxMonData(param1, MON_DATA_FORM, NULL); + v2 = BoxPokemon_GetValue(param1, MON_DATA_SPECIES, NULL); + v3 = BoxPokemon_GetValue(param1, MON_DATA_IS_EGG, NULL); + v4 = BoxPokemon_GetValue(param1, MON_DATA_FORM, NULL); param7->unk_28 = sub_02079D40((BoxPokemon *)param1); param7->unk_2C = sub_02079EDC(v2, v4, v3); - param7->unk_30 = GetBoxMonData(param1, MON_DATA_HELD_ITEM, NULL); - param7->unk_2E = GetBoxMonData(param1, MON_DATA_11, NULL); + param7->unk_30 = BoxPokemon_GetValue(param1, MON_DATA_HELD_ITEM, NULL); + param7->unk_2E = BoxPokemon_GetValue(param1, MON_DATA_11, NULL); NNS_G2dInitImageProxy(&(param7->unk_04)); NARC_ReadFromMember(param0->unk_48, param7->unk_28, 0, ((4 * 4) * 0x20 + 0x80), param0->unk_4C); @@ -156,7 +156,7 @@ void ov19_021DA428 (UnkStruct_ov19_021DA384 * param0, BoxPokemon * param1, s32 p sub_02021E90(param7->unk_00, 2 + param7->unk_2C); ov19_021DA63C(param0, param7, ov19_021D5EC8(param0->unk_40)); - EncryptBoxMon(param1, v5); + BoxPokemon_ExitDecryptionContext(param1, v5); } void ov19_021DA548 (UnkStruct_ov19_021DA384 * param0, BoxPokemon * param1, u32 param2, u32 param3, u8 * param4, s32 param5, s32 param6, u32 param7, u32 param8, u32 param9, UnkStruct_ov19_021DCD18 * param10) @@ -166,16 +166,16 @@ void ov19_021DA548 (UnkStruct_ov19_021DA384 * param0, BoxPokemon * param1, u32 p BOOL v2; u8 v3, v4; - v2 = DecryptBoxMon(param1); - v3 = GetBoxMonData(param1, MON_DATA_IS_EGG, NULL); - v4 = GetBoxMonData(param1, MON_DATA_FORM, NULL); + v2 = BoxPokemon_EnterDecryptionContext(param1); + v3 = BoxPokemon_GetValue(param1, MON_DATA_IS_EGG, NULL); + v4 = BoxPokemon_GetValue(param1, MON_DATA_FORM, NULL); ov19_021D783C(&v1, NULL, ov19_021D77D0(param0->unk_44), param0->unk_10, param0->unk_04, param7); param10->unk_28 = param3; param10->unk_2C = sub_02079EDC(param2, v4, v3); - param10->unk_30 = GetBoxMonData(param1, MON_DATA_HELD_ITEM, NULL); - param10->unk_2E = GetBoxMonData(param1, MON_DATA_11, NULL); + param10->unk_30 = BoxPokemon_GetValue(param1, MON_DATA_HELD_ITEM, NULL); + param10->unk_2E = BoxPokemon_GetValue(param1, MON_DATA_11, NULL); NNS_G2dInitImageProxy(&(param10->unk_04)); NNS_G2dGetUnpackedCharacterData(param4, &v0); @@ -192,7 +192,7 @@ void ov19_021DA548 (UnkStruct_ov19_021DA384 * param0, BoxPokemon * param1, u32 p sub_02021E90(param10->unk_00, 2 + param10->unk_2C); ov19_021DA63C(param0, param10, ov19_021D5EC8(param0->unk_40)); - EncryptBoxMon(param1, v2); + BoxPokemon_ExitDecryptionContext(param1, v2); } void ov19_021DA63C (UnkStruct_ov19_021DA384 * param0, UnkStruct_ov19_021DCD18 * param1, u32 param2) diff --git a/src/overlay019/ov19_021DB8E4.c b/src/overlay019/ov19_021DB8E4.c index 9ea03402f9..146207629d 100644 --- a/src/overlay019/ov19_021DB8E4.c +++ b/src/overlay019/ov19_021DB8E4.c @@ -250,14 +250,14 @@ void ov19_021DBBA8 (UnkStruct_ov19_021DBA9C * param0, u32 param1, u32 param2, NN for (v3 = 0, v4 = 0; v3 < 5; v3++) { for (v2 = 0; v2 < 6; v2++) { v1 = sub_02079C9C(v0, param1, v4++); - v7 = DecryptBoxMon(v1); - v5 = GetBoxMonData(v1, MON_DATA_SPECIES, NULL); + v7 = BoxPokemon_EnterDecryptionContext(v1); + v5 = BoxPokemon_GetValue(v1, MON_DATA_SPECIES, NULL); if (v5) { - if (GetBoxMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - u16 v9 = GetBoxMonData(v1, MON_DATA_FORM, NULL); + if (BoxPokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + u16 v9 = BoxPokemon_GetValue(v1, MON_DATA_FORM, NULL); - v6 = GetMonFormPersonalDataAttribute(v5, v9, 27); + v6 = PokemonPersonalData_GetFormValue(v5, v9, 27); } else { v6 = (v5 != 490) ? 8 : 1; } @@ -273,7 +273,7 @@ void ov19_021DBBA8 (UnkStruct_ov19_021DBA9C * param0, u32 param1, u32 param2, NN sub_0201A6D0(&(param0->unk_3C), 10 + v2 * 2, 11 + v3 * 2, 2, 2, v6); } - EncryptBoxMon(v1, v7); + BoxPokemon_ExitDecryptionContext(v1, v7); } } diff --git a/src/overlay021/ov21_021D1FA4.c b/src/overlay021/ov21_021D1FA4.c index 567622f545..39208e18ca 100644 --- a/src/overlay021/ov21_021D1FA4.c +++ b/src/overlay021/ov21_021D1FA4.c @@ -175,7 +175,7 @@ void ov21_021D2188 (UnkStruct_ov21_021D13FC * param0, int param1, int param2, in } if (param2 == -1) { - param2 = GetMonPersonalityGender(param1, 0); + param2 = Pokemon_GetGenderOf(param1, 0); } sub_02075FB4(&v0, param1, param2, param3, param4, param5, param6); diff --git a/src/overlay021/ov21_021DE668.c b/src/overlay021/ov21_021DE668.c index 98183221ca..184f7b6cf6 100644 --- a/src/overlay021/ov21_021DE668.c +++ b/src/overlay021/ov21_021DE668.c @@ -641,8 +641,8 @@ static void ov21_021DF098 (UnkStruct_ov21_021DF374 * param0, UnkStruct_ov21_021D int v4, v5; int v6 = ov21_021D33D4(param2->unk_04, v3); - v4 = GetMonFormPersonalDataAttribute(v3, v6, 6); - v5 = GetMonFormPersonalDataAttribute(v3, v6, 7); + v4 = PokemonPersonalData_GetFormValue(v3, v6, 6); + v5 = PokemonPersonalData_GetFormValue(v3, v6, 7); v4 = ov21_021DF180(v4); v5 = ov21_021DF180(v5); diff --git a/src/overlay021/ov21_021DF734.c b/src/overlay021/ov21_021DF734.c index 874b657f50..9f6ee3d56b 100644 --- a/src/overlay021/ov21_021DF734.c +++ b/src/overlay021/ov21_021DF734.c @@ -803,7 +803,7 @@ static int ov21_021E02F0 (int param0, const UnkStruct_ov21_021DF844 * param1) int v0; int v1; - v0 = GetMonSpeciesPersonalDataAttribute(param0, 18); + v0 = PokemonPersonalData_GetSpeciesValue(param0, 18); if (v0 == 0) { return 1; diff --git a/src/overlay021/ov21_021E8D48.c b/src/overlay021/ov21_021E8D48.c index 826649bbc3..9873902bf9 100644 --- a/src/overlay021/ov21_021E8D48.c +++ b/src/overlay021/ov21_021E8D48.c @@ -153,8 +153,8 @@ UnkStruct_ov21_021E8D48 * ov21_021E8D48 (const UnkStruct_ov21_021E8E0C * param0) u32 v1; u32 v2; - v1 = GetMonData(param0->unk_10, MON_DATA_SPECIES, NULL); - v2 = GetMonData(param0->unk_10, MON_DATA_FORM, NULL); + v1 = Pokemon_GetValue(param0->unk_10, MON_DATA_SPECIES, NULL); + v2 = Pokemon_GetValue(param0->unk_10, MON_DATA_FORM, NULL); if (v1 == 487) { sub_02098988(v2); @@ -205,8 +205,8 @@ static void ov21_021E8E0C (UnkStruct_ov21_021E8D48 * param0, const UnkStruct_ov2 NARC * v1 = NARC_ctor(NARC_INDEX_RESOURCE__ENG__ZUKAN__ZUKAN, param1->unk_0C); int v2; - param0->unk_220 = GetMonData(param1->unk_10, MON_DATA_SPECIES, NULL); - v2 = GetMonData(param1->unk_10, MON_DATA_FORM, NULL); + param0->unk_220 = Pokemon_GetValue(param1->unk_10, MON_DATA_SPECIES, NULL); + v2 = Pokemon_GetValue(param1->unk_10, MON_DATA_FORM, NULL); param0->unk_00 = param1->unk_00; param0->unk_19C = sub_020095C4(32, ¶m0->unk_10, param1->unk_0C); @@ -603,8 +603,8 @@ static void ov21_021E95F8 (UnkStruct_ov21_021E968C * param0, UnkStruct_020218BC UnkStruct_ov19_021DA864 v1; int v2, v3; - v2 = GetMonSpeciesPersonalDataAttribute(param4, 6); - v3 = GetMonSpeciesPersonalDataAttribute(param4, 7); + v2 = PokemonPersonalData_GetSpeciesValue(param4, 6); + v3 = PokemonPersonalData_GetSpeciesValue(param4, 7); v2 = ov21_021DF180(v2); v3 = ov21_021DF180(v3); diff --git a/src/overlay022/ov22_02259098.c b/src/overlay022/ov22_02259098.c index a15b11cc51..ca4ff85794 100644 --- a/src/overlay022/ov22_02259098.c +++ b/src/overlay022/ov22_02259098.c @@ -42,7 +42,7 @@ void ov22_022590C0 (UnkStruct_020298D8 * param0, UnkStruct_02007768 * param1, Po void ov22_022590D4 (UnkStruct_020298D8 * param0, UnkStruct_02007768 * param1, Pokemon * param2, UnkStruct_02008A90 * param3, int param4, BOOL param5) { - int v0 = GetMonData(param2, MON_DATA_SPECIES, NULL); + int v0 = Pokemon_GetValue(param2, MON_DATA_SPECIES, NULL); sub_02075F00(param3, param2, 2); param0->unk_00 = sub_02007C34(param1, param3, 192, 56, 0, 0, NULL, NULL); diff --git a/src/overlay022/ov22_0225AF8C.c b/src/overlay022/ov22_0225AF8C.c index 09a9dd52f6..d3ec1dbe48 100644 --- a/src/overlay022/ov22_0225AF8C.c +++ b/src/overlay022/ov22_0225AF8C.c @@ -243,7 +243,7 @@ static UnkStruct_ov22_0225B1BC * ov22_0225B1BC (const UnkStruct_ov22_0225B4E4 * memset(v0, 0, sizeof(UnkStruct_ov22_0225B1BC)); v0->unk_29C = param0->unk_68; - v0->unk_298 = AllocMonZeroed(param0->unk_68); + v0->unk_298 = Pokemon_New(param0->unk_68); sub_0202A61C(param0->unk_00, v0->unk_298); ov22_0225B2D4(v0, param0); @@ -273,7 +273,7 @@ static UnkStruct_ov22_0225B1BC * ov22_0225B258 (const UnkStruct_ov22_0225B4E4 * memset(v0, 0, sizeof(UnkStruct_ov22_0225B1BC)); v0->unk_29C = param0->unk_68; - v0->unk_298 = AllocMonZeroed(param0->unk_68); + v0->unk_298 = Pokemon_New(param0->unk_68); sub_0202A61C(param0->unk_00, v0->unk_298); diff --git a/src/overlay022/ov22_0225B660.c b/src/overlay022/ov22_0225B660.c index bc230fac91..eff0a09c6e 100644 --- a/src/overlay022/ov22_0225B660.c +++ b/src/overlay022/ov22_0225B660.c @@ -349,9 +349,9 @@ static void ov22_0225BC18 (UnkStruct_ov22_0225B85C * param0) sub_0202A524(param0->unk_04, v2); sub_0200B48C(v1, 3, v2, v4, 1, GAME_LANGUAGE); - v5 = AllocMonZeroed(13); + v5 = Pokemon_New(13); sub_0202A560(param0->unk_04, v5); - v6 = GetBoxMon(v5); + v6 = Pokemon_GetBoxPokemon(v5); sub_0200B5CC(v1, 4, v6); Heap_FreeToHeap(v5); diff --git a/src/overlay032/ov32_022561C0.c b/src/overlay032/ov32_022561C0.c index d51431afe8..6bf509b8ea 100644 --- a/src/overlay032/ov32_022561C0.c +++ b/src/overlay032/ov32_022561C0.c @@ -206,17 +206,17 @@ static void ov32_022563C8 (UnkStruct_ov32_02256470_1 * param0, Party * param1) for (v1 = 0; v1 < param0->unk_00; v1++) { v0 = Party_GetPokemonBySlotIndex(param1, v1); - v2 = DecryptMon(v0); + v2 = Pokemon_EnterDecryptionContext(v0); param0->unk_04[v1].unk_00 = sub_02079D40((const BoxPokemon *)v0); - param0->unk_04[v1].unk_04 = GetMonData(v0, MON_DATA_SPECIES, NULL); - param0->unk_04[v1].unk_06 = GetMonData(v0, MON_DATA_CURRENT_HP, NULL); - param0->unk_04[v1].unk_08 = GetMonData(v0, MON_DATA_MAX_HP, NULL); - param0->unk_04[v1].unk_0A = GetMonData(v0, MON_DATA_HELD_ITEM, NULL); - param0->unk_04[v1].unk_0C = (GetMonData(v0, MON_DATA_160, NULL) != 0); - param0->unk_04[v1].unk_0E = GetMonData(v0, MON_DATA_IS_EGG, NULL); - param0->unk_04[v1].unk_0F = GetMonData(v0, MON_DATA_FORM, NULL); - - EncryptMon(v0, v2); + param0->unk_04[v1].unk_04 = Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); + param0->unk_04[v1].unk_06 = Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, NULL); + param0->unk_04[v1].unk_08 = Pokemon_GetValue(v0, MON_DATA_MAX_HP, NULL); + param0->unk_04[v1].unk_0A = Pokemon_GetValue(v0, MON_DATA_HELD_ITEM, NULL); + param0->unk_04[v1].unk_0C = (Pokemon_GetValue(v0, MON_DATA_160, NULL) != 0); + param0->unk_04[v1].unk_0E = Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL); + param0->unk_04[v1].unk_0F = Pokemon_GetValue(v0, MON_DATA_FORM, NULL); + + Pokemon_ExitDecryptionContext(v0, v2); } } diff --git a/src/overlay033/ov33_022561C0.c b/src/overlay033/ov33_022561C0.c index 477cf02f99..a45179caf7 100644 --- a/src/overlay033/ov33_022561C0.c +++ b/src/overlay033/ov33_022561C0.c @@ -87,11 +87,11 @@ static BOOL ov33_0225621C (UnkStruct_ov33_0225621C * param0, UnkStruct_ov25_0225 for (v2 = 0; v2 < param0->unk_04.unk_00; v2++) { v1 = Party_GetPokemonBySlotIndex(v0, v2); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - param0->unk_04.unk_04[v4].unk_04 = GetMonData(v1, MON_DATA_SPECIES, NULL); - param0->unk_04.unk_04[v4].unk_08 = GetMonData(v1, MON_DATA_FORM, NULL); + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + param0->unk_04.unk_04[v4].unk_04 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); + param0->unk_04.unk_04[v4].unk_08 = Pokemon_GetValue(v1, MON_DATA_FORM, NULL); param0->unk_04.unk_04[v4].unk_00 = sub_02079D40((const BoxPokemon *)v1); - v3 = ov33_0225630C(GetMonData(v1, MON_DATA_FRIENDSHIP, NULL)); + v3 = ov33_0225630C(Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL)); switch (v3) { case 0: diff --git a/src/overlay033/ov33_02256474.c b/src/overlay033/ov33_02256474.c index f75bea7c03..5db74dd6a1 100644 --- a/src/overlay033/ov33_02256474.c +++ b/src/overlay033/ov33_02256474.c @@ -293,7 +293,7 @@ static void ov33_02256634 (UnkStruct_ov33_02256474 * param0, const UnkStruct_ov3 GF_ASSERT(0); } - param0->unk_134[v5].unk_30 = GetMonFormPersonalDataAttribute(param1->unk_04[v5].unk_04, param1->unk_04[v5].unk_08, 28); + param0->unk_134[v5].unk_30 = PokemonPersonalData_GetFormValue(param1->unk_04[v5].unk_04, param1->unk_04[v5].unk_08, 28); param0->unk_134[v5].unk_31 = 0; param0->unk_134[v5].unk_32 = 0; diff --git a/src/overlay040/ov40_022561C0.c b/src/overlay040/ov40_022561C0.c index a328107c91..2acf86fffe 100644 --- a/src/overlay040/ov40_022561C0.c +++ b/src/overlay040/ov40_022561C0.c @@ -217,14 +217,14 @@ static void ov40_022563D0 (UnkStruct_ov40_0225645C_1 * param0, UnkStruct_0202631 for (v2 = 0; v2 < param0->unk_00; v2++) { v0 = sub_02026218(param1, v2); v1 = sub_02026220(v0); - v3 = DecryptBoxMon(v1); + v3 = BoxPokemon_EnterDecryptionContext(v1); param0->unk_04[v2] = sub_02079D40(v1); - param0->unk_1C[v2] = GetBoxMonData(v1, MON_DATA_SPECIES, NULL); - param0->unk_20[v2] = GetBoxMonData(v1, MON_DATA_FORM, NULL); + param0->unk_1C[v2] = BoxPokemon_GetValue(v1, MON_DATA_SPECIES, NULL); + param0->unk_20[v2] = BoxPokemon_GetValue(v1, MON_DATA_FORM, NULL); param0->unk_0C[v2] = ov5_021E6590(v0); - param0->unk_14[v2] = GetBoxMonGender(v1); + param0->unk_14[v2] = BoxPokemon_GetGender(v1); - EncryptBoxMon(v1, v3); + BoxPokemon_ExitDecryptionContext(v1, v3); } } diff --git a/src/overlay040/ov40_0225645C.c b/src/overlay040/ov40_0225645C.c index 576c1b7cd4..8f1467481c 100644 --- a/src/overlay040/ov40_0225645C.c +++ b/src/overlay040/ov40_0225645C.c @@ -394,7 +394,7 @@ static void ov40_02256848 (UnkStruct_ov40_0225645C * param0, const UnkStruct_ov4 ov25_02255938(param0->unk_24[2], 1 + sub_02079EDC(1, 0, 1)); if (param1->unk_00 > 0) { - if (GetMonFormPersonalDataAttribute(param1->unk_1C[0], param1->unk_20[0], 28)) { + if (PokemonPersonalData_GetFormValue(param1->unk_1C[0], param1->unk_20[0], 28)) { ov25_022558C4(param0->unk_24[0], 6); } else { ov25_022558C4(param0->unk_24[0], 7); diff --git a/src/overlay044/ov44_022561C0.c b/src/overlay044/ov44_022561C0.c index 70731878cc..34eab1a4f3 100644 --- a/src/overlay044/ov44_022561C0.c +++ b/src/overlay044/ov44_022561C0.c @@ -87,13 +87,13 @@ static BOOL ov44_0225621C (UnkStruct_ov44_0225621C * param0, UnkStruct_ov25_0225 for (v2 = 0; v2 < param0->unk_04.unk_30; v2++) { v1 = Party_GetPokemonBySlotIndex(v0, v2); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL)) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL)) { continue; } param0->unk_04.unk_00[v3] = sub_02079D40((const BoxPokemon *)v1); - param0->unk_04.unk_18[v3] = GetMonData(v1, MON_DATA_SPECIES, NULL); - param0->unk_04.unk_24[v3] = GetMonData(v1, MON_DATA_FORM, NULL); + param0->unk_04.unk_18[v3] = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); + param0->unk_04.unk_24[v3] = Pokemon_GetValue(v1, MON_DATA_FORM, NULL); param0->unk_48[v3] = (BoxPokemon *)v1; v3++; } diff --git a/src/overlay044/ov44_022565BC.c b/src/overlay044/ov44_022565BC.c index 684ee1f1a3..54f4d22287 100644 --- a/src/overlay044/ov44_022565BC.c +++ b/src/overlay044/ov44_022565BC.c @@ -330,7 +330,7 @@ static void ov44_02256954 (UnkStruct_ov44_022565BC * param0, u32 param1, u32 par if (param1 == 5) { v1 = 4; } else { - if (GetMonFormPersonalDataAttribute(param3, param4, 28)) { + if (PokemonPersonalData_GetFormValue(param3, param4, 28)) { v1 = 4; } else { v1 = 5; diff --git a/src/overlay057/ov57_021D0D80.c b/src/overlay057/ov57_021D0D80.c index da1f41344d..60a892b737 100644 --- a/src/overlay057/ov57_021D0D80.c +++ b/src/overlay057/ov57_021D0D80.c @@ -137,7 +137,7 @@ static int ov57_021D0E34 (UnkStruct_020067E8 * param0, int * param1) if (!sub_02025D10(v1) || !sub_02025D40(v1)) { sub_02025DE8(sub_02025CD8(v0)); sub_02025CE4(v1); - SetShayminLandForm(Party_GetFromSavedata(v0)); + Party_SetShayminLandForm(Party_GetFromSavedata(v0)); } sub_02017434(sub_02025E5C(v0)); diff --git a/src/overlay062/ov62_02239D60.c b/src/overlay062/ov62_02239D60.c index ec2b688ba9..6761cb7846 100644 --- a/src/overlay062/ov62_02239D60.c +++ b/src/overlay062/ov62_02239D60.c @@ -1203,15 +1203,15 @@ static void ov62_0223B050 (UnkStruct_0208C06C * param0) v7 = 494; } - v1 = GetMonPersonalData(v7, 102); - v3 = GetMonPersonalityGender(v7, v8); - v4 = GetMonPersonalityShininess(v5, v8); + v1 = PokemonPersonalData_FromMonSpecies(v7, 102); + v3 = Pokemon_GetGenderOf(v7, v8); + v4 = Pokemon_IsPersonalityShiny(v5, v8); v9 = sub_02076648(v7, v3, v10, v6, v8); v9 = 0; sub_02075FB4(&v2, v7, v3, v10, v4, v6, v8); v0->unk_32C = sub_02007C34(param0->unk_14.unk_50, &v2, 42, 91 + v9, 0, 0, NULL, NULL); - FreeMonPersonalData(v1); + PokemonPersonalData_Free(v1); } static void ov62_0223B124 (UnkStruct_0208C06C * param0, int param1) diff --git a/src/overlay062/ov62_02248408.c b/src/overlay062/ov62_02248408.c index bbf4e4f95a..24872b1f0e 100644 --- a/src/overlay062/ov62_02248408.c +++ b/src/overlay062/ov62_02248408.c @@ -71,18 +71,18 @@ void ov62_02248408 (UnkStruct_0202F264 * param0, BattleParams * param1, int para for (v11 = 0; v11 < v12; v11++) { v13 = Party_GetPokemonBySlotIndex(param1->parties[v4], v11); - if (GetMonData(v13, MON_DATA_172, NULL) == 0) { + if (Pokemon_GetValue(v13, MON_DATA_172, NULL) == 0) { break; } MI_CpuClear16(v8, sizeof(u16) * v9); - GetMonData(v13, MON_DATA_117, v8); + Pokemon_GetValue(v13, MON_DATA_117, v8); Strbuf_Clear(v6); Strbuf_CopyChars(v6, v8); if (sub_02002DB4(0, v6, v7) == 0) { - SetMonData(v13, 179, NULL); + Pokemon_SetValue(v13, 179, NULL); continue; } } diff --git a/src/overlay065/ov65_0222DCE0.c b/src/overlay065/ov65_0222DCE0.c index c2240bfa1b..d56a147a8e 100644 --- a/src/overlay065/ov65_0222DCE0.c +++ b/src/overlay065/ov65_0222DCE0.c @@ -668,11 +668,11 @@ static int ov65_0222DF88 (UnkStruct_ov65_0222EBE0 * param0) for (v3 = 0; v3 < v2; v3++) { v1 = Party_GetPokemonBySlotIndex(v0, v3); - if (GetMonData(v1, MON_DATA_CURRENT_HP, NULL) == 0) { + if (Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL) == 0) { continue; } - if (GetMonData(v1, MON_DATA_IS_EGG, NULL)) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL)) { continue; } @@ -1820,8 +1820,8 @@ static void ov65_0222F4C4 (UnkStruct_ov65_0222EBE0 * param0, int param1) for (v5 = 0; v5 < v4; v5++) { Pokemon * v6 = Party_GetPokemonBySlotIndex(v2, v5); - param0->unk_04->unk_00.unk_00[v5] = GetMonData(v6, MON_DATA_SPECIES, NULL); - param0->unk_04->unk_00.unk_0C[v5] = GetMonData(v6, MON_DATA_HELD_ITEM, NULL); + param0->unk_04->unk_00.unk_00[v5] = Pokemon_GetValue(v6, MON_DATA_SPECIES, NULL); + param0->unk_04->unk_00.unk_0C[v5] = Pokemon_GetValue(v6, MON_DATA_HELD_ITEM, NULL); } param0->unk_04->unk_00.unk_18 = sub_02025FCC(v0); diff --git a/src/overlay066/ov66_0222DDF0.c b/src/overlay066/ov66_0222DDF0.c index 3a8523f2da..d350e8b519 100644 --- a/src/overlay066/ov66_0222DDF0.c +++ b/src/overlay066/ov66_0222DDF0.c @@ -2350,9 +2350,9 @@ static void ov66_0222F7C8 (UnkStruct_ov66_0222F6C4 * param0, UnkStruct_021C0794 for (v8 = 0; v8 < 6; v8++) { if (v8 < v7) { v6 = Party_GetPokemonBySlotIndex(v1, v8); - param0->unk_20.unk_20[v8] = GetMonData(v6, MON_DATA_SPECIES, NULL); - param0->unk_20.unk_2C[v8] = GetMonData(v6, MON_DATA_FORM, NULL); - param0->unk_20.unk_32[v8] = GetMonData(v6, MON_DATA_IS_EGG, NULL); + param0->unk_20.unk_20[v8] = Pokemon_GetValue(v6, MON_DATA_SPECIES, NULL); + 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; } diff --git a/src/overlay076/ov76_0223B870.c b/src/overlay076/ov76_0223B870.c index 2a0395fa63..0884accbd7 100644 --- a/src/overlay076/ov76_0223B870.c +++ b/src/overlay076/ov76_0223B870.c @@ -595,9 +595,9 @@ void ov76_0223C188 (UnkStruct_ov76_0223DE00 * param0) param0->unk_2FC[v0] = sub_0200CE6C(param0->unk_D4.unk_08, param0->unk_D4.unk_0C, &v6); - v2 = GetMonData(v5, MON_DATA_SPECIES, NULL); - v1 = GetMonData(v5, MON_DATA_IS_EGG, NULL); - v4 = GetMonData(v5, MON_DATA_FORM, NULL); + v2 = Pokemon_GetValue(v5, MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetValue(v5, MON_DATA_IS_EGG, NULL); + v4 = Pokemon_GetValue(v5, MON_DATA_FORM, NULL); v3 = sub_02079EDC(v2, v4, v1); sub_02021F24(param0->unk_2FC[v0]->unk_00, v3); @@ -873,12 +873,12 @@ void ov76_0223C80C (UnkStruct_ov76_0223DE00 * param0, int param1, int param2) if (v1 != 0xff) { v3 = param2 + 1; - SetMonData(param0->unk_00->unk_04[v1], 162, (u8 *)&v3); + Pokemon_SetValue(param0->unk_00->unk_04[v1], 162, (u8 *)&v3); } if (v2 != 0xff) { v4 = param1 + 1; - SetMonData(param0->unk_00->unk_04[v2], 162, (u8 *)&v4); + Pokemon_SetValue(param0->unk_00->unk_04[v2], 162, (u8 *)&v4); } v0 = param0->unk_04[param1].unk_00; diff --git a/src/overlay076/ov76_0223D338.c b/src/overlay076/ov76_0223D338.c index 89869c77fb..9790e7a0ad 100644 --- a/src/overlay076/ov76_0223D338.c +++ b/src/overlay076/ov76_0223D338.c @@ -112,20 +112,20 @@ void ov76_0223D3CC (UnkStruct_ov76_0223DE00 * param0) if (param0->unk_04[param0->unk_3C4[0]].unk_00 != 0xff) { v2 = param0->unk_00->unk_04[param0->unk_04[param0->unk_3C4[0]].unk_00]; - sub_020775EC(v2, param0->unk_428); + Pokemon_Copy(v2, param0->unk_428); return; } for (v0 = 0; v0 < param0->unk_00->unk_00; v0++) { v2 = param0->unk_00->unk_04[v0]; - v1 = GetMonData(v2, MON_DATA_IS_EGG, NULL); + v1 = Pokemon_GetValue(v2, MON_DATA_IS_EGG, NULL); if (v1 != 0) { continue; } - sub_020775EC(v2, param0->unk_428); + Pokemon_Copy(v2, param0->unk_428); break; } } @@ -718,7 +718,7 @@ void ov76_0223DD88 (UnkStruct_ov76_0223DE00 * param0) sub_02075EF4(&v0, param0->unk_428, 2); - v2 = GetMonData(param0->unk_428, MON_DATA_SPECIES, NULL); + v2 = Pokemon_GetValue(param0->unk_428, MON_DATA_SPECIES, NULL); v3 = sub_020765AC(param0->unk_428, 2); param0->unk_D4.unk_D8 = v3; @@ -731,8 +731,8 @@ static void ov76_0223DE00 (UnkStruct_ov76_0223DE00 * param0) int v0; int v1; - v0 = GetMonData(param0->unk_428, MON_DATA_SPECIES, NULL); - v1 = GetMonNature(param0->unk_428); + v0 = Pokemon_GetValue(param0->unk_428, MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetNature(param0->unk_428); sub_02007B98(param0->unk_D4.unk_D4, 1); sub_020789F4(param0->unk_42C, param0->unk_D4.unk_188, param0->unk_D4.unk_D4, v0, 2, 0, 0); @@ -865,7 +865,7 @@ static BOOL ov76_0223DF94 (UnkStruct_ov76_0223DE00 * param0) v0.unk_18 = 1; v0.unk_1C = param0->unk_D4.unk_08; v0.unk_20 = param0->unk_D4.unk_14; - v0.unk_10 = GetMonData(param0->unk_428, MON_DATA_POKEBALL, NULL); + v0.unk_10 = Pokemon_GetValue(param0->unk_428, MON_DATA_POKEBALL, NULL); param0->unk_D4.unk_158 = ov12_02237728(&v0); param0->unk_3DC++; @@ -882,8 +882,8 @@ static BOOL ov76_0223DF94 (UnkStruct_ov76_0223DE00 * param0) v1 = param0->unk_3C4[0] + 1; ov76_0223B848(&v2, param0); - SetMonData(param0->unk_428, 162, (u8 *)&v1); - SetMonData(param0->unk_428, 171, &v2); + Pokemon_SetValue(param0->unk_428, 162, (u8 *)&v1); + Pokemon_SetValue(param0->unk_428, 171, &v2); param0->unk_D4.unk_154 = ov12_02236004(53, &v3); ov12_02236320(param0->unk_D4.unk_154); @@ -955,7 +955,7 @@ static BOOL ov76_0223DF94 (UnkStruct_ov76_0223DE00 * param0) v5.unk_18 = 1; v5.unk_1C = param0->unk_D4.unk_08; v5.unk_20 = param0->unk_D4.unk_14; - v5.unk_10 = GetMonData(param0->unk_428, MON_DATA_POKEBALL, NULL); + v5.unk_10 = Pokemon_GetValue(param0->unk_428, MON_DATA_POKEBALL, NULL); param0->unk_D4.unk_158 = ov12_02237728(&v5); @@ -1015,7 +1015,7 @@ static BOOL ov76_0223DF94 (UnkStruct_ov76_0223DE00 * param0) if (param0->unk_264[param0->unk_3C4[0]].unk_00 != 0xff) { v8 = param0->unk_00->unk_04[param0->unk_264[param0->unk_3C4[0]].unk_00]; - SetMonData(v8, 171, sub_0202CA28(param0->unk_00->unk_20, param0->unk_3C4[0])); + Pokemon_SetValue(v8, 171, sub_0202CA28(param0->unk_00->unk_20, param0->unk_3C4[0])); } } param0->unk_3D4 = 8; @@ -1244,7 +1244,7 @@ void ov76_0223E91C (UnkStruct_ov76_0223DE00 * param0, int param1) v1 = param0->unk_04[param1].unk_00; if (v1 != 0xff) { - SetMonData(param0->unk_00->unk_04[v1], 162, (u8 *)&v2); + Pokemon_SetValue(param0->unk_00->unk_04[v1], 162, (u8 *)&v2); } param0->unk_04[param1].unk_00 = 0xff; diff --git a/src/overlay078/ov78_021D0D80.c b/src/overlay078/ov78_021D0D80.c index ff03e08b2e..4c8a4573f5 100644 --- a/src/overlay078/ov78_021D0D80.c +++ b/src/overlay078/ov78_021D0D80.c @@ -663,7 +663,7 @@ static void ov78_021D1468 (UnkStruct_02007C7C ** param0, UnkStruct_ov78_021D107C UnkStruct_02008A90 v0; int v1; - v1 = GetMonPersonalityGender(param2, 0); + v1 = Pokemon_GetGenderOf(param2, 0); sub_02075FB4(&v0, param2, v1, 2, 0, NULL, NULL); diff --git a/src/overlay079/ov79_021D2268.c b/src/overlay079/ov79_021D2268.c index 80308c0c75..5905734884 100644 --- a/src/overlay079/ov79_021D2268.c +++ b/src/overlay079/ov79_021D2268.c @@ -527,13 +527,13 @@ static void ov79_021D27AC (UnkStruct_ov79_021D2928 * param0) static void ov79_021D27D8 (UnkStruct_ov79_021D2928 * param0) { param0->unk_30.unk_00 = param0->unk_10->unk_00; - param0->unk_30.unk_04 = GetMonData(param0->unk_10->unk_00, MON_DATA_SPECIES, NULL); - param0->unk_30.unk_07 = GetMonGender(param0->unk_10->unk_00); - param0->unk_30.unk_06 = GetMonNature(param0->unk_10->unk_00); - param0->unk_30.unk_08 = GetMonFormPersonalDataAttribute(param0->unk_30.unk_04, GetMonData(param0->unk_10->unk_00, MON_DATA_FORM, NULL), 28) ^ 1; + param0->unk_30.unk_04 = Pokemon_GetValue(param0->unk_10->unk_00, MON_DATA_SPECIES, NULL); + param0->unk_30.unk_07 = Pokemon_GetGender(param0->unk_10->unk_00); + param0->unk_30.unk_06 = Pokemon_GetNature(param0->unk_10->unk_00); + param0->unk_30.unk_08 = PokemonPersonalData_GetFormValue(param0->unk_30.unk_04, Pokemon_GetValue(param0->unk_10->unk_00, MON_DATA_FORM, NULL), 28) ^ 1; param0->unk_30.unk_0C = Strbuf_Init(12, param0->unk_00); - GetMonData(param0->unk_10->unk_00, MON_DATA_119, param0->unk_30.unk_0C); + Pokemon_GetValue(param0->unk_10->unk_00, MON_DATA_119, param0->unk_30.unk_0C); param0->unk_30.unk_09 = sub_02098EAC(param0->unk_10->unk_04, param0->unk_30.unk_06); } @@ -690,7 +690,7 @@ static int ov79_021D2AF0 (UnkStruct_ov79_021D2928 * param0, UnkStruct_ov79_021D2 { u32 v0; - v0 = GetMonData(param0->unk_30.unk_00, MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param0->unk_30.unk_00, MON_DATA_FORM, NULL); switch (param0->unk_30.unk_09) { case 1: diff --git a/src/overlay081/ov81_021D1610.c b/src/overlay081/ov81_021D1610.c index 78fd750b5d..26add406a5 100644 --- a/src/overlay081/ov81_021D1610.c +++ b/src/overlay081/ov81_021D1610.c @@ -822,10 +822,10 @@ static void ov81_021D285C (UnkStruct_ov81_021D1610 * param0, UnkStruct_0205AA50 static void ov81_021D28C8 (UnkStruct_ov81_021D1610 * param0, u16 param1, u8 param2, u8 param3) { - Pokemon * v0 = AllocMonZeroed(42); + Pokemon * v0 = Pokemon_New(42); sub_02074088(v0, param1, 1, 32, param2, 0, 0); - sub_0200B538(param0->unk_54, param3, GetBoxMon(v0)); + sub_0200B538(param0->unk_54, param3, Pokemon_GetBoxPokemon(v0)); Heap_FreeToHeap(v0); } diff --git a/src/overlay086/ov86_0223B140.c b/src/overlay086/ov86_0223B140.c index 8a392a3068..c7d9046e40 100644 --- a/src/overlay086/ov86_0223B140.c +++ b/src/overlay086/ov86_0223B140.c @@ -328,7 +328,7 @@ int ov86_0223B140 (UnkStruct_020067E8 * param0, int * param1) v2 = Party_GetCurrentCount(v0->unk_0C->unk_04); for (v1 = 0; v1 < v2; v1++) { - if (GetMonData(Party_GetPokemonBySlotIndex(v0->unk_0C->unk_04, v1), MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(Party_GetPokemonBySlotIndex(v0->unk_0C->unk_04, v1), MON_DATA_IS_EGG, NULL) == 0) { v0->unk_2C8[v0->unk_04] = v1; v0->unk_04++; } @@ -861,15 +861,15 @@ static void ov86_0223BAC8 (UnkStruct_ov86_0223B3C8 * param0, NNSG2dCellDataBank v11 = Party_GetPokemonBySlotIndex(param0->unk_0C->unk_04, param0->unk_2C8[v12]); sub_02075EF4(&v1, (Pokemon *)v11, 2); - param0->unk_2E0[v12] = GetMonData((Pokemon *)v11, MON_DATA_SPECIES, NULL); - param0->unk_2F8[v12] = GetMonData((Pokemon *)v11, MON_DATA_FORM, NULL); + param0->unk_2E0[v12] = Pokemon_GetValue((Pokemon *)v11, MON_DATA_SPECIES, NULL); + param0->unk_2F8[v12] = Pokemon_GetValue((Pokemon *)v11, MON_DATA_FORM, NULL); - sub_02013720(v1.unk_00, v1.unk_02, 63, &v0[0], param0->unk_310, GetMonData((Pokemon *)v11, MON_DATA_PERSONALITY, NULL), 1, 2, param0->unk_2E0[v12]); + sub_02013720(v1.unk_00, v1.unk_02, 63, &v0[0], param0->unk_310, Pokemon_GetValue((Pokemon *)v11, MON_DATA_PERSONALITY, NULL), 1, 2, param0->unk_2E0[v12]); DC_FlushRange(param0->unk_310, 3200); GX_LoadOBJ(param0->unk_310, v12 * 2 * 3200, 3200); - sub_02013720(v1.unk_00, v1.unk_02, 63, &v0[1], param0->unk_310, GetMonData((Pokemon *)v11, MON_DATA_PERSONALITY, NULL), 1, 2, param0->unk_2E0[v12]); + sub_02013720(v1.unk_00, v1.unk_02, 63, &v0[1], param0->unk_310, Pokemon_GetValue((Pokemon *)v11, MON_DATA_PERSONALITY, NULL), 1, 2, param0->unk_2E0[v12]); DC_FlushRange(param0->unk_310, 3200); GX_LoadOBJ(param0->unk_310, v12 * 2 * 3200 + 3200, 3200); @@ -1303,10 +1303,10 @@ static void ov86_0223C47C (UnkStruct_ov86_0223C3E4 * param0, int param1) static void ov86_0223C4DC (UnkStruct_ov86_0223C3E4 * param0) { - sub_0200B538(param0->unk_14, 0, GetBoxMon(param0->unk_24)); - sub_0200B60C(param0->unk_14, 1, GetMonLevel(param0->unk_24), 3, 0, 1); + sub_0200B538(param0->unk_14, 0, Pokemon_GetBoxPokemon(param0->unk_24)); + sub_0200B60C(param0->unk_14, 1, Pokemon_GetLevel(param0->unk_24), 3, 0, 1); - switch (GetMonGender(param0->unk_24)) { + switch (Pokemon_GetGender(param0->unk_24)) { case 0: MessageLoader_GetStrbuf(param0->unk_20, 1, param0->unk_18); break; @@ -1329,7 +1329,7 @@ static void ov86_0223C54C (UnkStruct_ov86_0223C3E4 * param0) switch (v0) { case 0: case 1: - sub_0200B8C8(param0->unk_14, 0, GetMonData(param0->unk_24, MON_DATA_153, NULL)); + sub_0200B8C8(param0->unk_14, 0, Pokemon_GetValue(param0->unk_24, MON_DATA_153, NULL)); break; } @@ -1355,7 +1355,7 @@ static void ov86_0223C58C (UnkStruct_0201CD38 * param0, void * param1) v0->unk_34++; break; case 1: - GetMonData(v0->unk_24, MON_DATA_119, v0->unk_1C); + Pokemon_GetValue(v0->unk_24, MON_DATA_119, v0->unk_1C); ov86_0223C47C(v0, 48); ov86_0223C4DC(v0); ov86_0223C47C(v0, 64); @@ -1364,7 +1364,7 @@ static void ov86_0223C58C (UnkStruct_0201CD38 * param0, void * param1) v0->unk_34++; break; case 2: - sub_0200B5EC(v0->unk_14, 0, GetBoxMon(v0->unk_24)); + sub_0200B5EC(v0->unk_14, 0, Pokemon_GetBoxPokemon(v0->unk_24)); MessageLoader_GetStrbuf(v0->unk_20, 4, v0->unk_18); sub_0200C388(v0->unk_14, v0->unk_1C, v0->unk_18); ov86_0223C47C(v0, 96); @@ -1921,11 +1921,11 @@ static int ov86_0223D2A8 (UnkStruct_ov86_0223B3C8 * param0, Pokemon * param1, co BOOL v0; int v1 = 6; - v0 = DecryptMon(param1); + v0 = Pokemon_EnterDecryptionContext(param1); do { { - int v2 = GetMonData(param1, MON_DATA_MET_GAME, NULL); + int v2 = Pokemon_GetValue(param1, MON_DATA_MET_GAME, NULL); if ((v2 == 1) || (v2 == 2) || (v2 == 3)) { v1 = 4; @@ -1943,7 +1943,7 @@ static int ov86_0223D2A8 (UnkStruct_ov86_0223B3C8 * param0, Pokemon * param1, co } } - if (GetMonData(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL)) { + if (Pokemon_GetValue(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL)) { v1 = 6; break; } @@ -1952,7 +1952,7 @@ static int ov86_0223D2A8 (UnkStruct_ov86_0223B3C8 * param0, Pokemon * param1, co u32 v3, v4; v3 = sub_02025F20(param2); - v4 = GetMonData(param1, MON_DATA_OT_ID, NULL); + v4 = Pokemon_GetValue(param1, MON_DATA_OT_ID, NULL); if (v3 != v4) { v1 = 2; @@ -1960,7 +1960,7 @@ static int ov86_0223D2A8 (UnkStruct_ov86_0223B3C8 * param0, Pokemon * param1, co } sub_02025EF4(param2, param0->unk_1C48); - GetMonData(param1, MON_DATA_145, param0->unk_1C4C); + Pokemon_GetValue(param1, MON_DATA_145, param0->unk_1C4C); if (Strbuf_Compare(param0->unk_1C48, param0->unk_1C4C)) { v1 = 2; @@ -1968,10 +1968,10 @@ static int ov86_0223D2A8 (UnkStruct_ov86_0223B3C8 * param0, Pokemon * param1, co } } - if (GetMonData(param1, MON_DATA_153, NULL) >= 2000) { + if (Pokemon_GetValue(param1, MON_DATA_153, NULL) >= 2000) { v1 = 6; } else { - if (GetMonData(param1, MON_DATA_147, NULL) == 0) { + if (Pokemon_GetValue(param1, MON_DATA_147, NULL) == 0) { v1 = 0; } else { v1 = 1; @@ -1979,7 +1979,7 @@ static int ov86_0223D2A8 (UnkStruct_ov86_0223B3C8 * param0, Pokemon * param1, co } } while (0); - EncryptMon(param1, v0); + Pokemon_ExitDecryptionContext(param1, v0); return v1; } diff --git a/src/overlay087/ov87_021D106C.c b/src/overlay087/ov87_021D106C.c index 8521c11532..2606da42c4 100644 --- a/src/overlay087/ov87_021D106C.c +++ b/src/overlay087/ov87_021D106C.c @@ -114,7 +114,7 @@ UnkStruct_ov87_021D106C * ov87_021D106C (UnkStruct_ov87_021D0D80 * param0, const v0->unk_1F0 = sub_0200B358(61); v0->unk_1F4 = Strbuf_Init(256, 61); v0->unk_1F8 = Strbuf_Init(256, 61); - v0->unk_1FC = AllocMonZeroed(61); + v0->unk_1FC = Pokemon_New(61); sub_02017798(ov87_021D11AC, v0); } @@ -411,7 +411,7 @@ static void ov87_021D1640 (UnkStruct_ov87_021D106C * param0) MessageLoader_GetStrbuf(param0->unk_1E8, v1->unk_10, param0->unk_1F4); sub_0201D738(v2, 0, param0->unk_1F4, 94, 0, 0xff, NULL); - switch (GetMonPersonalityGender(v1->unk_10, v1->unk_08)) { + switch (Pokemon_GetGenderOf(v1->unk_10, v1->unk_08)) { case 0: MessageLoader_GetStrbuf(param0->unk_1E4, 3, param0->unk_1F4); break; @@ -552,7 +552,7 @@ static void ov87_021D1970 (UnkStruct_ov87_021D106C * param0) for (v3 = 0; v3 < v2->unk_14; v3++) { sub_02073D80(param0->unk_1FC, v2->unk_20[v3].unk_10, v2->unk_20[v3].unk_12, 32, 1, v2->unk_20[v3].unk_08, 1, v2->unk_20[v3].unk_0C); - SetMonData(param0->unk_1FC, 112, (void *)(&(v2->unk_20[v3].unk_13))); + Pokemon_SetValue(param0->unk_1FC, 112, (void *)(&(v2->unk_20[v3].unk_13))); sub_02075EF4(&v1, param0->unk_1FC, 2); sub_02013720(v1.unk_00, v1.unk_02, 61, &v0, param0->unk_200, v2->unk_20[v3].unk_08, 0, 2, v2->unk_20[v3].unk_10); diff --git a/src/overlay088/ov88_0223B140.c b/src/overlay088/ov88_0223B140.c index 6f5bcf3275..e776b6f9d1 100644 --- a/src/overlay088/ov88_0223B140.c +++ b/src/overlay088/ov88_0223B140.c @@ -516,7 +516,7 @@ static void ov88_0223B710 (UnkStruct_0200B358 * param0, Party * param1, int para int v0; for (v0 = 0; v0 < Party_GetCurrentCount(param1); v0++) { - sub_0200B5CC(param0, v0 + param2, GetBoxMon(Party_GetPokemonBySlotIndex(param1, v0))); + sub_0200B5CC(param0, v0 + param2, Pokemon_GetBoxPokemon(Party_GetPokemonBySlotIndex(param1, v0))); } } @@ -586,13 +586,13 @@ static int ov88_0223B914 (UnkStruct_02095E80 * param0) for (v0 = 0; v0 < Party_GetCurrentCount(param0->unk_08->unk_08); v0++) { Pokemon * v4 = Party_GetPokemonBySlotIndex(param0->unk_08->unk_08, v0); - v2 = GetMonData(v4, MON_DATA_SPECIES_EGG, NULL); + v2 = Pokemon_GetValue(v4, MON_DATA_SPECIES_EGG, NULL); if (v2 == 492) { - v1 = GetMonData(v4, MON_DATA_FORM, NULL); + v1 = Pokemon_GetValue(v4, MON_DATA_FORM, NULL); if (v1 != 0) { - SetShayminForm(v4, 0); + Pokemon_SetShayminForm(v4, 0); } } } @@ -768,21 +768,21 @@ static void ov88_0223BD18 (Pokemon * param0, UnkStruct_ov88_0223C8AC * param1) { int v0, v1; - v0 = DecryptMon(param0); + v0 = Pokemon_EnterDecryptionContext(param0); - param1->unk_04 = GetMonData(param0, MON_DATA_POKEBALL, NULL); - param1->unk_00 = GetMonData(param0, MON_DATA_SPECIES, NULL); - param1->unk_06 = GetMonData(param0, MON_DATA_FORM, NULL); - param1->unk_05 = GetMonData(param0, MON_DATA_IS_EGG, NULL); - param1->unk_08 = GetMonData(param0, MON_DATA_GENDER, NULL); - param1->unk_0C = GetMonData(param0, MON_DATA_162, NULL); + param1->unk_04 = Pokemon_GetValue(param0, MON_DATA_POKEBALL, NULL); + param1->unk_00 = Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); + param1->unk_06 = Pokemon_GetValue(param0, MON_DATA_FORM, NULL); + param1->unk_05 = Pokemon_GetValue(param0, MON_DATA_IS_EGG, NULL); + param1->unk_08 = Pokemon_GetValue(param0, MON_DATA_GENDER, NULL); + param1->unk_0C = Pokemon_GetValue(param0, MON_DATA_162, NULL); - v1 = GetMonData(param0, MON_DATA_HELD_ITEM, NULL); + v1 = Pokemon_GetValue(param0, MON_DATA_HELD_ITEM, NULL); - EncryptMon(param0, v0); + Pokemon_ExitDecryptionContext(param0, v0); if (param1->unk_00 != 0) { - param1->unk_0A = GetMonFormPersonalDataAttribute(param1->unk_00, param1->unk_06, 28); + param1->unk_0A = PokemonPersonalData_GetFormValue(param1->unk_00, param1->unk_06, 28); } if (v1 != 0) { @@ -1285,8 +1285,8 @@ static int ov88_0223C800 (int param0, Pokemon * param1, u8 * param2, UnkStruct_0 sub_02075EF4(param3, param1, 2); { - int v0 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); - int v1 = GetMonData(param1, MON_DATA_SPECIES, NULL); + int v0 = Pokemon_GetValue(param1, MON_DATA_PERSONALITY, NULL); + int v1 = Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL); sub_020136A4(param3->unk_00, param3->unk_02, 26, 0, 0, 10, 10, param2, v0, 0, 2, v1); } @@ -1302,7 +1302,7 @@ static void ov88_0223C860 (UnkStruct_0205AA50 * param0, Party * param1, int para v0 = Strbuf_Init(20, 26); - GetMonData(Party_GetPokemonBySlotIndex(param1, param2), MON_DATA_119, v0); + Pokemon_GetValue(Party_GetPokemonBySlotIndex(param1, param2), MON_DATA_119, v0); sub_0201ADA4(param0, 0); ov88_0223EC78(param0, v0, param3, 0, param4, 1); Strbuf_Free(v0); @@ -1312,7 +1312,7 @@ static int ov88_0223C8AC (UnkStruct_ov88_0223C8AC * param0, Party * param1, int { if ((param0->unk_00 == 29) || (param0->unk_00 == 32)) { Pokemon * v0 = Party_GetPokemonBySlotIndex(param1, param2); - int v1 = GetMonData(v0, MON_DATA_77, NULL); + int v1 = Pokemon_GetValue(v0, MON_DATA_77, NULL); if (v1 == 0) { return 2; @@ -1373,7 +1373,7 @@ static void ov88_0223C8D8 (UnkStruct_0205AA50 * param0, int param1, Party * para MessageLoader_GetStrbuf(param4->unk_184, 41, v0); ov88_0223EC78(¶m0[28 + param1], v0, 9, 0xff, 6, 0); - v3 = GetMonData(Party_GetPokemonBySlotIndex(param2, param3), MON_DATA_LEVEL, NULL); + v3 = Pokemon_GetValue(Party_GetPokemonBySlotIndex(param2, param3), MON_DATA_LEVEL, NULL); Strbuf_FormatInt(v0, v3, 3, 0, 1); ov88_0223EC78(¶m0[28 + param1], v0, 9, 0, 24 + 6, 0); Strbuf_Free(v0); @@ -1383,7 +1383,7 @@ static void ov88_0223C8D8 (UnkStruct_0205AA50 * param0, int param1, Party * para ov88_0223EC78(¶m0[30 + param1], param4->unk_190, 7, 0, 3, 0); - v2 = GetMonData(Party_GetPokemonBySlotIndex(param2, param3), MON_DATA_HELD_ITEM, NULL); + v2 = Pokemon_GetValue(Party_GetPokemonBySlotIndex(param2, param3), MON_DATA_HELD_ITEM, NULL); sub_0201ADA4(¶m0[32 + param1], 0); v1 = Strbuf_Init(20, 26); @@ -2099,7 +2099,7 @@ static int ov88_0223DA3C (UnkStruct_02095E80 * param0) v0.unk_0B_4 = 0; v0.unk_0B_6 = 0; - sub_0200B5CC(param0->unk_17C, 0, GetBoxMon(Party_GetPokemonBySlotIndex(param0->unk_2270, param0->unk_88[0]))); + sub_0200B5CC(param0->unk_17C, 0, Pokemon_GetBoxPokemon(Party_GetPokemonBySlotIndex(param0->unk_2270, param0->unk_88[0]))); sub_02019CB8(param0->unk_174, 0, 0, 0, 0, 32, 24, 0); ov88_0223ECBC(¶m0->unk_49C[22], 16, 1, param0->unk_184, param0->unk_17C); @@ -2309,8 +2309,8 @@ static void ov88_0223DFF4 (UnkStruct_02095E80 * param0) static int ov88_0223E110 (UnkStruct_02095E80 * param0) { sub_02019CB8(param0->unk_174, 0, 0, 0, 0, 32, 24, 0); - sub_0200B5CC(param0->unk_17C, 0, GetBoxMon(Party_GetPokemonBySlotIndex(param0->unk_2270, param0->unk_88[0]))); - sub_0200B5CC(param0->unk_17C, 1, GetBoxMon(Party_GetPokemonBySlotIndex(param0->unk_2274, param0->unk_88[1] - 6))); + sub_0200B5CC(param0->unk_17C, 0, Pokemon_GetBoxPokemon(Party_GetPokemonBySlotIndex(param0->unk_2270, param0->unk_88[0]))); + sub_0200B5CC(param0->unk_17C, 1, Pokemon_GetBoxPokemon(Party_GetPokemonBySlotIndex(param0->unk_2274, param0->unk_88[1] - 6))); ov88_0223ECBC(¶m0->unk_49C[23], 21, 1, param0->unk_184, param0->unk_17C); param0->unk_226C = ov88_0223E20C; @@ -2447,7 +2447,7 @@ static int ov88_0223E4BC (UnkStruct_02095E80 * param0) v0.unk_0B_4 = 0; v0.unk_0B_6 = 0; - sub_0200B5CC(param0->unk_17C, 0, GetBoxMon(Party_GetPokemonBySlotIndex(param0->unk_2274, param0->unk_88[0] - 6))); + sub_0200B5CC(param0->unk_17C, 0, Pokemon_GetBoxPokemon(Party_GetPokemonBySlotIndex(param0->unk_2274, param0->unk_88[0] - 6))); sub_02019CB8(param0->unk_174, 0, 0, 0, 0, 32, 24, 0); ov88_0223ECBC(¶m0->unk_49C[22], 16, 1, param0->unk_184, param0->unk_17C); @@ -2496,14 +2496,14 @@ static void ov88_0223E694 (Party * param0, Party * param1, int param2, int param { Pokemon * v0, * v1; - v0 = AllocMonZeroed(26); - v1 = AllocMonZeroed(26); + v0 = Pokemon_New(26); + v1 = Pokemon_New(26); - sub_020775EC(Party_GetPokemonBySlotIndex(param0, param2), v0); - sub_020775EC(Party_GetPokemonBySlotIndex(param1, param3), v1); + Pokemon_Copy(Party_GetPokemonBySlotIndex(param0, param2), v0); + Pokemon_Copy(Party_GetPokemonBySlotIndex(param1, param3), v1); - if (GetMonData(v1, MON_DATA_SPECIES, NULL) == 493) { - if (GetMonData(v1, MON_DATA_FATEFUL_ENCOUNTER, NULL) || ((GetMonData(v1, MON_DATA_153, NULL) == 86) && (GetMonData(v1, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 0))) { + if (Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL) == 493) { + if (Pokemon_GetValue(v1, MON_DATA_FATEFUL_ENCOUNTER, NULL) || ((Pokemon_GetValue(v1, MON_DATA_153, NULL) == 86) && (Pokemon_GetValue(v1, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 0))) { UnkStruct_020507E4 * v2 = sub_020507E4(param4->unk_10); if (sub_0206B5F8(v2) == 0) { @@ -2512,17 +2512,17 @@ static void ov88_0223E694 (Party * param0, Party * param1, int param2, int param } } - SetMonData(v1, 111, NULL); + Pokemon_SetValue(v1, 111, NULL); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { u8 v3 = 70; - SetMonData(v1, 9, &v3); + Pokemon_SetValue(v1, 9, &v3); } sub_0209304C(v1, sub_02032EE8(sub_0203608C()), 5, 0, 11); sub_0207893C(v1); - sub_020775EC(v0, param4->unk_3C); - sub_020775EC(v1, param4->unk_40); + Pokemon_Copy(v0, param4->unk_3C); + Pokemon_Copy(v1, param4->unk_40); sub_02025E80(sub_02032EE8(sub_0203608C() ^ 1), param4->unk_38); param4->unk_2C = param2; @@ -2533,8 +2533,8 @@ static void ov88_0223E694 (Party * param0, Party * param1, int param2, int param } sub_0202F180(param4->unk_10, v1); - sub_020775EC(v1, Party_GetPokemonBySlotIndex(param0, param2)); - sub_020775EC(v0, Party_GetPokemonBySlotIndex(param1, param3)); + Pokemon_Copy(v1, Party_GetPokemonBySlotIndex(param0, param2)); + Pokemon_Copy(v0, Party_GetPokemonBySlotIndex(param1, param3)); ov88_0223E7F0(param4->unk_1C, v1); sub_0202CF28(param4->unk_20, (1 + 18)); Heap_FreeToHeap(v0); @@ -2547,8 +2547,8 @@ static void ov88_0223E7F0 (UnkStruct_0202B628 * param0, Pokemon * param1) UnkStruct_02025E6C * v1 = sub_02032EE8(sub_0203608C() ^ 1); u16 v2[10 + 1]; - GetMonData(param1, MON_DATA_117, v2); - v0 = sub_0202C11C((u16 *)sub_02025EF0(v1), sub_02025F30(v1), v2, GetMonGender(param1), 26); + Pokemon_GetValue(param1, MON_DATA_117, v2); + v0 = sub_0202C11C((u16 *)sub_02025EF0(v1), sub_02025F30(v1), v2, Pokemon_GetGender(param1), 26); sub_0202B758(param0, v0, 4); } @@ -2611,7 +2611,7 @@ static int ov88_0223E914 (UnkStruct_02095E80 * param0) for (v0 = 0; v0 < v1; v0++) { v2 = Party_GetPokemonBySlotIndex(param0->unk_2270, v0); - if (GetMonData(v2, MON_DATA_3, NULL)) { + if (Pokemon_GetValue(v2, MON_DATA_3, NULL)) { return 1; } } @@ -2621,7 +2621,7 @@ static int ov88_0223E914 (UnkStruct_02095E80 * param0) for (v0 = 0; v0 < v1; v0++) { v2 = Party_GetPokemonBySlotIndex(param0->unk_2274, v0); - if (GetMonData(v2, MON_DATA_3, NULL)) { + if (Pokemon_GetValue(v2, MON_DATA_3, NULL)) { return 2; } } diff --git a/src/overlay091/ov91_021D0D80.c b/src/overlay091/ov91_021D0D80.c index 053dfa44cb..f55932700d 100644 --- a/src/overlay091/ov91_021D0D80.c +++ b/src/overlay091/ov91_021D0D80.c @@ -756,13 +756,13 @@ static int ov91_021D13E4 (UnkStruct_ov91_021D0ED8 * param0) u32 v0; v0 = ov91_021D1DD0(param0); - SetMonData(param0->unk_00->unk_00, 54 + param0->unk_00->unk_17, &v0); + Pokemon_SetValue(param0->unk_00->unk_00, 54 + param0->unk_00->unk_17, &v0); v0 = 0; - SetMonData(param0->unk_00->unk_00, 62 + param0->unk_00->unk_17, &v0); + Pokemon_SetValue(param0->unk_00->unk_00, 62 + param0->unk_00->unk_17, &v0); v0 = MoveTable_CalcMaxPP(ov91_021D1DD0(param0), 0); - SetMonData(param0->unk_00->unk_00, 58 + param0->unk_00->unk_17, &v0); + Pokemon_SetValue(param0->unk_00->unk_00, 58 + param0->unk_00->unk_17, &v0); param0->unk_00->unk_16 = 0; @@ -1107,35 +1107,35 @@ static void ov91_021D1C10 (UnkStruct_ov91_021D0ED8 * param0, u32 param1) switch (param1) { case 0: - sub_0200B5CC(param0->unk_FC, 0, GetBoxMon(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, Pokemon_GetBoxPokemon(param0->unk_00->unk_00)); break; case 1: sub_0200B630(param0->unk_FC, 1, ov91_021D1DD0(param0)); break; case 2: - sub_0200B5CC(param0->unk_FC, 0, GetBoxMon(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, Pokemon_GetBoxPokemon(param0->unk_00->unk_00)); break; case 3: - sub_0200B5CC(param0->unk_FC, 0, GetBoxMon(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, Pokemon_GetBoxPokemon(param0->unk_00->unk_00)); sub_0200B630(param0->unk_FC, 1, ov91_021D1DD0(param0)); break; case 4: - sub_0200B5CC(param0->unk_FC, 0, GetBoxMon(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, Pokemon_GetBoxPokemon(param0->unk_00->unk_00)); sub_0200B630(param0->unk_FC, 1, ov91_021D1DD0(param0)); break; case 5: - sub_0200B5CC(param0->unk_FC, 0, GetBoxMon(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, Pokemon_GetBoxPokemon(param0->unk_00->unk_00)); sub_0200B630(param0->unk_FC, 1, ov91_021D1DE0(param0)); break; case 6: - sub_0200B5CC(param0->unk_FC, 0, GetBoxMon(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, Pokemon_GetBoxPokemon(param0->unk_00->unk_00)); sub_0200B630(param0->unk_FC, 1, ov91_021D1DD0(param0)); break; case 7: sub_0200B630(param0->unk_FC, 1, ov91_021D1DD0(param0)); break; case 8: - sub_0200B5CC(param0->unk_FC, 0, GetBoxMon(param0->unk_00->unk_00)); + sub_0200B5CC(param0->unk_FC, 0, Pokemon_GetBoxPokemon(param0->unk_00->unk_00)); sub_0200B630(param0->unk_FC, 1, ov91_021D1DD0(param0)); break; case 9: @@ -1158,7 +1158,7 @@ static u16 ov91_021D1DD0 (UnkStruct_ov91_021D0ED8 * param0) static u16 ov91_021D1DE0 (UnkStruct_ov91_021D0ED8 * param0) { - return (u16)GetMonData(param0->unk_00->unk_00, 54 + param0->unk_00->unk_17, NULL); + return (u16)Pokemon_GetValue(param0->unk_00->unk_00, 54 + param0->unk_00->unk_17, NULL); } static void ov91_021D1DF8 (UnkStruct_ov91_021D0ED8 * param0, u32 param1) @@ -1196,7 +1196,7 @@ static u8 ov91_021D1EA0 (UnkStruct_ov91_021D0ED8 * param0) u8 v0; for (v0 = 0; v0 < 4; v0++) { - if (GetMonData(param0->unk_00->unk_00, MON_DATA_MOVE1 + v0, NULL) == 0) { + if (Pokemon_GetValue(param0->unk_00->unk_00, MON_DATA_MOVE1 + v0, NULL) == 0) { break; } } diff --git a/src/overlay094/ov94_0223D0C4.c b/src/overlay094/ov94_0223D0C4.c index 9a1879b445..732dacaf04 100644 --- a/src/overlay094/ov94_0223D0C4.c +++ b/src/overlay094/ov94_0223D0C4.c @@ -91,7 +91,7 @@ int ov94_0223D0C4 (UnkStruct_ov94_0223FD4C * param0, int param1) ov94_0223D2E8(param0); ov94_0223D438(param0); ov94_0223D3DC(param0); - ov94_0223D910(param0->unk_B90, param0->unk_B94, param0->unk_B8C, ¶m0->unk_FCC[0], GetBoxMon((Pokemon *)param0->unk_12C.unk_00.unk_00), ¶m0->unk_12C.unk_EC); + ov94_0223D910(param0->unk_B90, param0->unk_B94, param0->unk_B8C, ¶m0->unk_FCC[0], Pokemon_GetBoxPokemon((Pokemon *)param0->unk_12C.unk_00.unk_00), ¶m0->unk_12C.unk_EC); v0 = (Pokemon *)param0->unk_12C.unk_00.unk_00; @@ -505,7 +505,7 @@ static void ov94_0223D88C (UnkStruct_ov94_0223FD4C * param0, int param1, int par { Strbuf* v0; - sub_0200B538(param0->unk_B8C, 0, GetBoxMon(param5)); + sub_0200B538(param0->unk_B8C, 0, Pokemon_GetBoxPokemon(param5)); v0 = MessageLoader_GetNewStrbuf(param0->unk_B90, param1); sub_0200C388(param0->unk_B8C, param0->unk_BAC, v0); sub_0201ADA4(¶m0->unk_F5C, 0xf0f); @@ -529,12 +529,12 @@ void ov94_0223D910 (MessageLoader * param0, MessageLoader * param1, UnkStruct_02 Strbuf* v5 = Strbuf_Init((8 + 1) * 2, 62); int v6, v7, v8, v9, v10; - GetBoxMonData(param4, MON_DATA_119, v4); + BoxPokemon_GetValue(param4, MON_DATA_119, v4); v10 = param5->unk_00; v6 = param5->unk_02; v7 = param5->unk_03; - v8 = GetBoxMonData(param4, MON_DATA_HELD_ITEM, NULL); + v8 = BoxPokemon_GetValue(param4, MON_DATA_HELD_ITEM, NULL); v3 = MessageLoader_GetNewStrbuf(param0, 70); v1 = MessageLoader_GetNewStrbuf(param0, Unk_ov94_02245FD8[v6]); @@ -580,7 +580,7 @@ void ov94_0223DA78 (MessageLoader * param0, UnkStruct_0205AA50 param1[], u16 * p Strbuf_CopyChars(v0, param2); v2 = MessageLoader_GetNewStrbuf(param0, 172); - GetMonData(param3, MON_DATA_145, v3); + Pokemon_GetValue(param3, MON_DATA_145, v3); ov94_02245900(¶m1[0], v1, 0, 0, 0, (u32)(((15 & 0xff) << 16) | ((2 & 0xff) << 8) | ((0 & 0xff) << 0))); ov94_02245900(¶m1[1], v0, 0, 0, 0, (u32)(((15 & 0xff) << 16) | ((2 & 0xff) << 8) | ((0 & 0xff) << 0))); @@ -601,8 +601,8 @@ void ov94_0223DB2C (Pokemon * param0) sub_02075EF4(&v0, param0, 2); { - int v2 = GetMonData(param0, MON_DATA_PERSONALITY, NULL); - int v3 = GetMonData(param0, MON_DATA_SPECIES, NULL); + int v2 = Pokemon_GetValue(param0, MON_DATA_PERSONALITY, NULL); + int v3 = Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); sub_020136A4(v0.unk_00, v0.unk_02, 62, 0, 0, 10, 10, v1, v2, 0, 2, v3); } diff --git a/src/overlay094/ov94_0223DC04.c b/src/overlay094/ov94_0223DC04.c index aead2b2981..34ab1f2ba5 100644 --- a/src/overlay094/ov94_0223DC04.c +++ b/src/overlay094/ov94_0223DC04.c @@ -80,7 +80,7 @@ int ov94_0223DC04 (UnkStruct_ov94_0223FD4C * param0, int param1) ov94_0223DE04(param0); ov94_0223DED8(param0); ov94_0223DE7C(param0); - ov94_0223D910(param0->unk_B90, param0->unk_B94, param0->unk_B8C, ¶m0->unk_FCC[0], GetBoxMon((Pokemon *)param0->unk_250[param0->unk_11C].unk_00.unk_00), ¶m0->unk_250[param0->unk_11C].unk_EC); + ov94_0223D910(param0->unk_B90, param0->unk_B94, param0->unk_B8C, ¶m0->unk_FCC[0], Pokemon_GetBoxPokemon((Pokemon *)param0->unk_250[param0->unk_11C].unk_00.unk_00), ¶m0->unk_250[param0->unk_11C].unk_EC); v0 = (Pokemon *)param0->unk_250[param0->unk_11C].unk_00.unk_00; diff --git a/src/overlay094/ov94_0223E46C.c b/src/overlay094/ov94_0223E46C.c index 6ad98e8015..662ef5020d 100644 --- a/src/overlay094/ov94_0223E46C.c +++ b/src/overlay094/ov94_0223E46C.c @@ -428,7 +428,7 @@ static int ov94_0223EA84 (UnkStruct_ov94_0223FD4C * param0) break; case 1: if (param0->unk_B7A.unk_00 != 0) { - param0->unk_10E4->unk_20 = GetMonSpeciesPersonalDataAttribute(param0->unk_B7A.unk_00, 18); + param0->unk_10E4->unk_20 = PokemonPersonalData_GetSpeciesValue(param0->unk_B7A.unk_00, 18); if (ov94_02241B80(¶m0->unk_B7A, param0->unk_10E4->unk_20)) { sub_02005748(1500); @@ -843,7 +843,7 @@ static int ov94_0223F2B0 (UnkStruct_ov94_0223FD4C * param0) sub_0201ADA4(¶m0->unk_FCC[1], 0x0); ov94_02242158(¶m0->unk_FCC[1], param0->unk_B94, v0, 0, 0, (u32)(((1 & 0xff) << 16) | ((2 & 0xff) << 8) | ((0 & 0xff) << 0))); - param0->unk_10E4->unk_20 = GetMonSpeciesPersonalDataAttribute(v0, 18); + param0->unk_10E4->unk_20 = PokemonPersonalData_GetSpeciesValue(v0, 18); ov94_02242AC4(¶m0->unk_111C, param0->unk_10E4->unk_06 + param0->unk_10E4->unk_04, param0->unk_10E4->unk_0A, param0->unk_10E4->unk_08); if (ov94_02241B80(¶m0->unk_B7A, param0->unk_10E4->unk_20)) { diff --git a/src/overlay094/ov94_0223FB48.c b/src/overlay094/ov94_0223FB48.c index 70597ded8b..0b6680338a 100644 --- a/src/overlay094/ov94_0223FB48.c +++ b/src/overlay094/ov94_0223FB48.c @@ -748,7 +748,7 @@ static int ov94_02240688 (UnkStruct_ov94_0223FD4C * param0) v2 = Party_GetPokemonBySlotIndex(param0->unk_00->unk_08, param0->unk_112); - if (GetMonData(v2, MON_DATA_162, NULL)) { + if (Pokemon_GetValue(v2, MON_DATA_162, NULL)) { v1 = 1; param0->unk_2C = 14; } @@ -840,7 +840,7 @@ static int ov94_022408E8 (UnkStruct_ov94_0223FD4C * param0) v2 = Party_GetPokemonBySlotIndex(param0->unk_00->unk_08, param0->unk_112); - if (GetMonData(v2, MON_DATA_162, NULL)) { + if (Pokemon_GetValue(v2, MON_DATA_162, NULL)) { v1 = 1; param0->unk_2C = 11; } @@ -1068,7 +1068,7 @@ static void ov94_02240DF8 (int param0, int param1, int param2, int param3, UnkSt static void ov94_02240E50 (BoxPokemon * param0, UnkStruct_ov94_0223BA88_sub2 * param1) { - param1->unk_03 = GetBoxMonLevel(param0); + param1->unk_03 = BoxPokemon_GetLevel(param0); } static void ov94_02240E5C (void * param0) @@ -1093,23 +1093,23 @@ static void ov94_02240EAC (BoxPokemon * param0, UnkStruct_02022550 * param1, Unk { int v0, v1, v2, v3; - DecryptBoxMon(param0); + BoxPokemon_EnterDecryptionContext(param0); - v0 = GetBoxMonData(param0, MON_DATA_172, NULL); - *param3 = GetBoxMonData(param0, MON_DATA_SPECIES, NULL); + v0 = BoxPokemon_GetValue(param0, MON_DATA_172, NULL); + *param3 = BoxPokemon_GetValue(param0, MON_DATA_SPECIES, NULL); - v3 = GetBoxMonData(param0, MON_DATA_FORM, NULL); - v2 = GetBoxMonData(param0, MON_DATA_IS_EGG, NULL); - v1 = GetBoxMonData(param0, MON_DATA_HELD_ITEM, NULL); + v3 = BoxPokemon_GetValue(param0, MON_DATA_FORM, NULL); + v2 = BoxPokemon_GetValue(param0, MON_DATA_IS_EGG, NULL); + v1 = BoxPokemon_GetValue(param0, MON_DATA_HELD_ITEM, NULL); param6->unk_00 = *param3; - param6->unk_02 = GetBoxMonData(param0, MON_DATA_GENDER, NULL) + 1; + param6->unk_02 = BoxPokemon_GetValue(param0, MON_DATA_GENDER, NULL) + 1; if (v2) { param6->unk_03 = 0; } - EncryptBoxMon(param0, 1); + BoxPokemon_ExitDecryptionContext(param0, 1); if (v0) { ov94_02240DF8(*param3, v3, v2, param4, param1, param5, param7); @@ -1166,12 +1166,12 @@ static void ov94_02240FA0 (UnkStruct_ov94_0223FD4C * param0, int param1) for (v1 = 0; v1 < v8; v1++) { v3 = Party_GetPokemonBySlotIndex(param0->unk_00->unk_08, v1); - v4 = GetBoxMon(v3); + v4 = Pokemon_GetBoxPokemon(v3); ov94_02240E50(v4, ¶m0->unk_1108->unk_00[v1]); ov94_02240EAC(v4, param0->unk_E28[v1], param0->unk_EA0[v1], &v0[v1], v1, v6, ¶m0->unk_1108->unk_00[v1], &v7[v1]); - if (GetMonData(v3, MON_DATA_162, NULL)) { + if (Pokemon_GetValue(v3, MON_DATA_162, NULL)) { sub_02021CAC(param0->unk_F18[v1], 1); } else { sub_02021CAC(param0->unk_F18[v1], 0); @@ -1220,7 +1220,7 @@ BoxPokemon * ov94_022411DC (Party * param0, UnkStruct_020797DC * param1, int par return NULL; } - return GetBoxMon(Party_GetPokemonBySlotIndex(param0, param3)); + return Pokemon_GetBoxPokemon(Party_GetPokemonBySlotIndex(param0, param3)); } return sub_02079C9C(param1, param2, param3); @@ -1254,13 +1254,13 @@ static int ov94_0224123C (BoxPokemon * param0) { int v0, v1 = 0, v2; - v2 = DecryptBoxMon(param0); + v2 = BoxPokemon_EnterDecryptionContext(param0); for (v0 = 0; v0 < 10; v0++) { - v1 += GetBoxMonData(param0, Unk_ov94_02245E34[v0], NULL); + v1 += BoxPokemon_GetValue(param0, Unk_ov94_02245E34[v0], NULL); } - EncryptBoxMon(param0, v2); + BoxPokemon_ExitDecryptionContext(param0, v2); if (v1) { return 1; @@ -1274,14 +1274,14 @@ static int ov94_02241278 (BoxPokemon * param0) int v0; int v1, v2; - v0 = DecryptBoxMon(param0); + v0 = BoxPokemon_EnterDecryptionContext(param0); { - v1 = GetBoxMonData(param0, MON_DATA_SPECIES, NULL); - v2 = GetBoxMonData(param0, MON_DATA_FORM, NULL); + v1 = BoxPokemon_GetValue(param0, MON_DATA_SPECIES, NULL); + v2 = BoxPokemon_GetValue(param0, MON_DATA_FORM, NULL); } - EncryptBoxMon(param0, v0); + BoxPokemon_ExitDecryptionContext(param0, v0); if (v2 > 0) { switch (v1) { @@ -1300,13 +1300,13 @@ static int ov94_022412C8 (BoxPokemon * param0) int v0; int v1; - v0 = DecryptBoxMon(param0); + v0 = BoxPokemon_EnterDecryptionContext(param0); { - v1 = GetBoxMonData(param0, MON_DATA_HELD_ITEM, NULL); + v1 = BoxPokemon_GetValue(param0, MON_DATA_HELD_ITEM, NULL); } - EncryptBoxMon(param0, v0); + BoxPokemon_ExitDecryptionContext(param0, v0); switch (v1) { case 112: @@ -1324,11 +1324,11 @@ static int ov94_022412F4 (Party * param0, UnkStruct_020797DC * param1, int param return 0; } - if (!GetBoxMonData(v0, MON_DATA_172, NULL)) { + if (!BoxPokemon_GetValue(v0, MON_DATA_172, NULL)) { return 0; } - if (GetBoxMonData(v0, MON_DATA_173, NULL)) { + if (BoxPokemon_GetValue(v0, MON_DATA_173, NULL)) { return 2; } @@ -1370,9 +1370,9 @@ static int ov94_02241384 (BoxPokemon * param0, UnkStruct_ov94_0223BA88_sub3 * pa { UnkStruct_ov94_0223BA88_sub2 v0; - v0.unk_00 = GetBoxMonData(param0, MON_DATA_SPECIES, NULL); - v0.unk_02 = GetBoxMonData(param0, MON_DATA_GENDER, NULL) + 1; - v0.unk_03 = GetBoxMonLevel(param0); + v0.unk_00 = BoxPokemon_GetValue(param0, MON_DATA_SPECIES, NULL); + v0.unk_02 = BoxPokemon_GetValue(param0, MON_DATA_GENDER, NULL) + 1; + v0.unk_03 = BoxPokemon_GetLevel(param0); return ov94_02241328(&v0, param1); } @@ -1383,18 +1383,18 @@ static void ov94_022413BC (UnkStruct_ov94_0223BA88 * param0, UnkStruct_ov94_0223 UnkStruct_ov94_0223BA88_sub3 v1; BoxPokemon * v2; - v0.unk_00 = GetBoxMonData(param1->unk_114, MON_DATA_SPECIES, NULL); - v0.unk_02 = GetBoxMonData(param1->unk_114, MON_DATA_GENDER, NULL) + 1; - v0.unk_03 = GetBoxMonLevel(param1->unk_114); + v0.unk_00 = BoxPokemon_GetValue(param1->unk_114, MON_DATA_SPECIES, NULL); + v0.unk_02 = BoxPokemon_GetValue(param1->unk_114, MON_DATA_GENDER, NULL) + 1; + v0.unk_03 = BoxPokemon_GetLevel(param1->unk_114); param0->unk_EC = v0; ov94_022425A8(param0, param1); - v2 = GetBoxMon((Pokemon *)param1->unk_250[param1->unk_11C].unk_00.unk_00); + v2 = Pokemon_GetBoxPokemon((Pokemon *)param1->unk_250[param1->unk_11C].unk_00.unk_00); - v1.unk_00 = GetBoxMonData(v2, MON_DATA_SPECIES, NULL); - v1.unk_02 = GetBoxMonData(v2, MON_DATA_GENDER, NULL) + 1; + v1.unk_00 = BoxPokemon_GetValue(v2, MON_DATA_SPECIES, NULL); + v1.unk_02 = BoxPokemon_GetValue(v2, MON_DATA_GENDER, NULL) + 1; v1.unk_03 = 0; v1.unk_04 = 0; @@ -1416,7 +1416,7 @@ static void ov94_02241464 (UnkStruct_ov94_0223BA88_sub2 * param0, UnkStruct_0202 BOOL ov94_02241498 (Pokemon * param0) { - int v0 = GetMonData(param0, MON_DATA_HELD_ITEM, NULL); + int v0 = Pokemon_GetValue(param0, MON_DATA_HELD_ITEM, NULL); if (Item_IsMail(v0)) { return 1; diff --git a/src/overlay094/ov94_022414B8.c b/src/overlay094/ov94_022414B8.c index 188e786cd3..a4bd3ca535 100644 --- a/src/overlay094/ov94_022414B8.c +++ b/src/overlay094/ov94_022414B8.c @@ -649,7 +649,7 @@ static int ov94_02241BAC (UnkStruct_ov94_0223FD4C * param0) sub_0201A8FC(¶m0->unk_F9C[1]); param0->unk_B74.unk_00 = v0; sub_02005748(1500); - param0->unk_10E4->unk_20 = GetMonSpeciesPersonalDataAttribute(v0, 18); + param0->unk_10E4->unk_20 = PokemonPersonalData_GetSpeciesValue(v0, 18); if (ov94_02241B80(¶m0->unk_B74, param0->unk_10E4->unk_20)) { param0->unk_2C = 10; @@ -1012,10 +1012,10 @@ static void ov94_022423FC (MessageLoader * param0, UnkStruct_0200B358 * param1, Strbuf* v3 = Strbuf_Init(10 + 1, 62); int v4, v5, v6; - GetBoxMonData(param3, MON_DATA_119, v2); + BoxPokemon_GetValue(param3, MON_DATA_119, v2); - v4 = GetBoxMonData(param3, MON_DATA_GENDER, NULL) + 1; - v5 = GetBoxMonLevel(param3); + v4 = BoxPokemon_GetValue(param3, MON_DATA_GENDER, NULL) + 1; + v5 = BoxPokemon_GetLevel(param3); v0 = MessageLoader_GetNewStrbuf(param0, 100); sub_0200B60C(param1, 3, v5, 3, 0, 1); @@ -1037,7 +1037,7 @@ static void ov94_022423FC (MessageLoader * param0, UnkStruct_0200B358 * param1, ov94_02245900(¶m2[1], v3, 70, 0, 0, Unk_ov94_02246920[v4 - 1]); } - param4->unk_00 = GetBoxMonData(param3, MON_DATA_SPECIES, NULL); + param4->unk_00 = BoxPokemon_GetValue(param3, MON_DATA_SPECIES, NULL); param4->unk_02 = v4; param4->unk_03 = v5; @@ -1085,12 +1085,12 @@ void ov94_022425A8 (UnkStruct_ov94_0223BA88 * param0, UnkStruct_ov94_0223FD4C * u16 * v0; if (ov94_022411D0(param1->unk_110)) { - SetShayminForm((Pokemon *)(param1->unk_114), 0); + Pokemon_SetShayminForm((Pokemon *)(param1->unk_114), 0); - MI_CpuCopyFast(param1->unk_114, param0->unk_00.unk_00, PokemonStructSize()); + MI_CpuCopyFast(param1->unk_114, param0->unk_00.unk_00, Pokemon_StructSize()); } else { - SetBoxShayminForm(param1->unk_114, 0); - sub_020774C8(param1->unk_114, (Pokemon *)param0->unk_00.unk_00); + BoxPokemon_SetShayminForm(param1->unk_114, 0); + Pokemon_FromBoxPokemon(param1->unk_114, (Pokemon *)param0->unk_00.unk_00); } sub_020021D0(param0->unk_10C, sub_02025EF0(param1->unk_00->unk_1C), 8); diff --git a/src/overlay094/ov94_02242AD0.c b/src/overlay094/ov94_02242AD0.c index db929f33bf..6f9fcc585e 100644 --- a/src/overlay094/ov94_02242AD0.c +++ b/src/overlay094/ov94_02242AD0.c @@ -794,10 +794,10 @@ static int ov94_02243398 (UnkStruct_ov94_0223FD4C * param0) param0->unk_36 = 0; if (sub_0202DA60(param0->unk_00->unk_00)) { - Pokemon * v1 = AllocMonZeroed(62); + Pokemon * v1 = Pokemon_New(62); sub_0202DA70(param0->unk_00->unk_00, v1); - sub_0200B5CC(param0->unk_B8C, 0, GetBoxMon(v1)); + sub_0200B5CC(param0->unk_B8C, 0, Pokemon_GetBoxPokemon(v1)); param0->unk_28 = 2; param0->unk_2C = 34; @@ -814,10 +814,10 @@ static int ov94_02243398 (UnkStruct_ov94_0223FD4C * param0) param0->unk_36 = 0; if (sub_0202DA60(param0->unk_00->unk_00)) { - Pokemon * v2 = AllocMonZeroed(62); + Pokemon * v2 = Pokemon_New(62); sub_0202DA70(param0->unk_00->unk_00, v2); - sub_0200B5CC(param0->unk_B8C, 0, GetBoxMon(v2)); + sub_0200B5CC(param0->unk_B8C, 0, Pokemon_GetBoxPokemon(v2)); param0->unk_28 = 3; param0->unk_2C = 34; @@ -1250,9 +1250,9 @@ static int ov94_02243AE8 (UnkStruct_ov94_0223FD4C * param0) static void ov94_02243B08 (UnkStruct_ov94_0223FD4C * param0, int param1) { if (param0->unk_110 != 18) { - Pokemon * v0 = AllocMonZeroed(62); + Pokemon * v0 = Pokemon_New(62); - sub_020774C8(sub_02079C9C(param0->unk_00->unk_0C, param0->unk_110, param0->unk_112), v0); + Pokemon_FromBoxPokemon(sub_02079C9C(param0->unk_00->unk_0C, param0->unk_110, param0->unk_112), v0); sub_0202DA7C(param0->unk_00->unk_00, v0, param0->unk_110); sub_02079968(param0->unk_00->unk_0C, param0->unk_110, param0->unk_112); Heap_FreeToHeap(v0); @@ -1276,7 +1276,7 @@ static void ov94_02243B08 (UnkStruct_ov94_0223FD4C * param0, int param1) static void ov94_02243BC4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, int param2, int param3) { - int v0 = GetMonData(param1, MON_DATA_HELD_ITEM, NULL); + int v0 = Pokemon_GetValue(param1, MON_DATA_HELD_ITEM, NULL); sub_0202F180(param0->unk_00->unk_20, param1); param2 = 18; @@ -1288,8 +1288,8 @@ static void ov94_02243BC4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, i if (param3) { u8 v1 = 70; - if (GetMonData(param1, MON_DATA_SPECIES, NULL) == 493) { - if (GetMonData(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) || ((GetMonData(param1, MON_DATA_153, NULL) == 86) && (GetMonData(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 0))) { + if (Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL) == 493) { + if (Pokemon_GetValue(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) || ((Pokemon_GetValue(param1, MON_DATA_153, NULL) == 86) && (Pokemon_GetValue(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 0))) { UnkStruct_020507E4 * v2 = sub_020507E4(param0->unk_00->unk_20); if (sub_0206B5F8(v2) == 0) { @@ -1298,8 +1298,8 @@ static void ov94_02243BC4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, i } } - SetMonData(param1, 9, &v1); - SetMonData(param1, 111, NULL); + Pokemon_SetValue(param1, 9, &v1); + Pokemon_SetValue(param1, 111, NULL); ov94_02243DE8(param0->unk_00->unk_00, 0); } @@ -1316,7 +1316,7 @@ static void ov94_02243BC4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, i int v4 = 0; sub_020799F0(param0->unk_00->unk_0C, ¶m2, &v4); - sub_020798A0(param0->unk_00->unk_0C, param2, GetBoxMon(param1)); + sub_020798A0(param0->unk_00->unk_0C, param2, Pokemon_GetBoxPokemon(param1)); param0->unk_124.unk_00 = param2; param0->unk_124.unk_04 = v4; @@ -1335,8 +1335,8 @@ static void ov94_02243CE4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, i param2 = 0; } - if (GetMonData(param1, MON_DATA_SPECIES, NULL) == 493) { - if (GetMonData(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) || ((GetMonData(param1, MON_DATA_153, NULL) == 86) && (GetMonData(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 0))) { + if (Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL) == 493) { + if (Pokemon_GetValue(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) || ((Pokemon_GetValue(param1, MON_DATA_153, NULL) == 86) && (Pokemon_GetValue(param1, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 0))) { UnkStruct_020507E4 * v0 = sub_020507E4(param0->unk_00->unk_20); if (sub_0206B5F8(v0) == 0) { @@ -1347,10 +1347,10 @@ static void ov94_02243CE4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, i { u8 v1 = 70; - SetMonData(param1, 9, &v1); + Pokemon_SetValue(param1, 9, &v1); } - SetMonData(param1, 111, NULL); + Pokemon_SetValue(param1, 111, NULL); if (param2 == 18) { int v2; @@ -1364,7 +1364,7 @@ static void ov94_02243CE4 (UnkStruct_ov94_0223FD4C * param0, Pokemon * param1, i int v3 = 0; sub_020799F0(param0->unk_00->unk_0C, ¶m2, &v3); - sub_020798A0(param0->unk_00->unk_0C, param2, GetBoxMon(param1)); + sub_020798A0(param0->unk_00->unk_0C, param2, Pokemon_GetBoxPokemon(param1)); param0->unk_124.unk_00 = param2; param0->unk_124.unk_04 = v3; @@ -1401,8 +1401,8 @@ static void ov94_02243E48 (UnkStruct_0202B628 * param0, UnkStruct_ov94_0223BA88 u16 v1[10 + 1]; Pokemon * v2 = (Pokemon *)param1->unk_00.unk_00; - GetMonData(v2, MON_DATA_117, v1); - v0 = sub_0202C1EC(param1->unk_10C, param1->unk_F6, v1, GetMonGender(v2), 62); + Pokemon_GetValue(v2, MON_DATA_117, v1); + v0 = sub_0202C1EC(param1->unk_10C, param1->unk_F6, v1, Pokemon_GetGender(v2), 62); sub_0202B758(param0, v0, 4); } diff --git a/src/overlay094/ov94_022444C8.c b/src/overlay094/ov94_022444C8.c index b6cef3f4ea..3029fe225b 100644 --- a/src/overlay094/ov94_022444C8.c +++ b/src/overlay094/ov94_022444C8.c @@ -37,11 +37,11 @@ static const UnkStruct_0208BE5C Unk_ov94_0224636C = { int ov94_022444C8 (UnkStruct_ov94_0223FD4C * param0, int param1) { - param0->unk_1104 = AllocMonZeroed(62); + param0->unk_1104 = Pokemon_New(62); switch (param0->unk_24) { case 7: - param0->unk_E8.unk_00 = (BoxPokemon *)GetBoxMon((Pokemon *)param0->unk_12C.unk_00.unk_00); + param0->unk_E8.unk_00 = (BoxPokemon *)Pokemon_GetBoxPokemon((Pokemon *)param0->unk_12C.unk_00.unk_00); param0->unk_E8.unk_04 = param0->unk_E8.unk_00; param0->unk_120 = ov94_02244870(¶m0->unk_12C); param0->unk_E8.unk_08 = param0->unk_120; @@ -49,7 +49,7 @@ int ov94_022444C8 (UnkStruct_ov94_0223FD4C * param0, int param1) param0->unk_E8.unk_10 = 2; break; case 8: - param0->unk_E8.unk_04 = (BoxPokemon *)GetBoxMon((Pokemon *)param0->unk_12C.unk_00.unk_00); + param0->unk_E8.unk_04 = (BoxPokemon *)Pokemon_GetBoxPokemon((Pokemon *)param0->unk_12C.unk_00.unk_00); param0->unk_E8.unk_00 = param0->unk_E8.unk_04; param0->unk_120 = ov94_02244870(¶m0->unk_12C); param0->unk_E8.unk_08 = param0->unk_120; @@ -57,9 +57,9 @@ int ov94_022444C8 (UnkStruct_ov94_0223FD4C * param0, int param1) param0->unk_E8.unk_10 = 4; break; case 10: - param0->unk_E8.unk_04 = GetBoxMon((Pokemon *)param0->unk_12C.unk_00.unk_00); + param0->unk_E8.unk_04 = Pokemon_GetBoxPokemon((Pokemon *)param0->unk_12C.unk_00.unk_00); sub_0202DA70(param0->unk_00->unk_00, param0->unk_1104); - param0->unk_E8.unk_00 = GetBoxMon(param0->unk_1104); + param0->unk_E8.unk_00 = Pokemon_GetBoxPokemon(param0->unk_1104); param0->unk_120 = ov94_02244870(¶m0->unk_12C); param0->unk_E8.unk_08 = param0->unk_120; param0->unk_E8.unk_0C = 3; @@ -67,8 +67,8 @@ int ov94_022444C8 (UnkStruct_ov94_0223FD4C * param0, int param1) break; case 9: sub_0202DA70(param0->unk_00->unk_00, param0->unk_1104); - param0->unk_E8.unk_00 = GetBoxMon(param0->unk_1104); - param0->unk_E8.unk_04 = (BoxPokemon *)GetBoxMon((Pokemon *)param0->unk_250[param0->unk_11C].unk_00.unk_00); + param0->unk_E8.unk_00 = Pokemon_GetBoxPokemon(param0->unk_1104); + param0->unk_E8.unk_04 = (BoxPokemon *)Pokemon_GetBoxPokemon((Pokemon *)param0->unk_250[param0->unk_11C].unk_00.unk_00); param0->unk_120 = ov94_02244870(¶m0->unk_250[param0->unk_11C]); param0->unk_E8.unk_08 = param0->unk_120; param0->unk_E8.unk_0C = 3; @@ -94,7 +94,7 @@ int ov94_02244678 (UnkStruct_ov94_0223FD4C * param0, int param1) if (param0->unk_24 == 9) { Pokemon * v1 = ov94_022448AC(param0, param0->unk_24); - int v2 = GetMonData(v1, MON_DATA_HELD_ITEM, NULL); + int v2 = Pokemon_GetValue(v1, MON_DATA_HELD_ITEM, NULL); int v3; int v4; @@ -109,12 +109,12 @@ int ov94_02244678 (UnkStruct_ov94_0223FD4C * param0, int param1) } } else if ((param0->unk_24 == 8) || (param0->unk_24 == 10)) { Pokemon * v1 = ov94_022448AC(param0, param0->unk_24); - Pokemon * v5 = AllocMonZeroed(62); + Pokemon * v5 = Pokemon_New(62); sub_0202DA70(param0->unk_00->unk_00, v5); - if ((GetMonData(v1, MON_DATA_SPECIES, NULL) != GetMonData(v5, MON_DATA_SPECIES, NULL)) || (GetMonData(v1, MON_DATA_PERSONALITY, NULL) != GetMonData(v5, MON_DATA_PERSONALITY, NULL))) { - int v6 = GetMonData(v1, MON_DATA_HELD_ITEM, NULL); + if ((Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL) != Pokemon_GetValue(v5, MON_DATA_SPECIES, NULL)) || (Pokemon_GetValue(v1, MON_DATA_PERSONALITY, NULL) != Pokemon_GetValue(v5, MON_DATA_PERSONALITY, NULL))) { + int v6 = Pokemon_GetValue(v1, MON_DATA_HELD_ITEM, NULL); int v7; int v8; @@ -193,12 +193,12 @@ static void ov94_022448E8 (UnkStruct_ov94_0223FD4C * param0) Pokemon * v0 = ov94_022448AC(param0, param0->unk_24); if (param0->unk_124.unk_00 == 18) { - sub_020775EC(v0, Party_GetPokemonBySlotIndex(param0->unk_00->unk_08, param0->unk_124.unk_04)); + Pokemon_Copy(v0, Party_GetPokemonBySlotIndex(param0->unk_00->unk_08, param0->unk_124.unk_04)); } else { int v1 = 0, v2 = 0; sub_02079968(param0->unk_00->unk_0C, param0->unk_124.unk_00, param0->unk_124.unk_04); sub_020799F0(param0->unk_00->unk_0C, &v1, &v2); - sub_020798A0(param0->unk_00->unk_0C, v1, GetBoxMon(v0)); + sub_020798A0(param0->unk_00->unk_0C, v1, Pokemon_GetBoxPokemon(v0)); } } diff --git a/src/overlay095/ov95_02246C20.c b/src/overlay095/ov95_02246C20.c index a8fabca41e..0701e0986b 100644 --- a/src/overlay095/ov95_02246C20.c +++ b/src/overlay095/ov95_02246C20.c @@ -177,10 +177,10 @@ int ov95_02246C20 (UnkStruct_020067E8 * param0, int * param1) v0->unk_18 = sub_020095C4(64, &v0->unk_1C, 57); sub_0200964C(&(v0->unk_1C), 0, (192 + 40 << FX32_SHIFT)); - v0->unk_1B0 = GetBoxMonData((BoxPokemon *)(v0->unk_00->unk_00), MON_DATA_SPECIES, NULL); - v0->unk_1B2 = GetBoxMonData((BoxPokemon *)(v0->unk_00->unk_00), MON_DATA_FORM, NULL); - v0->unk_1B4 = GetBoxMonData((BoxPokemon *)(v0->unk_00->unk_04), MON_DATA_SPECIES, NULL); - v0->unk_1B6 = GetBoxMonData((BoxPokemon *)(v0->unk_00->unk_04), MON_DATA_FORM, NULL); + v0->unk_1B0 = BoxPokemon_GetValue((BoxPokemon *)(v0->unk_00->unk_00), MON_DATA_SPECIES, NULL); + v0->unk_1B2 = BoxPokemon_GetValue((BoxPokemon *)(v0->unk_00->unk_00), MON_DATA_FORM, NULL); + v0->unk_1B4 = BoxPokemon_GetValue((BoxPokemon *)(v0->unk_00->unk_04), MON_DATA_SPECIES, NULL); + v0->unk_1B6 = BoxPokemon_GetValue((BoxPokemon *)(v0->unk_00->unk_04), MON_DATA_FORM, NULL); v0->unk_1B8 = NULL; sub_02017798(NULL, NULL); @@ -203,10 +203,10 @@ int ov95_02246C20 (UnkStruct_020067E8 * param0, int * param1) static BOOL ov95_02246DEC (BoxPokemon * param0) { - int v0 = GetBoxMonData(param0, MON_DATA_SPECIES, NULL); - int v1 = GetBoxMonData(param0, MON_DATA_FORM, NULL); + int v0 = BoxPokemon_GetValue(param0, MON_DATA_SPECIES, NULL); + int v1 = BoxPokemon_GetValue(param0, MON_DATA_FORM, NULL); - return GetMonFormPersonalDataAttribute(v0, v1, 28) == 0; + return PokemonPersonalData_GetFormValue(v0, v1, 28) == 0; } int ov95_02246E1C (UnkStruct_020067E8 * param0, int * param1) @@ -574,12 +574,12 @@ void ov95_022473E8 (UnkStruct_ov95_02247628 * param0, int param1, u32 param2, u3 u16 v8; v5 = (BoxPokemon *)((param1 == 0) ? param0->unk_00->unk_00 : param0->unk_00->unk_04); - v6 = DecryptBoxMon(v5); + v6 = BoxPokemon_EnterDecryptionContext(v5); sub_02075F0C(&v0, v5, 2, 0); - v7 = GetBoxMonData(v5, MON_DATA_PERSONALITY, NULL); - v8 = GetBoxMonData(v5, MON_DATA_SPECIES, NULL); + v7 = BoxPokemon_GetValue(v5, MON_DATA_PERSONALITY, NULL); + v8 = BoxPokemon_GetValue(v5, MON_DATA_SPECIES, NULL); if (param4) { v4.unk_08 *= 2; @@ -589,7 +589,7 @@ void ov95_022473E8 (UnkStruct_ov95_02247628 * param0, int param1, u32 param2, u3 DC_FlushRange(v3, v2); sub_0201958C(param0->unk_08, param2, v3, v2, 0); - EncryptBoxMon(v5, v6); + BoxPokemon_ExitDecryptionContext(v5, v6); Heap_FreeToHeap(v3); } diff --git a/src/overlay095/ov95_02247B6C.c b/src/overlay095/ov95_02247B6C.c index b460a93e47..630e918386 100644 --- a/src/overlay095/ov95_02247B6C.c +++ b/src/overlay095/ov95_02247B6C.c @@ -360,7 +360,7 @@ static int ov95_02247F04 (UnkStruct_ov95_02247C6C * param0, int * param1) { const BoxPokemon * v6 = ov95_02247634(param0->unk_00); - if (GetBoxMonData((BoxPokemon *)v6, MON_DATA_IS_EGG, NULL) == 0) { + if (BoxPokemon_GetValue((BoxPokemon *)v6, MON_DATA_IS_EGG, NULL) == 0) { u8 v7; sub_02007B98(param0->unk_10, 1); diff --git a/src/overlay095/ov95_0224B3D8.c b/src/overlay095/ov95_0224B3D8.c index e177b8a048..b406ab3a38 100644 --- a/src/overlay095/ov95_0224B3D8.c +++ b/src/overlay095/ov95_0224B3D8.c @@ -373,7 +373,7 @@ static int ov95_0224B71C (UnkStruct_ov95_0224B4D4 * param0, int * param1) if (ov95_0224BC00(param0)) { const BoxPokemon * v0 = ov95_0224763C(param0->unk_00); - if (GetBoxMonData((BoxPokemon *)v0, MON_DATA_IS_EGG, NULL) == 0) { + if (BoxPokemon_GetValue((BoxPokemon *)v0, MON_DATA_IS_EGG, NULL) == 0) { u8 v1; sub_02078A4C(param0->unk_84, &v1, ov95_02247660(param0->unk_00), 1); diff --git a/src/overlay097/ov97_0222D30C.c b/src/overlay097/ov97_0222D30C.c index 803f31aef8..d236ee71d8 100644 --- a/src/overlay097/ov97_0222D30C.c +++ b/src/overlay097/ov97_0222D30C.c @@ -405,7 +405,7 @@ static BOOL ov97_0222D5C8 (UnkStruct_0202DF40 * param0) int v1; v0 = (Pokemon *)¶m0->unk_04.val1.unk_04; - v1 = GetMonData(v0, MON_DATA_152, NULL); + v1 = Pokemon_GetValue(v0, MON_DATA_152, NULL); if (((v1 >= 3) && (v1 <= 14)) || ((v1 >= 64) && (v1 <= 71))) { return 1; diff --git a/src/overlay097/ov97_02233B18.c b/src/overlay097/ov97_02233B18.c index af0da16353..5aa059f492 100644 --- a/src/overlay097/ov97_02233B18.c +++ b/src/overlay097/ov97_02233B18.c @@ -397,7 +397,7 @@ static void ov97_02233D10 (UnkStruct_ov97_02234A2C * param0) UnkStruct_02024440 * v7; v7 = sub_02024440(param0->unk_10); - v4 = GetBoxMon(&v6); + v4 = Pokemon_GetBoxPokemon(&v6); for (v0 = 0; v0 < 6; v0++) { v2 = param0->unk_42C[v0].unk_04; diff --git a/src/overlay097/ov97_02236380.c b/src/overlay097/ov97_02236380.c index 9629a7f0c4..3119d8b30b 100644 --- a/src/overlay097/ov97_02236380.c +++ b/src/overlay097/ov97_02236380.c @@ -1314,7 +1314,7 @@ u32 ov97_02236E00 (BoxPokemonGBA * param0) v0 = ov97_02236DD0(GetGBABoxMonData(param0, 11, 0)); v1 = GetGBABoxMonData(param0, 25, 0); - return GetMonSpeciesLevel(v0, v1); + return Pokemon_GetSpeciesLevelAt(v0, v1); } static int ov97_02236E28 (BoxPokemonGBA * param0, BoxPokemon * param1) @@ -1324,23 +1324,23 @@ static int ov97_02236E28 (BoxPokemonGBA * param0, BoxPokemon * param1) u16 v2; int v3; - v2 = GetBoxMonData(param1, MON_DATA_SPECIES, NULL); + v2 = BoxPokemon_GetValue(param1, MON_DATA_SPECIES, NULL); v3 = GetGBABoxMonData(param0, 46, NULL); - v1 = GetMonSpeciesPersonalDataAttribute(v2, 25); + v1 = PokemonPersonalData_GetSpeciesValue(v2, 25); if (v1) { for (v0 = 0; v0 < (sizeof(Unk_ov97_0223ECA0) / 2); v0++) { if (Unk_ov97_0223ECA0[v0] == v2) { - v1 = GetMonSpeciesPersonalDataAttribute(v2, 24); + v1 = PokemonPersonalData_GetSpeciesValue(v2, 24); break; } } if ((v0 == (sizeof(Unk_ov97_0223ECA0) / 2)) && ((v3 & 1) == 0)) { - v1 = GetMonSpeciesPersonalDataAttribute(v2, 24); + v1 = PokemonPersonalData_GetSpeciesValue(v2, 24); } } else { - v1 = GetMonSpeciesPersonalDataAttribute(v2, 24); + v1 = PokemonPersonalData_GetSpeciesValue(v2, 24); } return v1; @@ -1355,17 +1355,17 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) u8 v5[10 + 1]; u16 v6[12]; - ZeroBoxMonData(param1); + BoxPokemon_Init(param1); - v0 = DecryptBoxMon(param1); + v0 = BoxPokemon_EnterDecryptionContext(param1); v1 = GetGBABoxMonData(param0, 0, NULL); - SetBoxMonData(param1, 0, (u8 *)&v1); + BoxPokemon_SetValue(param1, 0, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 11, NULL); v1 = ov97_02236DD0(v1); - SetBoxMonData(param1, 5, (u8 *)&v1); + BoxPokemon_SetValue(param1, 5, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 12, NULL); @@ -1373,61 +1373,61 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) v1 = Item_FromGBAID(v1); } - SetBoxMonData(param1, 6, (u8 *)&v1); + BoxPokemon_SetValue(param1, 6, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 1, NULL); - SetBoxMonData(param1, 7, (u8 *)&v1); + BoxPokemon_SetValue(param1, 7, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 25, NULL); - SetBoxMonData(param1, 8, (u8 *)&v1); + BoxPokemon_SetValue(param1, 8, (u8 *)&v1); v1 = 70; - SetBoxMonData(param1, 9, (u8 *)&v1); + BoxPokemon_SetValue(param1, 9, (u8 *)&v1); v1 = ov97_02236E28(param0, param1); - SetBoxMonData(param1, 10, (u8 *)&v1); + BoxPokemon_SetValue(param1, 10, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 8, NULL); - SetBoxMonData(param1, 11, (u8 *)&v1); + BoxPokemon_SetValue(param1, 11, (u8 *)&v1); v4 = GetGBABoxMonData(param0, 3, NULL); - SetBoxMonData(param1, 12, (u8 *)&v4); + BoxPokemon_SetValue(param1, 12, (u8 *)&v4); v1 = GetGBABoxMonData(param0, 26, NULL); - SetBoxMonData(param1, 13, (u8 *)&v1); + BoxPokemon_SetValue(param1, 13, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 27, NULL); - SetBoxMonData(param1, 14, (u8 *)&v1); + BoxPokemon_SetValue(param1, 14, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 28, NULL); - SetBoxMonData(param1, 15, (u8 *)&v1); + BoxPokemon_SetValue(param1, 15, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 29, NULL); - SetBoxMonData(param1, 16, (u8 *)&v1); + BoxPokemon_SetValue(param1, 16, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 30, NULL); - SetBoxMonData(param1, 17, (u8 *)&v1); + BoxPokemon_SetValue(param1, 17, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 31, NULL); - SetBoxMonData(param1, 18, (u8 *)&v1); + BoxPokemon_SetValue(param1, 18, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 22, NULL); - SetBoxMonData(param1, 19, (u8 *)&v1); + BoxPokemon_SetValue(param1, 19, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 23, NULL); - SetBoxMonData(param1, 20, (u8 *)&v1); + BoxPokemon_SetValue(param1, 20, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 24, NULL); - SetBoxMonData(param1, 21, (u8 *)&v1); + BoxPokemon_SetValue(param1, 21, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 33, NULL); - SetBoxMonData(param1, 22, (u8 *)&v1); + BoxPokemon_SetValue(param1, 22, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 47, NULL); - SetBoxMonData(param1, 23, (u8 *)&v1); + BoxPokemon_SetValue(param1, 23, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 48, NULL); - SetBoxMonData(param1, 24, (u8 *)&v1); + BoxPokemon_SetValue(param1, 24, (u8 *)&v1); for (v2 = 0; v2 < 4; v2++) { v1 = GetGBABoxMonData(param0, 13 + v2, NULL); @@ -1436,44 +1436,44 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) (void)0; } - SetBoxMonData(param1, 54 + v2, (u8 *)&v1); + BoxPokemon_SetValue(param1, 54 + v2, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 21, NULL); v1 = (v1 & (0x3 << (v2 * 2))) >> (v2 * 2); - SetBoxMonData(param1, 62 + v2, (u8 *)&v1); + BoxPokemon_SetValue(param1, 62 + v2, (u8 *)&v1); - v1 = GetBoxMonData(param1, 66 + v2, NULL); - SetBoxMonData(param1, 58 + v2, (u8 *)&v1); + v1 = BoxPokemon_GetValue(param1, 66 + v2, NULL); + BoxPokemon_SetValue(param1, 58 + v2, (u8 *)&v1); } v1 = GetGBABoxMonData(param0, 39, NULL); - SetBoxMonData(param1, 70, (u8 *)&v1); + BoxPokemon_SetValue(param1, 70, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 40, NULL); - SetBoxMonData(param1, 71, (u8 *)&v1); + BoxPokemon_SetValue(param1, 71, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 41, NULL); - SetBoxMonData(param1, 72, (u8 *)&v1); + BoxPokemon_SetValue(param1, 72, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 42, NULL); - SetBoxMonData(param1, 73, (u8 *)&v1); + BoxPokemon_SetValue(param1, 73, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 43, NULL); - SetBoxMonData(param1, 74, (u8 *)&v1); + BoxPokemon_SetValue(param1, 74, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 44, NULL); - SetBoxMonData(param1, 75, (u8 *)&v1); + BoxPokemon_SetValue(param1, 75, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 45, NULL); - SetBoxMonData(param1, 76, (u8 *)&v1); + BoxPokemon_SetValue(param1, 76, (u8 *)&v1); v3 = GetGBABoxMonData(param0, 50, NULL); if (v3 <= 4) { for (v2 = 0; v2 < v3; v2++) { v1 = 1; - SetBoxMonData(param1, 78 + v2, (u8 *)&v1); + BoxPokemon_SetValue(param1, 78 + v2, (u8 *)&v1); } } @@ -1482,7 +1482,7 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) if (v3 <= 4) { for (v2 = 0; v2 < v3; v2++) { v1 = 1; - SetBoxMonData(param1, 82 + v2, (u8 *)&v1); + BoxPokemon_SetValue(param1, 82 + v2, (u8 *)&v1); } } @@ -1491,7 +1491,7 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) if (v3 <= 4) { for (v2 = 0; v2 < v3; v2++) { v1 = 1; - SetBoxMonData(param1, 86 + v2, (u8 *)&v1); + BoxPokemon_SetValue(param1, 86 + v2, (u8 *)&v1); } } @@ -1500,7 +1500,7 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) if (v3 <= 4) { for (v2 = 0; v2 < v3; v2++) { v1 = 1; - SetBoxMonData(param1, 90 + v2, (u8 *)&v1); + BoxPokemon_SetValue(param1, 90 + v2, (u8 *)&v1); } } @@ -1509,60 +1509,60 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) if (v3 <= 4) { for (v2 = 0; v2 < v3; v2++) { v1 = 1; - SetBoxMonData(param1, 94 + v2, (u8 *)&v1); + BoxPokemon_SetValue(param1, 94 + v2, (u8 *)&v1); } } v1 = GetGBABoxMonData(param0, 67, NULL); - SetBoxMonData(param1, 98, (u8 *)&v1); + BoxPokemon_SetValue(param1, 98, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 68, NULL); - SetBoxMonData(param1, 99, (u8 *)&v1); + BoxPokemon_SetValue(param1, 99, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 69, NULL); - SetBoxMonData(param1, 100, (u8 *)&v1); + BoxPokemon_SetValue(param1, 100, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 70, NULL); - SetBoxMonData(param1, 101, (u8 *)&v1); + BoxPokemon_SetValue(param1, 101, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 71, NULL); - SetBoxMonData(param1, 102, (u8 *)&v1); + BoxPokemon_SetValue(param1, 102, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 72, NULL); - SetBoxMonData(param1, 103, (u8 *)&v1); + BoxPokemon_SetValue(param1, 103, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 73, NULL); - SetBoxMonData(param1, 104, (u8 *)&v1); + BoxPokemon_SetValue(param1, 104, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 74, NULL); - SetBoxMonData(param1, 105, (u8 *)&v1); + BoxPokemon_SetValue(param1, 105, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 75, NULL); - SetBoxMonData(param1, 106, (u8 *)&v1); + BoxPokemon_SetValue(param1, 106, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 76, NULL); - SetBoxMonData(param1, 107, (u8 *)&v1); + BoxPokemon_SetValue(param1, 107, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 77, NULL); - SetBoxMonData(param1, 108, (u8 *)&v1); + BoxPokemon_SetValue(param1, 108, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 78, NULL); - SetBoxMonData(param1, 109, (u8 *)&v1); + BoxPokemon_SetValue(param1, 109, (u8 *)&v1); v1 = GetGBABoxMonData(param0, 80, NULL); - SetBoxMonData(param1, 110, (u8 *)&v1); + BoxPokemon_SetValue(param1, 110, (u8 *)&v1); - v1 = GetBoxMonGender(param1); - SetBoxMonData(param1, 111, (u8 *)&v1); + v1 = BoxPokemon_GetGender(param1); + BoxPokemon_SetValue(param1, 111, (u8 *)&v1); - if (GetBoxMonData(param1, MON_DATA_SPECIES, NULL) == 201) { + if (BoxPokemon_GetValue(param1, MON_DATA_SPECIES, NULL) == 201) { v1 = GetGBABoxMonData(param0, 0, NULL); v1 = (((v1 & 0x3000000) >> 18) | ((v1 & 0x30000) >> 12) | ((v1 & 0x300) >> 6) | (v1 & 0x3)) % 28; - SetBoxMonData(param1, 112, (u8 *)&v1); + BoxPokemon_SetValue(param1, 112, (u8 *)&v1); } - if (GetBoxMonData(param1, MON_DATA_SPECIES, NULL) == 386) { + if (BoxPokemon_GetValue(param1, MON_DATA_SPECIES, NULL) == 386) { switch (Unk_021BF67C.unk_66) { default: case 2: @@ -1580,40 +1580,40 @@ void BoxMonGBAToBoxMon (BoxPokemonGBA * param0, BoxPokemon * param1) break; } - SetBoxMonData(param1, 112, (u8 *)&v1); + BoxPokemon_SetValue(param1, 112, (u8 *)&v1); } GetGBABoxMonData(param0, 2, &v5[0]); ov97_0223936C(&v5[0], &v6[0], 12, v4); - SetBoxMonData(param1, 118, &v6[0]); + BoxPokemon_SetValue(param1, 118, &v6[0]); if (GetGBABoxMonData(param0, 3, NULL) != Unk_020E4C44) { v1 = 1; - SetBoxMonData(param1, 77, &v1); + BoxPokemon_SetValue(param1, 77, &v1); } v1 = GetGBABoxMonData(param0, 37, NULL); - SetBoxMonData(param1, 122, &v1); + BoxPokemon_SetValue(param1, 122, &v1); GetGBABoxMonData(param0, 7, &v5[0]); ov97_0223936C(&v5[0], &v6[0], 8, v4); - SetBoxMonData(param1, 144, &v6[0]); + BoxPokemon_SetValue(param1, 144, &v6[0]); v1 = GetGBABoxMonData(param0, 35, NULL); - SetBoxMonData(param1, 153, &v1); + BoxPokemon_SetValue(param1, 153, &v1); v1 = GetGBABoxMonData(param0, 34, NULL); - SetBoxMonData(param1, 154, &v1); + BoxPokemon_SetValue(param1, 154, &v1); v1 = GetGBABoxMonData(param0, 38, NULL); - SetBoxMonData(param1, 155, &v1); + BoxPokemon_SetValue(param1, 155, &v1); v1 = GetGBABoxMonData(param0, 36, NULL); - SetBoxMonData(param1, 156, &v1); + BoxPokemon_SetValue(param1, 156, &v1); v1 = GetGBABoxMonData(param0, 49, NULL); - SetBoxMonData(param1, 157, &v1); - EncryptBoxMon(param1, v0); + BoxPokemon_SetValue(param1, 157, &v1); + BoxPokemon_ExitDecryptionContext(param1, v0); } diff --git a/src/overlay097/ov97_02237694.c b/src/overlay097/ov97_02237694.c index 670b7bb2c4..625cd22823 100644 --- a/src/overlay097/ov97_02237694.c +++ b/src/overlay097/ov97_02237694.c @@ -579,12 +579,12 @@ static void ov97_02237EF8 (UnkStruct_02022550 * param0, Pokemon * param1, int pa u32 v2; UnkStruct_ov97_0223F550 * v3 = &Unk_ov97_0223F550; - v0 = GetMonGender(param1); - v1 = GetMonShininess(param1); + v0 = Pokemon_GetGender(param1); + v1 = Pokemon_IsShiny(param1); sub_02075FB4(param5, param2, v0, 2, v1, param3, 0); - v2 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); + v2 = Pokemon_GetValue(param1, MON_DATA_PERSONALITY, NULL); sub_020136A4(param5->unk_00, param5->unk_02, v3->unk_08, 0, 0, 10, 10, param4, v2, 0, 2, param2); DC_FlushRange(param4, 0x20 * 10 * 10); @@ -625,7 +625,7 @@ static void ov97_02237FF4 (UnkStruct_ov97_0223F550 * param0, int param1, UnkStru switch (param1) { case 1: case 13: - ov97_02237EF8(param0->unk_26C, v0, GetMonData(v0, MON_DATA_SPECIES, 0), GetMonData(v0, MON_DATA_FORM, 0), param0->unk_278, ¶m0->unk_EF8); + ov97_02237EF8(param0->unk_26C, v0, Pokemon_GetValue(v0, MON_DATA_SPECIES, 0), Pokemon_GetValue(v0, MON_DATA_FORM, 0), param0->unk_278, ¶m0->unk_EF8); break; case 2: ov97_02237EF8(param0->unk_26C, v0, 494, 0, param0->unk_278, ¶m0->unk_EF8); diff --git a/src/overlay104/ov104_0222DCE0.c b/src/overlay104/ov104_0222DCE0.c index 58bd6c5418..ee1726b6a6 100644 --- a/src/overlay104/ov104_0222DCE0.c +++ b/src/overlay104/ov104_0222DCE0.c @@ -197,7 +197,7 @@ u32 ov104_0222DD6C (UnkStruct_ov104_0223A348_sub2 * param0, u16 param1, u32 para if (param3 == 0) { do { v2 = (LCRNG_Next() | LCRNG_Next() << 16); - } while ((v4.unk_0B != GetNatureFromPersonality(v2)) || (GetMonPersonalityShininess(param2, v2) == 1)); + } while ((v4.unk_0B != Pokemon_GetNatureOf(v2)) || (Pokemon_IsPersonalityShiny(param2, v2) == 1)); param0->unk_10 = v2; } else { @@ -215,7 +215,7 @@ u32 ov104_0222DD6C (UnkStruct_ov104_0223A348_sub2 * param0, u16 param1, u32 para v1 = 0; for (v0 = 0; v0 < 6; v0++) { - if (v4.unk_0A & GetSingleBitMask(v0)) { + if (v4.unk_0A & Pokemon_GetFlagMaskOf(v0)) { v1++; } } @@ -227,7 +227,7 @@ u32 ov104_0222DD6C (UnkStruct_ov104_0223A348_sub2 * param0, u16 param1, u32 para } for (v0 = 0; v0 < 6; v0++) { - if (v4.unk_0A & GetSingleBitMask(v0)) { + if (v4.unk_0A & Pokemon_GetFlagMaskOf(v0)) { param0->unk_18_val2[v0] = v1; } } @@ -235,16 +235,16 @@ u32 ov104_0222DD6C (UnkStruct_ov104_0223A348_sub2 * param0, u16 param1, u32 para param0->unk_1E_val2 = 0; param0->unk_1F = Unk_020E4C44; - v0 = GetMonSpeciesPersonalDataAttribute(param0->unk_00_val1_0, 25); + v0 = PokemonPersonalData_GetSpeciesValue(param0->unk_00_val1_0, 25); if (v0) { if (param0->unk_10 & 1) { param0->unk_20 = v0; } else { - param0->unk_20 = GetMonSpeciesPersonalDataAttribute(param0->unk_00_val1_0, 24); + param0->unk_20 = PokemonPersonalData_GetSpeciesValue(param0->unk_00_val1_0, 24); } } else { - param0->unk_20 = GetMonSpeciesPersonalDataAttribute(param0->unk_00_val1_0, 24); + param0->unk_20 = PokemonPersonalData_GetSpeciesValue(param0->unk_00_val1_0, 24); } param0->unk_21 = v3; @@ -261,7 +261,7 @@ void ov104_0222DF40 (const UnkStruct_ov104_0223A348_sub2 * param0, Pokemon * par u16 v5; u32 v6; - ZeroMonData(param1); + Pokemon_Init(param1); if (param2 == 120) { v4 = 50; @@ -274,48 +274,48 @@ void ov104_0222DF40 (const UnkStruct_ov104_0223A348_sub2 * param0, Pokemon * par v1 = (param0->unk_14_val2 & 0x3FFFFFFF); sub_02073D80(param1, param0->unk_00_val1_0, v4, v1, 1, param0->unk_10, 2, 0); - SetMonData(param1, 175, &v1); - CalculateMonLevelAndStats(param1); + Pokemon_SetValue(param1, 175, &v1); + Pokemon_CalcLevelAndStats(param1); v2 = param0->unk_00_val1_11; - SetMonData(param1, 112, &v2); - SetMonData(param1, 6, ¶m0->unk_02); + Pokemon_SetValue(param1, 112, &v2); + Pokemon_SetValue(param1, 6, ¶m0->unk_02); for (v0 = 0; v0 < 4; v0++) { v5 = param0->unk_04[v0]; - SetMonData(param1, 54 + v0, &v5); + Pokemon_SetValue(param1, 54 + v0, &v5); v2 = (param0->unk_1E_val2 >> (v0 * 2)) & 0x3; - SetMonData(param1, 62 + v0, &v2); + Pokemon_SetValue(param1, 62 + v0, &v2); - v3 = (u8)GetMonData(param1, MON_DATA_MOVE1_MAX_PP + v0, NULL); - SetMonData(param1, 58 + v0, &v3); + v3 = (u8)Pokemon_GetValue(param1, MON_DATA_MOVE1_MAX_PP + v0, NULL); + Pokemon_SetValue(param1, 58 + v0, &v3); } v6 = param0->unk_0C; - SetMonData(param1, 7, &v6); + Pokemon_SetValue(param1, 7, &v6); v2 = param0->unk_18_val1_00; - SetMonData(param1, 13, &v2); + Pokemon_SetValue(param1, 13, &v2); v2 = param0->unk_18_val1_01; - SetMonData(param1, 14, &v2); + Pokemon_SetValue(param1, 14, &v2); v2 = param0->unk_18_val1_02; - SetMonData(param1, 15, &v2); + Pokemon_SetValue(param1, 15, &v2); v2 = param0->unk_18_val1_03; - SetMonData(param1, 16, &v2); + Pokemon_SetValue(param1, 16, &v2); v2 = param0->unk_18_val1_04; - SetMonData(param1, 17, &v2); + Pokemon_SetValue(param1, 17, &v2); v2 = param0->unk_18_val1_05; - SetMonData(param1, 18, &v2); + Pokemon_SetValue(param1, 18, &v2); - SetMonData(param1, 10, ¶m0->unk_20); - SetMonData(param1, 9, ¶m0->unk_21); + Pokemon_SetValue(param1, 10, ¶m0->unk_20); + Pokemon_SetValue(param1, 9, ¶m0->unk_21); if (param0->unk_14_val1_30) { MessageLoader * v7; @@ -324,15 +324,15 @@ void ov104_0222DF40 (const UnkStruct_ov104_0223A348_sub2 * param0, Pokemon * par v7 = MessageLoader_Init(1, 26, 412, 4); v8 = MessageLoader_GetNewStrbuf(v7, param0->unk_00_val1_0); - SetMonData(param1, 119, v8); + Pokemon_SetValue(param1, 119, v8); Strbuf_Free(v8); MessageLoader_Free(v7); } else { - SetMonData(param1, 117, param0->unk_22); + Pokemon_SetValue(param1, 117, param0->unk_22); } - SetMonData(param1, 12, ¶m0->unk_1F); - CalculateMonLevelAndStats(param1); + Pokemon_SetValue(param1, 12, ¶m0->unk_1F); + Pokemon_CalcLevelAndStats(param1); } u16 ov104_0222E10C (u8 param0) @@ -359,7 +359,7 @@ void ov104_0222E134 (UnkStruct_021C0794 * param0, Pokemon * param1) int v4 = 0; UnkStruct_02025E6C * v5 = sub_02025E38(param0); - v0 = GetMonData(param1, MON_DATA_OT_ID, NULL); + v0 = Pokemon_GetValue(param1, MON_DATA_OT_ID, NULL); sub_02077EE4(param1, sub_02025E38(param0), 4, 0, 0, 11); v3 = sub_0203A138(562); @@ -368,8 +368,8 @@ void ov104_0222E134 (UnkStruct_021C0794 * param0, Pokemon * param1) v2 = MessageLoader_Init(0, 26, 363, 11); v1 = MessageLoader_GetNewStrbuf(v2, 0); - SetMonData(param1, 145, v1); - SetMonData(param1, 7, &v0); + Pokemon_SetValue(param1, 145, v1); + Pokemon_SetValue(param1, 7, &v0); Strbuf_Free(v1); MessageLoader_Free(v2); diff --git a/src/overlay104/ov104_0222ECE8.c b/src/overlay104/ov104_0222ECE8.c index 922e0616eb..043285ff6d 100644 --- a/src/overlay104/ov104_0222ECE8.c +++ b/src/overlay104/ov104_0222ECE8.c @@ -285,7 +285,7 @@ BOOL ov104_0222EE60 (UnkStruct_ov104_0223B5C0 * param0) v1 = 0; v3 = 512; - v4 = PokemonStructSize(); + v4 = Pokemon_StructSize(); v6 = Party_GetFromSavedata(param0->unk_6FC); v5 = Party_GetPokemonBySlotIndex(v6, param0->unk_260[0]); @@ -313,7 +313,7 @@ void ov104_0222EEA8 (int param0, int param1, void * param2, void * param3) return; } - v2 = PokemonStructSize(); + v2 = Pokemon_StructSize(); MI_CpuCopy8(&v4[0], v3->unk_D8C, v2); return; @@ -670,8 +670,8 @@ BOOL ov104_0222F238 (UnkStruct_ov104_0223ADA0 * param0) for (v1 = 0; v1 < v0; v1++) { v8 = Party_GetPokemonBySlotIndex(param0->unk_4D4, v1); - v7[v1] = GetMonData(v8, MON_DATA_ATK_IV, NULL); - v6[v1] = GetMonData(v8, MON_DATA_PERSONALITY, NULL); + v7[v1] = Pokemon_GetValue(v8, MON_DATA_ATK_IV, NULL); + v6[v1] = Pokemon_GetValue(v8, MON_DATA_PERSONALITY, NULL); } for (v1 = 0; v1 < v0; v1++) { @@ -1081,7 +1081,7 @@ BOOL ov104_0222F758 (UnkStruct_ov104_0223BA10 * param0) v1 = 0; v3 = 512; v5 = ov104_0223B7A8(param0->unk_10, 0); - v4 = PokemonStructSize(); + v4 = Pokemon_StructSize(); for (v0 = 0; v0 < v5; v0++) { v6 = Party_GetPokemonBySlotIndex(param0->unk_28, v0); @@ -1113,8 +1113,8 @@ void ov104_0222F7BC (int param0, int param1, void * param2, void * param3) } v0 = ov104_0223B7A8(v5->unk_10, 0); - v3 = PokemonStructSize(); - v4 = AllocMonZeroed(11); + v3 = Pokemon_StructSize(); + v4 = Pokemon_New(11); for (v1 = 0; v1 < v0; v1++) { MI_CpuCopy8(&v6[v3 * v1], v4, v3); @@ -1380,7 +1380,7 @@ BOOL ov104_0222FAD0 (UnkStruct_ov104_0223BFFC * param0) v1 = 0; v3 = 512; v5 = ov104_0223BD70(param0->unk_10, 0); - v4 = PokemonStructSize(); + v4 = Pokemon_StructSize(); for (v0 = 0; v0 < v5; v0++) { v6 = Party_GetPokemonBySlotIndex(param0->unk_70, v0); @@ -1412,8 +1412,8 @@ void ov104_0222FB34 (int param0, int param1, void * param2, void * param3) } v0 = ov104_0223BD70(v5->unk_10, 0); - v3 = PokemonStructSize(); - v4 = AllocMonZeroed(11); + v3 = Pokemon_StructSize(); + v4 = Pokemon_New(11); for (v1 = 0; v1 < v0; v1++) { MI_CpuCopy8(&v6[v3 * v1], v4, v3); diff --git a/src/overlay104/ov104_02231F74.c b/src/overlay104/ov104_02231F74.c index 35b739406f..2bce5ba3e2 100644 --- a/src/overlay104/ov104_02231F74.c +++ b/src/overlay104/ov104_02231F74.c @@ -1120,8 +1120,8 @@ void ov104_02232CE0 (UnkStruct_ov104_0223C4CC * param0, Pokemon * param1, int pa u32 v9, v10; v4 = Heap_AllocFromHeap(param2, (10 * 10 * ((8 / 2) * 8))); - v9 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); - v10 = GetMonData(param1, MON_DATA_SPECIES, NULL); + v9 = Pokemon_GetValue(param1, MON_DATA_PERSONALITY, NULL); + v10 = Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL); sub_02075EF4(&v3, param1, 2); sub_020136A4(v3.unk_00, v3.unk_02, param2, 0, 0, 10, 10, v4, v9, 0, 2, v10); diff --git a/src/overlay104/ov104_022332B4.c b/src/overlay104/ov104_022332B4.c index 6070f6ef95..8236b8037a 100644 --- a/src/overlay104/ov104_022332B4.c +++ b/src/overlay104/ov104_022332B4.c @@ -305,9 +305,9 @@ BOOL ov104_022334DC (UnkStruct_ov104_0222E930 * param0) *v15 = v4->unk_3F0[v13].unk_04[v14]; break; case 17: - v3 = AllocMonZeroed(11); + v3 = Pokemon_New(11); ov104_0222DF40(&v4->unk_3F0[v13], v3, ov104_0223ADA0(v4)); - *v15 = GetMonData(v3, MON_DATA_177, NULL); + *v15 = Pokemon_GetValue(v3, MON_DATA_177, NULL); Heap_FreeToHeap(v3); break; case 18: @@ -317,13 +317,13 @@ BOOL ov104_022334DC (UnkStruct_ov104_0222E930 * param0) v0[v10] = 0; } - v3 = AllocMonZeroed(11); + v3 = Pokemon_New(11); for (v10 = 0; v10 < v5; v10++) { ov104_0222DF40(&v4->unk_3F0[v10], v3, ov104_0223ADA0(v4)); - v7 = GetMonData(v3, MON_DATA_177, NULL); - v8 = GetMonData(v3, MON_DATA_178, NULL); + v7 = Pokemon_GetValue(v3, MON_DATA_177, NULL); + v8 = Pokemon_GetValue(v3, MON_DATA_178, NULL); if (v7 == v8) { v8 = 0xff; @@ -404,7 +404,7 @@ BOOL ov104_022334DC (UnkStruct_ov104_0222E930 * param0) for (v10 = 0; v10 < v6; v10++) { v3 = Party_GetPokemonBySlotIndex(v4->unk_4D4, v10); - sub_0200B538(param0->unk_00->unk_44, v10, GetBoxMon(v3)); + sub_0200B538(param0->unk_00->unk_44, v10, Pokemon_GetBoxPokemon(v3)); } break; case 35: diff --git a/src/overlay104/ov104_022339B4.c b/src/overlay104/ov104_022339B4.c index 9a464f5ff8..8f54c86980 100644 --- a/src/overlay104/ov104_022339B4.c +++ b/src/overlay104/ov104_022339B4.c @@ -188,7 +188,7 @@ static void ov104_02233BAC (UnkStruct_ov104_0223ADA0 * param0) } for (v0 = 0; v0 < 6; v0++) { - v4 = AllocMonZeroed(11); + v4 = Pokemon_New(11); ov104_0222DF40(¶m0->unk_280[v0], v4, ov104_0223ADA0(param0)); ov104_0222E1C0(param0->unk_4F8, param0->unk_4D4, v4); Heap_FreeToHeap(v4); @@ -272,7 +272,7 @@ static void ov104_02233F1C (UnkStruct_ov104_0223ADA0 * param0) ov104_0222E330(v4, v6, v5, v7, NULL, 4, 11, 179); - v1 = AllocMonZeroed(11); + v1 = Pokemon_New(11); for (v0 = 0; v0 < 4; v0++) { ov104_0222DF40(&v4[v0], v1, ov104_0223ADA0(param0)); @@ -291,7 +291,7 @@ static void ov104_02233F1C (UnkStruct_ov104_0223ADA0 * param0) ov104_0222E330(v4, v6, v5, v7, NULL, 4, 11, 179); - v1 = AllocMonZeroed(11); + v1 = Pokemon_New(11); for (v0 = 0; v0 < 4; v0++) { ov104_0222DF40(&v4[v0], v1, ov104_0223ADA0(param0)); @@ -417,10 +417,10 @@ void ov104_02234148 (UnkStruct_ov104_0223ADA0 * param0, u8 param1) v6[0] = param0->unk_4E8[v0]; sub_0202FF84(param0->unk_4F4, 4, v0, v6); - v5[0] = GetMonData(v12, MON_DATA_ATK_IV, NULL); + v5[0] = Pokemon_GetValue(v12, MON_DATA_ATK_IV, NULL); sub_0202FF84(param0->unk_4F4, 5, v0, v5); - v7[0] = GetMonData(v12, MON_DATA_PERSONALITY, NULL); + v7[0] = Pokemon_GetValue(v12, MON_DATA_PERSONALITY, NULL); sub_0202FF84(param0->unk_4F4, 6, v0, v7); } @@ -432,10 +432,10 @@ void ov104_02234148 (UnkStruct_ov104_0223ADA0 * param0, u8 param1) v6[0] = param0->unk_3D2[v0]; sub_0202FF84(param0->unk_4F4, 7, v0, v6); - v5[0] = GetMonData(v12, MON_DATA_ATK_IV, NULL); + v5[0] = Pokemon_GetValue(v12, MON_DATA_ATK_IV, NULL); sub_0202FF84(param0->unk_4F4, 8, v0, v5); - v7[0] = GetMonData(v12, MON_DATA_PERSONALITY, NULL); + v7[0] = Pokemon_GetValue(v12, MON_DATA_PERSONALITY, NULL); sub_0202FF84(param0->unk_4F4, 9, v0, v7); } @@ -499,7 +499,7 @@ void ov104_0223449C (UnkStruct_ov104_0223ADA0 * param0) sub_0207A008(param0->unk_4D4); - v3 = AllocMonZeroed(11); + v3 = Pokemon_New(11); for (v0 = 0; v0 < v1; v0++) { ov104_0222DF40(¶m0->unk_280[param0->unk_4DC[v0]], v3, ov104_0223ADA0(param0)); @@ -536,8 +536,8 @@ void ov104_02234570 (UnkStruct_ov104_0223ADA0 * param0) for (v0 = 0; v0 < v1; v0++) { v6 = Party_GetPokemonBySlotIndex(param0->unk_4D4, v0); - v4[v0] = GetMonData(v6, MON_DATA_SPECIES, NULL); - v5[v0] = GetMonData(v6, MON_DATA_HELD_ITEM, NULL); + v4[v0] = Pokemon_GetValue(v6, MON_DATA_SPECIES, NULL); + v5[v0] = Pokemon_GetValue(v6, MON_DATA_HELD_ITEM, NULL); } v2 = v1; @@ -545,8 +545,8 @@ void ov104_02234570 (UnkStruct_ov104_0223ADA0 * param0) for (v0 = 0; v0 < v1; v0++) { v6 = Party_GetPokemonBySlotIndex(param0->unk_4D8, v0); - v4[v0 + v2] = GetMonData(v6, MON_DATA_SPECIES, NULL); - v5[v0 + v2] = GetMonData(v6, MON_DATA_HELD_ITEM, NULL); + v4[v0 + v2] = Pokemon_GetValue(v6, MON_DATA_SPECIES, NULL); + v5[v0 + v2] = Pokemon_GetValue(v6, MON_DATA_HELD_ITEM, NULL); param0->unk_254[v0] = param0->unk_3D2[v0]; } @@ -590,7 +590,7 @@ void ov104_0223470C (UnkStruct_ov104_0223ADA0 * param0) sub_0207A008(param0->unk_4D8); - v3 = AllocMonZeroed(11); + v3 = Pokemon_New(11); for (v0 = 0; v0 < v2; v0++) { ov104_0222DF40(¶m0->unk_3F0[v0], v3, ov104_0223ADA0(param0)); diff --git a/src/overlay104/ov104_02234838.c b/src/overlay104/ov104_02234838.c index 4db5ef1d03..b1acae2a2e 100644 --- a/src/overlay104/ov104_02234838.c +++ b/src/overlay104/ov104_02234838.c @@ -258,7 +258,7 @@ BOOL ov104_02234A1C (UnkStruct_ov104_0222E930 * param0) for (v7 = 0; v7 < v5; v7++) { v1 = Party_GetPokemonBySlotIndex(v2, v3->unk_260[v7]); - SetMonData(v1, 6, &v3->unk_728[v7]); + Pokemon_SetValue(v1, 6, &v3->unk_728[v7]); } break; case 28: @@ -297,7 +297,7 @@ BOOL ov104_02234A1C (UnkStruct_ov104_0222E930 * param0) case 15: v2 = Party_GetFromSavedata(v0->unk_08); v1 = Party_GetPokemonBySlotIndex(v2, v3->unk_260[0]); - *v11 = GetMonData(v1, MON_DATA_SPECIES, NULL); + *v11 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); break; case 35: ov104_022356A0(v3); @@ -414,7 +414,7 @@ BOOL ov104_02234D6C (UnkStruct_ov104_0222E930 * param0) v4 = sub_0209B978(param0->unk_00->unk_00); v2 = Party_GetFromSavedata(v5->unk_08); v3 = Party_GetPokemonBySlotIndex(v2, v4->unk_260[0]); - v1 = GetMonData(v3, MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL); if (v4->unk_04 == 0) { v0 = sub_0202440C(v5->unk_08); diff --git a/src/overlay104/ov104_02234DB4.c b/src/overlay104/ov104_02234DB4.c index bf4a722c1b..8c7ad4bb73 100644 --- a/src/overlay104/ov104_02234DB4.c +++ b/src/overlay104/ov104_02234DB4.c @@ -63,7 +63,7 @@ UnkStruct_ov104_0223B5C0 * ov104_02234DB4 (UnkStruct_021C0794 * param0, u16 para v10->unk_6FC = param0; v10->unk_00 = 11; v10->unk_264 = sub_02079FF4(11); - v10->unk_D8C = AllocMonZeroed(11); + v10->unk_D8C = Pokemon_New(11); v0 = v10->unk_6F8; v1 = sub_0203026C(param0); @@ -114,7 +114,7 @@ UnkStruct_ov104_0223B5C0 * ov104_02234DB4 (UnkStruct_021C0794 * param0, u16 para for (v5 = 0; v5 < v4; v5++) { v9 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v10->unk_6FC), v10->unk_260[v5]); - v10->unk_728[v5] = GetMonData(v9, MON_DATA_HELD_ITEM, NULL); + v10->unk_728[v5] = Pokemon_GetValue(v9, MON_DATA_HELD_ITEM, NULL); } v10->unk_10 = 0; @@ -186,7 +186,7 @@ static void ov104_022350B8 (UnkStruct_ov104_0223B5C0 * param0) } v6 = Party_GetPokemonBySlotIndex(param0->unk_264, 0); - ov104_0223B0C8(1, param0->unk_6F4, v0, param0->unk_05, GetMonData(v6, MON_DATA_SPECIES, NULL), param0->unk_268, v3); + ov104_0223B0C8(1, param0->unk_6F4, v0, param0->unk_05, Pokemon_GetValue(v6, MON_DATA_SPECIES, NULL), param0->unk_268, v3); return; } @@ -267,7 +267,7 @@ void ov104_0223526C (UnkStruct_ov104_0223B5C0 * param0, u8 param1) sub_0203012C(param0->unk_6F8, 1); v10 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_6FC), param0->unk_260[0]); - v9 = GetMonData(v10, MON_DATA_SPECIES, NULL); + v9 = Pokemon_GetValue(v10, MON_DATA_SPECIES, NULL); v8 = sub_02030698(v4, sub_0205E55C(param0->unk_04), sub_0205E6A8(sub_0205E55C(param0->unk_04))); v1[0] = param0->unk_05; @@ -313,7 +313,7 @@ void ov104_0223526C (UnkStruct_ov104_0223B5C0 * param0, u8 param1) sub_02030140(param0->unk_6F8, 4, v0, 0, v2); } - sub_020306E4(v4, sub_0205E55C(param0->unk_04), sub_0205E6A8(sub_0205E55C(param0->unk_04)), GetMonData(v10, MON_DATA_SPECIES, NULL)); + sub_020306E4(v4, sub_0205E55C(param0->unk_04), sub_0205E6A8(sub_0205E55C(param0->unk_04)), Pokemon_GetValue(v10, MON_DATA_SPECIES, NULL)); return; } diff --git a/src/overlay104/ov104_022358E8.c b/src/overlay104/ov104_022358E8.c index 67aabc0c84..63b1da6fbe 100644 --- a/src/overlay104/ov104_022358E8.c +++ b/src/overlay104/ov104_022358E8.c @@ -350,7 +350,7 @@ BOOL ov104_02235BC0 (UnkStruct_ov104_0222E930 * param0) for (v8 = 0; v8 < 3; v8++) { v1 = Party_GetPokemonBySlotIndex(v2, v3->unk_24[v8]); - SetMonData(v1, 6, &v3->unk_36A[v8]); + Pokemon_SetValue(v1, 6, &v3->unk_36A[v8]); } break; case 19: diff --git a/src/overlay104/ov104_022361B4.c b/src/overlay104/ov104_022361B4.c index 6e8a89c489..a567d7b028 100644 --- a/src/overlay104/ov104_022361B4.c +++ b/src/overlay104/ov104_022361B4.c @@ -136,7 +136,7 @@ UnkStruct_ov104_0223BA10 * ov104_022361B4 (UnkStruct_021C0794 * param0, u16 para for (v7 = 0; v7 < 3; v7++) { v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v9->unk_04), v9->unk_24[v7]); - v9->unk_36A[v7] = GetMonData(v3, MON_DATA_HELD_ITEM, NULL); + v9->unk_36A[v7] = Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL); } v2 = Party_GetFromSavedata(v9->unk_04); @@ -148,12 +148,12 @@ UnkStruct_ov104_0223BA10 * ov104_022361B4 (UnkStruct_021C0794 * param0, u16 para v3 = Party_GetPokemonBySlotIndex(v9->unk_28, v7); v0 = 0; - SetMonData(v3, 6, &v0); + Pokemon_SetValue(v3, 6, &v0); - if (GetMonData(v3, MON_DATA_LEVEL, NULL) > 50) { - v1 = GetMonSpeciesLevelExp(GetMonData(v3, MON_DATA_SPECIES, NULL), 50); - SetMonData(v3, 8, &v1); - CalculateMonLevelAndStats(v3); + if (Pokemon_GetValue(v3, MON_DATA_LEVEL, NULL) > 50) { + v1 = Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL), 50); + Pokemon_SetValue(v3, 8, &v1); + Pokemon_CalcLevelAndStats(v3); } } @@ -190,10 +190,10 @@ static void ov104_02236528 (UnkStruct_ov104_0223BA10 * param0) for (v1 = 0; v1 < v0; v1++) { v3 = Party_GetPokemonBySlotIndex(param0->unk_28, v1); - param0->unk_394[v1][0] = GetMonData(v3, MON_DATA_MOVE1_CUR_PP, NULL); - param0->unk_394[v1][1] = GetMonData(v3, MON_DATA_MOVE2_CUR_PP, NULL); - param0->unk_394[v1][2] = GetMonData(v3, MON_DATA_MOVE3_CUR_PP, NULL); - param0->unk_394[v1][3] = GetMonData(v3, MON_DATA_MOVE4_CUR_PP, NULL); + param0->unk_394[v1][0] = Pokemon_GetValue(v3, MON_DATA_MOVE1_CUR_PP, NULL); + param0->unk_394[v1][1] = Pokemon_GetValue(v3, MON_DATA_MOVE2_CUR_PP, NULL); + param0->unk_394[v1][2] = Pokemon_GetValue(v3, MON_DATA_MOVE3_CUR_PP, NULL); + param0->unk_394[v1][3] = Pokemon_GetValue(v3, MON_DATA_MOVE4_CUR_PP, NULL); } ov104_0223B760(param0->unk_10, ov104_0223BB60(param0), param0->unk_30, (7 * 2)); @@ -235,7 +235,7 @@ static void ov104_022365F8 (UnkStruct_ov104_0223BA10 * param0) ov104_0222E330(v4, v6, v5, NULL, v7, 4, 11, 179); - v2 = AllocMonZeroed(11); + v2 = Pokemon_New(11); for (v1 = 0; v1 < 4; v1++) { ov104_0222DF40(&v4[v1], v2, ov104_0223BA10(param0)); @@ -262,25 +262,25 @@ static void ov104_022366A4 (UnkStruct_ov104_0223BA10 * param0) v5 = Party_GetPokemonBySlotIndex(param0->unk_28, v4); v2 = (u16)sub_02030398(param0->unk_08, 2, v4, 0, NULL); - SetMonData(v5, 163, &v2); + Pokemon_SetValue(v5, 163, &v2); v3 = (u8)sub_02030398(param0->unk_08, 3, v4, 0, NULL); - SetMonData(v5, 58, &v3); + Pokemon_SetValue(v5, 58, &v3); v3 = (u8)sub_02030398(param0->unk_08, 3, v4, 1, NULL); - SetMonData(v5, 59, &v3); + Pokemon_SetValue(v5, 59, &v3); v3 = (u8)sub_02030398(param0->unk_08, 3, v4, 2, NULL); - SetMonData(v5, 60, &v3); + Pokemon_SetValue(v5, 60, &v3); v3 = (u8)sub_02030398(param0->unk_08, 3, v4, 3, NULL); - SetMonData(v5, 61, &v3); + Pokemon_SetValue(v5, 61, &v3); v1 = (u32)sub_02030398(param0->unk_08, 4, v4, 0, NULL); - SetMonData(v5, 160, &v1); + Pokemon_SetValue(v5, 160, &v1); v2 = (u16)sub_02030398(param0->unk_08, 5, v4, 0, NULL); - SetMonData(v5, 6, &v2); + Pokemon_SetValue(v5, 6, &v2); } return; @@ -409,25 +409,25 @@ void ov104_02236848 (UnkStruct_ov104_0223BA10 * param0, u8 param1) for (v0 = 0; v0 < v8; v0++) { v11 = Party_GetPokemonBySlotIndex(param0->unk_28, v0); - v5[0] = GetMonData(v11, MON_DATA_CURRENT_HP, NULL); + v5[0] = Pokemon_GetValue(v11, MON_DATA_CURRENT_HP, NULL); sub_02030308(param0->unk_08, 2, v0, 0, v5); - v4[0] = GetMonData(v11, MON_DATA_MOVE1_CUR_PP, NULL); + v4[0] = Pokemon_GetValue(v11, MON_DATA_MOVE1_CUR_PP, NULL); sub_02030308(param0->unk_08, 3, v0, 0, v4); - v4[0] = GetMonData(v11, MON_DATA_MOVE2_CUR_PP, NULL); + v4[0] = Pokemon_GetValue(v11, MON_DATA_MOVE2_CUR_PP, NULL); sub_02030308(param0->unk_08, 3, v0, 1, v4); - v4[0] = GetMonData(v11, MON_DATA_MOVE3_CUR_PP, NULL); + v4[0] = Pokemon_GetValue(v11, MON_DATA_MOVE3_CUR_PP, NULL); sub_02030308(param0->unk_08, 3, v0, 2, v4); - v4[0] = GetMonData(v11, MON_DATA_MOVE4_CUR_PP, NULL); + v4[0] = Pokemon_GetValue(v11, MON_DATA_MOVE4_CUR_PP, NULL); sub_02030308(param0->unk_08, 3, v0, 3, v4); - v6[0] = GetMonData(v11, MON_DATA_160, NULL); + v6[0] = Pokemon_GetValue(v11, MON_DATA_160, NULL); sub_02030308(param0->unk_08, 4, v0, 0, v6); - v5[0] = GetMonData(v11, MON_DATA_HELD_ITEM, NULL); + v5[0] = Pokemon_GetValue(v11, MON_DATA_HELD_ITEM, NULL); sub_02030308(param0->unk_08, 5, v0, 0, v5); } @@ -536,10 +536,10 @@ void ov104_02236C50 (UnkStruct_ov104_0223BA10 * param0) for (v2 = v0; v2 < (v1 + v0); v2++) { v4 = Party_GetPokemonBySlotIndex(param0->unk_28, v2); - param0->unk_394[v2 - v0][0] = GetMonData(v4, MON_DATA_MOVE1_CUR_PP, NULL); - param0->unk_394[v2 - v0][1] = GetMonData(v4, MON_DATA_MOVE2_CUR_PP, NULL); - param0->unk_394[v2 - v0][2] = GetMonData(v4, MON_DATA_MOVE3_CUR_PP, NULL); - param0->unk_394[v2 - v0][3] = GetMonData(v4, MON_DATA_MOVE4_CUR_PP, NULL); + param0->unk_394[v2 - v0][0] = Pokemon_GetValue(v4, MON_DATA_MOVE1_CUR_PP, NULL); + param0->unk_394[v2 - v0][1] = Pokemon_GetValue(v4, MON_DATA_MOVE2_CUR_PP, NULL); + param0->unk_394[v2 - v0][2] = Pokemon_GetValue(v4, MON_DATA_MOVE3_CUR_PP, NULL); + param0->unk_394[v2 - v0][3] = Pokemon_GetValue(v4, MON_DATA_MOVE4_CUR_PP, NULL); } ov104_0223BA24(param0->unk_28); @@ -582,12 +582,12 @@ int ov104_02236D10 (UnkStruct_ov104_0223BA10 * param0) for (v5 = v2; v5 < (v0 + v2); v5++) { v9 = Party_GetPokemonBySlotIndex(param0->unk_28, v5); - if (GetMonData(v9, MON_DATA_172, NULL) == 0) { + if (Pokemon_GetValue(v9, MON_DATA_172, NULL) == 0) { continue; } - v3 = GetMonData(v9, MON_DATA_CURRENT_HP, NULL); - v4 = GetMonData(v9, MON_DATA_MAX_HP, NULL); + v3 = Pokemon_GetValue(v9, MON_DATA_CURRENT_HP, NULL); + v4 = Pokemon_GetValue(v9, MON_DATA_MAX_HP, NULL); if (v3 > 0) { v10[0]++; @@ -602,17 +602,17 @@ int ov104_02236D10 (UnkStruct_ov104_0223BA10 * param0) } } - if (GetMonData(v9, MON_DATA_160, NULL) == 0) { + if (Pokemon_GetValue(v9, MON_DATA_160, NULL) == 0) { v10[4]++; } } else { param0->unk_12 = 1; } - v8 += GetMonData(v9, MON_DATA_MOVE1_CUR_PP, NULL); - v8 += GetMonData(v9, MON_DATA_MOVE2_CUR_PP, NULL); - v8 += GetMonData(v9, MON_DATA_MOVE3_CUR_PP, NULL); - v8 += GetMonData(v9, MON_DATA_MOVE4_CUR_PP, NULL); + v8 += Pokemon_GetValue(v9, MON_DATA_MOVE1_CUR_PP, NULL); + v8 += Pokemon_GetValue(v9, MON_DATA_MOVE2_CUR_PP, NULL); + v8 += Pokemon_GetValue(v9, MON_DATA_MOVE3_CUR_PP, NULL); + v8 += Pokemon_GetValue(v9, MON_DATA_MOVE4_CUR_PP, NULL); } for (v5 = 0; v5 < v1; v5++) { diff --git a/src/overlay104/ov104_02237378.c b/src/overlay104/ov104_02237378.c index 5fbd7b9959..d4103e0173 100644 --- a/src/overlay104/ov104_02237378.c +++ b/src/overlay104/ov104_02237378.c @@ -186,12 +186,12 @@ BOOL ov104_02237460 (UnkStruct_ov104_0222E930 * param0) for (v1 = 0; v1 < v0; v1++) { v11 = Party_GetPokemonBySlotIndex(v9->unk_70, v1); - v7 = GetMonData(v11, MON_DATA_LEVEL, NULL); + v7 = Pokemon_GetValue(v11, MON_DATA_LEVEL, NULL); v7 -= 3; - v6 = GetMonSpeciesLevelExp(GetMonData(v11, MON_DATA_SPECIES, NULL), v7); + v6 = Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(v11, MON_DATA_SPECIES, NULL), v7); - SetMonData(v11, 8, &v6); - CalculateMonLevelAndStats(v11); + Pokemon_SetValue(v11, 8, &v6); + Pokemon_CalcLevelAndStats(v11); } } @@ -201,23 +201,23 @@ BOOL ov104_02237460 (UnkStruct_ov104_0222E930 * param0) v11 = Party_GetPokemonBySlotIndex(v9->unk_70, v1); v5 = v9->unk_94[v1]; - SetMonData(v11, 164, &v5); - SetMonData(v11, 163, &v5); + Pokemon_SetValue(v11, 164, &v5); + Pokemon_SetValue(v11, 163, &v5); v5 = v9->unk_A4[v1]; - SetMonData(v11, 165, &v5); + Pokemon_SetValue(v11, 165, &v5); v5 = v9->unk_B4[v1]; - SetMonData(v11, 166, &v5); + Pokemon_SetValue(v11, 166, &v5); v5 = v9->unk_C4[v1]; - SetMonData(v11, 167, &v5); + Pokemon_SetValue(v11, 167, &v5); v5 = v9->unk_D4[v1]; - SetMonData(v11, 168, &v5); + Pokemon_SetValue(v11, 168, &v5); v5 = v9->unk_E4[v1]; - SetMonData(v11, 169, &v5); + Pokemon_SetValue(v11, 169, &v5); } sub_020520A4(v10); @@ -266,12 +266,12 @@ static void ov104_02237634 (UnkStruct_ov104_02238240 * param0, UnkStruct_ov104_0 for (v0 = 0; v0 < v1; v0++) { v2 = Party_GetPokemonBySlotIndex(param1->unk_70, v0); - param1->unk_94[v0] = GetMonData(v2, MON_DATA_MAX_HP, NULL); - param1->unk_A4[v0] = GetMonData(v2, MON_DATA_ATK, NULL); - param1->unk_B4[v0] = GetMonData(v2, MON_DATA_DEF, NULL); - param1->unk_C4[v0] = GetMonData(v2, MON_DATA_SPEED, NULL); - param1->unk_D4[v0] = GetMonData(v2, MON_DATA_SP_ATK, NULL); - param1->unk_E4[v0] = GetMonData(v2, MON_DATA_SP_DEF, NULL); + param1->unk_94[v0] = Pokemon_GetValue(v2, MON_DATA_MAX_HP, NULL); + param1->unk_A4[v0] = Pokemon_GetValue(v2, MON_DATA_ATK, NULL); + param1->unk_B4[v0] = Pokemon_GetValue(v2, MON_DATA_DEF, NULL); + param1->unk_C4[v0] = Pokemon_GetValue(v2, MON_DATA_SPEED, NULL); + param1->unk_D4[v0] = Pokemon_GetValue(v2, MON_DATA_SP_ATK, NULL); + param1->unk_E4[v0] = Pokemon_GetValue(v2, MON_DATA_SP_DEF, NULL); } return; @@ -368,7 +368,7 @@ BOOL ov104_02237748 (UnkStruct_ov104_0222E930 * param0) v1 = Party_GetPokemonBySlotIndex(v3->unk_74, 0); } - *v20 = GetMonData(v1, MON_DATA_HELD_ITEM, NULL); + *v20 = Pokemon_GetValue(v1, MON_DATA_HELD_ITEM, NULL); break; case 16: *v20 = v3->unk_13; @@ -378,7 +378,7 @@ BOOL ov104_02237748 (UnkStruct_ov104_0222E930 * param0) for (v11 = 0; v11 < 3; v11++) { v1 = Party_GetPokemonBySlotIndex(v2, v3->unk_2C[v11]); - SetMonData(v1, 6, &v3->unk_412[v11]); + Pokemon_SetValue(v1, 6, &v3->unk_412[v11]); } break; case 19: diff --git a/src/overlay104/ov104_02237DD8.c b/src/overlay104/ov104_02237DD8.c index f4a0c861dc..3ff31446a9 100644 --- a/src/overlay104/ov104_02237DD8.c +++ b/src/overlay104/ov104_02237DD8.c @@ -206,7 +206,7 @@ UnkStruct_ov104_0223BFFC * ov104_02237DD8 (UnkStruct_021C0794 * param0, u16 para for (v7 = 0; v7 < 3; v7++) { v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v9->unk_04), v9->unk_2C[v7]); - v9->unk_412[v7] = GetMonData(v3, MON_DATA_HELD_ITEM, NULL); + v9->unk_412[v7] = Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL); } v2 = Party_GetFromSavedata(v9->unk_04); @@ -218,12 +218,12 @@ UnkStruct_ov104_0223BFFC * ov104_02237DD8 (UnkStruct_021C0794 * param0, u16 para v3 = Party_GetPokemonBySlotIndex(v9->unk_70, v7); v0 = 0; - SetMonData(v3, 6, &v0); + Pokemon_SetValue(v3, 6, &v0); - if (GetMonData(v3, MON_DATA_LEVEL, NULL) > 50) { - v1 = GetMonSpeciesLevelExp(GetMonData(v3, MON_DATA_SPECIES, NULL), 50); - SetMonData(v3, 8, &v1); - CalculateMonLevelAndStats(v3); + if (Pokemon_GetValue(v3, MON_DATA_LEVEL, NULL) > 50) { + v1 = Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL), 50); + Pokemon_SetValue(v3, 8, &v1); + Pokemon_CalcLevelAndStats(v3); } } @@ -303,7 +303,7 @@ static void ov104_02238114 (UnkStruct_ov104_0223BFFC * param0) ov104_0222E330(v4, v6, v5, NULL, v7, 4, 11, 179); - v2 = AllocMonZeroed(11); + v2 = Pokemon_New(11); for (v1 = 0; v1 < 4; v1++) { ov104_0222DF40(&v4[v1], v2, ov104_0223BFFC(param0)); @@ -328,7 +328,7 @@ static void ov104_022381C4 (UnkStruct_ov104_0223BFFC * param0) v3 = Party_GetPokemonBySlotIndex(param0->unk_70, v2); v1 = (u16)sub_0203054C(param0->unk_08, 4, v2, 0, NULL); - SetMonData(v3, 6, &v1); + Pokemon_SetValue(v3, 6, &v1); } return; @@ -435,7 +435,7 @@ void ov104_02238278 (UnkStruct_ov104_0223BFFC * param0, u8 param1) for (v0 = 0; v0 < v6; v0++) { v7 = Party_GetPokemonBySlotIndex(param0->unk_70, v0); - v3[0] = GetMonData(v7, MON_DATA_HELD_ITEM, NULL); + v3[0] = Pokemon_GetValue(v7, MON_DATA_HELD_ITEM, NULL); sub_020304CC(param0->unk_08, 4, v0, 0, v3); } @@ -586,17 +586,17 @@ static int ov104_02238584 (UnkStruct_ov104_0223BFFC * param0, Party * param1, Pa for (v3 = 0; v3 < param3; v3++) { v5 = Party_GetPokemonBySlotIndex(param1, v3); - if (GetMonData(v5, MON_DATA_172, NULL) == 0) { + if (Pokemon_GetValue(v5, MON_DATA_172, NULL) == 0) { continue; } - v0 = GetMonData(v5, MON_DATA_CURRENT_HP, NULL); + v0 = Pokemon_GetValue(v5, MON_DATA_CURRENT_HP, NULL); if (v0 == 0) { v1++; } - if (GetMonData(v5, MON_DATA_160, NULL) != 0) { + if (Pokemon_GetValue(v5, MON_DATA_160, NULL) != 0) { v2++; } } @@ -605,17 +605,17 @@ static int ov104_02238584 (UnkStruct_ov104_0223BFFC * param0, Party * param1, Pa for (v3 = 0; v3 < param3; v3++) { v5 = Party_GetPokemonBySlotIndex(param2, v3); - if (GetMonData(v5, MON_DATA_172, NULL) == 0) { + if (Pokemon_GetValue(v5, MON_DATA_172, NULL) == 0) { continue; } - v0 = GetMonData(v5, MON_DATA_CURRENT_HP, NULL); + v0 = Pokemon_GetValue(v5, MON_DATA_CURRENT_HP, NULL); if (v0 == 0) { v1++; } - if (GetMonData(v5, MON_DATA_160, NULL) != 0) { + if (Pokemon_GetValue(v5, MON_DATA_160, NULL) != 0) { v2++; } } @@ -793,7 +793,7 @@ void ov104_022388DC (UnkStruct_ov104_0223BFFC * param0, UnkStruct_ov104_0223C4CC v3 = Party_GetPokemonBySlotIndex(param0->unk_70, v2); - if (GetMonData(v3, MON_DATA_HELD_ITEM, NULL) == 0) { + if (Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL) == 0) { sub_02021CAC(param0->unk_50[v2]->unk_00, 0); } } @@ -803,7 +803,7 @@ void ov104_022388DC (UnkStruct_ov104_0223BFFC * param0, UnkStruct_ov104_0223C4CC v3 = Party_GetPokemonBySlotIndex(param0->unk_74, v2); - if (GetMonData(v3, MON_DATA_HELD_ITEM, NULL) == 0) { + if (Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL) == 0) { sub_02021CAC(param0->unk_60[v2]->unk_00, 0); } } @@ -848,7 +848,7 @@ void ov104_022389F4 (UnkStruct_ov104_0223BFFC * param0, UnkStruct_ov104_0223C4CC } v3 = Party_GetPokemonBySlotIndex(param0->unk_70, param3); - v0 = GetMonData(v3, MON_DATA_HELD_ITEM, NULL); + v0 = Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL); if (param4 == 1) { if (v0 == 0) { @@ -865,7 +865,7 @@ void ov104_022389F4 (UnkStruct_ov104_0223BFFC * param0, UnkStruct_ov104_0223C4CC } v3 = Party_GetPokemonBySlotIndex(param0->unk_74, param3); - v0 = GetMonData(v3, MON_DATA_HELD_ITEM, NULL); + v0 = Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL); if (param4 == 1) { if (v0 == 0) { @@ -1111,12 +1111,12 @@ static void ov104_02238BBC (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v0 = 0; v0 < param2; v0++) { v3 = Party_GetPokemonBySlotIndex(param1, v0); - v1 = GetMonData(v3, MON_DATA_MAX_HP, NULL); + v1 = Pokemon_GetValue(v3, MON_DATA_MAX_HP, NULL); v2 = (v1 * 1.2); v2 -= v1; v2 = (v1 - v2); - SetMonData(v3, 163, &v2); + Pokemon_SetValue(v3, 163, &v2); } return; @@ -1132,15 +1132,15 @@ static void ov104_02238C18 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v0 = 0; v0 < param2; v0++) { v6 = Party_GetPokemonBySlotIndex(param1, v0); - v3 = GetMonData(v6, MON_DATA_177, NULL); - v4 = GetMonData(v6, MON_DATA_178, NULL); - v5 = GetMonData(v6, MON_DATA_ABILITY, NULL); + v3 = Pokemon_GetValue(v6, MON_DATA_177, NULL); + v4 = Pokemon_GetValue(v6, MON_DATA_178, NULL); + v5 = Pokemon_GetValue(v6, MON_DATA_ABILITY, NULL); if ((v3 == 3) || (v4 == 3) || (v3 == 8) || (v4 == 8) || (v5 == 17)) { v1++; } else { v2 = 0x8; - SetMonData(v6, 160, &v2); + Pokemon_SetValue(v6, 160, &v2); } } @@ -1161,15 +1161,15 @@ static void ov104_02238C9C (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v0 = 0; v0 < param2; v0++) { v6 = Party_GetPokemonBySlotIndex(param1, v0); - v3 = GetMonData(v6, MON_DATA_177, NULL); - v4 = GetMonData(v6, MON_DATA_178, NULL); - v5 = GetMonData(v6, MON_DATA_ABILITY, NULL); + v3 = Pokemon_GetValue(v6, MON_DATA_177, NULL); + v4 = Pokemon_GetValue(v6, MON_DATA_178, NULL); + v5 = Pokemon_GetValue(v6, MON_DATA_ABILITY, NULL); if ((v3 == 4) || (v4 == 4) || (v5 == 7)) { v1++; } else { v2 = 0x40; - SetMonData(v6, 160, &v2); + Pokemon_SetValue(v6, 160, &v2); } } @@ -1190,15 +1190,15 @@ static void ov104_02238D14 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v0 = 0; v0 < param2; v0++) { v6 = Party_GetPokemonBySlotIndex(param1, v0); - v3 = GetMonData(v6, MON_DATA_177, NULL); - v4 = GetMonData(v6, MON_DATA_178, NULL); - v5 = GetMonData(v6, MON_DATA_ABILITY, NULL); + v3 = Pokemon_GetValue(v6, MON_DATA_177, NULL); + v4 = Pokemon_GetValue(v6, MON_DATA_178, NULL); + v5 = Pokemon_GetValue(v6, MON_DATA_ABILITY, NULL); if ((v3 == 10) || (v4 == 10) || (v5 == 41)) { v1++; } else { v2 = 0x10; - SetMonData(v6, 160, &v2); + Pokemon_SetValue(v6, 160, &v2); } } @@ -1221,7 +1221,7 @@ static void ov104_02238D8C (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v1 = 0; v1 < param2; v1++) { v5 = Party_GetPokemonBySlotIndex(param1, v0); - v4 = GetMonData(v5, MON_DATA_ABILITY, NULL); + v4 = Pokemon_GetValue(v5, MON_DATA_ABILITY, NULL); if ((v4 == 15) || (v4 == 72)) { v2++; @@ -1232,7 +1232,7 @@ static void ov104_02238D8C (UnkStruct_ov104_0223BFFC * param0, Party * param1, u } } else { v3 = (LCRNG_Next() % 4 + 2); - SetMonData(v5, 160, &v3); + Pokemon_SetValue(v5, 160, &v3); break; } } @@ -1256,9 +1256,9 @@ static void ov104_02238E08 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v1 = 0; v1 < param2; v1++) { v7 = Party_GetPokemonBySlotIndex(param1, v0); - v4 = GetMonData(v7, MON_DATA_177, NULL); - v5 = GetMonData(v7, MON_DATA_178, NULL); - v6 = GetMonData(v7, MON_DATA_ABILITY, NULL); + v4 = Pokemon_GetValue(v7, MON_DATA_177, NULL); + v5 = Pokemon_GetValue(v7, MON_DATA_178, NULL); + v6 = Pokemon_GetValue(v7, MON_DATA_ABILITY, NULL); if ((v4 == 15) || (v5 == 15) || (v6 == 40)) { v2++; @@ -1269,7 +1269,7 @@ static void ov104_02238E08 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u } } else { v3 = 0x20; - SetMonData(v7, 160, &v3); + Pokemon_SetValue(v7, 160, &v3); break; } @@ -1306,7 +1306,7 @@ static void ov104_02238E9C (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v0 = 0; v0 < param2; v0++) { v5 = Party_GetPokemonBySlotIndex(param1, v0); - SetMonData(v5, 6, &v3); + Pokemon_SetValue(v5, 6, &v3); } return; @@ -1336,7 +1336,7 @@ static void ov104_02238EF8 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v0 = 0; v0 < param2; v0++) { v5 = Party_GetPokemonBySlotIndex(param1, v0); - SetMonData(v5, 6, &v3); + Pokemon_SetValue(v5, 6, &v3); } return; @@ -1350,7 +1350,7 @@ static void ov104_02238F54 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u for (v0 = 0; v0 < param2; v0++) { v3 = Party_GetPokemonBySlotIndex(param1, v0); - v2 = GetMonData(v3, MON_DATA_LEVEL, NULL); + v2 = Pokemon_GetValue(v3, MON_DATA_LEVEL, NULL); v2 += 3; if (v2 > 100) { @@ -1358,10 +1358,10 @@ static void ov104_02238F54 (UnkStruct_ov104_0223BFFC * param0, Party * param1, u v2 = 100; } - v1 = GetMonSpeciesLevelExp(GetMonData(v3, MON_DATA_SPECIES, NULL), v2); + v1 = Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL), v2); - SetMonData(v3, 8, &v1); - CalculateMonLevelAndStats(v3); + Pokemon_SetValue(v3, 8, &v1); + Pokemon_CalcLevelAndStats(v3); } return; @@ -1510,10 +1510,10 @@ void ov104_02239054 (Party * param0, Party * param1, int param2, int param3) Pokemon * v2; v2 = Party_GetPokemonBySlotIndex(param0, param2); - v0 = GetMonData(v2, MON_DATA_HELD_ITEM, NULL); + v0 = Pokemon_GetValue(v2, MON_DATA_HELD_ITEM, NULL); v1 = Party_GetPokemonBySlotIndex(param1, param3); - SetMonData(v1, 6, &v0); + Pokemon_SetValue(v1, 6, &v0); return; } diff --git a/src/overlay104/ov104_0223A0C4.c b/src/overlay104/ov104_0223A0C4.c index 27207483ad..302c783ca0 100644 --- a/src/overlay104/ov104_0223A0C4.c +++ b/src/overlay104/ov104_0223A0C4.c @@ -844,7 +844,7 @@ static u32 ov104_0223A3A8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348 if (param4 == 0) { do { v2 = (sub_0204AEC0(param0) | sub_0204AEC0(param0) << 16); - } while ((v4.unk_0B != GetNatureFromPersonality(v2)) || (GetMonPersonalityShininess(param3, v2) == 1)); + } while ((v4.unk_0B != Pokemon_GetNatureOf(v2)) || (Pokemon_IsPersonalityShiny(param3, v2) == 1)); param1->unk_10 = v2; } else { @@ -862,7 +862,7 @@ static u32 ov104_0223A3A8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348 v1 = 0; for (v0 = 0; v0 < 6; v0++) { - if (v4.unk_0A & GetSingleBitMask(v0)) { + if (v4.unk_0A & Pokemon_GetFlagMaskOf(v0)) { v1++; } } @@ -874,7 +874,7 @@ static u32 ov104_0223A3A8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348 } for (v0 = 0; v0 < 6; v0++) { - if (v4.unk_0A & GetSingleBitMask(v0)) { + if (v4.unk_0A & Pokemon_GetFlagMaskOf(v0)) { param1->unk_18_val2[v0] = v1; } } @@ -882,16 +882,16 @@ static u32 ov104_0223A3A8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348 param1->unk_1E_val2 = 0; param1->unk_1F = Unk_020E4C44; - v0 = GetMonSpeciesPersonalDataAttribute(param1->unk_00_val1_0, 25); + v0 = PokemonPersonalData_GetSpeciesValue(param1->unk_00_val1_0, 25); if (v0) { if (param1->unk_10 & 1) { param1->unk_20 = v0; } else { - param1->unk_20 = GetMonSpeciesPersonalDataAttribute(param1->unk_00_val1_0, 24); + param1->unk_20 = PokemonPersonalData_GetSpeciesValue(param1->unk_00_val1_0, 24); } } else { - param1->unk_20 = GetMonSpeciesPersonalDataAttribute(param1->unk_00_val1_0, 24); + param1->unk_20 = PokemonPersonalData_GetSpeciesValue(param1->unk_00_val1_0, 24); } param1->unk_21 = v3; @@ -919,19 +919,19 @@ BattleParams * ov104_0223A580 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223 v3->unk_128 = 18; v3->unk_12C = 18; - v6 = AllocMonZeroed(param0->unk_04); + v6 = Pokemon_New(param0->unk_04); v1 = 50; Party_InitWithCapacity(v3->parties[0], param0->unk_0E); for (v0 = 0; v0 < param0->unk_0E; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(v5, param0->unk_2A[v0]), v6); + Pokemon_Copy(Party_GetPokemonBySlotIndex(v5, param0->unk_2A[v0]), v6); - if (GetMonData(v6, MON_DATA_LEVEL, NULL) > v1) { - v2 = GetMonSpeciesLevelExp(GetMonData(v6, MON_DATA_SPECIES, NULL), v1); + if (Pokemon_GetValue(v6, MON_DATA_LEVEL, NULL) > v1) { + v2 = Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(v6, MON_DATA_SPECIES, NULL), v1); - SetMonData(v6, 8, &v2); - CalculateMonLevelAndStats(v6); + Pokemon_SetValue(v6, 8, &v2); + Pokemon_CalcLevelAndStats(v6); } sub_0205213C(v3, v6, 0); @@ -966,7 +966,7 @@ static void ov104_0223A6AC (BattleParams * param0, UnkStruct_ov104_0223A348 * pa Pokemon * v2; ov104_0222E284(param0, ¶m1->unk_00, param2, param3, param4); - v2 = AllocMonZeroed(param4); + v2 = Pokemon_New(param4); for (v0 = 0; v0 < param2; v0++) { ov104_0222DF40(¶m1->unk_30[v0], v2, 120); diff --git a/src/overlay104/ov104_0223A7F4.c b/src/overlay104/ov104_0223A7F4.c index 7800cb2874..6883b9b226 100644 --- a/src/overlay104/ov104_0223A7F4.c +++ b/src/overlay104/ov104_0223A7F4.c @@ -366,10 +366,10 @@ BattleParams * ov104_0223ABA0 (UnkStruct_ov104_0223ADA0 * param0, UnkStruct_ov10 v4->unk_12C = 19; Party_InitWithCapacity(v4->parties[0], v2); - v5 = AllocMonZeroed(11); + v5 = Pokemon_New(11); for (v0 = 0; v0 < v2; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(param0->unk_4D4, v0), v5); + Pokemon_Copy(Party_GetPokemonBySlotIndex(param0->unk_4D4, v0), v5); sub_0205213C(v4, v5, 0); } @@ -386,10 +386,10 @@ BattleParams * ov104_0223ABA0 (UnkStruct_ov104_0223ADA0 * param0, UnkStruct_ov10 v4->trainerData[v0].unk_0C = ov104_0223AEE4(param0); } - v5 = AllocMonZeroed(11); + v5 = Pokemon_New(11); for (v0 = 0; v0 < v3; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(param0->unk_4D8, v0), v5); + Pokemon_Copy(Party_GetPokemonBySlotIndex(param0->unk_4D8, v0), v5); sub_0205213C(v4, v5, 1); } @@ -409,10 +409,10 @@ BattleParams * ov104_0223ABA0 (UnkStruct_ov104_0223ADA0 * param0, UnkStruct_ov10 ov104_0222E284(v4, &v6, v3, 3, 11); Party_InitWithCapacity(v4->parties[3], ov104_0223AA74(param0->unk_04, 0)); - v5 = AllocMonZeroed(11); + v5 = Pokemon_New(11); for (v0 = 0; v0 < v3; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(param0->unk_4D8, (v3 + v0)), v5); + Pokemon_Copy(Party_GetPokemonBySlotIndex(param0->unk_4D8, (v3 + v0)), v5); sub_0205213C(v4, v5, 3); } @@ -456,7 +456,7 @@ void ov104_0223ADB0 (UnkStruct_ov104_0223ADA0 * param0) ov104_0222E330(param0->unk_280, param0->unk_254, param0->unk_260, param0->unk_268, NULL, 6, 11, 179); sub_0207A008(param0->unk_4D4); - v1 = AllocMonZeroed(11); + v1 = Pokemon_New(11); for (v0 = 0; v0 < 6; v0++) { ov104_0222DF40(¶m0->unk_280[v0], v1, ov104_0223ADA0(param0)); @@ -482,7 +482,7 @@ void ov104_0223AE30 (UnkStruct_ov104_0223ADA0 * param0) ov104_0222E330(v3, param0->unk_584, param0->unk_590, param0->unk_598, NULL, 2, 11, 179); - v2 = AllocMonZeroed(11); + v2 = Pokemon_New(11); for (v0 = 0; v0 < 2; v0++) { ov104_0222DF40(&v3[v0], v2, ov104_0223ADA0(param0)); diff --git a/src/overlay104/ov104_0223AF58.c b/src/overlay104/ov104_0223AF58.c index bfca71473a..22adcc77a6 100644 --- a/src/overlay104/ov104_0223AF58.c +++ b/src/overlay104/ov104_0223AF58.c @@ -1597,10 +1597,10 @@ BattleParams * ov104_0223B250 (UnkStruct_ov104_0223B5C0 * param0, UnkStruct_ov10 v8->unk_12C = 22; Party_InitWithCapacity(v8->parties[0], v4); - v9 = AllocMonZeroed(11); + v9 = Pokemon_New(11); for (v1 = 0; v1 < v4; v1++) { - sub_020775EC(Party_GetPokemonBySlotIndex(v13, param0->unk_260[v1]), v9); + Pokemon_Copy(Party_GetPokemonBySlotIndex(v13, param0->unk_260[v1]), v9); sub_0205213C(v8, v9, 0); } @@ -1627,7 +1627,7 @@ BattleParams * ov104_0223B250 (UnkStruct_ov104_0223B5C0 * param0, UnkStruct_ov10 ov104_0223B518(¶m0->unk_290[v6], v7, param0->unk_18[v6], ¶m0->unk_268[v6], v5, 11, 180); - v9 = AllocMonZeroed(11); + v9 = Pokemon_New(11); for (v1 = 0; v1 < v5; v1++) { while (TRUE) { @@ -1638,7 +1638,7 @@ BattleParams * ov104_0223B250 (UnkStruct_ov104_0223B5C0 * param0, UnkStruct_ov10 ov104_0222DF40(¶m0->unk_290[v6], v9, ov104_0223B57C(param0, v7)); - CalculateMonAbility(v9); + Pokemon_CalcAbility(v9); sub_0205213C(v8, v9, 1); } @@ -1658,7 +1658,7 @@ BattleParams * ov104_0223B250 (UnkStruct_ov104_0223B5C0 * param0, UnkStruct_ov10 ov104_0222E284(v8, &v10, v5, 3, 11); Party_InitWithCapacity(v8->parties[3], v5); - v9 = AllocMonZeroed(11); + v9 = Pokemon_New(11); while (TRUE) { if (ov104_0223B4A4(param0, v6) == 0) { @@ -1668,7 +1668,7 @@ BattleParams * ov104_0223B250 (UnkStruct_ov104_0223B5C0 * param0, UnkStruct_ov10 ov104_0222DF40(¶m0->unk_290[v6], v9, ov104_0223B57C(param0, v7)); - CalculateMonAbility(v9); + Pokemon_CalcAbility(v9); sub_0205213C(v8, v9, 3); Heap_FreeToHeap(v9); break; @@ -1685,7 +1685,7 @@ static BOOL ov104_0223B4A4 (UnkStruct_ov104_0223B5C0 * param0, u8 param1) param0->unk_290[param1].unk_10 += ((24 + 1) * 10001); } - return GetMonPersonalityShininess(param0->unk_290[param1].unk_0C, param0->unk_290[param1].unk_10); + return Pokemon_IsPersonalityShiny(param0->unk_290[param1].unk_0C, param0->unk_290[param1].unk_10); } static u32 ov104_0223B4D4 (u8 param0) @@ -1810,7 +1810,7 @@ u8 ov104_0223B5C0 (UnkStruct_ov104_0223B5C0 * param0) v2 = Party_GetFromSavedata(param0->unk_6FC); v3 = Party_GetPokemonBySlotIndex(v2, param0->unk_260[0]); - v1 = GetMonData(v3, MON_DATA_LEVEL, NULL); + v1 = Pokemon_GetValue(v3, MON_DATA_LEVEL, NULL); return v1 / 10; } @@ -1869,11 +1869,11 @@ u16 ov104_0223B64C (UnkStruct_ov104_0223B5C0 * param0) v0 = Party_GetFromSavedata(param0->unk_6FC); v1 = Party_GetPokemonBySlotIndex(v0, param0->unk_260[0]); - v2 = GetMonData(v1, MON_DATA_LEVEL, NULL); + v2 = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); if (ov104_0223B500(param0->unk_04) == 2) { v1 = Party_GetPokemonBySlotIndex(v0, param0->unk_260[1]); - v3 = GetMonData(v1, MON_DATA_LEVEL, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); if (v2 > v3) { return v2; diff --git a/src/overlay104/ov104_0223B6F4.c b/src/overlay104/ov104_0223B6F4.c index c261d42f34..f6569b1c1c 100644 --- a/src/overlay104/ov104_0223B6F4.c +++ b/src/overlay104/ov104_0223B6F4.c @@ -189,10 +189,10 @@ BattleParams * ov104_0223B810 (UnkStruct_ov104_0223BA10 * param0, UnkStruct_ov10 v4 = 2; } - v6 = AllocMonZeroed(11); + v6 = Pokemon_New(11); for (v0 = 0; v0 < v2; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(param0->unk_28, (v4 + v0)), v6); + Pokemon_Copy(Party_GetPokemonBySlotIndex(param0->unk_28, (v4 + v0)), v6); sub_0205213C(v5, v6, 0); } @@ -210,10 +210,10 @@ BattleParams * ov104_0223B810 (UnkStruct_ov104_0223BA10 * param0, UnkStruct_ov10 v5->trainerData[v0].unk_0C = ov104_0223BB10(param0); } - v6 = AllocMonZeroed(11); + v6 = Pokemon_New(11); for (v0 = 0; v0 < v3; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(param0->unk_2C, v0), v6); + Pokemon_Copy(Party_GetPokemonBySlotIndex(param0->unk_2C, v0), v6); sub_0205213C(v5, v6, 1); } @@ -233,10 +233,10 @@ BattleParams * ov104_0223B810 (UnkStruct_ov104_0223BA10 * param0, UnkStruct_ov10 ov104_0222E284(v5, &v7, v3, 3, 11); Party_InitWithCapacity(v5->parties[3], ov104_0223B7DC(param0->unk_10, 0)); - v6 = AllocMonZeroed(11); + v6 = Pokemon_New(11); for (v0 = 0; v0 < v3; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(param0->unk_2C, (v3 + v0)), v6); + Pokemon_Copy(Party_GetPokemonBySlotIndex(param0->unk_2C, (v3 + v0)), v6); sub_0205213C(v5, v6, 3); } @@ -290,17 +290,17 @@ void ov104_0223BA24 (Party * param0) for (v0 = 0; v0 < v2; v0++) { v4 = Party_GetPokemonBySlotIndex(param0, v0); - if (GetMonData(v4, MON_DATA_172, NULL) == 0) { + if (Pokemon_GetValue(v4, MON_DATA_172, NULL) == 0) { continue; } - if (GetMonData(v4, MON_DATA_CURRENT_HP, NULL) == 0) { + if (Pokemon_GetValue(v4, MON_DATA_CURRENT_HP, NULL) == 0) { v3 = 1; - SetMonData(v4, 163, &v3); + Pokemon_SetValue(v4, 163, &v3); } v3 = 0; - SetMonData(v4, 160, &v3); + Pokemon_SetValue(v4, 160, &v3); } return; @@ -328,7 +328,7 @@ void ov104_0223BAB8 (UnkStruct_ov104_0223BA10 * param0) sub_0207A008(param0->unk_2C); v2 = ov104_0223B7DC(param0->unk_10, 1); - v3 = AllocMonZeroed(11); + v3 = Pokemon_New(11); for (v0 = 0; v0 < v2; v0++) { ov104_0222DF40(¶m0->unk_288[v0], v3, ov104_0223BA10(param0)); diff --git a/src/overlay104/ov104_0223BCBC.c b/src/overlay104/ov104_0223BCBC.c index d97948129b..a970577ed5 100644 --- a/src/overlay104/ov104_0223BCBC.c +++ b/src/overlay104/ov104_0223BCBC.c @@ -202,10 +202,10 @@ BattleParams * ov104_0223BDD8 (UnkStruct_ov104_0223BFFC * param0, UnkStruct_ov10 v4 = 2; } - v6 = AllocMonZeroed(11); + v6 = Pokemon_New(11); for (v0 = 0; v0 < v2; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(v12, (v4 + v0)), v6); + Pokemon_Copy(Party_GetPokemonBySlotIndex(v12, (v4 + v0)), v6); sub_0205213C(v5, v6, 0); } @@ -222,10 +222,10 @@ BattleParams * ov104_0223BDD8 (UnkStruct_ov104_0223BFFC * param0, UnkStruct_ov10 v5->trainerData[v0].unk_0C = ov104_0223C0D0(param0); } - v6 = AllocMonZeroed(11); + v6 = Pokemon_New(11); for (v0 = 0; v0 < v3; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(v13, v0), v6); + Pokemon_Copy(Party_GetPokemonBySlotIndex(v13, v0), v6); sub_0205213C(v5, v6, 1); } @@ -245,10 +245,10 @@ BattleParams * ov104_0223BDD8 (UnkStruct_ov104_0223BFFC * param0, UnkStruct_ov10 ov104_0222E284(v5, &v7, v3, 3, 11); Party_InitWithCapacity(v5->parties[3], ov104_0223BDA4(param0->unk_10, 0)); - v6 = AllocMonZeroed(11); + v6 = Pokemon_New(11); for (v0 = 0; v0 < v3; v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(v13, (v3 + v0)), v6); + Pokemon_Copy(Party_GetPokemonBySlotIndex(v13, (v3 + v0)), v6); sub_0205213C(v5, v6, 3); } @@ -319,7 +319,7 @@ void ov104_0223C04C (UnkStruct_ov104_0223BFFC * param0) sub_0207A008(param0->unk_74); v3 = ov104_0223BDA4(param0->unk_10, 1); - v5 = AllocMonZeroed(11); + v5 = Pokemon_New(11); for (v1 = 0; v1 < v3; v1++) { ov104_0222DF40(¶m0->unk_330[v1], v5, ov104_0223BFFC(param0)); @@ -328,7 +328,7 @@ void ov104_0223C04C (UnkStruct_ov104_0223BFFC * param0) v6 = Party_GetPokemonBySlotIndex(param0->unk_74, v1); v0 = 0; - SetMonData(v6, 6, &v0); + Pokemon_SetValue(v6, 6, &v0); } Heap_FreeToHeap(v5); diff --git a/src/overlay105/ov105_02241AE0.c b/src/overlay105/ov105_02241AE0.c index 4faf8904db..5efd38bb43 100644 --- a/src/overlay105/ov105_02241AE0.c +++ b/src/overlay105/ov105_02241AE0.c @@ -2165,12 +2165,12 @@ static BOOL ov105_02244424 (UnkStruct_ov105_02241FF4 * param0) ov104_0222E5D0(param0->unk_20, 0); v1 = Party_GetPokemonBySlotIndex(param0->unk_31C, (2 + param0->unk_324[0])); - v2 = GetBoxMon(v1); + v2 = Pokemon_GetBoxPokemon(v1); ov105_02244F00(param0, 1, v2); v1 = Party_GetPokemonBySlotIndex(param0->unk_320, param0->unk_324[1]); - v2 = GetBoxMon(v1); + v2 = Pokemon_GetBoxPokemon(v1); ov105_02244F00(param0, 2, v2); ov105_0224628C(¶m0->unk_50[5], sub_02027B50(param0->unk_138)); @@ -2770,7 +2770,7 @@ static void ov105_02244FF8 (UnkStruct_ov105_02241FF4 * param0, UnkStruct_0205AA5 u16 v6[(10 + 1)]; v5 = Party_GetPokemonBySlotIndex(param9, param2); - GetMonData(v5, MON_DATA_179, v6); + Pokemon_GetValue(v5, MON_DATA_179, v6); sub_0201ADA4(param1, param7); v4 = Strbuf_Init((10 + 1), 93); @@ -2778,7 +2778,7 @@ static void ov105_02244FF8 (UnkStruct_ov105_02241FF4 * param0, UnkStruct_0205AA5 sub_0201D78C(param1, param8, v4, param3, param4, 0xff, (u32)((((param5) & 0xff) << 16) | (((param6) & 0xff) << 8) | (((param7) & 0xff) << 0)), NULL); v0 = sub_0201C294(param1) - 1; - v1 = GetMonData(v5, MON_DATA_GENDER, NULL); + v1 = Pokemon_GetValue(v5, MON_DATA_GENDER, NULL); v2 = (v1 == 0) ? 25 : 26; v3 = (v1 == 0) ? ((u32)(((7 & 0xff) << 16) | ((8 & 0xff) << 8) | (((0 & 0xff) << 0)))) : ((u32)(((3 & 0xff) << 16) | ((4 & 0xff) << 8) | (((0 & 0xff) << 0)))); @@ -3088,10 +3088,10 @@ static void ov105_022455C4 (UnkStruct_ov105_02241FF4 * param0, u8 param1, Pokemo sub_02007DEC(param0->unk_12C[param1], 6, 0); - v0 = GetMonData(param2, MON_DATA_SPECIES, NULL); - v1 = GetMonData(param2, MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param2, MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetValue(param2, MON_DATA_FORM, NULL); - if (GetMonFormPersonalDataAttribute(v0, v1, 28) == 0) { + if (PokemonPersonalData_GetFormValue(v0, v1, 28) == 0) { ov105_02245DB8(param0->unk_12C[param1], param5); } @@ -3171,14 +3171,14 @@ void ov105_022456A8 (UnkStruct_ov105_02241FF4 * param0, u16 param1, u16 param2) for (v0 = 0; v0 < param0->unk_11; v0++) { v2 = Party_GetPokemonBySlotIndex(param0->unk_31C, param0->unk_324[v0]); - param0->unk_33C[v0 + v1] = GetMonData(v2, MON_DATA_SPECIES, NULL); + param0->unk_33C[v0 + v1] = Pokemon_GetValue(v2, MON_DATA_SPECIES, NULL); } v1 += param0->unk_11; for (v0 = 0; v0 < param0->unk_11; v0++) { v2 = Party_GetPokemonBySlotIndex(param0->unk_31C, param0->unk_324[v0]); - param0->unk_33C[v0 + v1] = GetMonData(v2, MON_DATA_GENDER, NULL); + param0->unk_33C[v0 + v1] = Pokemon_GetValue(v2, MON_DATA_GENDER, NULL); } v1 += param0->unk_11; diff --git a/src/overlay106/ov106_02241AE0.c b/src/overlay106/ov106_02241AE0.c index 31b60d1841..a50e0824e0 100644 --- a/src/overlay106/ov106_02241AE0.c +++ b/src/overlay106/ov106_02241AE0.c @@ -1148,7 +1148,7 @@ static void ov106_02242AC4 (UnkStruct_ov106_02243118 * param0, UnkStruct_0205AA5 u16 v6[(10 + 1)]; v5 = Party_GetPokemonBySlotIndex(param0->unk_290, 0); - GetMonData(v5, MON_DATA_179, v6); + Pokemon_GetValue(v5, MON_DATA_179, v6); sub_0201ADA4(param1, param6); v4 = Strbuf_Init((10 + 1), 98); @@ -1565,7 +1565,7 @@ void ov106_0224313C (UnkStruct_ov106_02243118 * param0, u16 param1, u16 param2) param0->unk_2A0[2] = param0->unk_18; v2 = Party_GetPokemonBySlotIndex(param0->unk_290, 0); - param0->unk_2A0[3] = GetMonData(v2, MON_DATA_LEVEL, NULL); + param0->unk_2A0[3] = Pokemon_GetValue(v2, MON_DATA_LEVEL, NULL); return; } diff --git a/src/overlay107/ov107_02241AE0.c b/src/overlay107/ov107_02241AE0.c index 309ac10df9..06e4c89cd5 100644 --- a/src/overlay107/ov107_02241AE0.c +++ b/src/overlay107/ov107_02241AE0.c @@ -872,7 +872,7 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) } if (param0->unk_16 == 0) { - if (GetMonData(v7, MON_DATA_CURRENT_HP, NULL) == GetMonData(v7, MON_DATA_MAX_HP, NULL)) { + if (Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL) == Pokemon_GetValue(v7, MON_DATA_MAX_HP, NULL)) { param0->unk_0A = ov107_02243918(param0, 37, 1); param0->unk_08 = 7; break; @@ -884,7 +884,7 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) break; } } else { - if ((GetMonData(v7, MON_DATA_CURRENT_HP, NULL) == GetMonData(v7, MON_DATA_MAX_HP, NULL)) && (ov107_02245210(v7) == 0)) { + if ((Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL) == Pokemon_GetValue(v7, MON_DATA_MAX_HP, NULL)) && (ov107_02245210(v7) == 0)) { param0->unk_0A = ov107_02243918(param0, 37, 1); param0->unk_08 = 7; break; @@ -1077,7 +1077,7 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) break; } - if (GetMonData(v7, MON_DATA_HELD_ITEM, NULL) == 0) { + if (Pokemon_GetValue(v7, MON_DATA_HELD_ITEM, NULL) == 0) { if (ov104_0223BA14(param0->unk_09) == 0) { ov107_02244120(param0); ov107_02249DBC(¶m0->unk_50[6], sub_02027B50(param0->unk_1C8)); @@ -1093,8 +1093,8 @@ static BOOL ov107_02241EC8 (UnkStruct_ov107_02241D6C * param0) return 1; } } else { - ov107_02244A8C(param0, 0, GetBoxMon(v7)); - sub_0200B744(param0->unk_24, 1, GetMonData(v7, MON_DATA_HELD_ITEM, NULL)); + ov107_02244A8C(param0, 0, Pokemon_GetBoxPokemon(v7)); + sub_0200B744(param0->unk_24, 1, Pokemon_GetValue(v7, MON_DATA_HELD_ITEM, NULL)); param0->unk_0A = ov107_02243918(param0, 60, 1); param0->unk_08 = 16; } @@ -1498,12 +1498,12 @@ static void ov107_02242F5C (UnkStruct_ov107_02241D6C * param0) v19 = Party_GetPokemonBySlotIndex(param0->unk_43C, v15); - if (GetMonData(v19, MON_DATA_HELD_ITEM, NULL) == 0) { + if (Pokemon_GetValue(v19, MON_DATA_HELD_ITEM, NULL) == 0) { ov107_02249BAC(param0->unk_404[v15], 0); } - v2 = GetMonData(v19, MON_DATA_CURRENT_HP, NULL); - v3 = GetMonData(v19, MON_DATA_MAX_HP, NULL); + v2 = Pokemon_GetValue(v19, MON_DATA_CURRENT_HP, NULL); + v3 = Pokemon_GetValue(v19, MON_DATA_MAX_HP, NULL); v4 = ov107_022450E8(param0, sub_0208C104(v2, v3, 48)); v5 = ov107_02245114(param0, sub_0208C104(v2, v3, 48)); @@ -2039,7 +2039,7 @@ asm static void ov107_02243950 (UnkStruct_ov107_02241D6C * param0, UnkStruct_020 add r0, r6, #0 mov r1, #6 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 ldr r0, [r5, #0x24] mov r1, #0 @@ -2062,7 +2062,7 @@ asm static void ov107_02243950 (UnkStruct_ov107_02241D6C * param0, UnkStruct_020 mov r3, #0x40 bl ov107_02243B5C add r0, r6, #0 - bl GetMonNature + bl Pokemon_GetNature add r2, r0, #0 ldr r0, [r5, #0x24] mov r1, #0 @@ -2087,7 +2087,7 @@ asm static void ov107_02243950 (UnkStruct_ov107_02241D6C * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 ldr r0, [r5, #0x24] mov r1, #0 @@ -2112,7 +2112,7 @@ asm static void ov107_02243950 (UnkStruct_ov107_02241D6C * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa5 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -2140,7 +2140,7 @@ asm static void ov107_02243950 (UnkStruct_ov107_02241D6C * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa6 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -2169,7 +2169,7 @@ asm static void ov107_02243950 (UnkStruct_ov107_02241D6C * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa8 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -2197,7 +2197,7 @@ asm static void ov107_02243950 (UnkStruct_ov107_02241D6C * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa9 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -2226,7 +2226,7 @@ asm static void ov107_02243950 (UnkStruct_ov107_02241D6C * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa7 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -2302,11 +2302,11 @@ static void ov107_02243C18 (UnkStruct_ov107_02241D6C * param0, UnkStruct_0205AA5 v2 = 137; v3 = 12 + (param2 * 24); - sub_0200B630(param0->unk_24, param2, GetMonData(param5, param6, NULL)); + sub_0200B630(param0->unk_24, param2, Pokemon_GetValue(param5, param6, NULL)); param0->unk_0A = ov107_02243860(param0, param1, param3, v0, v1, 0xff, 1, 2, 0, 0); - ov107_02244A74(param0, 4, GetMonData(param5, param7, NULL), MON_DATA_3, 0); - ov107_02244A74(param0, 5, GetMonData(param5, param8, NULL), MON_DATA_3, 0); + ov107_02244A74(param0, 4, Pokemon_GetValue(param5, param7, NULL), MON_DATA_3, 0); + ov107_02244A74(param0, 5, Pokemon_GetValue(param5, param8, NULL), MON_DATA_3, 0); param0->unk_0A = ov107_02243890(param0, param1, param4, v2, v3, 0xff, 1, 2, 0, 0, 1); return; @@ -2358,9 +2358,9 @@ static void ov107_02243CFC (UnkStruct_ov107_02241D6C * param0, UnkStruct_0205AA5 v4 = 0; } - sub_0200C5BC(param0->unk_1C4, GetMonData(v7, MON_DATA_CURRENT_HP, NULL), 3, 1, param1, v1, v2); + sub_0200C5BC(param0->unk_1C4, Pokemon_GetValue(v7, MON_DATA_CURRENT_HP, NULL), 3, 1, param1, v1, v2); sub_0200C578(param0->unk_1C4, 0, param1, v5, v6); - sub_0200C5BC(param0->unk_1C4, GetMonData(v7, MON_DATA_MAX_HP, NULL), 3, 0, param1, v3, v4); + sub_0200C5BC(param0->unk_1C4, Pokemon_GetValue(v7, MON_DATA_MAX_HP, NULL), 3, 0, param1, v3, v4); return; } @@ -2408,8 +2408,8 @@ static void ov107_02243DE4 (UnkStruct_ov107_02241D6C * param0, UnkStruct_0205AA5 v4 = 0; } - sub_0200C648(param0->unk_1C4, 1, GetMonData(v7, MON_DATA_LEVEL, NULL), 3, 0, param1, v1, v2); - v0 = GetMonData(v7, MON_DATA_GENDER, NULL); + sub_0200C648(param0->unk_1C4, 1, Pokemon_GetValue(v7, MON_DATA_LEVEL, NULL), 3, 0, param1, v1, v2); + v0 = Pokemon_GetValue(v7, MON_DATA_GENDER, NULL); ov107_02244B8C(param0, param1, v3, v4, 0, v0); return; @@ -3345,8 +3345,8 @@ static BOOL ov107_02244E44 (UnkStruct_ov107_02241D6C * param0, u8 param1, u8 par v5 = ov107_02249C98(param0->unk_14, param1); v6 = Party_GetPokemonBySlotIndex(param0->unk_43C, v5); - v0 = GetMonData(v6, MON_DATA_CURRENT_HP, NULL); - v1 = GetMonData(v6, MON_DATA_MAX_HP, NULL); + v0 = Pokemon_GetValue(v6, MON_DATA_CURRENT_HP, NULL); + v1 = Pokemon_GetValue(v6, MON_DATA_MAX_HP, NULL); v2 = ov107_022450E8(param0, sub_0208C104(v0, v1, 48)); v3 = ov107_02245114(param0, sub_0208C104(v0, v1, 48)); @@ -3379,7 +3379,7 @@ static BOOL ov107_02244E44 (UnkStruct_ov107_02241D6C * param0, u8 param1, u8 par } if (param0->unk_414 == NULL) { - ov107_02243F4C(param0, ¶m0->unk_50[3], v5, GetMonData(v6, MON_DATA_CURRENT_HP, NULL)); + ov107_02243F4C(param0, ¶m0->unk_50[3], v5, Pokemon_GetValue(v6, MON_DATA_CURRENT_HP, NULL)); ov107_02249BEC(param0->unk_420[v5], v3); ov107_02249C1C(param0->unk_3F4[v5], v2); param0->unk_0E_2 = 0; @@ -3567,19 +3567,19 @@ static BOOL ov107_02245210 (Pokemon * param0) v0 = 0; - if (GetMonData(param0, MON_DATA_MOVE1_CUR_PP, NULL) != GetMonData(param0, MON_DATA_MOVE1_MAX_PP, NULL)) { + if (Pokemon_GetValue(param0, MON_DATA_MOVE1_CUR_PP, NULL) != Pokemon_GetValue(param0, MON_DATA_MOVE1_MAX_PP, NULL)) { v0 = 1; } - if (GetMonData(param0, MON_DATA_MOVE2_CUR_PP, NULL) != GetMonData(param0, MON_DATA_MOVE2_MAX_PP, NULL)) { + if (Pokemon_GetValue(param0, MON_DATA_MOVE2_CUR_PP, NULL) != Pokemon_GetValue(param0, MON_DATA_MOVE2_MAX_PP, NULL)) { v0 = 1; } - if (GetMonData(param0, MON_DATA_MOVE3_CUR_PP, NULL) != GetMonData(param0, MON_DATA_MOVE3_MAX_PP, NULL)) { + if (Pokemon_GetValue(param0, MON_DATA_MOVE3_CUR_PP, NULL) != Pokemon_GetValue(param0, MON_DATA_MOVE3_MAX_PP, NULL)) { v0 = 1; } - if (GetMonData(param0, MON_DATA_MOVE4_CUR_PP, NULL) != GetMonData(param0, MON_DATA_MOVE4_MAX_PP, NULL)) { + if (Pokemon_GetValue(param0, MON_DATA_MOVE4_CUR_PP, NULL) != Pokemon_GetValue(param0, MON_DATA_MOVE4_MAX_PP, NULL)) { v0 = 1; } @@ -3817,7 +3817,7 @@ static void ov107_022454F8 (UnkStruct_ov107_02241D6C * param0, u8 param1, u8 par v1 = Party_GetPokemonBySlotIndex(param0->unk_43C, ov107_02249C98(param0->unk_14, param1)); v0 = ov107_02249CAC(param0->unk_1CC, param0->unk_09, 0); - ov107_02244A8C(param0, 0, GetBoxMon(v1)); + ov107_02244A8C(param0, 0, Pokemon_GetBoxPokemon(v1)); ov107_02249DBC(¶m0->unk_50[6], sub_02027B50(param0->unk_1C8)); param0->unk_0A = ov107_02243918(param0, Unk_ov107_02249E00[param2 - 1], 1); @@ -3849,10 +3849,10 @@ static void ov107_022455A0 (UnkStruct_ov107_02241D6C * param0, u8 param1, u16 pa v0 = Party_GetPokemonBySlotIndex(param0->unk_43C, ov107_02249C98(param0->unk_14, param1)); - SetMonData(v0, 6, ¶m2); + Pokemon_SetValue(v0, 6, ¶m2); ov107_02249BAC(param0->unk_404[ov107_02249C98(param0->unk_14, param1)], 1); - ov107_02244A8C(param0, 0, GetBoxMon(v0)); + ov107_02244A8C(param0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B70C(param0->unk_24, 1, param2); param0->unk_0A = ov107_02243918(param0, 59, 1); @@ -4333,7 +4333,7 @@ static void ov107_02245C00 (UnkStruct_ov107_02241D6C * param0) for (v0 = 0; v0 < v1; v0++) { v3 = Party_GetPokemonBySlotIndex(param0->unk_43C, v0); - v2 = ov104_0222E240(GetMonData(v3, MON_DATA_CURRENT_HP, NULL), GetMonData(v3, MON_DATA_MAX_HP, NULL)); + v2 = ov104_0222E240(Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL), Pokemon_GetValue(v3, MON_DATA_MAX_HP, NULL)); if (param0->unk_3F4[v0] != NULL) { ov107_02249C1C(param0->unk_3F4[v0], v2); diff --git a/src/overlay107/ov107_02245EB0.c b/src/overlay107/ov107_02245EB0.c index 91fe7fcf83..73bc3ff964 100644 --- a/src/overlay107/ov107_02245EB0.c +++ b/src/overlay107/ov107_02245EB0.c @@ -563,7 +563,7 @@ static BOOL ov107_022462CC (UnkStruct_ov107_02246170 * param0) v8 = Party_GetPokemonBySlotIndex(param0->unk_3DC, ov107_02249C98(param0->unk_14, param0->unk_0D)); ov107_02248BEC(param0); - ov107_02248104(param0, 0, GetBoxMon(v8)); + ov107_02248104(param0, 0, Pokemon_GetBoxPokemon(v8)); param0->unk_0A = ov107_022477CC(param0, 20, 1); param0->unk_08 = 15; @@ -576,7 +576,7 @@ static BOOL ov107_022462CC (UnkStruct_ov107_02246170 * param0) v8 = Party_GetPokemonBySlotIndex(param0->unk_3DC, ov107_02249C98(param0->unk_14, param0->unk_0D)); ov107_02248BEC(param0); - ov107_02248104(param0, 0, GetBoxMon(v8)); + ov107_02248104(param0, 0, Pokemon_GetBoxPokemon(v8)); param0->unk_0A = ov107_022477CC(param0, 21, 1); ov107_02247DF0(param0); @@ -1698,7 +1698,7 @@ asm static void ov107_02247804 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 add r0, r6, #0 mov r1, #6 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 ldr r0, [r5, #0x24] mov r1, #0 @@ -1721,7 +1721,7 @@ asm static void ov107_02247804 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 mov r3, #0x48 bl ov107_02247A14 add r0, r6, #0 - bl GetMonNature + bl Pokemon_GetNature add r2, r0, #0 ldr r0, [r5, #0x24] mov r1, #0 @@ -1747,7 +1747,7 @@ asm static void ov107_02247804 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 ldr r0, [r5, #0x24] mov r1, #0 @@ -1773,7 +1773,7 @@ asm static void ov107_02247804 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa5 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -1802,7 +1802,7 @@ asm static void ov107_02247804 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa6 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -1830,7 +1830,7 @@ asm static void ov107_02247804 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa8 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -1859,7 +1859,7 @@ asm static void ov107_02247804 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa9 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -1888,7 +1888,7 @@ asm static void ov107_02247804 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 add r0, r6, #0 mov r1, #0xa7 mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #1 str r0, [sp] @@ -1949,7 +1949,7 @@ asm static void ov107_02247AD0 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 ldr r1, [sp, #0x38] mov r2, #0 add r7, r3, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 ldr r0, [r4, #0x24] add r1, r5, #0 @@ -1978,7 +1978,7 @@ asm static void ov107_02247AD0 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 ldr r0, [sp, #0x34] ldr r1, [sp, #0x3c] mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #0 str r0, [sp] @@ -1989,7 +1989,7 @@ asm static void ov107_02247AD0 (UnkStruct_ov107_02246170 * param0, UnkStruct_020 ldr r0, [sp, #0x34] ldr r1, [sp, #0x40] mov r2, #0 - bl GetMonData + bl Pokemon_GetValue add r2, r0, #0 mov r0, #0 str r0, [sp] @@ -2044,9 +2044,9 @@ static void ov107_02247B78 (UnkStruct_ov107_02246170 * param0, UnkStruct_0205AA5 v3 = Party_GetPokemonBySlotIndex(param0->unk_3DC, v2); - sub_0200C5BC(param0->unk_144, GetMonData(v3, MON_DATA_CURRENT_HP, NULL), 3, 1, param1, v0 + (64 * v2), 1); + sub_0200C5BC(param0->unk_144, Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL), 3, 1, param1, v0 + (64 * v2), 1); sub_0200C578(param0->unk_144, 0, param1, 24 + v0 + (64 * v2), 1); - sub_0200C5BC(param0->unk_144, GetMonData(v3, MON_DATA_MAX_HP, NULL), 3, 0, param1, 32 + v0 + (64 * v2), 1); + sub_0200C5BC(param0->unk_144, Pokemon_GetValue(v3, MON_DATA_MAX_HP, NULL), 3, 0, param1, 32 + v0 + (64 * v2), 1); } sub_0201A9A4(param1); @@ -2075,9 +2075,9 @@ static void ov107_02247C64 (UnkStruct_ov107_02246170 * param0, UnkStruct_0205AA5 for (v4 = 0; v4 < v3; v4++) { v5 = Party_GetPokemonBySlotIndex(param0->unk_3DC, v4); - sub_0200C648(param0->unk_144, 1, GetMonData(v5, MON_DATA_LEVEL, NULL), 3, 0, param1, v1 + (64 * v4), 1); + sub_0200C648(param0->unk_144, 1, Pokemon_GetValue(v5, MON_DATA_LEVEL, NULL), 3, 0, param1, v1 + (64 * v4), 1); - v0 = GetMonData(v5, MON_DATA_GENDER, NULL); + v0 = Pokemon_GetValue(v5, MON_DATA_GENDER, NULL); ov107_022481FC(param0, param1, v2 + (64 * v4), 1, 0, v0); } @@ -3097,7 +3097,7 @@ static void ov107_02248A8C (UnkStruct_ov107_02246170 * param0, u8 param1) ov107_02249DBC(¶m0->unk_50[7], sub_02027B50(param0->unk_148)); v0 = Party_GetPokemonBySlotIndex(param0->unk_3DC, ov107_02249C98(param0->unk_14, param1)); - ov107_02248104(param0, 0, GetBoxMon(v0)); + ov107_02248104(param0, 0, Pokemon_GetBoxPokemon(v0)); param0->unk_0A = ov107_022477CC(param0, 47, 1); @@ -3137,7 +3137,7 @@ static void ov107_02248B50 (UnkStruct_ov107_02246170 * param0, u8 param1) ov107_02249DBC(¶m0->unk_50[7], sub_02027B50(param0->unk_148)); v0 = Party_GetPokemonBySlotIndex(param0->unk_3DC, ov107_02249C98(param0->unk_14, param1)); - ov107_02248104(param0, 0, GetBoxMon(v0)); + ov107_02248104(param0, 0, Pokemon_GetBoxPokemon(v0)); param0->unk_0A = ov107_022477CC(param0, 70, 1); @@ -3556,7 +3556,7 @@ static void ov107_02249024 (UnkStruct_ov107_02246170 * param0, u8 param1) v0 = Party_GetPokemonBySlotIndex(param0->unk_3DC, ov107_02249C98(param0->unk_14, param1)); ov107_02249DBC(¶m0->unk_50[7], sub_02027B50(param0->unk_148)); - ov107_02248104(param0, 0, GetBoxMon(v0)); + ov107_02248104(param0, 0, Pokemon_GetBoxPokemon(v0)); param0->unk_0A = ov107_022477CC(param0, 20, 1); param0->unk_3CC[ov107_02249C98(param0->unk_14, param1)] = 1; @@ -3580,7 +3580,7 @@ static void ov107_022490E8 (UnkStruct_ov107_02246170 * param0, u8 param1, u8 par ov107_02249DBC(¶m0->unk_50[7], sub_02027B50(param0->unk_148)); v1 = Party_GetPokemonBySlotIndex(param0->unk_3DC, ov107_02249C98(param0->unk_14, param1)); - ov107_02248104(param0, 0, GetBoxMon(v1)); + ov107_02248104(param0, 0, Pokemon_GetBoxPokemon(v1)); if (param2 == 1) { param0->unk_0A = ov107_022477CC(param0, 31, 1); @@ -3597,17 +3597,17 @@ static void ov107_022490E8 (UnkStruct_ov107_02246170 * param0, u8 param1, u8 par } if (param0->unk_3D0[ov107_02249C98(param0->unk_14, param1)] == 0) { - v0 = GetMonSpeciesLevelExp(GetMonData(v1, MON_DATA_SPECIES, NULL), 50); - SetMonData(v1, 8, &v0); - CalculateMonLevelAndStats(v1); + v0 = Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL), 50); + Pokemon_SetValue(v1, 8, &v0); + Pokemon_CalcLevelAndStats(v1); } else if (param0->unk_3D0[ov107_02249C98(param0->unk_14, param1)] == 1) { - v0 = GetMonSpeciesLevelExp(GetMonData(v1, MON_DATA_SPECIES, NULL), 55); - SetMonData(v1, 8, &v0); - CalculateMonLevelAndStats(v1); + v0 = Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL), 55); + Pokemon_SetValue(v1, 8, &v0); + Pokemon_CalcLevelAndStats(v1); } else { - v0 = GetMonSpeciesLevelExp(GetMonData(v1, MON_DATA_SPECIES, NULL), 45); - SetMonData(v1, 8, &v0); - CalculateMonLevelAndStats(v1); + v0 = Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL), 45); + Pokemon_SetValue(v1, 8, &v0); + Pokemon_CalcLevelAndStats(v1); } ov107_02247B78(param0, ¶m0->unk_50[3]); @@ -3654,7 +3654,7 @@ static void ov107_022492A8 (UnkStruct_ov107_02246170 * param0) for (v0 = 0; v0 < v1; v0++) { v3 = Party_GetPokemonBySlotIndex(param0->unk_3DC, v0); - v2 = ov104_0222E240(GetMonData(v3, MON_DATA_CURRENT_HP, NULL), GetMonData(v3, MON_DATA_MAX_HP, NULL)); + v2 = ov104_0222E240(Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL), Pokemon_GetValue(v3, MON_DATA_MAX_HP, NULL)); if (param0->unk_368[v0] != NULL) { ov107_02249C1C(param0->unk_368[v0], v2); diff --git a/src/overlay108/ov108_02241AE0.c b/src/overlay108/ov108_02241AE0.c index 9d8cce16c1..e089f300e8 100644 --- a/src/overlay108/ov108_02241AE0.c +++ b/src/overlay108/ov108_02241AE0.c @@ -1590,7 +1590,7 @@ static void ov108_02242F38 (UnkStruct_ov108_02241DB0 * param0) for (v2 = 0; v2 < v0; v2++) { v3 = Party_GetPokemonBySlotIndex(param0->unk_3C8, v2); - if (GetMonData(v3, MON_DATA_HELD_ITEM, NULL) == 0) { + if (Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL) == 0) { ov108_022435A8(param0->unk_39C[v2], 0); } else { ov108_022435A8(param0->unk_39C[v2], 1); @@ -1600,7 +1600,7 @@ static void ov108_02242F38 (UnkStruct_ov108_02241DB0 * param0) for (v2 = 0; v2 < v1; v2++) { v3 = Party_GetPokemonBySlotIndex(param0->unk_3CC, v2); - if (GetMonData(v3, MON_DATA_HELD_ITEM, NULL) == 0) { + if (Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL) == 0) { ov108_022435A8(param0->unk_3AC[v2], 0); } else { ov108_022435A8(param0->unk_3AC[v2], 1); diff --git a/src/overlay109/ov109_021D0D80.c b/src/overlay109/ov109_021D0D80.c index 6829167d5a..33580221aa 100644 --- a/src/overlay109/ov109_021D0D80.c +++ b/src/overlay109/ov109_021D0D80.c @@ -3536,7 +3536,7 @@ static void ov109_021D3B70 (UnkStruct_ov109_021D0F70 * param0, int param1) v5 = Party_GetPokemonBySlotIndex(v3, v1); sub_0209304C(v5, sub_02032EE8(sub_0203608C()), 5, 0, 11); - sub_020775EC(v5, v4); + Pokemon_Copy(v5, v4); } static int ov109_021D3BC4 (UnkStruct_ov109_021D0F70 * param0) @@ -3607,8 +3607,8 @@ static BOOL ov109_021D3C94 (Party * param0) for (v0 = 0; v0 < v1; v0++) { v2 = Party_GetPokemonBySlotIndex(param0, v0); - if (GetMonData(v2, MON_DATA_IS_EGG, NULL)) { - if (GetMonData(v2, MON_DATA_3, NULL)) { + if (Pokemon_GetValue(v2, MON_DATA_IS_EGG, NULL)) { + if (Pokemon_GetValue(v2, MON_DATA_3, NULL)) { return 1; } } diff --git a/src/overlay113/ov113_0225C700.c b/src/overlay113/ov113_0225C700.c index c6fe5abf8e..d3dfbdeb7f 100644 --- a/src/overlay113/ov113_0225C700.c +++ b/src/overlay113/ov113_0225C700.c @@ -1351,10 +1351,10 @@ static void ov113_0225DD4C (int param0, UnkStruct_021C0794 * param1, UnkStruct_o for (v3 = 0; v3 < v1; v3++) { v2 = Party_GetPokemonBySlotIndex(v0, v3); - param2[v3].unk_02 = GetMonData(v2, MON_DATA_SPECIES_EGG, NULL); - param2[v3].unk_04 = GetMonData(v2, MON_DATA_PERSONALITY, NULL); - param2[v3].unk_08 = GetMonData(v2, MON_DATA_FORM, NULL); - param2[v3].unk_00 = ov113_0226072C(param0, GetMonData(v2, MON_DATA_OT_ID, NULL)); + param2[v3].unk_02 = Pokemon_GetValue(v2, MON_DATA_SPECIES_EGG, NULL); + param2[v3].unk_04 = Pokemon_GetValue(v2, MON_DATA_PERSONALITY, NULL); + param2[v3].unk_08 = Pokemon_GetValue(v2, MON_DATA_FORM, NULL); + param2[v3].unk_00 = ov113_0226072C(param0, Pokemon_GetValue(v2, MON_DATA_OT_ID, NULL)); } } diff --git a/src/overlay113/ov113_0225E368.c b/src/overlay113/ov113_0225E368.c index 4aafce391d..73ed8d491c 100644 --- a/src/overlay113/ov113_0225E368.c +++ b/src/overlay113/ov113_0225E368.c @@ -1036,7 +1036,7 @@ static u8 ov113_0225EEF8 (const UnkStruct_ov113_02260818 * param0) { u8 v0; - v0 = GetNatureFromPersonality(param0->unk_04); + v0 = Pokemon_GetNatureOf(param0->unk_04); return Unk_ov113_02260D30[v0]; } diff --git a/src/overlay118/ov118_021D0D80.c b/src/overlay118/ov118_021D0D80.c index c6705ab370..db7e0dee27 100644 --- a/src/overlay118/ov118_021D0D80.c +++ b/src/overlay118/ov118_021D0D80.c @@ -78,16 +78,16 @@ int ov118_021D0DBC (UnkStruct_0207F248 * param0) switch (v0->unk_00) { case 0: { - v0->unk_0C = GetMonData(v1, MON_DATA_SPECIES, NULL); + v0->unk_0C = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); switch (v0->unk_0C) { case 487: - SetGiratinaForm(v1); + Pokemon_SetGiratinaForm(v1); v0->unk_08 = 65; v0->unk_10 = 0; break; case 492: - SetShayminForm(v1, 1); + Pokemon_SetShayminForm(v1, 1); v0->unk_08 = 35; v0->unk_10 = 1; break; @@ -146,7 +146,7 @@ int ov118_021D0DBC (UnkStruct_0207F248 * param0) v2 = MessageLoader_GetNewStrbuf(param0->unk_69C, 202); - sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v1)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v1)); sub_0200C388(param0->unk_6A0, param0->unk_6A4, v2); Strbuf_Free(v2); sub_02082708(param0, 0xffffffff, 1); diff --git a/src/overlay119/ov119_021D0D80.c b/src/overlay119/ov119_021D0D80.c index 479eb63e86..4ed6c6daea 100644 --- a/src/overlay119/ov119_021D0D80.c +++ b/src/overlay119/ov119_021D0D80.c @@ -322,7 +322,7 @@ int ov119_021D1158 (UnkStruct_0205AA50 * param0, int param1, Pokemon * param2, i v3 = sub_0200B358(71); v1 = MessageLoader_GetNewStrbuf(v5, param1); v2 = Strbuf_Init(255, 71); - v4 = GetBoxMon(param2); + v4 = Pokemon_GetBoxPokemon(param2); sub_0200B538(v3, 0, v4); sub_0200C388(v3, v2, v1); @@ -758,13 +758,13 @@ void ov119_021D1858 (UnkStruct_ov119_021D0FD0 * param0) int v4; v2 = param0->unk_00->unk_0C.unk_00; - v3 = GetMonData(v2, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v2, MON_DATA_SPECIES, NULL); v4 = sub_020765AC(v2, 2); { int v5 = 0; - SetMonData(v2, 76, &v5); + Pokemon_SetValue(v2, 76, &v5); } sub_02075EF4(&v0, v2, 2); @@ -778,8 +778,8 @@ void ov119_021D18C0 (UnkStruct_ov119_021D0FD0 * param0) int v0; int v1; - v0 = GetMonData(param0->unk_00->unk_0C.unk_00, MON_DATA_SPECIES, NULL); - v1 = GetMonNature(param0->unk_00->unk_0C.unk_00); + v0 = Pokemon_GetValue(param0->unk_00->unk_0C.unk_00, MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetNature(param0->unk_00->unk_0C.unk_00); sub_02007B98(param0->unk_70, 1); sub_020789F4(param0->unk_04.unk_3C, param0->unk_04.unk_54, param0->unk_70, v0, 2, 0, 0); diff --git a/src/overlay119/ov119_021D191C.c b/src/overlay119/ov119_021D191C.c index 81a879bd92..2b2e89dabe 100644 --- a/src/overlay119/ov119_021D191C.c +++ b/src/overlay119/ov119_021D191C.c @@ -137,8 +137,8 @@ static BOOL ov119_021D1930 (UnkStruct_ov119_021D0FD0 * param0) int v7; int v8; - v7 = GetMonData(param0->unk_00->unk_0C.unk_00, MON_DATA_SPECIES, NULL); - v8 = GetMonData(param0->unk_00->unk_0C.unk_00, MON_DATA_FORM, NULL); + v7 = Pokemon_GetValue(param0->unk_00->unk_0C.unk_00, MON_DATA_SPECIES, NULL); + v8 = Pokemon_GetValue(param0->unk_00->unk_0C.unk_00, MON_DATA_FORM, NULL); sub_02005844(v7, v8); param0->unk_04.unk_08 = ov119_021D1158(¶m0->unk_04.unk_14[0], 0, param0->unk_00->unk_0C.unk_00, param0->unk_04.unk_0C); } @@ -287,8 +287,8 @@ static BOOL ov119_021D1BD0 (UnkStruct_ov119_021D0FD0 * param0) int v3; int v4; - v3 = GetMonData(param0->unk_00->unk_0C.unk_00, MON_DATA_SPECIES, NULL); - v4 = GetMonData(param0->unk_00->unk_0C.unk_00, MON_DATA_FORM, NULL); + v3 = Pokemon_GetValue(param0->unk_00->unk_0C.unk_00, MON_DATA_SPECIES, NULL); + v4 = Pokemon_GetValue(param0->unk_00->unk_0C.unk_00, MON_DATA_FORM, NULL); sub_02005844(v3, v4); param0->unk_04.unk_08 = ov119_021D1158(¶m0->unk_04.unk_14[0], 0, param0->unk_00->unk_0C.unk_00, param0->unk_04.unk_0C); } diff --git a/src/party.c b/src/party.c index 1da1d404fb..e451998bcc 100644 --- a/src/party.c +++ b/src/party.c @@ -48,7 +48,7 @@ void Party_InitWithCapacity (Party * party, int capacity) party->capacity = capacity; for (i = 0; i < 6; i++) { - ZeroMonData(&party->pokemon[i]); + Pokemon_Init(&party->pokemon[i]); } } @@ -75,7 +75,7 @@ BOOL Party_RemovePokemonBySlotIndex (Party * party, int slot) party->pokemon[i] = party->pokemon[i + 1]; } - ZeroMonData(&party->pokemon[i]); + Pokemon_Init(&party->pokemon[i]); party->currentCount--; return TRUE; @@ -103,7 +103,7 @@ void sub_0207A128 (Party * party, int slot, Pokemon * param2) PARTY_ASSERT_SLOT(party, slot); - v0 = GetMonData(&(party->pokemon[slot]), MON_DATA_172, NULL) - GetMonData(param2, MON_DATA_172, NULL); + v0 = Pokemon_GetValue(&(party->pokemon[slot]), MON_DATA_172, NULL) - Pokemon_GetValue(param2, MON_DATA_172, NULL); party->pokemon[slot] = *param2; party->currentCount += v0; } @@ -136,7 +136,7 @@ BOOL Party_HasSpecies (const Party * party, int species) int i; for (i = 0; i < party->currentCount; i++) { - if (GetMonData((Pokemon *)&party->pokemon[i], MON_DATA_SPECIES, NULL) == species) { + if (Pokemon_GetValue((Pokemon *)&party->pokemon[i], MON_DATA_SPECIES, NULL) == species) { break; } } diff --git a/src/pokemon.c b/src/pokemon.c index a68b398cc5..ddceed7dc4 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -103,68 +103,68 @@ static enum PokemonDataBlockID { }; static void sub_02073E18(BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID); -static u32 GetMonDataAttribute(Pokemon *mon, enum PokemonDataParam param, void *dest); -static u32 GetBoxMonDataAttribute(BoxPokemon *boxMon, enum PokemonDataParam param, void *dest); -static void SetMonDataAttribute(Pokemon *mon, enum PokemonDataParam param, const void *value); -static void SetBoxMonDataAttribute(BoxPokemon *boxMon, enum PokemonDataParam param, const void *value); -static void IncreaseMonDataAttribute(Pokemon *mon, enum PokemonDataParam param, int value); -static void IncreaseBoxMonDataAttribute(BoxPokemon *boxMon, enum PokemonDataParam param, int value); -static u32 GetBoxMonExpToNextLevel(BoxPokemon *boxMon); -static void LoadMonExperienceTable (int monExpRate, u32 *monExpTable); -static u32 GetMonExpRateLevelExp(int monExpRate, int monLevel); -static u16 GetNatureAdjustedStatValue(u8 monNature, u16 monStatValue, u8 statType); -static u8 GetBoxMonShininess(BoxPokemon *boxMon); -static inline BOOL IsMonPersonalityShiny(u32 monOTID, u32 monPersonality); +static u32 Pokemon_GetDataInternal(Pokemon *mon, enum PokemonDataParam param, void *dest); +static u32 BoxPokemon_GetDataInternal(BoxPokemon *boxMon, enum PokemonDataParam param, void *dest); +static void Pokemon_SetDataInternal(Pokemon *mon, enum PokemonDataParam param, const void *value); +static void BoxPokemon_SetDataInternal(BoxPokemon *boxMon, enum PokemonDataParam param, const void *value); +static void Pokemon_IncreaseDataInternal(Pokemon *mon, enum PokemonDataParam param, int value); +static void BoxPokemon_IncreaseDataInternal(BoxPokemon *boxMon, enum PokemonDataParam param, int value); +static u32 BoxPokemon_GetExpToNextLevel(BoxPokemon *boxMon); +static void Pokemon_LoadExperienceTableOf(int monExpRate, u32 *monExpTable); +static u32 Pokemon_GetExpRateBaseExpAt(int monExpRate, int monLevel); +static u16 Pokemon_GetNatureStatValue(u8 monNature, u16 monStatValue, u8 statType); +static u8 BoxPokemon_IsShiny(BoxPokemon *boxMon); +static inline BOOL Pokemon_InlineIsPersonalityShiny(u32 monOTID, u32 monPersonality); static void sub_02076300(UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality); static u8 sub_020767BC(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality); -static void SetBoxMonDefaultMoves(BoxPokemon *boxMon); -static u16 AddBoxMonMove(BoxPokemon *boxMon, u16 moveID); -static void ReplaceBoxMonMove(BoxPokemon *boxMon, u16 moveID); -static void SetBoxMonMove(BoxPokemon *boxMon, u16 moveID, u8 moveSlot); -static BOOL MonHasMove(Pokemon *mon, u16 moveID); -static s8 GetBoxMonFlavorAffinity(BoxPokemon *boxMon, int flavor); +static void BoxPokemon_SetDefaultMoves(BoxPokemon *boxMon); +static u16 BoxPokemon_AddMove(BoxPokemon *boxMon, u16 moveID); +static void BoxPokemon_ReplaceMove(BoxPokemon *boxMon, u16 moveID); +static void BoxPokemon_SetMoveSlot(BoxPokemon *boxMon, u16 moveID, u8 moveSlot); +static BOOL Pokemon_HasMove(Pokemon *mon, u16 moveID); +static s8 BoxPokemon_GetFlavorAffinity(BoxPokemon *boxMon, int flavor); static BOOL sub_020778E0(BoxPokemon *boxMon); static BOOL sub_02077900(BoxPokemon *boxMon); static void sub_02077EA4(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); static void sub_02077EF8(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5); -static BOOL CanBoxMonLearnTM(BoxPokemon *boxMon, u8 tmID); -static void CalculateBoxMonAbility(BoxPokemon *boxMon); -static void LoadMonPersonalData(int monSpecies, PokemonPersonalData *monPersonalData); -static void LoadMonFormPersonalData(int monSpecies, int monForm, PokemonPersonalData *monPersonalData); -static void LoadMonEvolutionData(int monSpecies, PokemonEvolutionData *monEvolutionData); -static void EncryptMonData(void *data, u32 bytes, u32 seed); -static void DecryptMonData(void *data, u32 bytes, u32 seed); -static u16 GetMonDataChecksum(void *data, u32 bytes); -static void *GetBoxMonDataBlock(BoxPokemon *boxMon, u32 personality, enum PokemonDataBlockID dataBlockID); -static int GetMonFormNarcIndex(int monSpecies, int monForm); -static inline int GetLowestBitInverse (int num); - -void ZeroMonData (Pokemon *mon) +static BOOL BoxPokemon_CanLearnTM(BoxPokemon *boxMon, u8 tmID); +static void BoxPokemon_CalcAbility(BoxPokemon *boxMon); +static void PokemonPersonalData_LoadSpecies(int monSpecies, PokemonPersonalData *monPersonalData); +static void PokemonPersonalData_LoadForm(int monSpecies, int monForm, PokemonPersonalData *monPersonalData); +static void PokemonEvolutionData_LoadSpecies(int monSpecies, PokemonEvolutionData *monEvolutionData); +static void Pokemon_EncryptData(void *data, u32 bytes, u32 seed); +static void Pokemon_DecryptData(void *data, u32 bytes, u32 seed); +static u16 Pokemon_GetDataChecksum(void *data, u32 bytes); +static void *BoxPokemon_GetDataBlock(BoxPokemon *boxMon, u32 personality, enum PokemonDataBlockID dataBlockID); +static int Pokemon_GetFormNarcIndex(int monSpecies, int monForm); +static inline int Pokemon_GetLowestBitInverse(int num); + +void Pokemon_Init(Pokemon *mon) { MI_CpuClearFast(mon, sizeof(Pokemon)); - EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); - EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_EncryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); } -void ZeroBoxMonData (BoxPokemon *boxMon) +void BoxPokemon_Init(BoxPokemon *boxMon) { MI_CpuClearFast(boxMon, sizeof(BoxPokemon)); - EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); + Pokemon_EncryptData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); } -int PokemonStructSize (void) +int Pokemon_StructSize(void) { return sizeof(Pokemon); } -Pokemon *AllocMonZeroed (u32 heapID) +Pokemon *Pokemon_New(u32 heapID) { Pokemon * mon = Heap_AllocFromHeap(heapID, sizeof(Pokemon)); - ZeroMonData(mon); + Pokemon_Init(mon); return mon; } -BOOL DecryptMon (Pokemon *mon) +BOOL Pokemon_EnterDecryptionContext(Pokemon *mon) { BOOL wasDecrypted = FALSE; @@ -175,14 +175,14 @@ BOOL DecryptMon (Pokemon *mon) mon->box.partyDecrypted = TRUE; mon->box.boxDecrypted = TRUE; - DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + Pokemon_DecryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_DecryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } return wasDecrypted; } -BOOL EncryptMon (Pokemon *mon, BOOL encrypt) +BOOL Pokemon_ExitDecryptionContext(Pokemon *mon, BOOL encrypt) { BOOL wasEncrypted = FALSE; @@ -191,28 +191,28 @@ BOOL EncryptMon (Pokemon *mon, BOOL encrypt) mon->box.partyDecrypted = FALSE; mon->box.boxDecrypted = FALSE; - EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); - EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + mon->box.checksum = Pokemon_GetDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + Pokemon_EncryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } return wasEncrypted; } -BOOL DecryptBoxMon (BoxPokemon *boxMon) +BOOL BoxPokemon_EnterDecryptionContext(BoxPokemon *boxMon) { BOOL wasDecrypted = FALSE; if (boxMon->boxDecrypted == FALSE) { wasDecrypted = TRUE; boxMon->boxDecrypted = TRUE; - DecryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); + Pokemon_DecryptData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); } return wasDecrypted; } -BOOL EncryptBoxMon (BoxPokemon *boxMon, BOOL encrypt) +BOOL BoxPokemon_ExitDecryptionContext(BoxPokemon *boxMon, BOOL encrypt) { BOOL wasEncrypted = FALSE; @@ -220,141 +220,141 @@ BOOL EncryptBoxMon (BoxPokemon *boxMon, BOOL encrypt) wasEncrypted = TRUE; boxMon->boxDecrypted = FALSE; - boxMon->checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); + boxMon->checksum = Pokemon_GetDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); - EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); + Pokemon_EncryptData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); } return wasEncrypted; } -void sub_02073D80 (Pokemon *mon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) +void sub_02073D80(Pokemon *mon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) { - ZeroMonData(mon); + Pokemon_Init(mon); sub_02073E18(&mon->box, monSpecies, monLevel, monIVs, useMonPersonalityParam, monPersonality, monOTIDSource, monOTID); - EncryptMonData(&mon->party, sizeof(PartyPokemon), 0); - EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - SetMonData(mon, MON_DATA_LEVEL, &monLevel); + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), 0); + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_SetValue(mon, MON_DATA_LEVEL, &monLevel); UnkStruct_0202818C *v1 = sub_0202818C(0); - SetMonData(mon, MON_DATA_170, v1); + Pokemon_SetValue(mon, MON_DATA_170, v1); Heap_FreeToHeap(v1); u32 zero = 0; - SetMonData(mon, MON_DATA_162, &zero); + Pokemon_SetValue(mon, MON_DATA_162, &zero); UnkStruct_0202CA28 v2; MI_CpuClearFast(&v2, sizeof(UnkStruct_0202CA28)); - SetMonData(mon, MON_DATA_171, &v2); - CalculateMonLevelAndStats(mon); + Pokemon_SetValue(mon, MON_DATA_171, &v2); + Pokemon_CalcLevelAndStats(mon); } -static void sub_02073E18 (BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) +static void sub_02073E18(BoxPokemon *boxMon, int monSpecies, int monLevel, int monIVs, BOOL useMonPersonalityParam, u32 monPersonality, int monOTIDSource, u32 monOTID) { - ZeroBoxMonData(boxMon); + BoxPokemon_Init(boxMon); - BOOL reencrypt = DecryptBoxMon(boxMon); + BOOL reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); if (!useMonPersonalityParam) { monPersonality = (LCRNG_Next() | (LCRNG_Next() << 16)); } - SetBoxMonData(boxMon, MON_DATA_PERSONALITY, &monPersonality); + BoxPokemon_SetValue(boxMon, MON_DATA_PERSONALITY, &monPersonality); // TODO likely should be an enum if (monOTIDSource == 2) { do { monOTID = (LCRNG_Next() | (LCRNG_Next() << 16)); - } while (IsMonPersonalityShiny(monOTID, monPersonality)); + } while (Pokemon_InlineIsPersonalityShiny(monOTID, monPersonality)); } else if (monOTIDSource != 1) { monOTID = 0; } - SetBoxMonData(boxMon, MON_DATA_OT_ID, &monOTID); - SetBoxMonData(boxMon, MON_DATA_LANGUAGE, &Unk_020E4C44); - SetBoxMonData(boxMon, MON_DATA_SPECIES, &monSpecies); - SetBoxMonData(boxMon, MON_DATA_179, NULL); + BoxPokemon_SetValue(boxMon, MON_DATA_OT_ID, &monOTID); + BoxPokemon_SetValue(boxMon, MON_DATA_LANGUAGE, &Unk_020E4C44); + BoxPokemon_SetValue(boxMon, MON_DATA_SPECIES, &monSpecies); + BoxPokemon_SetValue(boxMon, MON_DATA_179, NULL); u32 v1, v2; // TODO rename, these are used/reused as temp vars through the whole function. - v1 = GetMonSpeciesLevelExp(monSpecies, monLevel); - SetBoxMonData(boxMon, MON_DATA_EXP, &v1); + v1 = Pokemon_GetSpeciesBaseExpAt(monSpecies, monLevel); + BoxPokemon_SetValue(boxMon, MON_DATA_EXP, &v1); - v1 = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_BASE_FRIENDSHIP); - SetBoxMonData(boxMon, MON_DATA_FRIENDSHIP, &v1); + v1 = PokemonPersonalData_GetSpeciesValue(monSpecies, MON_DATA_PERSONAL_BASE_FRIENDSHIP); + BoxPokemon_SetValue(boxMon, MON_DATA_FRIENDSHIP, &v1); - SetBoxMonData(boxMon, MON_DATA_MET_LEVEL, &monLevel); - SetBoxMonData(boxMon, MON_DATA_MET_GAME, &Unk_020E4C40); + BoxPokemon_SetValue(boxMon, MON_DATA_MET_LEVEL, &monLevel); + BoxPokemon_SetValue(boxMon, MON_DATA_MET_GAME, &Unk_020E4C40); v1 = ITEM_POKE_BALL; - SetBoxMonData(boxMon, MON_DATA_POKEBALL, &v1); + BoxPokemon_SetValue(boxMon, MON_DATA_POKEBALL, &v1); if (monIVs < 32) { - SetBoxMonData(boxMon, MON_DATA_HP_IV, &monIVs); - SetBoxMonData(boxMon, MON_DATA_ATK_IV, &monIVs); - SetBoxMonData(boxMon, MON_DATA_DEF_IV, &monIVs); - SetBoxMonData(boxMon, MON_DATA_SPEED_IV, &monIVs); - SetBoxMonData(boxMon, MON_DATA_SPATK_IV, &monIVs); - SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &monIVs); + BoxPokemon_SetValue(boxMon, MON_DATA_HP_IV, &monIVs); + BoxPokemon_SetValue(boxMon, MON_DATA_ATK_IV, &monIVs); + BoxPokemon_SetValue(boxMon, MON_DATA_DEF_IV, &monIVs); + BoxPokemon_SetValue(boxMon, MON_DATA_SPEED_IV, &monIVs); + BoxPokemon_SetValue(boxMon, MON_DATA_SPATK_IV, &monIVs); + BoxPokemon_SetValue(boxMon, MON_DATA_SPDEF_IV, &monIVs); } else { v1 = LCRNG_Next(); v2 = (v1 & (0x1f << 0)) >> 0; - SetBoxMonData(boxMon, MON_DATA_HP_IV, &v2); + BoxPokemon_SetValue(boxMon, MON_DATA_HP_IV, &v2); v2 = (v1 & (0x1f << 5)) >> 5; - SetBoxMonData(boxMon, MON_DATA_ATK_IV, &v2); + BoxPokemon_SetValue(boxMon, MON_DATA_ATK_IV, &v2); v2 = (v1 & (0x1f << 10)) >> 10; - SetBoxMonData(boxMon, MON_DATA_DEF_IV, &v2); + BoxPokemon_SetValue(boxMon, MON_DATA_DEF_IV, &v2); v1 = LCRNG_Next(); v2 = (v1 & (0x1f << 0)) >> 0; - SetBoxMonData(boxMon, MON_DATA_SPEED_IV, &v2); + BoxPokemon_SetValue(boxMon, MON_DATA_SPEED_IV, &v2); v2 = (v1 & (0x1f << 5)) >> 5; - SetBoxMonData(boxMon, MON_DATA_SPATK_IV, &v2); + BoxPokemon_SetValue(boxMon, MON_DATA_SPATK_IV, &v2); v2 = (v1 & (0x1f << 10)) >> 10; - SetBoxMonData(boxMon, MON_DATA_SPDEF_IV, &v2); + BoxPokemon_SetValue(boxMon, MON_DATA_SPDEF_IV, &v2); } - v1 = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_ABILITY_1); - v2 = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_ABILITY_2); + v1 = PokemonPersonalData_GetSpeciesValue(monSpecies, MON_DATA_PERSONAL_ABILITY_1); + v2 = PokemonPersonalData_GetSpeciesValue(monSpecies, MON_DATA_PERSONAL_ABILITY_2); // TODO enum value if (v2 != 0) { if (monPersonality & 1) { - SetBoxMonData(boxMon, MON_DATA_ABILITY, &v2); + BoxPokemon_SetValue(boxMon, MON_DATA_ABILITY, &v2); } else { - SetBoxMonData(boxMon, MON_DATA_ABILITY, &v1); + BoxPokemon_SetValue(boxMon, MON_DATA_ABILITY, &v1); } } else { - SetBoxMonData(boxMon, MON_DATA_ABILITY, &v1); + BoxPokemon_SetValue(boxMon, MON_DATA_ABILITY, &v1); } - v1 = GetBoxMonGender(boxMon); + v1 = BoxPokemon_GetGender(boxMon); - SetBoxMonData(boxMon, MON_DATA_GENDER, &v1); - SetBoxMonDefaultMoves(boxMon); - EncryptBoxMon(boxMon, reencrypt); + BoxPokemon_SetValue(boxMon, MON_DATA_GENDER, &v1); + BoxPokemon_SetDefaultMoves(boxMon); + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); } -void sub_02074044 (Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monNature) +void sub_02074044(Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 monNature) { u32 monPersonality; do { monPersonality = (LCRNG_Next() | (LCRNG_Next() << 16)); - } while (monNature != GetNatureFromPersonality(monPersonality)); + } while (monNature != Pokemon_GetNatureOf(monPersonality)); // TODO monOTIDSource probably an enum? sub_02073D80(mon, monSpecies, monLevel, monIVs, TRUE, monPersonality, 0, 0); } -void sub_02074088 (Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 param4, u8 param5, u8 param6) +void sub_02074088(Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 param4, u8 param5, u8 param6) { u32 monPersonality; u16 unownLetter; @@ -364,7 +364,7 @@ void sub_02074088 (Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 para do { monPersonality = (LCRNG_Next() | (LCRNG_Next() << 16)); unownLetter = (((monPersonality & 0x3000000) >> 18) | ((monPersonality & 0x30000) >> 12) | ((monPersonality & 0x300) >> 6) | (monPersonality & 0x3)) % 28; - } while (param5 != GetNatureFromPersonality(monPersonality) || param4 != GetMonPersonalityGender(monSpecies, monPersonality) || unownLetter != param6 - 1); + } while (param5 != Pokemon_GetNatureOf(monPersonality) || param4 != Pokemon_GetGenderOf(monSpecies, monPersonality) || unownLetter != param6 - 1); } else { monPersonality = sub_02074128(monSpecies, param4, param5); } @@ -373,15 +373,15 @@ void sub_02074088 (Pokemon *mon, u16 monSpecies, u8 monLevel, u8 monIVs, u8 para sub_02073D80(mon, monSpecies, monLevel, monIVs, TRUE, monPersonality, 0, 0); } -enum { +static enum PokemonGenderRatio { GENDER_ALWAYS_MALE = 0, GENDER_ALWAYS_FEMALE = 254, GENDER_NONE = 255 }; -u32 sub_02074128 (u16 monSpecies, u8 param1, u8 param2) +u32 sub_02074128(u16 monSpecies, u8 param1, u8 param2) { - u8 monGenderChance = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_GENDER); + u8 monGenderChance = PokemonPersonalData_GetSpeciesValue(monSpecies, MON_DATA_PERSONAL_GENDER); u32 result; switch (monGenderChance) { @@ -404,56 +404,56 @@ u32 sub_02074128 (u16 monSpecies, u8 param1, u8 param2) return result; } -void sub_02074158 (Pokemon *mon, u16 monSpecies, u8 monLevel, u32 monCombinedIVs, u32 monPersonality) +void sub_02074158(Pokemon *mon, u16 monSpecies, u8 monLevel, u32 monCombinedIVs, u32 monPersonality) { // TODO monOTIDSource probably an enum? sub_02073D80(mon, monSpecies, monLevel, 0, TRUE, monPersonality, 0, 0); - SetMonData(mon, MON_DATA_COMBINED_IVS, &monCombinedIVs); - CalculateMonLevelAndStats(mon); + Pokemon_SetValue(mon, MON_DATA_COMBINED_IVS, &monCombinedIVs); + Pokemon_CalcLevelAndStats(mon); } -void CalculateMonLevelAndStats (Pokemon *mon) +void Pokemon_CalcLevelAndStats(Pokemon *mon) { - BOOL reencrypt = DecryptMon(mon); - int monLevel = GetMonLevel(mon); + BOOL reencrypt = Pokemon_EnterDecryptionContext(mon); + int monLevel = Pokemon_GetLevel(mon); - SetMonData(mon, MON_DATA_LEVEL, &monLevel); - CalculateMonStats(mon); - EncryptMon(mon, reencrypt); + Pokemon_SetValue(mon, MON_DATA_LEVEL, &monLevel); + Pokemon_CalcStats(mon); + Pokemon_ExitDecryptionContext(mon, reencrypt); } -void CalculateMonStats (Pokemon *mon) +void Pokemon_CalcStats(Pokemon *mon) { int monMaxHp; int monCurrentHp; int monHpIV, monAtkIV, monDefIV, monSpeedIV, monSpAtkIV, monSpDefIV; int monHpEV, monAtkEV, monDefEV, monSpeedEV, monSpAtkEV, monSpDefEV; - BOOL reencrypt = DecryptMon(mon); - - int monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); - - monMaxHp = GetMonData(mon, MON_DATA_MAX_HP, NULL); - monCurrentHp = GetMonData(mon, MON_DATA_CURRENT_HP, NULL); - - monHpIV = GetMonData(mon, MON_DATA_HP_IV, NULL); - monHpEV = GetMonData(mon, MON_DATA_HP_EV, NULL); - monAtkIV = GetMonData(mon, MON_DATA_ATK_IV, NULL); - monAtkEV = GetMonData(mon, MON_DATA_ATK_EV, NULL); - monDefIV = GetMonData(mon, MON_DATA_DEF_IV, NULL); - monDefEV = GetMonData(mon, MON_DATA_DEF_EV, NULL); - monSpeedIV = GetMonData(mon, MON_DATA_SPEED_IV, NULL); - monSpeedEV = GetMonData(mon, MON_DATA_SPEED_EV, NULL); - monSpAtkIV = GetMonData(mon, MON_DATA_SPATK_IV, NULL); - monSpAtkEV = GetMonData(mon, MON_DATA_SPATK_EV, NULL); - monSpDefIV = GetMonData(mon, MON_DATA_SPDEF_IV, NULL); - monSpDefEV = GetMonData(mon, MON_DATA_SPDEF_EV, NULL); + BOOL reencrypt = Pokemon_EnterDecryptionContext(mon); + + int monLevel = Pokemon_GetValue(mon, MON_DATA_LEVEL, NULL); + + monMaxHp = Pokemon_GetValue(mon, MON_DATA_MAX_HP, NULL); + monCurrentHp = Pokemon_GetValue(mon, MON_DATA_CURRENT_HP, NULL); + + monHpIV = Pokemon_GetValue(mon, MON_DATA_HP_IV, NULL); + monHpEV = Pokemon_GetValue(mon, MON_DATA_HP_EV, NULL); + monAtkIV = Pokemon_GetValue(mon, MON_DATA_ATK_IV, NULL); + monAtkEV = Pokemon_GetValue(mon, MON_DATA_ATK_EV, NULL); + monDefIV = Pokemon_GetValue(mon, MON_DATA_DEF_IV, NULL); + monDefEV = Pokemon_GetValue(mon, MON_DATA_DEF_EV, NULL); + monSpeedIV = Pokemon_GetValue(mon, MON_DATA_SPEED_IV, NULL); + monSpeedEV = Pokemon_GetValue(mon, MON_DATA_SPEED_EV, NULL); + monSpAtkIV = Pokemon_GetValue(mon, MON_DATA_SPATK_IV, NULL); + monSpAtkEV = Pokemon_GetValue(mon, MON_DATA_SPATK_EV, NULL); + monSpDefIV = Pokemon_GetValue(mon, MON_DATA_SPDEF_IV, NULL); + monSpDefEV = Pokemon_GetValue(mon, MON_DATA_SPDEF_EV, NULL); - int monForm = GetMonData(mon, MON_DATA_FORM, NULL); - int monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + int monForm = Pokemon_GetValue(mon, MON_DATA_FORM, NULL); + int monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); PokemonPersonalData *monPersonalData = Heap_AllocFromHeap(0, sizeof(PokemonPersonalData)); - LoadMonFormPersonalData(monSpecies, monForm, monPersonalData); + PokemonPersonalData_LoadForm(monSpecies, monForm, monPersonalData); int newMaxHp; if (monSpecies == SPECIES_SHEDINJA) { @@ -462,33 +462,33 @@ void CalculateMonStats (Pokemon *mon) newMaxHp = ((2 * monPersonalData->baseHp + monHpIV + monHpEV / 4) * monLevel / 100 + monLevel + 10); } - SetMonData(mon, MON_DATA_MAX_HP, &newMaxHp); + Pokemon_SetValue(mon, MON_DATA_MAX_HP, &newMaxHp); // TODO inline func maybe int newAtk = ((2 * monPersonalData->baseAtk + monAtkIV + monAtkEV / 4) * monLevel / 100 + 5); - newAtk = GetNatureAdjustedStatValue(GetMonNature(mon), newAtk, STAT_ATTACK); + newAtk = Pokemon_GetNatureStatValue(Pokemon_GetNature(mon), newAtk, STAT_ATTACK); - SetMonData(mon, MON_DATA_ATK, &newAtk); + Pokemon_SetValue(mon, MON_DATA_ATK, &newAtk); int newDef = ((2 * monPersonalData->baseDef + monDefIV + monDefEV / 4) * monLevel / 100 + 5); - newDef = GetNatureAdjustedStatValue(GetMonNature(mon), newDef, STAT_DEFENSE); + newDef = Pokemon_GetNatureStatValue(Pokemon_GetNature(mon), newDef, STAT_DEFENSE); - SetMonData(mon, MON_DATA_DEF, &newDef); + Pokemon_SetValue(mon, MON_DATA_DEF, &newDef); int newSpeed = ((2 * monPersonalData->baseSpeed + monSpeedIV + monSpeedEV / 4) * monLevel / 100 + 5); - newSpeed = GetNatureAdjustedStatValue(GetMonNature(mon), newSpeed, STAT_SPEED); + newSpeed = Pokemon_GetNatureStatValue(Pokemon_GetNature(mon), newSpeed, STAT_SPEED); - SetMonData(mon, MON_DATA_SPEED, &newSpeed); + Pokemon_SetValue(mon, MON_DATA_SPEED, &newSpeed); int newSpAtk = ((2 * monPersonalData->baseSpAtk + monSpAtkIV + monSpAtkEV / 4) * monLevel / 100 + 5); - newSpAtk = GetNatureAdjustedStatValue(GetMonNature(mon), newSpAtk, STAT_SPECIAL_ATTACK); + newSpAtk = Pokemon_GetNatureStatValue(Pokemon_GetNature(mon), newSpAtk, STAT_SPECIAL_ATTACK); - SetMonData(mon, MON_DATA_SP_ATK, &newSpAtk); + Pokemon_SetValue(mon, MON_DATA_SP_ATK, &newSpAtk); int newSpDef = ((2 * monPersonalData->baseSpDef + monSpDefIV + monSpDefEV / 4) * monLevel / 100 + 5); - newSpDef = GetNatureAdjustedStatValue(GetMonNature(mon), newSpDef, STAT_SPECIAL_DEFENSE); + newSpDef = Pokemon_GetNatureStatValue(Pokemon_GetNature(mon), newSpDef, STAT_SPECIAL_DEFENSE); - SetMonData(mon, MON_DATA_SP_DEF, &newSpDef); + Pokemon_SetValue(mon, MON_DATA_SP_DEF, &newSpDef); Heap_FreeToHeap(monPersonalData); if (monCurrentHp != 0 || monMaxHp == 0) { @@ -502,19 +502,19 @@ void CalculateMonStats (Pokemon *mon) } if (monCurrentHp) { - SetMonData(mon, MON_DATA_CURRENT_HP, &monCurrentHp); + Pokemon_SetValue(mon, MON_DATA_CURRENT_HP, &monCurrentHp); } - EncryptMon(mon, reencrypt); + Pokemon_ExitDecryptionContext(mon, reencrypt); } -u32 GetMonData (Pokemon *mon, enum PokemonDataParam param, void *dest) +u32 Pokemon_GetValue(Pokemon *mon, enum PokemonDataParam param, void *dest) { if (mon->box.partyDecrypted == FALSE) { - DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + Pokemon_DecryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_DecryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); - u16 checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + u16 checksum = Pokemon_GetDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != mon->box.checksum) { GF_ASSERT(checksum == mon->box.checksum); @@ -522,17 +522,17 @@ u32 GetMonData (Pokemon *mon, enum PokemonDataParam param, void *dest) } } - u32 result = GetMonDataAttribute(mon, param, dest); + u32 result = Pokemon_GetDataInternal(mon, param, dest); if (mon->box.partyDecrypted == FALSE) { - EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_EncryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } return result; } -static u32 GetMonDataAttribute (Pokemon *mon, enum PokemonDataParam param, void *dest) +static u32 Pokemon_GetDataInternal(Pokemon *mon, enum PokemonDataParam param, void *dest) { u32 result = 0; @@ -576,18 +576,18 @@ static u32 GetMonDataAttribute (Pokemon *mon, enum PokemonDataParam param, void result = 1; break; default: - result = GetBoxMonDataAttribute(&mon->box, param, dest); + result = BoxPokemon_GetDataInternal(&mon->box, param, dest); break; } return result; } -u32 GetBoxMonData (BoxPokemon *boxMon, enum PokemonDataParam param, void *dest) +u32 BoxPokemon_GetValue(BoxPokemon *boxMon, enum PokemonDataParam param, void *dest) { if (boxMon->boxDecrypted == FALSE) { - DecryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); - u16 checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); + Pokemon_DecryptData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); + u16 checksum = Pokemon_GetDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != boxMon->checksum) { GF_ASSERT(checksum == boxMon->checksum); @@ -595,23 +595,23 @@ u32 GetBoxMonData (BoxPokemon *boxMon, enum PokemonDataParam param, void *dest) } } - u32 result = GetBoxMonDataAttribute(boxMon, param, dest); + u32 result = BoxPokemon_GetDataInternal(boxMon, param, dest); if (boxMon->boxDecrypted == FALSE) { - EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); + Pokemon_EncryptData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); } return result; } -static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, enum PokemonDataParam param, void *dest) +static u32 BoxPokemon_GetDataInternal (BoxPokemon *boxMon, enum PokemonDataParam param, void *dest) { u32 result = 0; - PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_A); - PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_B); - PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_C); - PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_D); + PokemonDataBlockA *monDataBlockA = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_A); + PokemonDataBlockB *monDataBlockB = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_B); + PokemonDataBlockC *monDataBlockC = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_C); + PokemonDataBlockD *monDataBlockD = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_D); switch (param) { default: @@ -652,7 +652,7 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, enum PokemonDataParam par } break; case MON_DATA_LEVEL: - result = GetMonSpeciesLevel(monDataBlockA->species, monDataBlockA->exp); + result = Pokemon_GetSpeciesLevelAt(monDataBlockA->species, monDataBlockA->exp); break; case MON_DATA_SPECIES: if (boxMon->invalidData) { @@ -847,9 +847,9 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, enum PokemonDataParam par result = monDataBlockB->fatefulEncounter; break; case MON_DATA_GENDER: - result = GetMonPersonalityGender(monDataBlockA->species, boxMon->personality); + result = Pokemon_GetGenderOf(monDataBlockA->species, boxMon->personality); monDataBlockB->gender = result; - boxMon->checksum = GetMonDataChecksum(&boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); + boxMon->checksum = Pokemon_GetDataChecksum(&boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); break; case MON_DATA_FORM: result = monDataBlockB->form; @@ -1000,9 +1000,9 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, enum PokemonDataParam par case MON_DATA_178: // TODO enum values if (monDataBlockA->species == SPECIES_ARCEUS && monDataBlockA->ability == 121) { - result = GetArceusItemType(Item_LoadParam(monDataBlockA->heldItem, 1, 0)); + result = Pokemon_GetArceusTypeOf(Item_LoadParam(monDataBlockA->heldItem, 1, 0)); } else { - result = GetMonFormPersonalDataAttribute(monDataBlockA->species, monDataBlockB->form, 6 + (param - 177)); + result = PokemonPersonalData_GetFormValue(monDataBlockA->species, monDataBlockB->form, 6 + (param - 177)); } break; case MON_DATA_179: @@ -1013,31 +1013,31 @@ static u32 GetBoxMonDataAttribute (BoxPokemon *boxMon, enum PokemonDataParam par return result; } -void SetMonData (Pokemon *mon, enum PokemonDataParam param, const void *value) +void Pokemon_SetValue(Pokemon *mon, enum PokemonDataParam param, const void *value) { if (mon->box.partyDecrypted == FALSE) { - DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); - u16 checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + Pokemon_DecryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_DecryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + u16 checksum = Pokemon_GetDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != mon->box.checksum) { GF_ASSERT(checksum == mon->box.checksum); mon->box.invalidData = TRUE; - EncryptMonData(mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + Pokemon_EncryptData(mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); return; } } - SetMonDataAttribute(mon, param, value); + Pokemon_SetDataInternal(mon, param, value); if (mon->box.partyDecrypted == FALSE) { - EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); - EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + mon->box.checksum = Pokemon_GetDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + Pokemon_EncryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } } -static void SetMonDataAttribute (Pokemon *mon, enum PokemonDataParam param, const void *value) +static void Pokemon_SetDataInternal(Pokemon *mon, enum PokemonDataParam param, const void *value) { // TODO can this be restructured better? u32 *u32Value = value; @@ -1082,44 +1082,44 @@ static void SetMonDataAttribute (Pokemon *mon, enum PokemonDataParam param, cons sub_0202CA10(value, &mon->party.unk_4C); break; default: - SetBoxMonDataAttribute(&mon->box, param, value); + BoxPokemon_SetDataInternal(&mon->box, param, value); break; } } -void SetBoxMonData (BoxPokemon *boxMon, enum PokemonDataParam param, const void *value) +void BoxPokemon_SetValue(BoxPokemon *boxMon, enum PokemonDataParam param, const void *value) { if (boxMon->boxDecrypted == FALSE) { - DecryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); - u16 checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); + Pokemon_DecryptData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); + u16 checksum = Pokemon_GetDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != boxMon->checksum) { GF_ASSERT(checksum == boxMon->checksum); boxMon->invalidData = TRUE; - EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); + Pokemon_EncryptData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); return; } } - SetBoxMonDataAttribute(boxMon, param, value); + BoxPokemon_SetDataInternal(boxMon, param, value); if (boxMon->boxDecrypted == FALSE) { - boxMon->checksum = GetMonDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); - EncryptMonData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); + boxMon->checksum = Pokemon_GetDataChecksum(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4); + Pokemon_EncryptData(boxMon->dataBlocks, sizeof(PokemonDataBlock) * 4, boxMon->checksum); } } -static void SetBoxMonDataAttribute (BoxPokemon *boxMon, enum PokemonDataParam param, const void *value) +static void BoxPokemon_SetDataInternal(BoxPokemon *boxMon, enum PokemonDataParam param, const void *value) { // TODO can this be restructured better? u32 *u32Value = value; u16 *u16Value = value; u8 *u8Value = value; - PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_A); - PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_B); - PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_C); - PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_D); + PokemonDataBlockA *monDataBlockA = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_A); + PokemonDataBlockB *monDataBlockB = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_B); + PokemonDataBlockC *monDataBlockC = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_C); + PokemonDataBlockD *monDataBlockD = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_D); switch (param) { case MON_DATA_PERSONALITY: @@ -1331,7 +1331,7 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, enum PokemonDataParam pa monDataBlockB->fatefulEncounter = u8Value[0]; break; case MON_DATA_GENDER: - monDataBlockB->gender = GetMonPersonalityGender(monDataBlockA->species, boxMon->personality); + monDataBlockB->gender = Pokemon_GetGenderOf(monDataBlockA->species, boxMon->personality); break; case MON_DATA_FORM: monDataBlockB->form = u8Value[0]; @@ -1493,31 +1493,31 @@ static void SetBoxMonDataAttribute (BoxPokemon *boxMon, enum PokemonDataParam pa } } -void IncreaseMonData (Pokemon *mon, enum PokemonDataParam param, int value) +void Pokemon_IncreaseValue(Pokemon *mon, enum PokemonDataParam param, int value) { if (mon->box.partyDecrypted == FALSE) { - DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + Pokemon_DecryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_DecryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); - u16 checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + u16 checksum = Pokemon_GetDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); if (checksum != mon->box.checksum) { GF_ASSERT(checksum == mon->box.checksum); - EncryptMonData(mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + Pokemon_EncryptData(mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); return; } } - IncreaseMonDataAttribute(mon, param, value); + Pokemon_IncreaseDataInternal(mon, param, value); if (mon->box.partyDecrypted == FALSE) { - EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); - EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + mon->box.checksum = Pokemon_GetDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + Pokemon_EncryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } } -static void IncreaseMonDataAttribute (Pokemon *mon, enum PokemonDataParam param, int value) +static void Pokemon_IncreaseDataInternal(Pokemon *mon, enum PokemonDataParam param, int value) { switch (param) { case MON_DATA_CURRENT_HP: @@ -1540,23 +1540,23 @@ static void IncreaseMonDataAttribute (Pokemon *mon, enum PokemonDataParam param, GF_ASSERT(0); break; default: - IncreaseBoxMonDataAttribute(&mon->box, param, value); + BoxPokemon_IncreaseDataInternal(&mon->box, param, value); break; } } -static void IncreaseBoxMonDataAttribute (BoxPokemon *boxMon, enum PokemonDataParam param, int value) +static void BoxPokemon_IncreaseDataInternal(BoxPokemon *boxMon, enum PokemonDataParam param, int value) { - PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_A); - PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_B); - PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_C); - PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_D); + PokemonDataBlockA *monDataBlockA = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_A); + PokemonDataBlockB *monDataBlockB = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_B); + PokemonDataBlockC *monDataBlockC = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_C); + PokemonDataBlockD *monDataBlockD = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_D); // TODO consts for various maximum values? switch (param) { case MON_DATA_EXP: - if (monDataBlockA->exp + value > GetMonSpeciesLevelExp(monDataBlockA->species, 100)) { - monDataBlockA->exp = GetMonSpeciesLevelExp(monDataBlockA->species, 100); + if (monDataBlockA->exp + value > Pokemon_GetSpeciesBaseExpAt(monDataBlockA->species, 100)) { + monDataBlockA->exp = Pokemon_GetSpeciesBaseExpAt(monDataBlockA->species, 100); } else { monDataBlockA->exp += value; } @@ -1840,23 +1840,23 @@ static void IncreaseBoxMonDataAttribute (BoxPokemon *boxMon, enum PokemonDataPar } } -PokemonPersonalData *GetMonFormPersonalData (int monSpecies, int monForm, int heapID) +PokemonPersonalData *PokemonPersonalData_FromMonForm(int monSpecies, int monForm, int heapID) { PokemonPersonalData *monPersonalData = Heap_AllocFromHeap(heapID, sizeof(PokemonPersonalData)); - LoadMonFormPersonalData(monSpecies, monForm, monPersonalData); + PokemonPersonalData_LoadForm(monSpecies, monForm, monPersonalData); return monPersonalData; } -PokemonPersonalData *GetMonPersonalData (int monSpecies, int heapID) +PokemonPersonalData *PokemonPersonalData_FromMonSpecies(int monSpecies, int heapID) { PokemonPersonalData *monPersonalData = Heap_AllocFromHeap(heapID, sizeof(PokemonPersonalData)); - LoadMonPersonalData(monSpecies, monPersonalData); + PokemonPersonalData_LoadSpecies(monSpecies, monPersonalData); return monPersonalData; } -u32 GetMonPersonalDataAttribute (PokemonPersonalData *monPersonalData, enum PokemonPersonalDataParam param) +u32 PokemonPersonalData_GetValue(PokemonPersonalData *monPersonalData, enum PokemonPersonalDataParam param) { u32 result; @@ -1967,88 +1967,88 @@ u32 GetMonPersonalDataAttribute (PokemonPersonalData *monPersonalData, enum Poke return result; } -void FreeMonPersonalData (PokemonPersonalData *monPersonalData) +void PokemonPersonalData_Free(PokemonPersonalData *monPersonalData) { GF_ASSERT(monPersonalData); Heap_FreeToHeap(monPersonalData); } -u32 GetMonFormPersonalDataAttribute (int monSpecies, int monForm, enum PokemonPersonalDataParam param) +u32 PokemonPersonalData_GetFormValue(int monSpecies, int monForm, enum PokemonPersonalDataParam param) { - monSpecies = GetMonFormNarcIndex(monSpecies, monForm); + monSpecies = Pokemon_GetFormNarcIndex(monSpecies, monForm); - PokemonPersonalData *monPersonalData = GetMonPersonalData(monSpecies, 0); - u32 result = GetMonPersonalDataAttribute(monPersonalData, param); + PokemonPersonalData *monPersonalData = PokemonPersonalData_FromMonSpecies(monSpecies, 0); + u32 result = PokemonPersonalData_GetValue(monPersonalData, param); - FreeMonPersonalData(monPersonalData); + PokemonPersonalData_Free(monPersonalData); return result; } -u32 GetMonSpeciesPersonalDataAttribute (int monSpecies, enum PokemonPersonalDataParam param) +u32 PokemonPersonalData_GetSpeciesValue(int monSpecies, enum PokemonPersonalDataParam param) { - PokemonPersonalData *monPersonalData = GetMonPersonalData(monSpecies, 0); - u32 result = GetMonPersonalDataAttribute(monPersonalData, param); + PokemonPersonalData *monPersonalData = PokemonPersonalData_FromMonSpecies(monSpecies, 0); + u32 result = PokemonPersonalData_GetValue(monPersonalData, param); - FreeMonPersonalData(monPersonalData); + PokemonPersonalData_Free(monPersonalData); return result; } -u8 GetMonPercentToNextLevel (Pokemon *mon) +u8 Pokemon_GetPercentToNextLevel(Pokemon *mon) { - BOOL recrypt = DecryptMon(mon); - u16 monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); - u8 monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); - u32 monCurrentLevelExp = GetMonSpeciesLevelExp(monSpecies, monLevel); - u32 monNextLevelExp = GetMonSpeciesLevelExp(monSpecies, monLevel + 1); - u32 monExp = GetMonData(mon, MON_DATA_EXP, NULL); + BOOL recrypt = Pokemon_EnterDecryptionContext(mon); + u16 monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + u8 monLevel = Pokemon_GetValue(mon, MON_DATA_LEVEL, NULL); + u32 monCurrentLevelExp = Pokemon_GetSpeciesBaseExpAt(monSpecies, monLevel); + u32 monNextLevelExp = Pokemon_GetSpeciesBaseExpAt(monSpecies, monLevel + 1); + u32 monExp = Pokemon_GetValue(mon, MON_DATA_EXP, NULL); - EncryptMon(mon, recrypt); + Pokemon_ExitDecryptionContext(mon, recrypt); u8 monPercentToNextLevel = ((monExp - monCurrentLevelExp) * 100) / (monNextLevelExp - monCurrentLevelExp); return monPercentToNextLevel; } -u32 GetMonExpToNextLevel (Pokemon *mon) +u32 Pokemon_GetExpToNextLevel(Pokemon *mon) { - return GetBoxMonExpToNextLevel(&mon->box); + return BoxPokemon_GetExpToNextLevel(&mon->box); } -static u32 GetBoxMonExpToNextLevel (BoxPokemon *boxMon) +static u32 BoxPokemon_GetExpToNextLevel(BoxPokemon *boxMon) { - u16 monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); - u16 monNextlevel = GetBoxMonLevel(boxMon) + 1; - u32 monExp = GetBoxMonData(boxMon, MON_DATA_EXP, NULL); + u16 monSpecies = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, NULL); + u16 monNextlevel = BoxPokemon_GetLevel(boxMon) + 1; + u32 monExp = BoxPokemon_GetValue(boxMon, MON_DATA_EXP, NULL); - return GetMonSpeciesLevelExp(monSpecies, monNextlevel) - monExp; + return Pokemon_GetSpeciesBaseExpAt(monSpecies, monNextlevel) - monExp; } -u32 GetMonCurrentLevelExp (Pokemon *mon) +u32 Pokemon_GetCurrentLevelBaseExp(Pokemon *mon) { - return GetMonSpeciesLevelExp(GetMonData(mon, MON_DATA_SPECIES, NULL), GetMonData(mon, MON_DATA_LEVEL, NULL)); + return Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL), Pokemon_GetValue(mon, MON_DATA_LEVEL, NULL)); } -u32 GetMonSpeciesLevelExp (int monSpecies, int monLevel) +u32 Pokemon_GetSpeciesBaseExpAt(int monSpecies, int monLevel) { - return GetMonExpRateLevelExp(GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_EXP_RATE), monLevel); + return Pokemon_GetExpRateBaseExpAt(PokemonPersonalData_GetSpeciesValue(monSpecies, MON_DATA_PERSONAL_EXP_RATE), monLevel); } -static void LoadMonExperienceTable (int monExpRate, u32 *monExpTable) +static void Pokemon_LoadExperienceTableOf(int monExpRate, u32 *monExpTable) { // TODO const for table size, enum for exp rate types GF_ASSERT(monExpRate < 8); NARC_ReadWholeMemberByIndexPair(monExpTable, NARC_INDEX_POKETOOL__PERSONAL__PL_GROWTBL, monExpRate); } -static u32 GetMonExpRateLevelExp (int monExpRate, int monLevel) +static u32 Pokemon_GetExpRateBaseExpAt(int monExpRate, int monLevel) { // TODO const for table size, enum for exp rate types GF_ASSERT(monExpRate < 8); GF_ASSERT(monLevel <= 101); u32 *expTable = Heap_AllocFromHeap(0, 101 * 4); - LoadMonExperienceTable(monExpRate, expTable); + Pokemon_LoadExperienceTableOf(monExpRate, expTable); u32 result = expTable[monLevel]; Heap_FreeToHeap(expTable); @@ -2056,39 +2056,39 @@ static u32 GetMonExpRateLevelExp (int monExpRate, int monLevel) return result; } -u32 GetMonLevel (Pokemon *mon) +u32 Pokemon_GetLevel(Pokemon *mon) { - return GetBoxMonLevel(&mon->box); + return BoxPokemon_GetLevel(&mon->box); } -u32 GetBoxMonLevel (BoxPokemon *boxMon) +u32 BoxPokemon_GetLevel(BoxPokemon *boxMon) { - BOOL reencrypt = DecryptBoxMon(boxMon); - int monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); - u32 monExp = GetBoxMonData(boxMon, MON_DATA_EXP, NULL); + BOOL reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); + int monSpecies = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, NULL); + u32 monExp = BoxPokemon_GetValue(boxMon, MON_DATA_EXP, NULL); - EncryptBoxMon(boxMon, reencrypt); + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); - return GetMonSpeciesLevel(monSpecies, monExp); + return Pokemon_GetSpeciesLevelAt(monSpecies, monExp); } -u32 GetMonSpeciesLevel (u16 monSpecies, u32 monExp) +u32 Pokemon_GetSpeciesLevelAt(u16 monSpecies, u32 monExp) { - PokemonPersonalData *monPersonalData = GetMonPersonalData(monSpecies, 0); + PokemonPersonalData *monPersonalData = PokemonPersonalData_FromMonSpecies(monSpecies, 0); - u32 monLevel = GetMonPersonalDataLevel(monPersonalData, monSpecies, monExp); - FreeMonPersonalData(monPersonalData); + u32 monLevel = PokemonPersonalData_GetLevelAt(monPersonalData, monSpecies, monExp); + PokemonPersonalData_Free(monPersonalData); return monLevel; } -u32 GetMonPersonalDataLevel (PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monExp) +u32 PokemonPersonalData_GetLevelAt(PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monExp) { // TODO const for table size, enum for exp rate types static u32 monExpTable[101]; - int monExpRate = GetMonPersonalDataAttribute(monPersonalData, MON_DATA_PERSONAL_EXP_RATE); - LoadMonExperienceTable(monExpRate, monExpTable); + int monExpRate = PokemonPersonalData_GetValue(monPersonalData, MON_DATA_PERSONAL_EXP_RATE); + Pokemon_LoadExperienceTableOf(monExpRate, monExpTable); int i; for (i = 1; i < 101; i++) { @@ -2100,22 +2100,22 @@ u32 GetMonPersonalDataLevel (PokemonPersonalData *monPersonalData, u16 unused_mo return i - 1; } -u8 GetMonNature (Pokemon *mon) +u8 Pokemon_GetNature(Pokemon *mon) { - return GetBoxMonNature(&mon->box); + return BoxPokemon_GetNature(&mon->box); } -u8 GetBoxMonNature (BoxPokemon *boxMon) +u8 BoxPokemon_GetNature(BoxPokemon *boxMon) { - BOOL reencrypt = DecryptBoxMon(boxMon); - u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); + BOOL reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); + u32 monPersonality = BoxPokemon_GetValue(boxMon, MON_DATA_PERSONALITY, NULL); - EncryptBoxMon(boxMon, reencrypt); + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); - return GetNatureFromPersonality(monPersonality); + return Pokemon_GetNatureOf(monPersonality); } -u8 GetNatureFromPersonality (u32 monPersonality) +u8 Pokemon_GetNatureOf(u32 monPersonality) { // TODO const for nature count/enum for natures? return (u8)(monPersonality % 25); @@ -2150,7 +2150,7 @@ static const s8 sNatureStatAffinities[][5] = { {0, 0, 0, 0, 0} }; -static u16 GetNatureAdjustedStatValue (u8 monNature, u16 monStatValue, u8 statType) +static u16 Pokemon_GetNatureStatValue(u8 monNature, u16 monStatValue, u8 statType) { if (statType < STAT_ATTACK || statType > STAT_SPECIAL_DEFENSE) { return monStatValue; @@ -2174,7 +2174,7 @@ static u16 GetNatureAdjustedStatValue (u8 monNature, u16 monStatValue, u8 statTy return result; } -s8 GetNatureStatAffinity (u8 monNature, u8 statType) +s8 Pokemon_GetStatAffinityOf(u8 monNature, u8 statType) { return sNatureStatAffinities[monNature][statType - 1]; } @@ -2192,7 +2192,7 @@ static const s8 Unk_020F05A0[][3] = { {3, 2, 1} // ??? in unk_020933F8.c }; -void sub_02075C74 (Pokemon *mon, u8 param1, u16 param2) +void sub_02075C74(Pokemon *mon, u8 param1, u16 param2) { // TODO enum value (param 1 is method of gaining/losing friendship) if (param1 == 5) { @@ -2201,16 +2201,16 @@ void sub_02075C74 (Pokemon *mon, u8 param1, u16 param2) } } - u16 monSpeciesEgg = GetMonData(mon, MON_DATA_SPECIES_EGG, NULL); + u16 monSpeciesEgg = Pokemon_GetValue(mon, MON_DATA_SPECIES_EGG, NULL); if (monSpeciesEgg == SPECIES_NONE || monSpeciesEgg == SPECIES_EGG) { return; } - u16 monHeldItem = GetMonData(mon, MON_DATA_HELD_ITEM, NULL); + u16 monHeldItem = Pokemon_GetValue(mon, MON_DATA_HELD_ITEM, NULL); u8 itemHoldEffect = Item_LoadParam(monHeldItem, ITEM_PARAM_HOLD_EFFECT, 0); u8 v4 = 0; - s16 monFriendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL); + s16 monFriendship = Pokemon_GetValue(mon, MON_DATA_FRIENDSHIP, NULL); if (monFriendship >= 100) { v4++; @@ -2222,11 +2222,11 @@ void sub_02075C74 (Pokemon *mon, u8 param1, u16 param2) s8 v3 = Unk_020F05A0[param1][v4]; - if (v3 > 0 && GetMonData(mon, MON_DATA_POKEBALL, NULL) == ITEM_LUXURY_BALL) { + if (v3 > 0 && Pokemon_GetValue(mon, MON_DATA_POKEBALL, NULL) == ITEM_LUXURY_BALL) { v3++; } - if (v3 > 0 && GetMonData(mon, MON_DATA_152, NULL) == param2) { + if (v3 > 0 && Pokemon_GetValue(mon, MON_DATA_152, NULL) == param2) { v3++; } @@ -2246,38 +2246,38 @@ void sub_02075C74 (Pokemon *mon, u8 param1, u16 param2) monFriendship = 255; } - SetMonData(mon, MON_DATA_FRIENDSHIP, &monFriendship); + Pokemon_SetValue(mon, MON_DATA_FRIENDSHIP, &monFriendship); } -u8 GetMonGender (Pokemon *mon) +u8 Pokemon_GetGender(Pokemon *mon) { - return GetBoxMonGender(&mon->box); + return BoxPokemon_GetGender(&mon->box); } -u8 GetBoxMonGender (BoxPokemon *boxMon) +u8 BoxPokemon_GetGender(BoxPokemon *boxMon) { - BOOL reencrypt = DecryptBoxMon(boxMon); - u16 monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); - u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); + BOOL reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); + u16 monSpecies = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, NULL); + u32 monPersonality = BoxPokemon_GetValue(boxMon, MON_DATA_PERSONALITY, NULL); - EncryptBoxMon(boxMon, reencrypt); + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); - return GetMonPersonalityGender(monSpecies, monPersonality); + return Pokemon_GetGenderOf(monSpecies, monPersonality); } -u8 GetMonPersonalityGender (u16 monSpecies, u32 monPersonality) +u8 Pokemon_GetGenderOf(u16 monSpecies, u32 monPersonality) { - PokemonPersonalData *monPersonalData = GetMonPersonalData(monSpecies, 0); - u8 monGender = GetMonPersonalDataGender(monPersonalData, monSpecies, monPersonality); + PokemonPersonalData *monPersonalData = PokemonPersonalData_FromMonSpecies(monSpecies, 0); + u8 monGender = PokemonPersonalData_GetGenderOf(monPersonalData, monSpecies, monPersonality); - FreeMonPersonalData(monPersonalData); + PokemonPersonalData_Free(monPersonalData); return monGender; } -u8 GetMonPersonalDataGender (PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monPersonality) +u8 PokemonPersonalData_GetGenderOf(PokemonPersonalData *monPersonalData, u16 unused_monSpecies, u32 monPersonality) { - u8 monGender = GetMonPersonalDataAttribute(monPersonalData, MON_DATA_PERSONAL_GENDER); + u8 monGender = PokemonPersonalData_GetValue(monPersonalData, MON_DATA_PERSONAL_GENDER); switch (monGender) { case GENDER_ALWAYS_MALE: @@ -2295,29 +2295,31 @@ u8 GetMonPersonalDataGender (PokemonPersonalData *monPersonalData, u16 unused_mo } } -u8 GetMonShininess (Pokemon *mon) +// TODO return bool +u8 Pokemon_IsShiny(Pokemon *mon) { - return GetBoxMonShininess(&mon->box); + return BoxPokemon_IsShiny(&mon->box); } -static u8 GetBoxMonShininess (BoxPokemon *boxMon) +// TODO return bool +static u8 BoxPokemon_IsShiny(BoxPokemon *boxMon) { - u32 monOTID = GetBoxMonData(boxMon, MON_DATA_OT_ID, NULL); - u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); + u32 monOTID = BoxPokemon_GetValue(boxMon, MON_DATA_OT_ID, NULL); + u32 monPersonality = BoxPokemon_GetValue(boxMon, MON_DATA_PERSONALITY, NULL); - return GetMonPersonalityShininess(monOTID, monPersonality); + return Pokemon_IsPersonalityShiny(monOTID, monPersonality); } -static inline BOOL IsMonPersonalityShiny(u32 monOTID, u32 monPersonality) { +static inline BOOL Pokemon_InlineIsPersonalityShiny(u32 monOTID, u32 monPersonality) { return (((monOTID & 0xffff0000) >> 16) ^ (monOTID & 0xffff) ^ ((monPersonality & 0xffff0000) >> 16) ^ (monPersonality & 0xffff)) < 8; } -u8 GetMonPersonalityShininess (u32 monOTID, u32 monPersonality) +u8 Pokemon_IsPersonalityShiny(u32 monOTID, u32 monPersonality) { - return IsMonPersonalityShiny(monOTID, monPersonality); + return Pokemon_InlineIsPersonalityShiny(monOTID, monPersonality); } -u32 sub_02075E64 (u32 param0) +u32 sub_02075E64(u32 param0) { param0 = (((param0 & 0xffff0000) >> 16) ^ (param0 & 0xffff)) >> 3; @@ -2326,16 +2328,16 @@ u32 sub_02075E64 (u32 param0) u16 v3 = LCRNG_Next() & 0x7; for (i = 0; i < 13; i++) { - if (param0 & GetSingleBitMask(i)) { + if (param0 & Pokemon_GetFlagMaskOf(i)) { if (LCRNG_Next() & 1) { - v2 |= GetSingleBitMask(i + 3); + v2 |= Pokemon_GetFlagMaskOf(i + 3); } else { - v3 |= GetSingleBitMask(i + 3); + v3 |= Pokemon_GetFlagMaskOf(i + 3); } } else { if (LCRNG_Next() & 1) { - v2 |= GetSingleBitMask(i + 3); - v3 |= GetSingleBitMask(i + 3); + v2 |= Pokemon_GetFlagMaskOf(i + 3); + v3 |= Pokemon_GetFlagMaskOf(i + 3); } } } @@ -2345,34 +2347,34 @@ u32 sub_02075E64 (u32 param0) return result; } -void sub_02075EF4 (UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2) +void sub_02075EF4(UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2) { sub_02075F0C(param0, &mon->box, param2, FALSE); } -void sub_02075F00 (UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2) +void sub_02075F00(UnkStruct_02008A90 *param0, Pokemon *mon, u8 param2) { sub_02075F0C(param0, &mon->box, param2, TRUE); } -void sub_02075F0C (UnkStruct_02008A90 *param0, BoxPokemon *boxMon, u8 param2, BOOL param3) +void sub_02075F0C(UnkStruct_02008A90 *param0, BoxPokemon *boxMon, u8 param2, BOOL param3) { - BOOL reencrypt = DecryptBoxMon(boxMon); + BOOL reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); - u16 monSpeciesEgg = GetBoxMonData(boxMon, MON_DATA_SPECIES_EGG, NULL); - u8 monGender = GetBoxMonGender(boxMon); - u8 monShininess = GetBoxMonShininess(boxMon); - u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); + u16 monSpeciesEgg = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES_EGG, NULL); + u8 monGender = BoxPokemon_GetGender(boxMon); + u8 monShininess = BoxPokemon_IsShiny(boxMon); + u32 monPersonality = BoxPokemon_GetValue(boxMon, MON_DATA_PERSONALITY, NULL); u8 monForm; if (monSpeciesEgg == SPECIES_EGG) { - if (GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL) == SPECIES_MANAPHY) { + if (BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, NULL) == SPECIES_MANAPHY) { monForm = 1; } else { monForm = 0; } } else { - monForm = GetBoxMonData(boxMon, MON_DATA_FORM, NULL); + monForm = BoxPokemon_GetValue(boxMon, MON_DATA_FORM, NULL); } if (param3 == TRUE) { @@ -2381,16 +2383,16 @@ void sub_02075F0C (UnkStruct_02008A90 *param0, BoxPokemon *boxMon, u8 param2, BO sub_02075FB4(param0, monSpeciesEgg, monGender, param2, monShininess, monForm, monPersonality); } - EncryptBoxMon(boxMon, reencrypt); + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); } -void sub_02075FB4 (UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality) +void sub_02075FB4(UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality) { // TODO enum values? param0->unk_06 = 0; param0->unk_08 = 0; param0->unk_0C = 0; - monForm = SanitizeFormId(monSpecies, monForm); + monForm = Pokemon_SanitizeFormId(monSpecies, monForm); switch (monSpecies) { case SPECIES_BURMY: @@ -2478,7 +2480,7 @@ void sub_02075FB4 (UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 } } -u8 SanitizeFormId (u16 monSpecies, u8 monForm) +u8 Pokemon_SanitizeFormId(u16 monSpecies, u8 monForm) { // TODO enum values? switch (monSpecies) { @@ -2553,14 +2555,14 @@ u8 SanitizeFormId (u16 monSpecies, u8 monForm) return monForm; } -static void sub_02076300 (UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality) +static void sub_02076300(UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGender, u8 param3, u8 monShininess, u8 monForm, u32 monPersonality) { // TODO enum values? param0->unk_06 = 0; param0->unk_08 = 0; param0->unk_0C = 0; - monForm = SanitizeFormId(monSpecies, monForm); + monForm = Pokemon_SanitizeFormId(monSpecies, monForm); switch (monSpecies) { case SPECIES_BURMY: @@ -2666,32 +2668,32 @@ static void sub_02076300 (UnkStruct_02008A90 *param0, u16 monSpecies, u8 monGend } } -u8 sub_020765AC (Pokemon *mon, u8 param1) +u8 sub_020765AC(Pokemon *mon, u8 param1) { return sub_020765C4(&mon->box, param1, FALSE); } -u8 sub_020765B8 (Pokemon *mon, u8 param1) +u8 sub_020765B8(Pokemon *mon, u8 param1) { return sub_020765C4(&mon->box, param1, TRUE); } -u8 sub_020765C4 (BoxPokemon *boxMon, u8 param1, BOOL param2) +u8 sub_020765C4(BoxPokemon *boxMon, u8 param1, BOOL param2) { - u16 monSpeciesEgg = GetBoxMonData(boxMon, MON_DATA_SPECIES_EGG, NULL); - u8 monGender = GetBoxMonGender(boxMon); - u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); + u16 monSpeciesEgg = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES_EGG, NULL); + u8 monGender = BoxPokemon_GetGender(boxMon); + u32 monPersonality = BoxPokemon_GetValue(boxMon, MON_DATA_PERSONALITY, NULL); u8 monForm; // TODO enum values? if (monSpeciesEgg == SPECIES_EGG) { - if (GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL) == SPECIES_MANAPHY) { + if (BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, NULL) == SPECIES_MANAPHY) { monForm = 1; } else { monForm = 0; } } else { - monForm = GetBoxMonData(boxMon, MON_DATA_FORM, NULL); + monForm = BoxPokemon_GetValue(boxMon, MON_DATA_FORM, NULL); } if (param2 == TRUE) { @@ -2701,10 +2703,10 @@ u8 sub_020765C4 (BoxPokemon *boxMon, u8 param1, BOOL param2) return sub_02076648(monSpeciesEgg, monGender, param1, monForm, monPersonality); } -u8 sub_02076648 (u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality) +u8 sub_02076648(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality) { // TODO enum values? - monForm = SanitizeFormId(monSpecies, monForm); + monForm = Pokemon_SanitizeFormId(monSpecies, monForm); int narcIndex; int memberIndex; @@ -2776,10 +2778,10 @@ u8 sub_02076648 (u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPer return result; } -static u8 sub_020767BC (u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality) +static u8 sub_020767BC(u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 monPersonality) { // TODO enum values? - monForm = SanitizeFormId(monSpecies, monForm); + monForm = Pokemon_SanitizeFormId(monSpecies, monForm); int narcIndex; int memberIndex; @@ -2866,7 +2868,7 @@ static u8 sub_020767BC (u16 monSpecies, u8 monGender, u8 param2, u8 monForm, u32 return result; } -void sub_0207697C (UnkStruct_02008A90 *param0, u16 param1) +void sub_0207697C(UnkStruct_02008A90 *param0, u16 param1) { param0->unk_00 = 60; param0->unk_02 = param1 * 2; @@ -2898,7 +2900,7 @@ static const int Unk_020F0588[] = { 0x1 }; -UnkStruct_0200D0F4 *sub_02076994 (UnkStruct_0200C6E4 *param0, UnkStruct_0200C704 *param1, UnkStruct_02002F38 *param2, int param3, int param4, int param5, int param6, int param7, int heapID) +UnkStruct_0200D0F4 *sub_02076994(UnkStruct_0200C6E4 *param0, UnkStruct_0200C704 *param1, UnkStruct_02002F38 *param2, int param3, int param4, int param5, int param6, int param7, int heapID) { UnkStruct_ov104_0223F9E0 v0; UnkStruct_0200D0F4 *v1; @@ -2940,7 +2942,7 @@ UnkStruct_0200D0F4 *sub_02076994 (UnkStruct_0200C6E4 *param0, UnkStruct_0200C704 return v1; } -void sub_02076AAC (int param0, int param1, UnkStruct_ov5_021DE5D0 *param2) +void sub_02076AAC(int param0, int param1, UnkStruct_ov5_021DE5D0 *param2) { // TODO enum values? if (param1 == 2) { @@ -2961,43 +2963,43 @@ void sub_02076AAC (int param0, int param1, UnkStruct_ov5_021DE5D0 *param2) } } -u32 GetPokemonStructSize (void) +u32 Pokemon_GetStructSize(void) { return (u32)sizeof(Pokemon); } -u32 GetBoxPokemonStructSize (void) +u32 BoxPokemon_GetStructSize(void) { return (u32)sizeof(BoxPokemon); } -u8 GetMonForm (Pokemon *mon) +u8 Pokemon_GetForm(Pokemon *mon) { - return GetBoxMonForm(&mon->box); + return BoxPokemon_GetForm(&mon->box); } -u8 GetBoxMonForm (BoxPokemon *boxMon) +u8 BoxPokemon_GetForm(BoxPokemon *boxMon) { - return GetBoxMonData(boxMon, MON_DATA_FORM, NULL); + return BoxPokemon_GetValue(boxMon, MON_DATA_FORM, NULL); } -BoxPokemon *GetBoxMon (Pokemon *mon) +BoxPokemon *Pokemon_GetBoxPokemon(Pokemon *mon) { return &mon->box; } -BOOL sub_02076B14 (Pokemon *mon) +BOOL sub_02076B14(Pokemon *mon) { - u16 monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); - u8 monNextLevel = GetMonData(mon, MON_DATA_LEVEL, NULL) + 1; - u32 monExp = GetMonData(mon, MON_DATA_EXP, NULL); - int monExpRate = GetMonSpeciesPersonalDataAttribute(monSpecies, MON_DATA_PERSONAL_EXP_RATE); + u16 monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + u8 monNextLevel = Pokemon_GetValue(mon, MON_DATA_LEVEL, NULL) + 1; + u32 monExp = Pokemon_GetValue(mon, MON_DATA_EXP, NULL); + int monExpRate = PokemonPersonalData_GetSpeciesValue(monSpecies, MON_DATA_PERSONAL_EXP_RATE); // TODO const value? - u32 maxExp = GetMonExpRateLevelExp(monExpRate, 100); + u32 maxExp = Pokemon_GetExpRateBaseExpAt(monExpRate, 100); if (monExp > maxExp) { monExp = maxExp; - SetMonData(mon, MON_DATA_EXP, &monExp); + Pokemon_SetValue(mon, MON_DATA_EXP, &monExp); } // TODO const value? @@ -3005,10 +3007,10 @@ BOOL sub_02076B14 (Pokemon *mon) return FALSE; } - maxExp = GetMonExpRateLevelExp(monExpRate, monNextLevel); + maxExp = Pokemon_GetExpRateBaseExpAt(monExpRate, monNextLevel); if (monExp >= maxExp) { - SetMonData(mon, MON_DATA_LEVEL, &monNextLevel); + Pokemon_SetValue(mon, MON_DATA_LEVEL, &monNextLevel); return TRUE; } @@ -3016,14 +3018,14 @@ BOOL sub_02076B14 (Pokemon *mon) } // TODO return species enum (TODO: replace species id defines with enum) -u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int *evoTypeResult) +u16 sub_02076B94(Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int *evoTypeResult) { u16 targetSpecies = SPECIES_NONE; - u16 monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); - u16 monHeldItem = GetMonData(mon, MON_DATA_HELD_ITEM, NULL); - u32 monPersonality = GetMonData(mon, MON_DATA_PERSONALITY, NULL); - u8 monBeauty = GetMonData(mon, MON_DATA_BEAUTY, NULL); + u16 monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + u16 monHeldItem = Pokemon_GetValue(mon, MON_DATA_HELD_ITEM, NULL); + u32 monPersonality = Pokemon_GetValue(mon, MON_DATA_PERSONALITY, NULL); + u8 monBeauty = Pokemon_GetValue(mon, MON_DATA_BEAUTY, NULL); int i; u16 monFriendship; @@ -3043,13 +3045,13 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int } PokemonEvolutionData *monEvolutionData = Heap_AllocFromHeap(0, sizeof(PokemonEvolutionData)); - LoadMonEvolutionData(monSpecies, monEvolutionData); + PokemonEvolutionData_LoadSpecies(monSpecies, monEvolutionData); // TODO enum? switch (evoTypeList) { case 0: - u8 monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); - monFriendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL); + u8 monLevel = Pokemon_GetValue(mon, MON_DATA_LEVEL, NULL); + monFriendship = Pokemon_GetValue(mon, MON_DATA_FRIENDSHIP, NULL); for (i = 0; i < 7; i++) { switch (monEvolutionData->methods[i].type) { @@ -3079,7 +3081,7 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int break; case 8: // tyrogue evo to hitmonlee: above level param && attack > defense if (monEvolutionData->methods[i].param <= monLevel) { - if (GetMonData(mon, MON_DATA_ATK, NULL) > GetMonData(mon, MON_DATA_DEF, NULL)) { + if (Pokemon_GetValue(mon, MON_DATA_ATK, NULL) > Pokemon_GetValue(mon, MON_DATA_DEF, NULL)) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 8; } @@ -3087,7 +3089,7 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int break; case 9: // tyrogue evo to hitmontop: above level param && attack == defense if (monEvolutionData->methods[i].param <= monLevel) { - if (GetMonData(mon, MON_DATA_ATK, NULL) == GetMonData(mon, MON_DATA_DEF, NULL)) { + if (Pokemon_GetValue(mon, MON_DATA_ATK, NULL) == Pokemon_GetValue(mon, MON_DATA_DEF, NULL)) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 9; } @@ -3095,7 +3097,7 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int break; case 10: // tyrogue evo to hitmonchan: above level param && attack < defense if (monEvolutionData->methods[i].param <= monLevel) { - if (GetMonData(mon, MON_DATA_ATK, NULL) < GetMonData(mon, MON_DATA_DEF, NULL)) { + if (Pokemon_GetValue(mon, MON_DATA_ATK, NULL) < Pokemon_GetValue(mon, MON_DATA_DEF, NULL)) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 10; } @@ -3145,7 +3147,7 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int } break; case 20: // lickitung, tangela etc. evo: after param learned - if (MonHasMove(mon, monEvolutionData->methods[i].param) == 1) { + if (Pokemon_HasMove(mon, monEvolutionData->methods[i].param) == 1) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 20; } @@ -3159,13 +3161,13 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int } break; case 22: // burmy evo to mothim: above level param && male - if (GetMonData(mon, MON_DATA_GENDER, NULL) == 0 && monEvolutionData->methods[i].param <= monLevel) { + if (Pokemon_GetValue(mon, MON_DATA_GENDER, NULL) == 0 && monEvolutionData->methods[i].param <= monLevel) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 22; } break; case 23: // burmy evo to wormadam, combee evo to vespiquen: above level param && female - if (GetMonData(mon, MON_DATA_GENDER, NULL) == 1 && monEvolutionData->methods[i].param <= monLevel) { + if (Pokemon_GetValue(mon, MON_DATA_GENDER, NULL) == 1 && monEvolutionData->methods[i].param <= monLevel) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 23; } @@ -3225,13 +3227,13 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int break; } // kirlia evo to gallade: use param && male - if (monEvolutionData->methods[i].type == 16 && GetMonData(mon, MON_DATA_GENDER, NULL) == 0 && monEvolutionData->methods[i].param == evoParam) { + if (monEvolutionData->methods[i].type == 16 && Pokemon_GetValue(mon, MON_DATA_GENDER, NULL) == 0 && monEvolutionData->methods[i].param == evoParam) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 0; break; } // snorunt evo to froslass: use param && female - if (monEvolutionData->methods[i].type == 17 && GetMonData(mon, MON_DATA_GENDER, NULL) == 1 && monEvolutionData->methods[i].param == evoParam) { + if (monEvolutionData->methods[i].type == 17 && Pokemon_GetValue(mon, MON_DATA_GENDER, NULL) == 1 && monEvolutionData->methods[i].param == evoParam) { targetSpecies = monEvolutionData->methods[i].targetSpecies; evoTypeResult[0] = 0; break; @@ -3248,7 +3250,7 @@ u16 sub_02076B94 (Party *party, Pokemon *mon, u8 evoTypeList, u16 evoParam, int return targetSpecies; } -u16 sub_02076F84 (const u16 monSpecies) +u16 sub_02076F84(const u16 monSpecies) { u16 result = 0; GF_ASSERT(NATIONAL_DEX_COUNT + 1 > monSpecies); @@ -3263,7 +3265,7 @@ u16 sub_02076F84 (const u16 monSpecies) return result; } -u16 sub_02076FD4 (const u16 monSpecies) +u16 sub_02076FD4(const u16 monSpecies) { switch (monSpecies) { case SPECIES_WOBBUFFET: @@ -3282,19 +3284,19 @@ u16 sub_02076FD4 (const u16 monSpecies) return sub_02076F84(monSpecies); } -static void SetBoxMonDefaultMoves (BoxPokemon *boxMon) +static void BoxPokemon_SetDefaultMoves(BoxPokemon *boxMon) { BOOL reencrypt; // TODO const value? u16 *monLevelUpMoves = Heap_AllocFromHeap(0, 44); - reencrypt = DecryptBoxMon(boxMon); + reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); - u16 monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, 0); - int monForm = GetBoxMonData(boxMon, MON_DATA_FORM, 0); - u8 monLevel = GetBoxMonLevel(boxMon); + u16 monSpecies = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, 0); + int monForm = BoxPokemon_GetValue(boxMon, MON_DATA_FORM, 0); + u8 monLevel = BoxPokemon_GetLevel(boxMon); - LoadMonLevelUpMoves(monSpecies, monForm, monLevelUpMoves); + Pokemon_LoadLevelUpMovesOf(monSpecies, monForm, monLevelUpMoves); int i = 0; @@ -3302,10 +3304,10 @@ static void SetBoxMonDefaultMoves (BoxPokemon *boxMon) while (monLevelUpMoves[i] != 0xffff) { if ((monLevelUpMoves[i] & 0xfe00) <= monLevel << 9) { u16 monLevelUpMoveID = monLevelUpMoves[i] & 0x1ff; - u16 moveID = AddBoxMonMove(boxMon, monLevelUpMoveID); + u16 moveID = BoxPokemon_AddMove(boxMon, monLevelUpMoveID); if (moveID == 0xffff) { - ReplaceBoxMonMove(boxMon, monLevelUpMoveID); + BoxPokemon_ReplaceMove(boxMon, monLevelUpMoveID); } } else { break; @@ -3315,26 +3317,26 @@ static void SetBoxMonDefaultMoves (BoxPokemon *boxMon) } Heap_FreeToHeap(monLevelUpMoves); - EncryptBoxMon(boxMon, reencrypt); + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); } -u16 AddMonMove (Pokemon *mon, u16 moveID) +u16 Pokemon_AddMove(Pokemon *mon, u16 moveID) { - BoxPokemon *boxMon = GetBoxMon(mon); - return AddBoxMonMove(boxMon, moveID); + BoxPokemon *boxMon = Pokemon_GetBoxPokemon(mon); + return BoxPokemon_AddMove(boxMon, moveID); } -static u16 AddBoxMonMove (BoxPokemon *boxMon, u16 moveID) +static u16 BoxPokemon_AddMove(BoxPokemon *boxMon, u16 moveID) { // TODO const values for sentinels? u16 result = 0xffff; - BOOL reencrypt = DecryptBoxMon(boxMon); + BOOL reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); for (int i = 0; i < 4; i++) { u16 slotMove; - if ((slotMove = GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, NULL)) == 0) { - SetBoxMonMove(boxMon, moveID, i); + if ((slotMove = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1 + i, NULL)) == 0) { + BoxPokemon_SetMoveSlot(boxMon, moveID, i); result = moveID; break; } else { @@ -3345,29 +3347,29 @@ static u16 AddBoxMonMove (BoxPokemon *boxMon, u16 moveID) } } - EncryptBoxMon(boxMon, reencrypt); + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); return result; } -void ReplaceMonMove (Pokemon *mon, u16 moveID) +void Pokemon_ReplaceMove (Pokemon *mon, u16 moveID) { - BoxPokemon *boxMon = GetBoxMon(mon); - ReplaceBoxMonMove(boxMon, moveID); + BoxPokemon *boxMon = Pokemon_GetBoxPokemon(mon); + BoxPokemon_ReplaceMove(boxMon, moveID); } -static void ReplaceBoxMonMove (BoxPokemon *boxMon, u16 moveID) +static void BoxPokemon_ReplaceMove(BoxPokemon *boxMon, u16 moveID) { - BOOL reencrypt = DecryptBoxMon(boxMon); + BOOL reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); u16 moveIDs[4]; u8 movePPs[4]; u8 movePPUps[4]; for (int i = 0; i < 3; i++) { - moveIDs[i] = GetBoxMonData(boxMon, MON_DATA_MOVE2 + i, NULL); - movePPs[i] = GetBoxMonData(boxMon, MON_DATA_MOVE2_CUR_PP + i, NULL); - movePPUps[i] = GetBoxMonData(boxMon, MON_DATA_MOVE2_PP_UPS + i, NULL); + moveIDs[i] = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE2 + i, NULL); + movePPs[i] = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE2_CUR_PP + i, NULL); + movePPUps[i] = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE2_PP_UPS + i, NULL); } moveIDs[3] = moveID; @@ -3375,54 +3377,54 @@ static void ReplaceBoxMonMove (BoxPokemon *boxMon, u16 moveID) movePPUps[3] = 0; for (int i = 0; i < 4; i++) { - SetBoxMonData(boxMon, MON_DATA_MOVE1 + i, &moveIDs[i]); - SetBoxMonData(boxMon, MON_DATA_MOVE1_CUR_PP + i, &movePPs[i]); - SetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + i, &movePPUps[i]); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1 + i, &moveIDs[i]); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1_CUR_PP + i, &movePPs[i]); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1_PP_UPS + i, &movePPUps[i]); } - EncryptBoxMon(boxMon, reencrypt); + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); } -void ResetMonMove (Pokemon *mon, u16 moveID, u8 moveSlot) +void Pokemon_ResetMoveSlot(Pokemon *mon, u16 moveID, u8 moveSlot) { - SetMonMove(mon, moveID, moveSlot); + Pokemon_SetMoveSlot(mon, moveID, moveSlot); u32 moveMaxPP; u32 movePPUps = 0; - SetMonData(mon, MON_DATA_MOVE1_PP_UPS + moveSlot, &movePPUps); + Pokemon_SetValue(mon, MON_DATA_MOVE1_PP_UPS + moveSlot, &movePPUps); moveMaxPP = MoveTable_CalcMaxPP(moveID, 0); - SetMonData(mon, MON_DATA_MOVE1_CUR_PP + moveSlot, &moveMaxPP); + Pokemon_SetValue(mon, MON_DATA_MOVE1_CUR_PP + moveSlot, &moveMaxPP); return; } -void SetMonMove (Pokemon *mon, u16 moveID, u8 moveSlot) +void Pokemon_SetMoveSlot(Pokemon *mon, u16 moveID, u8 moveSlot) { - SetBoxMonMove(&mon->box, moveID, moveSlot); + BoxPokemon_SetMoveSlot(&mon->box, moveID, moveSlot); } -static void SetBoxMonMove (BoxPokemon *boxMon, u16 moveID, u8 moveSlot) +static void BoxPokemon_SetMoveSlot(BoxPokemon *boxMon, u16 moveID, u8 moveSlot) { - SetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot, &moveID); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1 + moveSlot, &moveID); - u8 movePPUps = GetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot, NULL); + u8 movePPUps = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot, NULL); u8 moveMaxPP = MoveTable_CalcMaxPP(moveID, movePPUps); - SetBoxMonData(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot, &moveMaxPP); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot, &moveMaxPP); } -u16 sub_0207727C (Pokemon *mon, int *index, u16 *moveID) +u16 sub_0207727C(Pokemon *mon, int *index, u16 *moveID) { u16 result = 0x0; // TODO const value? u16 *monLevelUpMoves = Heap_AllocFromHeap(0, 44); - u16 monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); - int monForm = GetMonData(mon, MON_DATA_FORM, NULL); - u8 monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); + u16 monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + int monForm = Pokemon_GetValue(mon, MON_DATA_FORM, NULL); + u8 monLevel = Pokemon_GetValue(mon, MON_DATA_LEVEL, NULL); - LoadMonLevelUpMoves(monSpecies, monForm, monLevelUpMoves); + Pokemon_LoadLevelUpMovesOf(monSpecies, monForm, monLevelUpMoves); // TODO const values for sentinels? if (monLevelUpMoves[index[0]] == 0xffff) { @@ -3443,7 +3445,7 @@ u16 sub_0207727C (Pokemon *mon, int *index, u16 *moveID) moveID[0] = monLevelUpMoves[index[0]] & 0x1ff; index[0]++; - result = AddMonMove(mon, moveID[0]); + result = Pokemon_AddMove(mon, moveID[0]); } Heap_FreeToHeap(monLevelUpMoves); @@ -3451,62 +3453,62 @@ u16 sub_0207727C (Pokemon *mon, int *index, u16 *moveID) return result; } -void SwapMonMoves (Pokemon *mon, int moveSlot1, int moveSlot2) +void Pokemon_SwapMoveSlots(Pokemon *mon, int moveSlot1, int moveSlot2) { - SwapBoxMonMoves(&mon->box, moveSlot1, moveSlot2); + BoxPokemon_SwapMoveSlots(&mon->box, moveSlot1, moveSlot2); } -void SwapBoxMonMoves (BoxPokemon *boxMon, int moveSlot1, int moveSlot2) +void BoxPokemon_SwapMoveSlots(BoxPokemon *boxMon, int moveSlot1, int moveSlot2) { u16 moveIDs[2]; u8 movePPs[2]; u8 movePPUps[2]; - moveIDs[0] = GetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot1, NULL); - movePPs[0] = GetBoxMonData(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot1, NULL); - movePPUps[0] = GetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot1, NULL); - moveIDs[1] = GetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot2, NULL); - movePPs[1] = GetBoxMonData(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot2, NULL); - movePPUps[1] = GetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot2, NULL); + moveIDs[0] = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1 + moveSlot1, NULL); + movePPs[0] = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot1, NULL); + movePPUps[0] = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot1, NULL); + moveIDs[1] = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1 + moveSlot2, NULL); + movePPs[1] = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot2, NULL); + movePPUps[1] = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot2, NULL); - SetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot1, &moveIDs[1]); - SetBoxMonData(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot1, &movePPs[1]); - SetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot1, &movePPUps[1]); - SetBoxMonData(boxMon, MON_DATA_MOVE1 + moveSlot2, &moveIDs[0]); - SetBoxMonData(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot2, &movePPs[0]); - SetBoxMonData(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot2, &movePPUps[0]); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1 + moveSlot1, &moveIDs[1]); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot1, &movePPs[1]); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot1, &movePPUps[1]); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1 + moveSlot2, &moveIDs[0]); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1_CUR_PP + moveSlot2, &movePPs[0]); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1_PP_UPS + moveSlot2, &movePPUps[0]); } -void DeleteMonMove (Pokemon *mon, u32 moveSlot) +void Pokemon_ClearMoveSlot(Pokemon *mon, u32 moveSlot) { u16 moveID; u8 movePP; u8 movePPUps; for (u32 i = moveSlot; i < 3; i++) { - moveID = GetMonData(mon, MON_DATA_MOVE1 + i + 1, NULL); - movePP = GetMonData(mon, MON_DATA_MOVE1_CUR_PP + i + 1, NULL); - movePPUps = GetMonData(mon, MON_DATA_MOVE1_PP_UPS + i + 1, NULL); + moveID = Pokemon_GetValue(mon, MON_DATA_MOVE1 + i + 1, NULL); + movePP = Pokemon_GetValue(mon, MON_DATA_MOVE1_CUR_PP + i + 1, NULL); + movePPUps = Pokemon_GetValue(mon, MON_DATA_MOVE1_PP_UPS + i + 1, NULL); - SetMonData(mon, MON_DATA_MOVE1 + i, &moveID); - SetMonData(mon, MON_DATA_MOVE1_CUR_PP + i, &movePP); - SetMonData(mon, MON_DATA_MOVE1_PP_UPS + i, &movePPUps); + Pokemon_SetValue(mon, MON_DATA_MOVE1 + i, &moveID); + Pokemon_SetValue(mon, MON_DATA_MOVE1_CUR_PP + i, &movePP); + Pokemon_SetValue(mon, MON_DATA_MOVE1_PP_UPS + i, &movePPUps); } moveID = 0; movePP = 0; movePPUps = 0; - SetMonData(mon, MON_DATA_MOVE4, &moveID); - SetMonData(mon, MON_DATA_MOVE4_CUR_PP, &movePP); - SetMonData(mon, MON_DATA_MOVE4_PP_UPS, &movePPUps); + Pokemon_SetValue(mon, MON_DATA_MOVE4, &moveID); + Pokemon_SetValue(mon, MON_DATA_MOVE4_CUR_PP, &movePP); + Pokemon_SetValue(mon, MON_DATA_MOVE4_PP_UPS, &movePPUps); } -static BOOL MonHasMove (Pokemon *mon, u16 moveID) +static BOOL Pokemon_HasMove(Pokemon *mon, u16 moveID) { int i; for (i = 0; i < 4; i++) { - if (GetMonData(mon, MON_DATA_MOVE1 + i, NULL) == moveID) { + if (Pokemon_GetValue(mon, MON_DATA_MOVE1 + i, NULL) == moveID) { break; } } @@ -3514,7 +3516,7 @@ static BOOL MonHasMove (Pokemon *mon, u16 moveID) return i != 4; } -void sub_020774C8 (BoxPokemon *boxMon, Pokemon *mon) +void Pokemon_FromBoxPokemon(BoxPokemon *boxMon, Pokemon *mon) { u32 zero = 0; @@ -3523,24 +3525,24 @@ void sub_020774C8 (BoxPokemon *boxMon, Pokemon *mon) mon->box.partyDecrypted = TRUE; } - SetMonData(mon, MON_DATA_160, &zero); - SetMonData(mon, MON_DATA_CURRENT_HP, &zero); - SetMonData(mon, MON_DATA_MAX_HP, &zero); + Pokemon_SetValue(mon, MON_DATA_160, &zero); + Pokemon_SetValue(mon, MON_DATA_CURRENT_HP, &zero); + Pokemon_SetValue(mon, MON_DATA_MAX_HP, &zero); UnkStruct_0202818C *v1 = sub_0202818C(0); - SetMonData(mon, MON_DATA_170, v1); + Pokemon_SetValue(mon, MON_DATA_170, v1); Heap_FreeToHeap(v1); - SetMonData(mon, MON_DATA_162, &zero); + Pokemon_SetValue(mon, MON_DATA_162, &zero); UnkStruct_0202CA28 v2; MI_CpuClearFast(&v2, sizeof(UnkStruct_0202CA28)); - SetMonData(mon, MON_DATA_171, &v2); + Pokemon_SetValue(mon, MON_DATA_171, &v2); - CalculateMonLevelAndStats(mon); + Pokemon_CalcLevelAndStats(mon); } -u8 GetPartyHighestLevel (Party *party) +u8 Party_GetMaxLevel(Party *party) { int currentPartyCount = Party_GetCurrentCount(party); @@ -3549,8 +3551,8 @@ u8 GetPartyHighestLevel (Party *party) for (int i = 0; i < currentPartyCount; i++) { Pokemon *mon = Party_GetPokemonBySlotIndex(party, i); - if (GetMonData(mon, MON_DATA_SPECIES, NULL) && GetMonData(mon, MON_DATA_IS_EGG, NULL) == 0) { - u8 monLevel = GetMonData(mon, MON_DATA_LEVEL, NULL); + if (Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL) && Pokemon_GetValue(mon, MON_DATA_IS_EGG, NULL) == 0) { + u8 monLevel = Pokemon_GetValue(mon, MON_DATA_LEVEL, NULL); if (monLevel > result) { result = monLevel; @@ -3561,7 +3563,7 @@ u8 GetPartyHighestLevel (Party *party) return result; } -u16 sub_020775A4 (u16 param0) +u16 sub_020775A4(u16 param0) { u16 result; @@ -3570,7 +3572,7 @@ u16 sub_020775A4 (u16 param0) return result; } -u16 sub_020775C4 (u16 param0) +u16 sub_020775C4(u16 param0) { u16 result = 0; @@ -3582,48 +3584,48 @@ u16 sub_020775C4 (u16 param0) return result; } -void sub_020775EC (Pokemon *src, Pokemon *dest) +void Pokemon_Copy(Pokemon *src, Pokemon *dest) { *dest = *src; return; } -void sub_02077604 (BoxPokemon *src, BoxPokemon *dest) +void BoxPokemon_Copy(BoxPokemon *src, BoxPokemon *dest) { *dest = *src; return; } -void sub_02077618 (Pokemon *src, BoxPokemon *dest) +void BoxPokemon_FromPokemon(Pokemon *src, BoxPokemon *dest) { *dest = src->box; return; } // TODO enums -s8 GetMonFlavorAffinity (Pokemon *mon, int flavor) +s8 Pokemon_GetFlavorAffinity(Pokemon *mon, int flavor) { - return GetBoxMonFlavorAffinity(&mon->box, flavor); + return BoxPokemon_GetFlavorAffinity(&mon->box, flavor); } // TODO enums -static s8 GetBoxMonFlavorAffinity (BoxPokemon *boxMon, int flavor) +static s8 BoxPokemon_GetFlavorAffinity(BoxPokemon *boxMon, int flavor) { - return GetMonPersonalityFlavorAffinity(GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL), flavor); + return Pokemon_GetFlavorAffinityOf(BoxPokemon_GetValue(boxMon, MON_DATA_PERSONALITY, NULL), flavor); } // TODO enums -s8 GetMonPersonalityFlavorAffinity (u32 monPersonality, int flavor) +s8 Pokemon_GetFlavorAffinityOf(u32 monPersonality, int flavor) { - u8 monNature = GetNatureFromPersonality(monPersonality); + u8 monNature = Pokemon_GetNatureOf(monPersonality); return sNatureFlavorAffinities[monNature][flavor]; } -int GetMonLevelUpMoveIDs (int monSpecies, int monForm, u16 *monLevelUpMoveIDs) +int Pokemon_LoadLevelUpMoveIdsOf(int monSpecies, int monForm, u16 *monLevelUpMoveIDs) { u16 *monLevelUpMoves = Heap_AllocFromHeap(0, 44); - LoadMonLevelUpMoves(monSpecies, monForm, monLevelUpMoves); + Pokemon_LoadLevelUpMovesOf(monSpecies, monForm, monLevelUpMoves); int result = 0; @@ -3637,7 +3639,7 @@ int GetMonLevelUpMoveIDs (int monSpecies, int monForm, u16 *monLevelUpMoveIDs) return result; } -void sub_020776B0 (Party *party) +void sub_020776B0(Party *party) { int currentPartyCount = Party_GetCurrentCount(party); u16 rand = LCRNG_Next(); @@ -3649,14 +3651,14 @@ void sub_020776B0 (Party *party) partySlot = LCRNG_Next() % currentPartyCount; mon = Party_GetPokemonBySlotIndex(party, partySlot); - if (GetMonData(mon, MON_DATA_SPECIES, NULL) && GetMonData(mon, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL) && Pokemon_GetValue(mon, MON_DATA_IS_EGG, NULL) == 0) { break; } else { partySlot = currentPartyCount; } } while (partySlot == currentPartyCount); - if (sub_02077758(party, GetSingleBitMask(partySlot)) == 0) { + if (sub_02077758(party, Pokemon_GetFlagMaskOf(partySlot)) == 0) { u8 monPokerus; do { monPokerus = LCRNG_Next() & 0xff; @@ -3670,12 +3672,12 @@ void sub_020776B0 (Party *party) monPokerus &= 0xf3; monPokerus++; - SetMonData(mon, MON_DATA_POKERUS, &monPokerus); + Pokemon_SetValue(mon, MON_DATA_POKERUS, &monPokerus); } } } -u8 sub_02077758 (Party *party, u8 param1) +u8 sub_02077758(Party *party, u8 param1) { int partySlot = 0; int v1 = 1; @@ -3686,7 +3688,7 @@ u8 sub_02077758 (Party *party, u8 param1) if (param1 & 1) { Pokemon *mon = Party_GetPokemonBySlotIndex(party, partySlot); - if (GetMonData(mon, MON_DATA_POKERUS, NULL)) { + if (Pokemon_GetValue(mon, MON_DATA_POKERUS, NULL)) { result |= v1; } } @@ -3698,7 +3700,7 @@ u8 sub_02077758 (Party *party, u8 param1) } else { Pokemon *mon = Party_GetPokemonBySlotIndex(party, partySlot); - if (GetMonData(mon, MON_DATA_POKERUS, NULL)) { + if (Pokemon_GetValue(mon, MON_DATA_POKERUS, NULL)) { result++; } } @@ -3706,15 +3708,15 @@ u8 sub_02077758 (Party *party, u8 param1) return result; } -void sub_020777B4 (Party *party, s32 param1) +void sub_020777B4(Party *party, s32 param1) { int currentPartyCount = Party_GetCurrentCount(party); for (int i = 0; i < currentPartyCount; i++) { Pokemon *mon = Party_GetPokemonBySlotIndex(party, i); - if (GetMonData(mon, MON_DATA_SPECIES, NULL)) { - u8 monPokerus = GetMonData(mon, MON_DATA_POKERUS, NULL); + if (Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL)) { + u8 monPokerus = Pokemon_GetValue(mon, MON_DATA_POKERUS, NULL); if (monPokerus & 0xf) { if (((monPokerus & 0xf) < param1) || (param1 > 4)) { @@ -3727,13 +3729,13 @@ void sub_020777B4 (Party *party, s32 param1) monPokerus = 0x10; } - SetMonData(mon, MON_DATA_POKERUS, &monPokerus); + Pokemon_SetValue(mon, MON_DATA_POKERUS, &monPokerus); } } } } -void sub_0207782C (Party *party) +void sub_0207782C(Party *party) { int currentPartyCount = Party_GetCurrentCount(party); @@ -3741,23 +3743,23 @@ void sub_0207782C (Party *party) for (int i = 0; i < currentPartyCount; i++) { Pokemon *mon = Party_GetPokemonBySlotIndex(party, i); - if (GetMonData(mon, MON_DATA_SPECIES, NULL)) { - u8 monPokerus = GetMonData(mon, MON_DATA_POKERUS, NULL); + if (Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL)) { + u8 monPokerus = Pokemon_GetValue(mon, MON_DATA_POKERUS, NULL); if (monPokerus & 0xf) { if (i != 0) { mon = Party_GetPokemonBySlotIndex(party, i - 1); - if ((GetMonData(mon, MON_DATA_POKERUS, NULL) & 0xf0) == 0) { - SetMonData(mon, MON_DATA_POKERUS, &monPokerus); + if ((Pokemon_GetValue(mon, MON_DATA_POKERUS, NULL) & 0xf0) == 0) { + Pokemon_SetValue(mon, MON_DATA_POKERUS, &monPokerus); } } if (i < currentPartyCount - 1) { mon = Party_GetPokemonBySlotIndex(party, i + 1); - if ((GetMonData(mon, MON_DATA_POKERUS, NULL) & 0xf0) == 0) { - SetMonData(mon, MON_DATA_POKERUS, &monPokerus); + if ((Pokemon_GetValue(mon, MON_DATA_POKERUS, NULL) & 0xf0) == 0) { + Pokemon_SetValue(mon, MON_DATA_POKERUS, &monPokerus); i++; } } @@ -3767,24 +3769,24 @@ void sub_0207782C (Party *party) } } -BOOL sub_020778D8 (Pokemon *mon) +BOOL sub_020778D8(Pokemon *mon) { return sub_020778E0(&mon->box); } -static BOOL sub_020778E0 (BoxPokemon *boxMon) +static BOOL sub_020778E0(BoxPokemon *boxMon) { - return (GetBoxMonData(boxMon, MON_DATA_POKERUS, NULL) & 0xf) != 0; + return (BoxPokemon_GetValue(boxMon, MON_DATA_POKERUS, NULL) & 0xf) != 0; } -BOOL sub_020778F8 (Pokemon *mon) +BOOL sub_020778F8(Pokemon *mon) { return sub_02077900(&mon->box); } -static BOOL sub_02077900 (BoxPokemon *boxMon) +static BOOL sub_02077900(BoxPokemon *boxMon) { - u8 monPokerus = GetBoxMonData(boxMon, MON_DATA_POKERUS, NULL); + u8 monPokerus = BoxPokemon_GetValue(boxMon, MON_DATA_POKERUS, NULL); if (monPokerus & 0xf) { return 0; @@ -3793,25 +3795,25 @@ static BOOL sub_02077900 (BoxPokemon *boxMon) return (monPokerus & 0xf0) != 0; } -void SetArceusForm (Pokemon *mon) +void Pokemon_SetArceusForm(Pokemon *mon) { - SetBoxArceusForm(&mon->box); + BoxPokemon_SetArceusForm(&mon->box); } -void SetBoxArceusForm (BoxPokemon *boxMon) +void BoxPokemon_SetArceusForm(BoxPokemon *boxMon) { - int monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); - int monAbility = GetBoxMonData(boxMon, MON_DATA_ABILITY, NULL); - int monHeldItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM, NULL); + int monSpecies = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, NULL); + int monAbility = BoxPokemon_GetValue(boxMon, MON_DATA_ABILITY, NULL); + int monHeldItem = BoxPokemon_GetValue(boxMon, MON_DATA_HELD_ITEM, NULL); // TODO enum values if (monSpecies == SPECIES_ARCEUS && monAbility == 121) { - int monForm = GetArceusItemType(Item_LoadParam(monHeldItem, 1, 0)); - SetBoxMonData(boxMon, MON_DATA_FORM, &monForm); + int monForm = Pokemon_GetArceusTypeOf(Item_LoadParam(monHeldItem, 1, 0)); + BoxPokemon_SetValue(boxMon, MON_DATA_FORM, &monForm); } } -u8 GetArceusItemType (u16 itemHoldEffect) +u8 Pokemon_GetArceusTypeOf(u16 itemHoldEffect) { u8 type; @@ -3872,29 +3874,29 @@ u8 GetArceusItemType (u16 itemHoldEffect) return type; } -int SetGiratinaForm (Pokemon *mon) +int Pokemon_SetGiratinaForm(Pokemon *mon) { - int result = SetBoxGiratinaForm(&mon->box); + int result = BoxPokemon_SetGiratinaForm(&mon->box); // TODO enum value? if (result != -1) { - CalculateMonLevelAndStats(mon); + Pokemon_CalcLevelAndStats(mon); } return result; } -int SetBoxGiratinaForm (BoxPokemon *boxMon) +int BoxPokemon_SetGiratinaForm(BoxPokemon *boxMon) { - int monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); - int monHeldItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM, NULL); + int monSpecies = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, NULL); + int monHeldItem = BoxPokemon_GetValue(boxMon, MON_DATA_HELD_ITEM, NULL); // TODO enum? if (monSpecies == SPECIES_GIRATINA) { int monForm = (monHeldItem == ITEM_GRISEOUS_ORB) ? 1 : 0; - SetBoxMonData(boxMon, MON_DATA_FORM, &monForm); - CalculateBoxMonAbility(boxMon); + BoxPokemon_SetValue(boxMon, MON_DATA_FORM, &monForm); + BoxPokemon_CalcAbility(boxMon); return monForm; } @@ -3902,19 +3904,19 @@ int SetBoxGiratinaForm (BoxPokemon *boxMon) return -1; } -void SetGiratinaOriginForm (Pokemon *mon) +void Pokemon_SetGiratinaOriginForm(Pokemon *mon) { // TODO enum? int monForm = 1; - if (GetMonData(mon, MON_DATA_SPECIES, NULL) == SPECIES_GIRATINA) { - SetBoxMonData(&mon->box, MON_DATA_FORM, &monForm); - CalculateBoxMonAbility(&mon->box); - CalculateMonLevelAndStats(mon); + if (Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL) == SPECIES_GIRATINA) { + BoxPokemon_SetValue(&mon->box, MON_DATA_FORM, &monForm); + BoxPokemon_CalcAbility(&mon->box); + Pokemon_CalcLevelAndStats(mon); } } -void SetPartyGiratinaForm (Party *party, int param1) +void Party_SetGiratinaForm(Party *party, int param1) { int currentPartyCount = Party_GetCurrentCount(party); @@ -3922,39 +3924,39 @@ void SetPartyGiratinaForm (Party *party, int param1) Pokemon *mon = Party_GetPokemonBySlotIndex(party, i); if (param1) { - SetGiratinaOriginForm(mon); + Pokemon_SetGiratinaOriginForm(mon); } else { - SetGiratinaForm(mon); + Pokemon_SetGiratinaForm(mon); } } } -void SetShayminForm (Pokemon *mon, int monForm) +void Pokemon_SetShayminForm(Pokemon *mon, int monForm) { - SetBoxShayminForm(&mon->box, monForm); - CalculateMonLevelAndStats(mon); + BoxPokemon_SetShayminForm(&mon->box, monForm); + Pokemon_CalcLevelAndStats(mon); } -void SetBoxShayminForm (BoxPokemon *boxMon, int monForm) +void BoxPokemon_SetShayminForm(BoxPokemon *boxMon, int monForm) { - int monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); + int monSpecies = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, NULL); if (monSpecies == SPECIES_SHAYMIN) { // TODO enum? GF_ASSERT(monForm <= 1); - SetBoxMonData(boxMon, MON_DATA_FORM, &monForm); - CalculateBoxMonAbility(boxMon); + BoxPokemon_SetValue(boxMon, MON_DATA_FORM, &monForm); + BoxPokemon_CalcAbility(boxMon); } } -BOOL CanShayminSkyForm (Pokemon *mon) +BOOL Pokemon_CanShayminSkyForm(Pokemon *mon) { - u32 monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); - u32 monForm = GetMonData(mon, MON_DATA_FORM, NULL); - u32 v2 = GetMonData(mon, MON_DATA_160, NULL); - u32 monCurrentHP = GetMonData(mon, MON_DATA_CURRENT_HP, NULL); - u32 monFatefulEncounter = GetMonData(mon, MON_DATA_FATEFUL_ENCOUNTER, NULL); + u32 monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + u32 monForm = Pokemon_GetValue(mon, MON_DATA_FORM, NULL); + u32 v2 = Pokemon_GetValue(mon, MON_DATA_160, NULL); + u32 monCurrentHP = Pokemon_GetValue(mon, MON_DATA_CURRENT_HP, NULL); + u32 monFatefulEncounter = Pokemon_GetValue(mon, MON_DATA_FATEFUL_ENCOUNTER, NULL); RTCTime rtcTime; sub_02013880(&rtcTime); @@ -3968,24 +3970,24 @@ BOOL CanShayminSkyForm (Pokemon *mon) && rtcTime.hour < 20); } -void SetShayminLandForm (Party *party) +void Party_SetShayminLandForm(Party *party) { int currentPartyCount = Party_GetCurrentCount(party); for (int i = 0; i < currentPartyCount; i++) { Pokemon *mon = Party_GetPokemonBySlotIndex(party, i); - int monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); - int monForm = GetMonData(mon, MON_DATA_FORM, NULL); + int monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + int monForm = Pokemon_GetValue(mon, MON_DATA_FORM, NULL); if (monSpecies == SPECIES_SHAYMIN && monForm == 1) { // TODO enum? int zero = 0; - SetShayminForm(mon, zero); + Pokemon_SetShayminForm(mon, zero); } } } -BOOL SetPartyShayminForm (Party *party, int param1, const RTCTime *rtcTime) +BOOL Party_SetShayminForm(Party *party, int param1, const RTCTime *rtcTime) { if (rtcTime->hour >= 20 || rtcTime->hour < 4) { s32 hours = rtcTime->hour; @@ -4000,7 +4002,7 @@ BOOL SetPartyShayminForm (Party *party, int param1, const RTCTime *rtcTime) param1++; if (minutes < param1) { - SetShayminLandForm(party); + Party_SetShayminLandForm(party); return TRUE; } @@ -4009,7 +4011,7 @@ BOOL SetPartyShayminForm (Party *party, int param1, const RTCTime *rtcTime) s32 minutes = rtcTime->minute + (rtcTime->hour - 4) * 60; if (minutes < param1) { - SetShayminLandForm(party); + Party_SetShayminLandForm(party); return TRUE; } @@ -4017,15 +4019,15 @@ BOOL SetPartyShayminForm (Party *party, int param1, const RTCTime *rtcTime) } } -BOOL SetRotomForm (Pokemon *mon, int monForm, int moveSlot) +BOOL Pokemon_SetRotomForm(Pokemon *mon, int monForm, int moveSlot) { - int monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); + int monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); if (monSpecies != SPECIES_ROTOM) { return FALSE; } - int currentMonForm = GetMonData(mon, MON_DATA_FORM, NULL); + int currentMonForm = Pokemon_GetValue(mon, MON_DATA_FORM, NULL); static const u16 rotomFormMoves[] = { MOVE_NONE, @@ -4041,16 +4043,16 @@ BOOL SetRotomForm (Pokemon *mon, int monForm, int moveSlot) int i; for (i = 0; i < 4; i++) { int j; - int moveID = GetMonData(mon, MON_DATA_MOVE1 + i, NULL); + int moveID = Pokemon_GetValue(mon, MON_DATA_MOVE1 + i, NULL); for (j = 1; j < NELEMS(rotomFormMoves); j++) { if (moveID != MOVE_NONE && moveID == rotomFormMoves[j]) { if (newFormMoveID != MOVE_NONE) { - ResetMonMove(mon, newFormMoveID, i); + Pokemon_ResetMoveSlot(mon, newFormMoveID, i); newFormMoveID = MOVE_NONE; break; } else { - DeleteMonMove(mon, i); + Pokemon_ClearMoveSlot(mon, i); i--; break; } @@ -4060,24 +4062,24 @@ BOOL SetRotomForm (Pokemon *mon, int monForm, int moveSlot) if (newFormMoveID != MOVE_NONE) { for (i = 0; i < 4; i++) { - if (GetMonData(mon, MON_DATA_MOVE1 + i, NULL) == MOVE_NONE) { - ResetMonMove(mon, newFormMoveID, i); + if (Pokemon_GetValue(mon, MON_DATA_MOVE1 + i, NULL) == MOVE_NONE) { + Pokemon_ResetMoveSlot(mon, newFormMoveID, i); break; } } if (i == 4) { - ResetMonMove(mon, newFormMoveID, moveSlot); + Pokemon_ResetMoveSlot(mon, newFormMoveID, moveSlot); } } - if (GetMonData(mon, MON_DATA_MOVE1, NULL) == MOVE_NONE) { - ResetMonMove(mon, MOVE_THUNDER_SHOCK, 0); + if (Pokemon_GetValue(mon, MON_DATA_MOVE1, NULL) == MOVE_NONE) { + Pokemon_ResetMoveSlot(mon, MOVE_THUNDER_SHOCK, 0); } - SetMonData(mon, MON_DATA_FORM, &monForm); - CalculateMonAbility(mon); - CalculateMonLevelAndStats(mon); + Pokemon_SetValue(mon, MON_DATA_FORM, &monForm); + Pokemon_CalcAbility(mon); + Pokemon_CalcLevelAndStats(mon); return TRUE; } @@ -4090,13 +4092,13 @@ BOOL SetRotomForm (Pokemon *mon, int monForm, int moveSlot) but then we'd be polluting namespace for the sake of two .c files. Could define in each .c file, but then there's risk of these becoming desynced (This is the worse option imo). */ -void LoadMonLevelUpMoves (int monSpecies, int monForm, u16 *monLevelUpMoves) +void Pokemon_LoadLevelUpMovesOf(int monSpecies, int monForm, u16 *monLevelUpMoves) { - monSpecies = GetMonFormNarcIndex(monSpecies, monForm); + monSpecies = Pokemon_GetFormNarcIndex(monSpecies, monForm); NARC_ReadWholeMemberByIndexPair(monLevelUpMoves, NARC_INDEX_POKETOOL__PERSONAL__WOTBL, monSpecies); } -void sub_02077D3C (UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7) +void sub_02077D3C(UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7) { if (monSpecies == SPECIES_CHATOT) { if (sub_020064C8(param1) == 0) { @@ -4114,7 +4116,7 @@ void sub_02077D3C (UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int p } } -void sub_02077DB4 (UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7, u8 param8) +void sub_02077DB4(UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int param3, int param4, int param5, int param6, int param7, u8 param8) { if (monSpecies == SPECIES_CHATOT) { if (sub_020064C8(param1) == 0) { @@ -4132,41 +4134,41 @@ void sub_02077DB4 (UnkStruct_0202CC84 *param0, int param1, u16 monSpecies, int p } } -BOOL sub_02077E3C (Pokemon *mon) +BOOL sub_02077E3C(Pokemon *mon) { - int monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); - int monForm = GetMonData(mon, MON_DATA_FORM, NULL); + int monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + int monForm = Pokemon_GetValue(mon, MON_DATA_FORM, NULL); return sub_02005844(monSpecies, monForm); } -void sub_02077E64 (Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) +void sub_02077E64(Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) { sub_02077EA4(&mon->box, param1, monPokeball, param3, param4, param5); if (monPokeball == ITEM_HEAL_BALL) { - int monMaxHP = GetMonData(mon, MON_DATA_MAX_HP, NULL); - SetMonData(mon, MON_DATA_CURRENT_HP, &monMaxHP); + int monMaxHP = Pokemon_GetValue(mon, MON_DATA_MAX_HP, NULL); + Pokemon_SetValue(mon, MON_DATA_CURRENT_HP, &monMaxHP); monMaxHP = 0; - SetMonData(mon, MON_DATA_160, &monMaxHP); + Pokemon_SetValue(mon, MON_DATA_160, &monMaxHP); } } -static void sub_02077EA4 (BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) +static void sub_02077EA4(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) { sub_0209305C(boxMon, param1, 0, param3, param5); - SetBoxMonData(boxMon, MON_DATA_MET_GAME, &Unk_020E4C40); - SetBoxMonData(boxMon, MON_DATA_POKEBALL, &monPokeball); - SetBoxMonData(boxMon, MON_DATA_158, ¶m4); + BoxPokemon_SetValue(boxMon, MON_DATA_MET_GAME, &Unk_020E4C40); + BoxPokemon_SetValue(boxMon, MON_DATA_POKEBALL, &monPokeball); + BoxPokemon_SetValue(boxMon, MON_DATA_158, ¶m4); } -void sub_02077EE4 (Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) +void sub_02077EE4(Pokemon *mon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) { sub_02077EF8(&mon->box, param1, monPokeball, param3, param4, param5); } -static void sub_02077EF8 (BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) +static void sub_02077EF8(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int monPokeball, int param3, int param4, int param5) { sub_02077EA4(boxMon, param1, monPokeball, param3, param4, param5); } @@ -4176,46 +4178,46 @@ static const u16 sHeldItemChance[][2] = { {20, 80} }; -void sub_02077F0C (Pokemon *mon, u32 param1, int param2) +void sub_02077F0C(Pokemon *mon, u32 param1, int param2) { if (param1 & (0x1 | 0x80)) { return; } u32 rand = LCRNG_Next() % 100; - u16 monSpecies = GetMonData(mon, MON_DATA_SPECIES, NULL); - u16 monForm = GetMonData(mon, MON_DATA_FORM, NULL); - u16 monItem1 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ITEM1); - u16 monItem2 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ITEM2); + u16 monSpecies = Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); + u16 monForm = Pokemon_GetValue(mon, MON_DATA_FORM, NULL); + u16 monItem1 = PokemonPersonalData_GetFormValue(monSpecies, monForm, MON_DATA_PERSONAL_ITEM1); + u16 monItem2 = PokemonPersonalData_GetFormValue(monSpecies, monForm, MON_DATA_PERSONAL_ITEM2); if (monItem1 == monItem2 && monItem1 != 0) { - SetMonData(mon, MON_DATA_HELD_ITEM, &monItem1); + Pokemon_SetValue(mon, MON_DATA_HELD_ITEM, &monItem1); return; } if (rand < sHeldItemChance[param2][0]) { return; } else if (rand < sHeldItemChance[param2][1]) { - SetMonData(mon, MON_DATA_HELD_ITEM, &monItem1); + Pokemon_SetValue(mon, MON_DATA_HELD_ITEM, &monItem1); } else { - SetMonData(mon, MON_DATA_HELD_ITEM, &monItem2); + Pokemon_SetValue(mon, MON_DATA_HELD_ITEM, &monItem2); } } -BOOL CanMonLearnTM (Pokemon *mon, u8 tmID) +BOOL Pokemon_CanLearnTM(Pokemon *mon, u8 tmID) { - return CanBoxMonLearnTM(&mon->box, tmID); + return BoxPokemon_CanLearnTM(&mon->box, tmID); } -static BOOL CanBoxMonLearnTM (BoxPokemon *boxMon, u8 tmID) +static BOOL BoxPokemon_CanLearnTM(BoxPokemon *boxMon, u8 tmID) { - u16 monSpeciesEgg = GetBoxMonData(boxMon, MON_DATA_SPECIES_EGG, NULL); - int monForm = GetBoxMonData(boxMon, MON_DATA_FORM, NULL); + u16 monSpeciesEgg = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES_EGG, NULL); + int monForm = BoxPokemon_GetValue(boxMon, MON_DATA_FORM, NULL); - return CanMonSpeciesLearnTM(monSpeciesEgg, monForm, tmID); + return Pokemon_CanFormLearnTM(monSpeciesEgg, monForm, tmID); } -BOOL CanMonSpeciesLearnTM (u16 monSpecies, int monForm, u8 tmID) +BOOL Pokemon_CanFormLearnTM(u16 monSpecies, int monForm, u8 tmID) { if (monSpecies == SPECIES_EGG) { return FALSE; @@ -4237,55 +4239,55 @@ BOOL CanMonSpeciesLearnTM (u16 monSpecies, int monForm, u8 tmID) monPersonalDataAttribute = MON_DATA_PERSONAL_TM_LEARNSET_MASK_4; } - return (GetMonFormPersonalDataAttribute(monSpecies, monForm, monPersonalDataAttribute) & tmFlag) != 0; + return (PokemonPersonalData_GetFormValue(monSpecies, monForm, monPersonalDataAttribute) & tmFlag) != 0; } -void CalculateMonAbility (Pokemon *mon) +void Pokemon_CalcAbility(Pokemon *mon) { - CalculateBoxMonAbility(&mon->box); + BoxPokemon_CalcAbility(&mon->box); } -static void CalculateBoxMonAbility (BoxPokemon *boxMon) +static void BoxPokemon_CalcAbility(BoxPokemon *boxMon) { - BOOL reencrypt = DecryptBoxMon(boxMon); - int monSpecies = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL); - u32 monPersonality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL); - int monForm = GetBoxMonData(boxMon, MON_DATA_FORM, NULL); - int monAbility1 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ABILITY_1); - int monAbility2 = GetMonFormPersonalDataAttribute(monSpecies, monForm, MON_DATA_PERSONAL_ABILITY_2); + BOOL reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); + int monSpecies = BoxPokemon_GetValue(boxMon, MON_DATA_SPECIES, NULL); + u32 monPersonality = BoxPokemon_GetValue(boxMon, MON_DATA_PERSONALITY, NULL); + int monForm = BoxPokemon_GetValue(boxMon, MON_DATA_FORM, NULL); + int monAbility1 = PokemonPersonalData_GetFormValue(monSpecies, monForm, MON_DATA_PERSONAL_ABILITY_1); + int monAbility2 = PokemonPersonalData_GetFormValue(monSpecies, monForm, MON_DATA_PERSONAL_ABILITY_2); // TODO enum value? if (monAbility2 != 0) { if (monPersonality & 1) { - SetBoxMonData(boxMon, MON_DATA_ABILITY, &monAbility2); + BoxPokemon_SetValue(boxMon, MON_DATA_ABILITY, &monAbility2); } else { - SetBoxMonData(boxMon, MON_DATA_ABILITY, &monAbility1); + BoxPokemon_SetValue(boxMon, MON_DATA_ABILITY, &monAbility1); } } else { - SetBoxMonData(boxMon, MON_DATA_ABILITY, &monAbility1); + BoxPokemon_SetValue(boxMon, MON_DATA_ABILITY, &monAbility1); } - EncryptBoxMon(boxMon, reencrypt); + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); } -void sub_020780C4 (Pokemon *mon, u32 monPersonality) +void sub_020780C4(Pokemon *mon, u32 monPersonality) { - Pokemon *newMon = AllocMonZeroed(0); + Pokemon *newMon = Pokemon_New(0); - sub_020775EC(mon, newMon); + Pokemon_Copy(mon, newMon); - PokemonDataBlockA *newMonBlockA = GetBoxMonDataBlock(&newMon->box, mon->box.personality, DATA_BLOCK_A); - PokemonDataBlockB *newMonBlockB = GetBoxMonDataBlock(&newMon->box, mon->box.personality, DATA_BLOCK_B); - PokemonDataBlockC *newMonBlockC = GetBoxMonDataBlock(&newMon->box, mon->box.personality, DATA_BLOCK_C); - PokemonDataBlockD *newMonBlockD = GetBoxMonDataBlock(&newMon->box, mon->box.personality, DATA_BLOCK_D); - PokemonDataBlockA *monBlockA = GetBoxMonDataBlock(&mon->box, monPersonality, DATA_BLOCK_A); - PokemonDataBlockB *monBlockB = GetBoxMonDataBlock(&mon->box, monPersonality, DATA_BLOCK_B); - PokemonDataBlockC *monBlockC = GetBoxMonDataBlock(&mon->box, monPersonality, DATA_BLOCK_C); - PokemonDataBlockD *monBlockD = GetBoxMonDataBlock(&mon->box, monPersonality, DATA_BLOCK_D); + PokemonDataBlockA *newMonBlockA = BoxPokemon_GetDataBlock(&newMon->box, mon->box.personality, DATA_BLOCK_A); + PokemonDataBlockB *newMonBlockB = BoxPokemon_GetDataBlock(&newMon->box, mon->box.personality, DATA_BLOCK_B); + PokemonDataBlockC *newMonBlockC = BoxPokemon_GetDataBlock(&newMon->box, mon->box.personality, DATA_BLOCK_C); + PokemonDataBlockD *newMonBlockD = BoxPokemon_GetDataBlock(&newMon->box, mon->box.personality, DATA_BLOCK_D); + PokemonDataBlockA *monBlockA = BoxPokemon_GetDataBlock(&mon->box, monPersonality, DATA_BLOCK_A); + PokemonDataBlockB *monBlockB = BoxPokemon_GetDataBlock(&mon->box, monPersonality, DATA_BLOCK_B); + PokemonDataBlockC *monBlockC = BoxPokemon_GetDataBlock(&mon->box, monPersonality, DATA_BLOCK_C); + PokemonDataBlockD *monBlockD = BoxPokemon_GetDataBlock(&mon->box, monPersonality, DATA_BLOCK_D); - DecryptMonData(&newMon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, newMon->box.checksum); - DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + Pokemon_DecryptData(&newMon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, newMon->box.checksum); + Pokemon_DecryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_DecryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); mon->box.personality = monPersonality; @@ -4294,40 +4296,40 @@ void sub_020780C4 (Pokemon *mon, u32 monPersonality) *monBlockC = *newMonBlockC; *monBlockD = *newMonBlockD; - mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + mon->box.checksum = Pokemon_GetDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); - EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); - EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_EncryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); Heap_FreeToHeap(newMon); } -static void LoadMonPersonalData (int monSpecies, PokemonPersonalData *monPersonalData) +static void PokemonPersonalData_LoadSpecies(int monSpecies, PokemonPersonalData *monPersonalData) { NARC_ReadWholeMemberByIndexPair(monPersonalData, NARC_INDEX_POKETOOL__PERSONAL__PL_PERSONAL, monSpecies); } -static void LoadMonFormPersonalData (int monSpecies, int monForm, PokemonPersonalData *monPersonalData) +static void PokemonPersonalData_LoadForm(int monSpecies, int monForm, PokemonPersonalData *monPersonalData) { - monSpecies = GetMonFormNarcIndex(monSpecies, monForm); + monSpecies = Pokemon_GetFormNarcIndex(monSpecies, monForm); NARC_ReadWholeMemberByIndexPair(monPersonalData, NARC_INDEX_POKETOOL__PERSONAL__PL_PERSONAL, monSpecies); } -static void LoadMonEvolutionData (int monSpecies, PokemonEvolutionData *monEvolutionData) +static void PokemonEvolutionData_LoadSpecies(int monSpecies, PokemonEvolutionData *monEvolutionData) { NARC_ReadWholeMemberByIndexPair(monEvolutionData, NARC_INDEX_POKETOOL__PERSONAL__EVO, monSpecies); } -static void EncryptMonData (void *data, u32 bytes, u32 seed) +static void Pokemon_EncryptData(void *data, u32 bytes, u32 seed) { EncryptData(data, bytes, seed); } -static void DecryptMonData (void *data, u32 bytes, u32 seed) +static void Pokemon_DecryptData(void *data, u32 bytes, u32 seed) { DecryptData(data, bytes, seed); } -static u16 GetMonDataChecksum (void *data, u32 bytes) +static u16 Pokemon_GetDataChecksum(void *data, u32 bytes) { int i; u16 checksum = 0; @@ -4362,7 +4364,7 @@ static u16 GetMonDataChecksum (void *data, u32 bytes) break; \ } -static void *GetBoxMonDataBlock (BoxPokemon *boxMon, u32 personality, enum PokemonDataBlockID dataBlockID) +static void *BoxPokemon_GetDataBlock(BoxPokemon *boxMon, u32 personality, enum PokemonDataBlockID dataBlockID) { personality = (personality & 0x3e000) >> 13; GF_ASSERT(personality <= 31); @@ -4430,7 +4432,7 @@ static void *GetBoxMonDataBlock (BoxPokemon *boxMon, u32 personality, enum Pokem return result; } -static int GetMonFormNarcIndex (int monSpecies, int monForm) +static int Pokemon_GetFormNarcIndex(int monSpecies, int monForm) { // TODO enum values? switch (monSpecies) { @@ -4466,7 +4468,7 @@ static int GetMonFormNarcIndex (int monSpecies, int monForm) return monSpecies; } -u32 GetSingleBitMask (int index) +u32 Pokemon_GetFlagMaskOf(int index) { int i; u32 bitMask = 1; @@ -4480,7 +4482,7 @@ u32 GetSingleBitMask (int index) return bitMask; } -int GetLowestSetBitIndex (u32 num) +int Pokemon_GetLowestFlagIndex(u32 num) { int i; u32 bit = 1; @@ -4517,7 +4519,7 @@ static const u16 Unk_020F05BE[18] = { 0x1ED }; -BOOL sub_02078804 (u16 param0) +BOOL sub_02078804(u16 param0) { for (u32 i = 0; i < NELEMS(Unk_020F05BE); i++) { if (param0 == Unk_020F05BE[i]) { @@ -4528,7 +4530,7 @@ BOOL sub_02078804 (u16 param0) return 0; } -u16 sub_02078824 (u8 index) +u16 sub_02078824(u8 index) { if (index >= NELEMS(Unk_020F05BE)) { index = 0; @@ -4537,24 +4539,24 @@ u16 sub_02078824 (u8 index) return Unk_020F05BE[index]; } -BOOL sub_02078838 (Pokemon *mon) +BOOL sub_02078838(Pokemon *mon) { - u16 monSpecies = (u16)GetMonData(mon, MON_DATA_SPECIES, NULL); + u16 monSpecies = (u16)Pokemon_GetValue(mon, MON_DATA_SPECIES, NULL); return sub_02078804(monSpecies); } -BOOL sub_0207884C (BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int heapID) +BOOL sub_0207884C(BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int heapID) { u32 v0 = sub_02025F20(param1); - u32 monOTID = GetBoxMonData(boxMon, MON_DATA_OT_ID, NULL); + u32 monOTID = BoxPokemon_GetValue(boxMon, MON_DATA_OT_ID, NULL); u32 v2 = sub_02025F30(param1); - u32 monOtGender = GetBoxMonData(boxMon, MON_DATA_OT_GENDER, NULL); + u32 monOtGender = BoxPokemon_GetValue(boxMon, MON_DATA_OT_GENDER, NULL); Strbuf *v4 = sub_02025F04(param1, heapID); // TODO enum/const value? Strbuf *v5 = Strbuf_Init(8, heapID); BOOL v6 = FALSE; - GetBoxMonData(boxMon, MON_DATA_145, v5); + BoxPokemon_GetValue(boxMon, MON_DATA_145, v5); if (v0 == monOTID && v2 == monOtGender && Strbuf_Compare(v4, v5) == 0) { v6 = TRUE; @@ -4566,7 +4568,7 @@ BOOL sub_0207884C (BoxPokemon *boxMon, UnkStruct_02025E6C *param1, int heapID) return v6; } -int sub_020788D0 (int param0) +int sub_020788D0(int param0) { // TODO enum values? switch (param0) { @@ -4599,48 +4601,48 @@ int sub_020788D0 (int param0) return param0; } -void sub_0207893C (Pokemon *mon) +void sub_0207893C(Pokemon *mon) { u8 zero = 0; UnkStruct_0202CA28 v1; MI_CpuClearFast(&v1, sizeof(UnkStruct_0202CA28)); - SetMonData(mon, MON_DATA_162, &zero); - SetMonData(mon, MON_DATA_171, &v1); + Pokemon_SetValue(mon, MON_DATA_162, &zero); + Pokemon_SetValue(mon, MON_DATA_171, &v1); } -void sub_0207896C (BoxPokemon *boxMon) +void sub_0207896C(BoxPokemon *boxMon) { - BOOL reencrypt = DecryptBoxMon(boxMon); + BOOL reencrypt = BoxPokemon_EnterDecryptionContext(boxMon); for (int i = 0; i < 4; i++) { - if (GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, NULL)) { - u8 moveMaxPP = GetBoxMonData(boxMon, MON_DATA_MOVE1_MAX_PP + i, NULL); + if (BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1 + i, NULL)) { + u8 moveMaxPP = BoxPokemon_GetValue(boxMon, MON_DATA_MOVE1_MAX_PP + i, NULL); - SetBoxMonData(boxMon, MON_DATA_MOVE1_CUR_PP + i, &moveMaxPP); + BoxPokemon_SetValue(boxMon, MON_DATA_MOVE1_CUR_PP + i, &moveMaxPP); } } - EncryptBoxMon(boxMon, reencrypt); + BoxPokemon_ExitDecryptionContext(boxMon, reencrypt); } -static inline int GetLowestBitInverse (int num) +static inline int Pokemon_GetLowestBitInverse(int num) { int result = (num & 0x1) ? 0 : 1; return result; } -void sub_020789BC (NARC *narc, UnkStruct_02007C10 *param1, u16 param2, u16 param3) +void sub_020789BC(NARC *narc, UnkStruct_02007C10 *param1, u16 param2, u16 param3) { - int v1 = GetLowestBitInverse(param3); + int v1 = Pokemon_GetLowestBitInverse(param3); UnkStruct_020789BC v0; NARC_ReadFromMember(narc, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); MI_CpuCopy8(&v0.unk_00[v1].unk_03[0], param1, sizeof(UnkStruct_02007C10) * 10); } -void sub_020789F4 (NARC *narc, UnkStruct_02015F84 *param1, UnkStruct_02007C7C *param2, u16 param3, int param4, int param5, int param6) +void sub_020789F4(NARC *narc, UnkStruct_02015F84 *param1, UnkStruct_02007C7C *param2, u16 param3, int param4, int param5, int param6) { int v3 = (param4 == 2) ? 0 : 1; @@ -4655,9 +4657,9 @@ void sub_020789F4 (NARC *narc, UnkStruct_02015F84 *param1, UnkStruct_02007C7C *p sub_02015FCC(param1, param2, &v0, param6); } -void sub_02078A4C (NARC *narc, u8 *param1, u16 param2, u16 param3) +void sub_02078A4C(NARC *narc, u8 *param1, u16 param2, u16 param3) { - int v1 = GetLowestBitInverse(param3); + int v1 = Pokemon_GetLowestBitInverse(param3); UnkStruct_020789BC v0; NARC_ReadFromMember(narc, 0, param2 * sizeof(UnkStruct_020789BC), sizeof(UnkStruct_020789BC), &v0); @@ -4665,7 +4667,7 @@ void sub_02078A4C (NARC *narc, u8 *param1, u16 param2, u16 param3) *param1 = v0.unk_00[v1].unk_00; } -void sub_02078A80 (NARC *narc, s8 *param1, u16 param2) +void sub_02078A80(NARC *narc, s8 *param1, u16 param2) { UnkStruct_020789BC v0; @@ -4673,7 +4675,7 @@ void sub_02078A80 (NARC *narc, s8 *param1, u16 param2) *param1 = v0.unk_56; } -void sub_02078AA4 (NARC *narc, s8 *param1, u16 param2) +void sub_02078AA4(NARC *narc, s8 *param1, u16 param2) { UnkStruct_020789BC v0; @@ -4681,7 +4683,7 @@ void sub_02078AA4 (NARC *narc, s8 *param1, u16 param2) *param1 = v0.unk_57; } -void sub_02078AC8 (NARC *narc, u8 *param1, u16 param2) +void sub_02078AC8(NARC *narc, u8 *param1, u16 param2) { UnkStruct_020789BC v0; @@ -4689,7 +4691,7 @@ void sub_02078AC8 (NARC *narc, u8 *param1, u16 param2) *param1 = v0.unk_58; } -BOOL sub_02078AEC (int param0, Pokemon *mon, int heapID) +BOOL sub_02078AEC(int param0, Pokemon *mon, int heapID) { int v0 = param0; @@ -4703,26 +4705,26 @@ BOOL sub_02078AEC (int param0, Pokemon *mon, int heapID) UnkStruct_0202CA28 v2; NARC_ReadFromMember(narc, 0, v0 * sizeof(UnkStruct_0202CA28), sizeof(UnkStruct_0202CA28), &v2); - SetMonData(mon, MON_DATA_162, &one); - SetMonData(mon, MON_DATA_171, &v2); + Pokemon_SetValue(mon, MON_DATA_162, &one); + Pokemon_SetValue(mon, MON_DATA_171, &v2); NARC_dtor(narc); return TRUE; } -void sub_02078B40 (Pokemon *mon, UnkStruct_02078B40 *param1) +void sub_02078B40(Pokemon *mon, UnkStruct_02078B40 *param1) { if (mon->box.partyDecrypted == FALSE) { - DecryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - DecryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + Pokemon_DecryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_DecryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } - BoxPokemon *boxMon = GetBoxMon(mon); + BoxPokemon *boxMon = Pokemon_GetBoxPokemon(mon); - PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_A); - PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_B); - PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_C); - PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, boxMon->personality, DATA_BLOCK_D); + PokemonDataBlockA *monDataBlockA = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_A); + PokemonDataBlockB *monDataBlockB = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_B); + PokemonDataBlockC *monDataBlockC = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_C); + PokemonDataBlockD *monDataBlockD = BoxPokemon_GetDataBlock(boxMon, boxMon->personality, DATA_BLOCK_D); param1->personality = boxMon->personality; param1->partyDecrypted = FALSE; @@ -4783,21 +4785,21 @@ void sub_02078B40 (Pokemon *mon, UnkStruct_02078B40 *param1) param1->unk_6E = mon->party.unk_12; if (mon->box.partyDecrypted == FALSE) { - EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + Pokemon_EncryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } } -void sub_02078E0C (UnkStruct_02078B40 *param0, Pokemon *mon) +void sub_02078E0C(UnkStruct_02078B40 *param0, Pokemon *mon) { MI_CpuClearFast(mon, sizeof(Pokemon)); - BoxPokemon *boxMon = GetBoxMon(mon); + BoxPokemon *boxMon = Pokemon_GetBoxPokemon(mon); - PokemonDataBlockA *monDataBlockA = GetBoxMonDataBlock(boxMon, param0->personality, DATA_BLOCK_A); - PokemonDataBlockB *monDataBlockB = GetBoxMonDataBlock(boxMon, param0->personality, DATA_BLOCK_B); - PokemonDataBlockC *monDataBlockC = GetBoxMonDataBlock(boxMon, param0->personality, DATA_BLOCK_C); - PokemonDataBlockD *monDataBlockD = GetBoxMonDataBlock(boxMon, param0->personality, DATA_BLOCK_D); + PokemonDataBlockA *monDataBlockA = BoxPokemon_GetDataBlock(boxMon, param0->personality, DATA_BLOCK_A); + PokemonDataBlockB *monDataBlockB = BoxPokemon_GetDataBlock(boxMon, param0->personality, DATA_BLOCK_B); + PokemonDataBlockC *monDataBlockC = BoxPokemon_GetDataBlock(boxMon, param0->personality, DATA_BLOCK_C); + PokemonDataBlockD *monDataBlockD = BoxPokemon_GetDataBlock(boxMon, param0->personality, DATA_BLOCK_D); boxMon->personality = param0->personality; boxMon->partyDecrypted = FALSE; @@ -4858,7 +4860,7 @@ void sub_02078E0C (UnkStruct_02078B40 *param0, Pokemon *mon) mon->party.unk_10 = param0->unk_6C; mon->party.unk_12 = param0->unk_6E; - EncryptMonData(&mon->party, sizeof(PartyPokemon), mon->box.personality); - mon->box.checksum = GetMonDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); - EncryptMonData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); + Pokemon_EncryptData(&mon->party, sizeof(PartyPokemon), mon->box.personality); + mon->box.checksum = Pokemon_GetDataChecksum(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4); + Pokemon_EncryptData(&mon->box.dataBlocks, sizeof(PokemonDataBlock) * 4, mon->box.checksum); } diff --git a/src/roaming_pokemon.c b/src/roaming_pokemon.c index be9c357f94..bdf26d6c34 100644 --- a/src/roaming_pokemon.c +++ b/src/roaming_pokemon.c @@ -291,15 +291,15 @@ void RoamingPokemon_ActivateSlot (UnkStruct_021C0794 * saveData, const u8 slot) sub_0202D980(v1, 6, level); v4 = sub_02025E38(saveData); - v0 = AllocMonZeroed(4); + v0 = Pokemon_New(4); - ZeroMonData(v0); + Pokemon_Init(v0); sub_02073D80(v0, species, level, 32, 0, 0, 1, sub_02025F24(v4)); sub_0202D980(v1, 7, 0); sub_0202D980(v1, 8, 1); - sub_0202D980(v1, 2, GetMonData(v0, MON_DATA_COMBINED_IVS, NULL)); - sub_0202D980(v1, 3, GetMonData(v0, MON_DATA_PERSONALITY, NULL)); - sub_0202D980(v1, 5, GetMonData(v0, MON_DATA_MAX_HP, NULL)); + sub_0202D980(v1, 2, Pokemon_GetValue(v0, MON_DATA_COMBINED_IVS, NULL)); + sub_0202D980(v1, 3, Pokemon_GetValue(v0, MON_DATA_PERSONALITY, NULL)); + sub_0202D980(v1, 5, Pokemon_GetValue(v0, MON_DATA_MAX_HP, NULL)); Heap_FreeToHeap(v0); previouslyVisitedMap = sub_0202D8BC(v2); diff --git a/src/unk_0200B358.c b/src/unk_0200B358.c index 89303f4a2b..fc951100bc 100644 --- a/src/unk_0200B358.c +++ b/src/unk_0200B358.c @@ -209,7 +209,7 @@ void sub_0200B538 (UnkStruct_0200B358 * param0, u32 param1, BoxPokemon * param2) u32 v1; v0 = MessageLoader_Init(1, 26, 412, param0->unk_04); - v1 = GetBoxMonData(param2, MON_DATA_SPECIES, NULL); + v1 = BoxPokemon_GetValue(param2, MON_DATA_SPECIES, NULL); MessageLoader_GetStrbuf(v0, v1, param0->unk_0C); sub_0200B448(param0, param1, param0->unk_0C, NULL); @@ -220,7 +220,7 @@ void sub_0200B578 (UnkStruct_0200B358 * param0, u32 param1, BoxPokemon * param2) { u32 v0; - v0 = GetBoxMonData(param2, MON_DATA_SPECIES, NULL); + v0 = BoxPokemon_GetValue(param2, MON_DATA_SPECIES, NULL); sub_0200B594(param0, param1, v0); } @@ -237,13 +237,13 @@ void sub_0200B594 (UnkStruct_0200B358 * param0, u32 param1, u32 param2) void sub_0200B5CC (UnkStruct_0200B358 * param0, u32 param1, BoxPokemon * param2) { - GetBoxMonData(param2, MON_DATA_119, param0->unk_0C); + BoxPokemon_GetValue(param2, MON_DATA_119, param0->unk_0C); sub_0200B448(param0, param1, param0->unk_0C, NULL); } void sub_0200B5EC (UnkStruct_0200B358 * param0, u32 param1, BoxPokemon * param2) { - GetBoxMonData(param2, MON_DATA_145, param0->unk_0C); + BoxPokemon_GetValue(param2, MON_DATA_145, param0->unk_0C); sub_0200B448(param0, param1, param0->unk_0C, NULL); } diff --git a/src/unk_020261E4.c b/src/unk_020261E4.c index 1703e3776e..14ead71474 100644 --- a/src/unk_020261E4.c +++ b/src/unk_020261E4.c @@ -39,8 +39,8 @@ void sub_020261EC (UnkStruct_02026310 * param0) { memset(param0, 0, sizeof(UnkStruct_02026310)); - ZeroBoxMonData(¶m0->unk_00[0].unk_00); - ZeroBoxMonData(¶m0->unk_00[1].unk_00); + BoxPokemon_Init(¶m0->unk_00[0].unk_00); + BoxPokemon_Init(¶m0->unk_00[1].unk_00); param0->unk_D8 = 0; param0->unk_DC = 0; @@ -114,8 +114,8 @@ BOOL sub_02026280 (UnkStruct_02026310 * param0) { int v0, v1; - v0 = GetBoxMonData(¶m0->unk_00[0].unk_00, MON_DATA_LANGUAGE, NULL); - v1 = GetBoxMonData(¶m0->unk_00[1].unk_00, MON_DATA_LANGUAGE, NULL); + v0 = BoxPokemon_GetValue(¶m0->unk_00[0].unk_00, MON_DATA_LANGUAGE, NULL); + v1 = BoxPokemon_GetValue(¶m0->unk_00[1].unk_00, MON_DATA_LANGUAGE, NULL); if (v0 != v1) { return 1; @@ -147,7 +147,7 @@ void sub_020262C0 (UnkStruct_02026224 * param0) void sub_020262F4 (UnkStruct_02026218 * param0) { - ZeroBoxMonData(¶m0->unk_00); + BoxPokemon_Init(¶m0->unk_00); param0->unk_68 = 0; sub_020262C0(¶m0->unk_08); } diff --git a/src/unk_0202631C.c b/src/unk_0202631C.c index b45f563b4d..51575e8acb 100644 --- a/src/unk_0202631C.c +++ b/src/unk_0202631C.c @@ -464,7 +464,7 @@ static BOOL sub_020268D8 (const UnkStruct_02026324 * param0, u32 param1) static void sub_020268FC (UnkStruct_02026324 * param0, u16 param1, Pokemon * param2) { - u8 v0 = GetMonData(param2, MON_DATA_FORM, NULL); + u8 v0 = Pokemon_GetValue(param2, MON_DATA_FORM, NULL); u32 v1; if (param1 == 386) { @@ -571,38 +571,38 @@ static void sub_02026A60 (UnkStruct_02026324 * param0, u16 param1, Pokemon * par switch (param1) { case 201: - v0 = GetMonForm(param2); + v0 = Pokemon_GetForm(param2); sub_0202643C(param0, v0); break; case 412: - v0 = GetMonData(param2, MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param2, MON_DATA_FORM, NULL); sub_020267B8(param0, param1, v0); break; case 413: - v0 = GetMonData(param2, MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param2, MON_DATA_FORM, NULL); sub_020267B8(param0, param1, v0); break; case 422: - v0 = GetMonData(param2, MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param2, MON_DATA_FORM, NULL); sub_020265E8(param0, param1, v0); break; case 423: - v0 = GetMonData(param2, MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param2, MON_DATA_FORM, NULL); sub_020265E8(param0, param1, v0); break; case 386: sub_020268FC(param0, param1, param2); break; case 492: - v0 = GetMonData(param2, MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param2, MON_DATA_FORM, NULL); sub_020265E8(param0, param1, v0); break; case 487: - v0 = GetMonData(param2, MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param2, MON_DATA_FORM, NULL); sub_020265E8(param0, param1, v0); break; case 479: - v0 = GetMonData(param2, MON_DATA_FORM, NULL); + v0 = Pokemon_GetValue(param2, MON_DATA_FORM, NULL); sub_02026A00(param0, param1, v0); break; default: @@ -630,7 +630,7 @@ static u32 sub_02026BAC (const UnkStruct_02026324 * param0, u16 param1, int para u32 v0, v1; u32 v2; - if (GetMonSpeciesPersonalDataAttribute(param1, 18) == 255) { + if (PokemonPersonalData_GetSpeciesValue(param1, 18) == 255) { if (param2 == 0) { return 2; } else { @@ -1069,9 +1069,9 @@ u32 sub_02027288 (const UnkStruct_02026324 * param0) void sub_020272A4 (UnkStruct_02026324 * param0, Pokemon * param1) { - u16 v0 = GetMonData(param1, MON_DATA_SPECIES, NULL); - u32 v1 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); - u32 v2 = GetMonGender(param1); + u16 v0 = Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL); + u32 v1 = Pokemon_GetValue(param1, MON_DATA_PERSONALITY, NULL); + u32 v2 = Pokemon_GetGender(param1); u32 v3; inline_02026DD0(param0); @@ -1097,10 +1097,10 @@ void sub_020272A4 (UnkStruct_02026324 * param0, Pokemon * param1) void sub_0202736C (UnkStruct_02026324 * param0, Pokemon * param1) { - u16 v0 = GetMonData(param1, MON_DATA_SPECIES, NULL); - u32 v1 = GetMonData(param1, MON_DATA_LANGUAGE, NULL); - u32 v2 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); - u32 v3 = GetMonGender(param1); + u16 v0 = Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL); + u32 v1 = Pokemon_GetValue(param1, MON_DATA_LANGUAGE, NULL); + u32 v2 = Pokemon_GetValue(param1, MON_DATA_PERSONALITY, NULL); + u32 v3 = Pokemon_GetGender(param1); u32 v4; inline_02026DD0(param0); diff --git a/src/unk_02028124.c b/src/unk_02028124.c index aa0a7c6677..2fbe3c012b 100644 --- a/src/unk_02028124.c +++ b/src/unk_02028124.c @@ -112,9 +112,9 @@ void sub_020281AC (UnkStruct_0202818C * param0, u8 param1, u8 param2, UnkStruct_ for (v0 = param2, v1 = 0; v0 < Party_GetCurrentCount(v9); v0++) { v10 = Party_GetPokemonBySlotIndex(v9, v0); - v4 = GetMonData(v10, MON_DATA_SPECIES, NULL); - v6 = GetMonData(v10, MON_DATA_IS_EGG, NULL); - v7 = GetMonData(v10, MON_DATA_FORM, NULL); + v4 = Pokemon_GetValue(v10, MON_DATA_SPECIES, NULL); + v6 = Pokemon_GetValue(v10, MON_DATA_IS_EGG, NULL); + v7 = Pokemon_GetValue(v10, MON_DATA_FORM, NULL); v5 = sub_02079D80(v10); v2 = sub_02079EDC(v4, v7, v6); diff --git a/src/unk_020298BC.c b/src/unk_020298BC.c index c26113e135..2fb47b4618 100644 --- a/src/unk_020298BC.c +++ b/src/unk_020298BC.c @@ -124,12 +124,12 @@ static void sub_020298D8 (UnkStruct_020298D8 * param0, u8 * param1, u8 * param2, static void sub_0202992C (UnkStruct_0202A138 * param0, Pokemon * param1, u8 param2, u8 param3, s8 param4) { - param0->unk_08 = GetMonData(param1, MON_DATA_SPECIES, NULL); - GetMonData(param1, MON_DATA_117, param0->unk_0A); + param0->unk_08 = Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL); + Pokemon_GetValue(param1, MON_DATA_117, param0->unk_0A); - param0->unk_00 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); - param0->unk_04 = GetMonData(param1, MON_DATA_OT_ID, NULL); - param0->unk_33 = GetMonData(param1, MON_DATA_FORM, NULL); + param0->unk_00 = Pokemon_GetValue(param1, MON_DATA_PERSONALITY, NULL); + param0->unk_04 = Pokemon_GetValue(param1, MON_DATA_OT_ID, NULL); + param0->unk_33 = Pokemon_GetValue(param1, MON_DATA_FORM, NULL); param0->unk_31 = param2; param0->unk_32 = param3; @@ -154,8 +154,8 @@ static void sub_020299C0 (UnkStruct_0202A138 * param0, const Strbuf *param1, int static void sub_020299D8 (const UnkStruct_0202A138 * param0, Pokemon * param1) { sub_02073D80(param1, param0->unk_08, 0, 0, 1, param0->unk_00, 1, param0->unk_04); - SetMonData(param1, 117, param0->unk_0A); - SetMonData(param1, 112, ¶m0->unk_33); + Pokemon_SetValue(param1, 117, param0->unk_0A); + Pokemon_SetValue(param1, 112, ¶m0->unk_33); } static void sub_02029A18 (UnkStruct_0202A150 * param0, u8 param1, u8 param2, u8 param3, u8 param4) diff --git a/src/unk_0202DF8C.c b/src/unk_0202DF8C.c index 53e64e2828..2d4a968f75 100644 --- a/src/unk_0202DF8C.c +++ b/src/unk_0202DF8C.c @@ -52,24 +52,24 @@ void sub_0202DFA8 (UnkStruct_0202DF8C * param0, const Party * param1, const RTCD for (v4 = 0, v5 = 0; v4 < v3; v4++) { v1 = Party_GetPokemonBySlotIndex(param1, v4); - v6 = DecryptMon(v1); - - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - v0->unk_00[v5].unk_00 = GetMonData(v1, MON_DATA_SPECIES, NULL); - v0->unk_00[v5].unk_02 = GetMonData(v1, MON_DATA_LEVEL, NULL); - v0->unk_00[v5].unk_03 = GetMonData(v1, MON_DATA_FORM, NULL); - v0->unk_00[v5].unk_04 = GetMonData(v1, MON_DATA_PERSONALITY, NULL); - v0->unk_00[v5].unk_08 = GetMonData(v1, MON_DATA_OT_ID, NULL); - v0->unk_00[v5].unk_32[0] = GetMonData(v1, MON_DATA_MOVE1, NULL); - v0->unk_00[v5].unk_32[1] = GetMonData(v1, MON_DATA_MOVE2, NULL); - v0->unk_00[v5].unk_32[2] = GetMonData(v1, MON_DATA_MOVE3, NULL); - v0->unk_00[v5].unk_32[3] = GetMonData(v1, MON_DATA_MOVE4, NULL); + v6 = Pokemon_EnterDecryptionContext(v1); + + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + v0->unk_00[v5].unk_00 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); + v0->unk_00[v5].unk_02 = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); + v0->unk_00[v5].unk_03 = Pokemon_GetValue(v1, MON_DATA_FORM, NULL); + v0->unk_00[v5].unk_04 = Pokemon_GetValue(v1, MON_DATA_PERSONALITY, NULL); + v0->unk_00[v5].unk_08 = Pokemon_GetValue(v1, MON_DATA_OT_ID, NULL); + v0->unk_00[v5].unk_32[0] = Pokemon_GetValue(v1, MON_DATA_MOVE1, NULL); + v0->unk_00[v5].unk_32[1] = Pokemon_GetValue(v1, MON_DATA_MOVE2, NULL); + v0->unk_00[v5].unk_32[2] = Pokemon_GetValue(v1, MON_DATA_MOVE3, NULL); + v0->unk_00[v5].unk_32[3] = Pokemon_GetValue(v1, MON_DATA_MOVE4, NULL); if (v2) { - GetMonData(v1, MON_DATA_119, v2); + Pokemon_GetValue(v1, MON_DATA_119, v2); Strbuf_ToChars(v2, v0->unk_00[v5].unk_0C, 11); - GetMonData(v1, MON_DATA_145, v2); + Pokemon_GetValue(v1, MON_DATA_145, v2); Strbuf_ToChars(v2, v0->unk_00[v5].unk_22, 8); } else { v0->unk_00[v5].unk_0C[0] = 0xffff; @@ -79,7 +79,7 @@ void sub_0202DFA8 (UnkStruct_0202DF8C * param0, const Party * param1, const RTCD v5++; } - EncryptMon(v1, v6); + Pokemon_ExitDecryptionContext(v1, v6); } v0->unk_168 = param2->year; diff --git a/src/unk_0202EEC0.c b/src/unk_0202EEC0.c index 0878bc054d..f59b57d66b 100644 --- a/src/unk_0202EEC0.c +++ b/src/unk_0202EEC0.c @@ -27,8 +27,8 @@ void sub_0202EEC8 (UnkStruct_02024440 * param0) MI_CpuClearFast(param0, sizeof(UnkStruct_02024440)); for (v0 = 0; v0 < 6; v0++) { - ZeroMonData(¶m0->unk_00[v0]); - GF_ASSERT(GetMonData(¶m0->unk_00[v0], MON_DATA_172, NULL) == 0); + Pokemon_Init(¶m0->unk_00[v0]); + GF_ASSERT(Pokemon_GetValue(¶m0->unk_00[v0], MON_DATA_172, NULL) == 0); } } @@ -39,8 +39,8 @@ void sub_0202EF04 (UnkStruct_02024440 * param0) MI_CpuClearFast(param0->unk_00, sizeof(Pokemon) * 6); for (v0 = 0; v0 < 6; v0++) { - ZeroMonData(¶m0->unk_00[v0]); - GF_ASSERT(GetMonData(¶m0->unk_00[v0], MON_DATA_172, NULL) == 0); + Pokemon_Init(¶m0->unk_00[v0]); + GF_ASSERT(Pokemon_GetValue(¶m0->unk_00[v0], MON_DATA_172, NULL) == 0); } } @@ -75,7 +75,7 @@ static int sub_0202EF40 (UnkStruct_02024440 * param0, u32 param1) void sub_0202EFA4 (UnkStruct_02024440 * param0, BoxPokemon * param1, int param2) { - sub_020774C8(param1, ¶m0->unk_00[param2]); + Pokemon_FromBoxPokemon(param1, ¶m0->unk_00[param2]); } void sub_0202EFB8 (UnkStruct_02024440 * param0, u32 param1) @@ -100,7 +100,7 @@ int sub_0202F028 (const UnkStruct_02024440 * param0) int v0, v1; for (v1 = 0, v0 = 0; v0 < 6; v0++) { - if (GetMonData((Pokemon *)¶m0->unk_00[v0], MON_DATA_172, NULL)) { + if (Pokemon_GetValue((Pokemon *)¶m0->unk_00[v0], MON_DATA_172, NULL)) { v1++; } } diff --git a/src/unk_0202F180.c b/src/unk_0202F180.c index f8b6e8a9d1..ea9cf0fee1 100644 --- a/src/unk_0202F180.c +++ b/src/unk_0202F180.c @@ -13,10 +13,10 @@ void sub_0202F180 (UnkStruct_021C0794 * param0, const Pokemon * param1) { - if (GetMonData((Pokemon *)param1, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue((Pokemon *)param1, MON_DATA_IS_EGG, NULL) == 0) { UnkStruct_02026324 * v0 = sub_02027560(param0); - sub_0202D040(sub_0202CD88(param0), v0, GetMonData((Pokemon *)param1, MON_DATA_SPECIES, NULL)); + sub_0202D040(sub_0202CD88(param0), v0, Pokemon_GetValue((Pokemon *)param1, MON_DATA_SPECIES, NULL)); sub_0202736C(v0, (Pokemon *)param1); sub_02056A48(sub_02056B24(param0), (const BoxPokemon *)param1); } diff --git a/src/unk_0202F1D4.c b/src/unk_0202F1D4.c index 0c844e780a..ad7f0db98a 100644 --- a/src/unk_0202F1D4.c +++ b/src/unk_0202F1D4.c @@ -601,13 +601,13 @@ static void sub_0202FD30 (UnkStruct_0202FD30 * param0, Party * param1) Pokemon * v1; u8 v2 = 0; - v1 = AllocMonZeroed(11); + v1 = Pokemon_New(11); Party_InitWithCapacity(param1, param0->unk_00); for (v0 = 0; v0 < param0->unk_02; v0++) { sub_02078E0C(¶m0->unk_04[v0], v1); - SetMonData(v1, 162, &v2); + Pokemon_SetValue(v1, 162, &v2); Party_AddPokemon(param1, v1); } diff --git a/src/unk_02030A80.c b/src/unk_02030A80.c index 0c820a723b..a7dd858bbb 100644 --- a/src/unk_02030A80.c +++ b/src/unk_02030A80.c @@ -112,7 +112,7 @@ int sub_02030BCC (const UnkStruct_02030A80 * param0) return 0; } - return SanitizeFormId(param0->unk_1C, param0->unk_1B_1); + return Pokemon_SanitizeFormId(param0->unk_1C, param0->unk_1B_1); } int sub_02030BEC (const UnkStruct_02030A80 * param0) diff --git a/src/unk_0203A9C8.c b/src/unk_0203A9C8.c index c898f8b5d9..6091846924 100644 --- a/src/unk_0203A9C8.c +++ b/src/unk_0203A9C8.c @@ -1341,7 +1341,7 @@ static BOOL sub_0203BC5C (UnkStruct_020508D4 * param0) Heap_FreeToHeap(v1->unk_260); - if ((Item_IsMail(v10) == 1) && (GetMonData(v8, MON_DATA_HELD_ITEM, NULL) == 0)) { + if ((Item_IsMail(v10) == 1) && (Pokemon_GetValue(v8, MON_DATA_HELD_ITEM, NULL) == 0)) { UnkStruct_02097728 * v11; UnkStruct_0203C540 * v12; diff --git a/src/unk_0203D1B8.c b/src/unk_0203D1B8.c index 6df0537a5d..d694574868 100644 --- a/src/unk_0203D1B8.c +++ b/src/unk_0203D1B8.c @@ -1004,8 +1004,8 @@ static void sub_0203DB38 (UnkStruct_ov88_0223C370 * param0, UnkStruct_0203CDB0 * param0->unk_1C = param1->unk_9C; param0->unk_20 = sub_0202CD88(param1->unk_0C); param0->unk_38 = Heap_AllocFromHeap(32, sub_02025E68()); - param0->unk_3C = Heap_AllocFromHeap(32, GetPokemonStructSize()); - param0->unk_40 = Heap_AllocFromHeap(32, GetPokemonStructSize()); + param0->unk_3C = Heap_AllocFromHeap(32, Pokemon_GetStructSize()); + param0->unk_40 = Heap_AllocFromHeap(32, Pokemon_GetStructSize()); param0->unk_00 = param1; param0->unk_34 = 0; } @@ -1060,8 +1060,8 @@ BOOL sub_0203DBF0 (UnkStruct_020508D4 * param0) break; case 4: v2->unk_48.unk_08 = v2->unk_04.unk_38; - v2->unk_48.unk_00 = GetBoxMon(v2->unk_04.unk_3C); - v2->unk_48.unk_04 = GetBoxMon(v2->unk_04.unk_40); + v2->unk_48.unk_00 = Pokemon_GetBoxPokemon(v2->unk_04.unk_3C); + v2->unk_48.unk_04 = Pokemon_GetBoxPokemon(v2->unk_04.unk_40); v2->unk_48.unk_14 = sub_02025E44(v1->unk_0C); v2->unk_48.unk_10 = 1; @@ -1089,7 +1089,7 @@ BOOL sub_0203DBF0 (UnkStruct_020508D4 * param0) break; case 5: { - int v3 = GetMonData(v2->unk_04.unk_40, MON_DATA_HELD_ITEM, NULL); + int v3 = Pokemon_GetValue(v2->unk_04.unk_40, MON_DATA_HELD_ITEM, NULL); int v4; int v5; @@ -1104,7 +1104,7 @@ BOOL sub_0203DBF0 (UnkStruct_020508D4 * param0) break; case 6: if (sub_0207B0D0(v2->unk_60)) { - sub_020775EC(v2->unk_04.unk_40, Party_GetPokemonBySlotIndex(v2->unk_04.unk_08, v2->unk_04.unk_2C)); + Pokemon_Copy(v2->unk_04.unk_40, Party_GetPokemonBySlotIndex(v2->unk_04.unk_08, v2->unk_04.unk_2C)); sub_0207B0E0(v2->unk_60); Heap_Destroy(26); v2->unk_00 = 7; @@ -1265,7 +1265,7 @@ static void sub_0203DF68 (UnkStruct_020508D4 * param0) int v4; v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v1->unk_04); - SetMonData(v3, 118, (u8 *)&v1->unk_0C->unk_1C); + Pokemon_SetValue(v3, 118, (u8 *)&v1->unk_0C->unk_1C); } break; case 5: @@ -1300,8 +1300,8 @@ void sub_0203DFE8 (UnkStruct_020508D4 * param0, int param1, int param2, int para switch (param1) { case 1: v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v1->unk_0C), v2->unk_04); - v2->unk_0C->unk_10 = GetMonData(v0, MON_DATA_GENDER, NULL); - v2->unk_0C->unk_08 = GetMonData(v0, MON_DATA_FORM, NULL); + v2->unk_0C->unk_10 = Pokemon_GetValue(v0, MON_DATA_GENDER, NULL); + v2->unk_0C->unk_08 = Pokemon_GetValue(v0, MON_DATA_FORM, NULL); if (param5 != NULL) { Strbuf_CopyChars(v2->unk_10, param5); diff --git a/src/unk_0203F6C4.c b/src/unk_0203F6C4.c index 3ffb4ec03f..f5d18893ac 100644 --- a/src/unk_0203F6C4.c +++ b/src/unk_0203F6C4.c @@ -3631,7 +3631,7 @@ static BOOL sub_0204174C (UnkStruct_0203E724 * param0) u16 * v2 = inline_0204FCAC(param0); v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v1); - *v2 = GetMonForm(v0); + *v2 = Pokemon_GetForm(v0); return 0; } @@ -4134,7 +4134,7 @@ static BOOL sub_02041F14 (UnkStruct_0203E724 * param0) sub_0200DAA4(param0->unk_34->unk_08, 3, 1024 - (18 + 12) - 9, 11, 0, 4); *v1 = sub_0200EC48(param0->unk_34->unk_08, 3, 10, 5, 11, 1024 - (18 + 12) - 9, v0, 4); - sub_020451B4(param0->unk_34, GetMonData(v0, MON_DATA_SPECIES, NULL)); + sub_020451B4(param0->unk_34, Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL)); return 0; } @@ -4598,8 +4598,8 @@ static BOOL sub_02042718 (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v2->unk_0C), v3); - GetMonData(v1, MON_DATA_117, v0); - sub_0203DFE8(param0->unk_28, 1, GetMonData(v1, MON_DATA_SPECIES, NULL), 10, v3, v0, inline_0204FCAC(param0)); + Pokemon_GetValue(v1, MON_DATA_117, v0); + sub_0203DFE8(param0->unk_28, 1, Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL), 10, v3, v0, inline_0204FCAC(param0)); return 1; } @@ -6734,12 +6734,12 @@ static BOOL sub_02044E40 (UnkStruct_0203E724 * param0) v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v2); - v3[0] = GetMonData(v0, MON_DATA_HP_EV, NULL); - v3[1] = GetMonData(v0, MON_DATA_ATK_EV, NULL); - v3[2] = GetMonData(v0, MON_DATA_DEF_EV, NULL); - v3[3] = GetMonData(v0, MON_DATA_SPEED_EV, NULL); - v3[4] = GetMonData(v0, MON_DATA_SPATK_EV, NULL); - v3[5] = GetMonData(v0, MON_DATA_SPDEF_EV, NULL); + v3[0] = Pokemon_GetValue(v0, MON_DATA_HP_EV, NULL); + v3[1] = Pokemon_GetValue(v0, MON_DATA_ATK_EV, NULL); + v3[2] = Pokemon_GetValue(v0, MON_DATA_DEF_EV, NULL); + v3[3] = Pokemon_GetValue(v0, MON_DATA_SPEED_EV, NULL); + v3[4] = Pokemon_GetValue(v0, MON_DATA_SPATK_EV, NULL); + v3[5] = Pokemon_GetValue(v0, MON_DATA_SPDEF_EV, NULL); *v1 = (v3[0] + v3[1] + v3[2] + v3[3] + v3[4] + v3[5]); return 0; @@ -6773,8 +6773,8 @@ static BOOL sub_02044F24 (UnkStruct_0203E724 * param0) u16 v4, v5; v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v3); - v4 = GetMonData(v0, MON_DATA_SPECIES, NULL); - v5 = GetMonData(v0, MON_DATA_FORM, NULL); + v4 = Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); + v5 = Pokemon_GetValue(v0, MON_DATA_FORM, NULL); *v1 = ov5_021F0E90(v4, v5); *v2 = ov5_021F0E84(v4); @@ -6900,9 +6900,9 @@ static BOOL sub_02045198 (UnkStruct_0203E724 * param0) static void sub_020451B4 (UnkStruct_0203CDB0 * param0, u16 param1) { UnkStruct_02026324 * v0 = sub_02027560(param0->unk_0C); - Pokemon * v1 = AllocMonZeroed(32); + Pokemon * v1 = Pokemon_New(32); - ZeroMonData(v1); + Pokemon_Init(v1); sub_02073D80(v1, param1, 50, 32, 0, 0, 0, 0); sub_020272A4(v0, v1); Heap_FreeToHeap(v1); @@ -7022,11 +7022,11 @@ static BOOL sub_02045384 (UnkStruct_0203E724 * param0) for (v2 = 0; v2 < v4; v2++) { v5 = Party_GetPokemonBySlotIndex(v1, v2); - v3 = GetMonData(v5, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v5, MON_DATA_SPECIES, NULL); if (v3 == 386) { - SetMonData(v5, 112, &v0); - CalculateMonLevelAndStats(v5); + Pokemon_SetValue(v5, 112, &v0); + Pokemon_CalcLevelAndStats(v5); sub_0202736C(v6, v5); } } @@ -7047,9 +7047,9 @@ static BOOL sub_02045404 (UnkStruct_0203E724 * param0) for (v1 = 0; v1 < v9; v1++) { v0 = Party_GetPokemonBySlotIndex(v8, v1); - v2 = GetMonData(v0, MON_DATA_SPECIES, NULL); - v6 = GetMonData(v0, MON_DATA_GENDER, NULL); - v5 = GetMonData(v0, MON_DATA_IS_EGG, NULL); + v2 = Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); + v6 = Pokemon_GetValue(v0, MON_DATA_GENDER, NULL); + v5 = Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL); if ((v2 == 415) && (v5 == 0)) { if (v6 == 0) { @@ -8296,8 +8296,8 @@ static u32 sub_0204676C (UnkStruct_021C0794 * param0) for (v0 = 0; v0 < v5; v0++) { v1 = Party_GetPokemonBySlotIndex(v4, v0); - if ((GetMonData(v1, MON_DATA_SPECIES, NULL) == 479) && (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0)) { - v3 |= 1 << GetMonData(v1, MON_DATA_FORM, NULL); + if ((Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL) == 479) && (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0)) { + v3 |= 1 << Pokemon_GetValue(v1, MON_DATA_FORM, NULL); } } } @@ -8312,8 +8312,8 @@ static u32 sub_0204676C (UnkStruct_021C0794 * param0) v7 = sub_02026218(v6, v0); v2 = sub_02026220(v7); - if ((GetBoxMonData(v2, 5, NULL) == 479) && (GetBoxMonData(v2, MON_DATA_IS_EGG, NULL) == 0)) { - v3 |= 1 << GetBoxMonData(v2, MON_DATA_FORM, NULL); + if ((BoxPokemon_GetValue(v2, 5, NULL) == 479) && (BoxPokemon_GetValue(v2, MON_DATA_IS_EGG, NULL) == 0)) { + v3 |= 1 << BoxPokemon_GetValue(v2, MON_DATA_FORM, NULL); } } } @@ -8328,8 +8328,8 @@ static u32 sub_0204676C (UnkStruct_021C0794 * param0) for (v0 = 0; v0 < (5 * 6); v0++) { v2 = sub_02079C9C(v8, v9, v0); - if ((GetBoxMonData(v2, 5, NULL) == 479) && (GetBoxMonData(v2, MON_DATA_IS_EGG, NULL) == 0)) { - v3 |= 1 << GetBoxMonData(v2, MON_DATA_FORM, NULL); + if ((BoxPokemon_GetValue(v2, 5, NULL) == 479) && (BoxPokemon_GetValue(v2, MON_DATA_IS_EGG, NULL) == 0)) { + v3 |= 1 << BoxPokemon_GetValue(v2, MON_DATA_FORM, NULL); } } } @@ -8454,7 +8454,7 @@ static BOOL sub_020469D0 (UnkStruct_0203E724 * param0) u16 v2 = inline_02049538(param0); v1 = Party_GetFromSavedata(param0->unk_34->unk_0C); - SetPartyGiratinaForm(v1, v2); + Party_SetGiratinaForm(v1, v2); { int v3, v4; Pokemon * v5; @@ -8464,7 +8464,7 @@ static BOOL sub_020469D0 (UnkStruct_0203E724 * param0) for (v3 = 0; v3 < v4; v3++) { v5 = Party_GetPokemonBySlotIndex(v1, v3); - if ((GetMonData(v5, MON_DATA_IS_EGG, NULL) == 0) && (GetMonData(v5, MON_DATA_SPECIES, NULL) == 487)) { + if ((Pokemon_GetValue(v5, MON_DATA_IS_EGG, NULL) == 0) && (Pokemon_GetValue(v5, MON_DATA_SPECIES, NULL) == 487)) { sub_0202736C(sub_02027560(v0->unk_0C), v5); } } @@ -8485,11 +8485,11 @@ static BOOL sub_02046A4C (UnkStruct_0203E724 * param0) for (v3 = 0; v3 < v2; v3++) { v4 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v3); - if (GetMonData(v4, MON_DATA_IS_EGG, NULL) == 0) { - v0 = GetMonData(v4, MON_DATA_SPECIES, NULL); + if (Pokemon_GetValue(v4, MON_DATA_IS_EGG, NULL) == 0) { + v0 = Pokemon_GetValue(v4, MON_DATA_SPECIES, NULL); if (v0 == 486) { - v1 = GetMonData(v4, MON_DATA_FATEFUL_ENCOUNTER, NULL); + v1 = Pokemon_GetValue(v4, MON_DATA_FATEFUL_ENCOUNTER, NULL); if (v1 == 1) { *v5 = 1; diff --git a/src/unk_020474B8.c b/src/unk_020474B8.c index b57d925970..9802e24593 100644 --- a/src/unk_020474B8.c +++ b/src/unk_020474B8.c @@ -445,7 +445,7 @@ BOOL sub_02047D00 (UnkStruct_0203E724 * param0) u16 v6; v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v4); - v6 = GetMonData(v1, MON_DATA_MOVE1 + v5, NULL); + v6 = Pokemon_GetValue(v1, MON_DATA_MOVE1 + v5, NULL); sub_0200B630(*v2, v3, v6); return 0; diff --git a/src/unk_020480A8.c b/src/unk_020480A8.c index 5972ebfc8a..892b757401 100644 --- a/src/unk_020480A8.c +++ b/src/unk_020480A8.c @@ -55,8 +55,8 @@ BOOL sub_020480D8 (UnkStruct_0203E724 * param0) for (v11 = 0, v12 = 0, v9 = 0; v9 < v8; v9++) { v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v9); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - v15 = (GetMonData(v1, MON_DATA_OT_ID, NULL) & 0xffff); + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + v15 = (Pokemon_GetValue(v1, MON_DATA_OT_ID, NULL) & 0xffff); v16 = sub_02048268(v7, v15); @@ -70,11 +70,11 @@ BOOL sub_020480D8 (UnkStruct_0203E724 * param0) for (v13 = 0, v14 = 0, v18 = 0; v18 < 18; v18++) { for (v17 = 0; v17 < (5 * 6); v17++) { v2 = sub_02079C9C(v3, v18, v17); - v19 = GetBoxMonData(v2, MON_DATA_SPECIES, NULL); + v19 = BoxPokemon_GetValue(v2, MON_DATA_SPECIES, NULL); if (v19) { - if (GetBoxMonData(v2, MON_DATA_IS_EGG, NULL) == 0) { - v15 = (GetBoxMonData(v2, MON_DATA_OT_ID, NULL) & 0xffff); + if (BoxPokemon_GetValue(v2, MON_DATA_IS_EGG, NULL) == 0) { + v15 = (BoxPokemon_GetValue(v2, MON_DATA_OT_ID, NULL) & 0xffff); v16 = sub_02048268(v7, v15); diff --git a/src/unk_02048DD8.c b/src/unk_02048DD8.c index 3f1803f635..caec252d5b 100644 --- a/src/unk_02048DD8.c +++ b/src/unk_02048DD8.c @@ -290,7 +290,7 @@ static void sub_02049268 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * para Party * v0 = Party_GetFromSavedata(param0->unk_0C); Pokemon * v1 = sub_02054A74(v0); - sub_0200B538(param1, 0, GetBoxMon(v1)); + sub_0200B538(param1, 0, Pokemon_GetBoxPokemon(v1)); } static void sub_02049288 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param1) diff --git a/src/unk_02049D08.c b/src/unk_02049D08.c index a75a58a8a4..9605c8b3e5 100644 --- a/src/unk_02049D08.c +++ b/src/unk_02049D08.c @@ -176,14 +176,14 @@ BOOL sub_02049EC4 (u16 param0, UnkStruct_021C0794 * param1, u8 param2) for (v0 = 0, v2 = 0; v0 < v3; v0++) { v7 = Party_GetPokemonBySlotIndex(v6, v0); - v4 = GetMonData(v7, MON_DATA_SPECIES, NULL); - v5 = GetMonData(v7, MON_DATA_HELD_ITEM, NULL); + v4 = Pokemon_GetValue(v7, MON_DATA_SPECIES, NULL); + v5 = Pokemon_GetValue(v7, MON_DATA_HELD_ITEM, NULL); if (param2 == 0) { v5 = 0; } - if (GetMonData(v7, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v7, MON_DATA_IS_EGG, NULL) != 0) { continue; } @@ -447,8 +447,8 @@ BOOL sub_0204A378 (UnkStruct_0204AFC4 * param0, void ** param1, UnkStruct_021C07 for (v0 = 0; v0 < param0->unk_0E; v0++) { param0->unk_2A[v0] = v1->unk_2C[v0] - 1; v3 = Party_GetPokemonBySlotIndex(v2, param0->unk_2A[v0]); - param0->unk_2E[v0] = GetMonData(v3, MON_DATA_SPECIES, NULL); - param0->unk_36[v0] = GetMonData(v3, MON_DATA_HELD_ITEM, NULL); + param0->unk_2E[v0] = Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL); + param0->unk_36[v0] = Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL); } Heap_FreeToHeap(*param1); @@ -467,8 +467,8 @@ int sub_0204A410 (UnkStruct_0204AFC4 * param0, UnkStruct_021C0794 * param1) for (v0 = 0; v0 < param0->unk_0E; v0++) { v5 = Party_GetPokemonBySlotIndex(v4, param0->unk_2A[v0]); - v2[v0] = GetMonData(v5, MON_DATA_SPECIES, NULL); - v3[v0] = GetMonData(v5, MON_DATA_HELD_ITEM, NULL); + v2[v0] = Pokemon_GetValue(v5, MON_DATA_SPECIES, NULL); + v3[v0] = Pokemon_GetValue(v5, MON_DATA_HELD_ITEM, NULL); if (v0 == 0) { continue; @@ -960,11 +960,11 @@ static u16 sub_0204AC54 (UnkStruct_021C0794 * param0, u8 param1, UnkStruct_0204A for (v2 = 0; v2 < param2->unk_0E; v2++) { v4 = Party_GetPokemonBySlotIndex(v3, param2->unk_2A[v2]); - if (GetMonData(v4, param1, NULL)) { + if (Pokemon_GetValue(v4, param1, NULL)) { continue; } - SetMonData(v4, param1, &v0); + Pokemon_SetValue(v4, param1, &v0); sub_0206DDB8(param0, v4, param1); ++v1; } @@ -998,28 +998,28 @@ static void sub_0204ACFC (UnkStruct_ov104_0223A348_sub2 * param0, Pokemon * para { int v0; - param0->unk_00_val1_0 = GetMonData(param1, MON_DATA_SPECIES, NULL); - param0->unk_00_val1_11 = GetMonData(param1, MON_DATA_FORM, NULL); - param0->unk_02 = GetMonData(param1, MON_DATA_HELD_ITEM, NULL); + param0->unk_00_val1_0 = Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL); + param0->unk_00_val1_11 = Pokemon_GetValue(param1, MON_DATA_FORM, NULL); + param0->unk_02 = Pokemon_GetValue(param1, MON_DATA_HELD_ITEM, NULL); for (v0 = 0; v0 < 4; v0++) { - param0->unk_04[v0] = GetMonData(param1, MON_DATA_MOVE1 + v0, NULL); - param0->unk_1E_val2 |= ((GetMonData(param1, MON_DATA_MOVE1_PP_UPS + v0, NULL))<< (v0 * 2)); + param0->unk_04[v0] = Pokemon_GetValue(param1, MON_DATA_MOVE1 + v0, NULL); + param0->unk_1E_val2 |= ((Pokemon_GetValue(param1, MON_DATA_MOVE1_PP_UPS + v0, NULL))<< (v0 * 2)); } - param0->unk_1F = GetMonData(param1, MON_DATA_LANGUAGE, NULL); - param0->unk_0C = GetMonData(param1, MON_DATA_OT_ID, NULL); - param0->unk_10 = GetMonData(param1, MON_DATA_PERSONALITY, NULL); - param0->unk_14_val2 = GetMonData(param1, MON_DATA_COMBINED_IVS, NULL); + param0->unk_1F = Pokemon_GetValue(param1, MON_DATA_LANGUAGE, NULL); + param0->unk_0C = Pokemon_GetValue(param1, MON_DATA_OT_ID, NULL); + param0->unk_10 = Pokemon_GetValue(param1, MON_DATA_PERSONALITY, NULL); + param0->unk_14_val2 = Pokemon_GetValue(param1, MON_DATA_COMBINED_IVS, NULL); for (v0 = 0; v0 < 6; v0++) { - param0->unk_18_val2[v0] = GetMonData(param1, MON_DATA_HP_EV + v0, NULL); + param0->unk_18_val2[v0] = Pokemon_GetValue(param1, MON_DATA_HP_EV + v0, NULL); } - param0->unk_20 = GetMonData(param1, MON_DATA_ABILITY, NULL); - param0->unk_21 = GetMonData(param1, MON_DATA_FRIENDSHIP, NULL); + param0->unk_20 = Pokemon_GetValue(param1, MON_DATA_ABILITY, NULL); + param0->unk_21 = Pokemon_GetValue(param1, MON_DATA_FRIENDSHIP, NULL); - GetMonData(param1, MON_DATA_117, param0->unk_22); + Pokemon_GetValue(param1, MON_DATA_117, param0->unk_22); } static void sub_0204AE20 (UnkStruct_0204AFC4 * param0, UnkStruct_021C0794 * param1, int param2) diff --git a/src/unk_0204AEE8.c b/src/unk_0204AEE8.c index 06ef125f19..1866f07175 100644 --- a/src/unk_0204AEE8.c +++ b/src/unk_0204AEE8.c @@ -210,7 +210,7 @@ void sub_0204B060 (UnkStruct_0204AFC4 * param0, UnkStruct_021C0794 * param1) v1 = Party_GetFromSavedata(param1); for (v0 = 0; v0 < 2; v0++) { - param0->unk_83E[1 + v0] = GetMonData(Party_GetPokemonBySlotIndex(v1, param0->unk_2A[v0]), MON_DATA_SPECIES, NULL); + param0->unk_83E[1 + v0] = Pokemon_GetValue(Party_GetPokemonBySlotIndex(v1, param0->unk_2A[v0]), MON_DATA_SPECIES, NULL); } param0->unk_83E[3] = sub_0202D3B4(param0->unk_74, 3, 0); @@ -345,7 +345,7 @@ static u32 sub_0204B1E8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348_s if (param4 == 0) { do { v2 = (sub_0204AEC0(param0) | sub_0204AEC0(param0) << 16); - } while ((v4.unk_0B != GetNatureFromPersonality(v2)) || (GetMonPersonalityShininess(param3, v2) == 1)); + } while ((v4.unk_0B != Pokemon_GetNatureOf(v2)) || (Pokemon_IsPersonalityShiny(param3, v2) == 1)); param1->unk_10 = v2; } else { @@ -363,7 +363,7 @@ static u32 sub_0204B1E8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348_s v1 = 0; for (v0 = 0; v0 < 6; v0++) { - if (v4.unk_0A & GetSingleBitMask(v0)) { + if (v4.unk_0A & Pokemon_GetFlagMaskOf(v0)) { v1++; } } @@ -375,7 +375,7 @@ static u32 sub_0204B1E8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348_s } for (v0 = 0; v0 < 6; v0++) { - if (v4.unk_0A & GetSingleBitMask(v0)) { + if (v4.unk_0A & Pokemon_GetFlagMaskOf(v0)) { param1->unk_18_val2[v0] = v1; } } @@ -383,16 +383,16 @@ static u32 sub_0204B1E8 (UnkStruct_0204AFC4 * param0, UnkStruct_ov104_0223A348_s param1->unk_1E_val2 = 0; param1->unk_1F = Unk_020E4C44; - v0 = GetMonSpeciesPersonalDataAttribute(param1->unk_00_val1_0, 25); + v0 = PokemonPersonalData_GetSpeciesValue(param1->unk_00_val1_0, 25); if (v0) { if (param1->unk_10 & 1) { param1->unk_20 = v0; } else { - param1->unk_20 = GetMonSpeciesPersonalDataAttribute(param1->unk_00_val1_0, 24); + param1->unk_20 = PokemonPersonalData_GetSpeciesValue(param1->unk_00_val1_0, 24); } } else { - param1->unk_20 = GetMonSpeciesPersonalDataAttribute(param1->unk_00_val1_0, 24); + param1->unk_20 = PokemonPersonalData_GetSpeciesValue(param1->unk_00_val1_0, 24); } param1->unk_21 = v3; diff --git a/src/unk_0204B830.c b/src/unk_0204B830.c index 3fb3857efa..a153c915fc 100644 --- a/src/unk_0204B830.c +++ b/src/unk_0204B830.c @@ -202,15 +202,15 @@ static void sub_0204BAAC (UnkStruct_0203CDB0 * param0, void * param1) v4 = (Pokemon *)&v0->val1.unk_04; v14 = (u8 *)&v0->val1.unk_F0; - v12 = GetMonData(v4, MON_DATA_152, NULL); - v8 = GetMonData(v4, MON_DATA_PERSONALITY, NULL); - v7 = GetMonData(v4, MON_DATA_OT_ID, NULL); + v12 = Pokemon_GetValue(v4, MON_DATA_152, NULL); + v8 = Pokemon_GetValue(v4, MON_DATA_PERSONALITY, NULL); + v7 = Pokemon_GetValue(v4, MON_DATA_OT_ID, NULL); v9 = ARNG_Next((u32)OS_GetTick()); if (v8 == 0x0) { (void)0; } else if (v8 == 0x1) { - while (GetMonPersonalityShininess(v7, v9)) { + while (Pokemon_IsPersonalityShiny(v7, v9)) { v9 = ARNG_Next(v9); } } else { @@ -218,73 +218,73 @@ static void sub_0204BAAC (UnkStruct_0203CDB0 * param0, void * param1) } sub_020780C4(v4, v9); - v10 = GetMonGender(v4); + v10 = Pokemon_GetGender(v4); - SetMonData(v4, 111, (u8 *)&v10); - v10 = GetMonData(v4, MON_DATA_HP_IV, 0) + GetMonData(v4, MON_DATA_ATK_IV, 0) + GetMonData(v4, MON_DATA_DEF_IV, 0) + GetMonData(v4, MON_DATA_SPEED_IV, 0) + GetMonData(v4, MON_DATA_SPATK_IV, 0) + GetMonData(v4, MON_DATA_SPDEF_IV, 0); + Pokemon_SetValue(v4, 111, (u8 *)&v10); + v10 = Pokemon_GetValue(v4, MON_DATA_HP_IV, 0) + Pokemon_GetValue(v4, MON_DATA_ATK_IV, 0) + Pokemon_GetValue(v4, MON_DATA_DEF_IV, 0) + Pokemon_GetValue(v4, MON_DATA_SPEED_IV, 0) + Pokemon_GetValue(v4, MON_DATA_SPATK_IV, 0) + Pokemon_GetValue(v4, MON_DATA_SPDEF_IV, 0); if (v10 == 0) { v8 = LCRNG_Next(); v9 = (v8 & (0x1F << 0)) >> 0; - SetMonData(v4, 70, (u8 *)&v9); + Pokemon_SetValue(v4, 70, (u8 *)&v9); v9 = (v8 & (0x1F << 5)) >> 5; - SetMonData(v4, 71, (u8 *)&v9); + Pokemon_SetValue(v4, 71, (u8 *)&v9); v9 = (v8 & (0x1F << 10)) >> 10; - SetMonData(v4, 72, (u8 *)&v9); + Pokemon_SetValue(v4, 72, (u8 *)&v9); v8 = LCRNG_Next(); v9 = (v8 & (0x1F << 0)) >> 0; - SetMonData(v4, 73, (u8 *)&v9); + Pokemon_SetValue(v4, 73, (u8 *)&v9); v9 = (v8 & (0x1F << 5)) >> 5; - SetMonData(v4, 74, (u8 *)&v9); + Pokemon_SetValue(v4, 74, (u8 *)&v9); v9 = (v8 & (0x1F << 10)) >> 10; - SetMonData(v4, 75, (u8 *)&v9); + Pokemon_SetValue(v4, 75, (u8 *)&v9); } v13 = sub_0202D79C(param0->unk_0C); - if (GetMonData(v4, MON_DATA_46, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_46, 0)) { v13[sub_02092444(73)] = v14[0]; } - if (GetMonData(v4, MON_DATA_47, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_47, 0)) { v13[sub_02092444(74)] = v14[1]; } - if (GetMonData(v4, MON_DATA_48, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_48, 0)) { v13[sub_02092444(75)] = v14[2]; } - if (GetMonData(v4, MON_DATA_49, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_49, 0)) { v13[sub_02092444(76)] = v14[3]; } - if (GetMonData(v4, MON_DATA_50, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_50, 0)) { v13[sub_02092444(77)] = v14[4]; } - if (GetMonData(v4, MON_DATA_51, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_51, 0)) { v13[sub_02092444(78)] = v14[5]; } - if (GetMonData(v4, MON_DATA_52, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_52, 0)) { v13[sub_02092444(79)] = v14[6]; } - if (GetMonData(v4, MON_DATA_MARINE_RIBBON, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_MARINE_RIBBON, 0)) { v13[sub_02092444(25)] = v14[7]; } - if (GetMonData(v4, MON_DATA_LAND_RIBBON, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_LAND_RIBBON, 0)) { v13[sub_02092444(26)] = v14[8]; } - if (GetMonData(v4, MON_DATA_SKY_RIBBON, 0)) { + if (Pokemon_GetValue(v4, MON_DATA_SKY_RIBBON, 0)) { v13[sub_02092444(27)] = v14[9]; } @@ -293,12 +293,12 @@ static void sub_0204BAAC (UnkStruct_0203CDB0 * param0, void * param1) u32 v16 = sub_02025F20(v1); u32 v17 = sub_02025F30(v1); - v6 = AllocMonZeroed(32); + v6 = Pokemon_New(32); - sub_020775EC(v4, v6); - SetMonData(v6, 145, v15); - SetMonData(v6, 7, &v16); - SetMonData(v6, 157, &v17); + Pokemon_Copy(v4, v6); + Pokemon_SetValue(v6, 145, v15); + Pokemon_SetValue(v6, 7, &v16); + Pokemon_SetValue(v6, 157, &v17); v4 = v6; Strbuf_Free(v15); @@ -306,15 +306,15 @@ static void sub_0204BAAC (UnkStruct_0203CDB0 * param0, void * param1) sub_0209304C(v4, v1, 4, sub_02017070(2, v12), 32); - if (GetMonData(v4, MON_DATA_SPECIES, NULL) == 493) { - if (GetMonData(v4, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1) { + if (Pokemon_GetValue(v4, MON_DATA_SPECIES, NULL) == 493) { + if (Pokemon_GetValue(v4, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1) { if (sub_0206B5F8(v2) == 0) { sub_0206B608(v2, 1); } } } - CalculateMonLevelAndStats(v4); + Pokemon_CalcLevelAndStats(v4); v3 = Party_GetFromSavedata(param0->unk_0C); v5 = Party_AddPokemon(v3, v4); @@ -339,7 +339,7 @@ static void sub_0204BDEC (UnkStruct_0204B830 * param0, u16 * param1, u16 * param v1 = (Pokemon *)&v0->val1.unk_04; sub_0200B498(param0->unk_04, 0, sub_02025E38(param0->unk_00->unk_0C)); - sub_0200B578(param0->unk_04, 1, GetBoxMon(v1)); + sub_0200B578(param0->unk_04, 1, Pokemon_GetBoxPokemon(v1)); } static void sub_0204BE2C (UnkStruct_0204B830 * param0, u16 * param1, u16 * param2) @@ -364,7 +364,7 @@ static void sub_0204BE44 (UnkStruct_0204B830 * param0, u16 * param1, u16 * param v1 = (Pokemon *)v0->val2.unk_04; sub_0200B498(param0->unk_04, 0, sub_02025E38(param0->unk_00->unk_0C)); - sub_0200B538(param0->unk_04, 1, GetBoxMon(v1)); + sub_0200B538(param0->unk_04, 1, Pokemon_GetBoxPokemon(v1)); } static BOOL sub_0204BE84 (UnkStruct_0203CDB0 * param0, void * param1) diff --git a/src/unk_0204C500.c b/src/unk_0204C500.c index b82192889e..4b13d2e4e4 100644 --- a/src/unk_0204C500.c +++ b/src/unk_0204C500.c @@ -48,7 +48,7 @@ BOOL sub_0204C500 (UnkStruct_0203E724 * param0) BOOL sub_0204C554 (UnkStruct_0203E724 * param0) { UnkStruct_02024440 * v0 = sub_02024440(param0->unk_34->unk_0C); - Pokemon * v1 = AllocMonZeroed(32); + Pokemon * v1 = Pokemon_New(32); u16 * v2 = inline_0204FCAC(param0); if (sub_0202F028(v0) == 6) { @@ -65,7 +65,7 @@ BOOL sub_0204C59C (UnkStruct_0203E724 * param0) { UnkStruct_02024440 * v0 = sub_02024440(param0->unk_34->unk_0C); UnkStruct_020797DC * v1 = sub_02024420(param0->unk_34->unk_0C); - Pokemon * v2 = AllocMonZeroed(32); + Pokemon * v2 = Pokemon_New(32); UnkStruct_02025E6C * v3 = sub_02025E38(param0->unk_34->unk_0C); UnkStruct_02026324 * v4 = sub_02027560(param0->unk_34->unk_0C); BOOL v5; @@ -74,7 +74,7 @@ BOOL sub_0204C59C (UnkStruct_0203E724 * param0) for (v6 = 0; v6 < 6; v6++) { sub_0202F000(v0, v6, v2); sub_0209304C(v2, v3, 2, 0, 32); - v5 = sub_02079868(v1, GetBoxMon(v2)); + v5 = sub_02079868(v1, Pokemon_GetBoxPokemon(v2)); GF_ASSERT(v5); sub_0202F180(param0->unk_34->unk_0C, v2); } diff --git a/src/unk_0204CFFC.c b/src/unk_0204CFFC.c index f4998248f2..e7b304d025 100644 --- a/src/unk_0204CFFC.c +++ b/src/unk_0204CFFC.c @@ -56,8 +56,8 @@ BOOL sub_0204D08C (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), *v2); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - *v3 = GetMonData(v1, MON_DATA_SPECIES, NULL); + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + *v3 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); } else { *v3 = 0; } @@ -75,7 +75,7 @@ BOOL sub_0204D0E8 (UnkStruct_0203E724 * param0) u16 v5, v6; v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), *v3); - v5 = GetMonData(v1, MON_DATA_OT_ID, NULL); + v5 = Pokemon_GetValue(v1, MON_DATA_OT_ID, NULL); v6 = sub_02025F20(v2); if (v5 == v6) { @@ -103,8 +103,8 @@ BOOL sub_0204D154 (UnkStruct_0203E724 * param0) v1 = Party_GetCurrentCount(v3); if (v1 < 6) { - v4 = AllocMonZeroed(11); - ZeroMonData(v4); + v4 = Pokemon_New(11); + Pokemon_Init(v4); v0 = sub_02017070(1, v8); ov5_021E6CF0(v4, v7, 1, v6, 3, v0); @@ -140,11 +140,11 @@ BOOL sub_0204D234 (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v4); *v2 = 0; - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) != 0) { return 0; } - if ((GetMonData(v1, MON_DATA_MOVE1, NULL) == v3) || (GetMonData(v1, MON_DATA_MOVE2, NULL) == v3) || (GetMonData(v1, MON_DATA_MOVE3, NULL) == v3) || (GetMonData(v1, MON_DATA_MOVE4, NULL) == v3)) { + if ((Pokemon_GetValue(v1, MON_DATA_MOVE1, NULL) == v3) || (Pokemon_GetValue(v1, MON_DATA_MOVE2, NULL) == v3) || (Pokemon_GetValue(v1, MON_DATA_MOVE3, NULL) == v3) || (Pokemon_GetValue(v1, MON_DATA_MOVE4, NULL) == v3)) { *v2 = 1; } @@ -165,11 +165,11 @@ BOOL sub_0204D2D8 (UnkStruct_0203E724 * param0) for (v5 = 0, *v2 = 6; v5 < v6; v5++) { v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v5); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) != 0) { continue; } - if ((GetMonData(v1, MON_DATA_MOVE1, NULL) == v3) || (GetMonData(v1, MON_DATA_MOVE2, NULL) == v3) || (GetMonData(v1, MON_DATA_MOVE3, NULL) == v3) || (GetMonData(v1, MON_DATA_MOVE4, NULL) == v3)) { + if ((Pokemon_GetValue(v1, MON_DATA_MOVE1, NULL) == v3) || (Pokemon_GetValue(v1, MON_DATA_MOVE2, NULL) == v3) || (Pokemon_GetValue(v1, MON_DATA_MOVE3, NULL) == v3) || (Pokemon_GetValue(v1, MON_DATA_MOVE4, NULL) == v3)) { *v2 = v5; break; } @@ -206,8 +206,8 @@ BOOL sub_0204D3DC (UnkStruct_0203E724 * param0) for (v4 = 0, v6 = 0; v4 < v5; v4++) { v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v4); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - if (GetMonData(v1, MON_DATA_LEVEL, NULL) <= v3) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL) <= v3) { v6++; } } @@ -228,8 +228,8 @@ BOOL sub_0204D470 (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v3); *v2 = 0; - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - *v2 = GetMonData(v1, MON_DATA_LEVEL, NULL); + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + *v2 = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); } return 0; @@ -252,12 +252,12 @@ BOOL sub_0204D4CC (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v3); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) != 0) { *v2 = 0; return 0; } - *v2 = GetMonNature(v1); + *v2 = Pokemon_GetNature(v1); return 0; } @@ -276,8 +276,8 @@ BOOL sub_0204D540 (UnkStruct_0203E724 * param0) for (v5 = 0; v5 < v4; v5++) { v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v5); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - if (GetMonNature(v1) == v3) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetNature(v1) == v3) { *v2 = v5; break; } @@ -295,7 +295,7 @@ BOOL sub_0204D5CC (UnkStruct_0203E724 * param0) u16 v3 = inline_02049538(param0); v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v3); - *v2 = GetMonData(v1, MON_DATA_FRIENDSHIP, NULL); + *v2 = Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL); return 0; } @@ -310,18 +310,18 @@ BOOL sub_0204D614 (UnkStruct_0203E724 * param0) u32 v5 = sub_0203A138(param0->unk_34->unk_1C->unk_00); v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v3); - v4 = GetMonData(v1, MON_DATA_FRIENDSHIP, NULL); + v4 = Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL); if (v2 > 0) { - if (Item_LoadParam(GetMonData(v1, MON_DATA_HELD_ITEM, NULL), 1, 11) == 53) { + if (Item_LoadParam(Pokemon_GetValue(v1, MON_DATA_HELD_ITEM, NULL), 1, 11) == 53) { v2 = v2 * 150 / 100; } - if (GetMonData(v1, MON_DATA_POKEBALL, NULL) == 11) { + if (Pokemon_GetValue(v1, MON_DATA_POKEBALL, NULL) == 11) { v2++; } - if (GetMonData(v1, MON_DATA_152, NULL) == v5) { + if (Pokemon_GetValue(v1, MON_DATA_152, NULL) == v5) { v2++; } } @@ -332,7 +332,7 @@ BOOL sub_0204D614 (UnkStruct_0203E724 * param0) v4 = 255; } - SetMonData(v1, 9, &v4); + Pokemon_SetValue(v1, 9, &v4); return 0; } @@ -345,7 +345,7 @@ BOOL sub_0204D6E4 (UnkStruct_0203E724 * param0) u16 v4; v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v3); - v4 = GetMonData(v1, MON_DATA_FRIENDSHIP, NULL); + v4 = Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL); if (v2 > v4) { v4 = 0; @@ -353,7 +353,7 @@ BOOL sub_0204D6E4 (UnkStruct_0203E724 * param0) v4 -= v2; } - SetMonData(v1, 9, &v4); + Pokemon_SetValue(v1, 9, &v4); return 0; } @@ -365,7 +365,7 @@ BOOL sub_0204D74C (UnkStruct_0203E724 * param0) u16 * v3 = inline_0204FCAC(param0); v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v1); - *v3 = GetMonData(v0, MON_DATA_COOL + v2, NULL); + *v3 = Pokemon_GetValue(v0, MON_DATA_COOL + v2, NULL); return 0; } @@ -387,8 +387,8 @@ BOOL sub_0204D7D4 (UnkStruct_0203E724 * param0) u16 v4 = inline_02049538(param0); v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v4); - *v2 = GetMonData(v1, MON_DATA_177, NULL); - *v3 = GetMonData(v1, MON_DATA_178, NULL); + *v2 = Pokemon_GetValue(v1, MON_DATA_177, NULL); + *v3 = Pokemon_GetValue(v1, MON_DATA_178, NULL); return 0; } @@ -418,7 +418,7 @@ BOOL sub_0204D86C (UnkStruct_0203E724 * param0) for (v2 = 0, v1 = 0; v2 < v0; v2++) { v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v4->unk_0C), v2); - if (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) { v1++; } } @@ -445,8 +445,8 @@ BOOL sub_0204D8C4 (UnkStruct_0203E724 * param0) v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v4->unk_0C), v2); - if (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) { - if (GetMonData(v3, MON_DATA_CURRENT_HP, NULL) != 0) { + if (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL) != 0) { v1++; } } @@ -470,8 +470,8 @@ BOOL sub_0204D94C (UnkStruct_0203E724 * param0) for (v2 = 0, v1 = 0; v2 < v0; v2++) { v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v4->unk_0C), v2); - if (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) { - if (GetMonData(v3, MON_DATA_CURRENT_HP, NULL) != 0) { + if (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(v3, MON_DATA_CURRENT_HP, NULL) != 0) { v1++; } } @@ -495,7 +495,7 @@ BOOL sub_0204D9C8 (UnkStruct_0203E724 * param0) for (v2 = 0, v1 = 0; v2 < v0; v2++) { v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v4->unk_0C), v2); - if (GetMonData(v3, MON_DATA_IS_EGG, NULL)) { + if (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL)) { v1++; } } @@ -520,7 +520,7 @@ BOOL sub_0204DA20 (UnkStruct_0203E724 * param0) for (v0 = 0; v0 < v1; v0++) { v4 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v5->unk_0C), v0); - v3 = GetMonData(v4, MON_DATA_POKERUS, NULL); + v3 = Pokemon_GetValue(v4, MON_DATA_POKERUS, NULL); if (v3 != 0) { *v2 = 1; @@ -538,7 +538,7 @@ BOOL sub_0204DA84 (UnkStruct_0203E724 * param0) u16 * v2 = inline_0204FCAC(param0); v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v1); - *v2 = GetMonData(v0, MON_DATA_GENDER, NULL); + *v2 = Pokemon_GetValue(v0, MON_DATA_GENDER, NULL); return 0; } @@ -553,26 +553,26 @@ BOOL sub_0204DACC (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v3); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) != 0) { *v2 = 0; return 0; } v4 = 0; - if ((GetMonData(v1, MON_DATA_MOVE1, NULL) != 0)) { + if ((Pokemon_GetValue(v1, MON_DATA_MOVE1, NULL) != 0)) { v4++; } - if ((GetMonData(v1, MON_DATA_MOVE2, NULL) != 0)) { + if ((Pokemon_GetValue(v1, MON_DATA_MOVE2, NULL) != 0)) { v4++; } - if ((GetMonData(v1, MON_DATA_MOVE3, NULL) != 0)) { + if ((Pokemon_GetValue(v1, MON_DATA_MOVE3, NULL) != 0)) { v4++; } - if ((GetMonData(v1, MON_DATA_MOVE4, NULL) != 0)) { + if ((Pokemon_GetValue(v1, MON_DATA_MOVE4, NULL) != 0)) { v4++; } @@ -590,7 +590,7 @@ BOOL sub_0204DB74 (UnkStruct_0203E724 * param0) u16 v5 = inline_02049538(param0); v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v4); - DeleteMonMove(v1, v5); + Pokemon_ClearMoveSlot(v1, v5); return 0; } @@ -604,7 +604,7 @@ BOOL sub_0204DBB8 (UnkStruct_0203E724 * param0) u16 v4 = inline_02049538(param0); v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v3); - *v2 = GetMonData(v1, MON_DATA_MOVE1 + v4, NULL); + *v2 = Pokemon_GetValue(v1, MON_DATA_MOVE1 + v4, NULL); return 0; } @@ -617,7 +617,7 @@ BOOL sub_0204DC18 (UnkStruct_0203E724 * param0) u16 v3 = inline_02049538(param0); v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v3); - *v2 = GetMonData(v1, MON_DATA_HELD_ITEM, NULL); + *v2 = Pokemon_GetValue(v1, MON_DATA_HELD_ITEM, NULL); return 0; } @@ -632,7 +632,7 @@ BOOL sub_0204DC60 (UnkStruct_0203E724 * param0) v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v2); v3 = 0; - SetMonData(v1, 6, &v3); + Pokemon_SetValue(v1, 6, &v3); return 0; } @@ -654,8 +654,8 @@ BOOL sub_0204DC98 (UnkStruct_0203E724 * param0) for (v5 = 0; v5 < v6; v5++) { v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v5); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - v7 = GetMonData(v1, MON_DATA_SPECIES, NULL); + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + v7 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); if (v4 == v7) { *v3 = 1; @@ -689,8 +689,8 @@ BOOL sub_0204DD28 (UnkStruct_0203E724 * param0) for (v5 = 0; v5 < v7; v5++) { v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v5); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - v8 = GetMonData(v1, MON_DATA_SPECIES, NULL); + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + v8 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); if (v4 == 0) { v9[v5] = v8; @@ -729,8 +729,8 @@ BOOL sub_0204DE00 (UnkStruct_0203E724 * param0) for (v5 = 0; v5 < v6; v5++) { v1 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v0->unk_0C), v5); - if (GetMonData(v1, MON_DATA_IS_EGG, NULL) == 0) { - v7 = GetMonData(v1, MON_DATA_SPECIES, NULL); + if (Pokemon_GetValue(v1, MON_DATA_IS_EGG, NULL) == 0) { + v7 = Pokemon_GetValue(v1, MON_DATA_SPECIES, NULL); if (v4 == v7) { *v3 = v5; @@ -752,7 +752,7 @@ BOOL sub_0204DE94 (UnkStruct_0203E724 * param0) v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v2); for (v3 = 0, v4 = 0; v3 < 80; v3++) { - if (GetMonData(v0, sub_020923C0(v3, 0), NULL) != 0) { + if (Pokemon_GetValue(v0, sub_020923C0(v3, 0), NULL) != 0) { v4++; } } @@ -776,8 +776,8 @@ BOOL sub_0204DF08 (UnkStruct_0203E724 * param0) for (v4 = 0; v4 < v6; v4++) { v0 = Party_GetPokemonBySlotIndex(v1, v4); - if (GetMonData(v0, MON_DATA_IS_EGG, NULL) == 0) { - if (GetMonData(v0, sub_020923C0(v3, 0), NULL) != 0) { + if (Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(v0, sub_020923C0(v3, 0), NULL) != 0) { v5++; break; } @@ -799,7 +799,7 @@ BOOL sub_0204DFB0 (UnkStruct_0203E724 * param0) u8 v4 = 1; v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v2); - *v1 = GetMonData(v0, sub_020923C0(v3, 0), NULL); + *v1 = Pokemon_GetValue(v0, sub_020923C0(v3, 0), NULL); return 0; } @@ -813,7 +813,7 @@ BOOL sub_0204E01C (UnkStruct_0203E724 * param0) v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0->unk_34->unk_0C), v1); - SetMonData(v0, sub_020923C0(v2, 0), &v3); + Pokemon_SetValue(v0, sub_020923C0(v2, 0), &v3); sub_0206DDB8(param0->unk_34->unk_0C, v0, sub_020923C0(v2, 0)); return 0; @@ -833,8 +833,8 @@ BOOL sub_0204E094 (UnkStruct_0203E724 * param0) for (v4 = 0; v4 < v5; v4++) { v0 = Party_GetPokemonBySlotIndex(v1, v4); - if (GetMonData(v0, MON_DATA_IS_EGG, NULL) != 0) { - if (GetMonData(v0, MON_DATA_3, NULL) != 0) { + if (Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v0, MON_DATA_3, NULL) != 0) { *v2 = 1; return 0; } @@ -869,11 +869,11 @@ BOOL sub_0204E12C (UnkStruct_0203E724 * param0) for (v0 = 0; v0 < v1; v0++) { v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v5->unk_0C), v0); - if (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) { - v2 = GetMonData(v3, MON_DATA_SPECIES, NULL); + if (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) { + v2 = Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL); if (v7 == v2) { - if (GetMonData(v3, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1) { + if (Pokemon_GetValue(v3, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1) { *v6 = v0; break; } @@ -900,7 +900,7 @@ BOOL sub_0204E1D0 (UnkStruct_0203E724 * param0) for (v0 = 0; v0 < v1; v0++) { v3 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(v4->unk_0C), v0); - if (GetMonData(v3, MON_DATA_HELD_ITEM, NULL) == v5) { + if (Pokemon_GetValue(v3, MON_DATA_HELD_ITEM, NULL) == v5) { *v6 = 1; break; } diff --git a/src/unk_0204F13C.c b/src/unk_0204F13C.c index bfbe4fce46..c759e3aebb 100644 --- a/src/unk_0204F13C.c +++ b/src/unk_0204F13C.c @@ -176,10 +176,10 @@ static BOOL sub_0204F268 (u16 param0, UnkStruct_021C0794 * param1) for (v0 = 0, v2 = 0; v0 < v3; v0++) { v7 = Party_GetPokemonBySlotIndex(v6, v0); - v4 = GetMonData(v7, MON_DATA_SPECIES, NULL); - v5 = GetMonData(v7, MON_DATA_LEVEL, NULL); + v4 = Pokemon_GetValue(v7, MON_DATA_SPECIES, NULL); + v5 = Pokemon_GetValue(v7, MON_DATA_LEVEL, NULL); - if (GetMonData(v7, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v7, MON_DATA_IS_EGG, NULL) != 0) { continue; } diff --git a/src/unk_02050A74.c b/src/unk_02050A74.c index 5d42bc8df6..25b7ba2c7b 100644 --- a/src/unk_02050A74.c +++ b/src/unk_02050A74.c @@ -596,7 +596,7 @@ void sub_020512E4 (UnkStruct_020508D4 * param0, u16 param1, u8 param2, int * par v4 = 1; v3 = Party_GetPokemonBySlotIndex(v1->parties[1], 0); - SetMonData(v3, 110, &v4); + Pokemon_SetValue(v3, 110, &v4); if (param4) { v1->unk_164 |= 0x8; @@ -933,7 +933,7 @@ static void sub_020518B0 (UnkStruct_0203CDB0 * param0, BattleParams * param1) } else if (v2 == 0x4) { v0 = Party_GetPokemonBySlotIndex(param1->parties[1], 0); - if (sub_0207A294(0, GetMonData(v0, MON_DATA_SPECIES, 0))) { + if (sub_0207A294(0, Pokemon_GetValue(v0, MON_DATA_SPECIES, 0))) { sub_0202CFEC(sub_0202CD88(param0->unk_0C), 9); } else { sub_0202CFEC(sub_0202CD88(param0->unk_0C), 10); @@ -947,7 +947,7 @@ static void sub_020518B0 (UnkStruct_0203CDB0 * param0, BattleParams * param1) if (v2 == 0x4) { v0 = Party_GetPokemonBySlotIndex(param1->parties[1], 0); - if (sub_0207A294(0, GetMonData(v0, MON_DATA_SPECIES, 0))) { + if (sub_0207A294(0, Pokemon_GetValue(v0, MON_DATA_SPECIES, 0))) { sub_0202CFEC(sub_0202CD88(param0->unk_0C), 9); } else { sub_0202CFEC(sub_0202CD88(param0->unk_0C), 10); @@ -985,7 +985,7 @@ static void sub_02051988 (UnkStruct_0203CDB0 * param0, BattleParams * param1) if (param0->unk_78.unk_02 >= 5) { v0 = Party_GetPokemonBySlotIndex(param1->parties[1], 0); - v3 = sub_0202BECC(sub_02025E5C(param0->unk_0C), GetMonData(v0, MON_DATA_SPECIES, 0), GetMonData(v0, MON_DATA_GENDER, 0), param1->unk_138, 11); + v3 = sub_0202BECC(sub_02025E5C(param0->unk_0C), Pokemon_GetValue(v0, MON_DATA_SPECIES, 0), Pokemon_GetValue(v0, MON_DATA_GENDER, 0), param1->unk_138, 11); sub_0202B758(param0->unk_9C, v3, 2); } } else if (v2 == 0x4) { @@ -993,7 +993,7 @@ static void sub_02051988 (UnkStruct_0203CDB0 * param0, BattleParams * param1) v4 = param1->unk_148; v0 = Party_GetPokemonBySlotIndex(param1->parties[v4], 0); - v3 = sub_0202BE4C(sub_02025E5C(param0->unk_0C), GetMonData(v0, MON_DATA_SPECIES, 0), GetMonData(v0, MON_DATA_GENDER, 0), param1->unk_138, 11); + v3 = sub_0202BE4C(sub_02025E5C(param0->unk_0C), Pokemon_GetValue(v0, MON_DATA_SPECIES, 0), Pokemon_GetValue(v0, MON_DATA_GENDER, 0), param1->unk_138, 11); sub_0202B758(param0->unk_9C, v3, 2); } @@ -1022,7 +1022,7 @@ void sub_02051ABC (UnkStruct_020508D4 * param0, u16 param1, u8 param2, int * par Pokemon * v3; v3 = Party_GetPokemonBySlotIndex(v1->parties[1], 0); - SetGiratinaOriginForm(v3); + Pokemon_SetGiratinaOriginForm(v3); } if (param4) { diff --git a/src/unk_02051D8C.c b/src/unk_02051D8C.c index a612357999..cfca4a803f 100644 --- a/src/unk_02051D8C.c +++ b/src/unk_02051D8C.c @@ -178,7 +178,7 @@ BattleParams * sub_02051F4C (int param0, const UnkStruct_0203CDB0 * param1) v4->unk_138 = sub_02055BA8(param1); sub_0207D570(v4->unk_E0, 4, 20, param0); - v5 = AllocMonZeroed(param0); + v5 = Pokemon_New(param0); sub_02073D80(v5, sub_0206B08C(sub_020507E4(param1->unk_0C)), 5, 32, 0, 0, 2, 0); Party_AddPokemon(v4->parties[0], v5); @@ -319,17 +319,17 @@ void sub_02052348 (BattleParams * param0, const UnkStruct_0203CDB0 * param1, int param0->unk_12C = 9; sub_02052184(param0, v2, 0); - v8 = AllocMonZeroed(11); + v8 = Pokemon_New(11); Party_InitWithCapacity(param0->parties[0], Party_GetCurrentCount(v3)); for (v0 = 0; v0 < Party_GetCurrentCount(v3); v0++) { - sub_020775EC(Party_GetPokemonBySlotIndex(v3, v0), v8); + Pokemon_Copy(Party_GetPokemonBySlotIndex(v3, v0), v8); - if ((GetMonData(v8, MON_DATA_LEVEL, NULL) != param2) && (param2 != 0)) { - v1 = GetMonSpeciesLevelExp(GetMonData(v8, MON_DATA_SPECIES, NULL), param2); + if ((Pokemon_GetValue(v8, MON_DATA_LEVEL, NULL) != param2) && (param2 != 0)) { + v1 = Pokemon_GetSpeciesBaseExpAt(Pokemon_GetValue(v8, MON_DATA_SPECIES, NULL), param2); - SetMonData(v8, 8, &v1); - CalculateMonLevelAndStats(v8); + Pokemon_SetValue(v8, 8, &v1); + Pokemon_CalcLevelAndStats(v8); } sub_0205213C(param0, v8, 0); @@ -388,11 +388,11 @@ void sub_020524E4 (BattleParams * param0, const UnkStruct_0203CDB0 * param1, con if (v10 == 0) { sub_02052164(param0, param2, 0); } else { - v9 = AllocMonZeroed(11); + v9 = Pokemon_New(11); Party_InitWithCapacity(param0->parties[0], v10); for (v8 = 0; v8 < v10; v8++) { - sub_020775EC(Party_GetPokemonBySlotIndex(param2, param3[v8] - 1), v9); + Pokemon_Copy(Party_GetPokemonBySlotIndex(param2, param3[v8] - 1), v9); sub_0205213C(param0, v9, 0); } diff --git a/src/unk_020528D0.c b/src/unk_020528D0.c index c891d26f66..f05df5bcf4 100644 --- a/src/unk_020528D0.c +++ b/src/unk_020528D0.c @@ -220,7 +220,7 @@ BOOL sub_02052B2C (UnkStruct_020508D4 * param0) case 0: { if ((v0 != NULL) && (v0->unk_0C != NULL)) { - SetPartyGiratinaForm(Party_GetFromSavedata(v0->unk_0C), 0); + Party_SetGiratinaForm(Party_GetFromSavedata(v0->unk_0C), 0); } } diff --git a/src/unk_02054884.c b/src/unk_02054884.c index ddcaeb4dff..3a8ffeb6cd 100644 --- a/src/unk_02054884.c +++ b/src/unk_02054884.c @@ -17,11 +17,11 @@ BOOL sub_02054884 (Pokemon * param0) { - if (GetMonData(param0, MON_DATA_CURRENT_HP, NULL) == 0) { + if (Pokemon_GetValue(param0, MON_DATA_CURRENT_HP, NULL) == 0) { return 0; } - if (GetMonData(param0, MON_DATA_IS_EGG, NULL)) { + if (Pokemon_GetValue(param0, MON_DATA_IS_EGG, NULL)) { return 0; } @@ -38,14 +38,14 @@ BOOL sub_020548B0 (int param0, UnkStruct_021C0794 * param1, u16 param2, u8 param v4 = sub_02025E38(param1); v3 = Party_GetFromSavedata(param1); - v1 = AllocMonZeroed(param0); + v1 = Pokemon_New(param0); - ZeroMonData(v1); + Pokemon_Init(v1); sub_02073D80(v1, param2, param3, 32, 0, 0, 0, 0); sub_02077E64(v1, v4, 4, param5, param6, param0); v2 = param4; - SetMonData(v1, 6, &v2); + Pokemon_SetValue(v1, 6, &v2); v0 = Party_AddPokemon(v3, v1); if (v0) { @@ -63,9 +63,9 @@ BOOL sub_02054930 (int param0, UnkStruct_021C0794 * param1, u16 param2, u8 param BOOL v1; UnkStruct_02025E6C * v2 = sub_02025E38(param1); Party * v3 = Party_GetFromSavedata(param1); - Pokemon * v4 = AllocMonZeroed(32); + Pokemon * v4 = Pokemon_New(32); - ZeroMonData(v4); + Pokemon_Init(v4); v0 = sub_02017070(param4, param5); ov5_021E6CF0(v4, param2, param3, v2, 4, v0); @@ -78,7 +78,7 @@ BOOL sub_02054930 (int param0, UnkStruct_021C0794 * param1, u16 param2, u8 param void sub_02054988 (Party * param0, int param1, int param2, u16 param3) { - ResetMonMove(Party_GetPokemonBySlotIndex(param0, param1), param3, param2); + Pokemon_ResetMoveSlot(Party_GetPokemonBySlotIndex(param0, param1), param3, param2); } int sub_020549A0 (Party * param0, u16 param1) @@ -91,11 +91,11 @@ int sub_020549A0 (Party * param0, u16 param1) for (v0 = 0; v0 < v1; v0++) { v2 = Party_GetPokemonBySlotIndex(param0, v0); - if (GetMonData(v2, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v2, MON_DATA_IS_EGG, NULL) != 0) { continue; } - if ((GetMonData(v2, MON_DATA_MOVE1, NULL) == param1) || (GetMonData(v2, MON_DATA_MOVE2, NULL) == param1) || (GetMonData(v2, MON_DATA_MOVE3, NULL) == param1) || (GetMonData(v2, MON_DATA_MOVE4, NULL) == param1)) { + if ((Pokemon_GetValue(v2, MON_DATA_MOVE1, NULL) == param1) || (Pokemon_GetValue(v2, MON_DATA_MOVE2, NULL) == param1) || (Pokemon_GetValue(v2, MON_DATA_MOVE3, NULL) == param1) || (Pokemon_GetValue(v2, MON_DATA_MOVE4, NULL) == param1)) { return v0; break; } @@ -152,7 +152,7 @@ Pokemon * sub_02054A74 (const Party * param0) for (v0 = 0; v0 < v1; v0++) { v2 = Party_GetPokemonBySlotIndex(param0, v0); - if (GetMonData(v2, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(v2, MON_DATA_IS_EGG, NULL) == 0) { return v2; } } @@ -180,8 +180,8 @@ void sub_02054AC4 (Party * param0) for (v0 = 0; v0 < v1; v0++) { v3 = Party_GetPokemonBySlotIndex(param0, v0); - if (GetMonData(v3, MON_DATA_IS_EGG, NULL) == 0) { - SetMonData(v3, 25, &v2); + if (Pokemon_GetValue(v3, MON_DATA_IS_EGG, NULL) == 0) { + Pokemon_SetValue(v3, 25, &v2); } } } @@ -199,14 +199,14 @@ int sub_02054B04 (Party * param0, u16 param1) v4 = Party_GetPokemonBySlotIndex(param0, v2); if (sub_02054884(v4)) { - if (GetMonData(v4, MON_DATA_160, NULL) & (0x80 | 0x8)) { - u32 v5 = GetMonData(v4, MON_DATA_CURRENT_HP, NULL); + if (Pokemon_GetValue(v4, MON_DATA_160, NULL) & (0x80 | 0x8)) { + u32 v5 = Pokemon_GetValue(v4, MON_DATA_CURRENT_HP, NULL); if (v5 > 1) { v5--; } - SetMonData(v4, 163, &v5); + Pokemon_SetValue(v4, 163, &v5); if (v5 == 1) { v1++; @@ -229,10 +229,10 @@ int sub_02054B04 (Party * param0, u16 param1) BOOL sub_02054B94 (Pokemon * param0) { - if ((GetMonData(param0, MON_DATA_160, NULL) & (0x80 | 0x8)) && (GetMonData(param0, MON_DATA_CURRENT_HP, NULL) == 1)) { + if ((Pokemon_GetValue(param0, MON_DATA_160, NULL) & (0x80 | 0x8)) && (Pokemon_GetValue(param0, MON_DATA_CURRENT_HP, NULL) == 1)) { u32 v0 = 0; - SetMonData(param0, 160, &v0); + Pokemon_SetValue(param0, 160, &v0); return 1; } diff --git a/src/unk_020559DC.c b/src/unk_020559DC.c index 70c636cb71..5a4cbe421c 100644 --- a/src/unk_020559DC.c +++ b/src/unk_020559DC.c @@ -147,7 +147,7 @@ static void sub_02055B64 (UnkStruct_0203CDB0 * param0, s32 param1, const RTCTime Party * v1; v1 = Party_GetFromSavedata(param0->unk_0C); - SetPartyShayminForm(v1, param1, param2); + Party_SetShayminForm(v1, param1, param2); } } diff --git a/src/unk_020562F8.c b/src/unk_020562F8.c index e694b4e1f9..bde534635e 100644 --- a/src/unk_020562F8.c +++ b/src/unk_020562F8.c @@ -141,13 +141,13 @@ static void sub_0205642C (UnkStruct_0203CDB0 * param0, UnkStruct_020564B4 * para UnkStruct_02024440 * v4; v4 = sub_02024440(param0->unk_0C); - v3 = AllocMonZeroed(4); + v3 = Pokemon_New(4); for (v0 = 0; v0 < 6; v0++) { param1->unk_30[v0] = 0; sub_0202F000(v4, v0, v3); - v2 = GetMonData(v3, MON_DATA_SPECIES, NULL); + v2 = Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL); param1->unk_00[v0].unk_00 = v2; sub_02056400(v2, v1); @@ -160,8 +160,8 @@ static void sub_0205642C (UnkStruct_0203CDB0 * param0, UnkStruct_020564B4 * para param1->unk_00[v0].unk_03 = v1[3]; param1->unk_00[v0].unk_04 = v1[2]; - param1->unk_00[v0].unk_06 = GetMonData(v3, MON_DATA_177, NULL); - param1->unk_00[v0].unk_07 = GetMonData(v3, MON_DATA_178, NULL); + param1->unk_00[v0].unk_06 = Pokemon_GetValue(v3, MON_DATA_177, NULL); + param1->unk_00[v0].unk_07 = Pokemon_GetValue(v3, MON_DATA_178, NULL); } Heap_FreeToHeap(v3); @@ -274,7 +274,7 @@ static void sub_02056624 (UnkStruct_0203CDB0 * param0, BattleParams * param1, Un static BattleParams * sub_0205664C (UnkStruct_0203CDB0 * param0, UnkStruct_020564B4 * param1) { BattleParams * v0; - Pokemon * v1 = AllocMonZeroed(32); + Pokemon * v1 = Pokemon_New(32); UnkStruct_02024440 * v2 = sub_02024440(param0->unk_0C); int v3 = sub_020563BC(param0); diff --git a/src/unk_02056720.c b/src/unk_02056720.c index ffa186dc3b..d7ef8fe97f 100644 --- a/src/unk_02056720.c +++ b/src/unk_02056720.c @@ -302,9 +302,9 @@ void sub_02056A48 (UnkStruct_02056B24 * param0, const BoxPokemon * param1) v0 = 12 - 1; } - param0->unk_B8[v0].unk_00 = GetBoxMonData((BoxPokemon *)param1, MON_DATA_SPECIES, NULL); + param0->unk_B8[v0].unk_00 = BoxPokemon_GetValue((BoxPokemon *)param1, MON_DATA_SPECIES, NULL); param0->unk_B8[v0].unk_02 = sub_02079E44(param1); - param0->unk_B8[v0].unk_04 = GetBoxMonData((BoxPokemon *)param1, MON_DATA_FORM, NULL); + param0->unk_B8[v0].unk_04 = BoxPokemon_GetValue((BoxPokemon *)param1, MON_DATA_FORM, NULL); } int sub_02056AAC (const UnkStruct_02056B24 * param0) diff --git a/src/unk_0205A0D8.c b/src/unk_0205A0D8.c index 6d51271ff4..54337667d3 100644 --- a/src/unk_0205A0D8.c +++ b/src/unk_0205A0D8.c @@ -520,7 +520,7 @@ static BOOL sub_0205A324 (UnkStruct_020508D4 * param0) } break; case 36: - sub_0200B538(v0->unk_28, 1, GetBoxMon(Party_GetPokemonBySlotIndex(v0->unk_50, v0->unk_84))); + sub_0200B538(v0->unk_28, 1, Pokemon_GetBoxPokemon(Party_GetPokemonBySlotIndex(v0->unk_50, v0->unk_84))); MessageLoader_GetStrbuf(v0->unk_2C, 18, v0->unk_0C); sub_0200C388(v0->unk_28, v0->unk_10, v0->unk_0C); v0->unk_30 = sub_0205AA50(v0, v0->unk_10); @@ -758,7 +758,7 @@ static void sub_0205AC80 (UnkStruct_0205A0D8 * param0, BOOL param1) v0 = Party_GetFromSavedata(param0->unk_24->unk_0C); v2 = param0->unk_4C; - v4 = GetPokemonStructSize(); + v4 = Pokemon_GetStructSize(); v1 = (UnkStruct_0205AD20 *)(v2 + v4 * 3); v1->unk_00 = param1; @@ -809,7 +809,7 @@ static BOOL sub_0205AD20 (UnkStruct_0205A0D8 * param0) { UnkStruct_0205AD20 * v0; - v0 = (UnkStruct_0205AD20 *)((u8 *)(param0->unk_48) + (GetPokemonStructSize() * 3)); + v0 = (UnkStruct_0205AD20 *)((u8 *)(param0->unk_48) + (Pokemon_GetStructSize() * 3)); return v0->unk_00; } @@ -844,7 +844,7 @@ static void sub_0205AD80 (UnkStruct_0205A0D8 * param0) u32 v0; int v1; - v0 = GetPokemonStructSize(); + v0 = Pokemon_GetStructSize(); Party_InitWithCapacity(param0->unk_50, 3); for (v1 = 0; v1 < 3; v1++) { @@ -858,7 +858,7 @@ static void sub_0205ADAC (UnkStruct_0205A0D8 * param0) u8 * v1, * v2; int v3; - v0 = GetPokemonStructSize(); + v0 = Pokemon_GetStructSize(); v1 = ¶m0->unk_4C[param0->unk_85 * v0]; v2 = ¶m0->unk_48[param0->unk_84 * v0]; @@ -880,14 +880,14 @@ static void sub_0205ADF8 (UnkStruct_0205A0D8 * param0, int param1) MessageLoader * v4; v4 = MessageLoader_Init(1, 26, 412, 4); - v3 = GetPokemonStructSize(); + v3 = Pokemon_GetStructSize(); sub_0201A7E8(param0->unk_24->unk_08, v0, 3, 21, 9, 10, 8, 13, 10); sub_0200DAA4(param0->unk_24->unk_08, 3, 1, 11, 0, 4); sub_0201ADA4(v0, 15); for (v1 = 0; v1 < 3; v1++) { - v2 = GetMonData((Pokemon *)(¶m0->unk_48[v1 * v3]), MON_DATA_SPECIES, NULL); + v2 = Pokemon_GetValue((Pokemon *)(¶m0->unk_48[v1 * v3]), MON_DATA_SPECIES, NULL); MessageLoader_GetStrbuf(v4, v2, param0->unk_0C); sub_0201D738(v0, 0, param0->unk_0C, 16, v1 * 16, 0xff, NULL); @@ -988,7 +988,7 @@ void sub_0205B0C0 (int param0, int param1, void * param2, void * param3) int sub_0205B0E4 (void) { - return GetPokemonStructSize() * 3 + sizeof(UnkStruct_0205AD20); + return Pokemon_GetStructSize() * 3 + sizeof(UnkStruct_0205AD20); } u8 * sub_0205B0F4 (int param0, void * param1, int param2) diff --git a/src/unk_0205DFC4.c b/src/unk_0205DFC4.c index 1367eab11f..b2da15b6a2 100644 --- a/src/unk_0205DFC4.c +++ b/src/unk_0205DFC4.c @@ -251,7 +251,7 @@ u16 sub_0205E1B4 (UnkStruct_021C0794 * param0) for (v1 = 0; v1 < v2; v1++) { v0 = Party_GetPokemonBySlotIndex(Party_GetFromSavedata(param0), v1); - if (GetMonData(v0, MON_DATA_IS_EGG, NULL) == 0) { + if (Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL) == 0) { return v1; } } @@ -270,7 +270,7 @@ BOOL HasAllLegendaryTitansInParty (UnkStruct_021C0794 * param0) v2 = Party_GetCurrentCount(v4); for (v0 = 0; v0 < v2; v0++) { - v6[v0] = GetMonData(Party_GetPokemonBySlotIndex(v4, v0), MON_DATA_SPECIES, NULL); + v6[v0] = Pokemon_GetValue(Party_GetPokemonBySlotIndex(v4, v0), MON_DATA_SPECIES, NULL); } for (v0 = 0; v0 < 3; v0++) { diff --git a/src/unk_0206C660.c b/src/unk_0206C660.c index 818c755720..07188cda3a 100644 --- a/src/unk_0206C660.c +++ b/src/unk_0206C660.c @@ -97,8 +97,8 @@ void sub_0206C740 (UnkStruct_020508D4 * param0, UnkStruct_ov6_02246204 * param1, v0->unk_04 = 0; v0->unk_00 = param1; v0->unk_08 = param2; - v0->unk_24 = AllocMonZeroed(param3); - v0->unk_28 = AllocMonZeroed(param3); + v0->unk_24 = Pokemon_New(param3); + v0->unk_28 = Pokemon_New(param3); sub_02050944(param0, sub_0206C680, v0); } diff --git a/src/unk_0206CCB0.c b/src/unk_0206CCB0.c index 9031bea118..f99613f753 100644 --- a/src/unk_0206CCB0.c +++ b/src/unk_0206CCB0.c @@ -474,17 +474,17 @@ static void sub_0206CE08 (int param0, u16 * param1, Pokemon * param2) { Strbuf* v0 = Strbuf_Init(64, param0); - GetMonData(param2, MON_DATA_119, v0); + Pokemon_GetValue(param2, MON_DATA_119, v0); Strbuf_ToChars(v0, param1, 10 + 1); Strbuf_Free(v0); } static void sub_0206CE38 (Pokemon * param0, u16 * param1, u8 * param2, u8 * param3, u8 * param4) { - *param1 = GetMonData(param0, MON_DATA_SPECIES, NULL); - *param2 = GetMonData(param0, MON_DATA_GENDER, NULL); - *param3 = GetMonData(param0, MON_DATA_LANGUAGE, NULL); - *param4 = GetMonData(param0, MON_DATA_MET_GAME, NULL); + *param1 = Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); + *param2 = Pokemon_GetValue(param0, MON_DATA_GENDER, NULL); + *param3 = Pokemon_GetValue(param0, MON_DATA_LANGUAGE, NULL); + *param4 = Pokemon_GetValue(param0, MON_DATA_MET_GAME, NULL); } static void sub_0206CE74 (UnkStruct_0200B358 * param0, int param1, u16 param2, u8 param3, u8 param4, u8 param5) @@ -505,12 +505,12 @@ static void sub_0206CEA4 (UnkStruct_0200B358 * param0, int param1, u16 param2) static void sub_0206CED0 (int param0, Pokemon * param1, u8 * param2, u16 * param3) { - *param2 = GetMonData(param1, MON_DATA_77, NULL); + *param2 = Pokemon_GetValue(param1, MON_DATA_77, NULL); if (*param2) { Strbuf* v0 = Strbuf_Init(64, param0); - GetMonData(param1, MON_DATA_119, v0); + Pokemon_GetValue(param1, MON_DATA_119, v0); Strbuf_ToChars(v0, param3, 10 + 1); Strbuf_Free(v0); } @@ -535,10 +535,10 @@ void sub_0206CF48 (UnkStruct_0202440C * param0, Pokemon * param1, int param2) v0->unk_00 = 1; v0->unk_1F = 0; - v0->unk_1E = GetMonNature(param1); + v0->unk_1E = Pokemon_GetNature(param1); sub_0206CE38(param1, &v0->unk_02, &v0->unk_04, &v0->unk_05, &v0->unk_06); - v0->unk_07 = GetMonData(param1, MON_DATA_77, NULL); + v0->unk_07 = Pokemon_GetValue(param1, MON_DATA_77, NULL); sub_0206CED0(param2, param1, &v0->unk_07, v0->unk_08); sub_02025C84(27); @@ -613,7 +613,7 @@ void sub_0206D048 (UnkStruct_0202440C * param0, Pokemon * param1) v0->unk_00 = 1; sub_0206CE38(param1, &v0->unk_02, &v0->unk_04, &v0->unk_05, &v0->unk_06); - v0->unk_07 = GetMonData(param1, MON_DATA_77, NULL); + v0->unk_07 = Pokemon_GetValue(param1, MON_DATA_77, NULL); sub_0206CED0(11, param1, &v0->unk_07, v0->unk_08); sub_02025C84(27); @@ -703,7 +703,7 @@ void sub_0206D160 (UnkStruct_0206D140 * param0, Pokemon * param1, int param2, in sub_0206CE38(param1, ¶m0->unk_06, ¶m0->unk_08, ¶m0->unk_09, ¶m0->unk_0A); - param0->unk_22 = GetMonData(param1, MON_DATA_POKEBALL, NULL); + param0->unk_22 = Pokemon_GetValue(param1, MON_DATA_POKEBALL, NULL); GF_ASSERT(param0->unk_22); sub_0206CED0(param4, param1, ¶m0->unk_0B, param0->unk_0C); @@ -1051,8 +1051,8 @@ void sub_0206D7C4 (UnkStruct_0203CDB0 * param0) for (v5 = 0; v5 < v4; v5++) { v6 = Party_GetPokemonBySlotIndex(v8, v5); - if (GetMonData(v6, MON_DATA_IS_EGG, NULL) == 0) { - v3 = GetMonData(v6, MON_DATA_GENDER, NULL); + if (Pokemon_GetValue(v6, MON_DATA_IS_EGG, NULL) == 0) { + v3 = Pokemon_GetValue(v6, MON_DATA_GENDER, NULL); if (v3 == 0) { v0 = 1; @@ -1457,7 +1457,7 @@ static u8 sub_0206DE4C (Pokemon * param0) v0 = 0; for (v1 = 0; v1 < (NELEMS(Unk_020EFDDC)); v1++) { - if (GetMonData(param0, Unk_020EFDDC[v1], NULL) == 1) { + if (Pokemon_GetValue(param0, Unk_020EFDDC[v1], NULL) == 1) { v0++; } } @@ -2703,7 +2703,7 @@ static int sub_0206ED14 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param v5 = 0xff; v6 = 0xff; v0 = (LCRNG_Next() % 0xffff); - v2 = GetNatureFromPersonality(v0); + v2 = Pokemon_GetNatureOf(v0); sub_0200B6D8(param1, 0, v2); @@ -2713,7 +2713,7 @@ static int sub_0206ED14 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param if ((v0 % 2) == 0) { for (v1 = 0; v1 < 5; v1++) { - if (GetMonPersonalityFlavorAffinity(v0, v1) == 1) { + if (Pokemon_GetFlavorAffinityOf(v0, v1) == 1) { v5 = v1; break; } @@ -2724,7 +2724,7 @@ static int sub_0206ED14 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param } for (v1 = 0; v1 < 5; v1++) { - if (GetNatureStatAffinity(v2, 1 + v1) > 0) { + if (Pokemon_GetStatAffinityOf(v2, 1 + v1) > 0) { v6 = v1; break; } @@ -2757,7 +2757,7 @@ static int sub_0206EDAC (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param v4 = sub_0202D93C(v0, 4); v5 = sub_0202D93C(v0, 3); - sub_0206CE74(param1, 1, v4, GetMonPersonalityGender(v4, v5), sub_02025FD8(v7), sub_02025FCC(v7)); + sub_0206CE74(param1, 1, v4, Pokemon_GetGenderOf(v4, v5), sub_02025FD8(v7), sub_02025FCC(v7)); break; } } @@ -2972,7 +2972,7 @@ static int sub_0206F160 (UnkStruct_0203CDB0 * param0, UnkStruct_0200B358 * param v4 = Party_GetFromSavedata(param0->unk_0C); v3 = Party_GetPokemonBySlotIndex(v4, sub_0205E1B4(param0->unk_0C)); - sub_0206CE74(param1, 0, GetMonData(v3, MON_DATA_SPECIES, NULL), GetMonData(v3, MON_DATA_GENDER, NULL), sub_02025FD8(v5), sub_02025FCC(v5)); + sub_0206CE74(param1, 0, Pokemon_GetValue(v3, MON_DATA_SPECIES, NULL), Pokemon_GetValue(v3, MON_DATA_GENDER, NULL), sub_02025FD8(v5), sub_02025FCC(v5)); sub_0200BFAC(param1, 1, (LCRNG_Next() % 100)); v1 = (LCRNG_Next() % (493 - 2) + 1); diff --git a/src/unk_02079170.c b/src/unk_02079170.c index d60d469f33..6aa3394c23 100644 --- a/src/unk_02079170.c +++ b/src/unk_02079170.c @@ -302,7 +302,7 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) Party_InitWithCapacity(param0->parties[param1], 6); v0 = Heap_AllocFromHeap(param2, sizeof(UnkStruct_ov16_022431BC_3) * 6); - v7 = AllocMonZeroed(param2); + v7 = Pokemon_New(param2); sub_0207939C(param0->unk_18[param1], v0); @@ -337,7 +337,7 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) sub_02073D80(v7, v9, v8[v1].unk_02, v6, 1, v4, 2, 0); sub_02078AEC(v8[v1].unk_06, v7, param2); - SetMonData(v7, 112, &v10); + Pokemon_SetValue(v7, 112, &v10); Party_AddPokemon(param0->parties[param1], v7); } } @@ -367,11 +367,11 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) sub_02073D80(v7, v12, v11[v1].unk_02, v6, 1, v4, 2, 0); for (v2 = 0; v2 < 4; v2++) { - SetMonMove(v7, v11[v1].unk_06[v2], v2); + Pokemon_SetMoveSlot(v7, v11[v1].unk_06[v2], v2); } sub_02078AEC(v11[v1].unk_0E, v7, param2); - SetMonData(v7, 112, &v13); + Pokemon_SetValue(v7, 112, &v13); Party_AddPokemon(param0->parties[param1], v7); } } @@ -399,9 +399,9 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) v6 = v14[v1].unk_00 * 31 / 255; sub_02073D80(v7, v15, v14[v1].unk_02, v6, 1, v4, 2, 0); - SetMonData(v7, 6, (u8 *)&v14[v1].unk_06); + Pokemon_SetValue(v7, 6, (u8 *)&v14[v1].unk_06); sub_02078AEC(v14[v1].unk_08, v7, param2); - SetMonData(v7, 112, &v16); + Pokemon_SetValue(v7, 112, &v16); Party_AddPokemon(param0->parties[param1], v7); } } @@ -429,14 +429,14 @@ static void sub_020793B8 (BattleParams * param0, int param1, int param2) v6 = v17[v1].unk_00 * 31 / 255; sub_02073D80(v7, v18, v17[v1].unk_02, v6, 1, v4, 2, 0); - SetMonData(v7, 6, (u8 *)&v17[v1].unk_06); + Pokemon_SetValue(v7, 6, (u8 *)&v17[v1].unk_06); for (v2 = 0; v2 < 4; v2++) { - SetMonMove(v7, v17[v1].unk_08[v2], v2); + Pokemon_SetMoveSlot(v7, v17[v1].unk_08[v2], v2); } sub_02078AEC(v17[v1].unk_10, v7, param2); - SetMonData(v7, 112, &v19); + Pokemon_SetValue(v7, 112, &v19); Party_AddPokemon(param0->parties[param1], v7); } } diff --git a/src/unk_020797C8.c b/src/unk_020797C8.c index 91fc4cbb1a..9a9735c7c4 100644 --- a/src/unk_020797C8.c +++ b/src/unk_020797C8.c @@ -35,7 +35,7 @@ static void sub_020797DC (UnkStruct_020797DC * param0) for (v0 = 0; v0 < 18; v0++) { for (v1 = 0; v1 < (5 * 6); v1++) { - ZeroBoxMonData(&(param0->unk_04[v0][v1])); + BoxPokemon_Init(&(param0->unk_04[v0][v1])); } } @@ -88,14 +88,14 @@ BOOL sub_020798A0 (UnkStruct_020797DC * param0, u32 param1, BoxPokemon * param2) u32 v0; sub_0207896C(param2); - SetBoxShayminForm(param2, 0); + BoxPokemon_SetShayminForm(param2, 0); if (param1 == 0xffffffff) { param1 = param0->unk_00; } for (v0 = 0; v0 < (5 * 6); v0++) { - if (GetBoxMonData(&(param0->unk_04[param1][v0]), MON_DATA_SPECIES, NULL) == 0) { + if (BoxPokemon_GetValue(&(param0->unk_04[param1][v0]), MON_DATA_SPECIES, NULL) == 0) { param0->unk_04[param1][v0] = *param2; sub_02024804(); return 1; @@ -108,7 +108,7 @@ BOOL sub_020798A0 (UnkStruct_020797DC * param0, u32 param1, BoxPokemon * param2) BOOL sub_02079914 (UnkStruct_020797DC * param0, u32 param1, u32 param2, BoxPokemon * param3) { sub_0207896C(param3); - SetBoxShayminForm(param3, 0); + BoxPokemon_SetShayminForm(param3, 0); if (param1 == 0xffffffff) { param1 = param0->unk_00; @@ -132,7 +132,7 @@ void sub_02079968 (UnkStruct_020797DC * param0, u32 param1, u32 param2) } if ((param2 < (5 * 6)) && (param1 < 18)) { - ZeroBoxMonData(&(param0->unk_04[param1][param2])); + BoxPokemon_Init(&(param0->unk_04[param1][param2])); sub_02024804(); } else { GF_ASSERT(0); @@ -152,7 +152,7 @@ u32 sub_020799A0 (const UnkStruct_020797DC * param0) while (TRUE) { for (v1 = 0; v1 < (5 * 6); v1++) { - if (GetBoxMonData((BoxPokemon *)(&(param0->unk_04[v0][v1])), MON_DATA_172, NULL) == 0) { + if (BoxPokemon_GetValue((BoxPokemon *)(&(param0->unk_04[v0][v1])), MON_DATA_172, NULL) == 0) { return v0; } } @@ -182,7 +182,7 @@ BOOL sub_020799F0 (const UnkStruct_020797DC * param0, int * param1, int * param2 while (TRUE) { for ( ; v1 < (5 * 6); v1++) { - if (GetBoxMonData((BoxPokemon *)(&(param0->unk_04[v0][v1])), MON_DATA_172, NULL) == 0) { + if (BoxPokemon_GetValue((BoxPokemon *)(&(param0->unk_04[v0][v1])), MON_DATA_172, NULL) == 0) { *param1 = v0; *param2 = v1; return 1; @@ -212,7 +212,7 @@ u32 sub_02079A50 (const UnkStruct_020797DC * param0) for (v0 = 0; v0 < 18; v0++) { for (v1 = 0; v1 < (5 * 6); v1++) { - if (GetBoxMonData((BoxPokemon *)(&(param0->unk_04[v0][v1])), MON_DATA_172, NULL) != 0) { + if (BoxPokemon_GetValue((BoxPokemon *)(&(param0->unk_04[v0][v1])), MON_DATA_172, NULL) != 0) { v2++; } } @@ -295,7 +295,7 @@ u32 sub_02079B54 (const UnkStruct_020797DC * param0, u32 param1) u32 v1 = 0; for (v0 = 0; v0 < (5 * 6); v0++) { - if (GetBoxMonData((BoxPokemon *)(&(param0->unk_04[param1][v0])), MON_DATA_172, NULL)) { + if (BoxPokemon_GetValue((BoxPokemon *)(&(param0->unk_04[param1][v0])), MON_DATA_172, NULL)) { v1++; } } @@ -319,8 +319,8 @@ u32 sub_02079B98 (const UnkStruct_020797DC * param0, u32 param1) u32 v1 = 0; for (v0 = 0; v0 < (5 * 6); v0++) { - if (GetBoxMonData((BoxPokemon *)(&(param0->unk_04[param1][v0])), MON_DATA_172, NULL)) { - if (GetBoxMonData((BoxPokemon *)(&(param0->unk_04[param1][v0])), MON_DATA_IS_EGG, NULL) == 0) { + if (BoxPokemon_GetValue((BoxPokemon *)(&(param0->unk_04[param1][v0])), MON_DATA_172, NULL)) { + if (BoxPokemon_GetValue((BoxPokemon *)(&(param0->unk_04[param1][v0])), MON_DATA_IS_EGG, NULL) == 0) { v1++; } } @@ -354,7 +354,7 @@ u32 sub_02079C08 (const UnkStruct_020797DC * param0, u32 param1, u32 param2, int param1 = param0->unk_00; } - return GetBoxMonData((BoxPokemon *)(¶m0->unk_04[param1][param2]), param3, param4); + return BoxPokemon_GetValue((BoxPokemon *)(¶m0->unk_04[param1][param2]), param3, param4); } void sub_02079C50 (UnkStruct_020797DC * param0, u32 param1, u32 param2, int param3, void * param4) @@ -366,7 +366,7 @@ void sub_02079C50 (UnkStruct_020797DC * param0, u32 param1, u32 param2, int para param1 = param0->unk_00; } - SetBoxMonData((BoxPokemon *)(¶m0->unk_04[param1][param2]), param3, param4); + BoxPokemon_SetValue((BoxPokemon *)(¶m0->unk_04[param1][param2]), param3, param4); sub_02024804(); } diff --git a/src/unk_02079D40.c b/src/unk_02079D40.c index d7a372c21b..983e24eab0 100644 --- a/src/unk_02079D40.c +++ b/src/unk_02079D40.c @@ -558,19 +558,19 @@ u32 sub_02079D40 (const BoxPokemon * param0) u32 v3; u32 v4; - v2 = DecryptBoxMon((BoxPokemon *)param0); - v0 = GetBoxMonData((BoxPokemon *)param0, MON_DATA_SPECIES, NULL); - v4 = GetBoxMonData((BoxPokemon *)param0, MON_DATA_IS_EGG, NULL); + v2 = BoxPokemon_EnterDecryptionContext((BoxPokemon *)param0); + v0 = BoxPokemon_GetValue((BoxPokemon *)param0, MON_DATA_SPECIES, NULL); + v4 = BoxPokemon_GetValue((BoxPokemon *)param0, MON_DATA_IS_EGG, NULL); v3 = sub_02079E44((BoxPokemon *)param0); v1 = sub_02079D8C(v0, v4, v3); - EncryptBoxMon((BoxPokemon *)param0, v2); + BoxPokemon_ExitDecryptionContext((BoxPokemon *)param0, v2); return v1; } u32 sub_02079D80 (Pokemon * param0) { - return sub_02079D40((const BoxPokemon *)GetBoxMon(param0)); + return sub_02079D40((const BoxPokemon *)Pokemon_GetBoxPokemon(param0)); } u32 sub_02079D8C (u32 param0, u32 param1, u32 param2) @@ -583,7 +583,7 @@ u32 sub_02079D8C (u32 param0, u32 param1, u32 param2) } } - param2 = SanitizeFormId(param0, param2); + param2 = Pokemon_SanitizeFormId(param0, param2); if (param2 != 0) { if (param0 == 386) { @@ -634,11 +634,11 @@ u16 sub_02079E44 (const BoxPokemon * param0) { u32 v0; - v0 = GetBoxMonData((BoxPokemon *)param0, MON_DATA_SPECIES_EGG, NULL); + v0 = BoxPokemon_GetValue((BoxPokemon *)param0, MON_DATA_SPECIES_EGG, NULL); switch (v0) { case 201: - return GetBoxMonForm((BoxPokemon *)param0); + return BoxPokemon_GetForm((BoxPokemon *)param0); case 386: case 412: case 413: @@ -647,7 +647,7 @@ u16 sub_02079E44 (const BoxPokemon * param0) case 487: case 492: case 479: - return GetBoxMonData((BoxPokemon *)param0, MON_DATA_FORM, NULL); + return BoxPokemon_GetValue((BoxPokemon *)param0, MON_DATA_FORM, NULL); default: return 0; } @@ -697,19 +697,19 @@ const u8 sub_02079F84 (const BoxPokemon * param0) u32 v2; u32 v3; - v0 = DecryptBoxMon((BoxPokemon *)param0); + v0 = BoxPokemon_EnterDecryptionContext((BoxPokemon *)param0); v2 = sub_02079E44(param0); - v1 = GetBoxMonData((BoxPokemon *)param0, MON_DATA_SPECIES, NULL); - v3 = GetBoxMonData((BoxPokemon *)param0, MON_DATA_IS_EGG, NULL); + v1 = BoxPokemon_GetValue((BoxPokemon *)param0, MON_DATA_SPECIES, NULL); + v3 = BoxPokemon_GetValue((BoxPokemon *)param0, MON_DATA_IS_EGG, NULL); - EncryptBoxMon((BoxPokemon *)param0, v0); + BoxPokemon_ExitDecryptionContext((BoxPokemon *)param0, v0); return sub_02079EDC(v1, v2, v3); } const u8 sub_02079FC4 (Pokemon * param0) { - return sub_02079F84((const BoxPokemon *)GetBoxMon(param0)); + return sub_02079F84((const BoxPokemon *)Pokemon_GetBoxPokemon(param0)); } u32 sub_02079FD0 (void) diff --git a/src/unk_0207A2A8.c b/src/unk_0207A2A8.c index 8173892a27..e9cd091fe2 100644 --- a/src/unk_0207A2A8.c +++ b/src/unk_0207A2A8.c @@ -29,7 +29,7 @@ void sub_0207A2C0 (UnkStruct_02098700 * param0) BOOL sub_0207A2D0 (const UnkStruct_0202610C * param0, Pokemon * param1, const UnkStruct_02098700 * param2) { - u16 v0 = (u16)GetMonData(param1, MON_DATA_SPECIES, NULL); + u16 v0 = (u16)Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL); int v1, v2, v3; if (param0 == NULL) { @@ -38,11 +38,11 @@ BOOL sub_0207A2D0 (const UnkStruct_0202610C * param0, Pokemon * param1, const Un v1 = sub_02026074(param0, 2); - if (GetMonData(param1, MON_DATA_LEVEL, NULL) > v1) { + if (Pokemon_GetValue(param1, MON_DATA_LEVEL, NULL) > v1) { return 0; } - if (GetMonData(param1, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(param1, MON_DATA_IS_EGG, NULL) != 0) { return 0; } @@ -132,10 +132,10 @@ int sub_0207A3AC (const UnkStruct_0202610C * param0, Party * param1, const UnkSt return 5; } - v6[v4] = (u16)GetMonData(v0, MON_DATA_SPECIES, NULL); - v7[v4] = (u16)GetMonData(v0, MON_DATA_HELD_ITEM, NULL); + v6[v4] = (u16)Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); + v7[v4] = (u16)Pokemon_GetValue(v0, MON_DATA_HELD_ITEM, NULL); - v5 += GetMonData(v0, MON_DATA_LEVEL, NULL); + v5 += Pokemon_GetValue(v0, MON_DATA_LEVEL, NULL); } } @@ -218,8 +218,8 @@ int sub_0207A594 (const UnkStruct_0202610C * param0, Party * param1, const UnkSt for (v4 = 0; v4 < v2; v4++) { v0 = Party_GetPokemonBySlotIndex(param1, v4); - v6[v4] = (u16)GetMonData(v0, MON_DATA_SPECIES, NULL); - v7[v4] = GetMonData(v0, MON_DATA_LEVEL, NULL); + v6[v4] = (u16)Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); + v7[v4] = Pokemon_GetValue(v0, MON_DATA_LEVEL, NULL); if (sub_0207A2D0(param0, v0, param2) == 0) { v6[v4] = 0; diff --git a/src/unk_0207AE68.c b/src/unk_0207AE68.c index 2c1fa3b061..c97f7c7161 100644 --- a/src/unk_0207AE68.c +++ b/src/unk_0207AE68.c @@ -112,8 +112,8 @@ UnkStruct_0207AE68 * sub_0207AE68 (Party * param0, Pokemon * param1, int param2, v0->unk_24 = param0; v0->unk_28 = param1; - v0->unk_60 = GetMonData(param1, MON_DATA_SPECIES, NULL); - v0->unk_86 = GetMonData(param1, MON_DATA_FORM, NULL); + v0->unk_60 = Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL); + v0->unk_86 = Pokemon_GetValue(param1, MON_DATA_FORM, NULL); v0->unk_62 = param2; v0->unk_5C = param11; v0->unk_80 = NARC_ctor(NARC_INDEX_POKETOOL__POKE_EDIT__PL_POKE_DATA, param11); @@ -295,7 +295,7 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) } sub_0200590C(param0->unk_60, param0->unk_84, param0->unk_86); - sub_0200B5CC(param0->unk_0C, 0, GetBoxMon(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); if (param0->unk_7C & 0x2) { param0->unk_65 = sub_0207C584(param0, 917); @@ -404,11 +404,11 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) break; case 11: if ((sub_0200598C() == 0) && (sub_020160F4(param0->unk_44, 0) == 1) && (sub_02007C24(param0->unk_1C[1]) == 0)) { - SetMonData(param0->unk_28, 5, (u8 *)¶m0->unk_62); - CalculateMonAbility(param0->unk_28); - CalculateMonLevelAndStats(param0->unk_28); - sub_0200B5CC(param0->unk_0C, 0, GetBoxMon(param0->unk_28)); - sub_0200B538(param0->unk_0C, 1, GetBoxMon(param0->unk_28)); + Pokemon_SetValue(param0->unk_28, 5, (u8 *)¶m0->unk_62); + Pokemon_CalcAbility(param0->unk_28); + Pokemon_CalcLevelAndStats(param0->unk_28); + sub_0200B5CC(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); + sub_0200B538(param0->unk_0C, 1, Pokemon_GetBoxPokemon(param0->unk_28)); param0->unk_65 = sub_0207C584(param0, 918); param0->unk_66 = 40; param0->unk_64++; @@ -420,10 +420,10 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) sub_0202736C(param0->unk_48, param0->unk_28); sub_0202CF28(param0->unk_50, (1 + 11)); sub_0202CFEC(param0->unk_50, 22); - sub_02056A48(param0->unk_54, GetBoxMon(param0->unk_28)); + sub_02056A48(param0->unk_54, Pokemon_GetBoxPokemon(param0->unk_28)); - if (GetMonData(param0->unk_28, MON_DATA_77, NULL) == 0) { - SetMonData(param0->unk_28, 179, NULL); + if (Pokemon_GetValue(param0->unk_28, MON_DATA_77, NULL) == 0) { + Pokemon_SetValue(param0->unk_28, 179, NULL); } param0->unk_64++; @@ -445,7 +445,7 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) param0->unk_64 = 14; break; default: - sub_0200B5CC(param0->unk_0C, 0, GetBoxMon(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); sub_0200B630(param0->unk_0C, 1, v3); param0->unk_65 = sub_0207C584(param0, 4); param0->unk_66 = 30; @@ -455,14 +455,14 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) } break; case 14: - sub_0200B5CC(param0->unk_0C, 0, GetBoxMon(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); sub_0200B630(param0->unk_0C, 1, param0->unk_6C); param0->unk_65 = sub_0207C584(param0, 1193); param0->unk_66 = 30; param0->unk_64++; break; case 16: - sub_0200B5CC(param0->unk_0C, 0, GetBoxMon(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); param0->unk_65 = sub_0207C584(param0, 1194); param0->unk_66 = 30; param0->unk_64++; @@ -562,7 +562,7 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) case 35: switch (sub_02002114(param0->unk_40, param0->unk_5C)) { case 0: - sub_0200B5CC(param0->unk_0C, 0, GetBoxMon(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); sub_0200B630(param0->unk_0C, 1, param0->unk_6C); param0->unk_65 = sub_0207C584(param0, 1198); param0->unk_66 = 30; @@ -587,8 +587,8 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) param0->unk_64++; break; case 27: - sub_0200B5CC(param0->unk_0C, 0, GetBoxMon(param0->unk_28)); - sub_0200B630(param0->unk_0C, 1, GetMonData(param0->unk_28, 54 + param0->unk_6E, NULL)); + sub_0200B5CC(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); + sub_0200B630(param0->unk_0C, 1, Pokemon_GetValue(param0->unk_28, 54 + param0->unk_6E, NULL)); param0->unk_65 = sub_0207C584(param0, 1200); param0->unk_66 = 30; param0->unk_64++; @@ -599,12 +599,12 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) param0->unk_64++; break; case 31: - sub_0200B5CC(param0->unk_0C, 0, GetBoxMon(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); sub_0200B630(param0->unk_0C, 1, param0->unk_6C); param0->unk_65 = sub_0207C584(param0, 1202); param0->unk_66 = 0; - SetMonData(param0->unk_28, 62 + param0->unk_6E, ¶m0->unk_66); - SetMonMove(param0->unk_28, param0->unk_6C, param0->unk_6E); + Pokemon_SetValue(param0->unk_28, 62 + param0->unk_6E, ¶m0->unk_66); + Pokemon_SetMoveSlot(param0->unk_28, param0->unk_6C, param0->unk_6E); param0->unk_66 = 30; param0->unk_64 = 37; break; @@ -668,7 +668,7 @@ static void sub_0207B180 (UnkStruct_0207AE68 * param0) break; case 43: if ((sub_0200598C() == 0) && (sub_020160F4(param0->unk_44, 0) == 1) && (sub_02007C24(param0->unk_1C[0]) == 0)) { - sub_0200B5CC(param0->unk_0C, 0, GetBoxMon(param0->unk_28)); + sub_0200B5CC(param0->unk_0C, 0, Pokemon_GetBoxPokemon(param0->unk_28)); param0->unk_65 = sub_0207C584(param0, 919); param0->unk_66 = 20; param0->unk_64++; @@ -705,54 +705,54 @@ static void sub_0207C028 (UnkStruct_0207AE68 * param0) UnkStruct_0202818C * v3; UnkStruct_0202CA28 v4; - v1 = AllocMonZeroed(param0->unk_5C); - sub_020775EC(param0->unk_28, v1); + v1 = Pokemon_New(param0->unk_5C); + Pokemon_Copy(param0->unk_28, v1); v2 = 292; - SetMonData(v1, 5, &v2); + Pokemon_SetValue(v1, 5, &v2); v2 = 4; - SetMonData(v1, 155, &v2); + Pokemon_SetValue(v1, 155, &v2); v2 = 0; - SetMonData(v1, 6, &v2); - SetMonData(v1, 11, &v2); + Pokemon_SetValue(v1, 6, &v2); + Pokemon_SetValue(v1, 11, &v2); for (v0 = 25; v0 < 53 + 1; v0++) { - SetMonData(v1, v0, &v2); + Pokemon_SetValue(v1, v0, &v2); } for (v0 = 78; v0 < 109 + 1; v0++) { - SetMonData(v1, v0, &v2); + Pokemon_SetValue(v1, v0, &v2); } for (v0 = 123; v0 < 143 + 1; v0++) { - SetMonData(v1, v0, &v2); + Pokemon_SetValue(v1, v0, &v2); } - SetMonData(v1, 179, NULL); - SetMonData(v1, 77, &v2); - SetMonData(v1, 160, &v2); + Pokemon_SetValue(v1, 179, NULL); + Pokemon_SetValue(v1, 77, &v2); + Pokemon_SetValue(v1, 160, &v2); v3 = sub_0202818C(param0->unk_5C); - SetMonData(v1, 170, v3); + Pokemon_SetValue(v1, 170, v3); Heap_FreeToHeap(v3); - SetMonData(v1, 162, &v2); + Pokemon_SetValue(v1, 162, &v2); MI_CpuClearFast(&v4, sizeof(UnkStruct_0202CA28)); - SetMonData(v1, 171, (UnkStruct_0202CA28 *)&v4); - CalculateMonAbility(v1); + Pokemon_SetValue(v1, 171, (UnkStruct_0202CA28 *)&v4); + Pokemon_CalcAbility(v1); - v0 = GetMonGender(v1); - SetMonData(v1, 111, &v0); + v0 = Pokemon_GetGender(v1); + Pokemon_SetValue(v1, 111, &v0); - CalculateMonLevelAndStats(v1); + Pokemon_CalcLevelAndStats(v1); Party_AddPokemon(param0->unk_24, v1); sub_0202736C(param0->unk_48, v1); sub_0202CF28(param0->unk_50, (1 + 11)); sub_0202CFEC(param0->unk_50, 22); - sub_02056A48(param0->unk_54, GetBoxMon(v1)); + sub_02056A48(param0->unk_54, Pokemon_GetBoxPokemon(v1)); Heap_FreeToHeap(v1); sub_0207D60C(param0->unk_4C, 4, 1, param0->unk_5C); } @@ -762,7 +762,7 @@ static void sub_0207C028 (UnkStruct_0207AE68 * param0) case 18: case 19: v0 = 0; - SetMonData(param0->unk_28, 6, &v0); + Pokemon_SetValue(param0->unk_28, 6, &v0); break; } } @@ -952,11 +952,11 @@ static void sub_0207C498 (UnkStruct_0207AE68 * param0) sub_02075EF4(&v0, param0->unk_28, 2); param0->unk_1C[0] = sub_02007C34(param0->unk_18, &v0, 128, 80, 0, 0, NULL, NULL); - v1 = AllocMonZeroed(param0->unk_5C); + v1 = Pokemon_New(param0->unk_5C); - sub_020775EC(param0->unk_28, v1); - SetMonData(v1, 5, (u8 *)¶m0->unk_62); - CalculateMonLevelAndStats(v1); + Pokemon_Copy(param0->unk_28, v1); + Pokemon_SetValue(v1, 5, (u8 *)¶m0->unk_62); + Pokemon_CalcLevelAndStats(v1); sub_02075EF4(&v0, v1, 2); Heap_FreeToHeap(v1); diff --git a/src/unk_0207E0B8.c b/src/unk_0207E0B8.c index 26a701abd1..e5b7182644 100644 --- a/src/unk_0207E0B8.c +++ b/src/unk_0207E0B8.c @@ -1055,7 +1055,7 @@ u8 sub_0207EF14 (UnkStruct_0207F248 * param0, u8 param1) } v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param1); - v2 = (u16)GetMonData(v0, MON_DATA_SPECIES, NULL); + v2 = (u16)Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); if (v2 == 0) { return 0; @@ -1064,21 +1064,21 @@ u8 sub_0207EF14 (UnkStruct_0207F248 * param0, u8 param1) sub_02081ED8(param0, v0, param1); param0->unk_704[param1].unk_04 = v2; - param0->unk_704[param1].unk_06 = (u16)GetMonData(v0, MON_DATA_CURRENT_HP, NULL); - param0->unk_704[param1].unk_08 = (u16)GetMonData(v0, MON_DATA_MAX_HP, NULL); - param0->unk_704[param1].unk_0A = (u16)GetMonData(v0, MON_DATA_LEVEL, NULL); - param0->unk_704[param1].unk_0C = (u16)GetMonData(v0, MON_DATA_HELD_ITEM, NULL); - param0->unk_704[param1].unk_12 = (u16)GetMonData(v0, MON_DATA_162, NULL); - param0->unk_704[param1].unk_10 = (u8)GetMonData(v0, MON_DATA_IS_EGG, NULL); - param0->unk_704[param1].unk_11 = (u8)GetMonData(v0, MON_DATA_FORM, NULL); - - if (GetMonData(v0, MON_DATA_176, NULL) == 1) { + param0->unk_704[param1].unk_06 = (u16)Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, NULL); + param0->unk_704[param1].unk_08 = (u16)Pokemon_GetValue(v0, MON_DATA_MAX_HP, NULL); + param0->unk_704[param1].unk_0A = (u16)Pokemon_GetValue(v0, MON_DATA_LEVEL, NULL); + param0->unk_704[param1].unk_0C = (u16)Pokemon_GetValue(v0, MON_DATA_HELD_ITEM, NULL); + param0->unk_704[param1].unk_12 = (u16)Pokemon_GetValue(v0, MON_DATA_162, NULL); + param0->unk_704[param1].unk_10 = (u8)Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL); + param0->unk_704[param1].unk_11 = (u8)Pokemon_GetValue(v0, MON_DATA_FORM, NULL); + + if (Pokemon_GetValue(v0, MON_DATA_176, NULL) == 1) { param0->unk_704[param1].unk_0E_12 = 0; } else { param0->unk_704[param1].unk_0E_12 = 1; } - param0->unk_704[param1].unk_0E_13 = GetMonGender(v0); + param0->unk_704[param1].unk_0E_13 = Pokemon_GetGender(v0); param0->unk_704[param1].unk_29 = 1; param0->unk_704[param1].unk_0E_0 = (u8)sub_0208E9F0(v0); @@ -1104,7 +1104,7 @@ static void sub_0207F094 (UnkStruct_0207F248 * param0, Pokemon * param1, u8 para v0 = sub_0207F134(param1, param0->unk_5A4->unk_2A); for (v1 = 0; v1 < 4; v1++) { - if (GetMonData(param1, MON_DATA_MOVE1 + v1, NULL) == 0) { + if (Pokemon_GetValue(param1, MON_DATA_MOVE1 + v1, NULL) == 0) { break; } } @@ -1122,34 +1122,34 @@ static u32 sub_0207F134 (Pokemon * param0, u8 param1) switch (param1) { case 0: - v0 = GetMonData(param0, MON_DATA_123, NULL); - v0 += GetMonData(param0, MON_DATA_124, NULL); - v0 += GetMonData(param0, MON_DATA_125, NULL); - v0 += GetMonData(param0, MON_DATA_126, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_123, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_124, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_125, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_126, NULL); break; case 1: - v0 = GetMonData(param0, MON_DATA_127, NULL); - v0 += GetMonData(param0, MON_DATA_128, NULL); - v0 += GetMonData(param0, MON_DATA_129, NULL); - v0 += GetMonData(param0, MON_DATA_130, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_127, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_128, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_129, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_130, NULL); break; case 2: - v0 = GetMonData(param0, MON_DATA_131, NULL); - v0 += GetMonData(param0, MON_DATA_132, NULL); - v0 += GetMonData(param0, MON_DATA_133, NULL); - v0 += GetMonData(param0, MON_DATA_134, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_131, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_132, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_133, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_134, NULL); break; case 3: - v0 = GetMonData(param0, MON_DATA_135, NULL); - v0 += GetMonData(param0, MON_DATA_136, NULL); - v0 += GetMonData(param0, MON_DATA_137, NULL); - v0 += GetMonData(param0, MON_DATA_138, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_135, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_136, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_137, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_138, NULL); break; case 4: - v0 = GetMonData(param0, MON_DATA_139, NULL); - v0 += GetMonData(param0, MON_DATA_140, NULL); - v0 += GetMonData(param0, MON_DATA_141, NULL); - v0 += GetMonData(param0, MON_DATA_142, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_139, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_140, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_141, NULL); + v0 += Pokemon_GetValue(param0, MON_DATA_142, NULL); } return v0; @@ -1376,7 +1376,7 @@ void sub_0207F8F8 (UnkStruct_0207F248 * param0, u8 param1) v1 = 0; } - if (GetMonData(v0, MON_DATA_CURRENT_HP, 0) == 0) { + if (Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, 0) == 0) { v1 += 2; } else if (sub_0207F984(param0, param1) == 1) { v1 += 1; @@ -1752,7 +1752,7 @@ static u8 sub_020800B4 (UnkStruct_0207F248 * param0, u8 * param1) if (sub_0206C0D0(param0->unk_5A4->unk_1C) == 0) { if (param0->unk_704[param0->unk_B11].unk_10 == 0) { for (v3 = 0; v3 < 4; v3++) { - v1 = (u16)GetMonData(v0, MON_DATA_MOVE1 + v3, NULL); + v1 = (u16)Pokemon_GetValue(v0, MON_DATA_MOVE1 + v3, NULL); if (v1 == 0) { break; @@ -2464,7 +2464,7 @@ static int sub_02080BF4 (UnkStruct_0207F248 * param0) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); v1 = MessageLoader_GetNewStrbuf(param0->unk_69C, 64); - sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B60C(param0->unk_6A0, 1, param0->unk_B14[2], 3, 0, 1); sub_0200C388(param0->unk_6A0, param0->unk_6A4, v1); Strbuf_Free(v1); @@ -2527,7 +2527,7 @@ static BOOL sub_02080F3C (UnkStruct_0207F248 * param0, u8 param1, s8 param2) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param1); v1 = param0->unk_704[param1].unk_06; - SetMonData(v0, 163, &v1); + Pokemon_SetValue(v0, 163, &v1); return 1; } @@ -2584,7 +2584,7 @@ static int sub_0208107C (UnkStruct_0207F248 * param0) v0 = Item_Load(param0->unk_5A4->unk_24, 0, 12); - if ((param0->unk_5A4->unk_24 == 466) && (CanShayminSkyForm(Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11)) == 1)) { + if ((param0->unk_5A4->unk_24 == 466) && (Pokemon_CanShayminSkyForm(Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11)) == 1)) { param0->unk_5A4->unk_38 = 1; Heap_FreeToHeap(v0); sub_020819B4(param0); @@ -2654,9 +2654,9 @@ static int sub_02081224 (UnkStruct_0207F248 * param0) v4 = param0->unk_5A4->unk_1C; if (param0->unk_5A4->unk_24 == 112) { - if (GetMonData(v0, MON_DATA_SPECIES, NULL) != 487) { + if (Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL) != 487) { MessageLoader_GetStrbuf(param0->unk_69C, 203, param0->unk_6A8); - sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B744(param0->unk_6A0, 1, param0->unk_5A4->unk_24); sub_0200C388(param0->unk_6A0, param0->unk_6A4, param0->unk_6A8); v2 = 11; @@ -2681,13 +2681,13 @@ static int sub_02081224 (UnkStruct_0207F248 * param0) v2 = sub_02081408(param0, v0, &v3); MessageLoader_GetStrbuf(param0->unk_69C, 118, param0->unk_6A8); - sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B70C(param0->unk_6A0, 1, param0->unk_5A4->unk_24); sub_0200C388(param0->unk_6A0, param0->unk_6A4, param0->unk_6A8); break; case 1: MessageLoader_GetStrbuf(param0->unk_69C, 78, param0->unk_6A8); - sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B744(param0->unk_6A0, 1, param0->unk_704[param0->unk_B11].unk_0C); sub_0200C388(param0->unk_6A0, param0->unk_6A4, param0->unk_6A8); v2 = 9; @@ -2714,11 +2714,11 @@ static int sub_02081408 (UnkStruct_0207F248 * param0, Pokemon * param1, int * pa v1 = param0->unk_5A4->unk_1C; sub_0207D60C(param0->unk_5A4->unk_04, param0->unk_5A4->unk_24, 1, 12); - SetMonData(param1, 6, &v0); - SetArceusForm(param1); + Pokemon_SetValue(param1, 6, &v0); + Pokemon_SetArceusForm(param1); if ((v1 == NULL) || (v1->unk_1C->unk_00 < 573) || (v1->unk_1C->unk_00 > 583)) { - *param2 = SetGiratinaForm(param1); + *param2 = Pokemon_SetGiratinaForm(param1); } else { *param2 = -1; } @@ -2736,9 +2736,9 @@ static int sub_02081408 (UnkStruct_0207F248 * param0, Pokemon * param1, int * pa static void sub_020814A8 (UnkStruct_0207F248 * param0, Pokemon * param1, u32 param2, u32 param3) { sub_0207D570(param0->unk_5A4->unk_04, (u16)param2, 1, 12); - SetMonData(param1, 6, ¶m3); - SetArceusForm(param1); - SetGiratinaForm(param1); + Pokemon_SetValue(param1, 6, ¶m3); + Pokemon_SetArceusForm(param1); + Pokemon_SetGiratinaForm(param1); param0->unk_704[param0->unk_B11].unk_0C = (u16)param3; sub_02083040(param0, param0->unk_B11, param0->unk_704[param0->unk_B11].unk_0C); } @@ -2875,7 +2875,7 @@ static int sub_02081760 (UnkStruct_0207F248 * param0) if (v3 == 0) { MessageLoader_GetStrbuf(param0->unk_69C, 118, param0->unk_6A8); - sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B70C(param0->unk_6A0, 1, param0->unk_5A4->unk_24); sub_0200C388(param0->unk_6A0, param0->unk_6A4, param0->unk_6A8); } else { diff --git a/src/unk_020819DC.c b/src/unk_020819DC.c index ea2dc1ad10..88e8717bf2 100644 --- a/src/unk_020819DC.c +++ b/src/unk_020819DC.c @@ -249,7 +249,7 @@ void sub_02081E08 (UnkStruct_0207F248 * param0) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); v1 = MessageLoader_GetNewStrbuf(param0->unk_69C, 37); - sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_6A0, param0->unk_6A4, v1); Strbuf_Free(v1); } @@ -275,7 +275,7 @@ void sub_02081ED8 (UnkStruct_0207F248 * param0, Pokemon * param1, u32 param2) v0 = MessageLoader_GetNewStrbuf(param0->unk_69C, Unk_020F1EA0[param2][0]); - sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(param1)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(param1)); sub_0200C388(param0->unk_6A0, param0->unk_704[param2].unk_00, v0); Strbuf_Free(v0); } @@ -749,12 +749,12 @@ void sub_020829DC (UnkStruct_0207F248 * param0) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - v3[0] = (u16)GetMonData(v0, MON_DATA_MAX_HP, NULL); - v3[1] = (u16)GetMonData(v0, MON_DATA_ATK, NULL); - v3[2] = (u16)GetMonData(v0, MON_DATA_DEF, NULL); - v3[3] = (u16)GetMonData(v0, MON_DATA_SP_ATK, NULL); - v3[4] = (u16)GetMonData(v0, MON_DATA_SP_DEF, NULL); - v3[5] = (u16)GetMonData(v0, MON_DATA_SPEED, NULL); + v3[0] = (u16)Pokemon_GetValue(v0, MON_DATA_MAX_HP, NULL); + v3[1] = (u16)Pokemon_GetValue(v0, MON_DATA_ATK, NULL); + v3[2] = (u16)Pokemon_GetValue(v0, MON_DATA_DEF, NULL); + v3[3] = (u16)Pokemon_GetValue(v0, MON_DATA_SP_ATK, NULL); + v3[4] = (u16)Pokemon_GetValue(v0, MON_DATA_SP_DEF, NULL); + v3[5] = (u16)Pokemon_GetValue(v0, MON_DATA_SPEED, NULL); sub_0201A7E8(param0->unk_00, ¶m0->unk_254[0], 0, 1, 1, 14, 12, 0, 576); sub_0200DC48(¶m0->unk_254[0], 1, 1, 14); diff --git a/src/unk_02082C2C.c b/src/unk_02082C2C.c index 64660c9bea..b59dbb705f 100644 --- a/src/unk_02082C2C.c +++ b/src/unk_02082C2C.c @@ -84,7 +84,7 @@ void sub_02082CEC (UnkStruct_0207F248 * param0, u8 param1, u16 param2, u16 param sub_0200D9B4(param0->unk_5A8, param0->unk_5AC, param4, sub_02079D80(v0), 0, 4 + param1); - v2 = GetMonData(v0, MON_DATA_IS_EGG, NULL); + v2 = Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL); v1.unk_00 = 4 + param1; v1.unk_04 = param2; @@ -113,8 +113,8 @@ void sub_02082DA8 (UnkStruct_0207F248 * param0, u8 param1) BOOL v7; v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param1); - v2 = GetMonData(v0, MON_DATA_SPECIES, NULL); - v3 = GetMonData(v0, MON_DATA_FORM, NULL); + v2 = Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL); + v3 = Pokemon_GetValue(v0, MON_DATA_FORM, NULL); v1 = NARC_ctor(NARC_INDEX_POKETOOL__ICONGRA__PL_POKE_ICON, 12); v4 = NNS_G2dGetImageLocation(sub_02021F98(param0->unk_704[param1].unk_24), NNS_G2D_VRAM_TYPE_2DMAIN); v5 = sub_0200723C(v1, sub_02079D80(v0), 0, 12, 1); diff --git a/src/unk_02083370.c b/src/unk_02083370.c index dc265bec0d..a3757fd464 100644 --- a/src/unk_02083370.c +++ b/src/unk_02083370.c @@ -177,7 +177,7 @@ static void sub_020834B0 (UnkStruct_0207F248 * param0, int * param1) if (param0->unk_704[param0->unk_B11].unk_0C == 0) { v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); MessageLoader_GetStrbuf(param0->unk_69C, 81, param0->unk_6A8); - sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_6A0, param0->unk_6A4, param0->unk_6A8); } else if (sub_0207D570(param0->unk_5A4->unk_04, param0->unk_704[param0->unk_B11].unk_0C, 1, 12) == 1) { u32 v4; @@ -185,11 +185,11 @@ static void sub_020834B0 (UnkStruct_0207F248 * param0, int * param1) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); v4 = 0; - SetMonData(v0, 6, &v4); - SetArceusForm(v0); + Pokemon_SetValue(v0, 6, &v4); + Pokemon_SetArceusForm(v0); if ((v3 == NULL) || (v3->unk_1C->unk_00 < 573) || (v3->unk_1C->unk_00 > 583)) { - v1 = SetGiratinaForm(v0); + v1 = Pokemon_SetGiratinaForm(v0); if ((param0->unk_704[param0->unk_B11].unk_0C == 112) && (v1 == 0)) { v2 = 18; @@ -197,7 +197,7 @@ static void sub_020834B0 (UnkStruct_0207F248 * param0, int * param1) } MessageLoader_GetStrbuf(param0->unk_69C, 82, param0->unk_6A8); - sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B70C(param0->unk_6A0, 1, param0->unk_704[param0->unk_B11].unk_0C); sub_0200C388(param0->unk_6A0, param0->unk_6A4, param0->unk_6A8); @@ -347,9 +347,9 @@ static int sub_020838F4 (void * param0) v1 = Party_GetPokemonBySlotIndex(v0->unk_5A4->unk_00, v0->unk_B11); v2 = 0; - SetMonData(v1, 6, &v2); - SetArceusForm(v1); - SetGiratinaForm(v1); + Pokemon_SetValue(v1, 6, &v2); + Pokemon_SetArceusForm(v1); + Pokemon_SetGiratinaForm(v1); v0->unk_704[v0->unk_B11].unk_0C = 0; @@ -845,7 +845,7 @@ int sub_02084780 (UnkStruct_0207F248 * param0) { Pokemon * v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - if (GetMonData(v0, MON_DATA_162, NULL) == 0) { + if (Pokemon_GetValue(v0, MON_DATA_162, NULL) == 0) { MessageLoader_GetStrbuf(param0->unk_69C, 129, param0->unk_6A4); sub_02021CAC(param0->unk_5B0[22 + param0->unk_B11], 1); } else { diff --git a/src/unk_02084B70.c b/src/unk_02084B70.c index 9a9c7665a8..16ad3ac291 100644 --- a/src/unk_02084B70.c +++ b/src/unk_02084B70.c @@ -225,7 +225,7 @@ static void sub_02084E58 (UnkStruct_0207F248 * param0, u16 param1, u32 param2) Strbuf* v1; v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); switch (sub_02084B70(param1)) { case 4: @@ -442,13 +442,13 @@ static int sub_02085424 (void * param0) v0 = (UnkStruct_0207F248 *)param0; v1 = Party_GetPokemonBySlotIndex(v0->unk_5A4->unk_00, v0->unk_B11); - v2[0] = GetMonData(v1, MON_DATA_HP_EV, NULL); - v2[1] = GetMonData(v1, MON_DATA_ATK_EV, NULL); - v2[2] = GetMonData(v1, MON_DATA_DEF_EV, NULL); - v2[3] = GetMonData(v1, MON_DATA_SPEED_EV, NULL); - v2[4] = GetMonData(v1, MON_DATA_SPATK_EV, NULL); - v2[5] = GetMonData(v1, MON_DATA_SPDEF_EV, NULL); - v2[6] = GetMonData(v1, MON_DATA_FRIENDSHIP, NULL); + v2[0] = Pokemon_GetValue(v1, MON_DATA_HP_EV, NULL); + v2[1] = Pokemon_GetValue(v1, MON_DATA_ATK_EV, NULL); + v2[2] = Pokemon_GetValue(v1, MON_DATA_DEF_EV, NULL); + v2[3] = Pokemon_GetValue(v1, MON_DATA_SPEED_EV, NULL); + v2[4] = Pokemon_GetValue(v1, MON_DATA_SPATK_EV, NULL); + v2[5] = Pokemon_GetValue(v1, MON_DATA_SPDEF_EV, NULL); + v2[6] = Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL); sub_02096F14(v0->unk_5A4->unk_00, v0->unk_5A4->unk_24, v0->unk_B11, 0, sub_02086930(v0), 12); sub_0207EF14(v0, v0->unk_B11); @@ -456,8 +456,8 @@ static int sub_02085424 (void * param0) sub_020822BC(v0, v0->unk_B11); sub_02083014(v0, v0->unk_B11, v0->unk_704[v0->unk_B11].unk_0E_0); - if ((v2[0] != GetMonData(v1, MON_DATA_HP_EV, NULL)) || (v2[1] != GetMonData(v1, MON_DATA_ATK_EV, NULL)) || (v2[2] != GetMonData(v1, MON_DATA_DEF_EV, NULL)) || (v2[3] != GetMonData(v1, MON_DATA_SPEED_EV, NULL)) || (v2[4] != GetMonData(v1, MON_DATA_SPATK_EV, NULL)) || (v2[5] != GetMonData(v1, MON_DATA_SPDEF_EV, NULL))) { - if (v2[6] != GetMonData(v1, MON_DATA_FRIENDSHIP, NULL)) { + if ((v2[0] != Pokemon_GetValue(v1, MON_DATA_HP_EV, NULL)) || (v2[1] != Pokemon_GetValue(v1, MON_DATA_ATK_EV, NULL)) || (v2[2] != Pokemon_GetValue(v1, MON_DATA_DEF_EV, NULL)) || (v2[3] != Pokemon_GetValue(v1, MON_DATA_SPEED_EV, NULL)) || (v2[4] != Pokemon_GetValue(v1, MON_DATA_SPATK_EV, NULL)) || (v2[5] != Pokemon_GetValue(v1, MON_DATA_SPDEF_EV, NULL))) { + if (v2[6] != Pokemon_GetValue(v1, MON_DATA_FRIENDSHIP, NULL)) { sub_02084E58(v0, v0->unk_5A4->unk_24, 0); } else { sub_02084E58(v0, v0->unk_5A4->unk_24, 1); @@ -485,7 +485,7 @@ static int sub_020855C4 (void * param0) sub_02096F14(v0->unk_5A4->unk_00, v0->unk_5A4->unk_24, v0->unk_B11, 0, sub_02086930(v0), 12); v1 = Party_GetPokemonBySlotIndex(v0->unk_5A4->unk_00, v0->unk_B11); - v3 = GetMonData(v1, MON_DATA_CURRENT_HP, NULL); + v3 = Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL); if (v0->unk_704[v0->unk_B11].unk_06 == 0) { v2 = MessageLoader_GetNewStrbuf(v0->unk_69C, 70); @@ -495,7 +495,7 @@ static int sub_020855C4 (void * param0) v2 = MessageLoader_GetNewStrbuf(v0->unk_69C, 64); } - sub_0200B5CC(v0->unk_6A0, 0, GetBoxMon(v1)); + sub_0200B5CC(v0->unk_6A0, 0, Pokemon_GetBoxPokemon(v1)); sub_0200B60C(v0->unk_6A0, 1, v3 - v0->unk_704[v0->unk_B11].unk_06, 3, 0, 1); sub_0200C388(v0->unk_6A0, v0->unk_6A4, v2); Strbuf_Free(v2); @@ -522,7 +522,7 @@ static int sub_02085704 (void * param0) u32 v2; v1 = Party_GetPokemonBySlotIndex(v0->unk_5A4->unk_00, v0->unk_B11); - v2 = GetMonData(v1, MON_DATA_CURRENT_HP, NULL); + v2 = Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL); if (v0->unk_704[v0->unk_B11].unk_06 != v2) { v0->unk_704[v0->unk_B11].unk_06++; @@ -596,10 +596,10 @@ int sub_02085804 (UnkStruct_0207F248 * param0) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); sub_02096954(v0, param0->unk_5A4->unk_24, 0, sub_02086930(param0), 12); - v2 = GetMonData(v0, MON_DATA_CURRENT_HP, NULL); + v2 = Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, NULL); v1 = MessageLoader_GetNewStrbuf(param0->unk_69C, 70); - sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200C388(param0->unk_6A0, param0->unk_6A4, v1); Strbuf_Free(v1); @@ -615,7 +615,7 @@ int sub_02085804 (UnkStruct_0207F248 * param0) break; case 2: v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - v2 = GetMonData(v0, MON_DATA_CURRENT_HP, NULL); + v2 = Pokemon_GetValue(v0, MON_DATA_CURRENT_HP, NULL); param0->unk_704[param0->unk_B11].unk_06++; @@ -667,22 +667,22 @@ static int sub_02085A70 (void * param0) v0 = (UnkStruct_0207F248 *)param0; v1 = Party_GetPokemonBySlotIndex(v0->unk_5A4->unk_00, v0->unk_B11); - v0->unk_B14[0] = (u16)GetMonData(v1, MON_DATA_MAX_HP, NULL); - v0->unk_B14[1] = (u16)GetMonData(v1, MON_DATA_ATK, NULL); - v0->unk_B14[2] = (u16)GetMonData(v1, MON_DATA_DEF, NULL); - v0->unk_B14[3] = (u16)GetMonData(v1, MON_DATA_SP_ATK, NULL); - v0->unk_B14[4] = (u16)GetMonData(v1, MON_DATA_SP_DEF, NULL); - v0->unk_B14[5] = (u16)GetMonData(v1, MON_DATA_SPEED, NULL); + v0->unk_B14[0] = (u16)Pokemon_GetValue(v1, MON_DATA_MAX_HP, NULL); + v0->unk_B14[1] = (u16)Pokemon_GetValue(v1, MON_DATA_ATK, NULL); + v0->unk_B14[2] = (u16)Pokemon_GetValue(v1, MON_DATA_DEF, NULL); + v0->unk_B14[3] = (u16)Pokemon_GetValue(v1, MON_DATA_SP_ATK, NULL); + v0->unk_B14[4] = (u16)Pokemon_GetValue(v1, MON_DATA_SP_DEF, NULL); + v0->unk_B14[5] = (u16)Pokemon_GetValue(v1, MON_DATA_SPEED, NULL); sub_02096F14(v0->unk_5A4->unk_00, v0->unk_5A4->unk_24, v0->unk_B11, 0, sub_02086930(v0), 12); - v0->unk_704[v0->unk_B11].unk_0A = GetMonData(v1, MON_DATA_LEVEL, NULL); - v0->unk_704[v0->unk_B11].unk_06 = GetMonData(v1, MON_DATA_CURRENT_HP, NULL); - v0->unk_704[v0->unk_B11].unk_08 = GetMonData(v1, MON_DATA_MAX_HP, NULL); + v0->unk_704[v0->unk_B11].unk_0A = Pokemon_GetValue(v1, MON_DATA_LEVEL, NULL); + v0->unk_704[v0->unk_B11].unk_06 = Pokemon_GetValue(v1, MON_DATA_CURRENT_HP, NULL); + v0->unk_704[v0->unk_B11].unk_08 = Pokemon_GetValue(v1, MON_DATA_MAX_HP, NULL); v2 = MessageLoader_GetNewStrbuf(v0->unk_69C, 193); - sub_0200B5CC(v0->unk_6A0, 0, GetBoxMon(v1)); + sub_0200B5CC(v0->unk_6A0, 0, Pokemon_GetBoxPokemon(v1)); sub_0200B60C(v0->unk_6A0, 1, v0->unk_704[v0->unk_B11].unk_0A, 3, 0, 1); sub_0200C388(v0->unk_6A0, v0->unk_6A4, v2); Strbuf_Free(v2); @@ -750,7 +750,7 @@ static int sub_02085C50 (void * param0) v0->unk_B13 = 6; break; case 0xffff: - sub_0200B5CC(v0->unk_6A0, 0, GetBoxMon(v1)); + sub_0200B5CC(v0->unk_6A0, 0, Pokemon_GetBoxPokemon(v1)); sub_0200B630(v0->unk_6A0, 1, v0->unk_5A4->unk_26); v2 = MessageLoader_GetNewStrbuf(v0->unk_69C, 52); @@ -767,7 +767,7 @@ static int sub_02085C50 (void * param0) case 0xfffe: break; default: - sub_0200B5CC(v0->unk_6A0, 0, GetBoxMon(v1)); + sub_0200B5CC(v0->unk_6A0, 0, Pokemon_GetBoxPokemon(v1)); sub_0200B630(v0->unk_6A0, 1, v0->unk_5A4->unk_26); v2 = MessageLoader_GetNewStrbuf(v0->unk_69C, 194); @@ -833,14 +833,14 @@ int sub_02085EF4 (UnkStruct_0207F248 * param0) param0->unk_B13 = 3; v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); if (param0->unk_5A4->unk_28 == 4) { sub_0200B630(param0->unk_6A0, 1, param0->unk_5A4->unk_26); return sub_02086008(param0); } - sub_0200B630(param0->unk_6A0, 1, GetMonData(v0, 54 + param0->unk_5A4->unk_28, NULL)); + sub_0200B630(param0->unk_6A0, 1, Pokemon_GetValue(v0, 54 + param0->unk_5A4->unk_28, NULL)); v1 = MessageLoader_GetNewStrbuf(param0->unk_69C, 60); sub_0200C388(param0->unk_6A0, param0->unk_6A4, v1); Strbuf_Free(v1); @@ -932,7 +932,7 @@ u8 sub_02086104 (UnkStruct_0207F248 * param0, Pokemon * param1) u8 v1; for (v1 = 0; v1 < 4; v1++) { - v0 = (u16)GetMonData(param1, MON_DATA_MOVE1 + v1, NULL); + v0 = (u16)Pokemon_GetValue(param1, MON_DATA_MOVE1 + v1, NULL); if (v0 == param0->unk_5A4->unk_26) { return 0xfd; @@ -943,7 +943,7 @@ u8 sub_02086104 (UnkStruct_0207F248 * param0, Pokemon * param1) } } - if (CanMonLearnTM(param1, Item_TMHMNumber(param0->unk_5A4->unk_24)) == 0) { + if (Pokemon_CanLearnTM(param1, Item_TMHMNumber(param0->unk_5A4->unk_24)) == 0) { return 0xff; } @@ -963,7 +963,7 @@ int sub_0208615C (UnkStruct_0207F248 * param0) v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); v2 = sub_02086104(param0, v0); - sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); sub_0200B630(param0->unk_6A0, 1, param0->unk_5A4->unk_26); switch (v2) { @@ -1017,14 +1017,14 @@ int sub_020862F8 (UnkStruct_0207F248 * param0) Strbuf* v1; v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - sub_0200B5CC(param0->unk_6A0, 0, GetBoxMon(v0)); + sub_0200B5CC(param0->unk_6A0, 0, Pokemon_GetBoxPokemon(v0)); if (param0->unk_5A4->unk_28 == 4) { sub_0200B630(param0->unk_6A0, 1, param0->unk_5A4->unk_26); return sub_0208648C(param0); } - sub_0200B630(param0->unk_6A0, 1, GetMonData(v0, 54 + param0->unk_5A4->unk_28, NULL)); + sub_0200B630(param0->unk_6A0, 1, Pokemon_GetValue(v0, 54 + param0->unk_5A4->unk_28, NULL)); v1 = MessageLoader_GetNewStrbuf(param0->unk_69C, 60); sub_0200C388(param0->unk_6A0, param0->unk_6A4, v1); Strbuf_Free(v1); @@ -1137,13 +1137,13 @@ static void sub_02086590 (UnkStruct_0207F248 * param0, Pokemon * param1, u32 par u32 v0; v0 = param0->unk_5A4->unk_26; - SetMonData(param1, 54 + param2, &v0); + Pokemon_SetValue(param1, 54 + param2, &v0); v0 = 0; - SetMonData(param1, 62 + param2, &v0); + Pokemon_SetValue(param1, 62 + param2, &v0); v0 = MoveTable_CalcMaxPP(param0->unk_5A4->unk_26, 0); - SetMonData(param1, 58 + param2, &v0); + Pokemon_SetValue(param1, 58 + param2, &v0); if (param0->unk_5A4->unk_24 != 0) { if (Item_IsHMMove(param0->unk_5A4->unk_26) == 0) { @@ -1161,7 +1161,7 @@ static u8 sub_02086614 (UnkStruct_0207F248 * param0, u8 param1) u16 v2; v0 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - v2 = (u16)GetMonData(v0, MON_DATA_MOVE1 + param1, NULL); + v2 = (u16)Pokemon_GetValue(v0, MON_DATA_MOVE1 + param1, NULL); v1 = MessageLoader_GetNewStrbuf(param0->unk_69C, 162 + param1); sub_0200B630(param0->unk_6A0, 0, v2); @@ -1235,7 +1235,7 @@ int sub_02086774 (UnkStruct_0207F248 * param0) if (sub_02096F14(param0->unk_5A4->unk_00, param0->unk_5A4->unk_24, param0->unk_B11, (u8)v0, sub_02086930(param0), 12) == 1) { Pokemon * v1 = Party_GetPokemonBySlotIndex(param0->unk_5A4->unk_00, param0->unk_B11); - sub_02084E58(param0, param0->unk_5A4->unk_24, GetMonData(v1, MON_DATA_MOVE1 + v0, NULL)); + sub_02084E58(param0, param0->unk_5A4->unk_24, Pokemon_GetValue(v1, MON_DATA_MOVE1 + v0, NULL)); sub_0207D60C(param0->unk_5A4->unk_04, param0->unk_5A4->unk_24, 1, 12); sub_02005748(1516); } else { diff --git a/src/unk_0208694C.c b/src/unk_0208694C.c index 50493064eb..cfabc38c30 100644 --- a/src/unk_0208694C.c +++ b/src/unk_0208694C.c @@ -1141,7 +1141,7 @@ static int sub_02086F3C (UnkStruct_020067E8 * param0, int * param1) u16 v3[10 + 1]; Pokemon * v4; - v4 = AllocMonZeroed(18); + v4 = Pokemon_New(18); sub_02073D80(v4, v0->unk_04, 5, 10, 10, 10, 10, 10); Heap_FreeToHeap(v4); } @@ -1419,9 +1419,9 @@ static void sub_0208737C (UnkStruct_02087A10 * param0, UnkStruct_020067E8 * para if (param0->unk_00 == 1) { Pokemon * v1; - v1 = AllocMonZeroed(18); + v1 = Pokemon_New(18); sub_02073D80(v1, param0->unk_04, 5, 10, 10, 10, 10, 10); - sub_0200B538(param0->unk_168, 0, GetBoxMon(v1)); + sub_0200B538(param0->unk_168, 0, Pokemon_GetBoxPokemon(v1)); Heap_FreeToHeap(v1); } @@ -1485,10 +1485,10 @@ static void sub_02087544 (UnkStruct_02087A10 * param0, UnkStruct_020067E8 * para } if ((param0->unk_158 == 0) || sub_02086F14(param0->unk_D8)) { - Pokemon * v4 = AllocMonZeroed(18); + Pokemon * v4 = Pokemon_New(18); sub_02073D80(v4, param0->unk_04, 1, 0, 0, 0, 0, 0); - sub_0200B538(param0->unk_168, 0, GetBoxMon(v4)); + sub_0200B538(param0->unk_168, 0, Pokemon_GetBoxPokemon(v4)); Heap_FreeToHeap(v4); } else { param0->unk_D8[param0->unk_158] = 0xffff; diff --git a/src/unk_0208C324.c b/src/unk_0208C324.c index d85f24b2c1..5181b18092 100644 --- a/src/unk_0208C324.c +++ b/src/unk_0208C324.c @@ -886,8 +886,8 @@ static int sub_0208CF78 (UnkStruct_0208D7BC * param0) if (param0->unk_24C->unk_11 == 2) { v0 = sub_0208DD48(param0); - v1 = AllocMonZeroed(19); - sub_020774C8(v0, v1); + v1 = Pokemon_New(19); + Pokemon_FromBoxPokemon(v0, v1); } else { v1 = sub_0208DD48(param0); } @@ -896,41 +896,41 @@ static int sub_0208CF78 (UnkStruct_0208D7BC * param0) param0->unk_6A6 = 0; v2 = param0->unk_250.unk_45; - param0->unk_250.unk_45 = (u8)GetMonData(v1, MON_DATA_COOL, NULL); + param0->unk_250.unk_45 = (u8)Pokemon_GetValue(v1, MON_DATA_COOL, NULL); if (v2 != param0->unk_250.unk_45) { param0->unk_6A6 |= 1; } v2 = param0->unk_250.unk_46; - param0->unk_250.unk_46 = (u8)GetMonData(v1, MON_DATA_BEAUTY, NULL); + param0->unk_250.unk_46 = (u8)Pokemon_GetValue(v1, MON_DATA_BEAUTY, NULL); if (v2 != param0->unk_250.unk_46) { param0->unk_6A6 |= 2; } v2 = param0->unk_250.unk_47; - param0->unk_250.unk_47 = (u8)GetMonData(v1, MON_DATA_CUTE, NULL); + param0->unk_250.unk_47 = (u8)Pokemon_GetValue(v1, MON_DATA_CUTE, NULL); if (v2 != param0->unk_250.unk_47) { param0->unk_6A6 |= 4; } v2 = param0->unk_250.unk_48; - param0->unk_250.unk_48 = (u8)GetMonData(v1, MON_DATA_SMART, NULL); + param0->unk_250.unk_48 = (u8)Pokemon_GetValue(v1, MON_DATA_SMART, NULL); if (v2 != param0->unk_250.unk_48) { param0->unk_6A6 |= 8; } v2 = param0->unk_250.unk_49; - param0->unk_250.unk_49 = (u8)GetMonData(v1, MON_DATA_TOUGH, NULL); + param0->unk_250.unk_49 = (u8)Pokemon_GetValue(v1, MON_DATA_TOUGH, NULL); if (v2 != param0->unk_250.unk_49) { param0->unk_6A6 |= 16; } - param0->unk_250.unk_4A = (u8)GetMonData(v1, MON_DATA_SHEEN, NULL); + param0->unk_250.unk_4A = (u8)Pokemon_GetValue(v1, MON_DATA_SHEEN, NULL); if (param0->unk_24C->unk_11 == 2) { Heap_FreeToHeap(v1); @@ -1011,9 +1011,9 @@ static void sub_0208D1A4 (UnkStruct_0208D7BC * param0) static void sub_0208D1D4 (UnkStruct_0208D7BC * param0, BoxPokemon * param1, UnkStruct_0208D1D4 * param2) { - Pokemon * v0 = AllocMonZeroed(19); + Pokemon * v0 = Pokemon_New(19); - sub_020774C8(param1, v0); + Pokemon_FromBoxPokemon(param1, v0); sub_0208D200(param0, v0, param2); Heap_FreeToHeap(v0); } @@ -1025,11 +1025,11 @@ static void sub_0208D200 (UnkStruct_0208D7BC * param0, Pokemon * param1, UnkStru u8 v2; BOOL v3; - v3 = DecryptMon(param1); + v3 = Pokemon_EnterDecryptionContext(param1); - param2->unk_0C = (u16)GetMonData(param1, MON_DATA_SPECIES, NULL); + param2->unk_0C = (u16)Pokemon_GetValue(param1, MON_DATA_SPECIES, NULL); - v0 = GetBoxMon(param1); + v0 = Pokemon_GetBoxPokemon(param1); MessageLoader_GetStrbuf(param0->unk_688, 11, param0->unk_694); sub_0200B538(param0->unk_690, 0, v0); @@ -1043,65 +1043,65 @@ static void sub_0208D200 (UnkStruct_0208D7BC * param0, Pokemon * param1, UnkStru sub_0200B5EC(param0->unk_690, 0, v0); sub_0200C388(param0->unk_690, param0->unk_250.unk_08, param0->unk_694); - param2->unk_0E = (u16)GetMonData(param1, MON_DATA_HELD_ITEM, NULL); - param2->unk_12_0 = (u8)GetMonData(param1, MON_DATA_LEVEL, NULL); - param2->unk_50_28 = GetMonData(param1, MON_DATA_IS_EGG, NULL); + param2->unk_0E = (u16)Pokemon_GetValue(param1, MON_DATA_HELD_ITEM, NULL); + param2->unk_12_0 = (u8)Pokemon_GetValue(param1, MON_DATA_LEVEL, NULL); + param2->unk_50_28 = Pokemon_GetValue(param1, MON_DATA_IS_EGG, NULL); - if ((GetMonData(param1, MON_DATA_176, NULL) == 1) && (param2->unk_50_28 == 0)) { + if ((Pokemon_GetValue(param1, MON_DATA_176, NULL) == 1) && (param2->unk_50_28 == 0)) { param2->unk_12_7 = 0; } else { param2->unk_12_7 = 1; } - param2->unk_13_0 = GetMonGender(param1); - param2->unk_13_2 = (u8)GetMonData(param1, MON_DATA_POKEBALL, NULL); - param2->unk_10 = (u8)GetMonData(param1, MON_DATA_177, NULL); - param2->unk_11 = (u8)GetMonData(param1, MON_DATA_178, NULL); - param2->unk_14 = GetMonData(param1, MON_DATA_OT_ID, NULL); - param2->unk_18 = GetMonData(param1, MON_DATA_EXP, NULL); - param2->unk_44 = (u8)GetMonData(param1, MON_DATA_OT_GENDER, NULL); - param2->unk_1C = GetMonSpeciesLevelExp(param2->unk_0C, param2->unk_12_0); + param2->unk_13_0 = Pokemon_GetGender(param1); + param2->unk_13_2 = (u8)Pokemon_GetValue(param1, MON_DATA_POKEBALL, NULL); + param2->unk_10 = (u8)Pokemon_GetValue(param1, MON_DATA_177, NULL); + param2->unk_11 = (u8)Pokemon_GetValue(param1, MON_DATA_178, NULL); + param2->unk_14 = Pokemon_GetValue(param1, MON_DATA_OT_ID, NULL); + param2->unk_18 = Pokemon_GetValue(param1, MON_DATA_EXP, NULL); + param2->unk_44 = (u8)Pokemon_GetValue(param1, MON_DATA_OT_GENDER, NULL); + param2->unk_1C = Pokemon_GetSpeciesBaseExpAt(param2->unk_0C, param2->unk_12_0); if (param2->unk_12_0 == 100) { param2->unk_20 = param2->unk_1C; } else { - param2->unk_20 = GetMonSpeciesLevelExp(param2->unk_0C, param2->unk_12_0 + 1); + param2->unk_20 = Pokemon_GetSpeciesBaseExpAt(param2->unk_0C, param2->unk_12_0 + 1); } - param2->unk_24 = (u16)GetMonData(param1, MON_DATA_CURRENT_HP, NULL); - param2->unk_26 = (u16)GetMonData(param1, MON_DATA_MAX_HP, NULL); - param2->unk_28 = (u16)GetMonData(param1, MON_DATA_ATK, NULL); - param2->unk_2A = (u16)GetMonData(param1, MON_DATA_DEF, NULL); - param2->unk_2C = (u16)GetMonData(param1, MON_DATA_SP_ATK, NULL); - param2->unk_2E = (u16)GetMonData(param1, MON_DATA_SP_DEF, NULL); - param2->unk_30 = (u16)GetMonData(param1, MON_DATA_SPEED, NULL); - param2->unk_32 = (u8)GetMonData(param1, MON_DATA_ABILITY, NULL); - param2->unk_33 = GetMonNature(param1); + param2->unk_24 = (u16)Pokemon_GetValue(param1, MON_DATA_CURRENT_HP, NULL); + param2->unk_26 = (u16)Pokemon_GetValue(param1, MON_DATA_MAX_HP, NULL); + param2->unk_28 = (u16)Pokemon_GetValue(param1, MON_DATA_ATK, NULL); + param2->unk_2A = (u16)Pokemon_GetValue(param1, MON_DATA_DEF, NULL); + param2->unk_2C = (u16)Pokemon_GetValue(param1, MON_DATA_SP_ATK, NULL); + param2->unk_2E = (u16)Pokemon_GetValue(param1, MON_DATA_SP_DEF, NULL); + param2->unk_30 = (u16)Pokemon_GetValue(param1, MON_DATA_SPEED, NULL); + param2->unk_32 = (u8)Pokemon_GetValue(param1, MON_DATA_ABILITY, NULL); + param2->unk_33 = Pokemon_GetNature(param1); for (v1 = 0; v1 < 4; v1++) { - param2->unk_34[v1] = (u16)GetMonData(param1, MON_DATA_MOVE1 + v1, NULL); - param2->unk_3C[v1] = (u8)GetMonData(param1, MON_DATA_MOVE1_CUR_PP + v1, NULL); - v2 = (u8)GetMonData(param1, MON_DATA_MOVE1_PP_UPS + v1, NULL); + param2->unk_34[v1] = (u16)Pokemon_GetValue(param1, MON_DATA_MOVE1 + v1, NULL); + param2->unk_3C[v1] = (u8)Pokemon_GetValue(param1, MON_DATA_MOVE1_CUR_PP + v1, NULL); + v2 = (u8)Pokemon_GetValue(param1, MON_DATA_MOVE1_PP_UPS + v1, NULL); param2->unk_40[v1] = MoveTable_CalcMaxPP(param2->unk_34[v1], v2); } - param2->unk_45 = (u8)GetMonData(param1, MON_DATA_COOL, NULL); - param2->unk_46 = (u8)GetMonData(param1, MON_DATA_BEAUTY, NULL); - param2->unk_47 = (u8)GetMonData(param1, MON_DATA_CUTE, NULL); - param2->unk_48 = (u8)GetMonData(param1, MON_DATA_SMART, NULL); - param2->unk_49 = (u8)GetMonData(param1, MON_DATA_TOUGH, NULL); - param2->unk_4A = (u8)GetMonData(param1, MON_DATA_SHEEN, NULL); + param2->unk_45 = (u8)Pokemon_GetValue(param1, MON_DATA_COOL, NULL); + param2->unk_46 = (u8)Pokemon_GetValue(param1, MON_DATA_BEAUTY, NULL); + param2->unk_47 = (u8)Pokemon_GetValue(param1, MON_DATA_CUTE, NULL); + param2->unk_48 = (u8)Pokemon_GetValue(param1, MON_DATA_SMART, NULL); + param2->unk_49 = (u8)Pokemon_GetValue(param1, MON_DATA_TOUGH, NULL); + param2->unk_4A = (u8)Pokemon_GetValue(param1, MON_DATA_SHEEN, NULL); param2->unk_4B = 5; for (v1 = 0; v1 < 5; v1++) { - if (GetMonFlavorAffinity(param1, v1) == 1) { + if (Pokemon_GetFlavorAffinity(param1, v1) == 1) { param2->unk_4B = v1; break; } } - param2->unk_4C = GetMonData(param1, MON_DATA_11, NULL); - param2->unk_4E = GetMonData(param1, MON_DATA_FORM, NULL); + param2->unk_4C = Pokemon_GetValue(param1, MON_DATA_11, NULL); + param2->unk_4E = Pokemon_GetValue(param1, MON_DATA_FORM, NULL); param2->unk_50_0 = sub_0208E9F0(param1); if (sub_020778F8(param1) == 1) { @@ -1116,7 +1116,7 @@ static void sub_0208D200 (UnkStruct_0208D7BC * param0, Pokemon * param1, UnkStru param2->unk_50_30 = 0; } - if (GetMonShininess(param1) == 1) { + if (Pokemon_IsShiny(param1) == 1) { param2->unk_50_29 = 1; } else { param2->unk_50_29 = 0; @@ -1129,13 +1129,13 @@ static void sub_0208D200 (UnkStruct_0208D7BC * param0, Pokemon * param1, UnkStru param0->unk_6B1 = 0; for (v1 = 0; v1 < 80; v1++) { - if (GetMonData(param1, sub_020923C0(v1, 0), NULL) != 0) { + if (Pokemon_GetValue(param1, sub_020923C0(v1, 0), NULL) != 0) { param2->unk_54[v1 / 32] |= (1 << (v1 & 0x1f)); param0->unk_6B1++; } } - EncryptMon(param1, v3); + Pokemon_ExitDecryptionContext(param1, v3); } static void sub_0208D618 (UnkStruct_0208D7BC * param0) @@ -1524,10 +1524,10 @@ static s8 sub_0208DC1C (UnkStruct_0208D7BC * param0, s8 param1) return -1; } - v0 = (Pokemon *)((u32)param0->unk_24C->unk_00 + GetPokemonStructSize() * v1); + v0 = (Pokemon *)((u32)param0->unk_24C->unk_00 + Pokemon_GetStructSize() * v1); - if (GetMonData(v0, MON_DATA_SPECIES, NULL) != 0) { - if (GetMonData(v0, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL) != 0) { + if (Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL) != 0) { if (sub_0208DBF4(param0) == 1) { break; } @@ -1556,8 +1556,8 @@ static s8 sub_0208DC84 (UnkStruct_0208D7BC * param0, s8 param1) v0 = Party_GetPokemonBySlotIndex(param0->unk_24C->unk_00, v1); - if (GetMonData(v0, MON_DATA_SPECIES, NULL) != 0) { - if (GetMonData(v0, MON_DATA_IS_EGG, NULL) != 0) { + if (Pokemon_GetValue(v0, MON_DATA_SPECIES, NULL) != 0) { + if (Pokemon_GetValue(v0, MON_DATA_IS_EGG, NULL) != 0) { if (sub_0208DBF4(param0) == 1) { break; } @@ -1585,10 +1585,10 @@ static s8 sub_0208DCE0 (UnkStruct_0208D7BC * param0, s8 param1) return -1; } - v0 = (BoxPokemon *)((u32)param0->unk_24C->unk_00 + GetBoxPokemonStructSize() * v1); + v0 = (BoxPokemon *)((u32)param0->unk_24C->unk_00 + BoxPokemon_GetStructSize() * v1); - if (GetBoxMonData(v0, MON_DATA_SPECIES, NULL) != 0) { - if (GetBoxMonData(v0, MON_DATA_IS_EGG, NULL) != 0) { + if (BoxPokemon_GetValue(v0, MON_DATA_SPECIES, NULL) != 0) { + if (BoxPokemon_GetValue(v0, MON_DATA_IS_EGG, NULL) != 0) { if (sub_0208DBF4(param0) == 1) { break; } @@ -1605,11 +1605,11 @@ void * sub_0208DD48 (UnkStruct_0208D7BC * param0) { switch (param0->unk_24C->unk_11) { case 0: - return (void *)((u32)param0->unk_24C->unk_00 + (GetPokemonStructSize() * param0->unk_24C->unk_14)); + return (void *)((u32)param0->unk_24C->unk_00 + (Pokemon_GetStructSize() * param0->unk_24C->unk_14)); case 1: return (void *)Party_GetPokemonBySlotIndex(param0->unk_24C->unk_00, param0->unk_24C->unk_14); case 2: - return (void *)((u32)param0->unk_24C->unk_00 + (GetBoxPokemonStructSize() * param0->unk_24C->unk_14)); + return (void *)((u32)param0->unk_24C->unk_00 + (BoxPokemon_GetStructSize() * param0->unk_24C->unk_14)); } return NULL; @@ -1792,9 +1792,9 @@ static void sub_0208E0DC (UnkStruct_0208D7BC * param0) v0 = sub_0208DD48(param0); if (param0->unk_24C->unk_11 == 2) { - SwapBoxMonMoves(v0, param0->unk_6A5_0, param0->unk_6A5_4); + BoxPokemon_SwapMoveSlots(v0, param0->unk_6A5_0, param0->unk_6A5_4); } else { - SwapMonMoves(v0, param0->unk_6A5_0, param0->unk_6A5_4); + Pokemon_SwapMoveSlots(v0, param0->unk_6A5_0, param0->unk_6A5_4); } v1 = param0->unk_250.unk_34[param0->unk_6A5_0]; @@ -2217,9 +2217,9 @@ u32 sub_0208E9EC (void) u32 sub_0208E9F0 (Pokemon * param0) { - u32 v0 = GetMonData(param0, MON_DATA_160, NULL); + u32 v0 = Pokemon_GetValue(param0, MON_DATA_160, NULL); - if (GetMonData(param0, MON_DATA_CURRENT_HP, NULL) == 0) { + if (Pokemon_GetValue(param0, MON_DATA_CURRENT_HP, NULL) == 0) { return 6; } else if ((v0 & (0x8 | 0x80)) != 0) { return 4; diff --git a/src/unk_0208EA44.c b/src/unk_0208EA44.c index 8ce392b348..c206411cee 100644 --- a/src/unk_0208EA44.c +++ b/src/unk_0208EA44.c @@ -672,7 +672,7 @@ void sub_0208F71C (UnkStruct_0208D7BC * param0) sub_0200D948(param0->unk_414, param0->unk_418, 19, v1, 0, 11); sub_0200D414(param0->unk_41C[19], sub_02079EDC(param0->unk_250.unk_0C, param0->unk_250.unk_4E, param0->unk_250.unk_50_28) + 7); - sub_02021D0C(param0->unk_41C[19], (GetMonFormPersonalDataAttribute(param0->unk_250.unk_0C, param0->unk_250.unk_4E, 28) ^ 1)); + sub_02021D0C(param0->unk_41C[19], (PokemonPersonalData_GetFormValue(param0->unk_250.unk_0C, param0->unk_250.unk_4E, 28) ^ 1)); } void sub_0208F7A4 (UnkStruct_0208D7BC * param0) diff --git a/src/unk_0208FCF8.c b/src/unk_0208FCF8.c index 859dfc67b3..2a50f291a6 100644 --- a/src/unk_0208FCF8.c +++ b/src/unk_0208FCF8.c @@ -573,9 +573,9 @@ static void sub_020908CC (UnkStruct_0208D7BC * param0) if (param0->unk_24C->unk_11 == 2) { { - Pokemon * v3 = AllocMonZeroed(19); + Pokemon * v3 = Pokemon_New(19); - sub_020774C8(v1, v3); + Pokemon_FromBoxPokemon(v1, v3); sub_02090800(¶m0->unk_244[0], v3, v2); Heap_FreeToHeap(v3); } diff --git a/src/unk_020916B4.c b/src/unk_020916B4.c index 193f620074..53a355514d 100644 --- a/src/unk_020916B4.c +++ b/src/unk_020916B4.c @@ -349,7 +349,7 @@ void sub_02091F8C (UnkStruct_0208D7BC * param0) sub_020789BC(param0->unk_6A0, param0->unk_2B4.unk_08, param0->unk_250.unk_0C, 1); - param0->unk_2B4.unk_38 = GetMonFormPersonalDataAttribute(param0->unk_250.unk_0C, param0->unk_250.unk_4E, 28) ^ 1; + param0->unk_2B4.unk_38 = PokemonPersonalData_GetFormValue(param0->unk_250.unk_0C, param0->unk_250.unk_4E, 28) ^ 1; param0->unk_2B4.unk_34 = sub_02007C34(param0->unk_2B4.unk_04, &v0, 52, 104, 0, 0, param0->unk_2B4.unk_08, NULL); sub_02007DEC(param0->unk_2B4.unk_34, 35, param0->unk_2B4.unk_38); diff --git a/src/unk_02092494.c b/src/unk_02092494.c index f6f7d0e39a..0890880685 100644 --- a/src/unk_02092494.c +++ b/src/unk_02092494.c @@ -319,7 +319,7 @@ void sub_0209282C (UnkStruct_02090800 * param0) static void sub_02092878 (UnkStruct_02090800 * param0) { - int v0 = GetMonNature(param0->unk_0C); + int v0 = Pokemon_GetNature(param0->unk_0C); if (v0 > 24) { return; @@ -336,15 +336,15 @@ static void sub_020928A0 (UnkStruct_02090800 * param0, int param1) param0->unk_1C.unk_04 = Strbuf_Init((((2 * 18) * 2) * 8), param0->unk_00); MessageLoader_GetStrbuf(param0->unk_04, param1, v0); - sub_0200B60C(param0->unk_08, 0, GetMonData(param0->unk_0C, MON_DATA_149, NULL), 2, 2, 1); - sub_0200C2E0(param0->unk_08, 1, GetMonData(param0->unk_0C, MON_DATA_150, NULL)); - sub_0200B60C(param0->unk_08, 2, GetMonData(param0->unk_0C, MON_DATA_151, NULL), 2, 0, 1); - sub_0200B60C(param0->unk_08, 3, GetMonData(param0->unk_0C, MON_DATA_MET_LEVEL, NULL), 3, 0, 1); - sub_0200BECC(param0->unk_08, 4, GetMonData(param0->unk_0C, MON_DATA_153, NULL)); - sub_0200B60C(param0->unk_08, 5, GetMonData(param0->unk_0C, MON_DATA_146, NULL), 2, 2, 1); - sub_0200C2E0(param0->unk_08, 6, GetMonData(param0->unk_0C, MON_DATA_147, NULL)); - sub_0200B60C(param0->unk_08, 7, GetMonData(param0->unk_0C, MON_DATA_148, NULL), 2, 0, 1); - sub_0200BECC(param0->unk_08, 8, GetMonData(param0->unk_0C, MON_DATA_152, NULL)); + sub_0200B60C(param0->unk_08, 0, Pokemon_GetValue(param0->unk_0C, MON_DATA_149, NULL), 2, 2, 1); + sub_0200C2E0(param0->unk_08, 1, Pokemon_GetValue(param0->unk_0C, MON_DATA_150, NULL)); + sub_0200B60C(param0->unk_08, 2, Pokemon_GetValue(param0->unk_0C, MON_DATA_151, NULL), 2, 0, 1); + sub_0200B60C(param0->unk_08, 3, Pokemon_GetValue(param0->unk_0C, MON_DATA_MET_LEVEL, NULL), 3, 0, 1); + sub_0200BECC(param0->unk_08, 4, Pokemon_GetValue(param0->unk_0C, MON_DATA_153, NULL)); + sub_0200B60C(param0->unk_08, 5, Pokemon_GetValue(param0->unk_0C, MON_DATA_146, NULL), 2, 2, 1); + sub_0200C2E0(param0->unk_08, 6, Pokemon_GetValue(param0->unk_0C, MON_DATA_147, NULL)); + sub_0200B60C(param0->unk_08, 7, Pokemon_GetValue(param0->unk_0C, MON_DATA_148, NULL), 2, 0, 1); + sub_0200BECC(param0->unk_08, 8, Pokemon_GetValue(param0->unk_0C, MON_DATA_152, NULL)); sub_0200C388(param0->unk_08, param0->unk_1C.unk_04, v0); Strbuf_Free(v0); } @@ -356,12 +356,12 @@ static void sub_020929C0 (UnkStruct_02090800 * param0, int param1) param0->unk_1C.unk_04 = Strbuf_Init((((2 * 18) * 2) * 4), param0->unk_00); MessageLoader_GetStrbuf(param0->unk_04, param1, v0); - sub_0200B60C(param0->unk_08, 0, GetMonData(param0->unk_0C, MON_DATA_149, NULL), 2, 2, 1); - sub_0200C2E0(param0->unk_08, 1, GetMonData(param0->unk_0C, MON_DATA_150, NULL)); - sub_0200B60C(param0->unk_08, 2, GetMonData(param0->unk_0C, MON_DATA_151, NULL), 2, 0, 1); - sub_0200B60C(param0->unk_08, 3, GetMonData(param0->unk_0C, MON_DATA_MET_LEVEL, NULL), 3, 0, 1); + sub_0200B60C(param0->unk_08, 0, Pokemon_GetValue(param0->unk_0C, MON_DATA_149, NULL), 2, 2, 1); + sub_0200C2E0(param0->unk_08, 1, Pokemon_GetValue(param0->unk_0C, MON_DATA_150, NULL)); + sub_0200B60C(param0->unk_08, 2, Pokemon_GetValue(param0->unk_0C, MON_DATA_151, NULL), 2, 0, 1); + sub_0200B60C(param0->unk_08, 3, Pokemon_GetValue(param0->unk_0C, MON_DATA_MET_LEVEL, NULL), 3, 0, 1); - switch (GetMonData(param0->unk_0C, MON_DATA_MET_GAME, NULL)) { + switch (Pokemon_GetValue(param0->unk_0C, MON_DATA_MET_GAME, NULL)) { default: sub_0200BECC(param0->unk_08, 4, (sub_02017070(1, 7))); break; @@ -401,15 +401,15 @@ static void sub_02092B1C (UnkStruct_02090800 * param0, int param1, int param2) MessageLoader_GetStrbuf(param0->unk_04, param1, v0); if (param2 == 0) { - sub_0200B60C(param0->unk_08, 5, GetMonData(param0->unk_0C, MON_DATA_146, NULL), 2, 2, 1); - sub_0200C2E0(param0->unk_08, 6, GetMonData(param0->unk_0C, MON_DATA_147, NULL)); - sub_0200B60C(param0->unk_08, 7, GetMonData(param0->unk_0C, MON_DATA_148, NULL), 2, 0, 1); - sub_0200BECC(param0->unk_08, 8, GetMonData(param0->unk_0C, MON_DATA_152, NULL)); + sub_0200B60C(param0->unk_08, 5, Pokemon_GetValue(param0->unk_0C, MON_DATA_146, NULL), 2, 2, 1); + sub_0200C2E0(param0->unk_08, 6, Pokemon_GetValue(param0->unk_0C, MON_DATA_147, NULL)); + sub_0200B60C(param0->unk_08, 7, Pokemon_GetValue(param0->unk_0C, MON_DATA_148, NULL), 2, 0, 1); + sub_0200BECC(param0->unk_08, 8, Pokemon_GetValue(param0->unk_0C, MON_DATA_152, NULL)); } else { - sub_0200B60C(param0->unk_08, 5, GetMonData(param0->unk_0C, MON_DATA_149, NULL), 2, 2, 1); - sub_0200C2E0(param0->unk_08, 6, GetMonData(param0->unk_0C, MON_DATA_150, NULL)); - sub_0200B60C(param0->unk_08, 7, GetMonData(param0->unk_0C, MON_DATA_151, NULL), 2, 0, 1); - sub_0200BECC(param0->unk_08, 8, GetMonData(param0->unk_0C, MON_DATA_153, NULL)); + sub_0200B60C(param0->unk_08, 5, Pokemon_GetValue(param0->unk_0C, MON_DATA_149, NULL), 2, 2, 1); + sub_0200C2E0(param0->unk_08, 6, Pokemon_GetValue(param0->unk_0C, MON_DATA_150, NULL)); + sub_0200B60C(param0->unk_08, 7, Pokemon_GetValue(param0->unk_0C, MON_DATA_151, NULL), 2, 0, 1); + sub_0200BECC(param0->unk_08, 8, Pokemon_GetValue(param0->unk_0C, MON_DATA_153, NULL)); } sub_0200C388(param0->unk_08, param0->unk_1C.unk_04, v0); @@ -432,14 +432,14 @@ static void sub_02092C24 (UnkStruct_02090800 * param0) param0->unk_24.unk_04 = Strbuf_Init(((2 * 18) * 2), param0->unk_00); - v0[0] = (GetMonData(param0->unk_0C, MON_DATA_HP_IV, NULL)); - v0[1] = (GetMonData(param0->unk_0C, MON_DATA_ATK_IV, NULL)); - v0[2] = (GetMonData(param0->unk_0C, MON_DATA_DEF_IV, NULL)); - v0[3] = (GetMonData(param0->unk_0C, MON_DATA_SPEED_IV, NULL)); - v0[4] = (GetMonData(param0->unk_0C, MON_DATA_SPATK_IV, NULL)); - v0[5] = (GetMonData(param0->unk_0C, MON_DATA_SPDEF_IV, NULL)); + v0[0] = (Pokemon_GetValue(param0->unk_0C, MON_DATA_HP_IV, NULL)); + v0[1] = (Pokemon_GetValue(param0->unk_0C, MON_DATA_ATK_IV, NULL)); + v0[2] = (Pokemon_GetValue(param0->unk_0C, MON_DATA_DEF_IV, NULL)); + v0[3] = (Pokemon_GetValue(param0->unk_0C, MON_DATA_SPEED_IV, NULL)); + v0[4] = (Pokemon_GetValue(param0->unk_0C, MON_DATA_SPATK_IV, NULL)); + v0[5] = (Pokemon_GetValue(param0->unk_0C, MON_DATA_SPDEF_IV, NULL)); - switch ((GetMonData(param0->unk_0C, MON_DATA_PERSONALITY, NULL) % 6)) { + switch ((Pokemon_GetValue(param0->unk_0C, MON_DATA_PERSONALITY, NULL) % 6)) { default: case 0: v1 = 0; @@ -608,7 +608,7 @@ static void sub_02092E10 (UnkStruct_02090800 * param0) v1 = 0; for (v0 = 0; v0 < 5; v0++) { - if (GetMonFlavorAffinity(param0->unk_0C, v0) == 1) { + if (Pokemon_GetFlavorAffinity(param0->unk_0C, v0) == 1) { v1 = v0 + 1; } } @@ -619,7 +619,7 @@ static void sub_02092E10 (UnkStruct_02090800 * param0) static void sub_02092E4C (UnkStruct_02090800 * param0) { - int v0 = GetMonData(param0->unk_0C, MON_DATA_FRIENDSHIP, NULL); + int v0 = Pokemon_GetValue(param0->unk_0C, MON_DATA_FRIENDSHIP, NULL); int v1; param0->unk_34.unk_04 = Strbuf_Init((((2 * 18) * 2) * 4), param0->unk_00); @@ -641,17 +641,17 @@ static int sub_02092E8C (Pokemon * param0, BOOL param1, int param2) { int v0 = 0; - if (GetMonData(param0, MON_DATA_IS_EGG, NULL) == 0) { - if ((GetMonData(param0, MON_DATA_152, NULL) == 0)) { - if (GetMonData(param0, MON_DATA_153, NULL) == (sub_02017070(0, 55))) { + if (Pokemon_GetValue(param0, MON_DATA_IS_EGG, NULL) == 0) { + if ((Pokemon_GetValue(param0, MON_DATA_152, NULL) == 0)) { + if (Pokemon_GetValue(param0, MON_DATA_153, NULL) == (sub_02017070(0, 55))) { v0 = 15; - } else if ((GetMonData(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1)) { + } else if ((Pokemon_GetValue(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1)) { if (param1 == 1) { v0 = 7; } else { v0 = 8; } - } else if (GetMonData(param0, MON_DATA_153, NULL) == (sub_02017070(1, 1))) { + } else if (Pokemon_GetValue(param0, MON_DATA_153, NULL) == (sub_02017070(1, 1))) { v0 = 2; } else { if (param1 == 1) { @@ -661,14 +661,14 @@ static int sub_02092E8C (Pokemon * param0, BOOL param1, int param2) } } } else { - if ((GetMonData(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1)) { - if (GetMonData(param0, MON_DATA_152, NULL) == sub_02017070(1, 2)) { + if ((Pokemon_GetValue(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1)) { + if (Pokemon_GetValue(param0, MON_DATA_152, NULL) == sub_02017070(1, 2)) { if (param1 == 1) { v0 = 13; } else { v0 = 14; } - } else if (GetMonData(param0, MON_DATA_152, NULL) == sub_02017070(2, 1)) { + } else if (Pokemon_GetValue(param0, MON_DATA_152, NULL) == sub_02017070(2, 1)) { if (param1 == 1) { v0 = 11; } else { @@ -682,7 +682,7 @@ static int sub_02092E8C (Pokemon * param0, BOOL param1, int param2) } } } else { - if ((GetMonData(param0, MON_DATA_152, NULL) == sub_02017070(1, 1)) || (GetMonData(param0, MON_DATA_152, NULL) == sub_02017070(1, 0)) || (GetMonData(param0, MON_DATA_152, NULL) == sub_02017070(1, 9)) || (GetMonData(param0, MON_DATA_152, NULL) == sub_02017070(1, 10)) || (GetMonData(param0, MON_DATA_152, NULL) == sub_02017070(1, 11))) { + if ((Pokemon_GetValue(param0, MON_DATA_152, NULL) == sub_02017070(1, 1)) || (Pokemon_GetValue(param0, MON_DATA_152, NULL) == sub_02017070(1, 0)) || (Pokemon_GetValue(param0, MON_DATA_152, NULL) == sub_02017070(1, 9)) || (Pokemon_GetValue(param0, MON_DATA_152, NULL) == sub_02017070(1, 10)) || (Pokemon_GetValue(param0, MON_DATA_152, NULL) == sub_02017070(1, 11))) { if (param1 == 1) { v0 = 5; } else { @@ -699,8 +699,8 @@ static int sub_02092E8C (Pokemon * param0, BOOL param1, int param2) } } else { if (param1 == 1) { - if ((GetMonData(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1)) { - if (GetMonData(param0, MON_DATA_152, NULL) == (sub_02017070(2, 1))) { + if ((Pokemon_GetValue(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1)) { + if (Pokemon_GetValue(param0, MON_DATA_152, NULL) == (sub_02017070(2, 1))) { v0 = 20; } else { v0 = 18; @@ -709,7 +709,7 @@ static int sub_02092E8C (Pokemon * param0, BOOL param1, int param2) v0 = 16; } } else { - if ((GetMonData(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1)) { + if ((Pokemon_GetValue(param0, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1)) { v0 = 19; } else { v0 = 17; @@ -733,7 +733,7 @@ void sub_0209305C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, param3 = (sub_02017070(2, 2)); } - if (GetBoxMonData(param0, MON_DATA_IS_EGG, NULL) == 0) { + if (BoxPokemon_GetValue(param0, MON_DATA_IS_EGG, NULL) == 0) { sub_02093368(param0, 0); sub_020932F0(param0, param3, 1); sub_020933C8(param0); @@ -745,7 +745,7 @@ void sub_0209305C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, sub_020932A4(param0, param1, param4); break; case 1: - if (GetBoxMonData(param0, MON_DATA_IS_EGG, NULL) == 0) { + if (BoxPokemon_GetValue(param0, MON_DATA_IS_EGG, NULL) == 0) { sub_02093368(param0, 0); sub_020932F0(param0, (sub_02017070(1, 1)), 1); sub_020933C8(param0); @@ -766,7 +766,7 @@ void sub_0209305C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, break; case 4: if (sub_0207884C(param0, param1, param4) == 1) { - if (GetBoxMonData(param0, MON_DATA_IS_EGG, NULL) == 0) { + if (BoxPokemon_GetValue(param0, MON_DATA_IS_EGG, NULL) == 0) { sub_02093368(param0, 0); sub_020932F0(param0, param3, 1); sub_020933C8(param0); @@ -775,7 +775,7 @@ void sub_0209305C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, sub_02093368(param0, 1); } } else { - if (GetBoxMonData(param0, MON_DATA_IS_EGG, NULL) == 0) { + if (BoxPokemon_GetValue(param0, MON_DATA_IS_EGG, NULL) == 0) { sub_02093368(param0, 0); sub_020932F0(param0, param3, 1); sub_020933C8(param0); @@ -788,7 +788,7 @@ void sub_0209305C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, sub_020933E8(param0); break; case 5: - if (GetBoxMonData(param0, MON_DATA_IS_EGG, NULL) == 0) { + if (BoxPokemon_GetValue(param0, MON_DATA_IS_EGG, NULL) == 0) { (void)0; } else { sub_020932F0(param0, (sub_02017070(1, 2)), 1); @@ -803,17 +803,17 @@ void sub_0209305C (BoxPokemon * param0, UnkStruct_02025E6C * param1, int param2, { int v0; - v0 = GetBoxMonData(param0, MON_DATA_153, NULL); - SetBoxMonData(param0, 152, &v0); + v0 = BoxPokemon_GetValue(param0, MON_DATA_153, NULL); + BoxPokemon_SetValue(param0, 152, &v0); - v0 = GetBoxMonData(param0, MON_DATA_149, NULL); - SetBoxMonData(param0, 146, &v0); + v0 = BoxPokemon_GetValue(param0, MON_DATA_149, NULL); + BoxPokemon_SetValue(param0, 146, &v0); - v0 = GetBoxMonData(param0, MON_DATA_150, NULL); - SetBoxMonData(param0, 147, &v0); + v0 = BoxPokemon_GetValue(param0, MON_DATA_150, NULL); + BoxPokemon_SetValue(param0, 147, &v0); - v0 = GetBoxMonData(param0, MON_DATA_151, NULL); - SetBoxMonData(param0, 148, &v0); + v0 = BoxPokemon_GetValue(param0, MON_DATA_151, NULL); + BoxPokemon_SetValue(param0, 148, &v0); } } @@ -829,9 +829,9 @@ static void sub_020932A4 (BoxPokemon * param0, UnkStruct_02025E6C * param1, int int v1 = sub_02025F30(param1); Strbuf* v2 = sub_02025F04(param1, param2); - SetBoxMonData(param0, 7, &v0); - SetBoxMonData(param0, 157, &v1); - SetBoxMonData(param0, 145, v2); + BoxPokemon_SetValue(param0, 7, &v0); + BoxPokemon_SetValue(param0, 157, &v1); + BoxPokemon_SetValue(param0, 145, v2); Strbuf_Free(v2); } @@ -842,15 +842,15 @@ static void sub_020932F0 (BoxPokemon * param0, int param1, int param2) sub_020138A4(&v0); if (param2 == 0) { - SetBoxMonData(param0, 152, ¶m1); - SetBoxMonData(param0, 146, &v0.year); - SetBoxMonData(param0, 147, &v0.month); - SetBoxMonData(param0, 148, &v0.day); + BoxPokemon_SetValue(param0, 152, ¶m1); + BoxPokemon_SetValue(param0, 146, &v0.year); + BoxPokemon_SetValue(param0, 147, &v0.month); + BoxPokemon_SetValue(param0, 148, &v0.day); } else { - SetBoxMonData(param0, 153, ¶m1); - SetBoxMonData(param0, 149, &v0.year); - SetBoxMonData(param0, 150, &v0.month); - SetBoxMonData(param0, 151, &v0.day); + BoxPokemon_SetValue(param0, 153, ¶m1); + BoxPokemon_SetValue(param0, 149, &v0.year); + BoxPokemon_SetValue(param0, 150, &v0.month); + BoxPokemon_SetValue(param0, 151, &v0.day); } } @@ -859,26 +859,26 @@ static void sub_02093368 (BoxPokemon * param0, int param1) int v0 = 0; if (param1 == 0) { - SetBoxMonData(param0, 152, &v0); - SetBoxMonData(param0, 146, &v0); - SetBoxMonData(param0, 147, &v0); - SetBoxMonData(param0, 148, &v0); + BoxPokemon_SetValue(param0, 152, &v0); + BoxPokemon_SetValue(param0, 146, &v0); + BoxPokemon_SetValue(param0, 147, &v0); + BoxPokemon_SetValue(param0, 148, &v0); } else { - SetBoxMonData(param0, 153, &v0); - SetBoxMonData(param0, 149, &v0); - SetBoxMonData(param0, 150, &v0); - SetBoxMonData(param0, 151, &v0); + BoxPokemon_SetValue(param0, 153, &v0); + BoxPokemon_SetValue(param0, 149, &v0); + BoxPokemon_SetValue(param0, 150, &v0); + BoxPokemon_SetValue(param0, 151, &v0); } } static void sub_020933C8 (BoxPokemon * param0) { - int v0 = GetBoxMonData(param0, MON_DATA_LEVEL, NULL); - SetBoxMonData(param0, 156, &v0); + int v0 = BoxPokemon_GetValue(param0, MON_DATA_LEVEL, NULL); + BoxPokemon_SetValue(param0, 156, &v0); } static void sub_020933E8 (BoxPokemon * param0) { int v0 = 1; - SetBoxMonData(param0, 110, &v0); + BoxPokemon_SetValue(param0, 110, &v0); } diff --git a/src/unk_020933F8.c b/src/unk_020933F8.c index 056089dab0..59e42ef18b 100644 --- a/src/unk_020933F8.c +++ b/src/unk_020933F8.c @@ -441,7 +441,7 @@ UnkStruct_02095C48 * sub_02093800 (const UnkStruct_02093800 * param0) v0->unk_148 = sub_02079FF4(20); for (v2 = 0; v2 < 4; v2++) { - v0->unk_00.unk_00[v2] = AllocMonZeroed(20); + v0->unk_00.unk_00[v2] = Pokemon_New(20); } for (v2 = 0; v2 < 4; v2++) { @@ -451,7 +451,7 @@ UnkStruct_02095C48 * sub_02093800 (const UnkStruct_02093800 * param0) sub_0202CD3C(v0->unk_14C[0], param0->unk_20); { - sub_020775EC(param0->unk_08, v0->unk_00.unk_00[0]); + Pokemon_Copy(param0->unk_08, v0->unk_00.unk_00[0]); v0->unk_00.unk_D8[0] = Strbuf_Init(8, 20); Strbuf_Copy(v0->unk_00.unk_D8[0], param0->unk_0C); @@ -505,7 +505,7 @@ static void sub_020939E0 (UnkStruct_02095C48 * param0, int param1, int param2) param0->unk_00.unk_D8[v1] = Strbuf_Init(8, 20); } - GetMonData(param0->unk_00.unk_00[v1], MON_DATA_145, param0->unk_00.unk_D8[v1]); + Pokemon_GetValue(param0->unk_00.unk_00[v1], MON_DATA_145, param0->unk_00.unk_D8[v1]); } for (v1 = 1; v1 < 4; v1++) { @@ -554,19 +554,19 @@ static int sub_02093B2C (Pokemon * param0, int param1) for (v1 = 0; v1 <= 3; v1++) { switch (param1) { case 0: - v2 = GetMonData(param0, MON_DATA_123 + v1, NULL); + v2 = Pokemon_GetValue(param0, MON_DATA_123 + v1, NULL); break; case 1: - v2 = GetMonData(param0, MON_DATA_127 + v1, NULL); + v2 = Pokemon_GetValue(param0, MON_DATA_127 + v1, NULL); break; case 2: - v2 = GetMonData(param0, MON_DATA_131 + v1, NULL); + v2 = Pokemon_GetValue(param0, MON_DATA_131 + v1, NULL); break; case 3: - v2 = GetMonData(param0, MON_DATA_135 + v1, NULL); + v2 = Pokemon_GetValue(param0, MON_DATA_135 + v1, NULL); break; case 4: - v2 = GetMonData(param0, MON_DATA_139 + v1, NULL); + v2 = Pokemon_GetValue(param0, MON_DATA_139 + v1, NULL); break; default: GF_ASSERT(0); @@ -1148,7 +1148,7 @@ void sub_02094680 (UnkStruct_02095C48 * param0, int param1, UnkStruct_0200B358 * int v1; v1 = sub_02095904(param1); - v0 = GetBoxMon(param0->unk_00.unk_00[v1]); + v0 = Pokemon_GetBoxPokemon(param0->unk_00.unk_00[v1]); sub_0200B5CC(param2, param3, v0); } @@ -1318,7 +1318,7 @@ BOOL sub_02094868 (UnkStruct_02095C48 * param0) v0 = sub_02095A3C(param0->unk_00.unk_110, param0->unk_00.unk_10F); - if (GetMonData(param0->unk_1974, v0, NULL) == 0) { + if (Pokemon_GetValue(param0->unk_1974, v0, NULL) == 0) { return 0; } @@ -1617,11 +1617,11 @@ void sub_02094C44 (UnkStruct_02095C48 * param0, UnkStruct_021C0794 * param1, u32 v2 = sub_02095A3C(param0->unk_00.unk_110, param0->unk_00.unk_10F); - if (GetMonData(param0->unk_1974, v2, NULL) == 0) { + if (Pokemon_GetValue(param0->unk_1974, v2, NULL) == 0) { v0 = 1; } - SetMonData(param0->unk_1974, v2, &v3); + Pokemon_SetValue(param0->unk_1974, v2, &v3); sub_0206DDB8(param0->unk_1970, param0->unk_1974, v2); } diff --git a/src/unk_02094EDC.c b/src/unk_02094EDC.c index 1d2d90c62a..c07c81950c 100644 --- a/src/unk_02094EDC.c +++ b/src/unk_02094EDC.c @@ -628,7 +628,7 @@ void sub_02095380 (const UnkStruct_ov6_02248BE8 * param0, Pokemon * param1, int for (v0 = 0; v0 < 4; v0++) { v1 = param0->unk_0C[v0]; - SetMonData(param1, 54 + v0, &v1); + Pokemon_SetValue(param1, 54 + v0, &v1); } { @@ -639,8 +639,8 @@ void sub_02095380 (const UnkStruct_ov6_02248BE8 * param0, Pokemon * param1, int v3 = MessageLoader_GetNewStrbuf(v5, param0->unk_16); v4 = MessageLoader_GetNewStrbuf(v5, param0->unk_18); - SetMonData(param1, 119, v3); - SetMonData(param1, 145, v4); + Pokemon_SetValue(param1, 119, v3); + Pokemon_SetValue(param1, 145, v4); Strbuf_Free(v3); Strbuf_Free(v4); @@ -657,12 +657,12 @@ void sub_02095380 (const UnkStruct_ov6_02248BE8 * param0, Pokemon * param1, int v10 = param0->unk_1E; v11 = param0->unk_1F; - SetMonData(param1, 19, &v6); - SetMonData(param1, 20, &v7); - SetMonData(param1, 21, &v8); - SetMonData(param1, 22, &v9); - SetMonData(param1, 23, &v10); - SetMonData(param1, 24, &v11); + Pokemon_SetValue(param1, 19, &v6); + Pokemon_SetValue(param1, 20, &v7); + Pokemon_SetValue(param1, 21, &v8); + Pokemon_SetValue(param1, 22, &v9); + Pokemon_SetValue(param1, 23, &v10); + Pokemon_SetValue(param1, 24, &v11); } } diff --git a/src/unk_02096420.c b/src/unk_02096420.c index ef711044b6..2a2179ee91 100644 --- a/src/unk_02096420.c +++ b/src/unk_02096420.c @@ -31,7 +31,7 @@ u8 sub_02096420 (Pokemon * param0, u16 param1, u16 param2, u32 param3) return 0; } - v1[0] = GetMonData(param0, MON_DATA_160, NULL); + v1[0] = Pokemon_GetValue(param0, MON_DATA_160, NULL); if (Item_Get(v0, 15) != 0) { if ((v1[0] & 0x7) != 0) { @@ -68,7 +68,7 @@ u8 sub_02096420 (Pokemon * param0, u16 param1, u16 param2, u32 param3) } } - v1[0] = GetMonData(param0, MON_DATA_CURRENT_HP, NULL); + v1[0] = Pokemon_GetValue(param0, MON_DATA_CURRENT_HP, NULL); if (((Item_Get(v0, 23) != 0) || (Item_Get(v0, 24) != 0)) && (Item_Get(v0, 25) == 0)) { if (v1[0] == 0) { @@ -76,14 +76,14 @@ u8 sub_02096420 (Pokemon * param0, u16 param1, u16 param2, u32 param3) return 1; } } else if (Item_Get(v0, 38) != 0) { - if ((v1[0] != 0) && (v1[0] < GetMonData(param0, MON_DATA_MAX_HP, NULL))) { + if ((v1[0] != 0) && (v1[0] < Pokemon_GetValue(param0, MON_DATA_MAX_HP, NULL))) { Heap_FreeToHeap(v0); return 1; } } if (Item_Get(v0, 25) != 0) { - if (GetMonData(param0, MON_DATA_LEVEL, NULL) < 100) { + if (Pokemon_GetValue(param0, MON_DATA_LEVEL, NULL) < 100) { Heap_FreeToHeap(v0); return 1; } @@ -97,7 +97,7 @@ u8 sub_02096420 (Pokemon * param0, u16 param1, u16 param2, u32 param3) } if ((Item_Get(v0, 34) != 0) || (Item_Get(v0, 35) != 0)) { - if ((GetMonData(param0, MON_DATA_MOVE1_PP_UPS + param2, NULL) < 3) && (MoveTable_CalcMaxPP(GetMonData(param0, MON_DATA_MOVE1 + param2, NULL), 0) >= 5)) { + if ((Pokemon_GetValue(param0, MON_DATA_MOVE1_PP_UPS + param2, NULL) < 3) && (MoveTable_CalcMaxPP(Pokemon_GetValue(param0, MON_DATA_MOVE1 + param2, NULL), 0) >= 5)) { Heap_FreeToHeap(v0); return 1; } @@ -119,14 +119,14 @@ u8 sub_02096420 (Pokemon * param0, u16 param1, u16 param2, u32 param3) } } - v1[0] = GetMonData(param0, MON_DATA_HP_EV, NULL); - v1[1] = GetMonData(param0, MON_DATA_ATK_EV, NULL); - v1[2] = GetMonData(param0, MON_DATA_DEF_EV, NULL); - v1[3] = GetMonData(param0, MON_DATA_SPEED_EV, NULL); - v1[4] = GetMonData(param0, MON_DATA_SPATK_EV, NULL); - v1[5] = GetMonData(param0, MON_DATA_SPDEF_EV, NULL); + v1[0] = Pokemon_GetValue(param0, MON_DATA_HP_EV, NULL); + v1[1] = Pokemon_GetValue(param0, MON_DATA_ATK_EV, NULL); + v1[2] = Pokemon_GetValue(param0, MON_DATA_DEF_EV, NULL); + v1[3] = Pokemon_GetValue(param0, MON_DATA_SPEED_EV, NULL); + v1[4] = Pokemon_GetValue(param0, MON_DATA_SPATK_EV, NULL); + v1[5] = Pokemon_GetValue(param0, MON_DATA_SPDEF_EV, NULL); - if (GetMonData(param0, MON_DATA_SPECIES, NULL) != 292) { + if (Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL) != 292) { if (Item_Get(v0, 39) != 0) { v1[6] = Item_Get(v0, 48); @@ -282,7 +282,7 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param v2 = 0; v3 = 0; - v1[0] = GetMonData(param0, MON_DATA_160, NULL); + v1[0] = Pokemon_GetValue(param0, MON_DATA_160, NULL); v1[1] = v1[0]; if (Item_Get(v0, 15) != 0) { @@ -311,12 +311,12 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param } if (v1[0] != v1[1]) { - SetMonData(param0, 160, &v1[1]); + Pokemon_SetValue(param0, 160, &v1[1]); v2 = 1; } - v1[0] = GetMonData(param0, MON_DATA_CURRENT_HP, NULL); - v1[1] = GetMonData(param0, MON_DATA_MAX_HP, NULL); + v1[0] = Pokemon_GetValue(param0, MON_DATA_CURRENT_HP, NULL); + v1[1] = Pokemon_GetValue(param0, MON_DATA_MAX_HP, NULL); if (((Item_Get(v0, 23) != 0) || (Item_Get(v0, 24) != 0)) && (Item_Get(v0, 25) != 0)) { if (v1[0] == 0) { @@ -334,15 +334,15 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param v3 = 1; } - v1[2] = GetMonData(param0, MON_DATA_LEVEL, NULL); + v1[2] = Pokemon_GetValue(param0, MON_DATA_LEVEL, NULL); if (Item_Get(v0, 25) != 0) { if (v1[2] < 100) { - IncreaseMonData(param0, MON_DATA_EXP, GetMonExpToNextLevel(param0)); - CalculateMonLevelAndStats(param0); + Pokemon_IncreaseValue(param0, MON_DATA_EXP, Pokemon_GetExpToNextLevel(param0)); + Pokemon_CalcLevelAndStats(param0); if (v1[0] == 0) { - v1[3] = GetMonData(param0, MON_DATA_MAX_HP, NULL); + v1[3] = Pokemon_GetValue(param0, MON_DATA_MAX_HP, NULL); sub_020970AC(param0, v1[0], v1[3], v1[3] - v1[1]); } @@ -386,22 +386,22 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param v3 = 1; } - v1[0] = GetMonData(param0, MON_DATA_HP_EV, NULL); - v1[1] = GetMonData(param0, MON_DATA_ATK_EV, NULL); - v1[2] = GetMonData(param0, MON_DATA_DEF_EV, NULL); - v1[3] = GetMonData(param0, MON_DATA_SPEED_EV, NULL); - v1[4] = GetMonData(param0, MON_DATA_SPATK_EV, NULL); - v1[5] = GetMonData(param0, MON_DATA_SPDEF_EV, NULL); + v1[0] = Pokemon_GetValue(param0, MON_DATA_HP_EV, NULL); + v1[1] = Pokemon_GetValue(param0, MON_DATA_ATK_EV, NULL); + v1[2] = Pokemon_GetValue(param0, MON_DATA_DEF_EV, NULL); + v1[3] = Pokemon_GetValue(param0, MON_DATA_SPEED_EV, NULL); + v1[4] = Pokemon_GetValue(param0, MON_DATA_SPATK_EV, NULL); + v1[5] = Pokemon_GetValue(param0, MON_DATA_SPDEF_EV, NULL); - if (GetMonData(param0, MON_DATA_SPECIES, NULL) != 292) { + if (Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL) != 292) { if (Item_Get(v0, 39) != 0) { v1[7] = Item_Get(v0, 48); v1[6] = sub_020970EC(v1[0], (v1[1] + v1[2] + v1[3] + v1[4] + v1[5]), v1[7]); if (v1[6] != -1) { v1[0] = v1[6]; - SetMonData(param0, 13, &v1[0]); - CalculateMonLevelAndStats(param0); + Pokemon_SetValue(param0, 13, &v1[0]); + Pokemon_CalcLevelAndStats(param0); v2 = 1; } @@ -417,8 +417,8 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param if (v1[6] != -1) { v1[1] = v1[6]; - SetMonData(param0, 14, &v1[1]); - CalculateMonLevelAndStats(param0); + Pokemon_SetValue(param0, 14, &v1[1]); + Pokemon_CalcLevelAndStats(param0); v2 = 1; } @@ -433,8 +433,8 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param if (v1[6] != -1) { v1[2] = v1[6]; - SetMonData(param0, 15, &v1[2]); - CalculateMonLevelAndStats(param0); + Pokemon_SetValue(param0, 15, &v1[2]); + Pokemon_CalcLevelAndStats(param0); v2 = 1; } @@ -449,8 +449,8 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param if (v1[6] != -1) { v1[3] = v1[6]; - SetMonData(param0, 16, &v1[3]); - CalculateMonLevelAndStats(param0); + Pokemon_SetValue(param0, 16, &v1[3]); + Pokemon_CalcLevelAndStats(param0); v2 = 1; } @@ -465,8 +465,8 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param if (v1[6] != -1) { v1[4] = v1[6]; - SetMonData(param0, 17, &v1[4]); - CalculateMonLevelAndStats(param0); + Pokemon_SetValue(param0, 17, &v1[4]); + Pokemon_CalcLevelAndStats(param0); v2 = 1; } @@ -481,8 +481,8 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param if (v1[6] != -1) { v1[5] = v1[6]; - SetMonData(param0, 18, &v1[5]); - CalculateMonLevelAndStats(param0); + Pokemon_SetValue(param0, 18, &v1[5]); + Pokemon_CalcLevelAndStats(param0); v2 = 1; } @@ -496,7 +496,7 @@ u8 sub_02096954 (Pokemon * param0, u16 param1, u16 param2, u16 param3, u32 param return 0; } - v1[0] = GetMonData(param0, MON_DATA_FRIENDSHIP, NULL); + v1[0] = Pokemon_GetValue(param0, MON_DATA_FRIENDSHIP, NULL); if (v1[0] < 100) { if (Item_Get(v0, 45) != 0) { @@ -538,14 +538,14 @@ static u8 sub_02096F34 (Pokemon * param0, u32 param1) u8 v1; u8 v2; - v0 = (u16)GetMonData(param0, MON_DATA_MOVE1 + param1, NULL); + v0 = (u16)Pokemon_GetValue(param0, MON_DATA_MOVE1 + param1, NULL); if (v0 == 0) { return 0; } - v1 = (u8)GetMonData(param0, MON_DATA_MOVE1_CUR_PP + param1, NULL); - v2 = (u8)GetMonData(param0, MON_DATA_MOVE1_PP_UPS + param1, NULL); + v1 = (u8)Pokemon_GetValue(param0, MON_DATA_MOVE1_CUR_PP + param1, NULL); + v2 = (u8)Pokemon_GetValue(param0, MON_DATA_MOVE1_PP_UPS + param1, NULL); if (v1 < MoveTable_CalcMaxPP(v0, v2)) { return 1; @@ -560,14 +560,14 @@ static u8 sub_02096F84 (Pokemon * param0, u32 param1, u32 param2) u8 v1; u8 v2; - v0 = (u16)GetMonData(param0, MON_DATA_MOVE1 + param1, NULL); + v0 = (u16)Pokemon_GetValue(param0, MON_DATA_MOVE1 + param1, NULL); if (v0 == 0) { return 0; } - v1 = (u8)GetMonData(param0, MON_DATA_MOVE1_CUR_PP + param1, NULL); - v2 = (u8)MoveTable_CalcMaxPP(v0, GetMonData(param0, MON_DATA_MOVE1_PP_UPS + param1, NULL)); + v1 = (u8)Pokemon_GetValue(param0, MON_DATA_MOVE1_CUR_PP + param1, NULL); + v2 = (u8)MoveTable_CalcMaxPP(v0, Pokemon_GetValue(param0, MON_DATA_MOVE1_PP_UPS + param1, NULL)); if (v1 < v2) { if (param2 == 127) { @@ -580,7 +580,7 @@ static u8 sub_02096F84 (Pokemon * param0, u32 param1, u32 param2) } } - SetMonData(param0, 58 + param1, &v1); + Pokemon_SetValue(param0, 58 + param1, &v1); return 1; } @@ -594,19 +594,19 @@ static u8 sub_02097004 (Pokemon * param0, u32 param1, u32 param2) u8 v2; u8 v3; - v2 = GetMonData(param0, MON_DATA_MOVE1_PP_UPS + param1, NULL); + v2 = Pokemon_GetValue(param0, MON_DATA_MOVE1_PP_UPS + param1, NULL); if (v2 == 3) { return 0; } - v0 = (u16)GetMonData(param0, MON_DATA_MOVE1 + param1, NULL); + v0 = (u16)Pokemon_GetValue(param0, MON_DATA_MOVE1 + param1, NULL); if (MoveTable_CalcMaxPP(v0, 0) < 5) { return 0; } - v1 = (u8)GetMonData(param0, MON_DATA_MOVE1_CUR_PP + param1, NULL); + v1 = (u8)Pokemon_GetValue(param0, MON_DATA_MOVE1_CUR_PP + param1, NULL); v3 = (u8)MoveTable_CalcMaxPP(v0, v2); if (v2 + param2 > 3) { @@ -617,8 +617,8 @@ static u8 sub_02097004 (Pokemon * param0, u32 param1, u32 param2) v1 = v1 + MoveTable_CalcMaxPP(v0, v2) - v3; - SetMonData(param0, 62 + param1, &v2); - SetMonData(param0, 58 + param1, &v1); + Pokemon_SetValue(param0, 62 + param1, &v2); + Pokemon_SetValue(param0, 58 + param1, &v1); return 1; } @@ -641,7 +641,7 @@ static void sub_020970AC (Pokemon * param0, u32 param1, u32 param2, u32 param3) param1 += param3; } - SetMonData(param0, 163, ¶m1); + Pokemon_SetValue(param0, 163, ¶m1); } static s32 sub_020970EC (s32 param0, s32 param1, s32 param2) @@ -678,7 +678,7 @@ static u8 sub_02097144 (Pokemon * param0, ItemData * param1) s32 v0; s32 v1; - v0 = GetMonData(param0, MON_DATA_FRIENDSHIP, NULL); + v0 = Pokemon_GetValue(param0, MON_DATA_FRIENDSHIP, NULL); if (v0 >= 255) { return 0; @@ -724,15 +724,15 @@ static u8 sub_020971D0 (Pokemon * param0, s32 param1, s32 param2, u16 param3, u3 } if (param2 > 0) { - if (Item_LoadParam(GetMonData(param0, MON_DATA_HELD_ITEM, NULL), 1, param4) == 53) { + if (Item_LoadParam(Pokemon_GetValue(param0, MON_DATA_HELD_ITEM, NULL), 1, param4) == 53) { param2 = param2 * 150 / 100; } - if (GetMonData(param0, MON_DATA_POKEBALL, NULL) == 11) { + if (Pokemon_GetValue(param0, MON_DATA_POKEBALL, NULL) == 11) { param2++; } - if (GetMonData(param0, MON_DATA_152, NULL) == param3) { + if (Pokemon_GetValue(param0, MON_DATA_152, NULL) == param3) { param2++; } } @@ -747,7 +747,7 @@ static u8 sub_020971D0 (Pokemon * param0, s32 param1, s32 param2, u16 param3, u3 param2 = 0; } - SetMonData(param0, 9, ¶m2); + Pokemon_SetValue(param0, 9, ¶m2); return 1; } @@ -762,15 +762,15 @@ void sub_02097284 (Party * param0) for (v0 = 0; v0 < v2; v0++) { v4 = Party_GetPokemonBySlotIndex(param0, v0); - if (GetMonData(v4, MON_DATA_172, NULL) == 0) { + if (Pokemon_GetValue(v4, MON_DATA_172, NULL) == 0) { continue; } - v3 = GetMonData(v4, MON_DATA_MAX_HP, NULL); - SetMonData(v4, 163, &v3); + v3 = Pokemon_GetValue(v4, MON_DATA_MAX_HP, NULL); + Pokemon_SetValue(v4, 163, &v3); v3 = 0; - SetMonData(v4, 160, &v3); + Pokemon_SetValue(v4, 160, &v3); for (v1 = 0; v1 < 4; v1++) { if (sub_02096F34(v4, v1) == 1) { diff --git a/src/unk_02097624.c b/src/unk_02097624.c index 56ab8368e0..59dfddd48d 100644 --- a/src/unk_02097624.c +++ b/src/unk_02097624.c @@ -120,7 +120,7 @@ UnkStruct_02097728 * sub_020976BC (UnkStruct_021C0794 * param0, Pokemon * param1 v0->unk_10 = param0; v0->unk_14 = sub_0202818C(param2); - GetMonData(param1, MON_DATA_170, v0->unk_14); + Pokemon_GetValue(param1, MON_DATA_170, v0->unk_14); return v0; } @@ -160,7 +160,7 @@ int sub_02097750 (UnkStruct_02097728 * param0, Pokemon * param1) return 0; } - SetMonData(param1, 170, param0->unk_14); + Pokemon_SetValue(param1, 170, param0->unk_14); return 1; } @@ -187,11 +187,11 @@ int sub_02097788 (UnkStruct_02028430 * param0, Pokemon * param1, int param2) v2 = sub_0202818C(param2); - GetMonData(param1, MON_DATA_170, v2); + Pokemon_GetValue(param1, MON_DATA_170, v2); sub_02028480(param0, 0, v0, v2); sub_02028124(v2); - SetMonData(param1, 170, v2); - SetMonData(param1, 6, &v1); + Pokemon_SetValue(param1, 170, v2); + Pokemon_SetValue(param1, 6, &v1); Heap_FreeToHeap(v2); return v0; @@ -210,8 +210,8 @@ int sub_020977E4 (UnkStruct_02028430 * param0, u16 param1, Pokemon * param2, int v0 = Item_ForMailNumber(sub_02028314(v1)); - SetMonData(param2, 170, v1); - SetMonData(param2, 6, &v0); + Pokemon_SetValue(param2, 170, v1); + Pokemon_SetValue(param2, 6, &v0); sub_02028470(param0, 0, param1); Heap_FreeToHeap(v1); diff --git a/src/unk_02097B18.c b/src/unk_02097B18.c index ed782d6e2d..b040be1c23 100644 --- a/src/unk_02097B18.c +++ b/src/unk_02097B18.c @@ -94,7 +94,7 @@ static int sub_02097B18 (UnkStruct_020067E8 * param0, int * param1) v1 = sub_02006840(param0); v0->unk_00 = v1; v0->unk_42C = NARC_ctor(NARC_INDEX_POKETOOL__POKE_EDIT__PL_POKE_DATA, 53); - v0->unk_428 = AllocMonZeroed(53); + v0->unk_428 = Pokemon_New(53); v0->unk_D4.unk_00 = 0xFF; v0->unk_418.unk_00 = 0; @@ -136,7 +136,7 @@ static int sub_02097B18 (UnkStruct_020067E8 * param0, int * param1) continue; } - v5 = GetMonData(v0->unk_00->unk_04[v4], MON_DATA_162, 0); + v5 = Pokemon_GetValue(v0->unk_00->unk_04[v4], MON_DATA_162, 0); if (v5 != 0) { v0->unk_04[v5 - 1].unk_00 = v4; @@ -398,8 +398,8 @@ static BOOL sub_02097F38 (UnkStruct_020508D4 * param0) if (v7->unk_22 != 7) { v8 = sub_02097F00(v0->unk_08, v7->unk_22); - SetMonData(v8, 162, (u8 *)&v13); - SetMonData(v8, 171, sub_0202CA28(v1->unk_20, v13 - 1)); + Pokemon_SetValue(v8, 162, (u8 *)&v13); + Pokemon_SetValue(v8, 171, sub_0202CA28(v1->unk_20, v13 - 1)); v9 = sub_0202CA28(v1->unk_20, v13 - 1); v10 = sub_0202CA64(v9, 0); diff --git a/src/unk_02098218.c b/src/unk_02098218.c index 2fbb8979dd..d0c0b58c46 100644 --- a/src/unk_02098218.c +++ b/src/unk_02098218.c @@ -120,7 +120,7 @@ static int sub_02098304 (UnkStruct_020067E8 * param0, int * param1) { int v1; - v1 = GetMonData(v0->unk_00->unk_0C.unk_00, MON_DATA_SPECIES, NULL); + v1 = Pokemon_GetValue(v0->unk_00->unk_0C.unk_00, MON_DATA_SPECIES, NULL); sub_02078A4C(v0->unk_04.unk_3C, &v0->unk_6C, v1, 1); @@ -224,9 +224,9 @@ static BOOL sub_0209843C (UnkStruct_020508D4 * param0) int v6 = 11; int v7 = 0; - SetMonData(v2, 76, &v7); + Pokemon_SetValue(v2, 76, &v7); sub_0209304C(v2, v3, v4, v5, v6); - SetMonData(v2, 179, NULL); + Pokemon_SetValue(v2, 179, NULL); } { @@ -245,18 +245,18 @@ static BOOL sub_0209843C (UnkStruct_020508D4 * param0) UnkStruct_0203CDB0 * v8 = sub_02050A60(param0); int v9; - v9 = GetMonData(v0->unk_0C.unk_00, MON_DATA_SPECIES, 0); + v9 = Pokemon_GetValue(v0->unk_0C.unk_00, MON_DATA_SPECIES, 0); v0->unk_08 = sub_0208712C(11, 1, v9, 10, sub_02025E44(sub_0203D174(v8))); - v0->unk_08->unk_10 = GetMonData(v0->unk_0C.unk_00, MON_DATA_GENDER, NULL); - v0->unk_08->unk_08 = GetMonData(v0->unk_0C.unk_00, MON_DATA_FORM, NULL); + v0->unk_08->unk_10 = Pokemon_GetValue(v0->unk_0C.unk_00, MON_DATA_GENDER, NULL); + v0->unk_08->unk_08 = Pokemon_GetValue(v0->unk_0C.unk_00, MON_DATA_FORM, NULL); sub_02050A38(param0, &Unk_020F2DAC, v0->unk_08); v0->unk_00++; } break; case 4: if (v0->unk_08->unk_14 == 0) { - SetMonData(v0->unk_0C.unk_00, 120, v0->unk_08->unk_18); + Pokemon_SetValue(v0->unk_0C.unk_00, 120, v0->unk_08->unk_18); { UnkStruct_0203CDB0 * v10 = sub_02050A60(param0); diff --git a/src/unk_020989DC.c b/src/unk_020989DC.c index 6dfafd2605..6fdd86e89c 100644 --- a/src/unk_020989DC.c +++ b/src/unk_020989DC.c @@ -504,14 +504,14 @@ void sub_02098EF8 (Poffin * param0, Pokemon * param1) u8 v8[7]; u8 v9[7]; - v2 = GetMonNature(param1); + v2 = Pokemon_GetNature(param1); v4 = Unk_020F685C[v2][0]; v5 = Unk_020F685C[v2][1]; Poffin_StoreAttributesToArray(param0, v8); for (v0 = 0; v0 < 6; v0++) { - v7[v0] = GetMonData(param1, MON_DATA_COOL + v0, NULL); + v7[v0] = Pokemon_GetValue(param1, MON_DATA_COOL + v0, NULL); } v1 = 0; @@ -534,13 +534,13 @@ void sub_02098EF8 (Poffin * param0, Pokemon * param1) v7[v0] = 255; } - SetMonData(param1, 19 + v0, &v7[v0]); + Pokemon_SetValue(param1, 19 + v0, &v7[v0]); } - v3 = GetMonData(param1, MON_DATA_FRIENDSHIP, NULL); + v3 = Pokemon_GetValue(param1, MON_DATA_FRIENDSHIP, NULL); if (v3 < 255) { ++v3; - SetMonData(param1, 9, &v3); + Pokemon_SetValue(param1, 9, &v3); } } diff --git a/src/unk_020997B8.c b/src/unk_020997B8.c index 4e0ae0dd1d..387e530a21 100644 --- a/src/unk_020997B8.c +++ b/src/unk_020997B8.c @@ -32,18 +32,18 @@ u16 * sub_020997D8 (Pokemon * param0, u32 param1) u8 v5; u8 v6, v7, v8; - v3 = (u16)GetMonData(param0, MON_DATA_SPECIES, NULL); - v5 = (u8)GetMonData(param0, MON_DATA_FORM, NULL); - v4 = (u8)GetMonData(param0, MON_DATA_LEVEL, NULL); + v3 = (u16)Pokemon_GetValue(param0, MON_DATA_SPECIES, NULL); + v5 = (u8)Pokemon_GetValue(param0, MON_DATA_FORM, NULL); + v4 = (u8)Pokemon_GetValue(param0, MON_DATA_LEVEL, NULL); for (v7 = 0; v7 < 4; v7++) { - v2[v7] = (u16)GetMonData(param0, MON_DATA_MOVE1 + v7, NULL); + v2[v7] = (u16)Pokemon_GetValue(param0, MON_DATA_MOVE1 + v7, NULL); } v0 = Heap_AllocFromHeap(param1, (44 / 2) * 2); v1 = Heap_AllocFromHeap(param1, (44 / 2) * 2); - LoadMonLevelUpMoves(v3, v5, v0); + Pokemon_LoadLevelUpMovesOf(v3, v5, v0); v8 = 0; diff --git a/src/unk_0209BA80.c b/src/unk_0209BA80.c index 681ef11814..d123778d9f 100644 --- a/src/unk_0209BA80.c +++ b/src/unk_0209BA80.c @@ -282,13 +282,13 @@ BOOL sub_0209BC64 (UnkStruct_0209BBA4 * param0, u16 param1, u16 param2) } else { v2 = Party_GetPokemonBySlotIndex(v3, param1); - param0->unk_76[0] = GetMonData(v2, MON_DATA_SPECIES, NULL); - param0->unk_7E[0] = GetMonData(v2, MON_DATA_HELD_ITEM, NULL); + param0->unk_76[0] = Pokemon_GetValue(v2, MON_DATA_SPECIES, NULL); + param0->unk_7E[0] = Pokemon_GetValue(v2, MON_DATA_HELD_ITEM, NULL); v2 = Party_GetPokemonBySlotIndex(v3, param2); - param0->unk_76[1] = GetMonData(v2, MON_DATA_SPECIES, NULL); - param0->unk_7E[1] = GetMonData(v2, MON_DATA_HELD_ITEM, NULL); + param0->unk_76[1] = Pokemon_GetValue(v2, MON_DATA_SPECIES, NULL); + param0->unk_7E[1] = Pokemon_GetValue(v2, MON_DATA_HELD_ITEM, NULL); } param0->unk_08[0] = param0->unk_76[0]; From 8e5ed2e16877a6f48102294cf245d8733fd2c2d6 Mon Sep 17 00:00:00 2001 From: wildfire Date: Thu, 14 Sep 2023 11:54:48 +0100 Subject: [PATCH 11/11] Revert mon types to defines so csv2bin works --- include/constants/pokemon.h | 45 +++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index d741c47a96..4d52d14643 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -3,29 +3,30 @@ /** * @brief Pokemon Types + * (Can't make this an enum yet due to issues with csv2bin) */ -enum PokemonType { - TYPE_NORMAL = 0, - TYPE_FIGHTING, - TYPE_FLYING, - TYPE_POISON, - TYPE_GROUND, - TYPE_ROCK, - TYPE_BUG, - TYPE_GHOST, - TYPE_STEEL, - TYPE_MYSTERY, - TYPE_FIRE, - TYPE_WATER, - TYPE_GRASS, - TYPE_ELECTRIC, - TYPE_PSYCHIC, - TYPE_ICE, - TYPE_DRAGON, - TYPE_DARK, - NUMBER_OF_MON_TYPES, - TYPE_NONE = 255, -}; +// enum PokemonType { +#define TYPE_NORMAL 0 +#define TYPE_FIGHTING 1 +#define TYPE_FLYING 2 +#define TYPE_POISON 3 +#define TYPE_GROUND 4 +#define TYPE_ROCK 5 +#define TYPE_BUG 6 +#define TYPE_GHOST 7 +#define TYPE_STEEL 8 +#define TYPE_MYSTERY 9 +#define TYPE_FIRE 10 +#define TYPE_WATER 11 +#define TYPE_GRASS 12 +#define TYPE_ELECTRIC 13 +#define TYPE_PSYCHIC 14 +#define TYPE_ICE 15 +#define TYPE_DRAGON 16 +#define TYPE_DARK 17 +#define NUMBER_OF_MON_TYPES 18 +#define TYPE_NONE 255 +// }; /** * @brief Pokemon Stats