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