Mercurial > mm7
comparison Render.cpp @ 2198:d9caf2b3d8d5
draw FlyAction and WaterWalk icons
author | Ritor1 |
---|---|
date | Sun, 02 Feb 2014 00:10:40 +0600 |
parents | d0e321190c86 |
children | 3445abad44c5 |
comparison
equal
deleted
inserted
replaced
2197:42c8807225a2 | 2198:d9caf2b3d8d5 |
---|---|
3656 } | 3656 } |
3657 | 3657 |
3658 //----- (004A0BEE) -------------------------------------------------------- | 3658 //----- (004A0BEE) -------------------------------------------------------- |
3659 void Render::RasterLine2D(signed int uX, signed int uY, signed int uZ, signed int uW, unsigned __int16 uColor) | 3659 void Render::RasterLine2D(signed int uX, signed int uY, signed int uZ, signed int uW, unsigned __int16 uColor) |
3660 { | 3660 { |
3661 signed int v12; // eax@17 | 3661 signed int lower_bound; // eax@17 |
3662 signed int left_bound; | |
3662 //signed int v19; // qax@41 | 3663 //signed int v19; // qax@41 |
3663 //int v20; // edi@41 | 3664 //int v20; // edi@41 |
3664 unsigned int v21; // edi@46 | 3665 unsigned int v21; // edi@46 |
3665 int v22; // esi@47 | 3666 int v22; // esi@47 |
3666 int v23; // ebx@47 | 3667 int v23; // ebx@47 |
3672 int v29; // edx@55 | 3673 int v29; // edx@55 |
3673 int v30; // ebx@60 | 3674 int v30; // ebx@60 |
3674 int v31; // edx@61 | 3675 int v31; // edx@61 |
3675 int v32; // edi@61 | 3676 int v32; // edi@61 |
3676 __int64 v36; // [sp+14h] [bp-8h]@1 | 3677 __int64 v36; // [sp+14h] [bp-8h]@1 |
3677 signed int v37; // [sp+18h] [bp-4h]@28 | 3678 signed int upper_bound; // [sp+18h] [bp-4h]@28 |
3678 unsigned int uXa; // [sp+24h] [bp+8h]@49 | 3679 unsigned int uXa; // [sp+24h] [bp+8h]@49 |
3679 //unsigned int uYa; // [sp+28h] [bp+Ch]@28 | 3680 //unsigned int uYa; // [sp+28h] [bp+Ch]@28 |
3680 int uYb; // [sp+28h] [bp+Ch]@47 | 3681 int uYb; // [sp+28h] [bp+Ch]@47 |
3681 //int uZa; // [sp+2Ch] [bp+10h]@38 | 3682 //int uZa; // [sp+2Ch] [bp+10h]@38 |
3682 bool left_border; | 3683 bool left_border; |
3710 { | 3711 { |
3711 LABEL_46: | 3712 LABEL_46: |
3712 v21 = pRenderer->uTargetSurfacePitch; | 3713 v21 = pRenderer->uTargetSurfacePitch; |
3713 if ( pRenderer->uTargetSurfacePitch ) | 3714 if ( pRenderer->uTargetSurfacePitch ) |
3714 { | 3715 { |
3715 v12 = uX + uY * pRenderer->uTargetSurfacePitch; | 3716 //v12 = uX + uY * pRenderer->uTargetSurfacePitch; |
3716 v22 = uW - uY; | 3717 v22 = uW - uY; |
3717 v23 = v22; | 3718 v23 = v22; |
3718 uYb = v22; | 3719 uYb = v22; |
3719 if ( v22 < 0 ) | 3720 if ( v22 < 0 ) |
3720 { | 3721 { |
3742 v30 = v23 + 1; | 3743 v30 = v23 + 1; |
3743 if ( v30 > 0 ) | 3744 if ( v30 > 0 ) |
3744 { | 3745 { |
3745 v31 = 2 * v24; | 3746 v31 = 2 * v24; |
3746 v32 = 2 * v21; | 3747 v32 = 2 * v21; |
3747 v12 = (int)&v26[v12]; | 3748 //v12 = (int)&v26[v12]; |
3748 int y = 0; | 3749 int y = 0; |
3749 int x = 0; | 3750 int x = 0; |
3750 for ( v30; v30; --v30 ) | 3751 for ( v30; v30; --v30 ) |
3751 { | 3752 { |
3752 v25 += uXa; | 3753 v25 += uXa; |
3776 { | 3777 { |
3777 v28 = 2 * v21; | 3778 v28 = 2 * v21; |
3778 v29 = 2 * v24; | 3779 v29 = 2 * v24; |
3779 int y = 0; | 3780 int y = 0; |
3780 int x = 0; | 3781 int x = 0; |
3781 v12 = (int)&v26[v12]; | 3782 //v12 = (int)&v26[v12]; |
3782 for ( v27; v27; --v27 ) | 3783 for ( v27; v27; --v27 ) |
3783 { | 3784 { |
3784 v25 += uYb; | 3785 v25 += uYb; |
3785 //*(short *)v12 = uColor; | 3786 //*(short *)v12 = uColor; |
3786 //v12 += v29; | 3787 //v12 += v29; |
3804 } | 3805 } |
3805 } | 3806 } |
3806 return; | 3807 return; |
3807 } | 3808 } |
3808 | 3809 |
3809 if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 8 )//левая и | 3810 if ( (BYTE4(v36) ^ (unsigned __int8)v36) & 8 )//for left and right(левая и правая) |
3810 { | 3811 { |
3811 if ( BYTE4(v36) & 8 )//left_border = true; | 3812 if ( BYTE4(v36) & 8 )//left_border = true; |
3812 { | 3813 { |
3813 uY += ((uW - uY) * (this->raster_clip_x - uX)) / (uZ - uX); | 3814 uY += ((uW - uY) * (this->raster_clip_x - uX)) / (uZ - uX); |
3814 uX = this->raster_clip_x; | 3815 uX = this->raster_clip_x; |
3827 uX = this->raster_clip_z; | 3828 uX = this->raster_clip_z; |
3828 } | 3829 } |
3829 else | 3830 else |
3830 { | 3831 { |
3831 uW += ((uY - uW) * (this->raster_clip_z - uZ)) / (uX - uZ); | 3832 uW += ((uY - uW) * (this->raster_clip_z - uZ)) / (uX - uZ); |
3832 uY = this->raster_clip_z; | 3833 uZ = this->raster_clip_z; |
3833 } | 3834 } |
3834 } | 3835 } |
3835 v37 = 0; | 3836 |
3837 upper_bound = 0; | |
3836 if ( uY < this->raster_clip_y ) | 3838 if ( uY < this->raster_clip_y ) |
3837 v37 = 2; | 3839 upper_bound = 2; |
3838 if ( uY > this->raster_clip_w ) | 3840 if ( uY > this->raster_clip_w ) |
3839 v37 |= 1; | 3841 upper_bound |= 1; |
3840 | 3842 |
3841 if ( uW >= this->raster_clip_y ) | 3843 lower_bound = 0; |
3842 v12 = 0; | 3844 if ( uW < this->raster_clip_y ) |
3843 else | 3845 lower_bound = 2; |
3844 v12 = 2; | |
3845 if ( uW > this->raster_clip_w ) | 3846 if ( uW > this->raster_clip_w ) |
3846 v12 |= 1; | 3847 lower_bound |= 1; |
3847 | 3848 |
3848 if ( !(v12 & v37) ) | 3849 if ( !(lower_bound & upper_bound) )//for up and down(для верха и низа) |
3849 { | 3850 { |
3850 v12 ^= v37; | 3851 lower_bound ^= upper_bound; |
3851 if ( v12 & 2 ) | 3852 if ( lower_bound & 2 ) |
3852 { | 3853 { |
3853 if ( v37 & 2 ) | 3854 if ( upper_bound & 2 ) |
3854 { | 3855 { |
3855 uX += ((uZ - uX) * (this->raster_clip_y - uY)) / (uW - uY); | 3856 uX += ((uZ - uX) * (this->raster_clip_y - uY)) / (uW - uY); |
3856 uY = this->raster_clip_y; | 3857 uY = this->raster_clip_y; |
3857 } | 3858 } |
3858 else | 3859 else |
3859 { | 3860 { |
3860 uZ += (uX - uZ) * (this->raster_clip_y - uW) / (uY - uW); | 3861 uZ += (uX - uZ) * (this->raster_clip_y - uW) / (uY - uW); |
3861 uW = this->raster_clip_y; | 3862 uW = this->raster_clip_y; |
3862 } | 3863 } |
3863 } | 3864 } |
3864 if ( v12 & 1 ) | 3865 if ( lower_bound & 1 ) |
3865 { | 3866 { |
3866 if ( v37 & 1 ) | 3867 if ( upper_bound & 1 ) |
3867 { | 3868 { |
3868 uX += ((uZ - uX) * (this->raster_clip_w - uY)) / (uW - uY); | 3869 uX += ((uZ - uX) * (this->raster_clip_w - uY)) / (uW - uY); |
3869 uY = this->raster_clip_w; | 3870 uY = this->raster_clip_w; |
3870 } | 3871 } |
3871 else | 3872 else |
7483 | 7484 |
7484 | 7485 |
7485 //----- (004A65CC) -------------------------------------------------------- | 7486 //----- (004A65CC) -------------------------------------------------------- |
7486 void Render::_4A65CC(unsigned int x, unsigned int y, Texture *a4, Texture *a5, int a6, int a7, int a8) | 7487 void Render::_4A65CC(unsigned int x, unsigned int y, Texture *a4, Texture *a5, int a6, int a7, int a8) |
7487 { | 7488 { |
7488 //unsigned __int16 *v8; // esi@6 | 7489 unsigned int uHeight; // edi@6 |
7489 unsigned int v9; // edi@6 | |
7490 unsigned int v10; // eax@7 | |
7491 unsigned int v11; // eax@8 | |
7492 unsigned int v12; // eax@9 | |
7493 unsigned int v13; // eax@10 | |
7494 unsigned int v14; // edx@11 | 7490 unsigned int v14; // edx@11 |
7495 unsigned int v15; // eax@13 | |
7496 unsigned int v16; // edx@14 | 7491 unsigned int v16; // edx@14 |
7497 unsigned int v17; // edx@17 | 7492 unsigned int v17; // edx@17 |
7498 unsigned int v18; // eax@19 | |
7499 unsigned int v19; // edx@20 | 7493 unsigned int v19; // edx@20 |
7500 int v20; // eax@27 | 7494 int v20; // eax@27 |
7501 int v21; // edx@29 | 7495 int v21; // edx@29 |
7502 int v22; // [sp+Ch] [bp-Ch]@6 | |
7503 int v23; // [sp+Ch] [bp-Ch]@24 | 7496 int v23; // [sp+Ch] [bp-Ch]@24 |
7504 unsigned __int8 *v24; // [sp+14h] [bp-4h]@6 | 7497 unsigned __int8 *v24; // [sp+14h] [bp-4h]@6 |
7505 int xa; // [sp+20h] [bp+8h]@26 | 7498 int xa; // [sp+20h] [bp+8h]@26 |
7506 unsigned int ya; // [sp+24h] [bp+Ch]@24 | 7499 unsigned int ya; // [sp+24h] [bp+Ch]@24 |
7507 int v27; // [sp+2Ch] [bp+14h]@6 | 7500 int Width; // [sp+2Ch] [bp+14h]@6 |
7508 | 7501 |
7509 if ( this->uNumSceneBegins && a4 && a4->pPalette16 && a5 && a5->pPalette16 ) | 7502 if ( this->uNumSceneBegins && a4 && a4->pPalette16 && a5 && a5->pPalette16 ) |
7510 { | 7503 { |
7511 //v8 = &this->pTargetSurface[x + y * this->uTargetSurfacePitch]; | |
7512 v24 = a4->pLevelOfDetail0_prolly_alpha_mask; | 7504 v24 = a4->pLevelOfDetail0_prolly_alpha_mask; |
7513 v27 = a4->uTextureWidth; | 7505 Width = a4->uTextureWidth; |
7514 v9 = a4->uTextureHeight; | 7506 uHeight = a4->uTextureHeight; |
7515 v22 = a4->uTextureWidth; | |
7516 int clipped_out_x = x; | 7507 int clipped_out_x = x; |
7517 int clipped_out_y = y; | 7508 int clipped_out_y = y; |
7518 if ( this->bClip ) | 7509 if ( this->bClip ) |
7519 { | 7510 { |
7520 v10 = this->uClipX; | 7511 if ( (signed int)x < (signed int)this->uClipX ) |
7521 if ( (signed int)x < (signed int)v10 ) | 7512 { |
7522 { | 7513 v24 += this->uClipX - x; |
7523 v11 = v10 - x; | 7514 Width += x - this->uClipX; |
7524 v24 += v11; | |
7525 v27 += x - this->uClipX; | |
7526 //v8 += v11; | |
7527 clipped_out_x = uClipX; | 7515 clipped_out_x = uClipX; |
7528 } | 7516 } |
7529 v12 = this->uClipY; | 7517 if ( (signed int)y < (signed int)this->uClipY ) |
7530 if ( (signed int)y < (signed int)v12 ) | 7518 { |
7531 { | 7519 v24 += a4->uTextureWidth * (this->uClipY - y); |
7532 v13 = v12 - y; | 7520 uHeight = y - this->uClipY + a4->uTextureHeight; |
7533 v24 += v22 * v13; | |
7534 v9 = y - this->uClipY + a4->uTextureHeight; | |
7535 //v8 += this->uTargetSurfacePitch * v13; | |
7536 clipped_out_y = uClipY; | 7521 clipped_out_y = uClipY; |
7537 } | 7522 } |
7538 v14 = this->uClipX; | 7523 v14 = this->uClipX; |
7539 if ( (signed int)v14 < (signed int)x ) | 7524 if ( (signed int)this->uClipX < (signed int)x ) |
7540 v14 = x; | 7525 v14 = x; |
7541 v15 = this->uClipZ; | 7526 if ( (signed int)(Width + v14) > (signed int)this->uClipZ ) |
7542 if ( (signed int)(v27 + v14) > (signed int)v15 ) | |
7543 { | 7527 { |
7544 v16 = this->uClipX; | 7528 v16 = this->uClipX; |
7545 if ( (signed int)v16 < (signed int)x ) | 7529 if ( (signed int)this->uClipX < (signed int)x ) |
7546 v16 = x; | 7530 v16 = x; |
7547 v27 = v15 - v16; | 7531 Width = this->uClipZ - v16; |
7548 } | 7532 } |
7549 v17 = this->uClipY; | 7533 v17 = this->uClipY; |
7550 if ( (signed int)v17 < (signed int)y ) | 7534 if ( (signed int)this->uClipY < (signed int)y ) |
7551 v17 = y; | 7535 v17 = y; |
7552 v18 = this->uClipW; | 7536 if ( (signed int)(uHeight + v17) > (signed int)this->uClipW ) |
7553 if ( (signed int)(v9 + v17) > (signed int)v18 ) | |
7554 { | 7537 { |
7555 v19 = this->uClipY; | 7538 v19 = this->uClipY; |
7556 if ( (signed int)v19 < (signed int)y ) | 7539 if ( (signed int)v19 < (signed int)y ) |
7557 v19 = y; | 7540 v19 = y; |
7558 v9 = v18 - v19; | 7541 uHeight = this->uClipW - v19; |
7559 } | 7542 } |
7560 } | 7543 } |
7561 | 7544 |
7562 for (int dy = 0; dy < v9; ++dy) | 7545 for (int dy = 0; dy < uHeight; ++dy) |
7563 { | 7546 { |
7564 for (int dx = 0; dx < v27; ++dx) | 7547 for (int dx = 0; dx < Width; ++dx) |
7565 { | 7548 { |
7566 v20 = *v24; | 7549 v20 = *v24; |
7567 if ( v20 >= a7 && v20 <= a8 ) | 7550 if ( v20 >= a7 && v20 <= a8 ) |
7568 { | 7551 { |
7569 v21 = a7 + (a6 + v20) % (2 * (a8 - a7)); | 7552 v21 = a7 + (a6 + v20) % (2 * (a8 - a7)); |
7570 if ( (a6 + v20) % (2 * (a8 - a7)) >= a8 - a7 ) | 7553 if ( (a6 + v20) % (2 * (a8 - a7)) >= a8 - a7 ) |
7571 v21 = 2 * a8 - v21 - a7; | 7554 v21 = 2 * a8 - v21 - a7; |
7572 //*v8 = a4->pPalette16[v21]; | 7555 WritePixel16(clipped_out_x + dx, clipped_out_y + dy, a4->pPalette16[v21]); |
7573 WritePixel16(clipped_out_x + dx, clipped_out_y + dy, a4->pPalette16[v21]); | 7556 } |
7574 } | 7557 ++v24; |
7575 ++v24; | 7558 } |
7576 } | 7559 v24 += a4->uTextureWidth - Width; |
7577 v24 += v22 - v27; | |
7578 } | 7560 } |
7579 /*if ( (signed int)v9 > 0 ) | 7561 /*if ( (signed int)v9 > 0 ) |
7580 { | 7562 { |
7581 ya = v9; | 7563 ya = v9; |
7582 v23 = v22 - v27; | 7564 v23 = v22 - v27; |
7611 } | 7593 } |
7612 | 7594 |
7613 //----- (004A63E6) -------------------------------------------------------- | 7595 //----- (004A63E6) -------------------------------------------------------- |
7614 void Render::DrawAura(unsigned int a2, unsigned int a3, Texture *a4, Texture *a5, int a6, int a7, int a8) | 7596 void Render::DrawAura(unsigned int a2, unsigned int a3, Texture *a4, Texture *a5, int a6, int a7, int a8) |
7615 { | 7597 { |
7616 Texture *v8; // eax@2 | |
7617 //Texture *v9; // ebx@4 | |
7618 //unsigned __int16 *v10; // esi@6 | |
7619 unsigned int v11; // edi@7 | |
7620 unsigned int v12; // eax@9 | |
7621 unsigned int v13; // eax@10 | |
7622 unsigned int v14; // edx@11 | 7598 unsigned int v14; // edx@11 |
7623 unsigned int v15; // eax@13 | |
7624 unsigned int v16; // edx@14 | 7599 unsigned int v16; // edx@14 |
7625 unsigned int v17; // edx@17 | 7600 unsigned int v17; // edx@17 |
7626 unsigned int v18; // eax@19 | |
7627 unsigned int v19; // edx@20 | 7601 unsigned int v19; // edx@20 |
7628 int v20; // eax@27 | 7602 int v20; // eax@27 |
7629 int v21; // edx@29 | 7603 int v21; // edx@29 |
7630 int v22; // [sp+Ch] [bp-Ch]@6 | |
7631 int v23; // [sp+Ch] [bp-Ch]@24 | 7604 int v23; // [sp+Ch] [bp-Ch]@24 |
7632 int v24; // [sp+10h] [bp-8h]@6 | 7605 int Height; // [sp+10h] [bp-8h]@6 |
7633 int v25; // [sp+14h] [bp-4h]@6 | 7606 int Width; // [sp+14h] [bp-4h]@6 |
7634 int i; // [sp+20h] [bp+8h]@25 | |
7635 int v27; // [sp+24h] [bp+Ch]@23 | 7607 int v27; // [sp+24h] [bp+Ch]@23 |
7636 unsigned __int8 *v28; // [sp+28h] [bp+10h]@6 | 7608 unsigned __int8 *v28; // [sp+28h] [bp+10h]@6 |
7637 | 7609 |
7638 if ( this->uNumSceneBegins ) | 7610 if ( this->uNumSceneBegins ) |
7639 { | 7611 { |
7640 v8 = a4; | |
7641 if ( a4 ) | 7612 if ( a4 ) |
7642 { | 7613 { |
7643 if ( a4->pPalette16 ) | 7614 if ( a4->pPalette16 ) |
7644 { | 7615 { |
7645 if ( a5 ) | 7616 if ( a5 ) |
7646 { | 7617 { |
7647 if ( a5->pPalette16 ) | 7618 if ( a5->pPalette16 ) |
7648 { | 7619 { |
7649 //v10 = &this->pTargetSurface[a2 + a3 * this->uTargetSurfacePitch]; | |
7650 v28 = a4->pLevelOfDetail0_prolly_alpha_mask; | 7620 v28 = a4->pLevelOfDetail0_prolly_alpha_mask; |
7651 v25 = v8->uTextureWidth; | 7621 Width = a4->uTextureWidth; |
7652 v24 = v8->uTextureHeight; | 7622 Height = a4->uTextureHeight; |
7653 v22 = v8->uTextureWidth; | |
7654 | |
7655 int clipped_out_x = a2; | 7623 int clipped_out_x = a2; |
7656 int clipped_out_y = a3; | 7624 int clipped_out_y = a3; |
7657 if ( this->bClip ) | 7625 if ( this->bClip ) |
7658 { | 7626 { |
7659 v11 = this->uClipX; | 7627 if ( (signed int)a2 < (signed int)this->uClipX ) |
7660 if ( (signed int)a2 < (signed int)v11 ) | |
7661 { | 7628 { |
7662 v28 += v11 - a2; | 7629 v28 += this->uClipX - a2; |
7663 v25 += a2 - v11; | 7630 Width += a2 - this->uClipX; |
7664 //v10 += v11 - a2; | |
7665 clipped_out_x = uClipX; | 7631 clipped_out_x = uClipX; |
7666 } | 7632 } |
7667 v12 = this->uClipY; | 7633 |
7668 if ( (signed int)a3 < (signed int)v12 ) | 7634 if ( (signed int)a3 < (signed int)this->uClipY ) |
7669 { | 7635 { |
7670 v13 = v12 - a3; | 7636 v28 += a4->uTextureWidth * (this->uClipY - a3); |
7671 v28 += v22 * v13; | 7637 Height += a3 - this->uClipY; |
7672 v24 += a3 - this->uClipY; | |
7673 //v10 += this->uTargetSurfacePitch * v13; | |
7674 clipped_out_y = uClipY; | 7638 clipped_out_y = uClipY; |
7675 } | 7639 } |
7640 | |
7676 v14 = this->uClipX; | 7641 v14 = this->uClipX; |
7677 if ( (signed int)v14 < (signed int)a2 ) | 7642 if ( (signed int)this->uClipX < (signed int)a2 ) |
7678 v14 = a2; | 7643 v14 = a2; |
7679 v15 = this->uClipZ; | 7644 if ( (signed int)(Width + v14) > (signed int)this->uClipZ ) |
7680 if ( (signed int)(v25 + v14) > (signed int)v15 ) | |
7681 { | 7645 { |
7682 v16 = this->uClipX; | 7646 v16 = this->uClipX; |
7683 if ( (signed int)v16 < (signed int)a2 ) | 7647 if ( (signed int)this->uClipX < (signed int)a2 ) |
7684 v16 = a2; | 7648 v16 = a2; |
7685 v25 = v15 - v16; | 7649 Width = this->uClipZ - v16; |
7686 } | 7650 } |
7651 | |
7687 v17 = this->uClipY; | 7652 v17 = this->uClipY; |
7688 if ( (signed int)v17 < (signed int)a3 ) | 7653 if ( (signed int)this->uClipY < (signed int)a3 ) |
7689 v17 = a3; | 7654 v17 = a3; |
7690 v18 = this->uClipW; | 7655 if ( (signed int)(Height + v17) > (signed int)this->uClipW ) |
7691 if ( (signed int)(v24 + v17) > (signed int)v18 ) | |
7692 { | 7656 { |
7693 v19 = this->uClipY; | 7657 v19 = this->uClipY; |
7694 if ( (signed int)v19 < (signed int)a3 ) | 7658 if ( (signed int)this->uClipY < (signed int)a3 ) |
7695 v19 = a3; | 7659 v19 = a3; |
7696 v24 = v18 - v19; | 7660 Height = this->uClipW - v19; |
7697 } | 7661 } |
7698 } | 7662 } |
7699 | 7663 |
7700 v27 = 0; | 7664 v27 = 0; |
7701 for (int y = 0; y < v24; ++y) | 7665 for (int y = 0; y < Height; ++y) |
7702 { | 7666 { |
7703 for (int x = 0; x < v25; ++x) | 7667 for (int x = 0; x < Width; ++x) |
7704 { | 7668 { |
7705 if ( *v28 ) | 7669 if ( *v28 ) |
7706 { | 7670 { |
7707 v20 = *(&a5->pLevelOfDetail0_prolly_alpha_mask[x & a5->uWidthMinus1] + a5->uTextureWidth * (v27 & a5->uHeightMinus1)); | 7671 v20 = *(&a5->pLevelOfDetail0_prolly_alpha_mask[x & a5->uWidthMinus1] + a5->uTextureWidth * (v27 & a5->uHeightMinus1)); |
7708 if ( v20 >= a7 ) | 7672 if ( v20 >= a7 ) |
7718 } | 7682 } |
7719 } | 7683 } |
7720 } | 7684 } |
7721 v28++; | 7685 v28++; |
7722 } | 7686 } |
7723 v28 += v22 - v25; | 7687 v28 += a4->uTextureWidth - Width; |
7724 } | 7688 } |
7725 | 7689 |
7726 /*if ( v24 > 0 ) | 7690 /*if ( v24 > 0 ) |
7727 { | 7691 { |
7728 v23 = v22 - v25; | 7692 v23 = v22 - v25; |
7753 v28 += v23; | 7717 v28 += v23; |
7754 } | 7718 } |
7755 while ( v27 < v24 ); | 7719 while ( v27 < v24 ); |
7756 }*/ | 7720 }*/ |
7757 | 7721 |
7758 | |
7759 | |
7760 } | 7722 } |
7761 } | 7723 } |
7762 } | 7724 } |
7763 } | 7725 } |
7764 } | 7726 } |
7765 } | 7727 } |
7766 | 7728 |
7767 //----- (004A6274) -------------------------------------------------------- | 7729 //----- (004A6274) -------------------------------------------------------- |
7768 void Render::DrawTextureTransparent(unsigned int uX, unsigned int uY, Texture *pTexture) | 7730 void Render::DrawTextureTransparent(unsigned int uX, unsigned int uY, Texture *pTexture) |
7769 { | 7731 { |
7770 Texture *pCurrentTexture; // edi@2 | |
7771 int uHeight; // ebx@4 | 7732 int uHeight; // ebx@4 |
7772 //unsigned __int16 *v6; // eax@4 | |
7773 unsigned int v7; // edx@5 | |
7774 unsigned int v8; // edx@6 | |
7775 unsigned int v9; // edx@7 | |
7776 unsigned int v10; // edx@8 | |
7777 unsigned int v11; // edx@9 | 7733 unsigned int v11; // edx@9 |
7778 unsigned int v12; // esi@12 | 7734 unsigned int v12; // esi@12 |
7779 unsigned int v13; // esi@15 | 7735 unsigned int v13; // esi@15 |
7780 unsigned int v14; // edx@17 | |
7781 unsigned int v15; // esi@18 | 7736 unsigned int v15; // esi@18 |
7782 unsigned __int8 *v16; // ebx@22 | |
7783 char uFlag; // zf@28 | |
7784 int v18; // [sp+10h] [bp-10h]@4 | |
7785 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 | 7737 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 |
7786 int uWidth; // [sp+1Ch] [bp-4h]@4 | 7738 int uWidth; // [sp+1Ch] [bp-4h]@4 |
7787 int uXa; // [sp+28h] [bp+8h]@24 | |
7788 unsigned int uYa; // [sp+2Ch] [bp+Ch]@22 | |
7789 unsigned int pTexturea; // [sp+30h] [bp+10h]@11 | |
7790 | 7739 |
7791 if ( this->uNumSceneBegins ) | 7740 if ( this->uNumSceneBegins ) |
7792 { | 7741 { |
7793 pCurrentTexture = pTexture; | |
7794 if ( pTexture ) | 7742 if ( pTexture ) |
7795 { | 7743 { |
7796 if ( pTexture->pPalette16 ) | 7744 if ( pTexture->pPalette16 ) |
7797 { | 7745 { |
7798 uHeight = pTexture->uTextureHeight; | 7746 uHeight = pTexture->uTextureHeight; |
7799 //v6 = &this->pTargetSurface[uX + uY * this->uTargetSurfacePitch]; | |
7800 v19 = pTexture->pLevelOfDetail0_prolly_alpha_mask; | 7747 v19 = pTexture->pLevelOfDetail0_prolly_alpha_mask; |
7801 uWidth = pTexture->uTextureWidth; | 7748 uWidth = pTexture->uTextureWidth; |
7802 v18 = pTexture->uTextureWidth; | |
7803 | 7749 |
7804 int clipped_out_x = uX; | 7750 int clipped_out_x = uX; |
7805 int clipped_out_y = uY; | 7751 int clipped_out_y = uY; |
7806 if ( this->bClip ) | 7752 if ( this->bClip ) |
7807 { | 7753 { |
7808 v7 = this->uClipX; | 7754 if ( (signed int)uX < (signed int)this->uClipX ) |
7809 if ( (signed int)uX < (signed int)v7 ) | |
7810 { | 7755 { |
7811 v8 = v7 - uX; | 7756 v19 += this->uClipX - uX; |
7812 v19 += v8; | |
7813 uWidth += uX - this->uClipX; | 7757 uWidth += uX - this->uClipX; |
7814 //v6 += v8; | |
7815 clipped_out_x = uClipX; | 7758 clipped_out_x = uClipX; |
7816 } | 7759 } |
7817 v9 = this->uClipY; | 7760 |
7818 uHeight = pTexture->uTextureHeight; | 7761 uHeight = pTexture->uTextureHeight; |
7819 if ( (signed int)uY < (signed int)v9 ) | 7762 if ( (signed int)uY < (signed int)this->uClipY ) |
7820 { | 7763 { |
7821 v10 = v9 - uY; | 7764 v19 += pTexture->uTextureWidth * (this->uClipY - uY); |
7822 v19 += v18 * v10; | |
7823 uHeight = uY - this->uClipY + pTexture->uTextureHeight; | 7765 uHeight = uY - this->uClipY + pTexture->uTextureHeight; |
7824 pCurrentTexture = pTexture; | |
7825 //v6 += this->uTargetSurfacePitch * v10; | |
7826 clipped_out_y = uClipY; | 7766 clipped_out_y = uClipY; |
7827 } | 7767 } |
7828 v11 = this->uClipX; | 7768 v11 = this->uClipX; |
7829 if ( (signed int)v11 < (signed int)uX ) | 7769 if ( (signed int)this->uClipX < (signed int)uX ) |
7830 v11 = uX; | 7770 v11 = uX; |
7831 pTexturea = this->uClipZ; | 7771 |
7832 if ( (signed int)(v11 + uWidth) > (signed int)pTexturea ) | 7772 if ( (signed int)(v11 + uWidth) > (signed int)this->uClipZ ) |
7833 { | 7773 { |
7834 v12 = this->uClipX; | 7774 v12 = this->uClipX; |
7835 if ( (signed int)v12 < (signed int)uX ) | 7775 if ( (signed int)this->uClipX < (signed int)uX ) |
7836 v12 = uX; | 7776 v12 = uX; |
7837 uWidth = pTexturea - v12; | 7777 uWidth = this->uClipZ - v12; |
7838 } | 7778 } |
7839 v13 = this->uClipY; | 7779 v13 = this->uClipY; |
7840 if ( (signed int)v13 < (signed int)uY ) | 7780 if ( (signed int)this->uClipY < (signed int)uY ) |
7841 v13 = uY; | 7781 v13 = uY; |
7842 v14 = this->uClipW; | 7782 |
7843 if ( (signed int)(uHeight + v13) > (signed int)v14 ) | 7783 if ( (signed int)(uHeight + v13) > (signed int)this->uClipW ) |
7844 { | 7784 { |
7845 v15 = this->uClipY; | 7785 v15 = this->uClipY; |
7846 if ( (signed int)v15 < (signed int)uY ) | 7786 if ( (signed int)this->uClipY < (signed int)uY ) |
7847 v15 = uY; | 7787 v15 = uY; |
7848 uHeight = v14 - v15; | 7788 uHeight = this->uClipW - v15; |
7849 } | 7789 } |
7850 } | 7790 } |
7851 | 7791 |
7852 v16 = v19; | |
7853 for (int y = 0; y < uHeight; ++y) | 7792 for (int y = 0; y < uHeight; ++y) |
7854 { | 7793 { |
7855 for (int x = 0; x < uWidth; ++x) | 7794 for (int x = 0; x < uWidth; ++x) |
7856 { | 7795 { |
7857 if ( *v16 ) | 7796 if ( *v19 ) |
7858 WritePixel16(clipped_out_x + x, clipped_out_y + y, pCurrentTexture->pPalette16[*v16]); | 7797 WritePixel16(clipped_out_x + x, clipped_out_y + y, pTexture->pPalette16[*v19]); |
7859 ++v16; | 7798 ++v19; |
7860 } | 7799 } |
7861 v16 += v18 - uWidth; | 7800 v19 += pTexture->uTextureWidth - uWidth; |
7862 } | 7801 } |
7863 /*if ( (signed int)uHeight > 0 ) | 7802 /*if ( (signed int)uHeight > 0 ) |
7864 { | 7803 { |
7865 uYa = uHeight; | 7804 uYa = uHeight; |
7866 v16 = v19; | 7805 v16 = v19; |
8076 } | 8015 } |
8077 | 8016 |
8078 //----- (004A5EB2) -------------------------------------------------------- | 8017 //----- (004A5EB2) -------------------------------------------------------- |
8079 void Render::DrawTextureIndexed(unsigned int uX, unsigned int uY, Texture *a4) | 8018 void Render::DrawTextureIndexed(unsigned int uX, unsigned int uY, Texture *a4) |
8080 { | 8019 { |
8081 Texture *v4; // edi@2 | |
8082 int v5; // ebx@4 | 8020 int v5; // ebx@4 |
8083 //unsigned __int16 *pTarget; // eax@4 | |
8084 unsigned int v7; // edx@5 | |
8085 unsigned int v8; // edx@6 | 8021 unsigned int v8; // edx@6 |
8086 unsigned int v9; // edx@7 | |
8087 unsigned int v10; // edx@8 | 8022 unsigned int v10; // edx@8 |
8088 unsigned int v11; // edx@9 | 8023 unsigned int v11; // edx@9 |
8089 unsigned int v12; // esi@12 | 8024 unsigned int v12; // esi@12 |
8090 unsigned int v13; // esi@15 | 8025 unsigned int v13; // esi@15 |
8091 //unsigned int v14; // edx@17 | |
8092 unsigned int v15; // esi@18 | 8026 unsigned int v15; // esi@18 |
8093 unsigned __int8 *v16; // edx@22 | |
8094 char v17; // zf@26 | 8027 char v17; // zf@26 |
8095 int v18; // [sp+10h] [bp-10h]@4 | 8028 int v18; // [sp+10h] [bp-10h]@4 |
8096 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 | 8029 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 |
8097 int v20; // [sp+1Ch] [bp-4h]@4 | 8030 int v20; // [sp+1Ch] [bp-4h]@4 |
8098 int uXa; // [sp+28h] [bp+8h]@24 | 8031 int uXa; // [sp+28h] [bp+8h]@24 |
8099 unsigned int uYa; // [sp+2Ch] [bp+Ch]@22 | 8032 unsigned int uYa; // [sp+2Ch] [bp+Ch]@22 |
8100 unsigned int v23; // [sp+30h] [bp+10h]@11 | |
8101 | 8033 |
8102 if ( this->uNumSceneBegins ) | 8034 if ( this->uNumSceneBegins ) |
8103 { | 8035 { |
8104 v4 = a4; | |
8105 if ( a4 ) | 8036 if ( a4 ) |
8106 { | 8037 { |
8107 if ( a4->pPalette16 ) | 8038 if ( a4->pPalette16 ) |
8108 { | 8039 { |
8109 v5 = a4->uTextureHeight; | 8040 v5 = a4->uTextureHeight; |
8114 | 8045 |
8115 int clipped_out_x = uX; | 8046 int clipped_out_x = uX; |
8116 int clipped_out_y = uY; | 8047 int clipped_out_y = uY; |
8117 if ( this->bClip ) | 8048 if ( this->bClip ) |
8118 { | 8049 { |
8119 v7 = this->uClipX; | 8050 if ( (signed int)uX < (signed int)this->uClipX ) |
8120 if ( (signed int)uX < (signed int)v7 ) | |
8121 { | 8051 { |
8122 v8 = v7 - uX; | 8052 v8 = this->uClipX - uX; |
8123 v19 += v8; | 8053 v19 += v8; |
8124 v20 += uX - this->uClipX; | 8054 v20 += uX - this->uClipX; |
8125 //pTarget += v8; | |
8126 clipped_out_x = uClipX; | 8055 clipped_out_x = uClipX; |
8127 } | 8056 } |
8128 v9 = this->uClipY; | 8057 |
8129 v5 = a4->uTextureHeight; | 8058 v5 = a4->uTextureHeight; |
8130 if ( (signed int)uY < (signed int)v9 ) | 8059 if ( (signed int)uY < (signed int)this->uClipY ) |
8131 { | 8060 { |
8132 v10 = v9 - uY; | 8061 v10 = this->uClipY - uY; |
8133 v19 += v18 * v10; | 8062 v19 += v18 * v10; |
8134 v5 = uY - this->uClipY + a4->uTextureHeight; | 8063 v5 = uY - this->uClipY + a4->uTextureHeight; |
8135 v4 = a4; | 8064 //v4 = a4; |
8136 //pTarget += this->uTargetSurfacePitch * v10; | |
8137 clipped_out_y = uClipY; | 8065 clipped_out_y = uClipY; |
8138 } | 8066 } |
8067 | |
8139 v11 = this->uClipX; | 8068 v11 = this->uClipX; |
8140 if ( (signed int)v11 < (signed int)uX ) | 8069 if ( (signed int)v11 < (signed int)uX ) |
8141 v11 = uX; | 8070 v11 = uX; |
8142 v23 = this->uClipZ; | 8071 |
8143 if ( (signed int)(v11 + v20) > (signed int)v23 ) | 8072 if ( (signed int)(v11 + v20) > (signed int)this->uClipZ ) |
8144 { | 8073 { |
8145 v12 = this->uClipX; | 8074 v12 = this->uClipX; |
8146 if ( (signed int)v12 < (signed int)uX ) | 8075 if ( (signed int)v12 < (signed int)uX ) |
8147 v12 = uX; | 8076 v12 = uX; |
8148 v20 = v23 - v12; | 8077 v20 = this->uClipZ - v12; |
8149 } | 8078 } |
8079 | |
8150 v13 = this->uClipY; | 8080 v13 = this->uClipY; |
8151 if ( (signed int)v13 < (signed int)uY ) | 8081 if ( (signed int)v13 < (signed int)uY ) |
8152 v13 = uY; | 8082 v13 = uY; |
8153 | 8083 |
8154 if ( (signed int)(v5 + v13) > (signed int)uClipW ) | 8084 if ( (signed int)(v5 + v13) > (signed int)uClipW ) |
8157 if ( (signed int)v15 < (signed int)uY ) | 8087 if ( (signed int)v15 < (signed int)uY ) |
8158 v15 = uY; | 8088 v15 = uY; |
8159 v5 = uClipW - v15; | 8089 v5 = uClipW - v15; |
8160 } | 8090 } |
8161 } | 8091 } |
8162 | 8092 |
8163 v16 = v19; | |
8164 for (int y = 0; y < v5; ++y) | 8093 for (int y = 0; y < v5; ++y) |
8165 { | 8094 { |
8166 for (int x = 0; x < v20; ++x) | 8095 for (int x = 0; x < v20; ++x) |
8167 { | 8096 { |
8168 WritePixel16(clipped_out_x + x, clipped_out_y + y, v4->pPalette16[*v16]); | 8097 if ( a4->pPalette16[*v19] != 0x7FF )// 2047 |
8169 ++v16; | 8098 WritePixel16(clipped_out_x + x, clipped_out_y + y, a4->pPalette16[*v19]); |
8099 ++v19; | |
8170 } | 8100 } |
8171 v16 += v18 - v20; | 8101 v19 += v18 - v20; |
8172 } | 8102 } |
8173 /*if ( (signed int)v5 > 0 ) | 8103 /*if ( (signed int)v5 > 0 ) |
8174 { | 8104 { |
8175 uYa = v5; | 8105 uYa = v5; |
8176 v16 = v19; | 8106 v16 = v19; |