24 #define DPS_MAXSPANS MAXHEIGHT+1
32 int sfrac, tfrac, light,
zi;
122 if (!(dv0_ab | dv1_ab))
128 if (!(dv0_ac | dv1_ac))
131 d_xdenom = (dv0_ac * dv1_ab) - (dv0_ab * dv1_ac);
232 static void FloorDivMod(
float numer,
float denom,
int *quotient,
int *rem)
238 x = floor(numer / denom);
240 r = (
int)floor(numer - (x * denom));
245 x = floor(-numer / denom);
247 r = (
int)floor(-numer - (x * denom));
265 fixed8_t endvertu, fixed8_t endvertv)
273 tm = endvertu - startvertu;
274 tn = endvertv - startvertv;
276 if (((tm <= 16) && (tm >= -15)) &&
277 ((tn <= 16) && (tn >= -15))) {
278 ptemp = &
adivtab[((tm + 15) << 5) + (tn + 15)];
299 float xstepdenominv, ystepdenominv, t0, t1;
300 float p01_minus_p21, p11_minus_p21, p00_minus_p20, p10_minus_p20;
307 xstepdenominv = 1.0 / (float)
d_xdenom;
309 ystepdenominv = -xstepdenominv;
317 ceil((t1 * p01_minus_p21 - t0 * p11_minus_p21) * xstepdenominv);
319 ceil((t1 * p00_minus_p20 - t0 * p10_minus_p20) * ystepdenominv);
323 r_sstepx = (
int)((t1 * p01_minus_p21 - t0 * p11_minus_p21) *
325 r_sstepy = (
int)((t1 * p00_minus_p20 - t0 * p10_minus_p20) *
330 r_tstepx = (
int)((t1 * p01_minus_p21 - t0 * p11_minus_p21) *
332 r_tstepy = (
int)((t1 * p00_minus_p20 - t0 * p10_minus_p20) *
337 r_zistepx = (
int)((t1 * p01_minus_p21 - t0 * p11_minus_p21) *
339 r_zistepy = (
int)((t1 * p00_minus_p20 - t0 * p10_minus_p20) *
371 lpdest = pspanpackage->
pdest;
372 lptex = pspanpackage->
ptex;
373 lpz = pspanpackage->
pz;
374 lsfrac = pspanpackage->
sfrac;
375 ltfrac = pspanpackage->
tfrac;
376 llight = pspanpackage->
light;
377 lzi = pspanpackage->
zi;
380 if ((lzi >> 16) >= *lpz) {
384 if (tmp[0] > 255) tmp[0] = 255;
385 if (tmp[1] > 255) tmp[1] = 255;
386 if (tmp[2] > 255) tmp[2] = 255;
387 tmp[0] = (lptex[0] * tmp[0]) >> 8;
388 tmp[1] = (lptex[1] * tmp[1]) >> 8;
389 tmp[2] = (lptex[2] * tmp[2]) >> 8;
404 if (ltfrac & 0x10000) {
412 }
while (pspanpackage->
count != -999999);
434 lpdest = pspanpackage->
pdest;
435 lpz = pspanpackage->
pz;
436 lzi = pspanpackage->
zi;
439 if ((lzi >> 16) >= *lpz) {
451 }
while (pspanpackage->
count != -999999);
478 lpdest = pspanpackage->
pdest;
479 lptex = pspanpackage->
ptex;
480 lpz = pspanpackage->
pz;
481 lsfrac = pspanpackage->
sfrac;
482 ltfrac = pspanpackage->
tfrac;
483 llight = pspanpackage->
light;
484 lzi = pspanpackage->
zi;
487 if ((lzi >> 16) >= *lpz) {
491 if (tmp[0] > 255) tmp[0] = 255;
492 if (tmp[1] > 255) tmp[1] = 255;
493 if (tmp[2] > 255) tmp[2] = 255;
494 lpdest[0] = (lptex[2] * tmp[2]) >> 8;
495 lpdest[1] = (lptex[1] * tmp[1]) >> 8;
496 lpdest[2] = (lptex[0] * tmp[0]) >> 8;
508 if (ltfrac & 0x10000) {
516 }
while (pspanpackage->
count != -999999);
524 height = pleftbottom[1] - plefttop[1];
525 ystart = plefttop[1];
529 d_sfrac = plefttop[2] & 0xFFFF;
530 d_tfrac = plefttop[3] & 0xFFFF;
553 pleftbottom[0], pleftbottom[1]);
597 int initialrightheight;
598 int *plefttop, *prighttop, *pleftbottom, *prightbottom;
608 initialrightheight = prightbottom[1] - prighttop[1];
633 plefttop = pleftbottom;
646 prightbottom[0], prightbottom[1]);
658 pstart =
a_spans + initialrightheight;
659 pstart->
count = originalcount;
663 prighttop = prightbottom;
666 height = prightbottom[1] - prighttop[1];
669 prightbottom[0], prightbottom[1]);
673 (*d_pdrawspans)(pstart);