Resolve remaining duplicates for CollectGold (#514)

Most overlays have the same CollectGold function (st0 is an odd one out,
there may be others). I noticed in the duplicates report
(https://raw.githubusercontent.com/Xeeynamo/sotn-decomp/gh-duplicates/duplicates.txt)
that there were 3 overlays which still had placeholders in. This PR
resolves that and finishes decompiling all of them.

The C code in all of these is copied from the `wrp` version, if it
matters. Symbols have been changed to account for different data
locations across overlays. I have attempted to be as formulaic as
possible with these.

In most of these, there is a function which is called at the end of the
function. In the `cen` version, it is `func_8019BBA4`. I have also
decompiled that function in every overlay, so once this PR is in, I will
submit another for those functions.
This commit is contained in:
bismurphy 2023-08-26 15:15:59 -04:00 committed by GitHub
parent 4bac2539d4
commit 290b0c0e3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 75 additions and 4 deletions

View File

@ -3,6 +3,7 @@ PfnEntityUpdates = 0x80180394;
g_InitializeData0 = 0x80180410;
g_InitializeEntityData0 = 0x8018041C;
UNK_Invincibility0 = 0x801807B8;
c_GoldPrizes = 0x80180F58;
g_Rooms = 0x801812D4;
EntityBackgroundBlock = 0x8018D600;
EntityUnkId12 = 0x8018D6E0;
@ -38,6 +39,7 @@ UnkEntityFunc0 = 0x80194D08;
SetStep = 0x80194EA4;
InitializeEntity = 0x80194F74;
CollectHeart = 0x801958F4;
CollectGold = 0x80195974;
CollectSubweapon = 0x80195A50;
EntityPrizeDrop = 0x80195C84;
EntityExplosion = 0x801964F8;

View File

@ -10,6 +10,7 @@ g_eBreakableanimSets = 0x80180640;
g_eBreakableBlendModes = 0x80180650;
g_CloneShootOrder = 0x801807D4;
UNK_Invincibility0 = 0x8018097C;
c_GoldPrizes = 0x8018111C;
c_HeartPrizes = 0x801811AC;
g_Rooms = 0x80181498;
EntityUnkId11 = 0x80191A64;
@ -53,6 +54,7 @@ UnkEntityFunc0 = 0x8019AE4C;
SetStep = 0x8019AFE8;
SetSubStep = 0x8019B008;
InitializeEntity = 0x8019B0B8;
CollectGold = 0x8019BAB8;
CollectSubweapon = 0x8019BB94;
CollectHeartVessel = 0x8019BCAC;
CollectLifeVessel = 0x8019BD50;

View File

@ -3,6 +3,7 @@ PfnEntityUpdates = 0x801803E4;
g_InitializeData0 = 0x8018044C;
g_InitializeEntityData0 = 0x80180458;
UNK_Invincibility0 = 0x80180690;
c_GoldPrizes = 0x80180E30;
g_Rooms = 0x801811AC;
EntityBreakable = 0x8018908C;
Random = 0x8018A168;
@ -20,6 +21,7 @@ UnkEntityFunc0 = 0x8018E024;
SetStep = 0x8018E1C0;
InitializeEntity = 0x8018E290;
ReplaceBreakableWithItemDrop = 0x8018E978;
CollectGold = 0x8018EC90;
CollectSubweapon = 0x8018ED6C;
EntityPrizeDrop = 0x8018EFA0;
EntityEquipItemDrop = 0x8018F9B4;

View File

@ -766,7 +766,27 @@ void CollectHeart(u16 index) {
DestroyEntity(g_CurrentEntity);
}
INCLUDE_ASM("asm/us/st/cen/nonmatchings/11280", func_80195974);
void CollectGold(u16 goldSize) {
s32 *gold, *unk;
u16 goldSizeIndex;
g_api.PlaySfx(NA_SE_PL_COLLECT_GOLD);
gold = &g_Status.gold;
goldSizeIndex = goldSize - 2;
*gold += c_GoldPrizes[goldSizeIndex];
if (*gold > MAX_GOLD) {
*gold = MAX_GOLD;
}
unk = &D_80097410;
if (*unk) {
g_api.FreePrimitives(D_80097414);
*unk = 0;
}
func_8019BBA4(D_80180F30[goldSizeIndex], 1);
DestroyEntity(g_CurrentEntity);
}
void CollectSubweapon(u16 subWeaponIdx) {
Entity* player = &PLAYER;

View File

@ -66,6 +66,8 @@ extern u8 D_80180780[]; // Animation
extern s16 D_80180BBC[];
extern u16 D_80180EEC[];
extern u16 D_80180F1C[];
extern u8* D_80180F30[];
extern s32 c_GoldPrizes[];
extern s8 D_80180FE8[];
extern u16 D_801811C8[];
extern u16 D_801811D8[];

View File

@ -824,7 +824,27 @@ void func_8019BA38(u16 arg0) {
DestroyEntity(g_CurrentEntity);
}
INCLUDE_ASM("asm/us/st/dre/nonmatchings/173C4", func_8019BAB8);
void CollectGold(u16 goldSize) {
s32 *gold, *unk;
u16 goldSizeIndex;
g_api.PlaySfx(NA_SE_PL_COLLECT_GOLD);
gold = &g_Status.gold;
goldSizeIndex = goldSize - 2;
*gold += c_GoldPrizes[goldSizeIndex];
if (*gold > MAX_GOLD) {
*gold = MAX_GOLD;
}
unk = &D_80097410;
if (*unk) {
g_api.FreePrimitives(D_80097414);
*unk = 0;
}
func_801A1CE8(D_801810F4[goldSizeIndex], 1);
DestroyEntity(g_CurrentEntity);
}
void CollectSubweapon(u16 subWeaponIdx) {
Entity* player = &PLAYER;

View File

@ -117,6 +117,8 @@ extern u8 D_80181324[];
extern u16 D_80181328[];
extern u16 D_801810B0[];
extern u16 D_801810E0[];
extern u8* D_801810F4[];
extern s32 c_GoldPrizes[];
// *** EntitySoulStealOrb properties START ***

View File

@ -347,7 +347,27 @@ INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_8018EAB4);
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_8018EC10);
INCLUDE_ASM("asm/us/st/rwrp/nonmatchings/A59C", func_8018EC90);
void CollectGold(u16 goldSize) {
s32 *gold, *unk;
u16 goldSizeIndex;
g_api.PlaySfx(NA_SE_PL_COLLECT_GOLD);
gold = &g_Status.gold;
goldSizeIndex = goldSize - 2;
*gold += c_GoldPrizes[goldSizeIndex];
if (*gold > MAX_GOLD) {
*gold = MAX_GOLD;
}
unk = &D_80097410;
if (*unk) {
g_api.FreePrimitives(D_80097414);
*unk = 0;
}
func_80194EC0(D_80180E08[goldSizeIndex], 1);
DestroyEntity(g_CurrentEntity);
}
void CollectSubweapon(u16 subWeaponIdx) {
Entity* player = &PLAYER;

View File

@ -20,9 +20,10 @@ extern u16 g_InitializeData0[];
extern u16 D_80181110[];
// *** EntitySoulStealOrb properties END ***
extern s32 c_GoldPrizes[];
extern u16 D_80180DC4[];
extern u16 D_80180DF4[];
extern u8* D_80180E08[];
extern u16 UNK_Update0[];
extern u16 UNK_Invincibility0[];