]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - vid_wgl.c
made some things static
[xonotic/darkplaces.git] / vid_wgl.c
index 4c36b9a0f3edef63490f0445e2e66f28ba757dcd..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>
@@ -474,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 )
@@ -504,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;
 
@@ -690,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();
 }
@@ -946,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;
 }