From: Jaka K. <lyn...@us...> - 2012-08-13 22:12:44
|
gemrb: Infinity Engine emulator The branch master has been updated via fd4384028530682eb5eb2c9adc00964d4bf4f6f7 (commit) via 3d399a433e89fad64f9aeeef0ba506917f478719 (commit) Summary of changes: gemrb/GUIScripts/GUICommon.py | 10 ++++++++++ gemrb/GUIScripts/InventoryCommon.py | 3 +++ gemrb/GUIScripts/bg1/GUIINV.py | 5 +---- gemrb/GUIScripts/bg1/GUIMG.py | 7 ++----- gemrb/GUIScripts/bg1/GUIPR.py | 5 +---- gemrb/GUIScripts/bg2/GUIINV.py | 5 +---- gemrb/GUIScripts/bg2/GUIMG.py | 7 ++----- gemrb/GUIScripts/bg2/GUIPR.py | 5 +---- gemrb/GUIScripts/ie_stats.py | 1 + gemrb/GUIScripts/iwd/GUIINV.py | 5 +---- gemrb/GUIScripts/iwd/GUIMG.py | 7 ++----- gemrb/GUIScripts/iwd/GUIPR.py | 5 +---- gemrb/GUIScripts/iwd2/GUIINV.py | 5 +---- gemrb/GUIScripts/iwd2/GUISPL.py | 5 +---- gemrb/GUIScripts/pst/GUIINV.py | 5 +---- gemrb/GUIScripts/pst/GUIMG.py | 8 +++----- gemrb/GUIScripts/pst/GUIPR.py | 5 +---- 17 files changed, 33 insertions(+), 60 deletions(-) from ef97e94519970833b81f958b0af645ddb665269c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=fd4384028530682eb5eb2c9adc00964d4bf4f6f7 commit fd4384028530682eb5eb2c9adc00964d4bf4f6f7 Author: Jaka Kranjc <lyn...@us...> Date: Tue Aug 14 00:07:33 2012 +0200 also grey out windows when berserking which also prevents further mucking around in the inventory diff --git a/gemrb/GUIScripts/GUICommon.py b/gemrb/GUIScripts/GUICommon.py index cacdf07..2a842f8 100644 --- a/gemrb/GUIScripts/GUICommon.py +++ b/gemrb/GUIScripts/GUICommon.py @@ -785,10 +785,10 @@ def SetCurrentDateTokens (stat): return (days, hours) # gray out window or mark it as visible depending on the actor's state -# Always greys it out for dead actors +# Always greys it out for actors that are: dead, berserking # The third parameter is another check which must be 0 to maintain window visibility def AdjustWindowVisibility (Window, pc, additionalCheck): - if additionalCheck or GemRB.GetPlayerStat (pc, IE_STATE_ID) & STATE_DEAD: + if additionalCheck or GemRB.GetPlayerStat (pc, IE_STATE_ID) & (STATE_DEAD|STATE_BERSERK): Window.SetVisible (WINDOW_GRAYED) else: Window.SetVisible (WINDOW_VISIBLE) diff --git a/gemrb/GUIScripts/InventoryCommon.py b/gemrb/GUIScripts/InventoryCommon.py index 27f7815..b6dcd37 100644 --- a/gemrb/GUIScripts/InventoryCommon.py +++ b/gemrb/GUIScripts/InventoryCommon.py @@ -114,6 +114,9 @@ def OnDragItem (): GemRB.LeaveStore() GemRB.DropDraggedItem (pc, slot) + # drop item if it caused us to disable the inventory view (example: cursed berserking sword) + if GemRB.GetPlayerStat (pc, IE_STATE_ID) & (STATE_BERSERK) and GemRB.IsDraggingItem (): + GemRB.DropDraggedItem (pc, -3) GUIINV.UpdateInventoryWindow () return diff --git a/gemrb/GUIScripts/ie_stats.py b/gemrb/GUIScripts/ie_stats.py index 7eb5f43..6eb4461 100644 --- a/gemrb/GUIScripts/ie_stats.py +++ b/gemrb/GUIScripts/ie_stats.py @@ -43,6 +43,7 @@ CHARMEDPC = 254 ENEMY = 255 # state bits (IE_STATE) +STATE_BERSERK = 2 STATE_PANIC = 4 STATE_HELPLESS = 1 + 32 STATE_PETRIFIED = 8 + 64 + 128 http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=3d399a433e89fad64f9aeeef0ba506917f478719 commit 3d399a433e89fad64f9aeeef0ba506917f478719 Author: Jaka Kranjc <lyn...@us...> Date: Mon Aug 13 23:02:54 2012 +0200 guiscripts: externalised window visibility adjustment vs. state diff --git a/gemrb/GUIScripts/GUICommon.py b/gemrb/GUIScripts/GUICommon.py index e1ff92b..cacdf07 100644 --- a/gemrb/GUIScripts/GUICommon.py +++ b/gemrb/GUIScripts/GUICommon.py @@ -784,6 +784,16 @@ def SetCurrentDateTokens (stat): return (days, hours) +# gray out window or mark it as visible depending on the actor's state +# Always greys it out for dead actors +# The third parameter is another check which must be 0 to maintain window visibility +def AdjustWindowVisibility (Window, pc, additionalCheck): + if additionalCheck or GemRB.GetPlayerStat (pc, IE_STATE_ID) & STATE_DEAD: + Window.SetVisible (WINDOW_GRAYED) + else: + Window.SetVisible (WINDOW_VISIBLE) + return + # return ceil(n/d) # def ceildiv (n, d): diff --git a/gemrb/GUIScripts/bg1/GUIINV.py b/gemrb/GUIScripts/bg1/GUIINV.py index 10280de..de44f98 100644 --- a/gemrb/GUIScripts/bg1/GUIINV.py +++ b/gemrb/GUIScripts/bg1/GUIINV.py @@ -308,10 +308,7 @@ def RefreshInventoryWindow (): #making window visible/shaded depending on the pc's state held = GemRB.GetPlayerStat (pc, IE_HELD) + GemRB.GetPlayerStat (pc, IE_CASTERHOLD) - if held == 0 and GemRB.GetPlayerStat (pc, IE_STATE_ID) & STATE_DEAD == 0: - Window.SetVisible (WINDOW_VISIBLE) - else: - Window.SetVisible (WINDOW_GRAYED) + GUICommon.AdjustWindowVisibility (Window, pc, held) return ################################################### diff --git a/gemrb/GUIScripts/bg1/GUIMG.py b/gemrb/GUIScripts/bg1/GUIMG.py index 754bff2..3e47cdf 100644 --- a/gemrb/GUIScripts/bg1/GUIMG.py +++ b/gemrb/GUIScripts/bg1/GUIMG.py @@ -183,11 +183,8 @@ def UpdateMageWindow (): Button.SetTooltip ('') Button.EnableBorder (0, 0) - if (CommonTables.ClassSkills.GetValue (GemRB.GetPlayerStat (pc, IE_CLASS), 2)=="*") or \ - GemRB.GetPlayerStat (pc, IE_STATE_ID) & STATE_DEAD: - Window.SetVisible (WINDOW_GRAYED) - else: - Window.SetVisible (WINDOW_VISIBLE) + CantCast = CommonTables.ClassSkills.GetValue (GemRB.GetPlayerStat (pc, IE_CLASS), 2) == "*" + GUICommon.AdjustWindowVisibility (Window, pc, CantCast) return def MagePrevLevelPress (): diff --git a/gemrb/GUIScripts/bg1/GUIPR.py b/gemrb/GUIScripts/bg1/GUIPR.py index 0d1eb18..b4e2f2e 100644 --- a/gemrb/GUIScripts/bg1/GUIPR.py +++ b/gemrb/GUIScripts/bg1/GUIPR.py @@ -191,10 +191,7 @@ def UpdatePriestWindow (): # also check the DRUIDSPELL column DivineCaster = CommonTables.ClassSkills.GetValue (Class, 0) CantCast = DivineCaster == "*" or GemRB.GetPlayerStat(pc, IE_DISABLEDBUTTON)&(1<<ACT_CAST) - if CantCast or GemRB.GetPlayerStat (pc, IE_STATE_ID) & STATE_DEAD: - Window.SetVisible (WINDOW_GRAYED) - else: - Window.SetVisible (WINDOW_VISIBLE) + GUICommon.AdjustWindowVisibility (Window, pc, CantCast) return def PriestPrevLevelPress (): diff --git a/gemrb/GUIScripts/bg2/GUIINV.py b/gemrb/GUIScripts/bg2/GUIINV.py index 633584b..f0e2383 100644 --- a/gemrb/GUIScripts/bg2/GUIINV.py +++ b/gemrb/GUIScripts/bg2/GUIINV.py @@ -308,10 +308,7 @@ def RefreshInventoryWindow (): #making window visible/shaded depending on the pc's state held = GemRB.GetPlayerStat (pc, IE_HELD) + GemRB.GetPlayerStat (pc, IE_CASTERHOLD) - if held or GemRB.GetPlayerStat (pc, IE_STATE_ID) & STATE_DEAD: - Window.SetVisible (WINDOW_GRAYED) - else: - Window.SetVisible (WINDOW_VISIBLE) + GUICommon.AdjustWindowVisibility (Window, pc, held) return ################################################### diff --git a/gemrb/GUIScripts/bg2/GUIMG.py b/gemrb/GUIScripts/bg2/GUIMG.py index 7c7ee74..f73efa3 100644 --- a/gemrb/GUIScripts/bg2/GUIMG.py +++ b/gemrb/GUIScripts/bg2/GUIMG.py @@ -228,11 +228,8 @@ def UpdateMageWindow (): Button.SetTooltip ('') Button.EnableBorder (0, 0) - if (CommonTables.ClassSkills.GetValue (GemRB.GetPlayerStat (pc, IE_CLASS), 2)=="*") or \ - GemRB.GetPlayerStat (pc, IE_STATE_ID) & STATE_DEAD: - Window.SetVisible (WINDOW_GRAYED) - else: - Window.SetVisible (WINDOW_VISIBLE) + CantCast = CommonTables.ClassSkills.GetValue (GemRB.GetPlayerStat (pc, IE_CLASS), 2) == "*" + GUICommon.AdjustWindowVisibility (Window, pc, CantCast) return def MagePrevLevelPress (): diff --git a/gemrb/GUIScripts/bg2/GUIPR.py b/gemrb/GUIScripts/bg2/GUIPR.py index aa56c42..4b263f5 100644 --- a/gemrb/GUIScripts/bg2/GUIPR.py +++ b/gemrb/GUIScripts/bg2/GUIPR.py @@ -189,10 +189,7 @@ def UpdatePriestWindow (): # also check the DRUIDSPELL column DivineCaster = CommonTables.ClassSkills.GetValue (Class, 0) CantCast = DivineCaster == "*" or GemRB.GetPlayerStat(pc, IE_DISABLEDBUTTON)&(1<<ACT_CAST) - if CantCast or GemRB.GetPlayerStat (pc, IE_STATE_ID) & STATE_DEAD: - Window.SetVisible (WINDOW_GRAYED) - else: - Window.SetVisible (WINDOW_VISIBLE) + GUICommon.AdjustWindowVisibility (Window, pc, CantCast) return def PriestPrevLevelPress (): diff --git a/gemrb/GUIScripts/iwd/GUIINV.py b/gemrb/GUIScripts/iwd/GUIINV.py index 01b8f43..1722f76 100644 --- a/gemrb/GUIScripts/iwd/GUIINV.py +++ b/gemrb/GUIScripts/iwd/GUIINV.py @@ -293,10 +293,7 @@ def RefreshInventoryWindow (): #making window visible/shaded depending on the pc's state held = GemRB.GetPlayerStat (pc, IE_HELD) + GemRB.GetPlayerStat (pc, IE_CASTERHOLD) - if held or GemRB.GetPlayerStat (pc, IE_STATE_ID) & STATE_DEAD: - Window.SetVisible (WINDOW_GRAYED) - else: - Window.SetVisible (WINDOW_VISIBLE) + GUICommon.AdjustWindowVisibility (Window, pc, held) return ################################################### diff --git a/gemrb/GUIScripts/iwd/GUIMG.py b/gemrb/GUIScripts/iwd/GUIMG.py index 49d44d3..3a511d8 100644 --- a/gemrb/GUIScripts/iwd/GUIMG.py +++ b/gemrb/GUIScripts/iwd/GUIMG.py @@ -185,11 +185,8 @@ def UpdateMageWindow (): Button.SetTooltip ('') Button.EnableBorder (0, 0) - if (CommonTables.ClassSkills.GetValue (GemRB.GetPlayerStat (pc, IE_CLASS), 2)=="*") or \ - GemRB.GetPlayerStat (pc, IE_STATE_ID) & STATE_DEAD: - Window.SetVisible (WINDOW_GRAYED) - else: - Window.SetVisible (WINDOW_VISIBLE) + CantCast = CommonTables.ClassSkills.GetValue (GemRB.GetPlayerStat (pc, IE_CLASS), 2) == "*" + GUICommon.AdjustWindowVisibility (Window, pc, CantCast) return def MagePrevLevelPress (): diff --git a/gemrb/GUIScripts/iwd/GUIPR.py b/gemrb/GUIScripts/iwd/GUIPR.py index 9138e1c..26f98d8 100644 --- a/gemrb/GUIScripts/iwd/GUIPR.py +++ b/gemrb/GUIScripts/iwd/GUIPR.py @@ -181,10 +181,7 @@ def UpdatePriestWindow (): # also check the DRUIDSPELL column DivineCaster = CommonTables.ClassSkills.GetValue (Class, 0) CantCast = DivineCaster == "*" or GemRB.GetPlayerStat(pc, IE_DISABLEDBUTTON)&(1<<ACT_CAST) - if CantCast or GemRB.GetPlayerStat (pc, IE_STATE_ID) & STATE_DEAD: - Window.SetVisible (WINDOW_GRAYED) - else: - Window.SetVisible (WINDOW_VISIBLE) + GUICommon.AdjustWindowVisibility (Window, pc, CantCast) return def PriestPrevLevelPress (): diff --git a/gemrb/GUIScripts/iwd2/GUIINV.py b/gemrb/GUIScripts/iwd2/GUIINV.py index 093a97b..b104624 100644 --- a/gemrb/GUIScripts/iwd2/GUIINV.py +++ b/gemrb/GUIScripts/iwd2/GUIINV.py @@ -306,10 +306,7 @@ def RefreshInventoryWindow (): #if actor is uncontrollable, make this grayed held = GemRB.GetPlayerStat (pc, IE_HELD) + GemRB.GetPlayerStat (pc, IE_CASTERHOLD) - if held or GemRB.GetPlayerStat (pc, IE_STATE_ID) & STATE_DEAD: - Window.SetVisible (WINDOW_GRAYED) - else: - Window.SetVisible (WINDOW_VISIBLE) + GUICommon.AdjustWindowVisibility (Window, pc, held) PortraitWindow.SetVisible (WINDOW_VISIBLE) OptionsWindow.SetVisible (WINDOW_VISIBLE) return diff --git a/gemrb/GUIScripts/iwd2/GUISPL.py b/gemrb/GUIScripts/iwd2/GUISPL.py index 203acd4..6ee101a 100644 --- a/gemrb/GUIScripts/iwd2/GUISPL.py +++ b/gemrb/GUIScripts/iwd2/GUISPL.py @@ -219,10 +219,7 @@ def UpdateSpellBookWindow (): #if actor is uncontrollable, make this grayed CantCast = GemRB.GetPlayerStat(pc, IE_DISABLEDBUTTON)&(1<<ACT_CAST) - if CantCast or GemRB.GetPlayerStat (pc, IE_STATE_ID) & STATE_DEAD: - Window.SetVisible (WINDOW_GRAYED) - else: - Window.SetVisible (WINDOW_VISIBLE) + GUICommon.AdjustWindowVisibility (Window, pc, CantCast) PortraitWindow.SetVisible (WINDOW_VISIBLE) OptionsWindow.SetVisible (WINDOW_VISIBLE) diff --git a/gemrb/GUIScripts/pst/GUIINV.py b/gemrb/GUIScripts/pst/GUIINV.py index d3b6843..860bab5 100644 --- a/gemrb/GUIScripts/pst/GUIINV.py +++ b/gemrb/GUIScripts/pst/GUIINV.py @@ -217,10 +217,7 @@ def RefreshInventoryWindow (): Label.SetText (text) held = GemRB.GetPlayerStat (pc, IE_HELD) + GemRB.GetPlayerStat (pc, IE_CASTERHOLD) - if held == 0 and GemRB.GetPlayerStat (pc, IE_STATE_ID) & STATE_DEAD == 0: - Window.SetVisible (WINDOW_VISIBLE) - else: - Window.SetVisible (WINDOW_GRAYED) + GUICommon.AdjustWindowVisibility (Window, pc, held) # update ground inventory slots Container = GemRB.GetContainer(pc, 1) diff --git a/gemrb/GUIScripts/pst/GUIMG.py b/gemrb/GUIScripts/pst/GUIMG.py index fa379e3..d80e5cd 100644 --- a/gemrb/GUIScripts/pst/GUIMG.py +++ b/gemrb/GUIScripts/pst/GUIMG.py @@ -137,11 +137,9 @@ def UpdateMageWindow (): Icon.SetEvent (IE_GUI_BUTTON_ON_PRESS, None) Icon.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, None) Icon.SetTooltip ('') - if (CommonTables.ClassSkills.GetValue (GemRB.GetPlayerStat (pc, IE_CLASS), 2)=="*") or \ - GemRB.GetPlayerStat (pc, IE_STATE_ID) & STATE_DEAD: - Window.SetVisible (WINDOW_GRAYED) - else: - Window.SetVisible (WINDOW_VISIBLE) + + CantCast = CommonTables.ClassSkills.GetValue (GemRB.GetPlayerStat (pc, IE_CLASS), 2) == "*" + GUICommon.AdjustWindowVisibility (Window, pc, CantCast) def MagePrevLevelPress (): global MageSpellLevel diff --git a/gemrb/GUIScripts/pst/GUIPR.py b/gemrb/GUIScripts/pst/GUIPR.py index 0431bf5..9c0f1c8 100644 --- a/gemrb/GUIScripts/pst/GUIPR.py +++ b/gemrb/GUIScripts/pst/GUIPR.py @@ -143,10 +143,7 @@ def UpdatePriestWindow (): Icon.SetTooltip ('') CantCast = CommonTables.ClassSkills.GetValue (GemRB.GetPlayerStat (pc, IE_CLASS), 1) == "*" CantCast += GemRB.GetPlayerStat(pc, IE_DISABLEDBUTTON)&(1<<ACT_CAST) - if CantCast or GemRB.GetPlayerStat (pc, IE_STATE_ID) & STATE_DEAD: - Window.SetVisible (WINDOW_GRAYED) - else: - Window.SetVisible (WINDOW_VISIBLE) + GUICommon.AdjustWindowVisibility (Window, pc, CantCast) def PriestPrevLevelPress (): ----------------------------------------------------------------------- This is an automated email from the git hooks/post-receive script. -- gemrb: Infinity Engine emulator |