From 36b46a9876477ce9cd78336a6551d940b5b64bbf Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 13 Jul 2020 20:20:51 +1000 Subject: [PATCH] Add a mutator hook to allow forcing team radar icons to display regardless of their team (will be useful in Race to display all racers) --- qcsrc/client/hud/panel/radar.qc | 4 +++- qcsrc/client/mutators/events.qh | 3 +++ qcsrc/common/gamemodes/gamemode/race/cl_race.qc | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/qcsrc/client/hud/panel/radar.qc b/qcsrc/client/hud/panel/radar.qc index 14cdb4f68..a2776b662 100644 --- a/qcsrc/client/hud/panel/radar.qc +++ b/qcsrc/client/hud/panel/radar.qc @@ -353,10 +353,12 @@ void HUD_Radar() IL_EACH(g_radarlinks, true, draw_teamradar_link(it.origin, it.velocity, it.team)); + bool mutator_returnvalue = MUTATOR_CALLHOOK(TeamRadar_Draw); // TODO: allow players to show on the radar as well! + IL_EACH(g_radaricons, it.teamradar_icon, { if ( hud_panel_radar_mouse ) if ( GetResource(it, RES_HEALTH) >= 0 ) - if ( it.team == myteam + 1 || ISGAMETYPE(RACE) || !teamplay ) + if ( it.team == myteam + 1 || mutator_returnvalue || !teamplay ) { vector coord = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(it.origin)); if(vdist((mousepos - coord), <, 8)) diff --git a/qcsrc/client/mutators/events.qh b/qcsrc/client/mutators/events.qh index 258ad9e11..c324732b2 100644 --- a/qcsrc/client/mutators/events.qh +++ b/qcsrc/client/mutators/events.qh @@ -228,3 +228,6 @@ MUTATOR_HOOKABLE(ShowNames_Draw, EV_ShowNames_Draw); /** Return true to display the race timer HUD panel */ MUTATOR_HOOKABLE(ShowRaceTimer, EV_NO_ARGS); + +/** Return true to force team radar to display entities regardless of their team */ +MUTATOR_HOOKABLE(TeamRadar_Draw, EV_NO_ARGS); diff --git a/qcsrc/common/gamemodes/gamemode/race/cl_race.qc b/qcsrc/common/gamemodes/gamemode/race/cl_race.qc index 01a6e83b2..c2346a4f2 100644 --- a/qcsrc/common/gamemodes/gamemode/race/cl_race.qc +++ b/qcsrc/common/gamemodes/gamemode/race/cl_race.qc @@ -176,3 +176,8 @@ MUTATOR_HOOKFUNCTION(cl_race, ShowRaceTimer) { return ISGAMETYPE(RACE); // show the race timer panel } + +MUTATOR_HOOKFUNCTION(cl_race, TeamRadar_Draw) +{ + return ISGAMETYPE(RACE); // show all competitors in a race +} -- 2.39.2