home *** CD-ROM | disk | FTP | other *** search
/ Game.EXE 2001 January / Game.EXE_01_2001.iso / demos / Blade of Darkness / data1.cab / Program_Executable_Files / Scripts / Menu.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2000-11-16  |  42.9 KB  |  1,588 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import Blood
  5. import MenuWidget
  6. import WidgetsExtra
  7. import Bladex
  8. import BBLib
  9. import netgame
  10. import Raster
  11. import BIPCx
  12. import Sounds
  13. import GotoMapVars
  14. import acts
  15. import SaveGame
  16. import MemPersistence
  17. import string
  18. if netgame.GetNetState() == 0:
  19.     import KeybWidget
  20.     import Credits
  21. else:
  22.     import NetScorer
  23. import Raster
  24. import BInput
  25. import BUIx
  26. import pdb
  27. import Reference
  28. import MenuText
  29. import NetMisc
  30. import netwidgets
  31. import os
  32. MenuFontSmall = '../../Data/Letras menu peq.bmp'
  33. MenuFontMed = '../../Data/Letras menu med.bmp'
  34. MenuFontBig = '../../Data/Letras menu gra.bmp'
  35. Character = -1
  36. TBUDSoundAble = 1
  37. EscapeFunction = None
  38. SndCorreGema = Bladex.CreateSound('..\\..\\Sounds\\golpe-2.wav', 'Risoto1')
  39. SndCorreGema.Volume = 0.5
  40. SndCorreGema.MinDistance = 1000000.0
  41. SndCorreGema.MaxDistance = 2000000
  42. SndNewMenu = Bladex.CreateSound('..\\..\\Sounds\\golpe-madera-pesada.wav', 'Risoto2')
  43. SndNewMenu.Volume = 1.0
  44. SndNewMenu.MinDistance = 1000000.0
  45. SndNewMenu.MaxDistance = 2000000
  46. last_ss_quality = -1
  47. sound_cfg_changed = 0
  48.  
  49. def PlaySound(Chound):
  50.     cam = Bladex.GetEntity('Camera')
  51.     Chound.Position = cam.Position
  52.     Chound.Stop()
  53.     Chound.PlaySound(0)
  54.  
  55.  
  56. def BackMenu(option):
  57.     _MainMenu.DeActivateMenuItem()
  58.  
  59. BackOption = {
  60.     'Name': MenuText.GetMenuText('BACK'),
  61.     'VSep': 65,
  62.     'Command': BackMenu,
  63.     'Font': MenuFontBig }
  64.  
  65. def Load2DMap(option):
  66.     Bladex.LoadLevel('2DMap')
  67.  
  68.  
  69. def LoadPlayerSelect(option):
  70.     global EscapeFunction, EscapeFunction
  71.     if 'Casa' != Bladex.GetCurrentMap():
  72.         MemPersistence.Store('MapAlreadyLoaded', 'pepepotamo')
  73.         Bladex.LoadLevel('Casa')
  74.     else:
  75.         aux = EscapeFunction
  76.         EscapeFunction = None
  77.         _MainMenu.DeActivateMenuItem()
  78.         _MainMenu.DeActivateMenuItem()
  79.         EscapeFunction = aux
  80.         aux = None
  81.         EscapeFunction(1)
  82.  
  83.  
  84. def LoadTutorial(option):
  85.     Bladex.LoadLevel('Tutorial')
  86.  
  87.  
  88. def SaveGame1(option):
  89.     Bladex.SetRunString("Bladex.StopTime();import GameState;state=GameState.WorldState();state.GetState();state.SaveState('../../Save/SaveGame1.py');state=None")
  90.  
  91.  
  92. def SaveGame2(option):
  93.     Bladex.SetRunString("Bladex.StopTime();import GameState;state=GameState.WorldState();state.GetState();state.SaveState('../../Save/SaveGame2.py');state=None")
  94.  
  95.  
  96. def SaveGame3(option):
  97.     Bladex.SetRunString("Bladex.StopTime();import GameState;state=GameState.WorldState();state.GetState();state.SaveState('../../Save/SaveGame3.py');state=None")
  98.  
  99.  
  100. def SaveGame4(option):
  101.     Bladex.SetRunString("Bladex.StopTime();import GameState;state=GameState.WorldState();state.GetState();state.SaveState('../../Save/SaveGame4.py');state=None")
  102.  
  103.  
  104. def LoadGameAux(name):
  105.     path = '../../Save/%s_files' % (name,)
  106.     execfile = "execfile('../../Scripts/sys_init.py');execfile('../../Save/%s.py')" % (name,)
  107.     file_data_aux = open('%s/%saux' % (path, 'aux'), 'rt')
  108.     text = file_data_aux.read()
  109.     print text
  110.     file_data_aux.close()
  111.     Bladex.BeginLoadGame()
  112.     Bladex.CloseLevel(execfile, text)
  113.  
  114.  
  115. def LoadGame(option):
  116.     LoadGameAux('SaveGame1')
  117.  
  118.  
  119. def LoadGame2(option):
  120.     LoadGameAux('SaveGame2')
  121.  
  122.  
  123. def LoadGame3(option):
  124.     LoadGameAux('SaveGame3')
  125.  
  126.  
  127. def LoadGame4(option):
  128.     LoadGameAux('SaveGame4')
  129.  
  130.  
  131. def CmdQuit(menu_class):
  132.     Bladex.Quit()
  133.  
  134.  
  135. def CommandPrb(menu_class):
  136.     print 'Hola'
  137.  
  138.  
  139. def OptionCommandPrb(menu_class, option):
  140.     print 'Received', option
  141.  
  142.  
  143. def SetOptionCommandPrb():
  144.     return 'Off'
  145.  
  146.  
  147. def SetFullScreenMode(option):
  148.     print option
  149.     if option == 'Full Screen':
  150.         Raster.SetVideoMode(0)
  151.     else:
  152.         Raster.SetWindowSize(640, 480)
  153.  
  154.  
  155. def FullScreenModeSettings():
  156.     print 'FullScreenModeSettings'
  157.     if Raster.FullScreen():
  158.         return 0
  159.     else:
  160.         return 1
  161.  
  162.  
  163. def SetFacing(option):
  164.     if option == 'Yes':
  165.         Bladex.SetAutoEngageCombat(1)
  166.     else:
  167.         Bladex.SetAutoEngageCombat(0)
  168.     SaveConfiguration()
  169.  
  170.  
  171. def GetFacing():
  172.     return Bladex.GetAutoEngageCombat()
  173.  
  174.  
  175. def FacingSettings():
  176.     if Bladex.GetAutoEngageCombat():
  177.         return 1
  178.     else:
  179.         return 0
  180.  
  181. GORE_PASSWORD = ''
  182. NEW_GORE_PASSWORD = ''
  183. CONFIRM_GORE_PASSWORD = ''
  184. CORRECT_GORE_PASSWORD = ''
  185.  
  186. def LoadPasswordFile():
  187.     global CORRECT_GORE_PASSWORD
  188.     import rotor
  189.     
  190.     try:
  191.         passwordfile = open('..\\..\\Bin\\Password.txt', 'r')
  192.     except:
  193.         return None
  194.  
  195.     encrpass = passwordfile.read()
  196.     passwordfile.close()
  197.     rt = rotor.newrotor('key', 12)
  198.     CORRECT_GORE_PASSWORD = rt.decrypt(encrpass)
  199.     del rt
  200.  
  201. LoadPasswordFile()
  202.  
  203. def SavePasswordFile():
  204.     import rotor
  205.     rt = rotor.newrotor('key', 12)
  206.     encrpass = rt.encrypt(CORRECT_GORE_PASSWORD)
  207.     del rt
  208.     passwordfile = open('..\\..\\Bin\\Password.txt', 'w')
  209.     passwordfile.write(encrpass)
  210.     passwordfile.close()
  211.  
  212.  
  213. def GetMouseInvert():
  214.     MouseData = Bladex.GetMouseState()
  215.     return 1 - MouseData[0]
  216.  
  217.  
  218. def SetMouseInvert(option):
  219.     MouseData = Bladex.GetMouseState()
  220.     if option == 'No':
  221.         Bladex.SetMouseState(0, MouseData[1], MouseData[2])
  222.     else:
  223.         Bladex.SetMouseState(1, MouseData[1], MouseData[2])
  224.     KeybWidget.SaveListConfig()
  225.  
  226.  
  227. def GetMouseXSens():
  228.     MouseData = Bladex.GetMouseState()
  229.     return int(MouseData[1])
  230.  
  231.  
  232. def SetMouseXSens(v):
  233.     MouseData = Bladex.GetMouseState()
  234.     Bladex.SetMouseState(MouseData[0], v, MouseData[2])
  235.     KeybWidget.SaveListConfig()
  236.  
  237.  
  238. def GetMouseYSens():
  239.     MouseData = Bladex.GetMouseState()
  240.     return int(MouseData[2])
  241.  
  242.  
  243. def SetMouseYSens(v):
  244.     MouseData = Bladex.GetMouseState()
  245.     Bladex.SetMouseState(MouseData[0], MouseData[1], v)
  246.     KeybWidget.SaveListConfig()
  247.  
  248.  
  249. def ResetKeyB(option):
  250.     _MainMenu.DeActivateMenuItem()
  251.     acts.ResetDefaultControls()
  252.     if KeybWidget.AdditionalKeysCallBack:
  253.         KeybWidget.AdditionalKeysCallBack()
  254.     
  255.     _MainMenu.ActivateMenuItem()
  256.  
  257.  
  258. def SetDeFacingValue(v):
  259.     return Bladex.SetAecGap(v)
  260.  
  261. CurrentScorerVar = 'Full'
  262.  
  263. def CurrentScorer():
  264.     if CurrentScorerVar == 'Full':
  265.         return 0
  266.     
  267.     if CurrentScorerVar == 'Auto':
  268.         return 1
  269.     
  270.  
  271.  
  272. def SetScorer(option):
  273.     global CurrentScorerVar
  274.     import Scorer
  275.     if option == 'Full':
  276.         Scorer.PowDefWidgets.Activate()
  277.         Scorer.wKeysFrame.SetVisible(1)
  278.         Scorer.wKeysRFrame.SetVisible(1)
  279.         Scorer.wSpecialsFrame.SetVisible(1)
  280.         Scorer.wEnemiesFrame.SetVisible(1)
  281.         Scorer.wObjectsFrame.SetVisible(1)
  282.         Scorer.wArrowInfo.SetVisible(1)
  283.     elif option == 'Auto':
  284.         Scorer.wLeftHand.SetVisible(0)
  285.         Scorer.wRightHand.SetVisible(0)
  286.         Scorer.PowDefWidgets.Deactivate()
  287.         Scorer.wKeysFrame.SetVisible(0)
  288.         Scorer.wKeysRFrame.SetVisible(0)
  289.         Scorer.wSpecialsFrame.SetVisible(0)
  290.         Scorer.wEnemiesFrame.SetVisible(0)
  291.         Scorer.wObjectsFrame.SetVisible(0)
  292.         Scorer.wArrowInfo.SetVisible(0)
  293.     
  294.     CurrentScorerVar = option
  295.     SaveConfiguration()
  296.  
  297.  
  298. def CheckGorePassWord():
  299.     print 'Checking Password'
  300.     return CORRECT_GORE_PASSWORD == GORE_PASSWORD
  301.  
  302.  
  303. def Empty():
  304.     return ''
  305.  
  306.  
  307. def SetPass(name):
  308.     global GORE_PASSWORD
  309.     GORE_PASSWORD = name
  310.  
  311.  
  312. def SetNewPass(name):
  313.     global NEW_GORE_PASSWORD
  314.     NEW_GORE_PASSWORD = name
  315.  
  316.  
  317. def SetConfNewPass(name):
  318.     global CONFIRM_GORE_PASSWORD
  319.     CONFIRM_GORE_PASSWORD = name
  320.  
  321.  
  322. def SaveConfiguration():
  323.     cfgfile = open('../../Config/GameCfg.py', 'w')
  324.     cfgfile.write('\n# Configuration settings... be carefull!\n\n\n')
  325.     cfgfile.write('Bladex.SetBloodLevel(' + `Bladex.GetBloodLevel()` + ')\n')
  326.     cfgfile.write('Bladex.SetMutilationLevel(' + `Bladex.GetMutilationLevel()` + ')\n')
  327.     cfgfile.write('Bladex.SetDrawObjectShadows(' + `Bladex.GetDrawObjectShadows()` + ')\n')
  328.     cfgfile.write('Bladex.SetAutoEngageCombat(' + `Bladex.GetAutoEngageCombat()` + ')\n')
  329.     cfgfile.write('Bladex.SetAecGap(' + `Bladex.GetAecGap()` + ')\n')
  330.     cfgfile.write('Blood.Evaporation = ' + `Blood.Evaporation` + '\n')
  331.     cfgfile.write('SetScorer(' + `CurrentScorerVar` + ')\n')
  332.     cfgfile.write('\n# Achalay my brother!.\n\n\n')
  333.     cfgfile.close()
  334.     print 'Game options Saved.'
  335.  
  336.  
  337. def SetBlood(option):
  338.     if option == 'Yes':
  339.         Bladex.SetBloodLevel(1)
  340.     else:
  341.         Bladex.SetBloodLevel(0)
  342.     SaveConfiguration()
  343.  
  344.  
  345. def BloodSettings():
  346.     if Bladex.GetBloodLevel():
  347.         return 0
  348.     else:
  349.         return 1
  350.  
  351.  
  352. def SetMutilation(option):
  353.     if option == 'Yes':
  354.         Bladex.SetMutilationLevel(1)
  355.     else:
  356.         Bladex.SetMutilationLevel(0)
  357.     SaveConfiguration()
  358.  
  359.  
  360. def MutilationSettings():
  361.     if Bladex.GetMutilationLevel():
  362.         return 0
  363.     else:
  364.         return 1
  365.  
  366.  
  367. def SetShadows(option):
  368.     if option == 'Yes':
  369.         Bladex.SetDrawObjectShadows(1)
  370.     else:
  371.         Bladex.SetDrawObjectShadows(0)
  372.     SaveConfiguration()
  373.  
  374.  
  375. def ShadowsSettings():
  376.     if Bladex.GetDrawObjectShadows():
  377.         return 0
  378.     else:
  379.         return 1
  380.  
  381.  
  382. def SetBloodEvaporation(option):
  383.     a = Bladex.GetCurrentMap()
  384.     lar = len(a)
  385.     if lar > 5:
  386.         a = a[lar - 4:lar]
  387.     else:
  388.         a = ''
  389.     if string.upper(a) != 'BACK':
  390.         if option == 'Active':
  391.             Blood.Evaporation = 1
  392.         else:
  393.             Blood.Evaporation = 0
  394.         SaveConfiguration()
  395.     
  396.  
  397.  
  398. def BloodEvaporationSettings():
  399.     if Blood.Evaporation:
  400.         return 0
  401.     else:
  402.         return 1
  403.  
  404.  
  405. def GetGammaValue():
  406.     return Raster.GetGammaCorrection()
  407.  
  408.  
  409. def SetGammaValue(v):
  410.     Raster.SetGammaCorrection(v)
  411.  
  412.  
  413. def GetBrightnessValue():
  414.     return Raster.GetBrightness()
  415.  
  416.  
  417. def SetBrightnessValue(v):
  418.     Raster.SetBrightness(v)
  419.  
  420.  
  421. def GetContrastValue():
  422.     return Raster.GetContrast()
  423.  
  424.  
  425. def SetContrastValue(v):
  426.     Raster.SetContrast(v)
  427.  
  428.  
  429. def ResetVideo(option):
  430.     _MainMenu.DeActivateMenuItem()
  431.     Raster.SetGammaCorrection(0)
  432.     Raster.SetBrightness(0)
  433.     Raster.SetContrast(1)
  434.     _MainMenu.ActivateMenuItem()
  435.  
  436.  
  437. def GetSoundValue():
  438.     return int(10 * Bladex.GetSoundVolume())
  439.  
  440.  
  441. def SetSoundValue(v):
  442.     global sound_cfg_changed
  443.     sound_cfg_changed = 1
  444.     return Bladex.SetSoundVolume(v * 0.1)
  445.  
  446.  
  447. def GetMusicValue():
  448.     return int(10 * Bladex.GetMusicVolume())
  449.  
  450.  
  451. def SetMusicValue(v):
  452.     global sound_cfg_changed
  453.     sound_cfg_changed = 1
  454.     return Bladex.SetMusicVolume(v * 0.1)
  455.  
  456.  
  457. def GetSoundQuality():
  458.     global last_ss_quality
  459.     last_ss_quality = Bladex.GetSSQuality()
  460.     return Bladex.GetSSQuality()
  461.  
  462.  
  463. def SetSoundQuality(option):
  464.     global last_ss_quality, last_ss_quality, last_ss_quality
  465.     if option == 'High':
  466.         last_ss_quality = 2
  467.         return 2
  468.     
  469.     if option == 'Med':
  470.         last_ss_quality = 1
  471.         return 1
  472.     
  473.     if option == 'Low':
  474.         last_ss_quality = 0
  475.         return 0
  476.     
  477.  
  478.  
  479. def GetEAX():
  480.     return Bladex.GetEAXOverride()
  481.  
  482.  
  483. def SetEAX(option):
  484.     global sound_cfg_changed
  485.     sound_cfg_changed = 1
  486.     if option == 'Enabled':
  487.         Bladex.SetEAXOverride(0)
  488.     
  489.     if option == 'Disabled':
  490.         Bladex.SetEAXOverride(1)
  491.     
  492.  
  493.  
  494. def GetSpeakerConfig():
  495.     return Bladex.GetSpeakerConfig()
  496.  
  497.  
  498. def SetSpeakerConfig(option):
  499.     global sound_cfg_changed
  500.     sound_cfg_changed = 1
  501.     if option == '4':
  502.         Bladex.SetSpeakerConfig(3)
  503.         return 3
  504.     
  505.     if option == '2':
  506.         Bladex.SetSpeakerConfig(1)
  507.         return 1
  508.     
  509.     if option == '2 + Subwoofer':
  510.         Bladex.SetSpeakerConfig(2)
  511.         return 2
  512.     
  513.     if option == 'Earphones':
  514.         Bladex.SetSpeakerConfig(0)
  515.         return 0
  516.     
  517.  
  518.  
  519. def GetDeFacingValue():
  520.     return int(Bladex.GetAecGap())
  521.  
  522.  
  523. def SetDeFacingValue(v):
  524.     i = Bladex.SetAecGap(v)
  525.     SaveConfiguration()
  526.     return i
  527.  
  528. _MainMenu = None
  529.  
  530. def ActivateMenu():
  531.     global _MainMenu
  532.     
  533.     try:
  534.         AppMode = Bladex.GetAppMode()
  535.     except x:
  536.         print 'Error getting AppMode', x
  537.  
  538.     if AppMode == 'Game' or AppMode == 'Demo':
  539.         if AppMode == 'Demo':
  540.             import Demo_Stuff
  541.             if Demo_Stuff.demo_is_active == 1:
  542.                 print 'ERROR - Menu.ActivateMenu()'
  543.                 print 'Fix with a path but should NOT happen!!!'
  544.                 Demo_Stuff.DemoLoop()
  545.                 return None
  546.             
  547.         
  548.         _MainMenu = MainMenu('Menu Principal', Desc1)
  549.         NetMisc.SetMainMenu(_MainMenu)
  550.         _MainMenu.MenuStack.Push(_MainMenu.wMenu)
  551.         InputManager = BInput.GetInputManager()
  552.         oldInputActionsSet = InputManager.GetInputActionsSet()
  553.         InputManager.SetInputActionsSet('Menu')
  554.         Bladex.AddInputAction('Menu Next', 0)
  555.         Bladex.AddInputAction('Menu Prev', 0)
  556.         Bladex.AddInputAction('Menu Inc', 0)
  557.         Bladex.AddInputAction('Menu Dec', 0)
  558.         Bladex.AddInputAction('Menu ActivateItem', 0)
  559.         Bladex.AddInputAction('Menu DeActivateItem', 0)
  560.         Bladex.AddInputAction('Menu Supr', 0)
  561.         Bladex.AddInputAction('Menu Next Strong', 0)
  562.         Bladex.AssocKey('Menu Next', 'Keyboard', 'Down')
  563.         Bladex.AddBoundFunc('Menu Next', _MainMenu.MenuNextItem)
  564.         Bladex.AssocKey('Menu Prev', 'Keyboard', 'Up')
  565.         Bladex.AddBoundFunc('Menu Prev', _MainMenu.MenuPrevItem)
  566.         Bladex.AssocKey('Menu Inc', 'Keyboard', 'Right')
  567.         Bladex.AddBoundFunc('Menu Inc', _MainMenu.MenuIncItem)
  568.         Bladex.AssocKey('Menu Dec', 'Keyboard', 'Left')
  569.         Bladex.AddBoundFunc('Menu Dec', _MainMenu.MenuDecItem)
  570.         Bladex.AssocKey('Menu Supr', 'Keyboard', 'Delete')
  571.         Bladex.AddBoundFunc('Menu Supr', _MainMenu.MenuSuprItem)
  572.         Bladex.AssocKey('Menu ActivateItem', 'Keyboard', 'Enter')
  573.         Bladex.AddBoundFunc('Menu ActivateItem', _MainMenu.ActivateMenuItem)
  574.         Bladex.AssocKey('Menu DeActivateItem', 'Keyboard', 'Esc')
  575.         Bladex.AssocKey('Menu DeActivateItem', 'Keyboard', 'F1')
  576.         Bladex.AddBoundFunc('Menu DeActivateItem', _MainMenu.DeActivateMenuItem)
  577.         Bladex.AssocKey('Menu Next Strong', 'Keyboard', 'Tab')
  578.         Bladex.AddBoundFunc('Menu Next Strong', _MainMenu.MenuNextItemStrong)
  579.         InputManager = BInput.GetInputManager()
  580.         InputManager.SetInputActionsSet('Menu')
  581.         if Reference.DEMO_MODE == 0:
  582.             if netgame.GetNetState() == 0:
  583.                 SaveGame.CreateSaveMenu()
  584.             
  585.         
  586.     elif AppMode == 'Menu':
  587.         Bladex.AddScheduledFunc(Bladex.GetTime(), ClearMenuKeyb, ())
  588.         Bladex.SetAppMode('Game')
  589.         if netgame.GetNetState() == 0:
  590.             import Scorer
  591.             Scorer.ActivateScorer()
  592.         else:
  593.             NetScorer.ActivateScorer()
  594.         Raster.SetTextMode(3)
  595.     else:
  596.         print 'Invalid AppMode'
  597.     print 'End ActivateMenu()'
  598.  
  599.  
  600. def PreActivateMenu():
  601.     Bladex.AddScheduledFunc(Bladex.GetTime(), ActivateMenu, (), 'ActivateMenu')
  602.  
  603.  
  604. def ClearMenuKeyb():
  605.     global _MainMenu
  606.     InputManager = BInput.GetInputManager()
  607.     InputManager.SetInputActionsSet('Menu')
  608.     Bladex.RemoveInputAction('Menu Next')
  609.     Bladex.RemoveInputAction('Menu Prev')
  610.     Bladex.RemoveInputAction('Menu Inc')
  611.     Bladex.RemoveInputAction('Menu Dec')
  612.     Bladex.RemoveInputAction('Menu ActivateItem')
  613.     Bladex.RemoveInputAction('Menu DeActivateItem')
  614.     Bladex.RemoveInputAction('Menu Supr')
  615.     Bladex.RemoveInputAction('Menu Next Strong')
  616.     _MainMenu = None
  617.     InputManager.SetInputActionsSet('Default')
  618.  
  619. wNULL_MenuParent = BUIx.CreateNULLWidget()
  620.  
  621. class MainMenu:
  622.     
  623.     def __init__(self, Name, MenuDescription):
  624.         self.Name = Name
  625.         self.MenuDescription = MenuDescription
  626.         self.MenuStack = MenuWidget.MenuStack(ActivateMenu)
  627.         self.wMenu = MenuWidget.B_MenuTree(wNULL_MenuParent, self.MenuDescription, self.MenuStack)
  628.         self.wMenu.SetAutoScale(1)
  629.  
  630.     
  631.     def __del__(self):
  632.         self.MenuStack.Reset()
  633.         self.MenuStack = None
  634.         self.wMenu = None
  635.  
  636.     
  637.     def ActivateMenuItem(self):
  638.         if Bladex.GetAppMode() == 'Menu':
  639.             wActiveMenuElement = self.MenuStack.Top().GetFocus()
  640.             
  641.             try:
  642.                 sw = wActiveMenuElement.GetFocus()
  643.                 sw.ActivateItem(1)
  644.             except:
  645.                 wActiveMenuElement.ActivateItem(1)
  646.  
  647.             SndNewMenu.PlayStereo()
  648.         
  649.  
  650.     
  651.     def DeActivateMenuItem(self):
  652.         global sound_cfg_changed
  653.         if Bladex.GetAppMode() == 'Menu':
  654.             if self.MenuStack.nItems() == 1 and EscapeFunction != None:
  655.                 if EscapeFunction(0):
  656.                     return None
  657.                 
  658.             
  659.             wActiveMenuElement = self.MenuStack.Top().GetFocus()
  660.             
  661.             try:
  662.                 sw = wActiveMenuElement.GetFocus()
  663.                 sw.ActivateItem(0)
  664.             except:
  665.                 wActiveMenuElement.ActivateItem(0)
  666.  
  667.             if last_ss_quality != -1 and last_ss_quality != Bladex.GetSSQuality():
  668.                 print 'Reseting sound quality'
  669.                 Bladex.SetSSQuality(last_ss_quality)
  670.             elif sound_cfg_changed == 1:
  671.                 Bladex.SaveSSConfig()
  672.                 sound_cfg_changed = 0
  673.             
  674.             SndNewMenu.PlayStereo()
  675.         
  676.  
  677.     
  678.     def MenuNextItemStrong(self):
  679.         w = self.MenuStack.Top()
  680.         w.NextFocus()
  681.  
  682.     
  683.     def MenuNextItem(self):
  684.         w = self.MenuStack.Top()
  685.         sw = w.GetFocus()
  686.         if TBUDSoundAble:
  687.             SndCorreGema.PlayStereo()
  688.         
  689.         
  690.         try:
  691.             sw.NextFocus()
  692.         except:
  693.             w.NextFocus()
  694.  
  695.  
  696.     
  697.     def MenuPrevItem(self):
  698.         w = self.MenuStack.Top()
  699.         sw = w.GetFocus()
  700.         if TBUDSoundAble:
  701.             SndCorreGema.PlayStereo()
  702.         
  703.         
  704.         try:
  705.             sw.PrevFocus()
  706.         except:
  707.             w.PrevFocus()
  708.  
  709.  
  710.     
  711.     def MenuIncItem(self):
  712.         w = self.MenuStack.Top()
  713.         sw = w.GetFocus()
  714.         
  715.         try:
  716.             sw.IncMenuItem()
  717.         except AttributeError:
  718.             
  719.             try:
  720.                 w.IncMenuItem()
  721.             except AttributeError:
  722.                 pass
  723.  
  724.  
  725.  
  726.     
  727.     def MenuDecItem(self):
  728.         w = self.MenuStack.Top()
  729.         sw = w.GetFocus()
  730.         
  731.         try:
  732.             sw.DecMenuItem()
  733.         except AttributeError:
  734.             
  735.             try:
  736.                 w.DecMenuItem()
  737.             except AttributeError:
  738.                 pass
  739.  
  740.  
  741.  
  742.     
  743.     def MenuSuprItem(self):
  744.         print 'MenuSuprItem(self)'
  745.         w = self.MenuStack.Top().GetFocus()
  746.         sw = w.GetFocus()
  747.         
  748.         try:
  749.             sw.SuprMenuItem()
  750.         except:
  751.             w.SuprMenuItem()
  752.  
  753.  
  754.     
  755.     def CommandPrb(self):
  756.         print 'Method CommandPrb'
  757.  
  758.     
  759.     def EndMenu(self):
  760.         while len(self.MenuStack.Top()) > 0:
  761.             self.DeActivateMenuItem()
  762.  
  763.  
  764. CtrlsPosition = (70, BUIx.B_FrameWidget.B_FR_AbsoluteLeft, BUIx.B_FrameWidget.B_FR_Left)
  765.  
  766. def GoTo2d(menu_class):
  767.     import GotoMapVars
  768.     GotoMapVars.EndOfLevel()
  769.  
  770. vsepexit = 200 - int(46 * ((600 - Raster.GetSize()[1]) / 120))
  771. if Reference.DEMO_MODE:
  772.     QuitMenu = {
  773.         'VSep': 30,
  774.         'Name': MenuText.GetMenuText('EXIT'),
  775.         'Font': MenuFontBig,
  776.         'iFocus': 2,
  777.         'ListDescr': [
  778.             {
  779.                 'Name': MenuText.GetMenuText('Exit, Are you sure?'),
  780.                 'VSep': vsepexit,
  781.                 'Font': MenuFontBig,
  782.                 'Kind': MenuWidget.B_MenuItemTextNoFXNoFocus },
  783.             {
  784.                 'Name': MenuText.GetMenuText('Yes'),
  785.                 'VSep': 20,
  786.                 'Font': MenuFontMed,
  787.                 'ListDescr': [
  788.                     {
  789.                         'Name': 'Features',
  790.                         'Kind': MenuWidget.B_BackFeatures },
  791.                     {
  792.                         'Name': ' ' }] },
  793.             {
  794.                 'Name': MenuText.GetMenuText('No'),
  795.                 'VSep': 10,
  796.                 'Font': MenuFontMed,
  797.                 'Command': BackMenu },
  798.             {
  799.                 'Name': 'Back',
  800.                 'Kind': MenuWidget.B_BackBlank }] }
  801. else:
  802.     QuitMenu = {
  803.         'VSep': 130,
  804.         'Name': MenuText.GetMenuText('EXIT'),
  805.         'Font': MenuFontBig,
  806.         'iFocus': 2,
  807.         'ListDescr': [
  808.             {
  809.                 'Name': MenuText.GetMenuText('Exit, Are you sure?'),
  810.                 'VSep': vsepexit,
  811.                 'Font': MenuFontBig,
  812.                 'Kind': MenuWidget.B_MenuItemTextNoFXNoFocus },
  813.             {
  814.                 'Name': MenuText.GetMenuText('Yes'),
  815.                 'VSep': 20,
  816.                 'Command': CmdQuit,
  817.                 'Font': MenuFontMed },
  818.             {
  819.                 'Name': MenuText.GetMenuText('No'),
  820.                 'VSep': 10,
  821.                 'Font': MenuFontMed,
  822.                 'Command': BackMenu },
  823.             {
  824.                 'Name': 'Back',
  825.                 'Kind': MenuWidget.B_BackBlank }] }
  826. PlayerConfigMenu = [
  827.     {
  828.         'Name': MenuText.GetMenuText('NAME:'),
  829.         'VSep': 30,
  830.         'Kind': netwidgets.B_InputBox,
  831.         'MaxSize': 16,
  832.         'GetInput': NetMisc.GetPlayerName,
  833.         'SetInput': NetMisc.SetPlayerName },
  834.     {
  835.         'Name': MenuText.GetMenuText('CHARACTER:'),
  836.         'Font': MenuFontMed,
  837.         'Kind': MenuWidget.B_MenuItemOption,
  838.         'Options': [
  839.             MenuText.GetMenuText('Knight'),
  840.             MenuText.GetMenuText('Barbarian'),
  841.             MenuText.GetMenuText('Dwarf'),
  842.             MenuText.GetMenuText('Amazon')],
  843.         'SelOptionFunc': NetMisc.GetCharType,
  844.         'Command': NetMisc.SetCharType },
  845.     {
  846.         'Name': 'Lista de jugadores',
  847.         'Kind': netwidgets.B_ImageListWidget,
  848.         'ImageList': NetMisc.CharBitmaps,
  849.         'GetCharType': NetMisc.GetCharStatus,
  850.         'VSep': 30 },
  851.     {
  852.         'Name': MenuText.GetMenuText('Next Skin'),
  853.         'VSep': 30,
  854.         'Command': NetMisc.NextSkin },
  855.     {
  856.         'Name': MenuText.GetMenuText('Level') + ':',
  857.         'Kind': MenuWidget.B_MenuSpin,
  858.         'SpinValues': (1, 4, 3),
  859.         'SpinGetValue': NetMisc.GetHandicap,
  860.         'SpinSetValueEnd': NetMisc.SetHandicap },
  861.     {
  862.         'Name': MenuText.GetMenuText('Save'),
  863.         'Command': NetMisc.SavePlayerConfiguration },
  864.     {
  865.         'Name': 'Back',
  866.         'Kind': MenuWidget.B_BackBlank }]
  867.  
  868. def MapLoading(option):
  869.     if Character == 0:
  870.         Bladex.LoadLevel('Ruins_M4')
  871.     
  872.     if Character == 1:
  873.         Bladex.LoadLevel('Barb_M1')
  874.     
  875.     if Character == 2:
  876.         Bladex.LoadLevel('Ragnar_M2')
  877.     
  878.     if Character == 3:
  879.         Bladex.LoadLevel('Dwarf_M3')
  880.     
  881.  
  882. TutGameChoosing = {
  883.     'Name': 'TopMenu',
  884.     'Kind': MenuWidget.B_MenuItemTextNoFX,
  885.     'ListDescr': [
  886.         {
  887.             'Name': MenuText.GetMenuText('ENTER TUTORIAL'),
  888.             'VSep': 180,
  889.             'Font': MenuFontBig,
  890.             'Command': LoadTutorial },
  891.         {
  892.             'Name': MenuText.GetMenuText('CONTINUE'),
  893.             'Font': MenuFontBig,
  894.             'Command': MapLoading },
  895.         BackOption,
  896.         {
  897.             'Name': 'Back',
  898.             'Kind': MenuWidget.B_BackImageWidget }] }
  899. NormalMenu = 1
  900.  
  901. def GetPasswordMenu():
  902.     if CORRECT_GORE_PASSWORD == '':
  903.         return ParentalLockOffMenu
  904.     else:
  905.         return ParentalLockOnMenu
  906.  
  907.  
  908. def SwitchParentalLock(Option):
  909.     global CORRECT_GORE_PASSWORD, GORE_PASSWORD, GORE_PASSWORD, CORRECT_GORE_PASSWORD, GORE_PASSWORD
  910.     print 'Hola!'
  911.     parl = GetMenuItem([
  912.         'OPTIONS',
  913.         'GORE'])
  914.     if parl['ListDescr'][0] == ParentalLockOffMenu:
  915.         if NEW_GORE_PASSWORD == CONFIRM_GORE_PASSWORD and CONFIRM_GORE_PASSWORD != '':
  916.             CORRECT_GORE_PASSWORD = NEW_GORE_PASSWORD
  917.             GORE_PASSWORD = CORRECT_GORE_PASSWORD
  918.             SavePasswordFile()
  919.             _MainMenu.DeActivateMenuItem()
  920.             _MainMenu.DeActivateMenuItem()
  921.             parl['ListDescr'][0] = ParentalLockOnMenu
  922.             GORE_PASSWORD = ''
  923.             Bladex.SetBloodLevel(0)
  924.             Bladex.SetMutilationLevel(0)
  925.             SaveConfiguration()
  926.             _MainMenu.ActivateMenuItem()
  927.         
  928.     elif CORRECT_GORE_PASSWORD == GORE_PASSWORD:
  929.         _MainMenu.DeActivateMenuItem()
  930.         _MainMenu.DeActivateMenuItem()
  931.         parl['ListDescr'][0] = ParentalLockOffMenu
  932.         CORRECT_GORE_PASSWORD = ''
  933.         GORE_PASSWORD = ''
  934.         SavePasswordFile()
  935.         _MainMenu.ActivateMenuItem()
  936.     
  937.  
  938. ParentalLockOnMenu = {
  939.     'Name': MenuText.GetMenuText('Parental Lock ON'),
  940.     'VSep': 200,
  941.     'Font': MenuFontBig,
  942.     'ListDescr': [
  943.         {
  944.             'Name': MenuText.GetMenuText('Password:'),
  945.             'VSep': 185,
  946.             'Kind': netwidgets.B_InputBox,
  947.             'MaxSize': 8,
  948.             'GetInput': Empty,
  949.             'SetInput': SetPass,
  950.             'PasswordChar': '#' },
  951.         {
  952.             'Name': MenuText.GetMenuText('Accept'),
  953.             'VSep': 50,
  954.             'Font': MenuFontBig,
  955.             'Command': SwitchParentalLock },
  956.         BackOption,
  957.         {
  958.             'Name': 'Back',
  959.             'Kind': MenuWidget.B_BackImageWidget }] }
  960. ParentalLockOffMenu = {
  961.     'Name': MenuText.GetMenuText('Parental Lock OFF'),
  962.     'VSep': 200,
  963.     'Font': MenuFontBig,
  964.     'ListDescr': [
  965.         {
  966.             'Name': MenuText.GetMenuText('New Password:'),
  967.             'Kind': netwidgets.B_InputBox,
  968.             'VSep': 185,
  969.             'MaxSize': 8,
  970.             'GetInput': Empty,
  971.             'SetInput': SetNewPass,
  972.             'PasswordChar': '#' },
  973.         {
  974.             'Name': MenuText.GetMenuText('Confirm New Password:'),
  975.             'Kind': netwidgets.B_InputBox,
  976.             'MaxSize': 8,
  977.             'GetInput': Empty,
  978.             'SetInput': SetConfNewPass,
  979.             'PasswordChar': '#' },
  980.         {
  981.             'Name': MenuText.GetMenuText('Accept'),
  982.             'VSep': 50,
  983.             'Font': MenuFontBig,
  984.             'Command': SwitchParentalLock },
  985.         BackOption,
  986.         {
  987.             'Name': 'Back',
  988.             'Kind': MenuWidget.B_BackImageWidget }] }
  989.  
  990. def SwitchCasaByGlobalMenu():
  991.     global Desc1, TutGameChoosing
  992.     DescAux = Desc1
  993.     Desc1 = TutGameChoosing
  994.     TutGameChoosing = DescAux
  995.     DescAux = None
  996.  
  997.  
  998. def SwitchToCasaMenu():
  999.     global NormalMenu
  1000.     if NormalMenu:
  1001.         NormalMenu = 0
  1002.         SwitchCasaByGlobalMenu()
  1003.         if Reference.DEMO_MODE:
  1004.             GetMenuItem([
  1005.                 'ENTER TUTORIAL'])['Kind'] = MenuWidget.B_MenuItemTextNoFXNoFocus
  1006.         
  1007.     
  1008.  
  1009.  
  1010. def SwitchToGlobalMenu():
  1011.     global NormalMenu
  1012.     if not NormalMenu:
  1013.         NormalMenu = 1
  1014.         SwitchCasaByGlobalMenu()
  1015.     
  1016.  
  1017. if netgame.GetNetState() != 0:
  1018.     PlayerConfigMenu.insert(6, {
  1019.         'Name': MenuText.GetMenuText('This modification will take effect in the next arena'),
  1020.         'VSep': 20,
  1021.         'Font': MenuFontSmall,
  1022.         'Kind': MenuWidget.B_MenuItemTextNoFXNoFocus })
  1023.     Desc1 = {
  1024.         'Name': 'TopMenu',
  1025.         'Kind': MenuWidget.B_MenuItemTextNoFX,
  1026.         'ListDescr': [
  1027.             {
  1028.                 'Name': MenuText.GetMenuText('Disconnect'),
  1029.                 'VSep': 220,
  1030.                 'Font': MenuFontBig,
  1031.                 'Command': NetMisc.Disconnect },
  1032.             {
  1033.                 'Name': MenuText.GetMenuText('Modify Player'),
  1034.                 'Font': MenuFontBig,
  1035.                 'ListDescr': PlayerConfigMenu },
  1036.             QuitMenu,
  1037.             {
  1038.                 'Name': 'Back',
  1039.                 'Kind': MenuWidget.B_BackImageWidget }] }
  1040. else:
  1041.     Desc1 = {
  1042.         'Name': 'TopMenu',
  1043.         'Size': (640, 480),
  1044.         'Kind': MenuWidget.B_MenuItemTextNoFX,
  1045.         'ListDescr': [
  1046.             {
  1047.                 'Name': MenuText.GetMenuText('GAME'),
  1048.                 'Font': MenuFontBig,
  1049.                 'VSep': 100,
  1050.                 'Size': (640, 480),
  1051.                 'ListDescr': [
  1052.                     {
  1053.                         'Name': MenuText.GetMenuText('START NEW GAME'),
  1054.                         'Size': (640, 480),
  1055.                         'Font': MenuFontBig,
  1056.                         'VSep': 140,
  1057.                         'Command': LoadPlayerSelect },
  1058.                     {
  1059.                         'Name': MenuText.GetMenuText('SAVE GAME'),
  1060.                         'Font': MenuFontBig,
  1061.                         'Size': (640, 480),
  1062.                         'ListDescr': [
  1063.                             {
  1064.                                 'Name': MenuText.GetMenuText('Savegame Slot 1:'),
  1065.                                 'Font': MenuFontBig,
  1066.                                 'VSep': 200,
  1067.                                 'Command': SaveGame1 },
  1068.                             {
  1069.                                 'Name': MenuText.GetMenuText('Savegame Slot 2:'),
  1070.                                 'Font': MenuFontBig,
  1071.                                 'VSep': 20,
  1072.                                 'Command': SaveGame2 },
  1073.                             {
  1074.                                 'Name': MenuText.GetMenuText('Savegame Slot 3:'),
  1075.                                 'Font': MenuFontBig,
  1076.                                 'VSep': 20,
  1077.                                 'Command': SaveGame3 },
  1078.                             {
  1079.                                 'Name': MenuText.GetMenuText('Savegame Slot 4:'),
  1080.                                 'Font': MenuFontBig,
  1081.                                 'VSep': 20,
  1082.                                 'Command': SaveGame4 },
  1083.                             {
  1084.                                 'Name': 'Back',
  1085.                                 'Kind': MenuWidget.B_BackImageWidget }] },
  1086.                     {
  1087.                         'Name': MenuText.GetMenuText('LOAD GAME'),
  1088.                         'Font': MenuFontBig,
  1089.                         'Size': (640, 480),
  1090.                         'ListDescr': [
  1091.                             {
  1092.                                 'Name': MenuText.GetMenuText('Load Game at Slot 1:'),
  1093.                                 'Font': MenuFontBig,
  1094.                                 'VSep': 200,
  1095.                                 'Command': LoadGame },
  1096.                             {
  1097.                                 'Name': MenuText.GetMenuText('Load Game at Slot 2:'),
  1098.                                 'Font': MenuFontBig,
  1099.                                 'VSep': 20,
  1100.                                 'Command': LoadGame2 },
  1101.                             {
  1102.                                 'Name': MenuText.GetMenuText('Load Game at Slot 3:'),
  1103.                                 'Font': MenuFontBig,
  1104.                                 'VSep': 20,
  1105.                                 'Command': LoadGame3 },
  1106.                             {
  1107.                                 'Name': MenuText.GetMenuText('Load Game at Slot 4:'),
  1108.                                 'Font': MenuFontBig,
  1109.                                 'VSep': 20,
  1110.                                 'Command': LoadGame4 },
  1111.                             {
  1112.                                 'Name': 'Back',
  1113.                                 'Kind': MenuWidget.B_BackImageWidget }] },
  1114.                     {
  1115.                         'Name': MenuText.GetMenuText('ARENA'),
  1116.                         'Font': MenuFontBig,
  1117.                         'Size': (640, 480),
  1118.                         'VSep': 20,
  1119.                         'ListDescr': [
  1120.                             {
  1121.                                 'Name': MenuText.GetMenuText('Connection:'),
  1122.                                 'Font': MenuFontMed,
  1123.                                 'VSep': 150,
  1124.                                 'Kind': MenuWidget.B_MenuItemOption,
  1125.                                 'Options': [
  1126.                                     MenuText.GetMenuText('IPX (Local network)'),
  1127.                                     MenuText.GetMenuText('TCP/IP (Internet)')],
  1128.                                 'SelOptionFunc': NetMisc.GetProtocol,
  1129.                                 'Command': NetMisc.SetProtocol },
  1130.                             {
  1131.                                 'Name': MenuText.GetMenuText('NEW ARENA'),
  1132.                                 'Size': (640, 480),
  1133.                                 'Font': MenuFontBig,
  1134.                                 'ListDescr': [
  1135.                                     {
  1136.                                         'Name': MenuText.GetMenuText('Name:'),
  1137.                                         'VSep': 20,
  1138.                                         'Kind': netwidgets.B_InputBox,
  1139.                                         'MaxSize': 16,
  1140.                                         'GetInput': NetMisc.GetArenaName,
  1141.                                         'SetInput': NetMisc.SetArenaName },
  1142.                                     {
  1143.                                         'Name': 'Lista de mapas',
  1144.                                         'Kind': netwidgets.B_MapListWidget,
  1145.                                         'LeftMap': '../../Data/net/MapL.bmp',
  1146.                                         'RightMap': '../../Data/net/MapR.bmp',
  1147.                                         'SelMap': '../../Data/net/MapM.bmp',
  1148.                                         'MarkMap': '../../Data/net/MapS.bmp',
  1149.                                         'MapGetValue': NetMisc.GetArenaMaps,
  1150.                                         'MapSetValue': NetMisc.SetArenaMaps,
  1151.                                         'VSep': 15 },
  1152.                                     {
  1153.                                         'Name': MenuText.GetMenuText('The bad place'),
  1154.                                         'VSep': 1,
  1155.                                         'Kind': netwidgets.B_DescriptorLabel },
  1156.                                     {
  1157.                                         'Name': MenuText.GetMenuText('Max players:'),
  1158.                                         'Kind': MenuWidget.B_MenuSpin,
  1159.                                         'SpinValues': (2, 10, 8),
  1160.                                         'SpinGetValue': NetMisc.GetMaxPlayers,
  1161.                                         'SpinSetValueEnd': NetMisc.SetMaxPlayers,
  1162.                                         'VSep': 30 },
  1163.                                     {
  1164.                                         'Name': MenuText.GetMenuText('Max Level:'),
  1165.                                         'Kind': MenuWidget.B_MenuSpin,
  1166.                                         'SpinValues': (1, 4, 3),
  1167.                                         'SpinGetValue': NetMisc.GetArenaHandicap,
  1168.                                         'SpinSetValueEnd': NetMisc.SetArenaHandicap },
  1169.                                     {
  1170.                                         'Name': MenuText.GetMenuText('Packets per second:'),
  1171.                                         'Font': MenuFontMed,
  1172.                                         'Kind': MenuWidget.B_MenuItemOption,
  1173.                                         'Options': [
  1174.                                             MenuText.GetMenuText('Variable'),
  1175.                                             '10',
  1176.                                             '20',
  1177.                                             '30',
  1178.                                             '40',
  1179.                                             '50',
  1180.                                             '60'],
  1181.                                         'SelOptionFunc': NetMisc.GetPPS,
  1182.                                         'Command': NetMisc.SetPPS },
  1183.                                     {
  1184.                                         'Name': MenuText.GetMenuText('Death Limit:'),
  1185.                                         'Kind': MenuWidget.B_MenuSpin,
  1186.                                         'SpinValues': (1, 51, 50),
  1187.                                         'SpinGetValue': NetMisc.GetFragLimit,
  1188.                                         'SpinSetValueEnd': NetMisc.SetFragLimit },
  1189.                                     {
  1190.                                         'Name': MenuText.GetMenuText('START'),
  1191.                                         'Command': NetMisc.StartServer },
  1192.                                     {
  1193.                                         'Name': MenuText.GetMenuText('BACK'),
  1194.                                         'VSep': 10,
  1195.                                         'Command': BackMenu },
  1196.                                     {
  1197.                                         'Name': 'Back',
  1198.                                         'Kind': MenuWidget.B_BackBlank }] },
  1199.                             {
  1200.                                 'Name': MenuText.GetMenuText('JOIN GAME'),
  1201.                                 'Size': (640, 480),
  1202.                                 'Font': MenuFontBig,
  1203.                                 'ListDescr': [
  1204.                                     {
  1205.                                         'Name': MenuText.GetMenuText('Address:'),
  1206.                                         'Kind': netwidgets.B_InputBox,
  1207.                                         'MaxSize': 32,
  1208.                                         'GetInput': NetMisc.GetIp,
  1209.                                         'SetInput': NetMisc.SetIp,
  1210.                                         'Locked': NetMisc.IpLooked,
  1211.                                         'VSep': 120 },
  1212.                                     {
  1213.                                         'Name': MenuText.GetMenuText('Search'),
  1214.                                         'Command': NetMisc.BrowseServers },
  1215.                                     {
  1216.                                         'Name': MenuText.GetMenuText("Server's list"),
  1217.                                         'Kind': netwidgets.B_ServerListWidget,
  1218.                                         'Size': (610, 200),
  1219.                                         'ListDescr': [] },
  1220.                                     {
  1221.                                         'Name': MenuText.GetMenuText('BACK'),
  1222.                                         'VSep': 10,
  1223.                                         'Command': BackMenu },
  1224.                                     {
  1225.                                         'Name': 'Back',
  1226.                                         'Kind': MenuWidget.B_BackBlank }] },
  1227.                             {
  1228.                                 'Name': MenuText.GetMenuText('PLAYER CONFIGURATION'),
  1229.                                 'Font': MenuFontBig,
  1230.                                 'ListDescr': PlayerConfigMenu },
  1231.                             BackOption,
  1232.                             {
  1233.                                 'Name': 'Back',
  1234.                                 'Kind': MenuWidget.B_BackImageWidget }] },
  1235.                     BackOption,
  1236.                     {
  1237.                         'Name': 'Back',
  1238.                         'Kind': MenuWidget.B_BackImageWidget }] },
  1239.             {
  1240.                 'Name': MenuText.GetMenuText('CONTROLS'),
  1241.                 'VSep': 10,
  1242.                 'Font': MenuFontBig,
  1243.                 'Size': (640, 480),
  1244.                 'ListDescr': [
  1245.                     {
  1246.                         'Name': MenuText.GetMenuText('KEYBOARD/GAMEPAD'),
  1247.                         'VSep': 180,
  1248.                         'Size': (640, 480),
  1249.                         'Font': MenuFontBig,
  1250.                         'ListDescr': [
  1251.                             {
  1252.                                 'Name': MenuText.GetMenuText('CONFIGURE ACTIONS'),
  1253.                                 'VSep': 180,
  1254.                                 'Size': (640, 480),
  1255.                                 'Font': MenuFontBig,
  1256.                                 'ListDescr': [
  1257.                                     {
  1258.                                         'Name': 'KeybList',
  1259.                                         'Kind': KeybWidget.B_KeybListWidget,
  1260.                                         'VSep': 120,
  1261.                                         'Size': (610, 200),
  1262.                                         'ListDescr': KeybActions },
  1263.                                     BackOption,
  1264.                                     {
  1265.                                         'Name': 'Back',
  1266.                                         'Kind': MenuWidget.B_BackImageWidget }] },
  1267.                             BackOption,
  1268.                             {
  1269.                                 'Name': 'Back',
  1270.                                 'Kind': MenuWidget.B_BackImageWidget }] },
  1271.                     {
  1272.                         'Name': MenuText.GetMenuText('MOUSE'),
  1273.                         'Font': MenuFontBig,
  1274.                         'Size': (640, 480),
  1275.                         'ListDescr': [
  1276.                             {
  1277.                                 'Name': MenuText.GetMenuText('Invert'),
  1278.                                 'VSep': 185,
  1279.                                 'Font': MenuFontMed,
  1280.                                 'Kind': MenuWidget.B_MenuItemOption,
  1281.                                 'Options': [
  1282.                                     MenuText.GetMenuText('Yes'),
  1283.                                     MenuText.GetMenuText('No')],
  1284.                                 'SelOptionFunc': GetMouseInvert,
  1285.                                 'Command': SetMouseInvert },
  1286.                             {
  1287.                                 'Name': MenuText.GetMenuText('X Speed'),
  1288.                                 'Font': MenuFontMed,
  1289.                                 'Kind': MenuWidget.B_MenuSpin,
  1290.                                 'SpinValues': (int(0), int(10), int(10)),
  1291.                                 'SpinGetValue': GetMouseXSens,
  1292.                                 'SpinSetValueEnd': SetMouseXSens },
  1293.                             {
  1294.                                 'Name': MenuText.GetMenuText('Y Speed'),
  1295.                                 'Font': MenuFontMed,
  1296.                                 'Kind': MenuWidget.B_MenuSpin,
  1297.                                 'SpinValues': (int(0), int(10), int(10)),
  1298.                                 'SpinGetValue': GetMouseYSens,
  1299.                                 'SpinSetValueEnd': SetMouseYSens },
  1300.                             BackOption,
  1301.                             {
  1302.                                 'Name': 'Back',
  1303.                                 'Kind': MenuWidget.B_BackImageWidget }] },
  1304.                     {
  1305.                         'Name': MenuText.GetMenuText('RESET TO DEFAULTS'),
  1306.                         'Font': MenuFontBig,
  1307.                         'Command': ResetKeyB },
  1308.                     BackOption,
  1309.                     {
  1310.                         'Name': 'Back',
  1311.                         'Kind': MenuWidget.B_BackImageWidget }] },
  1312.             {
  1313.                 'Name': MenuText.GetMenuText('OPTIONS'),
  1314.                 'VSep': 10,
  1315.                 'Font': MenuFontBig,
  1316.                 'Size': (640, 480),
  1317.                 'ListDescr': [
  1318.                     {
  1319.                         'Name': MenuText.GetMenuText('VIDEO'),
  1320.                         'VSep': 120,
  1321.                         'Size': (640, 480),
  1322.                         'Font': MenuFontBig,
  1323.                         'ListDescr': [
  1324.                             {
  1325.                                 'Name': MenuText.GetMenuText('Gamma:'),
  1326.                                 'VSep': 151,
  1327.                                 'Font': MenuFontMed,
  1328.                                 'Kind': MenuWidget.B_MenuSpin,
  1329.                                 'SpinValues': (0.0, 1.0, 20),
  1330.                                 'SpinGetValue': GetGammaValue,
  1331.                                 'SpinOnChange': SetGammaValue,
  1332.                                 'SpinSetValue': SetGammaValue },
  1333.                             {
  1334.                                 'Name': MenuText.GetMenuText('Contrast:'),
  1335.                                 'VSep': 15,
  1336.                                 'Font': MenuFontMed,
  1337.                                 'Kind': MenuWidget.B_MenuSpin,
  1338.                                 'SpinValues': (0.5, 4.0, 35),
  1339.                                 'SpinGetValue': GetContrastValue,
  1340.                                 'SpinOnChange': SetContrastValue,
  1341.                                 'SpinSetValue': SetContrastValue },
  1342.                             {
  1343.                                 'Name': MenuText.GetMenuText('Brightness:'),
  1344.                                 'VSep': 15,
  1345.                                 'Font': MenuFontMed,
  1346.                                 'Kind': MenuWidget.B_MenuSpin,
  1347.                                 'SpinValues': (0.0, 50.0, 25),
  1348.                                 'SpinGetValue': GetBrightnessValue,
  1349.                                 'SpinOnChange': SetBrightnessValue,
  1350.                                 'SpinSetValue': SetBrightnessValue },
  1351.                             {
  1352.                                 'Name': MenuText.GetMenuText('RESET COLOR CONTROL'),
  1353.                                 'VSep': 15,
  1354.                                 'Font': MenuFontMed,
  1355.                                 'Command': ResetVideo },
  1356.                             {
  1357.                                 'Name': MenuText.GetMenuText('Character Shadows:'),
  1358.                                 'VSep': 15,
  1359.                                 'Font': MenuFontMed,
  1360.                                 'Kind': MenuWidget.B_MenuItemOption,
  1361.                                 'Options': [
  1362.                                     MenuText.GetMenuText('Yes'),
  1363.                                     MenuText.GetMenuText('No')],
  1364.                                 'SelOptionFunc': ShadowsSettings,
  1365.                                 'Command': SetShadows },
  1366.                             BackOption,
  1367.                             {
  1368.                                 'Name': 'Back',
  1369.                                 'Kind': MenuWidget.B_BackImageWidget }] },
  1370.                     {
  1371.                         'Name': MenuText.GetMenuText('SOUND'),
  1372.                         'VSep': 10,
  1373.                         'Font': MenuFontBig,
  1374.                         'Size': (640, 480),
  1375.                         'ListDescr': [
  1376.                             {
  1377.                                 'Name': MenuText.GetMenuText('FX Volume:'),
  1378.                                 'VSep': 152,
  1379.                                 'Font': MenuFontMed,
  1380.                                 'Kind': MenuWidget.B_MenuSpin,
  1381.                                 'SpinValues': (int(0), int(10), int(10)),
  1382.                                 'SpinGetValue': GetSoundValue,
  1383.                                 'SpinSetValueEnd': SetSoundValue },
  1384.                             {
  1385.                                 'Name': MenuText.GetMenuText('Music Volume:'),
  1386.                                 'VSep': 10,
  1387.                                 'Font': MenuFontMed,
  1388.                                 'Kind': MenuWidget.B_MenuSpin,
  1389.                                 'SpinValues': (int(0), int(10), int(10)),
  1390.                                 'SpinGetValue': GetMusicValue,
  1391.                                 'SpinSetValueEnd': SetMusicValue },
  1392.                             {
  1393.                                 'Name': MenuText.GetMenuText('Sound Quality:'),
  1394.                                 'VSep': 10,
  1395.                                 'Font': MenuFontMed,
  1396.                                 'Kind': MenuWidget.B_MenuItemOption,
  1397.                                 'Options': [
  1398.                                     MenuText.GetMenuText('Low'),
  1399.                                     MenuText.GetMenuText('Med'),
  1400.                                     MenuText.GetMenuText('High')],
  1401.                                 'SelOptionFunc': GetSoundQuality,
  1402.                                 'Command': SetSoundQuality },
  1403.                             {
  1404.                                 'Name': MenuText.GetMenuText('EAX:'),
  1405.                                 'VSep': 10,
  1406.                                 'Font': MenuFontMed,
  1407.                                 'Options': [
  1408.                                     MenuText.GetMenuText('Disabled'),
  1409.                                     MenuText.GetMenuText('Enabled')],
  1410.                                 'Kind': MenuWidget.B_MenuItemOption,
  1411.                                 'SelOptionFunc': GetEAX,
  1412.                                 'Command': SetEAX },
  1413.                             {
  1414.                                 'Name': MenuText.GetMenuText('EAX (FOR IMPROVED ENVIRONMENTAL REALISM)'),
  1415.                                 'VSep': 5,
  1416.                                 'Font': MenuFontSmall,
  1417.                                 'Kind': MenuWidget.B_MenuItemTextNoFXNoFocus },
  1418.                             {
  1419.                                 'Name': MenuText.GetMenuText('Speaker Configuration:'),
  1420.                                 'VSep': 10,
  1421.                                 'Font': MenuFontMed,
  1422.                                 'Options': [
  1423.                                     MenuText.GetMenuText('Earphones'),
  1424.                                     MenuText.GetMenuText('2'),
  1425.                                     MenuText.GetMenuText('2 + Subwoofer'),
  1426.                                     MenuText.GetMenuText('4')],
  1427.                                 'Kind': MenuWidget.B_MenuItemOption,
  1428.                                 'SelOptionFunc': GetSpeakerConfig,
  1429.                                 'Command': SetSpeakerConfig },
  1430.                             BackOption,
  1431.                             {
  1432.                                 'Name': 'Back',
  1433.                                 'Kind': MenuWidget.B_BackImageWidget }] },
  1434.                     {
  1435.                         'Name': MenuText.GetMenuText('GORE'),
  1436.                         'VSep': 10,
  1437.                         'Font': MenuFontBig,
  1438.                         'ListDescr': [
  1439.                             GetPasswordMenu(),
  1440.                             {
  1441.                                 'VSep': 20,
  1442.                                 'Name': MenuText.GetMenuText('Blood:'),
  1443.                                 'Font': MenuFontBig,
  1444.                                 'Kind': MenuWidget.B_MenuItemOption,
  1445.                                 'Options': [
  1446.                                     MenuText.GetMenuText('Yes'),
  1447.                                     MenuText.GetMenuText('No')],
  1448.                                 'Command': SetBlood,
  1449.                                 'SelOptionFunc': BloodSettings,
  1450.                                 'CheckPass': CheckGorePassWord },
  1451.                             {
  1452.                                 'Name': MenuText.GetMenuText('Mutilations:'),
  1453.                                 'Font': MenuFontBig,
  1454.                                 'Kind': MenuWidget.B_MenuItemOption,
  1455.                                 'Options': [
  1456.                                     MenuText.GetMenuText('Yes'),
  1457.                                     MenuText.GetMenuText('No')],
  1458.                                 'Command': SetMutilation,
  1459.                                 'SelOptionFunc': MutilationSettings,
  1460.                                 'CheckPass': CheckGorePassWord },
  1461.                             BackOption,
  1462.                             {
  1463.                                 'Name': 'Back',
  1464.                                 'Kind': MenuWidget.B_BackImageWidget }] },
  1465.                     {
  1466.                         'Name': MenuText.GetMenuText('AUTO LOCK ON:'),
  1467.                         'VSep': 30,
  1468.                         'Font': MenuFontBig,
  1469.                         'Kind': MenuWidget.B_MenuItemOption,
  1470.                         'Options': [
  1471.                             MenuText.GetMenuText('No'),
  1472.                             MenuText.GetMenuText('Yes')],
  1473.                         'Command': SetFacing,
  1474.                         'SelOptionFunc': GetFacing },
  1475.                     BackOption,
  1476.                     {
  1477.                         'Name': 'Back',
  1478.                         'Kind': MenuWidget.B_BackImageWidget }] },
  1479.             {
  1480.                 'Name': MenuText.GetMenuText('CREDITS'),
  1481.                 'VSep': 10,
  1482.                 'Size': (640, 480),
  1483.                 'Font': MenuFontBig,
  1484.                 'ListDescr': [
  1485.                     {
  1486.                         'Name': 'Credits',
  1487.                         'Kind': Credits.B_CreditsImageWidget,
  1488.                         'ImageList': Credits.BitmapsNames }] },
  1489.             QuitMenu,
  1490.             {
  1491.                 'Name': 'Back',
  1492.                 'Size': (640, 480),
  1493.                 'Kind': MenuWidget.B_BackImageWidget }] }
  1494.     if 'Casa' != Bladex.GetCurrentMap():
  1495.         Desc1['ListDescr'].insert(1, {
  1496.             'Name': MenuText.GetMenuText('BACK TO GAME'),
  1497.             'Font': MenuFontBig,
  1498.             'Command': BackMenu })
  1499.     
  1500.  
  1501. def BackMap():
  1502.     Desc1['ListDescr'].insert(len(Desc1['ListDescr']) - 1, {
  1503.         'Name': MenuText.GetMenuText('Leave Rune Quest'),
  1504.         'Font': MenuFontBig,
  1505.         'Command': GoTo2d,
  1506.         'VSep': 20 })
  1507.  
  1508.  
  1509. def GetMenuItem(way):
  1510.     idx = 0
  1511.     continueflag = 1
  1512.     MenuLevel = Desc1
  1513.     ReturnValue = 1
  1514.     while continueflag:
  1515.         continueflag = 0
  1516.         for val in MenuLevel['ListDescr']:
  1517.             if val.has_key('Name'):
  1518.                 print 'see', val['Name']
  1519.                 if MenuText.GetInverseMenuText(val['Name']) == way[idx]:
  1520.                     idx = idx + 1
  1521.                     if len(way) == idx:
  1522.                         ReturnValue = val
  1523.                     elif val.has_key('ListDescr'):
  1524.                         continueflag = 1
  1525.                         MenuLevel = val
  1526.                         print 'Searching at', val['Name']
  1527.                     else:
  1528.                         print val['Name'], 'is not a list'
  1529.                     break
  1530.                 
  1531.             
  1532.         
  1533.     MenuLevel = None
  1534.     return ReturnValue
  1535.  
  1536.  
  1537. def InitMenuKeys():
  1538.     Raster.SetTextMode(3)
  1539.     InputManager = BInput.GetInputManager()
  1540.     InputManager.AddInputActionsSet('MenuRedefine')
  1541.     InputManager.AddInputActionsSet('Menu')
  1542.     oldInputActionsSet = InputManager.GetInputActionsSet()
  1543.     InputManager.SetInputActionsSet('Menu')
  1544.     InputManager.SetInputActionsSet('Default')
  1545.     Bladex.AddInputAction('Activate Menu', 0)
  1546.     Bladex.AssocKey('Activate Menu', 'Keyboard', 'Esc')
  1547.     Bladex.AddBoundFunc('Activate Menu', PreActivateMenu)
  1548.     InputManager.SetInputActionsSet(oldInputActionsSet)
  1549.     print 'Activadas!'
  1550.     if Reference.DEMO_MODE == 1:
  1551.         GetMenuItem([
  1552.             'CREDITS'])['Kind'] = MenuWidget.B_MenuItemTextNoFXNoFocus
  1553.         del GetMenuItem([
  1554.             'CREDITS'])['ListDescr']
  1555.         GetMenuItem([
  1556.             'GAME',
  1557.             'SAVE GAME'])['Kind'] = MenuWidget.B_MenuItemTextNoFXNoFocus
  1558.         del GetMenuItem([
  1559.             'GAME',
  1560.             'SAVE GAME'])['ListDescr']
  1561.         GetMenuItem([
  1562.             'GAME',
  1563.             'LOAD GAME'])['Kind'] = MenuWidget.B_MenuItemTextNoFXNoFocus
  1564.         del GetMenuItem([
  1565.             'GAME',
  1566.             'LOAD GAME'])['ListDescr']
  1567.         GetMenuItem([
  1568.             'GAME',
  1569.             'ARENA'])['Kind'] = MenuWidget.B_MenuItemTextNoFXNoFocus
  1570.         del GetMenuItem([
  1571.             'GAME',
  1572.             'ARENA'])['ListDescr']
  1573.         GetMenuItem([
  1574.             'GAME',
  1575.             'START NEW GAME'])['Name'] = MenuText.GetMenuText('START GAME')
  1576.         GetMenuItem([
  1577.             'CONTROLS',
  1578.             'KEYBOARD/GAMEPAD'])['Name'] = MenuText.GetMenuText('KEYBOARD')
  1579.     
  1580.  
  1581.  
  1582. try:
  1583.     execfile('../../Config/GameCfg.py')
  1584.     print 'Menu.py -> Executed GameCfg.py'
  1585. except:
  1586.     print 'Menu.py -> No GameCfg.py found'
  1587.  
  1588.