Skip to content

Commit 1503bbc

Browse files
committed
reimplement: SHC_3BB0A8C1_0x00479C80 optimization issues
1 parent cf6e9d4 commit 1503bbc

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#include "OpenSHC/Audio/mss/SoundSystem.func.hpp"
2+
3+
#include "OpenSHC/Globals/DAT_SoundEffectsHelperData1.hpp"
4+
5+
namespace OpenSHC {
6+
namespace Audio {
7+
namespace MSS {
8+
9+
// TODO: Remove, only test
10+
// GLOBAL: STRONGHOLDCRUSADER 0x00df3828
11+
int test;
12+
13+
// FUNCTION: STRONGHOLDCRUSADER 0x00479C80
14+
void SoundSystem::findSamplePlaceForSoundUnk(int soundIndex)
15+
{
16+
if (this->soundFileCurrSampleNum_0x28c[soundIndex] >= 0) {
17+
return;
18+
}
19+
20+
test = 0; // DAT_SoundEffectsHelperData1::ptr->DAT_NumberOfUsedSoundSamplePlaces = 0;
21+
22+
for (int i = 1; i < 32; ++i) {
23+
if (this->sampleSoundIndex_0x20c[i]) {
24+
++test; // ++DAT_SoundEffectsHelperData1::ptr->DAT_NumberOfUsedSoundSamplePlaces;
25+
}
26+
}
27+
28+
for (int i = 1; i < 32; ++i) {
29+
if (this->sampleSoundIndex_0x20c[i]) {
30+
continue;
31+
}
32+
this->sampleSoundIndex_0x20c[i] = soundIndex;
33+
this->soundFileCurrSampleNum_0x28c[soundIndex] = i;
34+
return;
35+
}
36+
}
37+
38+
}
39+
}
40+
}

0 commit comments

Comments
 (0)