]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/warpzonelib/server.qc
properly draw the hook through warpzones again too; fix interpolation issues
[xonotic/xonotic-data.pk3dir.git] / qcsrc / warpzonelib / server.qc
index f2b3581887536234d6614690906e444dd27f2bd9..c156299c6967c96bddf44661b8c1f32f6fe203c3 100644 (file)
@@ -300,6 +300,7 @@ void WarpZoneCamera_InitStep_FindTarget()
                error("Camera with nonexisting target");
                return;
        }
+       WarpZone_Camera_SetUp(self, self.enemy.origin, self.enemy.angles);
 }
 
 void WarpZone_InitStep_UpdateTransform()
@@ -393,21 +394,29 @@ void WarpZone_InitStep_ClearTarget()
        self.enemy = world;
 }
 
+entity warpzone_first; .entity warpzone_next;
 void WarpZone_InitStep_FindTarget()
 {
        float i;
        entity e, e2;
 
+       if(self.enemy)
+               return;
+
        // this way only one of the two ents needs to target
        if(self.target != "")
        {
+               self.enemy = self; // so the if(!e.enemy) check also skips self, saves one IF
+
                e2 = world;
-               for(e = world; (e = find(e, targetname, self.target)); )
+               for(e = world, i = 0; (e = find(e, targetname, self.target)); )
                        if(!e.enemy)
-                               if(random() * ++i < 1)
-                                       e2 = e;
+                               if(e.classname == self.classname) // possibly non-warpzones may use the same targetname!
+                                       if(random() * ++i < 1)
+                                               e2 = e;
                if(!e2)
                {
+                       self.enemy = world;
                        error("Warpzone with non-existing target");
                        return;
                }
@@ -537,7 +546,7 @@ void WarpZone_StartFrame()
                WarpZone_StoreProjectileData(e);
 }
 
-void target_warpzone_reconnect_use()
+void trigger_warpzone_reconnect_use()
 {
        entity e;
        e = self;
@@ -555,7 +564,12 @@ void target_warpzone_reconnect_use()
        self = e;
 }
 
-void trigger_warpzone_reconnect()
+void spawnfunc_trigger_warpzone_reconnect()
+{
+       self.use = trigger_warpzone_reconnect_use;
+}
+
+void spawnfunc_target_warpzone_reconnect()
 {
-       self.use = target_warpzone_reconnect_use;
+       spawnfunc_trigger_warpzone_reconnect(); // both names make sense here :(
 }