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