From 2a0cf9c8f08c47a03d4de7b57c9313e6cc2ae526 Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Thu, 15 Mar 2012 19:02:27 +0200 Subject: [PATCH] Cleanup radar code. I'll adapt the radar menu to the new changes later --- data/defaultVT.cfg | 2 +- data/qcsrc/client/Main.qc | 2 +- data/qcsrc/client/View.qc | 4 +-- data/qcsrc/client/main.qh | 2 +- data/qcsrc/client/radar.qc | 71 ++++++++++++++++++++------------------ docs/Release notes.txt | 2 ++ docs/TODO.txt | 4 +-- 7 files changed, 46 insertions(+), 41 deletions(-) diff --git a/data/defaultVT.cfg b/data/defaultVT.cfg index b524ae35..f9d099a5 100644 --- a/data/defaultVT.cfg +++ b/data/defaultVT.cfg @@ -1384,7 +1384,7 @@ seta sv_status_privacy 1 "hide IP addresses from \"status\" replies shown to cli seta cl_radar 2 "show radar. 1 in team maches, 2 always" seta cl_radar_content_alpha 1 "alpha of the minimap" seta cl_radar_background_alpha 0.5 "set to -1 to disable" -seta cl_radar_foreground_alpha 1 "set to -1 to disable" +seta cl_radar_foreground_alpha 0.9 "set to -1 to disable" 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" diff --git a/data/qcsrc/client/Main.qc b/data/qcsrc/client/Main.qc index 567c9ba6..b3aeb438 100644 --- a/data/qcsrc/client/Main.qc +++ b/data/qcsrc/client/Main.qc @@ -552,7 +552,7 @@ void GameCommand(string msg) cvar_clientsettemp(argv(1), argv(2)); } else if(cmd == "radar") { - ons_showmap = !ons_showmap; + showmap = !showmap; } else if(cmd == "sbar_columns_set") { Cmd_Sbar_SetFields(argc); diff --git a/data/qcsrc/client/View.qc b/data/qcsrc/client/View.qc index 8a7462fc..557a0d9b 100644 --- a/data/qcsrc/client/View.qc +++ b/data/qcsrc/client/View.qc @@ -1031,7 +1031,7 @@ void CSQC_UpdateView(float w, float h) // draw radar if( - ons_showmap + showmap || ( !scoreboard_active @@ -1186,7 +1186,7 @@ void CSQC_UpdateView(float w, float h) if not(getstati(STAT_ARMOR) < g_power || time <= power_boot) { // crosshair goes VERY LAST - if(!scoreboard_active && !ons_showmap && !camera_active) { + if(!scoreboard_active && !showmap && !camera_active) { // TrueAim check float shottype; // wcross_origin = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight; diff --git a/data/qcsrc/client/main.qh b/data/qcsrc/client/main.qh index ed68d766..a868ae40 100644 --- a/data/qcsrc/client/main.qh +++ b/data/qcsrc/client/main.qh @@ -31,7 +31,7 @@ vector mi_center; vector mi_scale; // Minimap string minimapname; -float ons_showmap; +float showmap; // -------------------------------------------------------------------------- // General stuff diff --git a/data/qcsrc/client/radar.qc b/data/qcsrc/client/radar.qc index 97ea2444..f266d297 100644 --- a/data/qcsrc/client/radar.qc +++ b/data/qcsrc/client/radar.qc @@ -55,34 +55,41 @@ vector yinvert(vector v) void draw_radar_background(float ca, float bg, float fg) { - vector cgc; + vector col, rgb; + vector pos1, pos2, pos3, pos4; + pos1 = '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); + pos2 = '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); + pos3 = '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); + pos4 = '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); + rgb = GetTeamRGB(GetPlayerColor(player_localentnum - 1)); + if(bg > 0) { R_BeginPolygon("gfx/hud/bg_radar.tga", DRAWFLAG_NORMAL); - 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), yinvert(mi_pictexcoord1), '1 1 1', 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), yinvert(mi_pictexcoord2), '1 1 1', 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), yinvert(mi_pictexcoord3), '1 1 1', 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), yinvert(mi_pictexcoord0), '1 1 1', bg); + R_PolygonVertex(pos1, yinvert(mi_pictexcoord1), '1 1 1', bg); + R_PolygonVertex(pos2, yinvert(mi_pictexcoord2), '1 1 1', bg); + R_PolygonVertex(pos3, yinvert(mi_pictexcoord3), '1 1 1', bg); + R_PolygonVertex(pos4, yinvert(mi_pictexcoord0), '1 1 1', bg); R_EndPolygon(); } if(ca > 0 && minimapname != "") { - cgc = '1 1 1' * ca; + col = '1 1 1' * ca; R_BeginPolygon(minimapname, DRAWFLAG_SCREEN | DRAWFLAG_MIPMAP); if(v_flipped) { - R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord3), yinvert(mi_pictexcoord3), cgc, 1); - R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord2), yinvert(mi_pictexcoord2), cgc, 1); - R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord1), yinvert(mi_pictexcoord1), cgc, 1); - R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord0), yinvert(mi_pictexcoord0), cgc, 1); + R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord3), yinvert(mi_pictexcoord3), col, 1); + R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord2), yinvert(mi_pictexcoord2), col, 1); + R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord1), yinvert(mi_pictexcoord1), col, 1); + R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord0), yinvert(mi_pictexcoord0), col, 1); } else { - R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord0), yinvert(mi_pictexcoord0), cgc, 1); - R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord1), yinvert(mi_pictexcoord1), cgc, 1); - R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord2), yinvert(mi_pictexcoord2), cgc, 1); - R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord3), yinvert(mi_pictexcoord3), cgc, 1); + R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord0), yinvert(mi_pictexcoord0), col, 1); + R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord1), yinvert(mi_pictexcoord1), col, 1); + R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord2), yinvert(mi_pictexcoord2), col, 1); + R_PolygonVertex(radar_texcoord_to_2dcoord(mi_pictexcoord3), yinvert(mi_pictexcoord3), col, 1); } R_EndPolygon(); } @@ -90,21 +97,17 @@ void draw_radar_background(float ca, float bg, float fg) if(fg > 0) { R_BeginPolygon("gfx/hud/fg_radar.tga", DRAWFLAG_NORMAL); - 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), yinvert(mi_pictexcoord1), '1 1 1', fg); - 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), yinvert(mi_pictexcoord2), '1 1 1', fg); - 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), yinvert(mi_pictexcoord3), '1 1 1', fg); - 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), yinvert(mi_pictexcoord0), '1 1 1', fg); + R_PolygonVertex(pos1, yinvert(mi_pictexcoord1), '1 1 1', fg); + R_PolygonVertex(pos2, yinvert(mi_pictexcoord2), '1 1 1', fg); + R_PolygonVertex(pos3, yinvert(mi_pictexcoord3), '1 1 1', fg); + R_PolygonVertex(pos4, yinvert(mi_pictexcoord0), '1 1 1', fg); R_EndPolygon(); - } - vector rgb; - rgb = GetTeamRGB(GetPlayerColor(player_localentnum - 1)); - if(fg > 0) - { + R_BeginPolygon("gfx/hud/fg_radar_team.tga", DRAWFLAG_NORMAL); - 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), yinvert(mi_pictexcoord1), rgb, fg); - 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), yinvert(mi_pictexcoord2), rgb, fg); - 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), yinvert(mi_pictexcoord3), rgb, fg); - 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), yinvert(mi_pictexcoord0), rgb, fg); + R_PolygonVertex(pos1, yinvert(mi_pictexcoord1), rgb, fg); + R_PolygonVertex(pos2, yinvert(mi_pictexcoord2), rgb, fg); + R_PolygonVertex(pos3, yinvert(mi_pictexcoord3), rgb, fg); + R_PolygonVertex(pos4, yinvert(mi_pictexcoord0), rgb, fg); R_EndPolygon(); } } @@ -208,7 +211,7 @@ float cl_radar_zoommode; void radar_loadcvars() { v_flipped = cvar("v_flipped"); - if(ons_showmap) + if(showmap) { cl_radar_scale = 42; // dummy, not used (see zoommode) cl_radar_content_alpha = 1 * (1 - cvar("_menu_alpha")); @@ -250,12 +253,12 @@ void radar_loadcvars() void() radar_view = { - local float color1; // color already declared as a global in hud.qc + local float col; // color already declared as a global in hud.qc local entity tm; float scale2d, normalsize, bigsize; float f; - if(minimapname == "" && !ons_showmap) + if(minimapname == "" && !showmap) return; radar_loadcvars(); @@ -354,7 +357,7 @@ void() radar_view = draw_radar_background(cl_radar_content_alpha, cl_radar_background_alpha, cl_radar_foreground_alpha); - if(ons_showmap) + if(showmap) { drawresetcliparea(); drawsetcliparea( @@ -371,9 +374,9 @@ void() radar_view = 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")); ) { - color1 = GetPlayerColor(tm.sv_entnum); - //if(color == COLOR_SPECTATOR || color == color1) - draw_radar_player(tm.origin, tm.angles, GetTeamRGB(color1)); + col = GetPlayerColor(tm.sv_entnum); + //if(color == COLOR_SPECTATOR || color == col) + draw_radar_player(tm.origin, tm.angles, GetTeamRGB(col)); } draw_radar_player(view_origin, view_angles, '1 1 1'); diff --git a/docs/Release notes.txt b/docs/Release notes.txt index 777d5d50..d93a52b8 100644 --- a/docs/Release notes.txt +++ b/docs/Release notes.txt @@ -313,3 +313,5 @@ Features: - Visuals: Cubemap reflections on several map textures. You'll commonly see them on metal surfaces, but also on some stone floors. - Character portraits, which show when getting fragged or shooting team mates. + +- Improved radar (minimap), which shows in both team games and standalone games by default. diff --git a/docs/TODO.txt b/docs/TODO.txt index 2089145c..cedef231 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -150,6 +150,6 @@ - 0.8: Maybe turn the HEAL teammate into a sign, not part of shownames -- 0.7: Don't name the large map "ons map" +- 0.7: Remove _mini -- 0.7: Remove _mini \ No newline at end of file +- 0.7: Adapt radar menu \ No newline at end of file -- 2.39.2