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
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
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
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
33 GUIWindow_Save::GUIWindow_Save() :
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
34 GUIWindow(0, 0, window->GetWidth(), window->GetHeight(), 0, nullptr)
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
35 {
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
36 // ------------------------------------------------
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
37 // 0045E93E SaveUI_Load(enum CURRENT_SCREEN screen)
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
38 char *v3; // eax@7
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
39 LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
40
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
41 ++pIcons_LOD->uTexturePacksCount;
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
42 if (!pIcons_LOD->uNumPrevLoadedFiles)
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
43 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
44 memset(&pSavegameUsedSlots, 0, sizeof(pSavegameUsedSlots));
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
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
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
54
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
55 //if (screen == SCREEN_SAVEGAME)
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
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
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
60 }
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
61 /*else
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
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
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
66 }*/
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
67
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
68 //pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);//Read...(Чтение...)
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
69 pRenderer->Present();
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
70 pSavegameList->Initialize(1);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
71 pLODFile.AllocSubIndicesAndIO(300, 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
72 for (uint i = 0; i < 40; ++i)
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
73 {
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
74 v3 = pSavegameList->pFileList[i].pSaveFileName;
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
75 if (!*pSavegameList->pFileList[i].pSaveFileName)
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
76 v3 = "1.mm7";
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
77 sprintf(pTmpBuf.data(), "saves\\%s", v3);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
78 if (_access(pTmpBuf.data(), 0) || _access(pTmpBuf.data(), 6))
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
79 {
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
80 pSavegameUsedSlots[i] = 0;
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
81 strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[LOCSTR_EMPTY]);
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 {
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
85 pLODFile.LoadFile(pTmpBuf.data(), 1);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
86 fread(&pSavegameHeader[i], 100, 1, pLODFile.FindContainer("header.bin", 1));
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
87 if (pLODFile.FindContainer("image.pcx", 1))
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
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
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
90 pLODFile.CloseWriteFile();
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
91 pSavegameUsedSlots[i] = 1;
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
92 }
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
93 else
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
94 pSavegameUsedSlots[i] = 0;
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
95 }
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
96 }
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
97 pLODFile.FreeSubIndexAndIO();
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
98 uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
99 uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
100 uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
101 uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
102
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
103 // -----------------------------
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
104 // GUIWindow_Save c-tor --- part
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
105 CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
106 CreateButton(21, 218, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
107 CreateButton(21, 238, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
108 CreateButton(21, 258, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
109 CreateButton(21, 278, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
110 CreateButton(21, 298, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
111 CreateButton(21, 318, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
112 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
113 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
114 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
115 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
116 }
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
117
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
118
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
119 void GUIWindow_Save::Update()
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
120 {
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
121 // -----------------------------------
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
122 // 004156F0 GUI_UpdateWindows --- part
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
123 // {
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
124 // SaveUI_Draw();
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 // ----- (004606FE) --------------------------------------------------------
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
128 // void SaveUI_Draw()
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
129 // {
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
130 UI_DrawSaveLoad(true);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
131 }
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
132
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
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
136 GUIWindow_Load::GUIWindow_Load(bool ingame) :
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
137 GUIWindow(0, 0, 0, 0, 0, nullptr)
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
138 {
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
139 // ----- (0045E361) --------------------------------------------------------
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
140 // void LoadUI_Load(unsigned int uDialogueType)
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
141 // {
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
142 current_screen_type = SCREEN_LOADGAME;
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
143
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
144 LODWriteableFile pLODFile; // [sp+1Ch] [bp-248h]@1
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
145
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
146 dword_6BE138 = -1;
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
147 pIcons_LOD->_inlined_sub2();
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
148
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
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
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
158 if (ingame)
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
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
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
161 if (current_screen_type == SCREEN_SAVEGAME)
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
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
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
165 }
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
166 else
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
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
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
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
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
172 }
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
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
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
175
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
176
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
177 /*pGUIWindow_CurrentMenu = new GUIWindow_Load(
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
178 saveload_dlg_xs[uDialogueType],
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
179 saveload_dlg_ys[uDialogueType],
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
180 saveload_dlg_zs[uDialogueType],
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
181 saveload_dlg_ws[uDialogueType], 0, 0);*/
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
182
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
183 // GUIWindow::GUIWindow
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
184 this->uFrameX = saveload_dlg_xs[ingame ? 1 : 0];
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
185 this->uFrameY = saveload_dlg_ys[ingame ? 1 : 0];
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
186 this->uFrameWidth = saveload_dlg_zs[ingame ? 1 : 0];
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
187 this->uFrameHeight = saveload_dlg_ws[ingame ? 1 : 0];
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
188 this->uFrameZ = uFrameX + uFrameWidth - 1;
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
189 this->uFrameW = uFrameY + uFrameHeight - 1;
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
190
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
191
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
192
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
193 DrawText(pFontSmallnum, 25, 199, 0, pGlobalTXT_LocalizationStrings[505], 0, 0, 0);// "Reading..."
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
194 pRenderer->Present();
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
195 pSavegameList->Initialize(0);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
196 if (pSaveListPosition > (signed int)uNumSavegameFiles)
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
197 {
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
198 pSaveListPosition = 0;
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
199 uLoadGameUI_SelectedSlot = 0;
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
200 }
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
201 pLODFile.AllocSubIndicesAndIO(300, 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
202 Assert(sizeof(SavegameHeader) == 100);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
203 for (uint i = 0; i < uNumSavegameFiles; ++i)
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
204 {
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
205 sprintf(pTmpBuf.data(), "saves\\%s", pSavegameList->pFileList[i].pSaveFileName);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
206 if (_access(pTmpBuf.data(), 6))
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(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[72]); // "Empty"
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
210 continue;
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
211 }
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
212 pLODFile.LoadFile(pTmpBuf.data(), 1);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
213 if (pLODFile.FindContainer("header.bin", true))
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
214 fread(&pSavegameHeader[i], 100, 1, pLODFile.FindContainer("header.bin", true));
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
215 if (!_stricmp(pSavegameList->pFileList[i].pSaveFileName, pGlobalTXT_LocalizationStrings[613]))// "AutoSave.MM7"
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
216 strcpy(pSavegameHeader[i].pName, pGlobalTXT_LocalizationStrings[16]);// "Autosave"
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
217 if (!pLODFile.FindContainer("image.pcx", true))
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
218 {
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
219 pSavegameUsedSlots[i] = 0;
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
220 strcpy(pSavegameList->pFileList[i].pSaveFileName, "");
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
221 }
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
222 else
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
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
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
225 pLODFile.CloseWriteFile();
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
226 pSavegameUsedSlots[i] = 1;
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
227 }
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
228 }
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
229
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
230 pLODFile.FreeSubIndexAndIO();
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
231 if (current_screen_type == SCREEN_SAVEGAME)
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
232 {
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
233 uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
234 uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_saveD", TEXTURE_16BIT_PALETTE);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
235 }
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
236 else
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
237 {
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
238 uTextureID_x_d = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
239 uTextureID_LS_ = pIcons_LOD->LoadTexture("LS_loadD", TEXTURE_16BIT_PALETTE);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
240 }
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
241 uTextureID_AR_UP_DN = pIcons_LOD->LoadTexture("AR_UP_DN", TEXTURE_16BIT_PALETTE);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
242 uTextureID_AR_DN_DN = pIcons_LOD->LoadTexture("AR_DN_DN", TEXTURE_16BIT_PALETTE);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
243 CreateButton(21, 198, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 0, 0, "", 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
244 CreateButton(21, 219, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 1, 0, "", 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
245 CreateButton(21, 240, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 2, 0, "", 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
246 CreateButton(21, 261, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 3, 0, "", 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
247 CreateButton(21, 282, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 4, 0, "", 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
248 CreateButton(21, 303, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 5, 0, "", 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
249 CreateButton(21, 324, 191, 18, 1, 0, UIMSG_SelectLoadSlot, 6, 0, "", 0);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
250 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
251 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
252 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
253 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
254 }
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
255
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
256
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
257 void GUIWindow_Load::Update()
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
258 {
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
259 // -----------------------------------
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
260 // 004156F0 GUI_UpdateWindows --- part
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
261 // {
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
262 // LoadUI_Draw();
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
263 // }
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
264
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
265 // ----- (004606F7) --------------------------------------------------------
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
266 // void LoadUI_Draw()
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
267 // {
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
268 UI_DrawSaveLoad(false);
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
269 }
fed97f15d1e1 * SaveLoad
a.parshin
parents: 2544
diff changeset
270
2501
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
271
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
272 //----- (004601B7) --------------------------------------------------------
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
273 static void UI_DrawSaveLoad(bool save)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
274 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
275 // const char *pSlotName; // edi@36
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
276 GUIWindow save_load_window; // [sp+Ch] [bp-78h]@8
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
277 unsigned int pSaveFiles; // [sp+70h] [bp-14h]@10
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
278 unsigned __int64 full_hours;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
279 unsigned __int64 full_days;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
280 int full_weeks;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
281 int full_month;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
282 int current_year;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
283 int current_month;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
284 int current_day;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
285 int current_hour;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
286 int current_minutes;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
287
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
288 pRenderer->BeginScene();
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
289 if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LoadingProcInMainMenu )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
292 if (save)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
296 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
297 else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
303 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
304 if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
305 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
306 memset(&save_load_window, 0, 0x54);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
307 save_load_window.uFrameX = pGUIWindow_CurrentMenu->uFrameX + 240;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
308 save_load_window.uFrameWidth = 220;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
309 save_load_window.uFrameY = (pGUIWindow_CurrentMenu->uFrameY - pFontSmallnum->uFontHeight) + 157;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
310 save_load_window.uFrameZ = save_load_window.uFrameX + 219;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
311 save_load_window.uFrameHeight = pFontSmallnum->uFontHeight;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
315 //Draw map name
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
316 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
317 //Draw date
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
318 full_hours = ((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) / 60i64;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
319 full_days = (unsigned int)full_hours / 24;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
320 full_weeks = (unsigned int)(full_days / 7);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
321 full_month = (unsigned int)full_weeks / 4;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
322 current_year = (full_month / 12) + game_starting_year;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
323 current_month = full_month % 12;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
324 current_day = full_days % 28;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
325 current_hour = full_hours % 24;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
326 current_minutes = (((signed __int64)(pSavegameHeader[uLoadGameUI_SelectedSlot].uWordTime * 0.234375) / 60) % 60i64);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
327
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
328 save_load_window.uFrameY = pGUIWindow_CurrentMenu->uFrameY + 261;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
329 int am;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
330 if ( (signed int)current_hour >= 12 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
331 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
332 current_hour -= 12;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
333 if ( !current_hour )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
334 current_hour = 12;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
335 am = 1;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
336 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
337 else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
338 am = 0;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
339 const char* day = aDayNames[full_days % 7];
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
340 const char* ampm = aAMPMNames[am];
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
341 const char* month = aMonthNames[current_month];
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
342
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
344 save_load_window.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf.data(), 3);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
345 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
346 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
347 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
348 pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
349 strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, pKeyActionMap->pPressedKeysBuffer);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
350 pMessageQueue_50CBD0->AddGUIMessage(UIMSG_SaveGame, 0, 0);
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 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
354 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CANCELLED)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
355 pGUIWindow_CurrentMenu->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
356 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
357 if (GetCurrentMenuID() == MENU_LoadingProcInMainMenu)
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
358 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
359 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[135]) + 25,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
360 220, 0, pGlobalTXT_LocalizationStrings[135], 0, 0, 0);//Загрузка
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
361 pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, pFontSmallnum->AlignText_Center(186,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
362 pSavegameHeader[uLoadGameUI_SelectedSlot].pName) + 25, 0x106, 0, pSavegameHeader[uLoadGameUI_SelectedSlot].pName, 185, 0);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
363 pGUIWindow_CurrentMenu->DrawText(pFontSmallnum, pFontSmallnum->AlignText_Center(186, pGlobalTXT_LocalizationStrings[165]) + 25,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
364 304, 0, pGlobalTXT_LocalizationStrings[165], 0, 0, 0);//"Пожалуйста, пожождите"
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
365 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
366 else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
367 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
368 if ( save )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
369 pSaveFiles = 40;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
370 else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
371 pSaveFiles = uNumSavegameFiles;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
372
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
373 int slot_Y = 199;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
374 for ( uint i = pSaveListPosition; i < pSaveFiles; ++i )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
375 {
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
376 if ( slot_Y >= 346 )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
377 break;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
378 if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS || i != uLoadGameUI_SelectedSlot )
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
379 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
380 else
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
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,
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
382 slot_Y, pFontSmallnum);
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
383 slot_Y += 21;
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
384 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
385 }
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
386 pRenderer->EndScene();
0ff6a9e9bf7f GUI folger
Ritor1
parents:
diff changeset
387 }