From a32188f7d62343cc6c25f4be8a93919dcb814224 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Wed, 1 Jan 2020 12:37:46 +1000 Subject: [PATCH] Decompile setDifficulty --- src/game/game_1668e0.c | 21 ++++++++------------- src/include/game/game_1668e0.h | 2 +- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/game/game_1668e0.c b/src/game/game_1668e0.c index 91c6e91ea..01113f7bb 100644 --- a/src/game/game_1668e0.c +++ b/src/game/game_1668e0.c @@ -7304,19 +7304,14 @@ s32 getDifficulty(void) return g_Difficulty; } -GLOBAL_ASM( -glabel setDifficulty -/* f16cda8: 04800003 */ bltz $a0,.L0f16cdb8 -/* f16cdac: 28810004 */ slti $at,$a0,0x4 -/* f16cdb0: 14200002 */ bnez $at,.L0f16cdbc -/* f16cdb4: 00000000 */ sll $zero,$zero,0x0 -.L0f16cdb8: -/* f16cdb8: 00002025 */ or $a0,$zero,$zero -.L0f16cdbc: -/* f16cdbc: 3c018008 */ lui $at,0x8008 -/* f16cdc0: 03e00008 */ jr $ra -/* f16cdc4: ac244020 */ sw $a0,0x4020($at) -); +void setDifficulty(s32 difficulty) +{ + if (difficulty < DIFF_A || difficulty > DIFF_PD) { + difficulty = DIFF_A; + } + + g_Difficulty = difficulty; +} void setVar80084028(u32 arg0) { diff --git a/src/include/game/game_1668e0.h b/src/include/game/game_1668e0.h index d09cd2585..ef23517ff 100644 --- a/src/include/game/game_1668e0.h +++ b/src/include/game/game_1668e0.h @@ -62,7 +62,7 @@ void stageLoad(void); u32 func0f16cce4(void); u32 func0f16cd40(void); u32 getVar80084014(void); -void setDifficulty(s32 arg0); +void setDifficulty(s32 difficulty); void setVar80084028(u32 arg0); void setVar8008402c(u32 arg0); void setVar80084030(u32 arg0);