From: Laszlo T. <ave...@us...> - 2005-05-21 14:17:48
|
Update of /cvsroot/gemrb/gemrb/gemrb/GUIScripts/tob In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24767/GUIScripts/tob Modified Files: GUIWORLD.py Log Message: Completed Container implementation (PC inventory ground items still have to be completed) Index: GUIWORLD.py =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/GUIScripts/tob/GUIWORLD.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** GUIWORLD.py 20 May 2005 12:43:07 -0000 1.8 --- GUIWORLD.py 21 May 2005 14:17:39 -0000 1.9 *************** *** 35,38 **** --- 35,39 ---- ReformPartyWindow = None OldActionsWindow = None + OldMessageWindow = None Container = None *************** *** 40,43 **** --- 41,46 ---- global ContinueWindow, OldActionsWindow + if ContinueWindow == None: + return GemRB.UnloadWindow (ContinueWindow) GemRB.SetVar ("ActionsWindow", OldActionsWindow) *************** *** 47,51 **** ! def OpenEndDialogWindow (): global ContinueWindow, OldActionsWindow --- 50,54 ---- ! def OpenEndMessageWindow (): global ContinueWindow, OldActionsWindow *************** *** 57,61 **** GemRB.LoadWindowPack (GetWindowPack()) ContinueWindow = Window = GemRB.LoadWindow (9) ! OldActionsWindow = GemRB.GetVar("ActionsWindow") GemRB.SetVar ("ActionsWindow", Window) --- 60,64 ---- GemRB.LoadWindowPack (GetWindowPack()) ContinueWindow = Window = GemRB.LoadWindow (9) ! OldActionsWindow = GemRB.GetVar ("ActionsWindow") GemRB.SetVar ("ActionsWindow", Window) *************** *** 68,72 **** GemRB.UnhideGUI () ! def OpenContinueDialogWindow (): global ContinueWindow, OldActionsWindow --- 71,75 ---- GemRB.UnhideGUI () ! def OpenContinueMessageWindow (): global ContinueWindow, OldActionsWindow *************** *** 78,82 **** GemRB.LoadWindowPack (GetWindowPack()) ContinueWindow = Window = GemRB.LoadWindow (9) ! OldActionsWindow = GemRB.GetVar("ActionsWindow") GemRB.SetVar ("ActionsWindow", Window) --- 81,85 ---- GemRB.LoadWindowPack (GetWindowPack()) ContinueWindow = Window = GemRB.LoadWindow (9) ! OldActionsWindow = GemRB.GetVar ("ActionsWindow") GemRB.SetVar ("ActionsWindow", Window) *************** *** 91,95 **** def CloseContainerWindow (): ! global OldActionsWindow, ContainerWindow GemRB.HideGUI () --- 94,101 ---- def CloseContainerWindow (): ! global OldActionsWindow, OldMessageWindow, ContainerWindow ! ! if ContainerWindow == None: ! return GemRB.HideGUI () *************** *** 98,101 **** --- 104,108 ---- ContainerWindow = None GemRB.SetVar ("ActionsWindow", OldActionsWindow) + GemRB.SetVar ("MessageWindow", OldMessageWindow) Table = GemRB.LoadTable ("containr") row = Container['Type'] *************** *** 107,110 **** --- 114,118 ---- #it is enough to close here GemRB.UnloadTable (Table) + GemRB.UnhideGUI () *************** *** 119,123 **** pc = GemRB.GameGetFirstSelectedPC () ! inventory_slots = GemRB.GetSlots (pc, -1) RightCount = len(inventory_slots) ScrollBar = GemRB.GetControl (Window, 53) --- 127,131 ---- pc = GemRB.GameGetFirstSelectedPC () ! inventory_slots = GemRB.GetSlots (pc, 0x8000) RightCount = len(inventory_slots) ScrollBar = GemRB.GetControl (Window, 53) *************** *** 128,131 **** --- 136,140 ---- def RedrawContainerWindow (): Window = ContainerWindow + LeftTopIndex = GemRB.GetVar ("LeftTopIndex") LeftIndex = GemRB.GetVar ("LeftIndex") *************** *** 134,138 **** LeftCount = Container['ItemCount'] pc = GemRB.GameGetFirstSelectedPC () ! inventory_slots = GemRB.GetSlots (pc, -1) RightCount = len(inventory_slots) --- 143,147 ---- LeftCount = Container['ItemCount'] pc = GemRB.GameGetFirstSelectedPC () ! inventory_slots = GemRB.GetSlots (pc, 0x8000) RightCount = len(inventory_slots) *************** *** 169,173 **** else: GemRB.SetVarAssoc (Window, Button, "RightIndex", -1) - GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_DISABLED) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_NAND) GemRB.SetTooltip (Window, Button, "") --- 178,181 ---- *************** *** 175,179 **** def OpenContainerWindow (): ! global OldActionsWindow, ContainerWindow, Container if ContainerWindow: --- 183,188 ---- def OpenContainerWindow (): ! global OldActionsWindow, OldMessageWindow ! global ContainerWindow, Container if ContainerWindow: *************** *** 185,189 **** --- 194,200 ---- ContainerWindow = Window = GemRB.LoadWindow (8) OldActionsWindow = GemRB.GetVar ("ActionsWindow") + OldMessageWindow = GemRB.GetVar ("MessageWindow") GemRB.SetVar ("ActionsWindow", Window) + GemRB.SetVar ("MessageWindow", -1) pc = GemRB.GameGetFirstSelectedPC() *************** *** 245,254 **** Button = GemRB.GetControl (Window, 51) GemRB.SetText (Window, Button, 1403) ! GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "CloseContainerWindow") UpdateContainerWindow () GemRB.UnhideGUI () def OpenReformPartyWindow (): global ReformPartyWindow --- 256,293 ---- Button = GemRB.GetControl (Window, 51) GemRB.SetText (Window, Button, 1403) ! GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "LeaveContainer") UpdateContainerWindow () GemRB.UnhideGUI () + + #doing this way it will inform the core system too, which in turn will call + #CloseContainerWindow () + def LeaveContainer (): + GemRB.LeaveContainer() + + def DropItemContainer (): + RightTopIndex = GemRB.GetVar ("RightTopIndex") + RightIndex = GemRB.GetVar ("RightIndex") + if RightIndex<0: + return + #we need to get the right slot number + pc = GemRB.GameGetFirstSelectedPC () + inventory_slots = GemRB.GetSlots (pc, 0x8000) + GemRB.ChangeContainerItem (0, inventory_slots[RightTopIndex+RightIndex], 0) + UpdateContainerWindow () + + + def TakeItemContainer (): + LeftTopIndex = GemRB.GetVar ("LeftTopIndex") + LeftIndex = GemRB.GetVar ("LeftIndex") + if LeftIndex<0: + return + + GemRB.ChangeContainerItem (0, LeftTopIndex+LeftIndex, 1) + UpdateContainerWindow () + + def OpenReformPartyWindow (): global ReformPartyWindow |