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