Fixed increased (more than 32) dynamic lights.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@694 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2012-07-10 11:21:17 +00:00
parent f6c994ab47
commit 5f6a2d7820
7 changed files with 16 additions and 10 deletions

View File

@ -150,7 +150,8 @@ typedef struct msurface_s
// lighting info
int dlightframe;
int dlightbits;
unsigned int dlightbits[(MAX_DLIGHTS + 31) >> 5];
// int is 32 bits, need an array for MAX_DLIGHTS > 32
int lightmaptexturenum;
byte styles[MAXLIGHTMAPS];

View File

@ -165,7 +165,7 @@ DYNAMIC LIGHTS
R_MarkLights -- johnfitz -- rewritten to use LordHavoc's lighting speedup
=============
*/
void R_MarkLights (dlight_t *light, int bit, mnode_t *node)
void R_MarkLights (dlight_t *light, int num, mnode_t *node)
{
mplane_t *splitplane;
msurface_t *surf;
@ -214,18 +214,18 @@ start:
{
if (surf->dlightframe != r_dlightframecount) // not dynamic until now
{
surf->dlightbits = bit;
surf->dlightbits[num >> 5] = 1U << (num & 31);
surf->dlightframe = r_dlightframecount;
}
else // already dynamic
surf->dlightbits |= bit;
surf->dlightbits[num >> 5] |= 1U << (num & 31);
}
}
if (node->children[0]->contents >= 0)
R_MarkLights (light, bit, node->children[0]);
R_MarkLights (light, num, node->children[0]);
if (node->children[1]->contents >= 0)
R_MarkLights (light, bit, node->children[1]);
R_MarkLights (light, num, node->children[1]);
}
/*
@ -249,7 +249,7 @@ void R_PushDlights (void)
{
if (l->die < cl.time || !l->radius)
continue;
R_MarkLights ( l, 1<<i, cl.worldmodel->nodes );
R_MarkLights (l, i, cl.worldmodel->nodes);
}
}

View File

@ -259,7 +259,7 @@ qboolean R_CullBox (vec3_t emins, vec3_t emaxs);
void R_StoreEfrags (efrag_t **ppefrag);
qboolean R_CullModelForEntity (entity_t *e);
void R_RotateForEntity (vec3_t origin, vec3_t angles);
void R_MarkLights (dlight_t *light, int bit, mnode_t *node);
void R_MarkLights (dlight_t *light, int num, mnode_t *node);
void R_InitParticles (void);
void R_DrawParticles (void);

View File

@ -538,7 +538,7 @@ void R_DrawBrushModel (entity_t *e)
(!cl_dlights[k].radius))
continue;
R_MarkLights (&cl_dlights[k], 1<<k,
R_MarkLights (&cl_dlights[k], k,
clmodel->nodes + clmodel->hulls[0].firstclipnode);
}
}
@ -970,7 +970,7 @@ void R_AddDynamicLights (msurface_t *surf)
for (lnum=0 ; lnum<MAX_DLIGHTS ; lnum++)
{
if ( !(surf->dlightbits & (1<<lnum) ) )
if (! (surf->dlightbits[lnum >> 5] & (1U << (lnum & 31))))
continue; // not lit by this light
rad = cl_dlights[lnum].radius;

View File

@ -175,6 +175,7 @@ these patched libSDL binaries may help.
<UL>
<LI> Made Quake shareware 1.00 and 1.01 versions to be recognized properly.</LI>
<LI> Made the keypad keys to send separate key events in game mode.</LI>
<LI> Fixed increased (more than 32) dynamic lights.</LI>
<LI> Music playback: Made sure that the file's channels count is supported.</LI>
<LI> Support for Solaris.</LI>
<LI> Increased string buffer size from 256 to 384 for PF_VarString to work around broken mods such as UQC.</LI>
@ -368,3 +369,4 @@ these patched libSDL binaries may help.
</BODY>
</HTML>

View File

@ -101,6 +101,7 @@ these patched libSDL binaries may help.
<itemize>
<item> Made Quake shareware 1.00 and 1.01 versions to be recognized properly.
<item> Made the keypad keys to send separate key events in game mode.
<item> Fixed increased (more than 32) dynamic lights.
<item> Music playback: Made sure that the file's channels count is supported.
<item> Support for Solaris.
<item> Increased string buffer size from 256 to 384 for PF_VarString to work around broken mods such as UQC.

View File

@ -163,6 +163,8 @@
o Made the keypad keys to send separate key events in game mode.
o Fixed increased (more than 32) dynamic lights.
o Music playback: Made sure that the file's channels count is
supported.