Skip to content
Draft
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
40 changes: 40 additions & 0 deletions src/OpenSHC/Audio/mss/SoundSystem/findSamplePlaceForSoundUnk.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include "OpenSHC/Audio/mss/SoundSystem.func.hpp"

#include "OpenSHC/Globals/DAT_SoundEffectsHelperData1.hpp"

namespace OpenSHC {
namespace Audio {
namespace MSS {

// TODO: Remove, only test
// GLOBAL: STRONGHOLDCRUSADER 0x00df3828
int test;

// FUNCTION: STRONGHOLDCRUSADER 0x00479C80
void SoundSystem::findSamplePlaceForSoundUnk(int soundIndex)
{
if (this->soundFileCurrSampleNum_0x28c[soundIndex] >= 0) {
return;
}

test = 0; // DAT_SoundEffectsHelperData1::ptr->DAT_NumberOfUsedSoundSamplePlaces = 0;

for (int i = 1; i < 32; ++i) {
if (this->sampleSoundIndex_0x20c[i]) {
++test; // ++DAT_SoundEffectsHelperData1::ptr->DAT_NumberOfUsedSoundSamplePlaces;
}
}

for (int i = 1; i < 32; ++i) {
if (this->sampleSoundIndex_0x20c[i]) {
continue;
}
this->sampleSoundIndex_0x20c[i] = soundIndex;
this->soundFileCurrSampleNum_0x28c[soundIndex] = i;
return;
}
}

}
}
}