35 #define DPS_MAXSPANS MAXHEIGHT+1
44 int sfrac, tfrac, light,
zi;
135 byte irtable[256] = { 79, 78, 77, 76, 75, 74, 73, 72,
136 71, 70, 69, 68, 67, 66, 65, 64,
137 64, 65, 66, 67, 68, 69, 70, 71,
138 72, 73, 74, 75, 76, 77, 78, 79,
140 64, 65, 66, 67, 68, 69, 70, 71,
141 72, 73, 74, 75, 76, 77, 78, 79,
142 208, 208, 208, 208, 208, 208, 208, 208,
143 64, 66, 68, 70, 72, 74, 76, 78,
145 64, 65, 66, 67, 68, 69, 70, 71,
146 72, 73, 74, 75, 76, 77, 78, 79,
147 64, 65, 66, 67, 68, 69, 70, 71,
148 72, 73, 74, 75, 76, 77, 78, 79,
150 64, 66, 68, 70, 72, 74, 76, 78,
151 68, 67, 66, 65, 64, 65, 66, 67,
152 68, 69, 70, 71, 72, 73, 74, 75,
153 76, 76, 77, 77, 78, 78, 79, 79,
155 64, 65, 66, 67, 68, 69, 70, 71,
156 72, 73, 74, 75, 76, 77, 78, 79,
157 64, 65, 66, 67, 68, 69, 70, 71,
158 72, 73, 74, 75, 76, 77, 78, 79,
160 64, 65, 66, 67, 68, 69, 70, 71,
161 72, 73, 74, 75, 76, 77, 78, 79,
162 64, 65, 66, 67, 68, 69, 70, 71,
163 72, 73, 74, 75, 76, 77, 78, 79,
165 64, 65, 66, 67, 68, 69, 70, 71,
166 72, 73, 74, 75, 76, 77, 78, 79,
167 64, 65, 66, 67, 68, 69, 70, 71,
168 64, 65, 66, 67, 68, 69, 70, 71,
170 64, 65, 66, 67, 68, 69, 70, 71,
171 72, 73, 74, 75, 76, 77, 78, 79,
172 208, 208, 64, 64, 70, 71, 72, 64,
173 66, 68, 70, 64, 65, 66, 67, 68};
219 if ( !( dv0_ab | dv1_ab ) )
225 if ( !( dv0_ac | dv1_ac ) )
228 d_xdenom = ( dv0_ac * dv1_ab ) - ( dv0_ab * dv1_ac );
345 x = floor(numer / denom);
347 r = (
int)floor(numer - (
x * denom));
354 x = floor(-numer / denom);
356 r = (
int)floor(-numer - (
x * denom));
385 tm = endvertu - startvertu;
386 tn = endvertv - startvertv;
388 if (((tm <= 16) && (tm >= -15)) &&
389 ((tn <= 16) && (tn >= -15)))
391 ptemp = &
adivtab[((tm+15) << 5) + (tn+15)];
414 #if id386 && !defined __linux__ && !defined __FreeBSD__
417 static float xstepdenominv, ystepdenominv, t0, t1;
418 static float p01_minus_p21, p11_minus_p21, p00_minus_p20, p10_minus_p20;
419 static float one = 1.0F, negative_one = -1.0F;
420 static unsigned long t0_int, t1_int;
422 extern unsigned long fpu_sp24_ceil_cw, fpu_ceil_cw, fpu_chop_cw;
431 __asm mov eax, dword ptr [
r_p0+0]
432 __asm mov ebx, dword ptr [
r_p0+4]
433 __asm sub eax, dword ptr [
r_p2+0]
434 __asm sub ebx, dword ptr [
r_p2+4]
435 __asm mov p00_minus_p20, eax
436 __asm mov p01_minus_p21, ebx
437 __asm fild dword ptr p00_minus_p20
438 __asm fild dword ptr p01_minus_p21
439 __asm mov eax, dword ptr [
r_p1+0]
440 __asm mov ebx, dword ptr [
r_p1+4]
441 __asm sub eax, dword ptr [
r_p2+0]
442 __asm sub ebx, dword ptr [
r_p2+4]
443 __asm fstp p01_minus_p21
444 __asm fstp p00_minus_p20
445 __asm mov p10_minus_p20, eax
446 __asm mov p11_minus_p21, ebx
447 __asm fild dword ptr p10_minus_p20
448 __asm fild dword ptr p11_minus_p21
449 __asm fstp p11_minus_p21
450 __asm fstp p10_minus_p20
461 __asm fldcw word ptr [fpu_sp24_ceil_cw]
466 __asm fst xstepdenominv ;
467 __asm fmul negative_one ; -( 1 /
d_xdenom )
480 __asm mov eax, dword ptr [
r_p0+16]
481 __asm mov ebx, dword ptr [
r_p1+16]
482 __asm sub eax, dword ptr [
r_p2+16]
483 __asm sub ebx, dword ptr [
r_p2+16]
485 __asm fstp ystepdenominv ; (empty)
487 __asm mov t0_int, eax
488 __asm mov t1_int, ebx
489 __asm fild t0_int ; t0
490 __asm fild t1_int ; t1 | t0
491 __asm fxch
st(1) ; t0 | t1
494 __asm fmul p01_minus_p21 ; t1 * p01_minus_p21
495 __asm fld t0 ; t0 | t1 * p01_minus_p21
496 __asm fmul p11_minus_p21 ; t0 * p11_minus_p21 | t1 * p01_minus_p21
497 __asm fld t1 ; t1 | t0 * p11_minus_p21 | t1 * p01_minus_p21
498 __asm fmul p00_minus_p20 ; t1 * p00_minus_p20 | t0 * p11_minus_p21 | t1 * p01_minus_p21
499 __asm fld t0 ; t0 | t1 * p00_minus_p20 | t0 * p11_minus_p21 | t1 * p01_minus_p21
500 __asm fmul p10_minus_p20 ; t0 * p10_minus_p20 | t1 * p00_minus_p20 | t0 * p11_minus_p21 | t1 * p01_minus_p21
501 __asm fxch
st(2) ; t0 * p11_minus_p21 | t0 * p10_minus_p20 | t1 * p00_minus_p20 | t1 * p01_minus_p21
502 __asm fsubp
st(3),
st ; t0 * p10_minus_p20 | t1 * p00_minus_p20 | t1 * p01_minus_p21 - t0 * p11_minus_p21
503 __asm fsubrp
st(1),
st ; t1 * p00_minus_p20 - t0 * p10_minus_p20 | t1 * p01_minus_p21 - t0 * p11_minus_p21
504 __asm fxch
st(1) ; t1 * p01_minus_p21 - t0 * p11_minus_p21 | t1 * p00_minus_p20 - t0 * p10_minus_p20
505 __asm fmul xstepdenominv ;
r_lstepx | t1 * p00_minus_p20 - t0 * p10_minus_p20
515 __asm fldcw word ptr [fpu_chop_cw]
525 __asm mov eax, dword ptr [
r_p0+8]
526 __asm mov ebx, dword ptr [
r_p1+8]
527 __asm sub eax, dword ptr [
r_p2+8]
528 __asm sub ebx, dword ptr [
r_p2+8]
529 __asm mov t0_int, eax
530 __asm mov t1_int, ebx
531 __asm fild t0_int ; t0
532 __asm fild t1_int ; t1 | t0
533 __asm fxch
st(1) ; t0 | t1
535 __asm fst t1 ; (empty)
537 __asm fmul p01_minus_p21 ; t1 * p01_minus_p21
538 __asm fld t0 ; t0 | t1 * p01_minus_p21
539 __asm fmul p11_minus_p21 ; t0 * p11_minus_p21 | t1 * p01_minus_p21
540 __asm fld t1 ; t1 | t0 * p11_minus_p21 | t1 * p01_minus_p21
541 __asm fmul p00_minus_p20 ; t1 * p00_minus_p20 | t0 * p11_minus_p21 | t1 * p01_minus_p21
542 __asm fld t0 ; t0 | t1 * p00_minus_p20 | t0 * p11_minus_p21 | t1 * p01_minus_p21
543 __asm fmul p10_minus_p20 ; t0 * p10_minus_p20 | t1 * p00_minus_p20 | t0 * p11_minus_p21 | t1 * p01_minus_p21
544 __asm fxch
st(2) ; t0 * p11_minus_p21 | t0 * p10_minus_p20 | t1 * p00_minus_p20 | t1 * p01_minus_p21
545 __asm fsubp
st(3),
st ; t0 * p10_minus_p20 | t1 * p00_minus_p20 | t1 * p01_minus_p21 - t0 * p11_minus_p21
546 __asm fsubrp
st(1),
st ; t1 * p00_minus_p20 - t0 * p10_minus_p20 | t1 * p01_minus_p21 - t0 * p11_minus_p21
547 __asm fxch
st(1) ; t1 * p01_minus_p21 - t0 * p11_minus_p21 | t1 * p00_minus_p20 - t0 * p10_minus_p20
548 __asm fmul xstepdenominv ;
r_lstepx | t1 * p00_minus_p20 - t0 * p10_minus_p20
563 __asm mov eax, dword ptr [
r_p0+12]
564 __asm mov ebx, dword ptr [
r_p1+12]
565 __asm sub eax, dword ptr [
r_p2+12]
566 __asm sub ebx, dword ptr [
r_p2+12]
568 __asm mov t0_int, eax
569 __asm mov t1_int, ebx
570 __asm fild t0_int ; t0
571 __asm fild t1_int ; t1 | t0
572 __asm fxch
st(1) ; t0 | t1
574 __asm fst t1 ; (empty)
576 __asm fmul p01_minus_p21 ; t1 * p01_minus_p21
577 __asm fld t0 ; t0 | t1 * p01_minus_p21
578 __asm fmul p11_minus_p21 ; t0 * p11_minus_p21 | t1 * p01_minus_p21
579 __asm fld t1 ; t1 | t0 * p11_minus_p21 | t1 * p01_minus_p21
580 __asm fmul p00_minus_p20 ; t1 * p00_minus_p20 | t0 * p11_minus_p21 | t1 * p01_minus_p21
581 __asm fld t0 ; t0 | t1 * p00_minus_p20 | t0 * p11_minus_p21 | t1 * p01_minus_p21
582 __asm fmul p10_minus_p20 ; t0 * p10_minus_p20 | t1 * p00_minus_p20 | t0 * p11_minus_p21 | t1 * p01_minus_p21
583 __asm fxch
st(2) ; t0 * p11_minus_p21 | t0 * p10_minus_p20 | t1 * p00_minus_p20 | t1 * p01_minus_p21
584 __asm fsubp
st(3),
st ; t0 * p10_minus_p20 | t1 * p00_minus_p20 | t1 * p01_minus_p21 - t0 * p11_minus_p21
585 __asm fsubrp
st(1),
st ; t1 * p00_minus_p20 - t0 * p10_minus_p20 | t1 * p01_minus_p21 - t0 * p11_minus_p21
586 __asm fxch
st(1) ; t1 * p01_minus_p21 - t0 * p11_minus_p21 | t1 * p00_minus_p20 - t0 * p10_minus_p20
587 __asm fmul xstepdenominv ;
r_lstepx | t1 * p00_minus_p20 - t0 * p10_minus_p20
602 __asm mov eax, dword ptr [
r_p0+20]
603 __asm mov ebx, dword ptr [
r_p1+20]
604 __asm sub eax, dword ptr [
r_p2+20]
605 __asm sub ebx, dword ptr [
r_p2+20]
607 __asm mov t0_int, eax
608 __asm mov t1_int, ebx
609 __asm fild t0_int ; t0
610 __asm fild t1_int ; t1 | t0
611 __asm fxch
st(1) ; t0 | t1
613 __asm fst t1 ; (empty)
615 __asm fmul p01_minus_p21 ; t1 * p01_minus_p21
616 __asm fld t0 ; t0 | t1 * p01_minus_p21
617 __asm fmul p11_minus_p21 ; t0 * p11_minus_p21 | t1 * p01_minus_p21
618 __asm fld t1 ; t1 | t0 * p11_minus_p21 | t1 * p01_minus_p21
619 __asm fmul p00_minus_p20 ; t1 * p00_minus_p20 | t0 * p11_minus_p21 | t1 * p01_minus_p21
620 __asm fld t0 ; t0 | t1 * p00_minus_p20 | t0 * p11_minus_p21 | t1 * p01_minus_p21
621 __asm fmul p10_minus_p20 ; t0 * p10_minus_p20 | t1 * p00_minus_p20 | t0 * p11_minus_p21 | t1 * p01_minus_p21
622 __asm fxch
st(2) ; t0 * p11_minus_p21 | t0 * p10_minus_p20 | t1 * p00_minus_p20 | t1 * p01_minus_p21
623 __asm fsubp
st(3),
st ; t0 * p10_minus_p20 | t1 * p00_minus_p20 | t1 * p01_minus_p21 - t0 * p11_minus_p21
624 __asm fsubrp
st(1),
st ; t1 * p00_minus_p20 - t0 * p10_minus_p20 | t1 * p01_minus_p21 - t0 * p11_minus_p21
625 __asm fxch
st(1) ; t1 * p01_minus_p21 - t0 * p11_minus_p21 | t1 * p00_minus_p20 - t0 * p10_minus_p20
626 __asm fmul xstepdenominv ;
r_lstepx | t1 * p00_minus_p20 - t0 * p10_minus_p20
646 __asm jne translucent
650 __asm jmp done_with_steps
653 __asm and eax, 0ffffh
654 __asm and ebx, 0ffffh
675 float xstepdenominv, ystepdenominv, t0, t1;
676 float p01_minus_p21, p11_minus_p21, p00_minus_p20, p10_minus_p20;
683 xstepdenominv = 1.0 / (float)
d_xdenom;
685 ystepdenominv = -xstepdenominv;
693 ceil((t1 * p01_minus_p21 - t0 * p11_minus_p21) * xstepdenominv);
695 ceil((t1 * p00_minus_p20 - t0 * p10_minus_p20) * ystepdenominv);
699 r_sstepx = (
int)((t1 * p01_minus_p21 - t0 * p11_minus_p21) *
701 r_sstepy = (
int)((t1 * p00_minus_p20 - t0* p10_minus_p20) *
706 r_tstepx = (
int)((t1 * p01_minus_p21 - t0 * p11_minus_p21) *
708 r_tstepy = (
int)((t1 * p00_minus_p20 - t0 * p10_minus_p20) *
713 r_zistepx = (
int)((t1 * p01_minus_p21 - t0 * p11_minus_p21) *
715 r_zistepy = (
int)((t1 * p00_minus_p20 - t0 * p10_minus_p20) *
772 lpdest = pspanpackage->
pdest;
773 lptex = pspanpackage->
ptex;
774 lpz = pspanpackage->
pz;
775 lsfrac = pspanpackage->
sfrac;
776 ltfrac = pspanpackage->
tfrac;
777 llight = pspanpackage->
light;
778 lzi = pspanpackage->
zi;
782 if ((lzi >> 16) >= *lpz)
788 *lpdest = ((
byte *)
vid.
colormap)[*lptex + (llight & 0xFF00)];
799 lptex += lsfrac >> 16;
802 if (ltfrac & 0x10000)
811 }
while (pspanpackage->
count != -999999);
847 lpdest = pspanpackage->
pdest;
848 lptex = pspanpackage->
ptex;
849 lpz = pspanpackage->
pz;
850 lsfrac = pspanpackage->
sfrac;
851 ltfrac = pspanpackage->
tfrac;
852 llight = pspanpackage->
light;
853 lzi = pspanpackage->
zi;
857 if ((lzi >> 16) >= *lpz)
859 int temp =
vid.
colormap[*lptex + ( llight & 0xFF00 )];
869 lptex += lsfrac >> 16;
872 if (ltfrac & 0x10000)
881 }
while (pspanpackage->
count != -999999);
908 lpdest = pspanpackage->
pdest;
909 lpz = pspanpackage->
pz;
910 lzi = pspanpackage->
zi;
914 if ((lzi >> 16) >= *lpz)
925 }
while (pspanpackage->
count != -999999);
955 lpdest = pspanpackage->
pdest;
956 lptex = pspanpackage->
ptex;
957 lpz = pspanpackage->
pz;
958 lsfrac = pspanpackage->
sfrac;
959 ltfrac = pspanpackage->
tfrac;
960 llight = pspanpackage->
light;
961 lzi = pspanpackage->
zi;
965 if ((lzi >> 16) >= *lpz)
967 int temp =
vid.
colormap[*lptex + ( llight & 0xFF00 )];
978 lptex += lsfrac >> 16;
981 if (ltfrac & 0x10000)
990 }
while (pspanpackage->
count != -999999);
1017 lpdest = pspanpackage->
pdest;
1018 lpz = pspanpackage->
pz;
1019 lzi = pspanpackage->
zi;
1023 if ((lzi >> 16) >= *lpz)
1034 }
while (pspanpackage->
count != -999999);
1066 lpdest = pspanpackage->
pdest;
1067 lptex = pspanpackage->
ptex;
1068 lpz = pspanpackage->
pz;
1069 lsfrac = pspanpackage->
sfrac;
1070 ltfrac = pspanpackage->
tfrac;
1071 llight = pspanpackage->
light;
1072 lzi = pspanpackage->
zi;
1076 if ((lzi >> 16) >= *lpz)
1082 *lpdest = ((
byte *)
vid.
colormap)[*lptex + (llight & 0xFF00)];
1092 lptex += lsfrac >> 16;
1095 if (ltfrac & 0x10000)
1104 }
while (pspanpackage->
count != -999999);
1127 lcount = pspanpackage->
count;
1134 lpdest = pspanpackage->
pdest;
1153 int initialleftheight, initialrightheight;
1154 int *plefttop, *prighttop, *pleftbottom, *prightbottom;
1155 int working_lstepx, originalcount;
1163 initialleftheight = pleftbottom[1] - plefttop[1];
1164 initialrightheight = prightbottom[1] - prighttop[1];
1189 d_sfrac = (plefttop[2] & 0xFFFF) << 16;
1190 d_tfrac = (plefttop[3] & 0xFFFF) << 16;
1196 d_sfrac = plefttop[2] & 0xFFFF;
1197 d_tfrac = plefttop[3] & 0xFFFF;
1207 if (initialleftheight == 1)
1226 pleftbottom[0], pleftbottom[1]);
1319 plefttop = pleftbottom;
1322 height = pleftbottom[1] - plefttop[1];
1357 pleftbottom[0], pleftbottom[1]);
1444 prightbottom[0], prightbottom[1]);
1457 pstart =
a_spans + initialrightheight;
1458 pstart->
count = originalcount;
1462 prighttop = prightbottom;
1465 height = prightbottom[1] - prighttop[1];
1468 prightbottom[0], prightbottom[1]);
1473 (*d_pdrawspans) (pstart);
1531 edgetableindex += 2;
1534 edgetableindex += 4;