コード例 #1
0
ファイル: loader.py プロジェクト: cmajames/py_touhou
 def get_stage(self, name):
     file = self.get_file(name)
     return Stage.read(file)  #TODO: modular
コード例 #2
0
ファイル: make_stage.py プロジェクト: cmajames/py_touhou
    (2, 192 * 2 - 30 - 40.0 - 50.0, -46 * 3 * 8 - 20, -50.0)
]

# Bounding boxes
anm = ANM0.read(open('stg1bg.anm', 'rb'))[0]
for model in models:
    vertices = []
    for script_index, ox2, oy2, oz2, width_override, height_override in model.quads:
        sprite = Sprite(width_override, height_override)
        anmrunner = ANMRunner(anm, script_index, sprite)
        vertices2 = get_sprite_vertices(sprite)
        vertices.extend((x + ox2, y + oy2, z + oz2) for x, y, z in vertices2)
    xmin, ymin, zmin = min(x for x, y, z in vertices), min(
        y for x, y, z in vertices), min(z for x, y, z in vertices)
    xmax, ymax, zmax = max(x for x, y, z in vertices), max(
        y for x, y, z in vertices), max(z for x, y, z in vertices)
    model.bounding_box = (xmin, ymin, zmin, xmax - xmin, ymax - ymin,
                          zmax - zmin)

stage = Stage()
stage.name = 'Test by ThibG'
stage.bgms = ('', 'bgm/th06_15.mid'), ('', ''), ('', ''), ('', '')
stage.models = models
stage.object_instances = instances
stage.script = [(0, 1, (50, 0, 50, 300.0, 800.0)), (0, 2, (0.0, 400.0, 0.3)),
                (0, 0, (0.0, 0.0, 0.0)), (2100, 0, (0.0, -800.0, 0.0)),
                (3200, 0, (0.0, 0.0, 0.0)), (6500, 0, (0.0, 0.0, 0.0))]

with open('stage1.std', 'wb') as file:
    stage.write(file)
コード例 #3
0
ファイル: loader.py プロジェクト: GovanifY/PyTouhou
 def get_stage(self, name):
     file = self.get_file(name)
     return Stage.read(file) #TODO: modular
コード例 #4
0
ファイル: make_stage.py プロジェクト: GovanifY/PyTouhou
# Bounding boxes
anm = ANM0.read(open('stg1bg.anm', 'rb'))[0]
for model in models:
    vertices = []
    for script_index, ox2, oy2, oz2, width_override, height_override in model.quads:
        sprite = Sprite(width_override, height_override)
        anmrunner = ANMRunner(anm, script_index, sprite)
        vertices2 = get_sprite_vertices(sprite)
        vertices.extend((x + ox2, y + oy2, z + oz2) for x, y, z in vertices2)
    xmin, ymin, zmin = min(x for x, y, z in vertices), min(y for x, y, z in vertices), min(z for x, y, z in vertices)
    xmax, ymax, zmax = max(x for x, y, z in vertices), max(y for x, y, z in vertices), max(z for x, y, z in vertices)
    model.bounding_box = (xmin, ymin, zmin, xmax - xmin, ymax - ymin, zmax - zmin)


stage = Stage()
stage.name = 'Test by ThibG'
stage.bgms = ('', 'bgm/th06_15.mid'), ('', ''), ('', ''), ('', '')
stage.models = models
stage.object_instances = instances
stage.script = [(0, 1, (50, 0, 50, 300.0, 800.0)),
                (0, 2, (0.0, 400.0, 0.3)),
                (0, 0, (0.0, 0.0, 0.0)),
                (2100, 0, (0.0, -800.0, 0.0)),
                (3200, 0, (0.0, 0.0, 0.0)),
                (6500, 0, (0.0, 0.0, 0.0))]

with open('stage1.std', 'wb') as file:
    stage.write(file)