From 12da1abf586d83a13ec39f627814869a183cebd6 Mon Sep 17 00:00:00 2001 From: Seth Barberee Date: Fri, 23 Dec 2022 12:51:55 -0800 Subject: [PATCH] rename func --- asm/friend_rescue.s | 16 ++++++------ include/code_8094F88.h | 5 ++-- src/code_8095824.c | 50 ++++++++++++++++++------------------- src/friend_rescue_1.c | 13 +++++----- src/load_screen.c | 5 ++-- src/main_menu.c | 7 +++--- src/thank_you_wonder_mail.c | 3 +-- src/wonder_mail.c | 4 +-- src/wonder_mail_main_menu.c | 3 ++- 9 files changed, 53 insertions(+), 53 deletions(-) diff --git a/asm/friend_rescue.s b/asm/friend_rescue.s index 660e78d01..5f9313b61 100644 --- a/asm/friend_rescue.s +++ b/asm/friend_rescue.s @@ -155,11 +155,11 @@ _08032850: .4byte _0803378C _08032A48: movs r0, 0x1 - bl sub_8095324 + bl CountMailType cmp r0, 0 bne _08032A9C movs r0, 0x5 - bl sub_8095324 + bl CountMailType adds r4, r0, 0 cmp r4, 0 bne _08032A9C @@ -214,11 +214,11 @@ _08032AC8: .4byte gUnknown_80E25F4 _08032ACC: .4byte gUnknown_80E20E0 _08032AD0: movs r0, 0x1 - bl sub_8095324 + bl CountMailType cmp r0, 0 bne _08032B24 movs r0, 0x5 - bl sub_8095324 + bl CountMailType adds r4, r0, 0 cmp r4, 0 bne _08032B24 @@ -292,7 +292,7 @@ _08032B78: .4byte gUnknown_80E25F4 _08032B7C: .4byte gUnknown_80E2068 _08032B80: movs r0, 0x4 - bl sub_8095324 + bl CountMailType adds r2, r0, 0 cmp r2, 0 beq _08032B9C @@ -323,12 +323,12 @@ _08032BBC: .4byte gUnknown_80E25F4 _08032BC0: .4byte gUnknown_80E2190 _08032BC4: movs r0, 0x1 - bl sub_8095324 + bl CountMailType adds r4, r0, 0 cmp r4, 0 bne _08032C0C movs r0, 0x5 - bl sub_8095324 + bl CountMailType cmp r0, 0 bne _08032BF4 ldr r0, _08032BEC @@ -356,7 +356,7 @@ _08032C04: .4byte gUnknown_80E25F4 _08032C08: .4byte gUnknown_80E2218 _08032C0C: movs r0, 0x5 - bl sub_8095324 + bl CountMailType adds r2, r0, 0 cmp r2, 0 bne _08032C28 diff --git a/include/code_8094F88.h b/include/code_8094F88.h index 5a62c62d1..5a4adcbc3 100644 --- a/include/code_8094F88.h +++ b/include/code_8094F88.h @@ -3,7 +3,6 @@ #include "item.h" -// TODO: same as unkStruct_8095228 struct unkStruct_203B480 { /* 0x0 */ u8 mailType; @@ -41,11 +40,11 @@ void sub_8095274(u32 param_1); bool8 sub_8095298(s32 param_1); void sub_80952C4(void); bool8 sub_80952F0(u8 mailType, u32 param_2); -s32 sub_8095324(u8 mailType); +s32 CountMailType(u8 mailType); u32 sub_8095350(void); s32 sub_8095374(void); s32 sub_809539C(u8 mailType, u32 param_2); -s32 sub_80953D4(u8 param_1); +s32 sub_80953D4(u8 mailType); #endif diff --git a/src/code_8095824.c b/src/code_8095824.c index b7241cef0..0c3f19ce6 100644 --- a/src/code_8095824.c +++ b/src/code_8095824.c @@ -20,7 +20,7 @@ extern void RestorePokemonMoves(struct unkStruct_8094924 *r0, struct PokemonMove void sub_8095824(struct unkStruct_8094924 * a, struct unkStruct_203B480 *b); void sub_8095774(struct unkStruct_8094924 * a, struct unkStruct_203B480 *b); -s32 sub_8095324(u8); +s32 CountMailType(u8); extern struct PokemonStruct *GetPlayerPokemonStruct(void); extern s32 sub_8094E4C(void); @@ -97,87 +97,87 @@ void sub_80952C4(void) bool8 sub_80952F0(u8 mailType, u32 param_2) { - struct unkStruct_203B480 *piVar1; + struct unkStruct_203B480 *ptr; s32 index; - for(index = 0, piVar1 = &gUnknown_203B480[0]; index < 0x20; piVar1++, index++) + for(index = 0, ptr = &gUnknown_203B480[0]; index < 0x20; ptr++, index++) { - if ((piVar1->mailType == mailType) && (piVar1->unk10 == param_2)) return TRUE; + if ((ptr->mailType == mailType) && (ptr->unk10 == param_2)) return TRUE; } return FALSE; } -s32 sub_8095324(u8 mailType) +s32 CountMailType(u8 mailType) { - struct unkStruct_203B480 *piVar1; + struct unkStruct_203B480 *ptr; s32 total = 0; s32 index; - for(index = 0, piVar1 = &gUnknown_203B480[0]; index < 0x20; piVar1++, index++) + for(index = 0, ptr = &gUnknown_203B480[0]; index < 0x20; ptr++, index++) { - if (piVar1->mailType == mailType) total++; + if (ptr->mailType == mailType) total++; } return total; } u32 sub_8095350(void) { - struct unkStruct_203B480 *piVar1; + struct unkStruct_203B480 *ptr; u32 total = 0; s32 index; - for(index = 0, piVar1 = &gUnknown_203B480[0]; index < 0x20; piVar1++, index++) + for(index = 0, ptr = &gUnknown_203B480[0]; index < 0x20; ptr++, index++) { - if (piVar1->mailType != 0) total++; + if (ptr->mailType != 0) total++; } return total; } s32 sub_8095374(void) { - struct unkStruct_203B480 *piVar1; + struct unkStruct_203B480 *ptr; s32 retvar = -1; s32 index; - for(index = 0, piVar1 = &gUnknown_203B480[0]; index < 0x20; piVar1++, index++) + for(index = 0, ptr = &gUnknown_203B480[0]; index < 0x20; ptr++, index++) { - if (piVar1->mailType == 1) retvar = index; + if (ptr->mailType == 1) retvar = index; } return retvar; } s32 sub_809539C(u8 mailType, u32 param_2) { - struct unkStruct_203B480 *piVar1; + struct unkStruct_203B480 *ptr; s32 index; - for(index = 0, piVar1 = &gUnknown_203B480[0]; index < 0x20; piVar1++, index++) + for(index = 0, ptr = &gUnknown_203B480[0]; index < 0x20; ptr++, index++) { - if ((piVar1->mailType == mailType) && (piVar1->unk10 == param_2)) return index; + if ((ptr->mailType == mailType) && (ptr->unk10 == param_2)) return index; } return -1; } -s32 sub_80953D4(u8 param_1) +s32 sub_80953D4(u8 mailType) { - struct unkStruct_203B480 *piVar1; + struct unkStruct_203B480 *ptr; s32 index; - for(index = 0, piVar1 = &gUnknown_203B480[0]; index < 0x20; piVar1++, index++) + for(index = 0, ptr = &gUnknown_203B480[0]; index < 0x20; ptr++, index++) { - if (piVar1->mailType == param_1) return index; + if (ptr->mailType == mailType) return index; } return -1; } s32 sub_8095400(u32 param_1) { - u32 *piVar1; + u32 *ptr; s32 index; - for(index = 0, piVar1 = &gUnknown_203B480[0].unk10; index < 0x20; piVar1 += 0xC, index++) + for(index = 0, ptr = &gUnknown_203B480[0].unk10; index < 0x20; ptr += 0xC, index++) { - if (*piVar1 == param_1) return index; + if (*ptr == param_1) return index; } return -1; } @@ -225,7 +225,7 @@ void sub_8095494(struct unkStruct_809542C *param_1, u8 index) u32 sub_80954B4(void) { - if(sub_8095324(3) != 0) + if(CountMailType(3) != 0) return 1; else return 0; diff --git a/src/friend_rescue_1.c b/src/friend_rescue_1.c index d77329525..35324e552 100644 --- a/src/friend_rescue_1.c +++ b/src/friend_rescue_1.c @@ -1,4 +1,5 @@ #include "global.h" +#include "constants/wonder_mail.h" #include "text.h" #include "pokemon.h" #include "save.h" @@ -42,7 +43,6 @@ extern u8 gUnknown_80E31FC[]; extern u32 sub_80154F0(); extern void sub_80155F0(); -struct unkStruct_203B480 *sub_8095228(u8); extern void sub_80141B4(u8 *r0, u32, u32 *r1, u32); extern void sub_8014248(const char *r0, u32, u32, struct MenuItem *r4, u32, u32, u32, u32 *r5, u32); @@ -201,7 +201,7 @@ void sub_8033A2C(void) case 0x11: gUnknown_203B33C->unk40 = 2; gUnknown_203B33C->unk528 = 0x11; - if(sub_8095324(1) != 0) + if(CountMailType(WONDER_MAIL_TYPE_SOS) != 0) SetFriendRescueMenuState(0x31); else SetFriendRescueMenuState(0x22); @@ -217,7 +217,7 @@ void sub_8033A2C(void) case 4: gUnknown_203B33C->unk40 = 4; gUnknown_203B33C->unk528 = 4; - if(sub_8095324(4) != 0) + if(CountMailType(WONDER_MAIL_TYPE_AOK) != 0) SetFriendRescueMenuState(0x1C); else SetFriendRescueMenuState(0x22); @@ -225,7 +225,7 @@ void sub_8033A2C(void) case 0x12: gUnknown_203B33C->unk40 = 5; gUnknown_203B33C->unk528 = 0x12; - if(sub_8095324(5) != 0) + if(CountMailType(5) != 0) SetFriendRescueMenuState(0x3D); else SetFriendRescueMenuState(0xE); @@ -233,7 +233,7 @@ void sub_8033A2C(void) case 0x13: gUnknown_203B33C->unk40 = 6; gUnknown_203B33C->unk528 = 0x13; - if(sub_8095324(5) == 0) + if(CountMailType(5) == 0) SetFriendRescueMenuState(0x51); else SetFriendRescueMenuState(0x5B); @@ -485,8 +485,7 @@ void sub_8033DBC(void) sub_80951FC(&temp); temp2 = sub_8095228(sub_809539C(1, temp.unk10)); temp2->mailType = 7; - //MemoryFill8((u8 *)gUnknown_203B484, 0, sizeof(struct unkStruct_203B484)); - MemoryFill8((u8 *)gUnknown_203B484, 0, 0x5C); + MemoryFill8((u8 *)gUnknown_203B484, 0, sizeof(struct unkStruct_203B484)); SetFriendRescueMenuState(0x40); break; case 24: diff --git a/src/load_screen.c b/src/load_screen.c index 969f0d6b7..0d2dccd4f 100644 --- a/src/load_screen.c +++ b/src/load_screen.c @@ -1,4 +1,5 @@ #include "global.h" +#include "constants/wonder_mail.h" #include "input.h" #include "main_menu.h" #include "play_time.h" @@ -315,7 +316,7 @@ void DrawLoadScreenText(void) xxx_call_draw_string(64,12,gLoadScreen->formattedPlayerName,0,0); // Draw Location Info - if ((sub_8095324(1) != 0) || (sub_8095324(7) != 0)) { + if ((CountMailType(WONDER_MAIL_TYPE_SOS) != 0) || (CountMailType(WONDER_MAIL_TYPE_OKD) != 0)) { if (iVar2 == 0xf1207) PrintDungeonLocationtoBuffer(gLoadScreen->formattedLocation,GetDungeonLocationInfo()); else @@ -420,7 +421,7 @@ bool8 IsQuickSave(void) iVar1 = sub_8011FA8(); isQuicksave = FALSE; - if (sub_8095324(1) != 0 || sub_8095324(7) != 0) + if (CountMailType(WONDER_MAIL_TYPE_SOS) != 0 || CountMailType(WONDER_MAIL_TYPE_OKD) != 0) { if (iVar1 == 0xf1207) isQuicksave = TRUE; diff --git a/src/main_menu.c b/src/main_menu.c index 30c664219..f2c65a80b 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -13,6 +13,7 @@ #include "rescue_password_menu.h" #include "save.h" #include "trade_items_menu.h" +#include "constants/wonder_mail.h" // NOTE: 0x13 and 0x14 // Communication Screen? @@ -77,7 +78,7 @@ extern void CleanSaveMenu(void); extern u8 sub_8012FD8(u32 *); extern void sub_8013114(u32 *, s32 *); extern u8 sub_803D0D8(); -extern s32 sub_8095324(u32); +extern s32 CountMailType(u32); extern void sub_8012D60(struct unkStruct_Menu *, const struct MenuItem *, u32, u32, u32, u32); extern void sub_8012E04(struct unkStruct_Menu *, const struct MenuItem *, u32, u32, u32, u32); @@ -992,8 +993,8 @@ void sub_803623C(void) void SetMainMenuItems(void) { if (sub_8011C34() != -1) { - if (sub_8095324(1) == 0) { - if (sub_8095324(7) != 0) { + if (CountMailType(WONDER_MAIL_TYPE_SOS) == 0) { + if (CountMailType(WONDER_MAIL_TYPE_OKD) != 0) { if (sub_803D0D8() != 0) { // Revive Team // Delete Save Data diff --git a/src/thank_you_wonder_mail.c b/src/thank_you_wonder_mail.c index 5067f568e..18f8157d7 100644 --- a/src/thank_you_wonder_mail.c +++ b/src/thank_you_wonder_mail.c @@ -15,7 +15,6 @@ #include "code_800D090.h" extern struct WonderMailStruct_203B2C4 *gUnknown_203B2C4; -struct unkStruct_203B480 * sub_8095228(u8 index); #define THANK_YOU_MAIL_MAIN_MENU 0 #define ANYTHING_ELSE_THANK_YOU_MAIN_MENU 1 @@ -1203,7 +1202,7 @@ void HandleThankYouMailPelipperMainMenu(void) case 1: gUnknown_203B2C4->unk40 = 6; gUnknown_203B2C4->wonderMailMode = WONDER_MAIL_MODE_SEND; - if(sub_8095324(5) == 0) + if(CountMailType(5) == 0) { SetThankYouMailMenuState(NO_THANK_YOU_MAIL); } diff --git a/src/wonder_mail.c b/src/wonder_mail.c index c584e39e8..34b11b244 100644 --- a/src/wonder_mail.c +++ b/src/wonder_mail.c @@ -854,7 +854,7 @@ void sub_8028BF0(void) } break; case 1: - if(sub_8095324(2) != 0) + if(CountMailType(2) != 0) { sub_8028B04(30); } @@ -866,7 +866,7 @@ void sub_8028BF0(void) case 2: gUnknown_203B2C0->unk40 = 4; gUnknown_203B2C0->unk538 = 2; - if(sub_8095324(4) != 0) + if(CountMailType(WONDER_MAIL_TYPE_AOK) != 0) { sub_8028B04(41); } diff --git a/src/wonder_mail_main_menu.c b/src/wonder_mail_main_menu.c index efb089066..2f987ef73 100644 --- a/src/wonder_mail_main_menu.c +++ b/src/wonder_mail_main_menu.c @@ -1,4 +1,5 @@ #include "global.h" +#include "constants/wonder_mail.h" #include "save.h" #include "memory.h" #include "text.h" @@ -174,7 +175,7 @@ void HandleInvalidPasswordMenu(void); bool8 sub_8039880(void) { - return (sub_8095324(1) != 0 || sub_8095324(7) != 0 || sub_8011C1C() == 2); + return (CountMailType(WONDER_MAIL_TYPE_SOS) != 0 || CountMailType(WONDER_MAIL_TYPE_OKD) != 0 || sub_8011C1C() == 2); } bool8 CreateWonderMailMenu(void)