From: Laszlo T. <ave...@us...> - 2005-05-25 18:56:36
|
Update of /cvsroot/gemrb/gemrb/gemrb/GUIScripts/bg2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11153/GUIScripts/bg2 Modified Files: GUIINV.py GUIWORLD.py Log Message: GetContainer creates empty container if required LeaveContainer removes empty groundpiles Index: GUIINV.py =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/GUIScripts/bg2/GUIINV.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** GUIINV.py 18 May 2005 15:37:09 -0000 1.20 --- GUIINV.py 25 May 2005 18:55:53 -0000 1.21 *************** *** 75,79 **** Button = GemRB.GetControl (Window, i) GemRB.SetTooltip (Window, Button, 12011) ! #major & minor clothing color Button = GemRB.GetControl (Window, 62) --- 75,83 ---- Button = GemRB.GetControl (Window, i) GemRB.SetTooltip (Window, Button, 12011) ! ! # ground items scrollbar ! ScrollBar = GemRB.GetControl (Window, 66) ! GemRB.SetEvent (Window, ScrollBar, IE_GUI_SCROLLBAR_ON_CHANGE, "RefreshInventoryWindow") ! #major & minor clothing color Button = GemRB.GetControl (Window, 62) *************** *** 105,111 **** Label = GemRB.GetControl (Window, 0x1000003a) - #ground icons scrollbar - ScrollBar = GemRB.GetControl (Window, 66) - #info label, game paused, etc Label = GemRB.GetControl (Window, 0x1000003f) --- 109,112 ---- *************** *** 190,198 **** return ! def UpdateInventoryWindow (): Window = InventoryWindow pc = GemRB.GameGetSelectedPCSingle () # name --- 191,209 ---- return ! #complete update def UpdateInventoryWindow (): Window = InventoryWindow pc = GemRB.GameGetSelectedPCSingle () + Container = GemRB.GetContainer (pc, 1) + ScrollBar = GemRB.GetControl (Window, 66) + GemRB.SetVarAssoc (Window, ScrollBar, "TopIndex", Container['ItemCount']) + RefreshInventoryWindow() + + #partial update without altering TopIndex + def RefreshInventoryWindow (): + Window = InventoryWindow + + pc = GemRB.GameGetSelectedPCSingle () # name *************** *** 247,250 **** --- 258,274 ---- GemRB.SetButtonBAM(Window, Button, "COLGRAD", 0, 0, Color) + # update ground inventory slots + Container = GemRB.GetContainer(pc, 1) + TopIndex = GemRB.GetVar("TopIndex") + for i in range (5): + Button = GemRB.GetControl (Window, i+68) + Slot = GemRB.GetContainerItem (pc, i+TopIndex) + if Slot != None: + Item = GemRB.GetItem (Slot['ItemResRef']) + GemRB.SetItemIcon (Window, Button, Slot['ItemResRef'],0) + GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_OR) + else: + GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE, OP_NAND) + # populate inventory slot controls for i in range (38): Index: GUIWORLD.py =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/GUIScripts/bg2/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 25 May 2005 18:55:53 -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 |