This commit is contained in:
Ethan Roseman 2020-08-08 01:25:36 -04:00
parent 13e47dbc33
commit f8343fa522
2 changed files with 13 additions and 3 deletions

View File

@ -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 #############################

View File

@ -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;
}