feat(sound): finish implementing SI2::InitSoundKitDefs

This commit is contained in:
fallenoak 2025-11-22 13:13:01 -06:00
parent 29ee02db68
commit a83a70c0e5
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 18 additions and 4 deletions

View File

@ -3,9 +3,11 @@
#include "sound/CVarHandlers.hpp"
#include "sound/SESound.hpp"
#include "sound/SOUNDKITDEF.hpp"
#include "sound/SOUNDKITLOOKUP.hpp"
#include "ui/FrameScript.hpp"
TSGrowableArray<SOUNDKITDEF*> SI2::s_SoundKitDefs;
TSHashTable<SOUNDKITLOOKUP, HASHKEY_CONSTSTRI> SI2::s_SoundKitLookupTable;
int32_t SI2::Init(int32_t a1) {
// TODO
@ -108,7 +110,7 @@ void SI2::InitSoundKitDefs() {
for (uint32_t i = 0; i < g_soundEntriesDB.GetNumRecords(); i++) {
auto soundEntriesRec = g_soundEntriesDB.GetRecordByIndex(i);
// Sound kit definition
// Populate sound kit definitions
auto soundKitDef = STORM_NEW(SOUNDKITDEF);
@ -145,6 +147,8 @@ void SI2::InitSoundKitDefs() {
soundKitDef->fileCount++;
}
// Copy relevant record fields
soundKitDef->flags = soundEntriesRec->m_flags;
soundKitDef->name = soundEntriesRec->m_name;
soundKitDef->minDistance = soundEntriesRec->m_minDistance;
@ -160,9 +164,15 @@ void SI2::InitSoundKitDefs() {
SI2::s_SoundKitDefs[soundEntriesRec->GetID()] = soundKitDef;
// Sound kit lookup
// Populate sound kit lookups
// TODO SOUNDKITLOOKUP
auto soundKitLookup = SI2::s_SoundKitLookupTable.Ptr(soundEntriesRec->m_name);
if (!soundKitLookup) {
soundKitLookup = SI2::s_SoundKitLookupTable.New(soundEntriesRec->m_name, 0, 0x0);
}
soundKitLookup->ID = soundEntriesRec->GetID();
}
}

View File

@ -1,10 +1,13 @@
#ifndef SOUND_SI2_HPP
#define SOUND_SI2_HPP
#include "SOUNDKITLOOKUP.hpp"
#include "sound/SI2Script.hpp"
#include "storm/hash/Hashkey.hpp"
#include "storm/hash/TSHashTable.hpp"
#include "ui/Types.hpp"
#include <storm/Array.hpp>
#include <cstdint>
#include <storm/Array.hpp>
class SOUNDKITDEF;
@ -13,6 +16,7 @@ class SI2 {
// Static variables
static FrameScript_Method s_ScriptFunctions[NUM_SCRIPT_FUNCTIONS_SI2];
static TSGrowableArray<SOUNDKITDEF*> s_SoundKitDefs;
static TSHashTable<SOUNDKITLOOKUP, HASHKEY_CONSTSTRI> s_SoundKitLookupTable;
// Static functions
static int32_t Init(int32_t a1);