]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Animation support
authorJakob MG <jakob_mg@hotmail.com>
Tue, 14 Jun 2011 13:39:29 +0000 (15:39 +0200)
committerJakob MG <jakob_mg@hotmail.com>
Tue, 14 Jun 2011 13:39:29 +0000 (15:39 +0200)
qcsrc/client/tturrets.qc
qcsrc/server/tturrets/include/turrets_early.qh
qcsrc/server/tturrets/system/system_main.qc
qcsrc/server/tturrets/units/unit_walker.qc

index ffbae2a56ce539bdf2aae989eda0c1cbadb094b2..88d5c13d01d2130fb6c9372073a1b2beb9865bc6 100644 (file)
@@ -350,12 +350,6 @@ void ent_turret()
         self.tur_head.move_avelocity_y = ReadShort();            
     }
     
-    if(sf & TNSF_AVEL)
-    {        
-        //WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity_x));
-        //WriteShort(MSG_ENTITY, rint(self.tur_head.avelocity_y));
-    }
-    
     if(sf & TNSF_MOVE)
     {
         self.origin_x = ReadShort();
@@ -373,7 +367,13 @@ void ent_turret()
         self.move_velocity = self.velocity;
         self.move_origin = self.origin;
     }
-    
+        
+    if(sf & TNSF_ANIM)
+    {
+        self.frame1time = ReadCoord();
+        self.frame = ReadByte();
+    }
+
 
     if(sf & TNSF_STATUS)
     {        
index eeccd73d2bdd3826ea465b5218d7f295fee21826..3fd62cff35ea4d884321c8ae82e3778ec9858976 100644 (file)
@@ -475,6 +475,7 @@ float TNSF_SETUP        = 8;
 float TNSF_ANG          = 16;
 float TNSF_AVEL         = 32;
 float TNSF_MOVE         = 64;
+.float anim_start_time;
 float TNSF_ANIM         = 128;
 
 float TNSF_FULL_UPDATE  = 16777215;
index 8d4867fdfddf7423f1e25b69987fb1802a9cfb7f..12bb12f38ffb23bb0ebfa8e5b5a3c60f88e346cf 100644 (file)
@@ -44,7 +44,8 @@ float turret_send(entity to, float sf)
     
     if(sf & TNSF_ANIM)
     {
-        
+        WriteCoord(MSG_ENTITY, self.anim_start_time);
+        WriteByte(MSG_ENTITY, self.frame);
     }
     
     if(sf & TNSF_STATUS)
index ea61cf987a83c7487a0a3e05eb5742e47c29e7c8..740761e3e3537bed1b2aae96fb25be8518a171c0 100644 (file)
@@ -107,11 +107,17 @@ void walker_animate()
     vz         = self.velocity_z;
 
     if (self.tur_head.frame != 0)
-        self.tur_head.frame = self.tur_head.frame +1;
+        self.tur_head.frame = self.tur_head.frame + 1;
 
     if (self.tur_head.frame > 12)
         self.tur_head.frame = 0;
 
+    if(self.frame != self.animflag)
+    {
+        self.SendFlags |= TNSF_ANIM;
+        self.anim_start_time = time;
+    }
+    
     switch (self.animflag)
     {