From 0e7468efbf995788333f2353884377a70449ef43 Mon Sep 17 00:00:00 2001 From: Samual Date: Tue, 15 Feb 2011 02:31:49 -0500 Subject: [PATCH] YAY now it works -- default it to off, and add a todo for tomorrow where I need to fix the edgedistance calculation. After that it just needs to be added to the menu and then merged ^_^ --- defaultXonotic.cfg | 6 ++++-- qcsrc/client/autocvars.qh | 6 ++++-- qcsrc/client/waypointsprites.qc | 35 +++++++++++++++++++-------------- 3 files changed, 28 insertions(+), 19 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index b0f20ab80..1a15ca98f 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1220,8 +1220,10 @@ seta g_waypointsprite_alpha 1 "This allows the client to control transparency of seta g_waypointsprite_edgefadealpha 0.5 "alpha multiplier near the edge" seta g_waypointsprite_edgefadescale 1 "scale multiplier near the edge" seta g_waypointsprite_edgefadedistance 50 "distance in virtual pixels from edge where to start fading" -seta g_waypointsprite_edgeoffset_x 0.15 "offset of how close the waypoint can be to the edge of the screen - between left and right" -seta g_waypointsprite_edgeoffset_y 0.15 "offset of how close the waypoint can be to the edge of the screen - between top and bottom" +seta g_waypointsprite_edgeoffset_bottom 0 "offset of how close the waypoint can be to the bottom edge of the screen" +seta g_waypointsprite_edgeoffset_left 0 "offset of how close the waypoint can be to the left edge of the screen" +seta g_waypointsprite_edgeoffset_right 0 "offset of how close the waypoint can be to the right edge of the screen" +seta g_waypointsprite_edgeoffset_top 0 "offset of how close the waypoint can be to the top edge of the screen" seta g_waypointsprite_crosshairfadealpha 0.25 "alpha multiplier near crosshair" seta g_waypointsprite_crosshairfadescale 1 "scale multiplier near the crosshair" seta g_waypointsprite_crosshairfadedistance 150 "distance in virtual pixels from crosshair where to start fading" diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index c9337db07..77d7e6edb 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -135,8 +135,10 @@ var float autocvar_g_waypointsprite_distancefadescale = 1; var float autocvar_g_waypointsprite_edgefadealpha = 1; float autocvar_g_waypointsprite_edgefadedistance; var float autocvar_g_waypointsprite_edgefadescale = 1; -var float autocvar_g_waypointsprite_edgeoffset_x = 0.15; -var float autocvar_g_waypointsprite_edgeoffset_y = 0.15; +var float autocvar_g_waypointsprite_edgeoffset_bottom = 0; +var float autocvar_g_waypointsprite_edgeoffset_left = 0; +var float autocvar_g_waypointsprite_edgeoffset_right = 0; +var float autocvar_g_waypointsprite_edgeoffset_top = 0; float autocvar_g_waypointsprite_minalpha; float autocvar_g_waypointsprite_minscale; float autocvar_g_waypointsprite_normdistance; diff --git a/qcsrc/client/waypointsprites.qc b/qcsrc/client/waypointsprites.qc index d93c40cfe..6a89f3289 100644 --- a/qcsrc/client/waypointsprites.qc +++ b/qcsrc/client/waypointsprites.qc @@ -9,8 +9,10 @@ float waypointsprite_scale; float waypointsprite_edgefadealpha; float waypointsprite_edgefadescale; float waypointsprite_edgefadedistance; -float waypointsprite_edgeoffset_x; -float waypointsprite_edgeoffset_y; +float waypointsprite_edgeoffset_bottom; +float waypointsprite_edgeoffset_left; +float waypointsprite_edgeoffset_right; +float waypointsprite_edgeoffset_top; float waypointsprite_crosshairfadealpha; float waypointsprite_crosshairfadescale; float waypointsprite_crosshairfadedistance; @@ -184,13 +186,11 @@ void Draw_WaypointSprite() o = project_3d_to_2d(self.origin); rot = 0; - print("origin: ", vtos(o), ", edgeoffsets: ", ftos(waypointsprite_edgeoffset_x), " - ", ftos(autocvar_g_waypointsprite_edgeoffset_x), ". \n"); - if(o_z < 0 - || o_x < (vid_conwidth * waypointsprite_edgeoffset_x) - || o_y < (vid_conheight * waypointsprite_edgeoffset_y) - || o_x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_x)) - || o_y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_y))) + || o_x < (vid_conwidth * waypointsprite_edgeoffset_left) + || o_y < (vid_conheight * waypointsprite_edgeoffset_top) + || o_x > (vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) + || o_y > (vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom))) { // scale it to be just in view vector d; @@ -218,13 +218,13 @@ void Draw_WaypointSprite() if(d_z * f1 > 0) { // RIGHT edge - d = d * ((0.5 - waypointsprite_edgeoffset_x) / f1); + d = d * ((0.5 - waypointsprite_edgeoffset_right) / f1); rot = 3; } else { // LEFT edge - d = d * (-(0.5 - waypointsprite_edgeoffset_x) / f1); + d = d * (-(0.5 - waypointsprite_edgeoffset_left) / f1); rot = 1; } } @@ -233,13 +233,13 @@ void Draw_WaypointSprite() if(d_z * f2 > 0) { // BOTTOM edge - d = d * ((0.5 - waypointsprite_edgeoffset_y) / f2); + d = d * ((0.5 - waypointsprite_edgeoffset_bottom) / f2); rot = 0; } else { // TOP edge - d = d * (-(0.5 - waypointsprite_edgeoffset_y) / f2); + d = d * (-(0.5 - waypointsprite_edgeoffset_top) / f2); rot = 2; } } @@ -258,7 +258,10 @@ void Draw_WaypointSprite() spriteimage = strcat("models/sprites/", spriteimage, "_frame", ftos(mod(floor((max(0, time - self.spawntime)) * 2), t))); float edgedistance_min, crosshairdistance; - edgedistance_min = min4(o_y, o_x,vid_conwidth - o_x, vid_conheight - o_y); + edgedistance_min = min4(o_y, // todo: FIGURE THIS SHIT OUT + o_x, + vid_conwidth - o_x, + vid_conheight - o_y); crosshairdistance = sqrt( pow(o_x - vid_conwidth/2, 2) + pow(o_y - vid_conheight/2, 2) ); @@ -426,8 +429,10 @@ void WaypointSprite_Load() waypointsprite_edgefadealpha = autocvar_g_waypointsprite_edgefadealpha; waypointsprite_edgefadescale = autocvar_g_waypointsprite_edgefadescale; waypointsprite_edgefadedistance = autocvar_g_waypointsprite_edgefadedistance; - waypointsprite_edgeoffset_x = autocvar_g_waypointsprite_edgeoffset_x; - waypointsprite_edgeoffset_y = autocvar_g_waypointsprite_edgeoffset_y; + waypointsprite_edgeoffset_bottom = autocvar_g_waypointsprite_edgeoffset_bottom; + waypointsprite_edgeoffset_left = autocvar_g_waypointsprite_edgeoffset_left; + waypointsprite_edgeoffset_right = autocvar_g_waypointsprite_edgeoffset_right; + waypointsprite_edgeoffset_top = autocvar_g_waypointsprite_edgeoffset_top; waypointsprite_crosshairfadealpha = autocvar_g_waypointsprite_crosshairfadealpha; waypointsprite_crosshairfadescale = autocvar_g_waypointsprite_crosshairfadescale; waypointsprite_crosshairfadedistance = autocvar_g_waypointsprite_crosshairfadedistance; -- 2.39.2