2 # GemRB - Infinity Engine Emulator
3 # Copyright (C) 2003 The GemRB Project
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 from GUIDefines
import *
31 global StartWindow
, QuickLoadSlot
33 screen_width
= GemRB
.GetSystemVariable (SV_WIDTH
)
34 screen_height
= GemRB
.GetSystemVariable (SV_HEIGHT
)
35 if screen_width
== 1024:
36 GemRB
.LoadWindowFrame("STON10L", "STON10R", "STON10T", "STON10B")
37 GemRB
.LoadWindowPack("GUICONN", 800, 600)
39 StartWindow
= GemRB
.LoadWindow(0)
40 StartWindow
.SetFrame ()
41 ProtocolButton
= StartWindow
.GetControl(0x00)
42 NewGameButton
= StartWindow
.GetControl(0x02)
43 LoadGameButton
= StartWindow
.GetControl(0x07)
44 QuickLoadButton
= StartWindow
.GetControl(0x03)
45 JoinGameButton
= StartWindow
.GetControl(0x0B)
46 OptionsButton
= StartWindow
.GetControl(0x08)
47 QuitGameButton
= StartWindow
.GetControl(0x01)
48 StartWindow
.CreateLabel(0x0fff0000, 0,0,800,30, "REALMS2", "", 1)
49 VersionLabel
= StartWindow
.GetControl(0x0fff0000)
50 VersionLabel
.SetText(GEMRB_VERSION
)
51 ProtocolButton
.SetStatus(IE_GUI_BUTTON_ENABLED
)
52 NewGameButton
.SetStatus(IE_GUI_BUTTON_ENABLED
)
53 LoadGameButton
.SetStatus(IE_GUI_BUTTON_ENABLED
)
55 GemRB
.SetVar("SaveDir",1)
56 Games
=GemRB
.GetSaveGames()
58 #looking for the quicksave
59 EnableQuickLoad
= IE_GUI_BUTTON_DISABLED
61 Slotname
= Game
.GetSaveID()
64 EnableQuickLoad
= IE_GUI_BUTTON_ENABLED
68 QuickLoadButton
.SetStatus(EnableQuickLoad
)
69 JoinGameButton
.SetStatus(IE_GUI_BUTTON_DISABLED
)
70 OptionsButton
.SetStatus(IE_GUI_BUTTON_ENABLED
)
71 QuitGameButton
.SetStatus(IE_GUI_BUTTON_ENABLED
)
72 LastProtocol
= GemRB
.GetVar("Last Protocol Used")
74 ProtocolButton
.SetText(15413)
75 elif LastProtocol
== 1:
76 ProtocolButton
.SetText(13967)
77 elif LastProtocol
== 2:
78 ProtocolButton
.SetText(13968)
79 NewGameButton
.SetText(13963)
80 LoadGameButton
.SetText(13729)
81 QuickLoadButton
.SetText(33508)
82 JoinGameButton
.SetText(13964)
83 OptionsButton
.SetText(13905)
84 QuitGameButton
.SetText(13731)
85 QuitGameButton
.SetFlags(IE_GUI_BUTTON_CANCEL
, OP_OR
)
86 NewGameButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, NewGamePress
)
87 QuitGameButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, QuitPress
)
88 ProtocolButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, ProtocolPress
)
89 OptionsButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, OptionsPress
)
90 LoadGameButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, LoadPress
)
91 QuickLoadButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, QuickLoadPress
)
92 StartWindow
.SetVisible(WINDOW_VISIBLE
)
93 GemRB
.LoadMusicPL("Theme.mus")
98 global StartWindow
, ProtocolWindow
100 StartWindow
.SetVisible(WINDOW_INVISIBLE
)
101 ProtocolWindow
= GemRB
.LoadWindow(1)
103 #Disabling Unused Buttons in this Window
104 Button
= ProtocolWindow
.GetControl(2)
105 Button
.SetState(IE_GUI_BUTTON_DISABLED
)
106 Button
.SetFlags(IE_GUI_BUTTON_NO_IMAGE
, OP_OR
)
107 Button
= ProtocolWindow
.GetControl(3)
108 Button
.SetState(IE_GUI_BUTTON_DISABLED
)
109 Button
.SetFlags(IE_GUI_BUTTON_NO_IMAGE
, OP_OR
)
110 Button
= ProtocolWindow
.GetControl(9)
111 Button
.SetState(IE_GUI_BUTTON_DISABLED
)
112 Button
.SetFlags(IE_GUI_BUTTON_NO_IMAGE
, OP_OR
)
114 SinglePlayerButton
= ProtocolWindow
.GetControl(10)
115 SinglePlayerButton
.SetFlags(IE_GUI_BUTTON_RADIOBUTTON
,OP_OR
)
116 SinglePlayerButton
.SetText(15413)
118 IPXButton
= ProtocolWindow
.GetControl(0)
119 IPXButton
.SetFlags(IE_GUI_BUTTON_RADIOBUTTON
,OP_OR
)
120 IPXButton
.SetText(13967)
122 TCPIPButton
= ProtocolWindow
.GetControl(1)
123 TCPIPButton
.SetFlags(IE_GUI_BUTTON_RADIOBUTTON
,OP_OR
)
124 TCPIPButton
.SetText(13968)
126 SinglePlayerButton
.SetVarAssoc("Last Protocol Used", 0)
127 IPXButton
.SetVarAssoc("Last Protocol Used", 1)
128 TCPIPButton
.SetVarAssoc("Last Protocol Used", 2)
130 TextArea
= ProtocolWindow
.GetControl(7)
131 TextArea
.SetText(11316)
133 DoneButton
= ProtocolWindow
.GetControl(6)
134 DoneButton
.SetText(11973)
135 DoneButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, ProtocolDonePress
)
136 DoneButton
.SetFlags (IE_GUI_BUTTON_CANCEL
, OP_OR
)
138 ProtocolWindow
.SetVisible(WINDOW_VISIBLE
)
141 def ProtocolDonePress():
142 global StartWindow
, ProtocolWindow
144 ProtocolWindow
.Unload()
146 ProtocolButton
= StartWindow
.GetControl(0x00)
148 LastProtocol
= GemRB
.GetVar("Last Protocol Used")
149 if LastProtocol
== 0:
150 ProtocolButton
.SetText(15413)
151 elif LastProtocol
== 1:
152 ProtocolButton
.SetText(13967)
153 elif LastProtocol
== 2:
154 ProtocolButton
.SetText(13968)
156 StartWindow
.SetVisible(WINDOW_VISIBLE
)
164 GemRB
.SetNextScript("GUILOAD")
167 def QuickLoadPress():
168 global StartWindow
, QuickLoadSlot
170 LoadScreen
.StartLoadScreen()
171 GemRB
.LoadGame(QuickLoadSlot
) # load & start game
179 GemRB
.SetNextScript("Options")
183 global StartWindow
, QuitWindow
184 StartWindow
.SetVisible(WINDOW_INVISIBLE
)
185 QuitWindow
= GemRB
.LoadWindow(22)
186 CancelButton
= QuitWindow
.GetControl(2)
187 CancelButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, QuitCancelPress
)
188 CancelButton
.SetFlags(IE_GUI_BUTTON_CANCEL
, OP_OR
)
190 QuitButton
= QuitWindow
.GetControl(1)
191 QuitButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, QuitQuitPress
)
192 QuitButton
.SetFlags(IE_GUI_BUTTON_DEFAULT
, OP_OR
)
194 TextArea
= QuitWindow
.GetControl(0)
195 CancelButton
.SetText(13727)
196 QuitButton
.SetText(15417)
197 TextArea
.SetText(19532)
198 QuitWindow
.SetVisible(WINDOW_VISIBLE
)
205 GemRB
.SetNextScript("SPParty")
208 def QuitCancelPress():
209 global StartWindow
, QuitWindow
212 StartWindow
.SetVisible(WINDOW_VISIBLE
)