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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import Bladex
  5. import netgame
  6. import AuxFuncs
  7. PTS = []
  8.  
  9. def AddNode(Source, Target, time = 2):
  10.     PTS.append(Source, Target, time)
  11.  
  12.  
  13. def ResetNode():
  14.     global PTS, Counter, auxi1, auxi2, CallBack, LastTime
  15.     PTS = []
  16.     Counter = 0
  17.     auxi1 = (0, 0, 0)
  18.     auxi2 = (0, 0, 0)
  19.     CallBack = None
  20.     LastTime = 2
  21.  
  22.  
  23. def SaveNode(time = 2):
  24.     cam = Bladex.GetEntity('Camera')
  25.     PTS.append(cam.Position, cam.TPos, time)
  26.  
  27.  
  28. def ChNode(idx, time = 2):
  29.     cam = Bladex.GetEntity('Camera')
  30.     PTS[idx] = (cam.Position, cam.TPos, time)
  31.  
  32.  
  33. def ZoomNode(idx, Zoom = 0.5):
  34.     n = PTS[idx]
  35.     iZoom = 1.0 - Zoom
  36.     PTS[idx] = ((n[0][0] * iZoom + n[1][0] * Zoom, n[0][1] * iZoom + n[1][1] * Zoom, n[0][2] * iZoom + n[1][2] * Zoom), n[1], n[2])
  37.  
  38. Counter = 0
  39. auxi1 = (0, 0, 0)
  40. auxi2 = (0, 0, 0)
  41. CallBack = None
  42. LastTime = 2
  43.  
  44. def GetTime(tupla):
  45.     if len(tupla) == 2:
  46.         return 2
  47.     elif len(tupla) != 3:
  48.         tupla[3]()
  49.     
  50.     return tupla[2]
  51.  
  52.  
  53. def FinalAbrePuerta():
  54.     global CallBack
  55.     Cam = Bladex.GetEntity('Camera')
  56.     Cam.SetPersonView('Player1')
  57.     Cam.Cut()
  58.     Bladex.ActivateInput()
  59.     if netgame.GetNetState() == 0:
  60.         import Scorer
  61.         Scorer.SetVisible(1)
  62.     
  63.     if CallBack:
  64.         CallBack()
  65.         CallBack = None
  66.     
  67.  
  68.  
  69. def LoopAbrePuerta():
  70.     global Counter, Counter
  71.     cam = Bladex.GetEntity('Camera')
  72.     opos = cam.Position
  73.     tpos = cam.TPos
  74.     if Counter == len(PTS):
  75.         Counter = 0
  76.         if LastTime != 0:
  77.             AuxFuncs.MoveCamFromTo(opos[0], opos[1], opos[2], auxi1[0], auxi1[1], auxi1[2], tpos[0], tpos[1], tpos[2], auxi2[0], auxi2[1], auxi2[2], LastTime, FinalAbrePuerta)
  78.         else:
  79.             FinalAbrePuerta()
  80.     else:
  81.         Point = PTS[Counter][0]
  82.         Target = PTS[Counter][1]
  83.         Counter = Counter + 1
  84.         AuxFuncs.MoveCamFromTo(opos[0], opos[1], opos[2], Point[0], Point[1], Point[2], tpos[0], tpos[1], tpos[2], Target[0], Target[1], Target[2], GetTime(PTS[Counter - 1]), LoopAbrePuerta)
  85.  
  86.  
  87. def AbreCam():
  88.     global Counter, Counter, auxi1, auxi2
  89.     Counter = 0
  90.     Point = PTS[Counter][0]
  91.     Target = PTS[Counter][1]
  92.     Counter = Counter + 1
  93.     Bladex.DeactivateInput()
  94.     if netgame.GetNetState() == 0:
  95.         import Scorer
  96.         Scorer.SetVisible(0)
  97.     
  98.     cam = Bladex.GetEntity('Camera')
  99.     auxi1 = cam.Position
  100.     auxi2 = cam.TPos
  101.     AuxFuncs.MoveCamFromTo(auxi1[0], auxi1[1], auxi1[2], Point[0], Point[1], Point[2], auxi2[0], auxi2[1], auxi2[2], Target[0], Target[1], Target[2], GetTime(PTS[Counter - 1]), LoopAbrePuerta)
  102.  
  103.  
  104. def SaveData(filename):
  105.     import cPickle
  106.     funcfile = open(filename, 'wt')
  107.     p = cPickle.Pickler(funcfile)
  108.     d = (Counter, auxi1, auxi2, CallBack, LastTime, PTS)
  109.     p.dump(d)
  110.     funcfile.close()
  111.  
  112.  
  113. def LoadData(filename):
  114.     global Counter, auxi1, auxi2, CallBack, LastTime, PTS
  115.     import cPickle
  116.     funcfile = open(filename, 'rt')
  117.     p = cPickle.Unpickler(funcfile)
  118.     d = p.load()
  119.     funcfile.close()
  120.     print d
  121.     Counter = d[0]
  122.     auxi1 = d[1]
  123.     auxi2 = d[2]
  124.     CallBack = d[3]
  125.     LastTime = d[4]
  126.     PTS = d[5]
  127.  
  128. import GameState
  129. GameState.ModulesToBeSaved.append(__import__(__name__))
  130.