From: Jaka K. <lyn...@us...> - 2012-11-25 16:35:07
|
gemrb: Infinity Engine emulator The branch master has been updated via 47c50a64fe4b187e1a6d1cfc02e2c958a75c40bf (commit) via 2c31e6c56b71c55e9ce1681ad109ed5dc598edfe (commit) via e2f0a8de8325774d3999705433830ad806a1e755 (commit) Summary of changes: gemrb/GUIScripts/GUICommon.py | 4 +- gemrb/GUIScripts/{bg2 => }/GUIPR.py | 51 +++-- gemrb/GUIScripts/bg1/GUIPR.py | 368 ----------------------------------- gemrb/GUIScripts/iwd/GUIMG.py | 4 +- gemrb/GUIScripts/iwd/GUIPR.py | 357 --------------------------------- 5 files changed, 36 insertions(+), 748 deletions(-) rename gemrb/GUIScripts/{bg2 => }/GUIPR.py (89%) delete mode 100644 gemrb/GUIScripts/bg1/GUIPR.py delete mode 100644 gemrb/GUIScripts/iwd/GUIPR.py from 7c90cc814ef1e51eeb7083a661ace66be8319eeb (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=47c50a64fe4b187e1a6d1cfc02e2c958a75c40bf commit 47c50a64fe4b187e1a6d1cfc02e2c958a75c40bf Author: Jaka Kranjc <lyn...@us...> Date: Sun Nov 25 17:32:09 2012 +0100 merged-removed bg1 guipr too diff --git a/gemrb/GUIScripts/GUIPR.py b/gemrb/GUIScripts/GUIPR.py index c65750e..60ba7ff 100644 --- a/gemrb/GUIScripts/GUIPR.py +++ b/gemrb/GUIScripts/GUIPR.py @@ -175,6 +175,7 @@ def UpdatePriestWindow (): if i < known_cnt: ks = GemRB.GetKnownSpell (pc, type, level, i) Button.SetSpellIcon (ks['SpellResRef'], 0) + Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_NAND) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OnPriestMemorizeSpell) Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, OpenPriestSpellInfoWindow) spell = GemRB.GetSpell (ks['SpellResRef']) @@ -365,7 +366,7 @@ def OnPriestRemoveSpell (): index = GemRB.GetVar ("SpellButton") - 100 - #remove spell from book + #remove spell from memory GemRB.RemoveSpell (pc, type, level, index) OpenPriestSpellInfoWindow() return diff --git a/gemrb/GUIScripts/bg1/GUIPR.py b/gemrb/GUIScripts/bg1/GUIPR.py deleted file mode 100644 index 11ae2d8..0000000 --- a/gemrb/GUIScripts/bg1/GUIPR.py +++ /dev/null @@ -1,368 +0,0 @@ -# -*-python-*- -# GemRB - Infinity Engine Emulator -# Copyright (C) 2003 The GemRB Project -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# - - -# GUIPR.py - scripts to control priest spells windows from GUIPR winpack - -################################################### - -import GemRB -import GUICommon -import CommonTables -import GUICommonWindows -from GUIDefines import * -from ie_stats import * -from ie_action import ACT_CAST - -PriestWindow = None -PriestSpellInfoWindow = None -PriestSpellLevel = 0 -PriestSpellUnmemorizeWindow = None -OldOptionsWindow = None -PortraitWindow = None -OldPortraitWindow = None - - -def OpenPriestWindow (): - global PriestWindow, OptionsWindow - global OldOptionsWindow, PortraitWindow, OldPortraitWindow - - - if GUICommon.CloseOtherWindow (OpenPriestWindow): - if PriestWindow: - PriestWindow.Unload () - if OptionsWindow: - OptionsWindow.Unload () - if PortraitWindow: - PortraitWindow.Unload () - PriestWindow = None - GemRB.SetVar ("OtherWindow", -1) - GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE) - GemRB.UnhideGUI () - OptionsWindow = OldOptionsWindow - OldOptionsWindow = None - GUICommonWindows.PortraitWindow = OldPortraitWindow - OldPortraitWindow = None - GUICommonWindows.SetSelectionChangeHandler(None) - return - - GemRB.HideGUI () - GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE) - - GemRB.LoadWindowPack ("GUIPR", 640, 480) - PriestWindow = Window = GemRB.LoadWindow (2) - GemRB.SetVar ("OtherWindow", PriestWindow.ID) - OldOptionsWindow = GUICommonWindows.OptionsWindow - OptionsWindow = GemRB.LoadWindow (0) - GUICommonWindows.SetupMenuWindowControls (OptionsWindow, 0, OpenPriestWindow) - OldPortraitWindow = GUICommonWindows.PortraitWindow - PortraitWindow = GUICommonWindows.OpenPortraitWindow (0) - OptionsWindow.SetFrame () - - Button = Window.GetControl (1) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, PriestPrevLevelPress) - - Button = Window.GetControl (2) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, PriestNextLevelPress) - -## #setup level buttons -## for i in range (7): -## Button = Window.GetControl (55 + i) -## Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, RefreshPriestLevel) -## Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR) - -## for i in range (7): -## Button = Window.GetControl (55 + i) -## Button.SetVarAssoc ("PriestSpellLevel", i) - - # Setup memorized spells buttons - for i in range (12): - Button = Window.GetControl (3 + i) - Button.SetBorder (0,0,0,0,0,0,0,0,64,0,1) - Button.SetSprites ("SPELFRAM",0,0,0,0,0) - Button.SetFlags (IE_GUI_BUTTON_PICTURE | IE_GUI_BUTTON_PLAYONCE, OP_OR) - Button.SetState (IE_GUI_BUTTON_LOCKED) - - # Setup book spells buttons - for i in range (20): - Button = Window.GetControl (27 + i) - Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE | IE_GUI_BUTTON_PLAYONCE, OP_OR) - Button.SetState (IE_GUI_BUTTON_LOCKED) - - GUICommonWindows.SetSelectionChangeHandler (UpdatePriestWindow) - UpdatePriestWindow () - - OptionsWindow.SetVisible (WINDOW_VISIBLE) - Window.SetVisible (WINDOW_FRONT) - PortraitWindow.SetVisible (WINDOW_VISIBLE) - return - - -def UpdatePriestWindow (): - global PriestMemorizedSpellList, PriestKnownSpellList - - PriestMemorizedSpellList = [] - PriestKnownSpellList = [] - - Window = PriestWindow - pc = GemRB.GameGetSelectedPCSingle () - type = IE_SPELL_TYPE_PRIEST - level = PriestSpellLevel - max_mem_cnt = GemRB.GetMemorizableSpellsCount (pc, type, level) - - Label = Window.GetControl (0x10000032) - GemRB.SetToken ('LEVEL', str (level + 1)) - Label.SetText (12137) - - Name = GemRB.GetPlayerName (pc, 0) - Label = Window.GetControl (0x10000035) - Label.SetText (Name) - - mem_cnt = GemRB.GetMemorizedSpellsCount (pc, type, level, False) - for i in range (12): - Button = Window.GetControl (3 + i) - if i < mem_cnt: - ms = GemRB.GetMemorizedSpell (pc, type, level, i) - Button.SetSpellIcon (ms['SpellResRef']) - Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_NAND) - Button.SetFlags (IE_GUI_BUTTON_PICTURE | IE_GUI_BUTTON_PLAYONCE, OP_OR) - if ms['Flags']: - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenPriestSpellUnmemorizeWindow) - else: - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OnPriestUnmemorizeSpell) - Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, OpenPriestSpellInfoWindow) - spell = GemRB.GetSpell (ms['SpellResRef']) - Button.SetTooltip (spell['SpellName']) - PriestMemorizedSpellList.append (ms['SpellResRef']) - Button.SetVarAssoc ("SpellButton", i) - Button.EnableBorder (0, ms['Flags'] == 0) - else: - if i < max_mem_cnt: - Button.SetFlags (IE_GUI_BUTTON_NORMAL | IE_GUI_BUTTON_PLAYONCE, OP_SET) - else: - Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_SET) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, None) - Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, None) - Button.SetTooltip ('') - Button.EnableBorder (0, 0) - - - known_cnt = GemRB.GetKnownSpellsCount (pc, type, level) - for i in range (20): - Button = Window.GetControl (27 + i) - if i < known_cnt: - ks = GemRB.GetKnownSpell (pc, type, level, i) - Button.SetSpellIcon (ks['SpellResRef']) - Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_NAND) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OnPriestMemorizeSpell) - Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, OpenPriestSpellInfoWindow) - spell = GemRB.GetSpell (ks['SpellResRef']) - Button.SetTooltip (spell['SpellName']) - PriestKnownSpellList.append (ks['SpellResRef']) - Button.SetVarAssoc ("SpellButton", 100 + i) - - else: - Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_OR) - Button.SetFlags (IE_GUI_BUTTON_PICTURE, OP_NAND) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, None) - Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, None) - Button.SetTooltip ('') - Button.EnableBorder (0, 0) - - ClassName = GUICommon.GetClassRowName (pc) - DivineCaster = CommonTables.ClassSkills.GetValue (ClassName, "CLERICSPELL") - if DivineCaster == "*": - # also check the DRUIDSPELL column - DivineCaster = CommonTables.ClassSkills.GetValue (ClassName, "DRUIDSPELL") - CantCast = DivineCaster == "*" - CantCast += GemRB.GetPlayerStat(pc, IE_DISABLEDBUTTON)&(1<<ACT_CAST) - - GUICommon.AdjustWindowVisibility (Window, pc, CantCast) - return - -def PriestPrevLevelPress (): - global PriestSpellLevel - - if PriestSpellLevel > 0: - PriestSpellLevel = PriestSpellLevel - 1 - UpdatePriestWindow () - - return - -def PriestNextLevelPress (): - global PriestSpellLevel - - if PriestSpellLevel < 6: - PriestSpellLevel = PriestSpellLevel + 1 - UpdatePriestWindow () - return - -def RefreshPriestLevel (): - global PriestSpellLevel - - PriestSpellLevel = GemRB.GetVar ("PriestSpellLevel") - UpdatePriestWindow () - return - -def OpenPriestSpellInfoWindow (): - global PriestSpellInfoWindow - - if PriestSpellInfoWindow != None: - if PriestSpellInfoWindow: - PriestSpellInfoWindow.Unload () - PriestSpellInfoWindow = None - return - - PriestSpellInfoWindow = Window = GemRB.LoadWindow (3) - - #back - Button = Window.GetControl (5) - Button.SetText (15416) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenPriestSpellInfoWindow) - - index = GemRB.GetVar ("SpellButton") - if index < 100: - ResRef = PriestMemorizedSpellList[index] - else: - ResRef = PriestKnownSpellList[index - 100] - - spell = GemRB.GetSpell (ResRef) - - #Label = Window.GetControl (0x0fffffff) - #Label.SetText (spell['SpellName']) - - Label = Window.GetControl (0x10000000) - Label.SetText (spell['SpellName']) - - Button = Window.GetControl (2) - Button.SetSpellIcon (ResRef, 1) - - Text = Window.GetControl (3) - Text.SetText (spell['SpellDesc']) - - Window.ShowModal (MODAL_SHADOW_GRAY) - return - -def OnPriestMemorizeSpell (): - pc = GemRB.GameGetSelectedPCSingle () - level = PriestSpellLevel - type = IE_SPELL_TYPE_PRIEST - - index = GemRB.GetVar ("SpellButton") - 100 - - if GemRB.MemorizeSpell (pc, type, level, index): - UpdatePriestWindow () - GemRB.PlaySound ("GAM_24") - Button = PriestWindow.GetControl(index + 27) - Button.SetAnimation ("FLASH",0,1) - mem_cnt = GemRB.GetMemorizedSpellsCount (pc, type, level, False) - Button = PriestWindow.GetControl(mem_cnt + 2) - Button.SetAnimation ("FLASH",0,1) - return - -def OpenPriestSpellRemoveWindow (): - global PriestSpellUnmemorizeWindow - - PriestSpellUnmemorizeWindow = Window = GemRB.LoadWindow (5) - - # "Are you sure you want to ....?" - TextArea = Window.GetControl (3) - TextArea.SetText (11824) - - # Remove - Button = Window.GetControl (0) - Button.SetText (17507) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OnPriestRemoveSpell) - Button.SetFlags (IE_GUI_BUTTON_DEFAULT, OP_OR) - - # Cancel - Button = Window.GetControl (1) - Button.SetText (13727) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenPriestSpellRemoveWindow) - Button.SetFlags (IE_GUI_BUTTON_CANCEL, OP_OR) - - Window.ShowModal (MODAL_SHADOW_GRAY) - return - -def ClosePriestSpellUnmemorizeWindow (): - global PriestSpellUnmemorizeWindow - - if PriestSpellUnmemorizeWindow: - PriestSpellUnmemorizeWindow.Unload () - PriestSpellUnmemorizeWindow = None - return - -def OpenPriestSpellUnmemorizeWindow (): - global PriestSpellUnmemorizeWindow - - PriestSpellUnmemorizeWindow = Window = GemRB.LoadWindow (5) - - # "Are you sure you want to ....?" - TextArea = Window.GetControl (3) - TextArea.SetText (11824) - - # Remove - Button = Window.GetControl (0) - Button.SetText (17507) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OnPriestUnmemorizeSpell) - Button.SetFlags (IE_GUI_BUTTON_DEFAULT, OP_OR) - - # Cancel - Button = Window.GetControl (1) - Button.SetText (13727) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, ClosePriestSpellUnmemorizeWindow) - Button.SetFlags (IE_GUI_BUTTON_CANCEL, OP_OR) - - Window.ShowModal (MODAL_SHADOW_GRAY) - return - -def OnPriestUnmemorizeSpell (): - if PriestSpellUnmemorizeWindow: - ClosePriestSpellUnmemorizeWindow () - - pc = GemRB.GameGetSelectedPCSingle () - level = PriestSpellLevel - type = IE_SPELL_TYPE_PRIEST - - index = GemRB.GetVar ("SpellButton") - - if GemRB.UnmemorizeSpell (pc, type, level, index): - UpdatePriestWindow () - GemRB.PlaySound ("GAM_44") - Button = PriestWindow.GetControl(index + 3) - Button.SetAnimation ("FLASH",0,1) - return - -def OnPriestRemoveSpell (): - ClosePriestSpellUnmemorizeWindow() - OpenPriestSpellInfoWindow() - - pc = GemRB.GameGetSelectedPCSingle () - level = PriestSpellLevel - type = IE_SPELL_TYPE_PRIEST - - index = GemRB.GetVar ("SpellButton")-100 - - #remove spell from memory - GemRB.RemoveSpell (pc, type, level, index) - UpdatePriestWindow () - return - -################################################### -# End of file GUIPR.py http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=2c31e6c56b71c55e9ce1681ad109ed5dc598edfe commit 2c31e6c56b71c55e9ce1681ad109ed5dc598edfe Author: Jaka Kranjc <lyn...@us...> Date: Sun Nov 25 16:59:58 2012 +0100 removed the iwd guipr and promoted the bg2 one as global diff --git a/gemrb/GUIScripts/bg2/GUIPR.py b/gemrb/GUIScripts/GUIPR.py similarity index 100% rename from gemrb/GUIScripts/bg2/GUIPR.py rename to gemrb/GUIScripts/GUIPR.py diff --git a/gemrb/GUIScripts/iwd/GUIPR.py b/gemrb/GUIScripts/iwd/GUIPR.py deleted file mode 100644 index 603dcde..0000000 --- a/gemrb/GUIScripts/iwd/GUIPR.py +++ /dev/null @@ -1,357 +0,0 @@ -# -*-python-*- -# GemRB - Infinity Engine Emulator -# Copyright (C) 2003 The GemRB Project -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# - - -# GUIPR.py - scripts to control the priest spells windows from the GUIPR winpack - -################################################### - -import GemRB -import GUICommon -import CommonTables -from GUIDefines import * -from ie_stats import * -from ie_action import ACT_CAST - -PriestWindow = None -PriestSpellInfoWindow = None -PriestSpellLevel = 0 -PriestSpellUnmemorizeWindow = None -PortraitWindow = None -OptionsWindow = None -OldPortraitWindow = None -OldOptionsWindow = None - -def OpenPriestWindow (): - import GUICommonWindows - global PriestWindow, OptionsWindow, PortraitWindow - global OldPortraitWindow, OldOptionsWindow - - if GUICommon.CloseOtherWindow (OpenPriestWindow): - if PriestWindow: - PriestWindow.Unload () - if OptionsWindow: - OptionsWindow.Unload () - if PortraitWindow: - PortraitWindow.Unload () - - PriestWindow = None - GemRB.SetVar ("OtherWindow", -1) - GUICommon.GameWindow.SetVisible(WINDOW_VISIBLE) - GemRB.UnhideGUI () - GUICommonWindows.PortraitWindow = OldPortraitWindow - OldPortraitWindow = None - GUICommonWindows.OptionsWindow = OldOptionsWindow - OldOptionsWindow = None - GUICommonWindows.SetSelectionChangeHandler (None) - return - - GemRB.HideGUI () - GUICommon.GameWindow.SetVisible(WINDOW_INVISIBLE) - - GemRB.LoadWindowPack ("GUIPR", 640, 480) - PriestWindow = Window = GemRB.LoadWindow (2) - GemRB.SetVar ("OtherWindow", PriestWindow.ID) - #saving the original portrait window - OldOptionsWindow = GUICommonWindows.OptionsWindow - OptionsWindow = GemRB.LoadWindow (0) - GUICommonWindows.MarkMenuButton (OptionsWindow) - GUICommonWindows.SetupMenuWindowControls (OptionsWindow, 0, OpenPriestWindow) - OptionsWindow.SetFrame () - OldPortraitWindow = GUICommonWindows.PortraitWindow - PortraitWindow = GUICommonWindows.OpenPortraitWindow (0) - - Button = Window.GetControl (1) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, PriestPrevLevelPress) - - Button = Window.GetControl (2) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, PriestNextLevelPress) - - # Setup memorized spells buttons - for i in range (12): - Button = Window.GetControl (3 + i) - Button.SetBorder (0,0,0,0,0,0,0,0,64,0,1) - Button.SetSprites ("SPELFRAM",0,0,0,0,0) - Button.SetFlags (IE_GUI_BUTTON_PICTURE | IE_GUI_BUTTON_PLAYONCE, OP_OR) - Button.SetState (IE_GUI_BUTTON_LOCKED) - - # Setup book spells buttons - for i in range (GUICommon.GetGUISpellButtonCount()): - Button = Window.GetControl (27 + i) - Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE | IE_GUI_BUTTON_PLAYONCE, OP_OR) - Button.SetState (IE_GUI_BUTTON_LOCKED) - - GUICommonWindows.SetSelectionChangeHandler (UpdatePriestWindow) - UpdatePriestWindow () - OptionsWindow.SetVisible (WINDOW_VISIBLE) - #bringing window front - Window.SetVisible (WINDOW_FRONT) - PortraitWindow.SetVisible (WINDOW_VISIBLE) - return - -def UpdatePriestWindow (): - global PriestMemorizedSpellList, PriestKnownSpellList - - PriestMemorizedSpellList = [] - PriestKnownSpellList = [] - - Window = PriestWindow - pc = GemRB.GameGetSelectedPCSingle () - type = IE_SPELL_TYPE_PRIEST - level = PriestSpellLevel - max_mem_cnt = GemRB.GetMemorizableSpellsCount (pc, type, level) - - Label = Window.GetControl (0x10000032) - GemRB.SetToken ('LEVEL', str (level + 1)) - Label.SetText (12137) - - Name = GemRB.GetPlayerName (pc, 0) - Label = Window.GetControl (0x10000035) - Label.SetText (Name) - - mem_cnt = GemRB.GetMemorizedSpellsCount (pc, type, level, False) - for i in range (12): - Button = Window.GetControl (3 + i) - if i < mem_cnt: - ms = GemRB.GetMemorizedSpell (pc, type, level, i) - Button.SetSpellIcon (ms['SpellResRef'], 0) - Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_NAND) - Button.SetFlags (IE_GUI_BUTTON_PICTURE | IE_GUI_BUTTON_PLAYONCE, OP_OR) - if ms['Flags']: - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenPriestSpellUnmemorizeWindow) - else: - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OnPriestUnmemorizeSpell) - Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, OpenPriestSpellInfoWindow) - spell = GemRB.GetSpell (ms['SpellResRef']) - Button.SetTooltip (spell['SpellName']) - PriestMemorizedSpellList.append (ms['SpellResRef']) - Button.SetVarAssoc ("SpellButton", i) - Button.EnableBorder (0, ms['Flags'] == 0) - else: - if i < max_mem_cnt: - Button.SetFlags (IE_GUI_BUTTON_NORMAL | IE_GUI_BUTTON_PLAYONCE, OP_SET) - else: - Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_SET) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, None) - Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, None) - Button.SetTooltip ('') - Button.EnableBorder (0, 0) - - - known_cnt = GemRB.GetKnownSpellsCount (pc, type, level) - for i in range (GUICommon.GetGUISpellButtonCount()): - Button = Window.GetControl (27 + i) - if i < known_cnt: - ks = GemRB.GetKnownSpell (pc, type, level, i) - Button.SetSpellIcon (ks['SpellResRef'], 0) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OnPriestMemorizeSpell) - Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, OpenPriestSpellInfoWindow) - spell = GemRB.GetSpell (ks['SpellResRef']) - Button.SetTooltip (spell['SpellName']) - PriestKnownSpellList.append (ks['SpellResRef']) - Button.SetVarAssoc ("SpellButton", 100 + i) - - else: - Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE, OP_OR) - Button.SetFlags (IE_GUI_BUTTON_PICTURE, OP_NAND) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, None) - Button.SetEvent (IE_GUI_BUTTON_ON_RIGHT_PRESS, None) - Button.SetTooltip ('') - Button.EnableBorder (0, 0) - - ClassName = GUICommon.GetClassRowName (pc) - DivineCaster = CommonTables.ClassSkills.GetValue (ClassName, "CLERICSPELL") - if DivineCaster == "*": - # also check the DRUIDSPELL column - DivineCaster = CommonTables.ClassSkills.GetValue (ClassName, "DRUIDSPELL") - CantCast = DivineCaster == "*" - CantCast += GemRB.GetPlayerStat(pc, IE_DISABLEDBUTTON)&(1<<ACT_CAST) - - GUICommon.AdjustWindowVisibility (Window, pc, CantCast) - return - -def PriestPrevLevelPress (): - global PriestSpellLevel - - if PriestSpellLevel > 0: - PriestSpellLevel = PriestSpellLevel - 1 - UpdatePriestWindow () - return - -def PriestNextLevelPress (): - global PriestSpellLevel - - if PriestSpellLevel < 6: - PriestSpellLevel = PriestSpellLevel + 1 - UpdatePriestWindow () - return - -def RefreshPriestLevel (): - global PriestSpellLevel - - PriestSpellLevel = GemRB.GetVar ("PriestSpellLevel") - UpdatePriestWindow () - return - -def OpenPriestSpellInfoWindow (): - global PriestSpellInfoWindow - - if PriestSpellInfoWindow != None: - if PriestSpellInfoWindow: - PriestSpellInfoWindow.Unload () - PriestSpellInfoWindow = None - return - - PriestSpellInfoWindow = Window = GemRB.LoadWindow (3) - - #back - Button = Window.GetControl (5) - Button.SetText (15416) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OpenPriestSpellInfoWindow) - - index = GemRB.GetVar ("SpellButton") - if index < 100: - ResRef = PriestMemorizedSpellList[index] - else: - ResRef = PriestKnownSpellList[index - 100] - - spell = GemRB.GetSpell (ResRef) - - #Label = Window.GetControl (0x0fffffff) - #Label.SetText (spell['SpellName']) - - Label = Window.GetControl (0x10000000) - Label.SetText (spell['SpellName']) - - Button = Window.GetControl (2) - Button.SetSpellIcon (ResRef, 1) - - Text = Window.GetControl (3) - Text.SetText (spell['SpellDesc']) - - Window.ShowModal (MODAL_SHADOW_GRAY) - return - -def OnPriestMemorizeSpell (): - pc = GemRB.GameGetSelectedPCSingle () - level = PriestSpellLevel - type = IE_SPELL_TYPE_PRIEST - - index = GemRB.GetVar ("SpellButton") - 100 - - if GemRB.MemorizeSpell (pc, type, level, index): - UpdatePriestWindow () - GemRB.PlaySound ("GAM_24") - Button = PriestWindow.GetControl(index + 27) - Button.SetAnimation ("FLASH",0,1) - mem_cnt = GemRB.GetMemorizedSpellsCount (pc, type, level, False) - Button = PriestWindow.GetControl(mem_cnt + 2) - Button.SetAnimation ("FLASH",0,1) - return - -def OpenPriestSpellRemoveWindow (): - global PriestSpellUnmemorizeWindow - - PriestSpellUnmemorizeWindow = Window = GemRB.LoadWindow (5) - - # "Are you sure you want to ....?" - TextArea = Window.GetControl (3) - TextArea.SetText (63745) - - # Remove - Button = Window.GetControl (0) - Button.SetText (17507) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OnPriestRemoveSpell) - Button.SetFlags (IE_GUI_BUTTON_DEFAULT, OP_OR) - - # Cancel - Button = Window.GetControl (1) - Button.SetText (13727) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, ClosePriestSpelliUnmemorizeWindow) - Button.SetFlags (IE_GUI_BUTTON_CANCEL, OP_OR) - - Window.ShowModal (MODAL_SHADOW_GRAY) - return - -def ClosePriestSpellUnmemorizeWindow (): - global PriestSpellUnmemorizeWindow - - if PriestSpellUnmemorizeWindow: - PriestSpellUnmemorizeWindow.Unload () - PriestSpellUnmemorizeWindow = None - return - -def OpenPriestSpellUnmemorizeWindow (): - global PriestSpellUnmemorizeWindow - - PriestSpellUnmemorizeWindow = Window = GemRB.LoadWindow (5) - - # "Are you sure you want to ....?" - TextArea = Window.GetControl (3) - TextArea.SetText (11824) - - # Remove - Button = Window.GetControl (0) - Button.SetText (17507) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, OnPriestUnmemorizeSpell) - Button.SetFlags (IE_GUI_BUTTON_DEFAULT, OP_OR) - - # Cancel - Button = Window.GetControl (1) - Button.SetText (13727) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, ClosePriestSpellUnmemorizeWindow) - Button.SetFlags (IE_GUI_BUTTON_CANCEL, OP_OR) - - Window.ShowModal (MODAL_SHADOW_GRAY) - return - -def OnPriestUnmemorizeSpell (): - if PriestSpellUnmemorizeWindow: - ClosePriestSpellUnmemorizeWindow () - - pc = GemRB.GameGetSelectedPCSingle () - level = PriestSpellLevel - type = IE_SPELL_TYPE_PRIEST - - index = GemRB.GetVar ("SpellButton") - - if GemRB.UnmemorizeSpell (pc, type, level, index): - UpdatePriestWindow () - GemRB.PlaySound ("GAM_44") - Button = PriestWindow.GetControl(index + 3) - Button.SetAnimation ("FLASH",0,1) - return - -def OnPriestRemoveSpell (): - if PriestSpellUnmemorizeWindow: - ClosePriestSpellRemoveWindow () - - pc = GemRB.GameGetSelectedPCSingle () - level = PriestSpellLevel - type = IE_SPELL_TYPE_PRIEST - - index = GemRB.GetVar ("SpellButton") - 100 - - #remove spell from book - GemRB.RemoveSpell (pc, type, level, index) - UpdatePriestWindow () - return - -################################################### -# End of file GUIPR.py http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=e2f0a8de8325774d3999705433830ad806a1e755 commit e2f0a8de8325774d3999705433830ad806a1e755 Author: Jaka Kranjc <lyn...@us...> Date: Sun Nov 25 16:57:11 2012 +0100 harmonised bg2 and iwd guipr once removed, at least two bugs will be fixed diff --git a/gemrb/GUIScripts/GUICommon.py b/gemrb/GUIScripts/GUICommon.py index dfd6bd0..6f410a2 100644 --- a/gemrb/GUIScripts/GUICommon.py +++ b/gemrb/GUIScripts/GUICommon.py @@ -185,8 +185,8 @@ def HasHOW (): def HasTOTL (): return GemRB.HasResource ("ar9700", RES_ARE) -def GetIWDSpellButtonCount (): - if HasHOW(): +def GetGUISpellButtonCount (): + if HasHOW() or GameIsBG2(): return 24 else: return 20 diff --git a/gemrb/GUIScripts/bg2/GUIPR.py b/gemrb/GUIScripts/bg2/GUIPR.py index 6b9a22a..c65750e 100644 --- a/gemrb/GUIScripts/bg2/GUIPR.py +++ b/gemrb/GUIScripts/bg2/GUIPR.py @@ -84,14 +84,15 @@ def OpenPriestWindow (): Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, PriestNextLevelPress) #setup level buttons - for i in range (7): - Button = Window.GetControl (55 + i) - Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, RefreshPriestLevel) - Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR) + if GUICommon.GameIsBG2(): + for i in range (7): + Button = Window.GetControl (55 + i) + Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, RefreshPriestLevel) + Button.SetFlags (IE_GUI_BUTTON_RADIOBUTTON, OP_OR) - for i in range (7): - Button = Window.GetControl (55 + i) - Button.SetVarAssoc ("PriestSpellLevel", i) + for i in range (7): + Button = Window.GetControl (55 + i) + Button.SetVarAssoc ("PriestSpellLevel", i) # Setup memorized spells buttons for i in range (12): @@ -102,7 +103,7 @@ def OpenPriestWindow (): Button.SetState (IE_GUI_BUTTON_LOCKED) # Setup book spells buttons - for i in range (24): + for i in range (GUICommon.GetGUISpellButtonCount()): Button = Window.GetControl (27 + i) Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE | IE_GUI_BUTTON_PLAYONCE, OP_OR) Button.SetState (IE_GUI_BUTTON_LOCKED) @@ -128,8 +129,13 @@ def UpdatePriestWindow (): max_mem_cnt = GemRB.GetMemorizableSpellsCount (pc, type, level) Label = Window.GetControl (0x10000032) - GemRB.SetToken("SPELLLEVEL", str(level+1) ) - Label.SetText (10345) + # bg2 uses a shorthand form + if GUICommon.GameIsBG2(): + GemRB.SetToken ("SPELLLEVEL", str(level+1)) + Label.SetText (10345) + else: + GemRB.SetToken ('LEVEL', str(level+1)) + Label.SetText (12137) Name = GemRB.GetPlayerName (pc, 0) Label = Window.GetControl (0x10000035) @@ -164,7 +170,7 @@ def UpdatePriestWindow (): Button.EnableBorder (0, 0) known_cnt = GemRB.GetKnownSpellsCount (pc, type, level) - for i in range (24): + for i in range (GUICommon.GetGUISpellButtonCount()): Button = Window.GetControl (27 + i) if i < known_cnt: ks = GemRB.GetKnownSpell (pc, type, level, i) @@ -241,7 +247,10 @@ def OpenPriestSpellInfoWindow (): spell = GemRB.GetSpell (ResRef) - Label = Window.GetControl (0x0fffffff) + if GUICommon.GameIsBG2(): + Label = Window.GetControl (0x0fffffff) + else: + Label = Window.GetControl (0x10000000) Label.SetText (spell['SpellName']) Button = Window.GetControl (2) @@ -264,10 +273,14 @@ def OnPriestMemorizeSpell (): UpdatePriestWindow () GemRB.PlaySound ("GAM_24") Button = PriestWindow.GetControl(index + 27) - Button.SetAnimation ("FLASH") mem_cnt = GemRB.GetMemorizedSpellsCount (pc, type, level, False) - Button = PriestWindow.GetControl(mem_cnt + 2) - Button.SetAnimation ("FLASH") + Button2 = PriestWindow.GetControl(mem_cnt + 2) + if GUICommon.GameIsBG2(): # no blending + Button.SetAnimation ("FLASH") + Button2.SetAnimation ("FLASH") + else: + Button.SetAnimation ("FLASH", 0, 1) + Button2.SetAnimation ("FLASH", 0, 1) return def OpenPriestSpellRemoveWindow (): @@ -340,12 +353,11 @@ def OnPriestUnmemorizeSpell (): UpdatePriestWindow () GemRB.PlaySound ("GAM_44") Button = PriestWindow.GetControl(index + 3) - Button.SetAnimation ("FLASH") + Button.SetAnimation ("FLASH", 0, GUICommon.GameIsBG2() is False) # no blending for bg2 return def OnPriestRemoveSpell (): ClosePriestSpellUnmemorizeWindow() - OpenPriestSpellInfoWindow() pc = GemRB.GameGetSelectedPCSingle () level = PriestSpellLevel @@ -355,7 +367,7 @@ def OnPriestRemoveSpell (): #remove spell from book GemRB.RemoveSpell (pc, type, level, index) - UpdatePriestWindow () + OpenPriestSpellInfoWindow() return ################################################### diff --git a/gemrb/GUIScripts/iwd/GUIMG.py b/gemrb/GUIScripts/iwd/GUIMG.py index 455e511..5645bc7 100644 --- a/gemrb/GUIScripts/iwd/GUIMG.py +++ b/gemrb/GUIScripts/iwd/GUIMG.py @@ -104,7 +104,7 @@ def OpenMageWindow (): Button.SetState (IE_GUI_BUTTON_LOCKED) # Setup book spells buttons - for i in range (GUICommon.GetIWDSpellButtonCount()): + for i in range (GUICommon.GetGUISpellButtonCount()): Button = Window.GetControl (27 + i) Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE | IE_GUI_BUTTON_PLAYONCE, OP_OR) Button.SetState (IE_GUI_BUTTON_LOCKED) @@ -166,7 +166,7 @@ def UpdateMageWindow (): known_cnt = GemRB.GetKnownSpellsCount (pc, type, level) - for i in range (GUICommon.GetIWDSpellButtonCount()): + for i in range (GUICommon.GetGUISpellButtonCount()): Button = Window.GetControl (27 + i) if i < known_cnt: ks = GemRB.GetKnownSpell (pc, type, level, i) diff --git a/gemrb/GUIScripts/iwd/GUIPR.py b/gemrb/GUIScripts/iwd/GUIPR.py index 03fae9e..603dcde 100644 --- a/gemrb/GUIScripts/iwd/GUIPR.py +++ b/gemrb/GUIScripts/iwd/GUIPR.py @@ -92,7 +92,7 @@ def OpenPriestWindow (): Button.SetState (IE_GUI_BUTTON_LOCKED) # Setup book spells buttons - for i in range (GUICommon.GetIWDSpellButtonCount()): + for i in range (GUICommon.GetGUISpellButtonCount()): Button = Window.GetControl (27 + i) Button.SetFlags (IE_GUI_BUTTON_NO_IMAGE | IE_GUI_BUTTON_PLAYONCE, OP_OR) Button.SetState (IE_GUI_BUTTON_LOCKED) @@ -155,7 +155,7 @@ def UpdatePriestWindow (): known_cnt = GemRB.GetKnownSpellsCount (pc, type, level) - for i in range (GUICommon.GetIWDSpellButtonCount()): + for i in range (GUICommon.GetGUISpellButtonCount()): Button = Window.GetControl (27 + i) if i < known_cnt: ks = GemRB.GetKnownSpell (pc, type, level, i) ----------------------------------------------------------------------- This is an automated email from the git hooks/post-receive script. -- gemrb: Infinity Engine emulator |