Whitespace and comment cleanup.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-05-15 17:38:43 +00:00
parent dd81f9bf30
commit 5d52236da1
23 changed files with 271 additions and 719 deletions

View file

@ -46,12 +46,7 @@ extern void R_TransformFrustum (void);
vec3_t transformed_modelorg; vec3_t transformed_modelorg;
/*
==============
D_DrawPoly
==============
*/
void void
D_DrawPoly (void) D_DrawPoly (void)
{ {
@ -59,11 +54,6 @@ D_DrawPoly (void)
} }
/*
=============
D_MipLevelForScale
=============
*/
int int
D_MipLevelForScale (float scale) D_MipLevelForScale (float scale)
{ {
@ -85,14 +75,7 @@ D_MipLevelForScale (float scale)
} }
/*
==============
D_DrawSolidSurface
==============
*/
// FIXME: clean this up // FIXME: clean this up
void void
D_DrawSolidSurface (surf_t *surf, int color) D_DrawSolidSurface (surf_t *surf, int color)
{ {
@ -125,11 +108,6 @@ D_DrawSolidSurface (surf_t *surf, int color)
} }
/*
==============
D_CalcGradients
==============
*/
void void
D_CalcGradients (msurface_t *pface) D_CalcGradients (msurface_t *pface)
{ {
@ -169,19 +147,12 @@ D_CalcGradients (msurface_t *pface)
((pface->texturemins[1] << 16) >> miplevel) ((pface->texturemins[1] << 16) >> miplevel)
+ pface->texinfo->vecs[1][3] * t; + pface->texinfo->vecs[1][3] * t;
//
// -1 (-epsilon) so we never wander off the edge of the texture // -1 (-epsilon) so we never wander off the edge of the texture
//
bbextents = ((pface->extents[0] << 16) >> miplevel) - 1; bbextents = ((pface->extents[0] << 16) >> miplevel) - 1;
bbextentt = ((pface->extents[1] << 16) >> miplevel) - 1; bbextentt = ((pface->extents[1] << 16) >> miplevel) - 1;
} }
/*
==============
D_DrawSurfaces
==============
*/
void void
D_DrawSurfaces (void) D_DrawSurfaces (void)
{ {
@ -248,17 +219,13 @@ D_DrawSurfaces (void)
// FIXME: we don't want to do all this for every polygon! // FIXME: we don't want to do all this for every polygon!
// TODO: store once at start of frame // TODO: store once at start of frame
currententity = s->entity; // FIXME: make this passed in currententity = s->entity; // FIXME: make this passed in
// // to R_RotateBmodel ()
//
// to
// R_RotateBmodel ()
VectorSubtract (r_origin, currententity->origin, VectorSubtract (r_origin, currententity->origin,
local_modelorg); local_modelorg);
TransformVector (local_modelorg, transformed_modelorg); TransformVector (local_modelorg, transformed_modelorg);
R_RotateBmodel (); // FIXME: don't mess with the R_RotateBmodel (); // FIXME: don't mess with the
// frustum, // frustum, make entity passed in
// make entity passed in
} }
D_CalcGradients (pface); D_CalcGradients (pface);
@ -266,11 +233,10 @@ D_DrawSurfaces (void)
D_DrawZSpans (s->spans); D_DrawZSpans (s->spans);
if (s->insubmodel) { if (s->insubmodel) {
//
// restore the old drawing state // restore the old drawing state
// FIXME: we don't want to do this every time! // FIXME: we don't want to do this every time!
// TODO: speed up // TODO: speed up
//
currententity = &cl_entities[0]; currententity = &cl_entities[0];
VectorCopy (world_transformed_modelorg, VectorCopy (world_transformed_modelorg,
transformed_modelorg); transformed_modelorg);
@ -285,17 +251,13 @@ D_DrawSurfaces (void)
// FIXME: we don't want to do all this for every polygon! // FIXME: we don't want to do all this for every polygon!
// TODO: store once at start of frame // TODO: store once at start of frame
currententity = s->entity; // FIXME: make this passed in currententity = s->entity; // FIXME: make this passed in
// // to R_RotateBmodel ()
//
// to
// R_RotateBmodel ()
VectorSubtract (r_origin, currententity->origin, VectorSubtract (r_origin, currententity->origin,
local_modelorg); local_modelorg);
TransformVector (local_modelorg, transformed_modelorg); TransformVector (local_modelorg, transformed_modelorg);
R_RotateBmodel (); // FIXME: don't mess with the R_RotateBmodel (); // FIXME: don't mess with the
// frustum, // frustum, make entity passed in
// make entity passed in
} }
pface = s->data; pface = s->data;
@ -315,11 +277,10 @@ D_DrawSurfaces (void)
D_DrawZSpans (s->spans); D_DrawZSpans (s->spans);
if (s->insubmodel) { if (s->insubmodel) {
//
// restore the old drawing state // restore the old drawing state
// FIXME: we don't want to do this every time! // FIXME: we don't want to do this every time!
// TODO: speed up // TODO: speed up
//
currententity = &cl_entities[0]; currententity = &cl_entities[0];
VectorCopy (world_transformed_modelorg, VectorCopy (world_transformed_modelorg,
transformed_modelorg); transformed_modelorg);

View file

@ -33,9 +33,6 @@
#include "d_iface.h" #include "d_iface.h"
/*
D_FillRect
*/
void void
D_FillRect (vrect_t *rect, int color) D_FillRect (vrect_t *rect, int color)
{ {

View file

@ -43,11 +43,7 @@ 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]; short *zspantable[MAXHEIGHT];
/*
================
D_Patch
================
*/
void void
D_Patch (void) D_Patch (void)
{ {
@ -65,11 +61,6 @@ D_Patch (void)
} }
/*
================
D_ViewChanged
================
*/
void void
D_ViewChanged (void) D_ViewChanged (void)
{ {

View file

@ -48,7 +48,6 @@ D_StartParticles (void)
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
void void
D_DrawParticle (particle_t *pparticle) D_DrawParticle (particle_t *pparticle)
{ {
@ -93,7 +92,6 @@ D_DrawParticle (particle_t *pparticle)
switch (pix) { switch (pix) {
case 1: case 1:
count = 1 << d_y_aspect_shift; count = 1 << d_y_aspect_shift;
for (; count; count--, pz += d_zwidth, pdest += screenwidth) { for (; count; count--, pz += d_zwidth, pdest += screenwidth) {
if (pz[0] <= izi) { if (pz[0] <= izi) {
pz[0] = izi; pz[0] = izi;
@ -104,7 +102,6 @@ D_DrawParticle (particle_t *pparticle)
case 2: case 2:
count = 2 << d_y_aspect_shift; count = 2 << d_y_aspect_shift;
for (; count; count--, pz += d_zwidth, pdest += screenwidth) { for (; count; count--, pz += d_zwidth, pdest += screenwidth) {
if (pz[0] <= izi) { if (pz[0] <= izi) {
pz[0] = izi; pz[0] = izi;
@ -120,7 +117,6 @@ D_DrawParticle (particle_t *pparticle)
case 3: case 3:
count = 3 << d_y_aspect_shift; count = 3 << d_y_aspect_shift;
for (; count; count--, pz += d_zwidth, pdest += screenwidth) { for (; count; count--, pz += d_zwidth, pdest += screenwidth) {
if (pz[0] <= izi) { if (pz[0] <= izi) {
pz[0] = izi; pz[0] = izi;
@ -141,7 +137,6 @@ D_DrawParticle (particle_t *pparticle)
case 4: case 4:
count = 4 << d_y_aspect_shift; count = 4 << d_y_aspect_shift;
for (; count; count--, pz += d_zwidth, pdest += screenwidth) { for (; count; count--, pz += d_zwidth, pdest += screenwidth) {
if (pz[0] <= izi) { if (pz[0] <= izi) {
pz[0] = izi; pz[0] = izi;
@ -167,7 +162,6 @@ D_DrawParticle (particle_t *pparticle)
default: default:
count = pix << d_y_aspect_shift; count = pix << d_y_aspect_shift;
for (; count; count--, pz += d_zwidth, pdest += screenwidth) { for (; count; count--, pz += d_zwidth, pdest += screenwidth) {
for (i = 0; i < pix; i++) { for (i = 0; i < pix; i++) {
if (pz[i] <= izi) { if (pz[i] <= izi) {
@ -179,5 +173,4 @@ D_DrawParticle (particle_t *pparticle)
break; break;
} }
} }
#endif // !USE_INTEL_ASM #endif // !USE_INTEL_ASM

View file

@ -126,11 +126,6 @@ void D_PolysetScanLeftEdge (int height);
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
/*
================
D_PolysetDraw
================
*/
void void
D_PolysetDraw (void) D_PolysetDraw (void)
{ {
@ -150,11 +145,6 @@ D_PolysetDraw (void)
} }
/*
================
D_PolysetDrawFinalVerts
================
*/
void void
D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts) D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts)
{ {
@ -181,11 +171,6 @@ D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts)
} }
/*
================
D_DrawSubdiv
================
*/
void void
D_DrawSubdiv (void) D_DrawSubdiv (void)
{ {
@ -238,11 +223,6 @@ D_DrawSubdiv (void)
} }
/*
================
D_DrawNonSubdiv
================
*/
void void
D_DrawNonSubdiv (void) D_DrawNonSubdiv (void)
{ {
@ -304,11 +284,6 @@ D_DrawNonSubdiv (void)
} }
/*
================
D_PolysetRecursiveTriangle
================
*/
void void
D_PolysetRecursiveTriangle (int *lp1, int *lp2, int *lp3) D_PolysetRecursiveTriangle (int *lp1, int *lp2, int *lp3)
{ {
@ -348,6 +323,7 @@ D_PolysetRecursiveTriangle (int *lp1, int *lp2, int *lp3)
return; // entire tri is filled return; // entire tri is filled
split2: split2:
temp = lp1; temp = lp1;
lp1 = lp2; lp1 = lp2;
@ -368,7 +344,6 @@ D_PolysetRecursiveTriangle (int *lp1, int *lp2, int *lp3)
if ((lp2[1] == lp1[1]) && (lp2[0] < lp1[0])) if ((lp2[1] == lp1[1]) && (lp2[0] < lp1[0]))
goto nodraw; goto nodraw;
z = new[5] >> 16; z = new[5] >> 16;
zbuf = zspantable[new[1]] + new[0]; zbuf = zspantable[new[1]] + new[0];
if (z >= *zbuf) { if (z >= *zbuf) {
@ -388,11 +363,6 @@ D_PolysetRecursiveTriangle (int *lp1, int *lp2, int *lp3)
#endif // !USE_INTEL_ASM #endif // !USE_INTEL_ASM
/*
================
D_PolysetUpdateTables
================
*/
void void
D_PolysetUpdateTables (void) D_PolysetUpdateTables (void)
{ {
@ -411,12 +381,6 @@ D_PolysetUpdateTables (void)
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
/*
===================
D_PolysetScanLeftEdge
====================
*/
void void
D_PolysetScanLeftEdge (int height) D_PolysetScanLeftEdge (int height)
{ {
@ -472,15 +436,9 @@ D_PolysetScanLeftEdge (int height)
} }
} while (--height); } while (--height);
} }
#endif // USE_INTEL_ASM #endif // USE_INTEL_ASM
/*
===================
D_PolysetSetUpForLineScan
====================
*/
void void
D_PolysetSetUpForLineScan (fixed8_t startvertu, fixed8_t startvertv, D_PolysetSetUpForLineScan (fixed8_t startvertu, fixed8_t startvertv,
fixed8_t endvertu, fixed8_t endvertv) fixed8_t endvertu, fixed8_t endvertv)
@ -513,12 +471,6 @@ D_PolysetSetUpForLineScan (fixed8_t startvertu, fixed8_t startvertv,
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
/*
================
D_PolysetCalcGradients
================
*/
void void
D_PolysetCalcGradients (int skinwidth) D_PolysetCalcGradients (int skinwidth)
{ {
@ -535,8 +487,8 @@ D_PolysetCalcGradients (int skinwidth)
ystepdenominv = -xstepdenominv; ystepdenominv = -xstepdenominv;
// ceil () for light so positive steps are exaggerated, negative steps // ceil () for light so positive steps are exaggerated, negative steps
// diminished, pushing us away from underflow toward overflow. Underflow is // diminished, pushing us away from underflow toward overflow. Underflow
// very visible, overflow is very unlikely, because of ambient lighting // is very visible, overflow is very unlikely, because of ambient lighting
t0 = r_p0[4] - r_p2[4]; t0 = r_p0[4] - r_p2[4];
t1 = r_p1[4] - r_p2[4]; t1 = r_p1[4] - r_p2[4];
r_lstepx = (int) r_lstepx = (int)
@ -575,7 +527,6 @@ D_PolysetCalcGradients (int skinwidth)
a_ststepxwhole = skinwidth * (r_tstepx >> 16) + (r_sstepx >> 16); a_ststepxwhole = skinwidth * (r_tstepx >> 16) + (r_sstepx >> 16);
} }
#endif // USE_INTEL_ASM #endif // USE_INTEL_ASM
@ -589,8 +540,7 @@ InitGel (byte * palette)
for (i = 0; i < 256; i++) { for (i = 0; i < 256; i++) {
// r = (palette[i*3]>>4); // r = (palette[i*3]>>4);
r = r = (palette[i * 3] + palette[i * 3 + 1] +
(palette[i * 3] + palette[i * 3 + 1] +
palette[i * 3 + 2]) / (16 * 3); palette[i * 3 + 2]) / (16 * 3);
gelmap[i] = /* 64 */ 0 + r; gelmap[i] = /* 64 */ 0 + r;
} }
@ -599,12 +549,6 @@ InitGel (byte * palette)
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
/*
================
D_PolysetDrawSpans8
================
*/
void void
D_PolysetDrawSpans8 (spanpackage_t * pspanpackage) D_PolysetDrawSpans8 (spanpackage_t * pspanpackage)
{ {
@ -664,11 +608,6 @@ D_PolysetDrawSpans8 (spanpackage_t * pspanpackage)
#endif // USE_INTEL_ASM #endif // USE_INTEL_ASM
/*
================
D_PolysetFillSpans8
================
*/
void void
D_PolysetFillSpans8 (spanpackage_t * pspanpackage) D_PolysetFillSpans8 (spanpackage_t * pspanpackage)
{ {
@ -699,11 +638,7 @@ D_PolysetFillSpans8 (spanpackage_t * pspanpackage)
} }
} }
/*
================
D_RasterizeAliasPolySmooth
================
*/
void void
D_RasterizeAliasPolySmooth (void) D_RasterizeAliasPolySmooth (void)
{ {
@ -720,19 +655,13 @@ D_RasterizeAliasPolySmooth (void)
initialleftheight = pleftbottom[1] - plefttop[1]; initialleftheight = pleftbottom[1] - plefttop[1];
initialrightheight = prightbottom[1] - prighttop[1]; initialrightheight = prightbottom[1] - prighttop[1];
// // set the s, t, and light gradients, which are consistent across the
// set the s, t, and light gradients, which are consistent across the triangle // triangle because being a triangle, things are affine
// because being a triangle, things are affine
//
D_PolysetCalcGradients (r_affinetridesc.skinwidth); D_PolysetCalcGradients (r_affinetridesc.skinwidth);
//
// rasterize the polygon // rasterize the polygon
//
//
// scan out the top (and possibly only) part of the left edge // scan out the top (and possibly only) part of the left edge
//
d_pedgespanpackage = a_spans; d_pedgespanpackage = a_spans;
ystart = plefttop[1]; ystart = plefttop[1];
@ -785,10 +714,8 @@ D_RasterizeAliasPolySmooth (void)
// TODO: can reuse partial expressions here // TODO: can reuse partial expressions here
// for negative steps in x along left edge, bias toward overflow // for negative steps in x along left edge, bias toward overflow
// rather than // rather than underflow (sort of turning the floor () we did in the
// underflow (sort of turning the floor () we did in the gradient // gradient calcs into ceil (), but plus a little bit)
// calcs into
// ceil (), but plus a little bit)
if (ubasestep < 0) if (ubasestep < 0)
working_lstepx = r_lstepx - 1; working_lstepx = r_lstepx - 1;
else else
@ -824,9 +751,7 @@ D_RasterizeAliasPolySmooth (void)
D_PolysetScanLeftEdge (initialleftheight); D_PolysetScanLeftEdge (initialleftheight);
} }
//
// scan out the bottom part of the left edge, if it exists // scan out the bottom part of the left edge, if it exists
//
if (pedgetable->numleftedges == 2) { if (pedgetable->numleftedges == 2) {
int height; int height;
@ -917,8 +842,8 @@ D_RasterizeAliasPolySmooth (void)
D_PolysetScanLeftEdge (height); D_PolysetScanLeftEdge (height);
} }
} }
// scan out the top (and possibly only) part of the right edge, updating the // scan out the top (and possibly only) part of the right edge, updating
// count field // the count field
d_pedgespanpackage = a_spans; d_pedgespanpackage = a_spans;
D_PolysetSetUpForLineScan (prighttop[0], prighttop[1], D_PolysetSetUpForLineScan (prighttop[0], prighttop[1],
@ -956,11 +881,6 @@ D_RasterizeAliasPolySmooth (void)
} }
/*
================
D_PolysetSetEdgeTable
================
*/
void void
D_PolysetSetEdgeTable (void) D_PolysetSetEdgeTable (void)
{ {
@ -969,10 +889,8 @@ D_PolysetSetEdgeTable (void)
edgetableindex = 0; // assume the vertices are already in edgetableindex = 0; // assume the vertices are already in
// top to bottom order // top to bottom order
// // determine which edges are right & left, and the order in which to
// determine which edges are right & left, and the order in which // rasterize them
// to rasterize them
//
if (r_p0[1] >= r_p1[1]) { if (r_p0[1] >= r_p1[1]) {
if (r_p0[1] == r_p1[1]) { if (r_p0[1] == r_p1[1]) {
if (r_p0[1] < r_p2[1]) if (r_p0[1] < r_p2[1])
@ -1054,6 +972,7 @@ D_PolysetRecursiveDrawLine (int *lp1, int *lp2)
D_PolysetRecursiveDrawLine (new, lp2); D_PolysetRecursiveDrawLine (new, lp2);
} }
void void
D_PolysetRecursiveTriangle2 (int *lp1, int *lp2, int *lp3) D_PolysetRecursiveTriangle2 (int *lp1, int *lp2, int *lp3)
{ {

View file

@ -44,12 +44,10 @@ void D_DrawTurbulent8Span (void);
/* /*
=============
D_WarpScreen D_WarpScreen
// this performs a slight compression of the screen at the same time as this performs a slight compression of the screen at the same time as
// the sine warp, to keep the edges from wrapping the sine warp, to keep the edges from wrapping
=============
*/ */
void void
D_WarpScreen (void) D_WarpScreen (void)
@ -98,12 +96,6 @@ D_WarpScreen (void)
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
/*
=============
D_DrawTurbulent8Span
=============
*/
void void
D_DrawTurbulent8Span (void) D_DrawTurbulent8Span (void)
{ {
@ -121,15 +113,9 @@ D_DrawTurbulent8Span (void)
r_turb_t += r_turb_tstep; r_turb_t += r_turb_tstep;
} while (--r_turb_spancount > 0); } while (--r_turb_spancount > 0);
} }
#endif // USE_INTEL_ASM #endif // USE_INTEL_ASM
/*
=============
Turbulent8
=============
*/
void void
Turbulent8 (espan_t *pspan) Turbulent8 (espan_t *pspan)
{ {
@ -197,10 +183,9 @@ Turbulent8 (espan_t *pspan)
if (snext > bbextents) if (snext > bbextents)
snext = bbextents; snext = bbextents;
else if (snext < 16) else if (snext < 16)
snext = 16; // prevent round-off error on <0 snext = 16; // prevent round-off error on <0 steps
// steps from // from from causing overstepping &
// from causing overstepping & running off the // running off the edge of the texture
// edge of the texture
tnext = (int) (tdivz * z) + tadjust; tnext = (int) (tdivz * z) + tadjust;
if (tnext > bbextentt) if (tnext > bbextentt)
@ -212,13 +197,10 @@ Turbulent8 (espan_t *pspan)
r_turb_sstep = (snext - r_turb_s) >> 4; r_turb_sstep = (snext - r_turb_s) >> 4;
r_turb_tstep = (tnext - r_turb_t) >> 4; r_turb_tstep = (tnext - r_turb_t) >> 4;
} else { } else {
// calculate s/z, t/z, zi->fixed s and t at last pixel in // calculate s/z, t/z, zi->fixed s and t at last pixel in span
// span (so // (so can't step off polygon), clamp, calculate s and t steps
// can't step off polygon), clamp, calculate s and t steps // across span by division, biasing steps low so we don't run
// across // off the texture
// span by division, biasing steps low so we don't run off
// the
// texture
spancountminus1 = (float) (r_turb_spancount - 1); spancountminus1 = (float) (r_turb_spancount - 1);
sdivz += d_sdivzstepu * spancountminus1; sdivz += d_sdivzstepu * spancountminus1;
tdivz += d_tdivzstepu * spancountminus1; tdivz += d_tdivzstepu * spancountminus1;
@ -228,10 +210,9 @@ Turbulent8 (espan_t *pspan)
if (snext > bbextents) if (snext > bbextents)
snext = bbextents; snext = bbextents;
else if (snext < 16) else if (snext < 16)
snext = 16; // prevent round-off error on <0 snext = 16; // prevent round-off error on <0 steps
// steps from // from causing overstepping & running
// from causing overstepping & running off the // off the edge of the texture
// edge of the texture
tnext = (int) (tdivz * z) + tadjust; tnext = (int) (tdivz * z) + tadjust;
if (tnext > bbextentt) if (tnext > bbextentt)
@ -261,12 +242,6 @@ Turbulent8 (espan_t *pspan)
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
/*
=============
D_DrawSpans8
=============
*/
void void
D_DrawSpans8 (espan_t *pspan) D_DrawSpans8 (espan_t *pspan)
{ {
@ -333,10 +308,9 @@ D_DrawSpans8 (espan_t *pspan)
if (snext > bbextents) if (snext > bbextents)
snext = bbextents; snext = bbextents;
else if (snext < 8) else if (snext < 8)
snext = 8; // prevent round-off error on <0 snext = 8; // prevent round-off error on <0 steps
// steps from // from causing overstepping & running
// from causing overstepping & running off the // off the edge of the texture
// edge of the texture
tnext = (int) (tdivz * z) + tadjust; tnext = (int) (tdivz * z) + tadjust;
if (tnext > bbextentt) if (tnext > bbextentt)
@ -348,13 +322,10 @@ D_DrawSpans8 (espan_t *pspan)
sstep = (snext - s) >> 3; sstep = (snext - s) >> 3;
tstep = (tnext - t) >> 3; tstep = (tnext - t) >> 3;
} else { } else {
// calculate s/z, t/z, zi->fixed s and t at last pixel in // calculate s/z, t/z, zi->fixed s and t at last pixel in span
// span (so // (so can't step off polygon), clamp, calculate s and t steps
// can't step off polygon), clamp, calculate s and t steps // across span by division, biasing steps low so we don't run
// across // off the texture
// span by division, biasing steps low so we don't run off
// the
// texture
spancountminus1 = (float) (spancount - 1); spancountminus1 = (float) (spancount - 1);
sdivz += d_sdivzstepu * spancountminus1; sdivz += d_sdivzstepu * spancountminus1;
tdivz += d_tdivzstepu * spancountminus1; tdivz += d_tdivzstepu * spancountminus1;
@ -364,10 +335,9 @@ D_DrawSpans8 (espan_t *pspan)
if (snext > bbextents) if (snext > bbextents)
snext = bbextents; snext = bbextents;
else if (snext < 8) else if (snext < 8)
snext = 8; // prevent round-off error on <0 snext = 8; // prevent round-off error on <0 steps
// steps from // from causing overstepping & running
// from causing overstepping & running off the // off the edge of the texture
// edge of the texture
tnext = (int) (tdivz * z) + tadjust; tnext = (int) (tdivz * z) + tadjust;
if (tnext > bbextentt) if (tnext > bbextentt)
@ -395,17 +365,10 @@ D_DrawSpans8 (espan_t *pspan)
} while ((pspan = pspan->pnext) != NULL); } while ((pspan = pspan->pnext) != NULL);
} }
#endif #endif
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
/*
=============
D_DrawZSpans
=============
*/
void void
D_DrawZSpans (espan_t *pspan) D_DrawZSpans (espan_t *pspan)
{ {
@ -455,5 +418,4 @@ D_DrawZSpans (espan_t *pspan)
} while ((pspan = pspan->pnext) != NULL); } while ((pspan = pspan->pnext) != NULL);
} }
#endif #endif

View file

@ -38,9 +38,6 @@
#define SKY_SPAN_MAX (1 << SKY_SPAN_SHIFT) #define SKY_SPAN_MAX (1 << SKY_SPAN_SHIFT)
/*
D_Sky_uv_To_st
*/
void void
D_Sky_uv_To_st (int u, int v, fixed16_t *s, fixed16_t *t) D_Sky_uv_To_st (int u, int v, fixed16_t *s, fixed16_t *t)
{ {
@ -68,9 +65,6 @@ D_Sky_uv_To_st (int u, int v, fixed16_t *s, fixed16_t *t)
} }
/*
D_DrawSkyScans8
*/
void void
D_DrawSkyScans8 (espan_t *pspan) D_DrawSkyScans8 (espan_t *pspan)
{ {

View file

@ -37,13 +37,8 @@ static int sprite_height;
static int minindex, maxindex; static int minindex, maxindex;
static sspan_t *sprite_spans; static sspan_t *sprite_spans;
#ifndef USE_INTEL_ASM
/* #ifndef USE_INTEL_ASM
=====================
D_SpriteDrawSpans
=====================
*/
void void
D_SpriteDrawSpans (sspan_t *pspan) D_SpriteDrawSpans (sspan_t *pspan)
{ {
@ -121,10 +116,9 @@ D_SpriteDrawSpans (sspan_t *pspan)
if (snext > bbextents) if (snext > bbextents)
snext = bbextents; snext = bbextents;
else if (snext < 8) else if (snext < 8)
snext = 8; // prevent round-off error on <0 snext = 8; // prevent round-off error on <0 steps
// steps from // from causing overstepping & running
// from causing overstepping & running off the // off the edge of the texture
// edge of the texture
tnext = (int) (tdivz * z) + tadjust; tnext = (int) (tdivz * z) + tadjust;
if (tnext > bbextentt) if (tnext > bbextentt)
@ -136,13 +130,10 @@ D_SpriteDrawSpans (sspan_t *pspan)
sstep = (snext - s) >> 3; sstep = (snext - s) >> 3;
tstep = (tnext - t) >> 3; tstep = (tnext - t) >> 3;
} else { } else {
// calculate s/z, t/z, zi->fixed s and t at last pixel in // calculate s/z, t/z, zi->fixed s and t at last pixel in span
// span (so // (so can't step off polygon), clamp, calculate s and t steps
// can't step off polygon), clamp, calculate s and t steps // across span by division, biasing steps low so we don't run
// across // off the texture
// span by division, biasing steps low so we don't run off
// the
// texture
spancountminus1 = (float) (spancount - 1); spancountminus1 = (float) (spancount - 1);
sdivz += d_sdivzstepu * spancountminus1; sdivz += d_sdivzstepu * spancountminus1;
tdivz += d_tdivzstepu * spancountminus1; tdivz += d_tdivzstepu * spancountminus1;
@ -152,10 +143,9 @@ D_SpriteDrawSpans (sspan_t *pspan)
if (snext > bbextents) if (snext > bbextents)
snext = bbextents; snext = bbextents;
else if (snext < 8) else if (snext < 8)
snext = 8; // prevent round-off error on <0 snext = 8; // prevent round-off error on <0 steps
// steps from // from causing overstepping & running
// from causing overstepping & running off the // off the edge of the texture
// edge of the texture
tnext = (int) (tdivz * z) + tadjust; tnext = (int) (tdivz * z) + tadjust;
if (tnext > bbextentt) if (tnext > bbextentt)
@ -196,15 +186,9 @@ D_SpriteDrawSpans (sspan_t *pspan)
} while (pspan->count != DS_SPAN_LIST_END); } while (pspan->count != DS_SPAN_LIST_END);
} }
#endif #endif
/*
=====================
D_SpriteScanLeftEdge
=====================
*/
void void
D_SpriteScanLeftEdge (void) D_SpriteScanLeftEdge (void)
{ {
@ -260,11 +244,6 @@ D_SpriteScanLeftEdge (void)
} }
/*
=====================
D_SpriteScanRightEdge
=====================
*/
void void
D_SpriteScanRightEdge (void) D_SpriteScanRightEdge (void)
{ {
@ -340,11 +319,6 @@ D_SpriteScanRightEdge (void)
} }
/*
=====================
D_SpriteCalculateGradients
=====================
*/
void void
D_SpriteCalculateGradients (void) D_SpriteCalculateGradients (void)
{ {
@ -387,11 +361,6 @@ D_SpriteCalculateGradients (void)
} }
/*
=====================
D_DrawSprite
=====================
*/
void void
D_DrawSprite (void) D_DrawSprite (void)
{ {
@ -402,8 +371,8 @@ D_DrawSprite (void)
sprite_spans = spans; sprite_spans = spans;
// find the top and bottom vertices, and make sure there's at least one scan to // find the top and bottom vertices, and make sure there's at least one
// draw // scan to draw
ymin = 999999.9; ymin = 999999.9;
ymax = -999999.9; ymax = -999999.9;
pverts = r_spritedesc.pverts; pverts = r_spritedesc.pverts;

View file

@ -50,6 +50,7 @@ surfcache_t *sc_rover, *sc_base;
#define GUARDSIZE 4 #define GUARDSIZE 4
void * void *
D_SurfaceCacheAddress (void) D_SurfaceCacheAddress (void)
{ {
@ -73,10 +74,10 @@ D_SurfaceCacheForRes (int width, int height)
if (pix > 64000) if (pix > 64000)
size += (pix - 64000) * 3; size += (pix - 64000) * 3;
return size; return size;
} }
void void
D_CheckCacheGuard (void) D_CheckCacheGuard (void)
{ {
@ -89,6 +90,7 @@ D_CheckCacheGuard (void)
Sys_Error ("D_CheckCacheGuard: failed"); Sys_Error ("D_CheckCacheGuard: failed");
} }
void void
D_ClearCacheGuard (void) D_ClearCacheGuard (void)
{ {
@ -101,12 +103,6 @@ D_ClearCacheGuard (void)
} }
/*
================
D_InitCaches
================
*/
void void
D_InitCaches (void *buffer, int size) D_InitCaches (void *buffer, int size)
{ {
@ -128,11 +124,6 @@ D_InitCaches (void *buffer, int size)
} }
/*
==================
D_FlushCaches
==================
*/
void void
D_FlushCaches (void) D_FlushCaches (void)
{ {
@ -152,11 +143,7 @@ D_FlushCaches (void)
sc_base->size = sc_size; sc_base->size = sc_size;
} }
/*
=================
D_SCAlloc
=================
*/
surfcache_t * surfcache_t *
D_SCAlloc (int width, int size) D_SCAlloc (int width, int size)
{ {
@ -217,8 +204,7 @@ D_SCAlloc (int width, int size)
if (width > 0) if (width > 0)
new->height = (size - sizeof (*new) + sizeof (new->data)) / width; new->height = (size - sizeof (*new) + sizeof (new->data)) / width;
new->owner = NULL; // should be set properly after new->owner = NULL; // should be set properly after return
// return
if (d_roverwrapped) { if (d_roverwrapped) {
if (wrapped_this_time || (sc_rover >= d_initial_rover)) if (wrapped_this_time || (sc_rover >= d_initial_rover))
@ -232,11 +218,6 @@ D_SCAlloc (int width, int size)
} }
/*
=================
D_SCDump
=================
*/
void void
D_SCDump (void) D_SCDump (void)
{ {
@ -249,10 +230,8 @@ D_SCDump (void)
} }
} }
//=============================================================================
// if the num is not a power of 2, assume it will not repeat // if the num is not a power of 2, assume it will not repeat
int int
MaskForNum (int num) MaskForNum (int num)
{ {
@ -267,6 +246,7 @@ MaskForNum (int num)
return 255; return 255;
} }
int int
D_log2 (int num) D_log2 (int num)
{ {
@ -279,30 +259,20 @@ D_log2 (int num)
return c; return c;
} }
//=============================================================================
/*
================
D_CacheSurface
================
*/
surfcache_t * surfcache_t *
D_CacheSurface (msurface_t *surface, int miplevel) D_CacheSurface (msurface_t *surface, int miplevel)
{ {
surfcache_t *cache; surfcache_t *cache;
//
// if the surface is animating or flashing, flush the cache // if the surface is animating or flashing, flush the cache
//
r_drawsurf.texture = R_TextureAnimation (surface->texinfo->texture); r_drawsurf.texture = R_TextureAnimation (surface->texinfo->texture);
r_drawsurf.lightadj[0] = d_lightstylevalue[surface->styles[0]]; r_drawsurf.lightadj[0] = d_lightstylevalue[surface->styles[0]];
r_drawsurf.lightadj[1] = d_lightstylevalue[surface->styles[1]]; r_drawsurf.lightadj[1] = d_lightstylevalue[surface->styles[1]];
r_drawsurf.lightadj[2] = d_lightstylevalue[surface->styles[2]]; r_drawsurf.lightadj[2] = d_lightstylevalue[surface->styles[2]];
r_drawsurf.lightadj[3] = d_lightstylevalue[surface->styles[3]]; r_drawsurf.lightadj[3] = d_lightstylevalue[surface->styles[3]];
//
// see if the cache holds apropriate data // see if the cache holds apropriate data
//
cache = surface->cachespots[miplevel]; cache = surface->cachespots[miplevel];
if (cache && !cache->dlight && surface->dlightframe != r_framecount if (cache && !cache->dlight && surface->dlightframe != r_framecount
@ -313,18 +283,14 @@ D_CacheSurface (msurface_t *surface, int miplevel)
&& cache->lightadj[3] == r_drawsurf.lightadj[3]) && cache->lightadj[3] == r_drawsurf.lightadj[3])
return cache; return cache;
//
// determine shape of surface // determine shape of surface
//
surfscale = 1.0 / (1 << miplevel); surfscale = 1.0 / (1 << miplevel);
r_drawsurf.surfmip = miplevel; r_drawsurf.surfmip = miplevel;
r_drawsurf.surfwidth = surface->extents[0] >> miplevel; r_drawsurf.surfwidth = surface->extents[0] >> miplevel;
r_drawsurf.rowbytes = r_drawsurf.surfwidth; r_drawsurf.rowbytes = r_drawsurf.surfwidth;
r_drawsurf.surfheight = surface->extents[1] >> miplevel; r_drawsurf.surfheight = surface->extents[1] >> miplevel;
//
// allocate memory if needed // allocate memory if needed
//
if (!cache) // if a texture just animated, don't if (!cache) // if a texture just animated, don't
// reallocate it // reallocate it
{ {
@ -348,9 +314,7 @@ D_CacheSurface (msurface_t *surface, int miplevel)
cache->lightadj[2] = r_drawsurf.lightadj[2]; cache->lightadj[2] = r_drawsurf.lightadj[2];
cache->lightadj[3] = r_drawsurf.lightadj[3]; cache->lightadj[3] = r_drawsurf.lightadj[3];
//
// draw and light the surface texture // draw and light the surface texture
//
r_drawsurf.surf = surface; r_drawsurf.surf = surface;
c_surf++; c_surf++;

View file

@ -37,9 +37,7 @@
// all global and static refresh variables are collected in a contiguous block // all global and static refresh variables are collected in a contiguous block
// to avoid cache conflicts. // to avoid cache conflicts.
//------------------------------------------------------- // global refresh variables ----------------------------
// global refresh variables
//-------------------------------------------------------
// FIXME: make into one big structure, like cl or sv // FIXME: make into one big structure, like cl or sv
// FIXME: do separately for refresh engine and driver // FIXME: do separately for refresh engine and driver

View file

@ -33,11 +33,6 @@
#include "d_local.h" #include "d_local.h"
/*
=====================
D_DrawZPoint
=====================
*/
void void
D_DrawZPoint (void) D_DrawZPoint (void)
{ {

View file

@ -43,9 +43,7 @@ int vstartscan;
vec3_t transformed_modelorg; vec3_t transformed_modelorg;
/*
D_DrawPoly
*/
void void
D_DrawPoly (void) D_DrawPoly (void)
{ {
@ -53,9 +51,6 @@ D_DrawPoly (void)
} }
/*
D_MipLevelForScale
*/
int int
D_MipLevelForScale (float scale) D_MipLevelForScale (float scale)
{ {
@ -77,12 +72,7 @@ D_MipLevelForScale (float scale)
} }
/*
D_DrawSolidSurface
*/
// FIXME: clean this up // FIXME: clean this up
void void
D_DrawSolidSurface (surf_t *surf, int color) D_DrawSolidSurface (surf_t *surf, int color)
{ {
@ -115,9 +105,6 @@ D_DrawSolidSurface (surf_t *surf, int color)
} }
/*
D_CalcGradients
*/
void void
D_CalcGradients (msurface_t *pface) D_CalcGradients (msurface_t *pface)
{ {
@ -157,17 +144,12 @@ D_CalcGradients (msurface_t *pface)
((pface->texturemins[1] << 16) >> miplevel) ((pface->texturemins[1] << 16) >> miplevel)
+ pface->texinfo->vecs[1][3] * t; + pface->texinfo->vecs[1][3] * t;
//
// -1 (-epsilon) so we never wander off the edge of the texture // -1 (-epsilon) so we never wander off the edge of the texture
//
bbextents = ((pface->extents[0] << 16) >> miplevel) - 1; bbextents = ((pface->extents[0] << 16) >> miplevel) - 1;
bbextentt = ((pface->extents[1] << 16) >> miplevel) - 1; bbextentt = ((pface->extents[1] << 16) >> miplevel) - 1;
} }
/*
D_DrawSurfaces
*/
void void
D_DrawSurfaces (void) D_DrawSurfaces (void)
{ {
@ -234,15 +216,13 @@ D_DrawSurfaces (void)
// FIXME: we don't want to do all this for every polygon! // FIXME: we don't want to do all this for every polygon!
// TODO: store once at start of frame // TODO: store once at start of frame
currententity = s->entity; // FIXME: make this passed in currententity = s->entity; // FIXME: make this passed in
// to // to R_RotateBmodel ()
// R_RotateBmodel ()
VectorSubtract (r_origin, currententity->origin, VectorSubtract (r_origin, currententity->origin,
local_modelorg); local_modelorg);
TransformVector (local_modelorg, transformed_modelorg); TransformVector (local_modelorg, transformed_modelorg);
R_RotateBmodel (); // FIXME: don't mess with the R_RotateBmodel (); // FIXME: don't mess with the
// frustum, // frustum, make entity passed in
// make entity passed in
} }
D_CalcGradients (pface); D_CalcGradients (pface);
@ -251,11 +231,10 @@ D_DrawSurfaces (void)
D_DrawZSpans (s->spans); D_DrawZSpans (s->spans);
if (s->insubmodel) { if (s->insubmodel) {
//
// restore the old drawing state // restore the old drawing state
// FIXME: we don't want to do this every time! // FIXME: we don't want to do this every time!
// TODO: speed up // TODO: speed up
//
currententity = &r_worldentity; currententity = &r_worldentity;
VectorCopy (world_transformed_modelorg, VectorCopy (world_transformed_modelorg,
transformed_modelorg); transformed_modelorg);
@ -270,15 +249,13 @@ D_DrawSurfaces (void)
// FIXME: we don't want to do all this for every polygon! // FIXME: we don't want to do all this for every polygon!
// TODO: store once at start of frame // TODO: store once at start of frame
currententity = s->entity; // FIXME: make this passed in currententity = s->entity; // FIXME: make this passed in
// to // to R_RotateBmodel ()
// R_RotateBmodel ()
VectorSubtract (r_origin, currententity->origin, VectorSubtract (r_origin, currententity->origin,
local_modelorg); local_modelorg);
TransformVector (local_modelorg, transformed_modelorg); TransformVector (local_modelorg, transformed_modelorg);
R_RotateBmodel (); // FIXME: don't mess with the R_RotateBmodel (); // FIXME: don't mess with the
// frustum, // frustum, make entity passed in
// make entity passed in
} }
pface = s->data; pface = s->data;
@ -298,11 +275,10 @@ D_DrawSurfaces (void)
D_DrawZSpans (s->spans); D_DrawZSpans (s->spans);
if (s->insubmodel) { if (s->insubmodel) {
//
// restore the old drawing state // restore the old drawing state
// FIXME: we don't want to do this every time! // FIXME: we don't want to do this every time!
// TODO: speed up // TODO: speed up
//
VectorCopy (world_transformed_modelorg, VectorCopy (world_transformed_modelorg,
transformed_modelorg); transformed_modelorg);
VectorCopy (base_vpn, vpn); VectorCopy (base_vpn, vpn);

View file

@ -33,9 +33,6 @@
#include "d_iface.h" #include "d_iface.h"
/*
D_FillRect
*/
void void
D_FillRect (vrect_t *rect, int color) D_FillRect (vrect_t *rect, int color)
{ {

View file

@ -53,9 +53,6 @@ extern int d_aflatcolor;
void (*d_drawspans) (espan_t *pspan); void (*d_drawspans) (espan_t *pspan);
/*
D_Init
*/
void void
D_Init (void) D_Init (void)
{ {
@ -74,9 +71,7 @@ D_Init (void)
VID_InitBuffers (); VID_InitBuffers ();
} }
/*
D_CopyRects
*/
void void
D_CopyRects (vrect_t *prects, int transparent) D_CopyRects (vrect_t *prects, int transparent)
{ {
@ -92,9 +87,6 @@ D_CopyRects (vrect_t *prects, int transparent)
} }
/*
D_EnableBackBufferAccess
*/
void void
D_EnableBackBufferAccess (void) D_EnableBackBufferAccess (void)
{ {
@ -103,9 +95,6 @@ D_EnableBackBufferAccess (void)
} }
/*
D_TurnZOn
*/
void void
D_TurnZOn (void) D_TurnZOn (void)
{ {
@ -113,9 +102,6 @@ D_TurnZOn (void)
} }
/*
D_DisableBackBufferAccess
*/
void void
D_DisableBackBufferAccess (void) D_DisableBackBufferAccess (void)
{ {
@ -123,9 +109,6 @@ D_DisableBackBufferAccess (void)
} }
/*
D_SetupFrame
*/
void void
D_SetupFrame (void) D_SetupFrame (void)
{ {
@ -162,14 +145,9 @@ D_SetupFrame (void)
} }
/*
D_UpdateRects
*/
void void
D_UpdateRects (vrect_t *prect) D_UpdateRects (vrect_t *prect)
{ {
// the software driver draws these directly to the vid buffer // the software driver draws these directly to the vid buffer
UNUSED (prect); UNUSED (prect);
} }

View file

@ -42,9 +42,7 @@ 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]; short *zspantable[MAXHEIGHT];
/*
D_Patch
*/
void void
D_Patch (void) D_Patch (void)
{ {
@ -62,9 +60,6 @@ D_Patch (void)
} }
/*
D_ViewChanged
*/
void void
D_ViewChanged (void) D_ViewChanged (void)
{ {

View file

@ -48,7 +48,6 @@ D_StartParticles (void)
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
void void
D_DrawParticle (particle_t *pparticle) D_DrawParticle (particle_t *pparticle)
{ {
@ -67,7 +66,6 @@ D_DrawParticle (particle_t *pparticle)
if (transformed[2] < PARTICLE_Z_CLIP) if (transformed[2] < PARTICLE_Z_CLIP)
return; return;
// project the point // project the point
// FIXME: preadjust xcenter and ycenter // FIXME: preadjust xcenter and ycenter
zi = 1.0 / transformed[2]; zi = 1.0 / transformed[2];
@ -93,7 +91,6 @@ D_DrawParticle (particle_t *pparticle)
switch (pix) { switch (pix) {
case 1: case 1:
count = 1 << d_y_aspect_shift; count = 1 << d_y_aspect_shift;
for (; count; count--, pz += d_zwidth, pdest += screenwidth) { for (; count; count--, pz += d_zwidth, pdest += screenwidth) {
if (pz[0] <= izi) { if (pz[0] <= izi) {
pz[0] = izi; pz[0] = izi;
@ -104,7 +101,6 @@ D_DrawParticle (particle_t *pparticle)
case 2: case 2:
count = 2 << d_y_aspect_shift; count = 2 << d_y_aspect_shift;
for (; count; count--, pz += d_zwidth, pdest += screenwidth) { for (; count; count--, pz += d_zwidth, pdest += screenwidth) {
if (pz[0] <= izi) { if (pz[0] <= izi) {
pz[0] = izi; pz[0] = izi;
@ -120,7 +116,6 @@ D_DrawParticle (particle_t *pparticle)
case 3: case 3:
count = 3 << d_y_aspect_shift; count = 3 << d_y_aspect_shift;
for (; count; count--, pz += d_zwidth, pdest += screenwidth) { for (; count; count--, pz += d_zwidth, pdest += screenwidth) {
if (pz[0] <= izi) { if (pz[0] <= izi) {
pz[0] = izi; pz[0] = izi;
@ -141,7 +136,6 @@ D_DrawParticle (particle_t *pparticle)
case 4: case 4:
count = 4 << d_y_aspect_shift; count = 4 << d_y_aspect_shift;
for (; count; count--, pz += d_zwidth, pdest += screenwidth) { for (; count; count--, pz += d_zwidth, pdest += screenwidth) {
if (pz[0] <= izi) { if (pz[0] <= izi) {
pz[0] = izi; pz[0] = izi;
@ -167,7 +161,6 @@ D_DrawParticle (particle_t *pparticle)
default: default:
count = pix << d_y_aspect_shift; count = pix << d_y_aspect_shift;
for (; count; count--, pz += d_zwidth, pdest += screenwidth) { for (; count; count--, pz += d_zwidth, pdest += screenwidth) {
for (i = 0; i < pix; i++) { for (i = 0; i < pix; i++) {
if (pz[i] <= izi) { if (pz[i] <= izi) {
@ -179,5 +172,4 @@ D_DrawParticle (particle_t *pparticle)
break; break;
} }
} }
#endif // !USE_INTEL_ASM #endif // !USE_INTEL_ASM

View file

@ -128,9 +128,6 @@ void D_PolysetScanLeftEdge (int height);
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
/*
D_PolysetDraw
*/
void void
D_PolysetDraw (void) D_PolysetDraw (void)
{ {
@ -150,9 +147,6 @@ D_PolysetDraw (void)
} }
/*
D_PolysetDrawFinalVerts
*/
void void
D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts) D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts)
{ {
@ -179,9 +173,6 @@ D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts)
} }
/*
D_DrawSubdiv
*/
void void
D_DrawSubdiv (void) D_DrawSubdiv (void)
{ {
@ -234,9 +225,6 @@ D_DrawSubdiv (void)
} }
/*
D_DrawNonSubdiv
*/
void void
D_DrawNonSubdiv (void) D_DrawNonSubdiv (void)
{ {
@ -298,9 +286,6 @@ D_DrawNonSubdiv (void)
} }
/*
D_PolysetRecursiveTriangle
*/
void void
D_PolysetRecursiveTriangle (int *lp1, int *lp2, int *lp3) D_PolysetRecursiveTriangle (int *lp1, int *lp2, int *lp3)
{ {
@ -380,9 +365,6 @@ D_PolysetRecursiveTriangle (int *lp1, int *lp2, int *lp3)
#endif // !USE_INTEL_ASM #endif // !USE_INTEL_ASM
/*
D_PolysetUpdateTables
*/
void void
D_PolysetUpdateTables (void) D_PolysetUpdateTables (void)
{ {
@ -401,10 +383,6 @@ D_PolysetUpdateTables (void)
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
/*
D_PolysetScanLeftEdge
*/
void void
D_PolysetScanLeftEdge (int height) D_PolysetScanLeftEdge (int height)
{ {
@ -460,13 +438,9 @@ D_PolysetScanLeftEdge (int height)
} }
} while (--height); } while (--height);
} }
#endif // !USE_INTEL_ASM #endif // !USE_INTEL_ASM
/*
D_PolysetSetUpForLineScan
*/
void void
D_PolysetSetUpForLineScan (fixed8_t startvertu, fixed8_t startvertv, D_PolysetSetUpForLineScan (fixed8_t startvertu, fixed8_t startvertv,
fixed8_t endvertu, fixed8_t endvertv) fixed8_t endvertu, fixed8_t endvertv)
@ -499,10 +473,6 @@ D_PolysetSetUpForLineScan (fixed8_t startvertu, fixed8_t startvertv,
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
/*
D_PolysetCalcGradients
*/
void void
D_PolysetCalcGradients (int skinwidth) D_PolysetCalcGradients (int skinwidth)
{ {
@ -559,11 +529,11 @@ D_PolysetCalcGradients (int skinwidth)
a_ststepxwhole = skinwidth * (r_tstepx >> 16) + (r_sstepx >> 16); a_ststepxwhole = skinwidth * (r_tstepx >> 16) + (r_sstepx >> 16);
} }
#endif // !USE_INTEL_ASM #endif // !USE_INTEL_ASM
byte gelmap[256]; byte gelmap[256];
void void
InitGel (byte * palette) InitGel (byte * palette)
{ {
@ -581,10 +551,6 @@ InitGel (byte * palette)
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
/*
D_PolysetDrawSpans8
*/
void void
D_PolysetDrawSpans8 (spanpackage_t * pspanpackage) D_PolysetDrawSpans8 (spanpackage_t * pspanpackage)
{ {
@ -644,9 +610,6 @@ D_PolysetDrawSpans8 (spanpackage_t * pspanpackage)
#endif // !USE_INTEL_ASM #endif // !USE_INTEL_ASM
/*
D_PolysetFillSpans8
*/
void void
D_PolysetFillSpans8 (spanpackage_t * pspanpackage) D_PolysetFillSpans8 (spanpackage_t * pspanpackage)
{ {
@ -677,9 +640,7 @@ D_PolysetFillSpans8 (spanpackage_t * pspanpackage)
} }
} }
/*
D_RasterizeAliasPolySmooth
*/
void void
D_RasterizeAliasPolySmooth (void) D_RasterizeAliasPolySmooth (void)
{ {
@ -696,19 +657,13 @@ D_RasterizeAliasPolySmooth (void)
initialleftheight = pleftbottom[1] - plefttop[1]; initialleftheight = pleftbottom[1] - plefttop[1];
initialrightheight = prightbottom[1] - prighttop[1]; initialrightheight = prightbottom[1] - prighttop[1];
// // set the s, t, and light gradients, which are consistent across the
// set the s, t, and light gradients, which are consistent across the triangle // triangle, because being a triangle, things are affine
// because being a triangle, things are affine
//
D_PolysetCalcGradients (r_affinetridesc.skinwidth); D_PolysetCalcGradients (r_affinetridesc.skinwidth);
//
// rasterize the polygon // rasterize the polygon
//
//
// scan out the top (and possibly only) part of the left edge // scan out the top (and possibly only) part of the left edge
//
D_PolysetSetUpForLineScan (plefttop[0], plefttop[1], D_PolysetSetUpForLineScan (plefttop[0], plefttop[1],
pleftbottom[0], pleftbottom[1]); pleftbottom[0], pleftbottom[1]);
@ -740,9 +695,9 @@ D_RasterizeAliasPolySmooth (void)
// TODO: can reuse partial expressions here // TODO: can reuse partial expressions here
// for negative steps in x along left edge, bias toward overflow rather than // for negative steps in x along left edge, bias toward overflow rather
// underflow (sort of turning the floor () we did in the gradient calcs into // than underflow (sort of turning the floor () we did in the gradient
// ceil (), but plus a little bit) // calcs into ceil (), but plus a little bit)
if (ubasestep < 0) if (ubasestep < 0)
working_lstepx = r_lstepx - 1; working_lstepx = r_lstepx - 1;
else else
@ -776,9 +731,7 @@ D_RasterizeAliasPolySmooth (void)
D_PolysetScanLeftEdge (initialleftheight); D_PolysetScanLeftEdge (initialleftheight);
//
// scan out the bottom part of the left edge, if it exists // scan out the bottom part of the left edge, if it exists
//
if (pedgetable->numleftedges == 2) { if (pedgetable->numleftedges == 2) {
int height; int height;
@ -849,8 +802,8 @@ D_RasterizeAliasPolySmooth (void)
D_PolysetScanLeftEdge (height); D_PolysetScanLeftEdge (height);
} }
// scan out the top (and possibly only) part of the right edge, updating the // scan out the top (and possibly only) part of the right edge, updating
// count field // the count field
d_pedgespanpackage = a_spans; d_pedgespanpackage = a_spans;
D_PolysetSetUpForLineScan (prighttop[0], prighttop[1], D_PolysetSetUpForLineScan (prighttop[0], prighttop[1],
@ -888,9 +841,6 @@ D_RasterizeAliasPolySmooth (void)
} }
/*
D_PolysetSetEdgeTable
*/
void void
D_PolysetSetEdgeTable (void) D_PolysetSetEdgeTable (void)
{ {
@ -899,10 +849,8 @@ D_PolysetSetEdgeTable (void)
edgetableindex = 0; // assume the vertices are already in edgetableindex = 0; // assume the vertices are already in
// top to bottom order // top to bottom order
//
// determine which edges are right & left, and the order in which // determine which edges are right & left, and the order in which
// to rasterize them // to rasterize them
//
if (r_p0[1] >= r_p1[1]) { if (r_p0[1] >= r_p1[1]) {
if (r_p0[1] == r_p1[1]) { if (r_p0[1] == r_p1[1]) {
if (r_p0[1] < r_p2[1]) if (r_p0[1] < r_p2[1])
@ -984,6 +932,7 @@ D_PolysetRecursiveDrawLine (int *lp1, int *lp2)
D_PolysetRecursiveDrawLine (new, lp2); D_PolysetRecursiveDrawLine (new, lp2);
} }
void void
D_PolysetRecursiveTriangle2 (int *lp1, int *lp2, int *lp3) D_PolysetRecursiveTriangle2 (int *lp1, int *lp2, int *lp3)
{ {

View file

@ -95,10 +95,6 @@ D_WarpScreen (void)
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
/*
D_DrawTurbulent8Span
*/
void void
D_DrawTurbulent8Span (void) D_DrawTurbulent8Span (void)
{ {
@ -116,12 +112,9 @@ D_DrawTurbulent8Span (void)
r_turb_t += r_turb_tstep; r_turb_t += r_turb_tstep;
} while (--r_turb_spancount > 0); } while (--r_turb_spancount > 0);
} }
#endif // !USE_INTEL_ASM #endif // !USE_INTEL_ASM
/*
Turbulent8
*/
void void
Turbulent8 (espan_t *pspan) Turbulent8 (espan_t *pspan)
{ {
@ -205,12 +198,9 @@ Turbulent8 (espan_t *pspan)
r_turb_tstep = (tnext - r_turb_t) >> 4; r_turb_tstep = (tnext - r_turb_t) >> 4;
} else { } else {
// calculate s/z, t/z, zi->fixed s and t at last pixel in // calculate s/z, t/z, zi->fixed s and t at last pixel in
// span (so // span (so can't step off polygon), clamp, calculate s and t
// can't step off polygon), clamp, calculate s and t steps // steps across span by division, biasing steps low so we
// across // don't run off the texture
// span by division, biasing steps low so we don't run off
// the
// texture
spancountminus1 = (float) (r_turb_spancount - 1); spancountminus1 = (float) (r_turb_spancount - 1);
sdivz += d_sdivzstepu * spancountminus1; sdivz += d_sdivzstepu * spancountminus1;
tdivz += d_tdivzstepu * spancountminus1; tdivz += d_tdivzstepu * spancountminus1;
@ -220,10 +210,9 @@ Turbulent8 (espan_t *pspan)
if (snext > bbextents) if (snext > bbextents)
snext = bbextents; snext = bbextents;
else if (snext < 16) else if (snext < 16)
snext = 16; // prevent round-off error on <0 snext = 16; // prevent round-off error on <0 steps
// steps from // from causing overstepping & running
// from causing overstepping & running off the // off the edge of the texture
// edge of the texture
tnext = (int) (tdivz * z) + tadjust; tnext = (int) (tdivz * z) + tadjust;
if (tnext > bbextentt) if (tnext > bbextentt)
@ -253,10 +242,6 @@ Turbulent8 (espan_t *pspan)
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
/*
D_DrawSpans8
*/
void void
D_DrawSpans8 (espan_t *pspan) D_DrawSpans8 (espan_t *pspan)
{ {
@ -338,13 +323,10 @@ D_DrawSpans8 (espan_t *pspan)
sstep = (snext - s) >> 3; sstep = (snext - s) >> 3;
tstep = (tnext - t) >> 3; tstep = (tnext - t) >> 3;
} else { } else {
// calculate s/z, t/z, zi->fixed s and t at last pixel in // calculate s/z, t/z, zi->fixed s and t at last pixel in span
// span (so // (so can't step off polygon), clamp, calculate s and t steps
// can't step off polygon), clamp, calculate s and t steps // across span by division, biasing steps low so we don't run
// across // off the texture
// span by division, biasing steps low so we don't run off
// the
// texture
spancountminus1 = (float) (spancount - 1); spancountminus1 = (float) (spancount - 1);
sdivz += d_sdivzstepu * spancountminus1; sdivz += d_sdivzstepu * spancountminus1;
tdivz += d_tdivzstepu * spancountminus1; tdivz += d_tdivzstepu * spancountminus1;
@ -354,10 +336,9 @@ D_DrawSpans8 (espan_t *pspan)
if (snext > bbextents) if (snext > bbextents)
snext = bbextents; snext = bbextents;
else if (snext < 8) else if (snext < 8)
snext = 8; // prevent round-off error on <0 snext = 8; // prevent round-off error on <0 steps
// steps from // from from causing overstepping &
// from causing overstepping & running off the // running off the edge of the texture
// edge of the texture
tnext = (int) (tdivz * z) + tadjust; tnext = (int) (tdivz * z) + tadjust;
if (tnext > bbextentt) if (tnext > bbextentt)
@ -385,15 +366,10 @@ D_DrawSpans8 (espan_t *pspan)
} while ((pspan = pspan->pnext) != NULL); } while ((pspan = pspan->pnext) != NULL);
} }
#endif #endif
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
/*
D_DrawZSpans
*/
void void
D_DrawZSpans (espan_t *pspan) D_DrawZSpans (espan_t *pspan)
{ {
@ -443,5 +419,4 @@ D_DrawZSpans (espan_t *pspan)
} while ((pspan = pspan->pnext) != NULL); } while ((pspan = pspan->pnext) != NULL);
} }
#endif #endif

View file

@ -38,9 +38,6 @@
#define SKY_SPAN_MAX (1 << SKY_SPAN_SHIFT) #define SKY_SPAN_MAX (1 << SKY_SPAN_SHIFT)
/*
D_Sky_uv_To_st
*/
void void
D_Sky_uv_To_st (int u, int v, fixed16_t *s, fixed16_t *t) D_Sky_uv_To_st (int u, int v, fixed16_t *s, fixed16_t *t)
{ {
@ -68,9 +65,6 @@ D_Sky_uv_To_st (int u, int v, fixed16_t *s, fixed16_t *t)
} }
/*
D_DrawSkyScans8
*/
void void
D_DrawSkyScans8 (espan_t *pspan) D_DrawSkyScans8 (espan_t *pspan)
{ {

View file

@ -37,11 +37,9 @@ static int sprite_height;
static int minindex, maxindex; static int minindex, maxindex;
static sspan_t *sprite_spans; static sspan_t *sprite_spans;
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
/*
D_SpriteDrawSpans
*/
void void
D_SpriteDrawSpans (sspan_t *pspan) D_SpriteDrawSpans (sspan_t *pspan)
{ {
@ -135,12 +133,9 @@ D_SpriteDrawSpans (sspan_t *pspan)
tstep = (tnext - t) >> 3; tstep = (tnext - t) >> 3;
} else { } else {
// calculate s/z, t/z, zi->fixed s and t at last pixel in // calculate s/z, t/z, zi->fixed s and t at last pixel in
// span (so // span (so can't step off polygon), clamp, calculate s and t
// can't step off polygon), clamp, calculate s and t steps // steps across span by division, biasing steps low so we
// across // don't run off the texture
// span by division, biasing steps low so we don't run off
// the
// texture
spancountminus1 = (float) (spancount - 1); spancountminus1 = (float) (spancount - 1);
sdivz += d_sdivzstepu * spancountminus1; sdivz += d_sdivzstepu * spancountminus1;
tdivz += d_tdivzstepu * spancountminus1; tdivz += d_tdivzstepu * spancountminus1;
@ -150,10 +145,9 @@ D_SpriteDrawSpans (sspan_t *pspan)
if (snext > bbextents) if (snext > bbextents)
snext = bbextents; snext = bbextents;
else if (snext < 8) else if (snext < 8)
snext = 8; // prevent round-off error on <0 snext = 8; // prevent round-off error on <0 steps
// steps from // from from causing overstepping &
// from causing overstepping & running off the // running off the edge of the texture
// edge of the texture
tnext = (int) (tdivz * z) + tadjust; tnext = (int) (tdivz * z) + tadjust;
if (tnext > bbextentt) if (tnext > bbextentt)
@ -194,13 +188,9 @@ D_SpriteDrawSpans (sspan_t *pspan)
} while (pspan->count != DS_SPAN_LIST_END); } while (pspan->count != DS_SPAN_LIST_END);
} }
#endif #endif
/*
D_SpriteScanLeftEdge
*/
void void
D_SpriteScanLeftEdge (void) D_SpriteScanLeftEdge (void)
{ {
@ -256,9 +246,6 @@ D_SpriteScanLeftEdge (void)
} }
/*
D_SpriteScanRightEdge
*/
void void
D_SpriteScanRightEdge (void) D_SpriteScanRightEdge (void)
{ {
@ -334,9 +321,6 @@ D_SpriteScanRightEdge (void)
} }
/*
D_SpriteCalculateGradients
*/
void void
D_SpriteCalculateGradients (void) D_SpriteCalculateGradients (void)
{ {
@ -379,9 +363,6 @@ D_SpriteCalculateGradients (void)
} }
/*
D_DrawSprite
*/
void void
D_DrawSprite (void) D_DrawSprite (void)
{ {
@ -392,8 +373,8 @@ D_DrawSprite (void)
sprite_spans = spans; sprite_spans = spans;
// find the top and bottom vertices, and make sure there's at least one scan to // find the top and bottom vertices, and make sure there's at least one
// draw // scan to draw
ymin = 999999.9; ymin = 999999.9;
ymax = -999999.9; ymax = -999999.9;
pverts = r_spritedesc.pverts; pverts = r_spritedesc.pverts;

View file

@ -45,12 +45,14 @@ surfcache_t *sc_rover, *sc_base;
#define GUARDSIZE 4 #define GUARDSIZE 4
void * void *
D_SurfaceCacheAddress (void) D_SurfaceCacheAddress (void)
{ {
return sc_base; return sc_base;
} }
int int
D_SurfaceCacheForRes (int width, int height) D_SurfaceCacheForRes (int width, int height)
{ {
@ -71,6 +73,7 @@ D_SurfaceCacheForRes (int width, int height)
return size; return size;
} }
void void
D_CheckCacheGuard (void) D_CheckCacheGuard (void)
{ {
@ -83,6 +86,7 @@ D_CheckCacheGuard (void)
Sys_Error ("D_CheckCacheGuard: failed"); Sys_Error ("D_CheckCacheGuard: failed");
} }
void void
D_ClearCacheGuard (void) D_ClearCacheGuard (void)
{ {
@ -95,9 +99,6 @@ D_ClearCacheGuard (void)
} }
/*
D_InitCaches
*/
void void
D_InitCaches (void *buffer, int size) D_InitCaches (void *buffer, int size)
{ {
@ -118,9 +119,6 @@ D_InitCaches (void *buffer, int size)
} }
/*
D_FlushCaches
*/
void void
D_FlushCaches (void) D_FlushCaches (void)
{ {
@ -140,9 +138,7 @@ D_FlushCaches (void)
sc_base->size = sc_size; sc_base->size = sc_size;
} }
/*
D_SCAlloc
*/
surfcache_t * surfcache_t *
D_SCAlloc (int width, int size) D_SCAlloc (int width, int size)
{ {
@ -208,8 +204,7 @@ D_SCAlloc (int width, int size)
if (width > 0) if (width > 0)
new->height = (size - sizeof (*new) + sizeof (new->data)) / width; new->height = (size - sizeof (*new) + sizeof (new->data)) / width;
new->owner = NULL; // should be set properly after new->owner = NULL; // should be set properly after return
// return
if (d_roverwrapped) { if (d_roverwrapped) {
if (wrapped_this_time || (sc_rover >= d_initial_rover)) if (wrapped_this_time || (sc_rover >= d_initial_rover))
@ -223,9 +218,6 @@ D_SCAlloc (int width, int size)
} }
/*
D_SCDump
*/
void void
D_SCDump (void) D_SCDump (void)
{ {
@ -239,10 +231,8 @@ D_SCDump (void)
} }
} }
//=============================================================================
// if the num is not a power of 2, assume it will not repeat // if the num is not a power of 2, assume it will not repeat
int int
MaskForNum (int num) MaskForNum (int num)
{ {
@ -257,6 +247,7 @@ MaskForNum (int num)
return 255; return 255;
} }
int int
D_log2 (int num) D_log2 (int num)
{ {
@ -269,28 +260,20 @@ D_log2 (int num)
return c; return c;
} }
//=============================================================================
/*
D_CacheSurface
*/
surfcache_t * surfcache_t *
D_CacheSurface (msurface_t *surface, int miplevel) D_CacheSurface (msurface_t *surface, int miplevel)
{ {
surfcache_t *cache; surfcache_t *cache;
//
// if the surface is animating or flashing, flush the cache // if the surface is animating or flashing, flush the cache
//
r_drawsurf.texture = R_TextureAnimation (surface->texinfo->texture); r_drawsurf.texture = R_TextureAnimation (surface->texinfo->texture);
r_drawsurf.lightadj[0] = d_lightstylevalue[surface->styles[0]]; r_drawsurf.lightadj[0] = d_lightstylevalue[surface->styles[0]];
r_drawsurf.lightadj[1] = d_lightstylevalue[surface->styles[1]]; r_drawsurf.lightadj[1] = d_lightstylevalue[surface->styles[1]];
r_drawsurf.lightadj[2] = d_lightstylevalue[surface->styles[2]]; r_drawsurf.lightadj[2] = d_lightstylevalue[surface->styles[2]];
r_drawsurf.lightadj[3] = d_lightstylevalue[surface->styles[3]]; r_drawsurf.lightadj[3] = d_lightstylevalue[surface->styles[3]];
//
// see if the cache holds apropriate data // see if the cache holds apropriate data
//
cache = surface->cachespots[miplevel]; cache = surface->cachespots[miplevel];
if (cache && !cache->dlight && surface->dlightframe != r_framecount if (cache && !cache->dlight && surface->dlightframe != r_framecount
@ -301,18 +284,14 @@ D_CacheSurface (msurface_t *surface, int miplevel)
&& cache->lightadj[3] == r_drawsurf.lightadj[3]) && cache->lightadj[3] == r_drawsurf.lightadj[3])
return cache; return cache;
//
// determine shape of surface // determine shape of surface
//
surfscale = 1.0 / (1 << miplevel); surfscale = 1.0 / (1 << miplevel);
r_drawsurf.surfmip = miplevel; r_drawsurf.surfmip = miplevel;
r_drawsurf.surfwidth = surface->extents[0] >> miplevel; r_drawsurf.surfwidth = surface->extents[0] >> miplevel;
r_drawsurf.rowbytes = r_drawsurf.surfwidth; r_drawsurf.rowbytes = r_drawsurf.surfwidth;
r_drawsurf.surfheight = surface->extents[1] >> miplevel; r_drawsurf.surfheight = surface->extents[1] >> miplevel;
//
// allocate memory if needed // allocate memory if needed
//
if (!cache) // if a texture just animated, don't if (!cache) // if a texture just animated, don't
// reallocate it // reallocate it
{ {
@ -336,9 +315,7 @@ D_CacheSurface (msurface_t *surface, int miplevel)
cache->lightadj[2] = r_drawsurf.lightadj[2]; cache->lightadj[2] = r_drawsurf.lightadj[2];
cache->lightadj[3] = r_drawsurf.lightadj[3]; cache->lightadj[3] = r_drawsurf.lightadj[3];
//
// draw and light the surface texture // draw and light the surface texture
//
r_drawsurf.surf = surface; r_drawsurf.surf = surface;
c_surf++; c_surf++;

View file

@ -37,9 +37,7 @@
// all global and static refresh variables are collected in a contiguous block // all global and static refresh variables are collected in a contiguous block
// to avoid cache conflicts. // to avoid cache conflicts.
//------------------------------------------------------- // global refresh variables -----------------------------
// global refresh variables
//-------------------------------------------------------
// FIXME: make into one big structure, like cl or sv // FIXME: make into one big structure, like cl or sv
// FIXME: do separately for refresh engine and driver // FIXME: do separately for refresh engine and driver

View file

@ -33,9 +33,6 @@
#include "d_local.h" #include "d_local.h"
/*
D_DrawZPoint
*/
void void
D_DrawZPoint (void) D_DrawZPoint (void)
{ {