home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 56 / CDPowerplay56Disc2.iso / demos / blade / data1.cab / Program_Executable_Files / Lib / Scorer.py < prev    next >
Encoding:
Python Source  |  2000-10-27  |  30.6 KB  |  855 lines

  1. import BUIx
  2. import Bladex
  3. #import Bldb
  4. import ScorerWidgets
  5. import WidgetsExtra
  6. import ScorerActions
  7. import PowDefWidgets
  8. import Raster
  9. import B3DLib
  10. import math
  11. import CharStats
  12. from Reference import ENERGY_LOW_LEVEL
  13. from Reference import DEMO_MODE
  14.  
  15.  
  16.  
  17.  
  18. CURRENT_LEVEL_R=0
  19. CURRENT_LEVEL_G=128
  20. CURRENT_LEVEL_B=255
  21.  
  22. CURRENT_STRENGTH_R=251
  23. CURRENT_STRENGTH_G=241
  24. CURRENT_STRENGTH_B=2
  25.  
  26.  
  27. E_ICON_DISTANCE = 37
  28. E_CENTRAL_DISTANCE = 20
  29. E_EDGAL_DISTANCE = 4
  30. E_ARROW_DISTANCE = 40
  31.  
  32.  
  33.  
  34. def ReorderEnemies(me,enemies,FacedName):
  35.     Left   = 0
  36.     Right  = 0
  37.     Result = [(-1,10.0), (-1,10.0),
  38.               (-1,10.0),
  39.               (-1,-10.0), (-1,-10.0)]
  40.     if FacedName:
  41.         CentralAngle = B3DLib.GetEntity2EntityAngle(me.Name,FacedName)
  42.     else:
  43.         CentralAngle = me.Angle
  44.     
  45.     for ename in range(len(enemies)):
  46.  
  47.         angle = ((B3DLib.GetEntity2EntityAngle(me.Name,enemies[ename][0]) - CentralAngle) % (3.1415*2))
  48.         if angle > 3.1415:
  49.             angle = angle-3.1415*2
  50.         
  51.         if math.fabs(angle) < math.fabs(Result[2][1]):
  52.             Result[2] = (ename,angle)
  53.         
  54.     for ename in range(len(enemies)):        
  55.  
  56.         angle = ((B3DLib.GetEntity2EntityAngle(me.Name,enemies[ename][0]) - CentralAngle) % (3.1415*2))
  57.         if angle > 3.1415:
  58.             angle = angle-3.1415*2
  59.  
  60.         if ename==Result[2][0]:
  61.             continue
  62.         if angle > 0:
  63.             if   angle < Result[1][1]:
  64.                 if Result[1][0] != -1:
  65.                     if Result[0][0] != -1:
  66.                         Left = Left+1
  67.                     Result[0] = Result[1]
  68.                 Result[1] = (ename,angle)
  69.             elif angle < Result[0][1]:
  70.                 if Result[0][0] != -1:
  71.                     Left = Left+1
  72.                 Result[0] = (ename,angle)
  73.             else:
  74.                 Left = Left+1
  75.         else:
  76.             if   angle > Result[3][1]:
  77.                 if Result[3][0] != -1:
  78.                     if Result[4][0] != -1:
  79.                         Right = Right+1
  80.                     Result[4] = Result[3]
  81.                 Result[3] = (ename,angle)                    
  82.             elif angle > Result[4][1]:
  83.                 if Result[4][0] != -1:
  84.                     Right = Right+1
  85.                 Result[4] = (ename,angle)
  86.             else:
  87.                 Right = Right+1
  88.     
  89.     return (Left,Right),Result
  90.     
  91.     
  92.     
  93.  
  94. def SetEnemiesData(pj):
  95.   enemies= pj.Data.visible_enemies
  96.   arrows,ienemies=ReorderEnemies(pj,enemies,pj.ActiveEnemy)
  97.   wEnemyBorderSelector.SetBorder(pj.ActiveEnemy!="")
  98.   wEnemyMark.SetVisible(pj.ActiveEnemy!="")
  99.   rw,rh=Raster.GetSize()      
  100.   if pj.ActiveEnemy:
  101.       wEnemies[2].SetSize(35*rw/640,35*rh/480)
  102.       wEnemiesVenoms[2].SetSize(35*rw/640,35*rh/480)
  103.   else:
  104.       wEnemies[2].SetSize(28*rw/640,28*rh/480)
  105.       wEnemiesVenoms[2].SetSize(28*rw/640,28*rh/480)
  106.   
  107.   wEnemyLeft.SetVisible(arrows[1]!=0)
  108.   wEnemyRight.SetVisible(arrows[0]!=0)
  109.  
  110.   for x in range(5):
  111.     
  112.     idx = ienemies[4-x][0]
  113.     if idx == -1:
  114.         wEnemies[x].SetVisible(0)
  115.         continue
  116.         
  117.     wEnemies[x].SetVisible(1)
  118.     try:
  119.         wEnemies[x].SetBitmap(enemies[idx][1][0])
  120.     except TypeError:
  121.         print "Bitmap not set for enemy "+enemies[idx][0]
  122.  
  123.     
  124.     chartype = Bladex.GetCharType(pj.CharType,pj.CharTypeExt)
  125.     if((x == 2) and (pj.ActiveEnemy != "")):
  126.       wEnemies[x].SetAlpha(1.0)
  127.     else:
  128.       Alpha = (chartype.MaxCombatDist-B3DLib.GetXZDistance(pj.Name,enemies[idx][0]))/chartype.MaxCombatDist
  129.       wEnemies[x].SetAlpha(Alpha)
  130.       
  131.     ent=Bladex.GetEntity(enemies[idx][0])    
  132.     if not ent:
  133.         print "The character called "+enemies[idx][0]+" has been destroyed"
  134.         continue
  135.     #apply(wEnemies[x].SetColor, ent.Data.CurrentHealthColor)
  136.     if ent.Data:
  137.         if ent.Data.Poisoned:
  138.             wEnemiesVenoms[x].SetVisible(1)
  139.         else:
  140.             wEnemiesVenoms[x].SetVisible(0)
  141.     else:
  142.         wEnemiesVenoms[x].SetVisible(0)
  143.         
  144.     wEnemiesLifeLabels[x].SetText(`int(ent.Life)`)
  145.     wEnemyBarrLabels[x].SetPositionPercentage(ent.Life/CharStats.GetCharMaxLife(ent.Kind,ent.Level))
  146.     wEnemyBarrLabels[x].SetBackgroundAlpha(wEnemies[x].GetAlpha())
  147.     wEnemiesLevelLabels[x].SetText(`ent.Level+1`)
  148.     inv = ent.GetInventory()    
  149.     key_found= inv.GetSpecialKey(0)
  150.     if not key_found and inv.nKeys:
  151.       key_found= inv.GetKey(0)
  152.     if key_found:
  153.       object= Bladex.GetEntity(key_found)      
  154.       if wEnemiesKeyLabels[x].GetBOD()!=object.Kind:
  155.         wEnemiesKeyLabels[x].SetBOD(object.Kind)
  156.       wEnemiesKeyLabels[x].SetVisible(1)
  157.       if inv.nObjects:
  158.         object= Bladex.GetEntity(inv.GetObject(0))
  159.         if wEnemiesObjLabels[x].GetBOD()!=object.Kind:
  160.           wEnemiesObjLabels[x].SetBOD(object.Kind)
  161.         wEnemiesObjLabels[x].SetVisible(1)
  162.       else:
  163.         wEnemiesObjLabels[x].SetVisible(0)
  164.     else:
  165.       # If there's an object, put it in the key slot
  166.       if inv.nObjects:
  167.         object= Bladex.GetEntity(inv.GetObject(0))
  168.         if wEnemiesKeyLabels[x].GetBOD()!=object.Kind:
  169.           wEnemiesKeyLabels[x].SetBOD(object.Kind)
  170.         wEnemiesKeyLabels[x].SetVisible(1)
  171.       else:
  172.         wEnemiesKeyLabels[x].SetVisible(0)      
  173.       wEnemiesObjLabels[x].SetVisible(0)
  174.     wEnemies[x].RecalcLabelLayout(BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_VCenter)
  175.     wEnemies[x].RecalcLabelLayout(BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_Bottom)
  176.  
  177.   wEnemiesFrame.RecalcLayout()
  178.  
  179.  
  180. __wNULL=BUIx.CreateNULLWidget()
  181. char=Bladex.GetEntity("Player1")
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191. # Si esta a 1 hace que se escale el HUD, si esta a 0 entonces solo se ajustan las posiciones
  192. # (y ademas queda mejor)
  193. wants_auto_scale=1
  194.  
  195.  
  196.  
  197. # Frames ---------------------------------------------------------------------------------------------------
  198. wFrame=BUIx.B_FrameWidget(__wNULL,"MainFrame",640,480)
  199. wLeftFrame=BUIx.B_FrameWidget(wFrame,"BarsFrame",195,65)
  200. wEnemiesFrame=BUIx.B_FrameWidget(wFrame,"EnemiesFrame",E_ICON_DISTANCE*5+E_CENTRAL_DISTANCE*2+E_ARROW_DISTANCE*2,65)
  201. wObjectsFrame=ScorerWidgets.B_ObjectsFrame(wFrame,"ObjectsFrame",125,65,char)
  202. #wKeysFrame=BUIx.B_FrameWidget(wFrame,"KeysFrame",50,65)
  203. wKeysRFrame=BUIx.B_FrameWidget(wFrame,"KeysRFrame",50,65)
  204. wSpecialsFrame=BUIx.B_FrameWidget(wFrame,"SpecialsFrame",180,32)
  205.  
  206.  
  207.  
  208. # Texto  ----------------------------------------------------------------------------------------------------
  209. wGameText=BUIx.B_TextWidget(wFrame,"GameTextWidget","\n\n\n\n\n",ScorerWidgets.font_server,"../../Data/Letras menu med.bmp")
  210. #wGameText=ScorerWidgets.B_GameTextWidget(wFrame,"GameTextWidget")
  211. wGameText.SetAlpha(1)
  212. wGameText.SetColor(255,255,255)
  213.  
  214.  
  215.  
  216. # Travel Book Warning--------------------------------------------------------------------------------------------
  217. TBookSword=BUIx.B_BitmapWidget(wFrame,"TBookSword",126,22,"PRESSF1","../../Data/pressf1.mmp")
  218. TBookSword.SetColor(255,255,255)
  219. wFrame.AddWidget(TBookSword,0,0,BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_Right,BUIx.B_FrameWidget.B_FR_AbsoluteBottom,BUIx.B_FrameWidget.B_FR_Bottom)
  220. TBookSword.SetAlpha(1.0)
  221. TBookSword.SetVisible(0)
  222.  
  223. TBS=Bladex.CreateSound("..\\..\\Sounds\\M-DESENFUNDA-PIEDRA.wav","TBWarning")
  224. TBS.Volume=1.0
  225. TBS.MinDistance=1000000.0
  226. TBS.MaxDistance=2000000
  227.  
  228. def SlideTBS(dir,time = 0):
  229.     TBS.PlayStereo()
  230.     SlideTBS2(dir,time)
  231.  
  232. def SlideTBS2(dir,time = 0):
  233.     
  234.     global TBookSword
  235.     MarcoAnchoTex = 201
  236.     if time < 0.25:
  237.         Bladex.AddScheduledFunc(Bladex.GetTime() + 0.015,SlideTBS2,(dir,time + 0.02))
  238.     else:
  239.         time = 0.25
  240.  
  241.     if dir:
  242.         XPos = -MarcoAnchoTex * time * 4
  243.     else:
  244.         TBookSword.SetVisible(1)
  245.         XPos = -MarcoAnchoTex + (MarcoAnchoTex * time * 4)
  246.  
  247.         wFrame.MoveWidgetTo("TBookSword",XPos,0)
  248.         
  249. def HideTBS():
  250.     global TBookSword
  251.     TBookSword.SetVisible(0)
  252.  
  253.  
  254.  
  255. # Barras de vida --------------------------------------------------------------------------------------------
  256. BAR_DELTA = 26
  257. Bladex.ReadBitMap("../../Data/Vida.bmp","Vida")
  258. Bladex.ReadBitMap("../../Data/Vida enemigo 8.bmp","BitmapBarraEnemigo")
  259.  
  260.  
  261.  
  262. wLifeBar=WidgetsExtra.B_FlashBarWidget(wLeftFrame,"LifeBar",116+BAR_DELTA,10)
  263. wLifeBar.SetColor(255,0,0)
  264. wLifeBar.SetFlashColor(53, 141, 36)
  265. wLifeBar.SetFlash(0)
  266. wLifeBar.Continuous= 1
  267. wLifeBar.SetBackgroundAlpha(0.0)
  268. wLifeBar.SetAlpha(1.0)
  269. wLifeBar.SetBitmap("Vida")
  270.     
  271.  
  272. ##def wLifeBarSizeChanged(x,y):
  273. ##  print "wLifeBarSizeChanged",x,y
  274. ##  
  275. ##wLifeBar.SetSizeChangedFunc(wLifeBarSizeChanged)
  276.  
  277. wLifeLabel=BUIx.B_TextWidget(wLifeBar,"LifeLabel","100/100",ScorerWidgets.font_server,"../../Data/Mapa de letras.bmp")
  278. wLifeLabel.SetColor(255,0,0)
  279. wLifeLabel.SetAlpha(1.0)
  280. wLifeBar.AddLabel(wLifeLabel,4-BAR_DELTA,-2,
  281.                   BUIx.B_Widget.B_LAB_Right,BUIx.B_Widget.B_LAB_VCenter,
  282.                   BUIx.B_Widget.B_FR_AbsoluteLeft,BUIx.B_Widget.B_FR_Left,
  283.                   BUIx.B_Widget.B_FR_AbsoluteTop,BUIx.B_Widget.B_FR_Top
  284.                   )
  285.  
  286.  
  287. wPoisonLabel=BUIx.B_TextWidget(wLifeBar,"PoisonLabel","POISONED",ScorerWidgets.font_server,"../../Data/Mapa de letras.bmp")
  288. wPoisonLabel.SetColor(85,105,60)
  289. wPoisonLabel.SetAlpha(1.0)
  290. wLifeBar.AddLabel(wPoisonLabel,0.4,0.5,
  291.                   BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_VCenter,
  292.                   BUIx.B_Widget.B_FR_HRelative, BUIx.B_Widget.B_FR_HCenter,
  293.                   BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter
  294.                   )
  295. wPoisonLabel.SetVisible(0)
  296.  
  297.  
  298.  
  299.  
  300. # Barra de nivel -------------------------------------------------------------------------------------------
  301. wLifeMarker = BUIx.B_BitmapWidget(wLeftFrame,"ObjNameBg",205,51,"MARCADORVIDAYXP","../../Data/marcadorvidayxp.mmp");
  302. wLifeMarker.SetColor(255,255,255)
  303. wLifeMarker.SetAlpha(1.0)
  304.  
  305.  
  306.  
  307. wLevelBar=ScorerWidgets.B_SmoothBarWidget(wLeftFrame,"LevelBar",116+BAR_DELTA,5)
  308. #wLevelBar=BUIx.B_BarWidget(wLeftFrame,"LevelBar",180,8)
  309. wLevelBar.SetColor(CURRENT_LEVEL_R,CURRENT_LEVEL_G,CURRENT_LEVEL_B)
  310. wLevelBar.SetAlpha(1.0)
  311. wLevelBar.SetBackgroundAlpha(0.0)
  312. wLevelBar.SetBackgroundColor(0,80,110)
  313.  
  314.  
  315. #wLevelUpLabel=BUIx.B_TextWidget(wLevelBar,"LevelUpLabel","LEVEL UP",ScorerWidgets.font_server,"..\\..\\Data\\Mapa de letras.bmp")
  316. wLevelUpLabel=WidgetsExtra.B_FlashTextWidget(wLevelBar,"LevelUpLabel","LEVEL UP",ScorerWidgets.font_server,"..\\..\\Data\\Mapa de letras.bmp")
  317. wLevelUpLabel.SetColor(170,170,170)
  318. wLevelUpLabel.SetAlpha(1.0)
  319. wLevelUpLabel.SetVisible(0)
  320. wLevelBar.AddLabel(wLevelUpLabel,0,2,
  321.                   BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_Bottom,
  322.                   BUIx.B_Widget.B_FR_AbsoluteRight,BUIx.B_Widget.B_FR_Right,
  323.                   BUIx.B_Widget.B_FR_AbsoluteTop,BUIx.B_Widget.B_FR_Top
  324.                   )
  325.  
  326.  
  327. wCurrentLevelLabel=BUIx.B_TextWidget(wLevelBar,"CurrentLevelLabel","Level 5",ScorerWidgets.font_server,"..\\..\\Data\\Mapa de letras.bmp")
  328. wCurrentLevelLabel.SetColor(0,159,220)
  329. wCurrentLevelLabel.SetAlpha(1.0)
  330. wLevelBar.AddLabel(wCurrentLevelLabel,6-BAR_DELTA,-4,
  331.                   BUIx.B_Widget.B_LAB_Right,BUIx.B_Widget.B_LAB_VCenter,
  332.                   BUIx.B_Widget.B_FR_AbsoluteLeft,BUIx.B_Widget.B_FR_Left,
  333.                   BUIx.B_Widget.B_FR_AbsoluteTop,BUIx.B_Widget.B_FR_Top
  334.                   )
  335. wLevelBar.SetBitmap("Vida")
  336.  
  337. # Barra de un bar    -------------------------------------------------------------------------------------------
  338. wLowBarFrame=BUIx.B_FrameWidget(wFrame,"LowBarFrame",176, 22)
  339. wLowBarFrame.SetVisible(1)
  340.  
  341.  
  342. wEnergyBmp=BUIx.B_BitmapWidget(wLowBarFrame,"EnergyBmp",176, 22,"MARCADORLANZAMAGOTAM","../../Data/marcadorlanzamagotam.mmp")
  343. wEnergyBmp.SetColor(255,255,255)
  344. wEnergyBmp.SetAlpha(1.0)
  345. wEnergyBmp.SetVisible(1)
  346.  
  347. # Barra de strength  -------------------------------------------------------------------------------------------
  348. wStrengthBar=ScorerWidgets.B_SmoothBarWidget(wLowBarFrame,"StrengthBar",112*(8.0/6.5),8)
  349. wStrengthBar.SetColor(CURRENT_STRENGTH_R,CURRENT_STRENGTH_G,CURRENT_STRENGTH_B)
  350. wStrengthBar.SetAlpha(0.75)
  351. wStrengthBar.SetBackgroundAlpha(0.0)
  352. wStrengthBar.SetBackgroundColor(CURRENT_STRENGTH_R,CURRENT_STRENGTH_G,CURRENT_STRENGTH_B)
  353. wStrengthBar.SetVisible(0)
  354. wStrengthBar.SetBitmap("Vida")
  355.  
  356. wMaxPowerLabel=WidgetsExtra.B_FlashTextWidget(wStrengthBar,"MaxPowerLabel","Maximun power",ScorerWidgets.font_server,"../../Data/Mapa de letras.bmp")
  357. wMaxPowerLabel.SetColor(255,255,255)
  358. wMaxPowerLabel.SetAlpha(1.0)
  359. wMaxPowerLabel.SetVisible(0)
  360. wStrengthBar.AddLabel(wMaxPowerLabel,0.5,0.5,
  361.                   BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_VCenter,
  362.                   BUIx.B_Widget.B_FR_HRelative, BUIx.B_Widget.B_FR_HCenter,
  363.                   BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter
  364.                   )
  365.  
  366. wStrengthLabel=WidgetsExtra.B_FlashTextWidget(wStrengthBar,"StrengthLabel","Launch",ScorerWidgets.font_server,"../../Data/Mapa de letras.bmp")
  367. wStrengthLabel.SetColor(251,210,99)
  368. wStrengthLabel.SetAlpha(1.0)
  369. wStrengthLabel.SetFlash(0.0)
  370. wStrengthBar.AddLabel(wStrengthLabel,9,0.5,
  371.                   BUIx.B_Widget.B_LAB_Left,BUIx.B_Widget.B_LAB_VCenter,
  372.                   BUIx.B_Widget.B_FR_AbsoluteRight,BUIx.B_Widget.B_FR_Right,
  373.                   BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter
  374.                   )
  375.  
  376. #wStrengthBar.SetBitmap("BitmapBarra")
  377.  
  378. # Barra de energy  -------------------------------------------------------------------------------------------
  379. wEnergyBar=ScorerWidgets.B_SmoothBarWidget(wLowBarFrame,"EnergyBar",112*(8.0/6.5),8)
  380. wEnergyBar.SetColor(0,255,128)
  381. wEnergyBar.SetAlpha(0.75)
  382. wEnergyBar.SetBackgroundAlpha(0.0)
  383. wEnergyBar.SetBackgroundColor(64,64,64)
  384. wEnergyBar.SetVisible(0)
  385. wEnergyBar.SetBitmap("Vida")
  386.  
  387. wDangerLabel=WidgetsExtra.B_FlashTextWidget(wEnergyBar,"DangerLabel","Low energy",ScorerWidgets.font_server,"..\\..\\Data\\Mapa de letras.bmp")
  388. wDangerLabel.SetColor(238,191,0)
  389. wDangerLabel.SetAlpha(1.0)
  390. wDangerLabel.SetVisible(0)
  391. wEnergyBar.AddLabel(wDangerLabel,0.5,0.5,
  392.                   BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_VCenter,
  393.                   BUIx.B_Widget.B_FR_HRelative, BUIx.B_Widget.B_FR_HCenter,
  394.                   BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter
  395.                   )
  396.  
  397. wEnergyMaxLabel=WidgetsExtra.B_FlashTextWidget(wEnergyBar,"EnergyMaxLabel","100",ScorerWidgets.font_server,"..\\..\\Data\\Mapa de letras.bmp")
  398. wEnergyMaxLabel.SetColor(0,255,128)
  399. wEnergyMaxLabel.SetAlpha(1)
  400. wEnergyMaxLabel.SetVisible(1)
  401. wEnergyBar.AddLabel(wEnergyMaxLabel,7,0.5,
  402.                   BUIx.B_Widget.B_LAB_Left,BUIx.B_Widget.B_LAB_VCenter,
  403.                   BUIx.B_Widget.B_FR_AbsoluteRight, BUIx.B_Widget.B_FR_Right,
  404.                   BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter
  405.                   )
  406.  
  407.  
  408. wLowBarFrame.AddWidget(wStrengthBar,56,6)
  409.  
  410. wLowBarFrame.AddWidget(wEnergyBar,56,6)
  411.  
  412. wLowBarFrame.AddWidget(wEnergyBmp,0,0)
  413.  
  414.  
  415. # Llaves ---------------------------------------------------------------------------------------------------
  416. wKey1=ScorerWidgets.B_InvKey3DWidget(wObjectsFrame,"Key1",32,32,"Llave",char)
  417. #wKey2=ScorerWidgets.B_InvKeyRing3DWidget(wKeysFrame,"Key2",32,32,"Llavero",char)
  418.  
  419. # Especials ---------------------------------------------------------------------------------------------------
  420. wSpecialKey1=ScorerWidgets.B_InvSpecialKeyWidget(wSpecialsFrame,"BEETLE",22,22,char)
  421. wSpecialKey2=ScorerWidgets.B_InvSpecialKeyWidget(wSpecialsFrame,"SPIDER",22,22,char)
  422. wSpecialKey3=ScorerWidgets.B_InvSpecialKeyWidget(wSpecialsFrame,"SHELL",22,22,char)
  423. wSpecialKey4=ScorerWidgets.B_InvSpecialKeyWidget(wSpecialsFrame,"STAR",22,22,char)
  424.  
  425. wTablet1=ScorerWidgets.B_InvTabletWidget(wSpecialsFrame,"Tablilla1","!",char)
  426. wTablet2=ScorerWidgets.B_InvTabletWidget(wSpecialsFrame,"Tablilla2","\"",char)
  427. wTablet3=ScorerWidgets.B_InvTabletWidget(wSpecialsFrame,"Tablilla3","#",char)
  428. wTablet4=ScorerWidgets.B_InvTabletWidget(wSpecialsFrame,"Tablilla4","$",char)
  429. wTablet5=ScorerWidgets.B_InvTabletWidget(wSpecialsFrame,"Tablilla5","%",char)
  430. wTablet6=ScorerWidgets.B_InvTabletWidget(wSpecialsFrame,"Tablilla6","&",char)
  431.  
  432.  
  433. """
  434. # Objetos --------------------------------------------------------------------------------------------------
  435. wSelObjectText=BUIx.B_TextWidget(wObjectsFrame,"SelObjectText","RED GEM  +10% EXP",
  436.                  ScorerWidgets.font_server,"../../Data/Mapa de letras.bmp")
  437. wSelObjectText.SetColor(170,170,170)
  438. wSelObjectText.SetAlpha(0.5)
  439. """
  440.  
  441.  
  442.  
  443. # Enemigos -------------------------------------------------------------------------------------------------
  444. wEnemy1,wEnemyVenom1,wEnemy1LifeLabel,wEnemy1LevelLabel,wEnemy1KeyLabel,wEnemy1ObjLabel,wEnemy1BarrLabel=ScorerWidgets.CreateEnemyWidget("wEnemy1",wEnemiesFrame,wants_auto_scale)
  445. wEnemy1.SetAlpha(0.25)
  446.  
  447. wEnemy2,wEnemyVenom2,wEnemy2LifeLabel,wEnemy2LevelLabel,wEnemy2KeyLabel,wEnemy2ObjLabel,wEnemy2BarrLabel=ScorerWidgets.CreateEnemyWidget("wEnemy2",wEnemiesFrame,wants_auto_scale)
  448. wEnemy2.SetAlpha(1.0)
  449.  
  450. wEnemy3,wEnemyVenom3,wEnemy3LifeLabel,wEnemy3LevelLabel,wEnemy3KeyLabel,wEnemy3ObjLabel,wEnemy3BarrLabel=ScorerWidgets.CreateEnemyWidget("wEnemy3",wEnemiesFrame,wants_auto_scale)
  451. wEnemy3.SetAlpha(0.25)
  452.  
  453. wEnemy4,wEnemyVenom4,wEnemy4LifeLabel,wEnemy4LevelLabel,wEnemy4KeyLabel,wEnemy4ObjLabel,wEnemy4BarrLabel=ScorerWidgets.CreateEnemyWidget("wEnemy4",wEnemiesFrame,wants_auto_scale)
  454. wEnemy4.SetAlpha(0.25)
  455.  
  456. wEnemy5,wEnemyVenom5,wEnemy5LifeLabel,wEnemy5LevelLabel,wEnemy5KeyLabel,wEnemy5ObjLabel,wEnemy5BarrLabel=ScorerWidgets.CreateEnemyWidget("wEnemy5",wEnemiesFrame,wants_auto_scale)
  457. wEnemy5.SetAlpha(0.25)
  458.  
  459.  
  460.  
  461. wEnemies=[wEnemy1,wEnemy2,wEnemy3,wEnemy4,wEnemy5]
  462. wEnemiesVenoms=[wEnemyVenom1,wEnemyVenom2,wEnemyVenom3,
  463.                    wEnemyVenom4,wEnemyVenom5]
  464. wEnemiesLifeLabels=[wEnemy1LifeLabel,wEnemy2LifeLabel,wEnemy3LifeLabel,
  465.                    wEnemy4LifeLabel,wEnemy5LifeLabel]
  466. wEnemiesLevelLabels=[wEnemy1LevelLabel,wEnemy2LevelLabel,wEnemy3LevelLabel,
  467.                    wEnemy4LevelLabel,wEnemy5LevelLabel]
  468. wEnemiesKeyLabels=[wEnemy1KeyLabel,wEnemy2KeyLabel,wEnemy3KeyLabel,
  469.                    wEnemy4KeyLabel,wEnemy5KeyLabel]
  470. wEnemiesObjLabels=[wEnemy1ObjLabel,wEnemy2ObjLabel,wEnemy3ObjLabel,
  471.                    wEnemy4ObjLabel,wEnemy5ObjLabel]
  472. wEnemyBarrLabels =[wEnemy1BarrLabel,wEnemy2BarrLabel,wEnemy3BarrLabel,
  473.                    wEnemy4BarrLabel,wEnemy5BarrLabel]
  474.  
  475.  
  476. wLeftFrame.AddWidget(wLifeBar,14,6)
  477. wLeftFrame.AddWidget(wLevelBar,14,24)
  478. wLeftFrame.AddWidget(wLifeMarker,1,1)
  479.  
  480. wObjectsFrame.AddWidget(wKey1,0,72)
  481. #wKeysRFrame.AddWidget(wKey2,0,6)
  482.  
  483. wLeftFrame.AddWidget(wSpecialsFrame,15,38)
  484. #wRightFrame.AddWidget(wKeysFrame,8,95)
  485.  
  486. wSpecialsFrame.AddWidget(wSpecialKey1,0,0)
  487. wSpecialsFrame.AddWidget(wSpecialKey2,21,0)
  488. wSpecialsFrame.AddWidget(wSpecialKey3,43,0)
  489. wSpecialsFrame.AddWidget(wSpecialKey4,65,0)
  490.  
  491. dlt = 0
  492. wSpecialsFrame.AddWidget(wTablet1, 96-dlt,0)
  493. wSpecialsFrame.AddWidget(wTablet2,110-dlt,0)
  494. wSpecialsFrame.AddWidget(wTablet3,124-dlt,0)
  495. wSpecialsFrame.AddWidget(wTablet4,138-dlt,0)
  496. wSpecialsFrame.AddWidget(wTablet5,152-dlt,0)
  497. wSpecialsFrame.AddWidget(wTablet6,166-dlt,0)
  498.  
  499.  
  500. """
  501. wObjectsFrame.AddWidget(wSelObjectText,0.5,53,
  502.                         BUIx.B_FrameWidget.B_FR_HRelative,BUIx.B_FrameWidget.B_FR_HCenter,
  503.                         BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  504. """
  505.  
  506.  
  507. wEnemyLeft=BUIx.B_BitmapWidget(wEnemiesFrame,"FlechaIzquierda",40,40,"FLECHAENEMIGODERECHA","../../Data/flechaenemigoderecha.mmp")
  508. wEnemiesFrame.AddWidget(wEnemyLeft,0,E_EDGAL_DISTANCE,
  509.                               BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_HCenter,BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  510. wEnemyLeft.SetAlpha(1.0)
  511. wEnemyLeft.SetColor(255,255,255)
  512.  
  513.  
  514. i = 0
  515. c = 0
  516. wEnemiesFrame.AddWidget(wEnemies[i],E_ICON_DISTANCE*i+c*E_CENTRAL_DISTANCE+E_ARROW_DISTANCE,E_EDGAL_DISTANCE,
  517.                               BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_HCenter,BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  518. i = 1
  519. c = 0
  520. wEnemiesFrame.AddWidget(wEnemies[i],E_ICON_DISTANCE*i+c*E_CENTRAL_DISTANCE+E_ARROW_DISTANCE,E_EDGAL_DISTANCE,
  521.                               BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_HCenter,BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  522.  
  523.  
  524. # Marcador centraL
  525. wEnemyMark=BUIx.B_BitmapWidget(wEnemiesFrame,"SelectorEnemigo",80,80,"SELECTORENEMIGO","../../Data/selectorenemigo.mmp");
  526. wEnemiesFrame.AddWidget(wEnemyMark,0.56,-10,
  527.                            BUIx.B_FrameWidget.B_FR_HRelative,  BUIx.B_FrameWidget.B_FR_HCenter,
  528.                            BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  529. wEnemyMark.SetAlpha(1.0)
  530. wEnemyMark.SetColor(255,255,255)
  531.  
  532.  
  533. i = 2
  534. c = 1
  535. # Cuadrado rojo
  536. wEnemyBorderSelector=BUIx.B_RectWidget(wEnemies[i],"CentralBitmapBorder",35,35)
  537. wEnemyBorderSelector.SetBorderColor(255,0,0)
  538. wEnemies[i].AddLabel(wEnemyBorderSelector,0,0,
  539.                     BUIx.B_Widget.B_LAB_HCenter,BUIx.B_Widget.B_LAB_VCenter,
  540.                     BUIx.B_Widget.B_FR_Left,BUIx.B_Widget.B_FR_Left,
  541.                     BUIx.B_Widget.B_FR_AbsoluteTop,BUIx.B_Widget.B_FR_Top
  542.                     )
  543. # Enemigo del centro
  544. wEnemiesFrame.AddWidget(wEnemies[i],E_ICON_DISTANCE*i+c*E_CENTRAL_DISTANCE+E_ARROW_DISTANCE,E_EDGAL_DISTANCE,
  545.                               BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_HCenter,BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  546.  
  547.  
  548.  
  549.  
  550. i = 3
  551. c = 2
  552. wEnemiesFrame.AddWidget(wEnemies[i],E_ICON_DISTANCE*i+c*E_CENTRAL_DISTANCE+E_ARROW_DISTANCE,E_EDGAL_DISTANCE,
  553.                               BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_HCenter,BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  554.  
  555. i = 4
  556. c = 2
  557. wEnemiesFrame.AddWidget(wEnemies[i],E_ICON_DISTANCE*i+c*E_CENTRAL_DISTANCE+E_ARROW_DISTANCE,E_EDGAL_DISTANCE,
  558.                               BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_HCenter,BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  559.  
  560.  
  561. wEnemyRight=BUIx.B_BitmapWidget(wEnemiesFrame,"FlechaDerecha",40,40,"FLECHAENEMIGOIZQUIERDA","../../Data/flechaenemigoizquierda.mmp");
  562. wEnemiesFrame.AddWidget(wEnemyRight,E_ICON_DISTANCE*5+2*E_CENTRAL_DISTANCE+E_ARROW_DISTANCE,E_EDGAL_DISTANCE,
  563.                               BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_HCenter,BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  564. wEnemyRight.SetAlpha(1.0)
  565. wEnemyRight.SetColor(255,255,255)
  566.  
  567.  
  568. InitAlpha=[1.0,0.3,0.2,0.1]
  569. InitPositions=[(5,10),(35,20),(75,30),(110,40)]
  570. wRightHand=ScorerWidgets.B_HandWidget(wFrame,"RightHand",150,150,"Right",
  571.                                       InitAlpha,InitPositions)
  572. wLeftHand=ScorerWidgets.B_HandWidget(wFrame,"LefttHand",150,150,"Left",
  573.                                       InitAlpha,InitPositions)
  574.                                       
  575. wArrowInfo=ScorerWidgets.InvArrowsControl(wFrame,"ArrowInfo",150,150,char)
  576.  
  577. #wQuiverHand=ScorerWidgets.B_HandWidget(wFrame,"LefttHand",150,150,"Left",
  578. #                                      InitAlpha,InitPositions)
  579.  
  580.  
  581.  
  582.  
  583. wFrame.AddWidget(wLeftFrame,4,4)
  584. #wFrame.AddWidget(wKeysRFrame,196,0)
  585. wFrame.AddWidget(wObjectsFrame,12,0,BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_Right,
  586.                               BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  587.  
  588.  
  589. wFrame.AddWidget(wEnemiesFrame,0.5,0,BUIx.B_FrameWidget.B_FR_HRelative,BUIx.B_FrameWidget.B_FR_HCenter,
  590.                               BUIx.B_FrameWidget.B_FR_AbsoluteTop,BUIx.B_FrameWidget.B_FR_Top)
  591. wFrame.AddWidget(wRightHand,6,20,BUIx.B_FrameWidget.B_FR_AbsoluteRight,BUIx.B_FrameWidget.B_FR_Right,
  592.                               BUIx.B_FrameWidget.B_FR_AbsoluteBottom,BUIx.B_FrameWidget.B_FR_Bottom)
  593. wFrame.AddWidget(wLeftHand,6,20,BUIx.B_FrameWidget.B_FR_AbsoluteLeft,BUIx.B_FrameWidget.B_FR_Left,
  594.                               BUIx.B_FrameWidget.B_FR_AbsoluteBottom,BUIx.B_FrameWidget.B_FR_Bottom)
  595. wFrame.AddWidget(wArrowInfo,6,20,BUIx.B_FrameWidget.B_FR_AbsoluteLeft,BUIx.B_FrameWidget.B_FR_Left,
  596.                               BUIx.B_FrameWidget.B_FR_AbsoluteBottom,BUIx.B_FrameWidget.B_FR_Bottom)
  597.  
  598.  
  599. wFrame.AddWidget(wGameText,0.5,27,
  600.                            BUIx.B_FrameWidget.B_FR_HRelative,BUIx.B_FrameWidget.B_FR_HCenter,
  601.                            BUIx.B_FrameWidget.B_FR_AbsoluteBottom,BUIx.B_FrameWidget.B_FR_Bottom)
  602.  
  603.  
  604. wFrame.AddWidget(wLowBarFrame,0.5,2,
  605.                            BUIx.B_FrameWidget.B_FR_HRelative,BUIx.B_FrameWidget.B_FR_HCenter,
  606.                            BUIx.B_FrameWidget.B_FR_AbsoluteBottom,BUIx.B_FrameWidget.B_FR_Bottom)
  607.  
  608.  
  609. #wFrame.SetFocus("LeftFrame")
  610. #wFrame.SetClipDraw(1)
  611.  
  612.  
  613. ShieldsControl=ScorerWidgets.InvShieldControl("Shields",wLeftHand,char,
  614.                                               view_period=1.4,cycle_period=0.3,fadein_period=0.3,
  615.                                               fadeout_period=0.3,
  616.                                               end_cycle_callback=ScorerActions.CB_ShieldOut,
  617.                                               Wants_auto_scale=wants_auto_scale)
  618. WeaponsControl=ScorerWidgets.InvWeaponsControl("Weapons",wRightHand,char,ShieldsControl,
  619.                                               view_period=1.4,cycle_period=0.3,fadein_period=0.3,
  620.                                               fadeout_period=0.3,
  621.                                               end_cycle_callback=ScorerActions.CB_WeaponOut,
  622.                                               Wants_auto_scale=wants_auto_scale)
  623. ObjectsControl=ScorerWidgets.InvObjectsControl("Objects",wObjectsFrame,char,
  624.                                               view_period=1.4,cycle_period=0.2,fadein_period=0.3,
  625.                                               fadeout_period=0.3,
  626.                                               end_cycle_callback=ScorerActions.IncCallBack,
  627.                                               Wants_auto_scale=wants_auto_scale)
  628.  
  629.  
  630.  
  631. PowDefWidgets.CreateWidgest()
  632. PowDefWidgets.Activate()
  633.  
  634.  
  635. wFrame.SetAutoScale(1)
  636. if wants_auto_scale:
  637.   wLeftFrame.SetAutoScale(1)
  638.   wEnemiesFrame.SetAutoScale(1)
  639.   wLowBarFrame.SetAutoScale(1)
  640.   wObjectsFrame.SetAutoScale(1)
  641.   #wKeysFrame.SetAutoScale(1)
  642.   #wKeysRFrame.SetAutoScale(1)
  643.   wSpecialsFrame.SetAutoScale(1)
  644.  
  645.   wGameText.SetAutoScale(1)
  646.   wLifeBar.SetAutoScale(1)
  647.   wLifeLabel.SetAutoScale(1)
  648.   wPoisonLabel.SetAutoScale(1)
  649.   wLevelBar.SetAutoScale(1)
  650.   wLevelUpLabel.SetAutoScale(1)
  651.   wLevelBar.SetAutoScale(1)
  652.   wCurrentLevelLabel.SetAutoScale(1)
  653.   wStrengthBar.SetAutoScale(1)
  654.   wMaxPowerLabel.SetAutoScale(1)
  655.   wStrengthLabel.SetAutoScale(1)
  656.   wEnergyBar.SetAutoScale(1)
  657.   wDangerLabel.SetAutoScale(1)
  658.   wEnergyMaxLabel.SetAutoScale(1)
  659.   TBookSword.SetAutoScale(1)
  660.   wLifeMarker.SetAutoScale(1)
  661.   wEnergyBmp.SetAutoScale(1)
  662.  
  663.   wKey1.SetAutoScale(1)
  664.   #wKey2.SetAutoScale(1)
  665.  
  666.   wSpecialKey1.SetAutoScale(1)
  667.   wSpecialKey2.SetAutoScale(1)
  668.   wSpecialKey3.SetAutoScale(1)
  669.   wSpecialKey4.SetAutoScale(1)
  670.  
  671.   wTablet1.SetAutoScale(1)
  672.   wTablet2.SetAutoScale(1)
  673.   wTablet3.SetAutoScale(1)
  674.   wTablet4.SetAutoScale(1)
  675.   wTablet5.SetAutoScale(1)
  676.   wTablet6.SetAutoScale(1)
  677.  
  678.   wEnemyBorderSelector.SetAutoScale(1)
  679.   wEnemyLeft.SetAutoScale(1)
  680.   wEnemyRight.SetAutoScale(1)
  681.   wEnemyMark.SetAutoScale(1)
  682.   for x in range(5):
  683.     wEnemies[x].SetAutoScale(1)
  684.     wEnemiesVenoms[x].SetAutoScale(1)
  685.     wEnemiesLifeLabels[x].SetAutoScale(1)
  686.     wEnemiesLevelLabels[x].SetAutoScale(1)
  687.     wEnemiesKeyLabels[x].SetAutoScale(1)
  688.     wEnemiesObjLabels[x].SetAutoScale(1)
  689.     wEnemyBarrLabels[x].SetAutoScale(1)
  690.  
  691.  
  692.   wEnemyBorderSelector.SetAutoScale(1)
  693.   wEnemyLeft.SetAutoScale(1)
  694.   wEnemyRight.SetAutoScale(1)
  695.   wEnemyMark.SetAutoScale(1)
  696.   for x in range(5):
  697.     wEnemies[x].SetAutoScale(1)
  698.     wEnemiesVenoms[x].SetAutoScale(1)
  699.     wEnemiesLifeLabels[x].SetAutoScale(1)
  700.     wEnemiesLevelLabels[x].SetAutoScale(1)
  701.     wEnemiesKeyLabels[x].SetAutoScale(1)
  702.     wEnemiesObjLabels[x].SetAutoScale(1)
  703.     wEnemyBarrLabels[x].SetAutoScale(1)
  704.  
  705.  
  706.   PowDefWidgets.DefTextWidget.SetAutoScale(1)
  707.   PowDefWidgets.PowTextWidget.SetAutoScale(1)
  708.   PowDefWidgets.DefBmpWidget.SetAutoScale(1)
  709.   PowDefWidgets.PowBmpWidget.SetAutoScale(1)
  710.   PowDefWidgets.wDefFrame.SetAutoScale(1)
  711.   PowDefWidgets.wPowFrame.SetAutoScale(1)
  712.  
  713.  
  714.  
  715.  
  716. ObjectsControl.view_period = 3.0  # Modify it to change the time of the inventory.
  717.  
  718. def ActivateScorer():
  719.     wLeftHand.SetVisible(0)
  720.     wRightHand.SetVisible(0)
  721.     wObjectsFrame.SetVisible(0)
  722.     #wKeysFrame.SetVisible(1)
  723.     #wKeysRFrame.SetVisible(1)
  724.     wSpecialsFrame.SetVisible(1)
  725.     Bladex.SetRootWidget(wFrame.GetPointer())
  726.  
  727. def ViewScorer(v):
  728.   wFrame.SetVisible(v)
  729.  
  730.  
  731. def ViewEnemies(v):
  732.   wEnemiesFrame.SetVisible(v)
  733.  
  734.  
  735. def ViewBars(v):
  736.   wLeftFrame.SetVisible(v)
  737.  
  738.  
  739.  
  740.  
  741. def ViewObjects(v):
  742.   wObjectsFrame.SetVisible(v)
  743.  
  744.  
  745.  
  746. def AddLifeValue(v):
  747.   wLifeBar.AddValue(v)
  748.   #print str(v)
  749.   #wLifeLabel.SetText(str(v))
  750.  
  751.  
  752. last_poisoned=0
  753.  
  754. def SetLifeValue(v,maxvalue,poisoned):
  755.   global last_poisoned
  756.   #Bldb.set_trace()
  757.   wLifeBar.SetPositionPercentage(v/maxvalue*(6.5/8.0))
  758.   wLifeLabel.SetText(str(int(v))+"/"+str(maxvalue))
  759.   
  760.   if poisoned!=last_poisoned:
  761.     wPoisonLabel.SetVisible(poisoned)
  762.     last_poisoned=poisoned
  763.     if poisoned:
  764.       wLifeBar.SetColor(0,66,19)
  765.       wLifeBar.SetFlash(3)      
  766.       #wLifeBar2.SetColor(0,83,24)
  767.     else:
  768.       wLifeBar.SetColor(255,0,0)
  769.       wLifeBar.SetFlash(0)
  770.       #wLifeBar2.SetColor(163,28,0)
  771.       
  772.  
  773. def SetLevelValue(v):
  774.   wCurrentLevelLabel.SetText("Level "+str(v+1))
  775.  
  776.  
  777.  
  778. def SetLevelBarValue(v):
  779.   wLevelBar.SetPosition(v*(6.5/8.0))
  780.  
  781.  
  782.  
  783. def SetLevelLimits(inf,sup):
  784.   wLevelBar.SetLimits(inf,sup)
  785.  
  786.  
  787.  
  788.  
  789. def __level_up_aux():
  790.   wLevelUpLabel.SetFlash(0)
  791.   wLevelUpLabel.SetVisible(0)
  792.  
  793.  
  794. def LevelUp():
  795.   wLevelUpLabel.SetFlash(15)
  796.   wLevelUpLabel.SetVisible(1)
  797.   now=Bladex.GetTime()
  798.   Bladex.AddScheduledFunc(now+2.0,__level_up_aux,())
  799.  
  800. VISIBLE=1
  801.  
  802. def SetStrengthBarValue(v):
  803.   wEnergyBar.SetVisible(0)
  804.   if VISIBLE:
  805.       wStrengthBar.SetVisible(1)
  806.  
  807.   old_pos= wStrengthBar.GetPositionPercentage()
  808.   wStrengthBar.SetPositionPercentage(v*(6.5/8.0))  
  809.   
  810.   if v>=1.0:
  811.     if old_pos<1.0:
  812.         wMaxPowerLabel.SetFlash(14)
  813.         wStrengthLabel.SetFlash(14)
  814.         wMaxPowerLabel.SetVisible(1)
  815.   else:
  816.       wMaxPowerLabel.SetVisible(0)
  817.       wStrengthLabel.SetFlash(0.0)
  818.  
  819. def SetEnergyBarValue(v, max_v):
  820.   wStrengthBar.SetVisible(0)  
  821.   if VISIBLE:
  822.       wEnergyBar.SetVisible(1)    
  823.   pos= min(max(v/max_v, 0),1.0)
  824.   wEnergyBar.SetPositionPercentage(pos*(6.5/8.0))
  825.   wEnergyMaxLabel.SetText(`max_v`)
  826.   wEnergyBar.RecalcLabelLayout(BUIx.B_Widget.B_LAB_Left,BUIx.B_Widget.B_LAB_VCenter)
  827.   if pos<=ENERGY_LOW_LEVEL:            
  828.       wDangerLabel.SetFlash(14)      
  829.       wDangerLabel.SetVisible(1)
  830.   else:
  831.       wDangerLabel.SetVisible(0)  
  832.  
  833. def SetVisible(vis):
  834.   global VISIBLE
  835.   VISIBLE=vis
  836.   if vis==0:
  837.     wLeftHand.SetVisible(vis)
  838.     wRightHand.SetVisible(0)
  839.     PowDefWidgets.Deactivate()
  840.   else:
  841.     PowDefWidgets.Activate()
  842.   #wKeysFrame.SetVisible(vis)
  843.   #wKeysRFrame.SetVisible(vis)
  844.   wSpecialsFrame.SetVisible(vis)
  845.   wEnemiesFrame.SetVisible(vis)
  846.   wLeftFrame.SetVisible(vis)
  847.   wArrowInfo.SetVisible(vis)
  848.  
  849.   wEnergyBar.SetVisible(0)
  850.   wStrengthBar.SetVisible(0)
  851.   wStrengthBar.SetVisible(0)
  852.   wLowBarFrame.SetVisible(0)
  853.   wObjectsFrame.SetVisible(0)
  854.  
  855.