# HG changeset patch # User Emmanuel Gil Peyrot # Date 1579361145 -3600 # Node ID 3687205fe620117ee1e195f0996c0a26269533d2 # Parent 0fed350d177854f4e75c89ec1781c1e4d21b5590 anm0_vm: Use the unused u16 to store the anm layer to use. diff --git a/src/th06/anm0_vm.rs b/src/th06/anm0_vm.rs --- 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]; }