Fix/match MxBackgroundAudioManager::FUN_1007ef40 (#518)

* Fix

* Match
This commit is contained in:
Christian Semmler 2024-02-02 15:00:44 -05:00 committed by GitHub
parent b7e274f902
commit a28113a26f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 25 deletions

View File

@ -56,16 +56,16 @@ private:
MxResult OpenMusic(MxAtomId& p_script); MxResult OpenMusic(MxAtomId& p_script);
void DestroyMusic(); void DestroyMusic();
MxBool m_musicEnabled; // 0x08 MxBool m_musicEnabled; // 0x08
MxDSAction m_action1; // 0x0c MxDSAction m_action1; // 0x0c
MxAudioPresenter* m_unk0xa0; MxAudioPresenter* m_unk0xa0; // 0xa0
MxDSAction m_action2; // 0xa4 MxDSAction m_action2; // 0xa4
MxAudioPresenter* m_unk0x138; MxAudioPresenter* m_unk0x138; // 0x138
MxS32 m_unk0x13c; MxS32 m_unk0x13c; // 0x13c
MxS32 m_unk0x140; MxS32 m_unk0x140; // 0x140
MxS32 m_targetVolume; MxS32 m_targetVolume; // 0x144
MxS16 m_unk0x148; MxS16 m_unk0x148; // 0x148
MxAtomId m_script; MxAtomId m_script; // 0x14c
}; };
#endif // MXBACKGROUNDAUDIOMANAGER_H #endif // MXBACKGROUNDAUDIOMANAGER_H

View File

@ -80,16 +80,15 @@ MxResult MxBackgroundAudioManager::Tickle()
switch (m_unk0x13c) { switch (m_unk0x13c) {
case MxPresenter::e_starting: case MxPresenter::e_starting:
FadeInOrFadeOut(); FadeInOrFadeOut();
return SUCCESS; break;
case MxPresenter::e_streaming: case MxPresenter::e_streaming:
FUN_1007ee70(); FUN_1007ee70();
return SUCCESS; break;
case MxPresenter::e_repeating: case MxPresenter::e_repeating:
FUN_1007ef40(); FUN_1007ef40();
return SUCCESS;
default:
return SUCCESS;
} }
return SUCCESS;
} }
// FUNCTION: LEGO1 0x1007ee70 // FUNCTION: LEGO1 0x1007ee70
@ -112,19 +111,23 @@ void MxBackgroundAudioManager::FUN_1007ee70()
// FUNCTION: LEGO1 0x1007ef40 // FUNCTION: LEGO1 0x1007ef40
void MxBackgroundAudioManager::FUN_1007ef40() void MxBackgroundAudioManager::FUN_1007ef40()
{ {
MxU32 compare; MxS32 compare, volume;
MxU32 volume;
if (m_unk0xa0 == NULL) { if (m_unk0xa0 == NULL) {
if (m_unk0x138) { if (m_unk0x138) {
compare = 30; if (m_unk0x148 != 0) {
if (m_unk0x148 == 0) { compare = 30;
compare = m_unk0x148;
} }
else {
compare = m_targetVolume;
}
volume = m_unk0x138->GetVolume(); volume = m_unk0x138->GetVolume();
if (volume < compare) { if (volume < compare) {
if (m_unk0x140 + m_unk0x138->GetVolume() <= compare) { if (m_unk0x140 + m_unk0x138->GetVolume() <= compare) {
compare = m_unk0x140 + compare; compare = m_unk0x140 + m_unk0x138->GetVolume();
} }
m_unk0x138->SetVolume(compare); m_unk0x138->SetVolume(compare);
} }
else { else {
@ -143,12 +146,14 @@ void MxBackgroundAudioManager::FUN_1007ef40()
DeleteObject(*m_unk0xa0->GetAction()); DeleteObject(*m_unk0xa0->GetAction());
} }
else { else {
compare = m_unk0xa0->GetVolume(); if (m_unk0xa0->GetVolume() - m_unk0x140 > 0) {
volume = 0;
if (compare != m_unk0x140 && -1 < compare - m_unk0x140) {
volume = m_unk0xa0->GetVolume() - m_unk0x140; volume = m_unk0xa0->GetVolume() - m_unk0x140;
} }
m_unk0x138->SetVolume(volume); else {
volume = 0;
}
m_unk0xa0->SetVolume(volume);
} }
} }
} }