Skip to content

Commit 3e791c2

Browse files
committed
reimplement: SHC_3BB0A8C1_0x0047A220 add comments
1 parent 88f9a0e commit 3e791c2

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/OpenSHC/Audio/mss/SoundSystem/setupVolumeAndSoundID.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ namespace Audio {
1414
// FUNCTION: STRONGHOLDCRUSADER 0x0047A1B0
1515
void SoundSystem::setupVolumeAndSoundID(eMusicIDsInt soundID)
1616
{
17-
// NOTE: Is this certain that these ids fit to the original game?
17+
// Indicator to handle as mission sound (?)
1818
if (soundID == DE::SHCDE::MUSIC_TUNE_NARR1) {
1919
// missionNumber1to20 might be unsigned, but found signs inconclusive
2020
if (DAT_GameCore::ptr->missionNumber1to20 - 1U <= 19) {
21+
// This makes the soundID "missionNumber1to20 + 46", which would use the enums 47 to 66.
22+
// These are only filled by 4 enums for 4 mission intros, so this space could be made for 20.
2123
soundID = DAT_GameCore::ptr->missionNumber1to20 + 46;
2224
} else {
2325
soundID = DE::SHCDE::MUSIC_TUNE_OFF;
@@ -30,6 +32,7 @@ namespace Audio {
3032
this->currentSoundID_0x3278 = soundID;
3133
int const fileVolume = MACRO_CALL_MEMBER(SFX::SFXState_Func::getSoundVolumeForFilename, DAT_SFXState::ptr)(
3234
DAT_SFXDefinedData::ptr->DAT_SFX_Pointers[soundID].musicFile);
35+
// 0x7f is the maximum volume of the MSS32 volume API.
3336
this->currentSoundIDVolumeUnk_0x327c = (fileVolume * 100) / 0x7f;
3437
this->mbr_0x3280 = 0;
3538
}

src/OpenSHC/Audio/mss/SoundSystem/setupVolumeAndSoundIDWithMultiplier.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ namespace Audio {
1414
// FUNCTION: STRONGHOLDCRUSADER 0x0047A220
1515
void SoundSystem::setupVolumeAndSoundIDWithMultiplier(eMusicIDsInt soundID, int soundMultiplier)
1616
{
17-
// NOTE: Is this certain that these ids fit to the original game?
17+
// Indicator to handle as mission sound (?)
1818
if (soundID == DE::SHCDE::MUSIC_TUNE_NARR1) {
1919
// missionNumber1to20 might be unsigned, but found signs inconclusive
2020
if (DAT_GameCore::ptr->missionNumber1to20 - 1U <= 19) {
21+
// This makes the soundID "missionNumber1to20 + 46", which would use the enums 47 to 66.
22+
// These are only filled by 4 enums for 4 mission intros, so this space could be made for 20.
2123
soundID = DAT_GameCore::ptr->missionNumber1to20 + 46;
2224
} else {
2325
soundID = DE::SHCDE::MUSIC_TUNE_OFF;
@@ -30,6 +32,7 @@ namespace Audio {
3032
this->currentSoundID_0x3278 = soundID;
3133
int const fileVolume = MACRO_CALL_MEMBER(SFX::SFXState_Func::getSoundVolumeForFilename, DAT_SFXState::ptr)(
3234
DAT_SFXDefinedData::ptr->DAT_SFX_Pointers[soundID].musicFile);
35+
// 0x7f is the maximum volume of the MSS32 volume API.
3336
this->currentSoundIDVolumeUnk_0x327c = (fileVolume * soundMultiplier) / 0x7f;
3437
this->mbr_0x3280 = 0;
3538
}

0 commit comments

Comments
 (0)