Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 158336 | Differences between
and this patch

Collapse All | Expand All

(-)gemrb/GUIScripts/iwd/GUISAVE.py (+239 lines)
Line 0 Link Here
1
#load window
2
import GemRB
3
from LoadScreen import *
4
from GUICommon import CloseOtherWindow
5
6
SaveWindow = 0
7
ConfirmWindow = 0
8
NameField = 0
9
SaveButton = 0
10
TextAreaControl = 0
11
GameCount = 0
12
ScrollBar = 0
13
14
def OpenSaveWindow ():
15
	global SaveWindow, TextAreaControl, GameCount, ScrollBar
16
17
	if CloseOtherWindow (OpenSaveWindow):
18
		CloseSaveWindow ()
19
		return
20
21
	GemRB.HideGUI ()
22
	GemRB.SetVisible (0,0)
23
24
	GemRB.LoadWindowPack ("GUISAVE", 640, 480)
25
	Window = SaveWindow = GemRB.LoadWindow (0)
26
	GemRB.SetWindowFrame (Window)
27
	CancelButton=GemRB.GetControl (Window,34)
28
	GemRB.SetText (Window, CancelButton, 13727)
29
	GemRB.SetEvent (Window,CancelButton,IE_GUI_BUTTON_ON_PRESS, "OpenSaveWindow")
30
	GemRB.SetVar ("LoadIdx",0)
31
32
	for i in range(4):
33
		Button = GemRB.GetControl (Window,26+i)
34
		GemRB.SetText (Window, Button, 15588)
35
		GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "SavePress")
36
		GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_DISABLED)
37
		GemRB.SetVarAssoc (Window, Button, "LoadIdx",i)
38
39
		Button = GemRB.GetControl (Window, 30+i)
40
		GemRB.SetText (Window, Button, 13957)
41
		GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "DeleteGamePress")
42
		GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_DISABLED)
43
		GemRB.SetVarAssoc (Window, Button, "LoadIdx",i)
44
45
		#area previews
46
		Button = GemRB.GetControl (Window, 1+i)
47
		GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED)
48
		GemRB.SetButtonFlags(Window, Button, IE_GUI_BUTTON_NO_IMAGE|IE_GUI_BUTTON_PICTURE,OP_SET)
49
50
		#PC portraits
51
		for j in range(PARTY_SIZE):
52
			Button = GemRB.GetControl (Window,40+i*PARTY_SIZE+j)
53
			GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED)
54
			GemRB.SetButtonFlags(Window, Button, IE_GUI_BUTTON_NO_IMAGE|IE_GUI_BUTTON_PICTURE,OP_SET)
55
56
	ScrollBar=GemRB.GetControl (Window, 25)
57
	GemRB.SetEvent (Window, ScrollBar, IE_GUI_SCROLLBAR_ON_CHANGE, "ScrollBarPress")
58
	GameCount=GemRB.GetSaveGameCount ()+1 #one more for the 'new game'
59
	if GameCount>4:
60
		TopIndex = GameCount-4
61
	else:
62
		TopIndex = 0
63
	GemRB.SetVar ("TopIndex",TopIndex)
64
	GemRB.SetVarAssoc (Window, ScrollBar, "TopIndex", TopIndex+1)
65
	ScrollBarPress ()
66
	GemRB.SetVisible (Window,1)
67
	return
68
69
def ScrollBarPress():
70
	Window = SaveWindow
71
	
72
	#draw load game portraits
73
	Pos = GemRB.GetVar ("TopIndex")
74
	for i in range(4):
75
		ActPos = Pos + i
76
77
		Button1 = GemRB.GetControl (Window,26+i)
78
		Button2 = GemRB.GetControl (Window, 30+i)
79
		if ActPos<GameCount:
80
			GemRB.SetButtonState (Window, Button1, IE_GUI_BUTTON_ENABLED)
81
			GemRB.SetButtonState (Window, Button2, IE_GUI_BUTTON_ENABLED)
82
		else:
83
			GemRB.SetButtonState (Window, Button1, IE_GUI_BUTTON_DISABLED)
84
			GemRB.SetButtonState (Window, Button2, IE_GUI_BUTTON_DISABLED)
85
86
		if ActPos<GameCount-1:
87
			Slotname = GemRB.GetSaveGameAttrib (0,ActPos)
88
		elif ActPos == GameCount-1:
89
			Slotname = 15304
90
		else:
91
			Slotname = ""
92
		Label = GemRB.GetControl (Window, 0x10000008+i)
93
		GemRB.SetText (Window, Label, Slotname)
94
95
		if ActPos<GameCount-1:
96
			Slotname = GemRB.GetSaveGameAttrib (4,ActPos)
97
		else:
98
			Slotname = ""
99
		Label = GemRB.GetControl (Window, 0x10000010+i)
100
		GemRB.SetText (Window, Label, Slotname)
101
102
		Button=GemRB.GetControl (Window, 1+i)
103
		if ActPos<GameCount-1:
104
			GemRB.SetSaveGamePreview(Window, Button, ActPos)
105
		else:
106
			GemRB.SetButtonPicture(Window, Button, "")
107
		for j in range(PARTY_SIZE):
108
			Button=GemRB.GetControl (Window, 40+i*PARTY_SIZE+j)
109
			if ActPos<GameCount-1:
110
				GemRB.SetSaveGamePortrait(Window, Button, ActPos,j)
111
			else:
112
				GemRB.SetButtonPicture(Window, Button, "")
113
	return
114
115
def AbortedSaveGame():
116
	GemRB.UnloadWindow (ConfirmWindow)
117
	GemRB.SetVisible (SaveWindow,1)
118
	return
119
	
120
def ConfirmedSaveGame():
121
	global ConfirmWindow
122
	
123
	Pos = GemRB.GetVar ("TopIndex")+GemRB.GetVar ("LoadIdx")
124
	Label = GemRB.GetControl (ConfirmWindow, 3)
125
	Slotname = GemRB.QueryText (ConfirmWindow, Label)
126
	StartLoadScreen()
127
	GemRB.SaveGame(Pos, Slotname) #loads and enters savegame 
128
	GemRB.UnloadWindow (ConfirmWindow)
129
	#CloseSaveWindow ()
130
	GemRB.SetVisible (SaveWindow,1)
131
	return
132
133
def SavePress():	
134
	global ConfirmWindow, NameField, SaveButton
135
	
136
	Pos = GemRB.GetVar ("TopIndex")+GemRB.GetVar ("LoadIdx")
137
	ConfirmWindow = GemRB.LoadWindow (1)
138
	
139
	#slot name
140
	if Pos<GameCount-1:
141
		Slotname = GemRB.GetSaveGameAttrib (0,Pos)
142
	else:
143
		Slotname = ""
144
	NameField = GemRB.GetControl (ConfirmWindow, 3)
145
	GemRB.SetText (ConfirmWindow, NameField, Slotname)
146
	GemRB.SetEvent (ConfirmWindow, NameField, IE_GUI_EDIT_ON_CHANGE,"EditChange")
147
	
148
	#game hours (should be generated from game)
149
	if Pos<GameCount-1:
150
		Slotname = GemRB.GetSaveGameAttrib (4,Pos)
151
	else:
152
		Slotname = ""
153
	Label = GemRB.GetControl (ConfirmWindow, 0x10000004)
154
	GemRB.SetText (ConfirmWindow, Label, Slotname)
155
	
156
	#areapreview
157
	Button=GemRB.GetControl (ConfirmWindow, 0)
158
	if Pos<GameCount-1:
159
		GemRB.SetSaveGamePreview(ConfirmWindow, Button, Pos)
160
	else:
161
		GemRB.SetButtonPicture(ConfirmWindow, Button, "")
162
163
	#portraits
164
	for j in range(PARTY_SIZE):
165
		Button=GemRB.GetControl (ConfirmWindow, 40+j)
166
		if Pos<GameCount-1:
167
			GemRB.SetSaveGamePortrait(ConfirmWindow, Button, Pos,j)
168
		else:
169
			GemRB.SetButtonPicture(ConfirmWindow, Button, "")
170
	
171
	#save	
172
	SaveButton=GemRB.GetControl (ConfirmWindow, 7)
173
	GemRB.SetText (ConfirmWindow, SaveButton, 15588)
174
	GemRB.SetEvent (ConfirmWindow, SaveButton, IE_GUI_BUTTON_ON_PRESS, "ConfirmedSaveGame")
175
	GemRB.SetButtonFlags (ConfirmWindow, SaveButton, IE_GUI_BUTTON_DEFAULT, OP_OR) 
176
	GemRB.SetButtonState (ConfirmWindow, SaveButton, IE_GUI_BUTTON_DISABLED)
177
	
178
	#cancel
179
	CancelButton=GemRB.GetControl (ConfirmWindow, 8)
180
	GemRB.SetText (ConfirmWindow, CancelButton, 13727)
181
	GemRB.SetEvent (ConfirmWindow, CancelButton, IE_GUI_BUTTON_ON_PRESS, "AbortedSaveGame")
182
	GemRB.SetVisible (ConfirmWindow,1)
183
	GemRB.SetControlStatus (ConfirmWindow, NameField, IE_GUI_CONTROL_FOCUSED) 
184
	return
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
194
def DeleteGameConfirm():
195
	global GameCount
196
197
	TopIndex = GemRB.GetVar ("TopIndex")
198
	Pos = TopIndex +GemRB.GetVar ("LoadIdx")
199
	GemRB.DeleteSaveGame(Pos)
200
	if TopIndex>0:
201
		GemRB.SetVar ("TopIndex",TopIndex-1)
202
	GameCount=GemRB.GetSaveGameCount () #count of games in save folder?
203
	GemRB.SetVarAssoc (SaveWindow, ScrollBar, "TopIndex", GameCount)
204
	ScrollBarPress()
205
	GemRB.UnloadWindow (ConfirmWindow)
206
	GemRB.SetVisible (SaveWindow,1)
207
	return
208
209
def DeleteGameCancel():
210
	GemRB.UnloadWindow (ConfirmWindow)
211
	GemRB.SetVisible (SaveWindow,1)
212
	return
213
214
def DeleteGamePress():
215
	global ConfirmWindow
216
217
	GemRB.SetVisible (SaveWindow, 0)
218
	ConfirmWindow=GemRB.LoadWindow (2)
219
	Text=GemRB.GetControl (ConfirmWindow, 0)
220
	GemRB.SetText (ConfirmWindow, Text, 15305)
221
	DeleteButton=GemRB.GetControl (ConfirmWindow, 1)
222
	GemRB.SetText (ConfirmWindow, DeleteButton, 13957)
223
	GemRB.SetEvent (ConfirmWindow, DeleteButton, IE_GUI_BUTTON_ON_PRESS, "DeleteGameConfirm")
224
	CancelButton=GemRB.GetControl (ConfirmWindow, 2)
225
	GemRB.SetText (ConfirmWindow, CancelButton, 13727)
226
	GemRB.SetEvent (ConfirmWindow, CancelButton, IE_GUI_BUTTON_ON_PRESS, "DeleteGameCancel")
227
	GemRB.SetVisible (ConfirmWindow,1)
228
	return
229
	
230
def CloseSaveWindow ():
231
	GemRB.UnloadWindow (SaveWindow)
232
	if GemRB.GetVar ("QuitAfterSave"):
233
		GemRB.QuitGame ()
234
		GemRB.SetNextScript ("Start")
235
		return
236
	
237
	GemRB.SetVisible (0,1) #enabling the game control screen
238
	GemRB.UnhideGUI () #enabling the other windows	
239
	return
0
  + native
240
  + native
1
  + text/plain
241
  + text/plain
(-)gemrb/GUIScripts/tob/GUISAVE.py (-41 / +54 lines)
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
(-)gemrb/GUIScripts/bg1/GUISAVE.py (-41 / +54 lines)
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
(-)gemrb/GUIScripts/bg2/GUISAVE.py (-41 / +54 lines)
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
(-)gemrb/GUIScripts/how/GUISAVE.py (-41 / +54 lines)
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

Return to bug 158336