Skip to content
Open
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
5 changes: 4 additions & 1 deletion src/OpenSHC/Audio/mss/SoundSystem/setupVolumeAndSoundID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ namespace Audio {
// FUNCTION: STRONGHOLDCRUSADER 0x0047A1B0
void SoundSystem::setupVolumeAndSoundID(eMusicIDsInt soundID)
{
// NOTE: Is this certain that these ids fit to the original game?
// Indicator to handle as mission sound (?)
if (soundID == DE::SHCDE::MUSIC_TUNE_NARR1) {
// missionNumber1to20 might be unsigned, but found signs inconclusive
if (DAT_GameCore::ptr->missionNumber1to20 - 1U <= 19) {
// This makes the soundID "missionNumber1to20 + 46", which would use the enums 47 to 66.
// These are only filled by 4 enums for 4 mission intros, so this space could be made for 20.
soundID = DAT_GameCore::ptr->missionNumber1to20 + 46;
} else {
soundID = DE::SHCDE::MUSIC_TUNE_OFF;
Expand All @@ -30,6 +32,7 @@ namespace Audio {
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);
// 0x7f is the maximum volume of the MSS32 volume API.
this->currentSoundIDVolumeUnk_0x327c = (fileVolume * 100) / 0x7f;
this->mbr_0x3280 = 0;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#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 0x0047A220
void SoundSystem::setupVolumeAndSoundIDWithMultiplier(eMusicIDsInt soundID, int soundMultiplier)
{
// Indicator to handle as mission sound (?)
if (soundID == DE::SHCDE::MUSIC_TUNE_NARR1) {
// missionNumber1to20 might be unsigned, but found signs inconclusive
if (DAT_GameCore::ptr->missionNumber1to20 - 1U <= 19) {
// This makes the soundID "missionNumber1to20 + 46", which would use the enums 47 to 66.
// These are only filled by 4 enums for 4 mission intros, so this space could be made for 20.
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);
// 0x7f is the maximum volume of the MSS32 volume API.
this->currentSoundIDVolumeUnk_0x327c = (fileVolume * soundMultiplier) / 0x7f;
Comment thread
gynt marked this conversation as resolved.
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 @@ -10896,7 +10896,7 @@ SHC_3BB0A8C1_0x00479FC0 | 100.0% | Reimplemented
SHC_3BB0A8C1_0x0047A080 | 0.0% | Pending
SHC_3BB0A8C1_0x0047A130 | 0.0% | Pending
SHC_3BB0A8C1_0x0047A1B0 | 100.0% | Reimplemented
SHC_3BB0A8C1_0x0047A220 | 0.0% | Pending
SHC_3BB0A8C1_0x0047A220 | 100.0% | Reimplemented
SHC_3BB0A8C1_0x0047A290 | 100.0% | Reimplemented
SHC_3BB0A8C1_0x0047A2A0 | 0.0% | Pending
SHC_3BB0A8C1_0x0047A310 | 0.0% | Pending
Expand Down