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 #this is essentially Start.py from the SoA game, except for a very small change
27 SinglePlayerButton
= 0
34 global StartWindow
, TutorialWindow
, QuitWindow
35 global ExitButton
, OptionsButton
, MultiPlayerButton
, MoviesButton
, SinglePlayerButton
, BackButton
36 global SinglePlayerButton
38 skip_videos
= GemRB
.GetVar ("SkipIntroVideos")
40 GemRB
.LoadWindowPack("START", 640, 480)
42 TutorialWindow
= GemRB
.LoadWindow (5)
43 TextAreaControl
= TutorialWindow
.GetControl (1)
44 CancelButton
= TutorialWindow
.GetControl (11)
45 PlayButton
= TutorialWindow
.GetControl (10)
46 TextAreaControl
.SetText (44200)
47 CancelButton
.SetText (13727)
48 PlayButton
.SetText (33093)
49 PlayButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, PlayPress
)
50 CancelButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, CancelTut
)
51 PlayButton
.SetFlags (IE_GUI_BUTTON_DEFAULT
, OP_OR
)
52 CancelButton
.SetFlags (IE_GUI_BUTTON_CANCEL
, OP_OR
)
54 QuitWindow
= GemRB
.LoadWindow (3)
55 QuitTextArea
= QuitWindow
.GetControl (0)
56 CancelButton
= QuitWindow
.GetControl (2)
57 ConfirmButton
= QuitWindow
.GetControl (1)
58 QuitTextArea
.SetText (19532)
59 CancelButton
.SetText (13727)
60 ConfirmButton
.SetText (15417)
61 ConfirmButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, ExitConfirmed
)
62 CancelButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, ExitCancelled
)
63 ConfirmButton
.SetFlags (IE_GUI_BUTTON_DEFAULT
, OP_OR
)
64 CancelButton
.SetFlags (IE_GUI_BUTTON_CANCEL
, OP_OR
)
66 StartWindow
= GemRB
.LoadWindow (0)
67 StartWindow
.SetFrame ()
68 #this is the ToB specific part of Start.py
69 if GemRB
.GetVar("oldgame")==1:
70 if GUICommon
.HasTOB():
71 StartWindow
.SetPicture("STARTOLD")
73 GemRB
.PlayMovie ("INTRO15F", 1)
76 GemRB
.PlayMovie ("INTRO", 1)
78 #end ToB specific part
79 SinglePlayerButton
= StartWindow
.GetControl (0)
80 ExitButton
= StartWindow
.GetControl (3)
81 OptionsButton
= StartWindow
.GetControl (4)
82 MultiPlayerButton
= StartWindow
.GetControl (1)
83 MoviesButton
= StartWindow
.GetControl (2)
84 BackButton
= StartWindow
.GetControl (5)
85 StartWindow
.CreateLabel(0x0fff0000, 0,450,640,30, "REALMS", "", 1)
86 Label
=StartWindow
.GetControl (0x0fff0000)
87 Label
.SetText (GEMRB_VERSION
)
88 if not GUICommon
.HasTOB():
89 BackButton
.SetState (IE_GUI_BUTTON_DISABLED
)
90 BackButton
.SetText ("")
92 BackButton
.SetState (IE_GUI_BUTTON_ENABLED
)
93 BackButton
.SetText (15416)
94 SinglePlayerButton
.SetState (IE_GUI_BUTTON_ENABLED
)
95 ExitButton
.SetState (IE_GUI_BUTTON_ENABLED
)
96 OptionsButton
.SetState (IE_GUI_BUTTON_ENABLED
)
97 MultiPlayerButton
.SetState (IE_GUI_BUTTON_ENABLED
)
98 MoviesButton
.SetState (IE_GUI_BUTTON_ENABLED
)
99 SinglePlayerButton
.SetText (15413)
100 ExitButton
.SetText (15417)
101 OptionsButton
.SetText (13905)
102 MultiPlayerButton
.SetText (15414)
103 MoviesButton
.SetText (15415)
104 SinglePlayerButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, SinglePlayerPress
)
105 ExitButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, ExitPress
)
106 OptionsButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, OptionsPress
)
107 MultiPlayerButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, MultiPlayerPress
)
108 MoviesButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, MoviesPress
)
109 BackButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, Restart
)
110 ExitButton
.SetFlags (IE_GUI_BUTTON_CANCEL
, OP_OR
)
111 QuitWindow
.SetVisible (WINDOW_INVISIBLE
)
112 TutorialWindow
.SetVisible (WINDOW_INVISIBLE
)
113 StartWindow
.SetVisible (WINDOW_VISIBLE
)
114 MusicTable
= GemRB
.LoadTable ("songlist")
115 # the table has useless rownames, so we can't search for BG2Theme
116 theme
= MusicTable
.GetValue ("33", "RESOURCE")
117 GemRB
.LoadMusicPL (theme
, 1)
120 def SinglePlayerPress():
122 SinglePlayerButton
.SetText (13728)
123 SinglePlayerButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, NewSingle
)
125 MultiPlayerButton
.SetText (13729)
126 MultiPlayerButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, LoadSingle
)
128 if GemRB
.GetVar("oldgame")==1:
129 MoviesButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, Tutorial
)
130 MoviesButton
.SetText (33093)
132 MoviesButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, ImportGame
)
133 MoviesButton
.SetText (71175)
135 ExitButton
.SetText (15416)
136 ExitButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, BackToMain
)
138 OptionsButton
.SetText ("")
139 OptionsButton
.SetState (IE_GUI_BUTTON_DISABLED
)
141 BackButton
.SetText ("")
142 BackButton
.SetState (IE_GUI_BUTTON_DISABLED
)
145 def MultiPlayerPress():
147 OptionsButton
.SetText ("")
148 SinglePlayerButton
.SetText (20642)
149 ExitButton
.SetText (15416)
150 MultiPlayerButton
.SetText ("")
151 MoviesButton
.SetText (11825)
152 MultiPlayerButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, None)
153 SinglePlayerButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, ConnectPress
)
154 MoviesButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, PregenPress
)
155 ExitButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, BackToMain
)
156 MultiPlayerButton
.SetState (IE_GUI_BUTTON_DISABLED
)
157 OptionsButton
.SetState (IE_GUI_BUTTON_DISABLED
)
162 #GemRB.SetVar("PlayMode",2)
171 TutorialWindow
.Unload()
172 #do not start game after chargen
173 GemRB
.SetVar("PlayMode",-1) #will allow export
174 GemRB
.SetVar("Slot",0)
176 GemRB
.SetNextScript ("CharGen")
185 TutorialWindow
.Unload()
186 if GemRB
.GetVar ("oldgame") == 0:
187 GemRB
.SetVar ("PlayMode", 2)
188 GemRB
.SetVar ("SaveDir", 1)
190 GemRB
.SetVar ("PlayMode", 0)
191 GemRB
.SetVar ("SaveDir", 0)
193 GemRB
.SetNextScript ("GUILOAD")
202 TutorialWindow
.Unload()
203 if GemRB
.GetVar ("oldgame") == 0:
204 GemRB
.SetVar ("PlayMode", 2)
205 GemRB
.SetVar ("SaveDir", 1)
207 GemRB
.SetVar ("PlayMode", 0)
208 GemRB
.SetVar ("SaveDir", 0)
209 GemRB
.SetVar("Slot",1)
211 GemRB
.SetNextScript ("CharGen")
220 TutorialWindow
.Unload()
221 #now this is tricky, we need to load old games, but set up the expansion
222 GemRB
.SetVar ("PlayMode", 0)
223 GemRB
.SetVar ("SaveDir", 0)
224 GemRB
.SetNextScript ("GUILOAD")
228 StartWindow
.SetVisible (WINDOW_INVISIBLE
)
229 TutorialWindow
.SetVisible (WINDOW_VISIBLE
)
238 TutorialWindow
.Unload()
239 GemRB
.SetVar("PlayMode",1) #tutorial
240 GemRB
.SetVar("SaveDir",0)
241 GemRB
.SetVar("Slot",1)
243 GemRB
.SetNextScript ("CharGen")
247 TutorialWindow
.SetVisible (WINDOW_INVISIBLE
)
248 StartWindow
.SetVisible (WINDOW_VISIBLE
)
252 StartWindow
.SetVisible (WINDOW_INVISIBLE
)
253 QuitWindow
.SetVisible (WINDOW_VISIBLE
)
261 #apparently the order is important
267 TutorialWindow
.Unload()
268 GemRB
.SetNextScript ("StartOpt")
272 #apparently the order is important
278 TutorialWindow
.Unload()
279 GemRB
.SetNextScript ("GUIMOVIE")
283 QuitWindow
.SetVisible (WINDOW_INVISIBLE
)
284 StartWindow
.SetVisible (WINDOW_VISIBLE
)
288 SinglePlayerButton
.SetState (IE_GUI_BUTTON_ENABLED
)
289 OptionsButton
.SetState (IE_GUI_BUTTON_ENABLED
)
290 MultiPlayerButton
.SetState (IE_GUI_BUTTON_ENABLED
)
291 BackButton
.SetState (IE_GUI_BUTTON_ENABLED
)
292 SinglePlayerButton
.SetText (15413)
293 ExitButton
.SetText (15417)
294 OptionsButton
.SetText (13905)
295 MultiPlayerButton
.SetText (15414)
296 MoviesButton
.SetText (15415)
297 BackButton
.SetText (15416)
298 SinglePlayerButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, SinglePlayerPress
)
299 ExitButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, ExitPress
)
300 OptionsButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, OptionsPress
)
301 MultiPlayerButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, MultiPlayerPress
)
302 MoviesButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, MoviesPress
)
303 QuitWindow
.SetVisible (WINDOW_INVISIBLE
)
304 StartWindow
.SetVisible (WINDOW_VISIBLE
)
310 GemRB
.SetNextScript ("Start")