Mercurial > mm7
annotate GUI/UI/UISaveLoad.cpp @ 2573:0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
Changing more class Texture to class Image.
author | a.parshin |
---|---|
date | Sat, 05 Mar 2016 16:25:53 +0200 |
parents | d87bfbd3bb3b |
children | dd36326a9994 |
rev | line source |
---|---|
2501 | 1 #define _CRTDBG_MAP_ALLOC |
2547 | 2 #define _CRT_SECURE_NO_WARNINGS |
2501 | 3 #include <stdlib.h> |
4 #include <crtdbg.h> | |
5 #include <io.h> | |
6 | |
2541 | 7 #include "Engine/Engine.h" |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
8 #include "Engine/AssetsManager.h" |
2547 | 9 #include "Engine/MapInfo.h" |
10 #include "Engine/Graphics/Render.h" | |
11 #include "Engine/LOD.h" | |
12 #include "Engine/SaveLoad.h" | |
13 #include "Engine/texts.h" | |
2501 | 14 |
2547 | 15 #include "IO/Keyboard.h" |
16 | |
17 #include "GUI/GUIFont.h" | |
18 #include "GUI/UI/UISaveLoad.h" | |
2501 | 19 |
2544
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
20 #include "Game/MainMenu.h" |
c674d547cc7c
GUIWindow switch logic refactored into behaviour classes
a.parshin
parents:
2541
diff
changeset
|
21 |
2547 | 22 void UI_DrawSaveLoad(bool save); |
23 | |
24 | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
25 Image *img_save_up = nullptr; |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
26 Image *img_load_up = nullptr; |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
27 Image *img_loadsave = nullptr; |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
28 Image *img_loadsave_saveu = nullptr; |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
29 Image *img_loadsave_loadu = nullptr; |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
30 Image *img_loadsave_x_u = nullptr; |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
31 |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
32 |
2547 | 33 GUIWindow_Save::GUIWindow_Save() : |
34 GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr) | |
35 { | |
36 // ------------------------------------------------ | |
37 // 0045E93E SaveUI_Load(enum CURRENT_SCREEN screen) | |
38 char *v3; // eax@7 | |
39 LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 | |
40 | |
41 ++pIcons_LOD->uTexturePacksCount; | |
42 if (!pIcons_LOD->uNumPrevLoadedFiles) | |
43 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
44 memset(&pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots)); | |
45 memset(&pSavegameThumbnails, 0, sizeof(pSavegameThumbnails)); | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
46 img_loadsave = assets->GetImage_16BitColorKey(L"loadsave", 0x7FF); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
47 img_save_up = assets->GetImage_16BitColorKey(L"save_up", 0x7FF); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
48 img_load_up = assets->GetImage_16BitColorKey(L"load_up", 0x7FF); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
49 img_loadsave_saveu = assets->GetImage_16BitColorKey(L"LS_saveU", 0x7FF); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
50 img_loadsave_loadu = assets->GetImage_16BitColorKey(L"LS_loadU", 0x7FF); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
51 img_loadsave_x_u = assets->GetImage_16BitColorKey(L"x_u", 0x7FF); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
52 |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
53 pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, img_loadsave); |
2547 | 54 |
55 //if (screen == SCREEN_SAVEGAME) | |
56 { | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
57 pRenderer->DrawTextureAlphaNew(241/640.0f, 302/480.0f, img_loadsave_saveu); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
58 pRenderer->DrawTextureAlphaNew(351/640.0f, 302/480.0f, img_loadsave_x_u); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
59 pRenderer->DrawTextureAlphaNew(18/640.0f, 141/480.0f, img_save_up); |
2547 | 60 } |
61 /*else | |
62 { | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
63 pRenderer->DrawTextureTransparentColorKey(241, 302, pIcons_LOD->GetTexture(uTextureID_LS_loadU)); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
64 pRenderer->DrawTextureTransparentColorKey(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
65 pRenderer->DrawTextureTransparentColorKey(18, 141, pIcons_LOD->GetTexture(uTextureID_load_up)); |
2547 | 66 }*/ |
67 | |
68 //pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);//Read...(Чтение...) | |
69 pRenderer->Present(); | |
70 pSavegameList->Initialize(1); | |
71 pLODFile.AllocSubIndicesAndIO(300, 0); | |
72 for (uint i = 0; i < 40; ++i) | |
73 { | |
74 v3 = pSavegameList->pFileList[i].pSaveFileName; | |
75 if (!*pSavegameList->pFileList[i].pSaveFileName) | |
76 v3 = "1.mm7"; | |
77 sprintf(pTmpBuf.data(), "saves\\%s", v3); | |
78 if (_access(pTmpBuf.data(), 0) || _access(pTmpBuf.data(), 6)) | |
79 { | |
80 pSavegameUsedSlots[i] = 0; | |
81 strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[LOCSTR_EMPTY]); | |
82 } | |
83 else | |
84 { | |
85 pLODFile.LoadFile(pTmpBuf.data(), 1); | |
86 fread(&pSavegameHeader[i], 100, 1, pLODFile.FindContainer("header.bin", 1)); | |
87 if (pLODFile.FindContainer("image.pcx", 1)) | |
88 { | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2547
diff
changeset
|
89 //pSavegameThumbnails[i].LoadFromFILE(pLODFile.FindContainer("image.pcx", 1), 0, 1); |
2547 | 90 pLODFile.CloseWriteFile(); |
91 pSavegameUsedSlots[i] = 1; | |
92 } | |
93 else | |
94 pSavegameUsedSlots[i] = 0; | |
95 } | |
96 } | |
97 pLODFile.FreeSubIndexAndIO(); | |
98 uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); | |
99 uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE); | |
100 uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); | |
101 uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); | |
102 | |
103 // ----------------------------- | |
104 // GUIWindow_Save c-tor --- part | |
105 CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); | |
106 CreateButton(21, 218, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); | |
107 CreateButton(21, 238, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); | |
108 CreateButton(21, 258, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); | |
109 CreateButton(21, 278, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); | |
110 CreateButton(21, 298, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); | |
111 CreateButton(21, 318, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); | |
112 pBtnLoadSlot = CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); | |
113 pBtnCancel = CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); | |
114 pBtnArrowUp = CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); | |
115 pBtnDownArrow = CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, 34, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); | |
116 } | |
117 | |
118 | |
119 void GUIWindow_Save::Update() | |
120 { | |
121 // ----------------------------------- | |
122 // 004156F0 GUI_UpdateWindows --- part | |
123 // { | |
124 // SaveUI_Draw(); | |
125 // } | |
126 | |
127 // ----- (004606FE) -------------------------------------------------------- | |
128 // void SaveUI_Draw() | |
129 // { | |
130 UI_DrawSaveLoad(true); | |
131 } | |
132 | |
133 | |
134 | |
135 | |
136 GUIWindow_Load::GUIWindow_Load(bool ingame) : | |
137 GUIWindow(0, 0, 0, 0, 0, nullptr) | |
138 { | |
139 // ----- (0045E361) -------------------------------------------------------- | |
140 // void LoadUI_Load(unsigned int uDialogueType) | |
141 // { | |
142 current_screen_type = SCREEN_LOADGAME; | |
143 | |
144 LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1 | |
145 | |
146 dword_6BE138 = -1; | |
147 pIcons_LOD->_inlined_sub2(); | |
148 | |
149 memset(pSavegameUsedSlots.data(), 0, sizeof(pSavegameUsedSlots)); | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2547
diff
changeset
|
150 memset(pSavegameThumbnails.data(), 0, 45 * sizeof(Image *)); |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
151 img_loadsave = assets->GetImage_16BitColorKey(L"loadsave", 0x7FF); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
152 img_save_up = assets->GetImage_16BitColorKey(L"save_up", 0x7FF); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
153 img_load_up = assets->GetImage_16BitColorKey(L"load_up", 0x7FF); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
154 img_loadsave_saveu = assets->GetImage_16BitColorKey(L"LS_saveU", 0x7FF); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
155 img_loadsave_loadu = assets->GetImage_16BitColorKey(L"LS_loadU", 0x7FF); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
156 img_loadsave_x_u = assets->GetImage_16BitColorKey(L"x_u", 0x7FF); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
157 |
2547 | 158 if (ingame) |
159 { | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
160 pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, img_loadsave); |
2547 | 161 if (current_screen_type == SCREEN_SAVEGAME) |
162 { | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
163 pRenderer->DrawTextureAlphaNew(241/640.0f, 302/480.0f, img_loadsave_saveu); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
164 pRenderer->DrawTextureAlphaNew(18 / 640.0f, 141 / 480.0f, img_save_up); |
2547 | 165 } |
166 else | |
167 { | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
168 pRenderer->DrawTextureAlphaNew(241 / 640.0f, 302 / 480.0f, img_loadsave_loadu); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
169 pRenderer->DrawTextureAlphaNew(18 / 640.0f, 141 / 480.0f, img_load_up); |
2547 | 170 } |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
171 pRenderer->DrawTextureAlphaNew(351 / 640.0f, 302 / 480.0f, img_loadsave_x_u); |
2547 | 172 } |
173 else | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2547
diff
changeset
|
174 pRenderer->DrawTextureNew(0, 0, main_menu_background); |
2547 | 175 |
176 | |
177 /*pGUIWindow_CurrentMenu = new GUIWindow_Load( | |
178 saveload_dlg_xs[uDialogueType], | |
179 saveload_dlg_ys[uDialogueType], | |
180 saveload_dlg_zs[uDialogueType], | |
181 saveload_dlg_ws[uDialogueType], 0, 0);*/ | |
182 | |
183 // GUIWindow::GUIWindow | |
184 this->uFrameX = saveload_dlg_xs[ingame ? 1 : 0]; | |
185 this->uFrameY = saveload_dlg_ys[ingame ? 1 : 0]; | |
186 this->uFrameWidth = saveload_dlg_zs[ingame ? 1 : 0]; | |
187 this->uFrameHeight = saveload_dlg_ws[ingame ? 1 : 0]; | |
188 this->uFrameZ = uFrameX + uFrameWidth - 1; | |
189 this->uFrameW = uFrameY + uFrameHeight - 1; | |
190 | |
191 | |
192 | |
193 DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);// "Reading..." | |
194 pRenderer->Present(); | |
195 pSavegameList->Initialize(0); | |
196 if (pSaveListPosition > (signed int)uNumSavegameFiles) | |
197 { | |
198 pSaveListPosition = 0; | |
199 uLoadGameUI_SelectedSlot = 0; | |
200 } | |
201 pLODFile.AllocSubIndicesAndIO(300, 0); | |
202 Assert(sizeof(SavegameHeader) == 100); | |
203 for (uint i = 0; i < uNumSavegameFiles; ++i) | |
204 { | |
205 sprintf(pTmpBuf.data(), "saves\\%s", pSavegameList->pFileList[i].pSaveFileName); | |
206 if (_access(pTmpBuf.data(), 6)) | |
207 { | |
208 pSavegameUsedSlots[i] = 0; | |
209 strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[72]); // "Empty" | |
210 continue; | |
211 } | |
212 pLODFile.LoadFile(pTmpBuf.data(), 1); | |
213 if (pLODFile.FindContainer("header.bin", true)) | |
214 fread(&pSavegameHeader[i], 100, 1, pLODFile.FindContainer("header.bin", true)); | |
215 if (!_stricmp(pSavegameList->pFileList[i].pSaveFileName, pGlobalTXT_LocalizationStrings[613]))// "AutoSave.MM7" | |
216 strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[16]);// "Autosave" | |
217 if (!pLODFile.FindContainer("image.pcx", true)) | |
218 { | |
219 pSavegameUsedSlots[i] = 0; | |
220 strcpy(pSavegameList->pFileList[i].pSaveFileName, ""); | |
221 } | |
222 else | |
223 { | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2547
diff
changeset
|
224 //pSavegameThumbnails[i].LoadFromFILE(pLODFile.FindContainer("image.pcx", true), 0, true); |
2547 | 225 pLODFile.CloseWriteFile(); |
226 pSavegameUsedSlots[i] = 1; | |
227 } | |
228 } | |
229 | |
230 pLODFile.FreeSubIndexAndIO(); | |
231 if (current_screen_type == SCREEN_SAVEGAME) | |
232 { | |
233 uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); | |
234 uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE); | |
235 } | |
236 else | |
237 { | |
238 uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); | |
239 uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_loadD", TEXTURE_16BIT_PALETTE); | |
240 } | |
241 uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE); | |
242 uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE); | |
243 CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0); | |
244 CreateButton(21, 219, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0); | |
245 CreateButton(21, 240, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0); | |
246 CreateButton(21, 261, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0); | |
247 CreateButton(21, 282, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0); | |
248 CreateButton(21, 303, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0); | |
249 CreateButton(21, 324, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0); | |
250 pBtnLoadSlot = CreateButton(241, 302, 105, 40, 1, 0, UIMSG_SaveLoadBtn, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_LS_), 0); | |
251 pBtnCancel = CreateButton(350, 302, 105, 40, 1, 0, UIMSG_Cancel, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_x_d), 0); | |
252 pBtnArrowUp = CreateButton(215, 199, 17, 17, 1, 0, UIMSG_ArrowUp, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_UP_DN), 0); | |
253 pBtnDownArrow = CreateButton(215, 323, 17, 17, 1, 0, UIMSG_DownArrow, uNumSavegameFiles, 0, "", pIcons_LOD->GetTexture(uTextureID_AR_DN_DN), 0); | |
254 } | |
255 | |
256 | |
257 void GUIWindow_Load::Update() | |
258 { | |
259 // ----------------------------------- | |
260 // 004156F0 GUI_UpdateWindows --- part | |
261 // { | |
262 // LoadUI_Draw(); | |
263 // } | |
264 | |
265 // ----- (004606F7) -------------------------------------------------------- | |
266 // void LoadUI_Draw() | |
267 // { | |
268 UI_DrawSaveLoad(false); | |
269 } | |
270 | |
2501 | 271 |
272 //----- (004601B7) -------------------------------------------------------- | |
273 static void UI_DrawSaveLoad(bool save) | |
274 { | |
275 // const char *pSlotName; // edi@36 | |
276 GUIWindow save_load_window; // [sp+Ch] [bp-78h]@8 | |
277 unsigned int pSaveFiles; // [sp+70h] [bp-14h]@10 | |
278 unsigned __int64 full_hours; | |
279 unsigned __int64 full_days; | |
280 int full_weeks; | |
281 int full_month; | |
282 int current_year; | |
283 int current_month; | |
284 int current_day; | |
285 int current_hour; | |
286 int current_minutes; | |
287 | |
288 pRenderer->BeginScene(); | |
289 if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LoadingProcInMainMenu ) | |
290 { | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
291 pRenderer->DrawTextureAlphaNew(8/640.0f, 8/480.0f, img_loadsave); |
2501 | 292 if (save) |
293 { | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
294 pRenderer->DrawTextureAlphaNew(241 / 640.0f, 302 / 480.0f, img_loadsave_saveu); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
295 pRenderer->DrawTextureAlphaNew( 18 / 640.0f, 139 / 480.0f, img_save_up); |
2501 | 296 } |
297 else | |
298 { | |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
299 pRenderer->DrawTextureAlphaNew(241 / 640.0f, 302 / 480.0f, img_loadsave_loadu); |
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
300 pRenderer->DrawTextureAlphaNew( 18 / 640.0f, 139 / 480.0f, img_load_up); |
2501 | 301 } |
2573
0c67be4ec900
DrawTextureIndexed renamed to DrawTextureTransparentColorKey
a.parshin
parents:
2572
diff
changeset
|
302 pRenderer->DrawTextureAlphaNew(351 / 640.0f, 302 / 480.0f, img_loadsave_x_u); |
2501 | 303 } |
304 if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) | |
305 { | |
306 memset(&save_load_window, 0, 0x54); | |
307 save_load_window.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240; | |
308 save_load_window.uFrameWidth = 220; | |
309 save_load_window.uFrameY = (pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight) + 157; | |
310 save_load_window.uFrameZ = save_load_window.uFrameX + 219; | |
311 save_load_window.uFrameHeight = pFontSmallnum->uFontHeight; | |
312 save_load_window.uFrameW = pFontSmallnum->uFontHeight + save_load_window.uFrameY - 1; | |
2572
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2547
diff
changeset
|
313 if ( pSavegameThumbnails[uLoadGameUI_SelectedSlot] ) |
d87bfbd3bb3b
Step towards unification of Texture and RGBTexture (class Image)
a.parshin
parents:
2547
diff
changeset
|
314 pRenderer->DrawTextureNew((pGUIWindow_CurrentMenu->uFrameX + 276)/640.0f, (pGUIWindow_CurrentMenu->uFrameY + 171)/480.0f, pSavegameThumbnails[uLoadGameUI_SelectedSlot]); |
2501 | 315 //Draw map name |
316 save_load_window.DrawTitleText(pFontSmallnum, 0, 0, 0, pMapStats->pInfos[pMapStats->GetMapInfo(pSavegameHeader[uLoadGameUI_SelectedSlot].pLocationName)].pName, 3); | |
317 //Draw date | |
318 full_hours = ((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) / 60i64; | |
319 full_days = (unsigned int)full_hours / 24; | |
320 full_weeks = (unsigned int)(full_days / 7); | |
321 full_month = (unsigned int)full_weeks / 4; | |
322 current_year = (full_month / 12) + game_starting_year; | |
323 current_month = full_month % 12; | |
324 current_day = full_days % 28; | |
325 current_hour = full_hours % 24; | |
326 current_minutes = (((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) % 60i64); | |
327 | |
328 save_load_window.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261; | |
329 int am; | |
330 if ( (signed int)current_hour >= 12 ) | |
331 { | |
332 current_hour -= 12; | |
333 if ( !current_hour ) | |
334 current_hour = 12; | |
335 am = 1; | |
336 } | |
337 else | |
338 am = 0; | |
339 const char* day = aDayNames[full_days % 7]; | |
340 const char* ampm = aAMPMNames[am]; | |
341 const char* month = aMonthNames[current_month]; | |
342 | |
343 sprintfex(pTmpBuf.data(), "%s %d:%02d %s\n%d %s %d", day, current_hour, current_minutes, aAMPMNames[am], current_day + 1, month, current_year); | |
344 save_load_window.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf.data(), 3); | |
345 } | |
346 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) | |
347 { | |
348 pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
349 strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, pKeyActionMap->pPressedKeysBuffer); | |
350 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveGame, 0, 0); | |
351 } | |
352 else | |
353 { | |
354 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED) | |
355 pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE; | |
356 } | |
357 if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu) | |
358 { | |
359 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[135]) + 25, | |
360 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0);//Загрузка | |
361 pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, pFontSmallnum->AlignText_Center(186, | |
362 pSavegameHeader[uLoadGameUI_SelectedSlot].pName) + 25, 0x106, 0, pSavegameHeader[uLoadGameUI_SelectedSlot].pName, 185, 0); | |
363 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[165]) + 25, | |
364 304, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0);//"Пожалуйста, пожождите" | |
365 } | |
366 else | |
367 { | |
368 if ( save ) | |
369 pSaveFiles = 40; | |
370 else | |
371 pSaveFiles = uNumSavegameFiles; | |
372 | |
373 int slot_Y = 199; | |
374 for ( uint i = pSaveListPosition; i < pSaveFiles; ++i ) | |
375 { | |
376 if ( slot_Y >= 346 ) | |
377 break; | |
378 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS || i != uLoadGameUI_SelectedSlot ) | |
379 pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 27, slot_Y, i == uLoadGameUI_SelectedSlot ? Color16(0xFF, 0xFF, 0x64) : 0, pSavegameHeader[i].pName, 185, 0); | |
380 else | |
381 pGUIWindow_CurrentMenu->DrawFlashingInputCursor(pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 27, slot_Y, i == uLoadGameUI_SelectedSlot ? Color16(0xFF, 0xFF, 0x64) : 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 175, 1) + 27, | |
382 slot_Y, pFontSmallnum); | |
383 slot_Y += 21; | |
384 } | |
385 } | |
386 pRenderer->EndScene(); | |
387 } |