Mercurial > touhou
annotate pytouhou/game/sprite.py @ 78:bcf965ede96c
Fix/rename/comment a few things
author | Thibaut Girka <thib@sitedethib.com> |
---|---|
date | Wed, 31 Aug 2011 13:51:42 +0200 |
parents | b3bd421bb895 |
children | f5f9b5eb69a3 |
rev | line source |
---|---|
52
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
1 # -*- encoding: utf-8 -*- |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
2 ## |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
3 ## Copyright (C) 2011 Thibaut Girka <thib@sitedethib.com> |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
4 ## |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
5 ## This program is free software; you can redistribute it and/or modify |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
6 ## it under the terms of the GNU General Public License as published |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
7 ## by the Free Software Foundation; version 3 only. |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
8 ## |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
9 ## This program is distributed in the hope that it will be useful, |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
12 ## GNU General Public License for more details. |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
13 ## |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
14 |
ab826bc29aa2
Add some documentation, GPLv3 headers, README and COPYING file.
Thibaut Girka <thib@sitedethib.com>
parents:
41
diff
changeset
|
15 |
15 | 16 from pytouhou.utils.matrix import Matrix |
71
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
17 from pytouhou.utils.interpolator import Interpolator |
15 | 18 |
21
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
17
diff
changeset
|
19 |
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
17
diff
changeset
|
20 class AnmWrapper(object): |
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
17
diff
changeset
|
21 def __init__(self, anm_files): |
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
17
diff
changeset
|
22 self.anm_files = list(anm_files) |
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
17
diff
changeset
|
23 |
69
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
24 |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
25 def get_sprite(self, sprite_index): |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
26 for anm in self.anm_files: |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
27 if sprite_index in anm.sprites: |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
28 return anm, anm.sprites[sprite_index] |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
29 raise IndexError |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
30 |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
31 |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
32 def get_script(self, script_index): |
21
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
17
diff
changeset
|
33 for anm in self.anm_files: |
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
17
diff
changeset
|
34 if script_index in anm.scripts: |
69
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
35 return anm, anm.scripts[script_index] |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
36 raise IndexError |
21
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
17
diff
changeset
|
37 |
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
17
diff
changeset
|
38 |
bf225780973f
Small refactoring, and Rumia \o/
Thibaut Girka <thib@sitedethib.com>
parents:
17
diff
changeset
|
39 |
15 | 40 class Sprite(object): |
69
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
41 def __init__(self): |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
42 self.anm = None |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
43 self._removed = False |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
44 self._changed = False |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
45 |
71
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
46 self.scale_interpolator = None |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
47 self.fade_interpolator = None |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
48 self.offset_interpolator = None |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
49 |
72
6a08f44fa01b
Handle a few more ANM instructions. pytouhou.game.background needs some serious refactoring.
Thibaut Girka <thib@sitedethib.com>
parents:
71
diff
changeset
|
50 self.blendfunc = 0 # 0 = Normal, 1 = saturate #TODO: proper constants |
6a08f44fa01b
Handle a few more ANM instructions. pytouhou.game.background needs some serious refactoring.
Thibaut Girka <thib@sitedethib.com>
parents:
71
diff
changeset
|
51 |
15 | 52 self.texcoords = (0, 0, 0, 0) # x, y, width, height |
71
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
53 self.dest_offset = (0., 0., 0.) |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
54 self.allow_dest_offset = False |
41
93c8dc2de923
Add (hopefully) "texture shifting" in animations
Thibaut Girka <thib@sitedethib.com>
parents:
38
diff
changeset
|
55 self.texoffsets = (0., 0.) |
15 | 56 self.mirrored = False |
57 self.rescale = (1., 1.) | |
57
694f25881d0f
Fix move_to interpolation, add support for a few ANM and ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
54
diff
changeset
|
58 self.scale_speed = (0., 0.) |
15 | 59 self.rotations_3d = (0., 0., 0.) |
27
b65d6bc55793
Add rotating sprite support
Thibaut Girka <thib@sitedethib.com>
parents:
26
diff
changeset
|
60 self.rotations_speed_3d = (0., 0., 0.) |
15 | 61 self.corner_relative_placement = False |
17
d940d004b840
Make game.sprite.Sprite use its own frame counter.
Thibaut Girka <thib@sitedethib.com>
parents:
15
diff
changeset
|
62 self.frame = 0 |
57
694f25881d0f
Fix move_to interpolation, add support for a few ANM and ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
54
diff
changeset
|
63 self.color = (255, 255, 255) |
37
a10e3f44a883
Add alpha (anm0 instruction 3) support
Thibaut Girka <thib@sitedethib.com>
parents:
34
diff
changeset
|
64 self.alpha = 255 |
15 | 65 self._uvs = [] |
66 self._vertices = [] | |
37
a10e3f44a883
Add alpha (anm0 instruction 3) support
Thibaut Girka <thib@sitedethib.com>
parents:
34
diff
changeset
|
67 self._colors = [] |
15 | 68 |
69 | |
71
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
70 def fade(self, duration, alpha, formula): |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
71 if not self.fade_interpolator: |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
72 self.fade_interpolator = Interpolator((self.alpha,), formula) |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
73 self.fade_interpolator.set_interpolation_start(self.frame, (self.alpha,)) |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
74 self.fade_interpolator.set_interpolation_end(self.frame + duration - 1, (alpha,)) |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
75 |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
76 |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
77 def scale_in(self, duration, sx, sy, formula): |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
78 if not self.scale_interpolator: |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
79 self.scale_interpolator = Interpolator(self.rescale, formula) |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
80 self.scale_interpolator.set_interpolation_start(self.frame, self.rescale) |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
81 self.scale_interpolator.set_interpolation_end(self.frame + duration - 1, (sx, sy)) |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
82 |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
83 |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
84 def move_in(self, duration, x, y, z, formula): |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
85 if not self.offset_interpolator: |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
86 self.offset_interpolator = Interpolator(self.dest_offset, formula) |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
87 self.offset_interpolator.set_interpolation_start(self.frame, self.dest_offset) |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
88 self.offset_interpolator.set_interpolation_end(self.frame + duration - 1, (x, y, z)) |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
89 |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
90 |
75
b3bd421bb895
Handle a few more ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
72
diff
changeset
|
91 def update_vertices_uvs_colors(self, override_width=0, override_height=0, angle_base=0.): |
71
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
92 if self.fade_interpolator: |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
93 self.fade_interpolator.update(self.frame) |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
94 self.alpha = int(self.fade_interpolator.values[0]) |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
95 |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
96 if self.scale_interpolator: |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
97 self.scale_interpolator.update(self.frame) |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
98 self.rescale = self.scale_interpolator.values |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
99 |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
100 if self.offset_interpolator: |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
101 self.offset_interpolator.update(self.frame) |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
102 self.dest_offset = self.offset_interpolator.values |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
103 |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
104 |
28
f405b947624d
Massive sprite updating/matrix handling optimizations
Thibaut Girka <thib@sitedethib.com>
parents:
27
diff
changeset
|
105 vertmat = Matrix([[-.5, .5, .5, -.5], |
f405b947624d
Massive sprite updating/matrix handling optimizations
Thibaut Girka <thib@sitedethib.com>
parents:
27
diff
changeset
|
106 [-.5, -.5, .5, .5], |
f405b947624d
Massive sprite updating/matrix handling optimizations
Thibaut Girka <thib@sitedethib.com>
parents:
27
diff
changeset
|
107 [ .0, .0, .0, .0], |
f405b947624d
Massive sprite updating/matrix handling optimizations
Thibaut Girka <thib@sitedethib.com>
parents:
27
diff
changeset
|
108 [ 1., 1., 1., 1.]]) |
15 | 109 |
110 tx, ty, tw, th = self.texcoords | |
111 sx, sy = self.rescale | |
112 width = override_width or (tw * sx) | |
113 height = override_height or (th * sy) | |
114 | |
31 | 115 vertmat.scale2d(width, height) |
15 | 116 if self.mirrored: |
28
f405b947624d
Massive sprite updating/matrix handling optimizations
Thibaut Girka <thib@sitedethib.com>
parents:
27
diff
changeset
|
117 vertmat.flip() |
75
b3bd421bb895
Handle a few more ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
72
diff
changeset
|
118 |
b3bd421bb895
Handle a few more ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
72
diff
changeset
|
119 rx, ry, rz = self.rotations_3d |
b3bd421bb895
Handle a few more ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
72
diff
changeset
|
120 rz += angle_base |
b3bd421bb895
Handle a few more ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
72
diff
changeset
|
121 |
b3bd421bb895
Handle a few more ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
72
diff
changeset
|
122 if (rx, ry, rz) != (0., 0., 0.): |
28
f405b947624d
Massive sprite updating/matrix handling optimizations
Thibaut Girka <thib@sitedethib.com>
parents:
27
diff
changeset
|
123 if rx: |
f405b947624d
Massive sprite updating/matrix handling optimizations
Thibaut Girka <thib@sitedethib.com>
parents:
27
diff
changeset
|
124 vertmat.rotate_x(-rx) |
f405b947624d
Massive sprite updating/matrix handling optimizations
Thibaut Girka <thib@sitedethib.com>
parents:
27
diff
changeset
|
125 if ry: |
f405b947624d
Massive sprite updating/matrix handling optimizations
Thibaut Girka <thib@sitedethib.com>
parents:
27
diff
changeset
|
126 vertmat.rotate_y(ry) |
f405b947624d
Massive sprite updating/matrix handling optimizations
Thibaut Girka <thib@sitedethib.com>
parents:
27
diff
changeset
|
127 if rz: |
f405b947624d
Massive sprite updating/matrix handling optimizations
Thibaut Girka <thib@sitedethib.com>
parents:
27
diff
changeset
|
128 vertmat.rotate_z(-rz) #TODO: minus, really? |
15 | 129 if self.corner_relative_placement: # Reposition |
28
f405b947624d
Massive sprite updating/matrix handling optimizations
Thibaut Girka <thib@sitedethib.com>
parents:
27
diff
changeset
|
130 vertmat.translate(width / 2., height / 2., 0.) |
71
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
131 if self.allow_dest_offset: |
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
132 vertmat.translate(*self.dest_offset) |
15 | 133 |
30 | 134 x_1 = 1. / self.anm.size[0] |
135 y_1 = 1. / self.anm.size[1] | |
41
93c8dc2de923
Add (hopefully) "texture shifting" in animations
Thibaut Girka <thib@sitedethib.com>
parents:
38
diff
changeset
|
136 tox, toy = self.texoffsets |
93c8dc2de923
Add (hopefully) "texture shifting" in animations
Thibaut Girka <thib@sitedethib.com>
parents:
38
diff
changeset
|
137 uvs = [(tx * x_1 + tox, 1. - (ty * y_1) + toy), |
93c8dc2de923
Add (hopefully) "texture shifting" in animations
Thibaut Girka <thib@sitedethib.com>
parents:
38
diff
changeset
|
138 ((tx + tw) * x_1 + tox, 1. - (ty * y_1) + toy), |
93c8dc2de923
Add (hopefully) "texture shifting" in animations
Thibaut Girka <thib@sitedethib.com>
parents:
38
diff
changeset
|
139 ((tx + tw) * x_1 + tox, 1. - ((ty + th) * y_1 + toy)), |
93c8dc2de923
Add (hopefully) "texture shifting" in animations
Thibaut Girka <thib@sitedethib.com>
parents:
38
diff
changeset
|
140 (tx * x_1 + tox, 1. - ((ty + th) * y_1 + toy))] |
15 | 141 |
30 | 142 d = vertmat.data |
143 assert (d[3][0], d[3][1], d[3][2], d[3][3]) == (1., 1., 1., 1.) | |
57
694f25881d0f
Fix move_to interpolation, add support for a few ANM and ECL instructions
Thibaut Girka <thib@sitedethib.com>
parents:
54
diff
changeset
|
144 self._colors = [(self.color[0], self.color[1], self.color[2], self.alpha)] * 4 |
30 | 145 self._uvs, self._vertices = uvs, zip(d[0], d[1], d[2]) |
15 | 146 |
147 | |
29
afa91be769ae
Don't lose time updating off-screen enemies' sprites
Thibaut Girka <thib@sitedethib.com>
parents:
28
diff
changeset
|
148 def update(self): |
69
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
149 if self.rotations_speed_3d != (0., 0., 0.) or self.scale_speed != (0., 0.): |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
150 ax, ay, az = self.rotations_3d |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
151 sax, say, saz = self.rotations_speed_3d |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
152 self.rotations_3d = ax + sax, ay + say, az + saz |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
153 self.rescale = self.rescale[0] + self.scale_speed[0], self.rescale[1] + self.scale_speed[1] |
a142e57218a0
Refactor. Move VMs to pytouhou.vm.
Thibaut Girka <thib@sitedethib.com>
parents:
61
diff
changeset
|
154 self._changed = True |
71
a03d7a94b997
Add support for a few ANM instructions
Thibaut Girka <thib@sitedethib.com>
parents:
69
diff
changeset
|
155 self.frame += 1 |
54 | 156 |