]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote branch 'origin/master' into samual/waypointsprite_edgeoffset
authorSamual <samual@xonotic.org>
Tue, 12 Jul 2011 01:17:05 +0000 (21:17 -0400)
committerSamual <samual@xonotic.org>
Tue, 12 Jul 2011 01:17:05 +0000 (21:17 -0400)
1  2 
defaultXonotic.cfg
qcsrc/client/autocvars.qh
qcsrc/client/waypointsprites.qc

Simple merge
Simple merge
index de896f9309b5edd201f327b4521c326d533f5056,3e83e45bcae4d144c462050eac1c5dcf6f6242f4..9e5b199882e4e1662fc123529d40f64a8403f9c8
@@@ -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;
  
 -      if(o_z < 0 || o_x < 0 || o_y < 0 || o_x > vid_conwidth || o_y > vid_conheight)
+       o = project_3d_to_2d(self.origin);
 +      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;
                        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
                        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;