Skip to content
Open
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
47 changes: 47 additions & 0 deletions src/OpenSHC/Audio/SFX/SFXState/playSpeechSFX.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// disable deprecation warnings for strcpy
#pragma warning(disable : 4996)

#include "../SFXState.func.hpp"

#include "OpenSHC/Audio/MSS/SoundSystem.func.hpp"
#include "OpenSHC/OS.func.hpp"
#include "OpenSHC/string-literals.hpp"

#include "OpenSHC/Globals/DAT_GameCore.hpp"
#include "OpenSHC/Globals/DAT_LastSpeechSFXFilename.hpp"
#include "OpenSHC/Globals/DAT_MapPropertiesState.hpp"
#include "OpenSHC/Globals/DAT_SoundSystemState.hpp"
#include "OpenSHC/Globals/DAT_SpeechDefinedData.hpp"

namespace OpenSHC {
namespace Audio {
namespace SFX {

// FUNCTION: STRONGHOLDCRUSADER 0x0044A3A0
void SFXState::playSpeechSFX(SpeechEffectID speechID)
{
if (speechID < SEID_GENERAL_STARTGAME || SEID_GENERAL_MESSAGE3 < speechID
|| (DAT_GameCore::instance.gameMode_2 == Game::GM_BUILDERUnk
&& DAT_MapPropertiesState::instance.SEC_U3_MapType2_1 == Map::MT_SIEGE
&& SEID_POP_FALLING <= speechID && speechID <= SEID_TAXES_RATE8)) {
return;
}

char fullSoundPath[64];
MACRO_CALL(OS_Func::_sprintf)(fullSoundPath, s_fx_speech_s_005a4d68,
DAT_SpeechDefinedData::instance.DAT_SpeechEffectFileArray[speechID]);
if (!MACRO_CALL(OS_Func::__stricmp)(fullSoundPath, DAT_LastSpeechSFXFilename::instance)) {
if (MACRO_CALL_MEMBER(MSS::SoundSystem_Func::isSampleOrStreamPlaying, DAT_SoundSystemState::ptr)(
MSS::enums::SND_STR_SPEECH_1)
|| MACRO_CALL_MEMBER(MSS::SoundSystem_Func::isSampleOrStreamPlaying, DAT_SoundSystemState::ptr)(
MSS::enums::SND_STR_SPEECH_2)) {
return;
}
}
strcpy(DAT_LastSpeechSFXFilename::instance, fullSoundPath);
MACRO_CALL_MEMBER(MSS::SoundSystem_Func::playSoundOnSpeechStream, DAT_SoundSystemState::ptr)(fullSoundPath);
}

}
}
}
2 changes: 1 addition & 1 deletion src/OpenSHC/OS/OS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace OS {
void* _memset(void* _Dst, int _Val, size_t _Size) { return memset(_Dst, _Val, _Size); }

// STUB: STRONGHOLDCRUSADER 0x0057F6DA
int _sprintf(char* _Dest, char* _Format, ...)
int _sprintf(char* _Dest, char const* _Format, ...)
{
// needed for proxy
va_list args;
Expand Down
2 changes: 1 addition & 1 deletion status/addresses-SHC-3BB0A8C1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16279,7 +16279,7 @@ SHC_3BB0A8C1_0x0044A290 | 0.0% | Pending

SHC_3BB0A8C1_0x0044A360 | 0.0% | Pending

SHC_3BB0A8C1_0x0044A3A0 | 0.0% | Pending
SHC_3BB0A8C1_0x0044A3A0 | 100.0% | Reimplemented, Security Cookie of DLL

SHC_3BB0A8C1_0x0044A460 | 0.0% | Pending

Expand Down