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
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 | 100.0% | Reimplemented
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