From 9b60b24cb7da481834a48d43d32a5392edd3dc07 Mon Sep 17 00:00:00 2001 From: Jdog Date: Wed, 12 Aug 2020 21:10:41 -0700 Subject: [PATCH] removed uneccessary global vars --- include/variables.h | 3 --- src/code_fa4c0_len_3bf0.c | 51 +++++++++++++++++++++++++++++++-------- undefined_syms.txt | 2 -- 3 files changed, 41 insertions(+), 15 deletions(-) diff --git a/include/variables.h b/include/variables.h index 1c2fa1a962..3b5026e350 100644 --- a/include/variables.h +++ b/include/variables.h @@ -23,9 +23,6 @@ extern s16 D_800A0944; extern s16 D_80151308; -extern s16 D_8010F304[]; // Key Items -extern s16 D_8010F444[]; // Items - extern s32 D_8009A650[1]; extern s16 gCurrentDoorSoundsSet; diff --git a/src/code_fa4c0_len_3bf0.c b/src/code_fa4c0_len_3bf0.c index 89201e5470..75cb70e714 100644 --- a/src/code_fa4c0_len_3bf0.c +++ b/src/code_fa4c0_len_3bf0.c @@ -91,18 +91,18 @@ INCLUDE_ASM(code_fa4c0_len_3bf0, PlaySoundAtF); s32 RemoveKeyItemAt(script_context* script, s32 initialCall) { s32* ptrReadPos = script->ptrReadPos; s32 index = get_variable(script, *ptrReadPos++); - s16* ptrTemp = D_8010F304; + s16* ptrKeyItems = &gPlayerData.keyItems; - ptrTemp[index] = 0; + ptrKeyItems[index] = 0; return 2; } s32 RemoveItemAt(script_context* script, s32 initialCall) { s32* ptrReadPos = script->ptrReadPos; s32 index = get_variable(script, *ptrReadPos++); - s16* ptrTemp = D_8010F444; + s16* ptrInvItems = &gPlayerData.invItems; - ptrTemp[index] = 0; + ptrInvItems[index] = 0; sort_items(); return 2; } @@ -255,6 +255,28 @@ s32 AddStarPieces(script_context* script, s32 initialCall) { } INCLUDE_ASM(code_fa4c0_len_3bf0, GetItemPower); +/* +s32 GetItemPower(script_context* script, s32 initialCall) { + s32* ptrReadPos = script->ptrReadPos; + s32* ptrNextPos = *ptrReadPos++; + + s32 temp_a1; + s32 temp_s0_2; + s32 temp_s1; + void *temp_s0; + + temp_s0 = arg0->unkC; + temp_a1 = *temp_s0; + temp_s0 = temp_s0 + 4; + temp_s1 = (get_variable(temp_a1) << 5) + 0x800878E0; + temp_s0_2 = temp_s0->unk4; + set_variable(arg0, temp_s0->unk0, temp_s1->unk1B); + set_variable(arg0, temp_s0_2, temp_s1->unk1C); + return 2; + +} +*/ + INCLUDE_ASM(code_fa4c0_len_3bf0, ShowGotItem); @@ -264,6 +286,7 @@ INCLUDE_ASM(code_fa4c0_len_3bf0, func_802D74C0); INCLUDE_ASM(code_fa4c0_len_3bf0, ShowEmote); + INCLUDE_ASM(code_fa4c0_len_3bf0, RemoveEffect); /* s32 RemoveEffect(script_context* script, s32 initialCall) { @@ -275,26 +298,34 @@ s32 RemoveEffect(script_context* script, s32 initialCall) { s32 func_802D7B10(script_context* script, s32 initialCall) { s32* ptrReadPos = script->ptrReadPos; - s32 ptrValue = get_variable(script, *ptrReadPos++); - *ptrValue = (*ptrValue | 0x10); + s32* ptrValue = get_variable(script, *ptrReadPos++); + + *ptrValue |= 0x10; return 2; } s32 func_802D7B44(script_context* script, s32 initialCall) { s32* ptrReadPos = script->ptrReadPos; - s32 ptrValue = get_variable(script, *ptrReadPos++); - *((ptrValue + 0xC) + 0x14) = 10; + s32* ptrValue = get_variable(script, *ptrReadPos++); + s32* ptrTemp = ptrValue[3]; + + ptrTemp[5] = 10; return 2; } s32 func_802D7B74(script_context* script, s32 initialCall) { s32* ptrReadPos = script->ptrReadPos; - s32 ptrValue = get_variable(script, *ptrReadPos++); - *((ptrValue + 0xC) + 0x30) = 5; + s32* ptrValue = get_variable(script, *ptrReadPos++); + s32* ptrTemp = ptrValue[3]; + + ptrTemp[11] = 5; return 2; } + +// More functions still in RemoveEffect.s but the ones above are matching properly */ + INCLUDE_ASM(code_fa4c0_len_3bf0, ShowSleepBubble); INCLUDE_ASM(code_fa4c0_len_3bf0, PlayEffect); diff --git a/undefined_syms.txt b/undefined_syms.txt index 1e0c9eb5bc..4956987d30 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -36,8 +36,6 @@ D_8009A650 = 0x8009A650; D_800A0900 = 0x800A0900; D_800DC500 = 0x800DC500; D_8010F6D0 = 0x8010F6D0; -D_8010F304 = 0x8010F304; -D_8010F444 = 0x8010F444; D_802C3000 = 0x802C3000; D_802DBD40 = 0x802DBD40; D_802E0D90 = 0x802E0D90;