From: Laszlo T. <ave...@us...> - 2006-07-04 14:31:31
|
Update of /cvsroot/gemrb/gemrb/gemrb/GUIScripts/bg1 In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv7046/GUIScripts/bg1 Modified Files: GUICommonWindows.py GUIINV.py Log Message: bg/bg2/iwd1:improved inventory screens: item transfer/quick weapon slots Button: The MouseEnter/Leave functions will set the associated variable Index: GUICommonWindows.py =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/GUIScripts/bg1/GUICommonWindows.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** GUICommonWindows.py 29 Jun 2006 06:56:44 -0000 1.11 --- GUICommonWindows.py 4 Jul 2006 14:31:27 -0000 1.12 *************** *** 31,52 **** FRAME_PC_TARGET = 1 - # Buttons: - # 0 CNTREACH - # 1 INVNT - # 2 MAP - # 3 MAGE - # 4 AI - # 5 STATS - # 6 JRNL - # 7 PRIEST - # 8 OPTION - # 9 REST - # 10 TXTE - OptionsWindow = None - def ReturnToGame (): - print "returntogame" - def SetupMenuWindowControls (Window, Gears, ReturnToGame): global OptionsWindow --- 31,36 ---- *************** *** 178,181 **** --- 162,166 ---- Button = GemRB.GetControl (Window, 3) GemRB.SetActionIcon (Window, Button, -1) + Button = GemRB.GetControl (Window, 4) GemRB.SetActionIcon (Window, Button, -1) *************** *** 198,205 **** return - def SetupControls (pc): - EmptyControls() - return - def OpenActionsWindowControls (Window): global ActionsWindow --- 183,186 ---- *************** *** 217,220 **** --- 198,207 ---- global ActionsWindow + if ActionsWindow == -1: + return + + if ActionsWindow == None: + return + pc = 0 for i in range (PARTY_SIZE): *************** *** 226,229 **** --- 213,220 ---- break + for i in range (12): + Button = GemRB.GetControl (ActionsWindow, i) + GemRB.SetButtonBorder (ActionsWindow, Button, 0,6,6,4,4,0,254,0,255) + if pc == 0: EmptyControls () *************** *** 232,236 **** GroupControls () return ! SetupControls (pc) return --- 223,228 ---- GroupControls () return ! #this is based on class ! GemRB.SetupControls (ActionsWindow, pc) return *************** *** 244,247 **** --- 236,264 ---- GemRB.GameControlSetTargetMode (TARGET_MODE_ALL | TARGET_MODE_ATTACK) + def ActionQWeaponPressed (which): + pc = GemRB.GameGetFirstSelectedPC() + + if GemRB.GetEquippedQuickSlot(pc)==which and not (GemRB.GameControlGetTargetMode() &TARGET_MODE_ATTACK): + GemRB.GameControlSetTargetMode (TARGET_MODE_ALL | TARGET_MODE_ATTACK) + else: + GemRB.GameControlSetTargetMode (TARGET_MODE_ALL) + GemRB.SetEquippedQuickSlot(pc, which) + + GemRB.SetupControls (ActionsWindow, pc) + UpdateActionsWindow () + return + + def ActionQWeapon1Pressed (): + ActionQWeaponPressed(0) + + def ActionQWeapon2Pressed (): + ActionQWeaponPressed(1) + + def ActionQWeapon3Pressed (): + ActionQWeaponPressed(2) + + def ActionQWeapon4Pressed (): + ActionQWeaponPressed(3) + def ActionStopPressed (): for i in range (PARTY_SIZE): *************** *** 250,257 **** return def GetActorClassTitle (actor): ClassTitle = GemRB.GetPlayerStat (actor, IE_TITLE1) ! #KitIndex = GemRB.GetPlayerStat (actor, IE_KIT) & 0xfff ! KitIndex = 0 Class = GemRB.GetPlayerStat (actor, IE_CLASS) ClassTable = GemRB.LoadTable ("classes") --- 267,286 ---- return + def RefreshUseItemWindow (): + pc = GemRB.GameGetFirstSelectedPC() + print "setting up useitem window topindex:",TopIndex + GemRB.SetupEquipmentIcons(ActionsWindow, pc, TopIndex) + return + + def ActionUseItemPressed (): + global TopIndex + + TopIndex = 0 + RefreshUseItemWindow() + return + def GetActorClassTitle (actor): ClassTitle = GemRB.GetPlayerStat (actor, IE_TITLE1) ! KitIndex = GemRB.GetPlayerStat (actor, IE_KIT) & 0xfff Class = GemRB.GetPlayerStat (actor, IE_CLASS) ClassTable = GemRB.LoadTable ("classes") *************** *** 283,288 **** # Switching from walking to non-walking environment: ! # set the first selected PC in walking env as a selected ! # in nonwalking env if (not SelectionChangeHandler) and handler: sel = GemRB.GameGetFirstSelectedPC () --- 312,317 ---- # Switching from walking to non-walking environment: ! # set the first selected PC in walking env as a selected ! # in nonwalking env if (not SelectionChangeHandler) and handler: sel = GemRB.GameGetFirstSelectedPC () *************** *** 311,318 **** GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "PortraitButtonOnPress") GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_SHIFT_PRESS, "PortraitButtonOnShiftPress") - #GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_DRAG_DROP, "PortraitButtonOnDragDrop") GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_DRAG_DROP, "OnDropItemToPC") ! #GemRB.SetEvent (Window, Button, IE_GUI_MOUSE_ENTER_BUTTON, "PortraitButtonOnMouseOver") ! #GemRB.SetEvent (Window, Button, IE_GUI_MOUSE_LEAVE_BUTTON, "PortraitButtonOnMouseLeave") GemRB.SetButtonBorder (Window, Button, FRAME_PC_SELECTED, 1, 1, 2, 2, 0, 255, 0, 255) --- 340,346 ---- GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "PortraitButtonOnPress") GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_SHIFT_PRESS, "PortraitButtonOnShiftPress") GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_DRAG_DROP, "OnDropItemToPC") ! GemRB.SetEvent (Window, Button, IE_GUI_MOUSE_ENTER_BUTTON, "PortraitButtonOnMouseOver") ! GemRB.SetEvent (Window, Button, IE_GUI_MOUSE_LEAVE_BUTTON, "PortraitButtonOnMouseLeave") GemRB.SetButtonBorder (Window, Button, FRAME_PC_SELECTED, 1, 1, 2, 2, 0, 255, 0, 255) *************** *** 338,342 **** GemRB.SetButtonFont (Window, Button, 'TOOLFONT') ! GemRB.SetVarAssoc (Window, Button, 'PressedPortrait', i) hp = GemRB.GetPlayerStat (i+1, IE_HITPOINTS) --- 366,370 ---- GemRB.SetButtonFont (Window, Button, 'TOOLFONT') ! GemRB.SetVarAssoc (Window, Button, "PressedPortrait", i) hp = GemRB.GetPlayerStat (i+1, IE_HITPOINTS) *************** *** 362,369 **** SelectionChanged () RunSelectionChangeHandler () ! def PortraitButtonOnShiftPress (): ! i = GemRB.GetVar ('PressedPortrait') if (not SelectionChangeHandler): --- 390,397 ---- SelectionChanged () RunSelectionChangeHandler () ! return def PortraitButtonOnShiftPress (): ! i = GemRB.GetVar ("PressedPortrait") if (not SelectionChangeHandler): *************** *** 375,392 **** SelectionChanged () RunSelectionChangeHandler () ! def SelectAllOnPress (): GemRB.GameSelectPC (0, 1) ! # Run by Game class when selection was changed def SelectionChanged (): ! global ActionsWindow - # FIXME: hack. If defined, display single selection if (not SelectionChangeHandler): ! if (ActionsWindow!=-1): ! UpdateActionsWindow () for i in range (PARTY_SIZE): Button = GemRB.GetControl (PortraitWindow, i) --- 403,418 ---- SelectionChanged () RunSelectionChangeHandler () ! return def SelectAllOnPress (): GemRB.GameSelectPC (0, 1) ! return # Run by Game class when selection was changed def SelectionChanged (): ! global PortraitWindow if (not SelectionChangeHandler): ! UpdateActionsWindow () for i in range (PARTY_SIZE): Button = GemRB.GetControl (PortraitWindow, i) *************** *** 394,408 **** else: sel = GemRB.GameGetSelectedPCSingle () for i in range (PARTY_SIZE): Button = GemRB.GetControl (PortraitWindow, i) GemRB.EnableButtonBorder (PortraitWindow, Button, FRAME_PC_SELECTED, i + 1 == sel) ! ! def PortraitButtonOnDragDrop (): ! i = GemRB.GetVar ('PressedPortrait') ! print "DragDrop" ! ! def PortraitButtonOnMouseOver (): ! i = GemRB.GetVar ('PressedPortrait') if GemRB.IsDraggingItem (): Button = GemRB.GetControl (PortraitWindow, i) --- 420,431 ---- else: sel = GemRB.GameGetSelectedPCSingle () + for i in range (PARTY_SIZE): Button = GemRB.GetControl (PortraitWindow, i) GemRB.EnableButtonBorder (PortraitWindow, Button, FRAME_PC_SELECTED, i + 1 == sel) + return ! def PortraitButtonOnMouseEnter (): ! i = GemRB.GetVar ("PressedPortrait") if GemRB.IsDraggingItem (): Button = GemRB.GetControl (PortraitWindow, i) *************** *** 410,418 **** def PortraitButtonOnMouseLeave (): ! i = GemRB.GetVar ('PressedPortrait') ! if GemRB.IsDraggingItem (): ! Button = GemRB.GetControl (PortraitWindow, i) ! GemRB.EnableButtonBorder (PortraitWindow, Button, FRAME_PC_TARGET, 0) ! def GetSavingThrow (SaveName, row, level): --- 433,439 ---- def PortraitButtonOnMouseLeave (): ! i = GemRB.GetVar ("PressedPortrait") ! Button = GemRB.GetControl (PortraitWindow, i) ! GemRB.EnableButtonBorder (PortraitWindow, Button, FRAME_PC_TARGET, 0) def GetSavingThrow (SaveName, row, level): *************** *** 441,449 **** Class = GemRB.FindTableValue (ClassTable, 5, 4) SaveName2 = GemRB.GetTableValue (ClassTable, Class, 3) ! Class = 0 #fighter ! print "SaveName2", SaveName2 SaveName1 = GemRB.GetTableValue (ClassTable, Class, 3) - print "SaveName1", SaveName1 for row in range (5): --- 462,468 ---- Class = GemRB.FindTableValue (ClassTable, 5, 4) SaveName2 = GemRB.GetTableValue (ClassTable, Class, 3) ! Class = 0 #fighter SaveName1 = GemRB.GetTableValue (ClassTable, Class, 3) for row in range (5): *************** *** 454,458 **** tmp1=tmp2 GemRB.SetPlayerStat (pc, IE_SAVEVSDEATH+row, tmp1) - print "Savingthrow:", tmp1 return --- 473,476 ---- Index: GUIINV.py =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/GUIScripts/bg1/GUIINV.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GUIINV.py 3 Jul 2006 16:29:16 -0000 1.10 --- GUIINV.py 4 Jul 2006 14:31:27 -0000 1.11 *************** *** 295,299 **** Window = InventoryWindow ! SlotType = GemRB.GetSlotType (slot+1) if not SlotType["ID"]: return --- 295,299 ---- Window = InventoryWindow ! SlotType = GemRB.GetSlotType (slot+1, pc) if not SlotType["ID"]: return *************** *** 303,306 **** --- 303,307 ---- GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_DRAG_DROP, "OnDragItem") + GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_NAND) if slot_item: item = GemRB.GetItem (slot_item["ItemResRef"]) *************** *** 324,330 **** GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_SHIFT_PRESS, "OpenItemAmountWindow") else: - if SlotType["ResRef"]=="*": GemRB.SetButtonBAM (Window, Button, "",0,0,0) else: GemRB.SetButtonBAM (Window, Button, SlotType["ResRef"],0,0,0) --- 325,333 ---- GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_SHIFT_PRESS, "OpenItemAmountWindow") else: if SlotType["ResRef"]=="*": GemRB.SetButtonBAM (Window, Button, "",0,0,0) + elif SlotType["ResRef"]=="": + GemRB.SetButtonBAM (Window, Button, "",0,0,0) + GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_OR) else: GemRB.SetButtonBAM (Window, Button, SlotType["ResRef"],0,0,0) |