dSndSourceMgr_c::createSource OK

This commit is contained in:
robojumper
2025-06-28 09:58:43 +02:00
parent 36115277a4
commit ba0f29f410
10 changed files with 87 additions and 13 deletions
+7 -7
View File
@@ -20056,7 +20056,7 @@ onStageOrLayerUpdate__14dSndStateMgr_cFv = .text:0x803618F0; // type:function si
getStageTypeFlags__14dSndStateMgr_cCFPCc = .text:0x80361CD0; // type:function size:0x2FC
isVolcanicDungeon__14dSndStateMgr_cFUl = .text:0x80361FD0; // type:function size:0x44
isSeekerStoneStage__14dSndStateMgr_cFPCcl = .text:0x80362020; // type:function size:0x84
fn_803620B0 = .text:0x803620B0; // type:function size:0x5C
isActiveDemoMaybe__14dSndStateMgr_cCFl = .text:0x803620B0; // type:function size:0x5C
fn_80362110 = .text:0x80362110; // type:function size:0x34
fn_80362150 = .text:0x80362150; // type:function size:0xB0
fn_80362200 = .text:0x80362200; // type:function size:0xFC
@@ -20945,8 +20945,8 @@ animCallback__15dSndAnimSound_cFilPCciPv = .text:0x803823B0; // type:function si
onAnimSoundEvent__14dSoundSource_cFl = .text:0x803823D0; // type:function size:0x8 scope:weak
setCallback__15dSndAnimSound_cFP14dSoundSource_c = .text:0x803823E0; // type:function size:0x14
setCallback__15dSndAnimSound_cFPFilPCciPv_vPv = .text:0x80382400; // type:function size:0xC
fn_80382410 = .text:0x80382410; // type:function size:0xC0
fn_803824D0 = .text:0x803824D0; // type:function size:0x24
isAnimSoundSource__15dSndSourceMgr_cFlPCc = .text:0x80382410; // type:function size:0xC0
isMultiSoundSource__15dSndSourceMgr_cFlPCc = .text:0x803824D0; // type:function size:0x24
isSwOrEOc__15dSndSourceMgr_cFPCc = .text:0x80382500; // type:function size:0x90
getSourceCategoryForSourceType__15dSndSourceMgr_cFlPCc = .text:0x80382590; // type:function size:0xB0
createSource__15dSndSourceMgr_cFlP9dAcBase_cPCcUc = .text:0x80382640; // type:function size:0xFD8
@@ -20979,7 +20979,7 @@ fn_803844C0 = .text:0x803844C0; // type:function size:0xB0
fn_80384570 = .text:0x80384570; // type:function size:0xC0
fn_80384630 = .text:0x80384630; // type:function size:0x94
fn_803846D0 = .text:0x803846D0; // type:function size:0xA0
fn_80384770 = .text:0x80384770; // type:function size:0xAC
getGroup__15dSndSourceMgr_cFlP9dAcBase_cPCcPCcUc = .text:0x80384770; // type:function size:0xAC
fn_80384820 = .text:0x80384820; // type:function size:0x8C
fn_803848B0 = .text:0x803848B0; // type:function size:0xAC
fn_80384960 = .text:0x80384960; // type:function size:0x8C
@@ -21400,7 +21400,7 @@ fn_80391BA0 = .text:0x80391BA0; // type:function size:0x160
fn_80391D00 = .text:0x80391D00; // type:function size:0x11C
fn_80391E20 = .text:0x80391E20; // type:function size:0x4C
fn_80391E70 = .text:0x80391E70; // type:function size:0x14
fn_80391E90 = .text:0x80391E90; // type:function size:0xA8
__ct__23dSndSourceHarpSwHarp4_cFlP9dAcBase_cPCcP17dSndSourceGroup_c = .text:0x80391E90; // type:function size:0xA8
fn_80391F40 = .text:0x80391F40; // type:function size:0xC
fn_80391F50 = .text:0x80391F50; // type:function size:0x24C
fn_803921A0 = .text:0x803921A0; // type:function size:0x198
@@ -38089,8 +38089,8 @@ lbl_8054C7B8 = .data:0x8054C7B8; // type:object size:0x10
lbl_8054C7C8 = .data:0x8054C7C8; // type:object size:0x1F8
lbl_8054C9C0 = .data:0x8054C9C0; // type:object size:0x10
lbl_8054C9D0 = .data:0x8054C9D0; // type:object size:0x1FC
lbl_8054CBCC = .data:0x8054CBCC; // type:object size:0x1FC
lbl_8054CDC8 = .data:0x8054CDC8; // type:object size:0x1FC
__vt__22dSndSourceHarpSwHarp_c = .data:0x8054CBCC; // type:object size:0x1FC
__vt__23dSndSourceHarpObjWarp_c = .data:0x8054CDC8; // type:object size:0x1FC
__vt__23dSndSourceHarpRelated_c = .data:0x8054CFC4; // type:object size:0x1FC
lbl_8054D1C0 = .data:0x8054D1C0; // type:object size:0x1F0
lbl_8054D3B0 = .data:0x8054D3B0; // type:object size:0xC
+2
View File
@@ -6,6 +6,8 @@
class dSndSourceDemo_c : public dSndSourceAnimSound_c {
public:
dSndSourceDemo_c(s32 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup);
/* 0x200 */ u8 _0x200[0x204 - 0x200];
};
#endif
+34
View File
@@ -20,6 +20,7 @@ public:
/* 0x1F8 */ virtual void d_s_harp_vt_0x1F8();
private:
/* 0x15C */ u8 _0x15C[0x1BC - 0x15C];
};
class dSndSourceHarpTg_c : public dSndSourceHarpRelated_c {
@@ -30,4 +31,37 @@ public:
private:
};
class dSndSourceHarpObjWarp_c : public dSndSourceHarpRelated_c {
public:
dSndSourceHarpObjWarp_c(s32 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
: dSndSourceHarpRelated_c(sourceType, ac, name, pOwnerGroup) {}
/* 0x188 */ virtual void postSetup() override;
/* 0x18C */ virtual void postCalc() override;
private:
};
class dSndSourceHarpSwHarp_c : public dSndSourceHarpRelated_c {
public:
dSndSourceHarpSwHarp_c(s32 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
: dSndSourceHarpRelated_c(sourceType, ac, name, pOwnerGroup) {}
/* 0x188 */ virtual void postSetup() override;
/* 0x18C */ virtual void postCalc() override;
private:
};
class dSndSourceHarpSwHarp4_c : public dSndSourceHarpRelated_c {
public:
dSndSourceHarpSwHarp4_c(s32 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup);
/* 0x188 */ virtual void postSetup() override;
/* 0x18C */ virtual void postCalc() override;
private:
/* 0x1BC */ u8 _0x1BC[0x210 - 0x1BC];
};
#endif
+1 -1
View File
@@ -66,7 +66,7 @@ private:
void clearSourceLists();
void clearSourceList(nw4r::ut::List *list);
dSndSourceGroup_c *findGroup(s32 sourceType, dAcBase_c *actor, const char *name, const char *origName, u8 subtype);
dSndSourceGroup_c *getGroup(s32 sourceType, dAcBase_c *actor, const char *name, const char *origName, u8 subtype);
bool fn_803846D0(s32 sourceType, const char *name, u8 subtype);
/* 0x0010 */ u8 field_0x0010;
+2
View File
@@ -9,6 +9,7 @@ public:
dSndSourceNpcSpecial_c(s32 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup);
private:
/* 0x200 */ u8 _0x200[0x204 - 0x200];
};
class dSndSourceNpcDr_c : public dSndSourceNpcSpecial_c {
@@ -16,6 +17,7 @@ public:
dSndSourceNpcDr_c(s32 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup);
private:
/* 0x204 */ u8 _0x204[0x20C - 0x204];
};
#endif
+2
View File
@@ -6,6 +6,8 @@
class dSndSourcePlayer_c : public dSndSourceAnimSound_c {
public:
dSndSourcePlayer_c(s32 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup);
/* 0x200 */ u8 _0x200[0x238 - 0x200];
};
#endif
+2
View File
@@ -6,6 +6,8 @@
class dSndSourcePlayerHead_c : public dSoundSource_c {
public:
dSndSourcePlayerHead_c(s32 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup);
/* 0x15C */ u8 _0x15C[0x22B0 - 0x15C];
};
#endif
+3
View File
@@ -6,6 +6,9 @@
class dSndSourceTgSound_c : public dSoundSource_c {
public:
dSndSourceTgSound_c(s32 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup);
private:
/* 0x15C */ u8 _0x15C[0x164 - 0x15C];
};
#endif
+3
View File
@@ -83,6 +83,9 @@ public:
bool isInDemo() const {
return getCurrentStageMusicDemoName() != nullptr;
}
// not sure, subtype is unused
bool isActiveDemoMaybe(s32 subtype) const;
bool isInEvent(const char *eventName);
private:
+31 -5
View File
@@ -6,6 +6,8 @@
#include "d/snd/d_snd_source.h"
// clang-format off
// vtable order - vtables are right but need to split up
// some headers for weak function order
#include "d/snd/d_snd_source_e_spark.h"
#include "d/snd/d_snd_source_enums.h"
#include "d/snd/d_snd_source_equipment.h"
@@ -32,6 +34,11 @@
#include <cmath>
// TODO - weak function order in this file is a problem.
// one particular problem is that all weak functions involving
// dSndAnimSound_c are reversed compared to their natural vtable order,
// and the overridden `SetupSound` function seems to be immune to reordering
// TODO move
struct ActorBaseNamePair {
const char *variant;
@@ -84,7 +91,7 @@ dSoundSourceIf_c *dSndSourceMgr_c::createSource(s32 sourceType, dAcBase_c *actor
return nullptr;
}
u8 subtype = actor->subtype;
s32 subtype = actor->subtype;
SizedString<64> nameStr;
nameStr.sprintf("%s", name);
@@ -160,9 +167,9 @@ dSoundSourceIf_c *dSndSourceMgr_c::createSource(s32 sourceType, dAcBase_c *actor
if (category != SND_SOURCE_CATEGORY_9) {
if (isModified) {
group = GetInstance()->findGroup(sourceType, actor, actualName, name, subtype);
group = GetInstance()->getGroup(sourceType, actor, actualName, name, subtype);
} else {
group = GetInstance()->findGroup(sourceType, actor, actualName, nullptr, subtype);
group = GetInstance()->getGroup(sourceType, actor, actualName, nullptr, subtype);
}
actualName = group->getName();
}
@@ -236,11 +243,30 @@ dSoundSourceIf_c *dSndSourceMgr_c::createSource(s32 sourceType, dAcBase_c *actor
}
break;
case SND_SOURCE_CATEGORY_TG_SOUND:
if (dSndStateMgr_c::GetInstance()->isActiveDemoMaybe(subtype)) {
return nullptr;
}
newSource = new dSndSourceTgSound_c(sourceType, actor, actualName, group);
break;
case SND_SOURCE_CATEGORY_HARP_RELATED:
// TODO
new dSndSourceHarpTg_c(0, actor, name, nullptr);
switch (sourceType) {
case SND_SOURCE_OBJECT_WARP:
newSource = new dSndSourceHarpObjWarp_c(sourceType, actor, actualName, group);
break;
case SND_SOURCE_SW_HARP:
if (subtype == 4) {
newSource = new dSndSourceHarpSwHarp4_c(sourceType, actor, actualName, group);
} else {
newSource = new dSndSourceHarpSwHarp_c(sourceType, actor, actualName, group);
}
break;
case SND_SOURCE_TG_HARP:
newSource = new dSndSourceHarpTg_c(sourceType, actor, actualName, group);
break;
default:
newSource = new dSndSourceHarpRelated_c(sourceType, actor, actualName, group);
break;
}
break;
case SND_SOURCE_CATEGORY_7: newSource = new dSndSourceDemo_c(sourceType, actor, actualName, group); break;
default: