Mercurial > mm7
comparison Engine/Graphics/Render.cpp @ 2536:400edd7b0407
DrawTextureIndexed() func
author | Ritor1 |
---|---|
date | Mon, 16 Feb 2015 00:48:08 +0600 |
parents | 3a36de426f5f |
children | 407263babde8 |
comparison
equal
deleted
inserted
replaced
2535:3a36de426f5f | 2536:400edd7b0407 |
---|---|
7700 } | 7700 } |
7701 } | 7701 } |
7702 } | 7702 } |
7703 | 7703 |
7704 //----- (004A5EB2) -------------------------------------------------------- | 7704 //----- (004A5EB2) -------------------------------------------------------- |
7705 void Render::DrawTextureIndexed(unsigned int uX, unsigned int uY, Texture *a4) | 7705 void Render::DrawTextureIndexed(signed int x, signed int y, Texture *tex) |
7706 { | 7706 { |
7707 int v5; // ebx@4 | 7707 int v5; // ebx@4 |
7708 unsigned int v8; // edx@6 | 7708 unsigned int v8; // edx@6 |
7709 unsigned int v10; // edx@8 | 7709 unsigned int v10; // edx@8 |
7710 unsigned int v11; // edx@9 | 7710 unsigned int v11; // edx@9 |
7715 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 | 7715 unsigned __int8 *v19; // [sp+18h] [bp-8h]@4 |
7716 int v20; // [sp+1Ch] [bp-4h]@4 | 7716 int v20; // [sp+1Ch] [bp-4h]@4 |
7717 | 7717 |
7718 if ( this->uNumSceneBegins ) | 7718 if ( this->uNumSceneBegins ) |
7719 { | 7719 { |
7720 if ( a4 ) | 7720 if ( tex ) |
7721 { | 7721 { |
7722 if ( a4->pPalette16 ) | 7722 if ( tex->pPalette16 ) |
7723 { | 7723 { |
7724 v5 = a4->uTextureHeight; | 7724 v5 = tex->uTextureHeight; |
7725 //pTarget = &this->pTargetSurface[uX + uY * this->uTargetSurfacePitch]; | 7725 //pTarget = &this->pTargetSurface[uX + uY * this->uTargetSurfacePitch]; |
7726 v19 = a4->pLevelOfDetail0_prolly_alpha_mask; | 7726 v19 = tex->pLevelOfDetail0_prolly_alpha_mask; |
7727 v20 = a4->uTextureWidth; | 7727 v20 = tex->uTextureWidth; |
7728 v18 = a4->uTextureWidth; | 7728 v18 = tex->uTextureWidth; |
7729 | 7729 |
7730 int clipped_out_x = uX; | 7730 int clipped_out_x = x; |
7731 int clipped_out_y = uY; | 7731 int clipped_out_y = y; |
7732 if ( this->bClip ) | 7732 if ( this->bClip ) |
7733 { | 7733 { |
7734 if ( (signed int)uX < (signed int)this->uClipX ) | 7734 if ( (signed int)x < (signed int)this->uClipX ) |
7735 { | 7735 { |
7736 v8 = this->uClipX - uX; | 7736 v8 = this->uClipX - x; |
7737 v19 += v8; | 7737 v19 += v8; |
7738 v20 += uX - this->uClipX; | 7738 v20 += x - this->uClipX; |
7739 clipped_out_x = uClipX; | 7739 clipped_out_x = uClipX; |
7740 } | 7740 } |
7741 | 7741 |
7742 v5 = a4->uTextureHeight; | 7742 v5 = tex->uTextureHeight; |
7743 if ( (signed int)uY < (signed int)this->uClipY ) | 7743 if ( (signed int)y < (signed int)this->uClipY ) |
7744 { | 7744 { |
7745 v10 = this->uClipY - uY; | 7745 v10 = this->uClipY - y; |
7746 v19 += v18 * v10; | 7746 v19 += v18 * v10; |
7747 v5 = uY - this->uClipY + a4->uTextureHeight; | 7747 v5 = y - this->uClipY + tex->uTextureHeight; |
7748 //v4 = a4; | 7748 //v4 = a4; |
7749 clipped_out_y = uClipY; | 7749 clipped_out_y = uClipY; |
7750 } | 7750 } |
7751 | 7751 |
7752 v11 = this->uClipX; | 7752 v11 = this->uClipX; |
7753 if ( (signed int)this->uClipX < (signed int)uX ) | 7753 if ( (signed int)this->uClipX < (signed int)x ) |
7754 v11 = uX; | 7754 v11 = x; |
7755 | 7755 |
7756 if ( (signed int)(v11 + v20) > (signed int)this->uClipZ ) | 7756 if ( (signed int)(v11 + v20) > (signed int)this->uClipZ ) |
7757 { | 7757 { |
7758 v12 = this->uClipX; | 7758 v12 = this->uClipX; |
7759 if ( (signed int)this->uClipX < (signed int)uX ) | 7759 if ( (signed int)this->uClipX < (signed int)x ) |
7760 v12 = uX; | 7760 v12 = x; |
7761 v20 = this->uClipZ - v12; | 7761 v20 = this->uClipZ - v12; |
7762 } | 7762 } |
7763 | 7763 |
7764 v13 = this->uClipY; | 7764 v13 = this->uClipY; |
7765 if ( (signed int)this->uClipY < (signed int)uY ) | 7765 if ( (signed int)this->uClipY < (signed int)y ) |
7766 v13 = uY; | 7766 v13 = y; |
7767 | 7767 |
7768 if ( (signed int)(v5 + v13) > (signed int)uClipW ) | 7768 if ( (signed int)(v5 + v13) > (signed int)uClipW ) |
7769 { | 7769 { |
7770 v15 = this->uClipY; | 7770 v15 = this->uClipY; |
7771 if ( (signed int)this->uClipY < (signed int)uY ) | 7771 if ( (signed int)this->uClipY < (signed int)y ) |
7772 v15 = uY; | 7772 v15 = y; |
7773 v5 = uClipW - v15; | 7773 v5 = uClipW - v15; |
7774 } | 7774 } |
7775 } | 7775 } |
7776 | 7776 |
7777 for (int y = 0; y < v5; ++y) | 7777 for (int y = 0; y < v5; ++y) |
7778 { | 7778 { |
7779 for (int x = 0; x < v20; ++x) | 7779 for (int x = 0; x < v20; ++x) |
7780 { | 7780 { |
7781 if ( a4->pPalette16[*v19] != 0x7FF )// 2047 | 7781 if ( tex->pPalette16[*v19] != 0x7FF )// 2047 |
7782 WritePixel16(clipped_out_x + x, clipped_out_y + y, a4->pPalette16[*v19]); | 7782 WritePixel16(clipped_out_x + x, clipped_out_y + y, tex->pPalette16[*v19]); |
7783 ++v19; | 7783 ++v19; |
7784 } | 7784 } |
7785 v19 += v18 - v20; | 7785 v19 += v18 - v20; |
7786 } | 7786 } |
7787 /*if ( (signed int)v5 > 0 ) | 7787 /*if ( (signed int)v5 > 0 ) |