2 # GemRB - Infinity Engine Emulator
3 # Copyright (C) 2003-2005 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.
22 from GUICommonWindows
import *
23 import GUICommonWindows
24 from GUICommon
import GameControl
31 from GUISTORE
import *
32 from GUIWORLD
import *
33 from TextScreen
import *
34 from GUIClasses
import GTextArea
35 from GUIClasses
import GWindow
40 global MessageWindow
, PortraitWindow
42 GemRB
.GameSetPartySize(PARTY_SIZE
)
43 GemRB
.GameSetProtagonistMode(2)
44 GemRB
.SetDefaultActions(1,14,16,17)
45 GemRB
.LoadWindowPack(GetWindowPack())
46 OptionsWindow
= MessageWindow
= GemRB
.LoadWindowObject(0)
47 ActionsWindow
= PortraitWindow
= OpenPortraitWindow()
49 GemRB
.SetVar ("MessageWindow", MessageWindow
.ID
)
50 GemRB
.SetVar ("PortraitWindow", PortraitWindow
.ID
)
51 GemRB
.SetVar ("TopWindow", -1)
52 GemRB
.SetVar ("OtherWindow", -1)
53 GemRB
.SetVar ("FloatWindow", -1)
54 GemRB
.SetVar ("ActionsPosition", -1) #already handled in portraitwindow
55 GemRB
.SetVar ("OptionsPosition", -1) #already handled in messagewindow
56 GemRB
.SetVar ("MessagePosition", 4)
57 GemRB
.SetVar ("PortraitPosition", 4)
58 GemRB
.SetVar ("OtherPosition", 5) #Inactivating
59 GemRB
.SetVar ("TopPosition", 5) #Inactivating
61 SetupMenuWindowControls (OptionsWindow
, 1, "ReturnToGame")
63 MessageWindow
.SetVisible(WINDOW_VISIBLE
)
64 PortraitWindow
.SetVisible(WINDOW_VISIBLE
)
68 GemRB
.GameSetScreenFlags(GS_LARGEDIALOG
, OP_OR
)
71 GemRB
.GameSetScreenFlags(GS_LARGEDIALOG
, OP_NAND
)
73 def UpdateControlStatus():
78 GSFlags
= GemRB
.GetMessageWindowSize()
79 Expand
= GSFlags
&GS_DIALOGMASK
80 Override
= GSFlags
&GS_DIALOG
81 GSFlags
= GSFlags
-Expand
83 #a dialogue is running, setting messagewindow size to maximum
85 Expand
= GS_LARGEDIALOG
87 MessageWindow
= GemRB
.GetVar ("MessageWindow")
89 GemRB
.LoadWindowPack(GetWindowPack())
90 hideflag
= GemRB
.HideGUI()
91 if Expand
== GS_LARGEDIALOG
:
92 GemRB
.SetVar ("PortraitWindow", -1)
93 TMessageWindow
= GemRB
.LoadWindowObject(7)
94 TMessageTA
= TMessageWindow
.GetControl (1)
96 GemRB
.SetVar ("PortraitWindow", PortraitWindow
.ID
)
97 TMessageWindow
= GemRB
.LoadWindowObject(0)
98 TMessageTA
= TMessageWindow
.GetControl (1)
99 SetupMenuWindowControls (TMessageWindow
, 1, "ReturnToGame")
102 TMessageTA
.SetFlags(IE_GUI_TEXTAREA_AUTOSCROLL
)
103 TMessageTA
.SetHistory(100)
105 MessageTA
= GTextArea(MessageWindow
, GemRB
.GetVar ("MessageTextArea"))
106 if MessageWindow
>0 and MessageWindow
!=TMessageWindow
.ID
:
107 MessageTA
.MoveText (TMessageTA
)
108 GWindow(MessageWindow
).Unload()
109 GemRB
.SetVar ("MessageWindow", TMessageWindow
.ID
)
110 GemRB
.SetVar ("MessageTextArea", TMessageTA
.ID
)
113 TMessageTA
.SetStatus (IE_GUI_CONTROL_FOCUSED
)
114 #gets PC currently talking
115 pc
= GemRB
.GameGetSelectedPCSingle (1)
117 Portrait
= GemRB
.GetPlayerPortrait(pc
,1)
120 Button
= TMessageWindow
.GetControl(11)
121 Button
.SetState (IE_GUI_BUTTON_LOCKED
)
123 Button
.SetFlags(IE_GUI_BUTTON_NO_IMAGE
, OP_SET
)
125 Button
.SetPicture(Portrait
, "NOPORTSM")
127 GameControl
.SetStatus(IE_GUI_CONTROL_FOCUSED
)