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 #character generation, appearance (GUICG12)
30 global PortraitsTable
, LastPortrait
32 PortraitName
= PortraitsTable
.GetRowName (LastPortrait
)+"L"
33 PortraitButton
.SetPicture (PortraitName
, "NOPORTLG")
37 global AppearanceWindow
, PortraitButton
, PortraitsTable
, LastPortrait
40 Gender
=GemRB
.GetVar ("Gender")
42 GemRB
.LoadWindowPack ("GUICG", 640, 480)
43 AppearanceWindow
= GemRB
.LoadWindow (11)
45 #Load the Portraits Table
46 PortraitsTable
= GemRB
.LoadTable ("PICTURES")
47 PortraitsStart
= PortraitsTable
.FindValue (0, 2)
48 FemaleCount
= PortraitsTable
.GetRowCount () - PortraitsStart
+ 1
50 LastPortrait
= GemRB
.Roll (1, FemaleCount
, PortraitsStart
-1)
52 LastPortrait
= GemRB
.Roll (1, PortraitsTable
.GetRowCount()-FemaleCount
, 0)
54 TextAreaControl
= AppearanceWindow
.GetControl (7)
55 TextAreaControl
.SetText ("") # why is this here?
57 PortraitButton
= AppearanceWindow
.GetControl (1)
58 PortraitButton
.SetFlags (IE_GUI_BUTTON_PICTURE|IE_GUI_BUTTON_NO_IMAGE
,OP_SET
)
59 PortraitButton
.SetState (IE_GUI_BUTTON_LOCKED
)
61 LeftButton
= AppearanceWindow
.GetControl (2)
62 RightButton
= AppearanceWindow
.GetControl (3)
64 BackButton
= AppearanceWindow
.GetControl (5)
65 BackButton
.SetText (15416)
66 BackButton
.SetFlags (IE_GUI_BUTTON_CANCEL
, OP_OR
)
68 CustomButton
= AppearanceWindow
.GetControl (6)
69 CustomButton
.SetText (17545)
71 DoneButton
= AppearanceWindow
.GetControl (0)
72 DoneButton
.SetText (11973)
73 DoneButton
.SetFlags (IE_GUI_BUTTON_DEFAULT
,OP_OR
)
75 RightButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, RightPress
)
76 LeftButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, LeftPress
)
77 BackButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, BackPress
)
78 CustomButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, CustomPress
)
79 DoneButton
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, NextPress
)
83 if PortraitsTable
.GetValue (LastPortrait
, 0) == Gender
:
86 LastPortrait
= LastPortrait
+ 1
87 if LastPortrait
>= PortraitsTable
.GetRowCount ():
94 AppearanceWindow
.SetVisible (WINDOW_VISIBLE
)
100 LastPortrait
= LastPortrait
+ 1
101 if LastPortrait
>= PortraitsTable
.GetRowCount ():
103 if PortraitsTable
.GetValue (LastPortrait
, 0) == Gender
:
110 LastPortrait
= LastPortrait
- 1
112 LastPortrait
= PortraitsTable
.GetRowCount ()-1
113 if PortraitsTable
.GetValue (LastPortrait
, 0) == Gender
:
119 AppearanceWindow
.Unload ()
120 GemRB
.SetNextScript ("GUICG1")
121 GemRB
.SetVar ("Gender",0) #scrapping the gender value
125 Window
= CustomWindow
127 Portrait
= PortraitList1
.QueryText ()
128 GemRB
.SetToken ("LargePortrait", Portrait
)
129 Portrait
= PortraitList2
.QueryText ()
130 GemRB
.SetToken ("SmallPortrait", Portrait
)
134 AppearanceWindow
.Unload ()
135 GemRB
.SetNextScript ("CharGen2")
140 CustomWindow
.Unload ()
143 def LargeCustomPortrait():
144 Window
= CustomWindow
146 Portrait
= PortraitList1
.QueryText ()
148 if GemRB
.GetVar ("Row1") == RowCount1
:
151 Label
= Window
.GetControl (0x10000007)
152 Label
.SetText (Portrait
)
154 Button
= Window
.GetControl (6)
156 Portrait
= "NOPORTMD"
157 Button
.SetState (IE_GUI_BUTTON_DISABLED
)
159 if PortraitList2
.QueryText ()!="":
160 Button
.SetState (IE_GUI_BUTTON_ENABLED
)
162 Button
= Window
.GetControl (0)
163 Button
.SetPicture (Portrait
, "NOPORTMD")
166 def SmallCustomPortrait():
167 Window
= CustomWindow
169 Portrait
= PortraitList2
.QueryText ()
171 if GemRB
.GetVar ("Row2") == RowCount2
:
174 Label
= Window
.GetControl (0x10000008)
175 Label
.SetText (Portrait
)
177 Button
= Window
.GetControl (6)
179 Portrait
= "NOPORTSM"
180 Button
.SetState (IE_GUI_BUTTON_DISABLED
)
182 if PortraitList1
.QueryText ()!="":
183 Button
.SetState (IE_GUI_BUTTON_ENABLED
)
185 Button
= Window
.GetControl (1)
186 Button
.SetPicture (Portrait
, "NOPORTSM")
190 global PortraitList1
, PortraitList2
191 global RowCount1
, RowCount2
194 CustomWindow
= Window
= GemRB
.LoadWindow (18)
195 PortraitList1
= Window
.GetControl (2)
196 RowCount1
= PortraitList1
.GetPortraits (0)
197 PortraitList1
.SetEvent (IE_GUI_TEXTAREA_ON_CHANGE
, LargeCustomPortrait
)
198 GemRB
.SetVar ("Row1", RowCount1
)
199 PortraitList1
.SetVarAssoc ("Row1",RowCount1
)
201 PortraitList2
= Window
.GetControl (4)
202 RowCount2
= PortraitList2
.GetPortraits (1)
203 PortraitList2
.SetEvent (IE_GUI_TEXTAREA_ON_CHANGE
, SmallCustomPortrait
)
204 GemRB
.SetVar ("Row2", RowCount2
)
205 PortraitList2
.SetVarAssoc ("Row2",RowCount2
)
207 Button
= Window
.GetControl (6)
208 Button
.SetText (11973)
209 Button
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, CustomDone
)
210 Button
.SetState (IE_GUI_BUTTON_DISABLED
)
212 Button
= Window
.GetControl (7)
213 Button
.SetText (15416)
214 Button
.SetEvent (IE_GUI_BUTTON_ON_PRESS
, CustomAbort
)
216 Button
= Window
.GetControl (0)
217 PortraitName
= PortraitsTable
.GetRowName (LastPortrait
)+"M"
218 Button
.SetPicture (PortraitName
, "NOPORTMD")
219 Button
.SetState (IE_GUI_BUTTON_LOCKED
)
221 Button
= Window
.GetControl (1)
222 PortraitName
= PortraitsTable
.GetRowName (LastPortrait
)+"S"
223 Button
.SetPicture (PortraitName
, "NOPORTSM")
224 Button
.SetState (IE_GUI_BUTTON_LOCKED
)
226 Window
.ShowModal (MODAL_SHADOW_NONE
)
231 AppearanceWindow
.Unload ()
232 PortraitTable
= GemRB
.LoadTable ("pictures")
233 PortraitName
= PortraitTable
.GetRowName (LastPortrait
)
234 GemRB
.SetToken ("SmallPortrait", PortraitName
+"S")
235 GemRB
.SetToken ("LargePortrait", PortraitName
+"M")
236 GemRB
.SetNextScript ("CharGen2") #Before race