home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 1.5)
-
- import Bladex
- import AuxFuncs
- import EnemyTypes
- import Sparks
- import Actions
- import math
- import Breakings
- import types
- import Reference
- import Blood
- import SolidMask
- import ObjStore
- import GameStateAux
- import os
- import Blood
- import ItemTypes
- ActualLevel = 'Noname'
-
- def Cafin(entity_name, camera_element, node):
- cam = Bladex.GetEntity('Camera')
- if node == 1:
- cam.SType = 0
- cam.ETarget = 'Player1'
- cam.TType = 2
- cam.CameraClearPath(0)
- cam.CameraClearPath(1)
-
-
-
- def BackPlayer():
- Cam = Bladex.GetEntity('Camera')
- Cam.SetPersonView('Player1')
-
-
- def ChangePointOfView(ox2, oy2, oz2, time, person = 'Player1'):
- cam = Bladex.GetEntity('Camera')
- ox1 = cam.Position[0]
- oy1 = cam.Position[1]
- oz1 = cam.Position[2]
- cam.AddCameraNode(0, time, ox1, oy1, oz1)
- cam.AddCameraNode(0, time / 2.0, ox2, oy2, oz2)
- cam.AddCameraNode(0, time / 2.0, (ox1 + ox2) / 2.0, (oy1 + oy2) / 2.0, (oz1 + oz2) / 2.0)
- cam.ETarget = person
- cam.TType = 2
- cam.SType = 1
- cam.CameraStartPath(0)
- cam.ChangeNodeFunc = Cafin
-
-
- def ChangeCam(ox2, oy2, oz2, tx2, ty2, tz2, time, CafinProx):
- cam = Bladex.GetEntity('Camera')
- ox1 = cam.Position[0]
- oy1 = cam.Position[1]
- oz1 = cam.Position[2]
- tx1 = cam.TPos[0]
- ty1 = cam.TPos[1]
- tz1 = cam.TPos[2]
- cam.AddCameraNode(0, time, ox1, oy1, oz1)
- cam.AddCameraNode(0, time / 2.0, ox2, oy2, oz2)
- cam.AddCameraNode(0, time / 2.0, (ox1 + ox2) / 2.0, (oy1 + oy2) / 2.0, (oz1 + oz2) / 2.0)
- cam.AddCameraNode(1, time, tx1, ty1, tz1)
- cam.AddCameraNode(1, time / 2.0, tx2, ty2, tz2)
- cam.AddCameraNode(1, time / 2.0, (tx1 + tx2) / 2.0, (ty1 + ty2) / 2.0, (tz1 + tz2) / 2.0)
- cam.ETarget = 'Player1'
- cam.SType = 1
- cam.TType = 1
- cam.CameraStartPath(0)
- cam.ChangeNodeFunc = CafinProx
-
-
- def InitGiroCamera():
- cam = Bladex.GetEntity('Camera')
- VecRot = (2 * cam.TPos[0] - cam.Position[0], 2 * cam.TPos[1] - cam.Position[1], 2 * cam.TPos[2] - cam.Position[2])
- cam.ESource = 'Player1'
- cam.SType = 2
- cam.TType = 0
- cam.TPos = VecRot
-
-
- def GiraCamara(AngleVariation):
- cam = Bladex.GetEntity('Camera')
- VecRot = (cam.TPos[0] - cam.Position[0], cam.TPos[1] - cam.Position[1], cam.TPos[2] - cam.Position[2])
- vtpos = (VecRot[0] * math.cos(AngleVariation) - VecRot[2] * math.sin(AngleVariation), VecRot[0], VecRot[0] * math.sin(AngleVariation) + VecRot[2] * math.cos(AngleVariation))
- cam.TPos = (vtpos[0] + cam.Position[0], cam.TPos[1], vtpos[2] + cam.Position[2])
-
- DeathState = 0
- DeathFile = None
-
- def DetieneArmaMuerto(obj_name):
- if DeathFile:
- o = Bladex.GetEntity(obj_name)
- o.OnStopFunc = None
- DeathFile.write("o = Bladex.CreateEntity('" + obj_name + "','" + o.Kind + "'," + str(o.Position[0]) + ',' + str(o.Position[1]) + ',' + str(o.Position[2]) + ",'Weapon')\n")
- DeathFile.write('o.Orientation = ' + str(o.Orientation[0]) + ',' + str(o.Orientation[1]) + ',' + str(o.Orientation[2]) + ',' + str(o.Orientation[3]) + '\n')
- DeathFile.write('ItemTypes.ItemDefaultFuncs(o)\n\n')
-
-
-
- def DetieneMutilacion(obj_name):
- if DeathFile:
- o = Bladex.GetEntity(obj_name)
- o.OnStopFunc = None
- DeathFile.write('\no = ' + o.Data[0] + '.SeverLimb(' + str(o.Data[1]) + ')\n')
- DeathFile.write('o.Stop()\n')
- DeathFile.write('o.Position = ' + str(o.Position[0]) + ',' + str(o.Position[1]) + ',' + str(o.Position[2]) + '\n')
- DeathFile.write('o.Orientation = ' + str(o.Orientation[0]) + ',' + str(o.Orientation[1]) + ',' + str(o.Orientation[2]) + ',' + str(o.Orientation[3]) + '\n')
-
-
-
- def GrabarLaSangre(x, y, z):
- if DeathFile:
- DeathFile.write("Bladex.CreateEntity('BloodPool','Entity Pool'," + str(x) + ',' + str(y) + ',' + str(z) + ')\n')
-
-
-
- def CloseDeathFile():
- global DeathFile
- if DeathFile:
- print "closing 'death.py'..."
- DeathFile.close()
- DeathFile = None
- os.rename('pak/deaths.py_', 'pak/deaths.py')
- Blood.AfterCreateBlood = None
-
-
-
- def MuertoyTroceado2(name, trozos):
- muertoint2 = Bladex.GetEntity(name)
- muertoint2.CastShadows = 0
- muertoint2.SetOnFloor()
- muertoint2.Life = 0
- for i in trozos:
- mut = muertoint2.SeverLimb(i)
-
-
- muertonum = 0
-
- def MuertoyTroceado(x, y, z, raze, weapon, trozos, angul = 2.19288423389, MeshName = None):
- global DeathState, DeathFile, muertonum
- if DeathState:
- return None
-
- if not DeathFile:
- if 'deaths.py' in os.listdir('./pak/'):
- execfile('pak/deaths.py')
- DeathState = 1
- return None
-
- print "Creating 'deaths.py'..."
- DeathFile = open('pak/deaths.py_', 'w')
- DeathFile.write('import Bladex\nimport ItemTypes \n\n')
- DeathFile.write("print 'loading deaths...'\n\n\n")
- Blood.AfterCreateBlood = GrabarLaSangre
-
- if weapon != '':
- armamuertoint2 = Bladex.CreateEntity(ActualLevel + 'WeapDeath' + `muertonum`, weapon, 0, 0, 0, 'Weapon')
- ItemTypes.ItemDefaultFuncs(armamuertoint2)
- armamuertoint2.OnStopFunc = DetieneArmaMuerto
-
- muertoint2 = Bladex.CreateEntity(ActualLevel + 'GuyInPieces' + `muertonum`, raze, x, y, z, 'Person')
- if MeshName:
- muertoint2.SetMesh(MeshName)
-
- muertoint2.Angle = angul
- if weapon != '':
- Actions.TakeObject(muertoint2.Name, armamuertoint2.Name)
- print 'The guy ', muertoint2.Name, ' got a gun named ', armamuertoint2.Name
- else:
- print 'The guy ', muertoint2.Name, 'is armless'
- EnemyTypes.EnemyDefaultFuncs(muertoint2)
- MuertoyTroceado2(muertoint2.Name, trozos)
- DeathFile.write(muertoint2.Name + ' = ' + "Bladex.CreateEntity('" + muertoint2.Name + "','" + muertoint2.Kind + "'," + str(muertoint2.Position[0]) + ',' + str(muertoint2.Position[1]) + ',' + str(muertoint2.Position[2]) + ",'Person'")
- if MeshName:
- DeathFile.write(",'" + MeshName + "')\n\n")
- else:
- DeathFile.write(')\n\n')
- DeathFile.write(muertoint2.Name + '.Angle = ' + str(angul) + '\n')
- DeathFile.write(muertoint2.Name + '.Life = 0\n\n')
- Bladex.AddScheduledFunc(Bladex.GetTime() + 60.0, CloseDeathFile, ())
- muertonum = muertonum + 1
-
-
- def Let_temblOff():
- cam = Bladex.GetEntity('Camera')
- cam.EarthQuakeFactor = 0
- cam.EarthQuake = 0
-
-
- def Temblores(time, pianoforte = 500):
- cam = Bladex.GetEntity('Camera')
- cam.EarthQuakeFactor = pianoforte
- cam.EarthQuake = 1
- Bladex.AddScheduledFunc(Bladex.GetTime() + time, Let_temblOff, ())
-
-
- def DetenLaCamaraDeLaConchaELaLora(Camera, frame):
- import Scorer
- cam = Bladex.GetEntity('Camera')
- cam.SetPersonView('Player1')
- cam.Cut()
- Bladex.ActivateInput()
- Scorer.SetVisible(1)
- Bladex.SetListenerPosition(1)
-
-
- def LaunchMaxCamera(CamName, Start, End, Funchi = DetenLaCamaraDeLaConchaELaLora):
- import Scorer
- cam = Bladex.GetEntity('Camera')
- cam.SetMaxCamera(CamName, Start, End)
- Scorer.SetVisible(0)
- Bladex.SetListenerPosition(2)
- Bladex.DeactivateInput()
- cam.AddCameraEvent(-1, Funchi)
-
-
- def HideObject(oname):
- pass
-
-
- def UnhideObject(oname):
- pass
-
-
- def HideBadGuy(name, ciego = 1, sordo = 1):
- pers = Bladex.GetEntity(name)
- if not pers:
- print 'WARNING : Trying to hide `' + name + '`but was deleted !'
- return None
-
- pers.Deaf = sordo
- pers.Blind = ciego
- pers.Freeze()
- pers.RemoveFromWorld()
- HideObject(pers.InvLeft)
- HideObject(pers.InvRight)
- HideObject(pers.InvRightBack)
- HideObject(pers.InvLeftBack)
- HideObject(pers.InvLeft2)
- char = Bladex.GetEntity('Player1')
- if char.ActiveEnemy == name:
- char.SetActiveEnemy('')
-
-
-
- def UnhideBadGuy(name):
- pers = Bladex.GetEntity(name)
- pers.Deaf = 0
- pers.Blind = 0
- pers.UnFreeze()
- pers.PutToWorld()
- UnhideObject(pers.InvLeft)
- UnhideObject(pers.InvRight)
- UnhideObject(pers.InvRightBack)
- UnhideObject(pers.InvLeftBack)
- UnhideObject(pers.InvLeft2)
-
-
- def OnUse(entity, onuse):
- import GameText
- GameText.WriteText(Bladex.GetEntity(entity).Data.MessageHint)
-
-
- class EmptyClass:
- pass
-
-
- def SetHint(gp, Name, OnUseData = '', Priority = 8.0, Distance = 4000.0):
- Reference.EntitiesSelectionData[gp.Name] = (Priority, Distance, Name)
- if type(OnUseData) == type(''):
- if OnUseData != '':
- gp.UseFunc = OnUse
- if not (gp.Data):
- gp.Data = EmptyClass()
-
- gp.Data.MessageHint = OnUseData
-
- else:
- gp.UseFunc = OnUseData
-
- QuakeFactor = 100
-
- def QuakeStep(personaje):
- cam = Bladex.GetEntity('Camera')
- cam.EarthQuakeFactor = QuakeFactor
- cam.EarthQuake = 1
- Bladex.AddScheduledFunc(Bladex.GetTime() + 0.125, QuakeHalf, ())
-
-
- def QuakeHalf():
- QuakeStepCounter = 1
- cam = Bladex.GetEntity('Camera')
- cam.EarthQuakeFactor = cam.EarthQuakeFactor / 2
- Bladex.AddScheduledFunc(Bladex.GetTime() + 0.125, QuakeStop, ())
-
-
- def QuakeStop():
- QuakeStepCounter = 2
- cam = Bladex.GetEntity('Camera')
- cam.EarthQuakeFactor = 0
- cam.EarthQuake = 0
-
- FIRE_DAMAGE = 1
-
- def QuemaTimer(e_name, time):
- char = Bladex.GetEntity(e_name)
- char.Life = char.Life - FIRE_DAMAGE
- if char.Life <= 0:
- Actions.FireDeath(e_name)
- char.RemoveFromList('Timer15')
- char.TimerFunc = ''
-
-
-
- def EntraQuema(triggername, entityname):
- if entityname == 'Player1':
- char = Bladex.GetEntity('Player1')
- char.SubscribeToList('Timer15')
- char.TimerFunc = QuemaTimer
-
-
-
- def SaleQuema(triggername, entityname):
- if entityname == 'Player1':
- char = Bladex.GetEntity('Player1')
- char.RemoveFromList('Timer15')
- char.TimerFunc = ''
-
-
-
- def FireOnGS(name):
- Bladex.SetTriggerSectorFunc(name, 'OnEnter', EntraQuema)
- Bladex.SetTriggerSectorFunc(name, 'OnLeave', SaleQuema)
-
-
- def FireOnS(sec):
- sec.OnEnter = EntraQuema
- sec.OnLeave = SaleQuema
-
-
- def EntraPincha(triggername, entityname):
- import Scorer
- ent = Bladex.GetEntity(entityname)
- if ent.Person:
- if entityname == 'Player1':
- Bladex.GetEntity('Camera').TType = 0
- AuxFuncs.FadeTo(1.0, 60.0, 32, 0, 0)
- Scorer.SetVisible(0)
-
- Bladex.AddScheduledFunc(Bladex.GetTime() + 0.5, MuereDeVerdadPincha, (ent,))
- p = ent.Position
-
-
-
- def MuereDeVerdadPincha(ent):
- ent.Life = 0
- ent.Wuea = Reference.WUEA_ENDED
- ent.SetTmpAnmFlags(1, 1, 1, 0, 5, 1, 0)
- ent.LaunchAnmType('dth_rock')
-
-
- def NailOnGS(name):
- Bladex.SetTriggerSectorFunc(name, 'OnEnter', EntraPincha)
-
-
- def NailOnS(sec):
- sec.OnEnter = EntraPincha
-
-
- class E_Grup:
- ObjId = 0
- n = 0
- OnDeath = None
- Guys = []
- ImDeadFuncs = { }
-
- def __init__(self):
- self.ObjId = ObjStore.GetNewId()
- self.n = 0
- self.OnDeath = None
- self.Guys = []
- self.ImDeadFuncs = { }
- ObjStore.ObjectsStore[self.ObjId] = self
-
-
- def __del__(self):
- del ObjStore.ObjectsStore[self.ObjId]
-
-
- def persistent_id(self):
- return self.ObjId
-
-
- def ImDeadFunc(self, Name):
- self.ImDeadFuncs[Name](Name)
- self.n = self.n - 1
- print 'Quedan', self.n
- self.Guys.remove(Name)
- if self.n == 0:
- if self.OnDeath:
- self.OnDeath()
-
-
-
-
- def AddGuy(self, Name):
- e = Bladex.GetEntity(Name)
- self.ImDeadFuncs[Name] = e.ImDeadFunc
- e.ImDeadFunc = self.ImDeadFunc
- self.n = self.n + 1
- if Name in self.Guys:
- print 'E_Grup error : ' + Name + ' is allready here.'
- else:
- self.Guys.append(Name)
-
-
- def HideBadGuys(self):
- for Name in self.Guys:
- HideBadGuy(Name)
-
-
-
- def UnhideBadGuys(self, number):
- counter = 0
- for Name in self.Guys:
- counter = counter + 1
- UnhideBadGuy(Name)
-
- return counter
-
-
- def __getstate__(self):
- return (1, self.ObjId, self.n, GameStateAux.SaveFunctionAux(self.OnDeath), self.Guys, self.ImDeadFuncs)
-
-
- def __setstate__(self, parm):
- if parm[0] == 1:
- self.ObjId = parm[1]
- ObjStore.ObjectsStore[self.ObjId] = self
- self.n = parm[2]
- GameStateAux.LoadFunctionAux(parm[3], self, 'OnDeath')
- self.Guys = parm[4]
- self.ImDeadFuncs = parm[5]
- else:
- print 'Door.__setstate__() -> Version mismatch'
- self.ObjId = ObjStore.GetNewId()
- ObjStore.ObjectsStore[self.ObjId] = self
-
-
- PersonasEnLlamas = []
-
- def EnciendeEnLlamas(o, Intensity = 15, Precission = 0.1):
- if not (o.Kind in PersonasEnLlamas):
- PersonasEnLlamas.append(o.Kind)
- Bladex.AddCombustionDataFor(o.Kind, 'Fire', 250, 400, 4, 1, 3, 144000)
-
- o.SelfIlum = 0.0
- o.CatchOnFire(0, 0, 0)
- luz = Bladex.CreateEntity(o.Name + 'Luz', 'Entity Spot', 0, 0, 0)
- luz.Color = (200, 100, 0)
- luz.Intensity = Intensity
- luz.Precission = Precission
- luz.CastShadows = 0
- luz.Visible = 1
- luz.SizeFactor = 0
- o.Link(luz)
-
-
- def ObjAlpha(o, alpha = 0.8, SelfIlum = 0.0):
- o.Alpha = alpha
- o.RasterMode = 'AdditiveAlpha'
- o.RasterMode = 'Read'
- o.CastShadows = 0
- o.SelfIlum = SelfIlum
-
-
- def ValidAppear(pos, func = None, param = None):
- entid = Bladex.GetEntitiesAt(pos[0], pos[1], pos[2], 4000)
- for on in entid:
- o = Bladex.GetEntity(on)
- if o.Person:
- if o.Life > 0:
- if o.Alpha > 0.01:
- print 'Trying to do it, but', on, 'is bothering. Next try in 5 seconds.'
- if func:
- Bladex.AddScheduledFunc(Bladex.GetTime() + 5.0, ValidAppear, (pos, func, param))
-
- return 0
-
-
-
-
- if func:
- apply(func, param)
- print 'The function was XQted'
- else:
- return 1
-
-
- def CreateFalseCube(pos, timeToKill = -1, Name = ''):
- o = Bladex.CreateEntity(Name + 'quad', 'Bloque', pos[0], pos[1] - 1500, pos[2])
- o.Orientation = (0.707107245922, 0.0, 0.0, 0.707106292248)
- o.Scale = 4
- o.CastShadows = 0
- o.Alpha = 0.0
- o.RasterMode = 'Read'
- if timeToKill != -1:
- Bladex.AddScheduledFunc(Bladex.GetTime() + timeToKill, o.SubscribeToList, ('Pin',))
-
- return o
-
-
- def CleanArea(x, y, z, radius):
- list = Bladex.GetEntitiesAt(x, y, z, radius)
- enCounter = 0
- for name in list:
- o = Bladex.GetEntity(name)
-
- return enCounter
-
-
- def EnterSecEvent(x, y, z, func):
- sec = Bladex.GetSector(x, y, z)
- EnterSecEventSector(sec, func)
-
-
- def GetSectorIdx(pos):
- if type(pos) != types.TupleType:
- return pos
- else:
- return Bladex.GetSector(pos[0], pos[1], pos[2]).Index
-
-
- def EnterSecIdEvent(id, func):
- if type(id) == types.StringType:
- EnterTSEvent(id, func)
- return id
- elif type(id) == types.TupleType:
- sec = Bladex.GetSector(id[0], id[1], id[2])
- EnterSecEventSector(sec, func)
- return sec.Index
- else:
- sec = Bladex.GetSector(id)
- EnterSecEventSector(sec, func)
- return id
-
-
- def EnterSecEventSector(sec, func):
- if sec:
- if not SectorTable.has_key(sec.Index):
- if sec.OnEnter:
- print 'ERROR : OnEnter Asigned to', sec.OnEnter
- else:
- SectorTable[sec.Index] = []
- else:
- numerox = len(SectorTable[sec.Index])
- if numerox > 0:
- if Reference.PYTHON_DEBUG >= 2:
- print 'Warning : OnEnter have', numerox, 'functions'
-
-
- SectorTable[sec.Index].insert(0, func)
- sec.OnEnter = OnPlayerEnter
- return sec.Index
- else:
- print 'ERROR : Sector invalid!'
-
-
- def OnPlayerEnter(sectorindex, entityname):
- pass
-
- SectorTable = { }
-
- def EnterTSEvent(secname, func):
- if secname:
- if not SectorTable.has_key(secname):
- if Bladex.GetTriggerSectorFunc(secname, 'OnEnter'):
- print 'ERROR : OnEnter Asigned to ', secname
- else:
- SectorTable[secname] = []
- else:
- numerox = len(SectorTable[secname])
- if numerox > 0:
- if Reference.PYTHON_DEBUG >= 2:
- print 'Warning : OnEnter have', numerox, 'functions'
-
-
- SectorTable[secname].insert(0, func)
- Bladex.SetTriggerSectorFunc(secname, 'OnEnter', OnPlayerEnter)
- return secname
- else:
- print "ERROR : Sector '" + secname + "' invalid!"
-
-
- def LuzChapuzera(light, FinishTime, delta = 1):
- t = Bladex.GetTime()
- light.Move(0, 0, delta)
- if t < FinishTime:
- Bladex.AddScheduledFunc(t + 0.0, LuzChapuzera, (light, FinishTime, -delta))
-
-
-
- def SaveData(filename):
- import cPickle
- funcfile = open(filename, 'wt')
- p = cPickle.Pickler(funcfile)
- d = (muertonum, ActualLevel, QuakeFactor, FIRE_DAMAGE, PersonasEnLlamas, SectorTable)
- p.dump(d)
- funcfile.close()
-
-
- def LoadData(filename):
- global muertonum, ActualLevel, QuakeFactor, FIRE_DAMAGE, PersonasEnLlamas, SectorTable
- import cPickle
- funcfile = open(filename, 'rt')
- p = cPickle.Unpickler(funcfile)
- d = p.load()
- funcfile.close()
- print d
- muertonum = d[0]
- ActualLevel = d[1]
- QuakeFactor = d[2]
- FIRE_DAMAGE = d[3]
- PersonasEnLlamas = d[4]
- SectorTable = d[5]
-
- import GameState
- GameState.ModulesToBeSaved.append(__import__(__name__))
-