Mercurial > mm7
annotate UI/UISaveLoad.cpp @ 1698:8cfb2e978445
Merge
author | Ritor1 |
---|---|
date | Sun, 22 Sep 2013 16:45:46 +0600 |
parents | afc1c3514dd5 |
children | e013b92030e3 |
rev | line source |
---|---|
1298 | 1 #ifdef _MSC_VER |
2 #define _CRT_SECURE_NO_WARNINGS | |
3 #endif | |
4 | |
5 #include <io.h> | |
1299 | 6 #include "..\MM7.h" |
1298 | 7 |
1299 | 8 #include "..\Keyboard.h" |
1298 | 9 |
1299 | 10 #include "..\MapInfo.h" |
11 #include "..\GUIWindow.h" | |
12 #include "..\GUIFont.h" | |
13 #include "..\Render.h" | |
14 #include "..\LOD.h" | |
15 #include "..\SaveLoad.h" | |
16 #include "..\texts.h" | |
1298 | 17 |
1299 | 18 #include "..\mm7_data.h" |
1298 | 19 |
20 | |
21 //----- (004601B7) -------------------------------------------------------- | |
22 static void UI_DrawSaveLoad(bool save) | |
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 //const char *v18; // ST14_4@32 | |
42 int v19; // eax@32 | |
43 const char *v20; // ST18_4@32 | |
44 int v21; // eax@32 | |
45 //const char *v22; // ST14_4@32 | |
46 int v23; // eax@32 | |
47 const char *pSlotName; // edi@36 | |
48 int v25; // eax@43 | |
49 GUIWindow pWindow; // [sp+Ch] [bp-78h]@8 | |
50 /*unsigned int Dst; // [sp+Ch] [bp-78h]@8 | |
51 unsigned int v27; // [sp+10h] [bp-74h]@8 | |
52 int v28; // [sp+14h] [bp-70h]@8 | |
53 int v29; // [sp+18h] [bp-6Ch]@8 | |
54 unsigned int v30; // [sp+1Ch] [bp-68h]@8 | |
55 unsigned int v31; // [sp+20h] [bp-64h]@8*/ | |
56 int pMinutes; // [sp+60h] [bp-24h]@10 | |
57 int pMonthNum; // [sp+68h] [bp-1Ch]@10 | |
58 unsigned int pSaveFiles; // [sp+70h] [bp-14h]@10 | |
59 __int64 pAMPM2; // [sp+74h] [bp-10h]@10 | |
60 int pYear; // [sp+7Ch] [bp-8h]@10 | |
61 //int a4; // [sp+80h] [bp-4h]@1 | |
62 int pFilesID; | |
63 | |
64 v1 = 255; | |
65 TargetColor(0xFF, 0xFF, 0xFF); | |
66 TargetColor(0xFF, 0xFF, 0x9B); | |
67 pRenderer->BeginScene(); | |
68 if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LoadingProcInMainMenu ) | |
69 { | |
70 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); | |
71 if (save) | |
72 { | |
73 v2 = uTextureID_save_up; | |
74 v3 = uTextureID_LS_saveU; | |
75 } | |
76 else | |
77 { | |
78 v2 = uTextureID_load_up; | |
79 v3 = uTextureID_LS_loadU; | |
80 } | |
81 pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(v3)); | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
82 pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(v2)); |
1298 | 83 pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); |
84 v1 = 255; | |
85 } | |
86 if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) | |
87 { | |
88 memset(&pWindow, 0, 0x54); | |
89 pWindow.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240; | |
90 v4 = pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight; | |
91 pWindow.uFrameWidth = 220; | |
92 v4 += 157; | |
93 pWindow.uFrameY = v4; | |
94 v5 = pFontSmallnum->uFontHeight; | |
95 pWindow.uFrameZ = pWindow.uFrameX + 219; | |
96 pWindow.uFrameHeight = v5; | |
97 pWindow.uFrameW = v5 + v4 - 1; | |
98 v6 = uLoadGameUI_SelectedSlot; | |
99 if (pSavegameThumbnails[uLoadGameUI_SelectedSlot].pPixels) | |
100 { | |
101 pRenderer->DrawTextureRGB(pGUIWindow_CurrentMenu->uFrameX + 276, pGUIWindow_CurrentMenu->uFrameY + 171, &pSavegameThumbnails[uLoadGameUI_SelectedSlot]); | |
102 v6 = uLoadGameUI_SelectedSlot; | |
103 } | |
104 pMapID = pMapStats->GetMapInfo(pSavegameHeader[v6].pLocationName); | |
105 pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[pMapID].pName, 3); | |
106 v8 = (signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60; | |
107 pMinutes = (int)(((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) >> 32); | |
108 v9 = v8; | |
109 v8 /= 60i64; | |
110 pAMPM2 = v8; | |
111 v10 = (unsigned int)v8 / 24; | |
112 pSaveFiles = v10; | |
113 v11 = (unsigned int)(v10 / 7); | |
114 v12 = v11; | |
115 LODWORD(v13) = (unsigned int)v11 >> 2; | |
116 HIDWORD(v13) = HIDWORD(v11); | |
117 pMonthNum = v13 % 12; | |
118 pYear = v13 / 12; | |
119 pMinutes = (int)__PAIR__(pMinutes, v9) % 60; | |
120 pOurHour = pAMPM2 % 24; | |
121 v14 = (unsigned __int64)(pAMPM2 % 24) >> 32; | |
122 LODWORD(pAMPM2) = pAMPM2 % 24; | |
123 HIDWORD(pOurHour) = pSaveFiles % 28; | |
124 pYear += game_starting_year; | |
125 v16 = v12 & 3; | |
126 pWindow.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261; | |
127 HIDWORD(pAMPM2) = v14 == 0 && ((signed int)v14 > 0 || (unsigned int)pOurHour >= 12) | |
128 && (signed int)v14 <= 0 && (v14 != 0 || (unsigned int)pOurHour < 24); | |
129 if ( v14 != 0 || ((signed int)v14 <= 0) && (unsigned int)pOurHour <= 12 ) | |
130 { | |
131 if ( !(v14 | (unsigned int)pOurHour) ) | |
132 { | |
133 pSaveFiles = 0; | |
134 pHour = 12; | |
135 goto LABEL_23; | |
136 } | |
137 } | |
138 else | |
139 { | |
140 v14 = (__PAIR__(v14, (unsigned int)pOurHour) - 12) >> 32; | |
141 LODWORD(pOurHour) = pOurHour - 12; | |
142 } | |
143 pHour = pOurHour; | |
144 pSaveFiles = v14; | |
145 LABEL_23: | |
146 auto day = aDayNames[HIDWORD(pOurHour) % 7]; | |
147 auto ampm = aAMPMNames[HIDWORD(pAMPM2)]; | |
148 auto month = aMonthNames[pMonthNum]; | |
149 //sprintf(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", _d, v17, (int)32, _a, 3, _m, pFilesID); | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
150 sprintfex(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", day, pHour, pMinutes, ampm, 7 * v16 + HIDWORD(pOurHour) % 7 + 1, month, pYear); |
1298 | 151 pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf.data(), 3u); |
152 v1 = 255; | |
153 } | |
154 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) | |
155 { | |
156 pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
157 strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, (const char *)pKeyActionMap->pPressedKeysBuffer); | |
158 pMessageQueue_50CBD0->AddMessage(UIMSG_SaveGame, 0, 0); | |
159 } | |
160 else | |
161 { | |
162 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) | |
163 pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
164 } | |
165 if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu) | |
166 { | |
167 //v18 = pGlobalTXT_LocalizationStrings[135]; | |
168 v19 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[135]);//"Çàãðóçêà" | |
169 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v19 + 25, 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0); | |
170 v20 = (const char *)(&pSavegameHeader[uLoadGameUI_SelectedSlot]); | |
171 v21 = pFontSmallnum->AlignText_Center(0xBA, (const char *)pSavegameHeader.data() + 100 * uLoadGameUI_SelectedSlot); | |
172 pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, v21 + 25, 0x106, 0, v20, 185, 0); | |
173 //v22 = pGlobalTXT_LocalizationStrings[165]; | |
174 v23 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[165]);//"Ïîæàëóéñòà, ïîæîæäèòå" | |
175 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, v23 + 25, 304, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0); | |
176 } | |
177 else | |
178 { | |
179 if ( save ) | |
180 pSaveFiles = 40; | |
181 else | |
182 pSaveFiles = uNumSavegameFiles; | |
183 int a4 = 199; | |
184 pFilesID = pSaveListPosition; | |
185 pSlotName = (const char *)(&pSavegameHeader[pSaveListPosition]);//draw name for save slot | |
186 do | |
187 { | |
188 if ( pFilesID >= (signed int)pSaveFiles ) | |
189 break; | |
190 short clr; | |
191 HIDWORD(pAMPM2) = clr = (pFilesID == uLoadGameUI_SelectedSlot ? TargetColor(v1, v1, 0x64) : 0); | |
192 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS || pFilesID != uLoadGameUI_SelectedSlot ) | |
193 { | |
194 pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, pSlotName, 185, 0); | |
195 } | |
196 else | |
197 { | |
198 v25 = pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, (const char *)pKeyActionMap->pPressedKeysBuffer, 175, 1); | |
199 pGUIWindow_CurrentMenu->DrawFlashingInputCursor(v25 + 27, a4, pFontSmallnum); | |
200 } | |
201 a4 += 21; | |
202 ++pFilesID; | |
203 pSlotName += 100; | |
204 } | |
205 while ( a4 < 346 ); | |
206 } | |
207 pRenderer->EndScene(); | |
208 } | |
209 // 6A0C9C: using guessed type int dword_6A0C9C; | |
210 | |
211 //----- (004606F7) -------------------------------------------------------- | |
212 void LoadUI_Draw() | |
213 { | |
214 UI_DrawSaveLoad(false); | |
215 } | |
216 | |
217 //----- (004606FE) -------------------------------------------------------- | |
218 void SaveUI_Draw() | |
219 { | |
220 UI_DrawSaveLoad(true); | |
221 } | |
222 | |
223 | |
224 //----- (0045E361) -------------------------------------------------------- | |
225 void LoadUI_Load(unsigned int uDialogueType) | |
226 { | |
227 unsigned int v1; // ebp@5 | |
228 unsigned int v2; // eax@5 | |
229 //signed int v3; // ebp@11 | |
230 FILE *v4; // eax@14 | |
231 FILE *v5; // eax@18 | |
232 unsigned int v6; // eax@25 | |
233 GUIButton *v7; // eax@27 | |
234 const char *v8; // [sp-8h] [bp-26Ch]@25 | |
235 //char *v9; // [sp-4h] [bp-268h]@19 | |
236 enum TEXTURE_TYPE v10; // [sp-4h] [bp-268h]@25 | |
237 unsigned int uDialogueType_; // [sp+10h] [bp-254h]@1 | |
238 //RGBTexture *pTex; // [sp+10h] [bp-254h]@12 | |
239 //SavegameHeader *Dest; // [sp+14h] [bp-250h]@12 | |
240 //const char *Str1; // [sp+18h] [bp-24Ch]@12 | |
241 LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 | |
242 int v16; // [sp+260h] [bp-4h]@1 | |
243 | |
244 uDialogueType_ = uDialogueType; | |
245 dword_6BE138 = -1; | |
246 pIcons_LOD->_inlined_sub2(); | |
247 | |
248 memset(pSavegameUsedSlots.data(), 0, sizeof(pSavegameUsedSlots)); | |
249 memset(pSavegameThumbnails.data(), 0, 45 * sizeof(RGBTexture)); | |
250 uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); | |
251 uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); | |
252 uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); | |
253 uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); | |
254 uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); | |
255 uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); | |
256 if ( uDialogueType_ ) | |
257 { | |
258 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); | |
259 if ( pCurrentScreen == SCREEN_SAVEGAME ) | |
260 { | |
261 v1 = uTextureID_save_up; | |
262 v2 = uTextureID_LS_saveU; | |
263 } | |
264 else | |
265 { | |
266 v1 = uTextureID_load_up; | |
267 v2 = uTextureID_LS_loadU; | |
268 } | |
269 pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(v2)); | |
270 pRenderer->DrawTextureIndexed( 18, 141, pIcons_LOD->GetTexture(v1)); | |
271 pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); | |
272 } | |
273 else | |
274 { | |
275 pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX); | |
276 } | |
277 pGUIWindow_CurrentMenu = GUIWindow::Create(saveload_dlg_xs[uDialogueType_], saveload_dlg_ys[uDialogueType_], saveload_dlg_zs[uDialogueType_], | |
278 saveload_dlg_ws[uDialogueType_], WINDOW_MainMenu_Load, 0, 0); | |
279 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);// "Reading..." | |
280 pRenderer->Present(); | |
281 pSavegameList->Initialize(0); | |
282 if ( pSaveListPosition > (signed int)uNumSavegameFiles ) | |
283 { | |
284 pSaveListPosition = 0; | |
285 uLoadGameUI_SelectedSlot = 0; | |
286 } | |
287 pLODFile.AllocSubIndicesAndIO(0x12C, 0); | |
1545 | 288 Assert(sizeof(SavegameHeader) == 0x64); |
1298 | 289 //v3 = 0; |
290 for (uint i = 0; i < uNumSavegameFiles; ++i) | |
291 { | |
292 | |
293 sprintf(pTmpBuf.data(), "saves\\%s", pSavegameList->pFileList[i].pSaveFileName); | |
294 if (_access(pTmpBuf.data(), 6)) | |
295 { | |
296 pSavegameUsedSlots[i] = 0; | |
297 strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[72]); // "Empty" | |
298 continue; | |
299 } | |
300 pLODFile.LoadFile(pTmpBuf.data(), 1); | |
301 v4 = pLODFile.FindContainer("header.bin", true); | |
302 if ( v4 ) | |
303 fread(&pSavegameHeader[i], 0x64, 1, v4); | |
304 if ( !_stricmp(pSavegameList->pFileList[i].pSaveFileName, pGlobalTXT_LocalizationStrings[613]) )// "AutoSave.MM7" | |
305 strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[16]);// "Autosave" | |
306 v5 = pLODFile.FindContainer("image.pcx", true); | |
307 if ( !v5 ) | |
308 { | |
309 pSavegameUsedSlots[i] = 0; | |
310 strcpy(pSavegameList->pFileList[i].pSaveFileName, ""); | |
311 } | |
312 else | |
313 { | |
314 pSavegameThumbnails[i].LoadFromFILE(v5, 0, true); | |
315 pLODFile.CloseWriteFile(); | |
316 pSavegameUsedSlots[i] = 1; | |
317 } | |
318 } | |
319 | |
320 //LABEL_24: | |
321 pLODFile.FreeSubIndexAndIO(); | |
322 if ( pCurrentScreen == SCREEN_SAVEGAME ) | |
323 { | |
324 uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); | |
325 uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD",TEXTURE_16BIT_PALETTE); | |
326 } | |
327 else | |
328 { | |
329 uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); | |
330 uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_loadD",TEXTURE_16BIT_PALETTE); | |
331 } | |
332 uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); | |
333 uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); | |
334 pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); | |
335 pGUIWindow_CurrentMenu->CreateButton(21, 219, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); | |
336 pGUIWindow_CurrentMenu->CreateButton(21, 240, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); | |
337 pGUIWindow_CurrentMenu->CreateButton(21, 261, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); | |
338 pGUIWindow_CurrentMenu->CreateButton(21, 282, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); | |
339 pGUIWindow_CurrentMenu->CreateButton(21, 303, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); | |
340 pGUIWindow_CurrentMenu->CreateButton(21, 324, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); | |
341 pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); | |
342 pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); | |
343 pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); | |
344 pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, uNumSavegameFiles, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); | |
345 } | |
346 | |
347 //----- (0045E93E) -------------------------------------------------------- | |
348 void SaveUI_Load() | |
349 { | |
350 unsigned int v0; // ebp@4 | |
351 unsigned int v1; // eax@4 | |
352 char *v3; // eax@7 | |
353 FILE *v4; // eax@11 | |
354 FILE *v5; // eax@11 | |
355 LODWriteableFile v11; // [sp+1Ch] [bp-248h]@1 | |
356 | |
357 ++pIcons_LOD->uTexturePacksCount; | |
358 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
359 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
360 memset(pSavegameUsedSlots.data(), 0, 0xB4u); | |
361 memset(&pSavegameThumbnails, 0, 0x708u); | |
362 uTextureID_loadsave = pIcons_LOD->LoadTexture("loadsave", TEXTURE_16BIT_PALETTE); | |
363 uTextureID_load_up = pIcons_LOD->LoadTexture("load_up", TEXTURE_16BIT_PALETTE); | |
364 uTextureID_save_up = pIcons_LOD->LoadTexture("save_up", TEXTURE_16BIT_PALETTE); | |
365 uTextureID_LS_loadU = pIcons_LOD->LoadTexture("LS_loadU", TEXTURE_16BIT_PALETTE); | |
366 uTextureID_LS_saveU = pIcons_LOD->LoadTexture("LS_saveU", TEXTURE_16BIT_PALETTE); | |
367 uTextureID_x_u = pIcons_LOD->LoadTexture("x_u", TEXTURE_16BIT_PALETTE); | |
368 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_loadsave)); | |
369 if ( pCurrentScreen == SCREEN_SAVEGAME ) | |
370 { | |
371 v0 = uTextureID_save_up; | |
372 v1 = uTextureID_LS_saveU; | |
373 } | |
374 else | |
375 { | |
376 v0 = uTextureID_load_up; | |
377 v1 = uTextureID_LS_loadU; | |
378 } | |
379 pRenderer->DrawTextureIndexed(0xF1u, 0x12Eu, pIcons_LOD->GetTexture(v1)); | |
380 pRenderer->DrawTextureIndexed(0x15Fu, 0x12Eu, pIcons_LOD->GetTexture(uTextureID_x_u)); | |
381 pRenderer->DrawTextureIndexed(0x12u, 0x8Du, pIcons_LOD->GetTexture(v0)); | |
382 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0); | |
383 pRenderer->Present(); | |
384 pSavegameList->Initialize(1u); | |
385 v11.AllocSubIndicesAndIO(0x12Cu, 0); | |
386 //v2 = pSavegameUsedSlots; | |
387 // Dest = pSavegameHeader; | |
388 // this_ = pSavegameThumbnails; | |
389 // v8 = (char *)pSavegameList->pSavesNames; | |
390 for (uint i = 0; i < 40; ++i) | |
391 { | |
392 v3 = pSavegameList->pFileList[i].pSaveFileName; | |
393 if ( !*pSavegameList->pFileList[i].pSaveFileName ) | |
394 v3 = "1.mm7"; | |
395 sprintf(pTmpBuf.data(), "saves\\%s", v3); | |
396 if ( _access(pTmpBuf.data(), 0) || _access(pTmpBuf.data(), 6) ) | |
397 { | |
398 pSavegameUsedSlots[i] = 0; | |
399 strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[LOCSTR_EMPTY]); | |
400 } | |
401 else | |
402 { | |
403 v11.LoadFile(pTmpBuf.data(), 1); | |
404 v4 = v11.FindContainer("header.bin", 1); | |
405 fread(&pSavegameHeader[i], 100, 1u, v4); | |
406 v5 = v11.FindContainer("image.pcx", 1); | |
407 if ( v5 ) | |
408 { | |
409 pSavegameThumbnails[i].LoadFromFILE(v5, 0, 1u); | |
410 v11.CloseWriteFile(); | |
411 pSavegameUsedSlots[i] = 1; | |
412 } | |
413 else | |
414 { | |
415 pSavegameUsedSlots[i] = 0; | |
416 } | |
417 } | |
418 | |
419 } | |
420 | |
421 v11.FreeSubIndexAndIO(); | |
422 uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); | |
423 uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE); | |
424 uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); | |
425 uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); | |
426 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SaveLoadButtons, 0, 0); | |
427 pGUIWindow_CurrentMenu->CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); | |
428 pGUIWindow_CurrentMenu->CreateButton(21, 218, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); | |
429 pGUIWindow_CurrentMenu->CreateButton(21, 238, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); | |
430 pGUIWindow_CurrentMenu->CreateButton(21, 258, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); | |
431 pGUIWindow_CurrentMenu->CreateButton(21, 278, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); | |
432 pGUIWindow_CurrentMenu->CreateButton(21, 298, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); | |
433 pGUIWindow_CurrentMenu->CreateButton(21, 318, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); | |
434 pBtnLoadSlot = pGUIWindow_CurrentMenu->CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); | |
435 pBtnCancel = pGUIWindow_CurrentMenu->CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); | |
436 pBtnArrowUp = pGUIWindow_CurrentMenu->CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); | |
437 pBtnDownArrow = pGUIWindow_CurrentMenu->CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, 34, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); | |
438 } |