Mercurial > touhou
diff src/th06/anm0_vm.rs @ 744:3687205fe620
anm0_vm: Use the unused u16 to store the anm layer to use.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sat, 18 Jan 2020 16:25:45 +0100 |
parents | 0a250ddfae79 |
children |
line wrap: on
line diff
--- a/src/th06/anm0_vm.rs +++ b/src/th06/anm0_vm.rs @@ -19,6 +19,8 @@ pub struct Vertex { /// XXX pub pos: [i16; 3], /// XXX + pub layer: u16, + /// XXX pub uv: [f32; 2], /// XXX pub color: [u8; 4], @@ -59,6 +61,7 @@ pub struct Sprite { rotations_3d: [f32; 3], rotations_speed_3d: [f32; 3], color: [u8; 4], + layer: u16, } impl Sprite { @@ -164,6 +167,11 @@ impl Sprite { vertices[1].color = self.color; vertices[2].color = self.color; vertices[3].color = self.color; + + vertices[0].layer = self.layer; + vertices[1].layer = self.layer; + vertices[2].layer = self.layer; + vertices[3].layer = self.layer; } /// Update sprite values from the interpolators. @@ -229,6 +237,7 @@ impl Anms { let anms = self.inner.borrow(); let mut anm = None; let mut texcoords = None; + let mut layer = 0; 'anm: for anm0 in anms.iter() { for sp in anm0.sprites.iter() { if sp.index == id as u32 { @@ -237,8 +246,10 @@ impl Anms { break 'anm; } } + layer += 1; } sprite.anm = anm; + sprite.layer = layer; if let Some(texcoords) = texcoords { sprite.texcoords = [texcoords.x, texcoords.y, texcoords.width, texcoords.height]; }