From 527471a7de6c6d99639969abc98d2d970848e16a Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 17 Apr 2001 15:55:33 +0000 Subject: [PATCH] *-wgl finally links (who knows if it works?:) and some more conceptual cleanup --- include/QF/input.h | 1 + libs/audio/targets/snd_dma.c | 7 --- libs/video/targets/Makefile.am | 2 +- libs/video/targets/in_common.c | 7 +++ libs/video/targets/in_dos.c | 5 ++ libs/video/targets/in_fbdev.c | 5 ++ libs/video/targets/in_null.c | 5 ++ libs/video/targets/in_sdl.c | 5 ++ libs/video/targets/in_sun.c | 5 ++ libs/video/targets/in_svgalib.c | 5 ++ libs/video/targets/in_win.c | 84 ++++++++------------------------- libs/video/targets/in_x11.c | 5 ++ libs/video/targets/vid_mgl.c | 4 -- libs/video/targets/vid_wgl.c | 10 +--- nq/source/Makefile.am | 2 +- nq/source/sys_win.c | 18 ------- qw/source/Makefile.am | 2 +- qw/source/cl_input.c | 20 -------- qw/source/cl_sys_sdl.c | 5 -- qw/source/cl_sys_win.c | 18 ------- qw/source/keys.c | 3 +- 21 files changed, 69 insertions(+), 149 deletions(-) diff --git a/include/QF/input.h b/include/QF/input.h index 35c73098a..9141d9d92 100644 --- a/include/QF/input.h +++ b/include/QF/input.h @@ -72,5 +72,6 @@ void IN_LL_Init (); void IN_LL_Shutdown (); void IN_LL_Commands (); void IN_LL_SendKeyEvents (); +void IN_LL_ClearStates (); #endif // _INPUT_H diff --git a/libs/audio/targets/snd_dma.c b/libs/audio/targets/snd_dma.c index f88524066..9eeee676f 100644 --- a/libs/audio/targets/snd_dma.c +++ b/libs/audio/targets/snd_dma.c @@ -40,8 +40,6 @@ #ifdef _WIN32 #include "winquake.h" -//#include "in_win.h" -void IN_Accumulate (void);//XXX FIXME #endif #include "QF/cmd.h" @@ -870,11 +868,6 @@ GetSoundtime (void) void S_ExtraUpdate (void) { - -#ifdef _WIN32 - IN_Accumulate (); -#endif - if (snd_noextraupdate->int_val) return; // don't pollute timings S_Update_ (); diff --git a/libs/video/targets/Makefile.am b/libs/video/targets/Makefile.am index 4ba56b8f4..6a2d509ee 100644 --- a/libs/video/targets/Makefile.am +++ b/libs/video/targets/Makefile.am @@ -70,7 +70,7 @@ libQFtdfx.la: $(libQFtdfx_la_OBJECTS) $(libQFtdfx_la_DEPENDENCIES) libQFwgl_la_LDFLAGS= -version-info 1:0:0 -libQFwgl_la_SOURCES= in_common.c in_win.c qfgl_ext.c vid.c vid_wgl.c +libQFwgl_la_SOURCES= in_common.c in_win.c qfgl_ext.c vid.c vid_common_gl.c vid_wgl.c libQFwgl.la: $(libQFwgl_la_OBJECTS) $(libQFwgl_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libQFwgl_la_LDFLAGS) $(libQFwgl_la_OBJECTS) $(libQFwgl_la_LIBADD) $(LIBS) diff --git a/libs/video/targets/in_common.c b/libs/video/targets/in_common.c index 467421edd..cbfa6c6a7 100644 --- a/libs/video/targets/in_common.c +++ b/libs/video/targets/in_common.c @@ -161,3 +161,10 @@ void IN_HandlePause (qboolean paused) { } + +void +IN_ClearStates (void) +{ + IN_LL_ClearStates (); + Key_ClearStates (); +} diff --git a/libs/video/targets/in_dos.c b/libs/video/targets/in_dos.c index f46b2af9e..c8dcf922c 100644 --- a/libs/video/targets/in_dos.c +++ b/libs/video/targets/in_dos.c @@ -612,3 +612,8 @@ void IN_HandlePause (qboolean pause) { } + +void +IN_LL_ClearStates (void) +{ +} diff --git a/libs/video/targets/in_fbdev.c b/libs/video/targets/in_fbdev.c index dbeb0ba04..d9e32c4f2 100644 --- a/libs/video/targets/in_fbdev.c +++ b/libs/video/targets/in_fbdev.c @@ -144,3 +144,8 @@ void IN_LL_ModeChanged (void) { } + +void +IN_LL_ClearStates (void) +{ +} diff --git a/libs/video/targets/in_null.c b/libs/video/targets/in_null.c index 4a606c77e..9b2a82c35 100644 --- a/libs/video/targets/in_null.c +++ b/libs/video/targets/in_null.c @@ -62,3 +62,8 @@ void IN_ModeChanged (void) { } + +void +IN_LL_ClearStates (void) +{ +} diff --git a/libs/video/targets/in_sdl.c b/libs/video/targets/in_sdl.c index 01dc88a64..93324fb90 100644 --- a/libs/video/targets/in_sdl.c +++ b/libs/video/targets/in_sdl.c @@ -383,3 +383,8 @@ IN_LL_Frame (void) } mouse_oldbuttonstate = mouse_buttonstate; } + +void +IN_LL_ClearStates (void) +{ +} diff --git a/libs/video/targets/in_sun.c b/libs/video/targets/in_sun.c index 7b7a55474..e3dccebb8 100644 --- a/libs/video/targets/in_sun.c +++ b/libs/video/targets/in_sun.c @@ -269,3 +269,8 @@ void IN_HandlePause (qboolean pause) { } + +void +IN_LL_ClearStates (void) +{ +} diff --git a/libs/video/targets/in_svgalib.c b/libs/video/targets/in_svgalib.c index d76b0c293..7a5e274a0 100644 --- a/libs/video/targets/in_svgalib.c +++ b/libs/video/targets/in_svgalib.c @@ -331,3 +331,8 @@ IN_LL_Commands (void) mouse_oldbuttonstate = mouse_buttonstate; } } + +void +IN_LL_ClearStates (void) +{ +} diff --git a/libs/video/targets/in_win.c b/libs/video/targets/in_win.c index fc7d1d985..70db57d87 100644 --- a/libs/video/targets/in_win.c +++ b/libs/video/targets/in_win.c @@ -35,12 +35,13 @@ #include "winquake.h" #include -#include "QF/keys.h" +#include "QF/cmd.h" #include "QF/compat.h" #include "QF/console.h" -#include "QF/qargs.h" -#include "QF/cmd.h" #include "QF/input.h" +#include "QF/keys.h" +#include "QF/qargs.h" +#include "QF/sys.h" #define DINPUT_BUFFERSIZE 16 #define iDirectInputCreate(a,b,c,d) pDirectInputCreate(a,b,c,d) @@ -60,7 +61,6 @@ static int mouse_oldbuttonstate; static POINT current_pos; static float mx_accum, my_accum; static qboolean mouseinitialized; -static cvar_t *m_filter; static qboolean restore_spi; static int originalmouseparms[3], newmouseparms[3] = { 0, 0, 1 }; static qboolean mouseparmsvalid, mouseactivatetoggle; @@ -395,33 +395,23 @@ IN_StartupMouse (void) IN_Init */ void -IN_Init (void) +IN_LL_Init (void) { uiWheelMessage = RegisterWindowMessage ("MSWHEEL_ROLLMSG"); - IN_StartupMouse (); - - JOY_Init (); } void -IN_Init_Cvars (void) +IN_LL_Init_Cvars (void) { - // mouse variables - m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, NULL, - "Toggle mouse input filtering."); - _windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, NULL, - "Grab the mouse from X while playing quake"); - - JOY_Init_Cvars(); } /* IN_Shutdown */ void -IN_Shutdown (void) +IN_LL_Shutdown (void) { IN_DeactivateMouse (); @@ -468,7 +458,7 @@ IN_MouseEvent (int mstate) IN_MouseMove */ void -IN_MouseMove (void) +IN_LL_Commands (void) { int mx, my; @@ -568,47 +558,10 @@ IN_MouseMove (void) /* - IN_Move + IN_LL_ClearStates */ void -IN_Move (void) -{ - - if (ActiveApp && !Minimized) { - IN_MouseMove (); - JOY_Move (); - } -} - - -/* - IN_Accumulate -*/ -void -IN_Accumulate (void) -{ -// int mx, my; -// HDC hdc; - -// if (dinput) return; // If using dinput we don't probably need this - - if (in_mouse_avail) { - GetCursorPos (¤t_pos); - - mx_accum += current_pos.x - window_center_x; - my_accum += current_pos.y - window_center_y; - - // force the mouse to the center, so there's room to move - SetCursorPos (window_center_x, window_center_y); - } -} - - -/* - IN_ClearStates -*/ -void -IN_ClearStates (void) +IN_LL_ClearStates (void) { if (in_mouse_avail) { @@ -618,12 +571,15 @@ IN_ClearStates (void) } } -/* - IN_Commands -*/ void -IN_Commands (void) -{ - // Joystick - JOY_Command(); +IN_LL_SendKeyEvents (void) +{ + MSG msg; + + while (PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE)) { + if (!GetMessage (&msg, NULL, 0, 0)) + Sys_Quit (); + TranslateMessage (&msg); + DispatchMessage (&msg); + } } diff --git a/libs/video/targets/in_x11.c b/libs/video/targets/in_x11.c index 458a84c4a..79ac082bd 100644 --- a/libs/video/targets/in_x11.c +++ b/libs/video/targets/in_x11.c @@ -493,3 +493,8 @@ IN_LL_Init_Cvars (void) "DGA Mouse accelleration multiplier"); } + +void +IN_LL_ClearStates (void) +{ +} diff --git a/libs/video/targets/vid_mgl.c b/libs/video/targets/vid_mgl.c index 28b98fbf2..69cec62b8 100644 --- a/libs/video/targets/vid_mgl.c +++ b/libs/video/targets/vid_mgl.c @@ -232,16 +232,12 @@ VID_UpdateWindowStatus (void) } -extern void CL_ClearStates (); - /* ClearAllStates */ void ClearAllStates (void) { - CL_ClearStates (); - Key_ClearStates (); IN_ClearStates (); } diff --git a/libs/video/targets/vid_wgl.c b/libs/video/targets/vid_wgl.c index d378f4d9a..6ca6e5877 100644 --- a/libs/video/targets/vid_wgl.c +++ b/libs/video/targets/vid_wgl.c @@ -140,8 +140,6 @@ glvert_t glv; HWND WINAPI InitializeWindow (HINSTANCE hInstance, int nCmdShow); LONG CDAudio_MessageHandler (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); -extern void CL_ClearStates (); - extern viddef_t vid; // global video state unsigned int d_8to24table[256]; @@ -171,11 +169,6 @@ RECT window_rect; // direct draw software compatability stuff -void -VID_HandlePause (qboolean pause) -{ -} - void VID_ForceLockState (int lk) { @@ -671,8 +664,6 @@ MapKey (int key) void ClearAllStates (void) { - CL_ClearStates (); - Key_ClearStates (); IN_ClearStates (); } @@ -1393,6 +1384,7 @@ VID_Init (unsigned char *palette) #endif GL_CheckBrightness (palette); + VID_InitGamma (palette); VID_SetPalette (palette); VID_SetMode (vid_default, palette); diff --git a/nq/source/Makefile.am b/nq/source/Makefile.am index a28a27948..39c004888 100644 --- a/nq/source/Makefile.am +++ b/nq/source/Makefile.am @@ -147,7 +147,7 @@ nq_sgl_DEPENDENCIES= $(client_LIB_DEPS) # ... SGI/Microsoft WGL (Windows OpenGL) nq_wgl_SOURCES= $(combined_SOURCES) $(ogl_SOURCES) conproc.c -nq_wgl_LDADD= $(client_LIBS) $(GLX_LIBS) ../../libs/video/targets/libQFwgl.la -lgdi32 -lcomctl32 $(client_POST_LIBS) +nq_wgl_LDADD= $(client_LIBS) ../../libs/video/targets/libQFwgl.la $(client_POST_LIBS) $(GLX_LIBS) -lgdi32 -lcomctl32 -lwinmm nq_wgl_DEPENDENCIES= $(client_LIB_DEPS) # Dedicated Server diff --git a/nq/source/sys_win.c b/nq/source/sys_win.c index 2b44f6c3c..345e2f3e7 100644 --- a/nq/source/sys_win.c +++ b/nq/source/sys_win.c @@ -443,24 +443,6 @@ Sys_Sleep (void) } -void -IN_SendKeyEvents (void) -{ - MSG msg; - - while (PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE)) { - // we always update if there are any event, even if we're paused - scr_skipupdate = 0; - - if (!GetMessage (&msg, NULL, 0, 0)) - Sys_Quit (); - - TranslateMessage (&msg); - DispatchMessage (&msg); - } -} - - /* ============================================================================== diff --git a/qw/source/Makefile.am b/qw/source/Makefile.am index 450eefe11..7bcca0ee3 100644 --- a/qw/source/Makefile.am +++ b/qw/source/Makefile.am @@ -183,7 +183,7 @@ qw_client_sgl_DEPENDENCIES= $(CLIENT_LIB_DEPS) # ... SGI/Microsoft WGL (Windows OpenGL) qw_client_wgl_SOURCES= $(common_SOURCES) $(client_SOURCES) $(ogl_SOURCES) -qw_client_wgl_LDADD= $(CLIENT_LIBS) $(GLX_LIBS) ../../libs/video/targets/libQFwgl.la -lgdi32 $(CLIENT_POST_LIBS) +qw_client_wgl_LDADD= $(CLIENT_LIBS) ../../libs/video/targets/libQFwgl.la $(CLIENT_POST_LIBS) $(GLX_LIBS) -lgdi32 -lwinmm qw_client_wgl_DEPENDENCIES= $(CLIENT_LIB_DEPS) # Stuff that doesn't get linked into an executable NEEDS to be mentioned here, diff --git a/qw/source/cl_input.c b/qw/source/cl_input.c index 1d3e143e8..371bd271c 100644 --- a/qw/source/cl_input.c +++ b/qw/source/cl_input.c @@ -756,23 +756,3 @@ CL_Input_Init_Cvars (void) "disable player delta compression. " "set to 1 if you have a poor ISP and get a lot of U_REMOVE warnings."); } - - -extern qboolean keydown[256]; - -/* - CL_ClearStates - - Generate key up event for each key that is down -*/ -void -CL_ClearStates (void) -{ - int i; - -// send an up event for each key, to make sure the server clears them all - for (i = 0; i < 256; i++) { - if (keydown[i]) - Key_Event (i, 0, false); - } -} diff --git a/qw/source/cl_sys_sdl.c b/qw/source/cl_sys_sdl.c index 975577729..f172c1679 100644 --- a/qw/source/cl_sys_sdl.c +++ b/qw/source/cl_sys_sdl.c @@ -263,8 +263,3 @@ SDL_main (int c, char **v) } } - -/* FIXME: evil stub for directsound crap */ -IN_Accumulate (void) -{ -} diff --git a/qw/source/cl_sys_win.c b/qw/source/cl_sys_win.c index dfc91b30b..11888a4a6 100644 --- a/qw/source/cl_sys_win.c +++ b/qw/source/cl_sys_win.c @@ -352,24 +352,6 @@ Sys_Sleep (void) } -void -IN_SendKeyEvents (void) -{ - MSG msg; - - while (PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE)) { - // we always update if there are any event, even if we're paused - scr_skipupdate = 0; - - if (!GetMessage (&msg, NULL, 0, 0)) - Sys_Quit (); - TranslateMessage (&msg); - DispatchMessage (&msg); - } -} - - - /* WINDOWS CRAP */ diff --git a/qw/source/keys.c b/qw/source/keys.c index ae8726118..dbc37c725 100644 --- a/qw/source/keys.c +++ b/qw/source/keys.c @@ -909,7 +909,8 @@ Key_ClearStates (void) int i; for (i = 0; i < 256; i++) { - keydown[i] = false; + if (keydown[i]) + Key_Event (i, 0, false); key_repeats[i] = false; } }