Esempio n. 1
0
void
V_UpdatePalette(void)
{
    int i;
    qboolean force;

    V_CalcPowerupCshift();

    /* drop the damage value */
    cl.cshifts[CSHIFT_DAMAGE].percent -= host_frametime * 150;
    if (cl.cshifts[CSHIFT_DAMAGE].percent < 0)
	cl.cshifts[CSHIFT_DAMAGE].percent = 0;

    /* drop the bonus value */
    cl.cshifts[CSHIFT_BONUS].percent -= host_frametime * 100;
    if (cl.cshifts[CSHIFT_BONUS].percent < 0)
	cl.cshifts[CSHIFT_BONUS].percent = 0;

    force = V_CheckGamma();

    if (force) {
	for (i = 0; i < 256; i++) {
	    ramps[0][i] = gammatable[i] << 8;
	    ramps[1][i] = gammatable[i] << 8;
	    ramps[2][i] = gammatable[i] << 8;
	}
#ifndef __LIBRETRO__
	if (VID_IsFullScreen() && VID_SetGammaRamp)
	    VID_SetGammaRamp(ramps);
	//VID_ShiftPalette(NULL);
#endif
    }
}
Esempio n. 2
0
static void
windowed_mouse_f(struct cvar_s *var)
{
    if (var->value) {
	Con_DPrintf("Callback: _windowed_mouse ON\n");
	if (!VID_IsFullScreen()) {
	    IN_GrabMouse();
	    IN_GrabKeyboard();
	}
    } else {
	Con_DPrintf("Callback: _windowed_mouse OFF\n");
	if (!VID_IsFullScreen()) {
	    IN_UngrabMouse();
	    IN_UngrabKeyboard();
	}
    }
}
Esempio n. 3
0
void
IN_Commands(void)
{
    if (!mouse_available)
	return;

    // FIXME - Need this consistant, robust

    // If we have the mouse, but are not in the game...
    if (mouse_grab_active && key_dest != key_game && !VID_IsFullScreen()) {
	IN_UngrabMouse();
	IN_UngrabKeyboard();
    }
    // If we don't have the mouse, but we're in the game and we want it...
    if (!mouse_grab_active && key_dest == key_game &&
	(_windowed_mouse.value || VID_IsFullScreen())) {
	IN_GrabKeyboard();
	IN_GrabMouse();
	IN_CenterMouse();
    }
}
Esempio n. 4
0
void
IN_Init(void)
{
#ifdef USE_XF86DGA
    int MajorVersion, MinorVersion;
#endif
    keyboard_grab_active = false;
    mouse_grab_active = false;

    // FIXME - do proper detection?
    //       - Also, look at other vid_*.c files for clues
    mouse_available = (COM_CheckParm("-nomouse")) ? false : true;

    if (x_disp == NULL)
	Sys_Error("x_disp not initialised before input...");

#ifdef USE_XF86DGA
    dga_mouse_active = false;
    if (!XF86DGAQueryVersion(x_disp, &MajorVersion, &MinorVersion)) {
	Con_Printf("Failed to detect XF86DGA Mouse\n");
	in_dgamouse.value = 0;
	dga_available = false;
    } else {
	dga_available = true;
    }
#endif

    // Need to grab the input focus at startup, just in case...
    // FIXME - must be viewable or get BadMatch
    XSetInputFocus(x_disp, x_win, RevertToParent, CurrentTime);

    IN_InitCvars();

    if (VID_IsFullScreen()) {
	if (!mouse_grab_active)
	    IN_GrabMouse();
	if (!keyboard_grab_active)
	    IN_GrabKeyboard();
    }
}