]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added cl_prydoncursor_notrace cvar
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 27 Feb 2010 18:09:54 +0000 (18:09 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 27 Feb 2010 18:09:54 +0000 (18:09 +0000)
added support for cl_prydoncursor < 0 as no visible cursor

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10025 d7cf8633-e32d-0410-b094-e92efae38249

cl_input.c
cl_main.c
client.h
sbar.c

index 9f75a36fbc4571c39d75aaa09572ad9e1de0f374..5c4d449d0d71cb792910b2d29ad15c4816399e88 100644 (file)
@@ -625,7 +625,7 @@ void CL_Input (void)
        if (!key_consoleactive && key_dest == key_game && !cl.csqc_wantsmousemove)
        {
                float modulatedsensitivity = sensitivity.value * cl.sensitivityscale;
-               if (cl_prydoncursor.integer)
+               if (cl_prydoncursor.integer > 0)
                {
                        // mouse interacting with the scene, mostly stationary view
                        V_StopPitchDrift();
@@ -743,7 +743,7 @@ void CL_UpdatePrydonCursor(void)
 {
        vec3_t temp;
 
-       if (!cl_prydoncursor.integer)
+       if (cl_prydoncursor.integer <= 0)
                VectorClear(cl.cmd.cursor_screen);
 
        /*
@@ -778,7 +778,15 @@ void CL_UpdatePrydonCursor(void)
        VectorSet(temp, cl.cmd.cursor_screen[2] * 1000000, (v_flipped.integer ? -1 : 1) * cl.cmd.cursor_screen[0] * -r_refdef.view.frustum_x * 1000000, cl.cmd.cursor_screen[1] * -r_refdef.view.frustum_y * 1000000);
        Matrix4x4_Transform(&r_refdef.view.matrix, temp, cl.cmd.cursor_end);
        // trace from view origin to the cursor
-       cl.cmd.cursor_fraction = CL_SelectTraceLine(cl.cmd.cursor_start, cl.cmd.cursor_end, cl.cmd.cursor_impact, cl.cmd.cursor_normal, &cl.cmd.cursor_entitynumber, (chase_active.integer || cl.intermission) ? &cl.entities[cl.playerentity].render : NULL);
+       if (cl_prydoncursor_notrace.integer)
+       {
+               cl.cmd.cursor_fraction = 1.0f;
+               VectorCopy(cl.cmd.cursor_end, cl.cmd.cursor_impact);
+               VectorClear(cl.cmd.cursor_normal);
+               cl.cmd.cursor_entitynumber = 0;
+       }
+       else
+               cl.cmd.cursor_fraction = CL_SelectTraceLine(cl.cmd.cursor_start, cl.cmd.cursor_end, cl.cmd.cursor_impact, cl.cmd.cursor_normal, &cl.cmd.cursor_entitynumber, (chase_active.integer || cl.intermission) ? &cl.entities[cl.playerentity].render : NULL);
 }
 
 typedef enum waterlevel_e
@@ -1678,7 +1686,7 @@ void CL_SendMove(void)
        if (in_button8.state  & 3) bits |= 128;
        if (in_use.state      & 3) bits |= 256;
        if (key_dest != key_game || key_consoleactive) bits |= 512;
-       if (cl_prydoncursor.integer) bits |= 1024;
+       if (cl_prydoncursor.integer > 0) bits |= 1024;
        if (in_button9.state  & 3)  bits |=   2048;
        if (in_button10.state  & 3) bits |=   4096;
        if (in_button11.state  & 3) bits |=   8192;
index 3edb319a2d18244333efb3a159ef873948a749b7..abf851c511aa9ba9a81ba93eab88eb3b84fd412a 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -84,6 +84,7 @@ cvar_t cl_dlights_decaybrightness = {CVAR_SAVE, "cl_dlights_decaybrightness", "1
 cvar_t qport = {0, "qport", "0", "identification key for playing on qw servers (allows you to maintain a connection to a quakeworld server even if your port changes)"};
 
 cvar_t cl_prydoncursor = {0, "cl_prydoncursor", "0", "enables a mouse pointer which is able to click on entities in the world, useful for point and click mods, see PRYDON_CLIENTCURSOR extension in dpextensions.qc"};
+cvar_t cl_prydoncursor_notrace = {0, "cl_prydoncursor_notrace", "0", "disables traceline used in prydon cursor reporting to the game, saving some cpu time"};
 
 cvar_t cl_deathnoviewmodel = {0, "cl_deathnoviewmodel", "1", "hides gun model when dead"};
 
@@ -2378,6 +2379,7 @@ void CL_Init (void)
        Cvar_RegisterVariable(&cl_dlights_decaybrightness);
 
        Cvar_RegisterVariable(&cl_prydoncursor);
+       Cvar_RegisterVariable(&cl_prydoncursor_notrace);
 
        Cvar_RegisterVariable(&cl_deathnoviewmodel);
 
index 4bd1738da9fe70a783279f91c7c1631d6b4f480d..fe6c3b39149cf5801405ada3fa2bfbbcffa4202a 100644 (file)
--- a/client.h
+++ b/client.h
@@ -1282,6 +1282,7 @@ extern cvar_t cl_stainmaps;
 extern cvar_t cl_stainmaps_clearonload;
 
 extern cvar_t cl_prydoncursor;
+extern cvar_t cl_prydoncursor_notrace;
 
 extern cvar_t cl_locs_enable;
 
diff --git a/sbar.c b/sbar.c
index 47220bf785dc92bc35f7a549dbd14f0b6d553dd3..81c72f8d55cffbae5db10494af1033e47ccbfbbd 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -1748,7 +1748,7 @@ void Sbar_Draw (void)
                DrawQ_Pic((vid_conwidth.integer - pic->width * crosshair_size.value) * 0.5f, (vid_conheight.integer - pic->height * crosshair_size.value) * 0.5f, pic, pic->width * crosshair_size.value, pic->height * crosshair_size.value, crosshair_color_red.value, crosshair_color_green.value, crosshair_color_blue.value, crosshair_color_alpha.value, 0);
        }
 
-       if (cl_prydoncursor.integer)
+       if (cl_prydoncursor.integer > 0)
                DrawQ_Pic((cl.cmd.cursor_screen[0] + 1) * 0.5 * vid_conwidth.integer, (cl.cmd.cursor_screen[1] + 1) * 0.5 * vid_conheight.integer, Draw_CachePic (va("gfx/prydoncursor%03i", cl_prydoncursor.integer)), 0, 0, 1, 1, 1, 1, 0);
 }