annotate UI/UISaveLoad.cpp @ 1698:8cfb2e978445

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