TickHook: Fix crash when TickHook isn't set.
[gemrb.git] / gemrb / GUIScripts / bg2 / GUIOPT8.py
blob106fc5386797cbcb06e028696bca1e2e781a4c13
1 # GemRB - Infinity Engine Emulator
2 # Copyright (C) 2003 The GemRB Project
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #gameplay
20 import GemRB
22 GamePlayWindow = 0
23 TextAreaControl = 0
25 def OnLoad():
26 global GamePlayWindow, TextAreaControl
27 GemRB.LoadWindowPack("GUIOPT", 640, 480)
28 GamePlayWindow = GemRB.LoadWindow(8)
29 TextAreaControl = GamePlayWindow.GetControl(40)
30 DelayButton = GamePlayWindow.GetControl(21)
31 DelaySlider = GamePlayWindow.GetControl(1)
32 MouseSpdButton = GamePlayWindow.GetControl(22)
33 MouseSpdSlider = GamePlayWindow.GetControl(2)
34 KeySpdButton = GamePlayWindow.GetControl(23)
35 KeySpdSlider = GamePlayWindow.GetControl(3)
36 DifficultyButton = GamePlayWindow.GetControl(24)
37 DifficultySlider = GamePlayWindow.GetControl(12)
38 BloodButton = GamePlayWindow.GetControl(27)
39 BloodButtonB = GamePlayWindow.GetControl(19)
40 DitherButton = GamePlayWindow.GetControl(25)
41 DitherButtonB = GamePlayWindow.GetControl(14)
42 InfravisionButton = GamePlayWindow.GetControl(44)
43 InfravisionButtonB = GamePlayWindow.GetControl(42)
44 WeatherButton = GamePlayWindow.GetControl(46)
45 WeatherButtonB = GamePlayWindow.GetControl(47)
46 HealButton = GamePlayWindow.GetControl(48)
47 HealButtonB = GamePlayWindow.GetControl(50)
48 HotKeyButton = GamePlayWindow.GetControl(51)
49 FeedbackButton = GamePlayWindow.GetControl(5)
50 AutoPauseButton = GamePlayWindow.GetControl(6)
51 OkButton = GamePlayWindow.GetControl(7)
52 CancelButton = GamePlayWindow.GetControl(20)
53 TextAreaControl.SetText(18042)
54 OkButton.SetText(11973)
55 CancelButton.SetText(13727)
56 HotKeyButton.SetText(816)
57 FeedbackButton.SetText(17163)
58 AutoPauseButton.SetText(17166)
59 DelayButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, DelayPress)
60 DelaySlider.SetEvent(IE_GUI_SLIDER_ON_CHANGE, DelayPress)
61 DelaySlider.SetVarAssoc("Tooltips",0)
63 KeySpdButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, KeySpdPress)
64 KeySpdSlider.SetEvent(IE_GUI_SLIDER_ON_CHANGE, KeySpdPress)
65 KeySpdSlider.SetVarAssoc("Keyboard Scroll Speed",0)
67 MouseSpdButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, MouseSpdPress)
68 MouseSpdSlider.SetEvent(IE_GUI_SLIDER_ON_CHANGE, MouseSpdPress)
69 MouseSpdSlider.SetVarAssoc("Mouse Scroll Speed",0)
71 DifficultyButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, DifficultyPress)
72 DifficultySlider.SetEvent(IE_GUI_SLIDER_ON_CHANGE, DifficultyPress)
73 DifficultySlider.SetVarAssoc("Difficulty Level",0)
75 BloodButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, BloodPress)
76 BloodButtonB.SetEvent(IE_GUI_BUTTON_ON_PRESS, BloodPress)
77 BloodButtonB.SetFlags(IE_GUI_BUTTON_CHECKBOX,OP_OR)
78 BloodButtonB.SetVarAssoc("Gore",1)
80 DitherButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, DitherPress)
81 DitherButtonB.SetEvent(IE_GUI_BUTTON_ON_PRESS, DitherPress)
82 DitherButtonB.SetFlags(IE_GUI_BUTTON_CHECKBOX,OP_OR)
83 DitherButtonB.SetVarAssoc("Always Dither",1)
85 InfravisionButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, InfravisionPress)
86 InfravisionButtonB.SetEvent(IE_GUI_BUTTON_ON_PRESS, InfravisionPress)
87 InfravisionButtonB.SetFlags(IE_GUI_BUTTON_CHECKBOX,OP_OR)
88 InfravisionButtonB.SetVarAssoc("Infravision",1)
90 WeatherButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, WeatherPress)
91 WeatherButtonB.SetEvent(IE_GUI_BUTTON_ON_PRESS, WeatherPress)
92 WeatherButtonB.SetFlags(IE_GUI_BUTTON_CHECKBOX,OP_OR)
93 WeatherButtonB.SetVarAssoc("Weather",1)
95 HealButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, HealPress)
96 HealButtonB.SetEvent(IE_GUI_BUTTON_ON_PRESS, HealPress)
97 HealButtonB.SetFlags(IE_GUI_BUTTON_CHECKBOX,OP_OR)
98 HealButtonB.SetVarAssoc("Heal Party on Rest",1)
100 HotKeyButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, HotKeyPress)
101 FeedbackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, FeedbackPress)
102 AutoPauseButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, AutoPausePress)
103 OkButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, OkPress)
104 OkButton.SetFlags (IE_GUI_BUTTON_DEFAULT, OP_OR)
105 CancelButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, CancelPress)
106 CancelButton.SetFlags (IE_GUI_BUTTON_CANCEL, OP_OR)
107 GamePlayWindow.SetVisible(WINDOW_VISIBLE)
108 return
110 def DelayPress():
111 TextAreaControl.SetText(18017)
112 return
114 def KeySpdPress():
115 TextAreaControl.SetText(18019)
116 return
118 def MouseSpdPress():
119 TextAreaControl.SetText(18018)
120 return
122 def DifficultyPress():
123 TextAreaControl.SetText(18020)
124 return
126 def BloodPress():
127 TextAreaControl.SetText(18023)
128 return
130 def DitherPress():
131 TextAreaControl.SetText(18021)
132 return
134 def InfravisionPress():
135 TextAreaControl.SetText(11797)
136 return
138 def WeatherPress():
139 TextAreaControl.SetText(20619)
140 return
142 def HealPress():
143 TextAreaControl.SetText(2242)
144 return
146 def HotKeyPress():
147 #TextAreaControl.SetText(18016)
148 return
150 def FeedbackPress():
151 GamePlayWindow.SetVisible(WINDOW_INVISIBLE)
152 if GamePlayWindow:
153 GamePlayWindow.Unload()
154 GemRB.SetNextScript("GUIOPT9")
155 return
157 def AutoPausePress():
158 GamePlayWindow.SetVisible(WINDOW_INVISIBLE)
159 if GamePlayWindow:
160 GamePlayWindow.Unload()
161 GemRB.SetNextScript("GUIOPT10")
162 return
164 def OkPress():
165 GamePlayWindow.SetVisible(WINDOW_INVISIBLE)
166 if GamePlayWindow:
167 GamePlayWindow.Unload()
168 GemRB.SetNextScript("StartOpt")
169 return
171 def CancelPress():
172 GamePlayWindow.SetVisible(WINDOW_INVISIBLE)
173 if GamePlayWindow:
174 GamePlayWindow.Unload()
175 GemRB.SetNextScript("StartOpt")
176 return