]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
-Added the preprocessor constant USE_DSOUND.
authorblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 14 Jul 2004 13:22:01 +0000 (13:22 +0000)
committerblack <black@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 14 Jul 2004 13:22:01 +0000 (13:22 +0000)
-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
sound.h
sys.h
sys_win.c
vid_sdl.c
vid_wgl.c

index 87ef8a5cf78f8e890db6dcaa9b148419bb92b1b5..9a66309b64b039b7e022fb453d28c040ba2a54e2 100644 (file)
--- 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 <windows.h>
 #include <dsound.h>
 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 d2991caba970a7b709d45e6b482e01c31acf4857..dbfc892327d64f3a2196d0dc46a21d442d0e74ac 100644 (file)
--- 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 0314f2427778a948622f448fec95e2ccb0ca02c3..608e53c3d85e3a813384ebb094e58e11d7a5b8b6 100644 (file)
--- 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
 
index 43d324d2ee328ec7e5e68338d18a269374c6b2da..e7ec1630cbec129be1ed7f83fbad0a80aaeab714 100644 (file)
--- 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);
-       }
-}
-
-
 /*
 ==============================================================================
 
index d4519854f8ffeccfd53ffc5a6bd6a1af3f8e6e74..f42e821d0ced49453639ac8bd7253fe1741e53fa 100644 (file)
--- 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;
 }
 
index fec366f75f1af0aedce354f5df3c20d11878e9e9..13c9b42562835bf3df5f7c45662766f0887062e0 100644 (file)
--- 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 */