summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/renderer/tr_local.h2
-rw-r--r--src/renderer/tr_main.c2
-rw-r--r--src/renderer/tr_types.h4
3 files changed, 5 insertions, 3 deletions
diff --git a/src/renderer/tr_local.h b/src/renderer/tr_local.h
index b15a2b0e..9a194401 100644
--- a/src/renderer/tr_local.h
+++ b/src/renderer/tr_local.h
@@ -837,7 +837,7 @@ the bits are allocated as follows:
*/
#define QSORT_FOGNUM_SHIFT 2
#define QSORT_ENTITYNUM_SHIFT 7
-#define QSORT_SHADERNUM_SHIFT (QSORT_ENTITYNUM_SHIFT+GENTITYNUM_BITS)
+#define QSORT_SHADERNUM_SHIFT (QSORT_ENTITYNUM_SHIFT+ENTITYNUM_BITS)
#if (QSORT_SHADERNUM_SHIFT+SHADERNUM_BITS) > 32
#error "Need to update sorting, too many bits."
#endif
diff --git a/src/renderer/tr_main.c b/src/renderer/tr_main.c
index 880850ef..060fafb6 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_GENTITIES-1);
+ *entityNum = ( sort >> QSORT_ENTITYNUM_SHIFT ) & MAX_ENTITIES;
*dlightMap = sort & 3;
}
diff --git a/src/renderer/tr_types.h b/src/renderer/tr_types.h
index 79327218..d2b4d23d 100644
--- a/src/renderer/tr_types.h
+++ b/src/renderer/tr_types.h
@@ -26,7 +26,9 @@ 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 MAX_ENTITIES 1023 // can't be increased without changing drawsurf bit packing
+
+#define ENTITYNUM_BITS 10 // can't be increased without changing drawsurf bit packing
+#define MAX_ENTITIES ((1<<ENTITYNUM_BITS) - 1)
// renderfx flags
#define RF_MINLIGHT 0x0001 // allways have some light (viewmodel, some items)