Exemple #1
0
def OpenMapWindow ():
	global MapWindow, OptionsWindow, PortraitWindow
	global OldPortraitWindow, OldOptionsWindow

	if GUICommon.CloseOtherWindow (OpenMapWindow):
		if MapWindow:
			MapWindow.Unload ()
		if OptionsWindow:
			OptionsWindow.Unload ()
		if PortraitWindow:
			PortraitWindow.Unload ()

		MapWindow = None
		#this window type should block the game
		GemRB.SetVar ("OtherWindow", -1)
		GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE)
		#OldOptionsWindow.SetVisible (WINDOW_VISIBLE)
		#OldPortraitWindow.SetVisible (WINDOW_VISIBLE)
		GemRB.UnhideGUI ()
		GUICommonWindows.PortraitWindow = OldPortraitWindow
		OldPortraitWindow = None
		GUICommonWindows.OptionsWindow = OldOptionsWindow
		OldOptionsWindow = None
		return

	GemRB.HideGUI ()
	GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)

	GemRB.LoadWindowPack ("GUIMAP", 640, 480)
	MapWindow = Window = GemRB.LoadWindow (2)
	#this window type blocks the game normally, but map window doesn't
	GemRB.SetVar ("OtherWindow", MapWindow.ID)
	#saving the original portrait window
	OldOptionsWindow = GUICommonWindows.OptionsWindow
	OptionsWindow = GemRB.LoadWindow (0)
	GUICommonWindows.MarkMenuButton (OptionsWindow)
	GUICommonWindows.SetupMenuWindowControls (OptionsWindow, 0, OpenMapWindow)
	OldPortraitWindow = GUICommonWindows.PortraitWindow
	PortraitWindow = GUICommonWindows.OpenPortraitWindow (0)
	OptionsWindow.SetFrame ()

	# World Map
	Button = Window.GetControl (1)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenWorldMapWindowInside)

	# Map Control
	Window.CreateMapControl (2, 0, 0, 0, 0)
	Map = Window.GetControl (2)
	Map.SetEvent (IE_GUI_MAP_ON_DOUBLE_PRESS, LeftDoublePressMap)
	#OldOptionsWindow.SetVisible (WINDOW_INVISIBLE)
	#OldPortraitWindow.SetVisible (WINDOW_INVISIBLE)
	OptionsWindow.SetVisible (WINDOW_VISIBLE)
	Window.SetVisible (WINDOW_VISIBLE)
	PortraitWindow.SetVisible (WINDOW_VISIBLE)
	Map.SetStatus (IE_GUI_CONTROL_FOCUSED)
Exemple #2
0
def OpenMageWindow():
    global MageWindow, OptionsWindow, PortraitWindow, OtherWindow, MageSpellInfoWindow
    global OldPortraitWindow, OldOptionsWindow

    if GUICommon.CloseOtherWindow(OpenMageWindow):
        CloseMageSpellUnmemorizeWindow()
        if MageSpellInfoWindow:
            MageSpellInfoWindow.Unload()
            MageSpellInfoWindow = None
        if OtherWindow:
            OtherWindow.Unload()
            OtherWindow = None
        if MageWindow:
            MageWindow.Unload()
        if OptionsWindow:
            OptionsWindow.Unload()
        if PortraitWindow:
            PortraitWindow.Unload()

        MageWindow = None
        GemRB.SetVar("OtherWindow", -1)
        GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE)
        GemRB.UnhideGUI()
        GUICommonWindows.PortraitWindow = OldPortraitWindow
        OldPortraitWindow = None
        GUICommonWindows.OptionsWindow = OldOptionsWindow
        OldOptionsWindow = None
        GUICommonWindows.SetSelectionChangeHandler(None)
        return

    GemRB.HideGUI()
    GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)

    GemRB.LoadWindowPack("GUIMG", 640, 480)

    #saving the original portrait window
    OldOptionsWindow = GUICommonWindows.OptionsWindow
    OptionsWindow = GemRB.LoadWindow(0)
    GUICommonWindows.MarkMenuButton(OptionsWindow)
    GUICommonWindows.SetupMenuWindowControls(OptionsWindow, 0, OpenMageWindow)
    OptionsWindow.SetFrame()
    OldPortraitWindow = GUICommonWindows.PortraitWindow
    PortraitWindow = GUICommonWindows.OpenPortraitWindow(0)

    GUICommonWindows.SetSelectionChangeHandler(SetupMageWindow)
    SetupMageWindow()
    return
Exemple #3
0
def OpenInventoryWindow():
    """Opens the inventory window."""

    import GUICommonWindows

    global InventoryWindow, OptionsWindow, PortraitWindow
    global OldPortraitWindow, OldOptionsWindow

    if GUICommon.CloseOtherWindow(OpenInventoryWindow):
        if GemRB.IsDraggingItem() == 1:
            pc = GemRB.GameGetSelectedPCSingle()
            #store the item in the inventory before window is closed
            GemRB.DropDraggedItem(pc, -3)
            #dropping on ground if cannot store in inventory
            if GemRB.IsDraggingItem() == 1:
                GemRB.DropDraggedItem(pc, -2)

        InventoryCommon.CloseIdentifyItemWindow()
        InventoryCommon.CloseAbilitiesItemWindow()
        InventoryCommon.CancelColor()
        if InventoryCommon.ItemInfoWindow:
            InventoryCommon.ItemInfoWindow.Unload()
            InventoryCommon.ItemInfoWindow = None
        if InventoryCommon.ItemAmountWindow:
            InventoryCommon.ItemAmountWindow.Unload()
            InventoryCommon.ItemAmountWindow = None
        if InventoryCommon.ErrorWindow:
            InventoryCommon.ErrortWindow.Unload()
            InventoryCommon.ErrortWindow = None

        if InventoryWindow:
            InventoryWindow.Unload()
        if OptionsWindow:
            OptionsWindow.Unload()
        if PortraitWindow:
            PortraitWindow.Unload()

        InventoryWindow = None
        GemRB.SetVar("OtherWindow", -1)
        GemRB.SetVar("MessageLabel", -1)
        GUICommonWindows.PortraitWindow = OldPortraitWindow
        GUICommonWindows.UpdatePortraitWindow()
        OldPortraitWindow = None
        GUICommonWindows.OptionsWindow = OldOptionsWindow
        OldOptionsWindow = None
        #don't go back to multi selection mode when going to the store screen
        if not GemRB.GetVar("Inventory"):
            GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE)
            GemRB.UnhideGUI()
            GUICommonWindows.SetSelectionChangeHandler(None)
        return

    GemRB.HideGUI()
    GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)

    GemRB.LoadWindowPack("GUIINV", 640, 480)
    InventoryWindow = Window = GemRB.LoadWindow(2)
    GemRB.SetVar("OtherWindow", InventoryWindow.ID)
    GemRB.SetVar("MessageLabel", Window.GetControl(0x1000003f).ID)
    OldOptionsWindow = GUICommonWindows.OptionsWindow
    OptionsWindow = GemRB.LoadWindow(0)
    GUICommonWindows.MarkMenuButton(OptionsWindow)
    GUICommonWindows.SetupMenuWindowControls(OptionsWindow, 0,
                                             OpenInventoryWindow)
    OptionsWindow.SetFrame()
    #saving the original portrait window
    OldPortraitWindow = GUICommonWindows.PortraitWindow
    PortraitWindow = GUICommonWindows.OpenPortraitWindow(0)

    #ground items scrollbar
    ScrollBar = Window.GetControl(66)
    ScrollBar.SetEvent(IE_GUI_SCROLLBAR_ON_CHANGE, RefreshInventoryWindow)

    #Ground Item
    for i in range(5):
        Button = Window.GetControl(i + 68)
        Button.SetEvent(IE_GUI_MOUSE_ENTER_BUTTON,
                        InventoryCommon.MouseEnterGround)
        Button.SetEvent(IE_GUI_MOUSE_LEAVE_BUTTON,
                        InventoryCommon.MouseLeaveGround)
        Button.SetVarAssoc("GroundItemButton", i)
        Button.SetSprites("STONSLOT", 0, 0, 2, 4, 3)

    #major & minor clothing color
    Button = Window.GetControl(62)
    Button.SetSprites("INVBUT", 0, 0, 1, 0, 0)
    Button.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, InventoryCommon.MajorPress)
    Button.SetTooltip(12007)

    Button = Window.GetControl(63)
    Button.SetSprites("INVBUT", 0, 0, 1, 0, 0)
    Button.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, InventoryCommon.MinorPress)
    Button.SetTooltip(12008)

    #portrait
    Button = Window.GetControl(50)
    Button.SetState(IE_GUI_BUTTON_LOCKED)
    Button.SetFlags(IE_GUI_BUTTON_NO_IMAGE | IE_GUI_BUTTON_PICTURE, OP_SET)
    Button.SetEvent(IE_GUI_BUTTON_ON_DRAG_DROP, InventoryCommon.OnAutoEquip)

    #encumbrance
    Button = Window.GetControl(67)
    r = Button.GetRect()
    Label = Window.CreateLabel(
        0x10000043, r["X"], r["Y"], r["Width"], 20, "NUMBER", "0:",
        IE_FONT_ALIGN_LEFT | IE_FONT_ALIGN_TOP | IE_FONT_SINGLE_LINE)
    Label = Window.CreateLabel(
        0x10000044, r["X"], r["Y"] + r["Height"] - 20, r["Width"], 20,
        "NUMBER", "0:",
        IE_FONT_ALIGN_RIGHT | IE_FONT_ALIGN_BOTTOM | IE_FONT_SINGLE_LINE)

    # armor class
    Label = Window.GetControl(0x10000038)
    Label.SetTooltip(17183)

    # hp current
    Label = Window.GetControl(0x10000039)
    Label.SetTooltip(17184)

    # hp max
    Label = Window.GetControl(0x1000003a)
    Label.SetTooltip(17378)

    # info label, game paused, etc
    Label = Window.GetControl(0x1000003f)
    Label.SetText("")

    SlotCount = GemRB.GetSlotType(-1)["Count"]
    for slot in range(SlotCount):
        SlotType = GemRB.GetSlotType(slot + 1)
        if SlotType["ID"]:
            Button = Window.GetControl(SlotType["ID"])
            Button.SetEvent(IE_GUI_MOUSE_ENTER_BUTTON,
                            InventoryCommon.MouseEnterSlot)
            Button.SetEvent(IE_GUI_MOUSE_LEAVE_BUTTON,
                            InventoryCommon.MouseLeaveSlot)
            Button.SetVarAssoc("ItemButton", slot + 1)
            #keeping 2 in the original place, because it is how
            #the gui resource has it, but setting the other cycles
            Button.SetSprites("STONSLOT", 0, 0, 2, 4, 3)

    # create a button so we can map it do ESC for quit exiting
    Button = Window.CreateButton(999, 0, 0, 1, 1)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenInventoryWindow)
    Button.SetFlags(IE_GUI_BUTTON_CANCEL, OP_OR)

    GemRB.SetVar("TopIndex", 0)
    GUICommonWindows.SetSelectionChangeHandler(UpdateInventoryWindow)
    UpdateInventoryWindow()
    OptionsWindow.SetVisible(WINDOW_VISIBLE)
    Window.SetVisible(WINDOW_FRONT)
    PortraitWindow.SetVisible(WINDOW_VISIBLE)
    Window.SetKeyPressEvent(GUICommonWindows.SwitchPCByKey)
    return
Exemple #4
0
def OpenOptionsWindow():
    """Open main options window"""

    global GameOptionsWindow, OptionsWindow, PortraitWindow
    global OldPortraitWindow, OldOptionsWindow

    if GUICommon.CloseOtherWindow(OpenOptionsWindow):
        CloseOptionsWindow()
        return

    GemRB.GamePause(1, 3)

    CommonWindow.CloseContainerWindow()
    GemRB.HideGUI()
    GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)
    if GameCheck.IsBG1():
        GUICommonWindows.SetSelectionChangeHandler(None)

    GemRB.LoadWindowPack("GUIOPT", WIDTH, HEIGHT)
    GameOptionsWindow = Window = GemRB.LoadWindow(2)
    GemRB.SetVar("OtherWindow", GameOptionsWindow.ID)

    if OldOptionsWindow == None:
        # OptionsWindow is the leftmost menu bar window present in most of the games
        OldOptionsWindow = GUICommonWindows.OptionsWindow
        OptionsWindow = GemRB.LoadWindow(0)
        GUICommonWindows.MarkMenuButton(OptionsWindow)
        GUICommonWindows.SetupMenuWindowControls(OptionsWindow, 0,
                                                 OpenOptionsWindow)
        OptionsWindow.SetFrame()
        if not GameCheck.IsBG1(
        ):  #not in PST either, but it has its own OpenOptionsWindow()
            OptionsWindow.SetFrame()
            #saving the original portrait window
            OldPortraitWindow = GUICommonWindows.PortraitWindow
            PortraitWindow = GUICommonWindows.OpenPortraitWindow(0)

    # Return to Game
    Button = Window.GetControl(11)
    Button.SetText(10308)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenOptionsWindow)
    Button.SetFlags(IE_GUI_BUTTON_CANCEL, OP_OR)

    # Quit Game
    Button = Window.GetControl(10)
    Button.SetText(13731)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenQuitMsgWindow)

    # Load Game
    Button = Window.GetControl(5)
    Button.SetText(13729)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenLoadMsgWindow)

    # Save Game
    Button = Window.GetControl(6)
    Button.SetText(13730)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenSaveMsgWindow)

    # Video Options
    Button = Window.GetControl(7)
    Button.SetText(17162)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenVideoOptionsWindow)

    # Audio Options
    Button = Window.GetControl(8)
    Button.SetText(17164)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenAudioOptionsWindow)

    # Gameplay Options
    Button = Window.GetControl(9)
    Button.SetText(17165)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenGameplayOptionsWindow)

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

    if GameCheck.IsIWD2():
        # Keyboard shortcuts
        KeyboardButton = Window.GetControl(13)
        KeyboardButton.SetText(33468)
        KeyboardButton.SetEvent(IE_GUI_BUTTON_ON_PRESS,
                                OpenHotkeyOptionsWindow)

        # Movies
        MoviesButton = Window.GetControl(14)
        MoviesButton.SetText(15415)
        MoviesButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenMovieWindow)

    RestoreWinVisibility()

    return
Exemple #5
0
def OpenMapWindow():
    import GUICommonWindows
    global MapWindow, OptionsWindow, PortraitWindow
    global OldPortraitWindow, OldOptionsWindow

    if GUICommon.CloseOtherWindow(OpenMapWindow):
        if MapWindow:
            MapWindow.Unload()
        if OptionsWindow:
            OptionsWindow.Unload()
        if PortraitWindow:
            PortraitWindow.Unload()

        MapWindow = None
        #this window type should block the game
        GemRB.SetVar("OtherWindow", -1)
        GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE)
        GemRB.UnhideGUI()
        GUICommonWindows.PortraitWindow = OldPortraitWindow
        OldPortraitWindow = None
        GUICommonWindows.OptionsWindow = OldOptionsWindow
        OldOptionsWindow = None
        return

    GemRB.HideGUI()
    GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)

    GemRB.LoadWindowPack("GUIMAP", 640, 480)
    MapWindow = Window = GemRB.LoadWindow(2)
    #this window type blocks the game normally, but map window doesn't
    GemRB.SetVar("OtherWindow", MapWindow.ID)
    #saving the original portrait window
    OldOptionsWindow = GUICommonWindows.OptionsWindow
    OptionsWindow = GemRB.LoadWindow(0)
    GUICommonWindows.MarkMenuButton(OptionsWindow)
    GUICommonWindows.SetupMenuWindowControls(OptionsWindow, 0, OpenMapWindow)
    OldPortraitWindow = GUICommonWindows.PortraitWindow
    PortraitWindow = GUICommonWindows.OpenPortraitWindow(0)
    OptionsWindow.SetFrame()

    # World Map
    Button = Window.GetControl(1)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenWorldMapWindowInside)

    # Hide or Show mapnotes
    Button = Window.GetControl(3)
    Button.SetFlags(IE_GUI_BUTTON_CHECKBOX, OP_OR)
    # Is this an option?
    GemRB.SetVar("ShowMapNotes", IE_GUI_MAP_VIEW_NOTES)
    Button.SetVarAssoc("ShowMapNotes", IE_GUI_MAP_VIEW_NOTES)

    Label = Window.GetControl(0x10000003)
    Label.SetText("")

    # Map Control
    Window.CreateMapControl(2, 0, 0, 0, 0, 0x10000003, "FLAG1")
    Map = Window.GetControl(2)
    Map.SetVarAssoc("ShowMapNotes", IE_GUI_MAP_VIEW_NOTES)
    Map.SetEvent(IE_GUI_MAP_ON_RIGHT_PRESS, AddNoteWindow)
    Map.SetEvent(IE_GUI_MAP_ON_DOUBLE_PRESS, LeftDoublePressMap)
    OptionsWindow.SetVisible(WINDOW_VISIBLE)
    Window.SetVisible(WINDOW_VISIBLE)
    PortraitWindow.SetVisible(WINDOW_VISIBLE)
    Map.SetStatus(IE_GUI_CONTROL_FOCUSED | IE_GUI_MAP_VIEW_NOTES)
    return
Exemple #6
0
def OpenPriestWindow():
    import GUICommonWindows
    global PriestWindow, OptionsWindow, PortraitWindow, PriestSpellInfoWindow
    global OldPortraitWindow, OldOptionsWindow

    if GUICommon.CloseOtherWindow(OpenPriestWindow):
        ClosePriestSpellUnmemorizeWindow()
        if PriestSpellInfoWindow:
            PriestSpellInfoWindow.Unload()
            PriestSpellInfoWindow = None
        if PriestWindow:
            PriestWindow.Unload()
        if OptionsWindow:
            OptionsWindow.Unload()
        if PortraitWindow:
            PortraitWindow.Unload()

        PriestWindow = None
        GemRB.SetVar("OtherWindow", -1)
        GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE)
        GemRB.UnhideGUI()
        GUICommonWindows.PortraitWindow = OldPortraitWindow
        OldPortraitWindow = None
        GUICommonWindows.OptionsWindow = OldOptionsWindow
        OldOptionsWindow = None
        GUICommonWindows.SetSelectionChangeHandler(None)
        return

    GemRB.HideGUI()
    GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)

    GemRB.LoadWindowPack("GUIPR", 640, 480)
    PriestWindow = Window = GemRB.LoadWindow(2)
    GemRB.SetVar("OtherWindow", PriestWindow.ID)
    #saving the original portrait window
    OldOptionsWindow = GUICommonWindows.OptionsWindow
    OptionsWindow = GemRB.LoadWindow(0)
    GUICommonWindows.MarkMenuButton(OptionsWindow)
    GUICommonWindows.SetupMenuWindowControls(OptionsWindow, 0,
                                             OpenPriestWindow)
    OptionsWindow.SetFrame()
    OldPortraitWindow = GUICommonWindows.PortraitWindow
    PortraitWindow = GUICommonWindows.OpenPortraitWindow(0)

    Button = Window.GetControl(1)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, PriestPrevLevelPress)

    Button = Window.GetControl(2)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, PriestNextLevelPress)

    #setup level buttons
    if GameCheck.IsBG2():
        for i in range(7):
            Button = Window.GetControl(55 + i)
            Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, RefreshPriestLevel)
            Button.SetFlags(IE_GUI_BUTTON_RADIOBUTTON, OP_OR)

        for i in range(7):
            Button = Window.GetControl(55 + i)
            Button.SetVarAssoc("PriestSpellLevel", i)

    # Setup memorized spells buttons
    for i in range(12):
        Button = Window.GetControl(3 + i)
        Button.SetBorder(0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 1)
        Button.SetSprites("SPELFRAM", 0, 0, 0, 0, 0)
        Button.SetFlags(
            IE_GUI_BUTTON_PICTURE | IE_GUI_BUTTON_PLAYONCE
            | IE_GUI_BUTTON_PLAYALWAYS, OP_OR)
        Button.SetState(IE_GUI_BUTTON_LOCKED)

    # Setup book spells buttons
    for i in range(GUICommon.GetGUISpellButtonCount()):
        Button = Window.GetControl(27 + i)
        Button.SetFlags(
            IE_GUI_BUTTON_NO_IMAGE | IE_GUI_BUTTON_PLAYONCE
            | IE_GUI_BUTTON_PLAYALWAYS, OP_OR)
        Button.SetState(IE_GUI_BUTTON_LOCKED)

    GUICommonWindows.SetSelectionChangeHandler(UpdatePriestWindow)
    UpdatePriestWindow()
    return
Exemple #7
0
def OpenRecordsWindow():
    import GUICommonWindows

    global RecordsWindow, OptionsWindow, PortraitWindow
    global OldPortraitWindow, OldOptionsWindow

    if GUICommon.CloseOtherWindow(OpenRecordsWindow):
        if InformationWindow: OpenInformationWindow()

        if RecordsWindow:
            RecordsWindow.Unload()
        if OptionsWindow:
            OptionsWindow.Unload()
        if PortraitWindow:
            PortraitWindow.Unload()

        RecordsWindow = None
        GemRB.SetVar("OtherWindow", -1)
        GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE)
        GemRB.UnhideGUI()
        GUICommonWindows.PortraitWindow = OldPortraitWindow
        OldPortraitWindow = None
        GUICommonWindows.UpdatePortraitWindow()
        GUICommonWindows.OptionsWindow = OldOptionsWindow
        OldOptionsWindow = None
        GUICommonWindows.SetSelectionChangeHandler(None)
        return

    GemRB.HideGUI()
    GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)

    GemRB.LoadWindowPack("GUIREC", 640, 480)
    RecordsWindow = Window = GemRB.LoadWindow(2)
    GemRB.SetVar("OtherWindow", RecordsWindow.ID)
    # saving the original portrait window
    OldOptionsWindow = GUICommonWindows.OptionsWindow
    OptionsWindow = GemRB.LoadWindow(0)
    GUICommonWindows.SetupMenuWindowControls(OptionsWindow, 0,
                                             OpenRecordsWindow)
    GUICommonWindows.MarkMenuButton(OptionsWindow)
    OptionsWindow.SetFrame()
    OldPortraitWindow = GUICommonWindows.PortraitWindow
    PortraitWindow = GUICommonWindows.OpenPortraitWindow(0)

    # dual class
    Button = Window.GetControl(0)
    Button.SetText(7174)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, DualClass.DualClassWindow)

    # levelup
    Button = Window.GetControl(37)
    Button.SetText(7175)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, LevelUp.OpenLevelUpWindow)

    # information
    Button = Window.GetControl(1)
    Button.SetText(11946)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenInformationWindow)

    # reform party
    Button = Window.GetControl(51)
    Button.SetText(16559)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenRecReformPartyWindow)

    # customize
    Button = Window.GetControl(50)
    Button.SetText(10645)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, GUIRECCommon.OpenCustomizeWindow)

    # export
    Button = Window.GetControl(36)
    Button.SetText(13956)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, GUIRECCommon.OpenExportWindow)

    # kit info
    if GameCheck.IsBG2():
        Button = Window.GetControl(52)
        Button.SetText(61265)
        Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenKitInfoWindow)

    GUICommonWindows.SetSelectionChangeHandler(UpdateRecordsWindow)
    UpdateRecordsWindow()

    OptionsWindow.SetVisible(WINDOW_VISIBLE)
    Window.SetVisible(WINDOW_VISIBLE)
    PortraitWindow.SetVisible(WINDOW_VISIBLE)
    return
Exemple #8
0
def OpenJournalWindow ():
	import GUICommonWindows
	global JournalWindow, OptionsWindow, PortraitWindow
	global OldPortraitWindow, OldOptionsWindow
	global StartTime, StartYear
	global Chapter

	if GUICommon.CloseOtherWindow (OpenJournalWindow):
		
		if JournalWindow:
			JournalWindow.Unload ()
		if OptionsWindow:
			OptionsWindow.Unload ()
		if PortraitWindow:
			PortraitWindow.Unload ()

		JournalWindow = None
		GemRB.SetVar ("OtherWindow", -1)
		GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE)
		GemRB.UnhideGUI ()
		GUICommonWindows.PortraitWindow = OldPortraitWindow
		OldPortraitWindow = None
		GUICommonWindows.OptionsWindow = OldOptionsWindow
		OldOptionsWindow = None
		GUICommonWindows.SetSelectionChangeHandler (None)
		return
		
	Table = GemRB.LoadTable("YEARS")
	StartTime = Table.GetValue("STARTTIME", "VALUE") / 4500
	StartYear = Table.GetValue("STARTYEAR", "VALUE")

	GemRB.HideGUI ()
	GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)

	GemRB.LoadWindowPack ("GUIJRNL", 640, 480)
	JournalWindow = Window = GemRB.LoadWindow (2)
	GemRB.SetVar ("OtherWindow", JournalWindow.ID)
	#saving the original portrait window
	OldOptionsWindow = GUICommonWindows.OptionsWindow
	OptionsWindow = GemRB.LoadWindow (0)
	GUICommonWindows.MarkMenuButton (OptionsWindow)
	GUICommonWindows.SetupMenuWindowControls (OptionsWindow, 0, OpenJournalWindow)
	OptionsWindow.SetFrame ()
	OldPortraitWindow = GUICommonWindows.PortraitWindow
	PortraitWindow = GUICommonWindows.OpenPortraitWindow (0)

	# prev. chapter
	Button = JournalWindow.GetControl (3)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, PrevChapterPress)

	# next chapter
	Button = JournalWindow.GetControl (4)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, NextChapterPress)

	GemRB.SetVar ("Section", Section)
	# Quests
	Button = JournalWindow.GetControl (6)
	Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR)
	Button.SetVarAssoc ("Section", 1)
	Button.SetText (45485)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, UpdateLogWindow)

	# Quests completed
	Button = JournalWindow.GetControl (7)
	Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR)
	Button.SetVarAssoc ("Section", 2)
	Button.SetText (45486)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, UpdateLogWindow)

	# Journal
	Button = JournalWindow.GetControl (8)
	Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR)
	Button.SetVarAssoc ("Section", 4)
	Button.SetText (15333)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, UpdateLogWindow)

	# User
	Button = JournalWindow.GetControl (9)
	Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR)
	Button.SetVarAssoc ("Section", 0)
	Button.SetText (45487)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, UpdateLogWindow)

	# Order
	Button = JournalWindow.GetControl (10)
	Button.SetText (4627)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, ToggleOrderWindow)

	# Done
	#Button = JournalWindow.GetControl (3)
	#Button.SetText (20636)
	#Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenJournalWindow)

	Chapter = GemRB.GetGameVar("chapter")
	if Chapter>65535:
		Chapter=0

	GUICommonWindows.SetSelectionChangeHandler (UpdateLogWindow)
	UpdateLogWindow ()
	OptionsWindow.SetVisible (WINDOW_VISIBLE)
	Window.SetVisible (WINDOW_FRONT)
	PortraitWindow.SetVisible (WINDOW_VISIBLE)
	return
Exemple #9
0
def OpenRecordsWindow():
    import GUICommonWindows

    global RecordsWindow, OptionsWindow, PortraitWindow, PauseState
    global OldPortraitWindow, OldOptionsWindow

    if GUICommon.CloseOtherWindow(OpenRecordsWindow):
        if InformationWindow: OpenInformationWindow()

        GUIRECCommon.CloseSubSubCustomizeWindow()
        GUIRECCommon.CloseSubCustomizeWindow()
        GUIRECCommon.CloseCustomizeWindow()
        GUIRECCommon.ExportCancelPress()
        GUIRECCommon.CloseBiographyWindow()
        KitDonePress()
        CloseInformationWindow()

        if RecordsWindow:
            RecordsWindow.Unload()
        if OptionsWindow:
            OptionsWindow.Unload()
        if PortraitWindow:
            PortraitWindow.Unload()

        RecordsWindow = None
        GemRB.SetVar("OtherWindow", -1)
        GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE)
        GemRB.UnhideGUI()
        GUICommonWindows.PortraitWindow = OldPortraitWindow
        OldPortraitWindow = None
        GUICommonWindows.UpdatePortraitWindow()
        GUICommonWindows.OptionsWindow = OldOptionsWindow
        OldOptionsWindow = None
        GUICommonWindows.SetSelectionChangeHandler(None)
        GemRB.GamePause(PauseState, 3)
        return

    PauseState = GemRB.GamePause(3, 1)
    GemRB.GamePause(1, 3)

    GemRB.HideGUI()
    GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)

    GemRB.LoadWindowPack("GUIREC", 640, 480)
    RecordsWindow = Window = GemRB.LoadWindow(2)
    GemRB.SetVar("OtherWindow", RecordsWindow.ID)
    # saving the original portrait window
    OldOptionsWindow = GUICommonWindows.OptionsWindow
    OptionsWindow = GemRB.LoadWindow(0)
    GUICommonWindows.SetupMenuWindowControls(OptionsWindow, 0,
                                             OpenRecordsWindow)
    GUICommonWindows.MarkMenuButton(OptionsWindow)
    OptionsWindow.SetFrame()
    OldPortraitWindow = GUICommonWindows.PortraitWindow
    PortraitWindow = GUICommonWindows.OpenPortraitWindow(0)

    # dual class
    Button = Window.GetControl(0)
    Button.SetText(7174)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, DualClass.DualClassWindow)

    # levelup
    Button = Window.GetControl(37)
    Button.SetText(7175)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, LevelUp.OpenLevelUpWindow)

    # information
    Button = Window.GetControl(1)
    Button.SetText(11946)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenInformationWindow)

    # reform party
    Button = Window.GetControl(51)
    Button.SetText(16559)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenRecReformPartyWindow)

    # customize
    Button = Window.GetControl(50)
    Button.SetText(10645)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, GUIRECCommon.OpenCustomizeWindow)

    # export
    Button = Window.GetControl(36)
    Button.SetText(13956)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, GUIRECCommon.OpenExportWindow)

    # kit info
    if GameCheck.IsBG2():
        Button = Window.GetControl(52)
        Button.SetText(61265)
        Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenKitInfoWindow)

    # create a button so we can map it do ESC for quit exiting
    Button = Window.CreateButton(99, 0, 0, 1, 1)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenRecordsWindow)
    Button.SetFlags(IE_GUI_BUTTON_CANCEL, OP_OR)

    GUICommonWindows.SetSelectionChangeHandler(UpdateRecordsWindow)
    UpdateRecordsWindow()

    Window.SetKeyPressEvent(GUICommonWindows.SwitchPCByKey)

    OptionsWindow.SetVisible(WINDOW_VISIBLE)
    Window.SetVisible(WINDOW_VISIBLE)
    PortraitWindow.SetVisible(WINDOW_VISIBLE)
    return
Exemple #10
0
def OpenMapWindow():
    import GameCheck
    global MapWindow, OptionsWindow, PortraitWindow
    global OldPortraitWindow, OldOptionsWindow

    if GUICommon.CloseOtherWindow(OpenMapWindow):
        if MapWindow:
            MapWindow.Unload()
        if OptionsWindow:
            OptionsWindow.Unload()
        if PortraitWindow:
            PortraitWindow.Unload()

        MapWindow = None
        #this window type should block the game
        GemRB.SetVar("OtherWindow", -1)
        GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE)
        GemRB.UnhideGUI()
        GUICommonWindows.PortraitWindow = OldPortraitWindow
        OldPortraitWindow = None
        GUICommonWindows.OptionsWindow = OldOptionsWindow
        OldOptionsWindow = None
        GUICommonWindows.SetSelectionChangeHandler(None)
        return

    GemRB.HideGUI()
    GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)

    GemRB.LoadWindowPack("GUIMAP", WIDTH, HEIGHT)
    MapWindow = Window = GemRB.LoadWindow(2)
    #this window type blocks the game normally, but map window doesn't
    GemRB.SetVar("OtherWindow", MapWindow.ID)
    #saving the original portrait window
    OldPortraitWindow = GUICommonWindows.PortraitWindow
    PortraitWindow = GUICommonWindows.OpenPortraitWindow()
    OldOptionsWindow = GUICommonWindows.OptionsWindow
    OptionsWindow = GemRB.LoadWindow(0)
    GUICommonWindows.MarkMenuButton(OptionsWindow)
    GUICommonWindows.SetupMenuWindowControls(OptionsWindow, GameCheck.IsIWD2(),
                                             OpenMapWindow)
    OptionsWindow.SetFrame()

    # World Map
    Button = Window.GetControl(1)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenWorldMapWindowInside)

    # Hide or Show mapnotes
    if HasMapNotes():
        Button = Window.GetControl(3)
        Button.SetFlags(IE_GUI_BUTTON_CHECKBOX, OP_OR)
        # Is this an option?
        GemRB.SetVar("ShowMapNotes", IE_GUI_MAP_VIEW_NOTES)
        Button.SetVarAssoc("ShowMapNotes", IE_GUI_MAP_VIEW_NOTES)

        Label = Window.GetControl(0x10000003)
        Label.SetText("")

    # Map Control
    if GameCheck.IsBG2() or GameCheck.IsIWD2():
        Window.CreateMapControl(2, 0, 0, 0, 0, 0x10000003, "FLAG1")
    else:
        Window.CreateMapControl(2, 0, 0, 0, 0)
    Map = Window.GetControl(2)
    if HasMapNotes():
        Map.SetVarAssoc("ShowMapNotes", IE_GUI_MAP_VIEW_NOTES)
        Map.SetEvent(IE_GUI_MAP_ON_RIGHT_PRESS, AddNoteWindow)
    Map.SetEvent(IE_GUI_MAP_ON_DOUBLE_PRESS, LeftDoublePressMap)

    OptionsWindow.SetVisible(WINDOW_VISIBLE)
    PortraitWindow.SetVisible(WINDOW_VISIBLE)
    Window.SetVisible(WINDOW_VISIBLE)
    if HasMapNotes():
        Map.SetStatus(IE_GUI_CONTROL_FOCUSED | IE_GUI_MAP_VIEW_NOTES)
    else:
        Map.SetStatus(IE_GUI_CONTROL_FOCUSED)

    # create a button so we can map it do ESC for quit exiting
    Button = Window.CreateButton(99, 0, 0, 1, 1)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenMapWindow)
    Button.SetFlags(IE_GUI_BUTTON_CANCEL, OP_OR)

    GUICommonWindows.SetSelectionChangeHandler(None)
    return
def OpenJournalWindow ():
	global JournalWindow, OptionsWindow, PortraitWindow
	global OldPortraitWindow, OldOptionsWindow
	global StartTime, StartYear, Chapter

	if GUICommon.CloseOtherWindow (OpenJournalWindow):

		if JournalWindow:
			JournalWindow.Unload ()
		if OptionsWindow:
			OptionsWindow.Unload ()
		if PortraitWindow:
			PortraitWindow.Unload ()
		
		JournalWindow = None
		GemRB.SetVar ("OtherWindow", -1)
		GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE)
		GemRB.UnhideGUI ()
		GUICommonWindows.PortraitWindow = OldPortraitWindow
		OldPortraitWindow = None
		GUICommonWindows.OptionsWindow = OldOptionsWindow
		OldOptionsWindow = None
		GUICommonWindows.SetSelectionChangeHandler (None)
		return
		
	Table = GemRB.LoadTable("YEARS")
	#StartTime is the time offset for ingame time, beginning from the startyear
	StartTime = Table.GetValue("STARTTIME", "VALUE") / 4500
	#StartYear is the year of the lowest ingame date to be printed
	StartYear = Table.GetValue("STARTYEAR", "VALUE")

	GemRB.HideGUI ()
	GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)
	
	GemRB.LoadWindowPack ("GUIJRNL", 640, 480)
	JournalWindow = Window = GemRB.LoadWindow (2)
	GemRB.SetVar ("OtherWindow", JournalWindow.ID)
	#saving the original portrait window
	OldOptionsWindow = GUICommonWindows.OptionsWindow
	OptionsWindow = GemRB.LoadWindow (0)
	GUICommonWindows.MarkMenuButton (OptionsWindow)
	GUICommonWindows.SetupMenuWindowControls (OptionsWindow, 0, OpenJournalWindow)
	OptionsWindow.SetFrame ()
	OldPortraitWindow = GUICommonWindows.PortraitWindow
	PortraitWindow = GUICommonWindows.OpenPortraitWindow (0)
	
	Button = Window.GetControl (3)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, JournalPrevSectionPress)

	Button = Window.GetControl (4)
	Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, JournalNextSectionPress)

	Chapter = GemRB.GetGameVar("chapter")
	GemRB.SetVar("TopIndex", 0)
	GUICommonWindows.SetSelectionChangeHandler (UpdateJournalWindow)
	UpdateJournalWindow ()
	
	OptionsWindow.SetVisible (WINDOW_VISIBLE)
	Window.SetVisible (WINDOW_VISIBLE)
	PortraitWindow.SetVisible (WINDOW_VISIBLE)
	return
Exemple #12
0
def OpenOptionsWindow():
    """Open main options window"""
    import GUICommonWindows
    global GameOptionsWindow, OptionsWindow, PortraitWindow
    global OldPortraitWindow, OldOptionsWindow

    if GUICommon.CloseOtherWindow(OpenOptionsWindow):
        CloseOptionsWindow()
        return

    hideflag = GemRB.HideGUI()
    GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)

    GemRB.LoadWindowPack("GUIOPT", 640, 480)
    GameOptionsWindow = Window = GemRB.LoadWindow(2)
    GemRB.SetVar("OtherWindow", GameOptionsWindow.ID)
    #saving the original portrait window
    if OldPortraitWindow == None:
        OldOptionsWindow = GUICommonWindows.OptionsWindow
        OptionsWindow = GemRB.LoadWindow(0)
        GUICommonWindows.MarkMenuButton(OptionsWindow)
        GUICommonWindows.SetupMenuWindowControls(OptionsWindow, 0,
                                                 OpenOptionsWindow)
        OptionsWindow.SetFrame()
        OldPortraitWindow = GUICommonWindows.PortraitWindow
        PortraitWindow = GUICommonWindows.OpenPortraitWindow(0)

    # Return to Game
    Button = Window.GetControl(11)
    Button.SetText(10308)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenOptionsWindow)

    # Quit Game
    Button = Window.GetControl(10)
    Button.SetText(13731)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenQuitMsgWindow)

    # Load Game
    Button = Window.GetControl(5)
    Button.SetText(13729)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenLoadMsgWindow)

    # Save Game
    Button = Window.GetControl(6)
    Button.SetText(13730)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenSaveMsgWindow)

    # Video Options
    Button = Window.GetControl(7)
    Button.SetText(17162)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenVideoOptionsWindow)

    # Audio Options
    Button = Window.GetControl(8)
    Button.SetText(17164)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenAudioOptionsWindow)

    # Gameplay Options
    Button = Window.GetControl(9)
    Button.SetText(17165)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, OpenGameplayOptionsWindow)

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

    OptionsWindow.SetVisible(WINDOW_VISIBLE)
    Window.SetVisible(WINDOW_VISIBLE)
    PortraitWindow.SetVisible(WINDOW_VISIBLE)
    return
Exemple #13
0
def OpenPriestWindow():
    import GUICommonWindows
    global PriestWindow, OptionsWindow, PortraitWindow
    global OldPortraitWindow, OldOptionsWindow

    if GUICommon.CloseOtherWindow(OpenPriestWindow):
        if PriestWindow:
            PriestWindow.Unload()
        if OptionsWindow:
            OptionsWindow.Unload()
        if PortraitWindow:
            PortraitWindow.Unload()

        PriestWindow = None
        GemRB.SetVar("OtherWindow", -1)
        GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE)
        GemRB.UnhideGUI()
        GUICommonWindows.PortraitWindow = OldPortraitWindow
        OldPortraitWindow = None
        GUICommonWindows.OptionsWindow = OldOptionsWindow
        OldOptionsWindow = None
        GUICommonWindows.SetSelectionChangeHandler(None)
        return

    GemRB.HideGUI()
    GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE)

    GemRB.LoadWindowPack("GUIPR", 640, 480)
    PriestWindow = Window = GemRB.LoadWindow(2)
    GemRB.SetVar("OtherWindow", PriestWindow.ID)
    #saving the original portrait window
    OldOptionsWindow = GUICommonWindows.OptionsWindow
    OptionsWindow = GemRB.LoadWindow(0)
    GUICommonWindows.MarkMenuButton(OptionsWindow)
    GUICommonWindows.SetupMenuWindowControls(OptionsWindow, 0,
                                             OpenPriestWindow)
    OptionsWindow.SetFrame()
    OldPortraitWindow = GUICommonWindows.PortraitWindow
    PortraitWindow = GUICommonWindows.OpenPortraitWindow(0)

    Button = Window.GetControl(1)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, PriestPrevLevelPress)

    Button = Window.GetControl(2)
    Button.SetEvent(IE_GUI_BUTTON_ON_PRESS, PriestNextLevelPress)

    # Setup memorized spells buttons
    for i in range(12):
        Button = Window.GetControl(3 + i)
        Button.SetBorder(0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 1)
        Button.SetSprites("SPELFRAM", 0, 0, 0, 0, 0)
        Button.SetFlags(IE_GUI_BUTTON_PICTURE, OP_OR)
        Button.SetState(IE_GUI_BUTTON_LOCKED)

    # Setup book spells buttons
    for i in range(GUICommon.GetIWDSpellButtonCount()):
        Button = Window.GetControl(27 + i)
        Button.SetFlags(IE_GUI_BUTTON_NO_IMAGE, OP_OR)
        Button.SetState(IE_GUI_BUTTON_LOCKED)

    GUICommonWindows.SetSelectionChangeHandler(UpdatePriestWindow)
    UpdatePriestWindow()
    OptionsWindow.SetVisible(WINDOW_VISIBLE)
    #bringing window front
    Window.SetVisible(WINDOW_FRONT)
    PortraitWindow.SetVisible(WINDOW_VISIBLE)
    return