From: MirceaKitsune Date: Thu, 15 Mar 2012 16:45:08 +0000 (+0200) Subject: Big improvements to the radar, and us a good set of images for it. Not yet finished... X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=22dd0922e9254006a02ed7cf95a0b2d9621fc6e9;p=voretournament%2Fvoretournament.git Big improvements to the radar, and us a good set of images for it. Not yet finished, but this commit won't break anything either --- diff --git a/data/defaultVT.cfg b/data/defaultVT.cfg index 30179cbc..b524ae35 100644 --- a/data/defaultVT.cfg +++ b/data/defaultVT.cfg @@ -1382,8 +1382,9 @@ 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_background_alpha -1 "set to -1 to disable" -seta cl_radar_foreground_alpha 0.8 "alpha of the map" +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_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/gfx/hud/bg_radar.tga b/data/gfx/hud/bg_radar.tga new file mode 100644 index 00000000..8c8bcb5f Binary files /dev/null and b/data/gfx/hud/bg_radar.tga differ diff --git a/data/gfx/hud/fg_radar.tga b/data/gfx/hud/fg_radar.tga new file mode 100644 index 00000000..13a89126 Binary files /dev/null and b/data/gfx/hud/fg_radar.tga differ diff --git a/data/gfx/hud/fg_radar_team.tga b/data/gfx/hud/fg_radar_team.tga new file mode 100644 index 00000000..fb97397e Binary files /dev/null and b/data/gfx/hud/fg_radar_team.tga differ diff --git a/data/gfx/ons-frame-team.tga b/data/gfx/ons-frame-team.tga deleted file mode 100644 index fb97397e..00000000 Binary files a/data/gfx/ons-frame-team.tga and /dev/null differ diff --git a/data/gfx/ons-frame.tga b/data/gfx/ons-frame.tga deleted file mode 100644 index 13a89126..00000000 Binary files a/data/gfx/ons-frame.tga and /dev/null differ diff --git a/data/qcsrc/client/Main.qc b/data/qcsrc/client/Main.qc index 7006f429..567c9ba6 100644 --- a/data/qcsrc/client/Main.qc +++ b/data/qcsrc/client/Main.qc @@ -176,6 +176,9 @@ void CSQC_Init(void) else get_mi_min_max_texcoords(0); // load new texcoords } + precache_pic("gfx/hud/bg_radar.tga"); + precache_pic("gfx/hud/fg_radar.tga"); + precache_pic("gfx/hud/fg_radar_team.tga"); mi_center = (mi_min + mi_max) * 0.5; mi_scale = mi_max - mi_min; diff --git a/data/qcsrc/client/radar.qc b/data/qcsrc/client/radar.qc index c0778f51..97ea2444 100644 --- a/data/qcsrc/client/radar.qc +++ b/data/qcsrc/client/radar.qc @@ -53,41 +53,60 @@ vector yinvert(vector v) return v; } -void draw_radar_background(float bg, float fg) +void draw_radar_background(float ca, float bg, float fg) { - float fga; - vector fgc; + vector cgc; 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_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_EndPolygon(); } - if(fg > 0 && minimapname != "") + if(ca > 0 && minimapname != "") { - fga = 1; - fgc = '1 1 1' * fg; + cgc = '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), 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); + 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); } 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_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_EndPolygon(); } + + 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_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_EndPolygon(); + } } void(vector coord3d, vector pangles, vector rgb) draw_radar_player = @@ -178,6 +197,7 @@ void draw_radar_link(vector start, vector end, float colors) } float cl_radar_scale; +float cl_radar_content_alpha; float cl_radar_background_alpha; float cl_radar_foreground_alpha; float cl_radar_rotation; @@ -191,6 +211,7 @@ void radar_loadcvars() if(ons_showmap) { cl_radar_scale = 42; // dummy, not used (see zoommode) + cl_radar_content_alpha = 1 * (1 - cvar("_menu_alpha")); 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"); @@ -204,6 +225,7 @@ void radar_loadcvars() else { cl_radar_scale = cvar("cl_radar_scale"); + cl_radar_content_alpha = cvar("cl_radar_content_alpha") * sbar_alpha_fg; 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"); @@ -214,6 +236,7 @@ void radar_loadcvars() // others default to 0 // match this to defaultVoretournament.cfg! if(!cl_radar_scale) cl_radar_scale = 4096; + if(!cl_radar_content_alpha) cl_radar_content_alpha = 0.4 * sbar_alpha_fg; 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; @@ -227,8 +250,7 @@ void radar_loadcvars() void() radar_view = { - local float color1, color2; // color already declared as a global in hud.qc - local vector rgb; + local float color1; // color already declared as a global in hud.qc local entity tm; float scale2d, normalsize, bigsize; float f; @@ -323,9 +345,6 @@ void() radar_view = 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, @@ -333,22 +352,11 @@ void() radar_view = radar_size2d_y + radar_extraclip_maxs_y - radar_extraclip_mins_y ); - draw_radar_background(cl_radar_background_alpha, cl_radar_foreground_alpha); + draw_radar_background(cl_radar_content_alpha, 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, @@ -363,9 +371,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")); ) { - color2 = GetPlayerColor(tm.sv_entnum); - //if(color == COLOR_SPECTATOR || color == color2) - draw_radar_player(tm.origin, tm.angles, GetTeamRGB(color2)); + color1 = GetPlayerColor(tm.sv_entnum); + //if(color == COLOR_SPECTATOR || color == color1) + draw_radar_player(tm.origin, tm.angles, GetTeamRGB(color1)); } draw_radar_player(view_origin, view_angles, '1 1 1'); diff --git a/docs/TODO.txt b/docs/TODO.txt index a867cb34..2089145c 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -148,4 +148,8 @@ - 0.7 | 0.8: Allow more bots from the menu? -- 0.8: Maybe turn the HEAL teammate into a sign, not part of shownames \ No newline at end of file +- 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 \ No newline at end of file