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