annotate UI/UISaveLoad.cpp @ 1602:96a1f5e0b6cd

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