removed clang-format and clang_complete files from the repo
[dosdemo] / src / 3dgfx / polytmpl.h
index 01bbd01..f601623 100644 (file)
@@ -13,7 +13,7 @@ static uint32_t SCANEDGE(struct pvertex *v0, struct pvertex *v1, struct pvertex
        int32_t u, v, du, dv, uslope, vslope;
 #endif
 #ifdef ZBUF
-       int z, dz, zslope;
+       int32_t z, dz, zslope;
 #endif
        int32_t start_idx, end_idx;
 
@@ -101,9 +101,6 @@ void POLYFILL(struct pvertex *pv, int nverts)
 #if defined(GOURAUD) || defined(TEXMAP) || defined(ZBUF)
        int mid;
        int32_t dx, tmp;
-#else
-       /* flat version, just pack the color now */
-       color = G3D_PACK_RGB(pv[0].r, pv[0].g, pv[0].b);
 #endif
 #ifdef GOURAUD
        int32_t r, g, b, dr, dg, db, rslope, gslope, bslope;
@@ -115,7 +112,12 @@ void POLYFILL(struct pvertex *pv, int nverts)
        int32_t u, v, du, dv, uslope, vslope;
 #endif
 #ifdef ZBUF
-       int z, dz, zslope;
+       int32_t z, dz, zslope;
+#endif
+
+#if !defined(GOURAUD) && !defined(TEXMAP)
+       /* flat version, just pack the color now */
+       color = G3D_PACK_RGB(pv[0].r, pv[0].g, pv[0].b);
 #endif
 
        for(i=1; i<nverts; i++) {
@@ -300,6 +302,9 @@ void POLYFILL(struct pvertex *pv, int nverts)
 
                /* go across the scanline interpolating if necessary */
                while(x <= right[i].x) {
+                       /*if(x == (180 << 8) && i == 174) {
+                               asm("int $3");
+                       }*/
 #if defined(GOURAUD) || defined(TEXMAP) || defined(BLEND_ALPHA) || defined(BLEND_ADD)
                        int cr, cg, cb;
 #endif
@@ -311,11 +316,11 @@ void POLYFILL(struct pvertex *pv, int nverts)
 #endif
 
 #ifdef ZBUF
-                       int cz = z;
+                       int32_t cz = z;
                        z += zslope;
 
                        if(z <= *zptr) {
-                               *zptr = z;
+                               *zptr++ = z;
                        } else {
 #ifdef GOURAUD
                                r += rslope;
@@ -329,9 +334,12 @@ void POLYFILL(struct pvertex *pv, int nverts)
                                u += uslope;
                                v += vslope;
 #endif
-                               goto skip_pixel;
+                               /* skip pixel */
+                               pixptr++;
+                               zptr++;
+                               x += 256;
+                               continue;
                        }
-                       zptr++;
 #endif
 
 #ifdef GOURAUD
@@ -407,9 +415,6 @@ void POLYFILL(struct pvertex *pv, int nverts)
                        color = G3D_PACK_RGB(cr, cg, cb);
 #endif
 
-#ifdef ZBUF
-skip_pixel:
-#endif
 #ifdef DEBUG_OVERDRAW
                        *pixptr++ += DEBUG_OVERDRAW;
 #else