Mercurial > might-and-magic-trilogy
diff mm7_4.cpp @ 200:c04d432611e1
2.12.13
author | Ritor1 |
---|---|
date | Wed, 02 Jan 2013 23:17:44 +0600 |
parents | 6109a4e23903 |
children | 11a199790ce0 |
line wrap: on
line diff
--- a/mm7_4.cpp Sat Dec 29 14:18:20 2012 +0600 +++ b/mm7_4.cpp Wed Jan 02 23:17:44 2013 +0600 @@ -6128,23 +6128,23 @@ { char *v0; // eax@5 char *v1; // edi@5 - FILE *v2; // eax@5 - unsigned int v3; // esi@7 - GUIFont *v4; // edx@9 - GUIFont *v5; // ecx@9 - __int16 v6; // ax@9 + FILE *pFile; // eax@5 + unsigned int pSize; // esi@7 + GUIFont *pFont; // edx@9 + GUIFont *pFont2; // ecx@9 + __int16 pHeight; // ax@9 void *v7; // eax@9 - unsigned int v8; // ST2C_4@9 - unsigned int v9; // eax@9 + unsigned int pNumPixels; // ST2C_4@9 + unsigned int teal; // eax@9 unsigned int v10; // ST2C_4@19 - unsigned int teal; // eax@19 + //unsigned int teal; // eax@19 //Texture v12; // [sp+Ch] [bp-130h]@5 //RGBTexture v16; // [sp+54h] [bp-E8h]@1 //double v15; // [sp+7Ch] [bp-C0h]@9 MSG Msg; // [sp+84h] [bp-B8h]@10 int v17; // [sp+A0h] [bp-9Ch]@9 - int a2; // [sp+A4h] [bp-98h]@9 - unsigned int a3; // [sp+A8h] [bp-94h]@9 + int pX; // [sp+A4h] [bp-98h]@9 + unsigned int pY; // [sp+A8h] [bp-94h]@9 int v20; // [sp+ACh] [bp-90h]@9 int a4; // [sp+B0h] [bp-8Ch]@9 int a8; // [sp+F8h] [bp-44h]@9 @@ -6155,12 +6155,13 @@ char *ptr; // [sp+130h] [bp-Ch]@5 GUIFont *pFontQuick; // [sp+134h] [bp-8h]@1 GUIFont *pFontCChar; // [sp+138h] [bp-4h]@1 - - RGBTexture v16; // [sp+54h] [bp-E8h]@1 + RGBTexture pTexture; // [sp+54h] [bp-E8h]@1 //RGBTexture::RGBTexture(&v16); - RGBTexture v21; // [sp+100h] [bp-3Ch]@1 + RGBTexture pTexture2; // [sp+100h] [bp-3Ch]@1 //RGBTexture::RGBTexture(&v21); - + Texture pTexture3; // [sp+Ch] [bp-130h]@5 + //Texture::Texture(&v12); + a5 = 0; pFontQuick = LoadFont("quick.fnt", "FONTPAL", 0); pFontCChar = LoadFont("cchar.fnt", "FONTPAL", 0); @@ -6171,77 +6172,55 @@ pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; dword_A74C88 = 0; pAudioPlayer->PlayMusicTrack(MUSIC_Credits); - v16.Load("mm6title.pcx", 0); + pTexture.Load("mm6title.pcx", 0); v0 = (char *)pEvents_LOD->LoadRaw("credits.txt", 0); v1 = v0; ptr = v0; - - Texture v12; // [sp+Ch] [bp-130h]@5 - //Texture::Texture(&v12); - - v2 = pEvents_LOD->FindContainer("credits.txt", 0); - if ( !v2 ) + pFile = pEvents_LOD->FindContainer("credits.txt", 0); + if ( !pFile ) Abortf(pGlobalTXT_LocalizationStrings[63]); // "Might and Magic VII is having trouble loading files. // Please re-install to fix this problem. Note: Re-installing will not destroy your save games." - fread(&v12, 1u, 0x30u, v2); - v3 = v12.uDecompressedSize; - if ( !v12.uDecompressedSize ) - v3 = v12.uTextureSize; - memset(&v12, 0, 0x48u); - v4 = pFontCChar; - v5 = pFontQuick; - v1[v3] = 0; + fread(&pTexture3, 1, 0x30, pFile); + pSize = pTexture3.uDecompressedSize; + if ( !pTexture3.uDecompressedSize ) + pSize = pTexture3.uTextureSize; + memset(&pTexture3, 0, 0x48); + pFont = pFontCChar; + pFont2 = pFontQuick; + v1[pSize] = 0; v20 = 250; a4 = 440; - a2 = 389; - a3 = 19; - v21.uWidth = 250; - v6 = v5->GetStringHeight2(v4, v1, (int)&a2, 0, 1); - v21.uHeight = v6 + 2 * a4; - v21.uNumPixels = (signed __int16)v21.uWidth * (signed __int16)v21.uHeight; - v7 = pAllocator->AllocNamedChunk(v21.pPixels, 2 * v21.uNumPixels, "scrollermap"); - v8 = v21.uNumPixels; - v21.pPixels = (unsigned __int16 *)v7; - v9 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0xFFu); - fill_pixels_fast(v9, v21.pPixels, v8); - v21.field_20 = 0; - v21.field_22 = 0; + pX = 389; + pY = 19; + pTexture2.uWidth = 250; + pHeight = pFont2->GetStringHeight2(pFont, v1, (int)&pX, 0, 1); + pTexture2.uHeight = pHeight + 2 * a4; + pTexture2.uNumPixels = (signed __int16)pTexture2.uWidth * (signed __int16)pTexture2.uHeight; + v7 = pAllocator->AllocNamedChunk(pTexture2.pPixels, 2 * pTexture2.uNumPixels, "scrollermap"); + pNumPixels = pTexture2.uNumPixels; + pTexture2.pPixels = (unsigned __int16 *)v7; + teal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0xFFu); + fill_pixels_fast(teal, pTexture2.pPixels, pNumPixels); + pTexture2.field_20 = 0; + pTexture2.field_22 = 0; a7 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x70u, 0x8Fu, 0xFEu); a8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xECu, 0xE6u, 0x9Cu); - pString = (char *)operator new(2 * v3); - strncpy(pString, ptr, v3); - pFontQuick->_44D2FD_prolly_draw_credits_entry( - pFontCChar, - 1, - a4 + 1, - (signed __int16)v21.uWidth, - (signed __int16)v21.uHeight, - 1u, - 1u, - pString, - v21.pPixels, - (signed __int16)v21.uWidth); - strncpy(pString, ptr, v3); - pFontQuick->_44D2FD_prolly_draw_credits_entry( - pFontCChar, - 0, - a4, - (signed __int16)v21.uWidth, - (signed __int16)v21.uHeight, - a7, - a8, - pString, - v21.pPixels, - (signed __int16)v21.uWidth); + pString = (char *)operator new(2 * pSize); + strncpy(pString, ptr, pSize); + pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 1, a4 + 1, (signed __int16)pTexture2.uWidth, (signed __int16)pTexture2.uHeight, 1, 1, pString, + pTexture2.pPixels, (signed __int16)pTexture2.uWidth); + strncpy(pString, ptr, pSize); + pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 0, a4, (signed __int16)pTexture2.uWidth, (signed __int16)pTexture2.uHeight, a7, a8, pString, pTexture2.pPixels, + (signed __int16)pTexture2.uWidth); free(pString); pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, (int)ptr); pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, 0x71u, 0, 0x1Bu, "", 0); - pCurrentScreen = 9; + pCurrentScreen = 9; // окно Credits SetCurrentMenuID(MENU_Credits); pRenderer->BeginScene(); - pRenderer->DrawTextureRGB(0, 0, &v16); - pRenderer->Clip(a2, a3, a2 + v20, a3 + a4); - pRenderer->_4A5D33(a2, a3, 0, 0, &v21); + pRenderer->DrawTextureRGB(0, 0, &pTexture); + pRenderer->Clip(pX, pY, pX + v20, pY + a4); + pRenderer->_4A5D33(pX, pY, 0, 0, &pTexture2); pRenderer->ResetClip(); pRenderer->EndScene(); pString = (char *)0x447A0000; @@ -6268,52 +6247,34 @@ pAsyncMouse->_46B736_consume_click_lists(1); if ( dword_A74C88 ) { - v16.Load("mm6title.pcx", 1); - v10 = v21.uNumPixels; + //pTexture.Load("mm6title.pcx", 1); + v10 = pTexture2.uNumPixels; teal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0xFFu); - fill_pixels_fast(teal, v21.pPixels, v10); + fill_pixels_fast(teal, pTexture2.pPixels, v10); strncpy(pTmpBuf, ptr, 0x7D0u); - pFontQuick->_44D2FD_prolly_draw_credits_entry( - pFontCChar, - 1, - a4 + 1, - (signed __int16)v21.uWidth, - (signed __int16)v21.uHeight, - 1u, - 1u, - pTmpBuf, - v21.pPixels, - (signed __int16)v21.uWidth); + pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 1, a4 + 1, (signed __int16)pTexture2.uWidth, (signed __int16)pTexture2.uHeight, 1, 1, pTmpBuf, + pTexture2.pPixels, (signed __int16)pTexture2.uWidth); strncpy(pTmpBuf, ptr, 0x7D0u); - pFontQuick->_44D2FD_prolly_draw_credits_entry( - pFontCChar, - 0, - a4, - (signed __int16)v21.uWidth, - (signed __int16)v21.uHeight, - a7, - a8, - pTmpBuf, - v21.pPixels, - (signed __int16)v21.uWidth); + pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 0, a4, (signed __int16)pTexture2.uWidth, (signed __int16)pTexture2.uHeight, a7, a8, pTmpBuf, + pTexture2.pPixels, (signed __int16)pTexture2.uWidth); dword_A74C88 = 0; pRenderer->BeginScene(); - pRenderer->DrawTextureRGB(0, 0, &v16); - pRenderer->Clip(a2, a3, a2 + v20, a2 + a4); - pRenderer->_4A5D33(a2, a3, 0, a5, &v21); + pRenderer->DrawTextureRGB(0, 0, &pTexture); + pRenderer->Clip(pX, pY, pX + v20, pX + a4); + pRenderer->_4A5D33(pX, pY, 0, a5, &pTexture2); pRenderer->ResetClip(); pRenderer->EndScene(); pRenderer->Present(); } timeGetTime(); pRenderer->BeginScene(); - pRenderer->DrawTextureRGB(0, 0, &v16); - pRenderer->Clip(a2, a3, a2 + v20, a3 + a4); - pRenderer->_4A5D33(a2, a3, 0, a5, &v21); + pRenderer->DrawTextureRGB(0, 0, &pTexture); + pRenderer->Clip(pX, pY, pX + v20, pY + a4); + pRenderer->_4A5D33(pX, pY, 0, a5, &pTexture2); pRenderer->ResetClip(); pRenderer->EndScene(); ++a5; - if ( a5 >= (signed __int16)v21.uHeight ) + if ( a5 >= (signed __int16)pTexture2.uHeight ) SetCurrentMenuID(MENU_MAIN); timeGetTime(); pRenderer->Present(); @@ -6332,8 +6293,8 @@ pAllocator->FreeChunk(pFontCChar); pWindow_MainMenu->Release(); pIcons_LOD->_4114F2(); - v16.Release(); - v21.Release(); + pTexture.Release(); + pTexture2.Release(); return MENU_MAIN; // return MENU_Main }