]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Static/floating crosshair is now an option controled by the cvar "crosshair_static"
authormolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 21 Aug 2002 07:47:52 +0000 (07:47 +0000)
committermolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 21 Aug 2002 07:47:52 +0000 (07:47 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2269 d7cf8633-e32d-0410-b094-e92efae38249

menu.c
r_crosshairs.c
screen.h

diff --git a/menu.c b/menu.c
index 7ae34c490be588759985a87168f8c3d8bdc0c97e..68538b40da8c3c0df566adf8960b3034cd7dcef0 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -1275,7 +1275,7 @@ void M_DrawCheckbox (int x, int y, int on)
 }
 
 
-#define        OPTIONS_ITEMS   27
+#define        OPTIONS_ITEMS   28
 
 int            options_cursor;
 
@@ -1339,10 +1339,13 @@ void M_Menu_Options_AdjustSliders (int dir)
        case 18:
                Cvar_SetValueQuick (&crosshair_size, bound(1, crosshair_size.value + dir, 5));
                break;
-       case 19: // show framerate
+       case 19: // static crosshair
+               Cvar_SetValueQuick (&crosshair_static, !crosshair_static.integer);
+               break;
+       case 20: // show framerate
                Cvar_SetValueQuick (&showfps, !showfps.integer);
                break;
-       case 20: // always run
+       case 21: // always run
                if (cl_forwardspeed.value > 200)
                {
                        Cvar_SetValueQuick (&cl_forwardspeed, 200);
@@ -1354,22 +1357,22 @@ void M_Menu_Options_AdjustSliders (int dir)
                        Cvar_SetValueQuick (&cl_backspeed, 400);
                }
                break;
-       case 21: // lookspring
+       case 22: // lookspring
                Cvar_SetValueQuick (&lookspring, !lookspring.integer);
                break;
-       case 22: // lookstrafe
+       case 23: // lookstrafe
                Cvar_SetValueQuick (&lookstrafe, !lookstrafe.integer);
                break;
-       case 23: // mouse speed
+       case 24: // mouse speed
                Cvar_SetValueQuick (&sensitivity, bound(1, sensitivity.value + dir * 0.5, 50));
                break;
-       case 24: // mouse look
+       case 25: // mouse look
                Cvar_SetValueQuick (&freelook, !freelook.integer);
                break;
-       case 25: // invert mouse
+       case 26: // invert mouse
                Cvar_SetValueQuick (&m_pitch, -m_pitch.value);
                break;
-       case 26: // windowed mouse
+       case 27: // windowed mouse
                Cvar_SetValueQuick (&vid_mouse, !vid_mouse.integer);
                break;
        }
@@ -1404,6 +1407,7 @@ void M_Options_Draw (void)
        M_ItemPrint(16, y, "          Sound Volume", snd_initialized);M_DrawSlider(220, y, volume.value);y += 8;
        M_Print(16, y, "             Crosshair");M_DrawSlider(220, y, crosshair.value / 5);y += 8;
        M_Print(16, y, "        Crosshair Size");M_DrawSlider(220, y, (crosshair_size.value - 1) / 4);y += 8;
+       M_Print(16, y, "      Static Crosshair");M_DrawCheckbox(220, y, crosshair_static.integer);y += 8;
        M_Print(16, y, "        Show Framerate");M_DrawCheckbox(220, y, showfps.integer);y += 8;
        M_Print(16, y, "            Always Run");M_DrawCheckbox(220, y, cl_forwardspeed.value > 200);y += 8;
        M_Print(16, y, "            Lookspring");M_DrawCheckbox(220, y, lookspring.integer);y += 8;
index 51294f182d87f3da704971dc24f7b0436e9fac48..193658118213fb9342f46e2bb3050aaa497fca97 100644 (file)
@@ -7,6 +7,7 @@ cvar_t crosshair_alpha = {CVAR_SAVE, "crosshair_alpha", "1"};
 cvar_t crosshair_flashspeed = {CVAR_SAVE, "crosshair_flashspeed", "2"};
 cvar_t crosshair_flashrange = {CVAR_SAVE, "crosshair_flashrange", "0.1"};
 cvar_t crosshair_size = {CVAR_SAVE, "crosshair_size", "1"};
+cvar_t crosshair_static = {CVAR_SAVE, "crosshair_static", "0"};
 
 // must match NUMCROSSHAIRS in gl_draw.c
 #define NUMCROSSHAIRS 5
@@ -149,42 +150,10 @@ void R_Crosshairs_Init(void)
        Cvar_RegisterVariable(&crosshair_flashspeed);
        Cvar_RegisterVariable(&crosshair_flashrange);
        Cvar_RegisterVariable(&crosshair_size);
+       Cvar_RegisterVariable(&crosshair_static);
        R_RegisterModule("R_Crosshair", r_crosshairs_start, r_crosshairs_shutdown, r_crosshairs_newmap);
 }
 
-/*
-void DrawCrosshair(int num)
-{
-       int i;
-       qbyte *color;
-       float scale, base;
-       char *picname;
-       cachepic_t *pic;
-       if (num < 0 || num >= NUMCROSSHAIRS)
-               num = 0;
-       if (cl.viewentity >= 1 && cl.viewentity <= cl.maxclients)
-       {
-               i = (cl.scores[cl.viewentity-1].colors & 0xF) << 4;
-               if (i >= 208 && i < 224) // blue
-                       i += 8;
-               else if (i < 128 || i >= 224) // 128-224 are backwards ranges (bright to dark, rather than dark to bright)
-                       i += 15;
-       }
-       else
-               i = 15;
-       color = (qbyte *) &d_8to24table[i];
-       if (crosshair_flashspeed.value >= 0.01f)
-               base = (sin(realtime * crosshair_flashspeed.value * (M_PI*2.0f)) * crosshair_flashrange.value);
-       else
-               base = 0.0f;
-       scale = crosshair_brightness.value * (1.0f / 255.0f);
-       picname = va("gfx/crosshair%i.tga", num + 1);
-       pic = Draw_CachePic(picname);
-       if (pic)
-               DrawQ_Pic((vid.conwidth - pic->width * crosshair_size.value) * 0.5f, (vid.conheight - pic->height * crosshair_size.value) * 0.5f, picname, pic->width * crosshair_size.value, pic->height * crosshair_size.value, color[0] * scale + base, color[1] * scale + base, color[2] * scale + base, crosshair_alpha.value, 0);
-}
-*/
-
 void R_DrawCrosshairSprite(rtexture_t *texture, vec3_t origin, vec_t scale, float cr, float cg, float cb, float ca)
 {
        rmeshbufferinfo_t m;
@@ -268,10 +237,18 @@ void R_DrawCrosshair(void)
        else
                base = 0.0f;
        scale = crosshair_brightness.value * (1.0f / 255.0f);
-       //picname = va("gfx/crosshair%i.tga", num + 1);
-       //pic = Draw_CachePic(picname);
-       //if (pic)
-       //      DrawQ_Pic((vid.conwidth - pic->width * crosshair_size.value) * 0.5f, (vid.conheight - pic->height * crosshair_size.value) * 0.5f, picname, pic->width * crosshair_size.value, pic->height * crosshair_size.value, color[0] * scale + base, color[1] * scale + base, color[2] * scale + base, crosshair_alpha.value, 0);
+
+       if (crosshair_static.integer)
+       {
+               char *picname;
+               cachepic_t *pic;
+
+               picname = va("gfx/crosshair%i.tga", num + 1);
+               pic = Draw_CachePic(picname);
+               if (pic)
+                       DrawQ_Pic((vid.conwidth - pic->width * crosshair_size.value) * 0.5f, (vid.conheight - pic->height * crosshair_size.value) * 0.5f, picname, pic->width * crosshair_size.value, pic->height * crosshair_size.value, color[0] * scale + base, color[1] * scale + base, color[2] * scale + base, crosshair_alpha.value, 0);
+       }
+       else
        {
                // trace the shot path up to a certain distance
                VectorCopy(cl_entities[cl.viewentity].render.origin, v1);
index 33283a432bd7827750227d4a6b2925c3432fa727..4e5357bc54f6a0083c95cde642d222dfb5ba799f 100644 (file)
--- a/screen.h
+++ b/screen.h
@@ -42,6 +42,7 @@ extern cvar_t showfps;
 
 extern cvar_t crosshair;
 extern cvar_t crosshair_size;
+extern cvar_t crosshair_static;
 
 #endif