]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
Shownames: fade when moving to spectate
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mutators / mutator / waypoints / waypointsprites.qc
index 7fa9181f2060f7b659e1e7e0b5bb00948706f5e3..fd21947d6fdeffa2cfba866fc75bcde6930ba928 100644 (file)
@@ -122,7 +122,7 @@ void Ent_WaypointSprite()
 
     self.draw2d = Draw_WaypointSprite;
 
-    InterpolateOrigin_Undo();
+    InterpolateOrigin_Undo(self);
     self.iflags |= IFLAG_ORIGIN;
 
     if (sendflags & 0x80)
@@ -211,7 +211,7 @@ void Ent_WaypointSprite()
             self.helpme += servertime;
     }
 
-    InterpolateOrigin_Note();
+    InterpolateOrigin_Note(this);
 
     self.entremove = Ent_RemoveWaypointSprite;
 }
@@ -233,7 +233,10 @@ vector spritelookupcolor(entity this, string s, vector def)
 {
     if (s == WP_Weapon.netname  || s == RADARICON_Weapon.netname) return get_weaponinfo(this.wp_extra).wpcolor;
     if (s == WP_Item.netname    || s == RADARICON_Item.netname) return Items_from(this.wp_extra).m_color;
-    if (s == WP_Buff.netname    || s == RADARICON_Buff.netname) return Buffs_from(this.wp_extra).m_color;
+    if (MUTATOR_CALLHOOK(WP_Format, this, s))
+    {
+        return MUTATOR_ARGV(0, vector);
+    }
     return def;
 }
 
@@ -242,8 +245,11 @@ string spritelookuptext(string s)
     if (s == WP_RaceStartFinish.netname) return (race_checkpointtime || race_mycheckpointtime) ? _("Finish") : _("Start");
     if (s == WP_Weapon.netname) return get_weaponinfo(self.wp_extra).m_name;
     if (s == WP_Item.netname) return Items_from(self.wp_extra).m_waypoint;
-    if (s == WP_Buff.netname) return Buffs_from(self.wp_extra).m_prettyName;
     if (s == WP_Monster.netname) return get_monsterinfo(self.wp_extra).monster_name;
+    if (MUTATOR_CALLHOOK(WP_Format, this, s))
+    {
+        return MUTATOR_ARGV(0, string);
+    }
 
     // need to loop, as our netname could be one of three
     FOREACH(Waypoints, it.netname == s, LAMBDA(
@@ -371,11 +377,13 @@ vector drawspritetext(vector o, float ang, float minwidth, vector rgb, float a,
     if (fabs(sa) > fabs(ca))
     {
         algnx = (sa < 0);
-        algny = 0.5 - 0.5 * ca / fabs(sa);
+        float f = fabs(sa);
+        algny = 0.5 - 0.5 * (f ? (ca / f) : 0);
     }
     else
     {
-        algnx = 0.5 - 0.5 * sa / fabs(ca);
+        float f = fabs(ca);
+        algnx = 0.5 - 0.5 * (f ? (sa / f) : 0);
         algny = (ca < 0);
     }
 
@@ -459,9 +467,9 @@ void Draw_WaypointSprite(entity this)
         if (autocvar_cl_hidewaypoints)
             return; // fixed waypoint
 
-    InterpolateOrigin_Do();
+    InterpolateOrigin_Do(self);
 
-    float t = GetPlayerColor(player_localnum) + 1;
+    float t = entcs_GetTeam(player_localnum) + 1;
 
     string spriteimage = "";