From 7607321a6de03b6459a110c5dbfc4632ccc9d2d9 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sun, 22 Mar 2020 09:20:46 +1000 Subject: [PATCH] Decompile func0f104720 --- src/game/game_102240.c | 42 ++++++++++++++-------------------- src/include/game/game_102240.h | 2 +- 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/game/game_102240.c b/src/game/game_102240.c index c1d8227dd..f4f08dc61 100644 --- a/src/game/game_102240.c +++ b/src/game/game_102240.c @@ -2312,31 +2312,23 @@ glabel func0f104664 /* f10471c: 27bd0028 */ addiu $sp,$sp,0x28 ); -GLOBAL_ASM( -glabel func0f104720 -/* f104720: 3c05800a */ lui $a1,%hi(g_SoloSaveFile) -/* f104724: 00001025 */ or $v0,$zero,$zero -/* f104728: 24a52200 */ addiu $a1,$a1,%lo(g_SoloSaveFile) -/* f10472c: 00001825 */ or $v1,$zero,$zero -/* f104730: 24060003 */ addiu $a2,$zero,0x3 -.L0f104734: -/* f104734: 94ae0080 */ lhu $t6,0x80($a1) -/* f104738: 51c00003 */ beqzl $t6,.L0f104748 -/* f10473c: 24630001 */ addiu $v1,$v1,0x1 -/* f104740: 24620001 */ addiu $v0,$v1,0x1 -/* f104744: 24630001 */ addiu $v1,$v1,0x1 -.L0f104748: -/* f104748: 1466fffa */ bne $v1,$a2,.L0f104734 -/* f10474c: 24a50002 */ addiu $a1,$a1,0x2 -/* f104750: 0082082a */ slt $at,$a0,$v0 -/* f104754: 10200003 */ beqz $at,.L0f104764 -/* f104758: 24020014 */ addiu $v0,$zero,0x14 -/* f10475c: 03e00008 */ jr $ra -/* f104760: 24820011 */ addiu $v0,$a0,0x11 -.L0f104764: -/* f104764: 03e00008 */ jr $ra -/* f104768: 00000000 */ sll $zero,$zero,0x0 -); +s32 func0f104720(s32 value) +{ + s32 next = 0; + s32 d; + + for (d = 0; d != 3; d++) { + if (g_SoloSaveFile.besttimes[SOLOSTAGEINDEX_SKEDARRUINS][d]) { + next = d + 1; + } + } + + if (next > value) { + return 17 + value; + } + + return 20; +} GLOBAL_ASM( glabel menuhandler0010476c diff --git a/src/include/game/game_102240.h b/src/include/game/game_102240.h index 1f56f6844..a44f400ff 100644 --- a/src/include/game/game_102240.h +++ b/src/include/game/game_102240.h @@ -12,7 +12,7 @@ bool isStageDifficultyUnlocked(s32 stageindex, s32 difficulty); u32 func0f103e68(void); u32 getMaxAiBuddies(void); u32 func0f104664(void); -u32 func0f104720(void); +s32 func0f104720(s32 value); char *func0f105664(struct menu_item *item); char *func0f1056a0(struct menu_item *item); char *invMenuTextPrimaryFunction(struct menu_item *item);