Mercurial > mm7
comparison UI/UISaveLoad.cpp @ 1735:873ac151c38d
Draw SaveLoadWindow
author | Ritor1 |
---|---|
date | Thu, 26 Sep 2013 17:39:39 +0600 |
parents | e013b92030e3 |
children | 1776d4f033a7 |
comparison
equal
deleted
inserted
replaced
1734:cacde83196e4 | 1735:873ac151c38d |
---|---|
19 | 19 |
20 | 20 |
21 //----- (004601B7) -------------------------------------------------------- | 21 //----- (004601B7) -------------------------------------------------------- |
22 static void UI_DrawSaveLoad(bool save) | 22 static void UI_DrawSaveLoad(bool save) |
23 { | 23 { |
24 //unsigned __int16 v1; // bx@1 | |
25 unsigned int v2; // edi@4 | |
26 unsigned int v3; // eax@4 | |
27 unsigned int v4; // eax@8 | |
28 int v5; // edi@8 | |
29 unsigned int v6; // eax@8 | |
30 unsigned int pMapID; // eax@10 | |
31 signed __int64 v8; // qax@10 | |
32 unsigned int v9; // ebx@10 | |
33 unsigned __int64 v10; // qax@10 | |
34 __int64 v11; // qax@10 | |
35 char v12; // di@10 | |
36 unsigned __int64 v13; // qtt@10 | |
37 unsigned int v14; // ecx@10 | |
38 __int64 pOurHour; // qax@10 | |
39 int v16; // edi@10 | |
40 signed int pHour; // ebx@22 | |
41 int v19; // eax@32 | |
42 const char *v20; // ST18_4@32 | |
43 int v21; // eax@32 | |
44 int v23; // eax@32 | |
45 const char *pSlotName; // edi@36 | 24 const char *pSlotName; // edi@36 |
46 int v25; // eax@43 | 25 GUIWindow save_load_window; // [sp+Ch] [bp-78h]@8 |
47 GUIWindow pWindow; // [sp+Ch] [bp-78h]@8 | |
48 int pMinutes; // [sp+60h] [bp-24h]@10 | |
49 int pMonthNum; // [sp+68h] [bp-1Ch]@10 | |
50 unsigned int pSaveFiles; // [sp+70h] [bp-14h]@10 | 26 unsigned int pSaveFiles; // [sp+70h] [bp-14h]@10 |
51 __int64 pAMPM2; // [sp+74h] [bp-10h]@10 | 27 unsigned __int64 full_hours; |
52 int pYear; // [sp+7Ch] [bp-8h]@10 | 28 unsigned __int64 full_days; |
53 int pFilesID; | 29 int full_weeks; |
54 | 30 int full_month; |
55 //v1 = 255; | 31 int current_year; |
56 //TargetColor(0xFF, 0xFF, 0xFF); | 32 int current_month; |
57 //TargetColor(0xFF, 0xFF, 0x9B); | 33 int current_day; |
34 int current_hour; | |
35 int current_minutes; | |
36 | |
58 pRenderer->BeginScene(); | 37 pRenderer->BeginScene(); |
59 if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LoadingProcInMainMenu ) | 38 if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LoadingProcInMainMenu ) |
60 { | 39 { |
61 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); | 40 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); |
62 if (save) | 41 if (save) |
63 { | 42 { |
64 v2 = uTextureID_save_up; | 43 pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_saveU)); |
65 v3 = uTextureID_LS_saveU; | 44 pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(uTextureID_save_up)); |
66 } | 45 } |
67 else | 46 else |
68 { | 47 { |
69 v2 = uTextureID_load_up; | 48 pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); |
70 v3 = uTextureID_LS_loadU; | 49 pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(uTextureID_load_up)); |
71 } | 50 } |
72 pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(v3)); | |
73 pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(v2)); | |
74 pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); | 51 pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); |
75 } | 52 } |
76 if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) | 53 if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) |
77 { | 54 { |
78 memset(&pWindow, 0, 0x54); | 55 memset(&save_load_window, 0, 0x54); |
79 pWindow.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240; | 56 save_load_window.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240; |
80 v4 = pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight; | 57 save_load_window.uFrameWidth = 220; |
81 pWindow.uFrameWidth = 220; | 58 save_load_window.uFrameY = (pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight) + 157; |
82 v4 += 157; | 59 save_load_window.uFrameZ = save_load_window.uFrameX + 219; |
83 pWindow.uFrameY = v4; | 60 save_load_window.uFrameHeight = pFontSmallnum->uFontHeight; |
84 v5 = pFontSmallnum->uFontHeight; | 61 save_load_window.uFrameW = pFontSmallnum->uFontHeight + save_load_window.uFrameY - 1; |
85 pWindow.uFrameZ = pWindow.uFrameX + 219; | 62 if ( pSavegameThumbnails[uLoadGameUI_SelectedSlot].pPixels ) |
86 pWindow.uFrameHeight = v5; | |
87 pWindow.uFrameW = v5 + v4 - 1; | |
88 v6 = uLoadGameUI_SelectedSlot; | |
89 if (pSavegameThumbnails[uLoadGameUI_SelectedSlot].pPixels) | |
90 { | |
91 pRenderer->DrawTextureRGB(pGUIWindow_CurrentMenu->uFrameX + 276, pGUIWindow_CurrentMenu->uFrameY + 171, &pSavegameThumbnails[uLoadGameUI_SelectedSlot]); | 63 pRenderer->DrawTextureRGB(pGUIWindow_CurrentMenu->uFrameX + 276, pGUIWindow_CurrentMenu->uFrameY + 171, &pSavegameThumbnails[uLoadGameUI_SelectedSlot]); |
92 v6 = uLoadGameUI_SelectedSlot; | 64 //Draw map name |
65 save_load_window.DrawTitleText(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[pMapStats->GetMapInfo(pSavegameHeader[uLoadGameUI_SelectedSlot].pLocationName)].pName, 3); | |
66 //Draw date | |
67 full_hours = ((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) / 60i64; | |
68 full_days = (unsigned int)full_hours / 24; | |
69 full_weeks = (unsigned int)(full_days / 7); | |
70 full_month = (unsigned int)full_weeks / 4; | |
71 current_year = (full_month / 12) + game_starting_year; | |
72 current_month = full_month % 12; | |
73 current_day = full_days % 28; | |
74 current_hour = full_hours % 24; | |
75 current_minutes = (((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) % 60i64); | |
76 | |
77 save_load_window.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261; | |
78 int am; | |
79 if ( (signed int)current_hour >= 12 ) | |
80 { | |
81 current_hour -= 12; | |
82 if ( !current_hour ) | |
83 current_hour = 12; | |
84 am = 1; | |
93 } | 85 } |
94 pMapID = pMapStats->GetMapInfo(pSavegameHeader[v6].pLocationName); | 86 else |
95 pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[pMapID].pName, 3); | 87 am = 0; |
96 v8 = (signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60; | 88 auto day = aDayNames[full_days % 7]; |
97 pMinutes = (int)(((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) >> 32); | 89 auto ampm = aAMPMNames[am]; |
98 v9 = v8; | 90 auto month = aMonthNames[current_month]; |
99 v8 /= 60i64; | 91 |
100 pAMPM2 = v8; | 92 sprintfex(pTmpBuf.data(), "%s %d:%02d %s\n%d %s %d", day, current_hour, current_minutes, aAMPMNames[am], current_day + 1, month, current_year); |
101 v10 = (unsigned int)v8 / 24; | 93 save_load_window.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf.data(), 3); |
102 pSaveFiles = v10; | |
103 v11 = (unsigned int)(v10 / 7); | |
104 v12 = v11; | |
105 LODWORD(v13) = (unsigned int)v11 >> 2; | |
106 HIDWORD(v13) = HIDWORD(v11); | |
107 pMonthNum = v13 % 12; | |
108 pYear = v13 / 12; | |
109 pMinutes = (int)__PAIR__(pMinutes, v9) % 60; | |
110 pOurHour = pAMPM2 % 24; | |
111 v14 = (unsigned __int64)(pAMPM2 % 24) >> 32; | |
112 LODWORD(pAMPM2) = pAMPM2 % 24; | |
113 HIDWORD(pOurHour) = pSaveFiles % 28; | |
114 pYear += game_starting_year; | |
115 v16 = v12 & 3; | |
116 pWindow.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261; | |
117 HIDWORD(pAMPM2) = v14 == 0 && ((signed int)v14 > 0 || (unsigned int)pOurHour >= 12) | |
118 && (signed int)v14 <= 0 && (v14 != 0 || (unsigned int)pOurHour < 24); | |
119 if ( v14 != 0 || ((signed int)v14 <= 0) && (unsigned int)pOurHour <= 12 ) | |
120 { | |
121 if ( !(v14 | (unsigned int)pOurHour) ) | |
122 { | |
123 pSaveFiles = 0; | |
124 pHour = 12; | |
125 goto LABEL_23; | |
126 } | |
127 } | |
128 else | |
129 { | |
130 v14 = (__PAIR__(v14, (unsigned int)pOurHour) - 12) >> 32; | |
131 LODWORD(pOurHour) = pOurHour - 12; | |
132 } | |
133 pHour = pOurHour; | |
134 pSaveFiles = v14; | |
135 LABEL_23: | |
136 auto day = aDayNames[HIDWORD(pOurHour) % 7]; | |
137 auto ampm = aAMPMNames[HIDWORD(pAMPM2)]; | |
138 auto month = aMonthNames[pMonthNum]; | |
139 //sprintf(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", _d, v17, (int)32, _a, 3, _m, pFilesID); | |
140 sprintfex(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", day, pHour, pMinutes, ampm, 7 * v16 + HIDWORD(pOurHour) % 7 + 1, month, pYear); | |
141 pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf.data(), 3u); | |
142 //v1 = 255; | |
143 } | 94 } |
144 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) | 95 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) |
145 { | 96 { |
146 pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | 97 pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; |
147 strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, (const char *)pKeyActionMap->pPressedKeysBuffer); | 98 strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, (const char *)pKeyActionMap->pPressedKeysBuffer); |
152 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) | 103 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) |
153 pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | 104 pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; |
154 } | 105 } |
155 if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu) | 106 if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu) |
156 { | 107 { |
157 //v18 = pGlobalTXT_LocalizationStrings[135]; | 108 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[135]) + 25, |
158 v19 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[135]);//"Загрузка" | 109 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0);//Загрузка |
159 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v19 + 25, 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0); | 110 pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, pFontSmallnum->AlignText_Center(186, |
160 v20 = (const char *)(&pSavegameHeader[uLoadGameUI_SelectedSlot]); | 111 (const char *)pSavegameHeader.data() + 100 * uLoadGameUI_SelectedSlot) + 25, 0x106, 0, pSavegameHeader[uLoadGameUI_SelectedSlot].pName, 185, 0); |
161 v21 = pFontSmallnum->AlignText_Center(0xBA, (const char *)pSavegameHeader.data() + 100 * uLoadGameUI_SelectedSlot); | 112 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[165]) + 25, |
162 pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v21 + 25, 0x106, 0, v20, 185, 0); | 113 304, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0);//"Пожалуйста, пожождите" |
163 //v22 = pGlobalTXT_LocalizationStrings[165]; | |
164 v23 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[165]);//"Пожалуйста, пожождите" | |
165 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v23 + 25, 304, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0); | |
166 } | 114 } |
167 else | 115 else |
168 { | 116 { |
169 if ( save ) | 117 if ( save ) |
170 pSaveFiles = 40; | 118 pSaveFiles = 40; |
171 else | 119 else |
172 pSaveFiles = uNumSavegameFiles; | 120 pSaveFiles = uNumSavegameFiles; |
173 int a4 = 199; | 121 |
174 pFilesID = pSaveListPosition; | 122 int slot_Y = 199; |
175 pSlotName = (const char *)(&pSavegameHeader[pSaveListPosition]);//draw name for save slot | 123 for ( uint i = pSaveListPosition; i < pSaveFiles; ++i ) |
176 do | 124 { |
177 { | 125 if ( slot_Y >= 346 ) |
178 if ( pFilesID >= (signed int)pSaveFiles ) | |
179 break; | 126 break; |
180 short clr; | 127 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS || i != uLoadGameUI_SelectedSlot ) |
181 HIDWORD(pAMPM2) = clr = (pFilesID == uLoadGameUI_SelectedSlot ? TargetColor(0xFF, 0xFF, 0x64) : 0); | 128 pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 27, slot_Y, i == uLoadGameUI_SelectedSlot ? TargetColor(0xFF, 0xFF, 0x64) : 0, pSavegameHeader[i].pName, 185, 0); |
182 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS || pFilesID != uLoadGameUI_SelectedSlot ) | |
183 { | |
184 pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, pSlotName, 185, 0); | |
185 } | |
186 else | 129 else |
187 { | 130 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, |
188 v25 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, (const char *)pKeyActionMap->pPressedKeysBuffer, 175, 1); | 131 slot_Y, pFontSmallnum); |
189 pGUIWindow_CurrentMenu->DrawFlashingInputCursor(v25 + 27, a4, pFontSmallnum); | 132 slot_Y += 21; |
190 } | |
191 a4 += 21; | |
192 ++pFilesID; | |
193 pSlotName += 100; | |
194 } | 133 } |
195 while ( a4 < 346 ); | |
196 } | 134 } |
197 pRenderer->EndScene(); | 135 pRenderer->EndScene(); |
198 } | 136 } |
199 // 6A0C9C: using guessed type int dword_6A0C9C; | 137 // 6A0C9C: using guessed type int dword_6A0C9C; |
200 | 138 |