X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=vid_wgl.c;h=1e5a738271e703cd4ccf773f200cc3445ad9048d;hp=afb773f5d97c8df395ce5e11e4be285cf74d29d8;hb=ecd3993b078bdd6deb9af935a706efa7202d88c3;hpb=aa33d8f8642530f7f266d6cde1422f95aa74b2be diff --git a/vid_wgl.c b/vid_wgl.c index afb773f5..1e5a7382 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -24,9 +24,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #include +#include #include #include "resource.h" #include +#include extern void S_BlockSound (void); extern void S_UnblockSound (void); @@ -40,6 +42,8 @@ extern HINSTANCE global_hInstance; // Tell startup code that we have a client int cl_available = true; +qboolean vid_supportrefreshrate = true; + static int (WINAPI *qwglChoosePixelFormat)(HDC, CONST PIXELFORMATDESCRIPTOR *); static int (WINAPI *qwglDescribePixelFormat)(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR); //static int (WINAPI *qwglGetPixelFormat)(HDC); @@ -113,8 +117,6 @@ static qboolean dinput; // input code -#include - #define DINPUT_BUFFERSIZE 16 #define iDirectInputCreate(a,b,c,d) pDirectInputCreate(a,b,c,d) @@ -145,7 +147,7 @@ static int mouse_buttons; static int mouse_oldbuttonstate; static qboolean restore_spi; -static int originalmouseparms[3], newmouseparms[3] = {0, 0, 1}; +static int originalmouseparms[3], newmouseparms[3] = {0, 0, 0}; static unsigned int uiWheelMessage; static qboolean mouseparmsvalid; @@ -184,25 +186,25 @@ static PDWORD pdwRawValue[JOY_MAX_AXES]; // each time. this avoids any problems with getting back to a default usage // or when changing from one controller to another. this way at least something // works. -static cvar_t in_joystick = {CVAR_SAVE, "joystick","0"}; -static cvar_t joy_name = {0, "joyname", "joystick"}; -static cvar_t joy_advanced = {0, "joyadvanced", "0"}; -static cvar_t joy_advaxisx = {0, "joyadvaxisx", "0"}; -static cvar_t joy_advaxisy = {0, "joyadvaxisy", "0"}; -static cvar_t joy_advaxisz = {0, "joyadvaxisz", "0"}; -static cvar_t joy_advaxisr = {0, "joyadvaxisr", "0"}; -static cvar_t joy_advaxisu = {0, "joyadvaxisu", "0"}; -static cvar_t joy_advaxisv = {0, "joyadvaxisv", "0"}; -static cvar_t joy_forwardthreshold = {0, "joyforwardthreshold", "0.15"}; -static cvar_t joy_sidethreshold = {0, "joysidethreshold", "0.15"}; -static cvar_t joy_pitchthreshold = {0, "joypitchthreshold", "0.15"}; -static cvar_t joy_yawthreshold = {0, "joyyawthreshold", "0.15"}; -static cvar_t joy_forwardsensitivity = {0, "joyforwardsensitivity", "-1.0"}; -static cvar_t joy_sidesensitivity = {0, "joysidesensitivity", "-1.0"}; -static cvar_t joy_pitchsensitivity = {0, "joypitchsensitivity", "1.0"}; -static cvar_t joy_yawsensitivity = {0, "joyyawsensitivity", "-1.0"}; -static cvar_t joy_wwhack1 = {0, "joywwhack1", "0.0"}; -static cvar_t joy_wwhack2 = {0, "joywwhack2", "0.0"}; +static cvar_t in_joystick = {CVAR_SAVE, "joystick","0", "enables joysticks"}; +static cvar_t joy_name = {0, "joyname", "joystick", "name of joystick to use (informational only, used only by joyadvanced 1 mode)"}; +static cvar_t joy_advanced = {0, "joyadvanced", "0", "use more than 2 axis joysticks (configuring this is very technical)"}; +static cvar_t joy_advaxisx = {0, "joyadvaxisx", "0", "axis mapping for joyadvanced 1 mode"}; +static cvar_t joy_advaxisy = {0, "joyadvaxisy", "0", "axis mapping for joyadvanced 1 mode"}; +static cvar_t joy_advaxisz = {0, "joyadvaxisz", "0", "axis mapping for joyadvanced 1 mode"}; +static cvar_t joy_advaxisr = {0, "joyadvaxisr", "0", "axis mapping for joyadvanced 1 mode"}; +static cvar_t joy_advaxisu = {0, "joyadvaxisu", "0", "axis mapping for joyadvanced 1 mode"}; +static cvar_t joy_advaxisv = {0, "joyadvaxisv", "0", "axis mapping for joyadvanced 1 mode"}; +static cvar_t joy_forwardthreshold = {0, "joyforwardthreshold", "0.15", "minimum joystick movement necessary to move forward"}; +static cvar_t joy_sidethreshold = {0, "joysidethreshold", "0.15", "minimum joystick movement necessary to move sideways (strafing)"}; +static cvar_t joy_pitchthreshold = {0, "joypitchthreshold", "0.15", "minimum joystick movement necessary to look up/down"}; +static cvar_t joy_yawthreshold = {0, "joyyawthreshold", "0.15", "minimum joystick movement necessary to turn left/right"}; +static cvar_t joy_forwardsensitivity = {0, "joyforwardsensitivity", "-1.0", "how fast the joystick moves forward"}; +static cvar_t joy_sidesensitivity = {0, "joysidesensitivity", "-1.0", "how fast the joystick moves sideways (strafing)"}; +static cvar_t joy_pitchsensitivity = {0, "joypitchsensitivity", "1.0", "how fast the joystick looks up/down"}; +static cvar_t joy_yawsensitivity = {0, "joyyawsensitivity", "-1.0", "how fast the joystick turns left/right"}; +static cvar_t joy_wwhack1 = {0, "joywwhack1", "0.0", "special hack for wingman warrior"}; +static cvar_t joy_wwhack2 = {0, "joywwhack2", "0.0", "special hack for wingman warrior"}; static qboolean joy_avail, joy_advancedinit, joy_haspov; static DWORD joy_oldbuttonstate, joy_oldpovstate; @@ -260,7 +262,7 @@ static void IN_StartupMouse (void); //==================================== -void VID_Finish (void) +void VID_Finish (qboolean allowmousegrab) { qboolean vid_usemouse; @@ -273,7 +275,7 @@ void VID_Finish (void) // handle the mouse state when windowed if that's changed vid_usemouse = false; - if (vid_mouse.integer && !key_consoleactive && !cls.demoplayback) + if (allowmousegrab && vid_mouse.integer && !key_consoleactive && !cls.demoplayback) vid_usemouse = true; if (vid_isfullscreen) vid_usemouse = true; @@ -287,6 +289,8 @@ void VID_Finish (void) qglFinish(); SwapBuffers(baseDC); } + + VID_UpdateGamma(false, 256); } //========================================================================== @@ -294,7 +298,7 @@ void VID_Finish (void) -static qbyte scantokey[128] = +static unsigned char scantokey[128] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 0 ,27 ,'1' ,'2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' ,'0' ,'-' ,'=' ,K_BACKSPACE,9 ,//0 @@ -469,6 +473,26 @@ void Sys_SendKeyEvents (void) LONG CDAudio_MessageHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); +static keynum_t buttonremap[16] = +{ + K_MOUSE1, + K_MOUSE2, + K_MOUSE3, + K_MOUSE4, + K_MOUSE5, + K_MOUSE6, + K_MOUSE7, + K_MOUSE8, + K_MOUSE9, + K_MOUSE10, + K_MOUSE11, + K_MOUSE12, + K_MOUSE13, + K_MOUSE14, + K_MOUSE15, + K_MOUSE16, +}; + /* main window procedure */ LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { @@ -567,9 +591,9 @@ LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { // perform button actions int i; - for (i=0 ; i= 32) @@ -767,10 +791,11 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp) vid_isfullscreen = false; if (fullscreen) { - gdevmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; + gdevmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY; gdevmode.dmBitsPerPel = bpp; gdevmode.dmPelsWidth = width; gdevmode.dmPelsHeight = height; + gdevmode.dmDisplayFrequency = refreshrate; gdevmode.dmSize = sizeof (gdevmode); if (ChangeDisplaySettings (&gdevmode, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) { @@ -1265,9 +1290,9 @@ static void IN_MouseMove (void) } // perform button actions - for (i=0 ; i