]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
b0rken nex speed indicator
authorFruitieX <rasse@rasse-laptop.(none)>
Sun, 3 Oct 2010 16:15:37 +0000 (19:15 +0300)
committerFruitieX <rasse@rasse-laptop.(none)>
Sun, 3 Oct 2010 16:15:37 +0000 (19:15 +0300)
gfx/nex_ring.tga [new file with mode: 0644]
qcsrc/client/View.qc

diff --git a/gfx/nex_ring.tga b/gfx/nex_ring.tga
new file mode 100644 (file)
index 0000000..c082c62
Binary files /dev/null and b/gfx/nex_ring.tga differ
index 0b7dcac792ec61d61f3dba40a2af3260f6b646c6..04f300703ca5da0e28b3361849c436bc24333c18 100644 (file)
@@ -697,6 +697,47 @@ void CSQC_UpdateView(float w, float h)
                        if(cvar("viewsize") < 120)
                                CSQC_common_hud();
 
+
+               // ring around crosshair representing velocity-dependent damage for the nex
+               if (activeweapon == WEP_NEX)
+               {
+                       float x, y;
+                       vector ringorigin, ringsize, t;
+                       ringorigin = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight;
+                       ringsize = 64 * '1 1 0'; // testing only
+
+                       // TODO send from server
+                       float maxvel, minvel, curvel;
+                       minvel = 400;
+                       maxvel = 1000;
+                       curvel = vlen(pmove_vel);
+
+                       f = bound(0, (curvel - minvel) / (maxvel - minvel), 1);
+                       x = cos(f * M_2_PI);
+                       y = sin(f * M_2_PI);
+                       f = fabs(x) + fabs(y);
+                       x /= f;
+                       y /= f;
+                       print("x:", ftos(x), " y:", ftos(y), "\n");
+                       if(x >= 0 && y >= 0) // first quadrant
+                       {
+                               R_BeginPolygon("gfx/nex_ring.tga", DRAWFLAG_ADDITIVE);
+
+                               v = ringorigin;                 t = '0.5 0.5 0';
+                               R_PolygonVertex(v, t, '1 1 1', 1);
+
+                               v = ringorigin;                 t = '0.5 0.5 0';
+                               v_x += 0.5 * ringsize_x;        t += '0.5 0.5 0';
+                               R_PolygonVertex(v, t, '1 1 1', 1);
+
+                               v = ringorigin;                 t = '0.5 0.5 0';
+                               v_x += x * 0.5 * ringsize_x;    t += x * '0.5 0.5 0';
+                               v_y += y * 0.5 * ringsize_y;    t += y * '0.5 -0.5 0';
+                               R_PolygonVertex(v, t, '1 1 1', 1);
+                               R_EndPolygon();
+                       }
+               }
+
                // crosshair goes VERY LAST
                if(!scoreboard_active && !camera_active && intermission != 2) {
                        // TrueAim check