Mercurial > mm7
diff Render.cpp @ 2101:ee2724b9ca05
RasterLine2D fix and etc.
author | Ritor1 |
---|---|
date | Mon, 16 Dec 2013 18:43:42 +0600 |
parents | 7810cb3a5fb7 |
children | 0db53678ff48 |
line wrap: on
line diff
--- a/Render.cpp Fri Dec 13 22:19:56 2013 +0600 +++ b/Render.cpp Mon Dec 16 18:43:42 2013 +0600 @@ -3561,15 +3561,15 @@ } //----- (004A0BEE) -------------------------------------------------------- -char Render::RasterLine2D(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned __int16 uColor) -{ - unsigned int v8; // ebx@5 - unsigned int v10; // ecx@9 - unsigned int v11; // esi@13 - int v12; // eax@17 +char Render::RasterLine2D(signed int uX, signed int uY, signed int uZ, signed int uW, unsigned __int16 uColor) +{ + signed int v8; // ebx@5 + signed int v10; // ecx@9 + signed int v11; // esi@13 + signed int v12; // eax@17 int v13; // eax@21 int v16; // eax@27 - signed __int64 v19; // qax@41 + signed int v19; // qax@41 int v20; // edi@41 unsigned int v21; // edi@46 int v22; // esi@47 @@ -3591,28 +3591,29 @@ int uZa; // [sp+2Ch] [bp+10h]@38 v36 = 0i64; - if ( (signed int)uX < this->raster_clip_x ) + if ( uX < this->raster_clip_x )// x выходит за рамки левой границы HIDWORD(v36) = 8; - if ( (signed int)uX > this->raster_clip_z ) + if ( uX > this->raster_clip_z )// x выходит за рамки правой границы HIDWORD(v36) |= 4; + if ( uZ < this->raster_clip_x )// z выходит за рамки левой границы + LODWORD(v36) = 8; + if ( uZ > this->raster_clip_z )// z выходит за рамки правой границы + LODWORD(v36) |= 4; + + if ( uY < this->raster_clip_y )// y выходит за рамки верхней границы + HIDWORD(v36) |= 2; + if ( uY > this->raster_clip_w )// y выходит за рамки нижней границы + HIDWORD(v36) |= 1; + + if ( uW < this->raster_clip_y )// w выходит за рамки верхней границы + LODWORD(v36) |= 2; + if ( uW > this->raster_clip_w )// w выходит за рамки нижней границы + LODWORD(v36) |= 1; + v8 = uY; - if ( (signed int)uY < this->raster_clip_y ) - HIDWORD(v36) |= 2; - if ( (signed int)uY > this->raster_clip_w ) - HIDWORD(v36) |= 1; - + v11 = uW; v10 = uZ; - if ( (signed int)uZ < this->raster_clip_x ) - LODWORD(v36) = 8; - if ( (signed int)uZ > this->raster_clip_z ) - LODWORD(v36) = v36 | 4; - - v11 = uW; - if ( (signed int)uW < this->raster_clip_y ) - LODWORD(v36) = v36 | 2; - if ( (signed int)uW > this->raster_clip_w ) - LODWORD(v36) = v36 | 1; LOBYTE(v12) = v36; if ( (unsigned int)v36 & HIDWORD(v36) ) @@ -3646,8 +3647,6 @@ v25 = 0; v26 = (unsigned __int16 *)this->pTargetSurface; - int y = 0; - int x = 0; if ( v26 ) { if ( (signed int)uXa <= v23 )//рисуем вертикальную линию @@ -3658,6 +3657,8 @@ v31 = 2 * v24; v32 = 2 * v21; v12 = (int)&v26[v12]; + int y = 0; + int x = 0; for ( v30; v30; --v30 ) { v25 += uXa; @@ -3683,11 +3684,12 @@ else//рисуем горизонтальную линию { v27 = uXa + 1; - int x = 0; if ( (signed int)(uXa + 1) > 0 ) { v28 = 2 * v21; v29 = 2 * v24; + int y = 0; + int x = 0; v12 = (int)&v26[v12]; for ( v27; v27; --v27 ) { @@ -3719,13 +3721,13 @@ { if ( BYTE4(v36) & 8 ) { - v13 = (signed int)((uW - uY) * (this->raster_clip_x - uX)) / (signed int)(uZ - uX); + v13 = ((uW - uY) * (this->raster_clip_x - uX)) / (uZ - uX); v8 = v13 + uY; uX = this->raster_clip_x; goto LABEL_24; } v10 = this->raster_clip_x; - v11 = (signed int)((uY - uW) * (this->raster_clip_x - uZ)) / (signed int)(uX - uZ) + uW; + v11 = ((uY - uW) * (this->raster_clip_x - uZ)) / (uX - uZ) + uW; } LABEL_24: if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 4 ) @@ -3733,28 +3735,30 @@ //v15 = this->raster_clip_z; if ( BYTE4(v36) & 4 ) { - v8 += (signed int)((v11 - v8) * (this->raster_clip_z - uX)) / (signed int)(v10 - uX); + v8 += ((v11 - v8) * (this->raster_clip_z - uX)) / (v10 - uX); uX = this->raster_clip_z; } else { - v16 = (signed int)((v8 - v11) * (this->raster_clip_z - v10)) / (signed int)(uX - v10); + v16 = ((v8 - v11) * (this->raster_clip_z - v10)) / (uX - v10); v10 = this->raster_clip_z; v11 += v16; } } v37 = 0; uYa = this->raster_clip_y; - if ( (signed int)v8 < this->raster_clip_y ) + if ( v8 < this->raster_clip_y ) v37 = 2; - if ( (signed int)v8 > this->raster_clip_w ) + if ( v8 > this->raster_clip_w ) v37 |= 1; - if ( (signed int)v11 >= this->raster_clip_y ) + + if ( v11 >= this->raster_clip_y ) v12 = 0; else v12 = 2; - if ( (signed int)v11 > this->raster_clip_w ) + if ( v11 > this->raster_clip_w ) LOBYTE(v12) = v12 | 1; + if ( !(v12 & v37) ) { v12 ^= v37; @@ -3763,13 +3767,13 @@ { if ( v37 & 2 ) { - uX += (signed int)((v10 - uX) * (uYa - v8)) / (signed int)(v11 - v8); + uX += ((v10 - uX) * (uYa - v8)) / (v11 - v8); LOBYTE(v12) = (char)this; v8 = this->raster_clip_y; } else { - v19 = (signed int)((uX - v10) * (uYa - v11)); + v19 = (uX - v10) * (uYa - v11); v20 = v8 - v11; v11 = uYa; v12 = v19 / v20; @@ -3780,13 +3784,13 @@ { if ( v37 & 1 ) { - uX += (signed int)((v10 - uX) * (this->raster_clip_w - v8)) / (signed int)(v11 - v8); + uX += ((v10 - uX) * (this->raster_clip_w - v8)) / (v11 - v8); LOBYTE(v12) = (char)this; v8 = this->raster_clip_w; } else { - v12 = (signed int)((uX - v10) * (this->raster_clip_w - v11)) / (signed int)(v8 - v11); + v12 = ((uX - v10) * (this->raster_clip_w - v11)) / (v8 - v11); v11 = this->raster_clip_w; v10 += v12; } @@ -7838,7 +7842,7 @@ { if ( *v28 ) { - v20 = *(&a5->pLevelOfDetail0_prolly_alpha_mask[i & a5->uWidthMinus1] + a5->uTextureWidth * (v27 & a5->uHeightMinus1)); + v20 = *(&a5->pLevelOfDetail0_prolly_alpha_mask[x & a5->uWidthMinus1] + a5->uTextureWidth * (v27 & a5->uHeightMinus1)); if ( v20 >= a7 ) { if ( v20 <= a8 )