Mercurial > mm7
comparison 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 |
comparison
equal
deleted
inserted
replaced
1163:3d96daa7e069 | 1164:6b911d7e09a5 |
---|---|
10553 | 10553 |
10554 //----- (004667E9) -------------------------------------------------------- | 10554 //----- (004667E9) -------------------------------------------------------- |
10555 void Render::ChangeBetweenWinFullscreenModes() | 10555 void Render::ChangeBetweenWinFullscreenModes() |
10556 { | 10556 { |
10557 float v0; // ST14_4@17 | 10557 float v0; // ST14_4@17 |
10558 bool v1; // edx@24 | |
10559 signed int v2; // ecx@24 | |
10560 int v3; // esi@25 | |
10561 int v4; // edx@26 | 10558 int v4; // edx@26 |
10562 ObjectDesc *v5; // eax@26 | 10559 ObjectDesc *v5; // eax@26 |
10563 RGBTexture *v6; // esi@33 | 10560 RGBTexture *v6; // esi@33 |
10564 const char *v7; // eax@34 | |
10565 const char *v8; // [sp-4h] [bp-28h]@33 | 10561 const char *v8; // [sp-4h] [bp-28h]@33 |
10566 int v9; // [sp+0h] [bp-24h]@33 | |
10567 struct tagRECT Rect; // [sp+14h] [bp-10h]@15 | 10562 struct tagRECT Rect; // [sp+14h] [bp-10h]@15 |
10568 | 10563 |
10569 if ( pRenderer->bWindowMode ) | 10564 if ( !pRenderer->bWindowMode && (dword_6BE364_game_settings_1 & 2) ) |
10570 goto LABEL_52; | |
10571 if ( dword_6BE364_game_settings_1 & 2 ) | |
10572 { | 10565 { |
10573 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." | 10566 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." |
10574 return; | 10567 return; |
10575 } | 10568 } |
10576 if ( !pRenderer->pRenderD3D || pRenderer->pRenderD3D->pAvailableDevices->bIsDeviceCompatible ) | 10569 if ( pRenderer->bWindowMode || !pRenderer->pRenderD3D || pRenderer->pRenderD3D->pAvailableDevices->bIsDeviceCompatible ) |
10577 { | 10570 { |
10578 LABEL_52: | |
10579 if ( pEventTimer->bPaused ) | 10571 if ( pEventTimer->bPaused ) |
10580 BYTE1(dword_6BE364_game_settings_1) |= 8u; | 10572 BYTE1(dword_6BE364_game_settings_1) |= 8u; |
10581 else | 10573 else |
10582 pEventTimer->Pause(); | 10574 pEventTimer->Pause(); |
10583 if ( pMiscTimer->bPaused ) | 10575 if ( pMiscTimer->bPaused ) |
10616 if ( pRenderer->pRenderD3D ) | 10608 if ( pRenderer->pRenderD3D ) |
10617 { | 10609 { |
10618 pBitmaps_LOD->_410423_move_textures_to_device(); | 10610 pBitmaps_LOD->_410423_move_textures_to_device(); |
10619 pSprites_LOD->MoveSpritesToVideoMemory(); | 10611 pSprites_LOD->MoveSpritesToVideoMemory(); |
10620 } | 10612 } |
10621 if ( pPaletteManager->uNumTargetBBits == pRenderer->uTargetBBits | 10613 if (!( pPaletteManager->uNumTargetBBits == pRenderer->uTargetBBits |
10622 && pPaletteManager->uNumTargetGBits == pRenderer->uTargetGBits | 10614 && pPaletteManager->uNumTargetGBits == pRenderer->uTargetGBits |
10623 && pPaletteManager->uNumTargetRBits == pRenderer->uTargetRBits ) | 10615 && pPaletteManager->uNumTargetRBits == pRenderer->uTargetRBits )) |
10624 goto LABEL_38; | 10616 { |
10625 pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); | 10617 pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); |
10626 pPaletteManager->RecalculateAll(); | 10618 pPaletteManager->RecalculateAll(); |
10627 pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); | 10619 pBitmaps_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); |
10628 pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); | 10620 pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); |
10629 v2 = 0; | 10621 for (int i = 0; i < pObjectList->uNumObjects; i++) |
10630 if ( (signed int)pObjectList->uNumObjects > 0 ) | |
10631 { | |
10632 v3 = 0; | |
10633 do | |
10634 { | 10622 { |
10635 BYTE3(v4) = 0; | 10623 BYTE3(v4) = 0; |
10636 v5 = &pObjectList->pObjects[v3]; | 10624 v5 = &pObjectList->pObjects[i]; |
10637 ++v3; | |
10638 *(short *)((char *)&v4 + 1) = v5->uParticleTrailColorR; | 10625 *(short *)((char *)&v4 + 1) = v5->uParticleTrailColorR; |
10639 LOBYTE(v4) = v5->uParticleTrailColorG; | 10626 LOBYTE(v4) = v5->uParticleTrailColorG; |
10640 v5->uParticleTrailColor = v5->uParticleTrailColorB | (v4 << 8); | 10627 v5->uParticleTrailColor = v5->uParticleTrailColorB | (v4 << 8); |
10641 ++v2; | 10628 } |
10642 } | 10629 SetUserInterface(pParty->alignment, true); |
10643 while ( v2 < (signed int)pObjectList->uNumObjects ); | 10630 if ( pVideoPlayer->pVideoFrame.pPixels ) |
10644 } | 10631 pVideoPlayer->pVideoFrame.Load(pVideoPlayer->pVideoFrameTextureFilename, 1); |
10645 LOBYTE(v1) = 1; | |
10646 SetUserInterface(pParty->alignment, v1); | |
10647 if ( pVideoPlayer->pVideoFrame.pPixels ) | |
10648 pVideoPlayer->pVideoFrame.Load(pVideoPlayer->pVideoFrameTextureFilename, 1); | |
10649 if ( uCurrentMenuID ) | |
10650 { | |
10651 if ( uCurrentMenuID != 6 ) | 10632 if ( uCurrentMenuID != 6 ) |
10652 { | 10633 { |
10653 if ( uCurrentMenuID == 8 ) | 10634 if ( uCurrentMenuID == 8 ) |
10654 dword_A74C88 = 1; | 10635 dword_A74C88 = 1; |
10655 goto LABEL_38; | 10636 } |
10656 } | 10637 else |
10657 v6 = &pTexture_PCX; | 10638 { |
10658 pTexture_PCX.Release(); | 10639 if ( uCurrentMenuID ) |
10659 v9 = 0; | 10640 { |
10660 v8 = "makeme.pcx"; | 10641 v6 = &pTexture_PCX; |
10661 } | 10642 pTexture_PCX.Release(); |
10662 else | 10643 v8 = "makeme.pcx"; |
10663 { | 10644 } |
10664 v6 = &pTexture_PCX; | 10645 else |
10665 pTexture_PCX.Release(); | 10646 { |
10666 v7 = "title.pcx"; | 10647 v6 = &pTexture_PCX; |
10667 if ( uCurrentMenuID ) | 10648 pTexture_PCX.Release(); |
10668 v7 = "lsave640.pcx"; | 10649 v8 = "title.pcx"; |
10669 v9 = 0; | 10650 if ( uCurrentMenuID ) |
10670 v8 = v7; | 10651 v8 = "lsave640.pcx"; |
10671 } | 10652 } |
10672 v6->Load(v8, v9); | 10653 v6->Load(v8, 0); |
10673 LABEL_38: | 10654 } |
10655 } | |
10674 viewparams->bRedrawGameUI = 1; | 10656 viewparams->bRedrawGameUI = 1; |
10675 viewparams->InitGrayPalette(); | 10657 viewparams->InitGrayPalette(); |
10676 pMouse->SetCurrentCursorBitmap(); | 10658 pMouse->SetCurrentCursorBitmap(); |
10677 if ( pRenderer->bWindowMode ) | 10659 if ( pRenderer->bWindowMode ) |
10678 { | 10660 { |
10703 } | 10685 } |
10704 | 10686 |
10705 //----- (0040DBD3) -------------------------------------------------------- | 10687 //----- (0040DBD3) -------------------------------------------------------- |
10706 void __fastcall Render::SetPixel(Vec2_int_ *pTargetXY, unsigned __int16 uColor) | 10688 void __fastcall Render::SetPixel(Vec2_int_ *pTargetXY, unsigned __int16 uColor) |
10707 { | 10689 { |
10708 Vec2_int_ *pTargetXY_; // esi@1 | |
10709 unsigned __int16 v3; // di@1 | |
10710 signed int v4; // ecx@2 | |
10711 signed int v5; // eax@4 | |
10712 | |
10713 pTargetXY_ = pTargetXY; | |
10714 v3 = uColor; | |
10715 pRenderer->BeginScene(); | 10690 pRenderer->BeginScene(); |
10716 if ( pRenderer->uNumSceneBegins ) | 10691 if ( pRenderer->uNumSceneBegins ) |
10717 { | 10692 { |
10718 v4 = pTargetXY_->x; | 10693 int xVal = pTargetXY->x; |
10719 if ( pTargetXY_->x >= 0 ) | 10694 int yVal = pTargetXY->y; |
10720 { | 10695 if ( xVal >= 0 && xVal <= 639 && yVal >= 0 && yVal <= 479) |
10721 if ( v4 <= 639 ) | 10696 { |
10722 { | 10697 pRenderer->pTargetSurface[xVal + pRenderer->uTargetSurfacePitch * yVal] = uColor; |
10723 v5 = pTargetXY_->y; | |
10724 if ( v5 >= 0 ) | |
10725 { | |
10726 if ( v5 <= 479 ) | |
10727 pRenderer->pTargetSurface[v4 + pRenderer->uTargetSurfacePitch * v5] = v3; | |
10728 } | |
10729 } | |
10730 } | 10698 } |
10731 pRenderer->EndScene(); | 10699 pRenderer->EndScene(); |
10732 } | 10700 } |
10733 } | 10701 } |
10734 | 10702 |
10808 delete [] pCompressedData; | 10776 delete [] pCompressedData; |
10809 } | 10777 } |
10810 else | 10778 else |
10811 fread(pTex->pPixels, 2, pTex->uWidth * pTex->uHeight, pFile); | 10779 fread(pTex->pPixels, 2, pTex->uWidth * pTex->uHeight, pFile); |
10812 | 10780 |
10813 if ( field_61A94_scale_hwls_to_half ) | 10781 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 |
10814 { | 10782 { |
10815 v11 = pTex->uHeight / 2; | 10783 v11 = pTex->uHeight / 2; |
10816 v12 = pTex->uWidth / 2; | 10784 v12 = pTex->uWidth / 2; |
10817 pTex->uHeight = v11; | 10785 pTex->uHeight = v11; |
10818 pTex->uWidth = v12; | 10786 pTex->uWidth = v12; |
10902 | 10870 |
10903 //----- (00452347) -------------------------------------------------------- | 10871 //----- (00452347) -------------------------------------------------------- |
10904 RenderHWLContainer::RenderHWLContainer(): | 10872 RenderHWLContainer::RenderHWLContainer(): |
10905 bDumpDebug(false) | 10873 bDumpDebug(false) |
10906 { | 10874 { |
10907 RenderHWLContainer *v1; // esi@1 | |
10908 | |
10909 v1 = this; | |
10910 this->pFile = 0; | 10875 this->pFile = 0; |
10911 uSignature = 0; | 10876 uSignature = 0; |
10912 v1->uDataOffset = 0; | 10877 this->uDataOffset = 0; |
10913 memset(&v1->uNumItems, 0, 0x61A84u); | 10878 memset(&this->uNumItems, 0, 0x61A84u); |
10914 v1->uNumItems = 0; | 10879 this->uNumItems = 0; |
10915 v1->field_61A94_scale_hwls_to_half = 0; | 10880 this->field_61A94_scale_hwls_to_half = 0; |
10916 } | 10881 } |
10917 | 10882 |
10918 //----- (0045237F) -------------------------------------------------------- | 10883 //----- (0045237F) -------------------------------------------------------- |
10919 bool RenderHWLContainer::Load(const wchar_t *pFilename) | 10884 bool RenderHWLContainer::Load(const wchar_t *pFilename) |
10920 { | 10885 { |