some micro-optimisations

This commit is contained in:
Bill Currie 2004-02-23 07:17:41 +00:00
parent 680c246e22
commit f9b95cee92
3 changed files with 6 additions and 13 deletions

View File

@ -190,9 +190,6 @@ typedef struct mleaf_s
struct mnode_s *parent;
// leaf specific
int dlightbits;
int dlightframe;
byte *compressed_vis;
efrag_t *efrags;

View File

@ -81,7 +81,7 @@ Mod_PointInLeaf (const vec3_t p, model_t *model)
return NULL; // never reached
}
static byte *
static inline byte *
Mod_DecompressVis (byte * in, model_t *model)
{
static byte decompressed[MAX_MAP_LEAFS / 8];
@ -116,7 +116,7 @@ Mod_DecompressVis (byte * in, model_t *model)
return decompressed;
}
byte *
byte *
Mod_LeafPVS (mleaf_t *leaf, model_t *model)
{
if (leaf == model->leafs)

View File

@ -236,15 +236,16 @@ R_MarkLights (const vec3_t lightorigin, dlight_t *light, int bit,
maxs[1] = lightorigin[1] + radius;
maxs[2] = lightorigin[2] + radius;
while (leafnum < model->numleafs) {
int i;
int b;
if (!(vis_bits = *in++)) {
leafnum += (*in++) * 8;
continue;
}
for (i = 0; i < 8 && leafnum < model->numleafs; i++, leafnum++) {
for (b = 1; b < 256 && leafnum < model->numleafs;
b <<= 1, leafnum++) {
int m;
mleaf_t *leaf = &model->leafs[leafnum + 1];
if (!(vis_bits & (1 << i)))
if (!(vis_bits & b))
continue;
if (leaf->visframe != r_visframecount)
continue;
@ -254,11 +255,6 @@ R_MarkLights (const vec3_t lightorigin, dlight_t *light, int bit,
continue;
if (R_CullBox (leaf->mins, leaf->maxs))
continue;
if (leaf->dlightframe != r_framecount) {
leaf->dlightbits = 0;
leaf->dlightframe = r_framecount;
}
leaf->dlightbits |= bit;
for (m = 0; m < leaf->nummarksurfaces; m++) {
msurface_t *surf = leaf->firstmarksurface[m];
if (surf->visframe != r_visframecount)