# HG changeset patch # User Grumpy7 # Date 1370184202 -7200 # Node ID 4eca5bb63dc06de496b297d1bc6f8f18f8d8410e # Parent 354ec6263123a3f2ddd506ac604a6c534ce3dc93 some small rendering cleanups - if+do while to for, unnecessary variable removal diff -r 354ec6263123 -r 4eca5bb63dc0 Render.cpp --- a/Render.cpp Sun Jun 02 05:42:28 2013 +0200 +++ b/Render.cpp Sun Jun 02 16:43:22 2013 +0200 @@ -8728,26 +8728,15 @@ bMipMaps = 0; v13 = pHWLTexture->pPixels; v14 = (unsigned __int16 *)desc.lpSurface; - if ( desc.dwHeight ) - { - do + for(int bMipMaps = 0; bMipMaps < desc.dwHeight; bMipMaps++) + { + for (v15 = 0; v15 < desc.dwWidth; v15++) { - v15 = 0; - if ( desc.dwWidth ) - { - do - { - ++v15; - *v14 = *v13; - ++v14; - ++v13; - } - while ( v15 < desc.dwWidth ); - } - ++bMipMaps; - v14 += (desc.lPitch >> 1) - desc.dwWidth; + *v14 = *v13; + ++v14; + ++v13; } - while ( bMipMaps < desc.dwHeight ); + v14 += (desc.lPitch >> 1) - desc.dwWidth; } ErrD3D((*pOutSurface)->Unlock(0)); } @@ -8813,14 +8802,14 @@ //----- (004A51CB) -------------------------------------------------------- void Render::BeginScene() { - Render *v1; // esi@1 + //Render *v1; // esi@1 unsigned int v2; // eax@1 - int v3; // eax@5 +/*int v3; // eax@5 unsigned __int16 **v4; // edi@6 - char *v5; // ebx@7 + char *v5; // ebx@7*/ DDSURFACEDESC2 Dst; // [sp+Ch] [bp-7Ch]@4 - v1 = this; + //v1 = this; v2 = this->uNumSceneBegins; this->uNumSceneBegins = v2 + 1; if ( !v2 ) @@ -8831,36 +8820,27 @@ { memset(&Dst, 0, 0x7Cu); Dst.dwSize = 124; - if ( LockSurface_DDraw4(v1->pColorKeySurface4, &Dst, 0x800 | DDLOCK_WAIT) ) - { - v1->pTargetSurface = (unsigned __int16 *)Dst.lpSurface; - v3 = Dst.lPitch >> 1; - v1->uTargetSurfacePitch = Dst.lPitch >> 1; -LABEL_10: - v1->field_18_locked_pitch = v3; - goto LABEL_11; - } - goto LABEL_8; + if ( LockSurface_DDraw4(this->pColorKeySurface4, &Dst, 0x800 | DDLOCK_WAIT) ) + { + this->pTargetSurface = (unsigned __int16 *)Dst.lpSurface; + this->uTargetSurfacePitch = Dst.lPitch >> 1; + this->field_18_locked_pitch = Dst.lPitch >> 1; + } + --this->uNumSceneBegins; } } else { - v4 = &this->pTargetSurface; if ( !this->pTargetSurface ) { - v5 = (char *)&this->uTargetSurfacePitch; LockRenderSurface((void **)&this->pTargetSurface, &this->uTargetSurfacePitch); - if ( *v4 ) - { - v3 = *(int *)v5; - goto LABEL_10; - } -LABEL_8: - --v1->uNumSceneBegins; - return; - } - } -LABEL_11: + if ( this->pTargetSurface ) + { + this->field_18_locked_pitch = this->uTargetSurfacePitch; + } + --this->uNumSceneBegins; + } + } RestoreFrontBuffer(); } } @@ -8868,16 +8848,10 @@ //----- (004A527D) -------------------------------------------------------- void Render::EndScene() { - unsigned int v1; // edx@1 - unsigned int v2; // edx@2 - HRESULT v3; // eax@5 - - v1 = this->uNumSceneBegins; - if ( v1 ) - { - v2 = v1 - 1; - this->uNumSceneBegins = v2; - if ( !v2 ) + if ( this->uNumSceneBegins ) + { + this->uNumSceneBegins--; + if ( !this->uNumSceneBegins ) { if ( this->pRenderD3D ) {