]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Vehicle antilag
authorJakob MG <jakob_mg@hotmail.com>
Sun, 23 Oct 2011 21:37:16 +0000 (23:37 +0200)
committerJakob MG <jakob_mg@hotmail.com>
Sun, 23 Oct 2011 21:37:16 +0000 (23:37 +0200)
qcsrc/server/g_subs.qc
qcsrc/server/g_world.qc
qcsrc/server/vehicles/racer.qc
qcsrc/server/vehicles/raptor.qc
qcsrc/server/vehicles/spiderbot.qc
qcsrc/server/vehicles/vehicles.qc
qcsrc/server/w_common.qc

index 6a62d61b5d423e43debf69ab9461e031c427142c..a908353a4c93b1c5a3116285cb2764c44e429f38 100644 (file)
@@ -391,7 +391,12 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma,
                // take players back into the past
                FOR_EACH_PLAYER(player)
                        if(player != forent)
-                               antilag_takeback(player, time - lag);
+                       {
+                           antilag_takeback(player, time - lag);
+                           if(player.vehicle)
+                    antilag_takeback(player.vehicle, time - lag);
+                       }
+                               
        }
 
        // do the trace
@@ -405,7 +410,12 @@ void tracebox_antilag_force_wz (entity source, vector v1, vector mi, vector ma,
        {
                FOR_EACH_PLAYER(player)
                        if(player != forent)
-                               antilag_restore(player);
+                       {
+                           antilag_restore(player);
+                           if(player.vehicle)
+                    antilag_restore(player.vehicle);
+                       }
+                               
        }
 
        // restore shooter solid type
index b134886d4f6fcfc54281c1af591fb028650650c8..5560c0b736ef5ec67497972015d3682122ebd27f 100644 (file)
@@ -2853,6 +2853,8 @@ void EndFrame()
                self.hitsound = FALSE;
                self.typehitsound = FALSE;
                antilag_record(self, altime);
+               if(self.vehicle)
+            antilag_record(self.vehicle, altime);
        }
 }
 
index e3c74c5e190c864a1d0832834729d2fc4b534979..7595027439bf731bed17c365e38956490f05552a 100644 (file)
@@ -273,10 +273,9 @@ float racer_frame()
         return 1;
     }
 
+    
     racer_align4point();
-
-    crosshair_trace(player);
-
+    vh_crosshair_trace(player);
     racer.angles_x *= -1;
 
     // Yaw
index 201c186c37947d65ad983efd0b4c67c1f0484120..4712777ee8f7db4f31078f9af528fd40bac9e705 100644 (file)
@@ -344,7 +344,7 @@ float raptor_frame()
         player.BUTTON_ATCK = player.BUTTON_ATCK2 = 0;
         return 1;
     }
-    crosshair_trace(player);
+    vh_crosshair_trace(player);
 
     vector vang;
     vang = raptor.angles;
index f43ec08e52f35f9a792a172a82c6a9da3e4f0093..00e8f3382372f98529bc75ee8b774401217c66e4 100644 (file)
@@ -145,7 +145,7 @@ void spiderbot_rocket_do()
     if not (self.owner.BUTTON_ATCK2)
         return;
 
-    crosshair_trace(self.owner);
+    vh_crosshair_trace(self.owner);
 
     v = gettaginfo(self.tur_head,gettagindex(self.tur_head,"tag_fire"));
     rocket = vehicles_projectile("spiderbot_rocket_launch", "weapons/rocket_fire.wav",
index c4e2875380486575ed766684f7def98d1053ff28..051a9136ef7a21a3f2e919996f1302a86941b050 100644 (file)
@@ -111,6 +111,40 @@ void CSQCVehicleSetup(entity own, float vehicle_id)
     dont before calling.
 
 **/
+void vh_crosshair_trace(entity player)
+{
+    float lag; 
+    entity pl;
+    
+    lag = ANTILAG_LATENCY(self);
+    if(lag < 0.001)
+        lag = 0;
+    if(clienttype(self) != CLIENTTYPE_REAL)
+        lag = 0;
+    if(autocvar_g_antilag == 0 || self.cvar_cl_noantilag)
+        lag = 0; // only do hitscan, but no antilag
+
+    if(lag)
+        FOR_EACH_PLAYER(pl)
+            if(pl != self)
+            {
+                antilag_takeback(pl, time - lag);
+                if(pl.vehicle)
+                    antilag_takeback(pl.vehicle, time - lag);
+
+            }
+
+    crosshair_trace(player);
+
+    if(lag)
+        FOR_EACH_PLAYER(pl)
+            if(pl != self)
+            {
+                antilag_restore(pl);
+                if(pl.vehicle)
+                    antilag_restore(pl.vehicle);
+            }
+}
 .entity lock_target;
 .float  lock_strength;
 .float  lock_time;
@@ -144,7 +178,7 @@ void vehicles_locktarget(float incr, float decr, float _lock_time)
         if(trace_ent.deadflag != DEAD_NO)
             trace_ent = world;
 
-        if not (trace_ent.vehicle_flags & VHF_ISVEHICLE || trace_ent.turrcaps_flags & TFL_TURRCAPS_ISTURRET)
+        if not (trace_ent.vehicle_flags & VHF_ISVEHICLE || trace_ent.turrcaps_flags & TFL_TURRCAPS_ISTURRET || trace_ent.classname == "player")
             trace_ent = world;
     }
 
index 1a995191c2f81025e9c9235d145649f0b9f82c42..00a9d2ed09d0a1d5c19ff9d1b1a0709d67534270 100644 (file)
@@ -419,7 +419,13 @@ void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, f
                if(lag)
                        FOR_EACH_PLAYER(pl)
                                if(pl != self)
-                                       antilag_takeback(pl, time - lag);
+                               {
+                                   antilag_takeback(pl, time - lag);
+                    if(pl.vehicle)
+                        antilag_takeback(pl.vehicle, time - lag);
+
+                               }
+                                       
 
                oldself = self;
                self = proj;
@@ -498,7 +504,12 @@ void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, f
                if(lag)
                        FOR_EACH_PLAYER(pl)
                                if(pl != self)
-                                       antilag_restore(pl);
+                               {
+                                   antilag_restore(pl);
+                                   if(pl.vehicle)
+                        antilag_restore(pl.vehicle);
+                               }
+                                       
 
                remove(proj);