From dfff1857ce0517dec0c67c59eed9bab0a4d55e25 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Fri, 27 Jan 2006 19:50:12 +0000 Subject: * Merged ioq3-r529 - Quick fullscreen changes - Fix to that server crashing memory leak - Some FreeBSD changes * Default for r_znear changed --- Makefile | 34 +++++++++++++++++++++++++++++++++- src/cgame/cg_view.c | 4 ++-- src/client/cl_keys.c | 38 ++++++++++++++++---------------------- src/qcommon/cm_patch.c | 1 + src/qcommon/cm_polylib.c | 2 +- src/renderer/tr_init.c | 6 +++++- src/unix/sdl_glimp.c | 28 ++++++++++++++++++++++++++++ 7 files changed, 86 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index d587243a..ca44dd6b 100644 --- a/Makefile +++ b/Makefile @@ -415,6 +415,21 @@ ifeq ($(PLATFORM),freebsd) DEBUG_CFLAGS=$(BASE_CFLAGS) -g + ifeq ($(USE_OPENAL),1) + BASE_CFLAGS += -DUSE_OPENAL=1 + ifeq ($(USE_OPENAL_DLOPEN),1) + BASE_CFLAGS += -DUSE_OPENAL_DLOPEN=1 + endif + endif + + ifeq ($(USE_CODEC_VORBIS),1) + BASE_CFLAGS += -DUSE_CODEC_VORBIS=1 + endif + + ifeq ($(USE_SDL),1) + BASE_CFLAGS += $(shell sdl11-config --cflags) -DUSE_SDL_VIDEO=1 -DUSE_SDL_SOUND=1 + endif + ifeq ($(ARCH),axp) CC=gcc BASE_CFLAGS += -DNO_VM_COMPILED @@ -440,7 +455,24 @@ ifeq ($(PLATFORM),freebsd) # don't need -ldl (FreeBSD) LDFLAGS=-lm - CLIENT_LDFLAGS=-L/usr/X11R6/$(LIB) -lGL -lX11 -lXext -lXxf86dga -lXxf86vm + CLIENT_LDFLAGS = + + ifeq ($(USE_SDL),1) + CLIENT_LDFLAGS += $(shell sdl11-config --libs) + else + CLIENT_LDFLAGS += -L/usr/X11R6/$(LIB) -lGL -lX11 -lXext -lXxf86dga -lXxf86vm + endif + + ifeq ($(USE_OPENAL),1) + ifneq ($(USE_OPENAL_DLOPEN),1) + CLIENT_LDFLAGS += $(THREAD_LDFLAGS) -lopenal + endif + endif + + ifeq ($(USE_CODEC_VORBIS),1) + CLIENT_LDFLAGS += -lvorbisfile -lvorbis -logg + endif + else # ifeq freebsd diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c index edfc9896..9fc2a145 100644 --- a/src/cgame/cg_view.c +++ b/src/cgame/cg_view.c @@ -761,11 +761,11 @@ static int CG_CalcFov( void ) float temp, temp2; temp = (float)( cg.time - cg.spawnTime ) / FOVWARPTIME; - temp2 = ( 180 - fov_x ) * temp; + temp2 = ( 170 - fov_x ) * temp; //Com_Printf( "%f %f\n", temp*100, temp2*100 ); - fov_x = 180 - temp2; + fov_x = 170 - temp2; } // account for zooms diff --git a/src/client/cl_keys.c b/src/client/cl_keys.c index 232f04a4..a0d4e065 100644 --- a/src/client/cl_keys.c +++ b/src/client/cl_keys.c @@ -1044,28 +1044,22 @@ void CL_KeyEvent (int key, qboolean down, unsigned time) { } #ifndef _WIN32 - if (key == K_ENTER) - { - if (down) - { - if (keys[K_ALT].down) - { - Key_ClearStates(); - if (Cvar_VariableValue("r_fullscreen") == 0) - { - Com_Printf("Switching to fullscreen rendering\n"); - Cvar_Set("r_fullscreen", "1"); - } - else - { - Com_Printf("Switching to windowed rendering\n"); - Cvar_Set("r_fullscreen", "0"); - } - Cbuf_ExecuteText( EXEC_APPEND, "vid_restart\n"); - return; - } - } - } + if (key == K_ENTER) + { + if (down) + { + if (keys[K_ALT].down) + { + 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 diff --git a/src/qcommon/cm_patch.c b/src/qcommon/cm_patch.c index fa0ff55a..194b806c 100644 --- a/src/qcommon/cm_patch.c +++ b/src/qcommon/cm_patch.c @@ -768,6 +768,7 @@ static qboolean CM_ValidateFacet( facet_t *facet ) { w = BaseWindingForPlane( plane, plane[3] ); for ( j = 0 ; j < facet->numBorders && w ; j++ ) { if ( facet->borderPlanes[j] == -1 ) { + FreeWinding( w ); return qfalse; } Vector4Copy( planes[ facet->borderPlanes[j] ].plane, plane ); diff --git a/src/qcommon/cm_polylib.c b/src/qcommon/cm_polylib.c index acd8f613..1a937544 100644 --- a/src/qcommon/cm_polylib.c +++ b/src/qcommon/cm_polylib.c @@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // counters are only bumped when running single threaded, -// because they are an awefull coherence problem +// because they are an awful coherence problem int c_active_windings; int c_peak_windings; int c_winding_allocs; diff --git a/src/renderer/tr_init.c b/src/renderer/tr_init.c index 79c910d1..4d47f46c 100644 --- a/src/renderer/tr_init.c +++ b/src/renderer/tr_init.c @@ -927,7 +927,11 @@ void R_Register( void ) r_overBrightBits = ri.Cvar_Get ("r_overBrightBits", "1", CVAR_ARCHIVE | CVAR_LATCH ); r_ignorehwgamma = ri.Cvar_Get( "r_ignorehwgamma", "0", CVAR_ARCHIVE | CVAR_LATCH); r_mode = ri.Cvar_Get( "r_mode", "3", CVAR_ARCHIVE | CVAR_LATCH ); +#if USE_SDL_VIDEO + r_fullscreen = ri.Cvar_Get( "r_fullscreen", "1", CVAR_ARCHIVE ); +#else r_fullscreen = ri.Cvar_Get( "r_fullscreen", "1", CVAR_ARCHIVE | CVAR_LATCH ); +#endif r_customwidth = ri.Cvar_Get( "r_customwidth", "1600", CVAR_ARCHIVE | CVAR_LATCH ); r_customheight = ri.Cvar_Get( "r_customheight", "1024", CVAR_ARCHIVE | CVAR_LATCH ); r_customaspect = ri.Cvar_Get( "r_customaspect", "1", CVAR_ARCHIVE | CVAR_LATCH ); @@ -954,7 +958,7 @@ void R_Register( void ) r_lodCurveError = ri.Cvar_Get( "r_lodCurveError", "250", CVAR_ARCHIVE|CVAR_CHEAT ); r_lodbias = ri.Cvar_Get( "r_lodbias", "0", CVAR_ARCHIVE ); r_flares = ri.Cvar_Get ("r_flares", "0", CVAR_ARCHIVE ); - r_znear = ri.Cvar_Get( "r_znear", "4", CVAR_CHEAT ); + r_znear = ri.Cvar_Get( "r_znear", "1", CVAR_CHEAT ); AssertCvarRange( r_znear, 0.001f, 200, qtrue ); r_ignoreGLErrors = ri.Cvar_Get( "r_ignoreGLErrors", "1", CVAR_ARCHIVE ); r_fastsky = ri.Cvar_Get( "r_fastsky", "0", CVAR_ARCHIVE ); diff --git a/src/unix/sdl_glimp.c b/src/unix/sdl_glimp.c index 1343cb61..e0ab58ce 100644 --- a/src/unix/sdl_glimp.c +++ b/src/unix/sdl_glimp.c @@ -1041,6 +1041,34 @@ void GLimp_EndFrame (void) SDL_GL_SwapBuffers(); } + if( r_fullscreen->modified ) + { + qboolean fullscreen; + qboolean sdlToggled = qfalse; + SDL_Surface *s = SDL_GetVideoSurface( ); + + if( s ) + { + // Find out the current state + if( s->flags & SDL_FULLSCREEN ) + fullscreen = qtrue; + else + fullscreen = qfalse; + + // Is the state we want different from the current state? + if( !!r_fullscreen->integer != fullscreen ) + sdlToggled = SDL_WM_ToggleFullScreen( s ); + else + sdlToggled = qtrue; + } + + // SDL_WM_ToggleFullScreen didn't work, so do it the slow way + if( !sdlToggled ) + Cbuf_AddText( "vid_restart" ); + + r_fullscreen->modified = qfalse; + } + // check logging QGL_EnableLogging( (qboolean)r_logFile->integer ); // bk001205 - was ->value } -- cgit