mirror of
https://github.com/zeldaret/ss
synced 2026-09-02 01:43:04 -04:00
Review
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
class dSnd3DActor_c : public nw4r::snd::Sound3DActor {
|
||||
public:
|
||||
dSnd3DActor_c(dSndSourceParam *pSourceParam, u8);
|
||||
dSnd3DActor_c(dSndSourceParam *pSourceParam, u8 sourceType);
|
||||
|
||||
virtual ~dSnd3DActor_c() {}
|
||||
|
||||
|
||||
@@ -46,11 +46,11 @@ public:
|
||||
|
||||
private:
|
||||
void updateListenerPos(f32);
|
||||
/* 0x10 */ bool mIsSetup;
|
||||
/* 0x11 */ bool mCalculationsFresh;
|
||||
/* 0x14 */ dSnd3DEngine_c *mpEngine;
|
||||
/* 0x18 */ nw4r::snd::Sound3DManager mManager;
|
||||
/* 0x44 */ nw4r::snd::Sound3DListener mListener;
|
||||
/* 0x010 */ bool mIsSetup;
|
||||
/* 0x011 */ bool mCalculationsFresh;
|
||||
/* 0x014 */ dSnd3DEngine_c *mpEngine;
|
||||
/* 0x018 */ nw4r::snd::Sound3DManager mManager;
|
||||
/* 0x044 */ nw4r::snd::Sound3DListener mListener;
|
||||
/* 0xB0 */ EGG::LookAtCamera mCamera;
|
||||
/* 0x138 */ mVec3_c mCameraDirectionNormalized;
|
||||
/* 0x144 */ mVec3_c mCameraTargetPosition;
|
||||
|
||||
@@ -41,8 +41,8 @@ public:
|
||||
const char *getSoundArchivePath();
|
||||
u32 convertLabelStringToSoundId(const char *label) const;
|
||||
|
||||
nw4r::snd::SoundArchivePlayer &getSoundArchivePlayerForType(u8 type);
|
||||
bool canUseThisPlayer(u8 type) const;
|
||||
nw4r::snd::SoundArchivePlayer &getSoundArchivePlayerForType(u8 sourceType);
|
||||
bool canUseThisPlayer(u8 sourceType) const;
|
||||
|
||||
enum PlayerMgrFlag_e {
|
||||
MGR_HBM = 0x1,
|
||||
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
/* 0x64 */ dSoundSource_c *mpCachedClosestSourceToListener;
|
||||
/* 0x68 */ dSoundSource_c *mpCachedClosestSourceToPlayer;
|
||||
/* 0x6C */ bool mCalculatedClosestToListener;
|
||||
/* 0x6C */ bool mCalculatedClosestToPlayer;
|
||||
/* 0x6D */ bool mCalculatedClosestToPlayer;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,19 +8,6 @@
|
||||
|
||||
SND_DISPOSER_FORWARD_DECL(dSndSourceMgr_c);
|
||||
|
||||
// 0 - "" - Link
|
||||
// ActorLink::initModels
|
||||
// 0x2C - NpcKenT
|
||||
// 0x20 - Door, TBox, CharE (Chair), Tubo
|
||||
// 0x35 - TgSound
|
||||
// 0x2D - PyBird
|
||||
// 0x22 - Bamboo
|
||||
// 0x23 - Item
|
||||
|
||||
// 0x19 - Nusi*, BKr, BBs
|
||||
// 0x1A - MgRArm, MgLArm
|
||||
// 0x1B - Mgtail
|
||||
|
||||
class dSndSourceMgr_c {
|
||||
SND_DISPOSER_MEMBERS(dSndSourceMgr_c);
|
||||
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
dSnd3DActor_c::dSnd3DActor_c(dSndSourceParam *pSourceParam, u8 a2)
|
||||
dSnd3DActor_c::dSnd3DActor_c(dSndSourceParam *pSourceParam, u8 sourceType)
|
||||
: nw4r::snd::Sound3DActor(
|
||||
dSndPlayerMgr_c::GetInstance()->getSoundArchivePlayerForType(a2), dSnd3DManager_c::GetInstance()->getManager()
|
||||
dSndPlayerMgr_c::GetInstance()->getSoundArchivePlayerForType(sourceType), dSnd3DManager_c::GetInstance()->getManager()
|
||||
),
|
||||
a_field_0x7D(0),
|
||||
a_field_0x7E(0),
|
||||
@@ -31,7 +31,7 @@ dSnd3DActor_c::dSnd3DActor_c(dSndSourceParam *pSourceParam, u8 a2)
|
||||
resetCachedRelativePositions();
|
||||
// Portability hazard
|
||||
SetUserParam(reinterpret_cast<u32>(this));
|
||||
if (dSndPlayerMgr_c::GetInstance()->canUseThisPlayer(a2)) {
|
||||
if (dSndPlayerMgr_c::GetInstance()->canUseThisPlayer(sourceType)) {
|
||||
a_field_0x7F = 1;
|
||||
}
|
||||
}
|
||||
@@ -43,9 +43,9 @@ void dSnd3DActor_c::d_vt_0x34(const nw4r::math::VEC3 &rPosition) {
|
||||
}
|
||||
|
||||
void dSnd3DActor_c::updatePositionRelativeToListener() {
|
||||
if (!checkFlag(1)) {
|
||||
if (!checkFlag(0x1)) {
|
||||
calculatePositionRelativeToListener();
|
||||
setFlag(1);
|
||||
setFlag(0x1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,10 +70,10 @@ void dSnd3DActor_c::calculatePositionRelativeToListener() {
|
||||
}
|
||||
|
||||
void dSnd3DActor_c::updateDistanceToListener() {
|
||||
if (!checkFlag(2)) {
|
||||
if (!checkFlag(0x2)) {
|
||||
updatePositionRelativeToListener();
|
||||
mDistanceToListener = VEC3Len(&mPositionRelativeToListener);
|
||||
setFlag(2);
|
||||
setFlag(0x2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,10 +110,10 @@ void dSnd3DActor_c::calculatePositionRelativeToCameraTarget() {
|
||||
}
|
||||
|
||||
void dSnd3DActor_c::updateDistanceToCameraTarget() {
|
||||
if (!checkFlag(8)) {
|
||||
if (!checkFlag(0x8)) {
|
||||
updatePositionRelativeToCameraTarget();
|
||||
mDistanceToCameraTarget = VEC3Len(&mPositionRelativeToCameraTarget);
|
||||
setFlag(8);
|
||||
setFlag(0x8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -177,7 +177,7 @@ void dSndControlPlayerMgr_c::calcVolumes() {
|
||||
targetVolume = currentVolume + maxVolumeIncrease;
|
||||
}
|
||||
// @bug not actually clamped
|
||||
nw4r::ut::Clamp(targetVolume, 0.0f, 2.0f);
|
||||
(void)nw4r::ut::Clamp(targetVolume, 0.0f, 2.0f);
|
||||
setVolume(i, targetVolume, 0);
|
||||
}
|
||||
mpTargetVolumes[i] = 1.0f;
|
||||
@@ -356,7 +356,7 @@ void dSndControlPlayerMgr_c::setPlayerVolumeInternal(u32 playerIdx, f32 volume)
|
||||
return;
|
||||
}
|
||||
// @bug not actually clamped
|
||||
nw4r::ut::Clamp(volume, 0.0f, 2.0f);
|
||||
(void)nw4r::ut::Clamp(volume, 0.0f, 2.0f);
|
||||
|
||||
if (mpTargetVolumes[playerIdx] > volume) {
|
||||
mpTargetVolumes[playerIdx] = volume;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
// I'm not super happy with these base class function in a separate file,
|
||||
// but either we add another intermediate class or this is ok. It's weird
|
||||
// that d_snd_sound has dSndControl_c::stop though
|
||||
// that d_snd_sound has dSndControl_c::configure though
|
||||
|
||||
void dSndControl_c::reset() {
|
||||
mCurrValue = mResetValue;
|
||||
@@ -18,7 +18,6 @@ void dSndControl_c::reset() {
|
||||
}
|
||||
|
||||
void dSndControl_c::stop() {
|
||||
// field_0x10 = field_0x04;
|
||||
mStartValue = mCurrValue;
|
||||
mTargetValue = mCurrValue;
|
||||
mDuration = 0;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "d/snd/d_snd_control_player_mgr.h"
|
||||
#include "d/snd/d_snd_mgr.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "d/snd/d_snd_source_enums.h"
|
||||
#include "d/snd/d_snd_wzsound.h"
|
||||
#include "egg/core/eggDvdRipper.h"
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
@@ -102,24 +103,26 @@ u32 dSndPlayerMgr_c::convertLabelStringToSoundId(const char *label) const {
|
||||
return dSndMgr_c::GetInstance()->changeNameToId(label);
|
||||
}
|
||||
|
||||
nw4r::snd::SoundArchivePlayer &dSndPlayerMgr_c::getSoundArchivePlayerForType(u8 type) {
|
||||
if (canUseThisPlayer(type)) {
|
||||
nw4r::snd::SoundArchivePlayer &dSndPlayerMgr_c::getSoundArchivePlayerForType(u8 sourceType) {
|
||||
if (canUseThisPlayer(sourceType)) {
|
||||
return mSoundArchivePlayer;
|
||||
}
|
||||
return *dSndMgr_c::getPlayer();
|
||||
}
|
||||
|
||||
bool dSndPlayerMgr_c::canUseThisPlayer(u8 type) const {
|
||||
bool dSndPlayerMgr_c::canUseThisPlayer(u8 sourceType) const {
|
||||
if (!mSoundArchivePlayer.IsAvailable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int ty = type;
|
||||
|
||||
if ((ty >= 0 && ty <= 1) || ty == 58) {
|
||||
return true;
|
||||
switch (sourceType) {
|
||||
case SND_SOURCE_PLAYER:
|
||||
case SND_SOURCE_PLAYER_HEAD:
|
||||
case SND_SOURCE_58:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool dSndPlayerMgr_c::loadDemoArchive(const char *demoArchiveName) {
|
||||
|
||||
@@ -63,13 +63,13 @@ bool dSndSmallEffectMgr_c::playSound(u32 soundId) {
|
||||
}
|
||||
case SE_S_MENU_SELECT_TURN_PAGE_LEFT: {
|
||||
if (isPlayingSound(dSndPlayerMgr_c::PLAYER_SMALL_NORMAL, SE_S_SHOP_STK_STOCK_SELECT_TURN_PAGE_LEFT)) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SE_S_MENU_SELECT_TURN_PAGE_RIGHT: {
|
||||
if (isPlayingSound(dSndPlayerMgr_c::PLAYER_SMALL_NORMAL, SE_S_SHOP_STK_STOCK_SELECT_TURN_PAGE_RIGHT)) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -87,7 +87,7 @@ bool dSndSmallEffectMgr_c::playSound(u32 soundId) {
|
||||
}
|
||||
case SE_S_WINDOW_PRESS_A: {
|
||||
if (isPlayingSound(dSndPlayerMgr_c::PLAYER_SMALL_IMPORTANT, SE_S_POINTER_OK)) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -97,7 +97,7 @@ bool dSndSmallEffectMgr_c::playSound(u32 soundId) {
|
||||
}
|
||||
case SE_S_MENU_P1_POINT_ITEM: {
|
||||
if (isPlayingSound(dSndPlayerMgr_c::PLAYER_SMALL_NORMAL, SE_S_MENU_P1_HOLD_POINTER)) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -108,9 +108,9 @@ bool dSndSmallEffectMgr_c::playSound(u32 soundId) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0x13EF:
|
||||
case SE_S_DOWSING_WAIT:
|
||||
if (isPlayingSound(dSndPlayerMgr_c::PLAYER_SMALL_NORMAL, SE_S_FIRST_PERSON_ON)) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -127,7 +127,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->getActorType() != 1 && source->getActorType() != 48) {
|
||||
if (source->getActorType() != SND_SOURCE_PLAYER_HEAD && source->getActorType() != SND_SOURCE_NPC_48) {
|
||||
f32 dist = source->getDistanceToListener();
|
||||
if (dist < closest) {
|
||||
closest = dist;
|
||||
|
||||
Reference in New Issue
Block a user