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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import Bladex
  5. import Reference
  6. import Menu
  7. import Raster
  8. import BUIx
  9. import BBLib
  10. import BInput
  11. import darfuncs
  12. import GameText
  13. import TutorialScorer
  14. fading_start_time = 0
  15. logo_rebel = 0
  16. logo_friendware = 0
  17. logo_blade = 0
  18. last_demo_msg_time = 0
  19. demo_is_active = 0
  20. prev_was_menu = 0
  21. LOGOS_FULL = 1
  22. TutorialScorer.ActivateTutorialScorer('../../Data/Letras menu med.bmp')
  23. TutorialScorer.wMultiText.SetColor(255, 0, 0)
  24. LastMessage = 0
  25. OnEnterDemo = 0
  26. OnExitDemo = 0
  27.  
  28. def StaticLogoRebel(time):
  29.     global last_demo_msg_time
  30.     alpha = (time - fading_start_time) * 0.25
  31.     if alpha > 0.8:
  32.         alpha = 0.8
  33.     
  34.     if alpha < 0:
  35.         alpha = 0
  36.     
  37.     if time - last_demo_msg_time > 3.0:
  38.         GameText.WriteTextAux('Modo DEMO - pulsa una tecla', 2.0, 255, 255, 255, [])
  39.         last_demo_msg_time = time
  40.     
  41.     (w, h) = Raster.GetSize()
  42.     Raster.SetPosition(w - 136, h - 90 - 5)
  43.     Raster.SetAlpha(alpha)
  44.     Raster.DrawBitmap(logo_rebel, 128, 90)
  45.     Raster.SetPosition(10, h - 110)
  46.     Raster.SetAlpha(alpha)
  47.     Raster.DrawBitmap(logo_friendware, 128 - 20, 128)
  48.     Raster.SetPosition(w / 2.0 - 128, -90)
  49.     Raster.SetAlpha(alpha)
  50.     Raster.DrawBitmap(logo_blade, 256, 256)
  51.  
  52.  
  53. def FadeLogoFriendware(time):
  54.     global fading_start_time
  55.     if time - fading_start_time < 2:
  56.         alpha = (time - fading_start_time) * 0.5
  57.     else:
  58.         alpha = 1.0 - (time - fading_start_time - 2) * 0.5
  59.     if alpha > 1:
  60.         alpha = 1
  61.     elif alpha <= 0:
  62.         alpha = 0
  63.         if time - fading_start_time > 1:
  64.             Bladex.RemoveAfterFrameFunc('FadeLogoFriendware')
  65.             fading_start_time = Bladex.GetTime() + 0.5
  66.             Bladex.SetAfterFrameFunc('StaticLogoRebel', StaticLogoRebel)
  67.         
  68.     
  69.     Raster.SetPenColor(255, 255, 255)
  70.     Raster.SetAlpha(alpha)
  71.     if LOGOS_FULL == 1:
  72.         Raster.SetPosition(110, 0)
  73.         Raster.DrawBitmap(logo_friendware, Raster.GetSize()[0] - 220, Raster.GetSize()[1])
  74.     else:
  75.         Raster.SetPosition(Raster.GetSize()[0] - 256, Raster.GetSize()[1] - 225)
  76.         Raster.DrawBitmap(logo_friendware, 255, 255)
  77.  
  78.  
  79. def FadeLogoRebel(time):
  80.     global fading_start_time
  81.     if time - fading_start_time < 2:
  82.         alpha = (time - fading_start_time) * 0.5
  83.     else:
  84.         alpha = 1.0 - (time - fading_start_time - 2) * 0.5
  85.     if alpha > 1:
  86.         alpha = 1
  87.     elif alpha <= 0:
  88.         alpha = 0
  89.         if time - fading_start_time > 1:
  90.             Bladex.RemoveAfterFrameFunc('FadeLogoRebel')
  91.             fading_start_time = Bladex.GetTime() + 0.5
  92.             Bladex.SetAfterFrameFunc('FadeLogoFriendware', FadeLogoFriendware)
  93.         
  94.     
  95.     Raster.SetPenColor(255, 255, 255)
  96.     Raster.SetAlpha(alpha)
  97.     if LOGOS_FULL == 1:
  98.         Raster.SetPosition(60, 40)
  99.         Raster.DrawBitmap(logo_rebel, Raster.GetSize()[0] - 120, Raster.GetSize()[1] - 80)
  100.     else:
  101.         Raster.SetPosition(Raster.GetSize()[0] - 256, Raster.GetSize()[1] - 256)
  102.         Raster.DrawBitmap(logo_rebel, 255, 255)
  103.  
  104.  
  105. def LaunchDemoCamera2(a, b):
  106.     global fading_start_time
  107.     fading_start_time = Bladex.GetTime() + 1
  108.     Bladex.RemoveAfterFrameFunc('StaticLogoRebel')
  109.     Bladex.SetAfterFrameFunc('FadeLogoRebel', FadeLogoRebel)
  110.     darfuncs.LaunchMaxCamera('demo_travelling.cam', 0, -1, LaunchDemoCamera)
  111.  
  112.  
  113. def LaunchDemoCamera(a, b):
  114.     darfuncs.LaunchMaxCamera('demo_travelling.cam', 0, -1, LaunchDemoCamera2)
  115.  
  116. import pdb
  117. oldInputActionsSet = None
  118.  
  119. def FinishDemoFunc(x, y, z):
  120.     global Listener
  121.     print 'Demo_Stuff.FinishDemoFunc called'
  122.     InputManager = BInput.GetInputManager()
  123.     InputManager.SetInputActionsSet(oldInputActionsSet)
  124.     InputManager.GetAttachedDevice('Keyboard').RemoveListener('EndDemo')
  125.     Listener = None
  126.     DemoLoop()
  127.  
  128.  
  129. def DemoLoop():
  130.     global demo_is_active, prev_was_menu, fading_start_time, Listener, oldInputActionsSet, demo_is_active, prev_was_menu, prev_was_menu, demo_is_active, fading_start_time, Listener, oldInputActionsSet
  131.     AppMode = Bladex.GetAppMode()
  132.     import Scorer
  133.     if AppMode == 'Menu':
  134.         demo_is_active = 1
  135.         prev_was_menu = 1
  136.         print 'DemoLoop-Menu2Demo'
  137.         Menu.ActivateMenu()
  138.         print 'DemoLoop , activatemenu en menu2demo'
  139.         Bladex.SetAppMode('Demo')
  140.         if OnEnterDemo:
  141.             OnEnterDemo()
  142.         
  143.         print 'demo mode set up'
  144.         Bladex.ExeMusicEvent(Bladex.GetMusicEvent('musica_loop_demo'))
  145.         fading_start_time = Bladex.GetTime() + 1
  146.         Bladex.SetAfterFrameFunc('FadeLogoRebel', FadeLogoRebel)
  147.         Listener = BInput.B_InputListener('EndDemo')
  148.         Listener.SetPythonFunc(FinishDemoFunc)
  149.         InputManager = BInput.GetInputManager()
  150.         oldInputActionsSet = InputManager.GetInputActionsSet()
  151.         InputManager.SetInputActionsSet('Demo')
  152.         InputManager.GetAttachedDevice('Keyboard').AddListener(Listener)
  153.         Bladex.AddScheduledFunc(Bladex.GetTime() + 0.1, LaunchDemoCamera, (0, 0))
  154.         Scorer.SetVisible(0)
  155.     elif AppMode == 'Demo':
  156.         demo_is_active = 0
  157.         Bladex.ActivateInput()
  158.         if prev_was_menu == 1:
  159.             Menu.ActivateMenu()
  160.             print 'DemoLoop-Demo2Menu'
  161.             print 'set menu mode'
  162.             Bladex.SetAppMode('Menu')
  163.         else:
  164.             print 'DemoLoop-Demo2Game'
  165.             print 'NO set 2 menu mode'
  166.             Bladex.SetAppMode('Game')
  167.         if OnExitDemo:
  168.             OnExitDemo()
  169.         
  170.         Bladex.ExeMusicEvent(-1)
  171.         Bladex.RemoveAfterFrameFunc('FadeLogoRebel')
  172.         Bladex.RemoveAfterFrameFunc('FadeLogoFriendware')
  173.         Bladex.RemoveAfterFrameFunc('StaticLogoRebel')
  174.         prev_was_menu = 0
  175.         cam = Bladex.GetEntity('Camera')
  176.         if Bladex.GetCurrentMap() != 'Casa':
  177.             cam.SetPersonView('Player1')
  178.             cam.Cut()
  179.             Bladex.SetListenerPosition(1)
  180.             Scorer.SetVisible(1)
  181.         
  182.     elif AppMode == 'Game':
  183.         prev_was_menu = 0
  184.         demo_is_active = 1
  185.         print 'DemoLoop-Game2Demo'
  186.         Bladex.SetAppMode('Demo')
  187.         print 'demo mode set up'
  188.         Bladex.ExeMusicEvent(Bladex.GetMusicEvent('musica_loop_demo'))
  189.         fading_start_time = Bladex.GetTime() + 1
  190.         Bladex.SetAfterFrameFunc('FadeLogoRebel', FadeLogoRebel)
  191.         if OnEnterDemo:
  192.             OnEnterDemo()
  193.         
  194.         Listener = BInput.B_InputListener('EndDemo')
  195.         Listener.SetPythonFunc(FinishDemoFunc)
  196.         InputManager = BInput.GetInputManager()
  197.         oldInputActionsSet = InputManager.GetInputActionsSet()
  198.         InputManager.SetInputActionsSet('Demo')
  199.         InputManager.GetAttachedDevice('Keyboard').AddListener(Listener)
  200.         LaunchDemoCamera(0, 0)
  201.         Scorer.SetVisible(0)
  202.     
  203.  
  204.  
  205. def Init():
  206.     global logo_rebel, logo_friendware, logo_blade
  207.     if Reference.DEMO_MODE == 1:
  208.         Bladex.SetMenuTgapFunc(DemoLoop)
  209.     else:
  210.         return None
  211.     BBLib.ReadMMP('../../Data/logorebel.mmp')
  212.     logo_rebel = Raster.BmpHandle('LOGOREBELALFA')
  213.     BBLib.ReadMMP('../../Data/logofriendware256.mmp')
  214.     logo_friendware = Raster.BmpHandle('LOGOFRIENDWARE')
  215.     BBLib.ReadMMP('../../Data/logoblade256.mmp')
  216.     logo_blade = Raster.BmpHandle('LOGOBLADE')
  217.     Bladex.AddMusicEventMP3('musica_loop_demo', '..\\..\\Sounds\\tema.mp3', 0.1, 1.0, 1.0, 11000, 0, -1)
  218.     Bladex.AddMusicEventMP3('emptyloquesea_demo', '', 0.1, 0.1, 1.0, 11000, 0, 0)
  219.  
  220.