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 #Single Player Party Formation
21 from GUIDefines
import *
23 PartyFormationWindow
= 0
27 global PartyFormationWindow
28 GemRB
.LoadWindowPack("GUIMP")
30 PartyFormationWindow
= GemRB
.LoadWindow(0)
32 ExitButton
= PartyFormationWindow
.GetControl(30)
33 ExitButton
.SetText(13906)
34 ExitButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, ExitPress
)
35 ExitButton
.SetFlags(IE_GUI_BUTTON_CANCEL
, OP_OR
)
37 ModifyCharactersButton
= PartyFormationWindow
.GetControl(43)
38 ModifyCharactersButton
.SetText(18816)
39 ModifyCharactersButton
.SetState(IE_GUI_BUTTON_DISABLED
)
40 #TODO: implement ModifyCharacters
41 #ModifyCharactersButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, ModifyCharactersPress)
43 DoneButton
= PartyFormationWindow
.GetControl(28)
44 DoneButton
.SetText(11973)
47 for i
in range(18,24):
48 Label
= PartyFormationWindow
.GetControl(0x10000012+i
)
49 #removing this label, it just disturbs us
51 Button
= PartyFormationWindow
.GetControl(i
-12)
52 ResRef
= GemRB
.GetPlayerPortrait(i
-17, 1)
54 Button
.SetFlags(IE_GUI_BUTTON_NORMAL
,OP_SET
)
56 Button
.SetPicture(ResRef
)
57 Button
.SetFlags(IE_GUI_BUTTON_PICTURE
, OP_OR
)
58 Portraits
= Portraits
+1
60 Button
.SetVarAssoc("Slot",i
-17)
61 Button
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, GeneratePress
)
63 Button
= PartyFormationWindow
.GetControl(i
)
64 Button
.SetVarAssoc("Slot",i
-17)
68 Button
.SetText(GemRB
.GetPlayerName(i
-17,0) )
70 Button
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, GeneratePress
)
73 DoneButton
.SetState(IE_GUI_BUTTON_DISABLED
)
75 DoneButton
.SetState(IE_GUI_BUTTON_ENABLED
)
76 DoneButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, EnterGamePress
)
78 PartyFormationWindow
.SetVisible(WINDOW_VISIBLE
)
82 global PartyFormationWindow
, ExitWindow
83 PartyFormationWindow
.SetVisible(WINDOW_INVISIBLE
)
84 ExitWindow
= GemRB
.LoadWindow(7)
86 TextArea
= ExitWindow
.GetControl(0)
87 TextArea
.SetText(11329)
89 CancelButton
= ExitWindow
.GetControl(2)
90 CancelButton
.SetText(13727)
91 CancelButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, ExitCancelPress
)
92 CancelButton
.SetFlags(IE_GUI_BUTTON_CANCEL
, OP_OR
)
94 DoneButton
= ExitWindow
.GetControl(1)
95 DoneButton
.SetText(11973)
96 DoneButton
.SetEvent(IE_GUI_BUTTON_ON_PRESS
, ExitDonePress
)
97 DoneButton
.SetFlags(IE_GUI_BUTTON_DEFAULT
, OP_OR
)
99 ExitWindow
.SetVisible(WINDOW_VISIBLE
)
103 global PartyFormationWindow
, ExitWindow
106 if PartyFormationWindow
:
107 PartyFormationWindow
.Unload()
108 GemRB
.SetNextScript("Start")
111 def ExitCancelPress():
112 global PartyFormationWindow
, ExitWindow
115 PartyFormationWindow
.SetVisible(WINDOW_VISIBLE
)
119 global PartyFormationWindow
120 slot
= GemRB
.GetVar("Slot")
121 ResRef
= GemRB
.GetPlayerPortrait(slot
, 0)
123 print "Already existing slot, we should drop it"
124 if PartyFormationWindow
:
125 PartyFormationWindow
.Unload()
126 GemRB
.SetNextScript("CharGen")
129 def EnterGamePress():