mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-02-01 12:20:54 +00:00
New Cvar function: Cvar_SetFlags. Yes, it's there for completeness.
Some minor changes to DGA code I couldn't be bothered to back out before I committed. They don't hurt anything, but they don't really improve matters much either. The mouse cursor still doesn't get warped off the screen, but it's no longer bright blue - now it's black and white like normal. I'm rewriting the damned DGA code from scratch to Get It Right this time.
This commit is contained in:
parent
30d1dc1c87
commit
ef1c6be3df
4 changed files with 62 additions and 29 deletions
|
@ -76,34 +76,42 @@ typedef struct cvar_alias_s
|
|||
// "look, the user made fs_basepath already", uses the users value, but sets
|
||||
// CVAR_ROM as per the call.
|
||||
|
||||
|
||||
// Returns the Cvar if found, creates it with value if not. Description and
|
||||
// flags are always updated.
|
||||
cvar_t *Cvar_Get (char *name, char *value, int cvarflags, char *description);
|
||||
|
||||
cvar_t *Cvar_FindAlias (char *alias_name);
|
||||
|
||||
void Cvar_Alias_Get (char *name, cvar_t *cvar);
|
||||
|
||||
// equivelants to "<name> <variable>" typed at the console
|
||||
void Cvar_Set (cvar_t *var, char *value);
|
||||
// equivelant to "<name> <variable>" typed at the console
|
||||
void Cvar_SetValue (cvar_t *var, float value);
|
||||
float Cvar_VariableValue (char *var_name);
|
||||
|
||||
// allows you to change a Cvar's flags without a full Cvar_Get
|
||||
void Cvar_SetFlags (cvar_t *var, int cvarflags);
|
||||
|
||||
// returns 0 if not defined or non numeric
|
||||
float Cvar_VariableValue (char *var_name);
|
||||
|
||||
char *Cvar_VariableString (char *var_name);
|
||||
// returns an empty string if not defined
|
||||
char *Cvar_VariableString (char *var_name);
|
||||
|
||||
char *Cvar_CompleteVariable (char *partial);
|
||||
// attempts to match a partial variable name for command line completion
|
||||
// returns NULL if nothing fits
|
||||
char *Cvar_CompleteVariable (char *partial);
|
||||
|
||||
qboolean Cvar_Command (void);
|
||||
// called by Cmd_ExecuteString when Cmd_Argv(0) doesn't match a known
|
||||
// command. Returns true if the command was a variable reference that
|
||||
// was handled. (print or change)
|
||||
qboolean Cvar_Command (void);
|
||||
|
||||
void Cvar_WriteVariables (FILE *f);
|
||||
// Writes lines containing "set variable value" for all variables
|
||||
// with the archive flag set to true.
|
||||
void Cvar_WriteVariables (FILE *f);
|
||||
|
||||
// Returns a pointer to the Cvar, NULL if not found
|
||||
cvar_t *Cvar_FindVar (char *var_name);
|
||||
|
||||
void Cvar_Init();
|
||||
|
|
|
@ -200,12 +200,12 @@ void Cvar_Set (cvar_t *var, char *value)
|
|||
|
||||
Cvar_Info(var);
|
||||
}
|
||||
/*
|
||||
|
||||
|
||||
/*
|
||||
Cvar_SetROM
|
||||
|
||||
doesn't check for CVAR_ROM flag
|
||||
|
||||
*/
|
||||
void Cvar_SetROM (cvar_t *var, char *value)
|
||||
{
|
||||
|
@ -464,3 +464,18 @@ cvar_t *Cvar_Get(char *name, char *string, int cvarflags, char *description)
|
|||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
/*
|
||||
Cvar_SetFlags
|
||||
|
||||
sets a Cvar's flags simply and easily
|
||||
*/
|
||||
void
|
||||
Cvar_SetFlags (cvar_t *var, int cvarflags);
|
||||
{
|
||||
if (var == NULL)
|
||||
return;
|
||||
|
||||
var->flags = cvarflags;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ cvar_t *_windowed_mouse;
|
|||
cvar_t *m_filter;
|
||||
#ifdef HAVE_DGA
|
||||
cvar_t *in_dgamouse;
|
||||
cvar_t *vid_dga_mouseaccel;
|
||||
cvar_t *in_dga_mouseaccel;
|
||||
#endif
|
||||
|
||||
static qboolean mouse_avail;
|
||||
|
@ -297,8 +297,8 @@ event_motion(XEvent *event)
|
|||
{
|
||||
#ifdef HAVE_DGA
|
||||
if (in_dgamouse->value) {
|
||||
mouse_x += event->xmotion.x_root * vid_dga_mouseaccel->value;
|
||||
mouse_y += event->xmotion.y_root * vid_dga_mouseaccel->value;
|
||||
mouse_x += event->xmotion.x_root * in_dga_mouseaccel->value;
|
||||
mouse_y += event->xmotion.y_root * in_dga_mouseaccel->value;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
|
@ -461,11 +461,20 @@ IN_Init(void)
|
|||
|
||||
_windowed_mouse = Cvar_Get ("_windowed_mouse","0",CVAR_ARCHIVE,"None");
|
||||
m_filter = Cvar_Get ("m_filter","0",CVAR_ARCHIVE,"None");
|
||||
in_dgamouse = Cvar_Get ("in_dgamouse", "0", CVAR_NONE,
|
||||
"1 if you have DGA mouse support");
|
||||
|
||||
|
||||
if (COM_CheckParm("-nomouse")) return 1;
|
||||
#ifdef HAVE_DGA
|
||||
vid_dga_mouseaccel = Cvar_Get ("vid_dga_mouseaccel","1",CVAR_ARCHIVE,
|
||||
in_dga_mouseaccel = Cvar_Get ("in_dga_mouseaccel","1",CVAR_ARCHIVE,
|
||||
"None");
|
||||
|
||||
if (!COM_CheckParm("-nodga")) {
|
||||
if (!COM_CheckParm("-nodga"))
|
||||
{
|
||||
XGrabKeyboard (x_disp, x_win, True, GrabModeAsync,
|
||||
GrabModeAsync, CurrentTime);
|
||||
|
||||
// XF86DGASetViewPort, XF86DGASetVidPage, and XF86DGADirectVideo's
|
||||
// XF86DGADirectVideo flag are disabled till someone has a chance to
|
||||
// figure out what's wrong with them (if anything) --KB
|
||||
|
@ -476,29 +485,30 @@ IN_Init(void)
|
|||
XF86DGADirectMouse|XF86DGADirectKeyb);
|
||||
// XF86DGASetVidPage(x_disp, DefaultScreen(x_disp), 0);
|
||||
|
||||
XGrabKeyboard (x_disp, x_win, True, GrabModeAsync,
|
||||
GrabModeAsync, CurrentTime);
|
||||
|
||||
XWarpPointer (x_disp, None, x_win, 0, 0, 0, 0, scr_width,
|
||||
scr_height);
|
||||
XWarpPointer(x_disp, None, x_win, 0, 0, 0, 0,
|
||||
vid.width, vid.height);
|
||||
// XWarpPointer (x_disp, None, x_win, 0, 0, 0, 0, scr_width,
|
||||
// scr_height);
|
||||
|
||||
XGrabPointer (x_disp, x_win, True, MOUSE_MASK, GrabModeAsync,
|
||||
GrabModeAsync, x_win, None, CurrentTime);
|
||||
|
||||
in_dgamouse = Cvar_Get ("in_dgamouse", "1", CVAR_ROM,
|
||||
"1 if you have DGA mouse support");
|
||||
} else
|
||||
in_dgamouse = Cvar_Get ("in_dgamouse", "0", CVAR_ROM,
|
||||
"1 if you have DGA mouse support");
|
||||
|
||||
Cvar_Set (in_dgamouse, "1");
|
||||
}
|
||||
#endif
|
||||
if (COM_CheckParm("-nomouse")) return 1;
|
||||
|
||||
in_dgamouse = Cvar_Get ("in_dgamouse", "0", CVAR_ROM,
|
||||
"1 if you have DGA mouse support");
|
||||
|
||||
mouse_x = mouse_y = 0.0;
|
||||
mouse_avail = 1;
|
||||
|
||||
/* Invisible cursor */
|
||||
CreateNullCursor(x_disp, x_win);
|
||||
XDefineCursor(x_disp, x_win, nullcursor);
|
||||
if (!in_dgamouse->value)
|
||||
{
|
||||
CreateNullCursor(x_disp, x_win);
|
||||
XDefineCursor(x_disp, x_win, nullcursor);
|
||||
}
|
||||
|
||||
x11_add_event(KeyPress, &event_key);
|
||||
x11_add_event(KeyRelease, &event_key);
|
||||
|
|
|
@ -92,7 +92,7 @@ unsigned char d_15to8table[65536];
|
|||
cvar_t *vid_mode;
|
||||
cvar_t *vid_fullscreen;
|
||||
extern cvar_t *gl_triplebuffer;
|
||||
extern cvar_t *vid_dga_mouseaccel;
|
||||
extern cvar_t *in_dga_mouseaccel;
|
||||
|
||||
#ifdef HAVE_VIDMODE
|
||||
static XF86VidModeModeInfo **vidmodes;
|
||||
|
@ -420,7 +420,7 @@ void VID_Init(unsigned char *palette)
|
|||
gl_ztrick = Cvar_Get ("gl_ztrick","0",CVAR_ARCHIVE,"None");
|
||||
vid_fullscreen = Cvar_Get ("vid_fullscreen","0",0,"None");
|
||||
#ifdef HAVE_DGA
|
||||
vid_dga_mouseaccel = Cvar_Get("vid_dga_mouseaccel","1",CVAR_ARCHIVE,
|
||||
in_dga_mouseaccel = Cvar_Get("vid_dga_mouseaccel","1",CVAR_ARCHIVE,
|
||||
"None");
|
||||
#endif
|
||||
vid.maxwarpwidth = WARP_WIDTH;
|
||||
|
|
Loading…
Reference in a new issue