iwd: more gcw syncing with bg2 - actonpc and dragging
[gemrb.git] / gemrb / GUIScripts / pst / QuitGame.py
blob29361f2ffebdc9c0fca8e35e28fce3975f7c7753
1 # -*-python-*-
2 # GemRB - Infinity Engine Emulator
3 # Copyright (C) 2007 The GemRB Project
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.
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.
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.
20 # QuitGame.py - display EndGame sequence
22 ###################################################
24 import GemRB
25 from GUIDefines import *
26 import GUICommon
28 movies = [None,"T1DEATH","T1ABSORB","FINALE"]
30 def OnLoad ():
31 GemRB.HideGUI ()
32 which = movies[GemRB.GetVar ("QuitGame1")]
33 if which!=None:
34 GemRB.PlayMovie (which,1)
35 which = movies[GemRB.GetVar ("QuitGame2")]
36 if which!=None:
37 GemRB.PlayMovie (which,1)
38 which = GemRB.GetVar ("QuitGame3")
39 if which:
40 DeathWindowEnd ()
41 else:
42 GemRB.QuitGame ()
43 GemRB.SetNextScript("Start")
45 def DonePress ():
46 GemRB.QuitGame ()
47 GemRB.SetNextScript("Start")
49 def DeathWindowEnd ():
50 GemRB.GamePause (1,1)
52 GemRB.LoadWindowPack (GUICommon.GetWindowPack())
53 Window = GemRB.LoadWindow (25)
55 #reason for death
56 Label = Window.GetControl (0x0fffffff)
57 strref = GemRB.GetVar ("QuitGame3")
58 Label.SetText (strref)
60 #done
61 Button = Window.GetControl (1)
62 Button.SetText (17237)
63 Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, DonePress)
64 Button.SetFlags (IE_GUI_BUTTON_DEFAULT|IE_GUI_BUTTON_CANCEL, OP_OR)
66 GemRB.HideGUI ()
67 GemRB.SetVar ("MessageWindow", -1)
68 GemRB.SetVar ("PortraitWindow", Window.ID)
69 GemRB.UnhideGUI ()
70 #making the playing field gray
71 GUICommon.GameWindow.SetVisible(WINDOW_GRAYED)
72 return