Mercurial > touhou
annotate data/ST/make_stage.py @ 667:904849807fd8
Implement update_mode 1 on enemy.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Mon, 12 Aug 2019 15:09:34 +0200 |
parents | 016f6b937893 |
children |
rev | line source |
---|---|
115 | 1 from pytouhou.formats.std import Stage, Model |
601
016f6b937893
Make sample data build again.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
121
diff
changeset
|
2 from pytouhou.formats.anm0 import ANM0 |
115 | 3 from pytouhou.vm.anmrunner import ANMRunner |
4 from pytouhou.game.sprite import Sprite | |
601
016f6b937893
Make sample data build again.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
121
diff
changeset
|
5 from pytouhou.ui.opengl.sprite import get_sprite_vertices |
115 | 6 |
7 ground = Model(quads=[(14, -100.0, -46*3, 0.5, (192+100)*2, 46*3), | |
8 (0, 192.0 - 40, -46.0, 0.0, 0, 0), | |
9 (0, 192.0 - 40, -46.0*2, 0.0, 0, 0), | |
10 (0, 192.0 - 40, -46.0*3, 0.0, 0, 0), | |
11 (11, -100.0, -46*3, 0.0, 220, 46*3), | |
12 (11, 192*2+100.0-220, -46*3, 0.0, 220, 46*3), | |
13 (12, 120.0, -46*3, -0.1, 0, 46*3), | |
14 (13, 192*2-120-14, -46*3, -0.1, 0, 46*3)]) | |
15 | |
16 tree = Model(quads=[(9, 0.0, 0.0, 0.0, 0, 0)]) | |
17 tree2 = Model(quads=[(10, 0.0, 0.0, 0.0, 0, 0)]) | |
18 | |
19 models = [ground, tree, tree2] | |
20 | |
21 | |
22 instances = [(0, 0.0, -46*3*-1, 0.0), | |
23 (0, 0.0, -46*3*0, 0.0), | |
24 (0, 0.0, -46*3*1, 0.0), | |
25 (0, 0.0, -46*3*2, 0.0), | |
26 (0, 0.0, -46*3*3, 0.0), | |
27 (0, 0.0, -46*3*4, 0.0), | |
28 (0, 0.0, -46*3*5, 0.0), | |
29 (0, 0.0, -46*3*6, 0.0), | |
30 (0, 0.0, -46*3*7, 0.0), | |
31 (0, 0.0, -46*3*8, 0.0), | |
121
1bc0ad774ed4
More impressive data, use a wider range of things, and document things!
Thibaut Girka <thib@sitedethib.com>
parents:
120
diff
changeset
|
32 (0, 0.0, -46*3*9, 0.0), |
1bc0ad774ed4
More impressive data, use a wider range of things, and document things!
Thibaut Girka <thib@sitedethib.com>
parents:
120
diff
changeset
|
33 (0, 0.0, -46*3*10, 0.0), |
115 | 34 #Trees |
35 (1, 40.0, -46*3*1, -50.0), | |
36 (1, 40.0, -46*3*2, -50.0), | |
37 (1, 40.0, -46*3*3, -50.0), | |
38 (1, 40.0, -46*3*4, -50.0), | |
39 (1, 40.0, -46*3*5, -50.0), | |
40 (1, 40.0, -46*3*6, -50.0), | |
121
1bc0ad774ed4
More impressive data, use a wider range of things, and document things!
Thibaut Girka <thib@sitedethib.com>
parents:
120
diff
changeset
|
41 (1, 40.0, -46*3*7, -50.0), |
1bc0ad774ed4
More impressive data, use a wider range of things, and document things!
Thibaut Girka <thib@sitedethib.com>
parents:
120
diff
changeset
|
42 (1, 40.0, -46*3*8, -50.0), |
115 | 43 |
44 (1, 40.0+40, -46*3*1-20, -50.0), | |
45 (1, 40.0+40, -46*3*2-20, -50.0), | |
46 (1, 40.0+40, -46*3*3-20, -50.0), | |
47 (1, 40.0+40, -46*3*4-20, -50.0), | |
48 (1, 40.0+40, -46*3*5-20, -50.0), | |
49 (1, 40.0+40, -46*3*6-20, -50.0), | |
121
1bc0ad774ed4
More impressive data, use a wider range of things, and document things!
Thibaut Girka <thib@sitedethib.com>
parents:
120
diff
changeset
|
50 (1, 40.0+40, -46*3*7-20, -50.0), |
1bc0ad774ed4
More impressive data, use a wider range of things, and document things!
Thibaut Girka <thib@sitedethib.com>
parents:
120
diff
changeset
|
51 (1, 40.0+40, -46*3*8-20, -50.0), |
115 | 52 |
53 (2, 192*2-30-40.0, -46*3*1, -50.0), | |
54 (2, 192*2-30-40.0, -46*3*2, -50.0), | |
55 (2, 192*2-30-40.0, -46*3*3, -50.0), | |
56 (2, 192*2-30-40.0, -46*3*4, -50.0), | |
57 (2, 192*2-30-40.0, -46*3*5, -50.0), | |
58 (2, 192*2-30-40.0, -46*3*6, -50.0), | |
121
1bc0ad774ed4
More impressive data, use a wider range of things, and document things!
Thibaut Girka <thib@sitedethib.com>
parents:
120
diff
changeset
|
59 (2, 192*2-30-40.0, -46*3*7, -50.0), |
1bc0ad774ed4
More impressive data, use a wider range of things, and document things!
Thibaut Girka <thib@sitedethib.com>
parents:
120
diff
changeset
|
60 (2, 192*2-30-40.0, -46*3*8, -50.0), |
115 | 61 |
62 (2, 192*2-30-40.0-50.0, -46*3*1-20, -50.0), | |
63 (2, 192*2-30-40.0-50.0, -46*3*2-20, -50.0), | |
64 (2, 192*2-30-40.0-50.0, -46*3*3-20, -50.0), | |
65 (2, 192*2-30-40.0-50.0, -46*3*4-20, -50.0), | |
66 (2, 192*2-30-40.0-50.0, -46*3*5-20, -50.0), | |
121
1bc0ad774ed4
More impressive data, use a wider range of things, and document things!
Thibaut Girka <thib@sitedethib.com>
parents:
120
diff
changeset
|
67 (2, 192*2-30-40.0-50.0, -46*3*6-20, -50.0), |
1bc0ad774ed4
More impressive data, use a wider range of things, and document things!
Thibaut Girka <thib@sitedethib.com>
parents:
120
diff
changeset
|
68 (2, 192*2-30-40.0-50.0, -46*3*7-20, -50.0), |
1bc0ad774ed4
More impressive data, use a wider range of things, and document things!
Thibaut Girka <thib@sitedethib.com>
parents:
120
diff
changeset
|
69 (2, 192*2-30-40.0-50.0, -46*3*8-20, -50.0)] |
115 | 70 |
71 | |
72 # Bounding boxes | |
601
016f6b937893
Make sample data build again.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
121
diff
changeset
|
73 anm = ANM0.read(open('stg1bg.anm', 'rb'))[0] |
115 | 74 for model in models: |
75 vertices = [] | |
76 for script_index, ox2, oy2, oz2, width_override, height_override in model.quads: | |
120
4300a832f033
Small refactoring and massive performance improvement
Thibaut Girka <thib@sitedethib.com>
parents:
117
diff
changeset
|
77 sprite = Sprite(width_override, height_override) |
601
016f6b937893
Make sample data build again.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
121
diff
changeset
|
78 anmrunner = ANMRunner(anm, script_index, sprite) |
016f6b937893
Make sample data build again.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
121
diff
changeset
|
79 vertices2 = get_sprite_vertices(sprite) |
115 | 80 vertices.extend((x + ox2, y + oy2, z + oz2) for x, y, z in vertices2) |
81 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) | |
82 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) | |
83 model.bounding_box = (xmin, ymin, zmin, xmax - xmin, ymax - ymin, zmax - zmin) | |
84 | |
85 | |
86 stage = Stage() | |
87 stage.name = 'Test by ThibG' | |
117
1ec8be40880f
[Data] Fix a crash with 102h.exe (missing music), and fix bullet sizes
Thibaut Girka <thib@sitedethib.com>
parents:
115
diff
changeset
|
88 stage.bgms = ('', 'bgm/th06_15.mid'), ('', ''), ('', ''), ('', '') |
115 | 89 stage.models = models |
90 stage.object_instances = instances | |
91 stage.script = [(0, 1, (50, 0, 50, 300.0, 800.0)), | |
92 (0, 2, (0.0, 400.0, 0.3)), | |
93 (0, 0, (0.0, 0.0, 0.0)), | |
121
1bc0ad774ed4
More impressive data, use a wider range of things, and document things!
Thibaut Girka <thib@sitedethib.com>
parents:
120
diff
changeset
|
94 (2100, 0, (0.0, -800.0, 0.0)), |
1bc0ad774ed4
More impressive data, use a wider range of things, and document things!
Thibaut Girka <thib@sitedethib.com>
parents:
120
diff
changeset
|
95 (3200, 0, (0.0, 0.0, 0.0)), |
1bc0ad774ed4
More impressive data, use a wider range of things, and document things!
Thibaut Girka <thib@sitedethib.com>
parents:
120
diff
changeset
|
96 (6500, 0, (0.0, 0.0, 0.0))] |
115 | 97 |
98 with open('stage1.std', 'wb') as file: | |
99 stage.write(file) | |
100 |