mirror of
https://github.com/zeldaret/ss
synced 2026-09-09 03:40:36 -04:00
A bit of source manager
This commit is contained in:
@@ -7,8 +7,6 @@
|
||||
#include "nw4r/snd/snd_Sound3DActor.h"
|
||||
|
||||
class dSnd3DActor_c : public nw4r::snd::Sound3DActor {
|
||||
static const u32 NUM_SOUNDS = 4;
|
||||
|
||||
public:
|
||||
dSnd3DActor_c(dSndSourceParam *pSourceParam, u8);
|
||||
|
||||
|
||||
@@ -6,13 +6,15 @@
|
||||
#include "d/snd/d_snd_source_if.h"
|
||||
#include "nw4r/ut/ut_list.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
class dSndSourceGroup_c;
|
||||
|
||||
/** Manages sound relating to a particular actor. */
|
||||
/** Size: probably 0x15C */
|
||||
class dSoundSource_c : public dSoundSourceIf_c, public dSnd3DActor_c {
|
||||
public:
|
||||
dSoundSource_c(u8, dAcBase_c *, UNKWORD, dSndSourceGroup_c *pOwnerGroup);
|
||||
dSoundSource_c(u8 sourceType, dAcBase_c *, const char *name, dSndSourceGroup_c *pOwnerGroup);
|
||||
virtual ~dSoundSource_c();
|
||||
|
||||
static u32 getCharacterTalkSoundId(u32 baseSoundId, dSoundSource_c *source);
|
||||
@@ -21,7 +23,10 @@ public:
|
||||
// This is where it gets a bit wild and this class starts mixing in overrides between
|
||||
// new virtual functions, which causes the vtable to list these functions in exactly this
|
||||
// order.
|
||||
virtual const char *d_s_vt_0x17C() const;
|
||||
virtual const char *getName() const;
|
||||
bool isName(const char *name) const {
|
||||
return !std::strcmp(getName(), name);
|
||||
}
|
||||
virtual void d_s_vt_0x180();
|
||||
virtual void d_s_vt_0x184();
|
||||
virtual void d_s_vt_0x188();
|
||||
@@ -60,7 +65,9 @@ public:
|
||||
// Overrides of dSoundSourceIf_c - always in the first section of
|
||||
// the vtable, so the order is not certain. May have to reorder for weak
|
||||
// function order.
|
||||
|
||||
virtual s32 getCategory() const override {
|
||||
return field_0x0FC;
|
||||
}
|
||||
virtual const nw4r::math::VEC3 &getListenerPosition() const override;
|
||||
|
||||
virtual bool hasPlayingSounds() const override; // 0x48
|
||||
@@ -80,11 +87,11 @@ private:
|
||||
// at 0x58: thunk-vtable
|
||||
|
||||
/* 0xE8 */ nw4r::ut::Node mMgrLink;
|
||||
/* 0x0F0 */ UNKWORD field_0x0F0;
|
||||
/* 0x0F0 */ const char *mpName;
|
||||
/* 0x0F4 */ UNKWORD field_0x0F4;
|
||||
/* 0x0F8 */ dAcBase_c *mpPlayer;
|
||||
/* 0x0FC */ u8 field_0x0FC;
|
||||
/* 0x0FD */ u8 field_0x0FD;
|
||||
/* 0x0FD */ u8 mSourceType;
|
||||
/* 0x0FE */ u8 field_0x0FE;
|
||||
/* 0x0FF */ u8 field_0x0FF;
|
||||
/* 0x100 */ u8 field_0x100;
|
||||
|
||||
@@ -21,7 +21,7 @@ class dSoundSource_c;
|
||||
class dSndSourceGroup_c {
|
||||
public:
|
||||
dSndSourceGroup_c();
|
||||
dSndSourceGroup_c(u32, const char*, u32, u32);
|
||||
dSndSourceGroup_c(s32 sourceType, const char*, u32, s32 mSubtype);
|
||||
~dSndSourceGroup_c();
|
||||
|
||||
void registerSource(dSoundSource_c *);
|
||||
@@ -46,8 +46,8 @@ private:
|
||||
/* 0x00 */ nw4r::ut::Node mNode1;
|
||||
/* 0x08 */ nw4r::ut::Node mNode2;
|
||||
/* 0x10 */ UNKWORD field_0x10;
|
||||
/* 0x14 */ UNKWORD field_0x14;
|
||||
/* 0x18 */ UNKWORD field_0x18;
|
||||
/* 0x14 */ s32 mSourceCategory;
|
||||
/* 0x18 */ s32 mSubtype;
|
||||
/* 0x1C */ u8 field_0x1C;
|
||||
/* 0x1D */ u8 field_0x1D;
|
||||
/* 0x1E */ SizedString<32> mName;
|
||||
|
||||
@@ -11,10 +11,11 @@ class dSoundSourceIf_c {
|
||||
public:
|
||||
virtual ~dSoundSourceIf_c() {}
|
||||
#define SOUNDSOURCE_VIRTUAL(offset) virtual void vt_##offset() = 0;
|
||||
|
||||
SOUNDSOURCE_VIRTUAL(0x0C);
|
||||
SOUNDSOURCE_VIRTUAL(0x10);
|
||||
virtual s32 getCategory() const = 0; // 0x10
|
||||
SOUNDSOURCE_VIRTUAL(0x14);
|
||||
virtual s32 getActorType() const;
|
||||
virtual s32 getActorType() const = 0;
|
||||
SOUNDSOURCE_VIRTUAL(0x1C);
|
||||
SOUNDSOURCE_VIRTUAL(0x20);
|
||||
SOUNDSOURCE_VIRTUAL(0x24);
|
||||
|
||||
@@ -29,9 +29,17 @@ class dSndSourceMgr_c {
|
||||
public:
|
||||
dSndSourceMgr_c();
|
||||
|
||||
void registerSource(dSoundSource_c *source);
|
||||
void unregisterSource(dSoundSource_c *source);
|
||||
|
||||
void playFlowSound(u32 id);
|
||||
|
||||
private:
|
||||
static bool isCertainEnemyType(dSoundSource_c *source);
|
||||
void removeSourceFromList(dSoundSource_c *source, nw4r::ut::List *list);
|
||||
void clearSourceLists();
|
||||
void clearSourceList(nw4r::ut::List *list);
|
||||
|
||||
/* 0x0010 */ u8 field_0x0010;
|
||||
/* 0x0011 */ u8 field_0x0011;
|
||||
/* 0x0012 */ u8 field_0x0012;
|
||||
@@ -44,7 +52,7 @@ private:
|
||||
/* 0x003C */ dSndSourceGroup_c mGroups[NUM_GROUPS];
|
||||
|
||||
// Not sure what these are for
|
||||
/* 0x383C */ nw4r::ut::List mSourceList1; // node offset 0xE8, probably into dSoundSource::mMgrLink
|
||||
/* 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
|
||||
/* 0x3854 */ nw4r::ut::List field_0x3854; // node offset 0x160
|
||||
|
||||
@@ -54,9 +62,9 @@ private:
|
||||
/* 0x386C */ f32 field_0x386C;
|
||||
|
||||
/* 0x3870 */ dSoundSource_c *mpPlayerSource;
|
||||
/* 0x3874 */ dSoundSource_c *mpFiTalkSource;
|
||||
/* 0x3878 */ dSoundSource_c *field_0x3878;
|
||||
/* 0x387C */ dSoundSource_c *field_0x387C;
|
||||
/* 0x3874 */ dSoundSource_c *mpKenseiSource;
|
||||
/* 0x3878 */ dSoundSource_c *mpBoomerangSource;
|
||||
/* 0x387C */ dSoundSource_c *mpTBoatSource;
|
||||
/* 0x3880 */ dSoundSource_c *field_0x3880; // fi singing related?
|
||||
/* 0x3884 */ dSoundSource_c *field_0x3884;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user