Skip to content
Browse files

GUIScript: decide the scrollbar resource to use by GameCheck

you can still pass a BAM resref manually if you wish to override default behavior.
fixes BG1 spell selector.
  • Loading branch information...
1 parent 979e67e commit ff580557caf2f3014b921f7bc40f5e99857c2f85 @bradallred bradallred committed Jan 20, 2014
Showing with 17 additions and 8 deletions.
  1. +15 −4 gemrb/GUIScripts/CreateControlDecorators.py
  2. +2 −4 gemrb/GUIScripts/LUSpellSelection.py
View
19 gemrb/GUIScripts/CreateControlDecorators.py
@@ -22,10 +22,21 @@
def CreateScrollBar(func):
def wrapper(win, control, *args):
- # modArgs = BAM Cycle + up, upPr, down, downPr, trough, slider
+ if len(args) < 6:
+ # append the BAM resref
+ if GameCheck.IsBG2():
+ args += ('GUISCRCW',)
+ elif GameCheck.IsPST():
+ args += ('CGSCRL1',)
+ else:
+ # this resource is in almost all games
+ # but is not the main scrollbar except in BG1
+ # probably we dont care about creating scrollbars elsewhere
+ args += ('GUIWSBR',)
+
if GameCheck.IsBG2():
- modArgs = args + (0,0,1,2,3,5,4)
+ args += (0,0,1,2,3,5,4)
else:
- modArgs = args + tuple([0] + range(6))
- return func(win, control, *modArgs)
+ args += tuple([0] + range(6))
+ return func(win, control, *args)
return wrapper
View
6 gemrb/GUIScripts/LUSpellSelection.py
@@ -102,8 +102,7 @@ def OpenSpellsWindow (actor, table, level, diff, kit=0, gen=0, recommend=True):
SpellsTextArea = SpellsWindow.GetControl (27)
SpellPointsLeftLabel = SpellsWindow.GetControl (0x1000001b)
if (EnhanceGUI):
- #FIXME: use other resources instead, this one is bg2-only
- SpellsWindow.CreateScrollBar (1000, 325,42, 16,252, "GUISCRCW")
+ SpellsWindow.CreateScrollBar (1000, 325,42, 16,252)
HideUnhideScrollBar(1)
SpellStart = 2
@@ -126,8 +125,7 @@ def OpenSpellsWindow (actor, table, level, diff, kit=0, gen=0, recommend=True):
SpellsTextArea = SpellsWindow.GetControl(26)
SpellPointsLeftLabel = SpellsWindow.GetControl (0x10000018)
if(EnhanceGUI):
- #FIXME: use other resources instead, this one is bg2-only
- SpellsWindow.CreateScrollBar (1000, 290,142, 16,252, "GUISCRCW")
+ SpellsWindow.CreateScrollBar (1000, 290,142, 16,252)
HideUnhideScrollBar(1)
#25th spell button for sorcerers
SpellsWindow.CreateButton (24, 231, 345, 42, 42)

0 comments on commit ff58055

Please sign in to comment.
Something went wrong with that request. Please try again.