Lines 5-10
Link Here
|
5 |
|
5 |
|
6 |
SaveWindow = 0 |
6 |
SaveWindow = 0 |
7 |
ConfirmWindow = 0 |
7 |
ConfirmWindow = 0 |
|
|
8 |
NameField = 0 |
9 |
SaveButton = 0 |
8 |
TextAreaControl = 0 |
10 |
TextAreaControl = 0 |
9 |
GameCount = 0 |
11 |
GameCount = 0 |
10 |
ScrollBar = 0 |
12 |
ScrollBar = 0 |
Lines 19-59
Link Here
|
19 |
GemRB.HideGUI () |
21 |
GemRB.HideGUI () |
20 |
GemRB.SetVisible (0,0) |
22 |
GemRB.SetVisible (0,0) |
21 |
|
23 |
|
22 |
GemRB.LoadWindowPack("GUISAVE", 640, 480) |
24 |
GemRB.LoadWindowPack ("GUISAVE", 640, 480) |
23 |
Window = SaveWindow = GemRB.LoadWindow (0) |
25 |
Window = SaveWindow = GemRB.LoadWindow (0) |
24 |
GemRB.SetWindowFrame (Window) |
26 |
GemRB.SetWindowFrame (Window) |
25 |
CancelButton=GemRB.GetControl (Window,34) |
27 |
CancelButton=GemRB.GetControl (Window,34) |
26 |
GemRB.SetText(Window, CancelButton, 13727) |
28 |
GemRB.SetText (Window, CancelButton, 13727) |
27 |
GemRB.SetEvent (Window,CancelButton,IE_GUI_BUTTON_ON_PRESS, "OpenSaveWindow") |
29 |
GemRB.SetEvent (Window,CancelButton,IE_GUI_BUTTON_ON_PRESS, "OpenSaveWindow") |
28 |
GemRB.SetVar("LoadIdx",0) |
30 |
GemRB.SetVar ("LoadIdx",0) |
29 |
|
31 |
|
30 |
for i in range(4): |
32 |
for i in range(4): |
31 |
Button = GemRB.GetControl (Window,26+i) |
33 |
Button = GemRB.GetControl (Window,26+i) |
32 |
GemRB.SetText(Window, Button, 15588) |
34 |
GemRB.SetText (Window, Button, 15588) |
33 |
GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "SavePress") |
35 |
GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "SavePress") |
34 |
GemRB.SetButtonState(Window, Button, IE_GUI_BUTTON_DISABLED) |
36 |
GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_DISABLED) |
35 |
GemRB.SetVarAssoc(Window, Button, "LoadIdx",i) |
37 |
GemRB.SetVarAssoc (Window, Button, "LoadIdx",i) |
36 |
|
38 |
|
37 |
Button = GemRB.GetControl (Window, 30+i) |
39 |
Button = GemRB.GetControl (Window, 30+i) |
38 |
GemRB.SetText(Window, Button, 13957) |
40 |
GemRB.SetText (Window, Button, 13957) |
39 |
GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "DeleteGamePress") |
41 |
GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "DeleteGamePress") |
40 |
GemRB.SetButtonState(Window, Button, IE_GUI_BUTTON_DISABLED) |
42 |
GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_DISABLED) |
41 |
GemRB.SetVarAssoc(Window, Button, "LoadIdx",i) |
43 |
GemRB.SetVarAssoc (Window, Button, "LoadIdx",i) |
42 |
|
44 |
|
43 |
#area previews |
45 |
#area previews |
44 |
Button = GemRB.GetControl (Window, 1+i) |
46 |
Button = GemRB.GetControl (Window, 1+i) |
45 |
GemRB.SetButtonState(Window, Button, IE_GUI_BUTTON_LOCKED) |
47 |
GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) |
46 |
GemRB.SetButtonFlags(Window, Button, IE_GUI_BUTTON_NO_IMAGE|IE_GUI_BUTTON_PICTURE,OP_SET) |
48 |
GemRB.SetButtonFlags(Window, Button, IE_GUI_BUTTON_NO_IMAGE|IE_GUI_BUTTON_PICTURE,OP_SET) |
47 |
|
49 |
|
48 |
#PC portraits |
50 |
#PC portraits |
49 |
for j in range(PARTY_SIZE): |
51 |
for j in range(PARTY_SIZE): |
50 |
Button = GemRB.GetControl (Window,40+i*PARTY_SIZE+j) |
52 |
Button = GemRB.GetControl (Window,40+i*PARTY_SIZE+j) |
51 |
GemRB.SetButtonState(Window, Button, IE_GUI_BUTTON_LOCKED) |
53 |
GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) |
52 |
GemRB.SetButtonFlags(Window, Button, IE_GUI_BUTTON_NO_IMAGE|IE_GUI_BUTTON_PICTURE,OP_SET) |
54 |
GemRB.SetButtonFlags(Window, Button, IE_GUI_BUTTON_NO_IMAGE|IE_GUI_BUTTON_PICTURE,OP_SET) |
53 |
|
55 |
|
54 |
ScrollBar=GemRB.GetControl (Window, 25) |
56 |
ScrollBar=GemRB.GetControl (Window, 25) |
55 |
GemRB.SetEvent (Window, ScrollBar, IE_GUI_SCROLLBAR_ON_CHANGE, "ScrollBarPress") |
57 |
GemRB.SetEvent (Window, ScrollBar, IE_GUI_SCROLLBAR_ON_CHANGE, "ScrollBarPress") |
56 |
GameCount=GemRB.GetSaveGameCount()+1 #one more for the 'new game' |
58 |
GameCount=GemRB.GetSaveGameCount ()+1 #one more for the 'new game' |
57 |
if GameCount>4: |
59 |
if GameCount>4: |
58 |
TopIndex = GameCount-4 |
60 |
TopIndex = GameCount-4 |
59 |
else: |
61 |
else: |
Lines 68-101
Link Here
|
68 |
Window = SaveWindow |
70 |
Window = SaveWindow |
69 |
|
71 |
|
70 |
#draw load game portraits |
72 |
#draw load game portraits |
71 |
Pos = GemRB.GetVar("TopIndex") |
73 |
Pos = GemRB.GetVar ("TopIndex") |
72 |
for i in range(4): |
74 |
for i in range(4): |
73 |
ActPos = Pos + i |
75 |
ActPos = Pos + i |
74 |
|
76 |
|
75 |
Button1 = GemRB.GetControl (Window,26+i) |
77 |
Button1 = GemRB.GetControl (Window,26+i) |
76 |
Button2 = GemRB.GetControl (Window, 30+i) |
78 |
Button2 = GemRB.GetControl (Window, 30+i) |
77 |
if ActPos<GameCount: |
79 |
if ActPos<GameCount: |
78 |
GemRB.SetButtonState(Window, Button1, IE_GUI_BUTTON_ENABLED) |
80 |
GemRB.SetButtonState (Window, Button1, IE_GUI_BUTTON_ENABLED) |
79 |
GemRB.SetButtonState(Window, Button2, IE_GUI_BUTTON_ENABLED) |
81 |
GemRB.SetButtonState (Window, Button2, IE_GUI_BUTTON_ENABLED) |
80 |
else: |
82 |
else: |
81 |
GemRB.SetButtonState(Window, Button1, IE_GUI_BUTTON_DISABLED) |
83 |
GemRB.SetButtonState (Window, Button1, IE_GUI_BUTTON_DISABLED) |
82 |
GemRB.SetButtonState(Window, Button2, IE_GUI_BUTTON_DISABLED) |
84 |
GemRB.SetButtonState (Window, Button2, IE_GUI_BUTTON_DISABLED) |
83 |
|
85 |
|
84 |
if ActPos<GameCount-1: |
86 |
if ActPos<GameCount-1: |
85 |
Slotname = GemRB.GetSaveGameAttrib(0,ActPos) |
87 |
Slotname = GemRB.GetSaveGameAttrib (0,ActPos) |
86 |
elif ActPos == GameCount-1: |
88 |
elif ActPos == GameCount-1: |
87 |
Slotname = 15304 |
89 |
Slotname = 15304 |
88 |
else: |
90 |
else: |
89 |
Slotname = "" |
91 |
Slotname = "" |
90 |
Label = GemRB.GetControl (Window, 0x10000008+i) |
92 |
Label = GemRB.GetControl (Window, 0x10000008+i) |
91 |
GemRB.SetText(Window, Label, Slotname) |
93 |
GemRB.SetText (Window, Label, Slotname) |
92 |
|
94 |
|
93 |
if ActPos<GameCount-1: |
95 |
if ActPos<GameCount-1: |
94 |
Slotname = GemRB.GetSaveGameAttrib(4,ActPos) |
96 |
Slotname = GemRB.GetSaveGameAttrib (4,ActPos) |
95 |
else: |
97 |
else: |
96 |
Slotname = "" |
98 |
Slotname = "" |
97 |
Label = GemRB.GetControl (Window, 0x10000010+i) |
99 |
Label = GemRB.GetControl (Window, 0x10000010+i) |
98 |
GemRB.SetText(Window, Label, Slotname) |
100 |
GemRB.SetText (Window, Label, Slotname) |
99 |
|
101 |
|
100 |
Button=GemRB.GetControl (Window, 1+i) |
102 |
Button=GemRB.GetControl (Window, 1+i) |
101 |
if ActPos<GameCount-1: |
103 |
if ActPos<GameCount-1: |
Lines 118-154
Link Here
|
118 |
def ConfirmedSaveGame(): |
120 |
def ConfirmedSaveGame(): |
119 |
global ConfirmWindow |
121 |
global ConfirmWindow |
120 |
|
122 |
|
121 |
Pos = GemRB.GetVar("TopIndex")+GemRB.GetVar("LoadIdx") |
123 |
Pos = GemRB.GetVar ("TopIndex")+GemRB.GetVar ("LoadIdx") |
122 |
Label = GemRB.GetControl (ConfirmWindow, 3) |
124 |
Label = GemRB.GetControl (ConfirmWindow, 3) |
123 |
Slotname = GemRB.QueryText(ConfirmWindow, Label) |
125 |
Slotname = GemRB.QueryText (ConfirmWindow, Label) |
124 |
StartLoadScreen() |
126 |
StartLoadScreen() |
125 |
GemRB.SaveGame(Pos, Slotname) #loads and enters savegame |
127 |
GemRB.SaveGame(Pos, Slotname) #loads and enters savegame |
126 |
GemRB.UnloadWindow (ConfirmWindow) |
128 |
GemRB.UnloadWindow (ConfirmWindow) |
127 |
CloseSaveWindow () |
129 |
#CloseSaveWindow () |
|
|
130 |
GemRB.SetVisible (SaveWindow,1) |
128 |
return |
131 |
return |
129 |
|
132 |
|
130 |
def SavePress(): |
133 |
def SavePress(): |
131 |
global ConfirmWindow |
134 |
global ConfirmWindow, NameField, SaveButton |
132 |
|
135 |
|
133 |
Pos = GemRB.GetVar("TopIndex")+GemRB.GetVar("LoadIdx") |
136 |
Pos = GemRB.GetVar ("TopIndex")+GemRB.GetVar ("LoadIdx") |
134 |
ConfirmWindow = GemRB.LoadWindow (1) |
137 |
ConfirmWindow = GemRB.LoadWindow (1) |
135 |
|
138 |
|
136 |
#slot name |
139 |
#slot name |
137 |
if Pos<GameCount-1: |
140 |
if Pos<GameCount-1: |
138 |
Slotname = GemRB.GetSaveGameAttrib(0,Pos) |
141 |
Slotname = GemRB.GetSaveGameAttrib (0,Pos) |
139 |
else: |
142 |
else: |
140 |
Slotname = "" |
143 |
Slotname = "" |
141 |
NameField = GemRB.GetControl (ConfirmWindow, 3) |
144 |
NameField = GemRB.GetControl (ConfirmWindow, 3) |
142 |
GemRB.SetText(ConfirmWindow, NameField, Slotname) |
145 |
GemRB.SetText (ConfirmWindow, NameField, Slotname) |
143 |
GemRB.SetControlStatus(ConfirmWindow, NameField, IE_GUI_CONTROL_FOCUSED) |
146 |
GemRB.SetEvent (ConfirmWindow, NameField, IE_GUI_EDIT_ON_CHANGE,"EditChange") |
144 |
|
147 |
|
145 |
#game hours (should be generated from game) |
148 |
#game hours (should be generated from game) |
146 |
if Pos<GameCount-1: |
149 |
if Pos<GameCount-1: |
147 |
Slotname = GemRB.GetSaveGameAttrib(4,Pos) |
150 |
Slotname = GemRB.GetSaveGameAttrib (4,Pos) |
148 |
else: |
151 |
else: |
149 |
Slotname = "" |
152 |
Slotname = "" |
150 |
Label = GemRB.GetControl (ConfirmWindow, 0x10000004) |
153 |
Label = GemRB.GetControl (ConfirmWindow, 0x10000004) |
151 |
GemRB.SetText(ConfirmWindow, Label, Slotname) |
154 |
GemRB.SetText (ConfirmWindow, Label, Slotname) |
152 |
|
155 |
|
153 |
#areapreview |
156 |
#areapreview |
154 |
Button=GemRB.GetControl (ConfirmWindow, 0) |
157 |
Button=GemRB.GetControl (ConfirmWindow, 0) |
Lines 167-193
Link Here
|
167 |
|
170 |
|
168 |
#save |
171 |
#save |
169 |
SaveButton=GemRB.GetControl (ConfirmWindow, 7) |
172 |
SaveButton=GemRB.GetControl (ConfirmWindow, 7) |
170 |
GemRB.SetText(ConfirmWindow, SaveButton, 15588) |
173 |
GemRB.SetText (ConfirmWindow, SaveButton, 15588) |
171 |
GemRB.SetEvent (ConfirmWindow, SaveButton, IE_GUI_BUTTON_ON_PRESS, "ConfirmedSaveGame") |
174 |
GemRB.SetEvent (ConfirmWindow, SaveButton, IE_GUI_BUTTON_ON_PRESS, "ConfirmedSaveGame") |
172 |
GemRB.SetButtonFlags (ConfirmWindow, SaveButton, IE_GUI_BUTTON_DEFAULT, OP_OR) |
175 |
GemRB.SetButtonFlags (ConfirmWindow, SaveButton, IE_GUI_BUTTON_DEFAULT, OP_OR) |
|
|
176 |
GemRB.SetButtonState (ConfirmWindow, SaveButton, IE_GUI_BUTTON_DISABLED) |
173 |
|
177 |
|
174 |
#cancel |
178 |
#cancel |
175 |
CancelButton=GemRB.GetControl (ConfirmWindow, 8) |
179 |
CancelButton=GemRB.GetControl (ConfirmWindow, 8) |
176 |
GemRB.SetText(ConfirmWindow, CancelButton, 13727) |
180 |
GemRB.SetText (ConfirmWindow, CancelButton, 13727) |
177 |
GemRB.SetEvent (ConfirmWindow, CancelButton, IE_GUI_BUTTON_ON_PRESS, "AbortedSaveGame") |
181 |
GemRB.SetEvent (ConfirmWindow, CancelButton, IE_GUI_BUTTON_ON_PRESS, "AbortedSaveGame") |
178 |
GemRB.SetVisible (ConfirmWindow,1) |
182 |
GemRB.SetVisible (ConfirmWindow,1) |
|
|
183 |
GemRB.SetControlStatus (ConfirmWindow, NameField, IE_GUI_CONTROL_FOCUSED) |
179 |
return |
184 |
return |
180 |
|
185 |
|
|
|
186 |
def EditChange(): |
187 |
Name = GemRB.QueryText (ConfirmWindow, NameField) |
188 |
if len(Name)==0: |
189 |
GemRB.SetButtonState (ConfirmWindow, SaveButton, IE_GUI_BUTTON_DISABLED) |
190 |
else: |
191 |
GemRB.SetButtonState (ConfirmWindow, SaveButton, IE_GUI_BUTTON_ENABLED) |
192 |
return |
193 |
|
181 |
def DeleteGameConfirm(): |
194 |
def DeleteGameConfirm(): |
182 |
global GameCount |
195 |
global GameCount |
183 |
|
196 |
|
184 |
TopIndex = GemRB.GetVar("TopIndex") |
197 |
TopIndex = GemRB.GetVar ("TopIndex") |
185 |
Pos = TopIndex +GemRB.GetVar("LoadIdx") |
198 |
Pos = TopIndex +GemRB.GetVar ("LoadIdx") |
186 |
GemRB.DeleteSaveGame(Pos) |
199 |
GemRB.DeleteSaveGame(Pos) |
187 |
if TopIndex>0: |
200 |
if TopIndex>0: |
188 |
GemRB.SetVar("TopIndex",TopIndex-1) |
201 |
GemRB.SetVar ("TopIndex",TopIndex-1) |
189 |
GameCount=GemRB.GetSaveGameCount() #count of games in save folder? |
202 |
GameCount=GemRB.GetSaveGameCount () #count of games in save folder? |
190 |
GemRB.SetVarAssoc(SaveWindow, ScrollBar, "TopIndex", GameCount) |
203 |
GemRB.SetVarAssoc (SaveWindow, ScrollBar, "TopIndex", GameCount) |
191 |
ScrollBarPress() |
204 |
ScrollBarPress() |
192 |
GemRB.UnloadWindow (ConfirmWindow) |
205 |
GemRB.UnloadWindow (ConfirmWindow) |
193 |
GemRB.SetVisible (SaveWindow,1) |
206 |
GemRB.SetVisible (SaveWindow,1) |
Lines 204-215
Link Here
|
204 |
GemRB.SetVisible (SaveWindow, 0) |
217 |
GemRB.SetVisible (SaveWindow, 0) |
205 |
ConfirmWindow=GemRB.LoadWindow (2) |
218 |
ConfirmWindow=GemRB.LoadWindow (2) |
206 |
Text=GemRB.GetControl (ConfirmWindow, 0) |
219 |
Text=GemRB.GetControl (ConfirmWindow, 0) |
207 |
GemRB.SetText(ConfirmWindow, Text, 15305) |
220 |
GemRB.SetText (ConfirmWindow, Text, 15305) |
208 |
DeleteButton=GemRB.GetControl (ConfirmWindow, 1) |
221 |
DeleteButton=GemRB.GetControl (ConfirmWindow, 1) |
209 |
GemRB.SetText(ConfirmWindow, DeleteButton, 13957) |
222 |
GemRB.SetText (ConfirmWindow, DeleteButton, 13957) |
210 |
GemRB.SetEvent (ConfirmWindow, DeleteButton, IE_GUI_BUTTON_ON_PRESS, "DeleteGameConfirm") |
223 |
GemRB.SetEvent (ConfirmWindow, DeleteButton, IE_GUI_BUTTON_ON_PRESS, "DeleteGameConfirm") |
211 |
CancelButton=GemRB.GetControl (ConfirmWindow, 2) |
224 |
CancelButton=GemRB.GetControl (ConfirmWindow, 2) |
212 |
GemRB.SetText(ConfirmWindow, CancelButton, 13727) |
225 |
GemRB.SetText (ConfirmWindow, CancelButton, 13727) |
213 |
GemRB.SetEvent (ConfirmWindow, CancelButton, IE_GUI_BUTTON_ON_PRESS, "DeleteGameCancel") |
226 |
GemRB.SetEvent (ConfirmWindow, CancelButton, IE_GUI_BUTTON_ON_PRESS, "DeleteGameCancel") |
214 |
GemRB.SetVisible (ConfirmWindow,1) |
227 |
GemRB.SetVisible (ConfirmWindow,1) |
215 |
return |
228 |
return |