diff --git a/FFVI_Mod/Core/AudioLoopManager.cs b/FFVI_Mod/Core/AudioLoopManager.cs index 356c73e..a303112 100644 --- a/FFVI_Mod/Core/AudioLoopManager.cs +++ b/FFVI_Mod/Core/AudioLoopManager.cs @@ -52,7 +52,6 @@ public class AudioLoopManager private const float TILE_SIZE = 16f; private const float MAP_EXIT_TOLERANCE = 12.0f; private const float WALL_TONE_INTERVAL = 0.1f; - private const float BEACON_INTERVAL = 2.0f; private const float SCENE_LOAD_SUPPRESSION = 1.0f; private const float INITIAL_LOOP_DELAY = 0.3f; @@ -224,7 +223,7 @@ private IEnumerator BeaconLoop() yield return null; continue; } - nextBeaconTime = Time.time + BEACON_INTERVAL; + nextBeaconTime = Time.time + (0.1f + (PreferencesManager.BeaconDelay / 25f)); if (Time.time < beaconSuppressedUntil) continue; @@ -252,11 +251,6 @@ private IEnumerator BeaconLoop() float pan = Mathf.Clamp(deltaX / 100f, -1f, 1f) * 0.5f + 0.5f; bool isSouth = entityPos.y < playerPos.y - 8f; - - float timeSinceLast = Time.time - lastBeaconPlayedAt; - if (timeSinceLast < BEACON_INTERVAL * 0.8f) - continue; - SoundPlayer.PlayBeacon(isSouth, pan, volumeScale); lastBeaconPlayedAt = Time.time; } diff --git a/FFVI_Mod/Core/ModMenu.cs b/FFVI_Mod/Core/ModMenu.cs index a6a0a28..dd1f132 100644 --- a/FFVI_Mod/Core/ModMenu.cs +++ b/FFVI_Mod/Core/ModMenu.cs @@ -50,12 +50,12 @@ public ToggleItem(string name, Func getter, Action toggle) public override void Toggle() => toggle(); } - private class VolumeItem : MenuItem + private class SliderItem : MenuItem { - private readonly Func getter; - private readonly Action setter; + protected readonly Func getter; + protected readonly Action setter; - public VolumeItem(string name, Func getter, Action setter) + public SliderItem(string name, Func getter, Action setter) { nameKey = name; this.getter = getter; @@ -71,12 +71,29 @@ public override void Adjust(int delta) setter(newValue); } + public override void Toggle() + { + //Only makes sense for volume controls, so leave as no-op. + + } + + } + + private class VolumeItem: SliderItem + { + + public VolumeItem(string name, Func getter, Action setter) + : base(name, getter, setter) + { + } + public override void Toggle() { // Toggle between 0 and 50 for quick mute/unmute int current = getter(); setter(current == 0 ? 50 : 0); } + } private class EnumItem : MenuItem @@ -183,6 +200,9 @@ public static void Initialize() new ToggleItem("Audio Beacons", () => FFVI_ScreenReaderMod.AudioBeaconsEnabled, () => FFVI_ScreenReaderMod.Instance?.ToggleAudioBeacons()), + new SliderItem("Beacon delay", + () => PreferencesManager.BeaconDelay, + PreferencesManager.SetBeaconDelay), new VolumeItem("Beacon Volume", () => PreferencesManager.BeaconVolume, PreferencesManager.SetBeaconVolume), diff --git a/FFVI_Mod/Core/PreferencesManager.cs b/FFVI_Mod/Core/PreferencesManager.cs index 679a621..899ab6c 100644 --- a/FFVI_Mod/Core/PreferencesManager.cs +++ b/FFVI_Mod/Core/PreferencesManager.cs @@ -19,6 +19,7 @@ public static class PreferencesManager private static MelonPreferences_Entry prefWallBumps; private static MelonPreferences_Entry prefFootsteps; private static MelonPreferences_Entry prefAudioBeacons; + private static MelonPreferences_Entry prefBeaconDelay; private static MelonPreferences_Entry prefExpCounter; // Volume preferences (0-100, default 50) @@ -45,6 +46,7 @@ public static void Initialize() prefWallBumps = prefsCategory.CreateEntry("WallBumps", false, "Wall Bumps", "Play bump sound when walking into walls"); prefFootsteps = prefsCategory.CreateEntry("Footsteps", false, "Footsteps", "Play click sound on each tile movement"); prefAudioBeacons = prefsCategory.CreateEntry("AudioBeacons", false, "Audio Beacons", "Play periodic pings toward the selected entity"); + prefBeaconDelay = prefsCategory.CreateEntry("BeaconDelay", 50, "Beacon delay", "How long to wait between audio beacons (0-100, higher values mean greater delay between pings)"); prefExpCounter = prefsCategory.CreateEntry("ExpCounter", false, "EXP Counter Sound", "Play rapid beeping while EXP bar animates on battle results"); prefWallBumpVolume = prefsCategory.CreateEntry("WallBumpVolume", 50, "Wall Bump Volume", "Volume for wall bump sounds (0-100)"); @@ -65,6 +67,8 @@ public static void Initialize() public static bool WallBumpsDefault => prefWallBumps?.Value ?? false; public static bool FootstepsDefault => prefFootsteps?.Value ?? false; public static bool AudioBeaconsDefault => prefAudioBeacons?.Value ?? false; + public static int BeaconDelay => prefBeaconDelay?.Value ?? 50; + public static bool ExpCounterDefault => prefExpCounter?.Value ?? false; #endregion @@ -117,6 +121,14 @@ public static void SetBeaconVolume(int value) prefsCategory?.SaveToFile(false); } } + public static void SetBeaconDelay(int value) + { + if (prefBeaconDelay != null) + { + prefBeaconDelay.Value = Math.Clamp(value, 0, 100); + prefsCategory?.SaveToFile(false); + } + } public static void SetExpCounterVolume(int value) {