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