]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/View.qc
Merge remote branch 'origin/fruitiex/precache_crosshair_ring'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / View.qc
index 04f300703ca5da0e28b3361849c436bc24333c18..9953af664b7b4db76233623bfa69a9c8d2aa166c 100644 (file)
@@ -566,7 +566,7 @@ void CSQC_UpdateView(float w, float h)
        // next R_RenderScene call
        drawstring('0 0 0', "", '1 1 0', '1 1 1', 0, 0);
 
-       if(cvar("r_fakelight") >= 2)
+       if(cvar("r_fakelight") >= 2 || cvar("r_fullbright"))
        {
                // apply night vision effect
                vector rgb, tc_00, tc_01, tc_10, tc_11;
@@ -698,44 +698,22 @@ void CSQC_UpdateView(float w, float h)
                                CSQC_common_hud();
 
 
+               precache_pic("gfx/nex_ring.tga");
                // 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);
+                       float f, a, curvel;
+                       vector rgb;
 
-                               v = ringorigin;                 t = '0.5 0.5 0';
-                               R_PolygonVertex(v, t, '1 1 1', 1);
+                       rgb_x = cvar("crosshair_nexvelocity_color_red");
+                       rgb_y = cvar("crosshair_nexvelocity_color_green");
+                       rgb_z = cvar("crosshair_nexvelocity_color_blue");
+                       a = cvar("crosshair_nexvelocity_alpha");
 
-                               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);
+                       curvel = vlen('1 0 0' * pmove_vel_x + '0 1 0' * pmove_vel_y);
+                       f = bound(0, (curvel - nex_minvelocity) / (nex_maxvelocity - nex_minvelocity), 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();
-                       }
+                       DrawCircleClippedPic('0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight, 0.1 * vid_conheight, "gfx/nex_ring.tga", f, rgb, a, DRAWFLAG_ADDITIVE);
                }
 
                // crosshair goes VERY LAST
@@ -916,7 +894,12 @@ void CSQC_UpdateView(float w, float h)
                                {
                                        CROSSHAIR_DO_BLUR(CROSSHAIR_DRAW_RING, wcross_resolution, wcross_name, wcross_alpha);
                                }
+
                                CROSSHAIR_DRAW(wcross_resolution, wcross_name, wcross_alpha * f);
+
+                               if(cvar("crosshair_dot"))
+                                       CROSSHAIR_DRAW(wcross_resolution * cvar("crosshair_dot_size"), "gfx/crosshairdot.tga", wcross_alpha * f * cvar("crosshair_dot_alpha"));
+
                                wcross_name_alpha_goal_prev = f;
                        }
                }