annotate GUI/UI/UISaveLoad.cpp @ 2575:a76d408c5132 tip

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