Another two obj source files

This commit is contained in:
robojumper
2025-06-24 22:15:25 +02:00
parent 21eef4331b
commit b522045f0e
10 changed files with 284 additions and 46 deletions
+12 -2
View File
@@ -2738,9 +2738,19 @@ d/snd/d_snd_source_enemy.cpp:
.data start:0x8054B1B8 end:0x8054B798
d/snd/d_snd_source_obj.cpp:
.text start:0x8038E860 end:0x8038EBF0 align:16
.text start:0x8038E860 end:0x8038EAD8 align:16
.data start:0x8054B798 end:0x8054BB78
.sdata start:0x80574798 end:0x805747C0
.sdata2 start:0x8057DD68 end:0x8057DD70
d/snd/d_snd_source_obj_clef.cpp:
.text start:0x8038EAE0 end:0x8038EBF0 align:16
.ctors start:0x804DB924 end:0x804DB928
.data start:0x8054B798 end:0x8054BBC0
.rodata start:0x804F3970 end:0x804F39B8
.data start:0x8054BB78 end:0x8054BBC0
.sbss start:0x80575DC0 end:0x80575DC8
.sdata2 start:0x8057DD70 end:0x8057DDB8
.bss start:0x805D0FE8 end:0x805D0FF8
d/snd/d_snd_source_equipment.cpp:
.text start:0x8038EBF0 end:0x8038F2A8 align:16
+42 -42
View File
@@ -20952,7 +20952,7 @@ getSourceCategoryForSourceType__15dSndSourceMgr_cFlPCc = .text:0x80382590; // ty
createSource__15dSndSourceMgr_cFUlP9dAcBase_cPCcUc = .text:0x80382640; // type:function size:0xFD8
fn_80383620 = .text:0x80383620; // type:function size:0x94
fn_803836C0 = .text:0x803836C0; // type:function size:0x98
fn_80383760 = .text:0x80383760; // type:function size:0x58
__dt__15dSndSourceObj_cFv = .text:0x80383760; // type:function size:0x58
fn_803837C0 = .text:0x803837C0; // type:function size:0x9C
__dt__21dSndSourceAnimSound_cFv = .text:0x80383860; // type:function size:0x94
fn_80383900 = .text:0x80383900; // type:function size:0x58
@@ -21044,7 +21044,7 @@ setSubtype__14dSoundSource_cFUc = .text:0x80385BA0; // type:function size:0x8
isSourceType__14dSoundSource_cCFl = .text:0x80385BB0; // type:function size:0x14
isCategory__14dSoundSource_cCFl = .text:0x80385BD0; // type:function size:0x14
fn_80385BF0 = .text:0x80385BF0; // type:function size:0xC
fn_80385C00 = .text:0x80385C00; // type:function size:0xC
d_s_vt_0x1E8__15dSndSourceObj_cFUl = .text:0x80385C00; // type:function size:0xC
fn_80385C10 = .text:0x80385C10; // type:function size:0xC
fn_80385C20 = .text:0x80385C20; // type:function size:0x8
hasAnimSound__18dSndSourceESpark_cFv = .text:0x80385C30; // type:function size:0x8
@@ -21307,16 +21307,16 @@ fn_8038E820 = .text:0x8038E820; // type:function size:0x8
fn_8038E830 = .text:0x8038E830; // type:function size:0x8
fn_8038E840 = .text:0x8038E840; // type:function size:0x8
fn_8038E850 = .text:0x8038E850; // type:function size:0x8
fn_8038E860 = .text:0x8038E860; // type:function size:0x130
fn_8038E990 = .text:0x8038E990; // type:function size:0x98
fn_8038EA30 = .text:0x8038EA30; // type:function size:0x5C
fn_8038EA90 = .text:0x8038EA90; // type:function size:0x8
fn_8038EAA0 = .text:0x8038EAA0; // type:function size:0x8
fn_8038EAB0 = .text:0x8038EAB0; // type:function size:0x8
fn_8038EAC0 = .text:0x8038EAC0; // type:function size:0x8
fn_8038EAD0 = .text:0x8038EAD0; // type:function size:0x8
tadtoneRelated = .text:0x8038EAE0; // type:function size:0xE4
fn_8038EBD0 = .text:0x8038EBD0; // type:function size:0x20
postSetup__15dSndSourceObj_cFv = .text:0x8038E860; // type:function size:0x130
setPosition__25dSndSourceObjLightShaft_cFRCQ34nw4r4math4VEC3 = .text:0x8038E990; // type:function size:0x98
__dt__25dSndSourceObjLightShaft_cFv = .text:0x8038EA30; // type:function size:0x5C scope:weak
@88@__dt__15dSndSourceObj_cFv = .text:0x8038EA90; // type:function size:0x8 scope:weak
@4@__dt__15dSndSourceObj_cFv = .text:0x8038EAA0; // type:function size:0x8 scope:weak
@88@__dt__25dSndSourceObjLightShaft_cFv = .text:0x8038EAB0; // type:function size:0x8 scope:weak
@4@setPosition__25dSndSourceObjLightShaft_cFRCQ34nw4r4math4VEC3 = .text:0x8038EAC0; // type:function size:0x8 scope:weak
@4@__dt__25dSndSourceObjLightShaft_cFv = .text:0x8038EAD0; // type:function size:0x8 scope:weak
startTadtoneSound__19dSndSourceObjClef_cFUlUl = .text:0x8038EAE0; // type:function size:0xE4
__sinit_\d_snd_source_obj_clef_cpp = .text:0x8038EBD0; // type:function size:0x20 scope:local
__ct__21dSndSourceEquipment_cFUcP9dAcBase_cPCcP17dSndSourceGroup_c = .text:0x8038EBF0; // type:function size:0x4C
shutdown__21dSndSourceEquipment_cFv = .text:0x8038EC40; // type:function size:0x5C
overrideStartSoundId__21dSndSourceEquipment_cFUl = .text:0x8038ECA0; // type:function size:0x1F0
@@ -21579,7 +21579,7 @@ fn_80397BF0 = .text:0x80397BF0; // type:function size:0x4
fn_80397C00 = .text:0x80397C00; // type:function size:0x60
fn_80397C60 = .text:0x80397C60; // type:function size:0xD8
fn_80397D40 = .text:0x80397D40; // type:function size:0x138
fn_80397E80 = .text:0x80397E80; // type:function size:0x5B0
postSetupSound__15dSndSourceObj_cFUlUlP13dSndSeSound_c = .text:0x80397E80; // type:function size:0x5B0
cbBeFlyLv__21dSndSourceEquipment_cFP13dSndSeSound_cP14dSoundSource_cRQ34nw4r3snd11SoundHandle = .text:0x80398430; // type:function size:0xC8
cbBeThrowRc__21dSndSourceEquipment_cFP13dSndSeSound_cP14dSoundSource_cRQ34nw4r3snd11SoundHandle = .text:0x80398500; // type:function size:0x158
cbBmIgnitionLv__21dSndSourceEquipment_cFP13dSndSeSound_cP14dSoundSource_cRQ34nw4r3snd11SoundHandle = .text:0x80398660; // type:function size:0x74
@@ -29023,11 +29023,11 @@ lbl_804F3888 = .rodata:0x804F3888; // type:object size:0x40
lbl_804F38C8 = .rodata:0x804F38C8; // type:object size:0x18
lbl_804F38E0 = .rodata:0x804F38E0; // type:object size:0x10
lbl_804F38F0 = .rodata:0x804F38F0; // type:object size:0x80
lbl_804F3970 = .rodata:0x804F3970; // type:object size:0xC
lbl_804F397C = .rodata:0x804F397C; // type:object size:0xC
lbl_804F3988 = .rodata:0x804F3988; // type:object size:0xC
lbl_804F3994 = .rodata:0x804F3994; // type:object size:0xC
lbl_804F39A0 = .rodata:0x804F39A0; // type:object size:0x18
grp4 = .rodata:0x804F3970; // type:object size:0x9 scope:local
grp6 = .rodata:0x804F397C; // type:object size:0x9 scope:local
grp9 = .rodata:0x804F3988; // type:object size:0x9 scope:local
grp12 = .rodata:0x804F3994; // type:object size:0x9 scope:local
grp17 = .rodata:0x804F39A0; // type:object size:0x11 scope:local
lbl_804F39B8 = .rodata:0x804F39B8; // type:object size:0xC
lbl_804F39C4 = .rodata:0x804F39C4; // type:object size:0xC
lbl_804F39D0 = .rodata:0x804F39D0; // type:object size:0xC
@@ -38069,9 +38069,9 @@ lbl_8054B1C4 = .data:0x8054B1C4; // type:object size:0xC
lbl_8054B1D0 = .data:0x8054B1D0; // type:object size:0x1EC
lbl_8054B3BC = .data:0x8054B3BC; // type:object size:0x1EC
lbl_8054B5A8 = .data:0x8054B5A8; // type:object size:0x1F0
lbl_8054B798 = .data:0x8054B798; // type:object size:0x1F0
lbl_8054B988 = .data:0x8054B988; // type:object size:0x1F0
lbl_8054BB78 = .data:0x8054BB78; // type:object size:0x48
__vt__25dSndSourceObjLightShaft_c = .data:0x8054B798; // type:object size:0x1F0
__vt__15dSndSourceObj_c = .data:0x8054B988; // type:object size:0x1EC
sGroups = .data:0x8054BB78; // type:object size:0x44 scope:local
@23983 = .data:0x8054BBC0; // type:object size:0x10 scope:local data:string
@23984 = .data:0x8054BBD0; // type:object size:0x15 scope:local data:string
__vt__25dSndSourceEquipmentWhip_c = .data:0x8054BBE8; // type:object size:0x1EC
@@ -41238,11 +41238,11 @@ lbl_80574778 = .sdata:0x80574778; // type:object size:0x8
lbl_80574780 = .sdata:0x80574780; // type:object size:0x4 data:string
lbl_80574784 = .sdata:0x80574784; // type:object size:0x8
lbl_8057478C = .sdata:0x8057478C; // type:object size:0xC
lbl_80574798 = .sdata:0x80574798; // type:object size:0x8
lbl_805747A0 = .sdata:0x805747A0; // type:object size:0x8
lbl_805747A8 = .sdata:0x805747A8; // type:object size:0x8
lbl_805747B0 = .sdata:0x805747B0; // type:object size:0x8
lbl_805747B8 = .sdata:0x805747B8; // type:object size:0x8
@5031 = .sdata:0x80574798; // type:object size:0x5 scope:local data:string
@5032 = .sdata:0x805747A0; // type:object size:0x6 scope:local data:string
@5034 = .sdata:0x805747A8; // type:object size:0x6 scope:local data:string
@5035 = .sdata:0x805747B0; // type:object size:0x5 scope:local data:string
@5036 = .sdata:0x805747B8; // type:object size:0x5 scope:local data:string
lbl_805747C0 = .sdata:0x805747C0; // type:object size:0x8
lbl_805747C8 = .sdata:0x805747C8; // type:object size:0x8
lbl_805747D0 = .sdata:0x805747D0; // type:object size:0x8
@@ -42296,7 +42296,7 @@ sInstance__15dSndSourceMgr_c = .sbss:0x80575DA8; // type:object size:0x4 data:4b
sDisposer__15dSndSourceMgr_c = .sbss:0x80575DAC; // type:object size:0x4 data:4byte
sCtxParams = .sbss:0x80575DB0; // type:object size:0x8 scope:local data:4byte
sIsStartingBaseSound__14dSoundSource_c = .sbss:0x80575DB8; // type:object size:0x1 data:byte
lbl_80575DC0 = .sbss:0x80575DC0; // type:object size:0x8 data:4byte
clefSoundHandle = .sbss:0x80575DC0; // type:object size:0x4 scope:local data:4byte
lbl_80575DC8 = .sbss:0x80575DC8; // type:object size:0x4 data:4byte
lbl_80575DCC = .sbss:0x80575DCC; // type:object size:0x4 data:4byte
sInstance__27dSndDistantSoundActorPool_c = .sbss:0x80575DD0; // type:object size:0x4 data:4byte
@@ -49218,20 +49218,20 @@ lbl_8057DD58 = .sdata2:0x8057DD58; // type:object size:0x4 align:4 data:float
lbl_8057DD5C = .sdata2:0x8057DD5C; // type:object size:0x4 align:4 data:float
lbl_8057DD60 = .sdata2:0x8057DD60; // type:object size:0x4 align:4 data:float
lbl_8057DD64 = .sdata2:0x8057DD64; // type:object size:0x4 align:4 data:float
lbl_8057DD68 = .sdata2:0x8057DD68; // type:object size:0x4 align:4 data:float
lbl_8057DD6C = .sdata2:0x8057DD6C; // type:object size:0x4 align:4 data:float
lbl_8057DD70 = .sdata2:0x8057DD70; // type:object size:0x4
lbl_8057DD74 = .sdata2:0x8057DD74; // type:object size:0x8
lbl_8057DD7C = .sdata2:0x8057DD7C; // type:object size:0x4
lbl_8057DD80 = .sdata2:0x8057DD80; // type:object size:0x4
lbl_8057DD84 = .sdata2:0x8057DD84; // type:object size:0x4
lbl_8057DD88 = .sdata2:0x8057DD88; // type:object size:0x8
lbl_8057DD90 = .sdata2:0x8057DD90; // type:object size:0x4
lbl_8057DD94 = .sdata2:0x8057DD94; // type:object size:0x8
lbl_8057DD9C = .sdata2:0x8057DD9C; // type:object size:0x4
lbl_8057DDA0 = .sdata2:0x8057DDA0; // type:object size:0x8
lbl_8057DDA8 = .sdata2:0x8057DDA8; // type:object size:0x4
lbl_8057DDAC = .sdata2:0x8057DDAC; // type:object size:0xC
@5033 = .sdata2:0x8057DD68; // type:object size:0x4 scope:local align:4 data:float
@5037 = .sdata2:0x8057DD6C; // type:object size:0x4 scope:local align:4 data:float
grp1 = .sdata2:0x8057DD70; // type:object size:0x2 scope:local
grp2 = .sdata2:0x8057DD74; // type:object size:0x5 scope:local
grp3 = .sdata2:0x8057DD7C; // type:object size:0x3 scope:local
grp5 = .sdata2:0x8057DD80; // type:object size:0x2 scope:local
grp7 = .sdata2:0x8057DD84; // type:object size:0x2 scope:local
grp8 = .sdata2:0x8057DD88; // type:object size:0x5 scope:local
grp10 = .sdata2:0x8057DD90; // type:object size:0x2 scope:local
grp11 = .sdata2:0x8057DD94; // type:object size:0x5 scope:local
grp13 = .sdata2:0x8057DD9C; // type:object size:0x2 scope:local
grp14 = .sdata2:0x8057DDA0; // type:object size:0x5 scope:local
grp15 = .sdata2:0x8057DDA8; // type:object size:0x3 scope:local
grp16 = .sdata2:0x8057DDAC; // type:object size:0x5 scope:local
lbl_8057DDB8 = .sdata2:0x8057DDB8; // type:object size:0x4 align:4 data:float
lbl_8057DDBC = .sdata2:0x8057DDBC; // type:object size:0x4 align:4 data:float
lbl_8057DDC0 = .sdata2:0x8057DDC0; // type:object size:0x4 align:4 data:float
@@ -52194,7 +52194,7 @@ l_wcsbuf = .bss:0x805D0510; // type:object size:0x540 scope:local
l_wcsbuf = .bss:0x805D0A50; // type:object size:0x540 scope:local
lbl_805D0F90 = .bss:0x805D0F90; // type:object size:0x24 align:4 data:float
lbl_805D0FB8 = .bss:0x805D0FB8; // type:object size:0x30 align:4 data:float
lbl_805D0FE8 = .bss:0x805D0FE8; // type:object size:0x10
@5909 = .bss:0x805D0FE8; // type:object size:0xC scope:local
lbl_805D0FF8 = .bss:0x805D0FF8; // type:object size:0x10 align:4 data:float
lbl_805D1008 = .bss:0x805D1008; // type:object size:0x10 align:4 data:float
sParam__27dSndDistantSoundActorPool_c = .bss:0x805D1018; // type:object size:0x14 align:4 data:float
+2 -1
View File
@@ -769,7 +769,8 @@ config.libs = [
Object(NonMatching, "d/snd/d_snd_source_link_body.cpp"),
Object(NonMatching, "d/snd/d_snd_source_link_head.cpp"),
Object(NonMatching, "d/snd/d_snd_source_enemy.cpp"),
Object(NonMatching, "d/snd/d_snd_source_obj.cpp"),
Object(Matching, "d/snd/d_snd_source_obj.cpp"),
Object(Matching, "d/snd/d_snd_source_obj_clef.cpp"),
Object(Matching, "d/snd/d_snd_source_equipment.cpp"),
Object(NonMatching, "d/snd/d_snd_mgr_unk_8.cpp"),
Object(NonMatching, "d/snd/d_snd_mgr_unk_9.cpp"),
+1 -1
View File
@@ -209,6 +209,7 @@ public:
protected:
StartResult setupSoundCommon(nw4r::snd::SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void *arg);
void setVolumeFade(f32 volume, u32 fadeFrames);
private:
/**
@@ -255,7 +256,6 @@ private:
dSndSeSound2_c *getHandleType2ForSoundHandle_Dupe(nw4r::snd::SoundHandle *pHandle);
void initVolumeFade();
void setVolumeFade(f32 volume, u32 fadeFrames);
void calcVolumeFade();
// at 0x00: dSoundSourceIf_c vtable
+4
View File
@@ -26,6 +26,10 @@ public:
static s32 getSourceCategoryForSourceType(s32 sourceType, const char *name);
static bool isSwOrEOc(const char *name);
static dSoundSource_c *getPlayerSource() {
return GetInstance()->mpPlayerSource;
}
static dSoundSource_c *getBoomerangSource() {
return GetInstance()->mpBoomerangSource;
}
+35
View File
@@ -0,0 +1,35 @@
#ifndef D_SND_SOURCE_OBJ_H
#define D_SND_SOURCE_OBJ_H
#include "d/snd/d_snd_source.h"
#include "d/snd/d_snd_util.h"
#include "nw4r/math/math_types.h"
class dSndSourceObj_c : public dSoundSource_c {
public:
dSndSourceObj_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
: dSoundSource_c(sourceType, ac, name, pOwnerGroup) {}
/* 0x188 */ virtual void postSetup() override;
/* 0x1CC */ virtual void postSetupSound(u32 playingId, u32 requestedId, dSndSeSound_c *seSound) override;
/* 0x1E8 */ virtual u32 d_s_vt_0x1E8(u32 soundId) override {
return specializeBgHitSoundId(soundId, mPolyAttr0, mPolyAttr1);
}
private:
bool isName(const char *name) const {
return streq(name, getName());
}
};
class dSndSourceObjLightShaft_c : public dSndSourceObj_c {
public:
dSndSourceObjLightShaft_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
: dSndSourceObj_c(sourceType, ac, name, pOwnerGroup) {}
/* 0x1EC */ virtual void setPosition(const nw4r::math::VEC3 &position) override;
};
#endif
+14
View File
@@ -0,0 +1,14 @@
#ifndef D_SND_SOURCE_OBJ_CLEF_H
#define D_SND_SOURCE_OBJ_CLEF_H
#include "d/snd/d_snd_source_obj.h"
class dSndSourceObjClef_c : public dSndSourceObj_c {
public:
dSndSourceObjClef_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
: dSndSourceObj_c(sourceType, ac, name, pOwnerGroup) {}
bool startTadtoneSound(u32 groupIdx, u32 noteIdx);
};
#endif
+4
View File
@@ -49,6 +49,10 @@ public:
return field_0x044;
}
s32 getField_0x058() const {
return field_0x058;
}
u32 getField_0x11C() const {
return field_0x11C;
}
+38
View File
@@ -0,0 +1,38 @@
#include "d/snd/d_snd_source_obj.h"
#include "common.h"
#include "d/snd/d_snd_source.h"
#include "d/snd/d_snd_source_mgr.h"
#include "d/snd/d_snd_state_mgr.h"
#include "d/snd/d_snd_wzsound.h"
#include "nw4r/math/math_types.h"
void dSndSourceObj_c::postSetup() {
if (isName("Fire")) {
if (dSndStateMgr_c::isInStage("F008r")) {
// Inside Goddess Statue
setVolumeFade(0.7f, 0);
}
return;
}
if ((isName("TDoor") || isName("Wind") || isName("Flag")) &&
dSndStateMgr_c::GetInstance()->getField_0x058() >= 13) {
setVolumeFade(0.0f, 0);
}
}
void dSndSourceObjLightShaft_c::setPosition(const nw4r::math::VEC3 &position) {
if (dSndSourceMgr_c::getPlayerSource() != nullptr) {
f32 y = dSndSourceMgr_c::getPlayerSource()->GetPosition().y;
nw4r::math::VEC3 v = position;
if (y > 0.0f) {
v.y = y;
} else {
v.y = 0.0f;
}
SetPosition(v);
mFlags = 0;
holdSound(SE_LightLi_LV);
}
}
+132
View File
@@ -0,0 +1,132 @@
#include "d/snd/d_snd_source_obj_clef.h"
#include "common.h"
#include "d/snd/d_snd_wzsound.h"
#include "nw4r/snd/snd_SeqSoundHandle.h"
#include "nw4r/snd/snd_SoundHandle.h"
struct SndTadtoneGroup {
u8 count;
u8 pitchVariables[];
};
static const SndTadtoneGroup grp1 = {
1,
{0x41},
};
static const SndTadtoneGroup grp2 = {
4,
{0x3C, 0x40, 0x41, 0x43},
};
static const SndTadtoneGroup grp3 = {
2,
{0x43, 0x37},
};
static const SndTadtoneGroup grp4 = {
8,
{0x34, 0x43, 0x41, 0x43, 0x45, 0x35, 0x39, 0x3C},
};
static const SndTadtoneGroup grp5 = {
1,
{0x41},
};
static const SndTadtoneGroup grp6 = {
8,
{0x48, 0x34, 0x37, 0x3C, 0x43, 0x4A, 0x4C, 0x48},
};
static const SndTadtoneGroup grp7 = {
1,
{0x41},
};
static const SndTadtoneGroup grp8 = {
4,
{0x3C, 0x40, 0x41, 0x43},
};
static const SndTadtoneGroup grp9 = {
8,
{0x43, 0x3C, 0x37, 0x3C, 0x34, 0x43, 0x41, 0x43},
};
static const SndTadtoneGroup grp10 = {
1,
{0x45},
};
static const SndTadtoneGroup grp11 = {
4,
{0x41, 0x35, 0x39, 0x3C},
};
static const SndTadtoneGroup grp12 = {
8,
{0x48, 0x34, 0x37, 0x3C, 0x43, 0x4A, 0x4C, 0x48},
};
static const SndTadtoneGroup grp13 = {
1,
{0x41},
};
static const SndTadtoneGroup grp14 = {
4,
{0x3C, 0x40, 0x41, 0x43},
};
static const SndTadtoneGroup grp15 = {
2,
{0x43, 0x37},
};
static const SndTadtoneGroup grp16 = {
4,
{0x37, 0x43, 0x41, 0x43},
};
static const SndTadtoneGroup grp17 = {
16,
{0x45, 0x39, 0x3E, 0x41, 0x35, 0x39, 0x3E, 0x41, 0x48, 0x34, 0x37, 0x3C, 0x43, 0x4A, 0x4C, 0x48},
};
static const SndTadtoneGroup *sGroups[] = {
&grp1, &grp2, &grp3, &grp4, &grp5, &grp6, &grp7, &grp8, &grp9,
&grp10, &grp11, &grp12, &grp13, &grp14, &grp15, &grp16, &grp17,
};
static nw4r::snd::SoundHandle clefSoundHandle;
bool dSndSourceObjClef_c::startTadtoneSound(u32 groupIdx, u32 noteIdx) {
if (groupIdx > ARRAY_LENGTH(sGroups)) {
return false;
}
if (groupIdx < 1) {
return false;
}
const SndTadtoneGroup *grp = sGroups[groupIdx - 1];
if (noteIdx >= grp->count) {
return false;
}
s16 var = grp->pitchVariables[noteIdx];
clefSoundHandle.Stop(10);
nw4r::snd::SoundHandle *pHandle = startSound(SE_Clef_VOICE, &clefSoundHandle);
if (pHandle != nullptr) {
nw4r::snd::SeqSoundHandle seqHandle(pHandle);
seqHandle.WriteVariable(0, var);
return true;
}
return false;
}