comparison mm7_2.cpp @ 706:d6236f6a9882

Rough function rearranging to new files
author Gloval
date Tue, 19 Mar 2013 21:53:21 +0400
parents a9c1fb7483c2
children af08fc9e29c8 70c5a87a1307
comparison
equal deleted inserted replaced
705:e39702f35283 706:d6236f6a9882
7614 } 7614 }
7615 7615
7616 7616
7617 7617
7618 7618
7619 //----- (004601B7) --------------------------------------------------------
7620 void GameUI_MainMenu_DoDrawLoad(int a1)
7621 {
7622 unsigned __int16 v1; // bx@1
7623 unsigned int v2; // edi@4
7624 unsigned int v3; // eax@4
7625 unsigned int v4; // eax@8
7626 int v5; // edi@8
7627 unsigned int v6; // eax@8
7628 unsigned int pMapID; // eax@10
7629 signed __int64 v8; // qax@10
7630 unsigned int v9; // ebx@10
7631 unsigned __int64 v10; // qax@10
7632 __int64 v11; // qax@10
7633 char v12; // di@10
7634 unsigned __int64 v13; // qtt@10
7635 unsigned int v14; // ecx@10
7636 __int64 pOurHour; // qax@10
7637 int v16; // edi@10
7638 signed int pHour; // ebx@22
7639 //const char *v18; // ST14_4@32
7640 int v19; // eax@32
7641 const char *v20; // ST18_4@32
7642 int v21; // eax@32
7643 //const char *v22; // ST14_4@32
7644 int v23; // eax@32
7645 const char *pSlotName; // edi@36
7646 int v25; // eax@43
7647 GUIWindow pWindow; // [sp+Ch] [bp-78h]@8
7648 /*unsigned int Dst; // [sp+Ch] [bp-78h]@8
7649 unsigned int v27; // [sp+10h] [bp-74h]@8
7650 int v28; // [sp+14h] [bp-70h]@8
7651 int v29; // [sp+18h] [bp-6Ch]@8
7652 unsigned int v30; // [sp+1Ch] [bp-68h]@8
7653 unsigned int v31; // [sp+20h] [bp-64h]@8*/
7654 int pMinutes; // [sp+60h] [bp-24h]@10
7655 int pMonthNum; // [sp+68h] [bp-1Ch]@10
7656 unsigned int pSaveFiles; // [sp+70h] [bp-14h]@10
7657 __int64 pAMPM2; // [sp+74h] [bp-10h]@10
7658 int pYear; // [sp+7Ch] [bp-8h]@10
7659 int a4; // [sp+80h] [bp-4h]@1
7660 int pFilesID;
7661
7662 v1 = 255;
7663 a4 = a1;
7664 GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0xFF);
7665 GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0x9B);
7666 pRenderer->BeginScene();
7667 if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LOADINGPROC )
7668 {
7669 pRenderer->DrawTextureIndexed(8, 8, uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0);
7670 if ( a4 )
7671 {
7672 v2 = uTextureID_save_up;
7673 v3 = uTextureID_LS_saveU;
7674 }
7675 else
7676 {
7677 v2 = uTextureID_load_up;
7678 v3 = uTextureID_LS_loadU;
7679 }
7680 pRenderer->DrawTextureIndexed(241, 302, (Texture *)(v3 != -1 ? &pIcons_LOD->pTextures[v3] : 0));
7681 pRenderer->DrawTextureIndexed(18, 139, (Texture *)(v2 != -1 ? &pIcons_LOD->pTextures[v2] : 0));
7682 pRenderer->DrawTextureIndexed(351, 302, (Texture *)(uTextureID_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_u] : 0));
7683 v1 = 255;
7684 }
7685 if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] )
7686 {
7687 memset(&pWindow, 0, 0x54);
7688 pWindow.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240;
7689 v4 = pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight;
7690 pWindow.uFrameWidth = 220;
7691 v4 += 157;
7692 pWindow.uFrameY = v4;
7693 v5 = pFontSmallnum->uFontHeight;
7694 pWindow.uFrameZ = pWindow.uFrameX + 219;
7695 pWindow.uFrameHeight = v5;
7696 pWindow.uFrameW = v5 + v4 - 1;
7697 v6 = uLoadGameUI_SelectedSlot;
7698 if (pSavegameThumbnails[uLoadGameUI_SelectedSlot].pPixels)
7699 {
7700 pRenderer->DrawTextureRGB(pGUIWindow_CurrentMenu->uFrameX + 276, pGUIWindow_CurrentMenu->uFrameY + 171, pSavegameThumbnails + uLoadGameUI_SelectedSlot);
7701 v6 = uLoadGameUI_SelectedSlot;
7702 }
7703 pMapID = pMapStats->GetMapInfo(pSavegameHeader[v6].pLocationName);
7704 pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[pMapID].pName, 3);
7705 v8 = (signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60;
7706 pMinutes = (int)((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) >> 32;
7707 v9 = v8;
7708 v8 /= 60i64;
7709 pAMPM2 = v8;
7710 v10 = (unsigned int)v8 / 24;
7711 pSaveFiles = v10;
7712 v11 = (unsigned int)(v10 / 7);
7713 v12 = v11;
7714 LODWORD(v13) = (unsigned int)v11 >> 2;
7715 HIDWORD(v13) = HIDWORD(v11);
7716 pMonthNum = v13 % 12;
7717 pYear = v13 / 12;
7718 pMinutes = (int)__PAIR__(pMinutes, v9) % 60;
7719 pOurHour = pAMPM2 % 24;
7720 v14 = (unsigned __int64)(pAMPM2 % 24) >> 32;
7721 LODWORD(pAMPM2) = pAMPM2 % 24;
7722 HIDWORD(pOurHour) = pSaveFiles % 28;
7723 pYear += game_starting_year;
7724 v16 = v12 & 3;
7725 pWindow.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261;
7726 HIDWORD(pAMPM2) = v14 == 0 && ((signed int)v14 > 0 || (unsigned int)pOurHour >= 12)
7727 && (signed int)v14 <= 0 && (v14 != 0 || (unsigned int)pOurHour < 24);
7728 if ( v14 != 0 || (signed int)v14 <= 0 && (unsigned int)pOurHour <= 12 )
7729 {
7730 if ( !(v14 | (unsigned int)pOurHour) )
7731 {
7732 pSaveFiles = 0;
7733 pHour = 12;
7734 goto LABEL_23;
7735 }
7736 }
7737 else
7738 {
7739 v14 = (__PAIR__(v14, (unsigned int)pOurHour) - 12) >> 32;
7740 LODWORD(pOurHour) = pOurHour - 12;
7741 }
7742 pHour = pOurHour;
7743 pSaveFiles = v14;
7744 LABEL_23:
7745 auto day = aDayNames[HIDWORD(pOurHour) % 7];
7746 auto ampm = aAMPMNames[HIDWORD(pAMPM2)];
7747 auto month = aMonthNames[pMonthNum];
7748 //sprintf(pTmpBuf, "%s %d:%02d%s\n%d %s %d", _d, v17, (int)32, _a, 3, _m, pFilesID);
7749 sprintf(pTmpBuf, "%s %d:%02d%s\n%d %s %d", day, pHour, pMinutes, ampm, 7 * v16 + HIDWORD(pOurHour) % 7 + 1, month, pYear);
7750 pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf, 3u);
7751 v1 = 255;
7752 }
7753 if ( pGUIWindow_CurrentMenu->field_40 == 2 )
7754 {
7755 pGUIWindow_CurrentMenu->field_40 = 0;
7756 strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, (const char *)pKeyActionMap->pPressedKeysBuffer);
7757 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
7758 {
7759 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)83;
7760 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0;
7761 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
7762 ++pMessageQueue_50CBD0->uNumMessages;
7763 }*/
7764 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveGame, 0, 0);
7765 }
7766 else
7767 {
7768 if ( pGUIWindow_CurrentMenu->field_40 == 3 )
7769 pGUIWindow_CurrentMenu->field_40 = 0;
7770 }
7771 if (GetCurrentMenuID() == MENU_LOADINGPROC)
7772 {
7773 //v18 = pGlobalTXT_LocalizationStrings[135];
7774 v19 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[135]);//"Загрузка"
7775 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v19 + 25, 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0);
7776 v20 = (const char *)(pSavegameHeader + uLoadGameUI_SelectedSlot);
7777 v21 = pFontSmallnum->AlignText_Center(0xBA, (const char *)pSavegameHeader + 100 * uLoadGameUI_SelectedSlot);
7778 pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v21 + 25, 0x106, 0, v20, 185, 0);
7779 //v22 = pGlobalTXT_LocalizationStrings[165];
7780 v23 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[165]);//"Пожалуйста, пожождите"
7781 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v23 + 25, 304, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0);
7782 }
7783 else
7784 {
7785 if ( a4 )
7786 pSaveFiles = 40;
7787 else
7788 pSaveFiles = uNumSavegameFiles;
7789 a4 = 199;
7790 pFilesID = pSaveListPosition;
7791 pSlotName = (const char *)(&pSavegameHeader[pSaveListPosition]);//draw name for save slot
7792 do
7793 {
7794 if ( pFilesID >= (signed int)pSaveFiles )
7795 break;
7796 short clr;
7797 HIDWORD(pAMPM2) = clr = (pFilesID == uLoadGameUI_SelectedSlot ? GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v1, v1, 0x64) : 0);
7798 if ( pGUIWindow_CurrentMenu->field_40 != 1 || pFilesID != uLoadGameUI_SelectedSlot )
7799 {
7800 pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, pSlotName, 185, 0);
7801 }
7802 else
7803 {
7804 v25 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, (const char *)pKeyActionMap->pPressedKeysBuffer, 175, 1);
7805 pGUIWindow_CurrentMenu->DrawFlashingInputCursor(v25 + 27, a4, pFontSmallnum);
7806 }
7807 a4 += 21;
7808 ++pFilesID;
7809 pSlotName += 100;
7810 }
7811 while ( a4 < 346 );
7812 }
7813 pRenderer->EndScene();
7814 }
7815 // 6A0C9C: using guessed type int dword_6A0C9C;
7816
7817 //----- (004606F7) --------------------------------------------------------
7818 void __cdecl GameUI_MainMenu_DrawLoad()
7819 {
7820 GameUI_MainMenu_DoDrawLoad(0);
7821 }
7822
7823 //----- (004606FE) --------------------------------------------------------
7824 void __cdecl sub_4606FE()
7825 {
7826 GameUI_MainMenu_DoDrawLoad(1);
7827 }
7828 7619
7829 //----- (00460706) -------------------------------------------------------- 7620 //----- (00460706) --------------------------------------------------------
7830 void TryLoadLevelFromLOD() 7621 void TryLoadLevelFromLOD()
7831 { 7622 {
7832 FILE *v0; // eax@1 7623 FILE *v0; // eax@1