- fixed watcom build
[dosdemo] / src / polytmpl.h
index 2147666..f36b288 100644 (file)
@@ -69,7 +69,7 @@ static uint32_t SCANEDGE(struct pvertex *v0, struct pvertex *v1, struct pvertex
 
 void POLYFILL(struct pvertex *pv, int nverts)
 {
-       int i;
+       int i, winding;
        int topidx = 0, botidx = 0, sltop = pfill_fb.height, slbot = 0;
        struct pvertex *left, *right;
        uint16_t color;
@@ -93,10 +93,10 @@ void POLYFILL(struct pvertex *pv, int nverts)
                if(pv[i].y > pv[botidx].y) botidx = i;
        }
 
-       int winding = 0;
+       winding = 0;
        for(i=0; i<nverts; i++) {
                int next = NEXTIDX(i);
-               winding += ((pv[next].x - pv[i].x) >> 8) * ((pv[next].y + pv[i].y) >> 8);
+               winding += ((pv[next].x - pv[i].x) >> 4) * ((pv[next].y + pv[i].y) >> 4);
        }
 
        /* +1 to avoid crashing due to off-by-one rounding errors in the rasterization */
@@ -143,8 +143,10 @@ void POLYFILL(struct pvertex *pv, int nverts)
                        uint32_t res, tmp;
 
                        if(winding < 0) {
+                               // clockwise
                                edge = y0 > y1 ? left : right;
                        } else {
+                               // counter-clockwise
                                edge = y0 > y1 ? right : left;
                        }
                        res = SCANEDGE(pv + i, pv + next, edge);