From: Samual <samual@xonotic.org>
Date: Tue, 12 Jul 2011 01:17:05 +0000 (-0400)
Subject: Merge remote branch 'origin/master' into samual/waypointsprite_edgeoffset
X-Git-Tag: xonotic-v0.5.0~148^2~48^2
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5b902bfabe6575373dac2ffe636074c0308c6abf;p=xonotic%2Fxonotic-data.pk3dir.git

Merge remote branch 'origin/master' into samual/waypointsprite_edgeoffset
---

5b902bfabe6575373dac2ffe636074c0308c6abf
diff --cc qcsrc/client/waypointsprites.qc
index de896f930,3e83e45bc..9e5b19988
--- a/qcsrc/client/waypointsprites.qc
+++ b/qcsrc/client/waypointsprites.qc
@@@ -177,20 -426,39 +430,43 @@@ void Draw_WaypointSprite(
  	else if(self.maxdistance > 0)
  		a *= pow(bound(0, (waypointsprite_fadedistance - dist) / (waypointsprite_fadedistance - waypointsprite_normdistance), 1), waypointsprite_distancealphaexponent) * (1 - waypointsprite_minalpha) + waypointsprite_minalpha;
  
+ 	vector rgb;
+ 	rgb = self.teamradar_color;
+ 	rgb = spritelookupcolor(spriteimage, rgb);
+ 	if(rgb == '0 0 0')
+ 	{
+ 		self.teamradar_color = '1 0 1';
+ 		print(sprintf("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage)); 
+ 	}
+ 
+ 	if(time - floor(time) > 0.5)
+ 	{
+ 		if(self.helpme && time < self.helpme)
+ 			a *= SPRITE_HELPME_BLINK;
+ 		else
+ 			a *= spritelookupblinkvalue(spriteimage);
+ 	}
+ 
+ 	if(a > 1)
+ 	{
+ 		rgb *= a;
+ 		a = 1;
+ 	}
+ 
  	if(a <= 0)
  		return;
- 	
- 	// draw the sprite image
+ 
+ 	rgb = fixrgbexcess(rgb);
+ 
  	vector o;
- 	float rot;
- 	o = project_3d_to_2d(self.origin);
- 	rot = 0;
+ 	float ang;
  
+ 	o = project_3d_to_2d(self.origin);
 -	if(o_z < 0 || o_x < 0 || o_y < 0 || o_x > vid_conwidth || o_y > vid_conheight)
 +	if(o_z < 0 
 +	|| 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,14 -477,12 +485,12 @@@
  			if(d_z * f1 > 0)
  			{
  				// RIGHT edge
 -				d = d * (0.5 / f1);
 +				d = d * ((0.5 - waypointsprite_edgeoffset_right) / f1);
- 				rot = 3;
  			}
  			else
  			{
  				// LEFT edge
 -				d = d * (-0.5 / f1);
 +				d = d * (-(0.5 - waypointsprite_edgeoffset_left) / f1);
- 				rot = 1;
  			}
  		}
  		else
@@@ -233,36 -490,35 +498,38 @@@
  			if(d_z * f2 > 0)
  			{
  				// BOTTOM edge
 -				d = d * (0.5 / f2);
 +				d = d * ((0.5 - waypointsprite_edgeoffset_bottom) / f2);
- 				rot = 0;
  			}
  			else
  			{
  				// TOP edge
 -				d = d * (-0.5 / f2);
 +				d = d * (-(0.5 - waypointsprite_edgeoffset_top) / f2);
- 				rot = 2;
  			}
  		}
  
  		o = d + '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight;
  	}
- 	o_z = 0;
- 
- 	float vidscale;
- 	vidscale = max(vid_conwidth / vid_width, vid_conheight / vid_height);
- 
- 	t = stof(db_get(tempdb, strcat("/spriteframes/", spriteimage)));
- 	if(t == 0)
- 		spriteimage = strcat("models/sprites/", spriteimage);
  	else
- 		spriteimage = strcat("models/sprites/", spriteimage, "_frame", ftos(mod(floor((max(0, time - self.spawntime)) * 2), t)));
+ 	{
+ #if 1
+ 		ang = M_PI;
+ #else
+ 		vector d;
+ 		d = o - '0.5 0 0' * vid_conwidth - '0 0.5 0' * vid_conheight;
+ 		ang = atan2(-d_x, -d_y);
+ #endif
+ 	}
+ 	o_z = 0;
  
  	float edgedistance_min, crosshairdistance;
 -	edgedistance_min = min4(o_y, o_x,vid_conwidth - o_x, vid_conheight - o_y);
 +		edgedistance_min = min4((o_y - (vid_conheight * waypointsprite_edgeoffset_top)), 
 +	(o_x - (vid_conwidth * waypointsprite_edgeoffset_left)),
 +	(vid_conwidth - (vid_conwidth * waypointsprite_edgeoffset_right)) - o_x, 
 +	(vid_conheight - (vid_conheight * waypointsprite_edgeoffset_bottom)) - o_y);
  
+ 	float vidscale;
+ 	vidscale = max(vid_conwidth / vid_width, vid_conheight / vid_height);
+ 
  	crosshairdistance = sqrt( pow(o_x - vid_conwidth/2, 2) + pow(o_y - vid_conheight/2, 2) );
  
  	t = waypointsprite_scale * vidscale;