From 4239e321d9d5003858af4efde584d113b281a47d Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Sun, 18 Oct 2009 23:36:10 +0000 Subject: * Merge ioq3-r1680 --- src/renderer/tr_init.c | 4 ++++ src/renderer/tr_local.h | 2 ++ src/renderer/tr_marks.c | 45 ++++++++++++++++++++++++++++----------------- src/server/sv_ccmds.c | 9 +++++++++ src/sys/sys_main.c | 12 +++--------- src/sys/sys_win32.c | 3 +++ 6 files changed, 49 insertions(+), 26 deletions(-) diff --git a/src/renderer/tr_init.c b/src/renderer/tr_init.c index a0f301a5..6fb7fed3 100644 --- a/src/renderer/tr_init.c +++ b/src/renderer/tr_init.c @@ -151,6 +151,8 @@ cvar_t *r_debugSort; cvar_t *r_printShaders; cvar_t *r_saveFontData; +cvar_t *r_marksOnTriangleMeshes; + cvar_t *r_maxpolys; int max_polys; cvar_t *r_maxpolyverts; @@ -1022,6 +1024,8 @@ void R_Register( void ) r_noportals = ri.Cvar_Get ("r_noportals", "0", CVAR_CHEAT); r_shadows = ri.Cvar_Get( "cg_shadows", "1", 0 ); + r_marksOnTriangleMeshes = ri.Cvar_Get("r_marksOnTriangleMeshes", "0", CVAR_ARCHIVE); + r_maxpolys = ri.Cvar_Get( "r_maxpolys", va("%d", MAX_POLYS), 0); r_maxpolyverts = ri.Cvar_Get( "r_maxpolyverts", va("%d", MAX_POLYVERTS), 0); diff --git a/src/renderer/tr_local.h b/src/renderer/tr_local.h index 4e0e27f8..03908826 100644 --- a/src/renderer/tr_local.h +++ b/src/renderer/tr_local.h @@ -1113,6 +1113,8 @@ extern cvar_t *r_debugSort; extern cvar_t *r_printShaders; extern cvar_t *r_saveFontData; +extern cvar_t *r_marksOnTriangleMeshes; + extern cvar_t *r_GLlibCoolDownMsec; //==================================================================== diff --git a/src/renderer/tr_marks.c b/src/renderer/tr_marks.c index 2523ea77..b846b3bd 100644 --- a/src/renderer/tr_marks.c +++ b/src/renderer/tr_marks.c @@ -174,7 +174,9 @@ void R_BoxSurfaces_r(mnode_t *node, vec3_t mins, vec3_t maxs, surfaceType_t **li surf->viewCount = tr.viewCount; } } - else if (*(surfaceType_t *) (surf->data) != SF_GRID) surf->viewCount = tr.viewCount; + else if (*(surfaceType_t *) (surf->data) != SF_GRID && + *(surfaceType_t *) (surf->data) != SF_TRIANGLES) + surf->viewCount = tr.viewCount; // check the viewCount because the surface may have // already been added if it spans multiple leafs if (surf->viewCount != tr.viewCount) { @@ -264,7 +266,6 @@ int R_MarkFragments( int numPoints, const vec3_t *points, const vec3_t projectio vec3_t clipPoints[2][MAX_VERTS_ON_POLY]; int numClipPoints; float *v; - srfSurfaceFace_t *surf; srfGridMesh_t *cv; drawVert_t *dv; vec3_t normal; @@ -400,25 +401,20 @@ int R_MarkFragments( int numPoints, const vec3_t *points, const vec3_t projectio } else if (*surfaces[i] == SF_FACE) { - surf = ( srfSurfaceFace_t * ) surfaces[i]; + srfSurfaceFace_t *surf = ( srfSurfaceFace_t * ) surfaces[i]; + // check the normal of this face if (DotProduct(surf->plane.normal, projectionDir) > -0.5) { continue; } - /* - VectorSubtract(clipPoints[0][0], clipPoints[0][1], v1); - VectorSubtract(clipPoints[0][2], clipPoints[0][1], v2); - CrossProduct(v1, v2, normal); - VectorNormalize(normal); - if (DotProduct(normal, projectionDir) > -0.5) continue; - */ indexes = (int *)( (byte *)surf + surf->ofsIndices ); for ( k = 0 ; k < surf->numIndices ; k += 3 ) { for ( j = 0 ; j < 3 ; j++ ) { v = surf->points[0] + VERTEXSIZE * indexes[k+j];; VectorMA( v, MARKER_OFFSET, surf->plane.normal, clipPoints[0][j] ); } + // add the fragments of this face R_AddMarkFragments( 3 , clipPoints, numPlanes, normals, dists, @@ -429,14 +425,29 @@ int R_MarkFragments( int numPoints, const vec3_t *points, const vec3_t projectio return returnedFragments; // not enough space for more fragments } } - continue; } - else { - // ignore all other world surfaces - // might be cool to also project polygons on a triangle soup - // however this will probably create huge amounts of extra polys - // even more than the projection onto curves - continue; + else if(*surfaces[i] == SF_TRIANGLES && r_marksOnTriangleMeshes->integer) { + + srfTriangles_t *surf = (srfTriangles_t *) surfaces[i]; + + for (k = 0; k < surf->numIndexes; k += 3) + { + for(j = 0; j < 3; j++) + { + v = surf->verts[surf->indexes[k + j]].xyz; + VectorMA(v, MARKER_OFFSET, surf->verts[surf->indexes[k + j]].normal, clipPoints[0][j]); + } + + // add the fragments of this face + R_AddMarkFragments(3, clipPoints, + numPlanes, normals, dists, + maxPoints, pointBuffer, + maxFragments, fragmentBuffer, &returnedPoints, &returnedFragments, mins, maxs); + if(returnedFragments == maxFragments) + { + return returnedFragments; // not enough space for more fragments + } + } } } return returnedFragments; diff --git a/src/server/sv_ccmds.c b/src/server/sv_ccmds.c index 1da5aaeb..ffd78e56 100644 --- a/src/server/sv_ccmds.c +++ b/src/server/sv_ccmds.c @@ -155,6 +155,15 @@ static void SV_MapRestart_f( void ) { sv.serverId = com_frameTime; Cvar_Set( "sv_serverid", va("%i", sv.serverId ) ); + // if a map_restart occurs while a client is changing maps, we need + // to give them the correct time so that when they finish loading + // they don't violate the backwards time check in cl_cgame.c + for (i=0 ; iinteger ; i++) { + if (svs.clients[i].state == CS_PRIMED) { + svs.clients[i].oldServerTime = sv.restartTime; + } + } + // reset all the vm data in place without changing memory allocation // note that we do NOT set sv.state = SS_LOADING, so configstrings that // had been changed from their default values will generate broadcast updates diff --git a/src/sys/sys_main.c b/src/sys/sys_main.c index 0a4183c7..f1b0c38a 100644 --- a/src/sys/sys_main.c +++ b/src/sys/sys_main.c @@ -381,9 +381,8 @@ static void* Sys_TryLibraryLoad(const char* base, const char* gamedir, const cha Sys_LoadDll Used to load a development dll instead of a virtual machine -#1 look down current path -#2 look in fs_homepath -#3 look in fs_basepath +#1 look in fs_homepath +#2 look in fs_basepath ================= */ void *Sys_LoadDll( const char *name, char *fqpath , @@ -395,7 +394,6 @@ void *Sys_LoadDll( const char *name, char *fqpath , char fname[MAX_OSPATH]; char *basepath; char *homepath; - char *pwdpath; char *gamedir; assert( name ); @@ -403,15 +401,11 @@ void *Sys_LoadDll( const char *name, char *fqpath , Q_snprintf (fname, sizeof(fname), "%s" ARCH_STRING DLL_EXT, name); // TODO: use fs_searchpaths from files.c - pwdpath = Sys_Cwd(); basepath = Cvar_VariableString( "fs_basepath" ); homepath = Cvar_VariableString( "fs_homepath" ); gamedir = Cvar_VariableString( "fs_game" ); - libHandle = Sys_TryLibraryLoad(pwdpath, gamedir, fname, fqpath); - - if(!libHandle && homepath) - libHandle = Sys_TryLibraryLoad(homepath, gamedir, fname, fqpath); + libHandle = Sys_TryLibraryLoad(homepath, gamedir, fname, fqpath); if(!libHandle && basepath) libHandle = Sys_TryLibraryLoad(basepath, gamedir, fname, fqpath); diff --git a/src/sys/sys_win32.c b/src/sys/sys_win32.c index 18efe406..bf4b8f75 100644 --- a/src/sys/sys_win32.c +++ b/src/sys/sys_win32.c @@ -650,5 +650,8 @@ void Sys_PlatformInit( void ) } else SDL_VIDEODRIVER_externallySet = qfalse; + + // Don't redirect to stdout.txt and stderr.txt + _putenv( "SDL_STDIO_REDIRECT=0" ); #endif } -- cgit