mirror of
https://github.com/zeldaret/ss
synced 2026-07-11 06:45:20 -04:00
snd_Sound3DActor OK
This commit is contained in:
@@ -186,8 +186,8 @@ namespace nw4r { namespace snd { namespace detail
|
||||
public:
|
||||
// virtual function ordering
|
||||
// vtable AmbientArgUpdateCallback
|
||||
virtual void at_0x08();
|
||||
virtual void at_0x0c(void *, void *);
|
||||
virtual ~AmbientArgUpdateCallback() {}
|
||||
virtual void at_0x0c(void *, BasicSound *);
|
||||
|
||||
// members
|
||||
private:
|
||||
@@ -299,6 +299,10 @@ namespace nw4r { namespace snd { namespace detail
|
||||
PRIORITY_MAX);
|
||||
}
|
||||
|
||||
void ClearAmbientArgUpdateCallback() {
|
||||
mAmbientInfo.argUpdateCallback = NULL;
|
||||
}
|
||||
|
||||
static int GetAmbientPriority(AmbientInfo const &ambientInfo,
|
||||
u32 soundId);
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
*/
|
||||
|
||||
#include "nw4r/snd/snd_BasicSound.h"
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
#include "nw4r/snd/snd_global.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* classes and functions
|
||||
@@ -35,6 +37,34 @@ namespace nw4r { namespace snd { namespace detail
|
||||
|
||||
bool detail_CanPlaySound(int startPriority);
|
||||
|
||||
template <typename TForEachFunc>
|
||||
TForEachFunc ForEachSound(TForEachFunc pFunc, bool reverse) {
|
||||
if (reverse) {
|
||||
detail::BasicSound::ExtSoundPlayerPlayLinkList::ReverseIterator it = mSoundList.GetBeginReverseIter();
|
||||
|
||||
while (it != mSoundList.GetEndReverseIter()) {
|
||||
detail::BasicSound::ExtSoundPlayerPlayLinkList::ReverseIterator curr = it;
|
||||
|
||||
SoundHandle handle;
|
||||
handle.detail_AttachSoundAsTempHandle(&*curr);
|
||||
pFunc(handle);
|
||||
|
||||
if (handle.IsAttachedSound()) {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
NW4R_RANGE_FOR_NO_AUTO_INC(it, mSoundList) {
|
||||
decltype(it) curItr = it++;
|
||||
SoundHandle handle;
|
||||
handle.detail_AttachSoundAsTempHandle(&*curItr);
|
||||
pFunc(handle);
|
||||
}
|
||||
}
|
||||
|
||||
return pFunc;
|
||||
}
|
||||
|
||||
private:
|
||||
BasicSound *GetLowestPrioritySound();
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
#ifndef NW4R_SND_SOUND_3D_ACTOR_H
|
||||
#define NW4R_SND_SOUND_3D_ACTOR_H
|
||||
|
||||
#include "nw4r/math.h"
|
||||
#include "nw4r/snd/snd_BasicSound.h"
|
||||
#include "nw4r/snd/snd_SoundActor.h"
|
||||
#include "nw4r/types_nw4r.h"
|
||||
|
||||
#include "nw4r/math.h"
|
||||
|
||||
namespace nw4r {
|
||||
namespace snd {
|
||||
@@ -14,16 +14,12 @@ namespace snd {
|
||||
class Sound3DActor : public SoundActor, public detail::BasicSound::AmbientInfo::AmbientArgUpdateCallback {
|
||||
public:
|
||||
Sound3DActor(SoundArchivePlayer &rPlayer, Sound3DManager &rManager);
|
||||
virtual ~Sound3DActor(); // at 0x8
|
||||
virtual ~Sound3DActor();
|
||||
|
||||
virtual StartResult detail_SetupSound(
|
||||
SoundHandle *pHandle, u32 id, detail::BasicSound::AmbientInfo *pArgInfo,
|
||||
detail::ExternalSoundPlayer *pPlayer, bool hold,
|
||||
const StartInfo *pStartInfo
|
||||
); // at 0xC
|
||||
virtual StartResult SetupSound(SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void *) override;
|
||||
|
||||
virtual void detail_Update(void *pArg,
|
||||
const detail::BasicSound *pSound); // at 0xC
|
||||
// AmbientArgUpdateCallback
|
||||
virtual void at_0x0c(void *arg, detail::BasicSound* sound) override;
|
||||
|
||||
void SetPosition(const math::VEC3 &rPosition);
|
||||
|
||||
@@ -31,10 +27,12 @@ private:
|
||||
static void ClearUpdateCallback(SoundHandle &rHandle);
|
||||
|
||||
private:
|
||||
Sound3DManager &m3DManager; // at 0xAC
|
||||
SoundArchivePlayer &mSoundArchivePlayer; // at 0xB0
|
||||
u32 mUserParam; // at 0xB4
|
||||
math::VEC3 mPosition; // at 0xB8
|
||||
Sound3DManager &m3DManager; // at 0x58
|
||||
SoundArchivePlayer *mSoundArchivePlayer; // at 0x5C
|
||||
u32 mUserParam; // at 0x60
|
||||
math::VEC3 mPosition; // at 0x64
|
||||
math::VEC3 mVelocity; // at 0x70
|
||||
bool mSkipVelocityUpdate; // at 0x7C
|
||||
};
|
||||
|
||||
} // namespace snd
|
||||
|
||||
@@ -14,12 +14,12 @@ namespace snd {
|
||||
|
||||
struct Sound3DParam {
|
||||
/* 0x00 */ math::VEC3 position;
|
||||
/* 0x0C */ math::VEC3 field_0x0C;
|
||||
/* 0x0C */ math::VEC3 velocity;
|
||||
/* 0x18 */ UNKWORD field_0x18;
|
||||
/* 0x1C */ u8 decayCurve;
|
||||
/* 0x1D */ u8 decayRatio;
|
||||
/* 0x1E */ u8 field_0x1E;
|
||||
/* 0x20 */ UNKWORD field_0x20;
|
||||
/* 0x20 */ u32 userParam;
|
||||
/* 0x24 */ UNKWORD field_0x24;
|
||||
|
||||
Sound3DParam();
|
||||
|
||||
@@ -50,6 +50,16 @@ namespace nw4r { namespace snd
|
||||
return &mActorPlayer[actorPlayerId];
|
||||
}
|
||||
|
||||
|
||||
template <typename TForEachFunc>
|
||||
TForEachFunc ForEachSound(TForEachFunc pFunc, bool reverse) {
|
||||
for (int i = 0; i < ACTOR_PLAYER_COUNT; i++) {
|
||||
mActorPlayer[i].ForEachSound(pFunc, reverse);
|
||||
}
|
||||
|
||||
return pFunc;
|
||||
}
|
||||
|
||||
detail::SoundActorParam const &detail_GetActorParam() const
|
||||
{
|
||||
return mActorParam;
|
||||
|
||||
@@ -123,6 +123,7 @@ namespace nw4r { namespace snd
|
||||
u32 flags; // at 0x0
|
||||
u8 decayCurve; // at 0x4
|
||||
u8 decayRatio; // at 0x5
|
||||
u8 field_0x06; // at 0x6
|
||||
};
|
||||
|
||||
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x256dc
|
||||
|
||||
Reference in New Issue
Block a user