summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/cl_cgame.c32
-rw-r--r--src/client/cl_cin.c12
-rw-r--r--src/client/cl_console.c7
-rw-r--r--src/client/cl_curl.c44
-rw-r--r--src/client/cl_keys.c29
-rw-r--r--src/client/cl_main.c116
-rw-r--r--src/client/cl_scrn.c7
-rw-r--r--src/client/client.h7
-rw-r--r--src/client/qal.c43
-rw-r--r--src/client/snd_dma.c6
-rw-r--r--src/client/snd_main.c7
-rw-r--r--src/client/snd_mix.c1
12 files changed, 174 insertions, 137 deletions
diff --git a/src/client/cl_cgame.c b/src/client/cl_cgame.c
index 68b34c6b..40714a56 100644
--- a/src/client/cl_cgame.c
+++ b/src/client/cl_cgame.c
@@ -725,7 +725,7 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) {
return re.inPVS( VMA(1), VMA(2) );
default:
- assert(0); // bk010102
+ assert(0);
Com_Error( ERR_DROP, "Bad cgame system trap: %ld", (long int) args[0] );
}
return 0;
@@ -946,8 +946,6 @@ void CL_FirstSnapshot( void ) {
Cbuf_AddText( cl_activeAction->string );
Cvar_Set( "activeAction", "" );
}
-
- Sys_BeginProfiling();
}
/*
@@ -1050,9 +1048,35 @@ void CL_SetCGameTime( void ) {
// while a normal demo may have different time samples
// each time it is played back
if ( cl_timedemo->integer ) {
+ int now = Sys_Milliseconds( );
+ int frameDuration;
+
if (!clc.timeDemoStart) {
- clc.timeDemoStart = Sys_Milliseconds();
+ clc.timeDemoStart = clc.timeDemoLastFrame = now;
+ clc.timeDemoMinDuration = INT_MAX;
+ clc.timeDemoMaxDuration = 0;
+ }
+
+ frameDuration = now - clc.timeDemoLastFrame;
+ clc.timeDemoLastFrame = now;
+
+ // Ignore the first measurement as it'll always be 0
+ if( clc.timeDemoFrames > 0 )
+ {
+ if( frameDuration > clc.timeDemoMaxDuration )
+ clc.timeDemoMaxDuration = frameDuration;
+
+ if( frameDuration < clc.timeDemoMinDuration )
+ clc.timeDemoMinDuration = frameDuration;
+
+ // 255 ms = about 4fps
+ if( frameDuration > UCHAR_MAX )
+ frameDuration = UCHAR_MAX;
+
+ clc.timeDemoDurations[ ( clc.timeDemoFrames - 1 ) %
+ MAX_TIMEDEMO_DURATIONS ] = frameDuration;
}
+
clc.timeDemoFrames++;
cl.serverTime = clc.timeDemoBaseTime + clc.timeDemoFrames * 50;
}
diff --git a/src/client/cl_cin.c b/src/client/cl_cin.c
index 1d8a5f89..32325cdf 100644
--- a/src/client/cl_cin.c
+++ b/src/client/cl_cin.c
@@ -1073,12 +1073,10 @@ static void RoQReset( void ) {
if (currentHandle < 0) return;
- Sys_EndStreamedFile(cinTable[currentHandle].iFile);
FS_FCloseFile( cinTable[currentHandle].iFile );
FS_FOpenFileRead (cinTable[currentHandle].fileName, &cinTable[currentHandle].iFile, qtrue);
// let the background thread start reading ahead
- Sys_BeginStreamedFile( cinTable[currentHandle].iFile, 0x10000 );
- Sys_StreamedRead (cin.file, 16, 1, cinTable[currentHandle].iFile);
+ FS_Read (cin.file, 16, cinTable[currentHandle].iFile);
RoQ_init();
cinTable[currentHandle].status = FMV_LOOPED;
}
@@ -1099,7 +1097,7 @@ static void RoQInterrupt(void)
if (currentHandle < 0) return;
- Sys_StreamedRead( cin.file, cinTable[currentHandle].RoQFrameSize+8, 1, cinTable[currentHandle].iFile );
+ FS_Read( cin.file, cinTable[currentHandle].RoQFrameSize+8, cinTable[currentHandle].iFile );
if ( cinTable[currentHandle].RoQPlayed >= cinTable[currentHandle].ROQSize ) {
if (cinTable[currentHandle].holdAtEnd==qfalse) {
if (cinTable[currentHandle].looping) {
@@ -1215,7 +1213,7 @@ redump:
// one more frame hits the dust
//
// assert(cinTable[currentHandle].RoQFrameSize <= 65536);
-// r = Sys_StreamedRead( cin.file, cinTable[currentHandle].RoQFrameSize+8, 1, cinTable[currentHandle].iFile );
+// r = FS_Read( cin.file, cinTable[currentHandle].RoQFrameSize+8, cinTable[currentHandle].iFile );
cinTable[currentHandle].RoQPlayed += cinTable[currentHandle].RoQFrameSize+8;
}
@@ -1271,7 +1269,6 @@ static void RoQShutdown( void ) {
cinTable[currentHandle].status = FMV_IDLE;
if (cinTable[currentHandle].iFile) {
- Sys_EndStreamedFile( cinTable[currentHandle].iFile );
FS_FCloseFile( cinTable[currentHandle].iFile );
cinTable[currentHandle].iFile = 0;
}
@@ -1322,7 +1319,6 @@ Fetch and decompress the pending frame
e_status CIN_RunCinematic (int handle)
{
- // bk001204 - init
int start = 0;
int thisTime = 0;
@@ -1462,8 +1458,6 @@ int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBi
{
RoQ_init();
// FS_Read (cin.file, cinTable[currentHandle].RoQFrameSize+8, cinTable[currentHandle].iFile);
- // let the background thread start reading ahead
- Sys_BeginStreamedFile( cinTable[currentHandle].iFile, 0x10000 );
cinTable[currentHandle].status = FMV_PLAY;
Com_DPrintf("trFMV::play(), playing %s\n", arg);
diff --git a/src/client/cl_console.c b/src/client/cl_console.c
index 3e321394..308abd07 100644
--- a/src/client/cl_console.c
+++ b/src/client/cl_console.c
@@ -69,9 +69,8 @@ Con_ToggleConsole_f
================
*/
void Con_ToggleConsole_f (void) {
- // closing a full screen console restarts the demo loop
+ // Can't toggle the console when it's the only thing available
if ( cls.state == CA_DISCONNECTED && cls.keyCatchers == KEYCATCH_CONSOLE ) {
- CL_StartDemoLoop();
return;
}
@@ -516,13 +515,13 @@ void Con_DrawSolidConsole( float frac ) {
re.SetColor( g_color_table[ColorIndex(COLOR_RED)] );
- i = strlen( SVN_VERSION );
+ i = strlen( Q3_VERSION );
for (x=0 ; x<i ; x++) {
SCR_DrawSmallChar( cls.glconfig.vidWidth - ( i - x ) * SMALLCHAR_WIDTH,
- (lines-(SMALLCHAR_HEIGHT+SMALLCHAR_HEIGHT/2)), SVN_VERSION[x] );
+ (lines-(SMALLCHAR_HEIGHT+SMALLCHAR_HEIGHT/2)), Q3_VERSION[x] );
}
diff --git a/src/client/cl_curl.c b/src/client/cl_curl.c
index 9c5e3cc4..d15cbba8 100644
--- a/src/client/cl_curl.c
+++ b/src/client/cl_curl.c
@@ -25,37 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
cvar_t *cl_cURLLib;
#if USE_CURL_DLOPEN
-
-#if USE_SDL_VIDEO
-#include "SDL.h"
-#include "SDL_loadso.h"
-#define OBJTYPE void *
-#define OBJLOAD(x) SDL_LoadObject(x)
-#define SYMLOAD(x,y) SDL_LoadFunction(x,y)
-#define OBJFREE(x) SDL_UnloadObject(x)
-
-#elif defined _WIN32
-#include <windows.h>
-#define OBJTYPE HMODULE
-#define OBJLOAD(x) LoadLibrary(x)
-#define SYMLOAD(x,y) GetProcAddress(x,y)
-#define OBJFREE(x) FreeLibrary(x)
-
-#elif defined __linux__ || defined __FreeBSD__ || defined MACOS_X || defined __sun
-#include <dlfcn.h>
-#define OBJTYPE void *
-#define OBJLOAD(x) dlopen(x, RTLD_LAZY | RTLD_GLOBAL)
-#define SYMLOAD(x,y) dlsym(x,y)
-#define OBJFREE(x) dlclose(x)
-#else
-
-#error "Your platform has no lib loading code or it is disabled"
-#endif
-
-#if defined __linux__ || defined __FreeBSD__ || defined MACOS_X
-#include <unistd.h>
-#include <sys/types.h>
-#endif
+#include "../sys/sys_loadlib.h"
char* (*qcurl_version)(void);
@@ -85,7 +55,7 @@ CURLMsg *(*qcurl_multi_info_read)(CURLM *multi_handle,
int *msgs_in_queue);
const char *(*qcurl_multi_strerror)(CURLMcode);
-static OBJTYPE cURLLib = NULL;
+static void *cURLLib = NULL;
/*
=================
@@ -96,7 +66,7 @@ static void *GPA(char *str)
{
void *rv;
- rv = SYMLOAD(cURLLib, str);
+ rv = Sys_LoadFunction(cURLLib, str);
if(!rv)
{
Com_Printf("Can't load symbol %s\n", str);
@@ -124,17 +94,17 @@ qboolean CL_cURL_Init()
Com_Printf("Loading \"%s\"...", cl_cURLLib->string);
- if( (cURLLib = OBJLOAD(cl_cURLLib->string)) == 0 )
+ if( (cURLLib = Sys_LoadLibrary(cl_cURLLib->string)) == 0 )
{
#ifdef _WIN32
return qfalse;
#else
char fn[1024];
- getcwd(fn, sizeof(fn));
+ Q_strncpyz( fn, Sys_Cwd( ), sizeof( fn ) );
strncat(fn, "/", sizeof(fn)-strlen(fn)-1);
strncat(fn, cl_cURLLib->string, sizeof(fn)-strlen(fn)-1);
- if( (cURLLib = OBJLOAD(fn)) == 0 )
+ if( (cURLLib = Sys_LoadLibrary(fn)) == 0 )
{
return qfalse;
}
@@ -189,7 +159,7 @@ void CL_cURL_Shutdown( void )
#if USE_CURL_DLOPEN
if(cURLLib)
{
- OBJFREE(cURLLib);
+ Sys_UnloadLibrary(cURLLib);
cURLLib = NULL;
}
qcurl_easy_init = NULL;
diff --git a/src/client/cl_keys.c b/src/client/cl_keys.c
index 950cb5b1..1ce97418 100644
--- a/src/client/cl_keys.c
+++ b/src/client/cl_keys.c
@@ -1148,7 +1148,6 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
}
}
-#ifndef _WIN32
if (key == K_ENTER)
{
if (down)
@@ -1158,14 +1157,10 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
Key_ClearStates();
Cvar_SetValue( "r_fullscreen",
!Cvar_VariableIntegerValue( "r_fullscreen" ) );
-#if !USE_SDL_VIDEO // This is handled in sdl_glimp.c/GLimp_EndFrame
- Cbuf_ExecuteText( EXEC_APPEND, "vid_restart\n");
-#endif
return;
}
}
}
-#endif
// console key is hardcoded, so the user can never unbind it
if (key == '`' || key == '~' ||
@@ -1208,7 +1203,7 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
if ( cls.state == CA_ACTIVE && !clc.demoplaying ) {
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_INGAME );
}
- else {
+ else if ( cls.state != CA_DISCONNECTED ) {
CL_Disconnect_f();
S_StopAllSounds();
VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_MAIN );
@@ -1223,19 +1218,21 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
//
// key up events only perform actions if the game key binding is
// a button command (leading + sign). These will be processed even in
- // console mode and menu mode, to keep the character from continuing
+ // console mode and menu mode, to keep the character from continuing
// an action started before a mode switch.
//
- if (!down) {
- kb = keys[key].binding;
+ if (!down ) {
+ if ( cls.state != CA_DISCONNECTED ) {
+ kb = keys[key].binding;
- CL_AddKeyUpCommands( key, kb, time );
+ CL_AddKeyUpCommands( key, kb, time );
- if ( cls.keyCatchers & KEYCATCH_UI && uivm ) {
- VM_Call( uivm, UI_KEY_EVENT, key, down );
- } else if ( cls.keyCatchers & KEYCATCH_CGAME && cgvm ) {
- VM_Call( cgvm, CG_KEY_EVENT, key, down );
- }
+ if ( cls.keyCatchers & KEYCATCH_UI && uivm ) {
+ VM_Call( uivm, UI_KEY_EVENT, key, down );
+ } else if ( cls.keyCatchers & KEYCATCH_CGAME && cgvm ) {
+ VM_Call( cgvm, CG_KEY_EVENT, key, down );
+ }
+ }
return;
}
@@ -1264,7 +1261,7 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) {
Com_Printf ("%s is unbound, use controls menu to set.\n"
, Key_KeynumToString( key ) );
}
- } else if (kb[0] == '+') {
+ } else if (kb[0] == '+') {
int i;
char button[1024], *buttonPtr;
buttonPtr = button;
diff --git a/src/client/cl_main.c b/src/client/cl_main.c
index 76b197d3..80c35db1 100644
--- a/src/client/cl_main.c
+++ b/src/client/cl_main.c
@@ -44,6 +44,7 @@ cvar_t *cl_freezeDemo;
cvar_t *cl_shownet;
cvar_t *cl_showSend;
cvar_t *cl_timedemo;
+cvar_t *cl_timedemoLog;
cvar_t *cl_autoRecordDemo;
cvar_t *cl_aviFrameRate;
cvar_t *cl_aviMotionJpeg;
@@ -394,17 +395,94 @@ CLIENT SIDE DEMO PLAYBACK
/*
=================
+CL_DemoFrameDurationSDev
+=================
+*/
+static float CL_DemoFrameDurationSDev( void )
+{
+ int i;
+ int numFrames;
+ float mean = 0.0f;
+ float variance = 0.0f;
+
+ if( ( clc.timeDemoFrames - 1 ) > MAX_TIMEDEMO_DURATIONS )
+ numFrames = MAX_TIMEDEMO_DURATIONS;
+ else
+ numFrames = clc.timeDemoFrames - 1;
+
+ for( i = 0; i < numFrames; i++ )
+ mean += clc.timeDemoDurations[ i ];
+ mean /= numFrames;
+
+ for( i = 0; i < numFrames; i++ )
+ {
+ float x = clc.timeDemoDurations[ i ];
+
+ variance += ( ( x - mean ) * ( x - mean ) );
+ }
+ variance /= numFrames;
+
+ return sqrt( variance );
+}
+
+/*
+=================
CL_DemoCompleted
=================
*/
-void CL_DemoCompleted( void ) {
- if (cl_timedemo && cl_timedemo->integer) {
+void CL_DemoCompleted( void )
+{
+ char buffer[ MAX_STRING_CHARS ];
+
+ if( cl_timedemo && cl_timedemo->integer )
+ {
int time;
time = Sys_Milliseconds() - clc.timeDemoStart;
- if ( time > 0 ) {
- Com_Printf ("%i frames, %3.1f seconds: %3.1f fps\n", clc.timeDemoFrames,
- time/1000.0, clc.timeDemoFrames*1000.0 / time);
+ if( time > 0 )
+ {
+ // Millisecond times are frame durations:
+ // minimum/average/maximum/std deviation
+ Com_sprintf( buffer, sizeof( buffer ),
+ "%i frames %3.1f seconds %3.1f fps %d.0/%.1f/%d.0/%.1f ms\n",
+ clc.timeDemoFrames,
+ time/1000.0,
+ clc.timeDemoFrames*1000.0 / time,
+ clc.timeDemoMinDuration,
+ time / (float)clc.timeDemoFrames,
+ clc.timeDemoMaxDuration,
+ CL_DemoFrameDurationSDev( ) );
+ Com_Printf( buffer );
+
+ // Write a log of all the frame durations
+ if( cl_timedemoLog && strlen( cl_timedemoLog->string ) > 0 )
+ {
+ int i;
+ int numFrames;
+ fileHandle_t f;
+
+ if( ( clc.timeDemoFrames - 1 ) > MAX_TIMEDEMO_DURATIONS )
+ numFrames = MAX_TIMEDEMO_DURATIONS;
+ else
+ numFrames = clc.timeDemoFrames - 1;
+
+ f = FS_FOpenFileWrite( cl_timedemoLog->string );
+ if( f )
+ {
+ FS_Printf( f, "# %s", buffer );
+
+ for( i = 0; i < numFrames; i++ )
+ FS_Printf( f, "%d\n", clc.timeDemoDurations[ i ] );
+
+ FS_FCloseFile( f );
+ Com_Printf( "%s written\n", cl_timedemoLog->string );
+ }
+ else
+ {
+ Com_Printf( "Couldn't open %s for writing\n",
+ cl_timedemoLog->string );
+ }
+ }
}
}
@@ -705,7 +783,7 @@ void CL_FlushMemory( void ) {
Hunk_ClearToMark();
}
- CL_StartHunkUsers();
+ CL_StartHunkUsers( qfalse );
}
/*
@@ -718,6 +796,12 @@ memory on the hunk from cgame, ui, and renderer
=====================
*/
void CL_MapLoading( void ) {
+ if ( com_dedicated->integer ) {
+ cls.state = CA_DISCONNECTED;
+ cls.keyCatchers = KEYCATCH_CONSOLE;
+ return;
+ }
+
if ( !com_cl_running->integer ) {
return;
}
@@ -875,7 +959,7 @@ void CL_ForwardCommandToServer( const char *string ) {
}
if ( clc.demoplaying || cls.state < CA_CONNECTED || cmd[0] == '+' ) {
- Com_Printf ("Unknown command \"%s\"\n", cmd);
+ Com_Printf ("Unknown command \"%s" S_COLOR_WHITE "\"\n", cmd);
return;
}
@@ -1236,7 +1320,7 @@ void CL_Vid_Restart_f( void ) {
CL_InitRef();
// startup all the client stuff
- CL_StartHunkUsers();
+ CL_StartHunkUsers( qfalse );
// start the cgame if connected
if ( cls.state > CA_CONNECTED && cls.state != CA_CINEMATIC ) {
@@ -2265,7 +2349,7 @@ After the server has cleared the hunk, these will need to be restarted
This is the only place that any of these functions are called from
============================
*/
-void CL_StartHunkUsers( void ) {
+void CL_StartHunkUsers( qboolean rendererOnly ) {
if (!com_cl_running) {
return;
}
@@ -2279,6 +2363,10 @@ void CL_StartHunkUsers( void ) {
CL_InitRenderer();
}
+ if ( rendererOnly ) {
+ return;
+ }
+
if ( !cls.soundStarted ) {
cls.soundStarted = qtrue;
S_Init();
@@ -2541,6 +2629,7 @@ void CL_Init( void ) {
cl_activeAction = Cvar_Get( "activeAction", "", CVAR_TEMP );
cl_timedemo = Cvar_Get ("timedemo", "0", 0);
+ cl_timedemoLog = Cvar_Get ("cl_timedemoLog", "", CVAR_ARCHIVE);
cl_autoRecordDemo = Cvar_Get ("cl_autoRecordDemo", "0", CVAR_ARCHIVE);
cl_aviFrameRate = Cvar_Get ("cl_aviFrameRate", "25", CVAR_ARCHIVE);
cl_aviMotionJpeg = Cvar_Get ("cl_aviMotionJpeg", "1", CVAR_ARCHIVE);
@@ -2825,12 +2914,6 @@ void CL_ServerInfoPacket( netadr_t from, msg_t *msg ) {
type = 1;
break;
- case NA_IPX:
- case NA_BROADCAST_IPX:
- str = "ipx";
- type = 2;
- break;
-
default:
str = "???";
type = 0;
@@ -3117,9 +3200,6 @@ void CL_LocalServers_f( void ) {
to.type = NA_BROADCAST;
NET_SendPacket( NS_CLIENT, strlen( message ), message, to );
-
- to.type = NA_BROADCAST_IPX;
- NET_SendPacket( NS_CLIENT, strlen( message ), message, to );
}
}
}
diff --git a/src/client/cl_scrn.c b/src/client/cl_scrn.c
index 21f4b932..a8d37e22 100644
--- a/src/client/cl_scrn.c
+++ b/src/client/cl_scrn.c
@@ -426,14 +426,9 @@ void SCR_DrawScreenField( stereoFrame_t stereoFrame ) {
}
}
- if ( !uivm ) {
- Com_DPrintf("draw screen without UI loaded\n");
- return;
- }
-
// if the menu is going to cover the entire screen, we
// don't need to render anything under it
- if ( !VM_Call( uivm, UI_IS_FULLSCREEN )) {
+ if ( uivm && !VM_Call( uivm, UI_IS_FULLSCREEN )) {
switch( cls.state ) {
default:
Com_Error( ERR_FATAL, "SCR_DrawScreenField: bad cls.state" );
diff --git a/src/client/client.h b/src/client/client.h
index ea98c4f2..b6a75f55 100644
--- a/src/client/client.h
+++ b/src/client/client.h
@@ -154,6 +154,7 @@ demo through a file.
=============================================================================
*/
+#define MAX_TIMEDEMO_DURATIONS 4096
typedef struct {
@@ -220,6 +221,10 @@ typedef struct {
int timeDemoFrames; // counter of rendered frames
int timeDemoStart; // cls.realtime before first frame
int timeDemoBaseTime; // each frame will be at this time + frameNum * 50
+ int timeDemoLastFrame;// time the last frame was rendered
+ int timeDemoMinDuration; // minimum frame duration
+ int timeDemoMaxDuration; // maximum frame duration
+ unsigned char timeDemoDurations[ MAX_TIMEDEMO_DURATIONS ]; // log of frame durations
// big stuff at end of structure so most offsets are 15 bits or less
netchan_t netchan;
@@ -384,7 +389,7 @@ void CL_FlushMemory(void);
void CL_ShutdownAll(void);
void CL_AddReliableCommand( const char *cmd );
-void CL_StartHunkUsers( void );
+void CL_StartHunkUsers( qboolean rendererOnly );
void CL_Disconnect_f (void);
void CL_GetChallengePacket (void);
diff --git a/src/client/qal.c b/src/client/qal.c
index c0b4a215..1ff99e39 100644
--- a/src/client/qal.c
+++ b/src/client/qal.c
@@ -30,36 +30,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#if USE_OPENAL_DLOPEN
-#if USE_SDL_VIDEO
-#include "SDL.h"
-#include "SDL_loadso.h"
-#define OBJTYPE void *
-#define OBJLOAD(x) SDL_LoadObject(x)
-#define SYMLOAD(x,y) SDL_LoadFunction(x,y)
-#define OBJFREE(x) SDL_UnloadObject(x)
-
-#elif defined _WIN32
-#include <windows.h>
-#define OBJTYPE HMODULE
-#define OBJLOAD(x) LoadLibrary(x)
-#define SYMLOAD(x,y) GetProcAddress(x,y)
-#define OBJFREE(x) FreeLibrary(x)
-
-#elif defined __linux__ || defined __FreeBSD__ || defined MACOS_X || defined __sun
-#include <dlfcn.h>
-#define OBJTYPE void *
-#define OBJLOAD(x) dlopen(x, RTLD_LAZY | RTLD_GLOBAL)
-#define SYMLOAD(x,y) dlsym(x,y)
-#define OBJFREE(x) dlclose(x)
-#else
-
-#error "Your platform has no lib loading code or it is disabled"
-#endif
-
-#if defined __linux__ || defined __FreeBSD__ || defined MACOS_X
-#include <unistd.h>
-#include <sys/types.h>
-#endif
+#include "../sys/sys_loadlib.h"
LPALENABLE qalEnable;
LPALDISABLE qalDisable;
@@ -132,7 +103,7 @@ LPALCGETENUMVALUE qalcGetEnumValue;
LPALCGETSTRING qalcGetString;
LPALCGETINTEGERV qalcGetIntegerv;
-static OBJTYPE OpenALLib = NULL;
+static void *OpenALLib = NULL;
static qboolean alinit_fail = qfalse;
@@ -145,7 +116,7 @@ static void *GPA(char *str)
{
void *rv;
- rv = SYMLOAD(OpenALLib, str);
+ rv = Sys_LoadFunction(OpenALLib, str);
if(!rv)
{
Com_Printf( " Can't load symbol %s\n", str);
@@ -170,17 +141,17 @@ qboolean QAL_Init(const char *libname)
return qtrue;
Com_Printf( "Loading \"%s\"...\n", libname);
- if( (OpenALLib = OBJLOAD(libname)) == 0 )
+ if( (OpenALLib = Sys_LoadLibrary(libname)) == 0 )
{
#ifdef _WIN32
return qfalse;
#else
char fn[1024];
- getcwd(fn, sizeof(fn));
+ Q_strncpyz( fn, Sys_Cwd( ), sizeof( fn ) );
strncat(fn, "/", sizeof(fn) - strlen(fn) - 1);
strncat(fn, libname, sizeof(fn) - strlen(fn) - 1);
- if( (OpenALLib = OBJLOAD(fn)) == 0 )
+ if( (OpenALLib = Sys_LoadLibrary(fn)) == 0 )
{
return qfalse;
}
@@ -279,7 +250,7 @@ void QAL_Shutdown( void )
{
if(OpenALLib)
{
- OBJFREE(OpenALLib);
+ Sys_UnloadLibrary(OpenALLib);
OpenALLib = NULL;
}
diff --git a/src/client/snd_dma.c b/src/client/snd_dma.c
index 7e7897b1..ec92da69 100644
--- a/src/client/snd_dma.c
+++ b/src/client/snd_dma.c
@@ -617,11 +617,7 @@ void S_Base_ClearSoundBuffer( void ) {
SNDDMA_BeginPainting ();
if (dma.buffer)
- // TTimo: due to a particular bug workaround in linux sound code,
- // have to optionally use a custom C implementation of Com_Memset
- // not affecting win32, we have #define Snd_Memset Com_Memset
- // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=371
- Snd_Memset(dma.buffer, clear, dma.samples * dma.samplebits/8);
+ Com_Memset(dma.buffer, clear, dma.samples * dma.samplebits/8);
SNDDMA_Submit ();
}
diff --git a/src/client/snd_main.c b/src/client/snd_main.c
index eb31f2d7..ebb0e9da 100644
--- a/src/client/snd_main.c
+++ b/src/client/snd_main.c
@@ -31,6 +31,7 @@ cvar_t *s_volume;
cvar_t *s_musicVolume;
cvar_t *s_doppler;
cvar_t *s_backend;
+cvar_t *s_muteWhenMinimized;
static soundInterface_t si;
@@ -220,6 +221,11 @@ S_Update
*/
void S_Update( void )
{
+ if( s_muteWhenMinimized->integer && com_minimized->integer ) {
+ S_StopAllSounds( );
+ return;
+ }
+
if( si.Update ) {
si.Update( );
}
@@ -373,6 +379,7 @@ void S_Init( void )
s_musicVolume = Cvar_Get( "s_musicvolume", "0.25", CVAR_ARCHIVE );
s_doppler = Cvar_Get( "s_doppler", "1", CVAR_ARCHIVE );
s_backend = Cvar_Get( "s_backend", "", CVAR_ROM );
+ s_muteWhenMinimized = Cvar_Get( "s_muteWhenMinimized", "0", CVAR_ARCHIVE );
cv = Cvar_Get( "s_initsound", "1", 0 );
if( !cv->integer ) {
diff --git a/src/client/snd_mix.c b/src/client/snd_mix.c
index 4d9e716a..46f3c6d0 100644
--- a/src/client/snd_mix.c
+++ b/src/client/snd_mix.c
@@ -31,7 +31,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
static portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE];
static int snd_vol;
-// bk001119 - these not static, required by unix/snd_mixa.s
int* snd_p;
int snd_linear_count;
short* snd_out;