# HG changeset patch # User Thibaut Girka # Date 1315348814 -7200 # Node ID f0e6ae22d29aaba62a196e733e028b71a0f9b705 # Parent 92772413b5a6e5521c95d8afac0908c71b69342d Add sample data diff --git a/data/ST/Makefile b/data/ST/Makefile new file mode 100644 --- /dev/null +++ b/data/ST/Makefile @@ -0,0 +1,58 @@ +all: stg1bg.png stg1bg.anm stage1.std face03a.anm face03b.anm face42.png eff01.png eff01.anm stg1enm2.anm ecldata1.ecl stg1enm.png stg1enm.anm stg1enm2.anm msg1.dat + +face42.png: face.svg + inkscape -e face42.png face.svg + + +stg1bg.png: stg1bg.svg + inkscape -e stg1bg.png stg1bg.svg + + +stg1enm.png: stg1enm.svg + inkscape -e stg1enm.png stg1enm.svg + + +eff01.png: eff01.svg + inkscape -e eff01.png eff01.svg + + +stg1bg.anm: stg1bg.script + thanm c stg1bg.anm stg1bg.script + + +stg1enm.anm: stg1enm.script + thanm c stg1enm.anm stg1enm.script + + +face03a.anm: face03a.script + thanm c face03a.anm face03a.script + + +face03b.anm: face03a.script + thanm c face03b.anm face03a.script + + +eff01.anm: eff01.script + thanm c eff01.anm eff01.script + + +stg1enm2.anm: stg1enm2.script + thanm c stg1enm2.anm stg1enm2.script + + +ecldata1.ecl: make_ecl.py + PYTHONPATH=../../ python make_ecl.py + + +stage1.std: make_stage.py + PYTHONPATH=../../ python make_stage.py + + +msg1.dat: msg1.script + thmsg c6 msg1.script msg1.dat + + +clean: + rm -f stg1bg.png stg1bg.anm stage1.std face03a.anm face03b.anm face42.png eff01.png eff01.anm stg1enm2.anm ecldata1.ecl stg1enm.png stg1enm.anm stg1enm2.anm msg1.dat + +.PHONY: all clean diff --git a/data/ST/eff01.script b/data/ST/eff01.script new file mode 100644 --- /dev/null +++ b/data/ST/eff01.script @@ -0,0 +1,12 @@ +ENTRY 0 +Name: data/eff00/eff01.png +Format: 1 +Width: 256 +Height: 256 + +Sprite: 0 384*448+0+0 + +Script: 0 +Instruction: 0 0 1 0 +Instruction: 0 0 15 + diff --git a/data/ST/eff01.svg b/data/ST/eff01.svg new file mode 100644 --- /dev/null +++ b/data/ST/eff01.svg @@ -0,0 +1,64 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/data/ST/face.svg b/data/ST/face.svg new file mode 100644 --- /dev/null +++ b/data/ST/face.svg @@ -0,0 +1,134 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/ST/face03a.script b/data/ST/face03a.script new file mode 100644 --- /dev/null +++ b/data/ST/face03a.script @@ -0,0 +1,11 @@ +ENTRY 0 +Name: data/face/face42.png +#Name2: data/face/face03b_a.png +Format: 1 +Width: 256 +Height: 256 + +Sprite: 0 128*256+0+0 +Sprite: 1 128*256+128+0 + + diff --git a/data/ST/make_ecl.py b/data/ST/make_ecl.py new file mode 100644 --- /dev/null +++ b/data/ST/make_ecl.py @@ -0,0 +1,70 @@ +from pytouhou.formats.ecl import ECL +from math import pi + +# Frame, sub, opcode, args +main = [(120, 0, 0, (-30.0, 80.0, 0.0, 16, 0, 0, 0)), + (140, 0, 0, (-30.0, 130.0, 0.0, 16, 0, 0, 0)), + + (160, 0, 2, (192*2+30.0, 80.0, 0.0, 16, 0, 0, 0)), + (180, 0, 2, (192*2+30.0, 130.0, 0.0, 16, 0, 0, 0)), + + (220, 0, 0, (-30.0, 80.0, 0.0, 16, 0, 0, 0)), + (220, 0, 0, (-30.0, 130.0, 0.0, 16, 0, 0, 0)), + + (260, 0, 2, (192*2+30.0, 80.0, 0.0, 16, 0, 0, 0)), + (260, 0, 2, (192*2+30.0, 130.0, 0.0, 16, 0, 0, 0)), + + (560, 2, 0, (0, -10, 0.0, 120, 0, 0, 0)), + (780, 2, 0, (0, -10, 0.0, 120, 0, 0, 0)), + (900, 2, 0, (0, -10, 0.0, 120, 0, 0, 0)), + + (1500, 3, 0, (192, -10, 0.0, 300, 0, 0, 0))] + + +subs = [ + # Frame, opcode, rank_mask, param_mask, args + [(0, 97, 0xff00, 256, (0,)), + (0, 108, 0xff00, 256, (1,)), + (0, 107, 0xff00, 256, (1,)), + (0, 45, 0xff00, 256, (-0.3, 0.8)), + (0, 48, 0xff00, 256, (0.01,)), + (0, 46, 0xff00, 256, (0.001,)), + (0, 5, 0xff00, 256, (-10005, pi-0.3)), + (0, 68, 0xff00, 256, (2, 6, 1, 1, 2.0, 0.0, -10005.0, 0.0, 1)), + (2, 21, 0xff00, 256, (-10005, -10005, 0.2)), + (2, 2, 0xff00, 256, (0, 7))], + + [(0, 75, 0xff00, 256, (1, 2, 10, 10, 2.0, 4.0, -pi, pi, 0)), + (5, 1, 0xff00, 256, (0,))], + + [(0, 97, 0xff00, 256, (3,)), + (0, 4, 0xff00, 256, (-10001, 15)), + (0, 57, 0xff00, 256, (60, 192.0, 80.0, 0.0)), + (0, 78, 0xff00, 256, ()), + (0, 67, 0xff00, 256, (2, 6, 1, 4, 2.0, 4.0, 0.0, 0.0, 1)), + (0, 79, 0xff00, 256, ()), + (0, 77, 0xff00, 256, (20,)), + (60, 65, 0xff00, 256, (20, 20, 192*2-20, 120)), + (60, 47, 0xff00, 256, (8.0,)), + + (60, 50, 0xff00, 256, (-pi, pi)), + + (80, 3, 0xff00, 256, (60, 9, -10001)), + + (80, 66, 0xff00, 256, ()), + (80, 76, 0xff00, 256, (0,)), + (80, 51, 0xff00, 256, (0, 8.0))], + + [(0, 97, 0xff00, 256, (0,)), + (0, 57, 0xff00, 256, (60, 192.0, 80.0, 0.0)), + (60, 82, 0xff00, 256, (40, 15, -1, -1, 0.0, 6.0, -1, -1)), + (60, 75, 0xff00, 256, (1, 3, 20, 1, 3.0, 6.0, -pi, pi, 1| 128)), + (60, 76, 0xff00, 256, (110,))] +] + +ecl = ECL() +ecl.subs = subs +ecl.main = main + +with open('ecldata1.ecl', 'wb') as file: + ecl.write(file) diff --git a/data/ST/make_stage.py b/data/ST/make_stage.py new file mode 100644 --- /dev/null +++ b/data/ST/make_stage.py @@ -0,0 +1,91 @@ +from pytouhou.formats.std import Stage, Model +from pytouhou.formats.anm0 import Animations +from pytouhou.vm.anmrunner import ANMRunner +from pytouhou.game.sprite import Sprite +from pytouhou.resource.anmwrapper import AnmWrapper +from pytouhou.opengl.sprite import get_sprite_rendering_data + +ground = Model(quads=[(14, -100.0, -46*3, 0.5, (192+100)*2, 46*3), + (0, 192.0 - 40, -46.0, 0.0, 0, 0), + (0, 192.0 - 40, -46.0*2, 0.0, 0, 0), + (0, 192.0 - 40, -46.0*3, 0.0, 0, 0), + (11, -100.0, -46*3, 0.0, 220, 46*3), + (11, 192*2+100.0-220, -46*3, 0.0, 220, 46*3), + (12, 120.0, -46*3, -0.1, 0, 46*3), + (13, 192*2-120-14, -46*3, -0.1, 0, 46*3)]) + +tree = Model(quads=[(9, 0.0, 0.0, 0.0, 0, 0)]) +tree2 = Model(quads=[(10, 0.0, 0.0, 0.0, 0, 0)]) + +models = [ground, tree, tree2] + + +instances = [(0, 0.0, -46*3*-1, 0.0), + (0, 0.0, -46*3*0, 0.0), + (0, 0.0, -46*3*1, 0.0), + (0, 0.0, -46*3*2, 0.0), + (0, 0.0, -46*3*3, 0.0), + (0, 0.0, -46*3*4, 0.0), + (0, 0.0, -46*3*5, 0.0), + (0, 0.0, -46*3*6, 0.0), + (0, 0.0, -46*3*7, 0.0), + (0, 0.0, -46*3*8, 0.0), + #Trees + (1, 40.0, -46*3*1, -50.0), + (1, 40.0, -46*3*2, -50.0), + (1, 40.0, -46*3*3, -50.0), + (1, 40.0, -46*3*4, -50.0), + (1, 40.0, -46*3*5, -50.0), + (1, 40.0, -46*3*6, -50.0), + + (1, 40.0+40, -46*3*1-20, -50.0), + (1, 40.0+40, -46*3*2-20, -50.0), + (1, 40.0+40, -46*3*3-20, -50.0), + (1, 40.0+40, -46*3*4-20, -50.0), + (1, 40.0+40, -46*3*5-20, -50.0), + (1, 40.0+40, -46*3*6-20, -50.0), + + (2, 192*2-30-40.0, -46*3*1, -50.0), + (2, 192*2-30-40.0, -46*3*2, -50.0), + (2, 192*2-30-40.0, -46*3*3, -50.0), + (2, 192*2-30-40.0, -46*3*4, -50.0), + (2, 192*2-30-40.0, -46*3*5, -50.0), + (2, 192*2-30-40.0, -46*3*6, -50.0), + + (2, 192*2-30-40.0-50.0, -46*3*1-20, -50.0), + (2, 192*2-30-40.0-50.0, -46*3*2-20, -50.0), + (2, 192*2-30-40.0-50.0, -46*3*3-20, -50.0), + (2, 192*2-30-40.0-50.0, -46*3*4-20, -50.0), + (2, 192*2-30-40.0-50.0, -46*3*5-20, -50.0), + (2, 192*2-30-40.0-50.0, -46*3*6-20, -50.0)] + + +# Bounding boxes +anm_wrapper = AnmWrapper([Animations.read(open('stg1bg.anm', 'rb'))]) +for model in models: + vertices = [] + for script_index, ox2, oy2, oz2, width_override, height_override in model.quads: + sprite = Sprite() + anmrunner = ANMRunner(anm_wrapper, script_index, sprite) + anmrunner.run_frame() + sprite.update() + key, (vertices2, uvs2, colors2) = get_sprite_rendering_data(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.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)), + (1600, 0, (0.0, -600.0, 0.0)), + (6500, 0, (0.0, -600.0, 0.0))] + +with open('stage1.std', 'wb') as file: + stage.write(file) + diff --git a/data/ST/msg1.script b/data/ST/msg1.script new file mode 100644 diff --git a/data/ST/stg1bg.script b/data/ST/stg1bg.script new file mode 100644 --- /dev/null +++ b/data/ST/stg1bg.script @@ -0,0 +1,147 @@ +ENTRY 0 +Name: data/stg1bg/stg1bg.png +#Name2: data/stg1bg/stg1bg_a.png +Format: 1 +Width: 256 +Height: 256 + +Sprite: 0 81*46+33+52 +Sprite: 1 38*24+57+25 +Sprite: 2 22*20+33+25 +Sprite: 3 22*20+97+25 +Sprite: 4 38*22+57+1 +Sprite: 5 54*97+201+158 +Sprite: 6 14*50+33+158 +Sprite: 7 14*50+47+158 +Sprite: 8 30*30+33+100 +Sprite: 9 30*24+33+132 +Sprite: 10 30*254+1+1 +Sprite: 11 10*58+65+101 + +# Road +Script: 0 +Instruction: 0 0 1 0 +Instruction: 0 0 23 +Instruction: 0 0 15 + +# Blue car part 1 +Script: 1 +Instruction: 0 0 1 1 +Instruction: 0 0 9 0.0f 1.570796f 0.0f +Instruction: 0 0 15 + +# Blue car part 2 +Script: 2 +Instruction: 0 0 1 2 +Instruction: 0 0 9 1.570796f 0.0f 0.0f +Instruction: 0 0 15 + +# Blue car part 3 +Script: 3 +Instruction: 0 0 1 3 +Instruction: 0 0 9 1.570796f 0.0f 0.0f +Instruction: 0 0 15 + +# Blue car part 4 +Script: 4 +Instruction: 0 0 1 4 +Instruction: 0 0 9 0.0f 0.0f 1.570796f +Instruction: 0 0 15 + + +# Red car part 1 +Script: 5 +Instruction: 0 0 1 1 +Instruction: 0 0 23 +Instruction: 0 0 9 1.570796f 0.0f 0.0f +Instruction: 0 0 4 0xff000000 +Instruction: 0 0 15 + +# Red car part 2 +Script: 6 +Instruction: 0 0 1 2 +Instruction: 0 0 23 +Instruction: 0 0 9 0.0f 1.570796f 0.0f +Instruction: 0 0 4 0xff000000 +Instruction: 0 0 15 + +# Red car part 3 +Script: 7 +Instruction: 0 0 1 3 +Instruction: 0 0 23 +Instruction: 0 0 9 0.0f 1.570796f 0.0f +Instruction: 0 0 4 0xff000000 +Instruction: 0 0 15 + +# Red car part 4 +Script: 8 +Instruction: 0 0 1 4 +Instruction: 0 0 23 +Instruction: 0 0 4 0xff000000 +Instruction: 0 0 15 + +# Tree +Script: 9 +Instruction: 0 0 1 5 +Instruction: 0 0 23 +Instruction: 0 0 9 -1.570796f 0.0f -0.2f +Instruction: 0 0 15 + +# Tree 2 +Script: 10 +Instruction: 0 0 1 5 +Instruction: 0 0 23 +Instruction: 0 0 9 -1.570796f 0.0f 0.2f +Instruction: 0 0 15 + +# Grass +Script: 11 +Instruction: 0 0 1 6 +Instruction: 0 0 23 +Instruction: 0 0 15 + +# Grass boundary +Script: 12 +Instruction: 0 0 1 7 +Instruction: 0 0 23 +Instruction: 0 0 15 + +# Grass boundary 2 +Script: 13 +Instruction: 0 0 1 7 +Instruction: 0 0 7 +Instruction: 0 0 23 +Instruction: 0 0 15 + +# Dirt +Script: 14 +Instruction: 0 0 1 8 +Instruction: 0 0 23 +Instruction: 0 0 15 + +# Water 1 +Script: 15 +Instruction: 0 0 1 9 +Instruction: 0 0 23 +Instruction: 0 0 15 + +# Flowing water +Script: 16 +Instruction: 0 0 1 10 +Instruction: 0 0 23 +Instruction: 0 0 28 0.1f +Instruction: 1 0 5 12 + +# Border 1 +Script: 17 +Instruction: 0 0 1 11 +Instruction: 0 0 23 +Instruction: 0 0 15 + +# Border 2 +Script: 18 +Instruction: 0 0 1 11 +Instruction: 0 0 23 +Instruction: 0 0 7 +Instruction: 0 0 15 + diff --git a/data/ST/stg1bg.svg b/data/ST/stg1bg.svg new file mode 100644 --- /dev/null +++ b/data/ST/stg1bg.svg @@ -0,0 +1,2136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/ST/stg1enm.script b/data/ST/stg1enm.script new file mode 100644 --- /dev/null +++ b/data/ST/stg1enm.script @@ -0,0 +1,18 @@ +ENTRY 0 +Name: data/stg1enm/stg1enm.png +Format: 1 +Width: 256 +Height: 256 + +Sprite: 0 56*56+1+1 +Sprite: 1 15*30+1+226 + +Script: 0 +Instruction: 0 0 1 0 +Instruction: 0 0 10 0.0f 0.0f 0.2f +Instruction: 1000 0 15 + +Script: 3 +Instruction: 0 0 1 1 +Instruction: 0 0 15 + diff --git a/data/ST/stg1enm.svg b/data/ST/stg1enm.svg new file mode 100644 --- /dev/null +++ b/data/ST/stg1enm.svg @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/ST/stg1enm2.script b/data/ST/stg1enm2.script new file mode 100644 --- /dev/null +++ b/data/ST/stg1enm2.script @@ -0,0 +1,5 @@ +ENTRY 0 +Name: data/eff00/eff01.png +Format: 1 +Width: 256 +Height: 256