From 63f2f2422398cd79dedcefcf9fbd14421841396f Mon Sep 17 00:00:00 2001 From: havoc Date: Sat, 27 Feb 2010 18:09:54 +0000 Subject: [PATCH] added cl_prydoncursor_notrace cvar 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 | 16 ++++++++++++---- cl_main.c | 2 ++ client.h | 1 + sbar.c | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/cl_input.c b/cl_input.c index 9f75a36f..5c4d449d 100644 --- a/cl_input.c +++ b/cl_input.c @@ -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; diff --git a/cl_main.c b/cl_main.c index 3edb319a..abf851c5 100644 --- 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); diff --git a/client.h b/client.h index 4bd1738d..fe6c3b39 100644 --- 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 47220bf7..81c72f8d 100644 --- 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); } -- 2.39.2