From: Mario Date: Wed, 18 May 2016 02:14:29 +0000 (+1000) Subject: Fix up waypointsprite_visible_for_player to not use self or other X-Git-Tag: xonotic-v0.8.2~928 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4e9cc4ae8ed4b262f4c9b51caf7c4aa95290711f;p=xonotic%2Fxonotic-data.pk3dir.git Fix up waypointsprite_visible_for_player to not use self or other --- diff --git a/qcsrc/common/mutators/mutator/buffs/buffs.qc b/qcsrc/common/mutators/mutator/buffs/buffs.qc index 15b725ee4..5ed63b538 100644 --- a/qcsrc/common/mutators/mutator/buffs/buffs.qc +++ b/qcsrc/common/mutators/mutator/buffs/buffs.qc @@ -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) diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc index d391c73fb..086590985 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qc @@ -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); diff --git a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh index 843a88d45..66ad9d545 100644 --- a/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh +++ b/qcsrc/common/mutators/mutator/waypoints/waypointsprites.qh @@ -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); diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index a3ac40b67..2016944bb 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -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); diff --git a/qcsrc/server/mutators/mutator/gamemode_assault.qc b/qcsrc/server/mutators/mutator/gamemode_assault.qc index e7785c7d0..26038b2bb 100644 --- a/qcsrc/server/mutators/mutator/gamemode_assault.qc +++ b/qcsrc/server/mutators/mutator/gamemode_assault.qc @@ -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; diff --git a/qcsrc/server/mutators/mutator/gamemode_keepaway.qc b/qcsrc/server/mutators/mutator/gamemode_keepaway.qc index a3960066c..5bc93fb33 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keepaway.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keepaway.qc @@ -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 diff --git a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc index e311f72c1..e2b9d013d 100644 --- a/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/mutator/gamemode_keyhunt.qc @@ -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 } diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index d24a0769b..6e43b97d9 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -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;