home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 1.5)
-
- import Bladex
- import copy_reg
- import types
- GlobalModulesCache = None
- GlobalFunctionsCache = None
- GlobalCFunctionsCache = None
-
- def GetGlobalsAux():
- import sys
-
- try:
- 1 + ''
- except:
- frame = sys.exc_info()[2].tb_frame.f_back
-
- while frame:
- globs = frame.f_globals
- frame = frame.f_back
- return globs
-
-
- def GetGlobalsAux2(req_type):
- g = GetGlobalsAux()
- elems = []
- for i in g.items():
- pass
-
- return elems
-
-
- def ConstSound(sound_name, sound_file, volume, base_volume, min_distance, max_distance, scale, send_notify):
- s = Bladex.CreateSound(sound_file, sound_name)
- if not s:
- return None
-
- s.Volume = volume
- s.BaseVolume = base_volume
- s.MinDistance = min_distance
- s.MaxDistance = max_distance
- s.Scale = scale
- s.SendNotify = send_notify
- return s
-
-
- def RedSound(s):
- return (ConstSound, (s.Name, '', s.Volume, s.BaseVolume, s.MinDistance, s.MaxDistance, s.Scale, s.SendNotify))
-
-
- def RegisterPickSound():
- gmadlig = Bladex.CreateSound('../../sounds/golpe-madera-mediana.wav', 'GolpeMaderaMediana')
- copy_reg.pickle(type(gmadlig), RedSound, ConstSound)
-
-
- def ConstEntity(ent_name):
- e = Bladex.GetEntity(ent_name)
- return e
-
-
- def RedEntity(e):
- if e:
-
- try:
- return (ConstEntity, (e.Name,))
- except:
- print 'PickInit.RedEntity() can not get entity name'
- return (ConstEntity, ('Invalid Entity',))
-
-
- return (ConstEntity, ('Invalid Entity',))
-
-
- def RegisterPickEntity():
- gmadlig = Bladex.GetEntity(0)
- copy_reg.pickle(type(gmadlig), RedEntity, ConstEntity)
-
-
- def FindFunctionAux(module, fun_name):
- if module.__dict__.has_key(fun_name):
- return module.__dict__[fun_name]
-
- return None
-
-
- def ConstFunction(fun_name, lib_name):
- funcs = GetGlobalsAux2(types.FunctionType)
- for i in funcs:
- pass
-
- global_mods = GetGlobalsAux2(types.ModuleType)
- for i in global_mods:
- pass
-
- for i in global_mods:
- func = FindFunctionAux(i[1], fun_name)
-
- print "Warning, can't find global function", fun_name, lib_name
- return None
-
-
- def RedFunction(f):
- import GameStateAux
- s = GameStateAux.GetFunctionFile(f)
- return (ConstFunction, (f.func_name, s))
-
-
- def RegisterPickFunction():
- import types
- copy_reg.pickle(types.FunctionType, RedFunction, ConstFunction)
-
-
- def ConstMethod(obj_id, method_name):
- import types
- import ObjStore
-
- try:
- obj = ObjStore.ObjectsStore[obj_id]
- assign_func = eval('obj.' + method_name)
- return assign_func
- except Exception:
- exc = None
- print 'PickInit.ConstMethod() can not find method', obj_id, method_name
- print 'Exception', exc
- return None
-
-
-
- def RedMethod(f):
-
- try:
- return (ConstMethod, (f.im_class.persistent_id(f.im_self), f.im_func.func_name))
- except:
- print 'PickInit.RedMethod() can not register method', f
- return (ConstMethod, (None, None))
-
-
-
- def RegisterPickMethod():
- import types
- copy_reg.pickle(types.MethodType, RedMethod, ConstMethod)
-
-
- def ConstCFunction(fun_name):
- print 'ConstCFunction', fun_name
- funcs = GetGlobalsAux2(types.BuiltinFunctionType)
- for i in funcs:
- pass
-
- import Bladex
- import Traps_C
- import B3DLib
- mods = (Bladex, B3DLib, Traps_C)
- for i in mods:
- func = FindFunctionAux(i, fun_name)
-
- global_mods = GetGlobalsAux2(types.ModuleType)
- for i in global_mods:
- pass
-
- print "Warning, can't find global function", fun_name
- return None
-
-
- def RedCFunction(f):
- return (ConstCFunction, (f.__name__,))
-
-
- def RegisterPickCFunction():
- import types
- copy_reg.pickle(types.BuiltinFunctionType, RedCFunction, ConstCFunction)
-
-
- def ConstSector(sec_idx):
- e = Bladex.GetSector(sec_idx)
- return e
-
-
- def RedSector(s):
- return (ConstSector, (s.Index,))
-
-
- def RegisterPickSector():
- gmadlig = Bladex.GetSector(0)
- if not gmadlig:
- print 'ERROR in RegisterPickSector()'
- return None
-
- copy_reg.pickle(type(gmadlig), RedSector, ConstSector)
-
-
- def ClearCaches():
- global GlobalModulesCache, GlobalFunctionsCache, GlobalCFunctionsCache
- GlobalModulesCache = None
- GlobalFunctionsCache = None
- GlobalCFunctionsCache = None
-
-
- def Init():
- ClearCaches()
- RegisterPickSound()
- RegisterPickEntity()
- RegisterPickFunction()
- RegisterPickSector()
- RegisterPickMethod()
- RegisterPickCFunction()
- print 'Executed PickInit.Init()'
-
-