Mercurial > mm7
changeset 1735:873ac151c38d
Draw SaveLoadWindow
author | Ritor1 |
---|---|
date | Thu, 26 Sep 2013 17:39:39 +0600 |
parents | cacde83196e4 |
children | 7a9d0973ae37 1776d4f033a7 26c1a3d50635 |
files | UI/UISaveLoad.cpp |
diffstat | 1 files changed, 64 insertions(+), 126 deletions(-) [+] |
line wrap: on
line diff
--- a/UI/UISaveLoad.cpp Thu Sep 26 14:17:34 2013 +0600 +++ b/UI/UISaveLoad.cpp Thu Sep 26 17:39:39 2013 +0600 @@ -21,125 +21,76 @@ //----- (004601B7) -------------------------------------------------------- static void UI_DrawSaveLoad(bool save) { - //unsigned __int16 v1; // bx@1 - unsigned int v2; // edi@4 - unsigned int v3; // eax@4 - unsigned int v4; // eax@8 - int v5; // edi@8 - unsigned int v6; // eax@8 - unsigned int pMapID; // eax@10 - signed __int64 v8; // qax@10 - unsigned int v9; // ebx@10 - unsigned __int64 v10; // qax@10 - __int64 v11; // qax@10 - char v12; // di@10 - unsigned __int64 v13; // qtt@10 - unsigned int v14; // ecx@10 - __int64 pOurHour; // qax@10 - int v16; // edi@10 - signed int pHour; // ebx@22 - int v19; // eax@32 - const char *v20; // ST18_4@32 - int v21; // eax@32 - int v23; // eax@32 const char *pSlotName; // edi@36 - int v25; // eax@43 - GUIWindow pWindow; // [sp+Ch] [bp-78h]@8 - int pMinutes; // [sp+60h] [bp-24h]@10 - int pMonthNum; // [sp+68h] [bp-1Ch]@10 + GUIWindow save_load_window; // [sp+Ch] [bp-78h]@8 unsigned int pSaveFiles; // [sp+70h] [bp-14h]@10 - __int64 pAMPM2; // [sp+74h] [bp-10h]@10 - int pYear; // [sp+7Ch] [bp-8h]@10 - int pFilesID; + unsigned __int64 full_hours; + unsigned __int64 full_days; + int full_weeks; + int full_month; + int current_year; + int current_month; + int current_day; + int current_hour; + int current_minutes; - //v1 = 255; - //TargetColor(0xFF, 0xFF, 0xFF); - //TargetColor(0xFF, 0xFF, 0x9B); pRenderer->BeginScene(); if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LoadingProcInMainMenu ) { pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); if (save) { - v2 = uTextureID_save_up; - v3 = uTextureID_LS_saveU; + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); + pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(uTextureID_save_up)); } else { - v2 = uTextureID_load_up; - v3 = uTextureID_LS_loadU; + pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); + pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(uTextureID_load_up)); } - pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(v3)); - pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(v2)); pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); } if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) { - memset(&pWindow, 0, 0x54); - pWindow.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240; - v4 = pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight; - pWindow.uFrameWidth = 220; - v4 += 157; - pWindow.uFrameY = v4; - v5 = pFontSmallnum->uFontHeight; - pWindow.uFrameZ = pWindow.uFrameX + 219; - pWindow.uFrameHeight = v5; - pWindow.uFrameW = v5 + v4 - 1; - v6 = uLoadGameUI_SelectedSlot; - if (pSavegameThumbnails[uLoadGameUI_SelectedSlot].pPixels) - { + memset(&save_load_window, 0, 0x54); + save_load_window.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240; + save_load_window.uFrameWidth = 220; + save_load_window.uFrameY = (pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight) + 157; + save_load_window.uFrameZ = save_load_window.uFrameX + 219; + save_load_window.uFrameHeight = pFontSmallnum->uFontHeight; + save_load_window.uFrameW = pFontSmallnum->uFontHeight + save_load_window.uFrameY - 1; + if ( pSavegameThumbnails[uLoadGameUI_SelectedSlot].pPixels ) pRenderer->DrawTextureRGB(pGUIWindow_CurrentMenu->uFrameX + 276, pGUIWindow_CurrentMenu->uFrameY + 171, &pSavegameThumbnails[uLoadGameUI_SelectedSlot]); - v6 = uLoadGameUI_SelectedSlot; - } - pMapID = pMapStats->GetMapInfo(pSavegameHeader[v6].pLocationName); - pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[pMapID].pName, 3); - v8 = (signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60; - pMinutes = (int)(((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) >> 32); - v9 = v8; - v8 /= 60i64; - pAMPM2 = v8; - v10 = (unsigned int)v8 / 24; - pSaveFiles = v10; - v11 = (unsigned int)(v10 / 7); - v12 = v11; - LODWORD(v13) = (unsigned int)v11 >> 2; - HIDWORD(v13) = HIDWORD(v11); - pMonthNum = v13 % 12; - pYear = v13 / 12; - pMinutes = (int)__PAIR__(pMinutes, v9) % 60; - pOurHour = pAMPM2 % 24; - v14 = (unsigned __int64)(pAMPM2 % 24) >> 32; - LODWORD(pAMPM2) = pAMPM2 % 24; - HIDWORD(pOurHour) = pSaveFiles % 28; - pYear += game_starting_year; - v16 = v12 & 3; - pWindow.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261; - HIDWORD(pAMPM2) = v14 == 0 && ((signed int)v14 > 0 || (unsigned int)pOurHour >= 12) - && (signed int)v14 <= 0 && (v14 != 0 || (unsigned int)pOurHour < 24); - if ( v14 != 0 || ((signed int)v14 <= 0) && (unsigned int)pOurHour <= 12 ) +//Draw map name + save_load_window.DrawTitleText(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[pMapStats->GetMapInfo(pSavegameHeader[uLoadGameUI_SelectedSlot].pLocationName)].pName, 3); +//Draw date + full_hours = ((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) / 60i64; + full_days = (unsigned int)full_hours / 24; + full_weeks = (unsigned int)(full_days / 7); + full_month = (unsigned int)full_weeks / 4; + current_year = (full_month / 12) + game_starting_year; + current_month = full_month % 12; + current_day = full_days % 28; + current_hour = full_hours % 24; + current_minutes = (((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) % 60i64); + + save_load_window.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261; + int am; + if ( (signed int)current_hour >= 12 ) { - if ( !(v14 | (unsigned int)pOurHour) ) - { - pSaveFiles = 0; - pHour = 12; - goto LABEL_23; - } + current_hour -= 12; + if ( !current_hour ) + current_hour = 12; + am = 1; } else - { - v14 = (__PAIR__(v14, (unsigned int)pOurHour) - 12) >> 32; - LODWORD(pOurHour) = pOurHour - 12; - } - pHour = pOurHour; - pSaveFiles = v14; -LABEL_23: - auto day = aDayNames[HIDWORD(pOurHour) % 7]; - auto ampm = aAMPMNames[HIDWORD(pAMPM2)]; - auto month = aMonthNames[pMonthNum]; - //sprintf(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", _d, v17, (int)32, _a, 3, _m, pFilesID); - sprintfex(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", day, pHour, pMinutes, ampm, 7 * v16 + HIDWORD(pOurHour) % 7 + 1, month, pYear); - pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf.data(), 3u); - //v1 = 255; + am = 0; + auto day = aDayNames[full_days % 7]; + auto ampm = aAMPMNames[am]; + auto month = aMonthNames[current_month]; + + sprintfex(pTmpBuf.data(), "%s %d:%02d %s\n%d %s %d", day, current_hour, current_minutes, aAMPMNames[am], current_day + 1, month, current_year); + save_load_window.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf.data(), 3); } if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) { @@ -154,15 +105,12 @@ } if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu) { - //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(0xBA, (const char *)pSavegameHeader.data() + 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); + pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[135]) + 25, + 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0);//Загрузка + pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, pFontSmallnum->AlignText_Center(186, + (const char *)pSavegameHeader.data() + 100 * uLoadGameUI_SelectedSlot) + 25, 0x106, 0, pSavegameHeader[uLoadGameUI_SelectedSlot].pName, 185, 0); + pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[165]) + 25, + 304, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0);//"Пожалуйста, пожождите" } else { @@ -170,29 +118,19 @@ pSaveFiles = 40; else pSaveFiles = uNumSavegameFiles; - int a4 = 199; - pFilesID = pSaveListPosition; - pSlotName = (const char *)(&pSavegameHeader[pSaveListPosition]);//draw name for save slot - do + + int slot_Y = 199; + for ( uint i = pSaveListPosition; i < pSaveFiles; ++i ) { - if ( pFilesID >= (signed int)pSaveFiles ) + if ( slot_Y >= 346 ) break; - short clr; - HIDWORD(pAMPM2) = clr = (pFilesID == uLoadGameUI_SelectedSlot ? TargetColor(0xFF, 0xFF, 0x64) : 0); - if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS || pFilesID != uLoadGameUI_SelectedSlot ) - { - pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, pSlotName, 185, 0); - } + if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS || i != uLoadGameUI_SelectedSlot ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 27, slot_Y, i == uLoadGameUI_SelectedSlot ? TargetColor(0xFF, 0xFF, 0x64) : 0, pSavegameHeader[i].pName, 185, 0); else - { - v25 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, (const char *)pKeyActionMap->pPressedKeysBuffer, 175, 1); - pGUIWindow_CurrentMenu->DrawFlashingInputCursor(v25 + 27, a4, pFontSmallnum); - } - a4 += 21; - ++pFilesID; - pSlotName += 100; + pGUIWindow_CurrentMenu->DrawFlashingInputCursor(pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 27, slot_Y, i == uLoadGameUI_SelectedSlot ? TargetColor(0xFF, 0xFF, 0x64) : 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 175, 1) + 27, + slot_Y, pFontSmallnum); + slot_Y += 21; } - while ( a4 < 346 ); } pRenderer->EndScene(); }