Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/OpenSHC/Audio/mss/SoundSystem/setupVolumeAndSoundID.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include "../SoundSystem.func.hpp"

#include "OpenSHC/Audio/SFX/SFXState.func.hpp"
#include "OpenSHC/DE/SHCDE/eMusicIDs.hpp"

#include "OpenSHC/Globals/DAT_GameCore.hpp"
#include "OpenSHC/Globals/DAT_SFXDefinedData.hpp"
#include "OpenSHC/Globals/DAT_SFXState.hpp"

namespace OpenSHC {
namespace Audio {
namespace MSS {

// FUNCTION: STRONGHOLDCRUSADER 0x0047A1B0
void SoundSystem::setupVolumeAndSoundID(eMusicIDsInt soundID)
{
// NOTE: Is this certain that these ids fit to the original game?
if (soundID == DE::SHCDE::MUSIC_TUNE_NARR1) {
// missionNumber1to20 might be unsigned, but found signs inconclusive
if (DAT_GameCore::ptr->missionNumber1to20 - 1U <= 19) {
soundID = DAT_GameCore::ptr->missionNumber1to20 + 46;
} else {
soundID = DE::SHCDE::MUSIC_TUNE_OFF;
}
}

if (soundID == this->currentSoundID_0x3278) {
return;
}
this->currentSoundID_0x3278 = soundID;
int const fileVolume = MACRO_CALL_MEMBER(SFX::SFXState_Func::getSoundVolumeForFilename, DAT_SFXState::ptr)(
DAT_SFXDefinedData::ptr->DAT_SFX_Pointers[soundID].musicFile);
this->currentSoundIDVolumeUnk_0x327c = (fileVolume * 100) / 0x7f;
this->mbr_0x3280 = 0;
}

}
}
}
2 changes: 1 addition & 1 deletion status/addresses-SHC-3BB0A8C1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10895,7 +10895,7 @@ SHC_3BB0A8C1_0x00479F30 | 100.0% | Reimplemented
SHC_3BB0A8C1_0x00479FC0 | 0.0% | Pending
SHC_3BB0A8C1_0x0047A080 | 0.0% | Pending
SHC_3BB0A8C1_0x0047A130 | 0.0% | Pending
SHC_3BB0A8C1_0x0047A1B0 | 0.0% | Pending
SHC_3BB0A8C1_0x0047A1B0 | 100.0% | Reimplemented
SHC_3BB0A8C1_0x0047A220 | 0.0% | Pending
SHC_3BB0A8C1_0x0047A290 | 0.0% | Pending
SHC_3BB0A8C1_0x0047A2A0 | 0.0% | Pending
Expand Down