]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix up waypointsprite_visible_for_player to not use self or other
authorMario <mario@smbclan.net>
Wed, 18 May 2016 02:14:29 +0000 (12:14 +1000)
committerMario <mario@smbclan.net>
Wed, 18 May 2016 02:14:29 +0000 (12:14 +1000)
qcsrc/common/mutators/mutator/buffs/buffs.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc
qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh
qcsrc/common/t_items.qc
qcsrc/server/mutators/mutator/gamemode_assault.qc
qcsrc/server/mutators/mutator/gamemode_keepaway.qc
qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
qcsrc/server/race.qc

index 15b725ee4b18d2bcd934728a6e0b2c2c8b233496..5ed63b538a7715d654e9f7f2871ca4ae5684f2ee 100644 (file)
@@ -153,17 +153,17 @@ void buff_Effect(entity player, string eff)
 }
 
 // buff item
-float buff_Waypoint_visible_for_player(entity plr)
-{SELFPARAM();
-       if(!self.owner.buff_active && !self.owner.buff_activetime)
+bool buff_Waypoint_visible_for_player(entity this, entity player, entity view)
+{
+       if(!this.owner.buff_active && !this.owner.buff_activetime)
                return false;
 
-       if (plr.buffs)
+       if (view.buffs)
        {
-               return plr.cvar_cl_buffs_autoreplace == false || plr.buffs != self.owner.buffs;
+               return view.cvar_cl_buffs_autoreplace == false || view.buffs != this.owner.buffs;
        }
 
-       return WaypointSprite_visible_for_player(plr);
+       return WaypointSprite_visible_for_player(this, player, view);
 }
 
 void buff_Waypoint_Spawn(entity e)
index d391c73fb18c7aa86b44603d77c3ad1e89d05d17..0865909858a520cfce0d8106ec46f15bfc797890 100644 (file)
@@ -921,25 +921,25 @@ void WaypointSprite_Think()
         self.nextthink = time; // WHY?!?
 }
 
-float WaypointSprite_visible_for_player(entity e)
-{SELFPARAM();
+bool WaypointSprite_visible_for_player(entity this, entity player, entity view)
+{
     // personal waypoints
-    if (self.enemy && self.enemy != e)
+    if (this.enemy && this.enemy != view)
         return false;
 
     // team waypoints
-    if (self.rule == SPRITERULE_SPECTATOR)
+    if (this.rule == SPRITERULE_SPECTATOR)
     {
         if (!autocvar_sv_itemstime)
             return false;
-        if (!warmup_stage && IS_PLAYER(e))
+        if (!warmup_stage && IS_PLAYER(view))
             return false;
     }
-    else if (self.team && self.rule == SPRITERULE_DEFAULT)
+    else if (this.team && this.rule == SPRITERULE_DEFAULT)
     {
-        if (self.team != e.team)
+        if (this.team != view.team)
             return false;
-        if (!IS_PLAYER(e))
+        if (!IS_PLAYER(view))
             return false;
     }
 
@@ -973,7 +973,7 @@ float WaypointSprite_Customize()
     if (MUTATOR_CALLHOOK(CustomizeWaypoint, self, other))
         return false;
 
-    return self.waypointsprite_visible_for_player(e);
+    return self.waypointsprite_visible_for_player(self, other, e);
 }
 
 bool WaypointSprite_SendEntity(entity this, entity to, float sendflags);
index 843a88d4502430dac3e536e9d5ee4b2839ea4b39..66ad9d5458cfe25bb154dfc815e3448f175b7de7 100644 (file)
@@ -128,7 +128,7 @@ float autocvar_sv_waypointsprite_limitedrange;
 .string model2;
 .string model3;
 
-.float(entity) waypointsprite_visible_for_player;
+.bool(entity, entity, entity) waypointsprite_visible_for_player;
 
 void WaypointSprite_UpdateSprites(entity e, entity m1, entity m2, entity m3);
 
@@ -162,7 +162,7 @@ void WaypointSprite_Disown(entity wp, float fadetime);
 
 void WaypointSprite_Think();
 
-float WaypointSprite_visible_for_player(entity e);
+bool WaypointSprite_visible_for_player(entity this, entity player, entity view);
 
 entity WaypointSprite_getviewentity(entity e);
 
index a3ac40b670010a39cfff08aea30f1c7c826b4037..2016944bbe4fbd62cd03866e63ecfbabd42b9b66 100644 (file)
@@ -554,15 +554,13 @@ void Item_RespawnCountdown ()
 
                if(self.waypointsprite_attached)
                {
-                       setself(self.waypointsprite_attached);
                        FOREACH_CLIENT(IS_REAL_CLIENT(it), {
-                               if(self.waypointsprite_visible_for_player(it))
+                               if(self.waypointsprite_attached.waypointsprite_visible_for_player(self.waypointsprite_attached, it, it))
                                {
                                        msg_entity = it;
                                        soundto(MSG_ONE, this, CH_TRIGGER, SND(ITEMRESPAWNCOUNTDOWN), VOL_BASE, ATTEN_NORM);    // play respawn sound
                                }
                        });
-                       setself(this);
 
                        WaypointSprite_Ping(self.waypointsprite_attached);
                        //WaypointSprite_UpdateHealth(self.waypointsprite_attached, self.count);
index e7785c7d0a907e8e2d66f5c43eab081c19cd9b3b..26038b2bb3cf46a16e6ea597d3caaf4ac17dc25f 100644 (file)
@@ -157,13 +157,9 @@ void assault_setenemytoobjective(entity this)
                objerror("no objective as target - fix the map!");
 }
 
-float assault_decreaser_sprite_visible(entity e)
-{SELFPARAM();
-       entity decreaser;
-
-       decreaser = self.assault_decreaser;
-
-       if(decreaser.enemy.health >= ASSAULT_VALUE_INACTIVE)
+bool assault_decreaser_sprite_visible(entity this, entity player, entity view)
+{
+       if(this.assault_decreaser.enemy.health >= ASSAULT_VALUE_INACTIVE)
                return false;
 
        return true;
index a3960066c16c228dd1a30f9904a3a230cc0fee8c..5bc93fb33fc4e1d9bbcfe5f955ab7378aeec0681 100644 (file)
@@ -64,10 +64,10 @@ int autocvar_g_keepawayball_effects;
 float autocvar_g_keepawayball_respawntime;
 int autocvar_g_keepawayball_trail_color;
 
-float ka_ballcarrier_waypointsprite_visible_for_player(entity e) // runs on waypoints which are attached to ballcarriers, updates once per frame
+bool ka_ballcarrier_waypointsprite_visible_for_player(entity this, entity player, entity view) // runs on waypoints which are attached to ballcarriers, updates once per frame
 {
-       if(e.ballcarried)
-               if(IS_SPEC(other))
+       if(view.ballcarried)
+               if(IS_SPEC(player))
                        return false; // we don't want spectators of the ballcarrier to see the attached waypoint on the top of their screen
 
        // TODO: Make the ballcarrier lack a waypointsprite whenever they have the invisibility powerup
index e311f72c1303830f49535beda0c59b242c6eaa6e..e2b9d013d33f2e9522e7eb3ee26536bcffc8574e 100644 (file)
@@ -157,22 +157,22 @@ void kh_ScoreRules(float teams)
        ScoreRules_basics_end();
 }
 
-float kh_KeyCarrier_waypointsprite_visible_for_player(entity e)  // runs all the time
-{SELFPARAM();
-       if(!IS_PLAYER(e) || DIFF_TEAM(self, e))
+bool kh_KeyCarrier_waypointsprite_visible_for_player(entity this, entity player, entity view)  // runs all the time
+{
+       if(!IS_PLAYER(view) || DIFF_TEAM(this, view))
                if(!kh_tracking_enabled)
                        return false;
 
        return true;
 }
 
-float kh_Key_waypointsprite_visible_for_player(entity e) // ??
-{SELFPARAM();
+bool kh_Key_waypointsprite_visible_for_player(entity this, entity player, entity view)
+{
        if(!kh_tracking_enabled)
                return false;
-       if(!self.owner)
+       if(!this.owner)
                return true;
-       if(!self.owner.owner)
+       if(!this.owner.owner)
                return true;
        return false;  // draw only when key is not owned
 }
index d24a0769b5a4b1b7834c76ca04fca34d588c63ab..6e43b97d91aecf28ebcdc2d45731e19d9c63410a 100644 (file)
@@ -714,11 +714,11 @@ void checkpoint_use(entity this, entity actor, entity trigger)
        checkpoint_passed();
 }
 
-float race_waypointsprite_visible_for_player(entity e)
-{SELFPARAM();
-       if(e.race_checkpoint == -1 || self.owner.race_checkpoint == -2)
+bool race_waypointsprite_visible_for_player(entity this, entity player, entity view)
+{
+       if(view.race_checkpoint == -1 || this.owner.race_checkpoint == -2)
                return true;
-       else if(e.race_checkpoint == self.owner.race_checkpoint)
+       else if(view.race_checkpoint == this.owner.race_checkpoint)
                return true;
        else
                return false;