home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 56 / CDPowerplay56Disc2.iso / demos / blade / data1.cab / Program_Executable_Files / Lib / Scorer.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2000-10-27  |  23.2 KB  |  267 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import BUIx
  5. import Bladex
  6. import ScorerWidgets
  7. import WidgetsExtra
  8. import ScorerActions
  9. import PowDefWidgets
  10. import Raster
  11. import B3DLib
  12. import math
  13. import CharStats
  14. ENERGY_LOW_LEVEL
  15. DEMO_MODE
  16. wGameText.SetAlpha(1)
  17. wGameText.SetColor(255, 255, 255)
  18. TBookSword.SetColor(255, 255, 255)
  19. 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)
  20. TBookSword.SetAlpha(1.0)
  21. TBookSword.SetVisible(0)
  22. TBS.Volume = 1.0
  23. TBS.MinDistance = 1000000.0
  24. TBS.MaxDistance = 2000000
  25. Bladex.ReadBitMap('../../Data/Vida.bmp', 'Vida')
  26. Bladex.ReadBitMap('../../Data/Vida enemigo 8.bmp', 'BitmapBarraEnemigo')
  27. wLifeBar.SetColor(255, 0, 0)
  28. wLifeBar.SetFlashColor(53, 141, 36)
  29. wLifeBar.SetFlash(0)
  30. wLifeBar.Continuous = 1
  31. wLifeBar.SetBackgroundAlpha(0.0)
  32. wLifeBar.SetAlpha(1.0)
  33. wLifeBar.SetBitmap('Vida')
  34. wLifeLabel.SetColor(255, 0, 0)
  35. wLifeLabel.SetAlpha(1.0)
  36. wLifeBar.AddLabel(wLifeLabel, 4 - BAR_DELTA, -2, BUIx.B_Widget.B_LAB_Right, BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_AbsoluteLeft, BUIx.B_Widget.B_FR_Left, BUIx.B_Widget.B_FR_AbsoluteTop, BUIx.B_Widget.B_FR_Top)
  37. wPoisonLabel.SetColor(85, 105, 60)
  38. wPoisonLabel.SetAlpha(1.0)
  39. wLifeBar.AddLabel(wPoisonLabel, 0.4, 0.5, BUIx.B_Widget.B_LAB_HCenter, BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_HRelative, BUIx.B_Widget.B_FR_HCenter, BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter)
  40. wPoisonLabel.SetVisible(0)
  41. wLifeMarker.SetColor(255, 255, 255)
  42. wLifeMarker.SetAlpha(1.0)
  43. wLevelBar.SetColor(CURRENT_LEVEL_R, CURRENT_LEVEL_G, CURRENT_LEVEL_B)
  44. wLevelBar.SetAlpha(1.0)
  45. wLevelBar.SetBackgroundAlpha(0.0)
  46. wLevelBar.SetBackgroundColor(0, 80, 110)
  47. wLevelUpLabel.SetColor(170, 170, 170)
  48. wLevelUpLabel.SetAlpha(1.0)
  49. wLevelUpLabel.SetVisible(0)
  50. wLevelBar.AddLabel(wLevelUpLabel, 0, 2, BUIx.B_Widget.B_LAB_HCenter, BUIx.B_Widget.B_LAB_Bottom, BUIx.B_Widget.B_FR_AbsoluteRight, BUIx.B_Widget.B_FR_Right, BUIx.B_Widget.B_FR_AbsoluteTop, BUIx.B_Widget.B_FR_Top)
  51. wCurrentLevelLabel.SetColor(0, 159, 220)
  52. wCurrentLevelLabel.SetAlpha(1.0)
  53. wLevelBar.AddLabel(wCurrentLevelLabel, 6 - BAR_DELTA, -4, BUIx.B_Widget.B_LAB_Right, BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_AbsoluteLeft, BUIx.B_Widget.B_FR_Left, BUIx.B_Widget.B_FR_AbsoluteTop, BUIx.B_Widget.B_FR_Top)
  54. wLevelBar.SetBitmap('Vida')
  55. wLowBarFrame.SetVisible(1)
  56. wEnergyBmp.SetColor(255, 255, 255)
  57. wEnergyBmp.SetAlpha(1.0)
  58. wEnergyBmp.SetVisible(1)
  59. wStrengthBar.SetColor(CURRENT_STRENGTH_R, CURRENT_STRENGTH_G, CURRENT_STRENGTH_B)
  60. wStrengthBar.SetAlpha(0.75)
  61. wStrengthBar.SetBackgroundAlpha(0.0)
  62. wStrengthBar.SetBackgroundColor(CURRENT_STRENGTH_R, CURRENT_STRENGTH_G, CURRENT_STRENGTH_B)
  63. wStrengthBar.SetVisible(0)
  64. wStrengthBar.SetBitmap('Vida')
  65. wMaxPowerLabel.SetColor(255, 255, 255)
  66. wMaxPowerLabel.SetAlpha(1.0)
  67. wMaxPowerLabel.SetVisible(0)
  68. wStrengthBar.AddLabel(wMaxPowerLabel, 0.5, 0.5, BUIx.B_Widget.B_LAB_HCenter, BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_HRelative, BUIx.B_Widget.B_FR_HCenter, BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter)
  69. wStrengthLabel.SetColor(251, 210, 99)
  70. wStrengthLabel.SetAlpha(1.0)
  71. wStrengthLabel.SetFlash(0.0)
  72. wStrengthBar.AddLabel(wStrengthLabel, 9, 0.5, BUIx.B_Widget.B_LAB_Left, BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_AbsoluteRight, BUIx.B_Widget.B_FR_Right, BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter)
  73. wEnergyBar.SetColor(0, 255, 128)
  74. wEnergyBar.SetAlpha(0.75)
  75. wEnergyBar.SetBackgroundAlpha(0.0)
  76. wEnergyBar.SetBackgroundColor(64, 64, 64)
  77. wEnergyBar.SetVisible(0)
  78. wEnergyBar.SetBitmap('Vida')
  79. wDangerLabel.SetColor(238, 191, 0)
  80. wDangerLabel.SetAlpha(1.0)
  81. wDangerLabel.SetVisible(0)
  82. wEnergyBar.AddLabel(wDangerLabel, 0.5, 0.5, BUIx.B_Widget.B_LAB_HCenter, BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_HRelative, BUIx.B_Widget.B_FR_HCenter, BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter)
  83. wEnergyMaxLabel.SetColor(0, 255, 128)
  84. wEnergyMaxLabel.SetAlpha(1)
  85. wEnergyMaxLabel.SetVisible(1)
  86. wEnergyBar.AddLabel(wEnergyMaxLabel, 7, 0.5, BUIx.B_Widget.B_LAB_Left, BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_AbsoluteRight, BUIx.B_Widget.B_FR_Right, BUIx.B_Widget.B_FR_VRelative, BUIx.B_Widget.B_FR_VCenter)
  87. wLowBarFrame.AddWidget(wStrengthBar, 56, 6)
  88. wLowBarFrame.AddWidget(wEnergyBar, 56, 6)
  89. wLowBarFrame.AddWidget(wEnergyBmp, 0, 0)
  90. (wEnemy1, wEnemyVenom1, wEnemy1LifeLabel, wEnemy1LevelLabel, wEnemy1KeyLabel, wEnemy1ObjLabel, wEnemy1BarrLabel) = ScorerWidgets.CreateEnemyWidget('wEnemy1', wEnemiesFrame, wants_auto_scale)
  91. wEnemy1.SetAlpha(0.25)
  92. (wEnemy2, wEnemyVenom2, wEnemy2LifeLabel, wEnemy2LevelLabel, wEnemy2KeyLabel, wEnemy2ObjLabel, wEnemy2BarrLabel) = ScorerWidgets.CreateEnemyWidget('wEnemy2', wEnemiesFrame, wants_auto_scale)
  93. wEnemy2.SetAlpha(1.0)
  94. (wEnemy3, wEnemyVenom3, wEnemy3LifeLabel, wEnemy3LevelLabel, wEnemy3KeyLabel, wEnemy3ObjLabel, wEnemy3BarrLabel) = ScorerWidgets.CreateEnemyWidget('wEnemy3', wEnemiesFrame, wants_auto_scale)
  95. wEnemy3.SetAlpha(0.25)
  96. (wEnemy4, wEnemyVenom4, wEnemy4LifeLabel, wEnemy4LevelLabel, wEnemy4KeyLabel, wEnemy4ObjLabel, wEnemy4BarrLabel) = ScorerWidgets.CreateEnemyWidget('wEnemy4', wEnemiesFrame, wants_auto_scale)
  97. wEnemy4.SetAlpha(0.25)
  98. (wEnemy5, wEnemyVenom5, wEnemy5LifeLabel, wEnemy5LevelLabel, wEnemy5KeyLabel, wEnemy5ObjLabel, wEnemy5BarrLabel) = ScorerWidgets.CreateEnemyWidget('wEnemy5', wEnemiesFrame, wants_auto_scale)
  99. wEnemy5.SetAlpha(0.25)
  100. wLeftFrame.AddWidget(wLifeBar, 14, 6)
  101. wLeftFrame.AddWidget(wLevelBar, 14, 24)
  102. wLeftFrame.AddWidget(wLifeMarker, 1, 1)
  103. wObjectsFrame.AddWidget(wKey1, 0, 72)
  104. wLeftFrame.AddWidget(wSpecialsFrame, 15, 38)
  105. wSpecialsFrame.AddWidget(wSpecialKey1, 0, 0)
  106. wSpecialsFrame.AddWidget(wSpecialKey2, 21, 0)
  107. wSpecialsFrame.AddWidget(wSpecialKey3, 43, 0)
  108. wSpecialsFrame.AddWidget(wSpecialKey4, 65, 0)
  109. wSpecialsFrame.AddWidget(wTablet1, 96 - dlt, 0)
  110. wSpecialsFrame.AddWidget(wTablet2, 110 - dlt, 0)
  111. wSpecialsFrame.AddWidget(wTablet3, 124 - dlt, 0)
  112. wSpecialsFrame.AddWidget(wTablet4, 138 - dlt, 0)
  113. wSpecialsFrame.AddWidget(wTablet5, 152 - dlt, 0)
  114. wSpecialsFrame.AddWidget(wTablet6, 166 - dlt, 0)
  115. wEnemiesFrame.AddWidget(wEnemyLeft, 0, E_EDGAL_DISTANCE, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  116. wEnemyLeft.SetAlpha(1.0)
  117. wEnemyLeft.SetColor(255, 255, 255)
  118. wEnemiesFrame.AddWidget(wEnemies[i], E_ICON_DISTANCE * i + c * E_CENTRAL_DISTANCE + E_ARROW_DISTANCE, E_EDGAL_DISTANCE, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  119. wEnemiesFrame.AddWidget(wEnemies[i], E_ICON_DISTANCE * i + c * E_CENTRAL_DISTANCE + E_ARROW_DISTANCE, E_EDGAL_DISTANCE, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  120. wEnemiesFrame.AddWidget(wEnemyMark, 0.56, -10, BUIx.B_FrameWidget.B_FR_HRelative, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  121. wEnemyMark.SetAlpha(1.0)
  122. wEnemyMark.SetColor(255, 255, 255)
  123. wEnemyBorderSelector.SetBorderColor(255, 0, 0)
  124. wEnemies[i].AddLabel(wEnemyBorderSelector, 0, 0, BUIx.B_Widget.B_LAB_HCenter, BUIx.B_Widget.B_LAB_VCenter, BUIx.B_Widget.B_FR_Left, BUIx.B_Widget.B_FR_Left, BUIx.B_Widget.B_FR_AbsoluteTop, BUIx.B_Widget.B_FR_Top)
  125. wEnemiesFrame.AddWidget(wEnemies[i], E_ICON_DISTANCE * i + c * E_CENTRAL_DISTANCE + E_ARROW_DISTANCE, E_EDGAL_DISTANCE, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  126. wEnemiesFrame.AddWidget(wEnemies[i], E_ICON_DISTANCE * i + c * E_CENTRAL_DISTANCE + E_ARROW_DISTANCE, E_EDGAL_DISTANCE, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  127. wEnemiesFrame.AddWidget(wEnemies[i], E_ICON_DISTANCE * i + c * E_CENTRAL_DISTANCE + E_ARROW_DISTANCE, E_EDGAL_DISTANCE, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  128. wEnemiesFrame.AddWidget(wEnemyRight, E_ICON_DISTANCE * 5 + 2 * E_CENTRAL_DISTANCE + E_ARROW_DISTANCE, E_EDGAL_DISTANCE, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  129. wEnemyRight.SetAlpha(1.0)
  130. wEnemyRight.SetColor(255, 255, 255)
  131. wFrame.AddWidget(wLeftFrame, 4, 4)
  132. wFrame.AddWidget(wObjectsFrame, 12, 0, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_Right, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  133. wFrame.AddWidget(wEnemiesFrame, 0.5, 0, BUIx.B_FrameWidget.B_FR_HRelative, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteTop, BUIx.B_FrameWidget.B_FR_Top)
  134. wFrame.AddWidget(wRightHand, 6, 20, BUIx.B_FrameWidget.B_FR_AbsoluteRight, BUIx.B_FrameWidget.B_FR_Right, BUIx.B_FrameWidget.B_FR_AbsoluteBottom, BUIx.B_FrameWidget.B_FR_Bottom)
  135. wFrame.AddWidget(wLeftHand, 6, 20, BUIx.B_FrameWidget.B_FR_AbsoluteLeft, BUIx.B_FrameWidget.B_FR_Left, BUIx.B_FrameWidget.B_FR_AbsoluteBottom, BUIx.B_FrameWidget.B_FR_Bottom)
  136. wFrame.AddWidget(wArrowInfo, 6, 20, BUIx.B_FrameWidget.B_FR_AbsoluteLeft, BUIx.B_FrameWidget.B_FR_Left, BUIx.B_FrameWidget.B_FR_AbsoluteBottom, BUIx.B_FrameWidget.B_FR_Bottom)
  137. wFrame.AddWidget(wGameText, 0.5, 27, BUIx.B_FrameWidget.B_FR_HRelative, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteBottom, BUIx.B_FrameWidget.B_FR_Bottom)
  138. wFrame.AddWidget(wLowBarFrame, 0.5, 2, BUIx.B_FrameWidget.B_FR_HRelative, BUIx.B_FrameWidget.B_FR_HCenter, BUIx.B_FrameWidget.B_FR_AbsoluteBottom, BUIx.B_FrameWidget.B_FR_Bottom)
  139. PowDefWidgets.CreateWidgest()
  140. PowDefWidgets.Activate()
  141. wFrame.SetAutoScale(1)
  142. ObjectsControl.view_period = 3.0
  143.  
  144. def ActivateScorer():
  145.     wLeftHand.SetVisible(0)
  146.     wRightHand.SetVisible(0)
  147.     wObjectsFrame.SetVisible(0)
  148.     wSpecialsFrame.SetVisible(1)
  149.     Bladex.SetRootWidget(wFrame.GetPointer())
  150.  
  151.  
  152. def ViewScorer(v):
  153.     wFrame.SetVisible(v)
  154.  
  155.  
  156. def ViewEnemies(v):
  157.     wEnemiesFrame.SetVisible(v)
  158.  
  159.  
  160. def ViewBars(v):
  161.     wLeftFrame.SetVisible(v)
  162.  
  163.  
  164. def ViewObjects(v):
  165.     wObjectsFrame.SetVisible(v)
  166.  
  167.  
  168. def AddLifeValue(v):
  169.     wLifeBar.AddValue(v)
  170.  
  171. last_poisoned = 0
  172.  
  173. def SetLifeValue(v, maxvalue, poisoned):
  174.     global last_poisoned
  175.     wLifeBar.SetPositionPercentage((v / maxvalue) * (6.5 / 8.0))
  176.     wLifeLabel.SetText(str(int(v)) + '/' + str(maxvalue))
  177.     if poisoned != last_poisoned:
  178.         wPoisonLabel.SetVisible(poisoned)
  179.         last_poisoned = poisoned
  180.         if poisoned:
  181.             wLifeBar.SetColor(0, 66, 19)
  182.             wLifeBar.SetFlash(3)
  183.         else:
  184.             wLifeBar.SetColor(255, 0, 0)
  185.             wLifeBar.SetFlash(0)
  186.     
  187.  
  188.  
  189. def SetLevelValue(v):
  190.     wCurrentLevelLabel.SetText('Level ' + str(v + 1))
  191.  
  192.  
  193. def SetLevelBarValue(v):
  194.     wLevelBar.SetPosition(v * (6.5 / 8.0))
  195.  
  196.  
  197. def SetLevelLimits(inf, sup):
  198.     wLevelBar.SetLimits(inf, sup)
  199.  
  200.  
  201. def __level_up_aux():
  202.     wLevelUpLabel.SetFlash(0)
  203.     wLevelUpLabel.SetVisible(0)
  204.  
  205.  
  206. def LevelUp():
  207.     wLevelUpLabel.SetFlash(15)
  208.     wLevelUpLabel.SetVisible(1)
  209.     now = Bladex.GetTime()
  210.     Bladex.AddScheduledFunc(now + 2.0, __level_up_aux, ())
  211.  
  212. VISIBLE = 1
  213.  
  214. def SetStrengthBarValue(v):
  215.     wEnergyBar.SetVisible(0)
  216.     if VISIBLE:
  217.         wStrengthBar.SetVisible(1)
  218.     
  219.     old_pos = wStrengthBar.GetPositionPercentage()
  220.     wStrengthBar.SetPositionPercentage(v * (6.5 / 8.0))
  221.     if v >= 1.0:
  222.         if old_pos < 1.0:
  223.             wMaxPowerLabel.SetFlash(14)
  224.             wStrengthLabel.SetFlash(14)
  225.             wMaxPowerLabel.SetVisible(1)
  226.         
  227.     else:
  228.         wMaxPowerLabel.SetVisible(0)
  229.         wStrengthLabel.SetFlash(0.0)
  230.  
  231.  
  232. def SetEnergyBarValue(v, max_v):
  233.     wStrengthBar.SetVisible(0)
  234.     if VISIBLE:
  235.         wEnergyBar.SetVisible(1)
  236.     
  237.     pos = min(max(v / max_v, 0), 1.0)
  238.     wEnergyBar.SetPositionPercentage(pos * (6.5 / 8.0))
  239.     wEnergyMaxLabel.SetText(`max_v`)
  240.     wEnergyBar.RecalcLabelLayout(BUIx.B_Widget.B_LAB_Left, BUIx.B_Widget.B_LAB_VCenter)
  241.     if pos <= ENERGY_LOW_LEVEL:
  242.         wDangerLabel.SetFlash(14)
  243.         wDangerLabel.SetVisible(1)
  244.     else:
  245.         wDangerLabel.SetVisible(0)
  246.  
  247.  
  248. def SetVisible(vis):
  249.     global VISIBLE
  250.     VISIBLE = vis
  251.     if vis == 0:
  252.         wLeftHand.SetVisible(vis)
  253.         wRightHand.SetVisible(0)
  254.         PowDefWidgets.Deactivate()
  255.     else:
  256.         PowDefWidgets.Activate()
  257.     wSpecialsFrame.SetVisible(vis)
  258.     wEnemiesFrame.SetVisible(vis)
  259.     wLeftFrame.SetVisible(vis)
  260.     wArrowInfo.SetVisible(vis)
  261.     wEnergyBar.SetVisible(0)
  262.     wStrengthBar.SetVisible(0)
  263.     wStrengthBar.SetVisible(0)
  264.     wLowBarFrame.SetVisible(0)
  265.     wObjectsFrame.SetVisible(0)
  266.  
  267.