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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import darfuncs
  5. import Bladex
  6. import Damage
  7. import AbreCam
  8. import Actions
  9. import EnemyTypes
  10. import PhantonFX
  11. import GenFX
  12. import ItemTypes
  13. import Reference
  14. import Auras
  15. import Blood
  16. import Menu
  17. import types
  18. import AuxFuncs
  19.  
  20. def GetSectorIdx(pos):
  21.     if type(pos) == types.StringType:
  22.         return pos
  23.     else:
  24.         return Bladex.GetSector(pos[0], pos[1], pos[2]).Index
  25.  
  26. _AppearsCagazo = Bladex.CreateSound('..\\..\\Sounds\\AparicionEnric2.wav', 'AppearsCagazo')
  27. _AppearsCagazo.MaxDistance = 200000.0
  28. _AppearsCagazo.MinDistance = 20000.0
  29. ChaosKnightActivated = 1
  30.  
  31. def MuereCaos(caosname):
  32.     chaosk1 = Bladex.GetEntity(caosname)
  33.     chaosk1.Data.PrepareDisappearance()
  34.     chaosk1.Data.Disappear(caosname)
  35.  
  36.  
  37. def ChaosAbreCam(per):
  38.     AbreCam.PTS = []
  39.     AbreCam.PTS.append((per.Position[0] - 3000, per.Position[1] - 1000, per.Position[2] - 3000), per.Position, 0.01)
  40.     AbreCam.PTS.append((per.Position[0] - 3000, per.Position[1] - 1000, per.Position[2] + 3000), per.Position, 3.5)
  41.     AbreCam.PTS.append((per.Position[0] + 3000, per.Position[1] - 1000, per.Position[2] + 3000), per.Position, 3.5)
  42.     AbreCam.PTS.append((per.Position[0] + 3000, per.Position[1] - 1000, per.Position[2] - 3000), per.Position, 3.5)
  43.     AbreCam.PTS.append((per.Position[0] - 3000, per.Position[1] - 1000, per.Position[2] - 3000), per.Position, 3.5)
  44.     AbreCam.LastTime = 0.01
  45.     AbreCam.AbreCam()
  46.  
  47.  
  48. def CreateChaosKnightBak(Position, Angle):
  49.     chaosk1 = Bladex.CreateEntity('ChaosKnightBak', 'ChaosKnight', Position[0], Position[1], Position[2], 'Person')
  50.     chaosk1.ActionAreaMin = pow(2, 0)
  51.     chaosk1.ActionAreaMax = pow(2, 1)
  52.     chaosk1.Angle = Angle
  53.     chaosk1.Level = CHAOS_KNIGHT_LEVEL
  54.     EnemyTypes.EnemyDefaultFuncs(chaosk1)
  55.     chaosk1.ImDeadFunc = MuereCaos
  56.     chaosk1.Data.DamageFactorNone = 0.15
  57.     chaosk1.Data.DamageFactorLight = 0.35
  58.     chaosk1.Data.DamageFactorHeavy = 0.35
  59.     chaosk1.Data.PrepareWeapons('Espadon', 'Escudon')
  60.     chaosk1.SetOnFloor()
  61.     darfuncs.HideBadGuy(chaosk1.Name)
  62.  
  63.  
  64. def ParticulateAppears(PersonName = 'Player1'):
  65.     wps = Bladex.CreateEntity(PersonName + 'WPS', 'Entity Particle System Dperson', 0.0, 0.0, 0.0)
  66.     wps.PersonName = PersonName
  67.     wps.ParticleType = 'EnergyConc'
  68.     wps.Time2Live = 60
  69.     wps.RandomVelocity = 0
  70.     wps.Velocity = (0, 0, 0)
  71.     wps.NormalVelocity = -5.0
  72.     wps.YGravity = 0
  73.     wps.DeathTime = Bladex.GetTime() + 1.5
  74.     wps.PPS = 600
  75.     Bladex.GetEntity(PersonName).Alpha = 0.0
  76.     PhantonFX.Delta = 0.015
  77.     Bladex.AddScheduledFunc(Bladex.GetTime() + 0.0, PhantonFX.AppearsChar, (PersonName,))
  78.  
  79.  
  80. def AppearsChaosKnightBak():
  81.     if not ChaosKnightActivated:
  82.         return None
  83.     
  84.     chaosk1 = Bladex.GetEntity('ChaosKnightBak')
  85.     darfuncs.UnhideBadGuy(chaosk1.Name)
  86.     Bladex.AddScheduledFunc(Bladex.GetTime() + 15.0, darfuncs.UnhideBadGuy, (chaosk1.Name,))
  87.     chaosk1.Blind = 1
  88.     chaosk1.Deaf = 1
  89.     chaosk1.Alpha = 0.0
  90.     chaosk1.Data.Appear()
  91.     ChaosAbreCam(chaosk1)
  92.     ParticulateAppears(chaosk1.Name)
  93.     Actions.TurnToFaceEntityNow('ChaosKnightBak', 'Player1')
  94.     for pos in CHAOS_KNIGHT_DEACTIVATE:
  95.         darfuncs.EnterSecIdEvent(pos, TranslateChaos)
  96.     
  97.  
  98.  
  99. def ParticulateDisappears(PersonName = 'Player1'):
  100.     wps = Bladex.CreateEntity(PersonName + 'WPS', 'Entity Particle System Dperson', 0.0, 0.0, 0.0)
  101.     wps.PersonName = PersonName
  102.     wps.ParticleType = 'EnergyDissip'
  103.     wps.Time2Live = 60
  104.     wps.RandomVelocity = 0
  105.     wps.Velocity = (0, 0, 0)
  106.     wps.NormalVelocity = 5.0
  107.     wps.YGravity = 0
  108.     wps.DeathTime = Bladex.GetTime() + 1.5
  109.     wps.PPS = 600
  110.     Bladex.GetEntity(PersonName).Alpha = 1.0
  111.     PhantonFX.Delta = 0.015
  112.     PhantonFX.SecAgo = 0
  113.     Bladex.AddScheduledFunc(Bladex.GetTime() + 0.0, PhantonFX.DisappearsChar, (PersonName, BorraCaos))
  114.  
  115.  
  116. def BorraCaos(ent):
  117.     Bladex.AddScheduledFunc(Bladex.GetTime() + 0.2, PrepareChaosAppears2, ())
  118.     ch = Bladex.GetEntity('ChaosKnightBak')
  119.     ch.Data.InteruptActions('ChaosKnightBak')
  120.     darfuncs.HideBadGuy('ChaosKnightBak')
  121.  
  122.  
  123. def TranslateChaos():
  124.     chaosk1 = Bladex.GetEntity('ChaosKnightBak')
  125.     if chaosk1:
  126.         if chaosk1.Life > 0:
  127.             chaosk1.Freeze()
  128.             ParticulateDisappears('ChaosKnightBak')
  129.         
  130.     
  131.  
  132.  
  133. def AppearsChaosKnightBak2():
  134.     if not ChaosKnightActivated:
  135.         return None
  136.     
  137.     chaosk1 = Bladex.GetEntity('ChaosKnightBak')
  138.     darfuncs.UnhideBadGuy(chaosk1.Name)
  139.     ParticulateAppears(chaosk1.Name)
  140.     Actions.TurnToFaceEntityNow('ChaosKnightBak', 'Player1')
  141.     for pos in CHAOS_KNIGHT_DEACTIVATE:
  142.         darfuncs.EnterSecIdEvent(pos, TranslateChaos)
  143.     
  144.  
  145.  
  146. def DeactivateChaosWeapon(EntityName, EventName):
  147.     if EventName == 'ChkDisapR':
  148.         weapon = Bladex.GetEntity(Bladex.GetEntity(EntityName).InvRight)
  149.     else:
  150.         weapon = Bladex.GetEntity(Bladex.GetEntity(EntityName).InvLeft)
  151.     weapon.RasterMode = 'Read'
  152.     weapon.Alpha = 0
  153.     wps = Bladex.CreateEntity('WPS', 'Entity Particle System Dobj', 0.0, 0.0, 0.0)
  154.     wps.ObjectName = weapon.Name
  155.     wps.ParticleType = 'EnergyDissip'
  156.     wps.PPS = 400
  157.     wps.YGravity = 0.0
  158.     wps.Friction = 0.0
  159.     wps.Velocity = (0.0, 0.0, 0.0)
  160.     wps.RandomVelocity = 2.0
  161.     wps.NormalVelocity = 6.0
  162.     wps.Time2Live = 60
  163.     wps.DeathTime = Bladex.GetTime() + 1.5
  164.  
  165.  
  166. def PrepareChaosAppears2():
  167.     pers = Bladex.CreateEntity('ChaosKnightBak', 'ChaosKnight', CHAOS_KNIGHT_POSITION[0], CHAOS_KNIGHT_POSITION[1], CHAOS_KNIGHT_POSITION[2], 'Person')
  168.     pers.ActionAreaMin = pow(2, 0)
  169.     pers.ActionAreaMax = pow(2, 1)
  170.     pers.Angle = CHAOS_KNIGHT_ANGLE
  171.     EnemyTypes.EnemyDefaultFuncs(pers)
  172.     pers.Data.PrepareWeapons('Espadon', 'Escudon')
  173.     Actions.TakeObject(pers.Name, 'EspadonChaosKnightBak')
  174.     Actions.TakeObject(pers.Name, 'EscudonChaosKnightBak')
  175.     pers.ImDeadFunc = MuereCaos
  176.     pers.AddAnmEventFunc('ChkDisapL', DeactivateChaosWeapon)
  177.     pers.AddAnmEventFunc('ChkDisapR', DeactivateChaosWeapon)
  178.     pers.SetOnFloor()
  179.     darfuncs.HideBadGuy(pers.Name)
  180.     for pos in CHAOS_KNIGHT_ACTIVATE:
  181.         darfuncs.EnterSecIdEvent(pos, AppearsChaosKnightBak2)
  182.     
  183.  
  184. CHAOS_KNIGHT_LEVEL = 15
  185. CHAOS_KNIGHT_POSITION = (300029.603984, 8180.76682918, -1209.8189804)
  186. CHAOS_KNIGHT_ANGLE = 0
  187. CHAOS_KNIGHT_ACTIVATE = []
  188. CHAOS_KNIGHT_DEACTIVATE = []
  189. TIME_BEFORE_PLAYER_APPEARING = 1.5
  190. EXEC_IN_PLAYER_APPEARING = ''
  191. EXEC_IN_CHAOS_KNIGHT_APPEARING = ''
  192.  
  193. def PlayerAppears():
  194.     import Scorer
  195.     darfuncs.UnhideBadGuy('Player1')
  196.     GenFX.PersonMagicallyAppearing()
  197.     Bladex.AddScheduledFunc(Bladex.GetTime() + 2.0, Bladex.ActivateInput, ())
  198.     Bladex.AddScheduledFunc(Bladex.GetTime() + 2.0, Scorer.SetVisible, (1,))
  199.     if EXEC_IN_PLAYER_APPEARING:
  200.         EXEC_IN_PLAYER_APPEARING()
  201.     
  202.  
  203.  
  204. def PrevPlayerAppears():
  205.     import Scorer
  206.     darfuncs.HideBadGuy('Player1')
  207.     Scorer.SetVisible(0)
  208.     Bladex.DeactivateInput()
  209.     AuxFuncs.FadeFrom(2.0, TIME_BEFORE_PLAYER_APPEARING)
  210.     Bladex.AddScheduledFunc(Bladex.GetTime() + TIME_BEFORE_PLAYER_APPEARING + 2.0, PlayerAppears, ())
  211.  
  212.  
  213. def PrepareChaosAppears():
  214.     CreateChaosKnightBak(CHAOS_KNIGHT_POSITION, CHAOS_KNIGHT_ANGLE)
  215.     Blood.Evaporation = 1
  216.     Bladex.AddScheduledFunc(Bladex.GetTime(), PrevPlayerAppears, ())
  217.     for pos in CHAOS_KNIGHT_ACTIVATE:
  218.         darfuncs.EnterSecIdEvent(pos, AppearsChaosKnightBak)
  219.     
  220.  
  221.  
  222. def AddChaosAppearsSector(x, y, z):
  223.     CHAOS_KNIGHT_ACTIVATE.append(Bladex.GetSector(x, y, z).Index)
  224.  
  225.  
  226. def AddChaosAppearsTSector(id):
  227.     CHAOS_KNIGHT_ACTIVATE.append(id)
  228.  
  229.  
  230. def AddChaosDisappearsSector(x, y, z):
  231.     CHAOS_KNIGHT_DEACTIVATE.append(Bladex.GetSector(x, y, z).Index)
  232.  
  233.  
  234. def AddChaosDisappearsTSector(id):
  235.     CHAOS_KNIGHT_DEACTIVATE.append(id)
  236.  
  237.  
  238. def DeactivateChaos():
  239.     global ChaosKnightActivated
  240.     ChaosKnightActivated = 0
  241.  
  242.  
  243. def AddChaosDeactivationTs(id):
  244.     darfuncs.EnterSecIdEvent(id, DeactivateChaos)
  245.  
  246. Bladex.ReadBitMap('..\\..\\Data\\SmokePrtl3.bmp', 'SmokePart3')
  247. Bladex.AddParticleGType('DeathCloud', 'SmokePart3', Reference.B_PARTICLE_GTYPE_MUL, 16)
  248. for i in range(16):
  249.     aux = (16.0 - i) / 16
  250.     r = 255
  251.     g = 255
  252.     b = 255
  253.     a = 0
  254.     Bladex.SetParticleGVal('DeathCloud', i, r, g, b, a, size)
  255.  
  256.  
  257. def DeathAppears(PersonName = 'Player1', pos = (0, 0, 0)):
  258.     time = Bladex.GetTime()
  259.     aura = Auras.MakeAura(PersonName, 0.4, (50, 1.0, 0.0, 0, 0, 0), (), (), (2, 0.9, 0.9, 0.0, 0.9, 0.0, 0.9, 0.9, 0.0, 0.9, 0.8))
  260.     aura.Data.AddEvent(time + 0.2, (150, 0.5, 0.0, 0, 0, 0), (), (), (2, 0.9, 0.9, 0.0, 0.9, 0.0, 0.9, 0.9, 0.0, 0.9, 0.8))
  261.     aura.Data.AddEvent(time + 0.4, (200, 0.01, 0.0, 0, 0, 0), (), (), (2, 0.9, 0.9, 0.0, 0.9, 0.0, 0.9, 0.9, 0.0, 0.9, 0.8))
  262.     wps = Bladex.CreateEntity(PersonName + 'WPS', 'Entity Particle System Dperson', 0.0, 0.0, 0.0)
  263.     wps.PersonName = PersonName
  264.     wps.ParticleType = 'DeathCloud'
  265.     wps.Time2Live = 16
  266.     wps.RandomVelocity = 2.0
  267.     wps.Velocity = (0, 0, 0)
  268.     wps.NormalVelocity = 20
  269.     wps.YGravity = 0
  270.     wps.DeathTime = Bladex.GetTime() + 0.25
  271.     wps.PPS = 1024
  272.     per = Bladex.GetEntity(PersonName)
  273.     darfuncs.UnhideBadGuy(per.Name)
  274.     per.Alpha = 1.0
  275.     per.SetTmpAnmFlags(1, 1, 1, 0, 5, 1, 0)
  276.     per.Wuea = Reference.WUEA_ENDED
  277.     per.LaunchAnmType('rlx')
  278.     per.Position = pos
  279.     per.SetOnFloor()
  280.     per.SetActiveEnemy('Player1')
  281.     Actions.TurnToFaceEntityNow(per.Name, 'Player1')
  282.     _AppearsCagazo.Play(per.Position[0], per.Position[1], per.Position[2], 0)
  283.  
  284.  
  285. def DeathDisappears(PersonName = 'Player1'):
  286.     wps = Bladex.CreateEntity(PersonName + 'WPS', 'Entity Particle System Dperson', 0.0, 0.0, 0.0)
  287.     wps.PersonName = PersonName
  288.     wps.ParticleType = 'DeathCloud'
  289.     wps.Time2Live = 16
  290.     wps.RandomVelocity = 2.0
  291.     wps.Velocity = (0, 0, 0)
  292.     wps.NormalVelocity = 2
  293.     wps.YGravity = 0
  294.     wps.DeathTime = Bladex.GetTime() + 0.25
  295.     wps.PPS = 1024
  296.     per = Bladex.GetEntity(PersonName)
  297.     per.Data.InteruptActions(per.Name)
  298.     darfuncs.HideBadGuy(per.Name)
  299.     _AppearsCagazo.Play(per.Position[0], per.Position[1], per.Position[2], 0)
  300.  
  301. SECTOR_PROCS = { }
  302. LastSectorIdx = None
  303. SECTOR_COUNT = { }
  304.  
  305. def RemoveSector(idx):
  306.     if SECTOR_PROCS.has_key(idx):
  307.         del SECTOR_PROCS[idx]
  308.     
  309.  
  310.  
  311. def AddSectorCount(pos, Demons, Vampires):
  312.     idx = GetSectorIdx(pos)
  313.     SECTOR_COUNT[idx] = [
  314.         Demons,
  315.         Vampires,
  316.         []]
  317.     return idx
  318.  
  319.  
  320. def AddSectorDelete(idx, pos):
  321.     SECTOR_COUNT[idx][2].append(GetSectorIdx(pos))
  322.  
  323.  
  324. def OnEnterSectorProc(sector):
  325.     global LastSectorIdx
  326.     pass
  327.  
  328.  
  329. def ActivateSectorProcs():
  330.     for i in SECTOR_PROCS.keys():
  331.         darfuncs.EnterSecIdEvent(i, OnEnterSectorProc)
  332.     
  333.  
  334.  
  335. def AddSectorFunction(pos, func, param):
  336.     idx = GetSectorIdx(pos)
  337.     if SECTOR_PROCS.has_key(idx):
  338.         SECTOR_PROCS[idx].append((func, param))
  339.     else:
  340.         SECTOR_PROCS[idx] = [
  341.             (func, param)]
  342.  
  343. L_Vamp = []
  344. L_Little_Demon = []
  345.  
  346. def AddVampires(Num, ValidPos, Level):
  347.     for i in range(Num):
  348.         pers = Bladex.CreateEntity('VMP_' + `Level` + '_' + `i`, 'Vamp', ValidPos[0], ValidPos[1], ValidPos[2], 'Person')
  349.         pers.Angle = 6.26312373572
  350.         pers.Level = Level
  351.         Cimitarra1 = Bladex.CreateEntity('VampWeapon' + `Level` + '_' + `i`, 'VampWeapon', 0, 0, 0, 'Weapon')
  352.         VampShield = Bladex.CreateEntity('VampShield' + `Level` + '_' + `i`, 'VampShield', 0, 0, 0, 'Weapon')
  353.         ItemTypes.ItemDefaultFuncs(Cimitarra1)
  354.         ItemTypes.ItemDefaultFuncs(VampShield)
  355.         Actions.TakeObject(pers.Name, Cimitarra1.Name)
  356.         Actions.TakeObject(pers.Name, VampShield.Name)
  357.         EnemyTypes.EnemyDefaultFuncs(pers)
  358.         pers.SetOnFloor()
  359.         darfuncs.HideBadGuy(pers.Name)
  360.         pers.ImDeadFunc = MuerteBichoMolesto
  361.         L_Vamp.append([
  362.             pers.Name,
  363.             0])
  364.     
  365.  
  366.  
  367. def AddDemons(Num, ValidPos, Level):
  368.     for i in range(Num):
  369.         pers = Bladex.CreateEntity('Little_Demon_' + `Level` + '_' + `i`, 'Little_Demon', ValidPos[0], ValidPos[1], ValidPos[2], 'Person')
  370.         pers.Angle = 6.26312373572
  371.         pers.Level = Level
  372.         EnemyTypes.EnemyDefaultFuncs(pers)
  373.         pers.SetOnFloor()
  374.         pers.ImDeadFunc = MuerteBichoMolesto
  375.         darfuncs.HideBadGuy(pers.Name)
  376.         L_Little_Demon.append([
  377.             pers.Name,
  378.             0])
  379.     
  380.  
  381.  
  382. def EnemyAppear(List, Position, Time):
  383.     EneName = None
  384.     for i in List:
  385.         pass
  386.     
  387.  
  388.  
  389. def HideEnemies():
  390.     print 'HideEnemies'
  391.     for i in L_Vamp:
  392.         pass
  393.     
  394.     for i in L_Little_Demon:
  395.         pass
  396.     
  397.  
  398.  
  399. def HideEnemiesSector(pos):
  400.     AddSectorFunction(pos, HideEnemies, ())
  401.  
  402.  
  403. def AddVampireAppears(secPos, enePos, Time):
  404.     AddSectorFunction(secPos, EnemyAppear, (L_Vamp, enePos, Time))
  405.  
  406.  
  407. def AddDemonAppears(secPos, enePos, Time):
  408.     AddSectorFunction(secPos, EnemyAppear, (L_Little_Demon, enePos, Time))
  409.  
  410.  
  411. def MuerteBichoMolesto(Name):
  412.     me = Bladex.GetEntity(Name)
  413.  
  414.