1# -*-python-*-
2# GemRB - Infinity Engine Emulator
3# Copyright (C) 2007 The GemRB Project
4#
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.
9#
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.
14#
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.
18#
19
20# QuitGame.py - display EndGame sequence
21
22###################################################
23
24import GemRB
25from GUIDefines import *
26import GUICommon
27import CommonWindow
28
29movies = [None,"T1DEATH","T1ABSORB","FINALE"]
30
31def OnLoad ():
32	CommonWindow.SetGameGUIHidden(True)
33	which = movies[GemRB.GetVar ("QuitGame1")]
34	if which!=None:
35		GemRB.PlayMovie (which,1)
36	which = movies[GemRB.GetVar ("QuitGame2")]
37	if which!=None:
38		GemRB.PlayMovie (which,1)
39	which = GemRB.GetVar ("QuitGame3")
40	if which:
41		DeathWindowEnd ()
42	else:
43		GemRB.QuitGame ()
44		GemRB.SetNextScript("Start")
45
46def DonePress ():
47		GemRB.QuitGame ()
48		GemRB.SetNextScript("Start")
49
50def DeathWindowEnd ():
51	GemRB.GamePause (1,3)
52
53	Window = GemRB.LoadWindow (25, GUICommon.GetWindowPack())
54
55	#reason for death
56	Label = Window.GetControl (0x0fffffff)
57	strref = GemRB.GetVar ("QuitGame3")
58	Label.SetText (strref)
59
60	#done
61	Button = Window.GetControl (1)
62	Button.SetText (17237)
63	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, DonePress)
64	Button.MakeDefault()
65
66	#making the playing field gray
67	GUICommon.GameWindow.SetDisabled(True)
68	return
69