diff options
| author | robojumper <robojumper@gmail.com> | 2025-06-04 23:47:43 +0200 |
|---|---|---|
| committer | robojumper <robojumper@gmail.com> | 2025-06-04 23:47:43 +0200 |
| commit | 35ae04fdf94b0210446ccdebef2d66171095a124 (patch) | |
| tree | 64303d75e9fcffdc1af80182362a29d4c80c7a78 /src/d | |
| parent | e9935e62330417c89601d11c5f92d6a11bc18926 (diff) | |
Refactoring
Diffstat (limited to 'src/d')
32 files changed, 237 insertions, 94 deletions
diff --git a/src/d/a/d_a_insect.cpp b/src/d/a/d_a_insect.cpp index db7c66fb..b93cac0d 100644 --- a/src/d/a/d_a_insect.cpp +++ b/src/d/a/d_a_insect.cpp @@ -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); diff --git a/src/d/a/obj/d_a_obj_switch.cpp b/src/d/a/obj/d_a_obj_switch.cpp index efb49d97..d64f90bb 100644 --- a/src/d/a/obj/d_a_obj_switch.cpp +++ b/src/d/a/obj/d_a_obj_switch.cpp @@ -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); diff --git a/src/d/a/obj/d_a_obj_tbox.cpp b/src/d/a/obj/d_a_obj_tbox.cpp index eea6e056..939a36b3 100644 --- a/src/d/a/obj/d_a_obj_tbox.cpp +++ b/src/d/a/obj/d_a_obj_tbox.cpp @@ -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); } } } diff --git a/src/d/d_cs_game.cpp b/src/d/d_cs_game.cpp index 5ab406a5..da22bbef 100644 --- a/src/d/d_cs_game.cpp +++ b/src/d/d_cs_game.cpp @@ -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 { diff --git a/src/d/d_message.cpp b/src/d/d_message.cpp index 83add314..5340403e 100644 --- a/src/d/d_message.cpp +++ b/src/d/d_message.cpp @@ -22,6 +22,7 @@ #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 "egg/core/eggHeap.h" #include "f/f_base.h" #include "f/f_profile.h" @@ -38,7 +39,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" @@ -216,7 +216,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; } } diff --git a/src/d/lyt/d_lyt_bird_gauge.cpp b/src/d/lyt/d_lyt_bird_gauge.cpp index 9ed904f1..cb8f2e08 100644 --- a/src/d/lyt/d_lyt_bird_gauge.cpp +++ b/src/d/lyt/d_lyt_bird_gauge.cpp @@ -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++; diff --git a/src/d/lyt/d_lyt_common_a_btn.cpp b/src/d/lyt/d_lyt_common_a_btn.cpp index f484e1e5..d32f69c3 100644 --- a/src/d/lyt/d_lyt_common_a_btn.cpp +++ b/src/d/lyt/d_lyt_common_a_btn.cpp @@ -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); } } } diff --git a/src/d/lyt/d_lyt_common_arrow.cpp b/src/d/lyt/d_lyt_common_arrow.cpp index 1b9d859d..393f5068 100644 --- a/src/d/lyt/d_lyt_common_arrow.cpp +++ b/src/d/lyt/d_lyt_common_arrow.cpp @@ -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); } } } diff --git a/src/d/lyt/d_lyt_do_button.cpp b/src/d/lyt/d_lyt_do_button.cpp index 9f4fc89e..c47df16f 100644 --- a/src/d/lyt/d_lyt_do_button.cpp +++ b/src/d/lyt/d_lyt_do_button.cpp @@ -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); } } diff --git a/src/d/lyt/meter/d_lyt_meter.cpp b/src/d/lyt/meter/d_lyt_meter.cpp index 00789d34..6a565c82 100644 --- a/src/d/lyt/meter/d_lyt_meter.cpp +++ b/src/d/lyt/meter/d_lyt_meter.cpp @@ -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++; } } diff --git a/src/d/lyt/meter/d_lyt_meter_cross_btn.cpp b/src/d/lyt/meter/d_lyt_meter_cross_btn.cpp index c34e4d04..189c41eb 100644 --- a/src/d/lyt/meter/d_lyt_meter_cross_btn.cpp +++ b/src/d/lyt/meter/d_lyt_meter_cross_btn.cpp @@ -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); } } } diff --git a/src/d/lyt/meter/d_lyt_meter_dowsing.cpp b/src/d/lyt/meter/d_lyt_meter_dowsing.cpp index 65f4905f..a7b426a4 100644 --- a/src/d/lyt/meter/d_lyt_meter_dowsing.cpp +++ b/src/d/lyt/meter/d_lyt_meter_dowsing.cpp @@ -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) { diff --git a/src/d/lyt/meter/d_lyt_meter_heart.cpp b/src/d/lyt/meter/d_lyt_meter_heart.cpp index 96b685c2..74e5fc6e 100644 --- a/src/d/lyt/meter/d_lyt_meter_heart.cpp +++ b/src/d/lyt/meter/d_lyt_meter_heart.cpp @@ -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); } } } diff --git a/src/d/lyt/meter/d_lyt_meter_item_select.cpp b/src/d/lyt/meter/d_lyt_meter_item_select.cpp index 159b5cd0..a8f6452b 100644 --- a/src/d/lyt/meter/d_lyt_meter_item_select.cpp +++ b/src/d/lyt/meter/d_lyt_meter_item_select.cpp @@ -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; diff --git a/src/d/lyt/meter/d_lyt_meter_key.cpp b/src/d/lyt/meter/d_lyt_meter_key.cpp index 824d4f10..7cd744d4 100644 --- a/src/d/lyt/meter/d_lyt_meter_key.cpp +++ b/src/d/lyt/meter/d_lyt_meter_key.cpp @@ -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() { diff --git a/src/d/lyt/meter/d_lyt_meter_minus_btn.cpp b/src/d/lyt/meter/d_lyt_meter_minus_btn.cpp index 9b3147dd..71f7e4dd 100644 --- a/src/d/lyt/meter/d_lyt_meter_minus_btn.cpp +++ b/src/d/lyt/meter/d_lyt_meter_minus_btn.cpp @@ -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) { diff --git a/src/d/lyt/meter/d_lyt_meter_plus_btn.cpp b/src/d/lyt/meter/d_lyt_meter_plus_btn.cpp index ba9c4b7d..fc7f94c1 100644 --- a/src/d/lyt/meter/d_lyt_meter_plus_btn.cpp +++ b/src/d/lyt/meter/d_lyt_meter_plus_btn.cpp @@ -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++; } } diff --git a/src/d/lyt/meter/d_lyt_meter_rupy.cpp b/src/d/lyt/meter/d_lyt_meter_rupy.cpp index 889efecb..9e29ab76 100644 --- a/src/d/lyt/meter/d_lyt_meter_rupy.cpp +++ b/src/d/lyt/meter/d_lyt_meter_rupy.cpp @@ -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; } diff --git a/src/d/lyt/meter/d_lyt_meter_shield_gauge.cpp b/src/d/lyt/meter/d_lyt_meter_shield_gauge.cpp index f89e6188..95887258 100644 --- a/src/d/lyt/meter/d_lyt_meter_shield_gauge.cpp +++ b/src/d/lyt/meter/d_lyt_meter_shield_gauge.cpp @@ -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 ); } diff --git a/src/d/lyt/meter/d_lyt_meter_timer.cpp b/src/d/lyt/meter/d_lyt_meter_timer.cpp index 8362c7f7..7a2af32c 100644 --- a/src/d/lyt/meter/d_lyt_meter_timer.cpp +++ b/src/d/lyt/meter/d_lyt_meter_timer.cpp @@ -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) { diff --git a/src/d/lyt/meter/d_lyt_meter_z_btn.cpp b/src/d/lyt/meter/d_lyt_meter_z_btn.cpp index 3058e83f..935f78fe 100644 --- a/src/d/lyt/meter/d_lyt_meter_z_btn.cpp +++ b/src/d/lyt/meter/d_lyt_meter_z_btn.cpp @@ -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) { diff --git a/src/d/lyt/msg_window/d_lyt_msg_window.cpp b/src/d/lyt/msg_window/d_lyt_msg_window.cpp index 3f935e28..0d3d6739 100644 --- a/src/d/lyt/msg_window/d_lyt_msg_window.cpp +++ b/src/d/lyt/msg_window/d_lyt_msg_window.cpp @@ -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())) { diff --git a/src/d/lyt/msg_window/d_lyt_msg_window_select_btn.cpp b/src/d/lyt/msg_window/d_lyt_msg_window_select_btn.cpp index 65c97411..6ea90360 100644 --- a/src/d/lyt/msg_window/d_lyt_msg_window_select_btn.cpp +++ b/src/d/lyt/msg_window/d_lyt_msg_window_select_btn.cpp @@ -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); } diff --git a/src/d/snd/d_snd_3d_actor.cpp b/src/d/snd/d_snd_3d_actor.cpp index 3ece873a..bf2d7799 100644 --- a/src/d/snd/d_snd_3d_actor.cpp +++ b/src/d/snd/d_snd_3d_actor.cpp @@ -27,7 +27,7 @@ dSnd3DActor_c::dSnd3DActor_c(UNKTYPE *a1, u8 a2) mFlags(0), mDistanceToPlayer(INFINITY), a_field_0xE0(0.0f) { - resetFloats(); + resetCachedRelativePositions(); // Portability hazard SetUserParam(reinterpret_cast<u32>(this)); if (dSndPlayerMgr_c::GetInstance()->canUseThisPlayer(a2)) { diff --git a/src/d/snd/d_snd_3d_manager.cpp b/src/d/snd/d_snd_3d_manager.cpp index 1bbf9717..ec1d91ce 100644 --- a/src/d/snd/d_snd_3d_manager.cpp +++ b/src/d/snd/d_snd_3d_manager.cpp @@ -9,7 +9,7 @@ #include "nw4r/snd/snd_SoundArchive.h" #include "toBeSorted/music_mgrs.h" -template class SndMgrDisposer<dSnd3DManager_c>; +SND_DISPOSER_DEFINE(dSnd3DManager_c); dSnd3DManager_c::dSnd3DManager_c() : mIsSetup(false), mCalculationsFresh(0) { mCameraPosSqVelocity = 0.0f; diff --git a/src/d/snd/d_snd_area_sound.cpp b/src/d/snd/d_snd_area_sound.cpp new file mode 100644 index 00000000..27033adf --- /dev/null +++ b/src/d/snd/d_snd_area_sound.cpp @@ -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; +} diff --git a/src/d/snd/d_snd_area_sound_effect_mgr.cpp b/src/d/snd/d_snd_area_sound_effect_mgr.cpp new file mode 100644 index 00000000..95114462 --- /dev/null +++ b/src/d/snd/d_snd_area_sound_effect_mgr.cpp @@ -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; +} diff --git a/src/d/snd/d_snd_control_player_mgr.cpp b/src/d/snd/d_snd_control_player_mgr.cpp index 1f82c696..3f79e49c 100644 --- a/src/d/snd/d_snd_control_player_mgr.cpp +++ b/src/d/snd/d_snd_control_player_mgr.cpp @@ -4,7 +4,7 @@ #include "d/snd/d_snd_control_player.h" #include "nw4r/ut/ut_list.h" -template class SndMgrDisposer<dSndControlPlayerMgr_c>; +SND_DISPOSER_DEFINE(dSndControlPlayerMgr_c); dSndControlPlayerMgr_c::dSndControlPlayerMgr_c() : mOverrideVolumeMask(0) { // TODO offsetof @@ -47,7 +47,7 @@ void dSndControlPlayerMgr_c::calcVolumes() { f32 currentVolume = getAppliedPlayerVolume(i); f32 targetVolume = mpTargetVolumes[i]; f32 maxVolumeDecrease = mpMaxVolumeDecreases[i]; - f32 maxVolumeIncrease = mpMaxVolumeDecreases[i]; + f32 maxVolumeIncrease = mpMaxVolumeIncreases[i]; if (currentVolume != targetVolume) { if (currentVolume - targetVolume > maxVolumeDecrease) { @@ -61,7 +61,7 @@ void dSndControlPlayerMgr_c::calcVolumes() { } mpTargetVolumes[i] = 1.0f; mpMaxVolumeDecreases[i] = 0.1f; - mpMaxVolumeDecreases[i] = 0.025f; + mpMaxVolumeIncreases[i] = 0.025f; } } } @@ -101,7 +101,7 @@ void dSndControlPlayerMgr_c::setVolume(u32 playerIdx, f32 value, s32 frames) { } else { // Volume is not overridden, set volume normally setControlValue(CTRL_VOLUME, playerIdx, value, frames); - mpSavedVolumes[playerIdx] = getControlVolumeTarget(CTRL_VOLUME, playerIdx); + mpSavedVolumes[playerIdx] = getControlTarget(CTRL_VOLUME, playerIdx); } } @@ -111,7 +111,7 @@ void dSndControlPlayerMgr_c::overrideVolume(u32 playerIdx, f32 volume, s32 frame } u32 mask = (1 << playerIdx); if ((mOverrideVolumeMask & mask) == 0) { - mpSavedVolumes[playerIdx] = getControlVolumeTarget(CTRL_VOLUME, playerIdx); + mpSavedVolumes[playerIdx] = getControlTarget(CTRL_VOLUME, playerIdx); mOverrideVolumeMask |= mask; } setControlValue(CTRL_VOLUME, playerIdx, volume, frames); @@ -171,7 +171,7 @@ f32 dSndControlPlayerMgr_c::getAppliedPlayerVolume(u32 playerIdx) const { return getPlayer1(playerIdx)->GetVolume(); } -f32 dSndControlPlayerMgr_c::getControlVolumeTarget(PlayerCtrl_e ctrlType, u32 playerIdx) const { +f32 dSndControlPlayerMgr_c::getControlTarget(PlayerCtrl_e ctrlType, u32 playerIdx) const { if (ctrlType >= CTRL_MAX) { return 1.0f; } diff --git a/src/d/snd/d_snd_mgr.cpp b/src/d/snd/d_snd_mgr.cpp index 982c3fbd..95fadd70 100644 --- a/src/d/snd/d_snd_mgr.cpp +++ b/src/d/snd/d_snd_mgr.cpp @@ -1,17 +1,16 @@ #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_util.h" +#include "d/snd/d_snd_small_effect_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 initSoundEffectSoundMgr(); -extern "C" void fn_8036A430(); extern "C" void initEnemyBgmRelatedMgr(); extern "C" void fn_80393530(); extern "C" void fn_80394830(); @@ -23,14 +22,14 @@ dSndMgr_c *dSndMgr_c::sInstance; dSndMgr_c::dSndMgr_c(): field_0x6CC(0) { sInstance = this; - SndMgrDisposer<dSndPlayerMgr_c>::create(); - SndMgrDisposer<dSndControlPlayerMgr_c>::create(); + dSndPlayerMgr_c::create(); + dSndControlPlayerMgr_c::create(); initEnemySoundMgr(); - SndMgrDisposer<dSnd3DManager_c>::create(); + dSnd3DManager_c::create(); initFanfareSoundMgr(); initSomeUnusedSoundMgr(); - initSoundEffectSoundMgr(); - fn_8036A430(); + dSndSmallEffectMgr_c::create(); + dSndAreaSoundEffectMgr_c::create(); initEnemyBgmRelatedMgr(); fn_80393530(); fn_80394830(); diff --git a/src/d/snd/d_snd_player_mgr.cpp b/src/d/snd/d_snd_player_mgr.cpp index 9fdf769a..b89ecdd5 100644 --- a/src/d/snd/d_snd_player_mgr.cpp +++ b/src/d/snd/d_snd_player_mgr.cpp @@ -12,7 +12,7 @@ const char *dSndPlayerMgr_c::getSoundArchivePath() { return "Sound/WZSound.brsar"; } -template class SndMgrDisposer<dSndPlayerMgr_c>; +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) {} diff --git a/src/d/snd/d_snd_small_effect_mgr.cpp b/src/d/snd/d_snd_small_effect_mgr.cpp new file mode 100644 index 00000000..cab93dd2 --- /dev/null +++ b/src/d/snd/d_snd_small_effect_mgr.cpp @@ -0,0 +1,8 @@ +#include "d/snd/d_snd_small_effect_mgr.h" + +#include "d/snd/d_snd_util.h" + + +SND_DISPOSER_DEFINE(dSndSmallEffectMgr_c) + +dSndSmallEffectMgr_c::dSndSmallEffectMgr_c() {} diff --git a/src/d/snd/d_snd_sound.cpp b/src/d/snd/d_snd_sound.cpp index aa441136..ff5a55a4 100644 --- a/src/d/snd/d_snd_sound.cpp +++ b/src/d/snd/d_snd_sound.cpp @@ -61,7 +61,7 @@ void dSndSound_c::resetControls() { resetTrackVolumes(); } -void dSndSound_c::executeCtrls() { +void dSndSound_c::calc() { if (mIsRunning && !IsAttachedSound()) { cancel(); } |
