From e393cec738b2084a005419258702e10047721ded Mon Sep 17 00:00:00 2001
From: nutbuster <nutbuster@cock.li>
Date: Tue, 12 Oct 2021 07:12:09 +1100
Subject: [PATCH] Fix sounds & set defaults

Set persistent values to False if None
Play both On & Off Sound
onclick_audio, hardcode the audio and instead have a flag system for
just the transitions menu
---
 game/screens.rpy | 9 ++++++---
 game/script.rpy  | 5 +++++
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/game/screens.rpy b/game/screens.rpy
index 60737dd..d90498e 100644
--- a/game/screens.rpy
+++ b/game/screens.rpy
@@ -20,8 +20,11 @@ init python:
 #idk non-functional dummies for uisounds hackery
 #coming soon
 
-    def onclick_audio(flag, audio_filename=["audio/ui/uiOptionOff.wav", "audio/ui/uiOptionOff.wav", "audio/ui/uiOptionOff.wav"]):
-        renpy.play(audio_filename[int(flag)])
+    def onclick_audio(flag, _audioflag=False):
+        audio_filename=["audio/ui/uiOptionOn.wav", "audio/ui/uiOptionOff.wav"]
+        if _audioflag:
+            audio_filename=["audio/ui/uiOptionOff.wav", "audio/ui/uiOptionOn.wav"]
+        renpy.play(audio_filename[int(bool(flag))])
 
     def ToggleAutoUpdate():
         onclick_audio(persistent.autoup)
@@ -915,7 +918,7 @@ screen preferences():
                     label _("Skip")
                     textbutton _("Unseen Text") action [Function(onclick_audio, preferences.skip_unseen), ToggleVariable("preferences.skip_unseen", True, False)]
                     textbutton _("After Choices") action [Function(onclick_audio, preferences.skip_after_choices), ToggleVariable("preferences.skip_after_choices", True, False)]
-                    textbutton _("Transitions") action [Function(onclick_audio, preferences.transitions), ToggleVariable("preferences.transitions", 0, 2)]
+                    textbutton _("Transitions") action [Function(onclick_audio, preferences.transitions, True), ToggleVariable("preferences.transitions", 0, 2)]
 
                 ## Additional vboxes of type "radio_pref" or "check_pref" can be
                 ## added here, to add additional creator-defined preferences.
diff --git a/game/script.rpy b/game/script.rpy
index 8711704..c5c55c0 100644
--- a/game/script.rpy
+++ b/game/script.rpy
@@ -38,6 +38,11 @@ init python:
     renpy.music.register_channel("ambient2","sfx",True,tight=True)
     if persistent.scroll == True:
         config.keymap['dismiss'].append('mousedown_4')
+    elif persistent.scroll == None:
+        persistent.scroll = False
+
+    if persistent.lewd == None:
+        persistent.lewd = False
 
 transform randPosition:
   alpha 0.0