diff src/th06/anm0_vm.rs @ 709:6d4802abe134

Make interpolators use u32 instead of u16.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 08 Sep 2019 17:53:13 +0200
parents b6c351ca0a35
children 3555845f8cf4
line wrap: on
line diff
--- a/src/th06/anm0_vm.rs
+++ b/src/th06/anm0_vm.rs
@@ -28,7 +28,7 @@ pub struct Vertex {
 #[derive(Debug, Clone, Default)]
 pub struct Sprite {
     blendfunc: u32,
-    frame: u16,
+    frame: u32,
 
     width_override: f32,
     height_override: f32,
@@ -226,7 +226,7 @@ pub struct AnmRunner {
     frame: u16,
     waiting: bool,
     variables: ([i32; 4], [f32; 4], [i32; 4]),
-    timeout: Option<u16>,
+    timeout: Option<u32>,
 }
 
 impl AnmRunner {
@@ -357,7 +357,7 @@ impl AnmRunner {
                 sprite.scale_speed = [ssx, ssy];
             }
             Instruction::Fade(new_alpha, duration) => {
-                sprite.fade_interpolator = Some(Interpolator1::new([sprite.color[3] as f32], sprite.frame, [new_alpha as f32], sprite.frame + duration as u16, Formula::Linear));
+                sprite.fade_interpolator = Some(Interpolator1::new([sprite.color[3] as f32], sprite.frame, [new_alpha as f32], sprite.frame + duration, Formula::Linear));
             }
             Instruction::SetBlendmodeAlphablend() => {
                 sprite.blendfunc = 1;
@@ -385,13 +385,13 @@ impl AnmRunner {
                 sprite.dest_offset = [x, y, z];
             }
             Instruction::MoveToLinear(x, y, z, duration) => {
-                sprite.offset_interpolator = Some(Interpolator3::new(sprite.dest_offset, sprite.frame, [x, y, z], sprite.frame + duration as u16, Formula::Linear));
+                sprite.offset_interpolator = Some(Interpolator3::new(sprite.dest_offset, sprite.frame, [x, y, z], sprite.frame + duration, Formula::Linear));
             }
             Instruction::MoveToDecel(x, y, z, duration) => {
-                sprite.offset_interpolator = Some(Interpolator3::new(sprite.dest_offset, sprite.frame, [x, y, z], sprite.frame + duration as u16, Formula::InvertPower2));
+                sprite.offset_interpolator = Some(Interpolator3::new(sprite.dest_offset, sprite.frame, [x, y, z], sprite.frame + duration, Formula::InvertPower2));
             }
             Instruction::MoveToAccel(x, y, z, duration) => {
-                sprite.offset_interpolator = Some(Interpolator3::new(sprite.dest_offset, sprite.frame, [x, y, z], sprite.frame + duration as u16, Formula::Power2));
+                sprite.offset_interpolator = Some(Interpolator3::new(sprite.dest_offset, sprite.frame, [x, y, z], sprite.frame + duration, Formula::Power2));
             }
             Instruction::Wait() => {
                 self.waiting = true;
@@ -423,7 +423,7 @@ impl AnmRunner {
                 sprite.visible = (visible & 1) != 0;
             }
             Instruction::ScaleIn(sx, sy, duration) => {
-                sprite.scale_interpolator = Some(Interpolator2::new(sprite.rescale, sprite.frame, [sx, sy], sprite.frame + duration as u16, Formula::Linear));
+                sprite.scale_interpolator = Some(Interpolator2::new(sprite.rescale, sprite.frame, [sx, sy], sprite.frame + duration, Formula::Linear));
             }
             Instruction::Todo(_todo) => {
                 // TODO.