From a16168db616997a1b3d7b0852f2d318529990a3f Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 11 Apr 2020 23:14:11 +1000 Subject: [PATCH] Identify frSetWeaponFound and frIsWeaponFound --- src/game/game_111600.c | 2 +- src/game/game_19c990.c | 8 ++++---- src/game/gamefile.c | 24 ++++++++++++------------ src/include/game/game_19c990.h | 4 ++-- src/include/types.h | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/game/game_111600.c b/src/game/game_111600.c index fd578a1ca..5fa0bbd82 100644 --- a/src/game/game_111600.c +++ b/src/game/game_111600.c @@ -425,7 +425,7 @@ bool func0f111cf8(s32 weapon1, s32 weapon2) bool currentPlayerGiveWeapon(s32 weaponnum) { - func0f19cb38(weaponnum); + frSetWeaponFound(weaponnum); if (currentPlayerHasWeapon(weaponnum) == 0) { struct invitem *item; diff --git a/src/game/game_19c990.c b/src/game/game_19c990.c index de9a78249..a3c5ead90 100644 --- a/src/game/game_19c990.c +++ b/src/game/game_19c990.c @@ -164,7 +164,7 @@ s32 func0f19ca78(u32 weaponnum) } GLOBAL_ASM( -glabel func0f19cad4 +glabel frIsWeaponFound /* f19cad4: 28810002 */ slti $at,$a0,0x2 /* f19cad8: 50200004 */ beqzl $at,.L0f19caec /* f19cadc: 28810030 */ slti $at,$a0,0x30 @@ -196,7 +196,7 @@ glabel func0f19cad4 ); GLOBAL_ASM( -glabel func0f19cb38 +glabel frSetWeaponFound /* f19cb38: 28810030 */ slti $at,$a0,0x30 /* f19cb3c: 1020000e */ beqz $at,.L0f19cb78 /* f19cb40: 000470c3 */ sra $t6,$a0,0x3 @@ -276,7 +276,7 @@ glabel func0f19cbcc /* f19cc30: 10000003 */ beqz $zero,.L0f19cc40 /* f19cc34: 24020001 */ addiu $v0,$zero,0x1 .L0f19cc38: -/* f19cc38: 0fc672b5 */ jal func0f19cad4 +/* f19cc38: 0fc672b5 */ jal frIsWeaponFound /* f19cc3c: 00a02025 */ or $a0,$a1,$zero .L0f19cc40: /* f19cc40: 8fbf0014 */ lw $ra,0x14($sp) @@ -298,7 +298,7 @@ bool frWeaponIsAvailable(s32 weapon) return true; } - return func0f19cad4(weapon); + return frIsWeaponFound(weapon); } u32 func0f19ccc0(u32 weaponnum) diff --git a/src/game/gamefile.c b/src/game/gamefile.c index 58b90b984..a5ba61640 100644 --- a/src/game/gamefile.c +++ b/src/game/gamefile.c @@ -194,8 +194,8 @@ void savefileLoadDefaults(struct savefile_solo *file) file->unk1e = 0; - for (i = 0; i < 21; i++) { - for (j = 0; j < 3; j++) { + for (i = 0; i < ARRAYCOUNT(file->besttimes); i++) { + for (j = 0; j < ARRAYCOUNT(file->besttimes[0]); j++) { file->besttimes[i][j] = 0; } } @@ -208,16 +208,16 @@ void savefileLoadDefaults(struct savefile_solo *file) func0f19afdc(); - for (i = 0; i < 3; i++) { + for (i = 0; i < ARRAYCOUNT(g_SoloSaveFile.coopcompletions); i++) { g_SoloSaveFile.coopcompletions[i] = 0; } - for (i = 0; i < 9; i++) { + for (i = 0; i < ARRAYCOUNT(g_SoloSaveFile.firingrangescores); i++) { g_SoloSaveFile.firingrangescores[i] = 0; } - for (i = 0; i < 6; i++) { - g_SoloSaveFile.unkb5[i] = 0; + for (i = 0; i < ARRAYCOUNT(g_SoloSaveFile.weaponsfound); i++) { + g_SoloSaveFile.weaponsfound[i] = 0; } savefileApplyOptions(file); @@ -481,7 +481,7 @@ glabel func0f10fac8 /* f10fe1c: 24040041 */ addiu $a0,$zero,0x41 /* f10fe20: 50400004 */ beqzl $v0,.L0f10fe34 /* f10fe24: 24040042 */ addiu $a0,$zero,0x42 -/* f10fe28: 0fc672ce */ jal func0f19cb38 +/* f10fe28: 0fc672ce */ jal frSetWeaponFound /* f10fe2c: 24040020 */ addiu $a0,$zero,0x20 /* f10fe30: 24040042 */ addiu $a0,$zero,0x42 .L0f10fe34: @@ -489,7 +489,7 @@ glabel func0f10fac8 /* f10fe38: 02002825 */ or $a1,$s0,$zero /* f10fe3c: 50400004 */ beqzl $v0,.L0f10fe50 /* f10fe40: 24040043 */ addiu $a0,$zero,0x43 -/* f10fe44: 0fc672ce */ jal func0f19cb38 +/* f10fe44: 0fc672ce */ jal frSetWeaponFound /* f10fe48: 24040021 */ addiu $a0,$zero,0x21 /* f10fe4c: 24040043 */ addiu $a0,$zero,0x43 .L0f10fe50: @@ -497,7 +497,7 @@ glabel func0f10fac8 /* f10fe54: 02002825 */ or $a1,$s0,$zero /* f10fe58: 10400003 */ beqz $v0,.L0f10fe68 /* f10fe5c: 00000000 */ sll $zero,$zero,0x0 -/* f10fe60: 0fc672ce */ jal func0f19cb38 +/* f10fe60: 0fc672ce */ jal frSetWeaponFound /* f10fe64: 24040022 */ addiu $a0,$zero,0x22 .L0f10fe68: /* f10fe68: 0fc35531 */ jal func0f0d54c4 @@ -754,19 +754,19 @@ glabel func0f10feac /* f11022c: 02002825 */ or $a1,$s0,$zero /* f110230: 0fc4794c */ jal bitSetByIndex /* f110234: 928604e3 */ lbu $a2,0x4e3($s4) -/* f110238: 0fc672b5 */ jal func0f19cad4 +/* f110238: 0fc672b5 */ jal frIsWeaponFound /* f11023c: 24040020 */ addiu $a0,$zero,0x20 /* f110240: 24040041 */ addiu $a0,$zero,0x41 /* f110244: 02002825 */ or $a1,$s0,$zero /* f110248: 0fc4794c */ jal bitSetByIndex /* f11024c: 00403025 */ or $a2,$v0,$zero -/* f110250: 0fc672b5 */ jal func0f19cad4 +/* f110250: 0fc672b5 */ jal frIsWeaponFound /* f110254: 24040021 */ addiu $a0,$zero,0x21 /* f110258: 24040042 */ addiu $a0,$zero,0x42 /* f11025c: 02002825 */ or $a1,$s0,$zero /* f110260: 0fc4794c */ jal bitSetByIndex /* f110264: 00403025 */ or $a2,$v0,$zero -/* f110268: 0fc672b5 */ jal func0f19cad4 +/* f110268: 0fc672b5 */ jal frIsWeaponFound /* f11026c: 24040022 */ addiu $a0,$zero,0x22 /* f110270: 24040043 */ addiu $a0,$zero,0x43 /* f110274: 02002825 */ or $a1,$s0,$zero diff --git a/src/include/game/game_19c990.h b/src/include/game/game_19c990.h index e27a0676f..8895b70b1 100644 --- a/src/include/game/game_19c990.h +++ b/src/include/game/game_19c990.h @@ -9,8 +9,8 @@ extern u8 var800888a0; bool ciIsTourDone(void); u8 ciGetFiringRangeScore(s32 weapon_id); u32 func0f19c9e4(void); -bool func0f19cad4(u32 arg0); -void func0f19cb38(s32 weaponnum); +u32 frIsWeaponFound(s32 weapon); +void frSetWeaponFound(s32 weaponnum); bool stageIsComplete(s32 solostageindex); u32 func0f19cbcc(void); bool frWeaponIsAvailable(s32 weapon); diff --git a/src/include/types.h b/src/include/types.h index 7d8ad9645..0eaef9bf7 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -3753,7 +3753,7 @@ struct savefile_solo { /*0x20*/ u16 besttimes[NUM_SOLOSTAGES][3]; /*0xa0*/ s32 coopcompletions[3]; /*0xac*/ u8 firingrangescores[9]; - /*0xb5*/ u8 unkb5[6]; + /*0xb5*/ u8 weaponsfound[6]; }; struct propstate {