From 9f48a26a280b631489573794e23058734ec73c30 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Wed, 17 Oct 2012 21:20:29 +0000 Subject: From /dev/humancontroller: to further reduce confusion, rename constants like MAX_ENTITIES to MAX_REFENTITIES --- src/renderer/tr_local.h | 8 ++++---- src/renderer/tr_main.c | 4 ++-- src/renderer/tr_scene.c | 6 +++--- src/renderer/tr_types.h | 11 ++++++----- src/renderer/tr_world.c | 2 +- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/renderer/tr_local.h b/src/renderer/tr_local.h index 9a194401..c7b584da 100644 --- a/src/renderer/tr_local.h +++ b/src/renderer/tr_local.h @@ -836,8 +836,8 @@ the bits are allocated as follows: 17-30 : sorted shader index */ #define QSORT_FOGNUM_SHIFT 2 -#define QSORT_ENTITYNUM_SHIFT 7 -#define QSORT_SHADERNUM_SHIFT (QSORT_ENTITYNUM_SHIFT+ENTITYNUM_BITS) +#define QSORT_REFENTITYNUM_SHIFT 7 +#define QSORT_SHADERNUM_SHIFT (QSORT_REFENTITYNUM_SHIFT+REFENTITYNUM_BITS) #if (QSORT_SHADERNUM_SHIFT+SHADERNUM_BITS) > 32 #error "Need to update sorting, too many bits." #endif @@ -954,7 +954,7 @@ typedef struct { trRefEntity_t *currentEntity; trRefEntity_t worldEntity; // point currentEntity at this when rendering world int currentEntityNum; - int shiftedEntityNum; // currentEntityNum << QSORT_ENTITYNUM_SHIFT + int shiftedEntityNum; // currentEntityNum << QSORT_REFENTITYNUM_SHIFT model_t *currentModel; viewParms_t viewParms; @@ -1703,7 +1703,7 @@ typedef enum { typedef struct { drawSurf_t drawSurfs[MAX_DRAWSURFS]; dlight_t dlights[MAX_DLIGHTS]; - trRefEntity_t entities[MAX_ENTITIES]; + trRefEntity_t entities[MAX_REFENTITIES]; srfPoly_t *polys;//[MAX_POLYS]; polyVert_t *polyVerts;//[MAX_POLYVERTS]; renderCommandList_t commands; diff --git a/src/renderer/tr_main.c b/src/renderer/tr_main.c index 08b739bd..8d5c444f 100644 --- a/src/renderer/tr_main.c +++ b/src/renderer/tr_main.c @@ -1128,7 +1128,7 @@ void R_DecomposeSort( unsigned sort, int *entityNum, shader_t **shader, int *fogNum, int *dlightMap ) { *fogNum = ( sort >> QSORT_FOGNUM_SHIFT ) & 31; *shader = tr.sortedShaders[ ( sort >> QSORT_SHADERNUM_SHIFT ) & (MAX_SHADERS-1) ]; - *entityNum = ( sort >> QSORT_ENTITYNUM_SHIFT ) & MAX_ENTITIES; + *entityNum = ( sort >> QSORT_REFENTITYNUM_SHIFT ) & REFENTITYNUM_MASK; *dlightMap = sort & 3; } @@ -1209,7 +1209,7 @@ void R_AddEntitySurfaces (void) { ent->needDlights = qfalse; // preshift the value we are going to OR into the drawsurf sort - tr.shiftedEntityNum = tr.currentEntityNum << QSORT_ENTITYNUM_SHIFT; + tr.shiftedEntityNum = tr.currentEntityNum << QSORT_REFENTITYNUM_SHIFT; // // the weapon model must be handled special -- diff --git a/src/renderer/tr_scene.c b/src/renderer/tr_scene.c index 72e078d5..49c0e593 100644 --- a/src/renderer/tr_scene.c +++ b/src/renderer/tr_scene.c @@ -102,7 +102,7 @@ void R_AddPolygonSurfaces( void ) { srfPoly_t *poly; tr.currentEntityNum = REFENTITYNUM_WORLD; - tr.shiftedEntityNum = tr.currentEntityNum << QSORT_ENTITYNUM_SHIFT; + tr.shiftedEntityNum = tr.currentEntityNum << QSORT_REFENTITYNUM_SHIFT; for ( i = 0, poly = tr.refdef.polys; i < tr.refdef.numPolys ; i++, poly++ ) { sh = R_GetShaderByHandle( poly->hShader ); @@ -209,8 +209,8 @@ void RE_AddRefEntityToScene( const refEntity_t *ent ) { if ( !tr.registered ) { return; } - if ( r_numentities >= MAX_ENTITIES ) { - ri.Printf(PRINT_DEVELOPER, "RE_AddRefEntityToScene: Dropping refEntity, reached MAX_ENTITIES\n"); + if ( r_numentities >= MAX_REFENTITIES ) { + ri.Printf(PRINT_DEVELOPER, "RE_AddRefEntityToScene: Dropping refEntity, reached MAX_REFENTITIES\n"); return; } if ( Q_isnan(ent->origin[0]) || Q_isnan(ent->origin[1]) || Q_isnan(ent->origin[2]) ) { diff --git a/src/renderer/tr_types.h b/src/renderer/tr_types.h index 6c394628..1ddb9a18 100644 --- a/src/renderer/tr_types.h +++ b/src/renderer/tr_types.h @@ -27,11 +27,12 @@ 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<