More enemy

This commit is contained in:
robojumper
2025-06-27 09:32:52 +02:00
parent b522045f0e
commit e1f7e2ac58
17 changed files with 1061 additions and 831 deletions
+2
View File
@@ -2736,6 +2736,8 @@ d/snd/d_snd_source_link_head.cpp:
d/snd/d_snd_source_enemy.cpp:
.text start:0x8038DD10 end:0x8038E858 align:16
.data start:0x8054B1B8 end:0x8054B798
.sdata start:0x80574758 end:0x80574798
.sdata2 start:0x8057DD48 end:0x8057DD68
d/snd/d_snd_source_obj.cpp:
.text start:0x8038E860 end:0x8038EAD8 align:16
+29 -29
View File
@@ -20950,7 +20950,7 @@ fn_803824D0 = .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_cFUlP9dAcBase_cPCcUc = .text:0x80382640; // type:function size:0xFD8
fn_80383620 = .text:0x80383620; // type:function size:0x94
__dt__25dSndSourceEnemyAnimBase_cFv = .text:0x80383620; // type:function size:0x94
fn_803836C0 = .text:0x803836C0; // type:function size:0x98
__dt__15dSndSourceObj_cFv = .text:0x80383760; // type:function size:0x58
fn_803837C0 = .text:0x803837C0; // type:function size:0x9C
@@ -20988,7 +20988,7 @@ fn_80384A00 = .text:0x80384A00; // type:function size:0x174
registerSource__15dSndSourceMgr_cFP14dSoundSource_c = .text:0x80384B80; // type:function size:0x178
getCategory__14dSoundSource_cCFv = .text:0x80384D00; // type:function size:0x8
isCertainEnemyType__15dSndSourceMgr_cFP14dSoundSource_c = .text:0x80384D10; // type:function size:0x78
fn_80384D90 = .text:0x80384D90; // type:function size:0x98
registerUnkEnemyType__15dSndSourceMgr_cFP17dSndSourceEnemy_c = .text:0x80384D90; // type:function size:0x98
unregisterSource__15dSndSourceMgr_cFP14dSoundSource_c = .text:0x80384E30; // type:function size:0xBC
removeSourceFromList__15dSndSourceMgr_cFP14dSoundSource_cPQ34nw4r2ut4List = .text:0x80384EF0; // type:function size:0xAC
onShutdownSource__15dSndSourceMgr_cFP14dSoundSource_c = .text:0x80384FA0; // type:function size:0x14
@@ -21045,8 +21045,8 @@ 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
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
d_s_vt_0x1E8__17dSndSourceEnemy_cFUl = .text:0x80385C10; // type:function size:0xC
setBattleBgmRelated__17dSndSourceEnemy_cFi = .text:0x80385C20; // type:function size:0x8
hasAnimSound__18dSndSourceESpark_cFv = .text:0x80385C30; // type:function size:0x8
fn_80385C40 = .text:0x80385C40; // type:function size:0x90
fn_80385CD0 = .text:0x80385CD0; // type:function size:0x8
@@ -21063,12 +21063,12 @@ fn_80385E90 = .text:0x80385E90; // type:function size:0x5C
fn_80385EF0 = .text:0x80385EF0; // type:function size:0x8
fn_80385F00 = .text:0x80385F00; // type:function size:0x8
fn_80385F10 = .text:0x80385F10; // type:function size:0x4
fn_80385F20 = .text:0x80385F20; // type:function size:0x8
fn_80385F30 = .text:0x80385F30; // type:function size:0x8
fn_80385F40 = .text:0x80385F40; // type:function size:0x5C
fn_80385FA0 = .text:0x80385FA0; // type:function size:0x8
fn_80385FB0 = .text:0x80385FB0; // type:function size:0x8
fn_80385FC0 = .text:0x80385FC0; // type:function size:0x4
hasAnimSound__25dSndSourceEnemyAnimBase_cFv = .text:0x80385F20; // type:function size:0x8
load__25dSndSourceEnemyAnimBase_cFPvPCc = .text:0x80385F30; // type:function size:0x8
setFrame__25dSndSourceEnemyAnimBase_cFf = .text:0x80385F40; // type:function size:0x5C
setRate__25dSndSourceEnemyAnimBase_cFf = .text:0x80385FA0; // type:function size:0x8
getAnimSound__25dSndSourceEnemyAnimBase_cFv = .text:0x80385FB0; // type:function size:0x8
SetupSound__25dSndSourceEnemyAnimBase_cFPQ34nw4r3snd11SoundHandleUlPCQ44nw4r3snd14SoundStartable9StartInfoPv = .text:0x80385FC0; // type:function size:0x4
hasAnimSound__21dSndSourceAnimSound_cFv = .text:0x80385FD0; // type:function size:0x8
load__21dSndSourceAnimSound_cFPvPCc = .text:0x80385FE0; // type:function size:0x8
setFrame__21dSndSourceAnimSound_cFf = .text:0x80385FF0; // type:function size:0x5C
@@ -21086,9 +21086,9 @@ fn_803862E0 = .text:0x803862E0; // type:function size:0x4
@88@__dt__21dSndSourceAnimSound_cFv = .text:0x80386310; // type:function size:0x8
@4@SetupSound__21dSndSourceAnimSound_cFPQ34nw4r3snd11SoundHandleUlPCQ44nw4r3snd14SoundStartable9StartInfoPv = .text:0x80386320; // type:function size:0x8
@4@__dt__21dSndSourceAnimSound_cFv = .text:0x80386330; // type:function size:0x8
fn_80386340 = .text:0x80386340; // type:function size:0x8
fn_80386350 = .text:0x80386350; // type:function size:0x8
fn_80386360 = .text:0x80386360; // type:function size:0x8
@88@__dt__25dSndSourceEnemyAnimBase_cFv = .text:0x80386340; // type:function size:0x8
@4@SetupSound__25dSndSourceEnemyAnimBase_cFPQ34nw4r3snd11SoundHandleUlPCQ44nw4r3snd14SoundStartable9StartInfoPv = .text:0x80386350; // type:function size:0x8
@4@__dt__25dSndSourceEnemyAnimBase_cFv = .text:0x80386360; // type:function size:0x8
fn_80386370 = .text:0x80386370; // type:function size:0x8
fn_80386380 = .text:0x80386380; // type:function size:0x8
fn_80386390 = .text:0x80386390; // type:function size:0x8
@@ -21129,7 +21129,7 @@ getSourceClosestToListener__17dSndSourceGroup_cFv = .text:0x80386CF0; // type:fu
getSourceClosestToPlayer__17dSndSourceGroup_cFv = .text:0x80386DE0; // type:function size:0x110
fn_80386EF0 = .text:0x80386EF0; // type:function size:0x80
setParamFromName__17dSndSourceGroup_cFPCc = .text:0x80386F70; // type:function size:0x1A4C
create__14dSoundSource_cFUlP9dAcBase_cPCcUc = .text:0x803889C0; // type:function size:0x4
create__16dSoundSourceIf_cFUlP9dAcBase_cPCcUc = .text:0x803889C0; // type:function size:0x4
__ct__14dSoundSource_cFUcP9dAcBase_cPCcP17dSndSourceGroup_c = .text:0x803889D0; // type:function size:0x108
__dt__14dSoundSource_cFv = .text:0x80388AE0; // type:function size:0xC4
setup__14dSoundSource_cFv = .text:0x80388BB0; // type:function size:0x118
@@ -21199,7 +21199,7 @@ resetTempParams__14dSoundSource_cFv = .text:0x8038B320; // type:function size:0x
onSetupError__14dSoundSource_cFv = .text:0x8038B350; // type:function size:0x30
overrideStartSoundId__14dSoundSource_cFUl = .text:0x8038B380; // type:function size:0x8
postStartSound__14dSoundSource_cFRQ34nw4r3snd11SoundHandleP13dSndSeSound_cUl = .text:0x8038B390; // type:function size:0x4
d_s_vt_0x1A0__14dSoundSource_cFUli = .text:0x8038B3A0; // type:function size:0x8
overrideHoldSoundId__14dSoundSource_cFUlb = .text:0x8038B3A0; // type:function size:0x8
postHoldSound__14dSoundSource_cFRQ34nw4r3snd11SoundHandleP13dSndSeSound_cUli = .text:0x8038B3B0; // type:function size:0x4
attachDistantSound__14dSoundSource_cFP23dSndDistantSoundActor_c = .text:0x8038B3C0; // type:function size:0x54
detachDistantSound__14dSoundSource_cFP23dSndDistantSoundActor_c = .text:0x8038B420; // type:function size:0x60
@@ -21285,15 +21285,15 @@ fn_8038DCD0 = .text:0x8038DCD0; // type:function size:0x8
fn_8038DCE0 = .text:0x8038DCE0; // type:function size:0x8
fn_8038DCF0 = .text:0x8038DCF0; // type:function size:0x8
fn_8038DD00 = .text:0x8038DD00; // type:function size:0x8
fn_8038DD10 = .text:0x8038DD10; // type:function size:0x94
fn_8038DDB0 = .text:0x8038DDB0; // type:function size:0x7C
fn_8038DE30 = .text:0x8038DE30; // type:function size:0x34
fn_8038DE70 = .text:0x8038DE70; // type:function size:0x34
fn_8038DEB0 = .text:0x8038DEB0; // type:function size:0x284
fn_8038E140 = .text:0x8038E140; // type:function size:0xC
fn_8038E150 = .text:0x8038E150; // type:function size:0xA4
fn_8038E200 = .text:0x8038E200; // type:function size:0xBC
fn_8038E2C0 = .text:0x8038E2C0; // type:function size:0x48
__ct__17dSndSourceEnemy_cFUcP9dAcBase_cPCcP17dSndSourceGroup_c = .text:0x8038DD10; // type:function size:0x94
__dt__17dSndSourceEnemy_cFv = .text:0x8038DDB0; // type:function size:0x7C
shutdown__17dSndSourceEnemy_cFv = .text:0x8038DE30; // type:function size:0x34
unregisterEnemySource__17dSndSourceEnemy_cFv = .text:0x8038DE70; // type:function size:0x34
postSetup__17dSndSourceEnemy_cFv = .text:0x8038DEB0; // type:function size:0x284
vt_0x020__17dSndSourceEnemy_cFv = .text:0x8038E140; // type:function size:0xC
checkBattleBgmRelated__17dSndSourceEnemy_cFv = .text:0x8038E150; // type:function size:0xA4
overrideStartSoundId__17dSndSourceEnemy_cFUl = .text:0x8038E200; // type:function size:0xBC
overrideHoldSoundId__17dSndSourceEnemy_cFUlb = .text:0x8038E2C0; // type:function size:0x48
fn_8038E310 = .text:0x8038E310; // type:function size:0xE0
fn_8038E3F0 = .text:0x8038E3F0; // type:function size:0x2C
fn_8038E420 = .text:0x8038E420; // type:function size:0x198
@@ -21301,8 +21301,8 @@ fn_8038E5C0 = .text:0x8038E5C0; // type:function size:0x74
fn_8038E640 = .text:0x8038E640; // type:function size:0x74
fn_8038E6C0 = .text:0x8038E6C0; // type:function size:0x98
fn_8038E760 = .text:0x8038E760; // type:function size:0x9C
fn_8038E800 = .text:0x8038E800; // type:function size:0x8
fn_8038E810 = .text:0x8038E810; // type:function size:0x8
@88@__dt__17dSndSourceEnemy_cFv = .text:0x8038E800; // type:function size:0x8
@4@__dt__17dSndSourceEnemy_cFv = .text:0x8038E810; // type:function size:0x8
fn_8038E820 = .text:0x8038E820; // type:function size:0x8
fn_8038E830 = .text:0x8038E830; // type:function size:0x8
fn_8038E840 = .text:0x8038E840; // type:function size:0x8
@@ -21529,7 +21529,7 @@ fn_80395D10 = .text:0x80395D10; // type:function size:0x5C
fn_80395D70 = .text:0x80395D70; // type:function size:0xB4
fn_80395E30 = .text:0x80395E30; // type:function size:0xA0
fn_80395ED0 = .text:0x80395ED0; // type:function size:0x84
fn_80395F60 = .text:0x80395F60; // type:function size:0x1A4
postSetupSound__17dSndSourceEnemy_cFUlUlP13dSndSeSound_c = .text:0x80395F60; // type:function size:0x1A4
fn_80396110 = .text:0x80396110; // type:function size:0x4C
fn_80396160 = .text:0x80396160; // type:function size:0x64
fn_803961D0 = .text:0x803961D0; // type:function size:0x64
@@ -38052,7 +38052,7 @@ lbl_80549900 = .data:0x80549900; // type:object size:0x1EC
lbl_80549AEC = .data:0x80549AEC; // type:object size:0x1EC
lbl_80549CD8 = .data:0x80549CD8; // type:object size:0x1EC
lbl_80549EC4 = .data:0x80549EC4; // type:object size:0x1EC
lbl_8054A0B0 = .data:0x8054A0B0; // type:object size:0x1EC
__vt__25dSndSourceEnemyAnimBase_c = .data:0x8054A0B0; // type:object size:0x1EC
__vt__21dSndSourceAnimSound_c = .data:0x8054A29C; // type:object size:0x1EC
__vt__18dSndSourceESpark_c = .data:0x8054A488; // type:object size:0x1EC
__vt__33SndMgrDisposer<15dSndSourceMgr_c> = .data:0x8054A674; // type:object size:0xC
@@ -38068,7 +38068,7 @@ lbl_8054B1B8 = .data:0x8054B1B8; // type:object size:0xC
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
__vt__17dSndSourceEnemy_c = .data:0x8054B5A8; // type:object size:0x1EC
__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
+4
View File
@@ -19,6 +19,10 @@ public:
void shutdown() {
mSound.Shutdown();
}
void setField_0x98(f32 value) {
field_0x98 = value;
}
private:
static void animCallback(int, s32, const char *, UNKWORD, void *userData);
+3 -4
View File
@@ -15,7 +15,6 @@
/** Size: probably 0x15C */
class dSoundSource_c : public dSoundSourceIf_c, public dSnd3DActor_c {
public:
static dSoundSource_c *create(u32 id, dAcBase_c *actor, const char *name, u8 subtype);
dSoundSource_c(u8 sourceType, dAcBase_c *, const char *name, dSndSourceGroup_c *pOwnerGroup);
virtual ~dSoundSource_c();
@@ -54,7 +53,7 @@ public:
/* 0x198 */ virtual void postStartSound(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id) override;
/* 0x19C */ virtual u32 overrideHitObjSoundId(u32 soundId, dSoundSource_c *source);
/* 0x1A0 */ virtual u32 d_s_vt_0x1A0(u32 soundId, UNKWORD);
/* 0x1A0 */ virtual u32 overrideHoldSoundId(u32 soundId, bool initial);
/* 0x1A4 */ virtual void
postHoldSound(nw4r::snd::SoundHandle &handle, dSndSeSound_c *pSound, u32 id, UNKWORD) override;
@@ -201,8 +200,8 @@ public:
/* 0x10C */ virtual void setRate(f32 frame) override {}
/* 0x110 */ virtual void setPolyAttrs(u8 polyAttr0, u8 polyAttr1) override;
/* 0x114 */ virtual void setBattleBgmRelated(UNKWORD) override {}
/* 0x118 */ virtual bool checkBattleBgmRelated() override {
return false;
/* 0x118 */ virtual UNKWORD checkBattleBgmRelated() override {
return 0;
}
dSndSeSound2_c *getHandleType2ForSoundId(u32 soundId);
+81
View File
@@ -0,0 +1,81 @@
#ifndef D_SND_SOURCE_ENEMY_H
#define D_SND_SOURCE_ENEMY_H
#include "d/snd/d_snd_anim_sound.h"
#include "d/snd/d_snd_source.h"
#include "nw4r/ut/ut_list.h"
class dSndSourceEnemy_c : public dSoundSource_c {
public:
dSndSourceEnemy_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup);
virtual ~dSndSourceEnemy_c();
/* 0x020 */ virtual void vt_0x020() override;
/* 0x044 */ virtual void shutdown() override;
/* 0x114 */ virtual void setBattleBgmRelated(UNKWORD arg) override {
field_0x164 = arg;
}
/* 0x118 */ virtual UNKWORD checkBattleBgmRelated() override;
/* 0x188 */ virtual void postSetup() override;
/* 0x194 */ virtual u32 overrideStartSoundId(u32 soundId) override;
/* 0x1A0 */ virtual u32 overrideHoldSoundId(u32 soundId, bool initial) 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:
// Probably not a problem for weak function order since getName is emitted
// earlier through an explicit call
bool isName(const char *name) const {
return streq(name, getName());
}
void unregisterEnemySource();
/* 0x15C */ nw4r::ut::Node mMgrEnemyLink;
/* 0x164 */ UNKWORD field_0x164;
/* 0x168 */ u8 field_0x168;
/* 0x169 */ u8 field_0x169;
/* 0x16A */ bool mIsRegisteredEnemy;
};
class dSndSourceEnemyAnimBase_c : public dSndSourceEnemy_c {
public:
dSndSourceEnemyAnimBase_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
: dSndSourceEnemy_c(sourceType, ac, name, pOwnerGroup), mAnimSound(this) {}
/* 0x1A8 */ virtual StartResult
SetupSound(nw4r::snd::SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void *arg) override {
return setupSoundCommon(pHandle, soundId, pStartInfo, arg);
}
/* 0x1D4 */ virtual dSndAnimSound_c *getAnimSound() override {
return &mAnimSound;
}
/* 0x100 */ virtual bool hasAnimSound() override {
return true;
}
/* 0x104 */ virtual void load(void *data, const char *name) override {
mAnimSound.setData(data, name);
}
/* 0x108 */ virtual void setFrame(f32 frame) override {
if (isInaudibleInternal()) {
mAnimSound.resetFrame(frame);
} else {
mAnimSound.setFrame(frame);
}
}
/* 0x10C */ virtual void setRate(f32 frame) override {
mAnimSound.setRate(frame);
}
private:
/* 0x16C */ dSndAnimSound_c mAnimSound;
};
#endif
+7 -3
View File
@@ -19,10 +19,14 @@ enum SoundSourceType_e {
// 10-31: Enemy? (2)
SND_SOURCE_ENEMY_10 = 10,
SND_SOURCE_LIZARUFOS = 13,
SND_SOURCE_BC_Z = 16,
SND_SOURCE_SPARK = 17,
SND_SOURCE_BIGBOSS = 20,
SND_SOURCE_GIRAHUMU_3 = 24,
SND_SOURCE_ENEMY_28 = 28,
SND_SOURCE_BULLET = 29,
SND_SOURCE_BULLET_MAGUPPO = 30,
SND_SOURCE_ENEMY_31 = 31,
// 32-42: Object? (3)
@@ -41,7 +45,7 @@ enum SoundSourceType_e {
SND_SOURCE_NPC_43 = 43,
SND_SOURCE_KENSEI = 44,
SND_SOURCE_PLAYER_BIRD = 45,
SND_SOURCE_NPC_48 = 48,
SND_SOURCE_NPC_HEAD = 48,
SND_SOURCE_INSECT = 49,
SND_SOURCE_NPC_NRM = 51,
SND_SOURCE_NPC_DRAGON = 52,
@@ -53,7 +57,7 @@ enum SoundSourceType_e {
SND_SOURCE_54 = 54,
SND_SOURCE_OBJECT_WARP = 55,
SND_SOURCE_SW_HARP = 56,
SND_SOURCE_57 = 57,
SND_SOURCE_TG_HARP = 57,
// 58: ? (7)
SND_SOURCE_58 = 58,
@@ -72,7 +76,7 @@ enum SoundSourceCategory_e {
SND_SOURCE_CATEGORY_OBJECT = 3,
SND_SOURCE_CATEGORY_NPC = 4,
SND_SOURCE_CATEGORY_TG_SOUND = 5,
SND_SOURCE_CATEGORY_6 = 6,
SND_SOURCE_CATEGORY_HARP_RELATED = 6,
SND_SOURCE_CATEGORY_7 = 7,
SND_SOURCE_CATEGORY_9 = 9,
};
+3 -1
View File
@@ -27,6 +27,8 @@ struct dSndSoundCtxParam {
/** An abstract interface for sound relating to a particular actor. */
class dSoundSourceIf_c {
public:
static dSoundSourceIf_c *create(u32 id, dAcBase_c *actor, const char *name, u8 subtype);
virtual ~dSoundSourceIf_c() {}
/* 0x00C */ virtual void setup() = 0;
@@ -100,7 +102,7 @@ public:
/* 0x10C */ virtual void setRate(f32 frame) = 0;
/* 0x110 */ virtual void setPolyAttrs(u8 polyAttr0, u8 polyAttr1) = 0;
/* 0x114 */ virtual void setBattleBgmRelated(UNKWORD) = 0;
/* 0x118 */ virtual bool checkBattleBgmRelated() = 0;
/* 0x118 */ virtual UNKWORD checkBattleBgmRelated() = 0;
};
#endif
+14 -3
View File
@@ -22,9 +22,13 @@ public:
void unregisterSource(dSoundSource_c *source);
void onShutdownSource(dSoundSource_c *source);
// Only for sources 10, 11, 12, 13, 14
void registerUnkEnemyType(dSndSourceEnemy_c *);
void playFlowSound(u32 id);
static s32 getSourceCategoryForSourceType(s32 sourceType, const char *name);
static bool isSwOrEOc(const char *name);
s32 getPlayerSourceRoomId() const;
static dSoundSource_c *getPlayerSource() {
return GetInstance()->mpPlayerSource;
@@ -45,12 +49,19 @@ public:
void stopAllSound();
void stopAllNonPlayerSound();
void incrementEnemyCount() {
field_0x3868++;
}
void decrementEnemyCount() {
field_0x3868--;
}
private:
static bool isCertainEnemyType(dSoundSource_c *source);
void removeSourceFromList(dSoundSource_c *source, nw4r::ut::List *list);
void clearSourceLists();
void clearSourceList(nw4r::ut::List *list);
s32 getPlayerSourceRoomId() const;
/* 0x0010 */ u8 field_0x0010;
/* 0x0011 */ u8 field_0x0011;
@@ -64,8 +75,8 @@ private:
/* 0x003C */ dSndSourceGroup_c mGroups[NUM_GROUPS];
// Not sure what these are for
/* 0x383C */ nw4r::ut::List mAllSources; // node offset 0xE8, probably into dSoundSource::mMgrLink
/* 0x3848 */ nw4r::ut::List field_0x3848; // node offset 0x15C, possibly a subset of source types
/* 0x383C */ nw4r::ut::List mAllSources; // node offset 0xE8, -> dSoundSource::mMgrLink
/* 0x3848 */ nw4r::ut::List field_0x3848; // node offset 0x15C, -> dSndSourceEnemy_c::mMgrEnemyLink
/* 0x3854 */ nw4r::ut::List field_0x3854; // node offset 0x160
/* 0x3860 */ UNKWORD field_0x3860;
+2
View File
@@ -19,6 +19,8 @@ public:
}
private:
// Probably not a problem for weak function order since getName is emitted
// earlier through an explicit call
bool isName(const char *name) const {
return streq(name, getName());
}
+2
View File
@@ -8,6 +8,8 @@ class dSoundSource_c;
class dSndSourceGroup_c;
class dSndDistantSoundActor_c;
class dSndSourceEnemy_c;
class dSndSound_c;
class dSndSoundCtxParam;
+1 -2
View File
@@ -11,7 +11,6 @@
#include "d/d_sc_game.h"
#include "d/d_stage.h"
#include "d/flag/enemyflag_manager.h"
#include "d/snd/d_snd_source.h"
#include "egg/core/eggAllocator.h"
#include "egg/math/eggMath.h"
#include "f/f_base.h"
@@ -121,7 +120,7 @@ dSoundSourceIf_c *dAcBase_c::createSoundSource() {
}
const char *actorName = getActorName(mpActorInfo);
return dSoundSource_c::create(soundSourceType, this, actorName, subtype);
return dSoundSourceIf_c::create(soundSourceType, this, actorName, subtype);
}
int dAcBase_c::initAllocatorWork1Heap(int size, char *name, int align) {
+5 -5
View File
@@ -33,7 +33,7 @@
static dSndSoundCtxParam sCtxParams;
bool dSoundSource_c::sIsStartingBaseSound;
dSoundSource_c *dSoundSource_c::create(u32 id, dAcBase_c *actor, const char *name, u8 subtype) {
dSoundSourceIf_c *dSoundSourceIf_c::create(u32 id, dAcBase_c *actor, const char *name, u8 subtype) {
return dSndSourceMgr_c::createSource(id, actor, name, subtype);
}
@@ -92,7 +92,7 @@ void dSoundSource_c::setup() {
case SND_SOURCE_CATEGORY_OBJECT:
case SND_SOURCE_CATEGORY_NPC:
case SND_SOURCE_CATEGORY_TG_SOUND:
case SND_SOURCE_CATEGORY_6:
case SND_SOURCE_CATEGORY_HARP_RELATED:
if (dSndSourceMgr_c::GetInstance()->getField_0x0013() != 0 && mSourceType != SND_SOURCE_SHUTTER) {
field_0x101 = 1;
} else {
@@ -684,7 +684,7 @@ nw4r::snd::SoundHandle *dSoundSource_c::continueHoldingSound(
u32 actualSoundId = soundId;
if (!sIsStartingBaseSound) {
actualSoundId = d_s_vt_0x1A0(soundId, 0);
actualSoundId = overrideHoldSoundId(soundId, false);
if (actualSoundId == -1) {
resetTempParams();
return nullptr;
@@ -822,7 +822,7 @@ nw4r::snd::SoundStartable::StartResult dSoundSource_c::setupSound(
if (!sIsStartingBaseSound) {
u32 anotherSoundId;
if (holdFlag) {
anotherSoundId = d_s_vt_0x1A0(soundId, 1);
anotherSoundId = overrideHoldSoundId(soundId, true);
} else {
anotherSoundId = overrideStartSoundId(soundId);
}
@@ -932,7 +932,7 @@ void dSoundSource_c::postStartSound(nw4r::snd::SoundHandle &handle, dSndSeSound_
// noop
}
u32 dSoundSource_c::d_s_vt_0x1A0(u32 soundId, UNKWORD) {
u32 dSoundSource_c::overrideHoldSoundId(u32 soundId, bool initial) {
return soundId;
}
+123
View File
@@ -0,0 +1,123 @@
#include "d/snd/d_snd_source_enemy.h"
#include "common.h"
#include "d/snd/d_snd_anim_sound.h"
#include "d/snd/d_snd_source.h"
#include "d/snd/d_snd_source_enums.h"
#include "d/snd/d_snd_source_mgr.h"
#include "d/snd/d_snd_wzsound.h"
dSndSourceEnemy_c::dSndSourceEnemy_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
: dSoundSource_c(sourceType, ac, name, pOwnerGroup), field_0x164(2), field_0x168(0), field_0x169(0) {
if ((SoundSourceType_e)sourceType < SND_SOURCE_ENEMY_28) {
dSndSourceMgr_c::GetInstance()->incrementEnemyCount();
mIsRegisteredEnemy = true;
} else {
mIsRegisteredEnemy = false;
}
}
dSndSourceEnemy_c::~dSndSourceEnemy_c() {
unregisterEnemySource();
}
void dSndSourceEnemy_c::shutdown() {
dSoundSource_c::shutdown();
unregisterEnemySource();
}
void dSndSourceEnemy_c::unregisterEnemySource() {
if (!mIsRegisteredEnemy) {
return;
}
if (mSourceType < SND_SOURCE_ENEMY_28) {
dSndSourceMgr_c::GetInstance()->decrementEnemyCount();
}
mIsRegisteredEnemy = false;
}
void dSndSourceEnemy_c::postSetup() {
if (isName("EBfish")) {
field_0x169 = 1;
} else if (isName("BLasBos")) {
setVolumeFade(0.9f, 0);
} else if (isName("BBigBos") || isName("BBsFootL") || isName("BBsFootR") || isName("BBsMane")) {
setVolumeFade(0.9f, 0);
} else if (isName("BAsura")) {
getAnimSound()->setField_0x98(100.0f);
} else if (isName("BGh") || isName("BGh2") || isName("BGh3")) {
getAnimSound()->setField_0x98(0.0f);
}
}
void dSndSourceEnemy_c::vt_0x020() {
dSndSourceMgr_c::GetInstance()->registerUnkEnemyType(this);
}
UNKWORD dSndSourceEnemy_c::checkBattleBgmRelated() {
if (getRoomId() == dSndSourceMgr_c::GetInstance()->getPlayerSourceRoomId()) {
f32 dist = getDistanceToPlayer();
if (field_0x168 == 0 && dist <= 1200.0f) {
return field_0x164;
}
if (field_0x168 != 0 && dist < 700.0f) {
return field_0x164;
}
}
return 0;
}
u32 dSndSourceEnemy_c::overrideStartSoundId(u32 soundId) {
switch (mSourceType) {
case SND_SOURCE_BULLET_MAGUPPO:
switch (mSubtype) {
case 1:
switch (soundId) {
case SE_MagpB_HIT: soundId = SE_MagpB_HIT_SAND; break;
case SE_MagpB_BROKEN: soundId = SE_MagpB_BROKEN_SAND; break;
}
break;
case 2:
switch (soundId) {
case SE_MagpB_BROKEN: soundId = SE_MagpB_BROKEN_MA; break;
}
break;
case 3:
switch (soundId) {
case SE_MagpB_BROKEN: soundId = SE_MagpB_BROKEN_WATER; break;
}
break;
}
break;
case SND_SOURCE_LIZARUFOS:
case SND_SOURCE_BC_Z:
if (soundId == SE_E_DISAPPEAR) {
unregisterEnemySource();
}
break;
}
return soundId;
}
u32 dSndSourceEnemy_c::overrideHoldSoundId(u32 soundId, bool initial) {
if (mSourceType == SND_SOURCE_BULLET_MAGUPPO) {
switch (mSubtype) {
case 1:
switch (soundId) {
case SE_MagpB_FLY_LV: soundId = SE_MagpB_FLY_LV_SAND; break;
}
break;
case 2:
case 3:
switch (soundId) {
case SE_MagpB_FLY_LV: soundId = SE_MagpB_FLY_LV_MA; break;
}
break;
}
}
return soundId;
}
+2 -2
View File
@@ -45,7 +45,7 @@ void dSndSourceGroup_c::set(s32 sourceType, const char *name) {
mParam.field_0x10 = 2200.0;
break;
}
case SND_SOURCE_NPC_48: {
case SND_SOURCE_NPC_HEAD: {
if (dSndStateMgr_c::isInStage("F401")) {
mParam.field_0x00 = 500.0f;
mParam.field_0x04 = 4000.0;
@@ -126,7 +126,7 @@ dSoundSource_c *dSndSourceGroup_c::getSourceClosestToListener() {
f32 closest = INFINITY;
for (dSoundSource_c *source = static_cast<dSoundSource_c *>(nw4r::ut::List_GetFirst(&mSourceList));
source != nullptr; source = static_cast<dSoundSource_c *>(nw4r::ut::List_GetNext(&mSourceList, source))) {
if (source->getSourceType() != SND_SOURCE_PLAYER_HEAD && source->getSourceType() != SND_SOURCE_NPC_48) {
if (source->getSourceType() != SND_SOURCE_PLAYER_HEAD && source->getSourceType() != SND_SOURCE_NPC_HEAD) {
f32 dist = source->getDistanceToListener();
if (dist < closest) {
closest = dist;
+5 -3
View File
@@ -5,6 +5,7 @@
#include "d/snd/d_snd_source_e_spark.h"
#include "d/snd/d_snd_source_enums.h"
#include "d/snd/d_snd_source_py_bird.h"
#include "d/snd/d_snd_source_enemy.h"
#include "d/snd/d_snd_util.h"
#include "nw4r/ut/ut_list.h"
@@ -38,8 +39,8 @@ s32 dSndSourceMgr_c::getSourceCategoryForSourceType(s32 sourceType, const char *
return SND_SOURCE_CATEGORY_TG_SOUND;
}
if (sourceType >= SND_SOURCE_54 && sourceType <= SND_SOURCE_57) {
return SND_SOURCE_CATEGORY_6;
if (sourceType >= SND_SOURCE_54 && sourceType <= SND_SOURCE_TG_HARP) {
return SND_SOURCE_CATEGORY_HARP_RELATED;
}
switch (sourceType) {
@@ -53,6 +54,7 @@ dSoundSource_c *dSndSourceMgr_c::createSource(u32 id, dAcBase_c *actor, const ch
// TODO
new dSndSourcePyBird_c(0, actor, name, nullptr);
new dSndSourceESpark_c(0, actor, name, nullptr);
new dSndSourceEnemyAnimBase_c(0, actor, name, nullptr);
return nullptr;
}
@@ -113,7 +115,7 @@ void dSndSourceMgr_c::registerSource(dSoundSource_c *source) {
}
break;
}
case SND_SOURCE_CATEGORY_6: {
case SND_SOURCE_CATEGORY_HARP_RELATED: {
nw4r::ut::List_Append(&field_0x3854, source);
break;
}
File diff suppressed because it is too large Load Diff
+1 -2
View File
@@ -3,7 +3,6 @@
#include "common.h"
#include "d/a/d_a_base.h"
#include "d/col/bg/d_bg_s.h"
#include "d/snd/d_snd_source.h"
SoundInfo::SoundInfo(dAcBase_c *ac) : mpActor(ac) {}
@@ -15,7 +14,7 @@ SoundInfo::~SoundInfo() {
}
bool SoundInfo::initSource(u8 sourceType, const char *name, const mVec3_c *posPtr) {
mpSource = dSoundSource_c::create(sourceType, mpActor, name, 0);
mpSource = dSoundSourceIf_c::create(sourceType, mpActor, name, 0);
if (mpSource == nullptr) {
return false;
}