cleaned up stuff

This commit is contained in:
eukos 2015-08-23 01:00:03 +02:00
parent d96f532e3a
commit 49fa8011bc
8 changed files with 100 additions and 508 deletions

View file

@ -977,10 +977,7 @@ void M_Load_Key (int k)
return;
m_state = m_none;
key_dest = key_game;
VID_HandlePause(false);
// Host_Loadgame_f can't bring up the loading plaque because too much
// stack space has been used, so do it now
if (loadscreen->value)
@ -1020,6 +1017,7 @@ void M_Save_Key (int k)
case K_ENTER:
m_state = m_none;
key_dest = key_game;
VID_HandlePause(false);
Cbuf_AddText (va("save s%i\n", load_cursor));
return;

View file

@ -29,14 +29,13 @@ int screenwidth;
int ubasestep, errorterm, erroradjustup, erroradjustdown;
int vstartscan;
extern int gonnareflect;
// FIXME: should go away
extern void R_RotateBmodel (void);
extern void R_TransformFrustum (void);
extern float oldwateralpha;
vec3_t transformed_modelorg;
/*
=============
D_MipLevelForScale
@ -61,14 +60,11 @@ int D_MipLevelForScale (float scale)
return lmiplevel;
}
/*
==============
D_DrawSolidSurface
==============
*/
void D_DrawSolidSurface (surf_t *surf, int color)
{
espan_t *span;
@ -145,26 +141,22 @@ D_CalcGradients
*/
void D_CalcGradients (msurface_t *pface)
{
// mplane_t *pplane; // 2001-12-10 Reduced compiler warnings by Jeff Ford
float mipscale;
vec3_t p_temp1;
vec3_t p_saxis, p_taxis;
float t;
// pplane = pface->plane; // 2001-12-10 Reduced compiler warnings by Jeff Ford
mipscale = 1.0 / (float)(1 << miplevel);
//mipscale = 12; // Low detail hack?!
TransformVector (pface->texinfo->vecs[0], p_saxis);
TransformVector (pface->texinfo->vecs[1], p_taxis);
t = xscaleinv * mipscale;
//t = 1024;
d_sdivzstepu = p_saxis[0] * t;
d_tdivzstepu = p_taxis[0] * t;
t = yscaleinv * mipscale;
//t = 1024;
d_sdivzstepv = -p_saxis[1] * t;
d_tdivzstepv = -p_taxis[1] * t;
@ -181,13 +173,10 @@ void D_CalcGradients (msurface_t *pface)
((pface->texturemins[0] << 16) >> miplevel)
+ pface->texinfo->vecs[0][3]*t;
tadjust = ((fixed16_t)(DotProduct (p_temp1, p_taxis) * 0x10000 + 0.5)) -
tadjust = ((fixed16_t)(DotProduct (p_temp1, p_taxis) * 0x10000 + 0.5)) -
((pface->texturemins[1] << 16) >> miplevel)
+ pface->texinfo->vecs[1][3]*t;
//
// -1 (-epsilon) so we never wander off the edge of the texture
//
bbextents = ((pface->extents[0] << 16) >> miplevel) - 1;
bbextentt = ((pface->extents[1] << 16) >> miplevel) - 1;
@ -200,8 +189,8 @@ D_DrawSurfaces
==============
*/
extern int waterinsight;
extern vec3_t sbaseaxis[3], tbaseaxis[3];
extern vec3_t reflectorg;
extern vec3_t sbaseaxis[3], tbaseaxis[3];
extern vec3_t reflectorg;
extern cvar_t *d_mipdetail;
extern cvar_t *r_waterquality;
void D_DrawSurfaces (void)
@ -216,7 +205,6 @@ void D_DrawSurfaces (void)
TransformVector (modelorg, transformed_modelorg);
VectorCopy (transformed_modelorg, world_transformed_modelorg);
// TODO: could preset a lot of this at mode set time
if (r_drawflat->value)
{
for (s = &surfaces[1] ; s<surface_p ; s++)
@ -241,11 +229,9 @@ void D_DrawSurfaces (void)
continue;
r_drawnpolycount++;
// Manoel Kasimier - translucent water - begin
if (r_drawwater && (!(s->flags & SURF_DRAWTRANSLUCENT)))
continue;
// Manoel Kasimier - translucent water - end
d_zistepu = s->d_zistepu;
d_zistepv = s->d_zistepv;
@ -289,13 +275,13 @@ void D_DrawSurfaces (void)
// FIXME: we don't want to do all this for every polygon!
// TODO: store once at start of frame
currententity = s->entity; //FIXME: make this passed in to
// R_RotateBmodel ()
// R_RotateBmodel ()
VectorSubtract (r_origin, currententity->origin,
local_modelorg);
TransformVector (local_modelorg, transformed_modelorg);
R_RotateBmodel (); // FIXME: don't mess with the frustum,
// make entity passed in
// make entity passed in
}
D_CalcGradients (pface);
@ -307,7 +293,7 @@ void D_DrawSurfaces (void)
if (!r_drawwater) // Manoel Kasimier - translucent water
if (!r_drawwater)
D_DrawZSpans (s->spans);
if (s->insubmodel)
@ -371,12 +357,9 @@ void D_DrawSurfaces (void)
D_CalcGradients (pface);
mirror_plane = pface->plane;
//D_DrawSpans8_C_FilterAlter (s->spans);
(*d_drawspans) (s->spans);
D_DrawZSpans (s->spans);
// D_DrawSpans8_C_Fogger (s->spans);
if (s->insubmodel)
{

View file

@ -75,7 +75,6 @@ void D_Init (void)
}
/*
===============
D_CopyRects
@ -105,18 +104,6 @@ void D_EnableBackBufferAccess (void)
VID_LockBuffer ();
}
/*
===============
D_TurnZOn
===============
*/
void D_TurnZOn (void)
{
// not needed for software version
}
/*
===============
D_DisableBackBufferAccess
@ -332,9 +319,6 @@ D_UpdateRects
*/
void D_UpdateRects (vrect_t *prect)
{
// the software driver draws these directly to the vid buffer
UNUSED(prect);
}

View file

@ -23,10 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "d_local.h"
int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle;
int d_y_aspect_shift, d_pix_min, d_pix_max, d_pix_shift;
int d_scantable[MAXHEIGHT];
int d_scantable[MAXHEIGHT];
short *zspantable[MAXHEIGHT];
/*
@ -144,14 +143,12 @@ void D_ViewChanged (void)
d_vrectbottom_particle =
r_refdef.vrectbottom - (d_pix_max << d_y_aspect_shift);
{
int i;
int i;
for (i=0 ; i<vid.height; i++)
{
d_scantable[i] = i*rowbytes;
zspantable[i] = d_pzbuffer + i*d_zwidth;
}
for (i=0 ; i<vid.height; i++)
{
d_scantable[i] = i*rowbytes;
zspantable[i] = d_pzbuffer + i*d_zwidth;
}
D_Patch ();

View file

@ -22,30 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "globaldef.h"
#include "d_local.h"
/*
==============
D_EndParticles
==============
*/
void D_EndParticles (void)
{
// not used by software driver
}
/*
==============
D_StartParticles
==============
*/
void D_StartParticles (void)
{
// not used by software driver
}
#if !id386
/*
@ -475,28 +451,15 @@ void D_DrawParticleLit (particle_t *pparticle)
u = (int)(xcenter + zi * transformed[0] + 0.5);
v = (int)(ycenter - zi * transformed[1] + 0.5);
if ((v > d_vrectbottom_particle) ||
(u > d_vrectright_particle) ||
(v < d_vrecty) ||
(u < d_vrectx))
{
if ((v > d_vrectbottom_particle) || (u > d_vrectright_particle) || (v < d_vrecty) || (u < d_vrectx))
return;
}
col = (int)pparticle->color;
//alf = R_LightPoint(pparticle->org);
//alf = R_LightPoint(pparticle->org);
// alf =
// 8192 *
// (R_LightPoint(pparticle->org) * -1) + 16384;
col = (int)pparticle->color;
alf = (R_LightPoint(pparticle->org) / 272);
//8192 * (pparticle->alpha * -1) + 16384;
Con_Printf ("%f paticl\n", alf);
Con_DPrintf ("%f paticl\n", alf);
col = ((byte *)acolormap)[col + ((int)alf & 0xFF00)];
@ -512,10 +475,6 @@ void D_DrawParticleLit (particle_t *pparticle)
else if (pix > d_pix_max)
pix = d_pix_max;
switch (pix)
{
case 1:
@ -1145,23 +1104,25 @@ void D_DrawParticle_Gel (particle_t *pparticle)
{
return;
}
gmcol = pparticle->color; // sample a pixel (TODO: Average a pixel on load)
if (gmcol < 16) gmcol = 0;
else if (gmcol < 32) gmcol = 1;
else if (gmcol < 48) gmcol = 2;
else if (gmcol < 64) gmcol = 3;
else if (gmcol < 80) gmcol = 4;
else if (gmcol < 96) gmcol = 5;
else if (gmcol < 112) gmcol = 6;
else if (gmcol < 128) gmcol = 7;
else if (gmcol < 144) gmcol = 8;
else if (gmcol < 160) gmcol = 9;
else if (gmcol < 176) gmcol = 10;
else if (gmcol < 192) gmcol = 11;
else if (gmcol < 208) gmcol = 12;
else if (gmcol < 224) gmcol = 13; // stupid elses huh?
else if (gmcol < 240) gmcol = 14;
else gmcol = 2; // stupid.
gmcol = pparticle->color; // sample a pixel (TODO: Average a pixel on load)
if (gmcol < 16) gmcol = 0;
else if (gmcol < 32) gmcol = 1;
else if (gmcol < 48) gmcol = 2;
else if (gmcol < 64) gmcol = 3;
else if (gmcol < 80) gmcol = 4;
else if (gmcol < 96) gmcol = 5;
else if (gmcol < 112) gmcol = 6;
else if (gmcol < 128) gmcol = 7;
else if (gmcol < 144) gmcol = 8;
else if (gmcol < 160) gmcol = 9;
else if (gmcol < 176) gmcol = 10;
else if (gmcol < 192) gmcol = 11;
else if (gmcol < 208) gmcol = 12;
else if (gmcol < 224) gmcol = 13;
else if (gmcol < 240) gmcol = 14;
else gmcol = 2;
pparticle->color = gmcol;
pz = d_pzbuffer + (d_zwidth * v) + u;
@ -1335,14 +1296,6 @@ void D_DrawSparkTrans (vec3_t src, vec3_t dest, unsigned int pcolour, int blend)
int coll, forg;
int du, dv, dz;
// coll = pcolour;
// if (pcolour<0)
// return; // hmm, corruption!
// if (pcolour>255)
// return; // hmm, corruption!
// alfa = palpha; // tODO : Alpha fade along length
D_2dPos(src, &u1, &v1, &z1);
D_2dPos(dest, &u2, &v2, &z2);
@ -1404,45 +1357,6 @@ void D_DrawSparkTrans (vec3_t src, vec3_t dest, unsigned int pcolour, int blend)
z1 += dz;
} while (count--);
}
/* else if (alfa < 0.66f)// alpha
{
do
{
pz = d_pzbuffer + (d_zwidth * (v1>>16)) + (u1>>16);
if (*pz <= z1>>16)
{
// *pz = z1>>16;
pdest = d_viewbuffer + d_scantable[v1>>16] + (u1>>16);
//pdest = transTable[coll][*pdest];
*pdest = coll;
}
u1 += du;
v1 += dv;
z1 += dz;
} while (count--);
}
else if (alfa < 0.33f)// alpha
{
do
{
pz = d_pzbuffer + (d_zwidth * (v1>>16)) + (u1>>16);
if (*pz <= z1>>16)
{
// *pz = z1>>16;
pdest = d_viewbuffer + d_scantable[v1>>16] + (u1>>16);
//pdest = transTable[*pdest][coll];
*pdest = coll;
}
u1 += du;
v1 += dv;
z1 += dz;
} while (count--);
}
*/
else // merge blend
{
@ -1466,5 +1380,3 @@ void D_DrawSparkTrans (vec3_t src, vec3_t dest, unsigned int pcolour, int blend)
} while (count--);
}
}

View file

@ -1642,10 +1642,6 @@ void R_EdgeDrawing (void)
if (r_drawculledpolys)
R_ScanEdges ();
// only the world can be drawn back to front with no z reads or compares, just
// z writes, so have the driver turn z compares on now
D_TurnZOn ();
if (r_dspeeds->value)
{
rw_time2 = Sys_FloatTime ();

View file

@ -3152,8 +3152,6 @@ void R_DrawParticles (void)
VectorScale (vright, 8.5, right);
#else
D_StartParticles ();
VectorScale (vright, xscaleshrink, r_pright);
VectorScale (vup, yscaleshrink, r_pup);
VectorCopy (vpn, r_ppn);
@ -4212,13 +4210,7 @@ else
}
#ifdef GLQUAKE
glEnd ();
glDisable (GL_BLEND);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
#else
D_EndParticles ();
#endif
}

View file

@ -24,16 +24,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// hmm
drawsurf_t r_drawsurf;
int lightleft, sourcesstep, blocksize, sourcetstep;
int lightdelta, lightdeltastep;
int lightright, lightleftstep, lightrightstep, blockdivshift;
int lightlefta[3];
int sourcesstep, blocksize, sourcetstep;
int lightrighta[3];
int lightleftstepa[3], lightrightstepa[3], blockdivshift;
int lightleft, sourcesstep, blocksize, sourcetstep;
int lightdelta, lightdeltastep;
int lightright, lightleftstep, lightrightstep, blockdivshift;
int lightlefta[3];
int sourcesstep, blocksize, sourcetstep;
int lightrighta[3];
int lightleftstepa[3], lightrightstepa[3], blockdivshift;
extern cvar_t *temp2;
@ -42,34 +40,30 @@ void *prowdestbase;
unsigned char *pbasesource;
unsigned int *pbasesource24;
int surfrowbytes; // used by ASM files
unsigned int dynlightenabled; // r_dynamic
int surfrowbytes; // used by ASM files
unsigned int dynlightenabled; // r_dynamic
int r_stepback;
int r_lightwidth;
int r_lightwidther;
int r_numhblocks, r_numvblocks;
int r_stepback;
int r_lightwidth;
int r_lightwidther;
int r_numhblocks, r_numvblocks;
unsigned char *r_source, *r_sourcemax;
unsigned long *r_source24;
unsigned char *r_sourcemax24;
int *r_lightptr;
int *r_lightptr_r;
int *r_lightptr_g;
int *r_lightptr_b;
int *r_lightptr_r;
int *r_lightptr_g;
int *r_lightptr_b;
int coloredmethod;
extern byte palmap[32][32][32];
extern unsigned char palmap3[65535];
static char *rgb_colormap_red;
static char *rgb_colormap_green;
static char *rgb_colormap_blue;
void PalmapStaticized ()
{
int i, j, k;
@ -77,15 +71,12 @@ void PalmapStaticized ()
rgb_colormap_red = host_colormap_red;
rgb_colormap_green = host_colormap_green;
rgb_colormap_blue = host_colormap_blue;
}
// test
int blocklights[18*18*3]; // LordHavoc: .lit support (*3 for RGB)
int blocklights[18*18*3]; // LordHavoc: .lit support (*3 for RGB)
void R_DrawSurfaceBlock8_mip0 (void);
void R_DrawSurfaceBlock8_mip1 (void);
@ -97,81 +88,49 @@ void R_DrawSurfaceBlock8Fast_mip1 (void);
void R_DrawSurfaceBlock8Fast_mip2 (void);
void R_DrawSurfaceBlock8Fast_mip3 (void);
#ifdef id386rgb
void D_DrawSurfaceBlock8RGBASM_mip0(void);
void D_DrawSurfaceBlock8RGBASM_mip1(void);
void D_DrawSurfaceBlock8RGBASM_mip2(void);
void D_DrawSurfaceBlock8RGBASM_mip3(void);
#endif
/*
void D_DrawSurfaceBlock8RED_mip0(void);
void D_DrawSurfaceBlock8RED_mip1(void);
void D_DrawSurfaceBlock8RED_mip2(void);
void D_DrawSurfaceBlock8RED_mip3(void);
void D_DrawSurfaceBlock8GREEN_mip0(void);
void D_DrawSurfaceBlock8GREEN_mip1(void);
void D_DrawSurfaceBlock8GREEN_mip2(void);
void D_DrawSurfaceBlock8GREEN_mip3(void);
void D_DrawSurfaceBlock8BLUE_mip0(void);
void D_DrawSurfaceBlock8BLUE_mip1(void);
void D_DrawSurfaceBlock8BLUE_mip2(void);
void D_DrawSurfaceBlock8BLUE_mip3(void);
*/
// 8-bit target - 8-bit textures - colored lighting - nearest
// 8-bit target - 8-bit textures - colored lighting - nearest
void D_DrawSurfaceBlock8RGBX_mip0(void);
void D_DrawSurfaceBlock8RGBX_mip1(void);
void D_DrawSurfaceBlock8RGBX_mip2(void);
void D_DrawSurfaceBlock8RGBX_mip3(void);
// 8-bit target - 8-bit textures - colored lighting - nearest - lookup method
// 8-bit target - 8-bit textures - colored lighting - nearest - lookup method
void D_DrawSurfaceBlock888RGBX_mip0(void);
void D_DrawSurfaceBlock888RGBX_mip1(void);
void D_DrawSurfaceBlock888RGBX_mip2(void);
void D_DrawSurfaceBlock888RGBX_mip3(void);
// 8-bit target - 8-bit textures - colored lighting - dithered
// 8-bit target - 8-bit textures - colored lighting - dithered
void D_DrawSurfaceBlock8RGBXD_mip0(void);
void D_DrawSurfaceBlock8RGBXD_mip1(void);
void D_DrawSurfaceBlock8RGBXD_mip2(void);
void D_DrawSurfaceBlock8RGBXD_mip3(void);
// 8-bit target - 24-bit textures - colored lighting - dithered
// 8-bit target - 24-bit textures - colored lighting - dithered
void D_DrawSurfaceBlock824RGBXD_mip0(void);
void D_DrawSurfaceBlock824RGBXD_mip1(void);
void D_DrawSurfaceBlock824RGBXD_mip2(void);
void D_DrawSurfaceBlock824RGBXD_mip3(void);
// 8-bit target - 24-bit textures - colored lighting - nearest
// 8-bit target - 24-bit textures - colored lighting - nearest
void D_DrawSurfaceBlock824RGBX_mip0(void);
void D_DrawSurfaceBlock824RGBX_mip1(void);
void D_DrawSurfaceBlock824RGBX_mip2(void);
void D_DrawSurfaceBlock824RGBX_mip3(void);
static void (*surfmiptable[4])(void) = {
R_DrawSurfaceBlock8_mip0,
R_DrawSurfaceBlock8_mip1,
R_DrawSurfaceBlock8_mip2,
R_DrawSurfaceBlock8_mip3
};
#ifdef EXPREND
static void (*surfmiptableshadow[4])(void) = {
R_DrawSurfaceBlock8S_mip0,
@ -179,7 +138,6 @@ static void (*surfmiptableshadow[4])(void) = {
R_DrawSurfaceBlock8S_mip2,
R_DrawSurfaceBlock8S_mip3
};
static void (*surfmiptablediffuse[4])(void) = {
R_DrawSurfaceBlock8D_mip0,
R_DrawSurfaceBlock8D_mip1,
@ -204,10 +162,6 @@ static void (*surfmiptable8RGBX[4])(void) =
#endif
};
static void (*surfmiptable8RGBXD[4])(void) =
{
@ -217,8 +171,6 @@ static void (*surfmiptable8RGBXD[4])(void) =
R_DrawSurfaceBlock8RGBXD_mip3
};
static void (*surfmiptable888RGB[4])(void) =
{
@ -228,7 +180,6 @@ static void (*surfmiptable888RGB[4])(void) =
R_DrawSurfaceBlock888RGB_mip3
};
#ifdef twentyfourbithack
static void (*surfmiptable824RGBXD[4])(void) =
{
@ -271,11 +222,6 @@ static void (*surfmiptablefast[4])(void) = {
#endif
// MACROHARD!!!!!!!
// Macros for initiating the RGB light deltas.
#define MakeLightDelta() { light[0] = lightrighta[0]; light[1] = lightrighta[1]; light[2] = lightrighta[2];};
#define PushLightDelta() { light[0] += lightdelta[0]; light[1] += lightdelta[1]; light[2] += lightdelta[2]; };
@ -348,10 +294,10 @@ void R_AddDynamicLights (void)
impact[0] = origin_for_ent[0] - // mankrip - dynamic lights on moving brush models fix - edited
surf->plane->normal[0]*dist;
impact[1] = origin_for_ent[1] - // mankrip - dynamic lights on moving brush models fix - edited
surf->plane->normal[1]*dist;
impact[2] = origin_for_ent[2] - // mankrip - dynamic lights on moving brush models fix - edited
surf->plane->normal[2]*dist;
impact[1] = origin_for_ent[1] - // mankrip - dynamic lights on moving brush models fix - edited
surf->plane->normal[1]*dist;
impact[2] = origin_for_ent[2] - // mankrip - dynamic lights on moving brush models fix - edited
surf->plane->normal[2]*dist;
local[0] = DotProduct (impact, tex->vecs[0]) + tex->vecs[0][3];
@ -375,11 +321,9 @@ void R_AddDynamicLights (void)
else
dist = td + (sd>>1);
if (dist < minlight)
{
unsigned temp;
temp = (rad - dist)*256;
;
i = t*smax + s;
if (!cl_dlights[lnum].dark)
@ -392,10 +336,6 @@ void R_AddDynamicLights (void)
blocklights[i] = 0;
}
}
}
}
}
@ -426,9 +366,6 @@ void R_AddDynamicLightsRGB ()
for (lnum=0 ; lnum<MAX_DLIGHTS ; lnum++)
{
if ( !(surf->dlightbits & (1<<lnum) ) )
continue; // not lit by this light
@ -468,9 +405,6 @@ void R_AddDynamicLightsRGB ()
bl = blocklights;
// 2001-09-11 Colored lightning by LordHavoc/Sarcazm/Maddes end
for (t = 0 ; t<tmax ; t++)
{
td = local[1] - t*16;
@ -501,21 +435,7 @@ void R_AddDynamicLightsRGB ()
}
// leilei - shadowhack continued
// Crude Versions
void R_AddDynamicLightsCrude (void)
{
msurface_t *surf;
@ -603,10 +523,6 @@ void R_AddDynamicLightsCrude (void)
blocklights[i] = 0;
}
}
}
}
}
@ -703,14 +619,9 @@ void R_AddDynamicLightsRGBCrude ()
bl += 3;
}
}
}
}
/*
===============
R_AddShadows
@ -788,17 +699,13 @@ void R_AddShadows (void)
//if (!cl_shadows[lnum].dark)
// blocklights[i] += temp;
// else
{
if (blocklights[i] > temp)
blocklights[i] -= temp;
else
blocklights[i] = 0;
}
if (blocklights[i] > temp)
blocklights[i] -= temp;
else
blocklights[i] = 0;
}
}
}
}
@ -1017,20 +924,6 @@ void R_BuildLightMapReallyCrap (void)
lightmap += size; // skip to next lightmap
}
// add all the dynamic lights
// if (surf->dlightframe == r_framecount && dynlightenabled){
// if (!crude)
// R_AddDynamicLightsCrude ();
// else
// R_AddDynamicLights ();
// }
// and shadows
// if (surf->shadowframe == r_framecount){
// R_AddShadows ();
// }
// bound, invert, and shift
for (i=0 ; i<size ; i++)
{
@ -1113,51 +1006,43 @@ void R_BuildLightMapRGB (void)
}
// add all the dynamic lights
if (surf->dlightframe == r_framecount && dynlightenabled)
if (!crude)
R_AddDynamicLightsRGBCrude ();
else
R_AddDynamicLightsRGB ();
if (surf->dlightframe == r_framecount && dynlightenabled)
if (!crude)
R_AddDynamicLightsRGBCrude ();
else
R_AddDynamicLightsRGB ();
// and shadows
if (surf->shadowframe == r_framecount)
R_AddShadowsRGB ();
if (surf->shadowframe == r_framecount)
R_AddShadowsRGB ();
// bound, invert, and shift
if (coloredmethod)
if (coloredmethod)
{
int t, re;
for (i=0 ; i<size ; i++)
{
t = blocklights[i] / 2;
if (t < 1024)
t = 1024;
if (t > sample)
t = sample;
t = t >> (8 - VID_CBITS);
int t, re;
for (i=0 ; i<size ; i++)
{
t = blocklights[i] / 2;
if (t < 1024)
t = 1024;
if (t > sample)
t = sample;
if (t < (1 << 6))
t = (1 << 6);
t = t >> (8 - VID_CBITS);
if (t < (1 << 6))
t = (1 << 6);
r = t;
// blocklights[i] = (r < 256) ? 256 : (r > sample) ? sample : r >> 1;
blocklights[i] = r;
}
r = t;
blocklights[i] = r;
}
}
else
{
for (i=0 ; i<size ; i++)
{
r = blocklights[i] >> shifted;
blocklights[i] = (r < 256) ? 256 : (r > sample) ? sample : r; // leilei - made min 256 to rid visual artifacts and gain speed
}
{
r = blocklights[i] >> shifted;
blocklights[i] = (r < 256) ? 256 : (r > sample) ? sample : r; // leilei - made min 256 to rid visual artifacts and gain speed
}
}
}
@ -1212,23 +1097,7 @@ void R_BuildLightMapRGBHack (void)
// and shadows
if (surf->shadowframe == r_framecount)
R_AddShadowsRGB ();
// bound, invert, and shift
/*
for (i=0 ; i<size ; i++)
{
r = blocklights[i];
blocklights[i] = (r < 0) ? 0 : (r > 65535) ? 65535 : r;
blocklights[i] = blocklights [i] >> (8 - VID_CBITS);;
}
*/
// bound, invert, and shift
for (i=0 ; i<size ; i++)
{
@ -1488,12 +1357,7 @@ void R_DrawSurface (void)
}
// scary 32-bit version
void R_DrawSurface32 (void)
{
#ifdef twentyfourbithack
@ -1605,19 +1469,7 @@ void R_DrawSurface32 (void)
#endif
}
//=============================================================================
#if !id386
/*
================
R_DrawSurfaceBlock8_mip0
@ -1727,7 +1579,6 @@ void R_DrawSurfaceBlock8_mip1 (void)
}
}
/*
================
R_DrawSurfaceBlock8_mip2
@ -1780,7 +1631,6 @@ void R_DrawSurfaceBlock8_mip2 (void)
}
}
/*
================
R_DrawSurfaceBlock8_mip3
@ -1878,13 +1728,6 @@ void R_DrawSurfaceBlock16 (void)
prowdestbase = prowdest;
}
#endif
#ifdef EXPREND
@ -1962,7 +1805,6 @@ void R_DrawSurfaceBlock8D_mip1 (void)
}
}
/*
================
R_DrawSurfaceBlock8_mip2
@ -1998,7 +1840,6 @@ void R_DrawSurfaceBlock8D_mip2 (void)
}
}
/*
================
R_DrawSurfaceBlock8_mip3
@ -2034,9 +1875,6 @@ void R_DrawSurfaceBlock8D_mip3 (void)
}
}
/*
================
R_DrawSurfaceBlock8_mip0
@ -2249,12 +2087,9 @@ void R_DrawSurfaceBlock8S_mip3 (void)
}
}
#endif
#if id386
// FAST VERSIONS BELOW LACK LIGHTSTEPPING
void R_DrawSurfaceBlock8_mip0fast (void)
{
int v, i, b, light;
@ -2362,57 +2197,26 @@ void R_DrawSurfaceBlock8_mip3fast (void)
psource -= r_stepback;
}
}
#endif
extern unsigned d_8to24table[256];
extern byte *lmmap;
extern byte palmap2[64][64][64];
// =!=!=!=!=!=!=!=
// ASMME: surf8rgb.s
// =!=!=!=!=!=!=!=
// final!!! Crap cleaned out and slightly more optimized
extern byte transTable[256][256];
// leilei - i put them all here, cutting lots of bloat. I also deprecated hqlite. :(
// it's seemingly faster (!) doing it through one function instead of four
// 18-bit version
// Unrolled
void R_DrawSurfaceBlock8RGBX_mip0()
{
unsigned int v, i;
@ -2467,9 +2271,6 @@ void R_DrawSurfaceBlock8RGBX_mip0()
}
}
void R_DrawSurfaceBlock8RGBX_mip1()
{
unsigned int v, i;
@ -2525,8 +2326,6 @@ void R_DrawSurfaceBlock8RGBX_mip1()
}
}
void R_DrawSurfaceBlock8RGBX_mip2()
{
unsigned int v, i;
@ -2582,7 +2381,6 @@ void R_DrawSurfaceBlock8RGBX_mip2()
}
}
void R_DrawSurfaceBlock8RGBX_mip3()
{
unsigned int v, i;
@ -2638,10 +2436,7 @@ void R_DrawSurfaceBlock8RGBX_mip3()
}
}
// 8RGBXD - dithered, 8-bit texture mip block
void R_DrawSurfaceBlock8RGBXD_mip0 ()
{
unsigned v, i;
@ -2698,8 +2493,6 @@ void R_DrawSurfaceBlock8RGBXD_mip0 ()
}
}
void R_DrawSurfaceBlock8RGBXD_mip1 ()
{
unsigned v, i;
@ -2756,8 +2549,6 @@ void R_DrawSurfaceBlock8RGBXD_mip1 ()
}
}
void R_DrawSurfaceBlock8RGBXD_mip2 ()
{
unsigned v, i;
@ -2814,9 +2605,6 @@ void R_DrawSurfaceBlock8RGBXD_mip2 ()
}
}
void R_DrawSurfaceBlock8RGBXD_mip3 ()
{
unsigned v, i;
@ -2872,13 +2660,7 @@ void R_DrawSurfaceBlock8RGBXD_mip3 ()
}
}
// New (and highly experimental) triple lookup method
void R_DrawSurfaceBlock888RGBLoops (int mip, int mif)
{
int v, i, b;
@ -3047,9 +2829,6 @@ void R_DrawSurfaceBlock888RGB_mip0()
}
}
void R_DrawSurfaceBlock888RGB_mip1()
{
unsigned int v, i;
@ -3103,8 +2882,6 @@ void R_DrawSurfaceBlock888RGB_mip1()
}
}
void R_DrawSurfaceBlock888RGB_mip2()
{
unsigned int v, i;
@ -3158,7 +2935,6 @@ void R_DrawSurfaceBlock888RGB_mip2()
}
}
void R_DrawSurfaceBlock888RGB_mip3()
{
unsigned int v, i;
@ -3211,8 +2987,6 @@ void R_DrawSurfaceBlock888RGB_mip3()
}
}
#endif
//extern cvar_t temp3;
@ -3313,7 +3087,6 @@ void R_DrawSurfaceBlock824RGBXDLoops (int mip, int mif)
}
}
void R_DrawSurfaceBlock824RGBXD_mip0 ()
{
int v, i, b, r;
@ -3368,8 +3141,6 @@ void R_DrawSurfaceBlock824RGBXD_mip0 ()
}
}
void R_DrawSurfaceBlock824RGBXD_mip1 ()
{
int v, i, b, r;
@ -3426,8 +3197,6 @@ void R_DrawSurfaceBlock824RGBXD_mip1 ()
}
}
void R_DrawSurfaceBlock824RGBXD_mip2 ()
{
int v, i, b, r;
@ -3483,9 +3252,6 @@ void R_DrawSurfaceBlock824RGBXD_mip2 ()
}
}
void R_DrawSurfaceBlock824RGBXD_mip3 ()
{
int v, i, b, r;
@ -3540,14 +3306,7 @@ void R_DrawSurfaceBlock824RGBXD_mip3 ()
}
}
#ifdef twentyfourbithack
void R_DrawSurfaceBlock824RGBXDf_mip0 (void)
{
R_DrawSurfaceBlock824RGBXDLoops (16, 4);
@ -3565,16 +3324,6 @@ void R_DrawSurfaceBlock824RGBXDf_mip3 (void)
R_DrawSurfaceBlock824RGBXDLoops (2, 1);
}
// No dithering in this one, goes straight to 8-bit spans (losing the point aren't we? Well colored lighting
// on 24-bit textures would probably choose better colors than colored lighting on translated textures
// so there's still *some* point to this.
@ -3671,7 +3420,6 @@ void R_DrawSurfaceBlock824RGBXLoops (int mip, int mif)
}
}
void R_DrawSurfaceBlock824RGBX_mip0 (void)
{
R_DrawSurfaceBlock824RGBXLoops (16, 4);
@ -3689,24 +3437,7 @@ void R_DrawSurfaceBlock824RGBX_mip3 (void)
R_DrawSurfaceBlock824RGBXLoops (2, 1);
}
#endif
//============================================================================
/*
================
R_GenTurbTile
================
*/
#endif
void R_GenTurbTile (pixel_t *pbasetex, void *pdest)
{
@ -3728,7 +3459,6 @@ void R_GenTurbTile (pixel_t *pbasetex, void *pdest)
}
}
/*
================
R_GenTurbTile16