Mercurial > mm7
diff UI/UIMainMenu.cpp @ 1698:8cfb2e978445
Merge
author | Ritor1 |
---|---|
date | Sun, 22 Sep 2013 16:45:46 +0600 |
parents | 6faacde46271 |
children | 03d9336e862f |
line wrap: on
line diff
--- a/UI/UIMainMenu.cpp Sun Sep 22 16:45:25 2013 +0600 +++ b/UI/UIMainMenu.cpp Sun Sep 22 16:45:46 2013 +0600 @@ -194,75 +194,73 @@ //----- (004979D2) -------------------------------------------------------- MENU_STATE MainMenuUI_Credits_Loop() { - char *v1; // edi@5 + char *cred_texturet; // edi@5 FILE *pFile; // eax@5 unsigned int pSize; // esi@7 - __int16 pHeight; // ax@9 - void *v7; // eax@9 - unsigned int pNumPixels; // ST2C_4@9 - unsigned int v10; // ST2C_4@19 MSG Msg; // [sp+84h] [bp-B8h]@10 - int v17; // [sp+A0h] [bp-9Ch]@9 GUIWindow credit_window; - int a5; // [sp+128h] [bp-14h]@1 + int move_Y; // [sp+128h] [bp-14h]@1 char *pString; // [sp+12Ch] [bp-10h]@9 - char *ptr; // [sp+130h] [bp-Ch]@5 GUIFont *pFontQuick; // [sp+134h] [bp-8h]@1 GUIFont *pFontCChar; // [sp+138h] [bp-4h]@1 - RGBTexture pTexture; // [sp+54h] [bp-E8h]@1 - RGBTexture pTexture2; // [sp+100h] [bp-3Ch]@1 - Texture pTexture3; // [sp+Ch] [bp-130h]@5 + RGBTexture mm6title_texture; // [sp+54h] [bp-E8h]@1 + RGBTexture cred_texture; // [sp+100h] [bp-3Ch]@1 + Texture pTemporaryTexture; // [sp+Ch] [bp-130h]@5 - a5 = 0; pFontQuick = LoadFont("quick.fnt", "FONTPAL", NULL); pFontCChar = LoadFont("cchar.fnt", "FONTPAL", NULL); + if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - dword_A74C88 = 0; + //dword_A74C88 = 0;//??? часть дальнейшего кода отсутствует, там использовалась данная переменная + pAudioPlayer->PlayMusicTrack(MUSIC_Credits); - pTexture.Load("mm6title.pcx", 0); - ptr = (char *)pEvents_LOD->LoadRaw("credits.txt", 0); - v1 = ptr; + + mm6title_texture.Load("mm6title.pcx", 0); + cred_texturet = (char *)pEvents_LOD->LoadRaw("credits.txt", 0); pFile = pEvents_LOD->FindContainer("credits.txt", 0); if ( !pFile ) Error(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(&pTexture3, 1, 0x30, pFile); - pSize = pTexture3.uDecompressedSize; - if ( !pTexture3.uDecompressedSize ) - pSize = pTexture3.uTextureSize; - memset(&pTexture3, 0, 0x48); - v1[pSize] = 0; + + //для получения размера----------------------- + fread(&pTemporaryTexture, 1, 0x30, pFile); + pSize = pTemporaryTexture.uDecompressedSize; + if ( !pSize ) + pSize = pTemporaryTexture.uTextureSize; + memset(&pTemporaryTexture, 0, 0x48);//обнуление + cred_texturet[pSize] = 0;//конец текста credit_window.uFrameWidth = 250; credit_window.uFrameHeight = 440; credit_window.uFrameX = 389; credit_window.uFrameY = 19; - pTexture2.uWidth = 250; - pHeight = pFontQuick->GetStringHeight2(pFontCChar, v1, &credit_window, 0, 1); - pTexture2.uHeight = pHeight + 2 * credit_window.uFrameHeight; - pTexture2.uNumPixels = (signed __int16)pTexture2.uWidth * (signed __int16)pTexture2.uHeight; - v7 = malloc(2 * pTexture2.uNumPixels);//, "scrollermap"); - pNumPixels = pTexture2.uNumPixels; - pTexture2.pPixels = (unsigned __int16 *)v7; - fill_pixels_fast(TargetColor(0, 0xFFu, 0xFFu), pTexture2.pPixels, pNumPixels); - pTexture2._allocation_flags = 0; + cred_texture.uWidth = 250; + cred_texture.uHeight = pFontQuick->GetStringHeight2(pFontCChar, cred_texturet, &credit_window, 0, 1) + 2 * credit_window.uFrameHeight; + cred_texture.uNumPixels = cred_texture.uWidth * cred_texture.uHeight; + cred_texture.pPixels = (unsigned __int16 *)malloc(2 * cred_texture.uNumPixels); + fill_pixels_fast(TargetColor(0, 0xFFu, 0xFFu), cred_texture.pPixels, cred_texture.uNumPixels); + cred_texture._allocation_flags = 0; + + //дать шрифт и цвета тексту pString = (char *)malloc(2 * pSize); - strncpy(pString, ptr, pSize); - pString[pSize]=0; - pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 0, credit_window.uFrameHeight, (signed __int16)pTexture2.uWidth, - (signed __int16)pTexture2.uHeight, TargetColor(0x70u, 0x8Fu, 0xFEu), TargetColor(0xECu, 0xE6u, 0x9Cu), pString, pTexture2.pPixels, - (signed __int16)pTexture2.uWidth); + strncpy(pString, cred_texturet, pSize); + pString[pSize] = 0; + pFontQuick->_44D2FD_prolly_draw_credits_entry(pFontCChar, 0, credit_window.uFrameHeight, cred_texture.uWidth, + cred_texture.uHeight, TargetColor(0x70u, 0x8Fu, 0xFEu), TargetColor(0xECu, 0xE6u, 0x9Cu), pString, cred_texture.pPixels, cred_texture.uWidth); free(pString); - pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, ptr); - pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_Escape, 0, 0x1Bu, "", 0); + + pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, cred_texturet); + pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_Escape, 0, 27, "", 0); pCurrentScreen = SCREEN_CREATORS; SetCurrentMenuID(MENU_CREDITSPROC); + + move_Y = 0; do { while ( PeekMessageA(&Msg, 0, 0, 0, 1) ) @@ -279,14 +277,14 @@ else { pRenderer->BeginScene(); - pRenderer->DrawTextureRGB(0, 0, &pTexture); + pRenderer->DrawTextureRGB(0, 0, &mm6title_texture); pRenderer->SetTextureClipRect(credit_window.uFrameX, credit_window.uFrameY, credit_window.uFrameX + credit_window.uFrameWidth, credit_window.uFrameY + credit_window.uFrameHeight); - pRenderer->_4A5D33(credit_window.uFrameX, credit_window.uFrameY, 0, a5, &pTexture2); + pRenderer->CreditsTextureScroll(credit_window.uFrameX, credit_window.uFrameY, 0, move_Y, &cred_texture); pRenderer->ResetTextureClipRect(); pRenderer->EndScene(); - ++a5; - if ( a5 >= (signed __int16)pTexture2.uHeight ) + ++move_Y; + if ( move_Y >= cred_texture.uHeight ) SetCurrentMenuID(MENU_MAIN); pRenderer->Present(); pCurrentScreen = SCREEN_GAME;//Ritor1: temporarily, must be corrected GUI_MainMenuMessageProc() @@ -295,12 +293,59 @@ } while ( GetCurrentMenuID() == MENU_CREDITSPROC ); pAudioPlayer->_4AA258(1); - free(ptr); + free(cred_texturet); free(pFontQuick); free(pFontCChar); pWindow_MainMenu->Release(); pIcons_LOD->RemoveTexturesPackFromTextureList(); - pTexture.Release(); - pTexture2.Release(); + mm6title_texture.Release(); + cred_texture.Release(); return MENU_MAIN; // return MENU_Main -} \ No newline at end of file +} +/*MENU_STATE MainMenuUI_Credits_Loop()//NewTitle +{ + MSG Msg; + GUIWindow credit_window; + RGBTexture mm6title_texture; + + if ( pMessageQueue_50CBD0->uNumMessages ) + pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; + ++pIcons_LOD->uTexturePacksCount; + if ( !pIcons_LOD->uNumPrevLoadedFiles ) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + + //pAudioPlayer->PlayMusicTrack(MUSIC_Credits); + + mm6title_texture.Load("newtitle.pcx", 0); + pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_Escape, 0, 27, "", 0); + pCurrentScreen = SCREEN_CREATORS; + SetCurrentMenuID(MENU_CREDITSPROC); + + do + { + while ( PeekMessageA(&Msg, 0, 0, 0, 1) ) + { + if ( Msg.message == 18 ) + Game_DeinitializeAndTerminate(0); + TranslateMessage(&Msg); + DispatchMessageA(&Msg); + } + if ( BYTE1(dword_6BE364_game_settings_1) & 1 ) + { + WaitMessage(); + } + else + { + pRenderer->BeginScene(); + pRenderer->DrawTextureRGB(0, 0, &mm6title_texture); + pRenderer->EndScene(); + pRenderer->Present(); + pCurrentScreen = SCREEN_GAME; + GUI_MainMenuMessageProc(); + } + } + while ( GetCurrentMenuID() == MENU_CREDITSPROC ); + //pAudioPlayer->_4AA258(1); + mm6title_texture.Release(); + return MENU_MAIN; // return MENU_Main +}*/ \ No newline at end of file