diff --git a/r_edge.c b/r_edge.c index c5b4b006..490204f6 100644 --- a/r_edge.c +++ b/r_edge.c @@ -73,7 +73,7 @@ edge_t edge_tail; edge_t edge_aftertail; edge_t edge_sentinel; -float fv; +static float fv; static int miplevel; @@ -1128,7 +1128,7 @@ void D_DrawSurfaces (void) if (!s->spans) continue; - r_drawnpolycount++; + //r_drawnpolycount++; #if 1 if(s->flags & SURF_DRAWSKY) D_BackgroundSurf (s); diff --git a/r_local.h b/r_local.h index 546b6b79..72e7a57c 100644 --- a/r_local.h +++ b/r_local.h @@ -333,7 +333,6 @@ extern ref_speeds_t r_stats; extern ref_instance_t RI; extern gl_globals_t tr; -extern float gldepthmin, gldepthmax; #define r_numEntities (tr.draw_list->num_solid_entities + tr.draw_list->num_trans_entities) #define r_numStatics (r_stats.c_client_ents) @@ -1082,7 +1081,7 @@ VARS ==================================================== */ -extern int d_spanpixcount; +//extern int d_spanpixcount; extern int r_framecount; // sequence # of current frame since Quake // started extern float r_aliasuvscale; // scale-up factor for screen u and v @@ -1109,7 +1108,7 @@ extern drawsurf_t r_drawsurf; void R_DrawSurface (void); -extern int c_surf; +//extern int c_surf; extern byte r_warpbuffer[WARP_WIDTH * WARP_HEIGHT]; @@ -1137,9 +1136,6 @@ void NonTurbulent8 (espan_t *pspan); //PGM surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel); -extern int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle; - -extern int d_pix_min, d_pix_max, d_pix_shift; extern pixel_t *d_viewbuffer; extern short *d_pzbuffer; @@ -1156,7 +1152,6 @@ extern int cachewidth; extern pixel_t *cacheblock; extern int r_screenwidth; -extern int r_drawnpolycount; extern int sintable[1280]; extern int intsintable[1280]; @@ -1176,13 +1171,13 @@ extern surf_t *surfaces, *surface_p, *surf_max; //=================================================================== -extern vec3_t sxformaxis[4]; // s axis transformed into viewspace -extern vec3_t txformaxis[4]; // t axis transformed into viewspac +//extern vec3_t sxformaxis[4]; // s axis transformed into viewspace +//extern vec3_t txformaxis[4]; // t axis transformed into viewspac extern float xcenter, ycenter; extern float xscale, yscale; extern float xscaleinv, yscaleinv; -extern float xscaleshrink, yscaleshrink; +//extern float xscaleshrink, yscaleshrink; extern edge_t *auxedges; @@ -1199,7 +1194,6 @@ extern edge_t edge_aftertail; extern int r_frustum_indexes[4*6]; -extern int r_maxsurfsseen, r_maxedgesseen, r_cnumsurfs; extern qboolean r_surfsonstack; extern mleaf_t *r_viewleaf; @@ -1207,7 +1201,7 @@ extern int r_viewcluster, r_oldviewcluster; extern int r_clipflags; extern int r_dlightframecount; -extern qboolean r_fov_greater_than_90; +//extern qboolean r_fov_greater_than_90; extern cvar_t *sw_aliasstats; @@ -1244,16 +1238,10 @@ extern mplane_t screenedge[4]; extern clipplane_t view_clipplanes[4]; extern int *pfrustum_indexes[4]; -extern vec3_t vup, base_vup; -extern vec3_t vpn, base_vpn; -extern vec3_t vright, base_vright; - extern cvar_t *r_fullbright; #define CACHESPOT(surf) ((surfcache_t**)surf->info->reserved) extern int r_visframecount; -extern mvertex_t *r_pcurrentvertbase; -extern int r_maxvalidedgeoffset; extern int r_currentkey; extern int r_currentbkey; extern qboolean insubmodel; @@ -1267,7 +1255,7 @@ extern int ubasestep, errorterm, erroradjustup, erroradjustdown; extern mvertex_t *r_pcurrentvertbase; -extern int r_maxvalidedgeoffset; +//extern int r_maxvalidedgeoffset; typedef struct { diff --git a/r_main.c b/r_main.c index 3eb85cfb..5776d688 100644 --- a/r_main.c +++ b/r_main.c @@ -20,10 +20,9 @@ GNU General Public License for more details. //#include "particledef.h" #include "entity_types.h" #include "mod_local.h" - +int r_cnumsurfs; #define IsLiquidContents( cnt ) ( cnt == CONTENTS_WATER || cnt == CONTENTS_SLIME || cnt == CONTENTS_LAVA ) -float gldepthmin, gldepthmax; ref_instance_t RI; @@ -42,7 +41,7 @@ vec3_t r_origin; float xcenter, ycenter; float xscale, yscale; float xscaleinv, yscaleinv; -float xscaleshrink, yscaleshrink; +//float xscaleshrink, yscaleshrink; float aliasxscale, aliasyscale, aliasxcenter, aliasycenter; int r_screenwidth; @@ -58,10 +57,10 @@ mplane_t screenedge[4]; // int r_framecount = 1; // so frame counts initialized to 0 don't match int r_visframecount; -int d_spanpixcount; -int r_polycount; -int r_drawnpolycount; -int r_wholepolycount; +//int d_spanpixcount; +//int r_polycount; +//int r_drawnpolycount; +//int r_wholepolycount; int *pfrustum_indexes[4]; int r_frustum_indexes[4*6]; @@ -113,8 +112,6 @@ cvar_t *sw_lockpvs; cvar_t *r_decals; - -mleaf_t *r_viewleaf; int r_viewcluster, r_oldviewcluster; float d_sdivzstepu, d_tdivzstepu, d_zistepu; @@ -134,8 +131,7 @@ qboolean r_dowarp; mvertex_t *r_pcurrentvertbase; -int c_surf; -int r_maxsurfsseen, r_maxedgesseen, r_cnumsurfs; +//int c_surf; qboolean r_surfsonstack; int r_clipflags; byte r_warpbuffer[WARP_WIDTH * WARP_HEIGHT]; @@ -1032,8 +1028,8 @@ R_DrawEntitiesOnList void R_DrawEntitiesOnList( void ) { int i; - extern int d_aflatcolor; - d_aflatcolor = 0; + //extern int d_aflatcolor; + //d_aflatcolor = 0; tr.blend = 1.0f; // GL_CheckForErrors(); //RI.currententity = gEngfuncs.GetEntityByIndex(0); @@ -1047,7 +1043,7 @@ void R_DrawEntitiesOnList( void ) { RI.currententity = tr.draw_list->solid_entities[i]; RI.currentmodel = RI.currententity->model; - d_aflatcolor += 500; + //d_aflatcolor += 500; Assert( RI.currententity != NULL ); Assert( RI.currentmodel != NULL ); @@ -1908,9 +1904,6 @@ void R_NewMap (void) r_surfsonstack = true; } - r_maxedgesseen = 0; - r_maxsurfsseen = 0; - r_numallocatededges = sw_maxedges->value; if (r_numallocatededges < MINEDGES) diff --git a/r_misc.c b/r_misc.c index fbccc98b..27f7f857 100644 --- a/r_misc.c +++ b/r_misc.c @@ -33,11 +33,10 @@ float d_scalemip[NUM_MIPS-1]; static float basemip[NUM_MIPS-1] = {1.0, 0.5*0.8, 0.25*0.8}; -extern int d_aflatcolor; -int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle; +//int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle; -int d_pix_min, d_pix_max, d_pix_shift; +//int d_pix_min, d_pix_max, d_pix_shift; int d_scantable[MAXHEIGHT]; short *zspantable[MAXHEIGHT]; @@ -73,7 +72,6 @@ void D_Patch (void) D_ViewChanged ================ */ -unsigned char *alias_colormap; void D_ViewChanged (void) { @@ -86,20 +84,20 @@ void D_ViewChanged (void) d_zrowbytes = vid.width * 2; d_zwidth = vid.width; - d_pix_min = gpGlobals->width / 320; + /*d_pix_min = gpGlobals->width / 320; if (d_pix_min < 1) d_pix_min = 1; d_pix_max = (int)((float)gpGlobals->height / (320.0 / 4.0) + 0.5); d_pix_shift = 8 - (int)((float)gpGlobals->height / 320.0 + 0.5); if (d_pix_max < 1) - d_pix_max = 1; + d_pix_max = 1;*/ - d_vrectx = RI.vrect.x; - d_vrecty = RI.vrect.y; - d_vrectright_particle = gpGlobals->width - d_pix_max; - d_vrectbottom_particle = - gpGlobals->height - d_pix_max; + //d_vrectx = RI.vrect.x; + //d_vrecty = RI.vrect.y; + //d_vrectright_particle = gpGlobals->width - d_pix_max; + //d_vrectbottom_particle = + // gpGlobals->height - d_pix_max; for (i=0 ; iwidth, gpGlobals->height,( int ) sw_clearcolor->value & 0xff ); } - alias_colormap = vid.colormap; - D_Patch (); } @@ -276,8 +272,8 @@ void R_ViewChanged (vrect_t *vr) yscale = xscale; aliasyscale = yscale * r_aliasuvscale; yscaleinv = 1.0 / yscale; - xscaleshrink = (RI.vrect.width-6)/RI.horizontalFieldOfView; - yscaleshrink = xscaleshrink; + //xscaleshrink = (RI.vrect.width-6)/RI.horizontalFieldOfView; + //yscaleshrink = xscaleshrink; // left side clip screenedge[0].normal[0] = -1.0 / (xOrigin*RI.horizontalFieldOfView); diff --git a/r_poly.c b/r_poly.c index fe03d18e..1a4264a1 100644 --- a/r_poly.c +++ b/r_poly.c @@ -39,7 +39,7 @@ typedef struct spanletvars_t s_spanletvars; -static int r_polyblendcolor; +//static int r_polyblendcolor; static espan_t *s_polygon_spans; @@ -1268,7 +1268,7 @@ void R_IMFlatShadedQuad( vec3_t a, vec3_t b, vec3_t c, vec3_t d, int color, floa r_polydesc.dist = DotProduct( r_polydesc.vpn, r_clip_verts[0][0] ); - r_polyblendcolor = color; + //r_polyblendcolor = color; R_ClipAndDrawPoly( alpha, false, false ); } diff --git a/r_polyse.c b/r_polyse.c index 6a2abe24..c9a75b1c 100644 --- a/r_polyse.c +++ b/r_polyse.c @@ -21,14 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // texture (used for Alias models) #include "r_local.h" -/* -int rand1k[] = { -#include "rand1k.h" -}; -*/ -#define MASK_1K 0x3FF - -int rand1k_index = 0; // TODO: put in span spilling to shrink list size // !!! if this is changed, it must be changed in d_polysa.s too !!! @@ -60,9 +52,6 @@ aliastriangleparms_t aliastriangleparms; int r_p0[6], r_p1[6], r_p2[6]; -byte *d_pcolormap; - -int d_aflatcolor; int d_xdenom; edgetable *pedgetable; @@ -120,7 +109,6 @@ void R_PolysetDrawSpans8_33 (spanpackage_t *pspanpackage); void R_PolysetDrawSpans8_66 (spanpackage_t *pspanpackage); void R_PolysetDrawSpans8_Opaque (spanpackage_t *pspanpackage); -void R_PolysetDrawThreshSpans8 (spanpackage_t *pspanpackage); void R_PolysetCalcGradients (int skinwidth); void R_DrawNonSubdiv (void); void R_PolysetSetEdgeTable (void); @@ -128,52 +116,6 @@ void R_RasterizeAliasPolySmooth (void); void R_PolysetScanLeftEdge(int height); void R_PolysetScanLeftEdge_C(int height); -// ====================== -// PGM -// 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 -byte iractive = 0; -byte irtable[256] = { 79, 78, 77, 76, 75, 74, 73, 72, // black/white - 71, 70, 69, 68, 67, 66, 65, 64, - 64, 65, 66, 67, 68, 69, 70, 71, // dark taupe - 72, 73, 74, 75, 76, 77, 78, 79, - - 64, 65, 66, 67, 68, 69, 70, 71, // slate grey - 72, 73, 74, 75, 76, 77, 78, 79, - 208, 208, 208, 208, 208, 208, 208, 208, // unused?' - 64, 66, 68, 70, 72, 74, 76, 78, // dark yellow - - 64, 65, 66, 67, 68, 69, 70, 71, // dark red - 72, 73, 74, 75, 76, 77, 78, 79, - 64, 65, 66, 67, 68, 69, 70, 71, // grey/tan - 72, 73, 74, 75, 76, 77, 78, 79, - - 64, 66, 68, 70, 72, 74, 76, 78, // chocolate - 68, 67, 66, 65, 64, 65, 66, 67, // mauve / teal - 68, 69, 70, 71, 72, 73, 74, 75, - 76, 76, 77, 77, 78, 78, 79, 79, - - 64, 65, 66, 67, 68, 69, 70, 71, // more mauve - 72, 73, 74, 75, 76, 77, 78, 79, - 64, 65, 66, 67, 68, 69, 70, 71, // olive - 72, 73, 74, 75, 76, 77, 78, 79, - - 64, 65, 66, 67, 68, 69, 70, 71, // maroon - 72, 73, 74, 75, 76, 77, 78, 79, - 64, 65, 66, 67, 68, 69, 70, 71, // sky blue - 72, 73, 74, 75, 76, 77, 78, 79, - - 64, 65, 66, 67, 68, 69, 70, 71, // olive again - 72, 73, 74, 75, 76, 77, 78, 79, - 64, 65, 66, 67, 68, 69, 70, 71, // nuclear green - 64, 65, 66, 67, 68, 69, 70, 71, // bright yellow - - 64, 65, 66, 67, 68, 69, 70, 71, // fire colors - 72, 73, 74, 75, 76, 77, 78, 79, - 208, 208, 64, 64, 70, 71, 72, 64, // mishmash1 - 66, 68, 70, 64, 65, 66, 67, 68}; // mishmash2 -// PGM -// ====================== - /* ================ R_PolysetUpdateTables @@ -739,82 +681,6 @@ void R_PolysetCalcGradients (int skinwidth) } #endif -/* -================ -R_PolysetDrawThreshSpans8 - -Random fizzle fade rasterizer -================ -*/ -void R_PolysetDrawThreshSpans8 (spanpackage_t *pspanpackage) -{ - int lcount; - byte *lpdest; - byte *lptex; - int lsfrac, ltfrac; - int llight; - int lzi; - short *lpz; - - do - { - lcount = d_aspancount - pspanpackage->count; - - errorterm += erroradjustup; - if (errorterm >= 0) - { - d_aspancount += d_countextrastep; - errorterm -= erroradjustdown; - } - else - { - d_aspancount += ubasestep; - } - - if (lcount) - { - lpdest = pspanpackage->pdest; - lptex = pspanpackage->ptex; - lpz = pspanpackage->pz; - lsfrac = pspanpackage->sfrac; - ltfrac = pspanpackage->tfrac; - llight = pspanpackage->light; - lzi = pspanpackage->zi; - - do - { - if ((lzi >> 16) >= *lpz) - { - rand1k_index = (rand1k_index + 1) & MASK_1K; - - /*if (rand1k[rand1k_index] <= r_affinetridesc.vis_thresh) - { - *lpdest = ((byte *)vid.colormap)[*lptex + (llight & 0xFF00)]; - *lpz = lzi >> 16; - }*/ - } - - lpdest++; - lzi += r_zistepx; - lpz++; - llight += r_lstepx; - lptex += a_ststepxwhole; - lsfrac += a_sstepxfrac; - lptex += lsfrac >> 16; - lsfrac &= 0xFFFF; - ltfrac += a_tstepxfrac; - if (ltfrac & 0x10000) - { - lptex += r_affinetridesc.skinwidth; - ltfrac &= 0xFFFF; - } - } while (--lcount); - } - - pspanpackage++; - } while (pspanpackage->count != -999999); -} - /* ================ diff --git a/r_scan.c b/r_scan.c index 4f078df2..0df3f8c9 100644 --- a/r_scan.c +++ b/r_scan.c @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. pixel_t *r_turb_pbase, *r_turb_pdest; fixed16_t r_turb_s, r_turb_t, r_turb_sstep, r_turb_tstep; int *r_turb_turb; -int r_turb_spancount; +static int r_turb_spancount; void D_DrawTurbulent8Span (void); diff --git a/r_surf.c b/r_surf.c index 9081b83a..1e306c65 100644 --- a/r_surf.c +++ b/r_surf.c @@ -1204,7 +1204,7 @@ surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel) // r_drawsurf.surf = surface; - c_surf++; + //c_surf++; // calculate the lightings R_BuildLightMap ( ); diff --git a/r_trialias.c b/r_trialias.c index 6c92eeac..88989cb4 100644 --- a/r_trialias.c +++ b/r_trialias.c @@ -2,17 +2,11 @@ // not really draw alias models here, but use this to draw triangles -int r_amodels_drawn; affinetridesc_t r_affinetridesc; -vec3_t r_plightvec; -vec3_t r_lerped[1024]; -vec3_t r_lerp_frontv, r_lerp_backv, r_lerp_move; -int r_ambientlight; int r_aliasblendcolor; -float r_shadelight; float aliastransform[3][4]; @@ -42,16 +36,6 @@ void R_AliasTransformFinalVerts( int numpoints, finalvert_t *fv, dtrivertx_t *ol R_AliasCheckBBox ================ */ -typedef struct { - int index0; - int index1; -} aedge_t; - -static aedge_t aedges[12] = { -{0, 1}, {1, 2}, {2, 3}, {3, 0}, -{4, 5}, {5, 6}, {6, 7}, {7, 4}, -{0, 5}, {1, 4}, {2, 7}, {3, 6} -}; #define BBOX_TRIVIAL_ACCEPT 0 #define BBOX_MUST_CLIP_XY 1