Ejemplo n.º 1
0
def CloseContainerWindow():
    global ContainerWindow

    if not ContainerWindow:
        return

    hideflag = GemRB.HideGUI()

    ContainerWindow.Unload()

    if GameCheck.IsPST():
        GemRB.SetVar("PortraitWindow", GUIWORLD.OldPortraitWindow.ID)
        GUICommonWindows.EnableAnimatedWindows()
        #PST needs a reminder to redraw the  clock for some reason
        if GUICommonWindows.ActionsWindow:
            GUICommonWindows.ActionsWindow.SetVisible(WINDOW_VISIBLE)

    GemRB.SetVar("MessageWindow", GUIWORLD.OldMessageWindow.ID)
    # iwd2 has no separate action window
    if not GameCheck.IsIWD2():
        GemRB.SetVar("ActionsWindow", GUIWORLD.OldActionsWindow.ID)

    Table = GemRB.LoadTable("containr")
    row = Container['Type']
    tmp = Table.GetValue(row, 2)
    #play closing sound if applicable
    if tmp != '*':
        GemRB.PlaySound(tmp)

    #it is enough to close here

    if hideflag:
        GemRB.UnhideGUI()
Ejemplo n.º 2
0
def CloseContainerWindow():
    global ContainerWindow

    if ContainerWindow == None:
        return

    hideflag = GemRB.HideGUI()

    if ContainerWindow:
        ContainerWindow.Unload()
    ContainerWindow = None

    if GUICommon.GameIsPST():
        GUICommonWindows.EnableAnimatedWindows()
        GemRB.SetVar("PortraitWindow", GUIWORLD.OldPortraitWindow.ID)

    # FIXME: iwd2 bug or just bad naming?
    if GUICommon.GameIsIWD2():
        GemRB.SetVar("MessageWindow", GUIWORLD.OldMessageWindow.ID)
    else:
        GemRB.SetVar("ActionsWindow", GUIWORLD.OldActionsWindow.ID)
        GemRB.SetVar("MessageWindow", GUIWORLD.OldMessageWindow.ID)

    Table = GemRB.LoadTable("containr")
    row = Container['Type']
    tmp = Table.GetValue(row, 2)
    #play closing sound if applicable
    if tmp != '*':
        GemRB.PlaySound(tmp)

    #it is enough to close here

    if hideflag:
        GemRB.UnhideGUI()
Ejemplo n.º 3
0
def OpenReformPartyWindow ():
	global ReformPartyWindow

	if GUICommon.CloseOtherWindow(OpenReformPartyWindow):
		GemRB.HideGUI ()
		if ReformPartyWindow:
			ReformPartyWindow.Unload ()
		ReformPartyWindow = None

		GemRB.SetVar ("OtherWindow", -1)
		GUICommonWindows.EnableAnimatedWindows ()
		GemRB.LoadWindowPack ("GUIREC")
		GemRB.UnhideGUI ()
		return

	GemRB.HideGUI ()
	GemRB.LoadWindowPack (GUICommon.GetWindowPack())
	ReformPartyWindow = Window = GemRB.LoadWindow (24)
	GemRB.SetVar ("OtherWindow", Window.ID)
	GUICommonWindows.DisableAnimatedWindows ()

	# Remove
	Button = Window.GetControl (15)
	Button.SetText (42514)
	Button.SetState (IE_GUI_BUTTON_DISABLED)
	# TODO: implement removal

	# Done
	Button = Window.GetControl (8)
	Button.SetText (1403)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenReformPartyWindow)

	GemRB.UnhideGUI ()
Ejemplo n.º 4
0
def OpenJournalWindow():
    global JournalWindow, PortraitWindow, ActionsWindow
    global StartTime

    Table = GemRB.LoadTable("YEARS")
    StartTime = Table.GetValue("STARTTIME", "VALUE")

    if GUICommon.CloseOtherWindow(OpenJournalWindow):
        if LogWindow: OpenLogWindow()
        if BeastsWindow: OpenBeastsWindow()
        if QuestsWindow: OpenQuestsWindow()

        GemRB.HideGUI()

        if JournalWindow:
            JournalWindow.Unload()
        #making the portraitwindow visible again
        GUICommonWindows.EnableAnimatedWindows()
        GemRB.SetVar("OtherWindow", -1)
        PortraitWindow = None
        ActionsWindow = None
        JournalWindow = None

        GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE)
        GemRB.UnhideGUI()
        return

    GemRB.HideGUI()
    GemRB.LoadWindowPack("GUIJRNL")
    JournalWindow = GemRB.LoadWindow(0)
    GemRB.SetVar("OtherWindow", JournalWindow.ID)
    GUICommonWindows.DisableAnimatedWindows()

    # Quests
    Button = JournalWindow.GetControl(0)
    Button.SetText(20430)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenQuestsWindow)

    # Beasts
    Button = JournalWindow.GetControl(1)
    Button.SetText(20634)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenBeastsWindow)

    # Journal
    Button = JournalWindow.GetControl(2)
    Button.SetText(20635)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenLogWindow)

    # Done
    Button = JournalWindow.GetControl(3)
    Button.SetText(20636)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenJournalWindow)
    Button.SetFlags(IE_GUI_BUTTON_CANCEL, OP_OR)
    Button.SetStatus(IE_GUI_CONTROL_FOCUSED)

    #JournalWindow.SetVisible (WINDOW_VISIBLE)
    GemRB.UnhideGUI()
Ejemplo n.º 5
0
def OpenFormationWindow ():
	global FormationWindow

	if GUICommon.CloseOtherWindow(OpenFormationWindow):
		GemRB.HideGUI ()
		if FormationWindow:
			FormationWindow.Unload ()
		FormationWindow = None

		GemRB.GameSetFormation (last_formation, 0)
		GUICommonWindows.EnableAnimatedWindows ()
		GemRB.SetVar ("OtherWindow", -1)
		GemRB.UnhideGUI ()
		return

	GemRB.HideGUI ()
	GemRB.LoadWindowPack (GUICommon.GetWindowPack())
	FormationWindow = Window = GemRB.LoadWindow (27)
	GemRB.SetVar ("OtherWindow", Window.ID)
	GUICommonWindows.DisableAnimatedWindows ()

	# Done
	Button = Window.GetControl (13)
	Button.SetText (1403)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenFormationWindow)

	tooltips = (
		44957,  # Follow
		44958,  # T
		44959,  # Gather
		44960,  # 4 and 2
		44961,  # 3 by 2
		44962,  # Protect
		48152,  # 2 by 3
		44964,  # Rank
		44965,  # V
		44966,  # Wedge
		44967,  # S
		44968,  # Line
		44969,  # None
	)

	for i in range (13):
		Button = Window.GetControl (i)
		Button.SetVarAssoc ("SelectedFormation", i)
		Button.SetTooltip (tooltips[i])
		Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, SelectFormation)

	GemRB.SetVar ("SelectedFormation", GemRB.GameGetFormation (0))
	SelectFormation ()

	GemRB.UnhideGUI ()
Ejemplo n.º 6
0
def WorldMapWindowCommon(Travel):
    global WorldMapWindow, WorldMapControl

    GemRB.HideGUI()

    if WorldMapWindow:
        if WorldMapWindow:
            WorldMapWindow.Unload()
        WorldMapWindow = None
        WorldMapControl = None
        GemRB.SetVar("OtherWindow", -1)
        GUICommonWindows.EnableAnimatedWindows()
        GemRB.UnhideGUI()
        return

    GUICommonWindows.DisableAnimatedWindows()
    GemRB.LoadWindowPack("GUIWMAP")
    WorldMapWindow = Window = GemRB.LoadWindow(0)
    MapWindow = None
    GemRB.SetVar("OtherWindow", WorldMapWindow.ID)

    Window.CreateWorldMapControl(4, 0, 62, 640, 418, Travel, "FONTDLG")
    WorldMapControl = Window.GetControl(4)
    WorldMapControl.SetTextColor(IE_GUI_WMAP_COLOR_BACKGROUND, 0x84, 0x4a,
                                 0x2c, 0x00)
    WorldMapControl.SetTextColor(IE_GUI_WMAP_COLOR_NORMAL, 0x20, 0x20, 0x00,
                                 0xff)
    WorldMapControl.SetTextColor(IE_GUI_WMAP_COLOR_SELECTED, 0x20, 0x20, 0x00,
                                 0xff)
    WorldMapControl.SetTextColor(IE_GUI_WMAP_COLOR_NOTVISITED, 0x20, 0x20,
                                 0x00, 0xa0)
    WorldMapControl.SetAnimation("WMPTY")
    #center on current area
    WorldMapControl.AdjustScrolling(0, 0)
    WorldMapControl.SetStatus(IE_GUI_CONTROL_FOCUSED)
    WorldMapControl.SetEvent(IE_GUI_WORLDMAP_ON_PRESS,
                             GUIMACommon.MoveToNewArea)

    # Done
    Button = Window.GetControl(0)
    Button.SetText(1403)
    if Travel >= 0:
        Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenWorldMapWindow)
    else:
        Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenMapWindow)
    GemRB.UnhideGUI()
Ejemplo n.º 7
0
def OpenOptionsWindow():
    """Open main options window (peacock tail)"""
    global OptionsWindow

    if GUICommon.CloseOtherWindow(OpenOptionsWindow):
        GemRB.HideGUI()
        if OptionsWindow:
            OptionsWindow.Unload()
        GemRB.SetVar("OtherWindow", -1)
        GUICommonWindows.EnableAnimatedWindows()
        OptionsWindow = None

        GemRB.UnhideGUI()
        return

    GemRB.GamePause(1, 1)
    TrySavingConfiguration()

    CommonWindow.CloseContainerWindow()
    GemRB.HideGUI()
    GemRB.LoadWindowPack("GUIOPT")
    OptionsWindow = Window = GemRB.LoadWindow(0)
    GemRB.SetVar("OtherWindow", OptionsWindow.ID)
    GUICommonWindows.DisableAnimatedWindows()

    def ConfigOptButton(button, strref, action):
        button.SetText(strref)
        button.SetEvent(IE_GUI_BUTTON_ON_PRESS, action)
        button.SetFlags(IE_GUI_BUTTON_MULTILINE, OP_OR)

    # Return to Game
    ConfigOptButton(Window.GetControl(0), 28638, OpenOptionsWindow)

    # Quit Game
    ConfigOptButton(Window.GetControl(1), 2595, OpenQuitMsgWindow)

    # Load Game
    ConfigOptButton(Window.GetControl(2), 2592, OpenLoadMsgWindow)

    # Save Game
    ConfigOptButton(Window.GetControl(3), 20639, GUISAVE.OpenSaveWindow)

    # Video Options
    ConfigOptButton(Window.GetControl(4), 28781, OpenVideoOptionsWindow)

    # Audio Options
    ConfigOptButton(Window.GetControl(5), 29720, OpenAudioOptionsWindow)

    # Gameplay Options
    ConfigOptButton(Window.GetControl(6), 29722, OpenGameplayOptionsWindow)

    # Keyboard Mappings
    ConfigOptButton(Window.GetControl(7), 29723, OpenKeyboardMappingsWindow)

    # Movies
    ConfigOptButton(Window.GetControl(9), 38156, OpenMoviesWindow)

    # game version, e.g. v1.1.0000
    Label = Window.GetControl(0x10000007)
    Label.SetText(GEMRB_VERSION)

    GemRB.UnhideGUI()
Ejemplo n.º 8
0
def OpenOptionsWindow ():
	"""Open main options window (peacock tail)"""
	global OptionsWindow

	if GUICommon.CloseOtherWindow (OpenOptionsWindow):
		if VideoOptionsWindow: OpenVideoOptionsWindow ()
		if AudioOptionsWindow: OpenAudioOptionsWindow ()
		if GameplayOptionsWindow: OpenGameplayOptionsWindow ()
		if FeedbackOptionsWindow: OpenFeedbackOptionsWindow ()
		if AutopauseOptionsWindow: OpenAutopauseOptionsWindow ()
		if LoadMsgWindow: OpenLoadMsgWindow ()
		if QuitMsgWindow: OpenQuitMsgWindow ()
		if KeysWindow: OpenKeysWindow ()
		if MoviesWindow: OpenMoviesWindow ()
		
		GemRB.HideGUI ()
		if OptionsWindow:
			OptionsWindow.Unload ()
		GemRB.SetVar ("OtherWindow", -1)
		GUICommonWindows.EnableAnimatedWindows ()
		OptionsWindow = None
		
		GemRB.UnhideGUI ()
		return
		
	GemRB.HideGUI ()
	GemRB.LoadWindowPack ("GUIOPT")
	OptionsWindow = Window = GemRB.LoadWindow (0)
	GemRB.SetVar ("OtherWindow", OptionsWindow.ID)
	GUICommonWindows.DisableAnimatedWindows ()
	
	# Return to Game
	Button = Window.GetControl (0)
	Button.SetText (28638)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenOptionsWindow)

	# Quit Game
	Button = Window.GetControl (1)
	Button.SetText (2595)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenQuitMsgWindow)

	# Load Game
	Button = Window.GetControl (2)
	Button.SetText (2592)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenLoadMsgWindow)

	# Save Game
	Button = Window.GetControl (3)
	Button.SetText (20639)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, GUISAVE.OpenSaveWindow)

	# Video Options
	Button = Window.GetControl (4)
	Button.SetText (28781)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenVideoOptionsWindow)

	# Audio Options
	Button = Window.GetControl (5)
	Button.SetText (29720)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenAudioOptionsWindow)

	# Gameplay Options
	Button = Window.GetControl (6)
	Button.SetText (29722)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenGameplayOptionsWindow)

	# Keyboard Mappings
	Button = Window.GetControl (7)
	Button.SetText (29723)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenKeyboardMappingsWindow)

	# Movies
	Button = Window.GetControl (9)
	Button.SetText (38156)   # or  2594
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenMoviesWindow)

	# game version, e.g. v1.1.0000
	Label = Window.GetControl (0x10000007)
	Label.SetText (GEMRB_VERSION)
	
	#Window.SetVisible (WINDOW_VISIBLE)
	GemRB.UnhideGUI ()