version 1.1 | | version 1.2 |
---|
| | |
/// tmap_scanline_per - Pentium-Pro-optimized assembly version | | /// tmap_scanline_per - Pentium-Pro-optimized assembly version |
/// written by Brian Raiter, Mar 1998. | | /// written by Brian Raiter, Mar 1998. |
| | /// lighting roundoff error fixed by Matt Mueller, July 1999 |
| | |
/// The gist of the algorithm is as follows (note that this is | | /// The gist of the algorithm is as follows (note that this is |
/// pseudocode, not actual C): | | /// pseudocode, not actual C): |
| | |
// divided by 256 so that the byte needed for the fade table offset | | // divided by 256 so that the byte needed for the fade table offset |
// will be aligned. | | // will be aligned. |
| | |
| | //Dividing by 256 is bad.. rounding errors and crap. We'll now do that |
| | //right before we need to access the table instead. -MM |
| | |
movl (_fx_l), %edx | | movl (_fx_l), %edx |
sarl $8, %edx | | // sarl $8, %edx |
movl %edx, (l) | | movl %edx, (l) |
movl (_fx_dl_dx), %edx | | movl (_fx_dl_dx), %edx |
sarl $6, %edx | | // sarl $6, %edx |
| | sall $2, %edx |
movl %edx, (dldx) | | movl %edx, (dldx) |
| | |
// Store pixptr, the pointer to our 64x64 texture map, in %esi. Store | | // Store pixptr, the pointer to our 64x64 texture map, in %esi. Store |
| | |
movl (dldx), %ecx | | movl (dldx), %ecx |
addl %ebp, %ecx | | addl %ebp, %ecx |
movl %ecx, (l) | | movl %ecx, (l) |
//edited 05/14/99 Matt Mueller - original glitches in really dark places, so changed from 0xFF00 to 0x7F00 to eliminate invalid values | | sarl $8, %ebp |
andl $0x7F00, %ebp | | andl $0x7F00, %ebp |
//end edit -MM | | |
movb fadetbl(%edx,%ebp), %dl // 0 e | | movb fadetbl(%edx,%ebp), %dl // 0 e |
| | |
movl (vbyz4), %ebx | | movl (vbyz4), %ebx |
| | |
cmpb $255, %dl // 0 e | | cmpb $255, %dl // 0 e |
sbbb %ah, %ah // 0 f | | sbbb %ah, %ah // 0 f |
movl %ecx, (l) | | movl %ecx, (l) |
//edited 05/14/99 Matt Mueller - original glitches in really dark places, so changed from 0xFF00 to 0x7F00 to eliminate invalid values | | sarl $8, %ebp |
andl $0x7F00, %ebp | | andl $0x7F00, %ebp |
//end edit -MM | | |
movb fadetbl(%edx,%ebp), %dl // 0 g | | movb fadetbl(%edx,%ebp), %dl // 0 g |
movb (%edi), %al // 0 h | | movb (%edi), %al // 0 h |
xorb %al, %dl // 0 i | | xorb %al, %dl // 0 i |
| | |
| | |
DoFPCalcs | | DoFPCalcs |
movl (l), %ebp | | movl (l), %ebp |
//edited 05/14/99 Matt Mueller - original glitches in really dark places, so changed from 0xFF00 to 0x7F00 to eliminate invalid values | | sarl $8, %ebp |
andl $0x7F00, %ebp | | andl $0x7F00, %ebp |
//end edit -MM | | |
movl (ubyz4), %eax | | movl (ubyz4), %eax |
incl %eax | | incl %eax |
andl $0x3FF0, %eax | | andl $0x3FF0, %eax |