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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import whrandom
  5. import Bladex
  6. import math
  7. import PhantonFX
  8. import Reference
  9. import Actions
  10. import ObjStore
  11. Bladex.AddParticleGType('Tierrax', 'SmokeParticle', Reference.B_PARTICLE_GTYPE_BLEND, 64)
  12. for i in range(64):
  13.     aux = (64.0 - i) / 64.0
  14.     r = 100
  15.     g = 100
  16.     b = 100
  17.     a = 255.0 * (1.0 - aux) ** 0.5
  18.     size = 80.0 + aux * 900.0
  19.     Bladex.SetParticleGVal('Tierrax', i, r, g, b, a, size)
  20.  
  21.  
  22. def SetTierraColor(r, g, b):
  23.     for i in range(64):
  24.         aux = (64.0 - i) / 64.0
  25.         a = 255.0 * (1.0 - aux) ** 0.5
  26.         size = 80.0 + aux * 900.0
  27.         Bladex.SetParticleGVal('Tierrax', i, r, g, b, a, size)
  28.     
  29.  
  30. Bladex.AddParticleGType('FastDust', 'SmokeParticle', Reference.B_PARTICLE_GTYPE_BLEND, 16)
  31. for i in range(16):
  32.     aux = (16.0 - i) / 16.0
  33.     r = 50
  34.     g = 50
  35.     b = 50
  36.     a = 255.0 * (1.0 - aux) ** 0.5
  37.     size = 40.0 + aux * 450.0
  38.     Bladex.SetParticleGVal('FastDust', i, r, g, b, a, size)
  39.  
  40.  
  41. def SetTierrapidaColor(r, g, b):
  42.     for i in range(16):
  43.         aux = (16.0 - i) / 16.0
  44.         a = 255.0 * (1.0 - aux) ** 0.5
  45.         size = 40.0 + aux * 450.0
  46.         Bladex.SetParticleGVal('FastDust', i, r, g, b, a, size)
  47.     
  48.  
  49.  
  50. def RemueveTierraGen(x, y, z, sx, sz, pps = 64, Ptypo = 'Tierrax', t2l = 64, Death = 2.0):
  51.     tierra1 = Bladex.CreateEntity('TierraRemoviendose1', 'Entity Particle System D3', x + sx, y, z + sz)
  52.     tierra1.D1 = (-2 * sx, 0, 0)
  53.     tierra1.D2 = (-2 * sx, 0, -2 * sz)
  54.     tierra1.ParticleType = Ptypo
  55.     tierra1.PPS = pps
  56.     tierra1.YGravity = 200.0
  57.     tierra1.Friction = 0.1
  58.     tierra1.Velocity = (0.0, -400.0, 0.0)
  59.     tierra1.RandomVelocity = 15.0
  60.     tierra1.Time2Live = t2l
  61.     if Death != -1:
  62.         tierra1.DeathTime = Bladex.GetTime() + Death
  63.     
  64.     tierra2 = Bladex.CreateEntity('TierraRemoviendose2', 'Entity Particle System D3', x + sx, y, z + sz)
  65.     tierra2.D1 = (-2 * sx, 0, -2 * sz)
  66.     tierra2.D2 = (0, 0, -2 * sz)
  67.     tierra2.ParticleType = Ptypo
  68.     tierra2.PPS = pps
  69.     tierra2.YGravity = 200.0
  70.     tierra2.Friction = 0.1
  71.     tierra2.Velocity = (0.0, -400.0, 0.0)
  72.     tierra2.RandomVelocity = 15.0
  73.     tierra2.Time2Live = t2l
  74.     if Death != -1:
  75.         tierra2.DeathTime = Bladex.GetTime() + Death
  76.     
  77.     return (tierra1, tierra2)
  78.  
  79.  
  80. def DropDust(x, y, z, vx, vy, vz, pps = 64, Ptypo = 'Tierrax', t2l = 64, Death = 1.0):
  81.     tierra1 = Bladex.CreateEntity('Cristales', 'Entity Particle System D1', x, y, z)
  82.     tierra1.ParticleType = Ptypo
  83.     tierra1.PPS = pps
  84.     tierra1.YGravity = 9800.0
  85.     tierra1.Friction = 0.1
  86.     tierra1.Velocity = (vx, vy, vz)
  87.     tierra1.RandomVelocity = 50.0
  88.     tierra1.Time2Live = t2l
  89.     tierra1.DeathTime = Bladex.GetTime() + Death
  90.     return tierra1
  91.  
  92. Bladex.AddParticleGType('Polvin', 'SmokeParticle', Reference.B_PARTICLE_GTYPE_BLEND, 64)
  93. intensidad = 60
  94.  
  95. def SetPolvinColor(r, g, b):
  96.     for i in range(68):
  97.         a = 255 * i / 64.0
  98.         size = 512 * (64 - i) / 64.0
  99.         Bladex.SetParticleGVal('Polvin', i, r, g, b, a, size)
  100.     
  101.  
  102. for i in range(68):
  103.     r = 255.0
  104.     g = 255.0
  105.     b = 255.0
  106.     a = 255 * i / 64.0
  107.     size = 512 * (64 - i) / 64.0
  108.     Bladex.SetParticleGVal('Polvin', i, r, g, b, a, size)
  109.  
  110.  
  111. def Tierrilla(x, y, z, dx, dz):
  112.     tierra1 = Bladex.CreateEntity('Tierrilla', 'Entity Particle System D3', x, y, z)
  113.     tierra1.D1 = (3000, 0, 0)
  114.     tierra1.D2 = (3000, 0, 3000)
  115.     tierra1.Time2Live = 68
  116.     tierra1.YGravity = -500
  117.     tierra1.Velocity = (dx, 1000, dz)
  118.     tierra1.RandomVelocity = 5
  119.     tierra1.ParticleType = 'Polvin'
  120.     tierra1.PPS = intensidad
  121.     tierra1.DeathTime = Bladex.GetTime() + 2.0
  122.  
  123.  
  124. class WindFX:
  125.     Variance = 0
  126.     Sector = None
  127.     Sonido = None
  128.     x = 0
  129.     y = 0
  130.     z = 0
  131.     wx = 0
  132.     wy = 0
  133.     wz = 0
  134.     
  135.     def __init__(self, x, y, z):
  136.         self.Sector = Bladex.GetSector(x, y, z)
  137.         self.Sector.OnEnter = self.EntroElIluso
  138.         self.ObjId = ObjStore.GetNewId()
  139.         ObjStore.ObjectsStore[self.ObjId] = self
  140.  
  141.     
  142.     def __del__(self):
  143.         del ObjStore.ObjectsStore[self.ObjId]
  144.  
  145.     
  146.     def persistent_id(self):
  147.         return self.ObjId
  148.  
  149.     
  150.     def __getstate__(self):
  151.         return (1, self.ObjId, self.Variance, self.Sector, self.Sonido, self.x, self.y, self.z, self.wx, self.wy, self.wz)
  152.  
  153.     
  154.     def __setstate__(self, parm):
  155.         if parm[0] == 1:
  156.             self.ObjId = parm[1]
  157.             ObjStore.ObjectsStore[self.ObjId] = self
  158.             self.Variance = parm[2]
  159.             self.Sector = parm[3]
  160.             self.Sonido = parm[4]
  161.             self.x = parm[5]
  162.             self.y = parm[6]
  163.             self.z = parm[7]
  164.             self.wx = parm[8]
  165.             self.wy = parm[9]
  166.             self.wz = parm[10]
  167.         else:
  168.             print 'WindFX.__setstate__() -> Version mismatch'
  169.             self.ObjId = ObjStore.GetNewId()
  170.             ObjStore.ObjectsStore[self.ObjId] = self
  171.  
  172.     
  173.     def SetSound(self, sonidox):
  174.         self.Sonido = sonidox
  175.  
  176.     
  177.     def SetGenerationPoint(self, x, y, z):
  178.         self.x = x
  179.         self.y = y
  180.         self.z = z
  181.  
  182.     
  183.     def SetWindVector(self, x, z):
  184.         self.wx = x
  185.         self.wz = z
  186.  
  187.     
  188.     def DropWind(self):
  189.         self.Sonido.Position = (self.x, self.y, self.z)
  190.         self.Sonido.PlaySound(0)
  191.         Tierrilla(self.x, self.y, self.z, self.wx, self.wz)
  192.  
  193.     
  194.     def EntroElIluso(self, Sector, Entity_Name):
  195.         if Entity_Name == 'Player1':
  196.             if whrandom.randint(0, self.Variance) == 0:
  197.                 self.DropWind()
  198.             
  199.         
  200.  
  201.  
  202. Bladex.AddParticleGType('LavaFire', 'FireParticle', Reference.B_PARTICLE_GTYPE_ADD, 31)
  203. for i in range(32):
  204.     r = 255
  205.     g = min(100.0 * (1.0 - aux * aux) + 35, 255.0)
  206.     b = min(50.0 * (1.0 - aux), 255.0)
  207.     a = min(200.0 * (1.0 - aux), 255.0)
  208.     size = 130.0 + math.sqrt(1.0 - aux) * 110.0
  209.     Bladex.SetParticleGVal('LavaFire', i, r, g, b, a, size)
  210.  
  211. D_SPEED = 0.05
  212.  
  213. def ChauPiedruchaTick(obj_name, time):
  214.     pieza = Bladex.GetEntity(obj_name)
  215.     luz = Bladex.GetEntity(obj_name + 'Luz')
  216.     if not pieza:
  217.         return None
  218.     else:
  219.         pieza.Alpha = pieza.Alpha - D_SPEED
  220.         luz.Intensity = pieza.Alpha * 10
  221.         if luz.Intensity < 1:
  222.             pieza.RemoveFromList('Timer15')
  223.             pieza.SubscribeToList('Pin')
  224.         
  225.  
  226.  
  227. def ChauPiedrucha(obj_name):
  228.     pieza = Bladex.GetEntity(obj_name)
  229.     if not pieza:
  230.         return None
  231.     else:
  232.         pieza.SubscribeToList('Timer15')
  233.         pieza.TimerFunc = ChauPiedruchaTick
  234.         pieza = Bladex.GetEntity(obj_name)
  235.         fuego = Bladex.GetEntity(obj_name + 'Fuego')
  236.         fuego.DeathTime = Bladex.GetTime()
  237.  
  238.  
  239. def DropPiedra(x, y, z, dx = 1, dy = 1, dz = 1, Pname = 'Piedra_02'):
  240.     Piedra = Bladex.CreateEntity('Piedrita', Pname, x, y, z)
  241.     Piedra.Static = 0
  242.     Fuego = Bladex.CreateEntity(Piedra.Name + 'Fuego', 'Entity Particle System D1', 0, 0, 0)
  243.     Fuego.ParticleType = 'LavaFire'
  244.     Fuego.PPS = 64
  245.     Fuego.YGravity = 1000
  246.     Fuego.Friction = 0.1
  247.     Fuego.Velocity = (0, 0, 0)
  248.     Fuego.RandomVelocity = 30.0
  249.     Fuego.Time2Live = 32
  250.     Piedra.Link(Fuego)
  251.     Luz = Bladex.CreateEntity(Piedra.Name + 'Luz', 'Entity Spot', 0, 0, 0)
  252.     Luz.Color = (255, 100, 50)
  253.     Luz.Intensity = 3
  254.     Luz.CastShadows = 0
  255.     Luz.Precission = 0.5
  256.     Luz.Visible = 0
  257.     Luz.Flick = 1
  258.     Piedra.Link(Luz)
  259.     Piedra.ExclusionGroup = 1
  260.     Piedra.Impulse(dx, dy, dz)
  261.     Piedra.OnStopFunc = ChauPiedrucha
  262.     return (Piedra, Fuego, Luz)
  263.  
  264.  
  265. def BorraPorLasDudas2(PersonName):
  266.     wps = Bladex.GetEntity(PersonName + 'WPS')
  267.     if wps:
  268.         wps.SubscribeToList('Pin')
  269.     
  270.  
  271.  
  272. def BorraPorLasDudas(PersonName):
  273.     Bladex.GetEntity(PersonName).CastShadows = 0
  274.     Bladex.AddScheduledFunc(Bladex.GetTime() + 5, BorraPorLasDudas2, (PersonName,))
  275.  
  276.  
  277. def EnPolvoPerson(PersonName, dx, dz):
  278.     me = Bladex.GetEntity(PersonName)
  279.     object = Bladex.GetEntity(me.InvLeft)
  280.     if me.InvLeft and object and not (object.TestHit):
  281.         Actions.RemoveFromInventory(me, object, 'DropLeftEvent')
  282.         object.Alpha = 1.0
  283.         object.Impulse(0.0, 0.0, 0.0)
  284.     
  285.     object = Bladex.GetEntity(me.InvRight)
  286.     if me.InvRight and object and not (object.TestHit):
  287.         Actions.RemoveFromInventory(me, object, 'DropRightEvent')
  288.         object.Alpha = 1.0
  289.         object.Impulse(0.0, 0.0, 0.0)
  290.     
  291.     wps = Bladex.CreateEntity(PersonName + 'WPS', 'Entity Particle System Dperson', 0.0, 0.0, 0.0)
  292.     wps.PersonName = PersonName
  293.     wps.ParticleType = 'EnPolvo'
  294.     wps.Time2Live = 64
  295.     wps.RandomVelocity = 0
  296.     wps.Velocity = (dx, 300, dz)
  297.     wps.NormalVelocity = 2.0
  298.     wps.YGravity = -300
  299.     wps.DeathTime = Bladex.GetTime() + 1.5
  300.     wps.PPS = 300
  301.     PhantonFX.Delta = 0.1
  302.     PhantonFX.SecAgo = 10
  303.     PhantonFX.DisappearsChar(PersonName, BorraPorLasDudas)
  304.  
  305. Bladex.AddParticleGType('EnPolvo', 'SmokeParticle', Reference.B_PARTICLE_GTYPE_BLEND, 64)
  306. for i in range(68):
  307.     r = 255.0
  308.     g = 255.0
  309.     b = 255.0
  310.     a = 255 * i / 64.0
  311.     size = 128 * (64 - i) / 64.0 + 16
  312.     Bladex.SetParticleGVal('EnPolvo', i, r, g, b, a, size)
  313.  
  314.