diff options
Diffstat (limited to 'src/renderer')
-rw-r--r-- | src/renderer/tr_backend.c | 2 | ||||
-rw-r--r-- | src/renderer/tr_main.c | 4 | ||||
-rw-r--r-- | src/renderer/tr_scene.c | 2 | ||||
-rw-r--r-- | src/renderer/tr_types.h | 3 | ||||
-rw-r--r-- | src/renderer/tr_world.c | 4 |
5 files changed, 9 insertions, 6 deletions
diff --git a/src/renderer/tr_backend.c b/src/renderer/tr_backend.c index ef391019..acf82bd0 100644 --- a/src/renderer/tr_backend.c +++ b/src/renderer/tr_backend.c @@ -577,7 +577,7 @@ void RB_RenderDrawSurfList( drawSurf_t *drawSurfs, int numDrawSurfs ) { if ( entityNum != oldEntityNum ) { depthRange = isCrosshair = qfalse; - if ( entityNum != ENTITYNUM_WORLD ) { + if ( entityNum != REFENTITYNUM_WORLD ) { backEnd.currentEntity = &backEnd.refdef.entities[entityNum]; backEnd.refdef.floatTime = originalTime - backEnd.currentEntity->e.shaderTime; // we have to reset the shaderTime as well otherwise image animations start diff --git a/src/renderer/tr_main.c b/src/renderer/tr_main.c index 060fafb6..08b739bd 100644 --- a/src/renderer/tr_main.c +++ b/src/renderer/tr_main.c @@ -680,7 +680,7 @@ qboolean R_GetPortalOrientations( drawSurf_t *drawSurf, int entityNum, R_PlaneForSurface( drawSurf->surface, &originalPlane ); // rotate the plane if necessary - if ( entityNum != ENTITYNUM_WORLD ) { + if ( entityNum != REFENTITYNUM_WORLD ) { tr.currentEntityNum = entityNum; tr.currentEntity = &tr.refdef.entities[entityNum]; @@ -797,7 +797,7 @@ static qboolean IsMirror( const drawSurf_t *drawSurf, int entityNum ) R_PlaneForSurface( drawSurf->surface, &originalPlane ); // rotate the plane if necessary - if ( entityNum != ENTITYNUM_WORLD ) + if ( entityNum != REFENTITYNUM_WORLD ) { tr.currentEntityNum = entityNum; tr.currentEntity = &tr.refdef.entities[entityNum]; diff --git a/src/renderer/tr_scene.c b/src/renderer/tr_scene.c index 5a5b2dd5..72e078d5 100644 --- a/src/renderer/tr_scene.c +++ b/src/renderer/tr_scene.c @@ -101,7 +101,7 @@ void R_AddPolygonSurfaces( void ) { shader_t *sh; srfPoly_t *poly; - tr.currentEntityNum = ENTITYNUM_WORLD; + tr.currentEntityNum = REFENTITYNUM_WORLD; tr.shiftedEntityNum = tr.currentEntityNum << QSORT_ENTITYNUM_SHIFT; for ( i = 0, poly = tr.refdef.polys; i < tr.refdef.numPolys ; i++, poly++ ) { diff --git a/src/renderer/tr_types.h b/src/renderer/tr_types.h index d2b4d23d..6c394628 100644 --- a/src/renderer/tr_types.h +++ b/src/renderer/tr_types.h @@ -28,7 +28,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define MAX_DLIGHTS 32 // can't be increased, because bit flags are used on surfaces #define ENTITYNUM_BITS 10 // can't be increased without changing drawsurf bit packing +// the last N-bit number (2^ENTITYNUM_BITS - 1) is reserved for the special world refentity, +// and this is reflected by the value of MAX_ENTITIES (which therefore is not a power-of-2) #define MAX_ENTITIES ((1<<ENTITYNUM_BITS) - 1) +#define REFENTITYNUM_WORLD ((1<<ENTITYNUM_BITS) - 1) // renderfx flags #define RF_MINLIGHT 0x0001 // allways have some light (viewmodel, some items) diff --git a/src/renderer/tr_world.c b/src/renderer/tr_world.c index 85a0043f..1cdc3630 100644 --- a/src/renderer/tr_world.c +++ b/src/renderer/tr_world.c @@ -59,7 +59,7 @@ static qboolean R_CullGrid( srfGridMesh_t *cv ) { return qtrue; } - if ( tr.currentEntityNum != ENTITYNUM_WORLD ) { + if ( tr.currentEntityNum != REFENTITYNUM_WORLD ) { sphereCull = R_CullLocalPointAndRadius( cv->localOrigin, cv->meshRadius ); } else { sphereCull = R_CullPointAndRadius( cv->localOrigin, cv->meshRadius ); @@ -652,7 +652,7 @@ void R_AddWorldSurfaces (void) { return; } - tr.currentEntityNum = ENTITYNUM_WORLD; + tr.currentEntityNum = REFENTITYNUM_WORLD; tr.shiftedEntityNum = tr.currentEntityNum << QSORT_ENTITYNUM_SHIFT; // determine which leaves are in the PVS / areamask |