diff --git a/engine/menu.c b/engine/menu.c index 132a908..7ae879a 100644 --- a/engine/menu.c +++ b/engine/menu.c @@ -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; diff --git a/renderer/d_edge.c b/renderer/d_edge.c index 6629abf..b485496 100644 --- a/renderer/d_edge.c +++ b/renderer/d_edge.c @@ -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] ; sflags & 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) { diff --git a/renderer/d_init.c b/renderer/d_init.c index 25b3998..05e59bd 100644 --- a/renderer/d_init.c +++ b/renderer/d_init.c @@ -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); } diff --git a/renderer/d_modech.c b/renderer/d_modech.c index d56c626..b6bd601 100644 --- a/renderer/d_modech.c +++ b/renderer/d_modech.c @@ -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 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--); } } - - diff --git a/renderer/r_main.c b/renderer/r_main.c index b138014..60154cc 100644 --- a/renderer/r_main.c +++ b/renderer/r_main.c @@ -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 (); diff --git a/renderer/r_part.c b/renderer/r_part.c index f211843..ec82028 100644 --- a/renderer/r_part.c +++ b/renderer/r_part.c @@ -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 + } diff --git a/renderer/r_surf.c b/renderer/r_surf.c index 4f0445d..0722d7d 100644 --- a/renderer/r_surf.c +++ b/renderer/r_surf.c @@ -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 ; lnumdlightbits & (1< 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 ; idlightframe == 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 sample) - t = sample; - t = t >> (8 - VID_CBITS); + int t, re; + for (i=0 ; i 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> 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 65535) ? 65535 : r; - blocklights[i] = blocklights [i] >> (8 - VID_CBITS);; - } - */ - + // bound, invert, and shift for (i=0 ; i