Mercurial > mm7
diff Render.cpp @ 1164:6b911d7e09a5
RenderHWLContainer::RenderHWLContainer, Render::SetPixel, Render::ChangeBetweenWinFullscreenModes cleanup
author | Grumpy7 |
---|---|
date | Tue, 04 Jun 2013 02:03:43 +0200 |
parents | 79fd2fb7a3ab |
children | 29a8defbad9e |
line wrap: on
line diff
--- a/Render.cpp Tue Jun 04 01:41:12 2013 +0200 +++ b/Render.cpp Tue Jun 04 02:03:43 2013 +0200 @@ -10555,27 +10555,19 @@ void Render::ChangeBetweenWinFullscreenModes() { float v0; // ST14_4@17 - bool v1; // edx@24 - signed int v2; // ecx@24 - int v3; // esi@25 int v4; // edx@26 ObjectDesc *v5; // eax@26 RGBTexture *v6; // esi@33 - const char *v7; // eax@34 const char *v8; // [sp-4h] [bp-28h]@33 - int v9; // [sp+0h] [bp-24h]@33 struct tagRECT Rect; // [sp+14h] [bp-10h]@15 - if ( pRenderer->bWindowMode ) - goto LABEL_52; - if ( dword_6BE364_game_settings_1 & 2 ) + if ( !pRenderer->bWindowMode && (dword_6BE364_game_settings_1 & 2) ) { ModalWindow(pGlobalTXT_LocalizationStrings[62], 0);// "Might and Magic VII requires your desktop to be in 16bit (32k or 65k) Color mode in order to operate in a window." return; } - if ( !pRenderer->pRenderD3D || pRenderer->pRenderD3D->pAvailableDevices->bIsDeviceCompatible ) - { -LABEL_52: + if ( pRenderer->bWindowMode || !pRenderer->pRenderD3D || pRenderer->pRenderD3D->pAvailableDevices->bIsDeviceCompatible ) + { if ( pEventTimer->bPaused ) BYTE1(dword_6BE364_game_settings_1) |= 8u; else @@ -10618,59 +10610,49 @@ pBitmaps_LOD->_410423_move_textures_to_device(); pSprites_LOD->MoveSpritesToVideoMemory(); } - if ( pPaletteManager->uNumTargetBBits == pRenderer->uTargetBBits + if (!( pPaletteManager->uNumTargetBBits == pRenderer->uTargetBBits && pPaletteManager->uNumTargetGBits == pRenderer->uTargetGBits - && pPaletteManager->uNumTargetRBits == pRenderer->uTargetRBits ) - goto LABEL_38; - pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); - pPaletteManager->RecalculateAll(); - pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); - pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); - v2 = 0; - if ( (signed int)pObjectList->uNumObjects > 0 ) - { - v3 = 0; - do + && pPaletteManager->uNumTargetRBits == pRenderer->uTargetRBits )) + { + pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); + pPaletteManager->RecalculateAll(); + pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); + pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); + for (int i = 0; i < pObjectList->uNumObjects; i++) { BYTE3(v4) = 0; - v5 = &pObjectList->pObjects[v3]; - ++v3; + v5 = &pObjectList->pObjects[i]; *(short *)((char *)&v4 + 1) = v5->uParticleTrailColorR; LOBYTE(v4) = v5->uParticleTrailColorG; v5->uParticleTrailColor = v5->uParticleTrailColorB | (v4 << 8); - ++v2; - } - while ( v2 < (signed int)pObjectList->uNumObjects ); - } - LOBYTE(v1) = 1; - SetUserInterface(pParty->alignment, v1); - if ( pVideoPlayer->pVideoFrame.pPixels ) - pVideoPlayer->pVideoFrame.Load(pVideoPlayer->pVideoFrameTextureFilename, 1); - if ( uCurrentMenuID ) - { + } + SetUserInterface(pParty->alignment, true); + if ( pVideoPlayer->pVideoFrame.pPixels ) + pVideoPlayer->pVideoFrame.Load(pVideoPlayer->pVideoFrameTextureFilename, 1); if ( uCurrentMenuID != 6 ) { if ( uCurrentMenuID == 8 ) - dword_A74C88 = 1; - goto LABEL_38; - } - v6 = &pTexture_PCX; - pTexture_PCX.Release(); - v9 = 0; - v8 = "makeme.pcx"; - } - else - { - v6 = &pTexture_PCX; - pTexture_PCX.Release(); - v7 = "title.pcx"; - if ( uCurrentMenuID ) - v7 = "lsave640.pcx"; - v9 = 0; - v8 = v7; - } - v6->Load(v8, v9); -LABEL_38: + dword_A74C88 = 1; + } + else + { + if ( uCurrentMenuID ) + { + v6 = &pTexture_PCX; + pTexture_PCX.Release(); + v8 = "makeme.pcx"; + } + else + { + v6 = &pTexture_PCX; + pTexture_PCX.Release(); + v8 = "title.pcx"; + if ( uCurrentMenuID ) + v8 = "lsave640.pcx"; + } + v6->Load(v8, 0); + } + } viewparams->bRedrawGameUI = 1; viewparams->InitGrayPalette(); pMouse->SetCurrentCursorBitmap(); @@ -10705,28 +10687,14 @@ //----- (0040DBD3) -------------------------------------------------------- void __fastcall Render::SetPixel(Vec2_int_ *pTargetXY, unsigned __int16 uColor) { - Vec2_int_ *pTargetXY_; // esi@1 - unsigned __int16 v3; // di@1 - signed int v4; // ecx@2 - signed int v5; // eax@4 - - pTargetXY_ = pTargetXY; - v3 = uColor; pRenderer->BeginScene(); if ( pRenderer->uNumSceneBegins ) { - v4 = pTargetXY_->x; - if ( pTargetXY_->x >= 0 ) - { - if ( v4 <= 639 ) - { - v5 = pTargetXY_->y; - if ( v5 >= 0 ) - { - if ( v5 <= 479 ) - pRenderer->pTargetSurface[v4 + pRenderer->uTargetSurfacePitch * v5] = v3; - } - } + int xVal = pTargetXY->x; + int yVal = pTargetXY->y; + if ( xVal >= 0 && xVal <= 639 && yVal >= 0 && yVal <= 479) + { + pRenderer->pTargetSurface[xVal + pRenderer->uTargetSurfacePitch * yVal] = uColor; } pRenderer->EndScene(); } @@ -10810,7 +10778,7 @@ else fread(pTex->pPixels, 2, pTex->uWidth * pTex->uHeight, pFile); - if ( field_61A94_scale_hwls_to_half ) + if ( field_61A94_scale_hwls_to_half ) //is it even possible to ever get here? field_61A94_scale_hwls_to_half is only set to zero { v11 = pTex->uHeight / 2; v12 = pTex->uWidth / 2; @@ -10904,15 +10872,12 @@ RenderHWLContainer::RenderHWLContainer(): bDumpDebug(false) { - RenderHWLContainer *v1; // esi@1 - - v1 = this; this->pFile = 0; uSignature = 0; - v1->uDataOffset = 0; - memset(&v1->uNumItems, 0, 0x61A84u); - v1->uNumItems = 0; - v1->field_61A94_scale_hwls_to_half = 0; + this->uDataOffset = 0; + memset(&this->uNumItems, 0, 0x61A84u); + this->uNumItems = 0; + this->field_61A94_scale_hwls_to_half = 0; } //----- (0045237F) --------------------------------------------------------