]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_wgl.c
made some things static
[xonotic/darkplaces.git] / vid_wgl.c
index 11eea0e26b890a9a54a7751134116f72c03d2725..d15c5b0acad10c516cb13e36a7932e14493bf408 100644 (file)
--- a/vid_wgl.c
+++ b/vid_wgl.c
@@ -19,6 +19,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */
 // gl_vidnt.c -- NT GL vid component
 
+// we don't need a very new dinput
+#define DIRECTINPUT_VERSION 0x0300
+
 #include "quakedef.h"
 #include <windows.h>
 #include <dsound.h>
@@ -78,7 +81,6 @@ static qboolean vid_initialized = false;
 static qboolean vid_wassuspended = false;
 static qboolean vid_usingmouse = false;
 static qboolean vid_usingvsync = false;
-static qboolean vid_usemouse = false;
 static qboolean vid_usevsync = false;
 static HICON hIcon;
 
@@ -260,6 +262,8 @@ static void IN_StartupMouse (void);
 
 void VID_Finish (void)
 {
+       qboolean vid_usemouse;
+
        vid_usevsync = vid_vsync.integer && !cls.timedemo && gl_videosyncavailable;
        if (vid_usingvsync != vid_usevsync && gl_videosyncavailable)
        {
@@ -473,6 +477,7 @@ LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM  wParam, LPARAM lParam)
        char    state[256];
        char    asciichar[4];
        int             vkey;
+       int             charlength;
        qboolean down = false;
 
        if ( uMsg == uiWheelMessage )
@@ -503,8 +508,12 @@ LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM  wParam, LPARAM lParam)
                        GetKeyboardState (state);
                        // alt/ctrl/shift tend to produce funky ToAscii values,
                        // and if it's not a single character we don't know care about it
-                       if (vkey == K_ALT || vkey == K_CTRL || vkey == K_SHIFT || ToAscii (wParam, lParam >> 16, state, (unsigned short *)asciichar, 0) != 1)
+                       charlength = ToAscii (wParam, lParam >> 16, state, (unsigned short *)asciichar, 0);
+                       if (vkey == K_ALT || vkey == K_CTRL || vkey == K_SHIFT || charlength == 0)
                                asciichar[0] = 0;
+                       else if( charlength == 2 ) {
+                               asciichar[0] = asciichar[1];
+                       }
                        Key_Event (vkey, asciichar[0], down);
                        break;
 
@@ -689,7 +698,7 @@ void VID_Init(void)
        wc.lpszClassName = "DarkPlacesWindowClass";
 
        if (!RegisterClass (&wc))
-               Sys_Error("Couldn't register window class\n");
+               Con_Printf ("Couldn't register window class\n");
 
        IN_Init();
 }
@@ -945,6 +954,13 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp)
        IN_StartupMouse ();
        IN_StartupJoystick ();
 
+       if (gl_videosyncavailable)
+       {
+               vid_usevsync = vid_vsync.integer;
+               vid_usingvsync = vid_vsync.integer;
+               qwglSwapIntervalEXT (vid_usevsync);
+       }
+
        return true;
 }