annotate GUI/UI/UISaveLoad.cpp @ 2547:fed97f15d1e1

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