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