Scriptname SoSDungeonsConfigScript extends Quest conditional
{Launches the SoS-Dungeons in-game configuration menu that allows the player to choose personal settings on the new sound effects.}

Quest Property DungeonConfigQuest  Auto  

Message Property MainMenu auto

Message Property EnableDisableWeather auto
Message Property EnableDisableCaveSounds auto
Message Property EnableDisableDwemerSounds auto
Message Property EnableDisableFortsSounds auto
Message Property EnableDisableMinesSounds auto
Message Property EnableDisableSewersSounds auto
Message Property EnableDisableFalmerSounds auto
Message Property EnableDisableUndeadSounds auto
Message Property EnableDisableEndMessage  Auto  

Int ChosenOption = 0
Int EnableDisablePage

Int DwemerSoundsDisabled conditional
Int WeatherDisabled conditional
Int CaveSoundsDisabled conditional
Int FortsSoundsDisabled conditional
Int MinesSoundsDisabled conditional
Int SewersSoundsDisabled conditional
Int FalmerSoundsDisabled conditional
Int UndeadSoundsDisabled conditional

Event OnInit() ; This event will run once, when the script is initialized
	RegisterForSingleUpdate(1)
EndEvent

Event OnUpdate()

	ChosenOption = MainMenu.Show()

		If (ChosenOption == 0)
			EnableDisablePage = 1
			If (EnableDisablePage == 1)
				EnableDisablePage = 0
					ChosenOption = EnableDisableDwemerSounds.Show()
						If (ChosenOption == 0)
							DwemerSoundsDisabled = 0
							EnableDisablePage = 2
						ElseIf (ChosenOption == 1)
							DwemerSoundsDisabled = 1
							EnableDisablePage = 2
						Endif
			Endif
		ElseIf (chosenOption == 1)
			EnableDisableEndMessage.Show()
			Stop()
		Endif
		
		If (EnableDisablePage == 2)
				EnableDisablePage = 0
					ChosenOption = EnableDisableCaveSounds.Show()
						If (ChosenOption == 0)
							CaveSoundsDisabled = 0
							EnableDisablePage = 3
						ElseIf (ChosenOption == 1)
							CaveSoundsDisabled = 1
							EnableDisablePage = 3
						Endif	
		Endif	

		If (EnableDisablePage == 3)
				EnableDisablePage = 0
					ChosenOption = EnableDisableFortsSounds.Show()
						If (ChosenOption == 0)
							FortsSoundsDisabled = 0
							EnableDisablePage = 4
						ElseIf (ChosenOption == 1)
							FortsSoundsDisabled = 1
							EnableDisablePage = 4
						Endif	
		Endif

		If (EnableDisablePage == 4)
				EnableDisablePage = 0
					ChosenOption = EnableDisableMinesSounds.Show()
						If (ChosenOption == 0)
							MinesSoundsDisabled = 0
							EnableDisablePage = 5
						ElseIf (ChosenOption == 1)
							MinesSoundsDisabled = 1
							EnableDisablePage = 5
						Endif	
		Endif

		If (EnableDisablePage == 5)
				EnableDisablePage = 0
					ChosenOption = EnableDisableSewersSounds.Show()
						If (ChosenOption == 0)
							SewersSoundsDisabled = 0
							EnableDisablePage = 6
						ElseIf (ChosenOption == 1)
							SewersSoundsDisabled = 1
							EnableDisablePage = 6
						Endif	
		Endif	

		If (EnableDisablePage == 6)
				EnableDisablePage = 0
					ChosenOption = EnableDisableFalmerSounds.Show()
						If (ChosenOption == 0)
							FalmerSoundsDisabled = 0
							EnableDisablePage = 7
						ElseIf (ChosenOption == 1)
							FalmerSoundsDisabled = 1
							EnableDisablePage = 7
						Endif	
		Endif	

		If (EnableDisablePage == 7)
				EnableDisablePage = 0
					ChosenOption = EnableDisableUndeadSounds.Show()
						If (ChosenOption == 0)
							UndeadSoundsDisabled = 0
							EnableDisablePage = 8
						ElseIf (ChosenOption == 1)
							UndeadSoundsDisabled = 1
							EnableDisablePage = 8
						Endif	
		Endif

		If (EnableDisablePage == 8)
				EnableDisablePage = 0
					ChosenOption = EnableDisableWeather.Show()
						If (ChosenOption == 0)
							WeatherDisabled = 0
							EnableDisablePage = 9
						ElseIf (ChosenOption == 1)
							WeatherDisabled = 1
							EnableDisablePage = 9
						Endif	
		Endif

		If (EnableDisablePage == 9)
			EnableDisablePage = 0
			EnableDisableEndMessage.Show()
			DungeonConfigQuest.Stop()
		Endif			

EndEvent
