Skip to content
Draft
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: 3 additions & 2 deletions src/OpenSHC/Audio/mss/SoundSystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@

#pragma once

#include "Mss32.h"
#include "OpenSHC/Audio/MSS/UnkSoundFlagsAndLoopCount.hpp"
#include "OpenSHC/Audio/MSS/enums/SHC_SoundStreamInt.hpp"
#include "OpenSHC/DE/SHCDE/eMusicIDsInt.hpp"
#include "OpenSHC/WindowsHelper/Enums/BOOLEnum.hpp"

#include "Mss32.h"
#include "WinDef.h"

namespace OpenSHC {
Expand Down Expand Up @@ -60,7 +61,7 @@ namespace Audio {
int sampleVolume; // 0x00003170 length: 4
int sampleSndStructVolumePercentage_0x3174[32]; // 0x00003174 length: 128
int samplePaused_0x31f4[32]; // 0x000031F4 length: 128
undefined4 sec_Section1055_0x3274; // 0x00003274 length: 4
int sec_Section1055_0x3274; // 0x00003274 length: 4
int currentSoundID_0x3278; // 0x00003278 length: 4
dword currentSoundIDVolumeUnk_0x327c; // 0x0000327C length: 4
dword mbr_0x3280; // 0x00003280 length: 4
Expand Down
30 changes: 30 additions & 0 deletions src/OpenSHC/Audio/mss/SoundSystem/setSomeSoundTime.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "../SoundSystem.func.hpp"

namespace OpenSHC {
namespace Audio {
namespace MSS {

// FUNCTION: STRONGHOLDCRUSADER 0x0047A2A0
void SoundSystem::setSomeSoundTime()
{
if (!(0 < this->sec_Section1055_0x3274 && this->mbr_0x154 != 2)) {
return;
}

if (this->mbr_0x154 == 1) {
DWORD _currentTime = timeGetTime();
// This logic seems to smooth out a time difference by not having the timestamp jump directly on
// bigger delays. Instead, it settles slightly behind the real time, basically pushing the current
// timestamp back a small bit, but in such a way that is gets closer and closer to the real time.
this->someSoundTime_0x158
= (_currentTime + ((_currentTime - this->someSoundTime_0x158) / 200) * -10) - 1;
this->mbr_0x154 = 2;
} else {
this->mbr_0x154 = 2;
this->someSoundTime_0x158 = timeGetTime();
}
}
}

}
}
2 changes: 1 addition & 1 deletion status/addresses-SHC-3BB0A8C1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10898,7 +10898,7 @@ SHC_3BB0A8C1_0x0047A130 | 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
SHC_3BB0A8C1_0x0047A2A0 | 100.0% | Reimplemented
SHC_3BB0A8C1_0x0047A310 | 0.0% | Pending
SHC_3BB0A8C1_0x0047A340 | 0.0% | Pending
SHC_3BB0A8C1_0x0047A554 | 0.0% | Pending
Expand Down