summaryrefslogtreecommitdiff
path: root/arm9/src/unk_02029FB0.c
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2021-09-08 13:18:19 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2021-09-08 13:18:19 -0400
commit84dce8ea46ff8e27b171169a1fa266f1a1115b27 (patch)
treed4378c90eae45074e55f5234ecedeb4107590cd3 /arm9/src/unk_02029FB0.c
parenta9ce5e44987cea38aaa0a2336d8582fc7a1edec4 (diff)
Name game stats methods
Diffstat (limited to 'arm9/src/unk_02029FB0.c')
-rw-r--r--arm9/src/unk_02029FB0.c81
1 files changed, 41 insertions, 40 deletions
diff --git a/arm9/src/unk_02029FB0.c b/arm9/src/unk_02029FB0.c
index 53b0a9d8..52cd5202 100644
--- a/arm9/src/unk_02029FB0.c
+++ b/arm9/src/unk_02029FB0.c
@@ -88,6 +88,7 @@ u8 UNK_02105CD8[] = {
FALSE, // 041
FALSE, // 042
FALSE, // 043
+
TRUE, // 044
TRUE, // 045
FALSE, // 046
@@ -178,22 +179,22 @@ static inline s32 GetOffsetToUnkB0(s32 a0)
return a0 - 44;
}
-THUMB_FUNC u32 FUN_02029FB0(void)
+THUMB_FUNC u32 Sav2_GameStats_sizeof(void)
{
- return sizeof(struct UnkStruct_02029FB0);
+ return sizeof(struct GameStats);
}
-THUMB_FUNC void FUN_02029FB8(struct UnkStruct_02029FB0 * ptr)
+THUMB_FUNC void Sav2_GameStats_init(struct GameStats * ptr)
{
- MI_CpuClear32(ptr, sizeof(struct UnkStruct_02029FB0));
+ MI_CpuClear32(ptr, sizeof(struct GameStats));
}
-THUMB_FUNC struct UnkStruct_02029FB0 * FUN_02029FC8(struct SaveBlock2 * sav2)
+THUMB_FUNC struct GameStats * Sav2_GameStats_get(struct SaveBlock2 * sav2)
{
return SavArray_get(sav2, 20);
}
-THUMB_FUNC u32 FUN_02029FD4(struct UnkStruct_02029FB0 * ptr, s32 a1)
+THUMB_FUNC u32 GameStats_GetValue(struct GameStats * ptr, s32 a1)
{
if (a1 < 44)
{
@@ -210,7 +211,7 @@ THUMB_FUNC u32 FUN_02029FD4(struct UnkStruct_02029FB0 * ptr, s32 a1)
}
}
-THUMB_FUNC u32 FUN_02029FF8(struct UnkStruct_02029FB0 * ptr, s32 a1, u32 a2)
+THUMB_FUNC u32 GameStats_SetValue(struct GameStats * ptr, s32 a1, u32 a2)
{
if (a1 < 44)
{
@@ -224,10 +225,10 @@ THUMB_FUNC u32 FUN_02029FF8(struct UnkStruct_02029FB0 * ptr, s32 a1, u32 a2)
{
GF_ASSERT(0);
}
- return FUN_02029FD4(ptr, a1);
+ return GameStats_GetValue(ptr, a1);
}
-THUMB_FUNC u32 FUN_0202A028(s32 a0)
+THUMB_FUNC u32 GameStats_GetMaxValue(s32 a0)
{
if (a0 < 44)
{
@@ -250,39 +251,39 @@ THUMB_FUNC u32 FUN_0202A028(s32 a0)
}
}
-THUMB_FUNC u16 FUN_0202A070(s32 a0)
+THUMB_FUNC u16 GameStats_GetStdInc(s32 a0)
{
return UNK_020EEA7C[a0];
}
-THUMB_FUNC u32 FUN_0202A07C(struct UnkStruct_02029FB0 * ptr, s32 a1, u32 a2)
+THUMB_FUNC u32 GameStats_SetCapped(struct GameStats * ptr, s32 a1, u32 a2)
{
- u32 r2 = FUN_0202A028(a1);
+ u32 r2 = GameStats_GetMaxValue(a1);
if (a2 < r2)
{
- return FUN_02029FF8(ptr, a1, a2);
+ return GameStats_SetValue(ptr, a1, a2);
}
else
{
- return FUN_02029FF8(ptr, a1, r2);
+ return GameStats_SetValue(ptr, a1, r2);
}
}
-THUMB_FUNC u32 FUN_0202A0A8(struct UnkStruct_02029FB0 * ptr, s32 a1, u32 a2)
+THUMB_FUNC u32 GameStats_UpdateBounded(struct GameStats * ptr, s32 a1, u32 a2)
{
- u32 r4 = FUN_0202A028(a1);
- u32 r0 = FUN_02029FD4(ptr, a1);
+ u32 r4 = GameStats_GetMaxValue(a1);
+ u32 r0 = GameStats_GetValue(ptr, a1);
if (a2 > r4)
{
a2 = r4;
}
if (r0 < a2)
{
- return FUN_02029FF8(ptr, a1, a2);
+ return GameStats_SetValue(ptr, a1, a2);
}
else if (r0 > r4)
{
- return FUN_02029FF8(ptr, a1, r4);
+ return GameStats_SetValue(ptr, a1, r4);
}
else
{
@@ -290,67 +291,67 @@ THUMB_FUNC u32 FUN_0202A0A8(struct UnkStruct_02029FB0 * ptr, s32 a1, u32 a2)
}
}
-THUMB_FUNC u32 FUN_0202A0E8(struct UnkStruct_02029FB0 * ptr, s32 a1)
+THUMB_FUNC u32 GameStats_Inc(struct GameStats * ptr, s32 a1)
{
- u32 r4 = FUN_0202A028(a1);
- u32 r2 = FUN_02029FD4(ptr, a1) + 1;
+ u32 r4 = GameStats_GetMaxValue(a1);
+ u32 r2 = GameStats_GetValue(ptr, a1) + 1;
if (r2 < r4)
{
- return FUN_02029FF8(ptr, a1, r2);
+ return GameStats_SetValue(ptr, a1, r2);
}
else
{
- return FUN_02029FF8(ptr, a1, r4);
+ return GameStats_SetValue(ptr, a1, r4);
}
}
-THUMB_FUNC u32 FUN_0202A11C(struct UnkStruct_02029FB0 * ptr, s32 a1, u32 a2)
+THUMB_FUNC u32 GameStats_Add(struct GameStats * ptr, s32 a1, u32 a2)
{
- u32 r6 = FUN_0202A028(a1);
- u32 r2 = FUN_02029FD4(ptr, a1);
+ u32 r6 = GameStats_GetMaxValue(a1);
+ u32 r2 = GameStats_GetValue(ptr, a1);
r2 += a2;
if (r2 < r6)
{
- return FUN_02029FF8(ptr, a1, r2);
+ return GameStats_SetValue(ptr, a1, r2);
}
else
{
- return FUN_02029FF8(ptr, a1, r6);
+ return GameStats_SetValue(ptr, a1, r6);
}
}
-THUMB_FUNC u32 FUN_0202A150(struct UnkStruct_02029FB0 * ptr, s32 a1)
+THUMB_FUNC u32 GameStats_GetCapped(struct GameStats * ptr, s32 a1)
{
- u32 r4 = FUN_0202A028(a1);
- u32 r0 = FUN_02029FD4(ptr, a1);
+ u32 r4 = GameStats_GetMaxValue(a1);
+ u32 r0 = GameStats_GetValue(ptr, a1);
if (r0 <= r4)
r4 = r0;
return r4;
}
-THUMB_FUNC u32 FUN_0202A170(struct UnkStruct_02029FB0 * ptr, s32 a1)
+THUMB_FUNC u32 GameStats_AddSpecial(struct GameStats * ptr, s32 a1)
{
GF_ASSERT(a1 < 38);
- u32 r0 = FUN_0202A150(ptr, 0) + FUN_0202A070(a1);
+ u32 r0 = GameStats_GetCapped(ptr, 0) + GameStats_GetStdInc(a1);
if (r0 > 99999999)
{
- return FUN_0202A07C(ptr, 0, 99999999);
+ return GameStats_SetCapped(ptr, 0, 99999999);
}
else
{
- return FUN_0202A11C(ptr, 0, FUN_0202A070(a1));
+ return GameStats_Add(ptr, 0, GameStats_GetStdInc(a1));
}
}
-THUMB_FUNC u32 FUN_0202A1B8(struct UnkStruct_02029FB0 * ptr)
+THUMB_FUNC u32 GameStats_GetStat0(struct GameStats * ptr)
{
- return FUN_0202A150(ptr, 0);
+ return GameStats_GetCapped(ptr, 0);
}
-THUMB_FUNC void FUN_0202A1C4(struct UnkStruct_02029FB0 * ptr, struct Pokedex * pokedex, u16 species)
+THUMB_FUNC void GameStats_IncSpeciesCaught(struct GameStats * ptr, struct Pokedex * pokedex, u16 species)
{
if (!Pokedex_CheckMonCaughtFlag(pokedex, species))
{
- FUN_0202A170(ptr, 22);
+ GameStats_AddSpecial(ptr, 22);
}
}