Mercurial > might-and-magic-trilogy
changeset 163:62585ad07024
2.02.12
author | Ritor1 |
---|---|
date | Mon, 03 Dec 2012 08:55:58 +0600 |
parents | 8ff698000225 |
children | c778b7aead81 b4c9e1d2eec8 |
files | GameUIs.cpp Render.cpp mm7_2.cpp mm7_4.cpp mm7_5.cpp |
diffstat | 5 files changed, 72 insertions(+), 124 deletions(-) [+] |
line wrap: on
line diff
--- a/GameUIs.cpp Fri Nov 30 18:14:09 2012 +0600 +++ b/GameUIs.cpp Mon Dec 03 08:55:58 2012 +0600 @@ -28,7 +28,7 @@ //RGBTexture *pTex; // [sp+10h] [bp-254h]@12 //SavegameHeader *Dest; // [sp+14h] [bp-250h]@12 //const char *Str1; // [sp+18h] [bp-24Ch]@12 - LODWriteableFile v15; // [sp+1Ch] [bp-248h]@1 + LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 int v16; // [sp+260h] [bp-4h]@1 uDialogueType_ = uDialogueType; @@ -48,7 +48,7 @@ if ( uDialogueType_ ) { pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0)); - if ( pCurrentScreen == 11 ) + if ( pCurrentScreen == 11 )//save or load { v1 = uTextureID_save_up; v2 = uTextureID_LS_saveU; @@ -76,7 +76,7 @@ dword_6A0C9C = 0; uLoadGameUI_SelectedSlot = 0; } - v15.AllocSubIndicesAndIO(0x12Cu, 0); + pLODFile.AllocSubIndicesAndIO(0x12C, 0); assert(sizeof(SavegameHeader) == 0x64); //v3 = 0; for (uint i = 0; i < uNumSavegameFiles; ++i) @@ -93,13 +93,13 @@ strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[72]); // "Empty" continue; } - v15.LoadFile(pTmpBuf, 1); - v4 = v15.FindContainer("header.bin", true); + pLODFile.LoadFile(pTmpBuf, 1); + v4 = pLODFile.FindContainer("header.bin", true); if ( v4 ) - fread(&pSavegameHeader[i], 0x64u, 1u, v4); + fread(&pSavegameHeader[i], 0x64, 1, v4); if ( !_strcmpi(pSavegameList->pSavesNames[i], pGlobalTXT_LocalizationStrings[613]) )// "AutoSave.MM7" strcpy(pSavegameList->pSavesNames[i], pGlobalTXT_LocalizationStrings[16]);// "Autosave" - v5 = v15.FindContainer("image.pcx", true); + v5 = pLODFile.FindContainer("image.pcx", true); if ( !v5 ) { pSavegameUsedSlots[i] = 0; @@ -108,7 +108,7 @@ else { pSavegameThumbnails[i].LoadFromFILE(v5, 0, true); - v15.CloseWriteFile(); + pLODFile.CloseWriteFile(); pSavegameUsedSlots[i] = 1; } //LABEL_23: @@ -122,9 +122,9 @@ //goto LABEL_22; } -LABEL_24: - v15.FreeSubIndexAndIO(); - if ( pCurrentScreen == 11 ) +//LABEL_24: + pLODFile.FreeSubIndexAndIO(); + if ( pCurrentScreen == 11 ) // save/load screen { v6 = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); v10 = (TEXTURE_TYPE)2; @@ -153,10 +153,10 @@ (Texture *)(uTextureID_x_d != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_d] : 0), 0); ptr_69BD5C = pGUIWindow_CurrentMenu->CreateButton(215, 199, 17, 17, 1, 0, 0xA2, 0, 0, "", (Texture *)(uTextureID_AR_UP_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_UP_DN] : 0), 0); - v7 = pGUIWindow_CurrentMenu->CreateButton(215, 0x143, 0x11, 0x11, 1, 0, 0xA3, uNumSavegameFiles, 0, "", + ptr_69BD58 = pGUIWindow_CurrentMenu->CreateButton(215, 0x143, 0x11, 0x11, 1, 0, 0xA3, uNumSavegameFiles, 0, "", (Texture *)(uTextureID_AR_DN_DN != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_AR_DN_DN] : 0), 0); v16 = -1; - ptr_69BD58 = v7; + //ptr_69BD58 = v7; } //----- (0045E93E) --------------------------------------------------------
--- a/Render.cpp Fri Nov 30 18:14:09 2012 +0600 +++ b/Render.cpp Mon Dec 03 08:55:58 2012 +0600 @@ -1838,7 +1838,7 @@ v5 = abs(X); v6 = abs(v83); --X; - v93 = &stru_76E5C8[(v5 << 7) + v6]; + v93 = &stru_76E5C8[v5 << 7] + v6; if ( !v93->field_0 || ((v7 = 48 * v4, v8 = &pVerticesSR_806210[v4], a2 = v8, !v82) ? (v9 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7), v10 = &pVerticesSR_806210[1] + v7) : (v9 = &pVerticesSR_806210[1] + v7, v10 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7)), ((a8 = v9,
--- a/mm7_2.cpp Fri Nov 30 18:14:09 2012 +0600 +++ b/mm7_2.cpp Mon Dec 03 08:55:58 2012 +0600 @@ -11411,7 +11411,7 @@ unsigned int v4; // eax@8 int v5; // edi@8 unsigned int v6; // eax@8 - unsigned int v7; // eax@10 + unsigned int pMapID; // eax@10 signed __int64 v8; // qax@10 unsigned int v9; // ebx@10 unsigned __int64 v10; // qax@10 @@ -11422,15 +11422,15 @@ __int64 v15; // qax@10 int v16; // edi@10 signed int v17; // ebx@22 - const char *v18; // ST14_4@32 + //const char *v18; // ST14_4@32 int v19; // eax@32 const char *v20; // ST18_4@32 int v21; // eax@32 - const char *v22; // ST14_4@32 + //const char *v22; // ST14_4@32 int v23; // eax@32 - const char *Str; // edi@36 + const char *pSlotName; // edi@36 int v25; // eax@43 - GUIWindow Dst; // [sp+Ch] [bp-78h]@8 + GUIWindow pWindow; // [sp+Ch] [bp-78h]@8 /*unsigned int Dst; // [sp+Ch] [bp-78h]@8 unsigned int v27; // [sp+10h] [bp-74h]@8 int v28; // [sp+14h] [bp-70h]@8 @@ -11439,9 +11439,9 @@ unsigned int v31; // [sp+20h] [bp-64h]@8*/ __int64 v32; // [sp+60h] [bp-24h]@10 int v33; // [sp+68h] [bp-1Ch]@10 - unsigned int v34; // [sp+70h] [bp-14h]@10 + unsigned int pSaveFiles; // [sp+70h] [bp-14h]@10 __int64 v35; // [sp+74h] [bp-10h]@10 - int v36; // [sp+7Ch] [bp-8h]@10 + int pFilesID; // [sp+7Ch] [bp-8h]@10 int a4; // [sp+80h] [bp-4h]@1 v1 = 255; @@ -11451,10 +11451,7 @@ pRenderer->BeginScene(); if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LOAD ) { - pRenderer->DrawTextureIndexed( - 8u, - 8u, - uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0); + pRenderer->DrawTextureIndexed(8, 8, uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0); if ( a4 ) { v2 = uTextureID_save_up; @@ -11472,54 +11469,52 @@ } if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) { - memset(&Dst, 0, 0x54); - Dst.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240; + memset(&pWindow, 0, 0x54); + pWindow.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240; v4 = pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight; - Dst.uFrameWidth = 220; + pWindow.uFrameWidth = 220; v4 += 157; - Dst.uFrameY = v4; + pWindow.uFrameY = v4; v5 = pFontSmallnum->uFontHeight; - Dst.uFrameZ = Dst.uFrameX + 219; - Dst.uFrameHeight = v5; - Dst.uFrameW = v5 + v4 - 1; + pWindow.uFrameZ = pWindow.uFrameX + 219; + pWindow.uFrameHeight = v5; + pWindow.uFrameW = v5 + v4 - 1; v6 = uLoadGameUI_SelectedSlot; if (pSavegameThumbnails[uLoadGameUI_SelectedSlot].pPixels) { pRenderer->DrawTextureRGB(pGUIWindow_CurrentMenu->uFrameX + 276, pGUIWindow_CurrentMenu->uFrameY + 171, pSavegameThumbnails + uLoadGameUI_SelectedSlot); v6 = uLoadGameUI_SelectedSlot; } - v7 = pMapStats->GetMapInfo(pSavegameHeader[v6].pLocationName); - Dst.DrawText2(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[v7].pName, 3); + pMapID = pMapStats->GetMapInfo(pSavegameHeader[v6].pLocationName); + pWindow.DrawText2(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[pMapID].pName, 3); v8 = (signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60; HIDWORD(v32) = (unsigned __int64)((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) >> 32; v9 = v8; v8 /= 60i64; v35 = v8; - v10 = (unsigned int)v8 / 0x18; - v34 = v10; + v10 = (unsigned int)v8 / 24; + pSaveFiles = v10; v11 = (unsigned int)(v10 / 7); v12 = v11; LODWORD(v13) = (unsigned int)v11 >> 2; HIDWORD(v13) = HIDWORD(v11); - v33 = v13 % 0xC; - v36 = v13 / 0xC; + v33 = v13 % 12; + pFilesID = v13 / 12; v32 = (signed __int64)__PAIR__(HIDWORD(v32), v9) % 60; v15 = v35 % 24; v14 = (unsigned __int64)(v35 % 24) >> 32; LODWORD(v35) = v35 % 24; - HIDWORD(v15) = v34 % 0x1C; - v36 += 1168; + HIDWORD(v15) = pSaveFiles % 28; + pFilesID += 1168; v16 = v12 & 3; - Dst.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261; - HIDWORD(v35) = (v14 & 0x80000000u) == 0 - && ((signed int)v14 > 0 || (unsigned int)v15 >= 0xC) - && (signed int)v14 <= 0 - && ((v14 & 0x80000000u) != 0 || (unsigned int)v15 < 0x18); - if ( (v14 & 0x80000000u) != 0 || (signed int)v14 <= 0 && (unsigned int)v15 <= 0xC ) + pWindow.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261; + HIDWORD(v35) = (v14 & 0x80000000u) == 0 && ((signed int)v14 > 0 || (unsigned int)v15 >= 12) + && (signed int)v14 <= 0 && ((v14 & 0x80000000u) != 0 || (unsigned int)v15 < 24); + if ( (v14 & 0x80000000u) != 0 || (signed int)v14 <= 0 && (unsigned int)v15 <= 12 ) { if ( !(v14 | (unsigned int)v15) ) { - v34 = 0; + pSaveFiles = 0; v17 = 12; goto LABEL_23; } @@ -11530,14 +11525,14 @@ LODWORD(v15) = v15 - 12; } v17 = v15; - v34 = v14; + pSaveFiles = v14; LABEL_23: auto _d = aDayNames[HIDWORD(v15) % 7]; auto _a = aAMPMNames[HIDWORD(v35)]; auto _m = aMonthNames[v33]; - sprintf(pTmpBuf, "%s %d:%02d%s\n%d %s %d", _d, v17, (int)32, _a, 3, _m, v36); - sprintf(pTmpBuf, "%s %d:%02d%s\n%d %s %d", _d, v17, (int)v32, _a, 7 * v16 + HIDWORD(v15) % 7 + 1, _m, v36); - Dst.DrawText2(pFontSmallnum, 0, 0, 0, pTmpBuf, 3u); + sprintf(pTmpBuf, "%s %d:%02d%s\n%d %s %d", _d, v17, (int)32, _a, 3, _m, pFilesID); + sprintf(pTmpBuf, "%s %d:%02d%s\n%d %s %d", _d, v17, (int)v32, _a, 7 * v16 + HIDWORD(v15) % 7 + 1, _m, pFilesID); + pWindow.DrawText2(pFontSmallnum, 0, 0, 0, pTmpBuf, 3u); v1 = 255; } if ( pGUIWindow_CurrentMenu->field_40 == 2 ) @@ -11559,34 +11554,34 @@ } if (GetCurrentMenuID() == MENU_LOAD) { - v18 = pGlobalTXT_LocalizationStrings[135]; - v19 = pFontSmallnum->AlignText_Center(0xBAu, pGlobalTXT_LocalizationStrings[135]); - pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v19 + 25, 220, 0, v18, 0, 0, 0); + //v18 = pGlobalTXT_LocalizationStrings[135]; + v19 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[135]);//"Загрузка" + pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v19 + 25, 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0); v20 = (const char *)(pSavegameHeader + uLoadGameUI_SelectedSlot); - v21 = pFontSmallnum->AlignText_Center(0xBAu, (const char *)pSavegameHeader + 100 * uLoadGameUI_SelectedSlot); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v21 + 25, 0x106u, 0, v20, 185, 0); - v22 = pGlobalTXT_LocalizationStrings[165]; - v23 = pFontSmallnum->AlignText_Center(0xBAu, pGlobalTXT_LocalizationStrings[165]); - pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v23 + 25, 304, 0, v22, 0, 0, 0); + v21 = pFontSmallnum->AlignText_Center(0xBA, (const char *)pSavegameHeader + 100 * uLoadGameUI_SelectedSlot); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v21 + 25, 0x106, 0, v20, 185, 0); + //v22 = pGlobalTXT_LocalizationStrings[165]; + v23 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[165]);//"Пожалуйста, пожождите" + pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v23 + 25, 304, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0); } else { if ( a4 ) - v34 = 40; + pSaveFiles = 40; else - v34 = uNumSavegameFiles; + pSaveFiles = uNumSavegameFiles; a4 = 199; - v36 = dword_6A0C9C; - Str = (const char *)(&pSavegameHeader[dword_6A0C9C]); + pFilesID = dword_6A0C9C; + pSlotName = (const char *)(&pSavegameHeader[dword_6A0C9C]);//draw name for save slot do { - if ( v36 >= (signed int)v34 ) + if ( pFilesID >= (signed int)pSaveFiles ) break; short clr; - HIDWORD(v35) = clr = (v36 == uLoadGameUI_SelectedSlot ? GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v1, v1, 0x64) : 0); - if ( pGUIWindow_CurrentMenu->field_40 != 1 || v36 != uLoadGameUI_SelectedSlot ) - { - pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, Str, 185, 0); + HIDWORD(v35) = clr = (pFilesID == uLoadGameUI_SelectedSlot ? GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v1, v1, 0x64) : 0); + if ( pGUIWindow_CurrentMenu->field_40 != 1 || pFilesID != uLoadGameUI_SelectedSlot ) + { + pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, pSlotName, 185, 0); } else { @@ -11594,8 +11589,8 @@ pGUIWindow_CurrentMenu->DrawFlashingInputCursor(v25 + 27, a4, pFontSmallnum); } a4 += 21; - ++v36; - Str += 100; + ++pFilesID; + pSlotName += 100; } while ( a4 < 346 ); } @@ -12069,17 +12064,7 @@ auto pNew = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE); //v0 = pIcons_LOD->LoadTexture("title_new", TEXTURE_16BIT_PALETTE); //v1 = (Texture *)(v0 != -1 ? &pIcons_LOD->pTextures[v0] : 0); - pMainMenu_BtnNew = pWindow_MainMenu->CreateButton(495, 172, - pNew->uTextureWidth, - pNew->uTextureHeight, - 1, - 0, - UIMSG_MainMenu_ShowPartyCreationWnd, - 0, - 78, - "", - pNew, - 0); + pMainMenu_BtnNew = pWindow_MainMenu->CreateButton(495, 172, pNew->uTextureWidth, pNew->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowPartyCreationWnd, 0, 78, "", pNew, 0); //v2 = pIcons_LOD->LoadTexture("title_load", TEXTURE_16BIT_PALETTE); //v3 = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0); auto pLoad = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE); @@ -12097,32 +12082,11 @@ //v4 = pIcons_LOD->LoadTexture("title_cred", TEXTURE_16BIT_PALETTE); //v5 = (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0); auto pCredits = pIcons_LOD->LoadTexturePtr("title_cred", TEXTURE_16BIT_PALETTE); - pMainMenu_BtnCredits = pWindow_MainMenu->CreateButton(495, 282, - pCredits->uTextureWidth, - pCredits->uTextureHeight, - 1, - 0, - UIMSG_ShowCredits, - 2, - 67, - "", - pCredits, - 0); + pMainMenu_BtnCredits = pWindow_MainMenu->CreateButton(495, 282, pCredits->uTextureWidth, pCredits->uTextureHeight, 1, 0, UIMSG_ShowCredits, 2, 67, "", pCredits, 0); //v6 = pIcons_LOD->LoadTexture("title_exit", TEXTURE_16BIT_PALETTE); //v7 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0); auto pExit = pIcons_LOD->LoadTexturePtr("title_exit", TEXTURE_16BIT_PALETTE); - pMainMenu_BtnExit = pWindow_MainMenu->CreateButton(495, 337, - pExit->uTextureWidth, - pExit->uTextureHeight, - 1, - 0, - UIMSG_ExitToWindows, - 3, - 0, - "", - pExit, - 0); - + pMainMenu_BtnExit = pWindow_MainMenu->CreateButton(495, 337, pExit->uTextureWidth, pExit->uTextureHeight, 1, 0, UIMSG_ExitToWindows, 3, 0, "", pExit, 0); pTexture_PCX.Release(); pTexture_PCX.Load("title.pcx", 0); SetCurrentMenuID(MENU_MAIN);
--- a/mm7_4.cpp Fri Nov 30 18:14:09 2012 +0600 +++ b/mm7_4.cpp Mon Dec 03 08:55:58 2012 +0600 @@ -5419,6 +5419,7 @@ // uPlayerCreationUI_ArrowAnim = 18; v6 = pFontCreate->uFontHeight - 2; v128 = pFontCreate->uFontHeight - 2; + memset(pText, 0, 200); strcpy(pText, pGlobalTXT_LocalizationStrings[205]);// "Skills" uNumLet = strlen(pText) - 1; pOrder = uNumLet; @@ -6123,9 +6124,6 @@ return v26; } -// - - //----- (004979D2) -------------------------------------------------------- MENU_STATE __cdecl CreditsMenu__Loop() {
--- a/mm7_5.cpp Fri Nov 30 18:14:09 2012 +0600 +++ b/mm7_5.cpp Mon Dec 03 08:55:58 2012 +0600 @@ -3390,7 +3390,6 @@ int v15; // edi@70 char v16; // zf@73 int v17; // eax@73 - unsigned int v18; // ecx@105 int v19; // edi@116 char v20; // dl@116 unsigned int v21; // eax@116 @@ -3405,11 +3404,8 @@ signed int v30; // [sp-28h] [bp-38h]@36 unsigned int v31; // [sp-24h] [bp-34h]@36 signed int v32; // [sp-20h] [bp-30h]@36 - unsigned int v33; // [sp-20h] [bp-30h]@105 signed int v34; // [sp-1Ch] [bp-2Ch]@36 - unsigned int v35; // [sp-1Ch] [bp-2Ch]@105 int v36; // [sp-18h] [bp-28h]@36 - enum WindowType v37; // [sp-18h] [bp-28h]@105 unsigned int v38; // [sp-14h] [bp-24h]@36 int v39; // [sp-14h] [bp-24h]@56 signed int v40; // [sp-10h] [bp-20h]@15 @@ -3493,9 +3489,7 @@ { //typing in the line pKeyActionMap->_459E5A(0, 19, pGUIWindow_CurrentMenu); - strcpy( - (char *)pKeyActionMap->pPressedKeysBuffer, - pSavegameHeader[uLoadGameUI_SelectedSlot].pName); + strcpy((char *)pKeyActionMap->pPressedKeysBuffer, pSavegameHeader[uLoadGameUI_SelectedSlot].pName); pKeyActionMap->uNumKeysPressed = strlen((const char *)pKeyActionMap->pPressedKeysBuffer); } } @@ -3504,8 +3498,7 @@ case UIMSG_A4: { - GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, - 61, 28, WINDOW_5E, (int)ptr_69BD64, 0); + GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_5E, (int)ptr_69BD64, 0); } continue; } @@ -3516,14 +3509,7 @@ { if ( pUIMessageType == UIMSG_A6 ) { - v43 = 0; - v39 = (int)ptr_69BD60; - v8 = pGUIWindow_CurrentMenu->uFrameY + 302; - v37 = (WindowType)95; - v18 = pGUIWindow_CurrentMenu->uFrameX + 350; - v35 = 28; - v33 = 61; - GUIWindow::Create(v18, v8, v33, v35, v37, v39, v43); + GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, (WindowType)95, (int)ptr_69BD60, 0); continue; } if ( pUIMessageType == UIMSG_SelectFacePlayerBack )