diff --git a/Classes/ClientSettings.uc b/Classes/ClientSettings.uc index 01b04af..2b5bd37 100644 --- a/Classes/ClientSettings.uc +++ b/Classes/ClientSettings.uc @@ -133,6 +133,9 @@ var CrosshairLayer TopLayer; var config float MenuX, MenuY, MenuWidth, MenuHeight; +var Sound DefaultHitSound[16]; +var Sound LoadedHitSound[16]; + simulated function AppendLayer(CrosshairLayer L) { if (BottomLayer == none) { BottomLayer = L; @@ -164,21 +167,22 @@ simulated function CreateCrosshairLayers() { } } -simulated function CheckConfig(string PackageBaseName) { +simulated function LoadHitSounds() { local int i; - local string PackageName; - - PackageName = class'StringUtils'.static.GetPackage(); for (i = 0; i < arraycount(sHitSound); i++) { - if (Left(sHitSound[i], Len(PackageBaseName)) ~= PackageBaseName) { - sHitSound[i] = class'StringUtils'.static.GetPackage()$Mid(sHitSound[i], InStr(sHitSound[i], ".")); - } - if (sHitSound[i] == "" && sHitSound[i] != default.sHitSound[i]) { - sHitSound[i] = default.sHitSound[i]; - } + if (sHitSound[i] != "") + LoadedHitSound[i] = Sound(DynamicLoadObject(sHitSound[i], class'Sound', true)); + else + LoadedHitSound[i] = none; + + if (LoadedHitSound[i] == none && DefaultHitSound[i] != none) + LoadedHitSound[i] = DefaultHitSound[i]; } +} +simulated function CheckConfig() { + LoadHitSounds(); CreateCrosshairLayers(); if (FPSCounterSmoothingStrength <= 0) @@ -425,10 +429,10 @@ defaultproperties SelectedTeamHitSound=2 HitSoundVolume=4 HitSoundTeamVolume=4 - sHitSound(0)="InstaGibPlusAssets_v1.HitSound" - sHitSound(1)="UnrealShare.StingerFire" - sHitSound(2)="InstaGibPlusAssets_v1.HitSoundFriendly" - sHitSound(3)="InstaGibPlusAssets_v1.HitSound1" + DefaultHitSound(0)=Sound'HitSound' + DefaultHitSound(1)=Sound'StingerFire' + DefaultHitSound(2)=Sound'HitSoundFriendly' + DefaultHitSound(3)=Sound'HitSound1' cShockBeam=1 bHideOwnBeam=False bBeamEnableLight=True diff --git a/Classes/IGPlus_SettingsContent.uc b/Classes/IGPlus_SettingsContent.uc index 99ca406..286c216 100644 --- a/Classes/IGPlus_SettingsContent.uc +++ b/Classes/IGPlus_SettingsContent.uc @@ -772,6 +772,7 @@ function SaveHitSounds() { Settings.sHitSound[i++] = Item.Value; Item = UWindowComboListItem(Item.Next); } + Settings.LoadHitSounds(); } function ShowCrosshairFactoryDialog() { @@ -1147,10 +1148,6 @@ function Save() { Settings.HitSoundTeamVolume = float(Edit_HitSoundTeamVolume.GetValue()); Settings.SelectedTeamHitSound = Cmb_SelectedTeamHitSound.GetSelectedIndex2(); - // force reloading of hit sounds in case the selected ones changed - class'bbPlayerStatics'.default.PlayedHitSound = none; - class'bbPlayerStatics'.default.PlayedTeamHitSound = none; - SaveHitSounds(); Settings.bEnableKillCam = Chk_EnableKillCam.bChecked; diff --git a/Classes/bbCHSpectator.uc b/Classes/bbCHSpectator.uc index 93d0e97..ee1b956 100644 --- a/Classes/bbCHSpectator.uc +++ b/Classes/bbCHSpectator.uc @@ -152,7 +152,7 @@ simulated function InitSettings() { if (Settings == none) { ClientSettingsHelper = new(none, 'InstaGibPlus') class'Object'; Settings = new(ClientSettingsHelper, 'ClientSettings') class'ClientSettings'; - Settings.CheckConfig(VersionInfo.GetPropertyText("PackageBaseName")); + Settings.CheckConfig(); Log("Loaded Settings!", 'IGPlus'); } } diff --git a/Classes/bbPlayer.uc b/Classes/bbPlayer.uc index a7451e3..d0ef8fe 100644 --- a/Classes/bbPlayer.uc +++ b/Classes/bbPlayer.uc @@ -926,7 +926,7 @@ simulated function InitSettings() { if (Settings == none) { ClientSettingsHelper = new(none, StringUtils.StringToName(VersionInfo.GetPropertyText("PackageBaseName"))) class'Object'; // object name = INI file name Settings = new(ClientSettingsHelper, 'ClientSettings') class'ClientSettings'; // object name = Section name - Settings.CheckConfig(VersionInfo.GetPropertyText("PackageBaseName")); + Settings.CheckConfig(); Log("Loaded Settings!", 'IGPlus'); } } diff --git a/Classes/bbPlayerStatics.uc b/Classes/bbPlayerStatics.uc index 610dc4f..43f7863 100644 --- a/Classes/bbPlayerStatics.uc +++ b/Classes/bbPlayerStatics.uc @@ -10,8 +10,6 @@ var float HitMarkerLifespan; var float HitMarkerSize; var color HitMarkerColor; var color HitMarkerTeamColors[4]; -var Sound PlayedHitSound; -var Sound PlayedTeamHitSound; static function DrawFPS(Canvas C, HUD MyHud, ClientSettings Settings, float DeltaTime) { local string FPS; @@ -164,17 +162,11 @@ static function DrawHitMarker(Canvas C, ClientSettings Settings, float DeltaTime } static function Sound GetHitSound(ClientSettings Settings) { - if (default.PlayedHitSound == none) { - default.PlayedHitSound = Sound(DynamicLoadObject(Settings.sHitSound[Settings.SelectedHitSound], class'Sound')); - } - return default.PlayedHitSound; + return Settings.LoadedHitSound[Settings.SelectedHitSound]; } static function Sound GetTeamHitSound(ClientSettings Settings) { - if (default.PlayedTeamHitSound == none) { - default.PlayedTeamHitSound = Sound(DynamicLoadObject(Settings.sHitSound[Settings.SelectedTeamHitSound], class'Sound')); - } - return default.PlayedTeamHitSound; + return Settings.LoadedHitSound[Settings.SelectedTeamHitSound]; } static function PlaySoundWithPitch469(PlayerPawn Me, Sound S, float Volume, optional byte Priority, optional float Pitch) {