comparison Render.cpp @ 1151:4eca5bb63dc0

some small rendering cleanups - if+do while to for, unnecessary variable removal
author Grumpy7
date Sun, 02 Jun 2013 16:43:22 +0200
parents ad89d1905b48
children d8b455c81917
comparison
equal deleted inserted replaced
1150:354ec6263123 1151:4eca5bb63dc0
8726 if ( LockSurface_DDraw4(*pOutSurface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) ) 8726 if ( LockSurface_DDraw4(*pOutSurface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY) )
8727 { 8727 {
8728 bMipMaps = 0; 8728 bMipMaps = 0;
8729 v13 = pHWLTexture->pPixels; 8729 v13 = pHWLTexture->pPixels;
8730 v14 = (unsigned __int16 *)desc.lpSurface; 8730 v14 = (unsigned __int16 *)desc.lpSurface;
8731 if ( desc.dwHeight ) 8731 for(int bMipMaps = 0; bMipMaps < desc.dwHeight; bMipMaps++)
8732 { 8732 {
8733 do 8733 for (v15 = 0; v15 < desc.dwWidth; v15++)
8734 { 8734 {
8735 v15 = 0; 8735 *v14 = *v13;
8736 if ( desc.dwWidth ) 8736 ++v14;
8737 { 8737 ++v13;
8738 do
8739 {
8740 ++v15;
8741 *v14 = *v13;
8742 ++v14;
8743 ++v13;
8744 }
8745 while ( v15 < desc.dwWidth );
8746 }
8747 ++bMipMaps;
8748 v14 += (desc.lPitch >> 1) - desc.dwWidth;
8749 } 8738 }
8750 while ( bMipMaps < desc.dwHeight ); 8739 v14 += (desc.lPitch >> 1) - desc.dwWidth;
8751 } 8740 }
8752 ErrD3D((*pOutSurface)->Unlock(0)); 8741 ErrD3D((*pOutSurface)->Unlock(0));
8753 } 8742 }
8754 } 8743 }
8755 delete [] pHWLTexture->pPixels; 8744 delete [] pHWLTexture->pPixels;
8811 } 8800 }
8812 8801
8813 //----- (004A51CB) -------------------------------------------------------- 8802 //----- (004A51CB) --------------------------------------------------------
8814 void Render::BeginScene() 8803 void Render::BeginScene()
8815 { 8804 {
8816 Render *v1; // esi@1 8805 //Render *v1; // esi@1
8817 unsigned int v2; // eax@1 8806 unsigned int v2; // eax@1
8818 int v3; // eax@5 8807 /*int v3; // eax@5
8819 unsigned __int16 **v4; // edi@6 8808 unsigned __int16 **v4; // edi@6
8820 char *v5; // ebx@7 8809 char *v5; // ebx@7*/
8821 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-7Ch]@4 8810 DDSURFACEDESC2 Dst; // [sp+Ch] [bp-7Ch]@4
8822 8811
8823 v1 = this; 8812 //v1 = this;
8824 v2 = this->uNumSceneBegins; 8813 v2 = this->uNumSceneBegins;
8825 this->uNumSceneBegins = v2 + 1; 8814 this->uNumSceneBegins = v2 + 1;
8826 if ( !v2 ) 8815 if ( !v2 )
8827 { 8816 {
8828 if ( this->pRenderD3D ) 8817 if ( this->pRenderD3D )
8829 { 8818 {
8830 if ( this->bColorKeySupported ) 8819 if ( this->bColorKeySupported )
8831 { 8820 {
8832 memset(&Dst, 0, 0x7Cu); 8821 memset(&Dst, 0, 0x7Cu);
8833 Dst.dwSize = 124; 8822 Dst.dwSize = 124;
8834 if ( LockSurface_DDraw4(v1->pColorKeySurface4, &Dst, 0x800 | DDLOCK_WAIT) ) 8823 if ( LockSurface_DDraw4(this->pColorKeySurface4, &Dst, 0x800 | DDLOCK_WAIT) )
8835 { 8824 {
8836 v1->pTargetSurface = (unsigned __int16 *)Dst.lpSurface; 8825 this->pTargetSurface = (unsigned __int16 *)Dst.lpSurface;
8837 v3 = Dst.lPitch >> 1; 8826 this->uTargetSurfacePitch = Dst.lPitch >> 1;
8838 v1->uTargetSurfacePitch = Dst.lPitch >> 1; 8827 this->field_18_locked_pitch = Dst.lPitch >> 1;
8839 LABEL_10:
8840 v1->field_18_locked_pitch = v3;
8841 goto LABEL_11;
8842 } 8828 }
8843 goto LABEL_8; 8829 --this->uNumSceneBegins;
8844 } 8830 }
8845 } 8831 }
8846 else 8832 else
8847 { 8833 {
8848 v4 = &this->pTargetSurface;
8849 if ( !this->pTargetSurface ) 8834 if ( !this->pTargetSurface )
8850 { 8835 {
8851 v5 = (char *)&this->uTargetSurfacePitch;
8852 LockRenderSurface((void **)&this->pTargetSurface, &this->uTargetSurfacePitch); 8836 LockRenderSurface((void **)&this->pTargetSurface, &this->uTargetSurfacePitch);
8853 if ( *v4 ) 8837 if ( this->pTargetSurface )
8854 { 8838 {
8855 v3 = *(int *)v5; 8839 this->field_18_locked_pitch = this->uTargetSurfacePitch;
8856 goto LABEL_10;
8857 } 8840 }
8858 LABEL_8: 8841 --this->uNumSceneBegins;
8859 --v1->uNumSceneBegins; 8842 }
8860 return; 8843 }
8861 }
8862 }
8863 LABEL_11:
8864 RestoreFrontBuffer(); 8844 RestoreFrontBuffer();
8865 } 8845 }
8866 } 8846 }
8867 8847
8868 //----- (004A527D) -------------------------------------------------------- 8848 //----- (004A527D) --------------------------------------------------------
8869 void Render::EndScene() 8849 void Render::EndScene()
8870 { 8850 {
8871 unsigned int v1; // edx@1 8851 if ( this->uNumSceneBegins )
8872 unsigned int v2; // edx@2 8852 {
8873 HRESULT v3; // eax@5 8853 this->uNumSceneBegins--;
8874 8854 if ( !this->uNumSceneBegins )
8875 v1 = this->uNumSceneBegins;
8876 if ( v1 )
8877 {
8878 v2 = v1 - 1;
8879 this->uNumSceneBegins = v2;
8880 if ( !v2 )
8881 { 8855 {
8882 if ( this->pRenderD3D ) 8856 if ( this->pRenderD3D )
8883 { 8857 {
8884 if ( this->bColorKeySupported ) 8858 if ( this->bColorKeySupported )
8885 { 8859 {