feat(sound): implement SI2::PlayUISound

This commit is contained in:
fallenoak 2025-11-22 23:09:03 -06:00
parent ff62e37b4b
commit 28095be341
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
4 changed files with 67 additions and 1 deletions

View File

@ -1,4 +1,5 @@
#include "sound/SI2.hpp"
#include "SoundKitProperties.hpp"
#include "console/CVar.hpp"
#include "sound/CVarHandlers.hpp"
#include "sound/SESound.hpp"
@ -229,10 +230,28 @@ void SI2::InitSoundKitGroups() {
}
}
void SI2::PlayUISound(int32_t id) {
void SI2::PlaySoundKit(int32_t id, int32_t a2, void* handle, const SoundKitProperties& properties, int32_t a5, void* a6, int32_t a7, int32_t a8) {
// TODO
}
void SI2::PlayUISound(int32_t id) {
static auto voiceChatOnID = SI2::GetSoundKitID("VoiceChatOn");
static auto voiceChatOffID = SI2::GetSoundKitID("VoiceChatOff");
SoundKitProperties properties;
properties.ResetToDefaults();
if (id == voiceChatOnID || id == voiceChatOffID) {
properties.m_type = 3;
}
properties.int20 = 128;
properties.uint24 = 2;
properties.uint3C = 0;
SI2::PlaySoundKit(id, 0, nullptr, properties, 0, nullptr, 1, 0);
}
void SI2::RegisterCVars() {
CVar::Register(
"StartTalkingDelay",

View File

@ -9,6 +9,7 @@
class SOUNDKITDEF;
struct SOUNDKITLOOKUP;
class SoundKitProperties;
class SI2 {
public:
@ -24,6 +25,7 @@ class SI2 {
static int32_t Init(int32_t a1);
static void InitSoundKitDefs();
static void InitSoundKitGroups();
static void PlaySoundKit(int32_t id, int32_t a2, void* handle, const SoundKitProperties& properties, int32_t a5, void* a6, int32_t a7, int32_t a8);
static void PlayUISound(int32_t id);
static void RegisterCVars();
static void RegisterScriptFunctions();

View File

@ -0,0 +1,22 @@
#include "sound/SoundKitProperties.hpp"
#include "util/SFile.hpp"
void SoundKitProperties::ResetToDefaults() {
// TODO
this->int20 = -1;
// TODO
this->m_type = 0;
// TODO
this->uint24 = 0;
// TODO
this->m_streaming = SFile::IsStreamingMode() != 0;
// TODO
}

View File

@ -0,0 +1,23 @@
#ifndef SOUND_SOUND_KIT_PROPERTIES_HPP
#define SOUND_SOUND_KIT_PROPERTIES_HPP
#include <cstdint>
class SoundKitProperties {
public:
// Member variables
uint32_t m_type;
// TODO
int32_t int20;
uint32_t uint24;
// TODO
uint32_t uint3C;
// TODO
int32_t m_streaming;
// TODO
// Member functions
void ResetToDefaults();
};
#endif