From: Laszlo T. <ave...@us...> - 2005-12-01 17:20:39
|
Update of /cvsroot/gemrb/gemrb/gemrb/GUIScripts/how In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13653/how Modified Files: GUIWORLD.py Log Message: updated bg1/iwd guiscripts (reform party) Index: GUIWORLD.py =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/GUIScripts/how/GUIWORLD.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** GUIWORLD.py 27 Nov 2005 13:43:44 -0000 1.5 --- GUIWORLD.py 1 Dec 2005 17:20:28 -0000 1.6 *************** *** 10,19 **** # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # $Header$ --- 10,19 ---- # 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # $Header$ *************** *** 21,27 **** # GUIW.py - scripts to control some windows from GUIWORLD winpack ! # except of Actions, Portrait, Options and Dialog windows ! ! ################################################### import GemRB --- 21,26 ---- # GUIW.py - scripts to control some windows from GUIWORLD winpack ! # except of Actions, Portrait, Options and Dialog windows ! ################################################################# import GemRB *************** *** 30,33 **** --- 29,35 ---- from GUICommonWindows import SetEncumbranceLabels + FRAME_PC_SELECTED = 0 + FRAME_PC_TARGET = 1 + ContainerWindow = None ContinueWindow = None *************** *** 150,153 **** --- 152,156 ---- Count=1 GemRB.SetVarAssoc (Window, ScrollBar, "RightTopIndex", Count) + RedrawContainerWindow () *************** *** 165,172 **** RightCount = len(inventory_slots) ! for i in range(6): #this is an autoselected container, but we could use PC too Slot = GemRB.GetContainerItem (0, i+LeftTopIndex) Button = GemRB.GetControl (Window, i) if Slot != None: Item = GemRB.GetItem (Slot['ItemResRef']) --- 168,176 ---- RightCount = len(inventory_slots) ! for i in range (6): #this is an autoselected container, but we could use PC too Slot = GemRB.GetContainerItem (0, i+LeftTopIndex) Button = GemRB.GetControl (Window, i) + if Slot != None: Item = GemRB.GetItem (Slot['ItemResRef']) *************** *** 181,185 **** ! for i in range(4): if i+RightTopIndex<RightCount: Slot = GemRB.GetSlotItem (pc, inventory_slots[i+RightTopIndex]) --- 185,189 ---- ! for i in range (4): if i+RightTopIndex<RightCount: Slot = GemRB.GetSlotItem (pc, inventory_slots[i+RightTopIndex]) *************** *** 208,212 **** return ! GemRB.HideGUI () GemRB.LoadWindowPack (GetWindowPack()) --- 212,216 ---- return ! hideflag = GemRB.HideGUI () GemRB.LoadWindowPack (GetWindowPack()) *************** *** 217,230 **** GemRB.SetVar ("MessageWindow", -1) - pc = GemRB.GameGetFirstSelectedPC() Container = GemRB.GetContainer(0) - # Gears (time) when options pane is down - //62? - Button = GemRB.GetControl (Window, 50) - GemRB.SetAnimation (Window, Button, "CGEAR") - GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE | IE_GUI_BUTTON_ANIMATED, OP_SET) - GemRB.SetButtonState(Window, Button, IE_GUI_BUTTON_LOCKED) - # 0 - 5 - Ground Item # 10 - 13 - Personal Item --- 221,226 ---- *************** *** 233,237 **** # 54 - encumbrance ! for i in range(6): Button = GemRB.GetControl (Window, i) GemRB.SetVarAssoc (Window, Button, "LeftIndex", i) --- 229,233 ---- # 54 - encumbrance ! for i in range (6): Button = GemRB.GetControl (Window, i) GemRB.SetVarAssoc (Window, Button, "LeftIndex", i) *************** *** 239,243 **** GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "TakeItemContainer") ! for i in range(4): Button = GemRB.GetControl (Window, i+10) GemRB.SetVarAssoc (Window, Button, "RightIndex", i) --- 235,239 ---- GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "TakeItemContainer") ! for i in range (4): Button = GemRB.GetControl (Window, i+10) GemRB.SetVarAssoc (Window, Button, "RightIndex", i) *************** *** 275,279 **** GemRB.SetVar ("RightTopIndex", 0) UpdateContainerWindow () ! GemRB.UnhideGUI () --- 271,276 ---- GemRB.SetVar ("RightTopIndex", 0) UpdateContainerWindow () ! if hideflag: ! GemRB.UnhideGUI () *************** *** 287,291 **** if RightIndex<0: return ! #we need to get the right slot number pc = GemRB.GameGetFirstSelectedPC () --- 284,288 ---- if RightIndex<0: return ! #we need to get the right slot number pc = GemRB.GameGetFirstSelectedPC () *************** *** 301,305 **** if LeftIndex<0: return ! if LeftIndex >= Container['ItemCount']: return --- 298,302 ---- if LeftIndex<0: return ! if LeftIndex >= Container['ItemCount']: return *************** *** 308,314 **** def OpenReformPartyWindow (): global ReformPartyWindow ! GemRB.HideGUI () if ReformPartyWindow: --- 305,405 ---- + def UpdateReformWindow (): + Window = ReformPartyWindow + + select = GemRB.GetVar ("Selected") + + need_to_drop = GemRB.GetPartySize ()-PARTY_SIZE + if need_to_drop<0: + need_to_drop = 0 + + #excess player number + Label = GemRB.GetControl (Window, 0x1000000f) + GemRB.SetText (Window, Label, str(need_to_drop) ) + + #done + Button = GemRB.GetControl (Window, 8) + if need_to_drop: + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_DISABLED) + else: + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_ENABLED) + + #remove + Button = GemRB.GetControl (Window, 15) + if select: + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_ENABLED) + else: + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_DISABLED) + + for i in range (PARTY_SIZE+1): + Button = GemRB.GetControl (Window, i) + GemRB.EnableButtonBorder (Window, Button, FRAME_PC_SELECTED, select == i+2 ) + #+2 because protagonist is skipped + pic = GemRB.GetPlayerPortrait (i+2,1) + if not pic: + GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_NO_IMAGE, OP_SET) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) + continue + + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_ENABLED) + GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_PICTURE|IE_GUI_BUTTON_ALIGN_BOTTOM|IE_GUI_BUTTON_ALIGN_LEFT, OP_SET) + GemRB.SetButtonPicture (Window, Button, pic, "NOPORTSM") + return + + def RemovePlayer (): + global ReformPartyWindow + + hideflag = GemRB.HideGUI () + + GemRB.LoadWindowPack (GetWindowPack()) + GemRB.UnloadWindow (ReformPartyWindow) + ReformPartyWindow = Window = GemRB.LoadWindow (25) + GemRB.SetVar ("OtherWindow", Window) + + #are you sure + Label = GemRB.GetControl (Window, 0x0fffffff) + GemRB.SetText (Window, Label, 17518) + + #confirm + Button = GemRB.GetControl (Window, 1) + GemRB.SetText (Window, Button, 17507) + GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "RemovePlayerConfirm") + + #cancel + Button = GemRB.GetControl (Window, 2) + GemRB.SetText (Window, Button, 13727) + GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "RemovePlayerCancel") + + def RemovePlayerConfirm (): + global ReformPartyWindow + + hideflag = GemRB.HideGUI () + GemRB.UnloadWindow (ReformPartyWindow) + GemRB.SetVar ("OtherWindow", -1) + #removing selected player + ReformPartyWindow = None + if hideflag: + GemRB.UnhideGUI () + GemRB.ExecuteString ("LeaveParty()", GemRB.GetVar("Selected") ) + OpenReformPartyWindow () + return + + def RemovePlayerCancel (): + global ReformPartyWindow + + hideflag = GemRB.HideGUI () + GemRB.UnloadWindow (ReformPartyWindow) + GemRB.SetVar ("OtherWindow", -1) + ReformPartyWindow = None + if hideflag: + GemRB.UnhideGUI () + OpenReformPartyWindow () + return + def OpenReformPartyWindow (): global ReformPartyWindow ! ! GemRB.SetVar ("Selected", 0) ! hideflag = GemRB.HideGUI () if ReformPartyWindow: *************** *** 317,322 **** GemRB.SetVar ("OtherWindow", -1) ! GemRB.LoadWindowPack ("GUIREC") ! GemRB.UnhideGUI () return --- 408,416 ---- GemRB.SetVar ("OtherWindow", -1) ! #GemRB.LoadWindowPack ("GUIREC") ! if hideflag: ! GemRB.UnhideGUI () ! #re-enabling party size control ! GemRB.GameSetPartySize (PARTY_SIZE) return *************** *** 325,340 **** GemRB.SetVar ("OtherWindow", Window) # Remove Button = GemRB.GetControl (Window, 15) ! GemRB.SetText (Window, Button, 42514) ! GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_DISABLED) # Done Button = GemRB.GetControl (Window, 8) ! GemRB.SetText (Window, Button, 1403) GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "OpenReformPartyWindow") ! ! GemRB.UnhideGUI () ! last_formation = None --- 419,448 ---- GemRB.SetVar ("OtherWindow", Window) + #PC portraits + for j in range (PARTY_SIZE+1): + Button = GemRB.GetControl (Window,j) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_LOCKED) + GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_RADIOBUTTON|IE_GUI_BUTTON_NO_IMAGE|IE_GUI_BUTTON_PICTURE,OP_SET) + GemRB.SetButtonBorder (Window, Button, FRAME_PC_SELECTED, 1, 1, 2, 2, 0, 255, 0, 255) + #protagonist is skipped + index = j + 2 + GemRB.SetVarAssoc (Window, Button, "Selected", index) + GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "UpdateReformWindow") + # Remove Button = GemRB.GetControl (Window, 15) ! GemRB.SetText (Window, Button, 17507) ! GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "RemovePlayer") # Done Button = GemRB.GetControl (Window, 8) ! GemRB.SetText (Window, Button, 11973) GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "OpenReformPartyWindow") ! GemRB.SetVar ("ActionsWindow", -1) ! UpdateReformWindow () ! if hideflag: ! GemRB.UnhideGUI () ! GemRB.ShowModal (Window, MODAL_SHADOW_GRAY) ! return last_formation = None *************** *** 343,348 **** global FormationWindow if CloseOtherWindow (OpenFormationWindow): - GemRB.HideGUI () GemRB.UnloadWindow (FormationWindow) FormationWindow = None --- 451,456 ---- global FormationWindow + hideflag = GemRB.HideGUI () if CloseOtherWindow (OpenFormationWindow): GemRB.UnloadWindow (FormationWindow) FormationWindow = None *************** *** 350,357 **** GemRB.GameSetFormation (last_formation) GemRB.SetVar ("OtherWindow", -1) ! GemRB.UnhideGUI () return - GemRB.HideGUI () GemRB.LoadWindowPack (GetWindowPack()) FormationWindow = Window = GemRB.LoadWindow (27) --- 458,465 ---- GemRB.GameSetFormation (last_formation) GemRB.SetVar ("OtherWindow", -1) ! if hideflag: ! GemRB.UnhideGUI () return GemRB.LoadWindowPack (GetWindowPack()) FormationWindow = Window = GemRB.LoadWindow (27) *************** *** 388,392 **** SelectFormation () ! GemRB.UnhideGUI () def SelectFormation (): --- 496,501 ---- SelectFormation () ! if hideflag: ! GemRB.UnhideGUI () def SelectFormation (): *************** *** 408,412 **** #no death movie, but music is changed GemRB.LoadMusicPL("Theme.mus",1) ! GemRB.GamePause(1,1) GemRB.LoadWindowPack (GetWindowPack()) --- 517,521 ---- #no death movie, but music is changed GemRB.LoadMusicPL("Theme.mus",1) ! GemRB.GamePause (1,1) GemRB.LoadWindowPack (GetWindowPack()) *************** *** 427,434 **** GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "QuitPress") ! GemRB.HideGUI() GemRB.SetVar ("MessageWindow", -1) GemRB.SetVar ("ActionsWindow", Window) ! GemRB.UnhideGUI() #making the playing field gray GemRB.SetVisible (0,2) --- 536,544 ---- GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "QuitPress") ! hideflag = GemRB.HideGUI () GemRB.SetVar ("MessageWindow", -1) GemRB.SetVar ("ActionsWindow", Window) ! if hideflag: ! GemRB.UnhideGUI () #making the playing field gray GemRB.SetVisible (0,2) *************** *** 440,450 **** def QuitPress(): ! GemRB.QuitGame() ! GemRB.SetNextScript("Start") return def LoadPress(): ! GemRB.QuitGame() ! GemRB.SetNextScript("GUILOAD") return --- 550,560 ---- def QuitPress(): ! GemRB.QuitGame () ! GemRB.SetNextScript ("Start") return def LoadPress(): ! GemRB.QuitGame () ! GemRB.SetNextScript ("GUILOAD") return |