From c006047b08f00e112940176c52656084df66742d Mon Sep 17 00:00:00 2001 From: Samual Date: Mon, 14 Feb 2011 21:50:37 -0500 Subject: [PATCH] Some ground work for screen offsets for waypointsprites -- doesn't work right now because AUTOCVARS SUCK FOR SOME UNKNOWN REASON. --- defaultXonotic.cfg | 2 ++ qcsrc/client/autocvars.qh | 2 ++ qcsrc/client/waypointsprites.qc | 20 +++++++++++++++----- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index c76176a84..888b96530 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1220,6 +1220,8 @@ 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.2 "offset of how close the waypoint can be to the edge of the screen (between left and right)" +seta g_waypointsprite_edgeoffset_y 0.2 "offset of how close the waypoint can be to the edge of the screen (between top and bottom)" 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 790855c88..52277fd78 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -135,6 +135,8 @@ 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; +float autocvar_g_waypointsprite_edgeoffset_x; +float autocvar_g_waypointsprite_edgeoffset_y; 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 8ecadaeb8..d93c40cfe 100644 --- a/qcsrc/client/waypointsprites.qc +++ b/qcsrc/client/waypointsprites.qc @@ -9,6 +9,8 @@ float waypointsprite_scale; float waypointsprite_edgefadealpha; float waypointsprite_edgefadescale; float waypointsprite_edgefadedistance; +float waypointsprite_edgeoffset_x; +float waypointsprite_edgeoffset_y; float waypointsprite_crosshairfadealpha; float waypointsprite_crosshairfadescale; float waypointsprite_crosshairfadedistance; @@ -182,7 +184,13 @@ void Draw_WaypointSprite() o = project_3d_to_2d(self.origin); rot = 0; - if(o_z < 0 || o_x < 0 || o_y < 0 || o_x > vid_conwidth || o_y > vid_conheight) + 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))) { // scale it to be just in view vector d; @@ -210,13 +218,13 @@ void Draw_WaypointSprite() if(d_z * f1 > 0) { // RIGHT edge - d = d * (0.5 / f1); + d = d * ((0.5 - waypointsprite_edgeoffset_x) / f1); rot = 3; } else { // LEFT edge - d = d * (-0.5 / f1); + d = d * (-(0.5 - waypointsprite_edgeoffset_x) / f1); rot = 1; } } @@ -225,13 +233,13 @@ void Draw_WaypointSprite() if(d_z * f2 > 0) { // BOTTOM edge - d = d * (0.5 / f2); + d = d * ((0.5 - waypointsprite_edgeoffset_y) / f2); rot = 0; } else { // TOP edge - d = d * (-0.5 / f2); + d = d * (-(0.5 - waypointsprite_edgeoffset_y) / f2); rot = 2; } } @@ -418,6 +426,8 @@ 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_crosshairfadealpha = autocvar_g_waypointsprite_crosshairfadealpha; waypointsprite_crosshairfadescale = autocvar_g_waypointsprite_crosshairfadescale; waypointsprite_crosshairfadedistance = autocvar_g_waypointsprite_crosshairfadedistance; -- 2.39.2