annotate UI/UISaveLoad.cpp @ 1436:883fea17dd9a

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