]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Waypointsprites for vehicles
authorJakob MG <jakob_mg@hotmail.com>
Sun, 12 Jun 2011 14:26:11 +0000 (16:26 +0200)
committerJakob MG <jakob_mg@hotmail.com>
Sun, 12 Jun 2011 14:26:11 +0000 (16:26 +0200)
models/sprites/vehicle_frame0.tga [new file with mode: 0644]
models/sprites/vehicle_frame1.tga [new file with mode: 0644]
qcsrc/server/vehicles/vehicles.qc

diff --git a/models/sprites/vehicle_frame0.tga b/models/sprites/vehicle_frame0.tga
new file mode 100644 (file)
index 0000000..0864bcb
Binary files /dev/null and b/models/sprites/vehicle_frame0.tga differ
diff --git a/models/sprites/vehicle_frame1.tga b/models/sprites/vehicle_frame1.tga
new file mode 100644 (file)
index 0000000..073354d
Binary files /dev/null and b/models/sprites/vehicle_frame1.tga differ
index 69c0f87e51f23528c0fd5caeffb32f3844dc2f29..7400dc142b6abe5f04f085f0d4b5845759062a14 100644 (file)
@@ -684,16 +684,6 @@ void vehicles_damage(entity inflictor, entity attacker, float damage, float deat
     }
 }
 
-void vehicles_return()
-{
-    pointparticles(particleeffectnum("teleport"), self.enemy.origin + '0 0 64', '0 0 0', 1);
-
-    self.enemy.think     = vehicles_spawn;
-    self.enemy.nextthink = time;
-
-    remove(self);
-}
-
 void vehicles_clearrturn()
 {
     entity ret;
@@ -705,25 +695,115 @@ void vehicles_clearrturn()
         {
             ret.classname   = "";
             ret.think       = SUB_Remove;
-            ret.nextthink   = time + 0.1;
+            ret.nextthink   = time + 0.1;            
+            
+            if(ret.waypointsprite_attached)
+                WaypointSprite_Kill(ret.waypointsprite_attached);
+            
             return;
         }
         ret = ret.chain;
     }
 }
 
+void vehicles_return()
+{
+    pointparticles(particleeffectnum("teleport"), self.enemy.origin + '0 0 64', '0 0 0', 1);
+
+    self.enemy.think     = vehicles_spawn;
+    self.enemy.nextthink = time;
+
+    if(self.waypointsprite_attached)
+        WaypointSprite_Kill(self.waypointsprite_attached);
+            
+    remove(self);
+}
+
+void vehicles_showwp_goaway()
+{
+    if(self.waypointsprite_attached)
+        WaypointSprite_Kill(self.waypointsprite_attached);
+            
+    remove(self);
+    
+}
+
+void vehicles_showwp()
+{
+    entity oldself;
+    
+    if(self.cnt)
+    {        
+        self.think      = vehicles_return;
+        self.nextthink  = self.cnt;
+    }    
+    else
+    {
+        self.think      = vehicles_return;
+        self.nextthink  = time +1;
+        
+        oldself = self;
+        self = spawn();
+        setmodel(self, "null");
+        self.team = oldself.enemy.team;
+        self.enemy = oldself.enemy;
+        setorigin(self, oldself.enemy.pos1);
+        
+        self.nextthink = time + 5;
+        self.think = vehicles_showwp_goaway;
+    }
+    
+    WaypointSprite_Spawn("vehicle", 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, TRUE);
+    if(self.waypointsprite_attached)
+    {
+        
+        if(teams_matter && self.team)
+            WaypointSprite_UpdateTeamRadar(self.waypointsprite_attached, RADARICON_POWERUP, TeamColor(self.team));
+        else
+            WaypointSprite_UpdateTeamRadar(self.waypointsprite_attached, RADARICON_POWERUP, '1 1 1');
+        
+        WaypointSprite_UpdateRule(self.waypointsprite_attached, self.enemy.team, SPRITERULE_DEFAULT);        
+        if(oldself == world)
+        {
+            WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, self.nextthink);        
+            dprint("Oldies is goldies\n");
+        }
+            
+        WaypointSprite_Ping(self.waypointsprite_attached);
+    }    
+    
+    if(oldself != world)
+        self = oldself;
+}
+
 void vehicles_setreturn()
 {
     entity ret;
-
+    
     vehicles_clearrturn();
 
     ret = spawn();
     ret.classname   = "vehicle_return";
-    ret.enemy       = self;
-    ret.think       = vehicles_return;
-    ret.nextthink   = time + self.vehicle_respawntime;
-} 
+    ret.enemy       = self;    
+    ret.team        = self.team;
+    ret.think       = vehicles_showwp;        
+    
+    if(self.deadflag != DEAD_NO)
+    {
+        ret.cnt         = time + self.vehicle_respawntime;
+        ret.nextthink   = min(time + self.vehicle_respawntime, time + self.vehicle_respawntime - 5);        
+    }        
+    else
+    {
+        ret.nextthink   = min(time + self.vehicle_respawntime, time + self.vehicle_respawntime - 1);        
+    }
+        
+    
+    
+    setmodel(ret, "null");
+    setorigin(ret, self.pos1 + '0 0 96');
+       
+}
 
 void vehicles_configcheck(string  configname, float check_cvar)
 {