Skip to content

Commit

Permalink
Updated code
Browse files Browse the repository at this point in the history
TODO: Fix CLuaFunctionParser to recognize `const char*` as a string and return default values for those types that cannot be recognized as its a NIGHTMARE to debug
  • Loading branch information
TracerDS committed Jun 18, 2024
1 parent a51a257 commit 065efcf
Show file tree
Hide file tree
Showing 4 changed files with 355 additions and 628 deletions.
30 changes: 27 additions & 3 deletions Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8515,9 +8515,13 @@ bool CStaticFunctionDefinitions::GetSoundLevelData(
return GetSoundLevelData(*std::get<CClientPlayer*>(element), dwLeft, dwRight);
}

float CStaticFunctionDefinitions::GetSoundBPM(CClientSound& Sound) noexcept {
return Sound.GetSoundBPM();
}

bool CStaticFunctionDefinitions::GetSoundBPM(CClientSound& Sound, float& fBPM)
{
fBPM = Sound.GetSoundBPM();
fBPM = GetSoundBPM(Sound);
return fBPM != 0.0f;
}

Expand Down Expand Up @@ -8562,9 +8566,14 @@ bool CStaticFunctionDefinitions::SetSoundMinDistance(CClientSound& Sound, float
return true;
}

float CStaticFunctionDefinitions::GetSoundMinDistance(CClientSound& Sound) noexcept
{
return Sound.GetMinDistance();
}

bool CStaticFunctionDefinitions::GetSoundMinDistance(CClientSound& Sound, float& fDistance)
{
fDistance = Sound.GetMinDistance();
fDistance = GetSoundMinDistance(Sound);
return true;
}

Expand All @@ -8574,9 +8583,13 @@ bool CStaticFunctionDefinitions::SetSoundMaxDistance(CClientSound& Sound, float
return true;
}

float CStaticFunctionDefinitions::GetSoundMaxDistance(CClientSound& Sound) noexcept {
return Sound.GetMaxDistance();
}

bool CStaticFunctionDefinitions::GetSoundMaxDistance(CClientSound& Sound, float& fDistance)
{
fDistance = Sound.GetMaxDistance();
fDistance = GetSoundMaxDistance(Sound);
return true;
}

Expand Down Expand Up @@ -8611,6 +8624,17 @@ bool CStaticFunctionDefinitions::SetSoundEffectEnabled(CClientPlayer& Player, co
return false;
}

bool CStaticFunctionDefinitions::SetSoundEffectEnabled(
std::variant<CClientSound*, CClientPlayer*>& element,
const SString& strEffectName,
bool bEnable
) noexcept {
if (std::holds_alternative<CClientSound*>(element))
return SetSoundEffectEnabled(*std::get<CClientSound*>(element), strEffectName, bEnable);
else if (std::holds_alternative<CClientPlayer*>(element))
return SetSoundEffectEnabled(*std::get<CClientPlayer*>(element), strEffectName, bEnable);
}

bool CStaticFunctionDefinitions::SetSoundPan(CClientPlayer& Player, float fPan)
{
CClientPlayerVoice* pVoice = Player.GetVoice();
Expand Down
4 changes: 4 additions & 0 deletions Client/mods/deathmatch/logic/CStaticFunctionDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -767,13 +767,16 @@ class CStaticFunctionDefinitions
static float* GetSoundWaveData(CClientSound& Sound, int iLength);
static bool SetSoundPanEnabled(CClientSound& Sound, bool bEnabled);
static bool GetSoundLevelData(CClientSound& Sound, DWORD& dwLeft, DWORD& dwRight);
static float GetSoundBPM(CClientSound& Sound) noexcept;
static bool GetSoundBPM(CClientSound& Sound, float& fBPM);
static bool IsSoundPanEnabled(CClientSound& Sound);
static float GetSoundSpeed(CClientSound& Sound) noexcept;
static bool GetSoundSpeed(CClientSound& Sound, float& fSpeed) noexcept;
static bool SetSoundMinDistance(CClientSound& Sound, float fDistance);
static float GetSoundMinDistance(CClientSound& Sound) noexcept;
static bool GetSoundMinDistance(CClientSound& Sound, float& fDistance);
static bool SetSoundMaxDistance(CClientSound& Sound, float fDistance);
static float GetSoundMaxDistance(CClientSound& Sound) noexcept;
static bool GetSoundMaxDistance(CClientSound& Sound, float& fDistance);
static bool GetSoundMetaTags(CClientSound& Sound, const SString& strFormat, SString& strMetaTags);
static bool SetSoundEffectEnabled(CClientSound& Sound, const SString& strEffectName, bool bEnable);
Expand Down Expand Up @@ -820,6 +823,7 @@ class CStaticFunctionDefinitions
static bool GetSoundLevelData(std::variant<CClientSound*, CClientPlayer*>& element, DWORD& dwLeft, DWORD& dwRight) noexcept;
static bool SetSoundPan(std::variant<CClientSound*, CClientPlayer*>& element, float fPan) noexcept;
static float GetSoundPan(std::variant<CClientSound*, CClientPlayer*>& element) noexcept;
static bool SetSoundEffectEnabled(std::variant<CClientSound*, CClientPlayer*>& element, const SString& strEffectName, bool bEnable) noexcept;

// Handling funcs
static eHandlingProperty GetVehicleHandlingEnum(std::string strProperty);
Expand Down
Loading

0 comments on commit 065efcf

Please sign in to comment.