A little bit

This commit is contained in:
robojumper
2025-06-15 00:24:13 +02:00
parent d3d5b57363
commit 7d333a8d8e
11 changed files with 193 additions and 36 deletions
+2
View File
@@ -64,6 +64,8 @@ public:
/** Runs when the fight is over, no matter how you started it */
bool endBgmBattleRoom();
bool isPlayingAnyBattleMusic();
private:
bool stopBgmSound(dSndBgmSound_c *sound, s32 fadeFrames);
void checkForPrepareStoppedBgmSound(u32 stoppedSoundId);
+32 -10
View File
@@ -15,18 +15,37 @@ SND_DISPOSER_FORWARD_DECL(dSndSmallEffectMgr_c);
class dSndSmallEffectMgr_c {
SND_DISPOSER_MEMBERS(dSndSmallEffectMgr_c)
static const s32 NUM_DELAYED_SOUNDS = 2;
static const s32 NUM_HOLD_SOUNDS = 3;
public:
enum BattleHitSound_e {
BATTLE_TUTTI_NORMAL = 0,
BATTLE_TUTTI_TURN = 1,
BATTLE_TUTTI_JUMP = 2,
BATTLE_TUTTI_FINISH = 3,
BATTLE_TUTTI_GUARDJUST = 5,
};
dSndSmallEffectMgr_c();
void calc();
bool playSound(u32 soundId);
// used for clawshots cursor, pan depends on where on the screen
// your cursor is when it activates
bool playSoundWithPan(u32 soundId, f32 pan);
void playSoundWithPitch(u32 soundId, f32 pitch);
void holdSoundWithPitch(u32 soundId, f32 pitch);
bool playSkbSound(u32 soundId);
bool playButtonPressSoundWhenAdvancingTextBoxes(f32);
void resetButtonPressSound();
void setButtonPressSound(dSoundSource_c *source);
void playSound(u32 soundId, nw4r::snd::SoundHandle *handle);
bool playBattleHitSound(BattleHitSound_e type, dSoundSource_c *source);
private:
bool playSoundInternal(u32 soundId);
void stopSounds(u32 playerIdx, u32 soundId, s32 fadeFrames);
@@ -34,20 +53,23 @@ private:
bool isPlayingSound(u32 playerIdx, u32 soundId);
bool isPlayingSound(u32 soundId);
/* 0x10 */ nw4r::snd::SoundHandle mHandle1;
/**
* Finds a sound handle currently playing the given sound,
* or an idle sound handle,
* or stops a lower-priority sound if needed and possible.
*/
nw4r::snd::SoundHandle *getHoldSoundHandle(u32 soundId);
/* 0x10 */ s32 field_0x10;
// used for most sounds
/* 0x14 */ nw4r::snd::SoundHandle mNormalSound;
/* 0x18 */ nw4r::snd::SoundHandle mHandle3;
// apparently used for shield gauge sounds, but maybe not given
// that the callers appear unreachable
/* 0x1C */ nw4r::snd::SoundHandle mShieldGaugeHandles[3];
/* 0x1C */ nw4r::snd::SoundHandle mHoldSoundHandles[NUM_HOLD_SOUNDS];
/* 0x28 */ s32 field_0x28;
/* 0x2C */ s32 field_0x2C;
/* 0x30 */ s32 field_0x30;
/* 0x34 */ s32 field_0x34;
/* 0x28 */ u32 mDelayedSoundIds[NUM_DELAYED_SOUNDS];
/* 0x30 */ s32 mDelayedSoundTimers[NUM_DELAYED_SOUNDS];
/* 0x38 */ u32 mTextboxAdvanceSound;
/* 0x3C */ nw4r::snd::SoundHandle mHandle4;
/* 0x3C */ nw4r::snd::SoundHandle mBattleTuttiHandle;
/* 0x40 */ u16 field_0x40;
/* 0x42 */ u16 field_0x42;
/* 0x44 */ s32 field_0x44;
+3 -6
View File
@@ -10,8 +10,6 @@
#include "nw4r/snd/snd_SoundStartable.h"
#include "nw4r/ut/ut_list.h"
#include <cstring>
/** Manages sound relating to a particular actor. */
/** Size: probably 0x15C */
class dSoundSource_c : public dSoundSourceIf_c, public dSnd3DActor_c {
@@ -28,10 +26,9 @@ 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 *getName() const; // 0x17C
bool isName(const char *name) const {
return !std::strcmp(getName(), name);
}
virtual const char *getName() const {
return mpName;
} // 0x17C
virtual void d_s_vt_0x180();
virtual void d_s_vt_0x184();
virtual void d_s_vt_0x188();
+1
View File
@@ -33,6 +33,7 @@ enum SoundSourceType_e {
SND_SOURCE_TIME_STONE = 37,
SND_SOURCE_CLEF = 38,
SND_SOURCE_SHUTTER = 39,
SND_SOURCE_OBJECT_40 = 40,
SND_SOURCE_OBJECT_42 = 42,
// 43-52: Npc (4)
+6
View File
@@ -4,6 +4,12 @@
#include "common.h"
#include "egg/core/eggDisposer.h"
#include <cstring>
inline bool streq(const char *left, const char *right) {
return !std::strcmp(left, right);
}
// This setup is only inferred. d/snd uses it all over the place.
// This works for dSndPlayerMgr_c, which has a vtable of its own but the Disposer at offset 0.
// It also works for the factory at 0x80399c20, which calls a base class ctor,
+6
View File
@@ -36,6 +36,12 @@ namespace nw4r { namespace snd
void DetachSound();
u32 GetTick() const {
if (IsAttachedSound())
return mSound->GetTick();
return 0;
}
void WriteVariable(int varNo, s16 value) {
if (IsAttachedSound())
mSound->WriteVariable(varNo, value);