Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Revert "Add client setting to toggle internet sound streams (#834)"
This reverts commit bdb8013.
  • Loading branch information
ccw808 committed Sep 16, 2019
1 parent 0e8ab99 commit 59b5fb2
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 89 deletions.
3 changes: 1 addition & 2 deletions Client/core/CClientVariables.cpp
@@ -1,6 +1,6 @@
/*****************************************************************************
*
* PROJECT: Multi Theft Auto
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: core/CClientVariables.cpp
* PURPOSE: Managed storage of client variables (cvars)
Expand Down Expand Up @@ -331,7 +331,6 @@ void CClientVariables::LoadDefaults()
DEFAULT("high_detail_peds", 0); // Disable rendering high detail peds all the time
DEFAULT("fast_clothes_loading", 1); // 0-off 1-auto 2-on
DEFAULT("allow_screen_upload", 1); // 0-off 1-on
DEFAULT("allow_external_sounds", 1); // 0-off 1-on
DEFAULT("max_clientscript_log_kb", 5000); // Max size in KB (0-No limit)
DEFAULT("display_fullscreen_style", 0); // 0-standard 1-borderless 2-borderless keep res 3-borderless stretch
DEFAULT("display_windowed", 0); // 0-off 1-on
Expand Down
33 changes: 0 additions & 33 deletions Client/core/CSettings.cpp
Expand Up @@ -376,11 +376,6 @@ void CSettings::CreateGUI()
m_pCheckBoxAllowScreenUpload->GetPosition(vecTemp, false);
m_pCheckBoxAllowScreenUpload->AutoSize(NULL, 20.0f);

m_pCheckBoxAllowExternalSounds = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabMultiplayer, _("Allow external sounds"), true));
m_pCheckBoxAllowExternalSounds->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 20.0f));
m_pCheckBoxAllowExternalSounds->GetPosition(vecTemp, false);
m_pCheckBoxAllowExternalSounds->AutoSize(NULL, 20.0f);

m_pCheckBoxCustomizedSAFiles = reinterpret_cast<CGUICheckBox*>(pManager->CreateCheckBox(pTabMultiplayer, _("Use customized GTA:SA files"), true));
m_pCheckBoxCustomizedSAFiles->SetPosition(CVector2D(vecTemp.fX, vecTemp.fY + 20.0f));
m_pCheckBoxCustomizedSAFiles->GetPosition(vecTemp, false);
Expand Down Expand Up @@ -1218,7 +1213,6 @@ void CSettings::CreateGUI()
m_pComboFxQuality->SetSelectionHandler(GUI_CALLBACK(&CSettings::OnFxQualityChanged, this));
m_pCheckBoxVolumetricShadows->SetClickHandler(GUI_CALLBACK(&CSettings::OnVolumetricShadowsClick, this));
m_pCheckBoxAllowScreenUpload->SetClickHandler(GUI_CALLBACK(&CSettings::OnAllowScreenUploadClick, this));
m_pCheckBoxAllowExternalSounds->SetClickHandler(GUI_CALLBACK(&CSettings::OnAllowExternalSoundsClick, this));
m_pCheckBoxCustomizedSAFiles->SetClickHandler(GUI_CALLBACK(&CSettings::OnCustomizedSAFilesClick, this));
m_pCheckBoxWindowed->SetClickHandler(GUI_CALLBACK(&CSettings::OnWindowedClick, this));
m_pCheckBoxDPIAware->SetClickHandler(GUI_CALLBACK(&CSettings::OnDPIAwareClick, this));
Expand Down Expand Up @@ -1512,11 +1506,6 @@ void CSettings::UpdateVideoTab()
CVARS_GET("allow_screen_upload", bAllowScreenUploadEnabled);
m_pCheckBoxAllowScreenUpload->SetSelected(bAllowScreenUploadEnabled);

// Allow external sounds
bool bAllowExternalSoundsEnabled;
CVARS_GET("allow_external_sounds", bAllowExternalSoundsEnabled);
m_pCheckBoxAllowExternalSounds->SetSelected(bAllowExternalSoundsEnabled);

// Customized sa files
m_pCheckBoxCustomizedSAFiles->SetSelected(GetApplicationSettingInt("customized-sa-files-request") != 0);
m_pCheckBoxCustomizedSAFiles->SetVisible(GetApplicationSettingInt("customized-sa-files-show") != 0);
Expand Down Expand Up @@ -3344,10 +3333,6 @@ void CSettings::SaveData()
bool bAllowScreenUploadEnabled = m_pCheckBoxAllowScreenUpload->GetSelected();
CVARS_SET("allow_screen_upload", bAllowScreenUploadEnabled);

// Allow external sounds
bool bAllowExternalSoundsEnabled = m_pCheckBoxAllowExternalSounds->GetSelected();
CVARS_SET("allow_external_sounds", bAllowExternalSoundsEnabled);

// Grass
bool bGrassEnabled = m_pCheckBoxGrass->GetSelected();
CVARS_SET("grass", bGrassEnabled);
Expand Down Expand Up @@ -4351,24 +4336,6 @@ bool CSettings::OnAllowScreenUploadClick(CGUIElement* pElement)
return true;
}

//
// AllowExternalSounds
//
bool CSettings::OnAllowExternalSoundsClick(CGUIElement* pElement)
{
if (!m_pCheckBoxAllowExternalSounds->GetSelected() && !m_bShownAllowExternalSoundsMessage)
{
m_bShownAllowExternalSoundsMessage = true;
SString strMessage;
strMessage +=
_("Some scripts may play sounds, such as radio, from the internet."
"\n\nDisabling this setting may decrease network"
"\nbandwidth consumption.\n");
CCore::GetSingleton().ShowMessageBox(_("EXTERNAL SOUNDS"), strMessage, MB_BUTTON_OK | MB_ICON_INFO);
}
return true;
}

//
// CustomizedSAFiles
//
Expand Down
5 changes: 1 addition & 4 deletions Client/core/CSettings.h
@@ -1,6 +1,6 @@
/*****************************************************************************
*
* PROJECT: Multi Theft Auto
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: core/CSettings.h
* PURPOSE: Header file for in-game settings window class
Expand Down Expand Up @@ -152,7 +152,6 @@ class CSettings
CGUICheckBox* m_pCheckBoxDeviceSelectionDialog;
CGUICheckBox* m_pCheckBoxShowUnsafeResolutions;
CGUICheckBox* m_pCheckBoxAllowScreenUpload;
CGUICheckBox* m_pCheckBoxAllowExternalSounds;
CGUICheckBox* m_pCheckBoxCustomizedSAFiles;
CGUICheckBox* m_pCheckBoxGrass;
CGUICheckBox* m_pCheckBoxHeatHaze;
Expand Down Expand Up @@ -378,7 +377,6 @@ class CSettings
bool OnFxQualityChanged(CGUIElement* pElement);
bool OnVolumetricShadowsClick(CGUIElement* pElement);
bool OnAllowScreenUploadClick(CGUIElement* pElement);
bool OnAllowExternalSoundsClick(CGUIElement* pElement);
bool OnCustomizedSAFilesClick(CGUIElement* pElement);
bool ShowUnsafeResolutionsClick(CGUIElement* pElement);
bool OnWindowedClick(CGUIElement* pElement);
Expand Down Expand Up @@ -445,7 +443,6 @@ class CSettings
DWORD m_dwFrameCount;
bool m_bShownVolumetricShadowsWarning;
bool m_bShownAllowScreenUploadMessage;
bool m_bShownAllowExternalSoundsMessage;
int m_iMaxAnisotropic;

std::list<SKeyBindSection*> m_pKeyBindSections;
Expand Down
52 changes: 8 additions & 44 deletions Client/mods/deathmatch/logic/CClientSound.cpp
@@ -1,8 +1,9 @@
/*****************************************************************************
*
* PROJECT: Multi Theft Auto
* PROJECT: Multi Theft Auto v1.0
* (Shared logic for modifications)
* LICENSE: See LICENSE in the top level directory
* FILE: mods/deathmatch/logic/CClientSound.cpp
* FILE: mods/shared_logic/CClientSound.cpp
* PURPOSE: Sound entity class
*
*****************************************************************************/
Expand Down Expand Up @@ -62,15 +63,12 @@ void CClientSound::DistanceStreamIn()
{
if (!m_pAudio)
{
// If the sound was successfully created, we stream it in
if (Create())
{
m_pSoundManager->OnDistanceStreamIn(this);
Create();
m_pSoundManager->OnDistanceStreamIn(this);

// Call Stream In event
CLuaArguments Arguments;
CallEvent("onClientElementStreamIn", Arguments, true);
}
// Call Stream In event
CLuaArguments Arguments;
CallEvent("onClientElementStreamIn", Arguments, true);
}
}

Expand Down Expand Up @@ -106,11 +104,6 @@ bool CClientSound::Create()
if (m_pAudio)
return false;

// If we're not allowed to play a stream, stop here
if (m_bStream)
if (!g_pCore->GetCVars()->GetValue("allow_external_sounds", true))
return false;

// Initial state
if (!m_pBuffer)
m_pAudio = new CBassAudio(m_bStream, m_strPath, m_bLoop, m_bThrottle, m_b3D);
Expand Down Expand Up @@ -633,35 +626,6 @@ bool CClientSound::IsFxEffectEnabled(uint uiFxEffect)
////////////////////////////////////////////////////////////
void CClientSound::Process3D(const CVector& vecPlayerPosition, const CVector& vecCameraPosition, const CVector& vecLookAt)
{
// If this is a stream
if (m_bStream)
{
// Check if we're allowed to play streams, otherwise just destroy the stream
// This way we can start the stream without the need to handle this edge case in scripting
if (g_pCore->GetCVars()->GetValue("allow_external_sounds", true))
{
if (!m_pAudio)
{
// call onClientSoundStarted
CLuaArguments Arguments;
Arguments.PushString("enabled"); // Reason
CallEvent("onClientSoundStarted", Arguments, false);
Create();
}
}
else
{
if (m_pAudio)
{
// call onClientSoundStopped
CLuaArguments Arguments;
Arguments.PushString("disabled"); // Reason
CallEvent("onClientSoundStopped", Arguments, false);
Destroy();
}
}
}

// Update 3D things if required
if (m_b3D)
{
Expand Down
@@ -1,6 +1,6 @@
/*****************************************************************************
*
* PROJECT: Multi Theft Auto
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
* PURPOSE: Scripting function processing
Expand Down
2 changes: 1 addition & 1 deletion Client/mods/deathmatch/logic/CStaticFunctionDefinitions.h
@@ -1,6 +1,6 @@
/*****************************************************************************
*
* PROJECT: Multi Theft Auto
* PROJECT: Multi Theft Auto v1.0
* LICENSE: See LICENSE in the top level directory
* FILE: mods/deathmatch/logic/CStaticFunctionDefinitions.h
* PURPOSE: Header for static function definitions class
Expand Down
4 changes: 2 additions & 2 deletions Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.cpp
@@ -1,8 +1,8 @@
/*****************************************************************************
*
* PROJECT: Multi Theft Auto
* PROJECT: Multi Theft Auto v1.x
* LICENSE: See LICENSE in the top level directory
* FILE: mods/deathmatch/logic/luadefs/CLuaAudioDefs.cpp
* FILE: mods/shared_logic/luadefs/CLuaAudioDefs.cpp
* PURPOSE: Lua audio definitions class
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
Expand Down
4 changes: 2 additions & 2 deletions Client/mods/deathmatch/logic/luadefs/CLuaAudioDefs.h
@@ -1,8 +1,8 @@
/*****************************************************************************
*
* PROJECT: Multi Theft Auto
* PROJECT: Multi Theft Auto v1.x
* LICENSE: See LICENSE in the top level directory
* FILE: mods/deathmatch/logic/luadefs/CLuaAudioDefs.h
* FILE: mods/shared_logic/luadefs/CLuaAudioDefs.h
* PURPOSE: Lua audio definitions class header
*
* Multi Theft Auto is available from http://www.multitheftauto.com/
Expand Down

0 comments on commit 59b5fb2

Please sign in to comment.