From 8d6484c47b9914f5e1ccb527632ca1f995cbec66 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Sat, 18 Jan 2020 18:01:38 +1000 Subject: [PATCH] Decompile objectiveGetDifficultyBits --- src/game/game_066310.c | 26 ++++++++------------------ src/include/game/game_066310.h | 2 +- src/include/types.h | 9 ++++++--- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/game/game_066310.c b/src/game/game_066310.c index 53597dd16..590ccd10a 100644 --- a/src/game/game_066310.c +++ b/src/game/game_066310.c @@ -54646,24 +54646,14 @@ char *objectiveGetText(s32 index) return NULL; } -GLOBAL_ASM( -glabel objectiveGetDifficultyBits -/* f095650: 2881000a */ slti $at,$a0,0xa -/* f095654: 10200008 */ beqz $at,.L0f095678 -/* f095658: 00047080 */ sll $t6,$a0,0x2 -/* f09565c: 3c03800a */ lui $v1,0x800a -/* f095660: 006e1821 */ addu $v1,$v1,$t6 -/* f095664: 8c63d060 */ lw $v1,-0x2fa0($v1) -/* f095668: 50600004 */ beqzl $v1,.L0f09567c -/* f09566c: 2402000f */ addiu $v0,$zero,0xf -/* f095670: 03e00008 */ jr $ra -/* f095674: 8062000f */ lb $v0,0xf($v1) -.L0f095678: -/* f095678: 2402000f */ addiu $v0,$zero,0xf -.L0f09567c: -/* f09567c: 03e00008 */ jr $ra -/* f095680: 00000000 */ sll $zero,$zero,0x0 -); +u32 objectiveGetDifficultyBits(s32 index) +{ + if (index < 10 && g_Objectives[index]) { + return g_Objectives[index]->difficulties; + } + + return DIFFBIT_A | DIFFBIT_SA | DIFFBIT_PA | DIFFBIT_PD; +} GLOBAL_ASM( glabel objectiveGetStatus diff --git a/src/include/game/game_066310.h b/src/include/game/game_066310.h index c8c5a7f64..d20436396 100644 --- a/src/include/game/game_066310.h +++ b/src/include/game/game_066310.h @@ -381,7 +381,7 @@ u32 func0f095340(void); u32 func0f0953cc(void); u32 func0f095560(void); s32 objectiveGetCount(void); -u32 objectiveGetDifficultyBits(u32 arg0); +u32 objectiveGetDifficultyBits(s32 index); u32 objectiveGetStatus(u32 arg0); u32 objectiveIsAllComplete(void); u32 func0f095bf4(void); diff --git a/src/include/types.h b/src/include/types.h index 5b2f917f1..6572b50ac 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -4670,9 +4670,12 @@ struct activemenuthing { }; struct objective { - u32 unk00; - u32 unk04; - u32 text; + /*0x00*/ u32 unk00; + /*0x04*/ u32 unk04; + /*0x08*/ u32 text; + /*0x0c*/ u16 unk0c; + /*0x0e*/ u8 unk0e; + /*0x0f*/ s8 difficulties; }; #endif