Fixed windows input (bad,bad hack)
authorblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 13 Oct 2003 12:43:28 +0000 (12:43 +0000)
committerblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 13 Oct 2003 12:43:28 +0000 (12:43 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@3582 d7cf8633-e32d-0410-b094-e92efae38249

menu.c
prvm_cmds.c
sys_win.c
vid_wgl.c

diff --git a/menu.c b/menu.c
index 539ae07..3f37a71 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -3779,10 +3779,11 @@ void MP_Keydown (int key, char ascii)
        // pass key
        prog->globals[OFS_PARM0] = (float) key;
        prog->globals[OFS_PARM1] = (float) ascii;
-       PRVM_ExecuteProgram(m_keydown, M_F_KEYDOWN"(float key) required\n");
+       PRVM_ExecuteProgram(m_keydown, M_F_KEYDOWN"(float key, float ascii) required\n");
 
        PRVM_End;
 }
+
 void MP_Draw (void)
 {
        PRVM_Begin;
index 675049f..0295b19 100644 (file)
@@ -2520,7 +2520,8 @@ prvm_builtin_t vm_m_builtins[] = {
        e10,                    // 490
        e10,                    // 500
        // menu functions
-
+       VM_M_setkeydest,
+       VM_M_getkeydest
 };
 
 const int vm_m_numbuiltins = sizeof(vm_m_builtins) / sizeof(prvm_builtin_t);
index d53955d..34f8238 100644 (file)
--- a/sys_win.c
+++ b/sys_win.c
@@ -412,7 +412,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
        Sys_Shared_LateInit();
 
        frameoldtime = Sys_DoubleTime ();
-
+       
        /* main window message loop */
        while (1)
        {
index 1e37bb3..d54dfaf 100644 (file)
--- a/vid_wgl.c
+++ b/vid_wgl.c
@@ -513,6 +513,11 @@ LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM  wParam, LPARAM lParam)
 {
        LONG    lRet = 1;
        int             fActive, fMinimized, temp;
+       char    state[256];
+       short   ascchar;
+       int             vkey;
+       qboolean down = false;
+
        extern unsigned int uiWheelMessage;
 
        if ( uMsg == uiWheelMessage )
@@ -533,15 +538,16 @@ LONG WINAPI MainWndProc (HWND hWnd, UINT uMsg, WPARAM  wParam, LPARAM lParam)
                        window_y = (int) HIWORD(lParam);
                        VID_UpdateWindowStatus ();
                        break;
-
+       
                case WM_KEYDOWN:
                case WM_SYSKEYDOWN:
-                       Key_Event (MapKey(lParam, wParam), true);
-                       break;
-
+                       down = true;
                case WM_KEYUP:
                case WM_SYSKEYUP:
-                       Key_Event (MapKey(lParam, wParam), false);
+                       vkey = MapKey(lParam, wParam);
+                       GetKeyboardState (state);
+                       ToAscii (wParam, vkey, state, &ascchar, 0);
+                       Key_Event (vkey, ascchar & 0xFF, down);
                        break;
 
                case WM_SYSCHAR: