mirror of
https://github.com/zeldaret/ss
synced 2026-07-09 06:13:17 -04:00
Merge pull request #197 from robojumper/d_snd
start matching some d/snd things
This commit is contained in:
+107
-22
@@ -2348,67 +2348,152 @@ toBeSorted/col/cc/misc_unks.cpp:
|
||||
.text start:0x803598D0 end:0x80359D20 align:16
|
||||
.sbss start:0x80575D28 end:0x80575D30
|
||||
|
||||
d/snd/d_snd.cpp:
|
||||
d/snd/d_snd_mgr.cpp:
|
||||
.text start:0x80359D20 end:0x8035A558 align:16
|
||||
.data start:0x805485D0 end:0x80548678
|
||||
.sbss start:0x80575D30 end:0x80575D38
|
||||
|
||||
d/snd/d_snd_actor.cpp:
|
||||
.text start:0x8035A560 end:0x8035BB78 align:16
|
||||
.text start:0x8035A560 end:0x8035A898 align:16
|
||||
.data start:0x80548678 end:0x805486A0
|
||||
|
||||
d/snd/d_snd_engine.cpp:
|
||||
d/snd/d_snd_3d_actor.cpp:
|
||||
.text start:0x8035A8A0 end:0x8035BB78 align:16
|
||||
.data start:0x805486A0 end:0x80548710
|
||||
.sdata2 start:0x8057D2C0 end:0x8057D308
|
||||
|
||||
d/snd/d_snd_3d_engine.cpp:
|
||||
.text start:0x8035BB80 end:0x8035C3F0 align:16
|
||||
.data start:0x80548710 end:0x80548730
|
||||
.sdata2 start:0x8057D308 end:0x8057D368
|
||||
|
||||
d/snd/d_snd_unk_component_1.cpp:
|
||||
d/snd/d_snd_sound.cpp:
|
||||
.text start:0x8035C3F0 end:0x8035DA88 align:16
|
||||
.data start:0x80548730 end:0x80548758
|
||||
.sdata2 start:0x8057D368 end:0x8057D380
|
||||
|
||||
d/snd/mgr/d_snd_mgr_bgm.cpp:
|
||||
.text start:0x8035DA90 end:0x8035F010 align:16
|
||||
d/snd/d_snd_player_mgr.cpp:
|
||||
.text start:0x8035DA90 end:0x8035F04C align:16
|
||||
.data start:0x80548758 end:0x805487A0
|
||||
.sbss start:0x80575D38 end:0x80575D40
|
||||
.sdata2 start:0x8057D380 end:0x8057D390
|
||||
|
||||
d/snd/mgr/d_snd_mgr_unk1.cpp:
|
||||
.text start:0x8035F010 end:0x80360C28 align:16
|
||||
d/snd/d_snd_control_player_mgr.cpp:
|
||||
.text start:0x8035F050 end:0x80360C28 align:16
|
||||
.ctors start:0x804DB914 end:0x804DB918
|
||||
.data start:0x805487A0 end:0x805487D0
|
||||
.sbss start:0x80575D40 end:0x80575D58
|
||||
.sdata2 start:0x8057D390 end:0x8057D3B8
|
||||
|
||||
d/snd/mgr/d_snd_mgr_unk3.cpp:
|
||||
d/snd/d_snd_3d_manager.cpp:
|
||||
.text start:0x80360C30 end:0x8036145C align:16
|
||||
.data start:0x805487D0 end:0x805487E0
|
||||
.sbss start:0x80575D58 end:0x80575D60
|
||||
.sdata2 start:0x8057D3B8 end:0x8057D3F8
|
||||
|
||||
d/snd/mgr/d_snd_mgr_enemy.cpp:
|
||||
d/snd/d_snd_stage_mgr.cpp:
|
||||
.text start:0x80361460 end:0x8036642C align:16
|
||||
.ctors start:0x804DB918 end:0x804DB91C
|
||||
|
||||
d/snd/d_snd_unk_component_2.cpp:
|
||||
.text start:0x80366430 end:0x8037D800 align:16
|
||||
.text start:0x80366430 end:0x8036A3A4 align:16
|
||||
|
||||
d/snd/mgr/d_snd_mgr_effect.cpp:
|
||||
d/snd/d_snd_area_sound_effect_mgr.cpp:
|
||||
.text start:0x8036A3B0 end:0x8036B8D0 align:16
|
||||
.data start:0x80548B38 end:0x80548B48
|
||||
.sbss start:0x80575D78 end:0x80575D80
|
||||
.sdata2 start:0x8057D8B0 end:0x8057D8E8
|
||||
|
||||
d/snd/d_snd_area_sound.cpp:
|
||||
.text start:0x8036B8D0 end:0x8036C090 align:16
|
||||
.data start:0x80548B48 end:0x80548B78
|
||||
.sdata2 start:0x8057D8E8 end:0x8057D920
|
||||
|
||||
d/snd/d_snd_control_sound.cpp:
|
||||
.text start:0x8036C090 end:0x8036C444 align:16
|
||||
.data start:0x80548B78 end:0x80548C38
|
||||
.sdata2 start:0x8057D920 end:0x8057D938
|
||||
|
||||
d/snd/d_snd_control_player.cpp:
|
||||
.text start:0x8036C450 end:0x8036C6A8 align:16
|
||||
.data start:0x80548C38 end:0x80548CC8
|
||||
.sdata2 start:0x8057D938 end:0x8057D940
|
||||
|
||||
d/snd/d_snd_bgm_mgr.cpp:
|
||||
.text start:0x8036C6B0 end:0x803739CC align:16
|
||||
.sbss start:0x80575D80 end:0x80575D88
|
||||
.sdata2 start:0x8057D940 end:0x8057D970
|
||||
|
||||
d/snd/d_snd_bgm_sound_callbacks.cpp:
|
||||
.text start:0x803739D0 end:0x80378ECC align:16
|
||||
.sdata2 start:0x8057D970 end:0x8057DA50
|
||||
|
||||
d/snd/d_snd_bgm_sound_boss_callbacks.cpp:
|
||||
.text start:0x80378ED0 end:0x80379D20 align:16
|
||||
.sdata2 start:0x8057DA50 end:0x8057DA58
|
||||
|
||||
d/snd/d_snd_bgm_sound.cpp:
|
||||
.text start:0x80379D20 end:0x8037BA68 align:16
|
||||
.sbss start:0x80575D88 end:0x80575D90
|
||||
|
||||
d/snd/d_snd_unk_15.cpp:
|
||||
.text start:0x8037BA70 end:0x8037D800 align:16
|
||||
|
||||
d/snd/d_snd_small_effect_mgr.cpp:
|
||||
.text start:0x8037D800 end:0x8037F8B4 align:16
|
||||
.data start:0x805491B8 end:0x805491D0
|
||||
.sbss start:0x80575D98 end:0x80575DA0
|
||||
.sdata2 start:0x8057DA80 end:0x8057DAD0
|
||||
|
||||
d/snd/mgr/d_snd_mgr_unk_5.cpp:
|
||||
.text start:0x8037F8C0 end:0x803864C8 align:16
|
||||
d/snd/d_snd_harp_mgr.cpp:
|
||||
.text start:0x8037F8C0 end:0x80382150 align:16
|
||||
.data start:0x805491D0 end:0x805491E0
|
||||
.sbss start:0x80575DA0 end:0x80575DA8
|
||||
.sdata2 start:0x8057DAD0 end:0x8057DB48
|
||||
|
||||
d/snd/d_snd_anim_sound.cpp:
|
||||
.text start:0x80382150 end:0x8038240C align:16
|
||||
.sdata2 start:0x8057DB50 end:0x8057DB68
|
||||
|
||||
d/snd/d_snd_source_mgr.cpp:
|
||||
.text start:0x80382410 end:0x803864C8 align:16
|
||||
.ctors start:0x804DB91C end:0x804DB920
|
||||
.sdata start:0x80574310 end:0x805743D0
|
||||
.sbss start:0x80575DA8 end:0x80575DB0
|
||||
.sdata2 start:0x8057DB68 end:0x8057DBC0
|
||||
|
||||
d/snd/mgr/d_snd_mgr_unk_6.cpp:
|
||||
.text start:0x803864D0 end:0x8038C408 align:16
|
||||
d/snd/d_snd_source_group.cpp:
|
||||
.text start:0x803864D0 end:0x803889BC align:16
|
||||
.data start:0x8054A680 end:0x8054A7D0
|
||||
.sdata start:0x805743D0 end:0x80574708
|
||||
.sdata2 start:0x8057DBC0 end:0x8057DCB0
|
||||
|
||||
d/snd/d_snd_source.cpp:
|
||||
.text start:0x803889C0 end:0x8038C408 align:16
|
||||
.ctors start:0x804DB920 end:0x804DB924
|
||||
.data start:0x8054A7D0 end:0x8054AAE8
|
||||
|
||||
d/snd/mgr/d_snd_mgr_unk_7.cpp:
|
||||
d/snd/d_snd_mgr_unk_7.cpp:
|
||||
.text start:0x8038C410 end:0x8038EBF0 align:16
|
||||
.ctors start:0x804DB924 end:0x804DB928
|
||||
|
||||
d/snd/mgr/d_snd_mgr_unk_8.cpp:
|
||||
d/snd/d_snd_mgr_unk_8.cpp:
|
||||
.text start:0x8038EBF0 end:0x8038FF18 align:16
|
||||
.ctors start:0x804DB928 end:0x804DB92C
|
||||
|
||||
d/snd/mgr/d_snd_mgr_unk_9.cpp:
|
||||
d/snd/d_snd_mgr_unk_9.cpp:
|
||||
.text start:0x8038FF20 end:0x80390A18 align:16
|
||||
.ctors start:0x804DB92C end:0x804DB930
|
||||
|
||||
d/snd/mgr/d_snd_mgr_unk_10.cpp:
|
||||
d/snd/d_snd_mgr_unk_10.cpp:
|
||||
.text start:0x80390A20 end:0x80393DF4 align:16
|
||||
.ctors start:0x804DB930 end:0x804DB934
|
||||
|
||||
d/snd/mgr/d_snd_mgr_unk_11.cpp:
|
||||
d/snd/d_snd_mgr_unk_11.cpp:
|
||||
.text start:0x80393E00 end:0x8039A848 align:16
|
||||
.ctors start:0x804DB934 end:0x804DB938
|
||||
|
||||
d/snd/mgr/d_snd_mgr_unk_12.cpp:
|
||||
d/snd/d_snd_calc_pitch.cpp:
|
||||
.text start:0x8039A850 end:0x8039A960 align:16
|
||||
|
||||
RVL_SDK/kpr/KPR.c:
|
||||
|
||||
+486
-486
File diff suppressed because it is too large
Load Diff
+32
-19
@@ -700,26 +700,39 @@ config.libs = [
|
||||
"progress_category": "game",
|
||||
"host": False,
|
||||
"objects": [
|
||||
# These are very low quality splits since nobody has figured
|
||||
# out enough detail. Need to look into nw4r::snd first
|
||||
Object(NonMatching, "d/snd/d_snd.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_actor.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_engine.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_unk_component_1.cpp"),
|
||||
Object(NonMatching, "d/snd/mgr/d_snd_mgr_bgm.cpp"),
|
||||
Object(NonMatching, "d/snd/mgr/d_snd_mgr_unk1.cpp"),
|
||||
Object(NonMatching, "d/snd/mgr/d_snd_mgr_unk3.cpp"),
|
||||
Object(NonMatching, "d/snd/mgr/d_snd_mgr_enemy.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_mgr.cpp"),
|
||||
Object(Matching, "d/snd/d_snd_actor.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_3d_actor.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_3d_engine.cpp"),
|
||||
Object(Matching, "d/snd/d_snd_sound.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_player_mgr.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_control_player_mgr.cpp"),
|
||||
Object(Matching, "d/snd/d_snd_3d_manager.cpp"),
|
||||
# this one is a bit weird. it deals with all the stage definitions,
|
||||
# but it's not actually the bgm manager?
|
||||
Object(NonMatching, "d/snd/d_snd_stage_mgr.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_unk_component_2.cpp"),
|
||||
Object(NonMatching, "d/snd/mgr/d_snd_mgr_effect.cpp"),
|
||||
Object(NonMatching, "d/snd/mgr/d_snd_mgr_unk_5.cpp"),
|
||||
Object(NonMatching, "d/snd/mgr/d_snd_mgr_unk_6.cpp"),
|
||||
Object(NonMatching, "d/snd/mgr/d_snd_mgr_unk_7.cpp"),
|
||||
Object(NonMatching, "d/snd/mgr/d_snd_mgr_unk_8.cpp"),
|
||||
Object(NonMatching, "d/snd/mgr/d_snd_mgr_unk_9.cpp"),
|
||||
Object(NonMatching, "d/snd/mgr/d_snd_mgr_unk_10.cpp"),
|
||||
Object(NonMatching, "d/snd/mgr/d_snd_mgr_unk_11.cpp"),
|
||||
Object(NonMatching, "d/snd/mgr/d_snd_mgr_unk_12.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_area_sound_effect_mgr.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_area_sound.cpp"),
|
||||
Object(Matching, "d/snd/d_snd_control_sound.cpp"),
|
||||
Object(Matching, "d/snd/d_snd_control_player.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_bgm_mgr.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_bgm_sound_callbacks.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_bgm_sound_boss_callbacks.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_bgm_sound.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_unk_15.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_small_effect_mgr.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_harp_mgr.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_anim_sound.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_source_mgr.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_source_group.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_source.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_mgr_unk_7.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_mgr_unk_8.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_mgr_unk_9.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_mgr_unk_10.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_mgr_unk_11.cpp"),
|
||||
Object(NonMatching, "d/snd/d_snd_calc_pitch.cpp"),
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
+5
-78
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_base.h"
|
||||
#include "d/snd/d_snd_source_if.h"
|
||||
#include "m/m_allocator.h"
|
||||
#include "m/m_angle.h"
|
||||
#include "m/m_vec.h"
|
||||
@@ -13,83 +14,9 @@
|
||||
class dAcBase_c;
|
||||
struct cBgS_PolyInfo;
|
||||
|
||||
struct SoundSource {
|
||||
virtual ~SoundSource() {}
|
||||
// TODO there's probably multiple inheritance involved and stuff
|
||||
#define SOUNDSOURCE_VIRTUAL(offset) virtual void vt_##offset();
|
||||
|
||||
SOUNDSOURCE_VIRTUAL(0x0C);
|
||||
SOUNDSOURCE_VIRTUAL(0x10);
|
||||
SOUNDSOURCE_VIRTUAL(0x14);
|
||||
SOUNDSOURCE_VIRTUAL(0x18);
|
||||
SOUNDSOURCE_VIRTUAL(0x1C);
|
||||
SOUNDSOURCE_VIRTUAL(0x20);
|
||||
SOUNDSOURCE_VIRTUAL(0x24);
|
||||
SOUNDSOURCE_VIRTUAL(0x28);
|
||||
SOUNDSOURCE_VIRTUAL(0x2C);
|
||||
SOUNDSOURCE_VIRTUAL(0x30);
|
||||
SOUNDSOURCE_VIRTUAL(0x34);
|
||||
SOUNDSOURCE_VIRTUAL(0x38);
|
||||
SOUNDSOURCE_VIRTUAL(0x3C);
|
||||
SOUNDSOURCE_VIRTUAL(0x40);
|
||||
SOUNDSOURCE_VIRTUAL(0x44);
|
||||
virtual bool shutdown(); // 0x48
|
||||
SOUNDSOURCE_VIRTUAL(0x4C);
|
||||
SOUNDSOURCE_VIRTUAL(0x50);
|
||||
SOUNDSOURCE_VIRTUAL(0x54);
|
||||
SOUNDSOURCE_VIRTUAL(0x58);
|
||||
SOUNDSOURCE_VIRTUAL(0x5C);
|
||||
SOUNDSOURCE_VIRTUAL(0x60);
|
||||
SOUNDSOURCE_VIRTUAL(0x64);
|
||||
SOUNDSOURCE_VIRTUAL(0x68);
|
||||
SOUNDSOURCE_VIRTUAL(0x6C);
|
||||
SOUNDSOURCE_VIRTUAL(0x70);
|
||||
SOUNDSOURCE_VIRTUAL(0x74);
|
||||
SOUNDSOURCE_VIRTUAL(0x78);
|
||||
SOUNDSOURCE_VIRTUAL(0x7C);
|
||||
SOUNDSOURCE_VIRTUAL(0x80);
|
||||
SOUNDSOURCE_VIRTUAL(0x84);
|
||||
SOUNDSOURCE_VIRTUAL(0x88);
|
||||
SOUNDSOURCE_VIRTUAL(0x8C);
|
||||
SOUNDSOURCE_VIRTUAL(0x90);
|
||||
SOUNDSOURCE_VIRTUAL(0x94);
|
||||
SOUNDSOURCE_VIRTUAL(0x98);
|
||||
SOUNDSOURCE_VIRTUAL(0x9C);
|
||||
SOUNDSOURCE_VIRTUAL(0xA0);
|
||||
SOUNDSOURCE_VIRTUAL(0xA4);
|
||||
SOUNDSOURCE_VIRTUAL(0xA8);
|
||||
SOUNDSOURCE_VIRTUAL(0xAC);
|
||||
SOUNDSOURCE_VIRTUAL(0xB0);
|
||||
SOUNDSOURCE_VIRTUAL(0xB4);
|
||||
SOUNDSOURCE_VIRTUAL(0xB8);
|
||||
SOUNDSOURCE_VIRTUAL(0xBC);
|
||||
SOUNDSOURCE_VIRTUAL(0xC0);
|
||||
SOUNDSOURCE_VIRTUAL(0xC4);
|
||||
SOUNDSOURCE_VIRTUAL(0xC8);
|
||||
SOUNDSOURCE_VIRTUAL(0xCC);
|
||||
SOUNDSOURCE_VIRTUAL(0xD0);
|
||||
SOUNDSOURCE_VIRTUAL(0xD4);
|
||||
SOUNDSOURCE_VIRTUAL(0xD8);
|
||||
SOUNDSOURCE_VIRTUAL(0xDC);
|
||||
SOUNDSOURCE_VIRTUAL(0xE0);
|
||||
SOUNDSOURCE_VIRTUAL(0xE4);
|
||||
SOUNDSOURCE_VIRTUAL(0xE8);
|
||||
SOUNDSOURCE_VIRTUAL(0xEC);
|
||||
SOUNDSOURCE_VIRTUAL(0xF0);
|
||||
SOUNDSOURCE_VIRTUAL(0xF4);
|
||||
SOUNDSOURCE_VIRTUAL(0xF8);
|
||||
SOUNDSOURCE_VIRTUAL(0xFC);
|
||||
|
||||
virtual bool isReadyMaybe(); // 0x100
|
||||
virtual bool load(void *data, const char *name); // 0x104
|
||||
virtual void setFrame(f32 frame); // 0x108
|
||||
virtual void setRate(f32 frame); // 0x10C
|
||||
virtual void set_0x164(UNKWORD val); // 0x114
|
||||
};
|
||||
|
||||
struct SoundInfo {
|
||||
dAcBase_c *actor;
|
||||
SoundSource *sound_source;
|
||||
dSoundSourceIf_c *sound_source;
|
||||
mVec3_c *obj_pos;
|
||||
TListNode<SoundInfo> mLink;
|
||||
};
|
||||
@@ -143,7 +70,7 @@ public:
|
||||
/* 0x68 */ mHeapAllocator_c heap_allocator;
|
||||
/* 0x84 */ const ActorInfo *mpActorInfo;
|
||||
/* 0x88 */ TList<SoundInfo, 12> sound_list;
|
||||
/* 0x94 */ RaiiPtr<SoundSource> sound_source;
|
||||
/* 0x94 */ RaiiPtr<dSoundSourceIf_c> sound_source;
|
||||
/* 0x98 */ mVec3_c *obj_pos;
|
||||
/* 0x9C */ mVec3_c pos_copy;
|
||||
/* 0xA8 */ u32 params2;
|
||||
@@ -252,7 +179,7 @@ public:
|
||||
s8 viewClipIdx, const ActorInfo *actorInfo
|
||||
);
|
||||
|
||||
/* 8002c690 */ SoundSource *createSoundSource();
|
||||
/* 8002c690 */ dSoundSourceIf_c *createSoundSource();
|
||||
/* 8002c710 */ int initAllocatorWork1Heap(int size, char *name, int align);
|
||||
/* 8002c720 */ int initAllocator(int size, char *name, EGG::Heap *heap, int align);
|
||||
/* 8002c7b0 */ bool addActorToRoom(s32 roomId);
|
||||
@@ -301,7 +228,7 @@ public:
|
||||
/* 8002d810 */ void FUN_8002d810();
|
||||
/* 8002d830 */ void FUN_8002d830();
|
||||
/* 8002d860 */ void FUN_8002d860(UNKWORD val);
|
||||
/* 8002d880 */ SoundSource *getSoundSource();
|
||||
/* 8002d880 */ dSoundSourceIf_c *getSoundSource();
|
||||
// End of SoundSource stuff
|
||||
|
||||
/* 8002d890 */ void removeSoundInfo(SoundInfo *);
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
#ifndef D_SND_ACTOR_H
|
||||
#define D_SND_ACTOR_H
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_misc.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
#include "nw4r/snd/snd_Sound3DActor.h"
|
||||
|
||||
class dSnd3DActor_c : public nw4r::snd::Sound3DActor {
|
||||
public:
|
||||
dSnd3DActor_c(dSndSourceParam *pSourceParam, u8 sourceType);
|
||||
|
||||
virtual ~dSnd3DActor_c() {}
|
||||
|
||||
virtual bool d_vt_0x30() {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void d_vt_0x34(const nw4r::math::VEC3 &);
|
||||
|
||||
virtual void d_vt_0x38(bool flag, int fadeFrames) = 0;
|
||||
|
||||
virtual UNKWORD d_vt_0x3C() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual UNKWORD d_vt_0x40() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual UNKWORD d_vt_0x44() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual const nw4r::math::VEC3 &getPositionRelativeToPlayer();
|
||||
virtual f32 getDistanceToPlayer(); // vt 0x4C
|
||||
virtual void updatePositionRelativeToPlayer(); // vt 0x50
|
||||
virtual void updateDistanceToPlayer(); // vt 0x54
|
||||
virtual void d_vt_0x58() = 0;
|
||||
virtual void d_vt_0x5C() = 0;
|
||||
|
||||
void resetCachedRelativePositions();
|
||||
|
||||
void updatePositionTransformedByListener();
|
||||
void updateCameraDirectionDot();
|
||||
void updatePositionRelativeToCameraTarget();
|
||||
void calculatePositionRelativeToCameraTarget();
|
||||
void updateDistanceToCameraTarget();
|
||||
void calculatePositionRelativeToListener();
|
||||
void updatePositionRelativeToListener();
|
||||
void updateDistanceToListener();
|
||||
|
||||
bool checkFlag(u16 flag) const {
|
||||
return (mFlags & flag);
|
||||
}
|
||||
|
||||
void setFlag(u16 flag) {
|
||||
mFlags |= flag;
|
||||
}
|
||||
|
||||
f32 getDistanceToListener() {
|
||||
updateDistanceToListener();
|
||||
return mDistanceToListener;
|
||||
}
|
||||
|
||||
bool hasPlayingSounds() const;
|
||||
bool isPlayingSound(u32 id);
|
||||
|
||||
const char *soundIdToSoundLabel(u32 soundId) const;
|
||||
u32 soundLabelToSoundId(const char *soundLabel) const;
|
||||
|
||||
protected:
|
||||
// a_ prefix to prevent multiple inheritance clashes
|
||||
/* 0x7D */ u8 a_field_0x7D;
|
||||
/* 0x7E */ u8 a_field_0x7E;
|
||||
/* 0x7F */ u8 a_field_0x7F;
|
||||
/* 0x80 */ u8 a_field_0x80;
|
||||
/* 0x84 */ f32 a_field_0x84;
|
||||
/* 0x88 */ f32 a_field_0x88;
|
||||
/* 0x8C */ f32 a_field_0x8C;
|
||||
/* 0x90 */ f32 a_field_0x90;
|
||||
/* 0x94 */ f32 mDistanceToListener;
|
||||
/* 0x98 */ f32 mCameraDirectionDot;
|
||||
/* 0x9C */ f32 a_field_0x9C;
|
||||
/* 0xA0 */ nw4r::math::VEC3 mPositionRelativeToListener;
|
||||
/* 0xAC */ nw4r::math::VEC3 mPositionTransformedByListener;
|
||||
/* 0xB8 */ f32 mDistanceToCameraTarget;
|
||||
/* 0xBC */ nw4r::math::VEC3 mPositionRelativeToCameraTarget;
|
||||
/* 0xC8 */ dSndSourceParam *mpSourceParam;
|
||||
/* 0xCC */ u16 mFlags;
|
||||
/* 0xD0 */ nw4r::math::VEC3 mPositionRelativeToPlayer;
|
||||
/* 0xDC */ f32 mDistanceToPlayer;
|
||||
/* 0xE0 */ f32 a_field_0xE0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef D_SND_3D_ENGINE
|
||||
#define D_SND_3D_ENGINE
|
||||
|
||||
#include "nw4r/snd/snd_BasicSound.h"
|
||||
#include "nw4r/snd/snd_Sound3DEngine.h"
|
||||
#include "nw4r/snd/snd_Sound3DManager.h"
|
||||
|
||||
class dSnd3DEngine_c : public nw4r::snd::Sound3DEngine {
|
||||
public:
|
||||
dSnd3DEngine_c();
|
||||
|
||||
virtual void UpdateAmbientParam(
|
||||
const nw4r::snd::Sound3DManager *mgr, const nw4r::snd::Sound3DParam *param3d, u32 unk, u32 flags,
|
||||
nw4r::snd::SoundAmbientParam *paramAmb
|
||||
) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,63 @@
|
||||
#ifndef D_SND_3D_MANAGER_H
|
||||
#define D_SND_3D_MANAGER_H
|
||||
|
||||
#include "d/snd/d_snd_3d_engine.h"
|
||||
#include "d/snd/d_snd_util.h"
|
||||
#include "egg/gfx/eggCamera.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
#include "nw4r/snd/snd_Sound3DListener.h"
|
||||
#include "nw4r/snd/snd_Sound3DManager.h"
|
||||
|
||||
SND_DISPOSER_FORWARD_DECL(dSnd3DManager_c);
|
||||
|
||||
class dSnd3DManager_c {
|
||||
SND_DISPOSER_MEMBERS(dSnd3DManager_c);
|
||||
|
||||
public:
|
||||
dSnd3DManager_c();
|
||||
|
||||
void setup();
|
||||
void updateFromCamera(EGG::LookAtCamera &camera);
|
||||
void setCamDistance(f32 value);
|
||||
void resetCamDistance();
|
||||
void calc();
|
||||
void clearState();
|
||||
|
||||
nw4r::snd::Sound3DManager &getManager() {
|
||||
return mManager;
|
||||
}
|
||||
|
||||
const mVec3_c &getCameraTargetPos() const {
|
||||
return mCameraTargetPosition;
|
||||
}
|
||||
|
||||
const mVec3_c &getNrmCameraDirection() const {
|
||||
return mCameraDirectionNormalized;
|
||||
}
|
||||
|
||||
const nw4r::math::VEC3 &getSndListenerPos() const {
|
||||
return mListener.GetPosition();
|
||||
}
|
||||
|
||||
const nw4r::math::MTX34 &getSndListenerMatrix() const {
|
||||
return mListener.GetMatrix();
|
||||
}
|
||||
|
||||
private:
|
||||
void updateListenerPos(f32);
|
||||
/* 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;
|
||||
/* 0x150 */ f32 mCameraPosSqVelocity;
|
||||
/* 0x154 */ f32 mCameraAtSqVelocity;
|
||||
/* 0x158 */ f32 mCamDistance;
|
||||
/* 0x15C */ s16 mTimer;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef D_SND_3D_ACTOR_H
|
||||
#define D_SND_3D_ACTOR_H
|
||||
|
||||
#include "nw4r/snd/snd_SoundActor.h"
|
||||
|
||||
class dSndActor_c : public nw4r::snd::SoundActor {
|
||||
public:
|
||||
dSndActor_c(nw4r::snd::SoundArchivePlayer &rPlayer);
|
||||
|
||||
private:
|
||||
void doesSomethingWithForeachSound();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,38 @@
|
||||
#ifndef D_SND_AREA_SOUND_H
|
||||
#define D_SND_AREA_SOUND_H
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_sound.h"
|
||||
|
||||
/** A sound class used for dSndAreaSoundEffectMgr */
|
||||
class dSndAreaSound_c : public dSndSound_c {
|
||||
public:
|
||||
dSndAreaSound_c();
|
||||
|
||||
virtual void cancel() override; // 0x08
|
||||
virtual void calc() override; // 0x0C
|
||||
virtual void fadeIn(u32 id, s32 fadeFrames) override; // 0x10
|
||||
|
||||
virtual void initCallback(u32 id); // 0x28
|
||||
|
||||
typedef void (*Callback)(dSndAreaSound_c &sound);
|
||||
|
||||
using dSndSound_c::pause;
|
||||
|
||||
void pause(s32 fadeFrames);
|
||||
void unpause(s32 fadeFrames);
|
||||
|
||||
private:
|
||||
bool isFadingOut() const {
|
||||
return mIsFadingOut && IsAttachedSound();
|
||||
}
|
||||
|
||||
/* 0x0F0 */ bool field_0xF0;
|
||||
/* 0x0F4 */ Callback mpCalcCallback;
|
||||
/* 0x0F8 */ UNKWORD field_0xF8;
|
||||
/* 0x0FC */ UNKWORD field_0xFC;
|
||||
/* 0x100 */ UNKWORD field_0x100;
|
||||
/* 0x104 */ UNKWORD field_0x104;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,39 @@
|
||||
#ifndef D_SND_AREA_SOUND_EFFECT_MGR_H
|
||||
#define D_SND_AREA_SOUND_EFFECT_MGR_H
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_actor.h"
|
||||
#include "d/snd/d_snd_area_sound.h"
|
||||
#include "d/snd/d_snd_util.h"
|
||||
|
||||
SND_DISPOSER_FORWARD_DECL(dSndAreaSoundEffectMgr_c);
|
||||
|
||||
/**
|
||||
* A singleton sound actor for playing persistent environmental background
|
||||
* sound effects. Turn this off and the Faron birds will stop singing.
|
||||
*
|
||||
* Plays sounds like SE_A_F100 (hence the name, not sure if it's the real meaning).
|
||||
*/
|
||||
class dSndAreaSoundEffectMgr_c {
|
||||
SND_DISPOSER_MEMBERS(dSndAreaSoundEffectMgr_c)
|
||||
|
||||
public:
|
||||
dSndAreaSoundEffectMgr_c();
|
||||
|
||||
bool startSound(u32 soundId, u32 handleIdx);
|
||||
void calc();
|
||||
void stopSounds(s32 fadeFrames);
|
||||
|
||||
private:
|
||||
bool isPlayingAnySound() const;
|
||||
bool isPlayingSound(u32 soundId) const;
|
||||
|
||||
/* 0x010 */ dSndAreaSound_c mSounds[3];
|
||||
/* 0x328 */ UNKWORD field_0x328;
|
||||
/* 0x32C */ f32 field_0x32C;
|
||||
/* 0x330 */ f32 field_0x330;
|
||||
/* 0x334 */ dSndActor_c mActor;
|
||||
/* 0x388 */ f32 field_0x388;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef D_SND_CALC_PITCH_H
|
||||
#define D_SND_CALC_PITCH_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
f32 pitchScaleForPitchIdx(s32 idx);
|
||||
f32 pitchScaleForPitchIdxTenths(f32 idx);
|
||||
f32 pitchIdxTenthsForPitchScale(f32 scale);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,107 @@
|
||||
#ifndef D_SND_CHECKERS_H
|
||||
#define D_SND_CHECKERS_H
|
||||
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
#include "toBeSorted/music_mgrs.h"
|
||||
|
||||
class SoundPropertiesChecker {
|
||||
public:
|
||||
virtual void operator()(nw4r::snd::SoundHandle &pHandle) {
|
||||
if (mSoundId != -1 && mSoundId != pHandle.GetId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mpPlayCounter != nullptr) {
|
||||
(*mpPlayCounter)++;
|
||||
} else {
|
||||
mPlayCounter++;
|
||||
}
|
||||
|
||||
if (pHandle.IsPause()) {
|
||||
if (mpPauseCounter != nullptr) {
|
||||
(*mpPauseCounter)++;
|
||||
} else {
|
||||
mPauseCounter++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (fn_803721F0(FANFARE_SOUND_MGR, pHandle.GetId())) {
|
||||
if (mpCounter3 != nullptr) {
|
||||
(*mpCounter3)++;
|
||||
} else {
|
||||
mCounter3++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (fn_803720E0(FANFARE_SOUND_MGR, pHandle.GetId())) {
|
||||
if (mpCounter3 != nullptr) {
|
||||
(*mpCounter3)++;
|
||||
} else {
|
||||
mCounter3++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (fn_80372070(FANFARE_SOUND_MGR, pHandle.GetId())) {
|
||||
if (mpCounter4 != nullptr) {
|
||||
(*mpCounter4)++;
|
||||
} else {
|
||||
mCounter4++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (fn_803734C0(FANFARE_SOUND_MGR, pHandle.GetId()) && !fn_80373550(FANFARE_SOUND_MGR, pHandle.GetId())) {
|
||||
mCounter3++;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x04 */ u32 mSoundId;
|
||||
/* 0x08 */ u32 mPlayCounter;
|
||||
/* 0x0C */ u32 mPauseCounter;
|
||||
/* 0x10 */ u32 mCounter3;
|
||||
/* 0x14 */ u32 mCounter4;
|
||||
/* 0x18 */ u32 *mpPlayCounter;
|
||||
/* 0x1C */ u32 *mpPauseCounter;
|
||||
/* 0x20 */ u32 *mpCounter3;
|
||||
/* 0x24 */ u32 *mpCounter4;
|
||||
};
|
||||
|
||||
|
||||
// used at the very least when trying to finish Demise
|
||||
class IsCurrentSoundIdChecker {
|
||||
public:
|
||||
IsCurrentSoundIdChecker(u32 id, bool *pResult) : mSoundId(id), mpResult(pResult) {}
|
||||
~IsCurrentSoundIdChecker() {}
|
||||
|
||||
virtual void operator()(nw4r::snd::SoundHandle &pHandle) {
|
||||
if (mSoundId == pHandle.GetId()) {
|
||||
*mpResult = true;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x04 */ u32 mSoundId;
|
||||
/* 0x08 */ bool *mpResult;
|
||||
};
|
||||
|
||||
class SoundStopper {
|
||||
public:
|
||||
SoundStopper(u32 id, s32 fadeFrames) : mSoundId(id), mFadeFrames(fadeFrames) {}
|
||||
~SoundStopper() {}
|
||||
|
||||
virtual void operator()(nw4r::snd::SoundHandle &pHandle) {
|
||||
if (mSoundId == pHandle.GetId()) {
|
||||
pHandle.Stop(mFadeFrames);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x04 */ u32 mSoundId;
|
||||
/* 0x08 */ s32 mFadeFrames;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,53 @@
|
||||
#ifndef D_SND_CONTROL_PLAYER_H
|
||||
#define D_SND_CONTROL_PLAYER_H
|
||||
|
||||
#include "d/snd/d_snd_sound.h"
|
||||
#include "nw4r/snd/snd_SoundPlayer.h"
|
||||
|
||||
class dSndControlPlayer_c : public dSndControl_c {
|
||||
public:
|
||||
dSndControlPlayer_c(f32 value, f32 min, f32 max) : dSndControl_c(value, min, max) {}
|
||||
virtual void reset() override; // vt 0x0C
|
||||
|
||||
virtual void stop() override; // vt 0x18
|
||||
virtual void apply() = 0; // vt 0x1C
|
||||
virtual f32 getAppliedValue() = 0; // vt 0x20
|
||||
|
||||
void setIndex1(u32 idx);
|
||||
void setIndex2(u32 idx);
|
||||
|
||||
protected:
|
||||
/* 0x30 */ nw4r::snd::SoundPlayer *mpPlayer;
|
||||
/* 0x34 */ u32 mIndex;
|
||||
};
|
||||
|
||||
class dSndControlPlayerVolumeBase_c : public dSndControlPlayer_c {
|
||||
public:
|
||||
dSndControlPlayerVolumeBase_c();
|
||||
};
|
||||
|
||||
class dSndControlPlayerVolume_c : public dSndControlPlayerVolumeBase_c {
|
||||
public:
|
||||
dSndControlPlayerVolume_c() {}
|
||||
|
||||
virtual void apply() override; // vt 0x1C
|
||||
virtual f32 getAppliedValue() override; // vt 0x20
|
||||
};
|
||||
|
||||
class dSndControlPlayerLpfFreq_c : public dSndControlPlayer_c {
|
||||
public:
|
||||
dSndControlPlayerLpfFreq_c() : dSndControlPlayer_c(0.0f, -1.0f, 0.0f) {}
|
||||
|
||||
virtual void apply() override; // vt 0x1C
|
||||
virtual f32 getAppliedValue() override; // vt 0x20
|
||||
};
|
||||
|
||||
class dSndControlPlayerFxSend_c : public dSndControlPlayer_c {
|
||||
public:
|
||||
dSndControlPlayerFxSend_c() : dSndControlPlayer_c(0.0f, 0.0f, 1.0f) {}
|
||||
|
||||
virtual void apply() override; // vt 0x1C
|
||||
virtual f32 getAppliedValue() override; // vt 0x20
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,95 @@
|
||||
#ifndef D_SND_CONTROL_PLAYER_MGR_H
|
||||
#define D_SND_CONTROL_PLAYER_MGR_H
|
||||
|
||||
#include "d/snd/d_snd_control_player.h"
|
||||
#include "d/snd/d_snd_util.h"
|
||||
#include "nw4r/snd/snd_SoundPlayer.h"
|
||||
#include "nw4r/ut/ut_list.h"
|
||||
|
||||
SND_DISPOSER_FORWARD_DECL(dSndControlPlayerMgr_c);
|
||||
|
||||
class dSndControlPlayerMgr_c {
|
||||
SND_DISPOSER_MEMBERS(dSndControlPlayerMgr_c);
|
||||
|
||||
public:
|
||||
enum PlayerCtrl_e {
|
||||
CTRL_VOLUME = 0,
|
||||
CTRL_LPF_FREQ = 1,
|
||||
CTRL_FX_SEND = 2,
|
||||
|
||||
CTRL_MAX = 3,
|
||||
};
|
||||
|
||||
dSndControlPlayerMgr_c();
|
||||
|
||||
void calc();
|
||||
|
||||
static const s32 sNumPlayers;
|
||||
static const s32 sPlayerMax;
|
||||
|
||||
nw4r::snd::SoundPlayer *getPlayer1(u32) const;
|
||||
nw4r::snd::SoundPlayer *getPlayer2(u32) const;
|
||||
|
||||
void setVolume(u32 playerIdx, f32 value, s32 frames);
|
||||
|
||||
void setLpfFreq(u32 playerIdx, f32 value, s32 frames);
|
||||
void setFxSend(u32 playerIdx, f32 value, s32 frames);
|
||||
|
||||
void overrideVolume(u32 playerIdx, f32 volume, s32 frames);
|
||||
void restoreVolume(u32 playerIdx, s32 frames);
|
||||
|
||||
void muteAllWorldSounds(s32 fadeFrames);
|
||||
void unmuteAllWorldSounds(s32 fadeFrames);
|
||||
|
||||
enum MuteLevel {
|
||||
MUTE_FULL = 0,
|
||||
MUTE_PARTIAL = 1,
|
||||
|
||||
MUTE_MAX = 2,
|
||||
};
|
||||
|
||||
enum VolumeControlGroup {
|
||||
/** PLAYER_BGM, PLAYER_BGM_BOSS */
|
||||
CTRL_GROUP_BGM = 0,
|
||||
/** PLAYER_TG_SOUND - PLAYER_AREA_IN_WATER_LV */
|
||||
CTRL_GROUP_STAGE_EFFECTS = 1,
|
||||
/** PLAYER_ENEMY - PLAYER_ENEMY_FOOTSTEP */
|
||||
CTRL_GROUP_ENEMY = 2,
|
||||
/* PLAYER_OBJECT_1 - PLAYER_TG_SOUND, but not PLAYER_NPC_VOICE */
|
||||
CTRL_GROUP_OBJECTS = 3,
|
||||
|
||||
CTRL_GROUP_MAX = 4,
|
||||
};
|
||||
void setGroupVolumeFlag(VolumeControlGroup group, MuteLevel level);
|
||||
|
||||
void setBgmVolumeDecreaseSpeed(f32 speed);
|
||||
void setStageEffectsVolume(f32 volume, s32 fadeFrames);
|
||||
|
||||
private:
|
||||
void setBgmMuteVolume(f32 volume);
|
||||
void setStageEffectsMuteVolume(f32 volume);
|
||||
void setEnemyMuteVolume(f32 volume);
|
||||
void setObjectMuteVolume(f32 volume);
|
||||
void setPlayerVolumeInternal(u32 playerIdx, f32 volume);
|
||||
|
||||
void resetControls();
|
||||
void calcVolumes();
|
||||
void calcMuteFlags();
|
||||
void executeControls();
|
||||
void linkCtrl(dSndControlPlayer_c *);
|
||||
void unlinkCtrl(dSndControlPlayer_c *);
|
||||
void setControlValue(PlayerCtrl_e ctrlType, u32 playerIdx, f32 value, s32 frames);
|
||||
f32 getAppliedPlayerVolume(u32 playerIdx) const;
|
||||
f32 getControlTarget(PlayerCtrl_e ctrlType, u32 playerIdx) const;
|
||||
|
||||
/* 0x10 */ dSndControlPlayer_c *mpCtrls[CTRL_MAX];
|
||||
/* 0x1C */ f32 *mpTargetVolumes;
|
||||
/* 0x20 */ f32 *mpMaxVolumeDecreases;
|
||||
/* 0x24 */ f32 *mpMaxVolumeIncreases;
|
||||
/* 0x28 */ f32 *mpSavedVolumes;
|
||||
/* 0x2C */ u32 mOverrideVolumeMask;
|
||||
/* 0x30 */ nw4r::ut::List mActiveControls;
|
||||
/* 0x3C */ s16 mTimersForGroupVolume[4][2];
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef D_SND_MGR_H
|
||||
#define D_SND_MGR_H
|
||||
|
||||
#include "egg/audio/eggAudioMgr.h"
|
||||
#include "nw4r/snd/snd_SoundArchivePlayer.h"
|
||||
|
||||
/** The core audio manager used for most sounds. */
|
||||
class dSndMgr_c : public EGG::SimpleAudioMgr {
|
||||
public:
|
||||
dSndMgr_c();
|
||||
|
||||
virtual void calc() override;
|
||||
void initialize(EGG::Heap *heap, u32 size);
|
||||
void initHbm(u32 frame);
|
||||
|
||||
static void restoreEffectsCallback();
|
||||
|
||||
static dSndMgr_c *GetInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
static nw4r::snd::SoundArchivePlayer* getPlayer() {
|
||||
return sInstance->ArcPlayer::getPlayer();
|
||||
}
|
||||
|
||||
private:
|
||||
static dSndMgr_c *sInstance;
|
||||
|
||||
/* 0x6C8 */ u8 _0x6C8[0x6CC - 0x6C8];
|
||||
/* 0x6CC */ u8 field_0x6CC;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef D_SND_MISC_H
|
||||
#define D_SND_MISC_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
// This is at least accessed by dSnd3DEngine_c's functions that
|
||||
// are called as part of UpdateAmbientParam. Appears to be
|
||||
// related to the biquadFilterValue.
|
||||
struct dSndSourceParam {
|
||||
dSndSourceParam() {
|
||||
reset();
|
||||
}
|
||||
|
||||
void reset() {
|
||||
field_0x00 = 300.0;
|
||||
field_0x04 = 1000.0f;
|
||||
field_0x08 = 100.0f;
|
||||
field_0x0C = 400.0f;
|
||||
field_0x10 = 5000.0f;
|
||||
}
|
||||
|
||||
/* 0x00 */ f32 field_0x00;
|
||||
/* 0x04 */ f32 field_0x04;
|
||||
/* 0x08 */ f32 field_0x08;
|
||||
/* 0x0C */ f32 field_0x0C;
|
||||
/* 0x10 */ f32 field_0x10;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,169 @@
|
||||
#ifndef D_SND_PLAYER_MGR_H
|
||||
#define D_SND_PLAYER_MGR_H
|
||||
|
||||
#include "d/snd/d_snd_mgr.h"
|
||||
#include "d/snd/d_snd_util.h"
|
||||
#include "nw4r/snd/snd_MemorySoundArchive.h"
|
||||
#include "nw4r/snd/snd_SoundArchivePlayer.h"
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
#include "nw4r/snd/snd_SoundStartable.h"
|
||||
|
||||
SND_DISPOSER_FORWARD_DECL(dSndPlayerMgr_c);
|
||||
|
||||
/**
|
||||
* The main interface for managing sound stuff. Will delegate to dSndMgr_c for
|
||||
* most things, but handles demo (cutscene) sound effects (SE_DEMO*) by itself.
|
||||
*
|
||||
* Previous Ghidra name: BgmMgr
|
||||
*/
|
||||
class dSndPlayerMgr_c {
|
||||
public:
|
||||
SND_DISPOSER_MEMBERS(dSndPlayerMgr_c);
|
||||
|
||||
public:
|
||||
dSndPlayerMgr_c();
|
||||
|
||||
void shutdown();
|
||||
void calc();
|
||||
|
||||
void enterMenu();
|
||||
void leaveMenu();
|
||||
void enterMap();
|
||||
void leaveMap();
|
||||
void enterHelp();
|
||||
void leaveHelp();
|
||||
|
||||
void enterHbm();
|
||||
void leaveHbm();
|
||||
|
||||
u32 getFreeSize();
|
||||
bool loadDemoArchive(const char *demoArchiveName);
|
||||
const char *getSoundArchivePath();
|
||||
u32 convertLabelStringToSoundId(const char *label) const;
|
||||
|
||||
nw4r::snd::SoundArchivePlayer &getSoundArchivePlayerForType(u8 sourceType);
|
||||
bool canUseThisPlayer(u8 sourceType) const;
|
||||
|
||||
enum PlayerMgrFlag_e {
|
||||
MGR_HBM = 0x1,
|
||||
MGR_UNK_0x2 = 0x2,
|
||||
MGR_PAUSE = 0x4,
|
||||
MGR_MAP = 0x8,
|
||||
MGR_HELP = 0x10,
|
||||
};
|
||||
|
||||
bool checkFlag(u32 mask) const {
|
||||
return mFlags & mask;
|
||||
}
|
||||
|
||||
void onFlag(u32 mask) {
|
||||
mFlags |= mask;
|
||||
}
|
||||
|
||||
void offFlag(u32 mask) {
|
||||
mFlags &= ~mask;
|
||||
}
|
||||
|
||||
u32 getEventMuteMask(u32 id) {
|
||||
nw4r::snd::SoundArchive *archive;
|
||||
if (mSoundArchivePlayer.IsAvailable()) {
|
||||
archive = &mSoundArchive;
|
||||
} else {
|
||||
archive = dSndMgr_c::GetInstance()->getArchive();
|
||||
}
|
||||
return archive->GetSoundUserParam(id) & sEventMuteFlagsMask;
|
||||
}
|
||||
|
||||
enum FanfareUnmuteParam_e {
|
||||
FANFARE_UNMUTE_BGM = 0x10000,
|
||||
FANFARE_UNMUTE_STAGE_EFFECTS = 0x20000,
|
||||
FANFARE_UNMUTE_ENEMY = 0x40000,
|
||||
FANFARE_UNMUTE_OBJECTS = 0x80000,
|
||||
};
|
||||
|
||||
// seem to be used for Small and Event sounds
|
||||
enum UserParamEventSmall_e {
|
||||
MUTE_BGM_PART = 0x10000,
|
||||
MUTE_BGM_FULL = 0x20000,
|
||||
MUTE_STAGE_EFFECTS_PART = 0x40000,
|
||||
MUTE_STAGE_EFFECTS_FULL = 0x80000,
|
||||
MUTE_ENEMY_PART = 0x100000,
|
||||
MUTE_ENEMY_FULL = 0x200000,
|
||||
MUTE_OBJECTS_PART = 0x400000,
|
||||
MUTE_OBJECTS_FULL = 0x800000,
|
||||
};
|
||||
|
||||
static const u32 sEventMuteFlagsMask;
|
||||
|
||||
// For a full overview over which sounds are played by which players,
|
||||
// see https://gist.github.com/robojumper/f81a55857cebed2c79cf3cf3c1ec8f04
|
||||
enum PlayerIndex_e {
|
||||
/** Background music */
|
||||
PLAYER_BGM = 0,
|
||||
/** Background music, boss battle */
|
||||
PLAYER_BGM_BOSS = 1,
|
||||
/** "fanfare?" */
|
||||
PLAYER_FAN = 2,
|
||||
/** small sound effects, only a few (UI navigation related) */
|
||||
PLAYER_SMALL_IMPORTANT = 3,
|
||||
/** small sound, often UI related */
|
||||
PLAYER_SMALL_NORMAL = 4,
|
||||
/** hit, roll attack, cloth, sink */
|
||||
PLAYER_LINK_BODY = 5,
|
||||
/** Link voice */
|
||||
PLAYER_LINK_VOICE = 6,
|
||||
/** Link footstep, swimming */
|
||||
PLAYER_LINK_FOOTSTEP = 7,
|
||||
/** Sword, beetle, ... */
|
||||
PLAYER_LINK_EQUIPMENT = 8,
|
||||
/** Enemy sound effects */
|
||||
PLAYER_ENEMY = 9,
|
||||
/** Enemy voices */
|
||||
PLAYER_ENEMY_VOICE = 10,
|
||||
/** Enemy footstep */
|
||||
PLAYER_ENEMY_FOOTSTEP = 11,
|
||||
/** Misc objects */
|
||||
PLAYER_OBJECT_1 = 12,
|
||||
/** Misc objects */
|
||||
PLAYER_OBJECT_2 = 13,
|
||||
/** NPC footsteps */
|
||||
PLAYER_NPC_FOOTSTEP = 14,
|
||||
/** NPC voices */
|
||||
PLAYER_NPC_VOICE = 15,
|
||||
/** leaves, grass */
|
||||
PLAYER_FOLIAGE = 16,
|
||||
/** misc TgSound environmental effects */
|
||||
PLAYER_TG_SOUND = 17,
|
||||
/** area sound effects (Faron birds...) */
|
||||
PLAYER_AREA = 18,
|
||||
/** not sure, only SE_A_IN_WATER_LV */
|
||||
PLAYER_AREA_IN_WATER_LV = 19,
|
||||
/** event */
|
||||
PLAYER_EVENT = 20,
|
||||
/** not sure */
|
||||
PLAYER_UNK_21 = 21,
|
||||
};
|
||||
|
||||
private:
|
||||
/* 0x010 */ u8 field_0x010;
|
||||
/* 0x011 */ u8 field_0x011;
|
||||
/* 0x014 */ s32 field_0x014;
|
||||
/* 0x018 */ s32 field_0x018;
|
||||
/* 0x01C */ s32 field_0x01C;
|
||||
/* 0x020 */ u32 mFlags;
|
||||
|
||||
// system menu, inventory, map
|
||||
void enterPauseState();
|
||||
void leavePauseState();
|
||||
|
||||
virtual nw4r::snd::SoundStartable::StartResult
|
||||
startSound(nw4r::snd::SoundHandle *pHandle, u32 soundId, const nw4r::snd::SoundStartable::StartInfo *pStartInfo);
|
||||
virtual nw4r::snd::SoundStartable::StartResult startSound(
|
||||
nw4r::snd::SoundHandle *pHandle, const char *soundLabel, const nw4r::snd::SoundStartable::StartInfo *pStartInfo
|
||||
);
|
||||
|
||||
/* 0x028 */ nw4r::snd::MemorySoundArchive mSoundArchive;
|
||||
/* 0x178 */ nw4r::snd::SoundArchivePlayer mSoundArchivePlayer;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,56 @@
|
||||
#ifndef D_SND_SMALL_EFFECT_MGR_H
|
||||
#define D_SND_SMALL_EFFECT_MGR_H
|
||||
|
||||
#include "d/snd/d_snd_source.h"
|
||||
#include "d/snd/d_snd_util.h"
|
||||
#include "d/snd/d_snd_wzsound.h" // IWYU pragma: export
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
|
||||
|
||||
SND_DISPOSER_FORWARD_DECL(dSndSmallEffectMgr_c);
|
||||
|
||||
/**
|
||||
* An interface for playing the SE_S ("sound effect, small"?) sounds.
|
||||
*/
|
||||
class dSndSmallEffectMgr_c {
|
||||
SND_DISPOSER_MEMBERS(dSndSmallEffectMgr_c)
|
||||
|
||||
public:
|
||||
dSndSmallEffectMgr_c();
|
||||
|
||||
bool playSound(u32 soundId);
|
||||
bool playSoundWithPan(u32 soundId, f32 pan);
|
||||
void playSoundWithPitch(u32 soundId, f32 pitch);
|
||||
|
||||
|
||||
bool playButtonPressSoundWhenAdvancingTextBoxes(f32);
|
||||
void resetButtonPressSound();
|
||||
void setButtonPressSound(dSoundSource_c *source);
|
||||
|
||||
private:
|
||||
bool playSoundInternal(u32 soundId);
|
||||
void stopSounds(u32 playerIdx, u32 soundId, s32 fadeFrames);
|
||||
void stopSounds(u32 soundId, s32 fadeFrames);
|
||||
bool isPlayingSound(u32 playerIdx, u32 soundId);
|
||||
bool isPlayingSound(u32 soundId);
|
||||
|
||||
/* 0x10 */ nw4r::snd::SoundHandle mHandle1;
|
||||
// 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];
|
||||
|
||||
/* 0x28 */ s32 field_0x28;
|
||||
/* 0x2C */ s32 field_0x2C;
|
||||
/* 0x30 */ s32 field_0x30;
|
||||
/* 0x34 */ s32 field_0x34;
|
||||
/* 0x38 */ u32 mTextboxAdvanceSound;
|
||||
/* 0x3C */ nw4r::snd::SoundHandle mHandle4;
|
||||
/* 0x40 */ u16 field_0x40;
|
||||
/* 0x42 */ u16 field_0x42;
|
||||
/* 0x44 */ s32 field_0x44;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,225 @@
|
||||
#ifndef D_SND_SOUND_H
|
||||
#define D_SND_SOUND_H
|
||||
|
||||
#include "common.h"
|
||||
#include "nw4r/snd/snd_SeqTrack.h"
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
#include "nw4r/snd/snd_SoundStartable.h"
|
||||
#include "nw4r/ut/ut_list.h"
|
||||
|
||||
class dSndSound_c;
|
||||
|
||||
// Not sure, handles a bunch of floats, exists in a ton of variants
|
||||
class dSndControl_c {
|
||||
public:
|
||||
dSndControl_c(f32 value, f32 min, f32 max)
|
||||
: mResetValue(value),
|
||||
mMax(max),
|
||||
mMin(min),
|
||||
mCurrValue(value),
|
||||
mStartValue(value),
|
||||
mTargetValue(value),
|
||||
mDuration(0),
|
||||
mTimer(0),
|
||||
mIsLinked(false) {}
|
||||
|
||||
~dSndControl_c() {}
|
||||
|
||||
virtual void configure(f32 value, f32 min, f32 max); // vt 0x08
|
||||
virtual void reset(); // vt 0x0C
|
||||
virtual void set(f32 value, s32 frames); // vt 0x10
|
||||
virtual void calc(); // vt 0x14
|
||||
virtual void stop(); // vt 0x18
|
||||
|
||||
bool isLinked() const {
|
||||
return mIsLinked;
|
||||
}
|
||||
|
||||
void setLinked(bool linked) {
|
||||
mIsLinked = linked;
|
||||
}
|
||||
|
||||
f32 getCurrentValue() const {
|
||||
return mCurrValue;
|
||||
}
|
||||
|
||||
f32 getTargetValue() const {
|
||||
return mTargetValue;
|
||||
}
|
||||
|
||||
bool isFinished() const {
|
||||
return mTimer >= mDuration;
|
||||
}
|
||||
|
||||
protected:
|
||||
/* 0x04 */ f32 mResetValue;
|
||||
/* 0x08 */ f32 mMax;
|
||||
/* 0x0C */ f32 mMin;
|
||||
/* 0x10 */ f32 mCurrValue;
|
||||
/* 0x14 */ f32 mStartValue;
|
||||
/* 0x18 */ f32 mTargetValue;
|
||||
/* 0x1C */ s32 mDuration;
|
||||
/* 0x20 */ s32 mTimer;
|
||||
/* 0x24 */ nw4r::ut::Node mNode;
|
||||
/* 0x2C */ bool mIsLinked;
|
||||
};
|
||||
|
||||
class dSndControlSound_c : public dSndControl_c {
|
||||
public:
|
||||
dSndControlSound_c(f32 value, f32 min, f32 max) : dSndControl_c(value, min, max) {}
|
||||
virtual void apply(dSndSound_c *pHandle) = 0; // vt 0x1C
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class dSndControlSoundVolume_c : public dSndControlSound_c {
|
||||
public:
|
||||
dSndControlSoundVolume_c() : dSndControlSound_c(1.0f, 0.0f, 2.0f) {}
|
||||
virtual void apply(dSndSound_c *pHandle) override;
|
||||
};
|
||||
|
||||
class dSndControlSoundPitch_c : public dSndControlSound_c {
|
||||
public:
|
||||
dSndControlSoundPitch_c() : dSndControlSound_c(1.0f, 0.25f, 4.0f) {}
|
||||
virtual void apply(dSndSound_c *pHandle) override;
|
||||
};
|
||||
|
||||
/** Stores pitch as a value from -24 to 24, exponentially scaling it to 0.25-4.0 */
|
||||
class dSndControlSoundPitchLinear_c : public dSndControlSound_c {
|
||||
public:
|
||||
dSndControlSoundPitchLinear_c();
|
||||
virtual void apply(dSndSound_c *pHandle) override;
|
||||
virtual void set(f32 value, s32 frames) override;
|
||||
|
||||
void setControl(dSndControlSound_c *ctrl) {
|
||||
mpOtherControl = ctrl;
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x30 */ dSndControlSound_c *mpOtherControl;
|
||||
};
|
||||
|
||||
class dSndControlSoundSeqTempoRatio_c : public dSndControlSound_c {
|
||||
public:
|
||||
dSndControlSoundSeqTempoRatio_c() : dSndControlSound_c(1.0f, 0.25f, 4.0f) {}
|
||||
virtual void apply(dSndSound_c *pHandle) override;
|
||||
};
|
||||
|
||||
class dSndControlSoundSeqTrackVolume_c : public dSndControlSound_c {
|
||||
public:
|
||||
dSndControlSoundSeqTrackVolume_c() : dSndControlSound_c(1.0f, 0.0f, 2.0f) {}
|
||||
virtual void apply(dSndSound_c *pHandle) override;
|
||||
|
||||
void setMask(u16 mask) {
|
||||
mMask = mask;
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x2E */ u16 mMask;
|
||||
};
|
||||
|
||||
class dSndControlSoundStrmTrackVolume_c : public dSndControlSound_c {
|
||||
public:
|
||||
dSndControlSoundStrmTrackVolume_c() : dSndControlSound_c(1.0f, 0.0f, 2.0f) {}
|
||||
virtual void apply(dSndSound_c *pHandle) override;
|
||||
|
||||
void setMask(u16 mask) {
|
||||
mMask = mask;
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x2E */ u16 mMask;
|
||||
};
|
||||
|
||||
class dSndSound_c : public nw4r::snd::SoundHandle {
|
||||
public:
|
||||
dSndSound_c();
|
||||
~dSndSound_c();
|
||||
|
||||
virtual void cancel(); // 0x08
|
||||
virtual void calc(); // 0x0C
|
||||
virtual void fadeIn(u32 id, s32 fadeFrames); // 0x10
|
||||
virtual nw4r::snd::SoundStartable::StartResult prepareSound(u32 soundId, u32 startOffset); // 0x14
|
||||
virtual nw4r::snd::SoundStartable::StartResult prepareSound(const char *label, u32 startOffset); // 0x18
|
||||
virtual void onPreparing(u32 soundId, u32 startOffset); // 0x1C
|
||||
virtual void stop(s32 fadeFrames); // 0x20
|
||||
virtual void pause(bool pauseFlag, s32 fadeFrames); // 0x24
|
||||
|
||||
bool isStrmSound();
|
||||
bool isWaveSound();
|
||||
bool isSeqSound();
|
||||
|
||||
f32 getCurrentStrmTrackVolume(u32 index) const;
|
||||
|
||||
void setVolume(f32 volume, s32 frames);
|
||||
void setPitchRelated(f32 pitch, s32 frames);
|
||||
void setLinearPitch(f32 pitch, s32 frames);
|
||||
void setTrackVolume(u32 trackFlags, f32 volume, s32 frames);
|
||||
void setStrmTrackVolume(u32 trackFlags, f32 volume, s32 frames);
|
||||
void setSingleSeqTrackVolume(u16 index, f32 volume, s32 frames);
|
||||
void setSingleStrmTrackVolume(u16 index, f32 volume, s32 frames);
|
||||
|
||||
// why f32 frames?
|
||||
void setEachSeqTrackVolume(u32 trackFlags, f32 frames);
|
||||
void setEachStrmTrackVolume(u32 trackFlags, f32 frames);
|
||||
|
||||
void setSeqTempoRatio(f32 ratio, s32 frames);
|
||||
void setSeqTrackMute(u32 trackFlags, nw4r::snd::SeqMute mute);
|
||||
void forceStop();
|
||||
|
||||
s16 readSeqTrackVariable(int varNo);
|
||||
void writeSeqTrackVariable(int varNo, s16 value);
|
||||
|
||||
void linkCtrl(dSndControlSound_c *);
|
||||
void unlinkCtrl(dSndControlSound_c *);
|
||||
|
||||
protected:
|
||||
bool cannotStart() const {
|
||||
return mIsRunning && !mIsFadingOut && IsAttachedSound();
|
||||
}
|
||||
|
||||
bool isRunning() const {
|
||||
return mIsRunning && IsAttachedSound();
|
||||
}
|
||||
|
||||
bool isPreparing() const {
|
||||
return mIsPreparing && !mIsRunning;
|
||||
}
|
||||
|
||||
bool canCancel() const {
|
||||
return mIsRunning || mIsPreparing || IsAttachedSound();
|
||||
}
|
||||
|
||||
bool isPreparingSoundId(u32 soundId) const {
|
||||
bool ret = mIsPreparing;
|
||||
if (ret) {
|
||||
ret = !mIsRunning;
|
||||
}
|
||||
if (ret) {
|
||||
ret = GetId() == soundId;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void resetControls();
|
||||
void resetTrackVolumes();
|
||||
|
||||
void setControlValue(dSndControlSound_c *ctrl, f32 value, s32 frames);
|
||||
|
||||
/* 0x08 */ u8 _0x08[0x10 - 0x08];
|
||||
|
||||
/* 0x10 */ u32 mPrevStartOffset;
|
||||
/* 0x14 */ bool mIsPreparing;
|
||||
/* 0x15 */ bool mPauseFlag;
|
||||
/* 0x16 */ bool mIsRunning;
|
||||
/* 0x17 */ bool mIsFadingOut;
|
||||
/* 0x18 */ dSndControlSoundVolume_c mCtrlVolume;
|
||||
/* 0x48 */ dSndControlSoundPitch_c mCtrlPitch;
|
||||
/* 0x78 */ dSndControlSoundPitchLinear_c mLinearPitch;
|
||||
/* 0xAC */ dSndControlSoundSeqTrackVolume_c *mpCtrlSeqTrackVolume;
|
||||
/* 0xB0 */ dSndControlSoundStrmTrackVolume_c *mpCtrlStrmTrackVolume;
|
||||
/* 0xB4 */ dSndControlSoundSeqTempoRatio_c mpCtrlSeqTempoRatio;
|
||||
/* 0xE4 */ nw4r::ut::List mList;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,115 @@
|
||||
#ifndef D_SOUND_SOURCE_H
|
||||
#define D_SOUND_SOURCE_H
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_3d_actor.h"
|
||||
#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 sourceType, dAcBase_c *, const char *name, dSndSourceGroup_c *pOwnerGroup);
|
||||
virtual ~dSoundSource_c();
|
||||
|
||||
static u32 getCharacterTalkSoundId(u32 baseSoundId, dSoundSource_c *source);
|
||||
u32 getRemoConSoundVariant(u32 soundId) const;
|
||||
|
||||
// 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;
|
||||
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();
|
||||
virtual void d_s_vt_0x18C();
|
||||
virtual void d_s_vt_0x190();
|
||||
virtual void d_s_vt_0x194();
|
||||
|
||||
virtual void d_vt_0x58() override;
|
||||
|
||||
virtual void d_s_vt_0x19C();
|
||||
virtual void d_s_vt_0x1A0();
|
||||
|
||||
virtual void d_vt_0x5C() override;
|
||||
virtual StartResult
|
||||
SetupSound(nw4r::snd::SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void *) override;
|
||||
|
||||
virtual void d_s_vt_0x1AC();
|
||||
virtual void d_s_vt_0x1B0();
|
||||
virtual void d_s_vt_0x1B4();
|
||||
virtual void d_s_vt_0x1B8();
|
||||
virtual void d_s_vt_0x1BC();
|
||||
virtual void d_s_vt_0x1C0();
|
||||
virtual void d_s_vt_0x1C4(bool flag, int fadeFrames);
|
||||
virtual void d_s_vt_0x1C8();
|
||||
virtual void d_s_vt_0x1CC();
|
||||
|
||||
virtual void d_vt_0x38(bool flag, int fadeFrames) override;
|
||||
|
||||
virtual void d_s_vt_0x1D4();
|
||||
virtual void d_s_vt_0x1D8();
|
||||
virtual void d_s_vt_0x1DC();
|
||||
virtual void d_s_vt_0x1E0();
|
||||
virtual void d_s_vt_0x1E4();
|
||||
virtual void d_s_vt_0x1E8();
|
||||
|
||||
// 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 mSourceCategory;
|
||||
}
|
||||
virtual const nw4r::math::VEC3 &getListenerPosition() const override;
|
||||
|
||||
virtual bool hasPlayingSounds() const override; // 0x48
|
||||
virtual bool isPlayingSound(u32 soundId) override; // 0x4C
|
||||
virtual bool isPlayingSound(const char *soundId) override; // 0x50
|
||||
|
||||
virtual bool isReadyMaybe() override {
|
||||
return false;
|
||||
} // 0x100
|
||||
virtual void load(void *data, const char *name) override {} // 0x104
|
||||
virtual void setFrame(f32 frame) override {} // 0x108
|
||||
virtual void setRate(f32 frame) override {} // 0x10C
|
||||
|
||||
private:
|
||||
// at 0x00: dSoundSourceIf_c vtable
|
||||
// at 0x04: dSnd3DActor_c sub-object
|
||||
// at 0x58: thunk-vtable
|
||||
|
||||
/* 0xE8 */ nw4r::ut::Node mMgrLink;
|
||||
/* 0x0F0 */ const char *mpName;
|
||||
/* 0x0F4 */ UNKWORD field_0x0F4;
|
||||
/* 0x0F8 */ dAcBase_c *mpPlayer;
|
||||
/* 0x0FC */ u8 mSourceCategory;
|
||||
/* 0x0FD */ u8 mSourceType;
|
||||
/* 0x0FE */ u8 field_0x0FE;
|
||||
/* 0x0FF */ u8 field_0x0FF;
|
||||
/* 0x100 */ u8 field_0x100;
|
||||
/* 0x101 */ u8 field_0x101;
|
||||
/* 0x102 */ u8 field_0x102;
|
||||
/* 0x104 */ UNKWORD field_0x104;
|
||||
/* 0x108 */ UNKWORD field_0x108;
|
||||
/* 0x10C */ UNKWORD field_0x10C;
|
||||
/* 0x110 */ nw4r::ut::List field_0x110; // node offset 0xEC
|
||||
/* 0x11C */ UNKWORD field_0x11C;
|
||||
/* 0x120 */ nw4r::ut::List field_0x120; // node offset 0x4
|
||||
/* 0x12C */ nw4r::ut::List field_0x12C; // node offset 0x4
|
||||
/* 0x138 */ nw4r::ut::Node mGroupLink; // node for list in dSndSourceGroup_c
|
||||
/* 0x140 */ dSndSourceGroup_c *mpOwnerGroup;
|
||||
/* 0x144 */ u8 _0x144[0x154 - 0x144];
|
||||
/* 0x154 */ UNKWORD field_0x154;
|
||||
/* 0x158 */ s16 field_0x158;
|
||||
/* 0x15A */ s16 field_0x15A;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,74 @@
|
||||
#ifndef D_SND_SOURCE_ENUMS_H
|
||||
#define D_SND_SOURCE_ENUMS_H
|
||||
|
||||
// TODO: Expand when we figure out what the other entries have in common
|
||||
enum SoundSourceType_e {
|
||||
// 0-1: Player (0)
|
||||
SND_SOURCE_PLAYER = 0,
|
||||
SND_SOURCE_PLAYER_HEAD = 1,
|
||||
|
||||
// 2-9: Equipment (1)
|
||||
SND_SOURCE_NET = 2,
|
||||
SND_SOURCE_BLADE = 3,
|
||||
SND_SOURCE_SHIELD = 4,
|
||||
SND_SOURCE_WHIP = 5,
|
||||
SND_SOURCE_BOOMERANG = 6,
|
||||
SND_SOURCE_ARROW = 7,
|
||||
SND_SOURCE_BOMB = 8,
|
||||
SND_SOURCE_HOOKSHOT = 9,
|
||||
|
||||
// 10-31: Enemy? (2)
|
||||
SND_SOURCE_ENEMY_10 = 10,
|
||||
SND_SOURCE_BIGBOSS = 20,
|
||||
SND_SOURCE_GIRAHUMU_3 = 24,
|
||||
SND_SOURCE_BULLET = 29,
|
||||
SND_SOURCE_ENEMY_31 = 31,
|
||||
|
||||
// 32-42: Object? (3)
|
||||
SND_SOURCE_OBJECT = 32,
|
||||
SND_SOURCE_BAMBOO = 34,
|
||||
SND_SOURCE_ITEM = 35,
|
||||
SND_SOURCE_TERRY_SHOP = 36,
|
||||
SND_SOURCE_TIME_STONE = 37,
|
||||
SND_SOURCE_CLEF = 38,
|
||||
SND_SOURCE_SHUTTER = 39,
|
||||
SND_SOURCE_OBJECT_42 = 42,
|
||||
|
||||
// 43-52: Npc (4)
|
||||
SND_SOURCE_NPC_43 = 43,
|
||||
SND_SOURCE_KENSEI = 44,
|
||||
SND_SOURCE_PLAYER_BIRD = 45,
|
||||
SND_SOURCE_NPC_48 = 48,
|
||||
SND_SOURCE_INSECT = 49,
|
||||
SND_SOURCE_NPC_NRM = 51,
|
||||
SND_SOURCE_NPC_DRAGON = 52,
|
||||
|
||||
// 53: TagSound (5)
|
||||
SND_SOURCE_TG_SOUND = 53,
|
||||
|
||||
// 54-57: Harp Related (6)
|
||||
SND_SOURCE_54 = 54,
|
||||
SND_SOURCE_OBJECT_WARP = 55,
|
||||
SND_SOURCE_SW_HARP = 56,
|
||||
SND_SOURCE_57 = 57,
|
||||
|
||||
// 58: ? (7)
|
||||
SND_SOURCE_58 = 58,
|
||||
|
||||
// 59: ? (9)
|
||||
SND_SOURCE_59 = 59,
|
||||
};
|
||||
|
||||
enum SoundSourceCategory_e {
|
||||
SND_SOURCE_CATEGORY_PLAYER = 0,
|
||||
SND_SOURCE_CATEGORY_EQUIPMENT = 1,
|
||||
SND_SOURCE_CATEGORY_ENEMY = 2,
|
||||
SND_SOURCE_CATEGORY_OBJECT = 3,
|
||||
SND_SOURCE_CATEGORY_NPC = 4,
|
||||
SND_SOURCE_CATEGORY_TG_SOUND = 5,
|
||||
SND_SOURCE_CATEGORY_6 = 6,
|
||||
SND_SOURCE_CATEGORY_7 = 7,
|
||||
SND_SOURCE_CATEGORY_9 = 9,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,63 @@
|
||||
#ifndef D_SND_SOURCE_GROUP_H
|
||||
#define D_SND_SOURCE_GROUP_H
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_misc.h"
|
||||
#include "nw4r/ut/ut_list.h"
|
||||
#include "sized_string.h"
|
||||
|
||||
class dSoundSource_c;
|
||||
|
||||
/**
|
||||
* All similar dSoundSource_c's are put in a group. The game can then find the closest
|
||||
* source for a given type by name/id, for example for changing things about the music
|
||||
* depending on proximity to a certain object or enemy.
|
||||
*
|
||||
* Through its dSndSourceParam, it can also "send" parameters to all dSnd3DActors
|
||||
* corresponding to these sound sources.
|
||||
*
|
||||
* Size: 0x70
|
||||
*/
|
||||
class dSndSourceGroup_c {
|
||||
public:
|
||||
dSndSourceGroup_c();
|
||||
dSndSourceGroup_c(s32 sourceType, const char*, u32, s32 mSubtype);
|
||||
~dSndSourceGroup_c();
|
||||
|
||||
void registerSource(dSoundSource_c *);
|
||||
void unregisterSource(dSoundSource_c *);
|
||||
|
||||
dSndSourceParam* getAmbientParam() {
|
||||
return &mParam;
|
||||
}
|
||||
|
||||
dSoundSource_c *getSourceClosestToListener();
|
||||
dSoundSource_c *getSourceClosestToPlayer();
|
||||
|
||||
s32 getNumSources() const;
|
||||
void set(s32 type, const char *name);
|
||||
void calc();
|
||||
|
||||
private:
|
||||
bool setParamFromName(const char *name);
|
||||
void resetSoundSourceParam();
|
||||
void clearList();
|
||||
|
||||
/* 0x00 */ nw4r::ut::Node mNode1;
|
||||
/* 0x08 */ nw4r::ut::Node mNode2;
|
||||
/* 0x10 */ UNKWORD field_0x10;
|
||||
/* 0x14 */ s32 mSourceCategory;
|
||||
/* 0x18 */ s32 mSubtype;
|
||||
/* 0x1C */ u8 field_0x1C;
|
||||
/* 0x1D */ u8 field_0x1D;
|
||||
/* 0x1E */ SizedString<32> mName;
|
||||
/* 0x40 */ UNKWORD field_0x40;
|
||||
/* 0x44 */ nw4r::ut::List mSourceList;
|
||||
/* 0x50 */ dSndSourceParam mParam;
|
||||
/* 0x64 */ dSoundSource_c *mpCachedClosestSourceToListener;
|
||||
/* 0x68 */ dSoundSource_c *mpCachedClosestSourceToPlayer;
|
||||
/* 0x6C */ bool mCalculatedClosestToListener;
|
||||
/* 0x6D */ bool mCalculatedClosestToPlayer;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,87 @@
|
||||
#ifndef D_SOUND_SOURCE_IF_H
|
||||
#define D_SOUND_SOURCE_IF_H
|
||||
|
||||
#include "common.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
|
||||
class dAcBase_c;
|
||||
|
||||
/** An abstract interface for sound relating to a particular actor. */
|
||||
class dSoundSourceIf_c {
|
||||
public:
|
||||
virtual ~dSoundSourceIf_c() {}
|
||||
#define SOUNDSOURCE_VIRTUAL(offset) virtual void vt_##offset() = 0;
|
||||
|
||||
SOUNDSOURCE_VIRTUAL(0x0C);
|
||||
virtual s32 getCategory() const = 0; // 0x10
|
||||
SOUNDSOURCE_VIRTUAL(0x14);
|
||||
virtual s32 getActorType() const = 0;
|
||||
SOUNDSOURCE_VIRTUAL(0x1C);
|
||||
SOUNDSOURCE_VIRTUAL(0x20);
|
||||
SOUNDSOURCE_VIRTUAL(0x24);
|
||||
virtual const nw4r::math::VEC3 &getListenerPosition() const = 0; // 0x28
|
||||
SOUNDSOURCE_VIRTUAL(0x2C);
|
||||
SOUNDSOURCE_VIRTUAL(0x30);
|
||||
SOUNDSOURCE_VIRTUAL(0x34);
|
||||
SOUNDSOURCE_VIRTUAL(0x38);
|
||||
SOUNDSOURCE_VIRTUAL(0x3C);
|
||||
SOUNDSOURCE_VIRTUAL(0x40);
|
||||
SOUNDSOURCE_VIRTUAL(0x44);
|
||||
virtual bool hasPlayingSounds() const = 0; // 0x48
|
||||
virtual bool isPlayingSound(u32 soundId) = 0; // 0x4C
|
||||
virtual bool isPlayingSound(const char *soundId) = 0; // 0x50
|
||||
SOUNDSOURCE_VIRTUAL(0x54);
|
||||
SOUNDSOURCE_VIRTUAL(0x58);
|
||||
SOUNDSOURCE_VIRTUAL(0x5C);
|
||||
SOUNDSOURCE_VIRTUAL(0x60);
|
||||
SOUNDSOURCE_VIRTUAL(0x64);
|
||||
SOUNDSOURCE_VIRTUAL(0x68);
|
||||
SOUNDSOURCE_VIRTUAL(0x6C);
|
||||
SOUNDSOURCE_VIRTUAL(0x70);
|
||||
SOUNDSOURCE_VIRTUAL(0x74);
|
||||
SOUNDSOURCE_VIRTUAL(0x78);
|
||||
SOUNDSOURCE_VIRTUAL(0x7C);
|
||||
SOUNDSOURCE_VIRTUAL(0x80);
|
||||
SOUNDSOURCE_VIRTUAL(0x84);
|
||||
SOUNDSOURCE_VIRTUAL(0x88);
|
||||
SOUNDSOURCE_VIRTUAL(0x8C);
|
||||
SOUNDSOURCE_VIRTUAL(0x90);
|
||||
SOUNDSOURCE_VIRTUAL(0x94);
|
||||
SOUNDSOURCE_VIRTUAL(0x98);
|
||||
SOUNDSOURCE_VIRTUAL(0x9C);
|
||||
SOUNDSOURCE_VIRTUAL(0xA0);
|
||||
SOUNDSOURCE_VIRTUAL(0xA4);
|
||||
SOUNDSOURCE_VIRTUAL(0xA8);
|
||||
SOUNDSOURCE_VIRTUAL(0xAC);
|
||||
SOUNDSOURCE_VIRTUAL(0xB0);
|
||||
SOUNDSOURCE_VIRTUAL(0xB4);
|
||||
SOUNDSOURCE_VIRTUAL(0xB8);
|
||||
SOUNDSOURCE_VIRTUAL(0xBC);
|
||||
SOUNDSOURCE_VIRTUAL(0xC0);
|
||||
SOUNDSOURCE_VIRTUAL(0xC4);
|
||||
SOUNDSOURCE_VIRTUAL(0xC8);
|
||||
SOUNDSOURCE_VIRTUAL(0xCC);
|
||||
SOUNDSOURCE_VIRTUAL(0xD0);
|
||||
SOUNDSOURCE_VIRTUAL(0xD4);
|
||||
SOUNDSOURCE_VIRTUAL(0xD8);
|
||||
SOUNDSOURCE_VIRTUAL(0xDC);
|
||||
SOUNDSOURCE_VIRTUAL(0xE0);
|
||||
SOUNDSOURCE_VIRTUAL(0xE4);
|
||||
SOUNDSOURCE_VIRTUAL(0xE8);
|
||||
SOUNDSOURCE_VIRTUAL(0xEC);
|
||||
SOUNDSOURCE_VIRTUAL(0xF0);
|
||||
SOUNDSOURCE_VIRTUAL(0xF4);
|
||||
SOUNDSOURCE_VIRTUAL(0xF8);
|
||||
SOUNDSOURCE_VIRTUAL(0xFC);
|
||||
|
||||
virtual bool isReadyMaybe() = 0; // 0x100
|
||||
virtual void load(void *data, const char *name) = 0; // 0x104
|
||||
virtual void setFrame(f32 frame) = 0; // 0x108
|
||||
virtual void setRate(f32 frame) = 0; // 0x10C
|
||||
|
||||
SOUNDSOURCE_VIRTUAL(0x110);
|
||||
SOUNDSOURCE_VIRTUAL(0x114);
|
||||
SOUNDSOURCE_VIRTUAL(0x118);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
#ifndef D_SND_SOURCE_MGR_H
|
||||
#define D_SND_SOURCE_MGR_H
|
||||
|
||||
#include "d/snd/d_snd_source.h"
|
||||
#include "d/snd/d_snd_source_group.h"
|
||||
#include "d/snd/d_snd_util.h"
|
||||
#include "nw4r/ut/ut_list.h"
|
||||
|
||||
SND_DISPOSER_FORWARD_DECL(dSndSourceMgr_c);
|
||||
|
||||
class dSndSourceMgr_c {
|
||||
SND_DISPOSER_MEMBERS(dSndSourceMgr_c);
|
||||
|
||||
static const u32 NUM_GROUPS = 128;
|
||||
|
||||
public:
|
||||
dSndSourceMgr_c();
|
||||
|
||||
void registerSource(dSoundSource_c *source);
|
||||
void unregisterSource(dSoundSource_c *source);
|
||||
|
||||
void playFlowSound(u32 id);
|
||||
static s32 getSourceCategoryForSourceType(s32 sourceType, const char *name);
|
||||
|
||||
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;
|
||||
/* 0x0013 */ u8 field_0x0013;
|
||||
|
||||
/* 0x0014 */ dSndSourceGroup_c *mpDefaultGroup;
|
||||
/* 0x0018 */ nw4r::ut::List mGroupList1;
|
||||
/* 0x0024 */ nw4r::ut::List mGroupList2;
|
||||
/* 0x0030 */ nw4r::ut::List mGroupList3;
|
||||
/* 0x003C */ dSndSourceGroup_c mGroups[NUM_GROUPS];
|
||||
|
||||
// Not sure what these are for
|
||||
/* 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
|
||||
|
||||
/* 0x3860 */ UNKWORD field_0x3860;
|
||||
/* 0x3864 */ UNKWORD field_0x3864;
|
||||
/* 0x3868 */ UNKWORD field_0x3868;
|
||||
/* 0x386C */ f32 field_0x386C;
|
||||
|
||||
/* 0x3870 */ dSoundSource_c *mpPlayerSource;
|
||||
/* 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;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,71 @@
|
||||
#ifndef D_SND_UTIL_H
|
||||
#define D_SND_UTIL_H
|
||||
|
||||
#include "common.h"
|
||||
#include "egg/core/eggDisposer.h"
|
||||
|
||||
// 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,
|
||||
// an inline ctor, and has the Disposer at offset 0x18
|
||||
|
||||
template <typename T>
|
||||
struct SndMgrDisposer : public EGG::Disposer {
|
||||
virtual ~SndMgrDisposer();
|
||||
|
||||
static T *create();
|
||||
static void remove();
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
SndMgrDisposer<T>::~SndMgrDisposer() {
|
||||
if (this == T::sDisposer) {
|
||||
remove();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T *SndMgrDisposer<T>::create() {
|
||||
if (T::sInstance == nullptr) {
|
||||
T::sInstance = new T();
|
||||
T::sDisposer = T::sInstance->GetDisposer();
|
||||
}
|
||||
return T::sInstance;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void SndMgrDisposer<T>::remove() {
|
||||
T::sInstance = nullptr;
|
||||
T::sDisposer = nullptr;
|
||||
}
|
||||
|
||||
#define SND_DISPOSER_FORWARD_DECL(class_name) \
|
||||
class class_name; \
|
||||
extern template class SndMgrDisposer<class_name>;
|
||||
|
||||
#define SND_DISPOSER_DEFINE(class_name) \
|
||||
template class SndMgrDisposer<class_name>; \
|
||||
class_name *class_name::sInstance; \
|
||||
SndMgrDisposer<class_name> *class_name::sDisposer;
|
||||
|
||||
#define SND_DISPOSER_MEMBERS(class_name) \
|
||||
public: \
|
||||
SndMgrDisposer<class_name> *GetDisposer() { \
|
||||
return &mDisposer; \
|
||||
} \
|
||||
\
|
||||
static class_name *GetInstance() { \
|
||||
return sInstance; \
|
||||
} \
|
||||
\
|
||||
static void create() { \
|
||||
SndMgrDisposer<class_name>::create(); \
|
||||
} \
|
||||
\
|
||||
static class_name *sInstance; \
|
||||
static SndMgrDisposer<class_name> *sDisposer; \
|
||||
\
|
||||
private: \
|
||||
SndMgrDisposer<class_name> mDisposer;
|
||||
|
||||
#endif
|
||||
@@ -1,9 +1,8 @@
|
||||
#ifndef SMALL_SOUND_MGR_H
|
||||
#define SMALL_SOUND_MGR_H
|
||||
#ifndef D_SND_WZSOUND_H
|
||||
#define D_SND_WZSOUND_H
|
||||
|
||||
// Thanks kiwi! https://gist.github.com/kiwi515/47bb17b07ed502bdfa7faa60bc48a3c7
|
||||
|
||||
#include "common.h"
|
||||
enum WZSound {
|
||||
/* 0x0000 */ SE_L_FLIPED,
|
||||
/* 0x0001 */ SE_L_FS_START,
|
||||
@@ -6469,18 +6468,4 @@ enum WZSound {
|
||||
/* 0x193D */ LABEL_SOUND_END
|
||||
};
|
||||
|
||||
class SmallSoundManager {
|
||||
public:
|
||||
void playSound(WZSound id);
|
||||
void playSoundWithPitch(WZSound id, f32 pitch);
|
||||
void playButtonPressSoundWhenAdvancingTextBoxes(f32);
|
||||
|
||||
static SmallSoundManager *GetInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private:
|
||||
static SmallSoundManager *sInstance;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -26,12 +26,20 @@ public:
|
||||
void stopAllSound();
|
||||
|
||||
u32 changeNameToId(const char *name) {
|
||||
return mOpenSndArchive->ConvertLabelStringToSoundId(name);
|
||||
u32 id = -1;
|
||||
if (mOpenSndArchive != nullptr) {
|
||||
id = mOpenSndArchive->ConvertLabelStringToSoundId(name);
|
||||
}
|
||||
return id;
|
||||
}
|
||||
nw4r::snd::SoundArchivePlayer *getPlayer() {
|
||||
return mActiveSndArchivePlayer;
|
||||
}
|
||||
|
||||
nw4r::snd::SoundArchive *getArchive() {
|
||||
return mOpenSndArchive;
|
||||
}
|
||||
|
||||
void setLoadStringLabels(bool bLoad) {
|
||||
mLoadLabelStringData = bLoad;
|
||||
}
|
||||
@@ -65,12 +73,7 @@ public:
|
||||
|
||||
virtual bool startSound(nw4r::snd::SoundHandle *handle, const char *name) // at 0x40
|
||||
{
|
||||
u32 id = -1;
|
||||
if (mOpenSndArchive) {
|
||||
id = changeNameToId(name);
|
||||
}
|
||||
|
||||
return ArcPlayer::startSound(handle, id);
|
||||
return ArcPlayer::startSound(handle, changeNameToId(name));
|
||||
}
|
||||
|
||||
virtual bool prepareSound(nw4r::snd::SoundHandle *handle, u32 id) // at 0x44
|
||||
@@ -85,12 +88,7 @@ public:
|
||||
|
||||
virtual bool prepareSound(nw4r::snd::SoundHandle *handle, const char *name) // at 0x4C
|
||||
{
|
||||
u32 id = -1;
|
||||
if (mOpenSndArchive) {
|
||||
id = changeNameToId(name);
|
||||
}
|
||||
|
||||
return ArcPlayer::prepareSound(handle, id);
|
||||
return ArcPlayer::prepareSound(handle, changeNameToId(name));
|
||||
}
|
||||
|
||||
virtual bool holdSound(nw4r::snd::SoundHandle *handle, u32 id) // at 0x50
|
||||
@@ -105,12 +103,7 @@ public:
|
||||
|
||||
virtual bool holdSound(nw4r::snd::SoundHandle *handle, const char *name) // at 0x58
|
||||
{
|
||||
u32 id = -1;
|
||||
if (mOpenSndArchive) {
|
||||
id = changeNameToId(name);
|
||||
}
|
||||
|
||||
return ArcPlayer::holdSound(handle, id);
|
||||
return ArcPlayer::holdSound(handle, changeNameToId(name));
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -21,9 +21,38 @@ public:
|
||||
~SoundHeapMgr() {
|
||||
destroySoundHeap();
|
||||
}
|
||||
virtual bool loadState(s32 id) {}
|
||||
virtual int getCurrentLevel() {}
|
||||
virtual void stateProc() {}
|
||||
int saveState() {
|
||||
return mSoundHeap.SaveState();
|
||||
}
|
||||
virtual bool loadState(s32 id) {
|
||||
s32 level = mSoundHeap.GetCurrentLevel();
|
||||
if (id > 0 && level >= id) {
|
||||
mSoundHeap.LoadState(id);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
virtual int getCurrentLevel() {
|
||||
return mSoundHeap.GetCurrentLevel();
|
||||
}
|
||||
virtual void stateProc() {
|
||||
OSMessage msg;
|
||||
if (OSReceiveMessage(&mQueue1.mQueue, &msg, 0)) {
|
||||
bool ok = loadState((s32)msg);
|
||||
OSSendMessage(&mQueue3.mQueue, (OSMessage)ok, 0);
|
||||
}
|
||||
|
||||
if (OSReceiveMessage(&mQueue2.mQueue, &msg, 0)) {
|
||||
int ok = mSoundHeap.SaveState();
|
||||
OSSendMessage(&mQueue3.mQueue, (OSMessage)ok, 0);
|
||||
}
|
||||
|
||||
if (OSReceiveMessage(&mQueue, &msg, 0)) {
|
||||
int level = getCurrentLevel();
|
||||
OSSendMessage(&mQueue3.mQueue, (OSMessage)level, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void createSoundHeap(Allocator *allocator, u32 size);
|
||||
void destroySoundHeap();
|
||||
@@ -34,7 +63,9 @@ public:
|
||||
|
||||
private:
|
||||
nw4r::snd::SoundHeap mSoundHeap;
|
||||
u8 unk[0x68 - 0x38];
|
||||
// I guess we're not initializing this queue?
|
||||
OSMessageQueue mQueue;
|
||||
OSMessage mBuffer[4];
|
||||
SoundMessageQueue mQueue1;
|
||||
SoundMessageQueue mQueue2;
|
||||
SoundMessageQueue mQueue3;
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace EGG {
|
||||
struct MultiArcSimpleAudioMgr {
|
||||
u8 field_0x000[0x0FC - 0x000];
|
||||
s32 field_0x0FC;
|
||||
ArcPlayer players[];
|
||||
ArcPlayer players[1];
|
||||
|
||||
nw4r::snd::SoundArchivePlayer *getPlayer(int i) {
|
||||
return players[i].getPlayer();
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "egg/core/eggHeap.h"
|
||||
#include "egg/core/eggStreamDecomp.h"
|
||||
|
||||
|
||||
namespace EGG {
|
||||
|
||||
class DvdRipper {
|
||||
@@ -28,6 +27,29 @@ public:
|
||||
typedef void (*UnkCallback)(void *);
|
||||
|
||||
public:
|
||||
// Not sure
|
||||
struct Arg {
|
||||
Arg(const char *path, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, u32 offset, u32 *pRead, u32 *fileSize)
|
||||
: path(path),
|
||||
pOut(pOut),
|
||||
pHeap(pHeap),
|
||||
allocDir(allocDir),
|
||||
offset(offset),
|
||||
pRead(pRead),
|
||||
fileSize(fileSize) {}
|
||||
const char *path;
|
||||
u8 *pOut;
|
||||
Heap *pHeap;
|
||||
EAllocDirection allocDir;
|
||||
u32 offset;
|
||||
u32 *pRead;
|
||||
u32 *fileSize;
|
||||
};
|
||||
|
||||
static u8 *loadToMainRAM(Arg &arg) {
|
||||
return loadToMainRAM(arg.path, arg.pOut, arg.pHeap, arg.allocDir, arg.offset, arg.pRead, arg.fileSize);
|
||||
}
|
||||
|
||||
static u8 *
|
||||
loadToMainRAM(s32 entryNum, u8 *pOut, Heap *pHeap, EAllocDirection allocDir, u32 offset, u32 *pRead, u32 *fileSize);
|
||||
|
||||
|
||||
@@ -35,6 +35,15 @@ protected:
|
||||
class LookAtCamera : public BaseCamera {
|
||||
public:
|
||||
LookAtCamera() : mPos(0.0f, 10.0f, 0.0f), mAt(0.0f, 0.0f, 0.0f), mUp(0.0f, 1.0f, 0.0f) {}
|
||||
|
||||
LookAtCamera& operator=(const LookAtCamera &other) {
|
||||
mViewMtx.copyFrom(other.mViewMtx);
|
||||
mOtherMtx.copyFrom(other.mOtherMtx);
|
||||
mPos = other.mPos;
|
||||
mAt = other.mAt;
|
||||
mUp = other.mUp;
|
||||
return *this;
|
||||
}
|
||||
// Which way around?
|
||||
virtual Matrix34f &getViewMatrix() override {
|
||||
return mViewMtx;
|
||||
@@ -53,7 +62,15 @@ public:
|
||||
virtual void doDraw() override;
|
||||
virtual Matrix34f &getViewMatrixOld() override;
|
||||
|
||||
protected:
|
||||
Vector3f getDirection() const {
|
||||
return mAt - mPos;
|
||||
}
|
||||
|
||||
Vector3f getOtherDirection() const {
|
||||
return mPos - mAt;
|
||||
}
|
||||
|
||||
public:
|
||||
/* 0x64 */ Vector3f mPos;
|
||||
/* 0x70 */ Vector3f mAt;
|
||||
/* 0x7C */ Vector3f mUp;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "common.h"
|
||||
#include "egg/math/eggQuat.h"
|
||||
#include "egg/math/eggVector.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
|
||||
namespace EGG {
|
||||
|
||||
@@ -55,6 +56,14 @@ struct Matrix34f {
|
||||
void multiplyTo(const Matrix34f &m2, Matrix34f &to) const;
|
||||
void dump();
|
||||
|
||||
operator nw4r::math::MTX34 *() {
|
||||
return (nw4r::math::MTX34 *)this;
|
||||
}
|
||||
|
||||
operator const nw4r::math::MTX34 *() const {
|
||||
return (nw4r::math::MTX34 *)this;
|
||||
}
|
||||
|
||||
public:
|
||||
void concat(const Matrix34f &, Matrix34f &) const;
|
||||
void rotate(const Vector3f &rpy) const;
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
#define NW4R_LYT_LAYOUT_H
|
||||
|
||||
#include "common.h"
|
||||
#include "new.h"
|
||||
#include "nw4r/lyt/lyt_animation.h"
|
||||
#include "nw4r/lyt/lyt_types.h"
|
||||
#include "rvl/MEM/mem_allocator.h"
|
||||
|
||||
#include <new>
|
||||
|
||||
namespace nw4r {
|
||||
namespace lyt {
|
||||
|
||||
@@ -327,40 +327,40 @@ namespace nw4r { namespace snd { namespace detail
|
||||
ExternalSoundPlayer *mExtSoundPlayer; // size 0x04, offset 0x18
|
||||
AmbientInfo mAmbientInfo; // size 0x14, offset 0x1c
|
||||
SoundParam mAmbientParam; // size 0x24, offset 0x30
|
||||
SoundActorParam mActorParam; // size 0x0c, offset 0x54
|
||||
MoveValue<f32, int> mFadeVolume; // size 0x10, offset 0x60
|
||||
MoveValue<f32, int> mPauseFadeVolume; // size 0x10, offset 0x70
|
||||
bool mStartFlag; // size 0x01, offset 0x80
|
||||
bool mStartedFlag; // size 0x01, offset 0x81
|
||||
bool mAutoStopFlag; // size 0x01, offset 0x82
|
||||
bool mFadeOutFlag; // size 0x01, offset 0x83
|
||||
PauseState mPauseState; // size 0x04, offset 0x84
|
||||
bool mUnPauseFlag; // size 0x01, offset 0x88
|
||||
SoundActorParam mActorParam; // size 0x0c, offset 0x58
|
||||
MoveValue<f32, int> mFadeVolume; // size 0x10, offset 0x64
|
||||
MoveValue<f32, int> mPauseFadeVolume; // size 0x10, offset 0x74
|
||||
bool mStartFlag; // size 0x01, offset 0x84
|
||||
bool mStartedFlag; // size 0x01, offset 0x85
|
||||
bool mAutoStopFlag; // size 0x01, offset 0x86
|
||||
bool mFadeOutFlag; // size 0x01, offset 0x87
|
||||
PauseState mPauseState; // size 0x04, offset 0x88
|
||||
bool mUnPauseFlag; // size 0x01, offset 0x8c
|
||||
/* 3 bytes padding */
|
||||
s32 mAutoStopCounter; // size 0x04, offset 0x8c
|
||||
u32 mUpdateCounter; // size 0x04, offset 0x90
|
||||
u8 mPriority; // size 0x01, offset 0x94
|
||||
u8 mVoiceOutCount; // size 0x01, offset 0x95
|
||||
u8 mBiquadFilterType; // size 0x01, offset 0x96
|
||||
s32 mAutoStopCounter; // size 0x04, offset 0x90
|
||||
u32 mUpdateCounter; // size 0x04, offset 0x94
|
||||
u8 mPriority; // size 0x01, offset 0x98
|
||||
u8 mVoiceOutCount; // size 0x01, offset 0x99
|
||||
u8 mBiquadFilterType; // size 0x01, offset 0x9a
|
||||
/* 1 byte padding */
|
||||
u32 mId; // size 0x04, offset 0x98
|
||||
MoveValue<f32, int> mExtMoveVolume; // size 0x10, offset 0x9c
|
||||
f32 mInitVolume; // size 0x04, offset 0xac
|
||||
f32 mExtPan; // size 0x04, offset 0xb0
|
||||
f32 mExtSurroundPan; // size 0x04, offset 0xb4
|
||||
f32 mExtPitch; // size 0x04, offset 0xb8
|
||||
f32 mLpfFreq; // size 0x04, offset 0xbc
|
||||
f32 mBiquadFilterValue; // size 0x04, offset 0xc0
|
||||
int mOutputLineFlag; // size 0x04, offset 0xc4
|
||||
f32 mMainOutVolume; // size 0x04, offset 0xc8
|
||||
f32 mMainSend; // size 0x04, offset 0xcc
|
||||
f32 mFxSend[AUX_BUS_NUM]; // size 0x0c, offset 0xd0
|
||||
f32 mRemoteOutVolume[4]; // size 0x10, offset 0xdc
|
||||
u32 mId; // size 0x04, offset 0x9c
|
||||
MoveValue<f32, int> mExtMoveVolume; // size 0x10, offset 0xa0
|
||||
f32 mInitVolume; // size 0x04, offset 0xb0
|
||||
f32 mExtPan; // size 0x04, offset 0xb4
|
||||
f32 mExtSurroundPan; // size 0x04, offset 0xb8
|
||||
f32 mExtPitch; // size 0x04, offset 0xbc
|
||||
f32 mLpfFreq; // size 0x04, offset 0xc0
|
||||
f32 mBiquadFilterValue; // size 0x04, offset 0xc4
|
||||
int mOutputLineFlag; // size 0x04, offset 0xc8
|
||||
f32 mMainOutVolume; // size 0x04, offset 0xcc
|
||||
f32 mMainSend; // size 0x04, offset 0xd0
|
||||
f32 mFxSend[AUX_BUS_NUM]; // size 0x0c, offset 0xd4
|
||||
f32 mRemoteOutVolume[4]; // size 0x10, offset 0xe0
|
||||
public:
|
||||
ut::LinkListNode mPriorityLink; // size 0x08, offset 0xe0
|
||||
ut::LinkListNode mSoundPlayerPlayLink; // size 0x08, offset 0xe8
|
||||
ut::LinkListNode mSoundPlayerPriorityLink; // size 0x08, offset 0xf0
|
||||
ut::LinkListNode mExtSoundPlayerPlayLink; // size 0x08, offset 0xf8
|
||||
ut::LinkListNode mPriorityLink; // size 0x08, offset 0xf0
|
||||
ut::LinkListNode mSoundPlayerPlayLink; // size 0x08, offset 0xf8
|
||||
ut::LinkListNode mSoundPlayerPriorityLink; // size 0x08, offset 0x100
|
||||
ut::LinkListNode mExtSoundPlayerPlayLink; // size 0x08, offset 0x108
|
||||
|
||||
// friends
|
||||
private:
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "common.h" // nullptr
|
||||
|
||||
#include "nw4r/snd/snd_SeqSound.h"
|
||||
#include "nw4r/snd/snd_SeqTrack.h"
|
||||
#include "nw4r/ut/ut_NonCopyable.h" // ut::NonCopyable
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -29,6 +30,7 @@ namespace nw4r { namespace snd
|
||||
// methods
|
||||
public:
|
||||
SeqSoundHandle(SoundHandle*);
|
||||
~SeqSoundHandle() { DetachSound(); }
|
||||
// methods
|
||||
bool IsAttachedSound() const { return mSound != nullptr; }
|
||||
|
||||
@@ -39,6 +41,26 @@ namespace nw4r { namespace snd
|
||||
mSound->WriteVariable(varNo, value);
|
||||
}
|
||||
|
||||
void ReadVariable(int varNo, s16 *value) {
|
||||
if (IsAttachedSound())
|
||||
mSound->ReadVariable(varNo, value);
|
||||
}
|
||||
|
||||
void SetTrackMute(u32 trackFlags, SeqMute mute) {
|
||||
if (IsAttachedSound())
|
||||
mSound->SetTrackMute(trackFlags, mute);
|
||||
}
|
||||
|
||||
void SetTempoRatio(f32 tempoRatio) {
|
||||
if (IsAttachedSound())
|
||||
mSound->SetTempoRatio(tempoRatio);
|
||||
}
|
||||
|
||||
void SetVolume(u32 trackFlags, f32 volume) {
|
||||
if (IsAttachedSound())
|
||||
mSound->SetTrackVolume(trackFlags, volume);
|
||||
}
|
||||
|
||||
// members
|
||||
private:
|
||||
/* base ut::NonCopyable */ // size 0x00, offset 0x00
|
||||
|
||||
@@ -21,8 +21,15 @@ public:
|
||||
// AmbientArgUpdateCallback
|
||||
virtual void at_0x0c(void *arg, detail::BasicSound* sound) override;
|
||||
|
||||
const nw4r::math::VEC3 &GetPosition() const {
|
||||
return mPosition;
|
||||
}
|
||||
void SetPosition(const math::VEC3 &rPosition);
|
||||
|
||||
void SetUserParam(u32 userParam) {
|
||||
mUserParam = userParam;
|
||||
}
|
||||
|
||||
private:
|
||||
static void ClearUpdateCallback(SoundHandle &rHandle);
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
virtual void UpdateAmbientParam(const Sound3DManager*, const Sound3DParam*, u32, int, SoundAmbientParam*);
|
||||
virtual s32 GetAmbientPriority(const Sound3DManager*, const Sound3DParam*, u32);
|
||||
virtual s32 GetRequiredVoiceOutCount(const Sound3DManager*, const Sound3DParam*, u32);
|
||||
virtual void UpdateAmbientParam(const Sound3DManager*, const Sound3DParam*, u32, u32, SoundAmbientParam*);
|
||||
virtual void UpdateAmbientParam(const Sound3DManager*, const Sound3DParam*, u32, u32 flags, SoundAmbientParam*);
|
||||
|
||||
private:
|
||||
Sound3DCalculator::CalcPanParam mPanParam; // at 0x04
|
||||
|
||||
@@ -68,10 +68,18 @@ public:
|
||||
return field_0x20;
|
||||
}
|
||||
|
||||
void SetField0x20(f32 value) {
|
||||
field_0x20 = value;
|
||||
}
|
||||
|
||||
f32 GetField0x24() const {
|
||||
return field_0x24;
|
||||
}
|
||||
|
||||
void SetField0x24(f32 value) {
|
||||
field_0x24 = value;
|
||||
}
|
||||
|
||||
void SetEngine(Sound3DEngine *engine);
|
||||
|
||||
enum ParamDecayCurve {
|
||||
|
||||
@@ -34,9 +34,46 @@ namespace nw4r { namespace snd
|
||||
const detail::BasicSound *detail_GetAttachedSound() const { return mSound; }
|
||||
void DetachSound();
|
||||
|
||||
void Stop() {
|
||||
|
||||
void FadeIn(int fadeFrames) {
|
||||
if (IsAttachedSound())
|
||||
mSound->Stop(0);
|
||||
mSound->FadeIn(fadeFrames);
|
||||
}
|
||||
|
||||
void SetVolume(f32 volume, int frames) {
|
||||
if (IsAttachedSound())
|
||||
mSound->SetVolume(volume, frames);
|
||||
}
|
||||
|
||||
void SetPitch(f32 volume) {
|
||||
if (IsAttachedSound())
|
||||
mSound->SetPitch(volume);
|
||||
}
|
||||
|
||||
void Stop(int fadeFrames) {
|
||||
if (IsAttachedSound())
|
||||
mSound->Stop(fadeFrames);
|
||||
}
|
||||
|
||||
void Pause(bool flag, int fadeFrames) {
|
||||
if (IsAttachedSound())
|
||||
mSound->Pause(flag, fadeFrames);
|
||||
}
|
||||
|
||||
void SetPan(f32 pan) {
|
||||
if (IsAttachedSound())
|
||||
mSound->SetPan(pan);
|
||||
}
|
||||
|
||||
bool IsPause() const {
|
||||
return IsAttachedSound() && mSound->IsPause();
|
||||
}
|
||||
|
||||
int GetRemainingFadeFrames() const {
|
||||
if (IsAttachedSound())
|
||||
return mSound->GetRemainingFadeFrames();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 GetId() const
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "nw4r/snd/snd_BasicSound.h"
|
||||
#include "nw4r/snd/snd_global.h" // AUX_BUS_NUM
|
||||
#include "nw4r/snd/snd_PlayerHeap.h"
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
|
||||
/*******************************************************************************
|
||||
* classes
|
||||
@@ -69,6 +70,35 @@ namespace nw4r { namespace snd
|
||||
void detail_FreePlayerHeap(detail::BasicSound *sound);
|
||||
void detail_AppendPlayerHeap(detail::PlayerHeap *heap);
|
||||
|
||||
// Apparently exists, needed in d/snd
|
||||
template <typename TForEachFunc>
|
||||
TForEachFunc ForEachSound(TForEachFunc pFunc, bool reverse) {
|
||||
if (reverse) {
|
||||
detail::BasicSound::SoundPlayerPlayLinkList::ReverseIterator it = mSoundList.GetBeginReverseIter();
|
||||
|
||||
while (it != mSoundList.GetEndReverseIter()) {
|
||||
detail::BasicSound::SoundPlayerPlayLinkList::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;
|
||||
}
|
||||
|
||||
// members
|
||||
private:
|
||||
detail::BasicSound::SoundPlayerPlayLinkList mSoundList; // size 0x0c, offset 0x00
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace nw4r { namespace snd
|
||||
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x27291
|
||||
struct StartInfo
|
||||
{
|
||||
StartInfo() : enableFlag(0) {}
|
||||
// enums
|
||||
public:
|
||||
enum EnableFlag
|
||||
@@ -76,6 +77,7 @@ namespace nw4r { namespace snd
|
||||
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x27208
|
||||
struct SeqSoundInfo
|
||||
{
|
||||
SeqSoundInfo() : seqDataAddress(NULL), startLocationLabel(NULL) {}
|
||||
void *seqDataAddress; // size 0x04, offset 0x00
|
||||
char const *startLocationLabel; // size 0x04, offset 0x04
|
||||
}; // size 0x08
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "common.h" // nullptr
|
||||
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
#include "nw4r/snd/snd_StrmSound.h"
|
||||
#include "nw4r/ut/ut_NonCopyable.h" // ut::NonCopyable
|
||||
|
||||
/*******************************************************************************
|
||||
@@ -30,10 +31,16 @@ namespace nw4r { namespace snd
|
||||
public:
|
||||
// methods
|
||||
StrmSoundHandle(SoundHandle*);
|
||||
~StrmSoundHandle() { DetachSound(); }
|
||||
bool IsAttachedSound() const { return mSound != nullptr; }
|
||||
|
||||
void DetachSound();
|
||||
|
||||
void SetVolume(u32 trackFlags, f32 volume, int fadeFrames) {
|
||||
if (IsAttachedSound())
|
||||
mSound->SetTrackVolume(trackFlags, volume, fadeFrames);
|
||||
}
|
||||
|
||||
// members
|
||||
private:
|
||||
/* base NonCopyable */ // size 0x00, offset 0x00
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "common.h"
|
||||
#include "string.h"
|
||||
#include "wstring.h"
|
||||
#include "printf.h"
|
||||
|
||||
extern "C" bool strequals(const char *a, const char *b);
|
||||
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#ifndef SOUND_AUDIO_MANAGER_H
|
||||
#define SOUND_AUDIO_MANAGER_H
|
||||
|
||||
#include "common.h"
|
||||
#include "egg/audio/eggAudioMgr.h"
|
||||
|
||||
|
||||
// Size: 0x6d0
|
||||
class SndAudioMgr : public EGG::SimpleAudioMgr {
|
||||
public:
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -3,55 +3,6 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
// TODO: Expand when we figure out what the other entries have in common
|
||||
enum SoundSourceType_e {
|
||||
// 0-1: Player (0)
|
||||
SND_SOURCE_PLAYER = 0,
|
||||
SND_SOURCE_PLAYER_HEAD = 1,
|
||||
|
||||
// 2-9: Equipment (1)
|
||||
SND_SOURCE_NET = 2,
|
||||
SND_SOURCE_BLADE = 3,
|
||||
SND_SOURCE_SHIELD = 4,
|
||||
SND_SOURCE_WHIP = 5,
|
||||
SND_SOURCE_BOOMERANG = 6,
|
||||
SND_SOURCE_ARROW = 7,
|
||||
SND_SOURCE_BOMB = 8,
|
||||
SND_SOURCE_HOOKSHOT = 9,
|
||||
|
||||
// 10-31: Enemy? (2)
|
||||
SND_SOURCE_BIGBOSS = 20,
|
||||
SND_SOURCE_GIRAHUMU_3 = 24,
|
||||
SND_SOURCE_BULLET = 29,
|
||||
|
||||
// 32-42: Object? (3)
|
||||
SND_SOURCE_OBJECT = 32,
|
||||
SND_SOURCE_BAMBOO = 34,
|
||||
SND_SOURCE_ITEM = 35,
|
||||
SND_SOURCE_TERRY_SHOP = 36,
|
||||
SND_SOURCE_TIME_STONE = 37,
|
||||
SND_SOURCE_CLEF = 38,
|
||||
SND_SOURCE_SHUTTER = 39,
|
||||
|
||||
// 43-52: Npc (4)
|
||||
SND_SOURCE_KENSEI = 44,
|
||||
SND_SOURCE_PLAYER_BIRD = 45,
|
||||
SND_SOURCE_INSECT = 49,
|
||||
SND_SOURCE_NPC_NRM = 51,
|
||||
SND_SOURCE_NPC_DRAGON = 52,
|
||||
|
||||
// 53: TagSound (5)
|
||||
SND_SOURCE_TG_SOUND = 53,
|
||||
|
||||
// 54-57: Harp Related (6)
|
||||
SND_SOURCE_OBJECT_WARP = 55,
|
||||
SND_SOURCE_SW_HARP = 56,
|
||||
|
||||
// 58: ? (7)
|
||||
|
||||
// 59: ? (9)
|
||||
};
|
||||
|
||||
/**
|
||||
* profileId and profileId2 are always the same.
|
||||
*/
|
||||
|
||||
@@ -91,14 +91,14 @@ public:
|
||||
return create2(ac, mdlFile, mdlName, anmName, callback, bufferOption);
|
||||
}
|
||||
|
||||
void setSoundSource(SoundSource *pSource);
|
||||
void setSoundSource(dSoundSourceIf_c *pSource);
|
||||
|
||||
protected:
|
||||
bool loadSounds(const char *name);
|
||||
void syncAnmFrame();
|
||||
void setSoundRate(f32 rate);
|
||||
|
||||
/* 0x68 */ SoundSource *mpSoundSource;
|
||||
/* 0x68 */ dSoundSourceIf_c *mpSoundSource;
|
||||
/* 0x6C */ void *mpSoundData;
|
||||
};
|
||||
|
||||
|
||||
@@ -2,16 +2,21 @@
|
||||
#define MUSIC_MGRS_H
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_player_mgr.h"
|
||||
#include "d/snd/d_snd_source_mgr.h"
|
||||
|
||||
class BgmMgr;
|
||||
class dSndPlayerMgr_c;
|
||||
class dSndSound_c;
|
||||
|
||||
extern "C" BgmMgr *BGM_MGR;
|
||||
// A lot of these names are and were guesses that are probably wrong in a lot of ways.
|
||||
|
||||
#define BGM_MGR (dSndPlayerMgr_c::GetInstance())
|
||||
extern "C" void fn_8035E000();
|
||||
extern "C" void fn_8035E860(BgmMgr *);
|
||||
extern "C" void fn_8035E310(BgmMgr *);
|
||||
extern "C" void fn_8035E820(BgmMgr *);
|
||||
extern "C" void fn_8035E880(BgmMgr *);
|
||||
extern "C" void fn_8035E790(BgmMgr *, UNKWORD, void *);
|
||||
extern "C" void fn_8035E860(dSndPlayerMgr_c *);
|
||||
extern "C" void fn_8035E310(dSndPlayerMgr_c *);
|
||||
extern "C" void fn_8035E820(dSndPlayerMgr_c *);
|
||||
extern "C" void fn_8035E880(dSndPlayerMgr_c *);
|
||||
extern "C" void fn_8035E790(dSndPlayerMgr_c *, UNKWORD, void *);
|
||||
|
||||
extern "C" void *ENEMY_SOUND_MGR;
|
||||
extern "C" void fn_80362150(void *, u16);
|
||||
@@ -21,12 +26,25 @@ extern "C" void fn_80362730(void *);
|
||||
extern "C" void fn_80365D20(void *);
|
||||
extern "C" void fn_803624F0(void *);
|
||||
extern "C" void fn_80364FD0(void *, s32);
|
||||
extern "C" bool fn_80364DA0(void *);
|
||||
extern "C" void fn_80365020(void *);
|
||||
extern "C" void fn_80364D00(void *, s32);
|
||||
|
||||
extern "C" void *ENEMY_BGM_RELATED_MGR;
|
||||
extern "C" void fn_80384570(void *, bool);
|
||||
extern "C" void fn_803858D0(void *);
|
||||
#define ENEMY_BGM_RELATED_MGR (dSndSourceMgr_c::GetInstance())
|
||||
extern "C" void fn_80384570(dSndSourceMgr_c *, bool);
|
||||
|
||||
// This one has a SoundActor that actually plays the BGM_ music tracks,
|
||||
// including the battle BGM track.
|
||||
extern "C" void *FANFARE_SOUND_MGR;
|
||||
extern "C" void AnotherSoundMgr__playSound(void *, s32);
|
||||
extern "C" bool fn_803721F0(void *, u32);
|
||||
extern "C" bool fn_803720E0(void *, u32);
|
||||
extern "C" bool fn_80372070(void *, u32);
|
||||
extern "C" bool fn_803734C0(void *, u32);
|
||||
extern "C" bool fn_80373550(void *, u32);
|
||||
extern "C" void fn_80372920(void *);
|
||||
extern "C" void fn_803738B0(void *, dSndSound_c *sound);
|
||||
extern "C" void fn_80373900(void *, dSndSound_c *sound);
|
||||
extern "C" bool fn_803733B0(void*, u32);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -66,5 +66,12 @@ inline float sqrtf(float x) {
|
||||
|
||||
} // namespace std
|
||||
|
||||
#define _HUGE_ENUF 1e+300
|
||||
#define INFINITY ((float)(_HUGE_ENUF * _HUGE_ENUF))
|
||||
#define HUGE_VAL ((double)INFINITY)
|
||||
#define HUGE_VALL ((long double)INFINITY)
|
||||
|
||||
#define DOUBLE_INF HUGE_VAL
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#include "d/col/bg/d_bg_s.h"
|
||||
#include "d/col/bg/d_bg_s_lin_chk.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
#include "d/snd/d_snd_wzsound.h"
|
||||
#include "m/m_mtx.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
#include "toBeSorted/time_area_mgr.h"
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(BOMBF, dAcBombf_c, fProfile::BOMBF, 0x129, 0, 4099);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "d/d_sc_game.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
#include "d/flag/storyflag_manager.h"
|
||||
#include "d/snd/d_snd_wzsound.h"
|
||||
#include "f/f_base.h"
|
||||
#include "f/f_profile_name.h"
|
||||
#include "m/m3d/m_fanm.h"
|
||||
@@ -38,7 +39,6 @@
|
||||
#include "s/s_Math.h"
|
||||
#include "toBeSorted/blur_and_palette_manager.h"
|
||||
#include "toBeSorted/d_emitter.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
#include "toBeSorted/time_area_mgr.h"
|
||||
|
||||
#include <cmath.h>
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
#include "d/a/obj/d_a_obj_tower_D101.h"
|
||||
#include "d/col/bg/d_bg_s_wtr_chk.h"
|
||||
#include "d/d_stage.h"
|
||||
#include "d/snd/d_snd_wzsound.h"
|
||||
#include "f/f_base.h"
|
||||
#include "f/f_manager.h"
|
||||
#include "f/f_profile_name.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/g3d/res/g3d_resmdl.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(OBJ_TOWER_GEAR_D101, dAcOTowerGearD101_c, fProfile::OBJ_TOWER_GEAR_D101, 0x17E, 0, 7);
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "d/d_linkage.h"
|
||||
#include "d/flag/dungeonflag_manager.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
#include "d/snd/d_snd_wzsound.h"
|
||||
#include "egg/math/eggMath.h"
|
||||
#include "f/f_manager.h"
|
||||
#include "f/f_profile_name.h"
|
||||
@@ -34,7 +35,6 @@
|
||||
#include "toBeSorted/blur_and_palette_manager.h"
|
||||
#include "toBeSorted/d_emitter.h"
|
||||
#include "toBeSorted/event_manager.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
#include "toBeSorted/special_item_drop_mgr.h"
|
||||
|
||||
void float_ordering() {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "d/col/c/c_m3d_g_pla.h"
|
||||
#include "d/col/cc/d_cc_d.h"
|
||||
#include "d/col/cc/d_cc_s.h"
|
||||
#include "d/snd/d_snd_wzsound.h"
|
||||
#include "egg/math/eggMath.h"
|
||||
#include "egg/math/eggQuat.h"
|
||||
#include "m/m_angle.h"
|
||||
@@ -20,8 +21,6 @@
|
||||
#include "toBeSorted/blur_and_palette_manager.h"
|
||||
#include "toBeSorted/d_emitter.h"
|
||||
#include "toBeSorted/dowsing_target.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
|
||||
void float_ordering() {
|
||||
const f32 arr[] = {5.f, 15.f, 7.f, 0.5f, 0.1f};
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
#include "d/d_pouch.h"
|
||||
#include "d/d_sc_game.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "m/m_angle.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(TAG_REACTION, dTgReaction_c, fProfile::TAG_REACTION, 0x0151, 0, 0);
|
||||
|
||||
@@ -172,7 +172,7 @@ void dTgReaction_c::checkForBonkItem() {
|
||||
if (dAcObjBase_c::create(fProfile::ITEM, roomid, newItemParms, &c2, nullptr, nullptr, 0xFFFFFFFF)) {
|
||||
field_0x4DD = 1;
|
||||
onDelete();
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_READ_RIDDLE_A);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_READ_RIDDLE_A);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -194,7 +194,7 @@ void dTgReaction_c::checkForBonkItem() {
|
||||
|
||||
pos.y += field_0x4E4;
|
||||
if (fn_578_DB0(pos, uVar3)) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_READ_RIDDLE_B);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_READ_RIDDLE_B);
|
||||
}
|
||||
SceneflagManager::sInstance->setFlag(roomid, getSceneFlag());
|
||||
onDelete();
|
||||
@@ -228,7 +228,7 @@ void dTgReaction_c::checkForSlingBellowsItem() {
|
||||
mVec3_c spawnPos = position;
|
||||
spawnPos.y += field_0x4E4;
|
||||
if (fn_578_DB0(spawnPos, uVar3)) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_READ_RIDDLE_B);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_READ_RIDDLE_B);
|
||||
}
|
||||
SceneflagManager::sInstance->setFlag(roomid, getSceneFlag());
|
||||
onDelete();
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "d/a/d_a_player.h"
|
||||
#include "d/a/obj/d_a_obj_base.h"
|
||||
#include "d/col/c/c_m3d_g_cps.h"
|
||||
#include "d/snd/d_snd_3d_manager.h"
|
||||
#include "d/t/d_t_sound_area_mgr.h"
|
||||
#include "rvl/MTX.h" // IWYU pragma: export
|
||||
|
||||
@@ -45,20 +46,13 @@ int dTgSndAr_c::doDelete() {
|
||||
return SUCCEEDED;
|
||||
}
|
||||
|
||||
struct Unk {
|
||||
u8 unk[0x144];
|
||||
mVec3_c v;
|
||||
};
|
||||
|
||||
extern Unk *lbl_80575D58;
|
||||
|
||||
int dTgSndAr_c::actorExecute() {
|
||||
dAcBase_c *link = dAcPy_c::LINK;
|
||||
if (link != nullptr && checkPosInArea(link->position)) {
|
||||
link->setBit_field_0xE8(params & 0xFF);
|
||||
}
|
||||
if (lbl_80575D58 != nullptr) {
|
||||
mVec3_c pos = lbl_80575D58->v;
|
||||
if (dSnd3DManager_c::GetInstance() != nullptr) {
|
||||
mVec3_c pos = dSnd3DManager_c::GetInstance()->getCameraTargetPos();
|
||||
if (checkPosInArea(pos) && dTgSndMg_c::GetInstance() != nullptr) {
|
||||
dTgSndMg_c::GetInstance()->setBgmFlag(params & 0xFF);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ dAcBase_c *dAcBase_c::s_Create_Parent;
|
||||
const ActorInfo *dAcBase_c::s_Create_ActorInfo;
|
||||
u8 dAcBase_c::s_Create_Subtype;
|
||||
|
||||
extern "C" SoundSource *soundForActorInitRelated_803889c0(s8, fBase_c *, const char *, u8);
|
||||
extern "C" dSoundSourceIf_c *soundForActorInitRelated_803889c0(s8, fBase_c *, const char *, u8);
|
||||
|
||||
bool dAcBase_c::createHeap() {
|
||||
return true;
|
||||
@@ -110,7 +110,7 @@ void dAcBase_c::setTempCreateParams(
|
||||
s_Create_ActorInfo = actorInfo;
|
||||
}
|
||||
|
||||
SoundSource *dAcBase_c::createSoundSource() {
|
||||
dSoundSourceIf_c *dAcBase_c::createSoundSource() {
|
||||
if (mpActorInfo == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -512,7 +512,7 @@ void dAcBase_c::FUN_8002d830() {}
|
||||
void dAcBase_c::FUN_8002d860(UNKWORD) {}
|
||||
|
||||
// 8002d880
|
||||
SoundSource *dAcBase_c::getSoundSource() {
|
||||
dSoundSourceIf_c *dAcBase_c::getSoundSource() {
|
||||
return sound_source.get();
|
||||
}
|
||||
// End of SoundSource stuff
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
#include "d/col/bg/d_bg_w_base.h"
|
||||
#include "d/col/c/c_cc_d.h"
|
||||
#include "d/col/c/c_m3d_g_pla.h"
|
||||
#include "d/snd/d_snd_wzsound.h"
|
||||
#include "m/m_angle.h"
|
||||
#include "m/m_mtx.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "toBeSorted/attention.h"
|
||||
#include "toBeSorted/d_emitter.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
void dAcOInsect_c::kill() {
|
||||
dJEffManager_c::spawnEffect(PARTICLE_RESOURCE_ID_MAPPING_394_, position, nullptr, nullptr, nullptr, nullptr, 0, 0);
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
#include "d/d_linkage.h"
|
||||
#include "d/d_rumble.h"
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
#include "d/snd/d_snd_wzsound.h"
|
||||
#include "nw4r/g3d/res/g3d_resfile.h"
|
||||
#include "s/s_Math.h"
|
||||
#include "toBeSorted/d_emitter.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(OBJ_SW, dAcOsw_c, fProfile::OBJ_SW, 0x12B, 0, 0x1002);
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "d/flag/sceneflag_manager.h"
|
||||
#include "d/flag/storyflag_manager.h"
|
||||
#include "d/flag/tboxflag_manager.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "d/t/d_t_siren.h"
|
||||
#include "m/m3d/m_fanm.h"
|
||||
#include "m/m3d/m_scnleaf.h"
|
||||
@@ -35,7 +36,6 @@
|
||||
#include "toBeSorted/counters/goddess_chest_counter.h"
|
||||
#include "toBeSorted/dowsing_target.h"
|
||||
#include "toBeSorted/event_manager.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
SPECIAL_ACTOR_PROFILE(TBOX, dAcTbox_c, fProfile::TBOX, 0x018D, 0, 6);
|
||||
|
||||
@@ -1781,7 +1781,7 @@ void dAcTbox_c::executeState_DemoAppear() {
|
||||
if (isStop && mAnmMatClr1.isStop(0) && field_0x11F8 > 0x5A) {
|
||||
mEvent.advanceNext();
|
||||
mStateMgr.changeState(StateID_WaitOpen);
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_READ_RIDDLE_A);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_READ_RIDDLE_A);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -3,9 +3,9 @@
|
||||
#include "d/d_cs_base.h"
|
||||
#include "d/d_cursor_hit_check.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "f/f_base.h"
|
||||
#include "toBeSorted/arc_managers/layout_arc_manager.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
SPECIAL_BASE_PROFILE(C_GAME, dCsGame_c, fProfile::C_GAME, 0x2BF, 0x06F9);
|
||||
|
||||
@@ -407,7 +407,7 @@ void dCsGame_c::lytItemCursor_c::lytBowCsr_c::executeState_Charge() {
|
||||
if (!mAnm[MAIN_ANIM_ARROW_PEAK].isEnabled()) {
|
||||
mAnm[MAIN_ANIM_ARROW_PEAK].setAnimEnable(true);
|
||||
mAnm[MAIN_ANIM_ARROW_PEAK].setFrame(0.0f);
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_BW_ALIGN_SIGHT);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_BW_ALIGN_SIGHT);
|
||||
}
|
||||
mAnm[MAIN_ANIM_ARROW_KEEP].setAnimEnable(false);
|
||||
} else {
|
||||
|
||||
+4
-3
@@ -22,6 +22,8 @@
|
||||
#include "d/lyt/d_lyt_mini_game.h"
|
||||
#include "d/lyt/meter/d_lyt_meter.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "d/snd/d_snd_source_mgr.h"
|
||||
#include "egg/core/eggHeap.h"
|
||||
#include "f/f_base.h"
|
||||
#include "f/f_profile.h"
|
||||
@@ -38,7 +40,6 @@
|
||||
#include "toBeSorted/file_manager.h"
|
||||
#include "toBeSorted/minigame_mgr.h"
|
||||
#include "toBeSorted/music_mgrs.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
#include "toBeSorted/unk_save_time.h"
|
||||
|
||||
#include "rvl/OS.h"
|
||||
@@ -198,7 +199,7 @@ void dFlow_c::playSound(u32 params) {
|
||||
return;
|
||||
}
|
||||
if (params >= 100) {
|
||||
fn_803858D0(ENEMY_BGM_RELATED_MGR);
|
||||
dSndSourceMgr_c::GetInstance()->playFlowSound(params);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -216,7 +217,7 @@ void dFlow_c::playSound(u32 params) {
|
||||
|
||||
switch (sSoundDefs[idx].mSoundMgr) {
|
||||
case 0: AnotherSoundMgr__playSound(FANFARE_SOUND_MGR, sSoundDefs[idx].mSoundId); break;
|
||||
case 1: SmallSoundManager::GetInstance()->playSound(sSoundDefs[idx].mSoundId); break;
|
||||
case 1: dSndSmallEffectMgr_c::GetInstance()->playSound(sSoundDefs[idx].mSoundId); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -631,7 +631,7 @@ bool daPlBaseMdl_c::create(
|
||||
field_0x58 = 0;
|
||||
mpSoundData = nullptr;
|
||||
field_0x5A = 0xFFFF;
|
||||
SoundSource *sound = player->getSoundSource();
|
||||
dSoundSourceIf_c *sound = player->getSoundSource();
|
||||
if (sound->isReadyMaybe()) {
|
||||
sound->load(nullptr, "");
|
||||
}
|
||||
@@ -1772,7 +1772,7 @@ void daPlayerModelBase_c::removeAnmChr(s32 childIdx) {
|
||||
}
|
||||
|
||||
void daPlayerModelBase_c::loadSound(nw4r::g3d::ResFile &file, const char *name, s32 childIdx) {
|
||||
SoundSource *s = getSoundSource();
|
||||
dSoundSourceIf_c *s = getSoundSource();
|
||||
mCurrentAnmChrIdx = childIdx;
|
||||
SizedString<64> path;
|
||||
path.sprintf("%s.brasd", name);
|
||||
@@ -1785,7 +1785,7 @@ void daPlayerModelBase_c::loadSound(nw4r::g3d::ResFile &file, const char *name,
|
||||
}
|
||||
|
||||
void daPlayerModelBase_c::loadSoundForAnim(s32 childIdx) {
|
||||
SoundSource *s = getSoundSource();
|
||||
dSoundSourceIf_c *s = getSoundSource();
|
||||
s32 anim = mAnimations[childIdx];
|
||||
mCurrentAnmChrIdx = childIdx;
|
||||
if (anim != mMainMdl.getField_0x5A()) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "d/lyt/d_lyt_bird_gauge.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
|
||||
STATE_DEFINE(dLytBirdGaugeMain_c, ModeNone);
|
||||
STATE_DEFINE(dLytBirdGaugeMain_c, ModeIn);
|
||||
@@ -181,7 +181,7 @@ void dLytBirdGaugeMain_c::changeToRecovery() {
|
||||
mAnmGroups[LYT_SKY_GAUGE_MAIN_ANIM_RECOVERY + mNumDisplayedDashes].setAnimEnable(true);
|
||||
mAnmGroups[LYT_SKY_GAUGE_MAIN_ANIM_RECOVERY + mNumDisplayedDashes].setFrame(0.0f);
|
||||
mLyt.calc();
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_BIRD_RECOVER);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_BIRD_RECOVER);
|
||||
mStateMgr.changeState(StateID_ModeRecovery);
|
||||
mIsAnimating = false;
|
||||
mNumDisplayedDashes++;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "common.h"
|
||||
#include "d/d_sys.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
|
||||
static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
{ "aBtn_00_in.brlan", "G_inOut_00"},
|
||||
@@ -186,9 +186,9 @@ void dLytCommonABtn_c::goToStateDecideOut() {
|
||||
anm.setRate(1.0f);
|
||||
}
|
||||
if (mSoundVariant == VARIANT_NORMAL) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_WINDOW_PRESS_A);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_WINDOW_PRESS_A);
|
||||
} else {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_TITLE_PRESS_START);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_TITLE_PRESS_START);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
#include "d/d_cs_base.h"
|
||||
#include "d/d_cursor_hit_check.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "rvl/MTX/mtx.h"
|
||||
#include "toBeSorted/arc_managers/layout_arc_manager.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
STATE_DEFINE(dLytCommonArrow_c, None);
|
||||
STATE_DEFINE(dLytCommonArrow_c, In);
|
||||
@@ -262,9 +262,9 @@ void dLytCommonArrow_c::executeState_Wait() {
|
||||
if (field_0x6C0 != 2) {
|
||||
displayElement(field_0x6C0 + ANIM_DECIDE_OFFSET, 0.0f);
|
||||
if (field_0x6C0 == 0) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_MENU_SELECT_TURN_PAGE_LEFT);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_MENU_SELECT_TURN_PAGE_LEFT);
|
||||
} else {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_MENU_SELECT_TURN_PAGE_RIGHT);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_MENU_SELECT_TURN_PAGE_RIGHT);
|
||||
}
|
||||
mTimer++;
|
||||
}
|
||||
@@ -287,9 +287,9 @@ void dLytCommonArrow_c::executeState_Wait() {
|
||||
|
||||
if (field_0x6BC != field_0x6B8 && field_0x6B8 != 2) {
|
||||
if (field_0x6B8 == 0) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_MENU_POINT_TURN_PAGE_LEFT);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_MENU_POINT_TURN_PAGE_LEFT);
|
||||
} else {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_MENU_POINT_TURN_PAGE_RIGHT);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_MENU_POINT_TURN_PAGE_RIGHT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
#include "common.h"
|
||||
#include "d/a/d_a_player.h"
|
||||
#include "d/lyt/meter/d_lyt_meter.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "nw4r/lyt/lyt_pane.h"
|
||||
#include "nw4r/lyt/lyt_types.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
#include "sized_string.h"
|
||||
#include "toBeSorted/event_manager.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
struct DoButtonClass {
|
||||
DoButtonClass();
|
||||
@@ -639,7 +639,7 @@ void dLytDobutton_c::realize() {
|
||||
}
|
||||
|
||||
if (mDoActionToShow == ACT_DO_CATCH) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_CALL_BIRD_CATCH);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_CALL_BIRD_CATCH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "d/lyt/d_lyt_sky_gauge.h"
|
||||
#include "d/lyt/msg_window/d_lyt_msg_window.h"
|
||||
#include "d/lyt/msg_window/d_lyt_simple_window.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "f/f_manager.h"
|
||||
#include "f/f_profile_name.h"
|
||||
#include "m/m_vec.h"
|
||||
@@ -40,7 +41,6 @@
|
||||
#include "toBeSorted/event_manager.h"
|
||||
#include "toBeSorted/minigame_mgr.h"
|
||||
#include "toBeSorted/misc_actor.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
// clang-format on
|
||||
|
||||
static dLytMeterConfiguration_c sConf;
|
||||
@@ -207,7 +207,7 @@ bool dLytMeter1Button_c::execute() {
|
||||
if (mAnm[BUTTON_1_ANIM_CALL].isEnabled()) {
|
||||
mAnm[BUTTON_1_ANIM_CALL].play();
|
||||
if (meter->checkAllFlags(METER_BTN_1) && mCallCount < 3 && mAnm[BUTTON_1_ANIM_CALL].getFrame() == 1.0f) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_1_BUTTON_BLINK);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_1_BUTTON_BLINK);
|
||||
mCallCount++;
|
||||
}
|
||||
}
|
||||
@@ -384,7 +384,7 @@ bool dLytMeter2Button_c::execute() {
|
||||
if (mAnm[BUTTON_1_ANIM_CALL].isEnabled()) {
|
||||
mAnm[BUTTON_1_ANIM_CALL].play();
|
||||
if (meter->checkAllFlags(METER_BTN_2) && mCallCount < 3 && mAnm[BUTTON_1_ANIM_CALL].getFrame() == 1.0f) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_2_BUTTON_BLINK);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_2_BUTTON_BLINK);
|
||||
mCallCount++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_lyt_unknowns.h"
|
||||
#include "d/lyt/meter/d_lyt_meter.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "toBeSorted/event_manager.h"
|
||||
#include "toBeSorted/fi_context.h"
|
||||
#include "toBeSorted/misc_actor.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
STATE_DEFINE(dLytMeterCrossBtnParts_c, Wait);
|
||||
STATE_DEFINE(dLytMeterCrossBtnParts_c, On);
|
||||
@@ -504,7 +504,7 @@ bool dLytMeterCrossBtn_c::execute() {
|
||||
mAnm[CROSS_BTN_ANIM_CALL_0].play();
|
||||
if (mParts[CROSS_BTN_PART_DOWN].isActive() && mCallCount0 < 3 &&
|
||||
mAnm[CROSS_BTN_ANIM_CALL_0].getFrame() == 1.0f) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_SG_CALL);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SG_CALL);
|
||||
mCallCount0++;
|
||||
}
|
||||
}
|
||||
@@ -525,7 +525,7 @@ bool dLytMeterCrossBtn_c::execute() {
|
||||
mAnm[CROSS_BTN_ANIM_CALL_1].play();
|
||||
if (mParts[CROSS_BTN_PART_TOP].isActive() && mCallCount1 < 3 &&
|
||||
mAnm[CROSS_BTN_ANIM_CALL_1].getFrame() == 1.0f) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_CATAPULT_READY);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_CATAPULT_READY);
|
||||
mCallCount1++;
|
||||
}
|
||||
}
|
||||
@@ -546,7 +546,7 @@ bool dLytMeterCrossBtn_c::execute() {
|
||||
if (mAnm[CROSS_BTN_ANIM_CALL_2].isEnabled()) {
|
||||
mAnm[CROSS_BTN_ANIM_CALL_2].play();
|
||||
if (mParts[CROSS_BTN_PART_DOWN].isActive() && mAnm[CROSS_BTN_ANIM_CALL_2].getFrame() == 1.0f) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_BIRD_CALL);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_BIRD_CALL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "d/lyt/d_lyt_util_items.h"
|
||||
#include "d/lyt/d_window.h"
|
||||
#include "d/lyt/meter/d_lyt_meter.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/lyt/lyt_group.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
@@ -17,7 +18,6 @@
|
||||
#include "toBeSorted/d_emitter.h"
|
||||
#include "toBeSorted/dowsing_target.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
STATE_DEFINE(dLytMeterDowsingMenuIcon_c, Wait);
|
||||
STATE_DEFINE(dLytMeterDowsingMenuIcon_c, On);
|
||||
@@ -717,7 +717,7 @@ void dLytMeterDowsing_c::executeState_DemoMove() {
|
||||
nw4r::math::MTX34 mtx = mpPanes[idx]->GetGlobalMtx();
|
||||
mVec3_c pos(mtx._03, mtx._13, 0.0f);
|
||||
dJEffManager_c::spawnUIEffect(PARTICLE_RESOURCE_ID_MAPPING_970_, pos, nullptr, nullptr, nullptr, nullptr);
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_DOWSING_ADD);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_DOWSING_ADD);
|
||||
}
|
||||
} else if (mDemoFrame == 16) {
|
||||
for (int i = 0; i < DOWSING_NUM_ITEMS; i++) {
|
||||
@@ -1010,7 +1010,7 @@ bool dLytMeterDowsing_c::execute() {
|
||||
if (mAnm[DOWSING_ANIM_CALL].isEnabled()) {
|
||||
mAnm[DOWSING_ANIM_CALL].play();
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_C) && mAnm[DOWSING_ANIM_CALL].getFrame() == 1.0f) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_C_BUTTON_BLINK);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_C_BUTTON_BLINK);
|
||||
}
|
||||
}
|
||||
} else if (field_0x5509 == 1) {
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
#include "d/d_sc_game.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_lyt_game_over.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
#include "toBeSorted/d_emitter.h"
|
||||
#include "toBeSorted/event_manager.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
static const d2d::LytBrlanMapping brlanMap[] = {
|
||||
{ "heartAll_00_heat.brlan", "G_heart_00"},
|
||||
@@ -288,7 +288,7 @@ void dLytMeterHeart_c::executeInternal() {
|
||||
nw4r::math::MTX34 mtx = mpHeartPanes[mEffectHeartIdx]->GetGlobalMtx();
|
||||
mVec3_c pos(mtx._03, mtx._13, 0.0f);
|
||||
dJEffManager_c::spawnUIEffect(PARTICLE_RESOURCE_ID_MAPPING_972_, pos, nullptr, nullptr, nullptr, nullptr);
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_HEART_ADD);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_HEART_ADD);
|
||||
mEffectHeartIdx = -1;
|
||||
}
|
||||
|
||||
@@ -323,14 +323,14 @@ void dLytMeterHeart_c::executeInternal() {
|
||||
if (mpAlphaPane->IsVisible() && mpAlphaPane->GetGlobalAlpha() != 0 && mStoredHealth % 4 == 0 &&
|
||||
(!(dScGame_c::currentSpawnInfo.stageName == "F406") || dScGame_c::currentSpawnInfo.layer != 13) &&
|
||||
dLytGameOver_c::GetInstance() == nullptr) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_HP_GAUGE_UP);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_HP_GAUGE_UP);
|
||||
}
|
||||
} else {
|
||||
if (mStoredHealth - 1 >= current) {
|
||||
mStoredHealth = mStoredHealth - 1;
|
||||
if (EventManager::isInEvent() && !strcmp(EventManager::getCurrentEventName(), ("MoleF202Start")) &&
|
||||
mStoredHealth % 4 == 0) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_HP_GAUGE_DOWN);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_HP_GAUGE_DOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "d/lyt/d_lyt_do_button.h"
|
||||
#include "d/lyt/d_lyt_unknowns.h"
|
||||
#include "d/lyt/meter/d_lyt_meter.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/lyt/lyt_group.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
@@ -22,7 +23,6 @@
|
||||
#include "toBeSorted/event_manager.h"
|
||||
#include "toBeSorted/minigame_mgr.h"
|
||||
#include "toBeSorted/misc_actor.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
STATE_DEFINE(dLytMeterItemSelectIcon_c, Wait);
|
||||
STATE_DEFINE(dLytMeterItemSelectIcon_c, On);
|
||||
@@ -1392,7 +1392,7 @@ void dLytMeterItemSelect_c::initializeState_DemoMove() {
|
||||
mAnm[i + ITEM_SELECT_ANIM_HAVE_OFFSET].setAnimEnable(false);
|
||||
}
|
||||
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_GET_ITEM_SET);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_GET_ITEM_SET);
|
||||
}
|
||||
|
||||
void dLytMeterItemSelect_c::executeState_DemoMove() {
|
||||
@@ -1988,7 +1988,7 @@ bool dLytMeterItemSelect_c::execute() {
|
||||
|
||||
if (dLytDobutton_c::getField0x47C() == dLytDobutton_c::ACT_DO_SAILCLOTH) {
|
||||
if (field_0x5774 == 0) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_PARACHUTE_CALL);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_PARACHUTE_CALL);
|
||||
}
|
||||
field_0x5774++;
|
||||
if (field_0x5774 >= mAnm[ITEM_SELECT_ANIM_CALL].getAnimDuration() / 2.0f) {
|
||||
@@ -2058,11 +2058,11 @@ bool dLytMeterItemSelect_c::execute() {
|
||||
mAnm[ITEM_SELECT_ANIM_FULL].setFrame(0.0f);
|
||||
mAnm[ITEM_SELECT_ANIM_FULL].setAnimEnable(true);
|
||||
if (field_0x5797 == I_BOMB_BAG) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_BM_MAX);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_BM_MAX);
|
||||
} else if (field_0x5797 == I_BOW) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_AW_MAX);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_AW_MAX);
|
||||
} else if (field_0x5797 == I_SLINGSHOT) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_PC_MAX);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_PC_MAX);
|
||||
}
|
||||
}
|
||||
field_0x57B7 = false;
|
||||
@@ -2094,7 +2094,7 @@ bool dLytMeterItemSelect_c::execute() {
|
||||
mAnm[ITEM_SELECT_ANIM_CALL].play();
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_B) &&
|
||||
mAnm[ITEM_SELECT_ANIM_CALL].getFrame() == 1.0f) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_B_BUTTON_BLINK);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_B_BUTTON_BLINK);
|
||||
}
|
||||
}
|
||||
b2 = true;
|
||||
@@ -2115,7 +2115,7 @@ bool dLytMeterItemSelect_c::execute() {
|
||||
mAnm[ITEM_SELECT_ANIM_CALL].play();
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_B) &&
|
||||
mAnm[ITEM_SELECT_ANIM_CALL].getFrame() == 1.0f) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_PARACHUTE_CALL);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_PARACHUTE_CALL);
|
||||
}
|
||||
}
|
||||
b2 = true;
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#include "d/a/d_a_item.h"
|
||||
#include "d/d_stage_mgr.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/lyt/lyt_pane.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
STATE_DEFINE(dLytMeterKakeraKey_c, Wait);
|
||||
STATE_DEFINE(dLytMeterKakeraKey_c, On);
|
||||
@@ -87,9 +87,9 @@ void dLytMeterKakeraKey_c::initializeState_Increase() {
|
||||
mAnm[mNextKeyPieceCount - 1 + KEY_KAKERA_ANIM_NUMBER_OFFSET].setFrame(0.0f);
|
||||
mSavedKeyPieceCount = dAcItem_c::getKeyPieceCount();
|
||||
if (mSavedKeyPieceCount == KEY_KAKERA_NUM_PIECES) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_KEY_COMPLETE);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_KEY_COMPLETE);
|
||||
} else {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_KEY_PARTS);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_KEY_PARTS);
|
||||
}
|
||||
}
|
||||
void dLytMeterKakeraKey_c::executeState_Increase() {
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
#include "d/lyt/d_lyt_control_game.h"
|
||||
#include "d/lyt/d_lyt_util_items.h"
|
||||
#include "d/lyt/meter/d_lyt_meter.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "m/m_angle.h"
|
||||
#include "nw4r/lyt/lyt_group.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
#include "sized_string.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
STATE_DEFINE(dLytMeterMinusBtnMenuIcon_c, Wait);
|
||||
STATE_DEFINE(dLytMeterMinusBtnMenuIcon_c, On);
|
||||
@@ -635,9 +635,9 @@ void dLytMeterMinusBtn_c::initializeState_DemoMove() {
|
||||
}
|
||||
|
||||
if (field_0x4E8C == 0) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_DOGU_PORCH_ADD_FIRST);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_DOGU_PORCH_ADD_FIRST);
|
||||
} else {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_DOGU_PORCH_ADD);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_DOGU_PORCH_ADD);
|
||||
}
|
||||
}
|
||||
void dLytMeterMinusBtn_c::executeState_DemoMove() {
|
||||
@@ -898,7 +898,7 @@ bool dLytMeterMinusBtn_c::execute() {
|
||||
mAnm[MINUS_BTN_ANIM_CALL].play();
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_MINUS) &&
|
||||
mAnm[MINUS_BTN_ANIM_CALL].getFrame() == 1.0f) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_MINUS_BUTTON_BLINK);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_MINUS_BUTTON_BLINK);
|
||||
}
|
||||
}
|
||||
} else if (field_0x4EBA == 1) {
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
#include "d/lyt/d_lyt_unknowns.h"
|
||||
#include "d/lyt/d_window.h"
|
||||
#include "d/lyt/meter/d_lyt_meter.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "d/t/d_t_map_mark.h"
|
||||
#include "f/f_base.h"
|
||||
#include "f/f_manager.h"
|
||||
#include "f/f_profile_name.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
STATE_DEFINE(dLytMeterPlusBtn_c, Wait);
|
||||
STATE_DEFINE(dLytMeterPlusBtn_c, ToUse);
|
||||
@@ -196,7 +196,7 @@ bool dLytMeterPlusBtn_c::execute() {
|
||||
mAnm[PLUS_BTN_ANIM_CALL].play();
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(METER_BTN_PLUS) &&
|
||||
mAnm[PLUS_BTN_ANIM_CALL].getFrame() == 1.0f && mCallCount < 3) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_PLUS_BUTTON_BLINK);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_PLUS_BUTTON_BLINK);
|
||||
mCallCount++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#include "d/a/d_a_item.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_lyt_meter_configuration.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
STATE_DEFINE(dLytMeterRupyStart_c, Wait);
|
||||
STATE_DEFINE(dLytMeterRupyStart_c, Start);
|
||||
@@ -426,9 +426,9 @@ bool dLytMeterRupy_c::updateDisplayedAmount(bool suppressSound) {
|
||||
b = true;
|
||||
if (field_0x8AB) {
|
||||
if (newNumDisplayed == amount) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_RUPEE_COUNT_DOWN_END);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_RUPEE_COUNT_DOWN_END);
|
||||
} else {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_RUPEE_COUNT_DOWN);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_RUPEE_COUNT_DOWN);
|
||||
}
|
||||
}
|
||||
if (field_0x8AD) {
|
||||
@@ -445,13 +445,13 @@ bool dLytMeterRupy_c::updateDisplayedAmount(bool suppressSound) {
|
||||
b = true;
|
||||
if (field_0x8AB) {
|
||||
if (newNumDisplayed == amount) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_RUPEE_COUNT_UP_END);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_RUPEE_COUNT_UP_END);
|
||||
if (field_0x8AD) {
|
||||
field_0x890 = 0;
|
||||
field_0x8AD = 0;
|
||||
}
|
||||
} else {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_RUPEE_COUNT_UP);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_RUPEE_COUNT_UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -511,7 +511,7 @@ bool dLytMeterRupy_c::updateDisplayedAmount(bool suppressSound) {
|
||||
mPrevDigits[2] = mDisplayedDigits[2];
|
||||
mPrevDigits[3] = mDisplayedDigits[3];
|
||||
} else if (field_0x8AD && amount == dAcItem_c::getCurrentWalletCapacity()) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_RUPEE_MAX);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_RUPEE_MAX);
|
||||
field_0x890 = 0;
|
||||
field_0x8AD = 0;
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#include "d/d_pouch.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_lyt_meter_configuration.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "toBeSorted/file_manager.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
STATE_DEFINE(dLytMeterShieldGauge_c, Normal);
|
||||
STATE_DEFINE(dLytMeterShieldGauge_c, Use);
|
||||
@@ -181,13 +181,13 @@ bool dLytMeterShieldGauge_c::execute() {
|
||||
if (mCurrentDurability >= mMaxDurability) {
|
||||
if (field_0x31E) {
|
||||
// Unreachable?
|
||||
SmallSoundManager::GetInstance()->playSoundWithPitch(SE_S_GAUGE_SHIELD_UP_LV, 1.0f);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSoundWithPitch(SE_S_GAUGE_SHIELD_UP_LV, 1.0f);
|
||||
}
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_GAUGE_SHIELD_UP_MAX);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_GAUGE_SHIELD_UP_MAX);
|
||||
} else {
|
||||
if (field_0x31E) {
|
||||
// Unreachable?
|
||||
SmallSoundManager::GetInstance()->playSoundWithPitch(
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSoundWithPitch(
|
||||
SE_S_GAUGE_SHIELD_UP_LV, mCurrentDurability / mMaxDurability
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/lyt/d_lyt_drop_line.h"
|
||||
#include "d/lyt/meter/d_lyt_meter.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "d/t/d_t_siren.h"
|
||||
#include "m/m_vec.h"
|
||||
#include "nw4r/lyt/lyt_pane.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
#include "toBeSorted/d_emitter.h"
|
||||
#include "toBeSorted/event_manager.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
@@ -328,7 +328,7 @@ bool LytMeterTimerPart1_c::incrementTearCount() {
|
||||
startNextFruitAnim();
|
||||
if (!dLytMeter_c::getfn_800C9FE0()) {
|
||||
createEffect(mActualTearCount - 1);
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_SIREN_SHIZUKU_GET_IN);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_SIREN_SHIZUKU_GET_IN);
|
||||
}
|
||||
|
||||
if (mActualTearCount < TIMER_01_NUM_TEARS) {
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
#include "d/lyt/d_lyt_control_game.h"
|
||||
#include "d/lyt/d_lyt_unknowns.h"
|
||||
#include "d/lyt/meter/d_lyt_meter.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "toBeSorted/attention.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
STATE_DEFINE(dLytMeterZBtn_c, Wait);
|
||||
STATE_DEFINE(dLytMeterZBtn_c, On);
|
||||
@@ -224,7 +224,7 @@ bool dLytMeterZBtn_c::execute() {
|
||||
if (mAnm[Z_BTN_ANIM_CALL].isEnabled()) {
|
||||
mAnm[Z_BTN_ANIM_CALL].play();
|
||||
if (dLytMeter_c::GetInstance()->checkAllFlags(0x800) && mAnm[Z_BTN_ANIM_CALL].getFrame() == 1.0f) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_Z_BUTTON_BLINK);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_Z_BUTTON_BLINK);
|
||||
}
|
||||
}
|
||||
} else if (field_0x1C6 == 1) {
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "d/lyt/d_lyt_auto_caption.h"
|
||||
// clang-format on
|
||||
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "f/f_base.h"
|
||||
#include "m/m_fader_base.h"
|
||||
#include "m/m_vec.h"
|
||||
@@ -38,7 +39,6 @@
|
||||
#include "toBeSorted/lyt_related_floats.h"
|
||||
#include "toBeSorted/music_mgrs.h"
|
||||
#include "toBeSorted/other_sound_stuff.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
@@ -308,7 +308,7 @@ void dLytMsgWindow_c::executeState_OutputText() {
|
||||
} else if (mpTagProcessor->getMsgWindowSubtype() <= MSG_WINDOW_1 && oldValue != mpMsgWindowUnk->getField_0x147A()) {
|
||||
u16 a = mpMsgWindowUnk->getField_0x147C();
|
||||
f32 b = (dTagProcessor_c::fn_800B8040(0, 0) * 100.0f);
|
||||
SmallSoundManager::GetInstance()->playButtonPressSoundWhenAdvancingTextBoxes(a / b);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playButtonPressSoundWhenAdvancingTextBoxes(a / b);
|
||||
}
|
||||
|
||||
if (setTextToDisplay(mpMsgWindowUnk->getProcessedText())) {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
#include "common.h"
|
||||
#include "d/d_pad.h"
|
||||
#include "d/lyt/d2d.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "toBeSorted/music_mgrs.h"
|
||||
#include "toBeSorted/small_sound_mgr.h"
|
||||
|
||||
|
||||
STATE_DEFINE(dLytMsgWindowSelectBtnParts_c, Wait);
|
||||
@@ -278,11 +278,11 @@ void dLytMsgWindowSelectBtn_c::initializeState_In() {
|
||||
} else {
|
||||
if (field_0x9CF != 0) {
|
||||
if (field_0x9A0 == 1) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_CHOICE_START);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_CHOICE_START);
|
||||
} else if (field_0x9A0 == 2) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_CHOICE_START_GAMEOVER);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_CHOICE_START_GAMEOVER);
|
||||
} else {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_TALK_CHOICE_START);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_TALK_CHOICE_START);
|
||||
}
|
||||
}
|
||||
mAnm[SELECT_BTN_ANIM_IN].setFrame(0.0f);
|
||||
@@ -323,7 +323,7 @@ void dLytMsgWindowSelectBtn_c::executeState_WaitSelect() {
|
||||
mpWindow->UpdateSize(mpSizeBox, 32.0f);
|
||||
} else if (v == 3) {
|
||||
field_0x9D1 = 1;
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_POINTER_RESET);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_POINTER_RESET);
|
||||
mStateMgr.changeState(StateID_In);
|
||||
return;
|
||||
}
|
||||
@@ -334,9 +334,9 @@ void dLytMsgWindowSelectBtn_c::executeState_WaitSelect() {
|
||||
mStateMgr.changeState(StateID_WaitDecide);
|
||||
// TODO
|
||||
if (mpTagProcessor != nullptr) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_TALK_CURSOR_CANCEL);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_TALK_CURSOR_CANCEL);
|
||||
} else {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_TALK_CURSOR_OK);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_TALK_CURSOR_OK);
|
||||
}
|
||||
fn_8035E880(BGM_MGR);
|
||||
} else if (dPad::checkButtonBPressed()) {
|
||||
@@ -347,9 +347,9 @@ void dLytMsgWindowSelectBtn_c::executeState_WaitSelect() {
|
||||
mStateMgr.changeState(StateID_WaitCancel);
|
||||
// TODO
|
||||
if (mpTagProcessor != nullptr) {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_TALK_CURSOR_CANCEL);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_TALK_CURSOR_CANCEL);
|
||||
} else {
|
||||
SmallSoundManager::GetInstance()->playSound(SE_S_TALK_CURSOR_OK);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_TALK_CURSOR_OK);
|
||||
}
|
||||
fn_8035E880(BGM_MGR);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
#include "d/snd/d_snd_3d_actor.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/a/d_a_player.h"
|
||||
#include "d/snd/d_snd_3d_manager.h"
|
||||
#include "d/snd/d_snd_checkers.h"
|
||||
#include "d/snd/d_snd_player_mgr.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
dSnd3DActor_c::dSnd3DActor_c(dSndSourceParam *pSourceParam, u8 sourceType)
|
||||
: nw4r::snd::Sound3DActor(
|
||||
dSndPlayerMgr_c::GetInstance()->getSoundArchivePlayerForType(sourceType), dSnd3DManager_c::GetInstance()->getManager()
|
||||
),
|
||||
a_field_0x7D(0),
|
||||
a_field_0x7E(0),
|
||||
a_field_0x7F(0),
|
||||
a_field_0x80(0),
|
||||
a_field_0x84(0.0f),
|
||||
a_field_0x88(0.0f),
|
||||
a_field_0x8C(0.0f),
|
||||
a_field_0x90(INFINITY),
|
||||
mDistanceToListener(INFINITY),
|
||||
mCameraDirectionDot(0.0f),
|
||||
a_field_0x9C(0.0f),
|
||||
mpSourceParam(pSourceParam),
|
||||
mFlags(0),
|
||||
mDistanceToPlayer(INFINITY),
|
||||
a_field_0xE0(0.0f) {
|
||||
resetCachedRelativePositions();
|
||||
// Portability hazard
|
||||
SetUserParam(reinterpret_cast<u32>(this));
|
||||
if (dSndPlayerMgr_c::GetInstance()->canUseThisPlayer(sourceType)) {
|
||||
a_field_0x7F = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void dSnd3DActor_c::d_vt_0x34(const nw4r::math::VEC3 &rPosition) {
|
||||
SetPosition(rPosition);
|
||||
// TODO - 0xE0
|
||||
mFlags = 0;
|
||||
}
|
||||
|
||||
void dSnd3DActor_c::updatePositionRelativeToListener() {
|
||||
if (!checkFlag(0x1)) {
|
||||
calculatePositionRelativeToListener();
|
||||
setFlag(0x1);
|
||||
}
|
||||
}
|
||||
|
||||
void dSnd3DActor_c::resetCachedRelativePositions() {
|
||||
mPositionRelativeToPlayer.x = INFINITY;
|
||||
mPositionRelativeToPlayer.y = INFINITY;
|
||||
mPositionRelativeToPlayer.z = INFINITY;
|
||||
|
||||
mPositionRelativeToListener.x = INFINITY;
|
||||
mPositionRelativeToListener.y = INFINITY;
|
||||
mPositionRelativeToListener.z = INFINITY;
|
||||
|
||||
mPositionTransformedByListener.x = INFINITY;
|
||||
mPositionTransformedByListener.y = INFINITY;
|
||||
mPositionTransformedByListener.z = INFINITY;
|
||||
}
|
||||
|
||||
void dSnd3DActor_c::calculatePositionRelativeToListener() {
|
||||
nw4r::math::VEC3Sub(
|
||||
&mPositionRelativeToListener, &GetPosition(), &dSnd3DManager_c::GetInstance()->getSndListenerPos()
|
||||
);
|
||||
}
|
||||
|
||||
void dSnd3DActor_c::updateDistanceToListener() {
|
||||
if (!checkFlag(0x2)) {
|
||||
updatePositionRelativeToListener();
|
||||
mDistanceToListener = VEC3Len(&mPositionRelativeToListener);
|
||||
setFlag(0x2);
|
||||
}
|
||||
}
|
||||
|
||||
void dSnd3DActor_c::updatePositionTransformedByListener() {
|
||||
if (!checkFlag(0x10)) {
|
||||
MTXMultVec(
|
||||
dSnd3DManager_c::GetInstance()->getSndListenerMatrix(), GetPosition(), mPositionTransformedByListener
|
||||
);
|
||||
setFlag(0x10);
|
||||
}
|
||||
}
|
||||
|
||||
void dSnd3DActor_c::updateCameraDirectionDot() {
|
||||
if (!checkFlag(0x20)) {
|
||||
updatePositionRelativeToListener();
|
||||
nw4r::math::VEC3 norm;
|
||||
VECNormalize(mPositionRelativeToListener, norm);
|
||||
mCameraDirectionDot = nw4r::math::VEC3Dot(&norm, dSnd3DManager_c::GetInstance()->getNrmCameraDirection());
|
||||
setFlag(0x20);
|
||||
}
|
||||
}
|
||||
|
||||
void dSnd3DActor_c::updatePositionRelativeToCameraTarget() {
|
||||
if (!checkFlag(0x4)) {
|
||||
calculatePositionRelativeToCameraTarget();
|
||||
setFlag(0x4);
|
||||
}
|
||||
}
|
||||
|
||||
void dSnd3DActor_c::calculatePositionRelativeToCameraTarget() {
|
||||
nw4r::math::VEC3Sub(
|
||||
&mPositionRelativeToCameraTarget, &GetPosition(), dSnd3DManager_c::GetInstance()->getCameraTargetPos()
|
||||
);
|
||||
}
|
||||
|
||||
void dSnd3DActor_c::updateDistanceToCameraTarget() {
|
||||
if (!checkFlag(0x8)) {
|
||||
updatePositionRelativeToCameraTarget();
|
||||
mDistanceToCameraTarget = VEC3Len(&mPositionRelativeToCameraTarget);
|
||||
setFlag(0x8);
|
||||
}
|
||||
}
|
||||
|
||||
void dSnd3DActor_c::updatePositionRelativeToPlayer() {
|
||||
if (!checkFlag(0x40)) {
|
||||
nw4r::math::VEC3 linkTranslation = dAcPy_c::GetLink()->getCenterTranslation();
|
||||
nw4r::math::VEC3 pos = GetPosition();
|
||||
nw4r::math::VEC3Sub(&mPositionRelativeToPlayer, &pos, &linkTranslation);
|
||||
|
||||
setFlag(0x40);
|
||||
}
|
||||
}
|
||||
|
||||
const nw4r::math::VEC3 &dSnd3DActor_c::getPositionRelativeToPlayer() {
|
||||
updatePositionRelativeToPlayer();
|
||||
return mPositionRelativeToPlayer;
|
||||
}
|
||||
|
||||
void dSnd3DActor_c::updateDistanceToPlayer() {
|
||||
if (!checkFlag(0x80)) {
|
||||
updatePositionRelativeToPlayer();
|
||||
nw4r::math::VEC3 linkTranslation = dAcPy_c::GetLink()->getCenterTranslation();
|
||||
nw4r::math::VEC3 pos = GetPosition();
|
||||
if ((linkTranslation.x == 0.0f && linkTranslation.y == 0.0f && linkTranslation.z == 0.0f) ||
|
||||
(pos.x == 0.0f && pos.y == 0.0f && pos.z == 0.0f)) {
|
||||
// Don't bother if we received dummy values
|
||||
mDistanceToPlayer = INFINITY;
|
||||
} else {
|
||||
mDistanceToPlayer = nw4r::math::VEC3Len(&mPositionRelativeToPlayer);
|
||||
}
|
||||
setFlag(0x80);
|
||||
}
|
||||
}
|
||||
|
||||
f32 dSnd3DActor_c::getDistanceToPlayer() {
|
||||
updateDistanceToPlayer();
|
||||
return mDistanceToPlayer;
|
||||
}
|
||||
|
||||
// here are functions that are probably in part copied from nw4r::snd::Sound3DCalculator
|
||||
|
||||
bool dSnd3DActor_c::hasPlayingSounds() const {
|
||||
for (int i = 0; i < ACTOR_PLAYER_COUNT; i++) {
|
||||
if (GetPlayingSoundCount(i) > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool dSnd3DActor_c::isPlayingSound(u32 id) {
|
||||
bool result = false;
|
||||
|
||||
IsCurrentSoundIdChecker handler(id, &result);
|
||||
ForEachSound(handler, false);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
#include "d/snd/d_snd_3d_engine.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "nw4r/snd/snd_Sound3DListener.h"
|
||||
|
||||
dSnd3DEngine_c::dSnd3DEngine_c() {}
|
||||
|
||||
static void CalcPitch(
|
||||
const nw4r::math::VEC3 *vec, f32 mag, const nw4r::snd::Sound3DManager &mgr,
|
||||
const nw4r::snd::Sound3DListener &listener, const nw4r::snd::Sound3DParam ¶m, f32 *pPitch
|
||||
);
|
||||
|
||||
void dSnd3DEngine_c::UpdateAmbientParam(
|
||||
const nw4r::snd::Sound3DManager *mgr, const nw4r::snd::Sound3DParam *param3d, u32 unk, u32 flags,
|
||||
nw4r::snd::SoundAmbientParam *paramAmb
|
||||
) {
|
||||
f32 pitch;
|
||||
CalcPitch(nullptr, 0.0f, *mgr, mgr->GetListenerList().GetFront(), *param3d, &pitch);
|
||||
}
|
||||
|
||||
// Largely copied from Sound3DCalculator::CalcPitch
|
||||
static void CalcPitch(
|
||||
const nw4r::math::VEC3 *vec, f32 mag, const nw4r::snd::Sound3DManager &mgr,
|
||||
const nw4r::snd::Sound3DListener &listener, const nw4r::snd::Sound3DParam ¶m, f32 *pPitch
|
||||
) {
|
||||
f32 f0 = mgr.GetField0x24();
|
||||
if (f0 == 0.0f) {
|
||||
*pPitch = 1.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
nw4r::math::VEC3 relativePos(*vec);
|
||||
if (mag > 0.0f) {
|
||||
relativePos /= mag;
|
||||
}
|
||||
f32 f3 = param.field_0x1E / 32.0f;
|
||||
f32 f1, f2;
|
||||
if (mag > 0.0f) {
|
||||
f1 = -nw4r::math::VEC3Dot(&relativePos, ¶m.velocity);
|
||||
f2 = -nw4r::math::VEC3Dot(&relativePos, &listener.GetVelocity());
|
||||
} else {
|
||||
f1 = -nw4r::math::VEC3Len(¶m.velocity);
|
||||
f2 = nw4r::math::VEC3Len(&listener.GetVelocity());
|
||||
}
|
||||
f32 pitch;
|
||||
f1 *= f3;
|
||||
f2 *= f3;
|
||||
if (f2 > f0) {
|
||||
pitch = 0.0f;
|
||||
} else if (f1 >= f0) {
|
||||
pitch = 65535.0f;
|
||||
} else {
|
||||
pitch = (f0 - f2) / (f0 - f1);
|
||||
}
|
||||
*pPitch = pitch;
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
#include "d/snd/d_snd_3d_manager.h"
|
||||
|
||||
#include "d/snd/d_snd_3d_engine.h"
|
||||
#include "d/snd/d_snd_mgr.h"
|
||||
#include "egg/math/eggMatrix.h"
|
||||
#include "egg/math/eggVector.h"
|
||||
#include "nw4r/math/math_arithmetic.h"
|
||||
#include "nw4r/math/math_types.h"
|
||||
#include "nw4r/snd/snd_SoundArchive.h"
|
||||
#include "toBeSorted/music_mgrs.h"
|
||||
|
||||
SND_DISPOSER_DEFINE(dSnd3DManager_c);
|
||||
|
||||
dSnd3DManager_c::dSnd3DManager_c() : mIsSetup(false), mCalculationsFresh(0) {
|
||||
mCameraPosSqVelocity = 0.0f;
|
||||
mCameraAtSqVelocity = 0.0f;
|
||||
mCamDistance = 0.9f;
|
||||
mTimer = 0;
|
||||
mpEngine = new dSnd3DEngine_c();
|
||||
mCameraDirectionNormalized.x = 0.0f;
|
||||
mCameraDirectionNormalized.y = 0.0f;
|
||||
mCameraDirectionNormalized.z = 1.0f;
|
||||
}
|
||||
|
||||
void dSnd3DManager_c::setup() {
|
||||
if (mIsSetup) {
|
||||
return;
|
||||
}
|
||||
|
||||
nw4r::snd::SoundArchive *archive = dSndMgr_c::GetInstance()->getArchive();
|
||||
u32 requiredSize = mManager.GetRequiredMemSize(archive);
|
||||
void *buf = dSndMgr_c::GetInstance()->getSoundHeap()->Alloc(requiredSize);
|
||||
mManager.Setup(archive, buf, requiredSize);
|
||||
mManager.SetEngine(mpEngine);
|
||||
mManager.SetMaxPriorityReduction(32);
|
||||
mManager.SetField0x20(0.9f);
|
||||
mManager.SetField0x24(3400.0f / 3.0f);
|
||||
mListener.SetMaxVolumeDistance(300.0f);
|
||||
mListener.SetUnitDistance(1000.0f);
|
||||
mListener.SetInteriorSize(400.0f);
|
||||
mManager.SetBiquadFilterType(3);
|
||||
mListener.SetUnitBiquadFilterMax(0.5f);
|
||||
mListener.SetUnitBiquadFilterValue(0.2f);
|
||||
mManager.GetListenerList().Insert(mManager.GetListenerList().GetEndIter(), &mListener);
|
||||
mIsSetup = true;
|
||||
}
|
||||
|
||||
void dSnd3DManager_c::resetCamDistance() {
|
||||
mCamDistance = 0.9f;
|
||||
}
|
||||
|
||||
void dSnd3DManager_c::setCamDistance(f32 value) {
|
||||
// @bug ? not actually clamped
|
||||
(void)nw4r::ut::Clamp(value, -1.0f, 2.0f);
|
||||
mCamDistance = value;
|
||||
}
|
||||
|
||||
void dSnd3DManager_c::calc() {
|
||||
// Don't actually calculate anything,
|
||||
// but allow re-calculations this frame.
|
||||
mCalculationsFresh = false;
|
||||
}
|
||||
|
||||
void dSnd3DManager_c::clearState() {
|
||||
mCameraPosSqVelocity = 0.0f;
|
||||
mCameraAtSqVelocity = 0.0f;
|
||||
mTimer = 0;
|
||||
}
|
||||
|
||||
|
||||
void dSnd3DManager_c::updateFromCamera(EGG::LookAtCamera &camera) {
|
||||
if (mCalculationsFresh) {
|
||||
return;
|
||||
}
|
||||
|
||||
f32 dist = 0.5f;
|
||||
if (fn_80364DA0(ENEMY_SOUND_MGR)) {
|
||||
dist = mCamDistance;
|
||||
f32 prevCameraAtSqVelocity = mCameraAtSqVelocity;
|
||||
f32 prevCameraPosSqVelocity = mCameraPosSqVelocity;
|
||||
mCameraAtSqVelocity = VECSquareDistance(camera.mAt, mCamera.mAt);
|
||||
mCameraPosSqVelocity = VECSquareDistance(camera.mPos, mCamera.mPos);
|
||||
if (((u32 *)ENEMY_SOUND_MGR)[71] > 30) {
|
||||
bool bigMovement = false;
|
||||
bool hugeMovement = false;
|
||||
if (mTimer > 0) {
|
||||
mTimer--;
|
||||
} else {
|
||||
f32 atAccel = prevCameraAtSqVelocity - mCameraAtSqVelocity;
|
||||
f32 atAccelAbs = nw4r::math::FAbs(atAccel);
|
||||
if (mCameraAtSqVelocity > 490000.0f) {
|
||||
bigMovement = true;
|
||||
hugeMovement = true;
|
||||
} else if (atAccelAbs > 10000.0f) {
|
||||
bigMovement = true;
|
||||
}
|
||||
if (!hugeMovement) {
|
||||
f32 posAccel = prevCameraPosSqVelocity - mCameraPosSqVelocity;
|
||||
f32 posAccelAbs = nw4r::math::FAbs(posAccel);
|
||||
if (mCameraPosSqVelocity > 490000.0f) {
|
||||
bigMovement = true;
|
||||
hugeMovement = true;
|
||||
} else if (posAccelAbs > 10000.0f) {
|
||||
bigMovement = true;
|
||||
}
|
||||
if (bigMovement && !hugeMovement && nw4r::math::FAbs(atAccelAbs - posAccelAbs) < 22500.0f) {
|
||||
nw4r::math::VEC3 myDir = mCamera.getOtherDirection();
|
||||
nw4r::math::VEC3 camDir = camera.getOtherDirection();
|
||||
VECNormalize(myDir, myDir);
|
||||
VECNormalize(camDir, camDir);
|
||||
if (nw4r::math::VEC3Dot(&myDir, &camDir) > 0.99f) {
|
||||
bigMovement = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bigMovement) {
|
||||
fn_80364D00(ENEMY_SOUND_MGR, -1);
|
||||
mTimer = 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mCamera = camera;
|
||||
updateListenerPos(dist);
|
||||
mCalculationsFresh = true;
|
||||
}
|
||||
|
||||
void dSnd3DManager_c::updateListenerPos(f32 f) {
|
||||
const EGG::Matrix34f &mtx = mCamera.getViewMatrix();
|
||||
mListener.SetMatrix(*mtx);
|
||||
EGG::Vector3f dir = mCamera.getDirection();
|
||||
VECNormalize(dir, mCameraDirectionNormalized);
|
||||
dir *= f;
|
||||
mCameraTargetPosition = mCamera.mPos + dir;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
#include "d/snd/d_snd_actor.h"
|
||||
|
||||
#include "d/snd/d_snd_checkers.h"
|
||||
#include "nw4r/snd/snd_BasicSound.h"
|
||||
#include "nw4r/snd/snd_SoundArchivePlayer.h"
|
||||
|
||||
dSndActor_c::dSndActor_c(nw4r::snd::SoundArchivePlayer &rStartable) : nw4r::snd::SoundActor(rStartable) {}
|
||||
|
||||
void dSndActor_c::doesSomethingWithForeachSound() {
|
||||
SoundPropertiesChecker checker;
|
||||
ForEachSound(checker, false);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
#include "d/snd/d_snd_area_sound.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_sound.h"
|
||||
|
||||
dSndAreaSound_c::dSndAreaSound_c()
|
||||
: field_0xF0(false), mpCalcCallback(nullptr), field_0xF8(nullptr), field_0xFC(nullptr), field_0x100(nullptr) {}
|
||||
|
||||
void dSndAreaSound_c::cancel() {
|
||||
dSndSound_c::cancel();
|
||||
field_0xF0 = false;
|
||||
}
|
||||
|
||||
void dSndAreaSound_c::calc() {
|
||||
if (isFadingOut() && mPauseFlag) {
|
||||
if (GetRemainingFadeFrames() <= 0) {
|
||||
Stop(0);
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
||||
dSndSound_c::calc();
|
||||
if (mpCalcCallback != nullptr) {
|
||||
(mpCalcCallback)(*this);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndAreaSound_c::fadeIn(u32 id, s32 fadeFrames) {
|
||||
dSndSound_c::fadeIn(id, fadeFrames);
|
||||
initCallback(id);
|
||||
}
|
||||
|
||||
void dSndAreaSound_c::pause(s32 fadeFrames) {
|
||||
if (isRunning()) {
|
||||
if (fadeFrames != 0) {
|
||||
pause(true, fadeFrames);
|
||||
mIsFadingOut = true;
|
||||
} else {
|
||||
Stop(fadeFrames);
|
||||
cancel();
|
||||
}
|
||||
} else {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
||||
void dSndAreaSound_c::unpause(s32 fadeFrames) {
|
||||
if (isFadingOut()) {
|
||||
pause(false, fadeFrames);
|
||||
mIsFadingOut = false;
|
||||
}
|
||||
}
|
||||
|
||||
void dSndAreaSound_c::initCallback(u32 id) {
|
||||
Callback cb = nullptr;
|
||||
mpCalcCallback = nullptr;
|
||||
field_0xF8 = nullptr;
|
||||
field_0xFC = nullptr;
|
||||
field_0x100 = nullptr;
|
||||
field_0x104 = nullptr;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
#include "d/snd/d_snd_area_sound_effect_mgr.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_sc_game.h"
|
||||
#include "d/snd/d_snd_mgr.h"
|
||||
#include "d/snd/d_snd_player_mgr.h"
|
||||
#include "d/snd/d_snd_util.h"
|
||||
#include "nw4r/snd/snd_SoundStartable.h"
|
||||
|
||||
SND_DISPOSER_DEFINE(dSndAreaSoundEffectMgr_c);
|
||||
|
||||
dSndAreaSoundEffectMgr_c::dSndAreaSoundEffectMgr_c()
|
||||
: field_0x328(0),
|
||||
field_0x32C(1.0f),
|
||||
field_0x330(1.0f),
|
||||
mActor(*dSndMgr_c::GetInstance()->getPlayer()),
|
||||
field_0x388(1.0f) {}
|
||||
|
||||
void dSndAreaSoundEffectMgr_c::calc() {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mSounds[i].calc();
|
||||
}
|
||||
}
|
||||
|
||||
bool dSndAreaSoundEffectMgr_c::startSound(u32 soundId, u32 handleIdx) {
|
||||
if (dSndPlayerMgr_c::GetInstance()->checkFlag(0x2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isPlayingSound(soundId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (handleIdx > 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dScGame_c::currentSpawnInfo.getTrial() == SpawnInfo::TRIAL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
dSndAreaSound_c *snd = &mSounds[handleIdx];
|
||||
nw4r::snd::SoundStartable::StartResult res = mActor.detail_StartSound(snd, soundId, nullptr);
|
||||
if (res == nw4r::snd::SoundStartable::START_SUCCESS) {
|
||||
snd->fadeIn(soundId, 30);
|
||||
}
|
||||
|
||||
// @bug should probably be `res != nw4r::snd::SoundStartable::START_SUCCESS`
|
||||
// all callers seem to ignore return value though
|
||||
return res;
|
||||
}
|
||||
|
||||
void dSndAreaSoundEffectMgr_c::stopSounds(s32 fadeFrames) {
|
||||
for (u32 i = 0; i < 3; i++) {
|
||||
mSounds[i].stop(fadeFrames);
|
||||
}
|
||||
}
|
||||
|
||||
bool dSndAreaSoundEffectMgr_c::isPlayingAnySound() const {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (mSounds[i].IsAttachedSound()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool dSndAreaSoundEffectMgr_c::isPlayingSound(u32 soundId) const {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (mSounds[i].GetId() == soundId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
#include "d/snd/d_snd_control_player.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_control_player_mgr.h"
|
||||
#include "d/snd/d_snd_sound.h"
|
||||
#include "nw4r/snd/snd_SoundPlayer.h"
|
||||
#include "nw4r/snd/snd_global.h"
|
||||
|
||||
dSndControlPlayerVolumeBase_c::dSndControlPlayerVolumeBase_c() : dSndControlPlayer_c(1.0f, 0.0f, 1.0f) {
|
||||
mpPlayer = nullptr;
|
||||
mIndex = 0;
|
||||
}
|
||||
|
||||
void dSndControlPlayer_c::reset() {
|
||||
dSndControl_c::reset();
|
||||
apply();
|
||||
}
|
||||
|
||||
void dSndControlPlayer_c::setIndex1(u32 idx) {
|
||||
mpPlayer = dSndControlPlayerMgr_c::GetInstance()->getPlayer1(idx);
|
||||
mIndex = idx;
|
||||
}
|
||||
|
||||
void dSndControlPlayer_c::setIndex2(u32 idx) {
|
||||
mpPlayer = dSndControlPlayerMgr_c::GetInstance()->getPlayer2(idx);
|
||||
mIndex = idx;
|
||||
}
|
||||
|
||||
void dSndControlPlayer_c::stop() {
|
||||
mCurrValue = getAppliedValue();
|
||||
dSndControl_c::stop();
|
||||
}
|
||||
|
||||
void dSndControlPlayerVolume_c::apply() {
|
||||
mpPlayer->SetVolume(mCurrValue);
|
||||
}
|
||||
|
||||
f32 dSndControlPlayerVolume_c::getAppliedValue() {
|
||||
return mpPlayer->GetVolume();
|
||||
}
|
||||
|
||||
void dSndControlPlayerLpfFreq_c::apply() {
|
||||
mpPlayer->SetLpfFreq(mCurrValue);
|
||||
}
|
||||
|
||||
f32 dSndControlPlayerLpfFreq_c::getAppliedValue() {
|
||||
return mpPlayer->GetLpfFreq();
|
||||
}
|
||||
|
||||
void dSndControlPlayerFxSend_c::apply() {
|
||||
if (mCurrValue < mMin) {
|
||||
mCurrValue = mMin;
|
||||
}
|
||||
if (mCurrValue >= mMax) {
|
||||
mCurrValue = mMax;
|
||||
}
|
||||
mpPlayer->SetFxSend(nw4r::snd::AUX_B, mCurrValue);
|
||||
}
|
||||
|
||||
extern "C" bool fn_8035F030(s32);
|
||||
|
||||
f32 dSndControlPlayerFxSend_c::getAppliedValue() {
|
||||
int auxBus = nw4r::snd::AUX_A;
|
||||
if (fn_8035F030(mIndex)) {
|
||||
auxBus = nw4r::snd::AUX_B;
|
||||
}
|
||||
return mpPlayer->GetFxSend(auxBus);
|
||||
}
|
||||
@@ -0,0 +1,403 @@
|
||||
#include "d/snd/d_snd_control_player_mgr.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_control_player.h"
|
||||
#include "d/snd/d_snd_mgr.h"
|
||||
#include "d/snd/d_snd_player_mgr.h"
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
#include "nw4r/ut/ut_list.h"
|
||||
#include "toBeSorted/music_mgrs.h"
|
||||
|
||||
struct FanfareMuteFlagsApplier {
|
||||
~FanfareMuteFlagsApplier() {}
|
||||
virtual void operator()(nw4r::snd::SoundHandle &handle) {
|
||||
// The logic here is inverted compared to the others - Fanfares seem to
|
||||
// mute things by default unless otherwise speciefied
|
||||
u32 id = handle.GetId();
|
||||
if (fn_803733B0(FANFARE_SOUND_MGR, id)) {
|
||||
u32 userParam = dSndMgr_c::GetInstance()->getArchive()->GetSoundUserParam(id);
|
||||
if (!(userParam & dSndPlayerMgr_c::FANFARE_UNMUTE_BGM)) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setGroupVolumeFlag(
|
||||
dSndControlPlayerMgr_c::CTRL_GROUP_BGM, dSndControlPlayerMgr_c::MUTE_FULL
|
||||
);
|
||||
dSndControlPlayerMgr_c::GetInstance()->setBgmVolumeDecreaseSpeed(0.2f);
|
||||
}
|
||||
|
||||
if (fn_80364DA0(ENEMY_SOUND_MGR)) {
|
||||
if (!(userParam & dSndPlayerMgr_c::FANFARE_UNMUTE_STAGE_EFFECTS)) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setGroupVolumeFlag(
|
||||
dSndControlPlayerMgr_c::CTRL_GROUP_STAGE_EFFECTS, dSndControlPlayerMgr_c::MUTE_FULL
|
||||
);
|
||||
}
|
||||
if (!(userParam & dSndPlayerMgr_c::FANFARE_UNMUTE_ENEMY)) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setGroupVolumeFlag(
|
||||
dSndControlPlayerMgr_c::CTRL_GROUP_ENEMY, dSndControlPlayerMgr_c::MUTE_FULL
|
||||
);
|
||||
}
|
||||
if (!(userParam & dSndPlayerMgr_c::FANFARE_UNMUTE_OBJECTS)) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setGroupVolumeFlag(
|
||||
dSndControlPlayerMgr_c::CTRL_GROUP_OBJECTS, dSndControlPlayerMgr_c::MUTE_FULL
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
struct SmallMuteFlagsApplier {
|
||||
~SmallMuteFlagsApplier() {}
|
||||
virtual void operator()(nw4r::snd::SoundHandle &handle) {
|
||||
u32 userParam = dSndMgr_c::GetInstance()->getArchive()->GetSoundUserParam(handle.GetId());
|
||||
|
||||
if (userParam & dSndPlayerMgr_c::MUTE_BGM_FULL) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setGroupVolumeFlag(
|
||||
dSndControlPlayerMgr_c::CTRL_GROUP_BGM, dSndControlPlayerMgr_c::MUTE_FULL
|
||||
);
|
||||
} else if (userParam & dSndPlayerMgr_c::MUTE_BGM_PART) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setGroupVolumeFlag(
|
||||
dSndControlPlayerMgr_c::CTRL_GROUP_BGM, dSndControlPlayerMgr_c::MUTE_PARTIAL
|
||||
);
|
||||
}
|
||||
|
||||
if (userParam & dSndPlayerMgr_c::MUTE_STAGE_EFFECTS_FULL) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setGroupVolumeFlag(
|
||||
dSndControlPlayerMgr_c::CTRL_GROUP_STAGE_EFFECTS, dSndControlPlayerMgr_c::MUTE_FULL
|
||||
);
|
||||
} else if (userParam & dSndPlayerMgr_c::MUTE_STAGE_EFFECTS_PART) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setGroupVolumeFlag(
|
||||
dSndControlPlayerMgr_c::CTRL_GROUP_STAGE_EFFECTS, dSndControlPlayerMgr_c::MUTE_PARTIAL
|
||||
);
|
||||
}
|
||||
|
||||
if (userParam & dSndPlayerMgr_c::MUTE_ENEMY_FULL) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setGroupVolumeFlag(
|
||||
dSndControlPlayerMgr_c::CTRL_GROUP_ENEMY, dSndControlPlayerMgr_c::MUTE_FULL
|
||||
);
|
||||
} else if (userParam & dSndPlayerMgr_c::MUTE_ENEMY_PART) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setGroupVolumeFlag(
|
||||
dSndControlPlayerMgr_c::CTRL_GROUP_ENEMY, dSndControlPlayerMgr_c::MUTE_PARTIAL
|
||||
);
|
||||
}
|
||||
|
||||
if (userParam & dSndPlayerMgr_c::MUTE_OBJECTS_FULL) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setGroupVolumeFlag(
|
||||
dSndControlPlayerMgr_c::CTRL_GROUP_OBJECTS, dSndControlPlayerMgr_c::MUTE_FULL
|
||||
);
|
||||
} else if (userParam & dSndPlayerMgr_c::MUTE_OBJECTS_PART) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setGroupVolumeFlag(
|
||||
dSndControlPlayerMgr_c::CTRL_GROUP_OBJECTS, dSndControlPlayerMgr_c::MUTE_PARTIAL
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
struct EventMuteFlagsApplier {
|
||||
~EventMuteFlagsApplier() {}
|
||||
virtual void operator()(nw4r::snd::SoundHandle &handle) {
|
||||
u32 userParam = dSndPlayerMgr_c::GetInstance()->getEventMuteMask(handle.GetId());
|
||||
|
||||
if (userParam & dSndPlayerMgr_c::MUTE_BGM_FULL) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setGroupVolumeFlag(
|
||||
dSndControlPlayerMgr_c::CTRL_GROUP_BGM, dSndControlPlayerMgr_c::MUTE_FULL
|
||||
);
|
||||
} else if (userParam & dSndPlayerMgr_c::MUTE_BGM_PART) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setGroupVolumeFlag(
|
||||
dSndControlPlayerMgr_c::CTRL_GROUP_BGM, dSndControlPlayerMgr_c::MUTE_PARTIAL
|
||||
);
|
||||
}
|
||||
|
||||
if (userParam & dSndPlayerMgr_c::MUTE_STAGE_EFFECTS_FULL) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setGroupVolumeFlag(
|
||||
dSndControlPlayerMgr_c::CTRL_GROUP_STAGE_EFFECTS, dSndControlPlayerMgr_c::MUTE_FULL
|
||||
);
|
||||
} else if (userParam & dSndPlayerMgr_c::MUTE_STAGE_EFFECTS_PART) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setGroupVolumeFlag(
|
||||
dSndControlPlayerMgr_c::CTRL_GROUP_STAGE_EFFECTS, dSndControlPlayerMgr_c::MUTE_PARTIAL
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
static FanfareMuteFlagsApplier fanfareApplier;
|
||||
static SmallMuteFlagsApplier smallApplier;
|
||||
static EventMuteFlagsApplier eventApplier;
|
||||
|
||||
SND_DISPOSER_DEFINE(dSndControlPlayerMgr_c);
|
||||
|
||||
dSndControlPlayerMgr_c::dSndControlPlayerMgr_c() : mOverrideVolumeMask(0) {
|
||||
// TODO offsetof
|
||||
nw4r::ut::List_Init(&mActiveControls, 0x24);
|
||||
|
||||
mpCtrls[CTRL_VOLUME] = new dSndControlPlayerVolume_c[sNumPlayers]();
|
||||
mpCtrls[CTRL_LPF_FREQ] = new dSndControlPlayerLpfFreq_c[sNumPlayers]();
|
||||
mpCtrls[CTRL_FX_SEND] = new dSndControlPlayerFxSend_c[sNumPlayers]();
|
||||
|
||||
mpSavedVolumes = new f32[sNumPlayers];
|
||||
mpTargetVolumes = new f32[sNumPlayers];
|
||||
mpMaxVolumeDecreases = new f32[sNumPlayers];
|
||||
mpMaxVolumeIncreases = new f32[sNumPlayers];
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::calc() {
|
||||
calcMuteFlags();
|
||||
calcVolumes();
|
||||
executeControls();
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::executeControls() {
|
||||
dSndControlPlayer_c *next;
|
||||
dSndControlPlayer_c *iter = static_cast<dSndControlPlayer_c *>(nw4r::ut::List_GetFirst(&mActiveControls));
|
||||
while (iter != nullptr) {
|
||||
next = static_cast<dSndControlPlayer_c *>(nw4r::ut::List_GetNext(&mActiveControls, iter));
|
||||
iter->calc();
|
||||
iter->apply();
|
||||
if (iter->isFinished()) {
|
||||
unlinkCtrl(iter);
|
||||
}
|
||||
iter = next;
|
||||
}
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::calcVolumes() {
|
||||
for (int i = 0; i < sNumPlayers; i++) {
|
||||
if ((mOverrideVolumeMask & (1 << i)) != 0) {
|
||||
// overridden volume
|
||||
mpTargetVolumes[i] = mpSavedVolumes[i];
|
||||
} else {
|
||||
// not overridden.
|
||||
f32 currentVolume = getAppliedPlayerVolume(i);
|
||||
f32 targetVolume = mpTargetVolumes[i];
|
||||
f32 maxVolumeDecrease = mpMaxVolumeDecreases[i];
|
||||
f32 maxVolumeIncrease = mpMaxVolumeIncreases[i];
|
||||
|
||||
if (currentVolume != targetVolume) {
|
||||
if (currentVolume - targetVolume > maxVolumeDecrease) {
|
||||
targetVolume = currentVolume - maxVolumeDecrease;
|
||||
} else if (targetVolume - currentVolume > maxVolumeIncrease) {
|
||||
targetVolume = currentVolume + maxVolumeIncrease;
|
||||
}
|
||||
// @bug not actually clamped
|
||||
(void)nw4r::ut::Clamp(targetVolume, 0.0f, 2.0f);
|
||||
setVolume(i, targetVolume, 0);
|
||||
}
|
||||
mpTargetVolumes[i] = 1.0f;
|
||||
mpMaxVolumeDecreases[i] = 0.1f;
|
||||
mpMaxVolumeIncreases[i] = 0.025f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::calcMuteFlags() {
|
||||
getPlayer1(dSndPlayerMgr_c::PLAYER_FAN)->ForEachSound(fanfareApplier, false);
|
||||
getPlayer1(dSndPlayerMgr_c::PLAYER_SMALL_IMPORTANT)->ForEachSound(smallApplier, false);
|
||||
getPlayer1(dSndPlayerMgr_c::PLAYER_SMALL_NORMAL)->ForEachSound(smallApplier, false);
|
||||
getPlayer1(dSndPlayerMgr_c::PLAYER_EVENT)->ForEachSound(eventApplier, false);
|
||||
|
||||
f32 volumesByGroup[CTRL_GROUP_MAX];
|
||||
for (int i = 0; i < CTRL_GROUP_MAX; i++) {
|
||||
volumesByGroup[i] = 1.0f;
|
||||
if (mTimersForGroupVolume[i][MUTE_PARTIAL] > 0) {
|
||||
mTimersForGroupVolume[i][MUTE_PARTIAL]--;
|
||||
volumesByGroup[i] = 0.3f;
|
||||
}
|
||||
|
||||
if (mTimersForGroupVolume[i][MUTE_FULL] > 0) {
|
||||
mTimersForGroupVolume[i][MUTE_FULL]--;
|
||||
volumesByGroup[i] = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (volumesByGroup[CTRL_GROUP_BGM] < 1.0f) {
|
||||
setBgmMuteVolume(volumesByGroup[CTRL_GROUP_BGM]);
|
||||
}
|
||||
|
||||
if (volumesByGroup[CTRL_GROUP_STAGE_EFFECTS] < 1.0f) {
|
||||
setStageEffectsMuteVolume(volumesByGroup[CTRL_GROUP_STAGE_EFFECTS]);
|
||||
}
|
||||
|
||||
if (volumesByGroup[CTRL_GROUP_ENEMY] < 1.0f) {
|
||||
setEnemyMuteVolume(volumesByGroup[CTRL_GROUP_ENEMY]);
|
||||
}
|
||||
|
||||
if (volumesByGroup[CTRL_GROUP_OBJECTS] < 1.0f) {
|
||||
setObjectMuteVolume(volumesByGroup[CTRL_GROUP_OBJECTS]);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::linkCtrl(dSndControlPlayer_c *ctrl) {
|
||||
if (ctrl == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (ctrl->isLinked()) {
|
||||
return;
|
||||
}
|
||||
ctrl->setLinked(true);
|
||||
nw4r::ut::List_Append(&mActiveControls, ctrl);
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::unlinkCtrl(dSndControlPlayer_c *ctrl) {
|
||||
if (ctrl == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (!ctrl->isLinked()) {
|
||||
return;
|
||||
}
|
||||
ctrl->setLinked(false);
|
||||
nw4r::ut::List_Remove(&mActiveControls, ctrl);
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::setVolume(u32 playerIdx, f32 value, s32 frames) {
|
||||
if (playerIdx >= sNumPlayers) {
|
||||
return;
|
||||
}
|
||||
|
||||
u32 mask = (1 << playerIdx);
|
||||
if ((mOverrideVolumeMask & mask) != 0) {
|
||||
// Volume is overridden, set saved volume as to not interrupt override
|
||||
mpSavedVolumes[playerIdx] = value;
|
||||
setPlayerVolumeInternal(playerIdx, value);
|
||||
} else {
|
||||
// Volume is not overridden, set volume normally
|
||||
setControlValue(CTRL_VOLUME, playerIdx, value, frames);
|
||||
mpSavedVolumes[playerIdx] = getControlTarget(CTRL_VOLUME, playerIdx);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::overrideVolume(u32 playerIdx, f32 volume, s32 frames) {
|
||||
if (playerIdx >= sNumPlayers) {
|
||||
return;
|
||||
}
|
||||
u32 mask = (1 << playerIdx);
|
||||
if ((mOverrideVolumeMask & mask) == 0) {
|
||||
mpSavedVolumes[playerIdx] = getControlTarget(CTRL_VOLUME, playerIdx);
|
||||
mOverrideVolumeMask |= mask;
|
||||
}
|
||||
setControlValue(CTRL_VOLUME, playerIdx, volume, frames);
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::restoreVolume(u32 playerIdx, s32 frames) {
|
||||
if (playerIdx >= sNumPlayers) {
|
||||
return;
|
||||
}
|
||||
u32 mask = (1 << playerIdx);
|
||||
if ((mOverrideVolumeMask & mask) == 0) {
|
||||
return;
|
||||
}
|
||||
mOverrideVolumeMask &= ~mask;
|
||||
setControlValue(CTRL_VOLUME, playerIdx, mpSavedVolumes[playerIdx], frames);
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::setLpfFreq(u32 playerIdx, f32 value, s32 frames) {
|
||||
if (playerIdx < sNumPlayers) {
|
||||
setControlValue(CTRL_LPF_FREQ, playerIdx, value, frames);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::setFxSend(u32 playerIdx, f32 value, s32 frames) {
|
||||
if (playerIdx < sNumPlayers) {
|
||||
setControlValue(CTRL_FX_SEND, playerIdx, value, frames);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::setControlValue(PlayerCtrl_e ctrlType, u32 playerIdx, f32 value, s32 frames) {
|
||||
if (ctrlType < CTRL_MAX && playerIdx < sNumPlayers) {
|
||||
dSndControlPlayer_c *ctrl = &mpCtrls[ctrlType][playerIdx];
|
||||
ctrl->set(value, frames);
|
||||
if (ctrl->isFinished()) {
|
||||
unlinkCtrl(ctrl);
|
||||
} else {
|
||||
linkCtrl(ctrl);
|
||||
}
|
||||
ctrl->apply();
|
||||
}
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::resetControls() {
|
||||
for (s32 i = 0; i < sNumPlayers; i++) {
|
||||
for (s32 ty = 0; ty < CTRL_MAX; ty++) {
|
||||
mpCtrls[ty][i].reset();
|
||||
}
|
||||
mpSavedVolumes[i] = 1.0f;
|
||||
}
|
||||
mOverrideVolumeMask = 0;
|
||||
}
|
||||
|
||||
f32 dSndControlPlayerMgr_c::getAppliedPlayerVolume(u32 playerIdx) const {
|
||||
if (playerIdx >= sNumPlayers) {
|
||||
return 0.0f;
|
||||
}
|
||||
return getPlayer1(playerIdx)->GetVolume();
|
||||
}
|
||||
|
||||
f32 dSndControlPlayerMgr_c::getControlTarget(PlayerCtrl_e ctrlType, u32 playerIdx) const {
|
||||
if (ctrlType >= CTRL_MAX) {
|
||||
return 1.0f;
|
||||
}
|
||||
if (playerIdx >= sNumPlayers) {
|
||||
return 1.0f;
|
||||
}
|
||||
return mpCtrls[ctrlType][playerIdx].getTargetValue();
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::setGroupVolumeFlag(VolumeControlGroup group, MuteLevel level) {
|
||||
if (group >= CTRL_GROUP_MAX) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (level >= MUTE_MAX) {
|
||||
return;
|
||||
}
|
||||
|
||||
mTimersForGroupVolume[group][level] = 5;
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::setPlayerVolumeInternal(u32 playerIdx, f32 volume) {
|
||||
if (playerIdx >= sNumPlayers) {
|
||||
return;
|
||||
}
|
||||
// @bug not actually clamped
|
||||
(void)nw4r::ut::Clamp(volume, 0.0f, 2.0f);
|
||||
|
||||
if (mpTargetVolumes[playerIdx] > volume) {
|
||||
mpTargetVolumes[playerIdx] = volume;
|
||||
}
|
||||
|
||||
u32 mask = (1 << playerIdx);
|
||||
if ((mOverrideVolumeMask & mask) != 0) {
|
||||
mpSavedVolumes[playerIdx] = mpTargetVolumes[playerIdx];
|
||||
}
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::setBgmMuteVolume(f32 volume) {
|
||||
for (u32 i = dSndPlayerMgr_c::PLAYER_BGM; i < dSndPlayerMgr_c::PLAYER_BGM_BOSS + 1; i++) {
|
||||
setPlayerVolumeInternal(i, volume);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::setBgmVolumeDecreaseSpeed(f32 decrease) {}
|
||||
|
||||
void dSndControlPlayerMgr_c::setStageEffectsVolume(f32 volume, s32 fadeFrames) {
|
||||
for (u32 i = dSndPlayerMgr_c::PLAYER_TG_SOUND; i <= dSndPlayerMgr_c::PLAYER_AREA_IN_WATER_LV; i++) {
|
||||
setVolume(i, volume, fadeFrames);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::setStageEffectsMuteVolume(f32 volume) {
|
||||
for (u32 i = dSndPlayerMgr_c::PLAYER_TG_SOUND; i <= dSndPlayerMgr_c::PLAYER_AREA_IN_WATER_LV; i++) {
|
||||
setPlayerVolumeInternal(i, volume);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::setEnemyMuteVolume(f32 volume) {
|
||||
for (u32 i = dSndPlayerMgr_c::PLAYER_ENEMY; i < dSndPlayerMgr_c::PLAYER_ENEMY_FOOTSTEP + 1; i++) {
|
||||
setPlayerVolumeInternal(i, volume);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndControlPlayerMgr_c::setObjectMuteVolume(f32 volume) {
|
||||
for (u32 i = dSndPlayerMgr_c::PLAYER_OBJECT_1; i < dSndPlayerMgr_c::PLAYER_TG_SOUND + 1; i++) {
|
||||
if (i != dSndPlayerMgr_c::PLAYER_NPC_VOICE) {
|
||||
setPlayerVolumeInternal(i, volume);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_calc_pitch.h"
|
||||
#include "d/snd/d_snd_sound.h"
|
||||
#include "nw4r/snd/snd_SeqSoundHandle.h"
|
||||
#include "nw4r/snd/snd_StrmSoundHandle.h"
|
||||
|
||||
// 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::configure though
|
||||
|
||||
void dSndControl_c::reset() {
|
||||
mCurrValue = mResetValue;
|
||||
mStartValue = mResetValue;
|
||||
mTargetValue = mResetValue;
|
||||
mDuration = 0;
|
||||
mTimer = 0;
|
||||
}
|
||||
|
||||
void dSndControl_c::stop() {
|
||||
mStartValue = mCurrValue;
|
||||
mTargetValue = mCurrValue;
|
||||
mDuration = 0;
|
||||
mTimer = 0;
|
||||
}
|
||||
|
||||
void dSndControl_c::set(f32 value, s32 frames) {
|
||||
stop();
|
||||
f32 clamped = value;
|
||||
if (clamped > mMax) {
|
||||
clamped = mMax;
|
||||
} else if (clamped < mMin) {
|
||||
clamped = mMin;
|
||||
}
|
||||
if (clamped != mCurrValue) {
|
||||
mTargetValue = clamped;
|
||||
if (frames == 0) {
|
||||
mCurrValue = clamped;
|
||||
} else {
|
||||
mDuration = frames;
|
||||
mTimer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dSndControl_c::calc() {
|
||||
if (mTimer < mDuration) {
|
||||
mTimer++;
|
||||
if (mTimer == mDuration) {
|
||||
mCurrValue = mTargetValue;
|
||||
} else {
|
||||
mCurrValue = mStartValue + (mTimer * (mTargetValue - mStartValue) / mDuration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dSndControlSoundVolume_c::apply(dSndSound_c *sound) {
|
||||
sound->SetVolume(mCurrValue, 0);
|
||||
}
|
||||
|
||||
void dSndControlSoundPitch_c::apply(dSndSound_c *sound) {
|
||||
sound->SetPitch(mCurrValue);
|
||||
}
|
||||
|
||||
void d_snd_control_sound_float_order() {
|
||||
-24.0f;
|
||||
24.0f;
|
||||
}
|
||||
|
||||
dSndControlSoundPitchLinear_c::dSndControlSoundPitchLinear_c() : dSndControlSound_c(0.0f, -24.0f, 24.0f) {
|
||||
mpOtherControl = nullptr;
|
||||
}
|
||||
|
||||
void dSndControlSoundPitchLinear_c::set(f32 value, s32 frames) {
|
||||
if (mpOtherControl != nullptr) {
|
||||
mCurrValue = pitchIdxTenthsForPitchScale(mpOtherControl->getCurrentValue());
|
||||
}
|
||||
|
||||
dSndControlSound_c::set(value, frames);
|
||||
}
|
||||
|
||||
void dSndControlSoundPitchLinear_c::apply(dSndSound_c *pHandle) {
|
||||
pHandle->setPitchRelated(pitchScaleForPitchIdxTenths(mCurrValue), 0);
|
||||
}
|
||||
|
||||
void dSndControlSoundSeqTempoRatio_c::apply(dSndSound_c *sound) {
|
||||
nw4r::snd::SeqSoundHandle handle(sound);
|
||||
handle.SetTempoRatio(mCurrValue);
|
||||
}
|
||||
|
||||
void dSndControlSoundSeqTrackVolume_c::apply(dSndSound_c *sound) {
|
||||
nw4r::snd::SeqSoundHandle handle(sound);
|
||||
handle.SetVolume(mMask, mCurrValue);
|
||||
}
|
||||
|
||||
void dSndControlSoundStrmTrackVolume_c::apply(dSndSound_c *sound) {
|
||||
nw4r::snd::StrmSoundHandle handle(sound);
|
||||
handle.SetVolume(mMask, mCurrValue, 0);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
#include "d/snd/d_snd_mgr.h"
|
||||
|
||||
#include "d/snd/d_snd_3d_manager.h"
|
||||
#include "d/snd/d_snd_area_sound_effect_mgr.h"
|
||||
#include "d/snd/d_snd_control_player_mgr.h"
|
||||
#include "d/snd/d_snd_player_mgr.h"
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
#include "d/snd/d_snd_source_mgr.h"
|
||||
#include "egg/audio/eggAudioRmtSpeakerMgr.h"
|
||||
#include "egg/audio/eggAudioUtility.h"
|
||||
|
||||
extern "C" void initEnemySoundMgr();
|
||||
extern "C" void initFanfareSoundMgr();
|
||||
extern "C" void initSomeUnusedSoundMgr();
|
||||
extern "C" void fn_80393530();
|
||||
extern "C" void fn_80394830();
|
||||
extern "C" void fn_8037F940();
|
||||
extern "C" void fn_80399600();
|
||||
extern "C" void fn_80399C20();
|
||||
|
||||
dSndMgr_c *dSndMgr_c::sInstance;
|
||||
|
||||
dSndMgr_c::dSndMgr_c(): field_0x6CC(0) {
|
||||
sInstance = this;
|
||||
dSndPlayerMgr_c::create();
|
||||
dSndControlPlayerMgr_c::create();
|
||||
initEnemySoundMgr();
|
||||
dSnd3DManager_c::create();
|
||||
initFanfareSoundMgr();
|
||||
initSomeUnusedSoundMgr();
|
||||
dSndSmallEffectMgr_c::create();
|
||||
dSndAreaSoundEffectMgr_c::create();
|
||||
dSndSourceMgr_c::create();
|
||||
fn_80393530();
|
||||
fn_80394830();
|
||||
fn_8037F940();
|
||||
fn_80399600();
|
||||
fn_80399C20();
|
||||
|
||||
initHbm(9);
|
||||
}
|
||||
|
||||
void dSndMgr_c::initialize(EGG::Heap *heap, u32 size) {}
|
||||
|
||||
void dSndMgr_c::initHbm(u32 frame) {
|
||||
EGG::AudioUtility::HBM::init(this, restoreEffectsCallback, frame);
|
||||
}
|
||||
|
||||
void dSndMgr_c::calc() {
|
||||
if (field_0x6CC) {
|
||||
EGG::SimpleAudioMgr::calc();
|
||||
EGG::AudioRmtSpeakerMgr::calc();
|
||||
dSndPlayerMgr_c::GetInstance()->calc();
|
||||
}
|
||||
}
|
||||
|
||||
void dSndMgr_c::restoreEffectsCallback() {}
|
||||
@@ -0,0 +1,170 @@
|
||||
|
||||
#include "d/snd/d_snd_player_mgr.h"
|
||||
|
||||
#include "common.h"
|
||||
#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"
|
||||
#include "nw4r/snd/snd_SoundStartable.h"
|
||||
#include "sized_string.h"
|
||||
|
||||
const char *dSndPlayerMgr_c::getSoundArchivePath() {
|
||||
return "Sound/WZSound.brsar";
|
||||
}
|
||||
|
||||
SND_DISPOSER_DEFINE(dSndPlayerMgr_c);
|
||||
|
||||
dSndPlayerMgr_c::dSndPlayerMgr_c()
|
||||
: field_0x010(0), field_0x011(0), field_0x014(-1), field_0x018(-1), field_0x01C(-1), mFlags(0) {}
|
||||
|
||||
void dSndPlayerMgr_c::enterPauseState() {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setVolume(PLAYER_FAN, 0.3f, 5);
|
||||
dSndControlPlayerMgr_c::GetInstance()->setVolume(PLAYER_AREA, 0.3f, 5);
|
||||
dSndControlPlayerMgr_c::GetInstance()->setVolume(PLAYER_AREA_IN_WATER_LV, 0.3f, 5);
|
||||
// has other effects, such as reducing BGM volume
|
||||
onFlag(MGR_PAUSE);
|
||||
}
|
||||
|
||||
u32 dSndPlayerMgr_c::getFreeSize() {
|
||||
return dSndMgr_c::GetInstance()->getSoundHeap()->GetFreeSize();
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::leavePauseState() {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setVolume(PLAYER_FAN, 1.0f, 5);
|
||||
dSndControlPlayerMgr_c::GetInstance()->setVolume(PLAYER_AREA, 1.0f, 5);
|
||||
dSndControlPlayerMgr_c::GetInstance()->setVolume(PLAYER_AREA_IN_WATER_LV, 1.0f, 5);
|
||||
offFlag(MGR_PAUSE);
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::enterMenu() {
|
||||
enterPauseState();
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_MENU_IN);
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::leaveMenu() {
|
||||
leavePauseState();
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_MENU_OUT);
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::enterMap() {
|
||||
enterPauseState();
|
||||
onFlag(MGR_MAP);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_MAP_OPEN);
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::leaveMap() {
|
||||
leavePauseState();
|
||||
offFlag(MGR_MAP);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_MAP_CLOSE);
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::enterHelp() {
|
||||
onFlag(MGR_HELP);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_HELP_IN);
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::leaveHelp() {
|
||||
offFlag(MGR_HELP);
|
||||
dSndSmallEffectMgr_c::GetInstance()->playSound(SE_S_HELP_OUT);
|
||||
}
|
||||
|
||||
nw4r::snd::SoundStartable::StartResult dSndPlayerMgr_c::startSound(
|
||||
nw4r::snd::SoundHandle *pHandle, u32 soundId, const nw4r::snd::SoundStartable::StartInfo *pStartInfo
|
||||
) {
|
||||
if (checkFlag(MGR_UNK_0x2)) {
|
||||
return nw4r::snd::SoundStartable::START_ERR_USER;
|
||||
}
|
||||
|
||||
nw4r::snd::SoundHandle handle;
|
||||
if (pHandle == nullptr) {
|
||||
pHandle = &handle;
|
||||
}
|
||||
nw4r::snd::SoundStartable::StartResult res;
|
||||
if (pStartInfo != nullptr) {
|
||||
res = dSndMgr_c::getPlayer()->detail_StartSound(pHandle, soundId, pStartInfo);
|
||||
} else {
|
||||
res = dSndMgr_c::getPlayer()->detail_StartSound(pHandle, soundId, nullptr);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
nw4r::snd::SoundStartable::StartResult dSndPlayerMgr_c::startSound(
|
||||
nw4r::snd::SoundHandle *pHandle, const char *soundLabel, const nw4r::snd::SoundStartable::StartInfo *pStartInfo
|
||||
) {
|
||||
u32 id = dSndPlayerMgr_c::GetInstance()->convertLabelStringToSoundId(soundLabel);
|
||||
return startSound(pHandle, id, pStartInfo);
|
||||
}
|
||||
|
||||
u32 dSndPlayerMgr_c::convertLabelStringToSoundId(const char *label) const {
|
||||
return dSndMgr_c::GetInstance()->changeNameToId(label);
|
||||
}
|
||||
|
||||
nw4r::snd::SoundArchivePlayer &dSndPlayerMgr_c::getSoundArchivePlayerForType(u8 sourceType) {
|
||||
if (canUseThisPlayer(sourceType)) {
|
||||
return mSoundArchivePlayer;
|
||||
}
|
||||
return *dSndMgr_c::getPlayer();
|
||||
}
|
||||
|
||||
bool dSndPlayerMgr_c::canUseThisPlayer(u8 sourceType) const {
|
||||
if (!mSoundArchivePlayer.IsAvailable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (sourceType) {
|
||||
case SND_SOURCE_PLAYER:
|
||||
case SND_SOURCE_PLAYER_HEAD:
|
||||
case SND_SOURCE_58:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool dSndPlayerMgr_c::loadDemoArchive(const char *demoArchiveName) {
|
||||
if (demoArchiveName == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int stateId = dSndMgr_c::GetInstance()->saveState();
|
||||
SizedString<64> path;
|
||||
path.sprintf("Sound/demo/%s.brsar", demoArchiveName);
|
||||
void *buf = dSndMgr_c::GetInstance()->getSoundHeap()->Alloc(getFreeSize() - 0x40000);
|
||||
if (buf == nullptr) {
|
||||
return false;
|
||||
}
|
||||
bool ok = false;
|
||||
u32 amountRead = 0;
|
||||
u32 fileSize = 0;
|
||||
EGG::DvdRipper::Arg arg(path, (u8 *)buf, nullptr, EGG::DvdRipper::ALLOC_DIR_TOP, 0, &amountRead, &fileSize);
|
||||
void *ptr = EGG::DvdRipper::loadToMainRAM(arg);
|
||||
if (ptr != nullptr) {
|
||||
ok = mSoundArchive.Setup(ptr);
|
||||
if (ok) {
|
||||
u32 size = mSoundArchivePlayer.GetRequiredMemSize(&mSoundArchive);
|
||||
void *buf2 = dSndMgr_c::GetInstance()->getSoundHeap()->Alloc(size);
|
||||
if (buf2 != nullptr) {
|
||||
ok = mSoundArchivePlayer.Setup(&mSoundArchive, buf2, size, nullptr, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ok) {
|
||||
dSndMgr_c::GetInstance()->loadState(stateId);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::shutdown() {
|
||||
mSoundArchivePlayer.Shutdown();
|
||||
mSoundArchive.Shutdown();
|
||||
}
|
||||
|
||||
void dSndPlayerMgr_c::calc() {
|
||||
if (mSoundArchivePlayer.IsAvailable()) {
|
||||
mSoundArchivePlayer.Update();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
#include "d/snd/d_snd_small_effect_mgr.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_checkers.h"
|
||||
#include "d/snd/d_snd_control_player_mgr.h"
|
||||
#include "d/snd/d_snd_player_mgr.h"
|
||||
#include "d/snd/d_snd_source.h"
|
||||
#include "d/snd/d_snd_source_if.h"
|
||||
#include "d/snd/d_snd_util.h"
|
||||
#include "d/snd/d_snd_wzsound.h"
|
||||
#include "nw4r/snd/snd_SeqSoundHandle.h"
|
||||
#include "rvl/OS/OSFastCast.h"
|
||||
#include "toBeSorted/music_mgrs.h"
|
||||
|
||||
SND_DISPOSER_DEFINE(dSndSmallEffectMgr_c)
|
||||
|
||||
dSndSmallEffectMgr_c::dSndSmallEffectMgr_c() : mTextboxAdvanceSound(-1), field_0x40(0), field_0x42(0), field_0x44(0) {
|
||||
// probably arrays
|
||||
field_0x28 = -1;
|
||||
field_0x30 = 0;
|
||||
field_0x2C = -1;
|
||||
field_0x34 = 0;
|
||||
}
|
||||
|
||||
bool dSndSmallEffectMgr_c::playSound(u32 soundId) {
|
||||
if (soundId >= SE_S_BUTTON_CALL_L && soundId <= SE_S_PLAY_GUIDE_BUTTON_BLINK) {
|
||||
soundId = SE_S_BUTTON_CALL_L;
|
||||
} else if (soundId >= SE_S_BUTTON_CALL_R && soundId <= SE_S_2_BUTTON_BLINK) {
|
||||
soundId = SE_S_BUTTON_CALL_R;
|
||||
} else {
|
||||
switch (soundId) {
|
||||
case SE_S_BOSS_KEY_TRANS: {
|
||||
stopSounds(dSndPlayerMgr_c::PLAYER_SMALL_NORMAL, SE_S_BOSS_KEY_TRANS_OFF, 5);
|
||||
break;
|
||||
}
|
||||
case SE_S_BOSS_KEY_TRANS_OFF: {
|
||||
stopSounds(dSndPlayerMgr_c::PLAYER_SMALL_NORMAL, SE_S_BOSS_KEY_TRANS, 5);
|
||||
break;
|
||||
}
|
||||
case SE_S_HP_GAUGE_UP: {
|
||||
if (isPlayingSound(dSndPlayerMgr_c::PLAYER_SMALL_NORMAL, SE_S_HEART_PIECE_GET)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SE_S_HEART_PIECE_GET: {
|
||||
if (isPlayingSound(dSndPlayerMgr_c::PLAYER_SMALL_NORMAL, SE_S_HP_GAUGE_UP)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SE_S_MAP_OPEN:
|
||||
case SE_S_MENU_IN: {
|
||||
stopSounds(dSndPlayerMgr_c::PLAYER_SMALL_NORMAL, SE_S_HELP_OUT, 1);
|
||||
break;
|
||||
}
|
||||
case SE_S_HELP_OUT: {
|
||||
if (isPlayingSound(dSndPlayerMgr_c::PLAYER_SMALL_NORMAL, SE_S_MENU_IN) ||
|
||||
isPlayingSound(dSndPlayerMgr_c::PLAYER_SMALL_NORMAL, SE_S_MAP_OPEN)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
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 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 false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SE_S_ITEM_SELECT_START: {
|
||||
if (isPlayingSound(dSndPlayerMgr_c::PLAYER_SMALL_NORMAL, SE_S_BM_KEEP_ERROR)) {
|
||||
soundId = SE_S_ITEM_SELECT_START_WAIT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SE_S_SKIP: {
|
||||
if (fn_80364DA0(ENEMY_SOUND_MGR)) {
|
||||
fn_80365020(ENEMY_SOUND_MGR);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SE_S_WINDOW_PRESS_A: {
|
||||
if (isPlayingSound(dSndPlayerMgr_c::PLAYER_SMALL_IMPORTANT, SE_S_POINTER_OK)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SE_S_MENU_P1_HOLD_POINTER: {
|
||||
stopSounds(dSndPlayerMgr_c::PLAYER_SMALL_NORMAL, SE_S_MENU_P1_POINT_ITEM, 0);
|
||||
break;
|
||||
}
|
||||
case SE_S_MENU_P1_POINT_ITEM: {
|
||||
if (isPlayingSound(dSndPlayerMgr_c::PLAYER_SMALL_NORMAL, SE_S_MENU_P1_HOLD_POINTER)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SE_S_FIRST_PERSON_ON:
|
||||
case SE_S_FIRST_PERSON_OFF: {
|
||||
if (!isPlayingSound(dSndPlayerMgr_c::PLAYER_SMALL_NORMAL, SE_S_DOWSING_SELECT_START)) {
|
||||
playSound(SE_S_DOWSING_SELECT_START);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SE_S_DOWSING_WAIT:
|
||||
if (isPlayingSound(dSndPlayerMgr_c::PLAYER_SMALL_NORMAL, SE_S_FIRST_PERSON_ON)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return playSoundInternal(soundId);
|
||||
}
|
||||
|
||||
bool dSndSmallEffectMgr_c::playSoundWithPan(u32 soundId, f32 pan) {
|
||||
bool ok = playSoundInternal(soundId);
|
||||
if (ok) {
|
||||
if (pan > 1.0f) {
|
||||
pan = 1.0f;
|
||||
} else if (pan < -1.0f) {
|
||||
pan = -1.0f;
|
||||
}
|
||||
mNormalSound.SetPan(pan);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
void dSndSmallEffectMgr_c::stopSounds(u32 playerIdx, u32 soundId, s32 fadeFrames) {
|
||||
SoundStopper stopper(soundId, fadeFrames);
|
||||
dSndControlPlayerMgr_c::GetInstance()->getPlayer1(playerIdx)->ForEachSound(stopper, false);
|
||||
}
|
||||
|
||||
void dSndSmallEffectMgr_c::stopSounds(u32 soundId, s32 fadeFrames) {
|
||||
for (s32 playerId = dSndPlayerMgr_c::PLAYER_SMALL_IMPORTANT; playerId <= dSndControlPlayerMgr_c::sPlayerMax;
|
||||
playerId++) {
|
||||
stopSounds(playerId, soundId, fadeFrames);
|
||||
}
|
||||
}
|
||||
|
||||
bool dSndSmallEffectMgr_c::isPlayingSound(u32 playerIdx, u32 soundId) {
|
||||
bool isPlaying = false;
|
||||
IsCurrentSoundIdChecker check(soundId, &isPlaying);
|
||||
dSndControlPlayerMgr_c::GetInstance()->getPlayer1(playerIdx)->ForEachSound(check, false);
|
||||
return isPlaying;
|
||||
}
|
||||
|
||||
bool dSndSmallEffectMgr_c::isPlayingSound(u32 soundId) {
|
||||
for (s32 playerId = dSndPlayerMgr_c::PLAYER_SMALL_IMPORTANT; playerId <= dSndControlPlayerMgr_c::sPlayerMax;
|
||||
playerId++) {
|
||||
if (isPlayingSound(playerId, soundId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool dSndSmallEffectMgr_c::playButtonPressSoundWhenAdvancingTextBoxes(f32 ratio) {
|
||||
if (mTextboxAdvanceSound == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ok = playSound(mTextboxAdvanceSound);
|
||||
if (ok) {
|
||||
s16 varValue;
|
||||
f32 value = ratio * 100.0f;
|
||||
OSf32tos16(&value, &varValue);
|
||||
nw4r::snd::SeqSoundHandle handle(&mNormalSound);
|
||||
handle.WriteVariable(10, varValue);
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
void dSndSmallEffectMgr_c::resetButtonPressSound() {
|
||||
mTextboxAdvanceSound = -1;
|
||||
}
|
||||
|
||||
void dSndSmallEffectMgr_c::setButtonPressSound(dSoundSource_c *source) {
|
||||
resetButtonPressSound();
|
||||
if (source != nullptr) {
|
||||
mTextboxAdvanceSound = dSoundSource_c::getCharacterTalkSoundId(SE_S_TALK_CHAR, source);
|
||||
if (mTextboxAdvanceSound == SE_S_TALK_CHAR) {
|
||||
resetButtonPressSound();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,396 @@
|
||||
#include "d/snd/d_snd_sound.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_mgr.h"
|
||||
#include "d/snd/d_snd_player_mgr.h"
|
||||
#include "nw4r/snd/snd_SeqSoundHandle.h"
|
||||
#include "nw4r/snd/snd_SoundArchive.h"
|
||||
#include "nw4r/snd/snd_SoundStartable.h"
|
||||
#include "nw4r/ut/ut_list.h"
|
||||
#include "toBeSorted/music_mgrs.h"
|
||||
|
||||
dSndSound_c::dSndSound_c()
|
||||
: mPrevStartOffset(0), mIsPreparing(false), mPauseFlag(false), mIsRunning(false), mIsFadingOut(false) {
|
||||
nw4r::ut::List_Init(&mList, 0x24);
|
||||
|
||||
mpCtrlSeqTrackVolume = new dSndControlSoundSeqTrackVolume_c[16]();
|
||||
for (int i = 0; i < 16; i++) {
|
||||
mpCtrlSeqTrackVolume[i].setMask(1 << i);
|
||||
}
|
||||
|
||||
mpCtrlStrmTrackVolume = new dSndControlSoundStrmTrackVolume_c[3]();
|
||||
// @bug should be 3, not 16
|
||||
for (int i = 0; i < 16; i++) {
|
||||
mpCtrlStrmTrackVolume[i].setMask(1 << i);
|
||||
}
|
||||
|
||||
mLinearPitch.setControl(&mCtrlPitch);
|
||||
resetControls();
|
||||
}
|
||||
|
||||
dSndSound_c::~dSndSound_c() {
|
||||
if (mpCtrlSeqTrackVolume != nullptr) {
|
||||
delete[] mpCtrlSeqTrackVolume;
|
||||
}
|
||||
if (mpCtrlStrmTrackVolume != nullptr) {
|
||||
delete[] mpCtrlStrmTrackVolume;
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSound_c::cancel() {
|
||||
if (canCancel()) {
|
||||
resetControls();
|
||||
mIsRunning = false;
|
||||
mIsFadingOut = false;
|
||||
mIsPreparing = false;
|
||||
mPrevStartOffset = 0;
|
||||
fn_80373900(FANFARE_SOUND_MGR, this);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSound_c::resetControls() {
|
||||
mCtrlVolume.reset();
|
||||
mCtrlVolume.apply(this);
|
||||
mCtrlPitch.reset();
|
||||
mCtrlPitch.apply(this);
|
||||
mLinearPitch.reset();
|
||||
mLinearPitch.apply(this);
|
||||
mpCtrlSeqTempoRatio.reset();
|
||||
mpCtrlSeqTempoRatio.apply(this);
|
||||
mPauseFlag = 0;
|
||||
resetTrackVolumes();
|
||||
}
|
||||
|
||||
void dSndSound_c::calc() {
|
||||
if (mIsRunning && !IsAttachedSound()) {
|
||||
cancel();
|
||||
}
|
||||
|
||||
dSndControlSound_c *next;
|
||||
dSndControlSound_c *iter = static_cast<dSndControlSound_c *>(nw4r::ut::List_GetFirst(&mList));
|
||||
while (iter != nullptr) {
|
||||
next = static_cast<dSndControlSound_c *>(nw4r::ut::List_GetNext(&mList, iter));
|
||||
iter->calc();
|
||||
iter->apply(this);
|
||||
if (iter->isFinished()) {
|
||||
unlinkCtrl(iter);
|
||||
}
|
||||
iter = next;
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSound_c::fadeIn(u32 id, s32 fadeFrames) {
|
||||
if (id != -1) {
|
||||
if (fadeFrames != 0) {
|
||||
FadeIn(fadeFrames);
|
||||
}
|
||||
cancel();
|
||||
mIsRunning = true;
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSound_c::stop(s32 fadeFrames) {
|
||||
if (isRunning()) {
|
||||
Stop(fadeFrames);
|
||||
|
||||
if (fadeFrames != 0) {
|
||||
mIsFadingOut = true;
|
||||
} else {
|
||||
cancel();
|
||||
}
|
||||
} else {
|
||||
if (!isPreparing()) {
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSound_c::pause(bool pauseFlag, s32 fadeFrames) {
|
||||
if (!IsAttachedSound()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((pauseFlag && !IsPause()) || (!pauseFlag && IsPause())) {
|
||||
Pause(pauseFlag, fadeFrames);
|
||||
mPauseFlag = pauseFlag;
|
||||
}
|
||||
}
|
||||
|
||||
bool dSndSound_c::isStrmSound() {
|
||||
if (!IsAttachedSound()) {
|
||||
return false;
|
||||
}
|
||||
return dSndMgr_c::GetInstance()->getArchive()->GetSoundType(GetId()) == nw4r::snd::SoundArchive::SOUND_TYPE_STRM;
|
||||
}
|
||||
|
||||
bool dSndSound_c::isWaveSound() {
|
||||
if (!IsAttachedSound()) {
|
||||
return false;
|
||||
}
|
||||
return dSndMgr_c::GetInstance()->getArchive()->GetSoundType(GetId()) == nw4r::snd::SoundArchive::SOUND_TYPE_WAVE;
|
||||
}
|
||||
|
||||
bool dSndSound_c::isSeqSound() {
|
||||
if (!IsAttachedSound()) {
|
||||
return false;
|
||||
}
|
||||
return dSndMgr_c::GetInstance()->getArchive()->GetSoundType(GetId()) == nw4r::snd::SoundArchive::SOUND_TYPE_SEQ;
|
||||
}
|
||||
|
||||
void dSndSound_c::linkCtrl(dSndControlSound_c *ctrl) {
|
||||
if (ctrl == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (ctrl->isLinked()) {
|
||||
return;
|
||||
}
|
||||
ctrl->setLinked(true);
|
||||
nw4r::ut::List_Append(&mList, ctrl);
|
||||
}
|
||||
|
||||
void dSndSound_c::unlinkCtrl(dSndControlSound_c *ctrl) {
|
||||
if (ctrl == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (!ctrl->isLinked()) {
|
||||
return;
|
||||
}
|
||||
ctrl->setLinked(false);
|
||||
nw4r::ut::List_Remove(&mList, ctrl);
|
||||
}
|
||||
|
||||
s16 dSndSound_c::readSeqTrackVariable(int varNo) {
|
||||
if (!isSeqSound()) {
|
||||
return -1;
|
||||
}
|
||||
s16 val = -1;
|
||||
nw4r::snd::SeqSoundHandle handle(this);
|
||||
handle.ReadVariable(varNo, &val);
|
||||
return val;
|
||||
}
|
||||
|
||||
void dSndSound_c::writeSeqTrackVariable(int varNo, s16 value) {
|
||||
if (!isSeqSound()) {
|
||||
return;
|
||||
}
|
||||
nw4r::snd::SeqSoundHandle handle(this);
|
||||
handle.WriteVariable(varNo, value);
|
||||
}
|
||||
|
||||
void dSndSound_c::setControlValue(dSndControlSound_c *ctrl, f32 value, s32 frames) {
|
||||
ctrl->set(value, frames);
|
||||
|
||||
if (ctrl->isFinished()) {
|
||||
unlinkCtrl(ctrl);
|
||||
} else {
|
||||
linkCtrl(ctrl);
|
||||
}
|
||||
|
||||
ctrl->apply(this);
|
||||
}
|
||||
|
||||
void dSndSound_c::setVolume(f32 volume, s32 frames) {
|
||||
if (IsAttachedSound()) {
|
||||
setControlValue(&mCtrlVolume, volume, frames);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSound_c::setPitchRelated(f32 pitch, s32 frames) {
|
||||
if (IsAttachedSound()) {
|
||||
setControlValue(&mCtrlPitch, pitch, frames);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSound_c::setLinearPitch(f32 pitch, s32 frames) {
|
||||
if (IsAttachedSound()) {
|
||||
setControlValue(&mLinearPitch, pitch, frames);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSound_c::resetTrackVolumes() {
|
||||
if (mpCtrlSeqTrackVolume != nullptr) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
mpCtrlSeqTrackVolume[i].reset();
|
||||
mpCtrlSeqTrackVolume[i].apply(this);
|
||||
}
|
||||
}
|
||||
|
||||
if (mpCtrlStrmTrackVolume != nullptr) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
mpCtrlStrmTrackVolume[i].reset();
|
||||
mpCtrlStrmTrackVolume[i].apply(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSound_c::setTrackVolume(u32 trackFlags, f32 volume, s32 frames) {
|
||||
if (trackFlags != 0 && IsAttachedSound()) {
|
||||
switch (dSndMgr_c::GetInstance()->getArchive()->GetSoundType(GetId())) {
|
||||
case nw4r::snd::SoundArchive::SOUND_TYPE_SEQ: {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if ((trackFlags & (u16)(1 << i)) != 0) {
|
||||
setControlValue(&mpCtrlSeqTrackVolume[i], volume, frames);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case nw4r::snd::SoundArchive::SOUND_TYPE_STRM: {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if ((trackFlags & (u16)(1 << i)) != 0) {
|
||||
setControlValue(&mpCtrlStrmTrackVolume[i], volume, frames);
|
||||
}
|
||||
}
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSound_c::setStrmTrackVolume(u32 trackFlags, f32 volume, s32 frames) {
|
||||
if (trackFlags != 0 && IsAttachedSound()) {
|
||||
switch (dSndMgr_c::GetInstance()->getArchive()->GetSoundType(GetId())) {
|
||||
case nw4r::snd::SoundArchive::SOUND_TYPE_STRM: {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if ((trackFlags & (u16)(1 << i)) != 0) {
|
||||
setControlValue(&mpCtrlStrmTrackVolume[i], volume, frames);
|
||||
}
|
||||
}
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSound_c::setSingleSeqTrackVolume(u16 index, f32 volume, s32 frames) {
|
||||
if (IsAttachedSound() && index < 16) {
|
||||
switch (dSndMgr_c::GetInstance()->getArchive()->GetSoundType(GetId())) {
|
||||
case nw4r::snd::SoundArchive::SOUND_TYPE_SEQ: {
|
||||
setControlValue(&mpCtrlSeqTrackVolume[index], volume, frames);
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSound_c::setSingleStrmTrackVolume(u16 index, f32 volume, s32 frames) {
|
||||
if (IsAttachedSound() && index < 3) {
|
||||
switch (dSndMgr_c::GetInstance()->getArchive()->GetSoundType(GetId())) {
|
||||
case nw4r::snd::SoundArchive::SOUND_TYPE_STRM: {
|
||||
setControlValue(&mpCtrlStrmTrackVolume[index], volume, frames);
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSound_c::setEachSeqTrackVolume(u32 trackFlags, f32 frames) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if ((trackFlags & (u16)(1 << i)) != 0) {
|
||||
setSingleSeqTrackVolume(i, 1.0f, (u32)frames);
|
||||
} else {
|
||||
setSingleSeqTrackVolume(i, 0.0f, (u32)frames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSound_c::setEachStrmTrackVolume(u32 trackFlags, f32 frames) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if ((trackFlags & (u16)(1 << i)) != 0) {
|
||||
setSingleStrmTrackVolume(i, 1.0f, (u32)frames);
|
||||
} else {
|
||||
setSingleStrmTrackVolume(i, 0.0f, (u32)frames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
f32 dSndSound_c::getCurrentStrmTrackVolume(u32 index) const {
|
||||
if (index >= 3) {
|
||||
return 0.0f;
|
||||
}
|
||||
return mpCtrlStrmTrackVolume[index].getCurrentValue();
|
||||
}
|
||||
|
||||
void dSndSound_c::setSeqTempoRatio(f32 ratio, s32 frames) {
|
||||
if (isSeqSound()) {
|
||||
setControlValue(&mpCtrlSeqTempoRatio, ratio, frames);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSound_c::setSeqTrackMute(u32 trackFlags, nw4r::snd::SeqMute mute) {
|
||||
if (isSeqSound()) {
|
||||
nw4r::snd::SeqSoundHandle handle(this);
|
||||
handle.SetTrackMute(trackFlags, mute);
|
||||
}
|
||||
}
|
||||
|
||||
nw4r::snd::SoundStartable::StartResult dSndSound_c::prepareSound(u32 soundId, u32 startOffset) {
|
||||
if (soundId == -1) {
|
||||
return nw4r::snd::SoundStartable::START_ERR_USER;
|
||||
}
|
||||
|
||||
if (cannotStart()) {
|
||||
return nw4r::snd::SoundStartable::START_ERR_USER;
|
||||
}
|
||||
|
||||
if (isPreparingSoundId(soundId)) {
|
||||
if (mPrevStartOffset == startOffset) {
|
||||
return nw4r::snd::SoundStartable::START_ERR_USER;
|
||||
}
|
||||
forceStop();
|
||||
} else {
|
||||
if (isPreparing()) {
|
||||
forceStop();
|
||||
} else {
|
||||
fn_80372920(FANFARE_SOUND_MGR);
|
||||
}
|
||||
}
|
||||
|
||||
nw4r::snd::SoundStartable::StartResult res;
|
||||
if (startOffset == 0) {
|
||||
res = dSndMgr_c::GetInstance()->getPlayer()->detail_PrepareSound(this, soundId, nullptr);
|
||||
} else {
|
||||
nw4r::snd::SoundStartable::StartInfo info;
|
||||
info.enableFlag |= nw4r::snd::SoundStartable::StartInfo::ENABLE_START_OFFSET;
|
||||
info.startOffsetType = nw4r::snd::SoundStartable::StartInfo::START_OFFSET_TYPE_MILLISEC;
|
||||
info.startOffset = startOffset;
|
||||
res = dSndMgr_c::GetInstance()->getPlayer()->detail_PrepareSound(this, soundId, &info);
|
||||
}
|
||||
|
||||
if (res == nw4r::snd::SoundStartable::START_SUCCESS) {
|
||||
onPreparing(soundId, startOffset);
|
||||
} else {
|
||||
cancel();
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
nw4r::snd::SoundStartable::StartResult dSndSound_c::prepareSound(const char *label, u32 startOffset) {
|
||||
u32 id = dSndPlayerMgr_c::GetInstance()->convertLabelStringToSoundId(label);
|
||||
return prepareSound(id, startOffset);
|
||||
}
|
||||
|
||||
void dSndSound_c::onPreparing(u32 soundId, u32 startOffset) {
|
||||
if (soundId != -1) {
|
||||
cancel();
|
||||
mPrevStartOffset = startOffset;
|
||||
mIsPreparing = true;
|
||||
fn_803738B0(FANFARE_SOUND_MGR, this);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSound_c::forceStop() {
|
||||
cancel();
|
||||
Stop(0);
|
||||
}
|
||||
|
||||
// Might be a separate file
|
||||
void dSndControl_c::configure(f32 value, f32 min, f32 max) {
|
||||
mResetValue = value;
|
||||
mMin = min;
|
||||
mMax = max;
|
||||
mCurrValue = value;
|
||||
mStartValue = value;
|
||||
mTargetValue = value;
|
||||
reset();
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
#include "d/snd/d_snd_source.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_3d_actor.h"
|
||||
#include "d/snd/d_snd_3d_manager.h"
|
||||
#include "d/snd/d_snd_mgr.h"
|
||||
#include "d/snd/d_snd_player_mgr.h"
|
||||
#include "d/snd/d_snd_source_group.h"
|
||||
#include "d/snd/d_snd_source_mgr.h"
|
||||
#include "nw4r/snd/snd_SoundStartable.h"
|
||||
#include "nw4r/ut/ut_list.h"
|
||||
#include "sized_string.h"
|
||||
|
||||
struct d_snd_mgr_unk_6_sinit {
|
||||
d_snd_mgr_unk_6_sinit() : field_0x00(0), field_0x04(0.0f) {}
|
||||
|
||||
u32 field_0x00;
|
||||
f32 field_0x04;
|
||||
};
|
||||
|
||||
d_snd_mgr_unk_6_sinit d_snd_mgr_unk_6_sinit_instance;
|
||||
|
||||
const char *help_i_need_data() {
|
||||
return "%s_%s_%d";
|
||||
}
|
||||
|
||||
dSoundSource_c::dSoundSource_c(u8 sourceType, dAcBase_c *player, const char *name, dSndSourceGroup_c *pOwnerGroup)
|
||||
: dSnd3DActor_c(pOwnerGroup->getAmbientParam(), sourceType),
|
||||
mpName(name),
|
||||
field_0x0F4(0),
|
||||
mpPlayer(player),
|
||||
mSourceType(sourceType),
|
||||
field_0x0FE(0),
|
||||
field_0x0FF(0),
|
||||
field_0x100(0),
|
||||
field_0x101(0),
|
||||
field_0x102(0),
|
||||
field_0x104(0),
|
||||
field_0x108(0),
|
||||
field_0x10C(0),
|
||||
field_0x11C(0),
|
||||
mpOwnerGroup(pOwnerGroup),
|
||||
field_0x154(0),
|
||||
field_0x158(-1),
|
||||
field_0x15A(-1) {
|
||||
mSourceCategory = dSndSourceMgr_c::getSourceCategoryForSourceType(sourceType, name);
|
||||
// TODO: Offsetof
|
||||
nw4r::ut::List_Init(&field_0x110, 0xEC);
|
||||
nw4r::ut::List_Init(&field_0x120, 0x04);
|
||||
nw4r::ut::List_Init(&field_0x12C, 0x04);
|
||||
pOwnerGroup->registerSource(this);
|
||||
}
|
||||
|
||||
dSoundSource_c::~dSoundSource_c() {
|
||||
SetUserParam(0);
|
||||
vt_0x44();
|
||||
d_s_vt_0x1BC();
|
||||
dSndSourceMgr_c::GetInstance()->unregisterSource(this);
|
||||
mpOwnerGroup->unregisterSource(this);
|
||||
}
|
||||
|
||||
const nw4r::math::VEC3 &dSoundSource_c::getListenerPosition() const {
|
||||
return dSnd3DManager_c::GetInstance()->getSndListenerPos();
|
||||
}
|
||||
|
||||
bool dSoundSource_c::hasPlayingSounds() const {
|
||||
return dSnd3DActor_c::hasPlayingSounds();
|
||||
}
|
||||
|
||||
bool dSoundSource_c::isPlayingSound(u32 soundId) {
|
||||
return dSnd3DActor_c::isPlayingSound(soundId);
|
||||
}
|
||||
|
||||
bool dSoundSource_c::isPlayingSound(const char *soundId) {
|
||||
return isPlayingSound(soundLabelToSoundId(soundId));
|
||||
}
|
||||
|
||||
void dSoundSource_c::d_vt_0x38(bool flag, int fadeFrames) {
|
||||
if (flag == 0) {
|
||||
PauseAllSound(flag, fadeFrames);
|
||||
d_s_vt_0x1C4(flag, fadeFrames);
|
||||
a_field_0x80 = 0;
|
||||
} else if (a_field_0x7E == 0) {
|
||||
PauseAllSound(flag, fadeFrames);
|
||||
d_s_vt_0x1C4(flag, fadeFrames);
|
||||
a_field_0x80 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
nw4r::snd::SoundStartable::StartResult
|
||||
dSoundSource_c::SetupSound(nw4r::snd::SoundHandle *pHandle, u32 soundId, const StartInfo *pStartInfo, void *) {
|
||||
// TODO
|
||||
return START_SUCCESS;
|
||||
}
|
||||
|
||||
void dSoundSource_c::d_vt_0x58() {
|
||||
// noop
|
||||
}
|
||||
|
||||
void dSoundSource_c::d_vt_0x5C() {
|
||||
// noop
|
||||
}
|
||||
|
||||
u32 dSoundSource_c::getCharacterTalkSoundId(u32 baseSoundId, dSoundSource_c *source) {
|
||||
if (baseSoundId != -1 && source != nullptr) {
|
||||
SizedString<64> label;
|
||||
|
||||
// maybe an inline
|
||||
const char *baseLabel = nullptr;
|
||||
if (dSndMgr_c::GetInstance()->getArchive() != nullptr) {
|
||||
baseLabel = dSndMgr_c::GetInstance()->getArchive()->GetSoundLabelString(baseSoundId);
|
||||
}
|
||||
|
||||
const char *charLabel = source->getName();
|
||||
label.sprintf("%s_%s", baseLabel, charLabel);
|
||||
u32 newLabel = dSndPlayerMgr_c::GetInstance()->convertLabelStringToSoundId(label);
|
||||
if (newLabel != -1) {
|
||||
return newLabel;
|
||||
}
|
||||
}
|
||||
return baseSoundId;
|
||||
}
|
||||
|
||||
u32 dSoundSource_c::getRemoConSoundVariant(u32 soundId) const {
|
||||
const char *label = soundIdToSoundLabel(soundId);
|
||||
SizedString<64> str;
|
||||
str.sprintf("%s_RC", label);
|
||||
return soundLabelToSoundId(str);
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
|
||||
#include "d/snd/d_snd_source_group.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_source.h"
|
||||
#include "d/snd/d_snd_source_enums.h"
|
||||
#include "nw4r/ut/ut_list.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
extern "C" bool isInStage(const char *stageName);
|
||||
|
||||
void dSndSourceGroup_c::set(s32 sourceType, const char *name) {
|
||||
resetSoundSourceParam();
|
||||
bool assignedParam = false;
|
||||
|
||||
switch (mSourceCategory) {
|
||||
case SND_SOURCE_CATEGORY_PLAYER: {
|
||||
assignedParam = true;
|
||||
mParam.field_0x10 = INFINITY;
|
||||
break;
|
||||
}
|
||||
case SND_SOURCE_CATEGORY_EQUIPMENT:
|
||||
if (sourceType == SND_SOURCE_ARROW) {
|
||||
assignedParam = true;
|
||||
mParam.field_0x00 = 1500.0f;
|
||||
mParam.field_0x10 = INFINITY;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!assignedParam && (sourceType == SND_SOURCE_KENSEI || sourceType == SND_SOURCE_58)) {
|
||||
assignedParam = true;
|
||||
mParam.field_0x10 = INFINITY;
|
||||
}
|
||||
|
||||
if (!assignedParam) {
|
||||
assignedParam = setParamFromName(name);
|
||||
}
|
||||
|
||||
if (!assignedParam) {
|
||||
switch (sourceType) {
|
||||
case SND_SOURCE_NPC_NRM: {
|
||||
mParam.field_0x00 = 300.0f;
|
||||
mParam.field_0x04 = 800.0;
|
||||
mParam.field_0x10 = 2200.0;
|
||||
break;
|
||||
}
|
||||
case SND_SOURCE_NPC_48: {
|
||||
if (isInStage("F401")) {
|
||||
mParam.field_0x00 = 500.0f;
|
||||
mParam.field_0x04 = 4000.0;
|
||||
} else if (isInStage("F402")) {
|
||||
mParam.field_0x00 = 400.0f;
|
||||
mParam.field_0x04 = 3500.0;
|
||||
} else {
|
||||
mParam.field_0x00 = 300.0f;
|
||||
mParam.field_0x04 = 800.0;
|
||||
mParam.field_0x10 = 2200.0;
|
||||
}
|
||||
|
||||
mParam.field_0x10 = INFINITY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSourceGroup_c::resetSoundSourceParam() {
|
||||
mParam.reset();
|
||||
}
|
||||
|
||||
dSndSourceGroup_c::dSndSourceGroup_c()
|
||||
: mSubtype(0),
|
||||
field_0x1C(0),
|
||||
field_0x1D(0),
|
||||
mName(""),
|
||||
field_0x40(0),
|
||||
mpCachedClosestSourceToListener(nullptr),
|
||||
mpCachedClosestSourceToPlayer(nullptr),
|
||||
mCalculatedClosestToListener(false),
|
||||
mCalculatedClosestToPlayer(false) {
|
||||
// TODO offsetof
|
||||
nw4r::ut::List_Init(&mSourceList, 0x138);
|
||||
resetSoundSourceParam();
|
||||
}
|
||||
|
||||
dSndSourceGroup_c::~dSndSourceGroup_c() {
|
||||
clearList();
|
||||
}
|
||||
|
||||
void dSndSourceGroup_c::calc() {
|
||||
// Reset freshness flags, computed on-demand
|
||||
mCalculatedClosestToPlayer = false;
|
||||
mCalculatedClosestToListener = false;
|
||||
}
|
||||
|
||||
s32 dSndSourceGroup_c::getNumSources() const {
|
||||
return nw4r::ut::List_GetSize(&mSourceList);
|
||||
}
|
||||
|
||||
void dSndSourceGroup_c::registerSource(dSoundSource_c *source) {
|
||||
if (source != nullptr) {
|
||||
nw4r::ut::List_Append(&mSourceList, source);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSourceGroup_c::unregisterSource(dSoundSource_c *source) {
|
||||
if (source != nullptr) {
|
||||
nw4r::ut::List_Remove(&mSourceList, source);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSourceGroup_c::clearList() {
|
||||
dSoundSource_c *source = static_cast<dSoundSource_c *>(nw4r::ut::List_GetFirst(&mSourceList));
|
||||
while (source != nullptr) {
|
||||
nw4r::ut::List_Remove(&mSourceList, source);
|
||||
source = static_cast<dSoundSource_c *>(nw4r::ut::List_GetFirst(&mSourceList));
|
||||
}
|
||||
}
|
||||
|
||||
dSoundSource_c *dSndSourceGroup_c::getSourceClosestToListener() {
|
||||
if (mCalculatedClosestToListener) {
|
||||
return mpCachedClosestSourceToListener;
|
||||
}
|
||||
|
||||
mpCachedClosestSourceToListener = nullptr;
|
||||
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() != SND_SOURCE_PLAYER_HEAD && source->getActorType() != SND_SOURCE_NPC_48) {
|
||||
f32 dist = source->getDistanceToListener();
|
||||
if (dist < closest) {
|
||||
closest = dist;
|
||||
mpCachedClosestSourceToListener = source;
|
||||
}
|
||||
}
|
||||
}
|
||||
mCalculatedClosestToListener = true;
|
||||
return mpCachedClosestSourceToListener;
|
||||
}
|
||||
|
||||
dSoundSource_c *dSndSourceGroup_c::getSourceClosestToPlayer() {
|
||||
if (mCalculatedClosestToPlayer) {
|
||||
return mpCachedClosestSourceToPlayer;
|
||||
}
|
||||
|
||||
if ((s32)nw4r::ut::List_GetSize(&mSourceList) <= 1) {
|
||||
return static_cast<dSoundSource_c *>(nw4r::ut::List_GetFirst(&mSourceList));
|
||||
}
|
||||
|
||||
mpCachedClosestSourceToPlayer = nullptr;
|
||||
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) {
|
||||
f32 dist = source->getDistanceToPlayer();
|
||||
if (dist < closest) {
|
||||
closest = dist;
|
||||
mpCachedClosestSourceToPlayer = source;
|
||||
}
|
||||
}
|
||||
}
|
||||
mCalculatedClosestToPlayer = true;
|
||||
return mpCachedClosestSourceToPlayer;
|
||||
}
|
||||
|
||||
bool dSndSourceGroup_c::setParamFromName(const char*) {
|
||||
// TODO
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
#include "d/snd/d_snd_source_mgr.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_source.h"
|
||||
#include "d/snd/d_snd_source_enums.h"
|
||||
#include "nw4r/ut/ut_list.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
s32 dSndSourceMgr_c::getSourceCategoryForSourceType(s32 sourceType, const char *name) {
|
||||
// This might be a full-on switch statement but I don't want to write out
|
||||
// all the unknown entries yet and this matches anyway
|
||||
|
||||
if (sourceType >= SND_SOURCE_PLAYER && sourceType <= SND_SOURCE_PLAYER_HEAD) {
|
||||
return SND_SOURCE_CATEGORY_PLAYER;
|
||||
}
|
||||
|
||||
if (sourceType >= SND_SOURCE_NET && sourceType <= SND_SOURCE_HOOKSHOT) {
|
||||
return SND_SOURCE_CATEGORY_EQUIPMENT;
|
||||
}
|
||||
|
||||
if (sourceType >= SND_SOURCE_ENEMY_10 && sourceType <= SND_SOURCE_ENEMY_31) {
|
||||
return SND_SOURCE_CATEGORY_ENEMY;
|
||||
}
|
||||
|
||||
if (sourceType >= SND_SOURCE_OBJECT && sourceType <= SND_SOURCE_OBJECT_42) {
|
||||
return SND_SOURCE_CATEGORY_OBJECT;
|
||||
}
|
||||
|
||||
if (sourceType >= SND_SOURCE_NPC_43 && sourceType <= SND_SOURCE_NPC_DRAGON) {
|
||||
return SND_SOURCE_CATEGORY_NPC;
|
||||
}
|
||||
|
||||
if (sourceType == SND_SOURCE_TG_SOUND) {
|
||||
return SND_SOURCE_CATEGORY_TG_SOUND;
|
||||
}
|
||||
|
||||
if (sourceType >= SND_SOURCE_54 && sourceType <= SND_SOURCE_57) {
|
||||
return SND_SOURCE_CATEGORY_6;
|
||||
}
|
||||
|
||||
switch (sourceType) {
|
||||
case SND_SOURCE_58:
|
||||
return SND_SOURCE_CATEGORY_7;
|
||||
case SND_SOURCE_59:
|
||||
return SND_SOURCE_CATEGORY_9;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
SND_DISPOSER_DEFINE(dSndSourceMgr_c);
|
||||
|
||||
dSndSourceMgr_c::dSndSourceMgr_c()
|
||||
: field_0x0010(0),
|
||||
field_0x0011(0),
|
||||
field_0x0012(0),
|
||||
field_0x0013(0),
|
||||
field_0x3860(0),
|
||||
field_0x3864(0),
|
||||
field_0x3868(0),
|
||||
field_0x386C(INFINITY),
|
||||
mpPlayerSource(nullptr),
|
||||
mpKenseiSource(nullptr),
|
||||
mpBoomerangSource(nullptr),
|
||||
mpTBoatSource(nullptr),
|
||||
field_0x3880(nullptr),
|
||||
field_0x3884(nullptr) {
|
||||
// TODO offsetof
|
||||
nw4r::ut::List_Init(&mGroupList1, 0);
|
||||
nw4r::ut::List_Init(&mGroupList2, 0);
|
||||
|
||||
// TODO figure out what these are for
|
||||
nw4r::ut::List_Init(&mGroupList3, 8);
|
||||
nw4r::ut::List_Init(&mAllSources, 0xE8);
|
||||
nw4r::ut::List_Init(&field_0x3848, 0x15C);
|
||||
nw4r::ut::List_Init(&field_0x3854, 0x160);
|
||||
|
||||
mpDefaultGroup = new dSndSourceGroup_c(-1, "Default", 0, 0);
|
||||
|
||||
for (dSndSourceGroup_c *group = &mGroups[0]; group < &mGroups[NUM_GROUPS]; group++) {
|
||||
nw4r::ut::List_Append(&mGroupList2, group);
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSourceMgr_c::registerSource(dSoundSource_c *source) {
|
||||
if (source != nullptr) {
|
||||
nw4r::ut::List_Append(&mAllSources, source);
|
||||
switch (source->getCategory()) {
|
||||
case SND_SOURCE_CATEGORY_PLAYER: {
|
||||
if (source->getActorType() == SND_SOURCE_PLAYER && mpPlayerSource == nullptr) {
|
||||
mpPlayerSource = source;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SND_SOURCE_CATEGORY_EQUIPMENT: {
|
||||
if (source->getActorType() == SND_SOURCE_BOOMERANG) {
|
||||
mpBoomerangSource = source;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SND_SOURCE_CATEGORY_ENEMY: {
|
||||
if (isCertainEnemyType(source)) {
|
||||
nw4r::ut::List_Append(&field_0x3848, source);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SND_SOURCE_CATEGORY_6: {
|
||||
nw4r::ut::List_Append(&field_0x3854, source);
|
||||
break;
|
||||
}
|
||||
case SND_SOURCE_CATEGORY_OBJECT: {
|
||||
if (source->isName("TBoat") && mpTBoatSource == nullptr) {
|
||||
mpTBoatSource = source;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SND_SOURCE_CATEGORY_NPC: {
|
||||
if (source->getActorType() == SND_SOURCE_KENSEI) {
|
||||
mpKenseiSource = source;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSourceMgr_c::unregisterSource(dSoundSource_c *source) {
|
||||
if (source != nullptr) {
|
||||
removeSourceFromList(source, &mAllSources);
|
||||
removeSourceFromList(source, &field_0x3848);
|
||||
removeSourceFromList(source, &field_0x3854);
|
||||
if (source == mpPlayerSource) {
|
||||
mpPlayerSource = nullptr;
|
||||
} else if (source == mpKenseiSource) {
|
||||
mpKenseiSource = nullptr;
|
||||
} else if (source == mpBoomerangSource) {
|
||||
mpBoomerangSource = nullptr;
|
||||
}
|
||||
|
||||
if (mpTBoatSource == source) {
|
||||
mpTBoatSource = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSourceMgr_c::removeSourceFromList(dSoundSource_c *source, nw4r::ut::List *list) {
|
||||
if (source != nullptr && list != nullptr) {
|
||||
// This removal code appears to be needlessly defensive
|
||||
dSoundSource_c *sourceIter = static_cast<dSoundSource_c *>(nw4r::ut::List_GetFirst(list));
|
||||
while (sourceIter != nullptr) {
|
||||
if (field_0x3880 == source) {
|
||||
// why in here????
|
||||
field_0x3880 = nullptr;
|
||||
}
|
||||
|
||||
if (sourceIter == source) {
|
||||
nw4r::ut::List_Remove(list, sourceIter);
|
||||
sourceIter = nullptr;
|
||||
} else {
|
||||
sourceIter = static_cast<dSoundSource_c *>(nw4r::ut::List_GetNext(list, sourceIter));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSourceMgr_c::clearSourceLists() {
|
||||
clearSourceList(&mAllSources);
|
||||
clearSourceList(&field_0x3848);
|
||||
clearSourceList(&field_0x3854);
|
||||
mpPlayerSource = nullptr;
|
||||
}
|
||||
|
||||
void dSndSourceMgr_c::clearSourceList(nw4r::ut::List *list) {
|
||||
if (list != nullptr) {
|
||||
dSoundSource_c *sourceIter = static_cast<dSoundSource_c *>(nw4r::ut::List_GetFirst(list));
|
||||
while (sourceIter != nullptr) {
|
||||
nw4r::ut::List_Remove(list, sourceIter);
|
||||
sourceIter = static_cast<dSoundSource_c *>(nw4r::ut::List_GetFirst(list));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
#include "d/snd/d_snd_util.h"
|
||||
|
||||
class SndClass80399a40 {
|
||||
public:
|
||||
SndClass80399a40();
|
||||
virtual ~SndClass80399a40() {}
|
||||
|
||||
/* 0x04 */ u8 _0x04[0x18 - 0x04];
|
||||
};
|
||||
|
||||
// This is a test for SndMgrDisposer, since this
|
||||
// class has the disposer at 0x18, which is interesting
|
||||
|
||||
class SndMgr80399c20;
|
||||
|
||||
extern template class SndMgrDisposer<SndMgr80399c20>;
|
||||
|
||||
class SndMgr80399c20 : SndClass80399a40 {
|
||||
public:
|
||||
SndMgrDisposer<SndMgr80399c20> *GetDisposer() {
|
||||
return &mDisposer;
|
||||
}
|
||||
|
||||
static SndMgr80399c20 *GetInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
static SndMgr80399c20 *sInstance;
|
||||
static SndMgrDisposer<SndMgr80399c20> *sDisposer;
|
||||
|
||||
private:
|
||||
SndMgrDisposer<SndMgr80399c20> mDisposer;
|
||||
};
|
||||
|
||||
template class SndMgrDisposer<SndMgr80399c20>;
|
||||
@@ -48,7 +48,7 @@ void AnimSoundImpl::Shutdown() {
|
||||
if (mIsActive) {
|
||||
for (int i = 0; i < mNumSounds; i++) {
|
||||
if (mpSounds[i].GetHandle()->IsAttachedSound() && mpSounds[i].IsRunning()) {
|
||||
mpSounds[i].GetHandle()->Stop();
|
||||
mpSounds[i].GetHandle()->Stop(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -426,7 +426,6 @@ void AnimEventPlayer::SetVariable(const AnimEvent *event, u32 varNo, f32 f) {
|
||||
SeqSoundHandle handle(GetHandle());
|
||||
int iVal = f * 100.0f;
|
||||
handle.WriteVariable(varNo, ut::Clamp(iVal, -0x8000, 0x7FFF));
|
||||
handle.DetachSound();
|
||||
}
|
||||
} else if (varNo < 32) {
|
||||
int iVal = f * 100.0f;
|
||||
@@ -438,7 +437,7 @@ AnimEventPlayer::AnimEventPlayer() : mpEvent(NULL), mIsRunning(false) {}
|
||||
|
||||
AnimEventPlayer::~AnimEventPlayer() {
|
||||
if (mHandle.IsAttachedSound() && IsRunning()) {
|
||||
mHandle.Stop();
|
||||
mHandle.Stop(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "toBeSorted/actor_info.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "d/snd/d_snd_source_enums.h"
|
||||
#include "f/f_profile_name.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
@@ -31,10 +31,10 @@ AnmMdlWrapper::AnmMdlWrapper() : mpSoundSource(nullptr), mpSoundData(nullptr) {}
|
||||
|
||||
AnmMdlWrapper::~AnmMdlWrapper() {
|
||||
if (mpSoundSource != nullptr) {
|
||||
if (mpSoundSource->shutdown()) {
|
||||
if (mpSoundSource->hasPlayingSounds()) {
|
||||
do {
|
||||
VIWaitForRetrace();
|
||||
} while (mpSoundSource->shutdown());
|
||||
} while (mpSoundSource->hasPlayingSounds());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ void AnmMdlWrapper::setRate(f32 rate) {
|
||||
setSoundRate(rate);
|
||||
}
|
||||
|
||||
void AnmMdlWrapper::setSoundSource(SoundSource *pSource) {
|
||||
void AnmMdlWrapper::setSoundSource(dSoundSourceIf_c *pSource) {
|
||||
mpSoundSource = pSource;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user