diff --git a/papermario/asm/nonmatchings/code_80850_len_3060/decrement_status_menu_disabled.s b/papermario/asm/nonmatchings/code_80850_len_3060/decrement_status_menu_disabled.s deleted file mode 100644 index ce9a14d089..0000000000 --- a/papermario/asm/nonmatchings/code_80850_len_3060/decrement_status_menu_disabled.s +++ /dev/null @@ -1,17 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -.include "include/macro.inc" - -glabel decrement_status_menu_disabled -/* 082FE0 800E9B30 3C048011 */ lui $a0, 0x8011 -/* 082FE4 800E9B34 2484EF58 */ addiu $a0, $a0, -0x10a8 -/* 082FE8 800E9B38 80820047 */ lb $v0, 0x47($a0) -/* 082FEC 800E9B3C 90830047 */ lbu $v1, 0x47($a0) -/* 082FF0 800E9B40 18400002 */ blez $v0, .L800E9B4C -/* 082FF4 800E9B44 2462FFFF */ addiu $v0, $v1, -1 -/* 082FF8 800E9B48 A0820047 */ sb $v0, 0x47($a0) -.L800E9B4C: -/* 082FFC 800E9B4C 03E00008 */ jr $ra -/* 083000 800E9B50 00000000 */ nop - diff --git a/papermario/asm/nonmatchings/code_80850_len_3060/increment_status_menu_disabled.s b/papermario/asm/nonmatchings/code_80850_len_3060/increment_status_menu_disabled.s deleted file mode 100644 index 24a48e64b1..0000000000 --- a/papermario/asm/nonmatchings/code_80850_len_3060/increment_status_menu_disabled.s +++ /dev/null @@ -1,13 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -.include "include/macro.inc" - -glabel increment_status_menu_disabled -/* 083004 800E9B54 3C038011 */ lui $v1, 0x8011 -/* 083008 800E9B58 2463EF58 */ addiu $v1, $v1, -0x10a8 -/* 08300C 800E9B5C 90620047 */ lbu $v0, 0x47($v1) -/* 083010 800E9B60 24420001 */ addiu $v0, $v0, 1 -/* 083014 800E9B64 03E00008 */ jr $ra -/* 083018 800E9B68 A0620047 */ sb $v0, 0x47($v1) - diff --git a/papermario/asm/nonmatchings/code_80850_len_3060/status_menu_stop_blinking_fp.s b/papermario/asm/nonmatchings/code_80850_len_3060/status_menu_stop_blinking_fp.s deleted file mode 100644 index 1f7d0fea1d..0000000000 --- a/papermario/asm/nonmatchings/code_80850_len_3060/status_menu_stop_blinking_fp.s +++ /dev/null @@ -1,17 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -.include "include/macro.inc" - -glabel status_menu_stop_blinking_fp -/* 082E80 800E99D0 3C038011 */ lui $v1, 0x8011 -/* 082E84 800E99D4 2463EF58 */ addiu $v1, $v1, -0x10a8 -/* 082E88 800E99D8 8062004D */ lb $v0, 0x4d($v1) -/* 082E8C 800E99DC 10400003 */ beqz $v0, .L800E99EC -/* 082E90 800E99E0 00000000 */ nop -/* 082E94 800E99E4 A060004D */ sb $zero, 0x4d($v1) -/* 082E98 800E99E8 A060004E */ sb $zero, 0x4e($v1) -.L800E99EC: -/* 082E9C 800E99EC 03E00008 */ jr $ra -/* 082EA0 800E99F0 00000000 */ nop - diff --git a/papermario/asm/nonmatchings/code_80850_len_3060/status_menu_stop_blinking_hp.s b/papermario/asm/nonmatchings/code_80850_len_3060/status_menu_stop_blinking_hp.s deleted file mode 100644 index d4081158f2..0000000000 --- a/papermario/asm/nonmatchings/code_80850_len_3060/status_menu_stop_blinking_hp.s +++ /dev/null @@ -1,18 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -.include "include/macro.inc" - -glabel status_menu_stop_blinking_hp -/* 082E14 800E9964 3C038011 */ lui $v1, 0x8011 -/* 082E18 800E9968 2463EF58 */ addiu $v1, $v1, -0x10a8 -/* 082E1C 800E996C 8062004A */ lb $v0, 0x4a($v1) -/* 082E20 800E9970 10400004 */ beqz $v0, .L800E9984 -/* 082E24 800E9974 00000000 */ nop -/* 082E28 800E9978 A060004A */ sb $zero, 0x4a($v1) -/* 082E2C 800E997C A060004B */ sb $zero, 0x4b($v1) -/* 082E30 800E9980 A060004C */ sb $zero, 0x4c($v1) -.L800E9984: -/* 082E34 800E9984 03E00008 */ jr $ra -/* 082E38 800E9988 00000000 */ nop - diff --git a/papermario/asm/nonmatchings/code_80850_len_3060/status_menu_stop_blinking_sp.s b/papermario/asm/nonmatchings/code_80850_len_3060/status_menu_stop_blinking_sp.s deleted file mode 100644 index b61ecc0e3f..0000000000 --- a/papermario/asm/nonmatchings/code_80850_len_3060/status_menu_stop_blinking_sp.s +++ /dev/null @@ -1,17 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -.include "include/macro.inc" - -glabel status_menu_stop_blinking_sp -/* 082F44 800E9A94 3C038011 */ lui $v1, 0x8011 -/* 082F48 800E9A98 2463EF58 */ addiu $v1, $v1, -0x10a8 -/* 082F4C 800E9A9C 80620050 */ lb $v0, 0x50($v1) -/* 082F50 800E9AA0 10400003 */ beqz $v0, .L800E9AB0 -/* 082F54 800E9AA4 00000000 */ nop -/* 082F58 800E9AA8 A0600050 */ sb $zero, 0x50($v1) -/* 082F5C 800E9AAC A0600051 */ sb $zero, 0x51($v1) -.L800E9AB0: -/* 082F60 800E9AB0 03E00008 */ jr $ra -/* 082F64 800E9AB4 00000000 */ nop - diff --git a/papermario/asm/nonmatchings/code_80850_len_3060/status_menu_stop_blinking_starpoints.s b/papermario/asm/nonmatchings/code_80850_len_3060/status_menu_stop_blinking_starpoints.s deleted file mode 100644 index 1e218ed66a..0000000000 --- a/papermario/asm/nonmatchings/code_80850_len_3060/status_menu_stop_blinking_starpoints.s +++ /dev/null @@ -1,17 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -.include "include/macro.inc" - -glabel status_menu_stop_blinking_starpoints -/* 082FBC 800E9B0C 3C038011 */ lui $v1, 0x8011 -/* 082FC0 800E9B10 2463EF58 */ addiu $v1, $v1, -0x10a8 -/* 082FC4 800E9B14 80620052 */ lb $v0, 0x52($v1) -/* 082FC8 800E9B18 10400003 */ beqz $v0, .L800E9B28 -/* 082FCC 800E9B1C 00000000 */ nop -/* 082FD0 800E9B20 A0600052 */ sb $zero, 0x52($v1) -/* 082FD4 800E9B24 A0600053 */ sb $zero, 0x53($v1) -.L800E9B28: -/* 082FD8 800E9B28 03E00008 */ jr $ra -/* 082FDC 800E9B2C 00000000 */ nop - diff --git a/papermario/asm/nonmatchings/code_80850_len_3060/subtract_hp.s b/papermario/asm/nonmatchings/code_80850_len_3060/subtract_hp.s deleted file mode 100644 index e8a7d1072a..0000000000 --- a/papermario/asm/nonmatchings/code_80850_len_3060/subtract_hp.s +++ /dev/null @@ -1,20 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -.include "include/macro.inc" - -glabel subtract_hp -/* 0837E4 800EA334 3C038011 */ lui $v1, 0x8011 -/* 0837E8 800EA338 2463F290 */ addiu $v1, $v1, -0xd70 -/* 0837EC 800EA33C 80620002 */ lb $v0, 2($v1) -/* 0837F0 800EA340 5C800001 */ bgtzl $a0, .L800EA348 -/* 0837F4 800EA344 00441023 */ subu $v0, $v0, $a0 -.L800EA348: -/* 0837F8 800EA348 04820003 */ bltzl $a0, .L800EA358 -/* 0837FC 800EA34C 24020001 */ addiu $v0, $zero, 1 -/* 083800 800EA350 58400001 */ blezl $v0, .L800EA358 -/* 083804 800EA354 24020001 */ addiu $v0, $zero, 1 -.L800EA358: -/* 083808 800EA358 03E00008 */ jr $ra -/* 08380C 800EA35C A0620002 */ sb $v0, 2($v1) - diff --git a/papermario/asm/nonmatchings/code_80850_len_3060/sync_status_menu.s b/papermario/asm/nonmatchings/code_80850_len_3060/sync_status_menu.s deleted file mode 100644 index efb9a74929..0000000000 --- a/papermario/asm/nonmatchings/code_80850_len_3060/sync_status_menu.s +++ /dev/null @@ -1,24 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -.include "include/macro.inc" - -glabel sync_status_menu -/* 08301C 800E9B6C 3C028011 */ lui $v0, 0x8011 -/* 083020 800E9B70 2442F290 */ addiu $v0, $v0, -0xd70 -/* 083024 800E9B74 90430010 */ lbu $v1, 0x10($v0) -/* 083028 800E9B78 90440002 */ lbu $a0, 2($v0) -/* 08302C 800E9B7C 90450005 */ lbu $a1, 5($v0) -/* 083030 800E9B80 94460290 */ lhu $a2, 0x290($v0) -/* 083034 800E9B84 9447000C */ lhu $a3, 0xc($v0) -/* 083038 800E9B88 3C028011 */ lui $v0, 0x8011 -/* 08303C 800E9B8C 2442EF58 */ addiu $v0, $v0, -0x10a8 -/* 083040 800E9B90 00031E00 */ sll $v1, $v1, 0x18 -/* 083044 800E9B94 00031E03 */ sra $v1, $v1, 0x18 -/* 083048 800E9B98 A044003D */ sb $a0, 0x3d($v0) -/* 08304C 800E9B9C A045003E */ sb $a1, 0x3e($v0) -/* 083050 800E9BA0 A4460048 */ sh $a2, 0x48($v0) -/* 083054 800E9BA4 A4470040 */ sh $a3, 0x40($v0) -/* 083058 800E9BA8 03E00008 */ jr $ra -/* 08305C 800E9BAC A4430042 */ sh $v1, 0x42($v0) - diff --git a/papermario/include/common_structs.h b/papermario/include/common_structs.h index 57c3686d03..c14aee3018 100644 --- a/papermario/include/common_structs.h +++ b/papermario/include/common_structs.h @@ -63,7 +63,7 @@ typedef struct { /* 0x00C */ s16 coins; /* 0x00E */ s8 fortressKeyCount; /* 0x00F */ u8 starPieces; - /* 0x010 */ u8 starPoints; + /* 0x010 */ s8 starPoints; /* 0x011 */ char unk_11; /* 0x012 */ s8 currentPartner; /* 0x013 */ char unk_13; @@ -140,7 +140,7 @@ typedef struct { /* 0x3D */ s8 displayHP; /* 0x3E */ s8 displayFP; /* 0x3F */ char unk_3F; - /* 0x40 */ s16 displayCounts; + /* 0x40 */ s16 displayCoins; /* 0x42 */ s16 displayStarpoints; /* 0x44 */ s8 igonreChanges; /* set != 0 to prevent automatic opening from HP/FP changes */ /* 0x45 */ s8 unk_45; diff --git a/papermario/src/code_80850_len_3060.c b/papermario/src/code_80850_len_3060.c index 2bf4bc5b97..a9803777f6 100644 --- a/papermario/src/code_80850_len_3060.c +++ b/papermario/src/code_80850_len_3060.c @@ -141,31 +141,87 @@ INCLUDE_ASM(code_80850_len_3060, is_status_menu_visible); INCLUDE_ASM(code_80850_len_3060, status_menu_start_blinking_hp); -INCLUDE_ASM(code_80850_len_3060, status_menu_stop_blinking_hp); +void status_menu_stop_blinking_hp(void) { + ui_status* uiStatus = &gUIStatus; + + if (uiStatus->hpBlinking != 0) { + uiStatus->hpBlinking = 0; + uiStatus->hpBlinkCounter = 0; + uiStatus->hpBlinkTimer = 0; + } +} INCLUDE_ASM(code_80850_len_3060, status_menu_start_blinking_fp); -INCLUDE_ASM(code_80850_len_3060, status_menu_stop_blinking_fp); +void status_menu_stop_blinking_fp(void) { + ui_status* uiStatus = &gUIStatus; + + if (uiStatus->fpBlinking != 0) { + uiStatus->fpBlinking = 0; + uiStatus->fpBlinkCounter = 0; + } +} INCLUDE_ASM(code_80850_len_3060, status_menu_start_blinking_coins); -INCLUDE_ASM(code_80850_len_3060, status_menu_stop_blinking_coins); +void status_menu_stop_blinking_coins(void) { + ui_status* uiStatus = &gUIStatus; + + if (uiStatus->coinsBlinking != 0) { + uiStatus->coinsBlinking = 0; + uiStatus->coinsBlinkCounter = 0; + uiStatus->coinsBlinkTimer = 0; + } +} INCLUDE_ASM(code_80850_len_3060, status_menu_start_blinking_sp); -INCLUDE_ASM(code_80850_len_3060, status_menu_stop_blinking_sp); +void status_menu_stop_blinking_sp(void) { + ui_status* uiStatus = &gUIStatus; + + if (uiStatus->spBlinking != 0) { + uiStatus->spBlinking = 0; + uiStatus->spBlinkCounter = 0; + } +} INCLUDE_ASM(code_80850_len_3060, status_menu_start_blinking_sp_bars); INCLUDE_ASM(code_80850_len_3060, status_menu_start_blinking_starpoints); -INCLUDE_ASM(code_80850_len_3060, status_menu_stop_blinking_starpoints); +void status_menu_stop_blinking_starpoints(void) { + ui_status* uiStatus = &gUIStatus; -INCLUDE_ASM(code_80850_len_3060, decrement_status_menu_disabled); + if (uiStatus->starpointsBlinking != 0) { + uiStatus->starpointsBlinking = 0; + uiStatus->starpointsBlinkCounter = 0; + } +} -INCLUDE_ASM(code_80850_len_3060, increment_status_menu_disabled); +void decrement_status_menu_disabled(void) { + ui_status* uiStatus = &gUIStatus; -INCLUDE_ASM(code_80850_len_3060, sync_status_menu); + if (uiStatus->disabled > 0) { + uiStatus->disabled--; + } +} + +void increment_status_menu_disabled(void) { + ui_status* uiStatus = &gUIStatus; + + uiStatus->disabled++; +} + +void sync_status_menu(void) { + player_data *playerData = &gPlayerData; + ui_status* uiStatus = &gUIStatus; + + uiStatus->displayHP = playerData->curHP; + uiStatus->displayFP = playerData->curFP; + uiStatus->displaySP = playerData->specialBarsFilled; + uiStatus->displayCoins = playerData->coins; + uiStatus->displayStarpoints = playerData->starPoints; +} INCLUDE_ASM(code_80850_len_3060, reset_status_menu);