From f8343fa522064d55e6eed8ab4c0fa4277fcbcc1c Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Sat, 8 Aug 2020 01:25:36 -0400 Subject: [PATCH] victory! --- papermario/Makefile | 2 +- papermario/src/code_80850_len_3060.c | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/papermario/Makefile b/papermario/Makefile index 9f43ed7f75..d5d6c8b8fd 100644 --- a/papermario/Makefile +++ b/papermario/Makefile @@ -50,7 +50,7 @@ OBJCOPY = $(CROSS)objcopy CPPFLAGS = -Iinclude -D _LANGUAGE_C -ffreestanding -DF3DEX_GBI_2 ASFLAGS = -EB -march=vr4300 -mtune=vr4300 -Iinclude OLDASFLAGS= -EB -Iinclude -CFLAGS = -O2 -quiet -G 0 -mcpu=vr4300 -mfix4300 +CFLAGS = -O2 -quiet -G 0 -mcpu=vr4300 -mfix4300 -mips3 -mgp32 -mfp32 LDFLAGS = -T undefined_syms.txt -T $(LD_SCRIPT) -Map $(BUILD_DIR)/papermario.map --no-check-sections ######################## Targets ############################# diff --git a/papermario/src/code_80850_len_3060.c b/papermario/src/code_80850_len_3060.c index a3ee402ca4..ef988866df 100644 --- a/papermario/src/code_80850_len_3060.c +++ b/papermario/src/code_80850_len_3060.c @@ -130,7 +130,18 @@ INCLUDE_ASM(code_80850_len_3060, recover_fp); INCLUDE_ASM(code_80850_len_3060, recover_hp); -INCLUDE_ASM(code_80850_len_3060, subtract_hp); +void subtract_hp(s32 amt) { + player_data* playerData = &gPlayerData; + s32 newHP = gPlayerData.curHP; + + if (amt > 0) { + newHP -= amt; + } + if (amt < 0 || newHP < 1) { + newHP = 1; + } + playerData->curHP = newHP; +} s8 has_full_hp(void) { player_data* playerData = &gPlayerData; @@ -166,4 +177,3 @@ s8 subtract_fortress_keys(s8 amt) { s8 get_fortress_key_count(void) { return gPlayerData.fortressKeyCount; } -