Mercurial > mm7
comparison Render.cpp @ 1176:dac817fbf85a
Слияние
author | Ritor1 |
---|---|
date | Mon, 03 Jun 2013 09:32:05 +0600 |
parents | 9e3bacdbec56 d8b455c81917 |
children | f7ad7bd0a806 |
comparison
equal
deleted
inserted
replaced
1175:9e3bacdbec56 | 1176:dac817fbf85a |
---|---|
8725 if ( LockSurface_DDraw4(*pOutSurface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) | 8725 if ( LockSurface_DDraw4(*pOutSurface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) |
8726 { | 8726 { |
8727 bMipMaps = 0; | 8727 bMipMaps = 0; |
8728 v13 = pHWLTexture->pPixels; | 8728 v13 = pHWLTexture->pPixels; |
8729 v14 = (unsigned __int16 *)desc.lpSurface; | 8729 v14 = (unsigned __int16 *)desc.lpSurface; |
8730 if ( desc.dwHeight ) | 8730 for(int bMipMaps = 0; bMipMaps < desc.dwHeight; bMipMaps++) |
8731 { | 8731 { |
8732 do | 8732 for (v15 = 0; v15 < desc.dwWidth; v15++) |
8733 { | 8733 { |
8734 v15 = 0; | 8734 *v14 = *v13; |
8735 if ( desc.dwWidth ) | 8735 ++v14; |
8736 { | 8736 ++v13; |
8737 do | |
8738 { | |
8739 ++v15; | |
8740 *v14 = *v13; | |
8741 ++v14; | |
8742 ++v13; | |
8743 } | |
8744 while ( v15 < desc.dwWidth ); | |
8745 } | |
8746 ++bMipMaps; | |
8747 v14 += (desc.lPitch >> 1) - desc.dwWidth; | |
8748 } | 8737 } |
8749 while ( bMipMaps < desc.dwHeight ); | 8738 v14 += (desc.lPitch >> 1) - desc.dwWidth; |
8750 } | 8739 } |
8751 ErrD3D((*pOutSurface)->Unlock(0)); | 8740 ErrD3D((*pOutSurface)->Unlock(0)); |
8752 } | 8741 } |
8753 } | 8742 } |
8754 delete [] pHWLTexture->pPixels; | 8743 delete [] pHWLTexture->pPixels; |
8810 } | 8799 } |
8811 | 8800 |
8812 //----- (004A51CB) -------------------------------------------------------- | 8801 //----- (004A51CB) -------------------------------------------------------- |
8813 void Render::BeginScene() | 8802 void Render::BeginScene() |
8814 { | 8803 { |
8815 Render *v1; // esi@1 | 8804 //Render *v1; // esi@1 |
8816 unsigned int v2; // eax@1 | 8805 unsigned int v2; // eax@1 |
8817 int v3; // eax@5 | 8806 /*int v3; // eax@5 |
8818 unsigned __int16 **v4; // edi@6 | 8807 unsigned __int16 **v4; // edi@6 |
8819 char *v5; // ebx@7 | 8808 char *v5; // ebx@7*/ |
8820 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-7Ch]@4 | 8809 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-7Ch]@4 |
8821 | 8810 |
8822 v1 = this; | 8811 //v1 = this; |
8823 v2 = this->uNumSceneBegins; | 8812 v2 = this->uNumSceneBegins; |
8824 this->uNumSceneBegins = v2 + 1; | 8813 this->uNumSceneBegins = v2 + 1; |
8825 if ( !v2 ) | 8814 if ( !v2 ) |
8826 { | 8815 { |
8827 if ( this->pRenderD3D ) | 8816 if ( this->pRenderD3D ) |
8828 { | 8817 { |
8829 if ( this->bColorKeySupported ) | 8818 if ( this->bColorKeySupported ) |
8830 { | 8819 { |
8831 memset(&Dst, 0, 0x7Cu); | 8820 memset(&Dst, 0, 0x7Cu); |
8832 Dst.dwSize = 124; | 8821 Dst.dwSize = 124; |
8833 if ( LockSurface_DDraw4(v1->pColorKeySurface4, &Dst, 0x800 | DDLOCK_WAIT) ) | 8822 if ( LockSurface_DDraw4(this->pColorKeySurface4, &Dst, 0x800 | DDLOCK_WAIT) ) |
8834 { | 8823 { |
8835 v1->pTargetSurface = (unsigned __int16 *)Dst.lpSurface; | 8824 this->pTargetSurface = (unsigned __int16 *)Dst.lpSurface; |
8836 v3 = Dst.lPitch >> 1; | 8825 this->uTargetSurfacePitch = Dst.lPitch >> 1; |
8837 v1->uTargetSurfacePitch = Dst.lPitch >> 1; | 8826 this->field_18_locked_pitch = Dst.lPitch >> 1; |
8838 LABEL_10: | |
8839 v1->field_18_locked_pitch = v3; | |
8840 goto LABEL_11; | |
8841 } | 8827 } |
8842 goto LABEL_8; | 8828 --this->uNumSceneBegins; |
8843 } | 8829 } |
8844 } | 8830 } |
8845 else | 8831 else |
8846 { | 8832 { |
8847 v4 = &this->pTargetSurface; | |
8848 if ( !this->pTargetSurface ) | 8833 if ( !this->pTargetSurface ) |
8849 { | 8834 { |
8850 v5 = (char *)&this->uTargetSurfacePitch; | |
8851 LockRenderSurface((void **)&this->pTargetSurface, &this->uTargetSurfacePitch); | 8835 LockRenderSurface((void **)&this->pTargetSurface, &this->uTargetSurfacePitch); |
8852 if ( *v4 ) | 8836 if ( this->pTargetSurface ) |
8853 { | 8837 { |
8854 v3 = *(int *)v5; | 8838 this->field_18_locked_pitch = this->uTargetSurfacePitch; |
8855 goto LABEL_10; | |
8856 } | 8839 } |
8857 LABEL_8: | 8840 --this->uNumSceneBegins; |
8858 --v1->uNumSceneBegins; | 8841 } |
8859 return; | 8842 } |
8860 } | |
8861 } | |
8862 LABEL_11: | |
8863 RestoreFrontBuffer(); | 8843 RestoreFrontBuffer(); |
8864 } | 8844 } |
8865 } | 8845 } |
8866 | 8846 |
8867 //----- (004A527D) -------------------------------------------------------- | 8847 //----- (004A527D) -------------------------------------------------------- |
8868 void Render::EndScene() | 8848 void Render::EndScene() |
8869 { | 8849 { |
8870 unsigned int v1; // edx@1 | 8850 if ( this->uNumSceneBegins ) |
8871 unsigned int v2; // edx@2 | 8851 { |
8872 HRESULT v3; // eax@5 | 8852 this->uNumSceneBegins--; |
8873 | 8853 if ( !this->uNumSceneBegins ) |
8874 v1 = this->uNumSceneBegins; | |
8875 if ( v1 ) | |
8876 { | |
8877 v2 = v1 - 1; | |
8878 this->uNumSceneBegins = v2; | |
8879 if ( !v2 ) | |
8880 { | 8854 { |
8881 if ( this->pRenderD3D ) | 8855 if ( this->pRenderD3D ) |
8882 { | 8856 { |
8883 if ( this->bColorKeySupported ) | 8857 if ( this->bColorKeySupported ) |
8884 { | 8858 { |
9130 void Render::DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4) | 9104 void Render::DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4) |
9131 { | 9105 { |
9132 int v4; // edi@3 | 9106 int v4; // edi@3 |
9133 unsigned __int16 *v5; // edx@3 | 9107 unsigned __int16 *v5; // edx@3 |
9134 unsigned __int16 *v6; // esi@3 | 9108 unsigned __int16 *v6; // esi@3 |
9135 unsigned int v7; // ebx@4 | |
9136 unsigned int v8; // eax@5 | 9109 unsigned int v8; // eax@5 |
9137 unsigned int v9; // ebx@5 | 9110 unsigned int v9; // ebx@5 |
9138 unsigned int v10; // eax@6 | |
9139 unsigned int v11; // eax@7 | 9111 unsigned int v11; // eax@7 |
9140 unsigned int v12; // ebx@8 | 9112 unsigned int v12; // ebx@8 |
9141 unsigned int v13; // eax@10 | |
9142 unsigned int v14; // edi@11 | |
9143 unsigned int v15; // eax@14 | 9113 unsigned int v15; // eax@14 |
9144 unsigned int v16; // ebx@17 | |
9145 int v17; // eax@23 | |
9146 char v18; // zf@25 | |
9147 int v19; // [sp+10h] [bp-8h]@3 | 9114 int v19; // [sp+10h] [bp-8h]@3 |
9148 int v20; // [sp+14h] [bp-4h]@3 | |
9149 unsigned int uOutXa; // [sp+20h] [bp+8h]@16 | 9115 unsigned int uOutXa; // [sp+20h] [bp+8h]@16 |
9150 int uOutXb; // [sp+20h] [bp+8h]@21 | |
9151 int v23; // [sp+28h] [bp+10h]@3 | 9116 int v23; // [sp+28h] [bp+10h]@3 |
9152 | 9117 |
9153 if ( this->uNumSceneBegins && a4 ) | 9118 if ( this->uNumSceneBegins && a4 ) |
9154 { | 9119 { |
9155 v4 = a4->uWidth; | 9120 v4 = a4->uWidth; |
9156 v5 = &this->pTargetSurface[uOutX + uOutY * this->uTargetSurfacePitch]; | 9121 v5 = &this->pTargetSurface[uOutX + uOutY * this->uTargetSurfacePitch]; |
9157 v6 = a4->pPixels; | 9122 v6 = a4->pPixels; |
9158 v20 = v4; | |
9159 v23 = a4->uHeight; | 9123 v23 = a4->uHeight; |
9160 v19 = v4; | 9124 v19 = v4; |
9161 if ( this->bClip ) | 9125 if ( this->bClip ) |
9162 { | 9126 { |
9163 v7 = this->uClipX; | 9127 if ( (signed int)uOutX < (signed int)this->uClipX ) |
9164 if ( (signed int)uOutX < (signed int)v7 ) | 9128 { |
9165 { | 9129 v8 = this->uClipX - uOutX; |
9166 v8 = v7 - uOutX; | 9130 v9 = uOutX - this->uClipX; |
9167 v9 = uOutX - v7; | |
9168 v8 *= 2; | 9131 v8 *= 2; |
9169 v4 += v9; | 9132 v4 += v9; |
9170 v6 = (unsigned __int16 *)((char *)v6 + v8); | 9133 v6 = (unsigned __int16 *)((char *)v6 + v8); |
9171 v20 += v9; | |
9172 v5 = (unsigned __int16 *)((char *)v5 + v8); | 9134 v5 = (unsigned __int16 *)((char *)v5 + v8); |
9173 } | 9135 } |
9174 v10 = this->uClipY; | 9136 if ( (signed int)uOutY < (signed int)this->uClipY ) |
9175 if ( (signed int)uOutY < (signed int)v10 ) | 9137 { |
9176 { | 9138 v11 = this->uClipY - uOutY; |
9177 v11 = v10 - uOutY; | |
9178 v6 += v19 * v11; | 9139 v6 += v19 * v11; |
9179 v23 += uOutY - this->uClipY; | 9140 v23 += uOutY - this->uClipY; |
9180 v4 = v20; | |
9181 v5 += this->uTargetSurfacePitch * v11; | 9141 v5 += this->uTargetSurfacePitch * v11; |
9182 } | 9142 } |
9183 v12 = this->uClipX; | 9143 v12 = max(this->uClipX, uOutX); |
9184 if ( (signed int)v12 < (signed int)uOutX ) | 9144 if ( (signed int)(v4 + v12) > (signed int)this->uClipZ ) |
9185 v12 = uOutX; | 9145 { |
9186 v13 = this->uClipZ; | 9146 v4 = this->uClipZ - max(this->uClipX, uOutX); |
9187 if ( (signed int)(v4 + v12) > (signed int)v13 ) | 9147 } |
9188 { | 9148 v15 = max(this->uClipY, uOutY); |
9189 v14 = this->uClipX; | 9149 if ( (signed int)(v15 + v23) > (signed int)this->uClipW ) |
9190 if ( (signed int)v14 < (signed int)uOutX ) | 9150 { |
9191 v14 = uOutX; | 9151 v23 = this->uClipW - max(this->uClipY, uOutY); |
9192 v4 = v13 - v14; | 9152 } |
9193 } | 9153 } |
9194 v15 = this->uClipY; | 9154 |
9195 if ( (signed int)v15 < (signed int)uOutY ) | 9155 for (int outerCounter = 0; outerCounter < v23; outerCounter++) |
9196 v15 = uOutY; | 9156 { |
9197 uOutXa = this->uClipW; | 9157 for (int counter = 0; counter < v4; counter++) |
9198 if ( (signed int)(v15 + v23) > (signed int)uOutXa ) | 9158 { |
9199 { | 9159 *v5 = *v6; |
9200 v16 = this->uClipY; | 9160 ++v5; |
9201 if ( (signed int)v16 < (signed int)uOutY ) | 9161 ++v6; |
9202 v16 = uOutY; | 9162 } |
9203 v23 = uOutXa - v16; | 9163 v6 += v19 - v4; |
9204 } | 9164 v5 += this->uTargetSurfacePitch - v4; |
9205 } | |
9206 if ( v23 > 0 ) | |
9207 { | |
9208 uOutXb = v23; | |
9209 do | |
9210 { | |
9211 if ( v4 > 0 ) | |
9212 { | |
9213 v17 = v4; | |
9214 do | |
9215 { | |
9216 *v5 = *v6; | |
9217 ++v5; | |
9218 ++v6; | |
9219 --v17; | |
9220 } | |
9221 while ( v17 ); | |
9222 } | |
9223 v6 += v19 - v4; | |
9224 v18 = uOutXb-- == 1; | |
9225 v5 += this->uTargetSurfacePitch - v4; | |
9226 } | |
9227 while ( !v18 ); | |
9228 } | 9165 } |
9229 } | 9166 } |
9230 } | 9167 } |
9231 | 9168 |
9232 //----- (004A5D33) -------------------------------------------------------- | 9169 //----- (004A5D33) -------------------------------------------------------- |