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)
{ {
@ -58,7 +57,7 @@ D_DrawParticle (particle_t *pparticle)
short *pz; short *pz;
int i, izi, pix, count, u, v; int i, izi, pix, count, u, v;
// transform point // transform point
VectorSubtract (pparticle->org, r_origin, local); VectorSubtract (pparticle->org, r_origin, local);
transformed[0] = DotProduct (local, r_pright); transformed[0] = DotProduct (local, r_pright);
@ -68,8 +67,8 @@ 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];
u = (int) (xcenter + zi * transformed[0] + 0.5); u = (int) (xcenter + zi * transformed[0] + 0.5);
v = (int) (ycenter - zi * transformed[1] + 0.5); v = (int) (ycenter - zi * transformed[1] + 0.5);
@ -91,9 +90,8 @@ D_DrawParticle (particle_t *pparticle)
pix = d_pix_max; pix = d_pix_max;
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;
@ -102,9 +100,8 @@ D_DrawParticle (particle_t *pparticle)
} }
break; break;
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;
@ -118,9 +115,8 @@ D_DrawParticle (particle_t *pparticle)
} }
break; break;
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;
@ -139,9 +135,8 @@ D_DrawParticle (particle_t *pparticle)
} }
break; break;
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;
@ -165,9 +160,8 @@ D_DrawParticle (particle_t *pparticle)
} }
break; break;
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;
@ -355,20 +331,19 @@ D_PolysetRecursiveTriangle (int *lp1, int *lp2, int *lp3)
lp3 = temp; lp3 = temp;
split: split:
// split this edge // split this edge
new[0] = (lp1[0] + lp2[0]) >> 1; new[0] = (lp1[0] + lp2[0]) >> 1;
new[1] = (lp1[1] + lp2[1]) >> 1; new[1] = (lp1[1] + lp2[1]) >> 1;
new[2] = (lp1[2] + lp2[2]) >> 1; new[2] = (lp1[2] + lp2[2]) >> 1;
new[3] = (lp1[3] + lp2[3]) >> 1; new[3] = (lp1[3] + lp2[3]) >> 1;
new[5] = (lp1[5] + lp2[5]) >> 1; new[5] = (lp1[5] + lp2[5]) >> 1;
// draw the point if splitting a leading edge // draw the point if splitting a leading edge
if (lp2[1] > lp1[1]) if (lp2[1] > lp1[1])
goto nodraw; goto nodraw;
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) {
@ -380,7 +355,7 @@ D_PolysetRecursiveTriangle (int *lp1, int *lp2, int *lp3)
} }
nodraw: nodraw:
// recursively continue // recursively continue
D_PolysetRecursiveTriangle (lp3, lp1, new); D_PolysetRecursiveTriangle (lp3, lp1, new);
D_PolysetRecursiveTriangle (lp3, new, lp2); D_PolysetRecursiveTriangle (lp3, new, lp2);
} }
@ -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)
{ {
@ -534,9 +486,9 @@ 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
@ -588,9 +539,8 @@ InitGel (byte * palette)
int r; int r;
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],
@ -930,7 +855,7 @@ D_RasterizeAliasPolySmooth (void)
// spanpackages // spanpackages
D_PolysetDrawSpans8 (a_spans); D_PolysetDrawSpans8 (a_spans);
// scan out the bottom part of the right edge, if it exists // scan out the bottom part of the right edge, if it exists
if (pedgetable->numrightedges == 2) { if (pedgetable->numrightedges == 2) {
int height; int height;
spanpackage_t *pstart; spanpackage_t *pstart;
@ -956,23 +881,16 @@ D_RasterizeAliasPolySmooth (void)
} }
/*
================
D_PolysetSetEdgeTable
================
*/
void void
D_PolysetSetEdgeTable (void) D_PolysetSetEdgeTable (void)
{ {
int edgetableindex; int edgetableindex;
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])
@ -1031,7 +949,7 @@ D_PolysetRecursiveDrawLine (int *lp1, int *lp2)
return; // line is completed return; // line is completed
split: split:
// split this edge // split this edge
new[0] = (lp1[0] + lp2[0]) >> 1; new[0] = (lp1[0] + lp2[0]) >> 1;
new[1] = (lp1[1] + lp2[1]) >> 1; new[1] = (lp1[1] + lp2[1]) >> 1;
new[5] = (lp1[5] + lp2[5]) >> 1; new[5] = (lp1[5] + lp2[5]) >> 1;
@ -1039,21 +957,22 @@ D_PolysetRecursiveDrawLine (int *lp1, int *lp2)
new[3] = (lp1[3] + lp2[3]) >> 1; new[3] = (lp1[3] + lp2[3]) >> 1;
new[4] = (lp1[4] + lp2[4]) >> 1; new[4] = (lp1[4] + lp2[4]) >> 1;
// draw the point // draw the point
ofs = d_scantable[new[1]] + new[0]; ofs = d_scantable[new[1]] + new[0];
if (new[5] > d_pzbuffer[ofs]) { if (new[5] > d_pzbuffer[ofs]) {
int pix; int pix;
d_pzbuffer[ofs] = new[5]; d_pzbuffer[ofs] = new[5];
pix = skintable[new[3] >> 16][new[2] >> 16]; pix = skintable[new[3] >> 16][new[2] >> 16];
// pix = ((byte *)acolormap)[pix + (new[4] & 0xFF00)]; // pix = ((byte *)acolormap)[pix + (new[4] & 0xFF00)];
d_viewbuffer[ofs] = pix; d_viewbuffer[ofs] = pix;
} }
// recursively continue // recursively continue
D_PolysetRecursiveDrawLine (lp1, new); D_PolysetRecursiveDrawLine (lp1, new);
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)
{ {
@ -1069,7 +988,7 @@ D_PolysetRecursiveTriangle2 (int *lp1, int *lp2, int *lp3)
return; return;
split: split:
// split this edge // split this edge
new[0] = (lp1[0] + lp2[0]) >> 1; new[0] = (lp1[0] + lp2[0]) >> 1;
new[1] = (lp1[1] + lp2[1]) >> 1; new[1] = (lp1[1] + lp2[1]) >> 1;
new[5] = (lp1[5] + lp2[5]) >> 1; new[5] = (lp1[5] + lp2[5]) >> 1;
@ -1079,7 +998,7 @@ D_PolysetRecursiveTriangle2 (int *lp1, int *lp2, int *lp3)
D_PolysetRecursiveDrawLine (new, lp3); D_PolysetRecursiveDrawLine (new, lp3);
// recursively continue // recursively continue
D_PolysetRecursiveTriangle (lp1, new, lp3); D_PolysetRecursiveTriangle (lp1, new, lp3);
D_PolysetRecursiveTriangle (new, lp2, lp3); D_PolysetRecursiveTriangle (new, lp2, 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,28 +183,24 @@ 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)
tnext = bbextentt; tnext = bbextentt;
else if (tnext < 16) else if (tnext < 16)
tnext = 16; // guard against round-off error on tnext = 16; // guard against round-off error on
// <0 steps // <0 steps
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,17 +210,16 @@ 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)
tnext = bbextentt; tnext = bbextentt;
else if (tnext < 16) else if (tnext < 16)
tnext = 16; // guard against round-off error on tnext = 16; // guard against round-off error on
// <0 steps // <0 steps
if (r_turb_spancount > 1) { if (r_turb_spancount > 1) {
r_turb_sstep = (snext - r_turb_s) / (r_turb_spancount - 1); r_turb_sstep = (snext - r_turb_s) / (r_turb_spancount - 1);
@ -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,28 +308,24 @@ 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)
tnext = bbextentt; tnext = bbextentt;
else if (tnext < 8) else if (tnext < 8)
tnext = 8; // guard against round-off error on tnext = 8; // guard against round-off error on
// <0 steps // <0 steps
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,17 +335,16 @@ 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)
tnext = bbextentt; tnext = bbextentt;
else if (tnext < 8) else if (tnext < 8)
tnext = 8; // guard against round-off error on tnext = 8; // guard against round-off error on
// <0 steps // <0 steps
if (spancount > 1) { if (spancount > 1) {
sstep = (snext - s) / (spancount - 1); sstep = (snext - s) / (spancount - 1);
@ -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,28 +116,24 @@ 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)
tnext = bbextentt; tnext = bbextentt;
else if (tnext < 8) else if (tnext < 8)
tnext = 8; // guard against round-off error on tnext = 8; // guard against round-off error on
// <0 steps // <0 steps
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,17 +143,16 @@ 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)
tnext = bbextentt; tnext = bbextentt;
else if (tnext < 8) else if (tnext < 8)
tnext = 8; // guard against round-off error on tnext = 8; // guard against round-off error on
// <0 steps // <0 steps
if (spancount > 1) { if (spancount > 1) {
sstep = (snext - s) / (spancount - 1); sstep = (snext - s) / (spancount - 1);
@ -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)
{ {
@ -381,17 +355,12 @@ D_SpriteCalculateGradients (void)
tadjust = ((fixed16_t) (DotProduct (p_temp1, p_taxis) * 0x10000 + 0.5)) - tadjust = ((fixed16_t) (DotProduct (p_temp1, p_taxis) * 0x10000 + 0.5)) -
(-(sprite_height >> 1) << 16); (-(sprite_height >> 1) << 16);
// -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 = (cachewidth << 16) - 1; bbextents = (cachewidth << 16) - 1;
bbextentt = (sprite_height << 16) - 1; bbextentt = (sprite_height << 16) - 1;
} }
/*
=====================
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;
@ -432,8 +401,8 @@ D_DrawSprite (void)
sprite_height = r_spritedesc.pspriteframe->height; sprite_height = r_spritedesc.pspriteframe->height;
cacheblock = (byte *) & r_spritedesc.pspriteframe->pixels[0]; cacheblock = (byte *) & r_spritedesc.pspriteframe->pixels[0];
// copy the first vertex to the last vertex, so we don't have to deal with // copy the first vertex to the last vertex, so we don't have to deal with
// wrapping // wrapping
nump = r_spritedesc.nump; nump = r_spritedesc.nump;
pverts = r_spritedesc.pverts; pverts = r_spritedesc.pverts;
pverts[nump] = pverts[0]; pverts[nump] = pverts[0];

View file

@ -50,7 +50,8 @@ 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;
@ -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)
{ {
@ -174,7 +161,7 @@ D_SCAlloc (int width, int size)
if (size > sc_size) if (size > sc_size)
Sys_Error ("D_SCAlloc: %i > cache size", size); Sys_Error ("D_SCAlloc: %i > cache size", size);
// if there is not size bytes after the rover, reset to the start // if there is not size bytes after the rover, reset to the start
wrapped_this_time = false; wrapped_this_time = false;
if (!sc_rover || (byte *) sc_rover - (byte *) sc_base > sc_size - size) { if (!sc_rover || (byte *) sc_rover - (byte *) sc_base > sc_size - size) {
@ -183,7 +170,7 @@ D_SCAlloc (int width, int size)
} }
sc_rover = sc_base; sc_rover = sc_base;
} }
// colect and free surfcache_t blocks until the rover block is large enough // colect and free surfcache_t blocks until the rover block is large enough
new = sc_rover; new = sc_rover;
if (sc_rover->owner) if (sc_rover->owner)
*sc_rover->owner = NULL; *sc_rover->owner = NULL;
@ -200,7 +187,7 @@ D_SCAlloc (int width, int size)
new->next = sc_rover->next; new->next = sc_rover->next;
} }
// create a fragment out of any leftovers // create a fragment out of any leftovers
if (new->size - size > 256) { if (new->size - size > 256) {
sc_rover = (surfcache_t *) ((byte *) new + size); sc_rover = (surfcache_t *) ((byte *) new + size);
sc_rover->size = new->size - size; sc_rover->size = new->size - 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,20 +283,16 @@ 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
{ {
cache = D_SCAlloc (r_drawsurf.surfwidth, cache = D_SCAlloc (r_drawsurf.surfwidth,
r_drawsurf.surfwidth * r_drawsurf.surfheight); r_drawsurf.surfwidth * r_drawsurf.surfheight);
@ -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)
{ {
@ -181,7 +163,7 @@ D_DrawSurfaces (void)
TransformVector (modelorg, transformed_modelorg); TransformVector (modelorg, transformed_modelorg);
VectorCopy (transformed_modelorg, world_transformed_modelorg); VectorCopy (transformed_modelorg, world_transformed_modelorg);
// TODO: could preset a lot of this at mode set time // TODO: could preset a lot of this at mode set time
if (r_drawflat->int_val) { if (r_drawflat->int_val) {
for (s = &surfaces[1]; s < surface_p; s++) { for (s = &surfaces[1]; s < surface_p; s++) {
if (!s->spans) if (!s->spans)
@ -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)
{ {
@ -58,7 +57,7 @@ D_DrawParticle (particle_t *pparticle)
short *pz; short *pz;
int i, izi, pix, count, u, v; int i, izi, pix, count, u, v;
// transform point // transform point
VectorSubtract (pparticle->org, r_origin, local); VectorSubtract (pparticle->org, r_origin, local);
transformed[0] = DotProduct (local, r_pright); transformed[0] = DotProduct (local, r_pright);
@ -67,9 +66,8 @@ 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];
u = (int) (xcenter + zi * transformed[0] + 0.5); u = (int) (xcenter + zi * transformed[0] + 0.5);
v = (int) (ycenter - zi * transformed[1] + 0.5); v = (int) (ycenter - zi * transformed[1] + 0.5);
@ -91,93 +89,87 @@ D_DrawParticle (particle_t *pparticle)
pix = d_pix_max; pix = d_pix_max;
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) {
if (pz[0] <= izi) {
pz[0] = izi;
pdest[0] = pparticle->color;
}
}
break;
for (; count; count--, pz += d_zwidth, pdest += screenwidth) { case 2:
if (pz[0] <= izi) { count = 2 << d_y_aspect_shift;
pz[0] = izi; for (; count; count--, pz += d_zwidth, pdest += screenwidth) {
pdest[0] = pparticle->color; if (pz[0] <= izi) {
pz[0] = izi;
pdest[0] = pparticle->color;
}
if (pz[1] <= izi) {
pz[1] = izi;
pdest[1] = pparticle->color;
}
}
break;
case 3:
count = 3 << d_y_aspect_shift;
for (; count; count--, pz += d_zwidth, pdest += screenwidth) {
if (pz[0] <= izi) {
pz[0] = izi;
pdest[0] = pparticle->color;
}
if (pz[1] <= izi) {
pz[1] = izi;
pdest[1] = pparticle->color;
}
if (pz[2] <= izi) {
pz[2] = izi;
pdest[2] = pparticle->color;
}
}
break;
case 4:
count = 4 << d_y_aspect_shift;
for (; count; count--, pz += d_zwidth, pdest += screenwidth) {
if (pz[0] <= izi) {
pz[0] = izi;
pdest[0] = pparticle->color;
}
if (pz[1] <= izi) {
pz[1] = izi;
pdest[1] = pparticle->color;
}
if (pz[2] <= izi) {
pz[2] = izi;
pdest[2] = pparticle->color;
}
if (pz[3] <= izi) {
pz[3] = izi;
pdest[3] = pparticle->color;
}
}
break;
default:
count = pix << d_y_aspect_shift;
for (; count; count--, pz += d_zwidth, pdest += screenwidth) {
for (i = 0; i < pix; i++) {
if (pz[i] <= izi) {
pz[i] = izi;
pdest[i] = pparticle->color;
} }
} }
break; }
break;
case 2:
count = 2 << d_y_aspect_shift;
for (; count; count--, pz += d_zwidth, pdest += screenwidth) {
if (pz[0] <= izi) {
pz[0] = izi;
pdest[0] = pparticle->color;
}
if (pz[1] <= izi) {
pz[1] = izi;
pdest[1] = pparticle->color;
}
}
break;
case 3:
count = 3 << d_y_aspect_shift;
for (; count; count--, pz += d_zwidth, pdest += screenwidth) {
if (pz[0] <= izi) {
pz[0] = izi;
pdest[0] = pparticle->color;
}
if (pz[1] <= izi) {
pz[1] = izi;
pdest[1] = pparticle->color;
}
if (pz[2] <= izi) {
pz[2] = izi;
pdest[2] = pparticle->color;
}
}
break;
case 4:
count = 4 << d_y_aspect_shift;
for (; count; count--, pz += d_zwidth, pdest += screenwidth) {
if (pz[0] <= izi) {
pz[0] = izi;
pdest[0] = pparticle->color;
}
if (pz[1] <= izi) {
pz[1] = izi;
pdest[1] = pparticle->color;
}
if (pz[2] <= izi) {
pz[2] = izi;
pdest[2] = pparticle->color;
}
if (pz[3] <= izi) {
pz[3] = izi;
pdest[3] = pparticle->color;
}
}
break;
default:
count = pix << d_y_aspect_shift;
for (; count; count--, pz += d_zwidth, pdest += screenwidth) {
for (i = 0; i < pix; i++) {
if (pz[i] <= izi) {
pz[i] = izi;
pdest[i] = pparticle->color;
}
}
}
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)
{ {
@ -347,14 +332,14 @@ D_PolysetRecursiveTriangle (int *lp1, int *lp2, int *lp3)
lp3 = temp; lp3 = temp;
split: split:
// split this edge // split this edge
new[0] = (lp1[0] + lp2[0]) >> 1; new[0] = (lp1[0] + lp2[0]) >> 1;
new[1] = (lp1[1] + lp2[1]) >> 1; new[1] = (lp1[1] + lp2[1]) >> 1;
new[2] = (lp1[2] + lp2[2]) >> 1; new[2] = (lp1[2] + lp2[2]) >> 1;
new[3] = (lp1[3] + lp2[3]) >> 1; new[3] = (lp1[3] + lp2[3]) >> 1;
new[5] = (lp1[5] + lp2[5]) >> 1; new[5] = (lp1[5] + lp2[5]) >> 1;
// draw the point if splitting a leading edge // draw the point if splitting a leading edge
if (lp2[1] > lp1[1]) if (lp2[1] > lp1[1])
goto nodraw; goto nodraw;
if ((lp2[1] == lp1[1]) && (lp2[0] < lp1[0])) if ((lp2[1] == lp1[1]) && (lp2[0] < lp1[0]))
@ -372,7 +357,7 @@ D_PolysetRecursiveTriangle (int *lp1, int *lp2, int *lp3)
} }
nodraw: nodraw:
// recursively continue // recursively continue
D_PolysetRecursiveTriangle (lp3, lp1, new); D_PolysetRecursiveTriangle (lp3, lp1, new);
D_PolysetRecursiveTriangle (lp3, new, lp2); D_PolysetRecursiveTriangle (lp3, new, lp2);
} }
@ -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],
@ -862,7 +815,7 @@ D_RasterizeAliasPolySmooth (void)
// spanpackages // spanpackages
D_PolysetDrawSpans8 (a_spans); D_PolysetDrawSpans8 (a_spans);
// scan out the bottom part of the right edge, if it exists // scan out the bottom part of the right edge, if it exists
if (pedgetable->numrightedges == 2) { if (pedgetable->numrightedges == 2) {
int height; int height;
spanpackage_t *pstart; spanpackage_t *pstart;
@ -888,21 +841,16 @@ D_RasterizeAliasPolySmooth (void)
} }
/*
D_PolysetSetEdgeTable
*/
void void
D_PolysetSetEdgeTable (void) D_PolysetSetEdgeTable (void)
{ {
int edgetableindex; int edgetableindex;
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])
@ -961,7 +909,7 @@ D_PolysetRecursiveDrawLine (int *lp1, int *lp2)
return; // line is completed return; // line is completed
split: split:
// split this edge // split this edge
new[0] = (lp1[0] + lp2[0]) >> 1; new[0] = (lp1[0] + lp2[0]) >> 1;
new[1] = (lp1[1] + lp2[1]) >> 1; new[1] = (lp1[1] + lp2[1]) >> 1;
new[5] = (lp1[5] + lp2[5]) >> 1; new[5] = (lp1[5] + lp2[5]) >> 1;
@ -969,21 +917,22 @@ D_PolysetRecursiveDrawLine (int *lp1, int *lp2)
new[3] = (lp1[3] + lp2[3]) >> 1; new[3] = (lp1[3] + lp2[3]) >> 1;
new[4] = (lp1[4] + lp2[4]) >> 1; new[4] = (lp1[4] + lp2[4]) >> 1;
// draw the point // draw the point
ofs = d_scantable[new[1]] + new[0]; ofs = d_scantable[new[1]] + new[0];
if (new[5] > d_pzbuffer[ofs]) { if (new[5] > d_pzbuffer[ofs]) {
int pix; int pix;
d_pzbuffer[ofs] = new[5]; d_pzbuffer[ofs] = new[5];
pix = skintable[new[3] >> 16][new[2] >> 16]; pix = skintable[new[3] >> 16][new[2] >> 16];
// pix = ((byte *)acolormap)[pix + (new[4] & 0xFF00)]; // pix = ((byte *)acolormap)[pix + (new[4] & 0xFF00)];
d_viewbuffer[ofs] = pix; d_viewbuffer[ofs] = pix;
} }
// recursively continue // recursively continue
D_PolysetRecursiveDrawLine (lp1, new); D_PolysetRecursiveDrawLine (lp1, new);
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)
{ {
@ -999,7 +948,7 @@ D_PolysetRecursiveTriangle2 (int *lp1, int *lp2, int *lp3)
return; return;
split: split:
// split this edge // split this edge
new[0] = (lp1[0] + lp2[0]) >> 1; new[0] = (lp1[0] + lp2[0]) >> 1;
new[1] = (lp1[1] + lp2[1]) >> 1; new[1] = (lp1[1] + lp2[1]) >> 1;
new[5] = (lp1[5] + lp2[5]) >> 1; new[5] = (lp1[5] + lp2[5]) >> 1;
@ -1009,7 +958,7 @@ D_PolysetRecursiveTriangle2 (int *lp1, int *lp2, int *lp3)
D_PolysetRecursiveDrawLine (new, lp3); D_PolysetRecursiveDrawLine (new, lp3);
// recursively continue // recursively continue
D_PolysetRecursiveTriangle (lp1, new, lp3); D_PolysetRecursiveTriangle (lp1, new, lp3);
D_PolysetRecursiveTriangle (new, lp2, lp3); D_PolysetRecursiveTriangle (new, lp2, 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)
{ {
@ -373,15 +357,12 @@ D_SpriteCalculateGradients (void)
tadjust = ((fixed16_t) (DotProduct (p_temp1, p_taxis) * 0x10000 + 0.5)) - tadjust = ((fixed16_t) (DotProduct (p_temp1, p_taxis) * 0x10000 + 0.5)) -
(-(sprite_height >> 1) << 16); (-(sprite_height >> 1) << 16);
// -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 = (cachewidth << 16) - 1; bbextents = (cachewidth << 16) - 1;
bbextentt = (sprite_height << 16) - 1; bbextentt = (sprite_height << 16) - 1;
} }
/*
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;
@ -422,8 +403,8 @@ D_DrawSprite (void)
sprite_height = r_spritedesc.pspriteframe->height; sprite_height = r_spritedesc.pspriteframe->height;
cacheblock = (byte *) & r_spritedesc.pspriteframe->pixels[0]; cacheblock = (byte *) & r_spritedesc.pspriteframe->pixels[0];
// copy the first vertex to the last vertex, so we don't have to deal with // copy the first vertex to the last vertex, so we don't have to deal with
// wrapping // wrapping
nump = r_spritedesc.nump; nump = r_spritedesc.nump;
pverts = r_spritedesc.pverts; pverts = r_spritedesc.pverts;
pverts[nump] = pverts[0]; pverts[nump] = pverts[0];

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,14 +99,11 @@ D_ClearCacheGuard (void)
} }
/*
D_InitCaches
*/
void void
D_InitCaches (void *buffer, int size) D_InitCaches (void *buffer, int size)
{ {
// if (!msg_suppress_1) // if (!msg_suppress_1)
// Con_Printf ("%ik surface cache\n", size/1024); // Con_Printf ("%ik surface cache\n", size/1024);
sc_size = size - GUARDSIZE; sc_size = size - GUARDSIZE;
sc_base = (surfcache_t *) buffer; sc_base = (surfcache_t *) buffer;
@ -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)
{ {
@ -165,7 +161,7 @@ D_SCAlloc (int width, int size)
if (size > sc_size) if (size > sc_size)
Sys_Error ("D_SCAlloc: %i > cache size", size); Sys_Error ("D_SCAlloc: %i > cache size", size);
// if there is not size bytes after the rover, reset to the start // if there is not size bytes after the rover, reset to the start
wrapped_this_time = false; wrapped_this_time = false;
if (!sc_rover || (byte *) sc_rover - (byte *) sc_base > sc_size - size) { if (!sc_rover || (byte *) sc_rover - (byte *) sc_base > sc_size - size) {
@ -174,7 +170,7 @@ D_SCAlloc (int width, int size)
} }
sc_rover = sc_base; sc_rover = sc_base;
} }
// colect and free surfcache_t blocks until the rover block is large enough // colect and free surfcache_t blocks until the rover block is large enough
new = sc_rover; new = sc_rover;
if (sc_rover->owner) if (sc_rover->owner)
*sc_rover->owner = NULL; *sc_rover->owner = NULL;
@ -191,7 +187,7 @@ D_SCAlloc (int width, int size)
new->next = sc_rover->next; new->next = sc_rover->next;
} }
// create a fragment out of any leftovers // create a fragment out of any leftovers
if (new->size - size > 256) { if (new->size - size > 256) {
sc_rover = (surfcache_t *) ((byte *) new + size); sc_rover = (surfcache_t *) ((byte *) new + size);
sc_rover->size = new->size - size; sc_rover->size = new->size - 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)
{ {