diff --git a/nq/source/gl_rsurf.c b/nq/source/gl_rsurf.c index c4fef0b81..2bc2b5697 100644 --- a/nq/source/gl_rsurf.c +++ b/nq/source/gl_rsurf.c @@ -37,8 +37,8 @@ # include #endif -#include #include +#include #include "QF/cmd.h" #include "QF/compat.h" @@ -141,6 +141,7 @@ R_ForceLightUpdate () int dlightdivtable[8192]; int dlightdivtableinitialized = 0; + void R_AddDynamicLights (msurface_t *surf) { @@ -194,21 +195,15 @@ R_AddDynamicLights (msurface_t *surf) surf->texturemins[1]; i = f; - maxdist = (int) (cl_dlights[lnum].radius * cl_dlights[lnum].radius); // for - // - // - // comparisons - // to - // minimum - // acceptable - // light + maxdist = (int) (cl_dlights[lnum].radius * cl_dlights[lnum].radius); + // for comparisons to minimum acceptable light // clamp radius to avoid exceeding 8192 entry division table if (maxdist > 1048576) maxdist = 1048576; maxdist3 = maxdist - (int) (dist * dist); // convert to 8.8 blocklights format -// if (!cl_dlights[lnum].dark) -// { +// if (!cl_dlights[lnum].dark) +// { f = cl_dlights[lnum].color[0] * maxdist; red = f; f = cl_dlights[lnum].color[1] * maxdist; @@ -411,6 +406,7 @@ extern float speedscale; // for top sky and bottom sky lpMTexFUNC qglMTexCoord2f = NULL; lpSelTexFUNC qglSelectTexture = NULL; + void GL_UploadLightmap (int i, int x, int y, int w, int h) { @@ -867,17 +863,17 @@ R_RecursiveWorldNode (mnode_t *node) switch (plane->type) { case PLANE_X: - dot = modelorg[0] - plane->dist; - break; + dot = modelorg[0] - plane->dist; + break; case PLANE_Y: - dot = modelorg[1] - plane->dist; - break; + dot = modelorg[1] - plane->dist; + break; case PLANE_Z: - dot = modelorg[2] - plane->dist; - break; + dot = modelorg[2] - plane->dist; + break; default: - dot = DotProduct (modelorg, plane->normal) - plane->dist; - break; + dot = DotProduct (modelorg, plane->normal) - plane->dist; + break; } side = dot < 0; @@ -1056,9 +1052,9 @@ AllocBlock (int w, int h, int *x, int *y) mvertex_t *r_pcurrentvertbase; model_t *currentmodel; - int nColinElim; + void BuildSurfaceDisplayList (msurface_t *fa) { @@ -1163,7 +1159,6 @@ BuildSurfaceDisplayList (msurface_t *fa) } } poly->numverts = lnumverts; - } diff --git a/qw/source/gl_rsurf.c b/qw/source/gl_rsurf.c index a26b288e2..2f15029af 100644 --- a/qw/source/gl_rsurf.c +++ b/qw/source/gl_rsurf.c @@ -88,6 +88,7 @@ msurface_t *sky_chain; extern qboolean lighthalf; + // LordHavoc: place for gl_rsurf setup code void glrsurf_init (void) @@ -95,6 +96,7 @@ glrsurf_init (void) memset (&lightmaps, 0, sizeof (lightmaps)); } + static void R_RecursiveLightUpdate (mnode_t *node) { @@ -110,6 +112,7 @@ R_RecursiveLightUpdate (mnode_t *node) c--, surf++) surf->cached_dlight = true; } + // LordHavoc: function to force all lightmaps to be updated void R_ForceLightUpdate (void) @@ -119,19 +122,16 @@ R_ForceLightUpdate (void) R_RecursiveLightUpdate (cl.worldmodel->nodes); } + +int dlightdivtable[8192]; +int dlightdivtableinitialized = 0; + + /* R_AddDynamicLights LordHavoc: completely rewrote this, relies on 64bit integer math... */ -int dlightdivtable[8192]; -int dlightdivtableinitialized = 0; - -/* - R_AddDynamicLights - - NOTE! LordHavoc was here, and it shows... (Mercury) -*/ void R_AddDynamicLights (msurface_t *surf) { @@ -209,6 +209,7 @@ R_AddDynamicLights (msurface_t *surf) } } + /* R_BuildLightMap @@ -311,6 +312,7 @@ R_BuildLightMap (msurface_t *surf, byte * dest, int stride) } } + /* R_TextureAnimation @@ -354,6 +356,7 @@ extern int solidskytexture; extern int alphaskytexture; extern float speedscale; // for top sky and bottom sky + void GL_UploadLightmap (int i, int x, int y, int w, int h) { @@ -367,6 +370,7 @@ GL_UploadLightmap (int i, int x, int y, int w, int h) GL_UNSIGNED_BYTE, lightmaps[i]); } + /* R_DrawSequentialPoly @@ -436,9 +440,7 @@ R_DrawMultitexturePoly (msurface_t *s) glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); } -/* - R_BlendLightmaps -*/ + void R_BlendLightmaps (void) { @@ -485,9 +487,6 @@ R_BlendLightmaps (void) glDepthMask (GL_TRUE); // back to normal Z buffering } -/* - R_RenderFullbrights -*/ void R_RenderFullbrights (void) @@ -514,9 +513,7 @@ R_RenderFullbrights (void) glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } -/* - R_RenderBrushPoly -*/ + void R_RenderBrushPoly (msurface_t *fa) { @@ -586,6 +583,7 @@ R_RenderBrushPoly (msurface_t *fa) glColor3ubv (lighthalf_v); } + void GL_WaterSurface (msurface_t *s) { @@ -607,9 +605,7 @@ GL_WaterSurface (msurface_t *s) EmitWaterPolys (s); } -/* - R_DrawWaterSurfaces -*/ + void R_DrawWaterSurfaces (void) { @@ -650,9 +646,6 @@ R_DrawWaterSurfaces (void) } -/* - DrawTextureChains -*/ void DrawTextureChains (void) { @@ -673,9 +666,7 @@ DrawTextureChains (void) glEnable (GL_BLEND); } -/* - R_DrawBrushModel -*/ + void R_DrawBrushModel (entity_t *e) { @@ -783,13 +774,12 @@ R_DrawBrushModel (entity_t *e) glPopMatrix (); } + /* WORLD MODEL */ -/* - R_RecursiveWorldNode -*/ + void R_RecursiveWorldNode (mnode_t *node) { @@ -897,10 +887,6 @@ R_RecursiveWorldNode (mnode_t *node) } - -/* - R_DrawWorld -*/ void R_DrawWorld (void) { @@ -937,9 +923,6 @@ R_DrawWorld (void) } -/* - R_MarkLeaves -*/ void R_MarkLeaves (void) { @@ -974,11 +957,11 @@ R_MarkLeaves (void) } - /* LIGHTMAP ALLOCATION */ + // returns a texture number and the position inside it int AllocBlock (int w, int h, int *x, int *y) @@ -1029,9 +1012,7 @@ model_t *currentmodel; int nColinElim; -/* - BuildSurfaceDisplayList -*/ + void BuildSurfaceDisplayList (msurface_t *fa) { @@ -1130,9 +1111,7 @@ BuildSurfaceDisplayList (msurface_t *fa) } -/* - GL_CreateSurfaceLightmap -*/ + void GL_CreateSurfaceLightmap (msurface_t *surf) { @@ -1154,8 +1133,7 @@ GL_CreateSurfaceLightmap (msurface_t *surf) /* GL_BuildLightmaps - Builds the lightmap texture - with all the surfaces from all brush models + Builds the lightmap texture with all the surfaces from all brush models */ void GL_BuildLightmaps (void)