From 96f08d30e94b4b6c1bfe945eced036a08964611b Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Thu, 15 Mar 2012 17:42:18 +0200 Subject: [PATCH] Rename teamradar to radar, and also allow it in non-team games by default --- data/defaultVT.cfg | 18 +- ...{teamradar_icon_1.tga => radar_icon_1.tga} | Bin ...{teamradar_icon_2.tga => radar_icon_2.tga} | Bin .../{teamradar_ping.tga => radar_ping.tga} | Bin data/qcsrc/client/View.qc | 6 +- data/qcsrc/client/progs.src | 4 +- data/qcsrc/client/radar.qc | 409 ++++++++++++++++++ data/qcsrc/client/radar.qh | 9 + data/qcsrc/client/teamradar.qc | 409 ------------------ data/qcsrc/client/teamradar.qh | 9 - data/qcsrc/client/waypointsprites.qc | 14 +- .../dialog_multiplayer_playersetup_hud.c | 10 +- data/qcsrc/server/assault.qc | 2 +- data/qcsrc/server/cl_impulse.qc | 20 +- data/qcsrc/server/ctf.qc | 8 +- data/qcsrc/server/domination.qc | 6 +- data/qcsrc/server/keyhunt.qc | 4 +- data/qcsrc/server/mode_onslaught.qc | 16 +- data/qcsrc/server/t_items.qc | 2 +- data/qcsrc/server/waypointsprites.qc | 2 +- docs/TODO.txt | 4 +- 21 files changed, 475 insertions(+), 477 deletions(-) rename data/gfx/{teamradar_icon_1.tga => radar_icon_1.tga} (100%) rename data/gfx/{teamradar_icon_2.tga => radar_icon_2.tga} (100%) rename data/gfx/{teamradar_ping.tga => radar_ping.tga} (100%) create mode 100644 data/qcsrc/client/radar.qc create mode 100644 data/qcsrc/client/radar.qh delete mode 100644 data/qcsrc/client/teamradar.qc delete mode 100644 data/qcsrc/client/teamradar.qh diff --git a/data/defaultVT.cfg b/data/defaultVT.cfg index b655404e..30179cbc 100644 --- a/data/defaultVT.cfg +++ b/data/defaultVT.cfg @@ -1381,15 +1381,15 @@ seta cl_weaponpriority_useforcycling 0 "when set, weapon cycling by the mouse wh seta sv_status_privacy 1 "hide IP addresses from \"status\" replies shown to clients" -seta cl_teamradar 1 "show radar in teammatches when available" -seta cl_teamradar_background_alpha 0.6 "set to -1 to disable" -seta cl_teamradar_foreground_alpha 0.8 "alpha of the map" -seta cl_teamradar_scale 4096 "distance you can see on the team radar" -seta cl_teamradar_rotation 0 "rotation mode: you set what points up. 0 = player, 1 = west, 2 = south, 3 = east, 4 = north" -seta cl_teamradar_size "128 128" "size of the team radar in pixels" -seta cl_teamradar_position "1 0" "1 0 would be upper right corner, 0.5 0.5 the center, append a 2 at the end to disable the corner hack, and a 1 to disable half the hack" -seta cl_teamradar_zoommode 0 "zoom mode: 0 = zoomed by default, 1 = zoomed when +zoom, 2 = always zoomed, 3 = always zoomed out" -alias cl_teamradar_rotate "toggle cl_teamradar_rotation 0 1 2 3 4" +seta cl_radar 2 "show radar. 1 in team maches, 2 always" +seta cl_radar_background_alpha -1 "set to -1 to disable" +seta cl_radar_foreground_alpha 0.8 "alpha of the map" +seta cl_radar_scale 4096 "distance you can see on the radar" +seta cl_radar_rotation 0 "rotation mode: you set what points up. 0 = player, 1 = west, 2 = south, 3 = east, 4 = north" +seta cl_radar_size "128 128" "size of the radar in pixels" +seta cl_radar_position "1 0" "1 0 would be upper right corner, 0.5 0.5 the center, append a 2 at the end to disable the corner hack, and a 1 to disable half the hack" +seta cl_radar_zoommode 0 "zoom mode: 0 = zoomed by default, 1 = zoomed when +zoom, 2 = always zoomed, 3 = always zoomed out" +alias cl_radar_rotate "toggle cl_radar_rotation 0 1 2 3 4" set g_maplist_allow_hidden 0 "allow hidden maps to be, e.g., voted for and in the maplist" set g_maplist_allow_frustrating 0 "allow impossible maps to be, e.g., voted for and in the maplist (if set to 2, ONLY impossible maps are allowed)" diff --git a/data/gfx/teamradar_icon_1.tga b/data/gfx/radar_icon_1.tga similarity index 100% rename from data/gfx/teamradar_icon_1.tga rename to data/gfx/radar_icon_1.tga diff --git a/data/gfx/teamradar_icon_2.tga b/data/gfx/radar_icon_2.tga similarity index 100% rename from data/gfx/teamradar_icon_2.tga rename to data/gfx/radar_icon_2.tga diff --git a/data/gfx/teamradar_ping.tga b/data/gfx/radar_ping.tga similarity index 100% rename from data/gfx/teamradar_ping.tga rename to data/gfx/radar_ping.tga diff --git a/data/qcsrc/client/View.qc b/data/qcsrc/client/View.qc index 3e48e2d3..8a7462fc 100644 --- a/data/qcsrc/client/View.qc +++ b/data/qcsrc/client/View.qc @@ -1036,16 +1036,16 @@ void CSQC_UpdateView(float w, float h) ( !scoreboard_active && - cvar_string("cl_teamradar") != "0" + cvar_string("cl_radar") != "0" && ( - cvar("cl_teamradar") == 2 + cvar("cl_radar") == 2 || teamplay ) ) ) - teamradar_view(); + radar_view(); // Draw artwork and play intermission music if(intermission && !isdemo() && gametype != GAME_RPG && !spectatee_status) // the match has ended. Don't do this for RPG because no one wins or loses there diff --git a/data/qcsrc/client/progs.src b/data/qcsrc/client/progs.src index 8d8e56b8..dd2592cf 100644 --- a/data/qcsrc/client/progs.src +++ b/data/qcsrc/client/progs.src @@ -20,7 +20,7 @@ csqc_builtins.qc autocvars.qh interpolate.qh -teamradar.qh +radar.qh waypointsprites.qh movetypes.qh prandom.qh @@ -57,7 +57,7 @@ shownames.qc Main.qc View.qc interpolate.qc -teamradar.qc +radar.qc waypointsprites.qc movetypes.qc prandom.qc diff --git a/data/qcsrc/client/radar.qc b/data/qcsrc/client/radar.qc new file mode 100644 index 00000000..c0778f51 --- /dev/null +++ b/data/qcsrc/client/radar.qc @@ -0,0 +1,409 @@ +float radar_angle; // player yaw angle +vector radar_origin3d_in_texcoord; // player origin +vector radar_origin2d; // 2D origin +vector radar_size2d; // 2D size +vector radar_extraclip_mins, radar_extraclip_maxs; // don't even ask +float radar_size; // 2D scale factor +float cl_radar_scale; // window size = ...qu +float cl_radar_nohudhack; +float v_flipped; + +float vlen2d(vector v) +{ + return sqrt(v_x * v_x + v_y * v_y); +} + +float vlen_maxnorm2d(vector v) +{ + return max4(v_x, v_y, -v_x, -v_y); +} + +float vlen_minnorm2d(vector v) +{ + return min(max(v_x, -v_x), max(v_y, -v_y)); +} + +vector radar_3dcoord_to_texcoord(vector in) +{ + vector out; + out_x = (in_x - mi_picmin_x) / (mi_picmax_x - mi_picmin_x); + out_y = (in_y - mi_picmin_y) / (mi_picmax_y - mi_picmin_y); + out_z = 0; + return out; +} + +vector radar_texcoord_to_2dcoord(vector in) +{ + vector out; + in -= radar_origin3d_in_texcoord; + + out = rotate(in, radar_angle * DEG2RAD); + out_y = - out_y; // screen space is reversed + + out = out * radar_size; + if(v_flipped) + out_x = -out_x; + out += radar_origin2d; + return out; +} + +vector yinvert(vector v) +{ + v_y = 1 - v_y; + return v; +} + +void draw_radar_background(float bg, float fg) +{ + float fga; + vector fgc; + if(bg > 0) + { + R_BeginPolygon("", 0); + R_PolygonVertex('1 0 0' * (radar_origin2d_x - radar_size2d_x * 0.5 + radar_extraclip_mins_x) + '0 1 0' * (radar_origin2d_y - radar_size2d_y * 0.5 + radar_extraclip_mins_y), '0 0 0', '0 0 0', bg); + R_PolygonVertex('1 0 0' * (radar_origin2d_x + radar_size2d_x * 0.5 + radar_extraclip_maxs_x) + '0 1 0' * (radar_origin2d_y - radar_size2d_y * 0.5 + radar_extraclip_mins_y), '0 0 0', '0 0 0', bg); + R_PolygonVertex('1 0 0' * (radar_origin2d_x + radar_size2d_x * 0.5 + radar_extraclip_maxs_x) + '0 1 0' * (radar_origin2d_y + radar_size2d_y * 0.5 + radar_extraclip_maxs_y), '0 0 0', '0 0 0', bg); + R_PolygonVertex('1 0 0' * (radar_origin2d_x - radar_size2d_x * 0.5 + radar_extraclip_mins_x) + '0 1 0' * (radar_origin2d_y + radar_size2d_y * 0.5 + radar_extraclip_maxs_y), '0 0 0', '0 0 0', bg); + R_EndPolygon(); + } + + if(fg > 0 && minimapname != "") + { + fga = 1; + fgc = '1 1 1' * fg; + R_BeginPolygon(minimapname, DRAWFLAG_SCREEN | DRAWFLAG_MIPMAP); + if(v_flipped) + { + R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord3), yinvert(mi_pictexcoord3), fgc, fga); + R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord2), yinvert(mi_pictexcoord2), fgc, fga); + R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord1), yinvert(mi_pictexcoord1), fgc, fga); + R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord0), yinvert(mi_pictexcoord0), fgc, fga); + } + else + { + R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord0), yinvert(mi_pictexcoord0), fgc, fga); + R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord1), yinvert(mi_pictexcoord1), fgc, fga); + R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord2), yinvert(mi_pictexcoord2), fgc, fga); + R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord3), yinvert(mi_pictexcoord3), fgc, fga); + } + R_EndPolygon(); + } +} + +void(vector coord3d, vector pangles, vector rgb) draw_radar_player = +{ + vector coord, rgb2; + + coord = radar_texcoord_to_2dcoord(radar_3dcoord_to_texcoord(coord3d)); + + makevectors(pangles - '0 1 0' * radar_angle); + if(v_flipped) + { + v_forward_x = -v_forward_x; + v_right_x = -v_right_x; + v_up_x = -v_up_x; + } + v_forward_z = 0; + v_forward = normalize(v_forward); + v_forward_y *= -1.0; + v_right_x = -v_forward_y; + v_right_y = v_forward_x; + + if(rgb == '1 1 1') + rgb2 = '0 0 0'; + else + rgb2 = '1 1 1'; + + R_BeginPolygon("", 0); + R_PolygonVertex(coord+v_forward*3, '0 0 0', rgb2, sbar_alpha_fg); + R_PolygonVertex(coord+v_right*4-v_forward*2.5, '0 1 0', rgb2, sbar_alpha_fg); + R_PolygonVertex(coord-v_forward*2, '1 0 0', rgb2, sbar_alpha_fg); + R_PolygonVertex(coord-v_right*4-v_forward*2.5, '1 1 0', rgb2, sbar_alpha_fg); + R_EndPolygon(); + + R_BeginPolygon("", 0); + R_PolygonVertex(coord+v_forward*2, '0 0 0', rgb, sbar_alpha_fg); + R_PolygonVertex(coord+v_right*3-v_forward*2, '0 1 0', rgb, sbar_alpha_fg); + R_PolygonVertex(coord-v_forward, '1 0 0', rgb, sbar_alpha_fg); + R_PolygonVertex(coord-v_right*3-v_forward*2, '1 1 0', rgb, sbar_alpha_fg); + R_EndPolygon(); +}; + +void draw_radar_icon(vector coord, float icon, entity pingdata, vector rgb, float a) +{ + float dt; + vector v; + float i; + + coord = radar_texcoord_to_2dcoord(radar_3dcoord_to_texcoord(coord)); + drawpic(coord - '4 4 0', strcat("gfx/radar_icon_", ftos(icon)), '8 8 0', rgb, a, 0); + + if(pingdata) + { + for(i = 0; i < MAX_RADAR_TIMES; ++i) + { + dt = pingdata.(radar_times[i]); + if(dt == 0) + continue; + dt = time - dt; + if(dt >= 1 || dt <= 0) + continue; + v = '2 2 0' * radar_size * dt; + drawpic(coord - 0.5 * v, "gfx/radar_ping", v, '1 1 1', (1 - dt) * a, DRAWFLAG_ADDITIVE); + } + } +} + +void draw_radar_link(vector start, vector end, float colors) +{ + vector c0, c1, norm; + + start = radar_texcoord_to_2dcoord(radar_3dcoord_to_texcoord(start)); + end = radar_texcoord_to_2dcoord(radar_3dcoord_to_texcoord(end)); + norm = normalize(start - end); + norm_z = norm_x; + norm_x = -norm_y; + norm_y = norm_z; + norm_z = 0; + + c0 = colormapPaletteColor(colors & 0x0F, FALSE); + c1 = colormapPaletteColor((colors & 0xF0) / 0x10, FALSE); + + R_BeginPolygon("", 0); + R_PolygonVertex(start - norm, '0 0 0', c0, sbar_alpha_fg); + R_PolygonVertex(start + norm, '0 1 0', c0, sbar_alpha_fg); + R_PolygonVertex(end + norm, '1 1 0', c1, sbar_alpha_fg); + R_PolygonVertex(end - norm, '1 0 0', c1, sbar_alpha_fg); + R_EndPolygon(); +} + +float cl_radar_scale; +float cl_radar_background_alpha; +float cl_radar_foreground_alpha; +float cl_radar_rotation; +vector cl_radar_size; +vector cl_radar_position; +float cl_radar_zoommode; + +void radar_loadcvars() +{ + v_flipped = cvar("v_flipped"); + if(ons_showmap) + { + cl_radar_scale = 42; // dummy, not used (see zoommode) + cl_radar_background_alpha = 1 * (1 - cvar("_menu_alpha")); + cl_radar_foreground_alpha = 1 * (1 - cvar("_menu_alpha")); + cl_radar_rotation = cvar("cl_radar_rotation"); + if(!cl_radar_rotation) + cl_radar_rotation = 4; + cl_radar_size = '256 256 0'; // TODO make somewhat variable? + cl_radar_position = '0.5 0.5 0'; + cl_radar_zoommode = 3; + cl_radar_nohudhack = 0; + } + else + { + cl_radar_scale = cvar("cl_radar_scale"); + cl_radar_background_alpha = cvar("cl_radar_background_alpha") * sbar_alpha_fg; + cl_radar_foreground_alpha = cvar("cl_radar_foreground_alpha") * sbar_alpha_fg; + cl_radar_rotation = cvar("cl_radar_rotation"); + cl_radar_size = stov(cvar_string("cl_radar_size")); + cl_radar_position = stov(cvar_string("cl_radar_position")); + cl_radar_zoommode = cvar("cl_radar_zoommode"); + + // others default to 0 + // match this to defaultVoretournament.cfg! + if(!cl_radar_scale) cl_radar_scale = 4096; + if(!cl_radar_background_alpha) cl_radar_background_alpha = 0.4 * sbar_alpha_fg; + if(!cl_radar_foreground_alpha) cl_radar_foreground_alpha = 0.8 * sbar_alpha_fg; + if(!cl_radar_size_x) cl_radar_size_x = 128; + if(!cl_radar_size_y) cl_radar_size_y = cl_radar_size_x; + + cl_radar_size_z = 0; + cl_radar_nohudhack = cl_radar_position_z; + cl_radar_position_z = 0; + } +} + +void() radar_view = +{ + local float color1, color2; // color already declared as a global in hud.qc + local vector rgb; + local entity tm; + float scale2d, normalsize, bigsize; + float f; + + if(minimapname == "" && !ons_showmap) + return; + + radar_loadcvars(); + + switch(cl_radar_zoommode) + { + default: + case 0: + f = current_zoomfraction; + break; + case 1: + f = 1 - current_zoomfraction; + break; + case 2: + f = 0; + break; + case 3: + f = 1; + break; + } + + switch(cl_radar_rotation) + { + case 0: + radar_angle = view_angles_y - 90; + break; + default: + radar_angle = 90 * cl_radar_rotation; + break; + } + + scale2d = vlen_maxnorm2d(mi_picmax - mi_picmin); + radar_size2d = cl_radar_size; + + radar_origin2d = + '1 0 0' * (0.5 * radar_size2d_x + cl_radar_position_x * (vid_conwidth - radar_size2d_x)) + + '0 1 0' * (0.5 * radar_size2d_y + cl_radar_position_y * (vid_conheight - radar_size2d_y)); + + radar_extraclip_mins = radar_extraclip_maxs = '0 0 0'; + if(cl_radar_position == '1 0 0') + { + if(cl_radar_nohudhack < 2) + radar_origin2d_y += 25; + if(cl_radar_nohudhack < 1) + radar_extraclip_mins_y -= 25; + } + else if(cl_radar_position == '0 1 0' || cl_radar_position == '1 1 0') + { + if(cl_radar_nohudhack < 2) + radar_origin2d_y -= 50; + //if(cl_radar_nohudhack < 1) + //radar_extraclip_size_y += 50; // don't, the HUD looks nice + } + + // pixels per world qu to match the radar_size2d_x range in the longest dimension + if(cl_radar_rotation == 0) + { + // max-min distance must fit the radar in any rotation + bigsize = vlen_minnorm2d(radar_size2d) * scale2d / (1.05 * vlen2d(mi_max - mi_min)); + } + else + { + vector c0, c1, c2, c3, span; + c0 = rotate(mi_min, radar_angle * DEG2RAD); + c1 = rotate(mi_max, radar_angle * DEG2RAD); + c2 = rotate('1 0 0' * mi_min_x + '0 1 0' * mi_max_y, radar_angle * DEG2RAD); + c3 = rotate('1 0 0' * mi_max_x + '0 1 0' * mi_min_y, radar_angle * DEG2RAD); + span = '0 0 0'; + span_x = max4(c0_x, c1_x, c2_x, c3_x) - min4(c0_x, c1_x, c2_x, c3_x); + span_y = max4(c0_y, c1_y, c2_y, c3_y) - min4(c0_y, c1_y, c2_y, c3_y); + + // max-min distance must fit the radar in x=x, y=y + bigsize = min( + radar_size2d_x * scale2d / (1.05 * span_x), + radar_size2d_y * scale2d / (1.05 * span_y) + ); + } + + normalsize = vlen_maxnorm2d(radar_size2d) * scale2d / cl_radar_scale; + if(bigsize > normalsize) + normalsize = bigsize; + + radar_size = + f * bigsize + + (1 - f) * normalsize; + radar_origin3d_in_texcoord = radar_3dcoord_to_texcoord( + f * (mi_min + mi_max) * 0.5 + + (1 - f) * view_origin); + + color1 = GetPlayerColor(player_localentnum-1); + rgb = GetTeamRGB(color1); + + drawsetcliparea( + radar_origin2d_x - radar_size2d_x * 0.5 + radar_extraclip_mins_x, + radar_origin2d_y - radar_size2d_y * 0.5 + radar_extraclip_mins_y, + radar_size2d_x + radar_extraclip_maxs_x - radar_extraclip_mins_x, + radar_size2d_y + radar_extraclip_maxs_y - radar_extraclip_mins_y + ); + + draw_radar_background(cl_radar_background_alpha, cl_radar_foreground_alpha); + + if(ons_showmap) + { + drawresetcliparea(); + + vector frame_origin, frame_size; + frame_origin = frame_size = '0 0 0'; + + frame_origin_x = radar_origin2d_x - radar_size2d_x * 0.55859375; // matches the picture + frame_origin_y = radar_origin2d_y - radar_size2d_y * 0.55859375; // matches the picture + frame_size_x = radar_size2d_x * 1.1171875; // matches the picture + frame_size_y = radar_size2d_y * 1.1171875; // matches the picture + drawpic(frame_origin, "gfx/ons-frame.tga", frame_size, '1 1 1', sbar_alpha_fg, 0); + drawpic(frame_origin, "gfx/ons-frame-team.tga", frame_size, rgb, sbar_alpha_fg, 0); + + drawsetcliparea( + radar_origin2d_x - radar_size2d_x * 0.5, + radar_origin2d_y - radar_size2d_y * 0.5, + radar_size2d_x, + radar_size2d_y + ); + } + + for(tm = world; (tm = find(tm, classname, "radarlink")); ) + draw_radar_link(tm.origin, tm.velocity, tm.team); + for(tm = world; (tm = findflags(tm, radar_icon, 0xFFFFFF)); ) + draw_radar_icon(tm.origin, tm.radar_icon, tm, tm.radar_color, tm.alpha * sbar_alpha_fg); + for(tm = world; (tm = find(tm, classname, "entcs_receiver")); ) + { + color2 = GetPlayerColor(tm.sv_entnum); + //if(color == COLOR_SPECTATOR || color == color2) + draw_radar_player(tm.origin, tm.angles, GetTeamRGB(color2)); + } + draw_radar_player(view_origin, view_angles, '1 1 1'); + + drawresetcliparea(); +}; + + + +// radar links + +void Ent_RadarLink() +{ + float sendflags; + sendflags = ReadByte(); + + InterpolateOrigin_Undo(); + + self.iflags = IFLAG_VELOCITY; + self.classname = "radarlink"; + + if(sendflags & 1) + { + self.origin_x = ReadCoord(); + self.origin_y = ReadCoord(); + self.origin_z = ReadCoord(); + } + + if(sendflags & 2) + { + self.velocity_x = ReadCoord(); + self.velocity_y = ReadCoord(); + self.velocity_z = ReadCoord(); + } + + if(sendflags & 4) + { + self.team = ReadByte(); + } + + InterpolateOrigin_Note(); +} diff --git a/data/qcsrc/client/radar.qh b/data/qcsrc/client/radar.qh new file mode 100644 index 00000000..8b702c45 --- /dev/null +++ b/data/qcsrc/client/radar.qh @@ -0,0 +1,9 @@ +void radar_view(); + +#define MAX_RADAR_TIMES 32 + +// to make entities have dots on the team radar +.float radar_icon; +.float radar_times[MAX_RADAR_TIMES]; +.float radar_time_index; +.vector radar_color; diff --git a/data/qcsrc/client/teamradar.qc b/data/qcsrc/client/teamradar.qc deleted file mode 100644 index 9e668653..00000000 --- a/data/qcsrc/client/teamradar.qc +++ /dev/null @@ -1,409 +0,0 @@ -float teamradar_angle; // player yaw angle -vector teamradar_origin3d_in_texcoord; // player origin -vector teamradar_origin2d; // 2D origin -vector teamradar_size2d; // 2D size -vector teamradar_extraclip_mins, teamradar_extraclip_maxs; // don't even ask -float teamradar_size; // 2D scale factor -float cl_teamradar_scale; // window size = ...qu -float cl_teamradar_nohudhack; -float v_flipped; - -float vlen2d(vector v) -{ - return sqrt(v_x * v_x + v_y * v_y); -} - -float vlen_maxnorm2d(vector v) -{ - return max4(v_x, v_y, -v_x, -v_y); -} - -float vlen_minnorm2d(vector v) -{ - return min(max(v_x, -v_x), max(v_y, -v_y)); -} - -vector teamradar_3dcoord_to_texcoord(vector in) -{ - vector out; - out_x = (in_x - mi_picmin_x) / (mi_picmax_x - mi_picmin_x); - out_y = (in_y - mi_picmin_y) / (mi_picmax_y - mi_picmin_y); - out_z = 0; - return out; -} - -vector teamradar_texcoord_to_2dcoord(vector in) -{ - vector out; - in -= teamradar_origin3d_in_texcoord; - - out = rotate(in, teamradar_angle * DEG2RAD); - out_y = - out_y; // screen space is reversed - - out = out * teamradar_size; - if(v_flipped) - out_x = -out_x; - out += teamradar_origin2d; - return out; -} - -vector yinvert(vector v) -{ - v_y = 1 - v_y; - return v; -} - -void draw_teamradar_background(float bg, float fg) -{ - float fga; - vector fgc; - if(bg > 0) - { - R_BeginPolygon("", 0); - R_PolygonVertex('1 0 0' * (teamradar_origin2d_x - teamradar_size2d_x * 0.5 + teamradar_extraclip_mins_x) + '0 1 0' * (teamradar_origin2d_y - teamradar_size2d_y * 0.5 + teamradar_extraclip_mins_y), '0 0 0', '0 0 0', bg); - R_PolygonVertex('1 0 0' * (teamradar_origin2d_x + teamradar_size2d_x * 0.5 + teamradar_extraclip_maxs_x) + '0 1 0' * (teamradar_origin2d_y - teamradar_size2d_y * 0.5 + teamradar_extraclip_mins_y), '0 0 0', '0 0 0', bg); - R_PolygonVertex('1 0 0' * (teamradar_origin2d_x + teamradar_size2d_x * 0.5 + teamradar_extraclip_maxs_x) + '0 1 0' * (teamradar_origin2d_y + teamradar_size2d_y * 0.5 + teamradar_extraclip_maxs_y), '0 0 0', '0 0 0', bg); - R_PolygonVertex('1 0 0' * (teamradar_origin2d_x - teamradar_size2d_x * 0.5 + teamradar_extraclip_mins_x) + '0 1 0' * (teamradar_origin2d_y + teamradar_size2d_y * 0.5 + teamradar_extraclip_maxs_y), '0 0 0', '0 0 0', bg); - R_EndPolygon(); - } - - if(fg > 0 && minimapname != "") - { - fga = 1; - fgc = '1 1 1' * fg; - R_BeginPolygon(minimapname, DRAWFLAG_SCREEN | DRAWFLAG_MIPMAP); - if(v_flipped) - { - R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord3), yinvert(mi_pictexcoord3), fgc, fga); - R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord2), yinvert(mi_pictexcoord2), fgc, fga); - R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord1), yinvert(mi_pictexcoord1), fgc, fga); - R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord0), yinvert(mi_pictexcoord0), fgc, fga); - } - else - { - R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord0), yinvert(mi_pictexcoord0), fgc, fga); - R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord1), yinvert(mi_pictexcoord1), fgc, fga); - R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord2), yinvert(mi_pictexcoord2), fgc, fga); - R_PolygonVertex(teamradar_texcoord_to_2dcoord(mi_pictexcoord3), yinvert(mi_pictexcoord3), fgc, fga); - } - R_EndPolygon(); - } -} - -void(vector coord3d, vector pangles, vector rgb) draw_teamradar_player = -{ - vector coord, rgb2; - - coord = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(coord3d)); - - makevectors(pangles - '0 1 0' * teamradar_angle); - if(v_flipped) - { - v_forward_x = -v_forward_x; - v_right_x = -v_right_x; - v_up_x = -v_up_x; - } - v_forward_z = 0; - v_forward = normalize(v_forward); - v_forward_y *= -1.0; - v_right_x = -v_forward_y; - v_right_y = v_forward_x; - - if(rgb == '1 1 1') - rgb2 = '0 0 0'; - else - rgb2 = '1 1 1'; - - R_BeginPolygon("", 0); - R_PolygonVertex(coord+v_forward*3, '0 0 0', rgb2, sbar_alpha_fg); - R_PolygonVertex(coord+v_right*4-v_forward*2.5, '0 1 0', rgb2, sbar_alpha_fg); - R_PolygonVertex(coord-v_forward*2, '1 0 0', rgb2, sbar_alpha_fg); - R_PolygonVertex(coord-v_right*4-v_forward*2.5, '1 1 0', rgb2, sbar_alpha_fg); - R_EndPolygon(); - - R_BeginPolygon("", 0); - R_PolygonVertex(coord+v_forward*2, '0 0 0', rgb, sbar_alpha_fg); - R_PolygonVertex(coord+v_right*3-v_forward*2, '0 1 0', rgb, sbar_alpha_fg); - R_PolygonVertex(coord-v_forward, '1 0 0', rgb, sbar_alpha_fg); - R_PolygonVertex(coord-v_right*3-v_forward*2, '1 1 0', rgb, sbar_alpha_fg); - R_EndPolygon(); -}; - -void draw_teamradar_icon(vector coord, float icon, entity pingdata, vector rgb, float a) -{ - float dt; - vector v; - float i; - - coord = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(coord)); - drawpic(coord - '4 4 0', strcat("gfx/teamradar_icon_", ftos(icon)), '8 8 0', rgb, a, 0); - - if(pingdata) - { - for(i = 0; i < MAX_TEAMRADAR_TIMES; ++i) - { - dt = pingdata.(teamradar_times[i]); - if(dt == 0) - continue; - dt = time - dt; - if(dt >= 1 || dt <= 0) - continue; - v = '2 2 0' * teamradar_size * dt; - drawpic(coord - 0.5 * v, "gfx/teamradar_ping", v, '1 1 1', (1 - dt) * a, DRAWFLAG_ADDITIVE); - } - } -} - -void draw_teamradar_link(vector start, vector end, float colors) -{ - vector c0, c1, norm; - - start = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(start)); - end = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(end)); - norm = normalize(start - end); - norm_z = norm_x; - norm_x = -norm_y; - norm_y = norm_z; - norm_z = 0; - - c0 = colormapPaletteColor(colors & 0x0F, FALSE); - c1 = colormapPaletteColor((colors & 0xF0) / 0x10, FALSE); - - R_BeginPolygon("", 0); - R_PolygonVertex(start - norm, '0 0 0', c0, sbar_alpha_fg); - R_PolygonVertex(start + norm, '0 1 0', c0, sbar_alpha_fg); - R_PolygonVertex(end + norm, '1 1 0', c1, sbar_alpha_fg); - R_PolygonVertex(end - norm, '1 0 0', c1, sbar_alpha_fg); - R_EndPolygon(); -} - -float cl_teamradar_scale; -float cl_teamradar_background_alpha; -float cl_teamradar_foreground_alpha; -float cl_teamradar_rotation; -vector cl_teamradar_size; -vector cl_teamradar_position; -float cl_teamradar_zoommode; - -void teamradar_loadcvars() -{ - v_flipped = cvar("v_flipped"); - if(ons_showmap) - { - cl_teamradar_scale = 42; // dummy, not used (see zoommode) - cl_teamradar_background_alpha = 1 * (1 - cvar("_menu_alpha")); - cl_teamradar_foreground_alpha = 1 * (1 - cvar("_menu_alpha")); - cl_teamradar_rotation = cvar("cl_teamradar_rotation"); - if(!cl_teamradar_rotation) - cl_teamradar_rotation = 4; - cl_teamradar_size = '256 256 0'; // TODO make somewhat variable? - cl_teamradar_position = '0.5 0.5 0'; - cl_teamradar_zoommode = 3; - cl_teamradar_nohudhack = 0; - } - else - { - cl_teamradar_scale = cvar("cl_teamradar_scale"); - cl_teamradar_background_alpha = cvar("cl_teamradar_background_alpha") * sbar_alpha_fg; - cl_teamradar_foreground_alpha = cvar("cl_teamradar_foreground_alpha") * sbar_alpha_fg; - cl_teamradar_rotation = cvar("cl_teamradar_rotation"); - cl_teamradar_size = stov(cvar_string("cl_teamradar_size")); - cl_teamradar_position = stov(cvar_string("cl_teamradar_position")); - cl_teamradar_zoommode = cvar("cl_teamradar_zoommode"); - - // others default to 0 - // match this to defaultVoretournament.cfg! - if(!cl_teamradar_scale) cl_teamradar_scale = 4096; - if(!cl_teamradar_background_alpha) cl_teamradar_background_alpha = 0.4 * sbar_alpha_fg; - if(!cl_teamradar_foreground_alpha) cl_teamradar_foreground_alpha = 0.8 * sbar_alpha_fg; - if(!cl_teamradar_size_x) cl_teamradar_size_x = 128; - if(!cl_teamradar_size_y) cl_teamradar_size_y = cl_teamradar_size_x; - - cl_teamradar_size_z = 0; - cl_teamradar_nohudhack = cl_teamradar_position_z; - cl_teamradar_position_z = 0; - } -} - -void() teamradar_view = -{ - local float color1, color2; // color already declared as a global in hud.qc - local vector rgb; - local entity tm; - float scale2d, normalsize, bigsize; - float f; - - if(minimapname == "" && !ons_showmap) - return; - - teamradar_loadcvars(); - - switch(cl_teamradar_zoommode) - { - default: - case 0: - f = current_zoomfraction; - break; - case 1: - f = 1 - current_zoomfraction; - break; - case 2: - f = 0; - break; - case 3: - f = 1; - break; - } - - switch(cl_teamradar_rotation) - { - case 0: - teamradar_angle = view_angles_y - 90; - break; - default: - teamradar_angle = 90 * cl_teamradar_rotation; - break; - } - - scale2d = vlen_maxnorm2d(mi_picmax - mi_picmin); - teamradar_size2d = cl_teamradar_size; - - teamradar_origin2d = - '1 0 0' * (0.5 * teamradar_size2d_x + cl_teamradar_position_x * (vid_conwidth - teamradar_size2d_x)) - + '0 1 0' * (0.5 * teamradar_size2d_y + cl_teamradar_position_y * (vid_conheight - teamradar_size2d_y)); - - teamradar_extraclip_mins = teamradar_extraclip_maxs = '0 0 0'; - if(cl_teamradar_position == '1 0 0') - { - if(cl_teamradar_nohudhack < 2) - teamradar_origin2d_y += 25; - if(cl_teamradar_nohudhack < 1) - teamradar_extraclip_mins_y -= 25; - } - else if(cl_teamradar_position == '0 1 0' || cl_teamradar_position == '1 1 0') - { - if(cl_teamradar_nohudhack < 2) - teamradar_origin2d_y -= 50; - //if(cl_teamradar_nohudhack < 1) - //teamradar_extraclip_size_y += 50; // don't, the HUD looks nice - } - - // pixels per world qu to match the teamradar_size2d_x range in the longest dimension - if(cl_teamradar_rotation == 0) - { - // max-min distance must fit the radar in any rotation - bigsize = vlen_minnorm2d(teamradar_size2d) * scale2d / (1.05 * vlen2d(mi_max - mi_min)); - } - else - { - vector c0, c1, c2, c3, span; - c0 = rotate(mi_min, teamradar_angle * DEG2RAD); - c1 = rotate(mi_max, teamradar_angle * DEG2RAD); - c2 = rotate('1 0 0' * mi_min_x + '0 1 0' * mi_max_y, teamradar_angle * DEG2RAD); - c3 = rotate('1 0 0' * mi_max_x + '0 1 0' * mi_min_y, teamradar_angle * DEG2RAD); - span = '0 0 0'; - span_x = max4(c0_x, c1_x, c2_x, c3_x) - min4(c0_x, c1_x, c2_x, c3_x); - span_y = max4(c0_y, c1_y, c2_y, c3_y) - min4(c0_y, c1_y, c2_y, c3_y); - - // max-min distance must fit the radar in x=x, y=y - bigsize = min( - teamradar_size2d_x * scale2d / (1.05 * span_x), - teamradar_size2d_y * scale2d / (1.05 * span_y) - ); - } - - normalsize = vlen_maxnorm2d(teamradar_size2d) * scale2d / cl_teamradar_scale; - if(bigsize > normalsize) - normalsize = bigsize; - - teamradar_size = - f * bigsize - + (1 - f) * normalsize; - teamradar_origin3d_in_texcoord = teamradar_3dcoord_to_texcoord( - f * (mi_min + mi_max) * 0.5 - + (1 - f) * view_origin); - - color1 = GetPlayerColor(player_localentnum-1); - rgb = GetTeamRGB(color1); - - drawsetcliparea( - teamradar_origin2d_x - teamradar_size2d_x * 0.5 + teamradar_extraclip_mins_x, - teamradar_origin2d_y - teamradar_size2d_y * 0.5 + teamradar_extraclip_mins_y, - teamradar_size2d_x + teamradar_extraclip_maxs_x - teamradar_extraclip_mins_x, - teamradar_size2d_y + teamradar_extraclip_maxs_y - teamradar_extraclip_mins_y - ); - - draw_teamradar_background(cl_teamradar_background_alpha, cl_teamradar_foreground_alpha); - - if(ons_showmap) - { - drawresetcliparea(); - - vector frame_origin, frame_size; - frame_origin = frame_size = '0 0 0'; - - frame_origin_x = teamradar_origin2d_x - teamradar_size2d_x * 0.55859375; // matches the picture - frame_origin_y = teamradar_origin2d_y - teamradar_size2d_y * 0.55859375; // matches the picture - frame_size_x = teamradar_size2d_x * 1.1171875; // matches the picture - frame_size_y = teamradar_size2d_y * 1.1171875; // matches the picture - drawpic(frame_origin, "gfx/ons-frame.tga", frame_size, '1 1 1', sbar_alpha_fg, 0); - drawpic(frame_origin, "gfx/ons-frame-team.tga", frame_size, rgb, sbar_alpha_fg, 0); - - drawsetcliparea( - teamradar_origin2d_x - teamradar_size2d_x * 0.5, - teamradar_origin2d_y - teamradar_size2d_y * 0.5, - teamradar_size2d_x, - teamradar_size2d_y - ); - } - - for(tm = world; (tm = find(tm, classname, "radarlink")); ) - draw_teamradar_link(tm.origin, tm.velocity, tm.team); - for(tm = world; (tm = findflags(tm, teamradar_icon, 0xFFFFFF)); ) - draw_teamradar_icon(tm.origin, tm.teamradar_icon, tm, tm.teamradar_color, tm.alpha * sbar_alpha_fg); - for(tm = world; (tm = find(tm, classname, "entcs_receiver")); ) - { - color2 = GetPlayerColor(tm.sv_entnum); - //if(color == COLOR_SPECTATOR || color == color2) - draw_teamradar_player(tm.origin, tm.angles, GetTeamRGB(color2)); - } - draw_teamradar_player(view_origin, view_angles, '1 1 1'); - - drawresetcliparea(); -}; - - - -// radar links - -void Ent_RadarLink() -{ - float sendflags; - sendflags = ReadByte(); - - InterpolateOrigin_Undo(); - - self.iflags = IFLAG_VELOCITY; - self.classname = "radarlink"; - - if(sendflags & 1) - { - self.origin_x = ReadCoord(); - self.origin_y = ReadCoord(); - self.origin_z = ReadCoord(); - } - - if(sendflags & 2) - { - self.velocity_x = ReadCoord(); - self.velocity_y = ReadCoord(); - self.velocity_z = ReadCoord(); - } - - if(sendflags & 4) - { - self.team = ReadByte(); - } - - InterpolateOrigin_Note(); -} diff --git a/data/qcsrc/client/teamradar.qh b/data/qcsrc/client/teamradar.qh deleted file mode 100644 index a892cc3e..00000000 --- a/data/qcsrc/client/teamradar.qh +++ /dev/null @@ -1,9 +0,0 @@ -void teamradar_view(); - -#define MAX_TEAMRADAR_TIMES 32 - -// to make entities have dots on the team radar -.float teamradar_icon; -.float teamradar_times[MAX_TEAMRADAR_TIMES]; -.float teamradar_time_index; -.vector teamradar_color; diff --git a/data/qcsrc/client/waypointsprites.qc b/data/qcsrc/client/waypointsprites.qc index 3d0d3084..020e8953 100644 --- a/data/qcsrc/client/waypointsprites.qc +++ b/data/qcsrc/client/waypointsprites.qc @@ -293,7 +293,7 @@ void Draw_WaypointSprite() align = 0.5; else align = 0; - drawhealthbar(o, rot * 90 * DEG2RAD, self.health, SPRITE_SIZE * t, SPRITE_HOTSPOT * t, SPRITE_HEALTHBAR_WIDTH * t, SPRITE_HEALTHBAR_HEIGHT * t, SPRITE_HEALTHBAR_MARGIN * t, SPRITE_HEALTHBAR_BORDER * t, align, self.teamradar_color, a * SPRITE_HEALTHBAR_BORDERALPHA, self.teamradar_color, a * SPRITE_HEALTHBAR_HEALTHALPHA, DRAWFLAG_NORMAL); + drawhealthbar(o, rot * 90 * DEG2RAD, self.health, SPRITE_SIZE * t, SPRITE_HOTSPOT * t, SPRITE_HEALTHBAR_WIDTH * t, SPRITE_HEALTHBAR_HEIGHT * t, SPRITE_HEALTHBAR_MARGIN * t, SPRITE_HEALTHBAR_BORDER * t, align, self.radar_color, a * SPRITE_HEALTHBAR_BORDERALPHA, self.radar_color, a * SPRITE_HEALTHBAR_HEALTHALPHA, DRAWFLAG_NORMAL); } } @@ -391,15 +391,15 @@ void Ent_WaypointSprite() if(sendflags & 32) { f = ReadByte(); - self.teamradar_icon = (f & 0x7F); + self.radar_icon = (f & 0x7F); if(f & 0x80) { - self.(teamradar_times[self.teamradar_time_index]) = time; - self.teamradar_time_index = mod(self.teamradar_time_index + 1, MAX_TEAMRADAR_TIMES); + self.(radar_times[self.radar_time_index]) = time; + self.radar_time_index = mod(self.radar_time_index + 1, MAX_RADAR_TIMES); } - self.teamradar_color_x = ReadByte() / 255.0; - self.teamradar_color_y = ReadByte() / 255.0; - self.teamradar_color_z = ReadByte() / 255.0; + self.radar_color_x = ReadByte() / 255.0; + self.radar_color_y = ReadByte() / 255.0; + self.radar_color_z = ReadByte() / 255.0; } InterpolateOrigin_Note(); diff --git a/data/qcsrc/menu/voret/dialog_multiplayer_playersetup_hud.c b/data/qcsrc/menu/voret/dialog_multiplayer_playersetup_hud.c index 317cac2e..7e4077c1 100644 --- a/data/qcsrc/menu/voret/dialog_multiplayer_playersetup_hud.c +++ b/data/qcsrc/menu/voret/dialog_multiplayer_playersetup_hud.c @@ -92,13 +92,13 @@ void fillVoretHudDialog(entity me) me.TR(me); me.TDempty(me, 0.2); me.TD(me, 1, 0.8, e = makeVoretTextLabel(0, "Position:")); - me.TD(me, 1, 1, e = makeVoretRadioButton(1, "cl_teamradar_position", "0 0", "Top left")); - me.TD(me, 1, 1, e = makeVoretRadioButton(1, "cl_teamradar_position", "0.5 0", "Top middle")); - me.TD(me, 1, 1, e = makeVoretRadioButton(1, "cl_teamradar_position", "1 0", "Top right")); + me.TD(me, 1, 1, e = makeVoretRadioButton(1, "cl_radar_position", "0 0", "Top left")); + me.TD(me, 1, 1, e = makeVoretRadioButton(1, "cl_radar_position", "0.5 0", "Top middle")); + me.TD(me, 1, 1, e = makeVoretRadioButton(1, "cl_radar_position", "1 0", "Top right")); me.TR(me); me.TDempty(me, 0.2); me.TD(me, 1, 0.8, e = makeVoretTextLabel(0, "Size:")); - me.TD(me, 1, 3, e = makeVoretTextSlider("cl_teamradar_size")); + me.TD(me, 1, 3, e = makeVoretTextSlider("cl_radar_size")); e.addValue(e, "96x96", "96 96"); e.addValue(e, "128x96", "128 96"); e.addValue(e, "128x128", "128 128"); @@ -109,7 +109,7 @@ void fillVoretHudDialog(entity me) e.configureVoretTextSliderValues(e); me.TR(me); me.TDempty(me, 0.2); - sl = makeVoretSlider(0.20, 1, 0.01, "cl_teamradar_background_alpha"); + sl = makeVoretSlider(0.20, 1, 0.01, "cl_radar_background_alpha"); me.TD(me, 1, 0.8, e = makeVoretSliderCheckBox(-1, 1, sl, "Background:")); me.TD(me, 1, 3, sl); me.TR(me); diff --git a/data/qcsrc/server/assault.qc b/data/qcsrc/server/assault.qc index 91941e3c..8f4148cd 100644 --- a/data/qcsrc/server/assault.qc +++ b/data/qcsrc/server/assault.qc @@ -148,7 +148,7 @@ void target_objective_decrease_activate() WaypointSprite_UpdateSprites(spr, "as-defend", "as-destroy", "as-destroy"); else WaypointSprite_UpdateSprites(spr, "as-defend", "as-push", "as-push"); - WaypointSprite_UpdateTeamRadar(spr, RADARICON_OBJECTIVE, '1 0.5 0'); + WaypointSprite_UpdateRadar(spr, RADARICON_OBJECTIVE, '1 0.5 0'); } } diff --git a/data/qcsrc/server/cl_impulse.qc b/data/qcsrc/server/cl_impulse.qc index f3d35ea0..e52b0e13 100644 --- a/data/qcsrc/server/cl_impulse.qc +++ b/data/qcsrc/server/cl_impulse.qc @@ -133,7 +133,7 @@ void ImpulseCommands (void) wp = WaypointSprite_DeployPersonal("waypoint", self.origin); if(wp) { - WaypointSprite_UpdateTeamRadar(wp, RADARICON_WAYPOINT, '0 1 1'); + WaypointSprite_UpdateRadar(wp, RADARICON_WAYPOINT, '0 1 1'); WaypointSprite_Ping(wp); } sprint(self, "personal waypoint spawned at location\n"); @@ -143,7 +143,7 @@ void ImpulseCommands (void) wp = WaypointSprite_DeployPersonal("waypoint", trace_endpos); if(wp) { - WaypointSprite_UpdateTeamRadar(wp, RADARICON_WAYPOINT, '0 1 1'); + WaypointSprite_UpdateRadar(wp, RADARICON_WAYPOINT, '0 1 1'); WaypointSprite_Ping(wp); } sprint(self, "personal waypoint spawned at crosshair\n"); @@ -154,7 +154,7 @@ void ImpulseCommands (void) wp = WaypointSprite_DeployPersonal("waypoint", self.death_origin); if(wp) { - WaypointSprite_UpdateTeamRadar(wp, RADARICON_WAYPOINT, '0 1 1'); + WaypointSprite_UpdateRadar(wp, RADARICON_WAYPOINT, '0 1 1'); WaypointSprite_Ping(wp); } sprint(self, "personal waypoint spawned at death location\n"); @@ -165,7 +165,7 @@ void ImpulseCommands (void) { wp = WaypointSprite_Attach("helpme", TRUE); if(wp) - WaypointSprite_UpdateTeamRadar(wp, RADARICON_HELPME, '1 0.5 0'); // TODO choose better color + WaypointSprite_UpdateRadar(wp, RADARICON_HELPME, '1 0.5 0'); // TODO choose better color if(!wp) wp = self.waypointsprite_attachedforcarrier; // flag sprite? if(wp) @@ -177,7 +177,7 @@ void ImpulseCommands (void) wp = WaypointSprite_DeployFixed("here", FALSE, self.origin); if(wp) { - WaypointSprite_UpdateTeamRadar(wp, RADARICON_HERE, '0 1 0'); + WaypointSprite_UpdateRadar(wp, RADARICON_HERE, '0 1 0'); WaypointSprite_Ping(wp); } sprint(self, "HERE spawned at location\n"); @@ -187,7 +187,7 @@ void ImpulseCommands (void) wp = WaypointSprite_DeployFixed("here", FALSE, trace_endpos); if(wp) { - WaypointSprite_UpdateTeamRadar(wp, RADARICON_HERE, '0 1 0'); + WaypointSprite_UpdateRadar(wp, RADARICON_HERE, '0 1 0'); WaypointSprite_Ping(wp); } sprint(self, "HERE spawned at crosshair\n"); @@ -198,7 +198,7 @@ void ImpulseCommands (void) wp = WaypointSprite_DeployFixed("here", FALSE, self.death_origin); if(wp) { - WaypointSprite_UpdateTeamRadar(wp, RADARICON_HERE, '0 1 0'); + WaypointSprite_UpdateRadar(wp, RADARICON_HERE, '0 1 0'); WaypointSprite_Ping(wp); } sprint(self, "HERE spawned at death location\n"); @@ -208,7 +208,7 @@ void ImpulseCommands (void) wp = WaypointSprite_DeployFixed("danger", FALSE, self.origin); if(wp) { - WaypointSprite_UpdateTeamRadar(wp, RADARICON_DANGER, '1 0.5 0'); + WaypointSprite_UpdateRadar(wp, RADARICON_DANGER, '1 0.5 0'); WaypointSprite_Ping(wp); } sprint(self, "DANGER spawned at location\n"); @@ -218,7 +218,7 @@ void ImpulseCommands (void) wp = WaypointSprite_DeployFixed("danger", FALSE, trace_endpos); if(wp) { - WaypointSprite_UpdateTeamRadar(wp, RADARICON_DANGER, '1 0.5 0'); + WaypointSprite_UpdateRadar(wp, RADARICON_DANGER, '1 0.5 0'); WaypointSprite_Ping(wp); } sprint(self, "DANGER spawned at crosshair\n"); @@ -229,7 +229,7 @@ void ImpulseCommands (void) wp = WaypointSprite_DeployFixed("danger", FALSE, self.death_origin); if(wp) { - WaypointSprite_UpdateTeamRadar(wp, RADARICON_DANGER, '1 0.5 0'); + WaypointSprite_UpdateRadar(wp, RADARICON_DANGER, '1 0.5 0'); WaypointSprite_Ping(wp); } sprint(self, "DANGER spawned at death location\n"); diff --git a/data/qcsrc/server/ctf.qc b/data/qcsrc/server/ctf.qc index 25a20e2c..38f476f3 100644 --- a/data/qcsrc/server/ctf.qc +++ b/data/qcsrc/server/ctf.qc @@ -127,12 +127,12 @@ void ctf_flag_spawnstuff() if(self.team == COLOR_TEAM1) { WaypointSprite_SpawnFixed("redbase", self.origin + '0 0 61', self, sprite); - WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_FLAG, colormapPaletteColor(COLOR_TEAM1 - 1, FALSE)); + WaypointSprite_UpdateRadar(self.sprite, RADARICON_FLAG, colormapPaletteColor(COLOR_TEAM1 - 1, FALSE)); } else { WaypointSprite_SpawnFixed("bluebase", self.origin + '0 0 61', self, sprite); - WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_FLAG, colormapPaletteColor(COLOR_TEAM2 - 1, FALSE)); + WaypointSprite_UpdateRadar(self.sprite, RADARICON_FLAG, colormapPaletteColor(COLOR_TEAM2 - 1, FALSE)); } } @@ -557,7 +557,7 @@ void FlagTouch() setorigin(self, FLAG_CARRY_POS); setattachment(self, other, ""); WaypointSprite_AttachCarrier("flagcarrier", other); - WaypointSprite_UpdateTeamRadar(other.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, '1 1 0'); + WaypointSprite_UpdateRadar(other.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, '1 1 0'); WaypointSprite_Ping(self.sprite); return; @@ -645,7 +645,7 @@ void FlagTouch() self.damageforcescale = 0; self.takedamage = DAMAGE_NO; WaypointSprite_AttachCarrier("flagcarrier", other); - WaypointSprite_UpdateTeamRadar(other.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, '1 1 0'); + WaypointSprite_UpdateRadar(other.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, '1 1 0'); } } }; diff --git a/data/qcsrc/server/domination.qc b/data/qcsrc/server/domination.qc index 960189e6..42d578e5 100644 --- a/data/qcsrc/server/domination.qc +++ b/data/qcsrc/server/domination.qc @@ -110,7 +110,7 @@ void dompoint_captured () WaypointSprite_UpdateSprites(self.sprite, "dom-pink", "", ""); break; } - WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_DOMPOINT, colormapPaletteColor(self.goalentity.team - 1, 0)); + WaypointSprite_UpdateRadar(self.sprite, RADARICON_DOMPOINT, colormapPaletteColor(self.goalentity.team - 1, 0)); WaypointSprite_Ping(self.sprite); self.captime = time; @@ -211,7 +211,7 @@ void dompointtouch() return; WaypointSprite_UpdateSprites(self.sprite, "dom-neut", "", ""); - WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_DOMPOINT, '0 1 1'); + WaypointSprite_UpdateRadar(self.sprite, RADARICON_DOMPOINT, '0 1 1'); WaypointSprite_Ping(self.sprite); self.goalentity = head; @@ -314,7 +314,7 @@ void dom_controlpoint_setup() waypoint_spawnforitem(self); WaypointSprite_SpawnFixed("dom-neut", self.origin + '0 0 32', self, sprite); - WaypointSprite_UpdateTeamRadar(self.sprite, RADARICON_DOMPOINT, '0 1 1'); + WaypointSprite_UpdateRadar(self.sprite, RADARICON_DOMPOINT, '0 1 1'); }; diff --git a/data/qcsrc/server/keyhunt.qc b/data/qcsrc/server/keyhunt.qc index dd0570f8..7ffc580a 100644 --- a/data/qcsrc/server/keyhunt.qc +++ b/data/qcsrc/server/keyhunt.qc @@ -308,7 +308,7 @@ void kh_Key_AssignTo(entity key, entity player) // runs every time a key is pic WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, "keycarrier-yellow", "keycarrier-friend", "keycarrier-yellow"); else if(player.team == COLOR_TEAM4) WaypointSprite_UpdateSprites(player.waypointsprite_attachedforcarrier, "keycarrier-pink", "keycarrier-friend", "keycarrier-pink"); - WaypointSprite_UpdateTeamRadar(player.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, colormapPaletteColor(player.team - 1, 0)); + WaypointSprite_UpdateRadar(player.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, colormapPaletteColor(player.team - 1, 0)); if(!kh_no_radar_circles) WaypointSprite_Ping(player.waypointsprite_attachedforcarrier); } @@ -414,7 +414,7 @@ void kh_Key_Spawn(entity initial_owner, float angle, float i) // runs every tim WaypointSprite_Spawn("key-dropped", 0, 0, key, '0 0 1' * KH_KEY_WP_ZSHIFT, world, key.team, key, waypointsprite_attachedforcarrier, FALSE); key.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = kh_Key_waypointsprite_visible_for_player; - WaypointSprite_UpdateTeamRadar(key.waypointsprite_attachedforcarrier, RADARICON_FLAG, '0 1 1'); + WaypointSprite_UpdateRadar(key.waypointsprite_attachedforcarrier, RADARICON_FLAG, '0 1 1'); kh_Key_AssignTo(key, initial_owner); } diff --git a/data/qcsrc/server/mode_onslaught.qc b/data/qcsrc/server/mode_onslaught.qc index d2b1ce99..0826d1ef 100644 --- a/data/qcsrc/server/mode_onslaught.qc +++ b/data/qcsrc/server/mode_onslaught.qc @@ -700,16 +700,16 @@ void onslaught_generator_updatesprite(entity e) if(e.lastshielded) { if(e.team == COLOR_TEAM1 || e.team == COLOR_TEAM2) - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, 0.5 * colormapPaletteColor(e.team - 1, FALSE)); + WaypointSprite_UpdateRadar(e.sprite, RADARICON_GENERATOR, 0.5 * colormapPaletteColor(e.team - 1, FALSE)); else - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.5 0.5 0.5'); + WaypointSprite_UpdateRadar(e.sprite, RADARICON_GENERATOR, '0.5 0.5 0.5'); } else { if(e.team == COLOR_TEAM1 || e.team == COLOR_TEAM2) - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, colormapPaletteColor(e.team - 1, FALSE)); + WaypointSprite_UpdateRadar(e.sprite, RADARICON_GENERATOR, colormapPaletteColor(e.team - 1, FALSE)); else - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_GENERATOR, '0.75 0.75 0.75'); + WaypointSprite_UpdateRadar(e.sprite, RADARICON_GENERATOR, '0.75 0.75 0.75'); } WaypointSprite_Ping(e.sprite); } @@ -787,16 +787,16 @@ void onslaught_controlpoint_updatesprite(entity e) if(e.lastshielded) { if(e.team == COLOR_TEAM1 || e.team == COLOR_TEAM2) - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, 0.5 * colormapPaletteColor(e.team - 1, FALSE)); + WaypointSprite_UpdateRadar(e.sprite, RADARICON_CONTROLPOINT, 0.5 * colormapPaletteColor(e.team - 1, FALSE)); else - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.5 0.5 0.5'); + WaypointSprite_UpdateRadar(e.sprite, RADARICON_CONTROLPOINT, '0.5 0.5 0.5'); } else { if(e.team == COLOR_TEAM1 || e.team == COLOR_TEAM2) - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, colormapPaletteColor(e.team - 1, FALSE)); + WaypointSprite_UpdateRadar(e.sprite, RADARICON_CONTROLPOINT, colormapPaletteColor(e.team - 1, FALSE)); else - WaypointSprite_UpdateTeamRadar(e.sprite, RADARICON_CONTROLPOINT, '0.75 0.75 0.75'); + WaypointSprite_UpdateRadar(e.sprite, RADARICON_CONTROLPOINT, '0.75 0.75 0.75'); } WaypointSprite_Ping(e.sprite); diff --git a/data/qcsrc/server/t_items.qc b/data/qcsrc/server/t_items.qc index 5517fa30..83ec80f4 100644 --- a/data/qcsrc/server/t_items.qc +++ b/data/qcsrc/server/t_items.qc @@ -174,7 +174,7 @@ void Item_RespawnCountdown (void) WaypointSprite_Spawn(name, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, TRUE); if(self.waypointsprite_attached) { - WaypointSprite_UpdateTeamRadar(self.waypointsprite_attached, RADARICON_POWERUP, rgb); + WaypointSprite_UpdateRadar(self.waypointsprite_attached, RADARICON_POWERUP, rgb); //WaypointSprite_UpdateMaxHealth(self.waypointsprite_attached, ITEM_RESPAWN_TICKS + 1); WaypointSprite_UpdateBuildFinished(self.waypointsprite_attached, time + ITEM_RESPAWN_TICKS); } diff --git a/data/qcsrc/server/waypointsprites.qc b/data/qcsrc/server/waypointsprites.qc index 40211538..a392f76e 100644 --- a/data/qcsrc/server/waypointsprites.qc +++ b/data/qcsrc/server/waypointsprites.qc @@ -73,7 +73,7 @@ void WaypointSprite_UpdateRule(entity e, float t, float r) e.SendFlags |= 1; } -void WaypointSprite_UpdateTeamRadar(entity e, float icon, vector col) +void WaypointSprite_UpdateRadar(entity e, float icon, vector col) { // no check, as this is never called without doing an actual change (usually only once) e.cnt = (icon & 0x7F) | (e.cnt & 0x80); diff --git a/docs/TODO.txt b/docs/TODO.txt index c074f59a..a867cb34 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -148,6 +148,4 @@ - 0.7 | 0.8: Allow more bots from the menu? -- 0.8: Maybe turn the HEAL teammate into a sign, not part of shownames - -- 0.7 | 0.8: Allow radar not only in team games, and rename it from teamradar to radar \ No newline at end of file +- 0.8: Maybe turn the HEAL teammate into a sign, not part of shownames \ No newline at end of file -- 2.39.2