mirror of
https://github.com/zeldaret/ss
synced 2026-06-17 07:07:39 -04:00
A bit more
This commit is contained in:
@@ -75,7 +75,7 @@ void dSnd3DManager_c::updateFromCamera(EGG::LookAtCamera &camera) {
|
||||
}
|
||||
|
||||
f32 dist = 0.5f;
|
||||
if (fn_80364DA0(ENEMY_SOUND_MGR)) {
|
||||
if (dSndStateMgr_c::GetInstance()->isInEvent()) {
|
||||
dist = mCamDistance;
|
||||
f32 prevCameraAtSqVelocity = mCameraAtSqVelocity;
|
||||
f32 prevCameraPosSqVelocity = mCameraPosSqVelocity;
|
||||
|
||||
@@ -50,6 +50,14 @@ bool dSndAreaSoundEffectMgr_c::startSound(u32 soundId, u32 handleIdx) {
|
||||
return res;
|
||||
}
|
||||
|
||||
void dSndAreaSoundEffectMgr_c::onEventStart() {
|
||||
// no-op
|
||||
}
|
||||
|
||||
void dSndAreaSoundEffectMgr_c::onEventEnd() {
|
||||
// no-op
|
||||
}
|
||||
|
||||
void dSndAreaSoundEffectMgr_c::stopSounds(s32 fadeFrames) {
|
||||
for (u32 i = 0; i < 3; i++) {
|
||||
mSounds[i].stop(fadeFrames);
|
||||
|
||||
@@ -35,7 +35,7 @@ dSndBgmMgr_c::dSndBgmMgr_c()
|
||||
field_0x29C(0),
|
||||
mSoundActor(dSndMgr_c::GetInstance()->getPlayer()),
|
||||
field_0x2F4(1.0f),
|
||||
field_0x2F8(-1),
|
||||
mBgmToPlayOnEventEnd(-1),
|
||||
field_0x2FC(0),
|
||||
field_0x300(-1),
|
||||
field_0x304(0),
|
||||
@@ -278,6 +278,22 @@ void dSndBgmMgr_c::setBgmHandleIdxVolume(u32 handleIdx, f32 volume, s32 fadeFram
|
||||
}
|
||||
}
|
||||
|
||||
void dSndBgmMgr_c::setBgmToPlayOnEventEnd(u32 soundId) {
|
||||
if (soundId != -1) {
|
||||
prepareBgm(soundId, 0);
|
||||
mBgmToPlayOnEventEnd = soundId;
|
||||
}
|
||||
}
|
||||
|
||||
bool dSndBgmMgr_c::onEventEnd() {
|
||||
bool ret = false;
|
||||
if (mBgmToPlayOnEventEnd != -1) {
|
||||
ret = playBgm(mBgmToPlayOnEventEnd, 0, false);
|
||||
mBgmToPlayOnEventEnd = -1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool dSndBgmMgr_c::isPlayingBgmSound() const {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
if (mBgmSounds[i]->isPlaying()) {
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
#include "d/snd/d_snd_control_player.h"
|
||||
#include "d/snd/d_snd_mgr.h"
|
||||
#include "d/snd/d_snd_player_mgr.h"
|
||||
#include "d/snd/d_snd_state_mgr.h"
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
#include "nw4r/ut/ut_list.h"
|
||||
#include "toBeSorted/music_mgrs.h"
|
||||
|
||||
struct FanfareMuteFlagsApplier {
|
||||
~FanfareMuteFlagsApplier() {}
|
||||
@@ -24,7 +24,7 @@ struct FanfareMuteFlagsApplier {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setBgmVolumeDecreaseSpeed(0.2f);
|
||||
}
|
||||
|
||||
if (fn_80364DA0(ENEMY_SOUND_MGR)) {
|
||||
if (dSndStateMgr_c::GetInstance()->isInEvent()) {
|
||||
if (!(userParam & dSndPlayerMgr_c::FANFARE_UNMUTE_STAGE_EFFECTS)) {
|
||||
dSndControlPlayerMgr_c::GetInstance()->setGroupVolumeFlag(
|
||||
dSndControlPlayerMgr_c::CTRL_GROUP_STAGE_EFFECTS, dSndControlPlayerMgr_c::MUTE_FULL
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
void todoInititalizeSndEvent();
|
||||
void todoExecuteSndEvent();
|
||||
void todoFinalizeSndEvent();
|
||||
void todoFinalizeSndEvent(bool skipped);
|
||||
|
||||
#pragma push
|
||||
#pragma readonly_strings on
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
void todoInititalizeSndEvent();
|
||||
void todoExecuteSndEvent();
|
||||
void todoFinalizeSndEvent();
|
||||
|
||||
// clang-format off
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "d/snd/d_snd_3d_manager.h"
|
||||
#include "d/snd/d_snd_area_sound_effect_mgr.h"
|
||||
#include "d/snd/d_snd_bgm_mgr.h"
|
||||
#include "d/snd/d_snd_bgm_seq_data_mgr.h"
|
||||
#include "d/snd/d_snd_control_player_mgr.h"
|
||||
#include "d/snd/d_snd_distant_sound_actor_pool.h"
|
||||
#include "d/snd/d_snd_player_mgr.h"
|
||||
@@ -14,7 +15,6 @@
|
||||
#include "egg/audio/eggAudioRmtSpeakerMgr.h"
|
||||
#include "egg/audio/eggAudioUtility.h"
|
||||
|
||||
extern "C" void initSomeUnusedSoundMgr();
|
||||
extern "C" void fn_8037F940();
|
||||
extern "C" void fn_80399600();
|
||||
|
||||
@@ -27,7 +27,7 @@ dSndMgr_c::dSndMgr_c() : field_0x6CC(0) {
|
||||
dSndStateMgr_c::create();
|
||||
dSnd3DManager_c::create();
|
||||
dSndBgmMgr_c::create();
|
||||
initSomeUnusedSoundMgr();
|
||||
dSndBgmSeqDataMgr_c::create();
|
||||
dSndSmallEffectMgr_c::create();
|
||||
dSndAreaSoundEffectMgr_c::create();
|
||||
dSndSourceMgr_c::create();
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "nw4r/snd/snd_SoundHandle.h"
|
||||
#include "nw4r/snd/snd_SoundStartable.h"
|
||||
#include "sized_string.h"
|
||||
#include "toBeSorted/music_mgrs.h"
|
||||
|
||||
const char *dSndPlayerMgr_c::getSoundArchivePath() {
|
||||
return "Sound/WZSound.brsar";
|
||||
@@ -168,7 +167,7 @@ void dSndPlayerMgr_c::enterCaution() {
|
||||
}
|
||||
|
||||
s32 frames = 9;
|
||||
if (fn_80364DA0(ENEMY_SOUND_MGR)) {
|
||||
if (dSndStateMgr_c::GetInstance()->isInEvent()) {
|
||||
frames = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "nw4r/snd/snd_SoundStartable.h"
|
||||
#include "nw4r/snd/snd_global.h"
|
||||
#include "rvl/OS/OSFastCast.h"
|
||||
#include "toBeSorted/music_mgrs.h"
|
||||
|
||||
SND_DISPOSER_DEFINE(dSndSmallEffectMgr_c)
|
||||
|
||||
@@ -175,8 +174,8 @@ bool dSndSmallEffectMgr_c::playSound(u32 soundId) {
|
||||
break;
|
||||
}
|
||||
case SE_S_SKIP: {
|
||||
if (fn_80364DA0(ENEMY_SOUND_MGR)) {
|
||||
fn_80365020(ENEMY_SOUND_MGR);
|
||||
if (dSndStateMgr_c::GetInstance()->isInEvent()) {
|
||||
dSndStateMgr_c::GetInstance()->onSkipEvent();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -349,7 +348,7 @@ bool dSndSmallEffectMgr_c::holdBowChargeSound(f32 remainingChargeAmount) {
|
||||
}
|
||||
|
||||
bool dSndSmallEffectMgr_c::holdFinisherPromptSound(const nw4r::math::VEC3 *position) {
|
||||
if (fn_80364DA0(ENEMY_SOUND_MGR)) {
|
||||
if (dSndStateMgr_c::GetInstance()->isInEvent()) {
|
||||
return false;
|
||||
}
|
||||
return dSndDistantSoundActorPool_c::GetInstance()->holdSound(SE_S_FOCUS_FINISHER_LV, position);
|
||||
|
||||
@@ -4,11 +4,10 @@
|
||||
#include "d/snd/d_snd_state_mgr.h"
|
||||
#include "d/snd/d_snd_wzsound.h"
|
||||
#include "nw4r/snd/snd_SeqSoundHandle.h"
|
||||
#include "toBeSorted/music_mgrs.h"
|
||||
|
||||
void dSndSourcePyBird_c::cbPyBirdGlide(dSndSeSound_c *sound, dSoundSource_c *source, nw4r::snd::SoundHandle &handle) {
|
||||
s32 var = 0;
|
||||
if (!fn_80364DA0(dSndStateMgr_c::GetInstance())) {
|
||||
if (!dSndStateMgr_c::GetInstance()->isInEvent()) {
|
||||
var = static_cast<dSndSourcePyBird_c*>(source)->mSeqVarValue;
|
||||
}
|
||||
nw4r::snd::SeqSoundHandle seqHandle(&handle);
|
||||
|
||||
@@ -580,6 +580,14 @@ void dSndSourceMgr_c::clearSourceList(nw4r::ut::List *list) {
|
||||
}
|
||||
}
|
||||
|
||||
void dSndSourceMgr_c::onEventStart() {
|
||||
// no-op
|
||||
}
|
||||
|
||||
void dSndSourceMgr_c::onEventEnd() {
|
||||
// no-op
|
||||
}
|
||||
|
||||
s32 dSndSourceMgr_c::getPlayerSourceRoomId() const {
|
||||
if (mpPlayerSource == nullptr) {
|
||||
return -1;
|
||||
|
||||
@@ -2,13 +2,22 @@
|
||||
|
||||
#include "common.h"
|
||||
#include "d/d_sc_game.h"
|
||||
#include "d/snd/d_snd_area_sound_effect_mgr.h"
|
||||
#include "d/snd/d_snd_bgm_mgr.h"
|
||||
#include "d/snd/d_snd_checkers.h"
|
||||
#include "d/snd/d_snd_control_player_mgr.h"
|
||||
#include "d/snd/d_snd_event.h"
|
||||
#include "d/snd/d_snd_mgr.h"
|
||||
#include "d/snd/d_snd_player_mgr.h"
|
||||
#include "d/snd/d_snd_source_mgr.h"
|
||||
#include "d/snd/d_snd_stage_data.h"
|
||||
#include "d/snd/d_snd_util.h"
|
||||
#include "egg/core/eggHeap.h"
|
||||
#include "nw4r/snd/snd_FxReverbStdDpl2.h"
|
||||
#include "nw4r/snd/snd_SoundPlayer.h"
|
||||
#include "nw4r/snd/snd_global.h"
|
||||
#include "sized_string.h"
|
||||
#include "toBeSorted/event_manager.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
@@ -32,9 +41,9 @@ dSndStateMgr_c::dSndStateMgr_c()
|
||||
field_0x067(0),
|
||||
field_0x068(-1),
|
||||
field_0x06C(-1),
|
||||
field_0x070(0),
|
||||
mpUnkCallback(nullptr),
|
||||
field_0x074(0),
|
||||
field_0x078(0),
|
||||
mpOnEventStartCallback(nullptr),
|
||||
field_0x07C(0),
|
||||
field_0x080(0),
|
||||
field_0x084(0),
|
||||
@@ -46,9 +55,8 @@ dSndStateMgr_c::dSndStateMgr_c()
|
||||
field_0x11C(0),
|
||||
field_0x120(0),
|
||||
field_0x124(0),
|
||||
field_0x128(-1),
|
||||
mSeLvSoundId(-1),
|
||||
field_0x22C(0),
|
||||
field_0x230(0),
|
||||
mpSoundEventDef(nullptr),
|
||||
field_0x238(-1),
|
||||
field_0x23C(0),
|
||||
@@ -85,7 +93,7 @@ void dSndStateMgr_c::setup(EGG::Heap *pHeap) {
|
||||
}
|
||||
void *mem = pHeap->alloc(max, 4);
|
||||
mFx.AssignWorkBuffer(mem, max);
|
||||
resetStageName();
|
||||
resetEventName();
|
||||
}
|
||||
|
||||
void dSndStateMgr_c::onStageOrLayerUpdate() {
|
||||
@@ -98,9 +106,9 @@ void dSndStateMgr_c::onStageOrLayerUpdate() {
|
||||
onFlag0x10(0x2);
|
||||
field_0x064 = 0;
|
||||
|
||||
if (!streq(field_0x098, dScGame_c::currentSpawnInfo.getStageName())) {
|
||||
if (!streq(mStageName, dScGame_c::currentSpawnInfo.getStageName())) {
|
||||
needsGroupsReload = true;
|
||||
field_0x01C = dScGame_c::currentSpawnInfo.getStageName();
|
||||
mStageName = dScGame_c::currentSpawnInfo.getStageName();
|
||||
}
|
||||
|
||||
if (!needsGroupsReload && dScGame_c::currentSpawnInfo.layer != mLayer) {
|
||||
@@ -197,6 +205,130 @@ bool dSndStateMgr_c::isSeekerStoneStage(const char *stageName, s32 layer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void dSndStateMgr_c::setEvent(const char *eventName) {
|
||||
if (eventName == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (dSndPlayerMgr_c::GetInstance()->checkFlag(dSndPlayerMgr_c::MGR_CAUTION)) {
|
||||
dSndPlayerMgr_c::GetInstance()->leaveCaution();
|
||||
}
|
||||
|
||||
if (field_0x064 == 0) {
|
||||
if (streq(mEventName, "DefaultSkip")) {
|
||||
onSkipEvent();
|
||||
mPrevEventName = mEventName;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!checkFlag0x18(0x20) || !checkFlag0x10(0x04)) {
|
||||
SizedString<64> prevEvent = mEventName;
|
||||
if (isInEvent()) {
|
||||
field_0x23C = 1;
|
||||
finalizeEvent(false);
|
||||
} else {
|
||||
field_0x23C = 0;
|
||||
}
|
||||
|
||||
// TODO - constness or direct access
|
||||
if (checkEventFlag(EVENT_0x04)) {
|
||||
offEventFlag(EVENT_0x04);
|
||||
}
|
||||
mEventName = eventName;
|
||||
mPrevEventName = prevEvent;
|
||||
resetEventVars();
|
||||
field_0x23D = 0;
|
||||
field_0x238 = -1;
|
||||
|
||||
if (streq(mEventName, "STB")) {
|
||||
if (field_0x118 != nullptr) {
|
||||
mEventName = field_0x118;
|
||||
}
|
||||
onEventFlag(EVENT_DEMO);
|
||||
} else {
|
||||
field_0x118 = nullptr;
|
||||
}
|
||||
|
||||
if (!checkFlag0x10(0x04)) {
|
||||
if (mpUnkCallback != nullptr) {
|
||||
mpUnkCallback();
|
||||
}
|
||||
field_0x23D = 1;
|
||||
dSndBgmMgr_c::GetInstance()->setField_0x306(1);
|
||||
dSndBgmMgr_c::GetInstance()->prepareBgm();
|
||||
onEventFlag(EVENT_0x04);
|
||||
onFlag0x10(0x04);
|
||||
dSndControlPlayerMgr_c::GetInstance()->unmuteScenePlayers(30);
|
||||
}
|
||||
bool b2 = checkEventFlag(EVENT_0x800) && dSndBgmMgr_c::GetInstance()->isPlayingBgmSound();
|
||||
if (checkEventFlag(EVENT_0x800) && field_0x064 == 0) {
|
||||
// TODO - constness or direct access
|
||||
offEventFlag(0x800);
|
||||
}
|
||||
|
||||
mSoundEventId = SND_EVENT_0x89;
|
||||
initializeEventCallbacks(mEventName);
|
||||
s32 i3 = 0;
|
||||
SizedString<64> eventLabel;
|
||||
if (mSoundEventId == SND_EVENT_JMAP) {
|
||||
s32 roomId = EventManager::getCurrentEventRoomId();
|
||||
// UB: Cannot pass object of non-POD type 'SizedString<32>' through variadic method
|
||||
eventLabel.sprintf("%s_R%d_JMAP_%d", mStageName, mLayer, roomId);
|
||||
} else if (mSoundEventId == SND_EVENT_JMAPAllMove) {
|
||||
s32 roomId = EventManager::getCurrentEventRoomId();
|
||||
// UB: Cannot pass object of non-POD type 'SizedString<32>' through variadic method
|
||||
eventLabel.sprintf("%s_R%d_JMAPAllMove_%d", mStageName, mLayer, roomId);
|
||||
} else {
|
||||
eventLabel.sprintf("%s", &mEventName);
|
||||
}
|
||||
|
||||
if (checkEventFlag(EVENT_DEMO)) {
|
||||
mBgmName.sprintf("BGM_%s", &eventLabel);
|
||||
mFanName.sprintf("FAN_%s", &eventLabel);
|
||||
mSeName.sprintf("SE_%s", &eventLabel);
|
||||
mCmdName.sprintf("CMD_%s", &eventLabel);
|
||||
} else {
|
||||
mBgmName.sprintf("BGM_EVENT_%s", &eventLabel);
|
||||
mFanName.sprintf("FAN_EVENT_%s", &eventLabel);
|
||||
mSeName.sprintf("SE_EVENT_%s", &eventLabel);
|
||||
mCmdName.sprintf("CMD_EVENT_%s", &eventLabel);
|
||||
}
|
||||
|
||||
if (checkEventFlag(EVENT_0x04)) {
|
||||
field_0x238 = getBgmLabelSoundId();
|
||||
if (b2 && field_0x238 == -1) {
|
||||
field_0x23D = 0;
|
||||
}
|
||||
} else {
|
||||
i3 = playFanOrBgm(getBgmLabelSoundId());
|
||||
if (i3) {
|
||||
field_0x23D = 0;
|
||||
}
|
||||
}
|
||||
|
||||
handleFan();
|
||||
handleSe();
|
||||
handleSeLv();
|
||||
handleCmd();
|
||||
|
||||
if (mSoundEventId != SND_EVENT_0x89) {
|
||||
onEventFlag(EVENT_IN_EVENT);
|
||||
field_0x11C = 0;
|
||||
field_0x120 = 0;
|
||||
field_0x124 = 0;
|
||||
if (mpOnEventStartCallback != nullptr) {
|
||||
(mpOnEventStartCallback)(mSoundEventId, mEventFlags);
|
||||
}
|
||||
if (field_0x238 == -1) {
|
||||
dSndBgmMgr_c::GetInstance()->onEventStart(mEventName, mSoundEventId, i3);
|
||||
}
|
||||
dSndAreaSoundEffectMgr_c::GetInstance()->onEventStart();
|
||||
dSndSourceMgr_c::GetInstance()->onEventStart();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool dSndStateMgr_c::isInStage(const char *stageName) {
|
||||
return !std::strcmp(dScGame_c::currentSpawnInfo.getStageName(), stageName);
|
||||
}
|
||||
@@ -233,6 +365,46 @@ void dSndStateMgr_c::initializeEventCallbacks(const char *name) {
|
||||
}
|
||||
}
|
||||
|
||||
void dSndStateMgr_c::handleSeLv() {
|
||||
SizedString<0x40> name = mSeName;
|
||||
name += "_LV";
|
||||
u32 soundId = convertSeLabelToSoundId(name);
|
||||
if (soundId != -1) {
|
||||
mSeLvSoundId = soundId;
|
||||
if (dSndMgr_c::GetInstance()->holdSound(&mSeLvSoundHandle, soundId)) {
|
||||
u32 id = dSndPlayerMgr_c::GetInstance()->getDemoArchive()->GetSoundUserParam(soundId);
|
||||
if ((dSndPlayerMgr_c::sEventMuteFlagsMask & id & 0x2000000) == 0) {
|
||||
mSeLvSoundHandle.SetFxSend(nw4r::snd::AUX_A, field_0x49C);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mSeLvSoundId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
bool dSndStateMgr_c::finalizeEvent(bool skipped) {
|
||||
dSndPlayerMgr_c *mgr = dSndPlayerMgr_c::GetInstance();
|
||||
if (mgr->checkFlag(dSndPlayerMgr_c::MGR_CAUTION)) {
|
||||
mgr->leaveCaution();
|
||||
}
|
||||
if (!isInEvent()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mpSoundEventDef != nullptr && mpSoundEventDef->finalizeCb) {
|
||||
mpSoundEventDef->finalizeCb(skipped);
|
||||
}
|
||||
|
||||
if (!isInDemo()) {
|
||||
nw4r::snd::SoundPlayer *p = dSndControlPlayerMgr_c::GetInstance()->getPlayer1(dSndPlayerMgr_c::PLAYER_EVENT);
|
||||
SoundStopperIfParamFlag20 stopper;
|
||||
p->ForEachSound(stopper, false);
|
||||
}
|
||||
// TODO ...
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *dSndStateMgr_c::getStageName(s32 id) {
|
||||
if (id >= SND_STAGE_MAX) {
|
||||
return "NULL";
|
||||
|
||||
Reference in New Issue
Block a user