From 1a7f50476baf153c58b30a1f366718ef5f9c8eea Mon Sep 17 00:00:00 2001 From: developomp Date: Sat, 19 Mar 2022 17:35:47 +0900 Subject: [PATCH] fixed gun sound replacement logic --- WBM/WBM.cs | 2 +- WBM/features/oldGunSound.cs | 28 ++++++++-------------------- WBM/mangledNames.cs | 2 -- 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/WBM/WBM.cs b/WBM/WBM.cs index 0aaff02..9ba65cf 100644 --- a/WBM/WBM.cs +++ b/WBM/WBM.cs @@ -13,7 +13,7 @@ namespace WBM { public const string programID = "com.developomp.wbm"; public const string programName = "War Brokers Mods"; - public const string programVersion = "1.9.0.0"; + public const string programVersion = "1.9.1.0"; /// This function is called as soon as the component becomes active. /// It is the first event function that's called during the component's lifecycle. diff --git a/WBM/features/oldGunSound.cs b/WBM/features/oldGunSound.cs index 4196795..68b3405 100644 --- a/WBM/features/oldGunSound.cs +++ b/WBM/features/oldGunSound.cs @@ -11,23 +11,11 @@ namespace WBM { private ConfigEntry useOldGunSoundConf; - private FieldInfo oldGunSoundRef; - private CAudioClip oldGunSoundRaw - { - get - { - return (CAudioClip)this.oldGunSoundRef.GetValue(this.webguy); - } - } private CAudioClip oldGunSound; private FieldInfo AKSoundRef; private CAudioClip AKSoundRaw { - get - { - return (CAudioClip)this.AKSoundRef.GetValue(this.webguy); - } set { this.AKSoundRef.SetValue(this.webguy, value); @@ -38,10 +26,6 @@ namespace WBM private FieldInfo SMGSoundRef; private CAudioClip SMGSoundRaw { - get - { - return (CAudioClip)this.SMGSoundRef.GetValue(this.webguy); - } set { this.SMGSoundRef.SetValue(this.webguy, value); @@ -51,7 +35,6 @@ namespace WBM private void setupOldGunSound() { - this.oldGunSoundRef = webguyType.GetField(MangledNames.gunShotClip, bindFlags); this.AKSoundRef = webguyType.GetField(MangledNames.AKRifleShotClip, bindFlags); this.SMGSoundRef = webguyType.GetField(MangledNames.SMGShotClip, bindFlags); @@ -59,9 +42,14 @@ namespace WBM this.useOldGunSoundConf.SettingChanged += this.onOldGunSoundChange; this.onOldGunSoundChange(new object(), new EventArgs()); - this.oldGunSound = this.oldGunSoundRaw; - this.newAKSound = this.AKSoundRaw; - this.newSMGSound = this.SMGSoundRaw; + this.oldGunSound = new DMJGLPCLOPG("Sound/gun_shot", 1f, 0f); + this.oldGunSound.GPBDJPDFDMJ(50f, 1_000f); + + this.newAKSound = new CAudioClip("Sound/AK47_Krinkov_Close_Single", 1f, 0f); + this.newAKSound.GPBDJPDFDMJ(50f, 1_000f); + + this.newSMGSound = new DMJGLPCLOPG("Sound/smg_gun_shot", 1f, 0f); + this.newSMGSound.GPBDJPDFDMJ(50f, 1_000f); } private void onOldGunSoundChange(object sender, EventArgs e) diff --git a/WBM/mangledNames.cs b/WBM/mangledNames.cs index bdd6a0a..b70c38b 100644 --- a/WBM/mangledNames.cs +++ b/WBM/mangledNames.cs @@ -5,8 +5,6 @@ namespace WBM { public static class MangledNames { - // CAudio - public const string gunShotClip = "BJAJGLKBGIK"; public const string AKRifleShotClip = "AMLFKFMFNHJ"; public const string SMGShotClip = "JBPCEBHIPOA"; // fps limit value