mirror of
https://github.com/zeldaret/ss
synced 2026-07-11 14:48:32 -04:00
Order below sinit is now ok
This commit is contained in:
@@ -78,14 +78,14 @@ public:
|
||||
/* 0x1D4 */ virtual dSndAnimSound_c *getAnimSound() {
|
||||
return nullptr;
|
||||
}
|
||||
/* 0x1D8 */ virtual void d_s_vt_0x1D8() {
|
||||
/* 0x1D8 */ virtual void registerAdditionalSource(dSoundSource_c *other) {
|
||||
return;
|
||||
}
|
||||
/* 0x1DC */ virtual UNKWORD d_s_vt_0x1DC() {
|
||||
/* 0x1DC */ virtual bool isMultiSource() const {
|
||||
return 0;
|
||||
}
|
||||
/* 0x1E0 */ virtual void onAnimSoundEvent(UNKWORD arg) {
|
||||
field_0x154 = arg;
|
||||
/* 0x1E0 */ virtual void onAnimSoundEvent(s32 arg) {
|
||||
mAnimEventValue = arg;
|
||||
}
|
||||
/* 0x1E4 */ virtual void d_s_vt_0x1E4_noop();
|
||||
/* 0x1E8 */ virtual u32 d_s_vt_0x1E8(u32 soundId);
|
||||
@@ -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);
|
||||
nw4r::snd::SoundStartable::StartResult onSetupError();
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -225,7 +226,6 @@ private:
|
||||
dSndDistantSoundActor_c *startBaseSoundAtPosition(u32 baseSoundId, const nw4r::math::VEC3 *position, f32 volume);
|
||||
nw4r::snd::SoundHandle *startBaseSound(u32 baseSoundId, f32 volume);
|
||||
|
||||
nw4r::snd::SoundStartable::StartResult onSetupError();
|
||||
|
||||
nw4r::snd::SoundStartable::StartResult
|
||||
startSound(u32 soundId, nw4r::snd::SoundHandle *handle, nw4r::snd::SoundHandle **pOutHandle);
|
||||
@@ -283,8 +283,8 @@ protected:
|
||||
/* 0x140 */ dSndSourceGroup_c *mpOwnerGroup;
|
||||
/* 0x144 */ f32 mVolumeFadeTarget;
|
||||
/* 0x148 */ f32 mVolumeFadeStepSize;
|
||||
/* 0x150 */ u8 _0x14C[0x154 - 0x14C];
|
||||
/* 0x154 */ UNKWORD field_0x154;
|
||||
/* 0x14C */ nw4r::ut::Node mSubSourceLink; // node for list in dSndSourceEnemyMultiBase_c
|
||||
/* 0x154 */ s32 mAnimEventValue;
|
||||
/* 0x158 */ s16 mPolyAttr0;
|
||||
/* 0x15A */ s16 mPolyAttr1;
|
||||
};
|
||||
|
||||
@@ -9,8 +9,6 @@ public:
|
||||
dSndSourceAnimSound_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
|
||||
: dSoundSource_c(sourceType, ac, name, pOwnerGroup), mAnimSound(this) {}
|
||||
|
||||
virtual ~dSndSourceAnimSound_c() {}
|
||||
|
||||
/* 0x1A8 */ virtual StartResult
|
||||
SetupSound(nw4r::snd::SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void *arg) override {
|
||||
return setupSoundCommon(pHandle, soundId, pStartInfo, arg);
|
||||
|
||||
@@ -8,8 +8,6 @@ public:
|
||||
dSndSourceESpark_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
|
||||
: dSoundSource_c(sourceType, ac, name, pOwnerGroup) {}
|
||||
|
||||
virtual ~dSndSourceESpark_c() {}
|
||||
|
||||
// okay
|
||||
virtual bool hasAnimSound() override {
|
||||
return true;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#ifndef D_SND_SOURCE_ENEMY_H
|
||||
#define 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_util.h"
|
||||
#include "nw4r/ut/ut_list.h"
|
||||
|
||||
class dSndSourceEnemy_c : public dSoundSource_c {
|
||||
@@ -74,8 +76,94 @@ public:
|
||||
mAnimSound.setRate(frame);
|
||||
}
|
||||
|
||||
private:
|
||||
protected:
|
||||
/* 0x16C */ dSndAnimSound_c mAnimSound;
|
||||
};
|
||||
|
||||
class dSndSourceEnemyAnim_c : public dSndSourceEnemyAnimBase_c {
|
||||
public:
|
||||
dSndSourceEnemyAnim_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
|
||||
: dSndSourceEnemyAnimBase_c(sourceType, ac, name, pOwnerGroup) {}
|
||||
|
||||
/* 0x194 */ virtual u32 overrideStartSoundId(u32 soundId) override;
|
||||
/* 0x1A0 */ virtual u32 overrideHoldSoundId(u32 soundId, bool initial) override;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class dSndSourceEnemyMultiBase_c : public dSndSourceEnemyAnimBase_c {
|
||||
public:
|
||||
dSndSourceEnemyMultiBase_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
|
||||
: dSndSourceEnemyAnimBase_c(sourceType, ac, name, pOwnerGroup) {
|
||||
nw4r::ut::List_Init(&mSubSourceList, 0x14C);
|
||||
mAnimSound.setCallback(this);
|
||||
}
|
||||
|
||||
/* 0x1A8 */ virtual StartResult
|
||||
SetupSound(nw4r::snd::SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void *arg) override {
|
||||
bool bHoldFlag = *(bool*)arg;
|
||||
if (!bHoldFlag && (mAnimEventValue & 0xF) > 0) {
|
||||
dSoundSource_c *otherSource;
|
||||
s32 idx = (mAnimEventValue & 0xF) - 1;
|
||||
if (idx < 0) {
|
||||
otherSource = nullptr;
|
||||
} else if (idx >= nw4r::ut::List_GetSize(&mSubSourceList)) {
|
||||
otherSource = nullptr;
|
||||
} else {
|
||||
otherSource = getSubSourceFirst();
|
||||
while (idx > 0) {
|
||||
otherSource = getSubSourceNext(otherSource);
|
||||
idx--;
|
||||
}
|
||||
}
|
||||
if (otherSource != nullptr) {
|
||||
otherSource->startSound(soundId, pHandle);
|
||||
return onSetupError();
|
||||
}
|
||||
}
|
||||
|
||||
return setupSoundCommon(pHandle, soundId, pStartInfo, arg);
|
||||
}
|
||||
|
||||
/* 0x1D8 */ virtual void registerAdditionalSource(dSoundSource_c *other) override {
|
||||
if (other == this) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (other == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (!hasSubSource(other)) {
|
||||
appendSubSource(other);
|
||||
}
|
||||
}
|
||||
/* 0x1DC */ virtual bool isMultiSource() const override {
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
// TODO: maybe created by the macro below
|
||||
bool hasSubSource(dSoundSource_c *other) {
|
||||
for (dSoundSource_c *it = getSubSourceFirst(); it != nullptr; it = getSubSourceNext(it)) {
|
||||
if (it == other) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* 0x210 */ LIST_MEMBER(dSoundSource_c, SubSource); // -> dSoundSource_c::mSubSourceLink
|
||||
};
|
||||
|
||||
class dSndSourceEnemyMulti_c : public dSndSourceEnemyMultiBase_c {
|
||||
public:
|
||||
dSndSourceEnemyMulti_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
|
||||
: dSndSourceEnemyMultiBase_c(sourceType, ac, name, pOwnerGroup) {}
|
||||
|
||||
/* 0x18C */ virtual void postCalc() override;
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,10 +19,12 @@ enum SoundSourceType_e {
|
||||
|
||||
// 10-31: Enemy? (2)
|
||||
SND_SOURCE_ENEMY_10 = 10,
|
||||
SND_SOURCE_MAGUPPO = 12,
|
||||
SND_SOURCE_LIZARUFOS = 13,
|
||||
SND_SOURCE_BC_Z = 16,
|
||||
SND_SOURCE_SPARK = 17,
|
||||
SND_SOURCE_BIGBOSS = 20,
|
||||
SND_SOURCE_BOSS_NUSI = 23,
|
||||
SND_SOURCE_GIRAHUMU_3 = 24,
|
||||
SND_SOURCE_ENEMY_28 = 28,
|
||||
SND_SOURCE_BULLET = 29,
|
||||
@@ -45,6 +47,7 @@ enum SoundSourceType_e {
|
||||
SND_SOURCE_NPC_43 = 43,
|
||||
SND_SOURCE_KENSEI = 44,
|
||||
SND_SOURCE_PLAYER_BIRD = 45,
|
||||
SND_SOURCE_NPC_NUSI = 46,
|
||||
SND_SOURCE_NPC_HEAD = 48,
|
||||
SND_SOURCE_INSECT = 49,
|
||||
SND_SOURCE_NPC_NRM = 51,
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef D_SND_SOURCE_HARP_RELATED_H
|
||||
#define D_SND_SOURCE_HARP_RELATED_H
|
||||
|
||||
#include "d/snd/d_snd_source.h"
|
||||
|
||||
class dSndSourceHarpRelated_c : public dSoundSource_c {
|
||||
public:
|
||||
dSndSourceHarpRelated_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup);
|
||||
virtual ~dSndSourceHarpRelated_c();
|
||||
|
||||
/* 0x18C */ virtual void postCalc() override;
|
||||
/* 0x1D0 */ virtual void setPause(bool flag, int fadeFrames) override;
|
||||
|
||||
/* 0x1EC */ virtual UNKWORD d_s_harp_vt_0x1EC() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 0x1F0 */ virtual void d_s_harp_vt_0x1F0();
|
||||
/* 0x1F4 */ virtual void d_s_harp_vt_0x1F4();
|
||||
/* 0x1F8 */ virtual void d_s_harp_vt_0x1F8();
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class dSndSourceHarpTg_c : public dSndSourceHarpRelated_c {
|
||||
public:
|
||||
dSndSourceHarpTg_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
|
||||
: dSndSourceHarpRelated_c(sourceType, ac, name, pOwnerGroup) {}
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,68 @@
|
||||
#ifndef D_SND_SOURCE_NPC_H
|
||||
#define D_SND_SOURCE_NPC_H
|
||||
|
||||
#include "d/snd/d_snd_anim_sound.h"
|
||||
#include "d/snd/d_snd_source.h"
|
||||
|
||||
// vtable at 8054d540 - placed by implementation of postSetupSound,
|
||||
// so this is the base class and also instantiated in createSource
|
||||
class dSndSourceNpc_c : public dSoundSource_c {
|
||||
public:
|
||||
dSndSourceNpc_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
|
||||
: dSoundSource_c(sourceType, ac, name, pOwnerGroup) {}
|
||||
|
||||
/* 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);
|
||||
}
|
||||
// at 80032af0, explicitly called by dAcNpc_c
|
||||
/* 0x1EC */ virtual void d_s_npc_vt_0x1EC(dSndSourceNpc_c *source) {}
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class dSndSourceNpcAnimBase_c : public dSndSourceNpc_c {
|
||||
public:
|
||||
dSndSourceNpcAnimBase_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
|
||||
: dSndSourceNpc_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:
|
||||
/* 0x15C */ dSndAnimSound_c mAnimSound;
|
||||
};
|
||||
|
||||
class dSndSourceNpcAnim_c : public dSndSourceNpcAnimBase_c {
|
||||
public:
|
||||
dSndSourceNpcAnim_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
|
||||
: dSndSourceNpcAnimBase_c(sourceType, ac, name, pOwnerGroup) {}
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef D_SND_SOURCE_OBJ_H
|
||||
#define D_SND_SOURCE_OBJ_H
|
||||
|
||||
#include "d/snd/d_snd_anim_sound.h"
|
||||
#include "d/snd/d_snd_source.h"
|
||||
#include "d/snd/d_snd_util.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
@@ -34,4 +35,45 @@ public:
|
||||
/* 0x1EC */ virtual void setPosition(const nw4r::math::VEC3 &position) override;
|
||||
};
|
||||
|
||||
class dSndSourceObjAnimBase_c : public dSndSourceObj_c {
|
||||
public:
|
||||
dSndSourceObjAnimBase_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
|
||||
: dSndSourceObj_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);
|
||||
}
|
||||
|
||||
protected:
|
||||
/* 0x15C */ dSndAnimSound_c mAnimSound;
|
||||
};
|
||||
|
||||
class dSndSourceObjAnim_c : public dSndSourceObjAnimBase_c {
|
||||
public:
|
||||
dSndSourceObjAnim_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
|
||||
: dSndSourceObjAnimBase_c(sourceType, ac, name, pOwnerGroup) {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,8 +8,6 @@ public:
|
||||
dSndSourcePyBird_c(u8 sourceType, dAcBase_c *ac, const char *name, dSndSourceGroup_c *pOwnerGroup)
|
||||
: dSndSourceAnimSound_c(sourceType, ac, name, pOwnerGroup), mSeqVarValue(0) {}
|
||||
|
||||
virtual ~dSndSourcePyBird_c() {}
|
||||
|
||||
/* 0x104 */ virtual void load(void *data, const char *name) override;
|
||||
|
||||
/* 0x1CC */ virtual void postSetupSound(u32 playingId, u32 requestedId, dSndSeSound_c *seSound) override;
|
||||
|
||||
Reference in New Issue
Block a user