From bd7ed880a8296d698518fe2749e1485a007b4071 Mon Sep 17 00:00:00 2001 From: black Date: Wed, 14 Jul 2004 13:22:01 +0000 Subject: [PATCH] -Added the preprocessor constant USE_DSOUND. -Moved some prototypes around in sys.h a bit. -Moved Sys_SendKeyEvents from sys_win.c to vid_wgl.c. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4270 d7cf8633-e32d-0410-b094-e92efae38249 --- snd_dma.c | 8 ++++---- sound.h | 5 +++++ sys.h | 25 ++++++++++++------------- sys_win.c | 19 ------------------- vid_sdl.c | 11 +++++------ vid_wgl.c | 18 ++++++++++++++++++ 6 files changed, 44 insertions(+), 42 deletions(-) diff --git a/snd_dma.c b/snd_dma.c index 87ef8a5c..9a66309b 100644 --- a/snd_dma.c +++ b/snd_dma.c @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" -#ifdef _WIN32 +#ifdef USE_DSOUND #include #include extern DWORD gSndBufSize; @@ -694,7 +694,7 @@ void S_ClearBuffer(void) else clear = 0; -#ifdef _WIN32 +#ifdef USE_DSOUND if (pDSBuf) { DWORD dwSize; @@ -959,7 +959,7 @@ void IN_Accumulate (void); void S_ExtraUpdate (void) { -#ifdef _WIN32 +#ifdef USE_DSOUND IN_Accumulate (); #endif @@ -989,7 +989,7 @@ void S_Update_(void) if (endtime > (unsigned int)(soundtime + samps)) endtime = soundtime + samps; -#ifdef _WIN32 +#ifdef USE_DSOUND // if the buffer was lost or stopped, restore it and/or restart it { DWORD dwStatus; diff --git a/sound.h b/sound.h index d2991cab..dbfc8923 100644 --- a/sound.h +++ b/sound.h @@ -22,6 +22,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef SOUND_H #define SOUND_H +//AK: TODO: find a better solution instead of using a define +#if defined( _WIN32 ) && !defined( USE_SDL ) +# define USE_DSOUND +#endif + #define DEFAULT_SOUND_PACKET_VOLUME 255 #define DEFAULT_SOUND_PACKET_ATTENUATION 1.0 diff --git a/sys.h b/sys.h index 0314f242..608e53c3 100644 --- a/sys.h +++ b/sys.h @@ -48,17 +48,24 @@ qboolean Sys_LoadLibrary (const char* dllname, dllhandle_t* handle, const dllfun void Sys_UnloadLibrary (dllhandle_t* handle); void* Sys_GetProcAddress (dllhandle_t handle, const char* name); +void Sys_Print(const char *msg); +void Sys_Printf(const char *fmt, ...); +// send text to the quake console (and possibly to terminal) + +// called after Com_InitArgv +void Sys_Shared_EarlyInit (void); +// called after Host_init +void Sys_Shared_LateInit (void); + +// returns current timestamp +char *Sys_TimeString(const char *timeformat); // -// system IO +// system IO interface (these are the sys functions that need to be implemented in a new driver atm) // void Sys_Error (const char *error, ...); // an error will cause the entire program to exit -void Sys_Print(const char *msg); -void Sys_Printf(const char *fmt, ...); -// send text to the quake console (and possibly to terminal) - void Sys_PrintToTerminal(const char *text); // (may) output text to terminal which launched program @@ -76,13 +83,5 @@ void Sys_Sleep(int milliseconds); void Sys_SendKeyEvents (void); // Perform Key_Event () callbacks until the input que is empty -// called after Com_InitArgv -void Sys_Shared_EarlyInit (void); -// called after Host_init -void Sys_Shared_LateInit (void); - -// returns current timestamp -char *Sys_TimeString(const char *timeformat); - #endif diff --git a/sys_win.c b/sys_win.c index 43d324d2..e7ec1630 100644 --- a/sys_win.c +++ b/sys_win.c @@ -277,25 +277,6 @@ void Sys_Sleep(int milliseconds) Sleep(milliseconds); } - -void Sys_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/vid_sdl.c b/vid_sdl.c index d4519854..f42e821d 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -335,16 +335,16 @@ static void VID_SetCaption() HICON icon; // set the caption - //SDL_WM_SetCaption( gamename, NULL ); + SDL_WM_SetCaption( gamename, NULL ); // get the HWND handle SDL_VERSION( &info.version ); if( !SDL_GetWMInfo( &info ) ) return; - icon = LoadIcon( GetModuleHandle( NULL ), MAKEINTRESOURCE( IDI_ICON1 ) ); - //icon = LoadIcon( NULL, IDI_ERROR ); - SetClassLong( info.window, GCL_HICONSM, (LONG) icon ); + //icon = LoadIcon( GetModuleHandle( NULL ), MAKEINTRESOURCE( IDI_ICON1 ) ); + icon = LoadIcon( NULL, IDI_ERROR ); + SetClassLong( info.window, GCL_HICON, (LONG) icon ); } #else static void VID_SetCaption() @@ -425,7 +425,7 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp) VID_Shutdown(); return false; } - + VID_SetCaption(); gl_renderer = qglGetString(GL_RENDERER); gl_vendor = qglGetString(GL_VENDOR); @@ -443,7 +443,6 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp) vid_activewindow = false; vid_usingmouse = false; IN_Init(); - VID_SetCaption(); return true; } diff --git a/vid_wgl.c b/vid_wgl.c index fec366f7..13c9b425 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -507,6 +507,24 @@ void AppActivate(BOOL fActive, BOOL minimize) } } +//TODO: move it around in vid_wgl.c since I dont think this is the right position +void Sys_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); + } +} + LONG CDAudio_MessageHandler(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); /* main window procedure */ -- 2.39.2