annotate GUIProgressBar.cpp @ 2473:98eda972505f

backing out of previous commit for Indoor.cpp
author zipi
date Tue, 19 Aug 2014 22:33:23 +0100
parents b054ea5daf45
children 5abd8fc8f1c6
rev   line source
2415
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2336
diff changeset
1 #define _CRTDBG_MAP_ALLOC
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2336
diff changeset
2 #include <stdlib.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2336
diff changeset
3 #include <crtdbg.h>
f4af3b203f65 LOD.cpp cleaned and search memory corrupt
Ritor1
parents: 2336
diff changeset
4
2253
aff7a7b072b7 adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents: 2153
diff changeset
5 #define _CRT_SECURE_NO_WARNINGS
0
Ritor1
parents:
diff changeset
6 #include "GUIProgressBar.h"
2336
d6887ee81068 header file include cleanup
Grumpy7
parents: 2271
diff changeset
7 #include "ErrorHandling.h"
0
Ritor1
parents:
diff changeset
8 #include "LOD.h"
Ritor1
parents:
diff changeset
9 #include "Party.h"
Ritor1
parents:
diff changeset
10 #include "Render.h"
Ritor1
parents:
diff changeset
11 #include "IconFrameTable.h"
Ritor1
parents:
diff changeset
12
Ritor1
parents:
diff changeset
13 #include "mm7_data.h"
Ritor1
parents:
diff changeset
14
Ritor1
parents:
diff changeset
15
Ritor1
parents:
diff changeset
16
Ritor1
parents:
diff changeset
17
Ritor1
parents:
diff changeset
18 struct GUIProgressBar *pGameLoadingUI_ProgressBar = new GUIProgressBar;
Ritor1
parents:
diff changeset
19
Ritor1
parents:
diff changeset
20
Ritor1
parents:
diff changeset
21
Ritor1
parents:
diff changeset
22
434
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
23 //----- (00Initialize) --------------------------------------------------------
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
24 bool GUIProgressBar::Initialize(Type type)
0
Ritor1
parents:
diff changeset
25 {
Ritor1
parents:
diff changeset
26 //GUIProgressBar *v2; // esi@1
Ritor1
parents:
diff changeset
27 signed int v4; // eax@7
Ritor1
parents:
diff changeset
28 int v5; // ecx@8
2429
6d5877899730 * -novideo disables shop videos
a.parshin
parents: 2420
diff changeset
29 //int v6; // edi@8
0
Ritor1
parents:
diff changeset
30 int v7; // edx@14
373
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
31 //const char *v8; // [sp-8h] [bp-84h]@20
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
32 //unsigned int v9; // [sp-4h] [bp-80h]@20
0
Ritor1
parents:
diff changeset
33 char Str1[64]; // [sp+4h] [bp-78h]@16
Ritor1
parents:
diff changeset
34
434
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
35 switch (type)
0
Ritor1
parents:
diff changeset
36 {
434
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
37 case TYPE_None:
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
38 return true;
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
39
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
40 case TYPE_Box:
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
41 case TYPE_Fullscreen:
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
42 break;
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
43
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
44 default:
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1421
diff changeset
45 Error("Invalid GUIProgressBar type: %u", type);
0
Ritor1
parents:
diff changeset
46 }
Ritor1
parents:
diff changeset
47
Ritor1
parents:
diff changeset
48 //v2 = this;
Ritor1
parents:
diff changeset
49 if (pLoadingBg.pPixels)
Ritor1
parents:
diff changeset
50 return false;
Ritor1
parents:
diff changeset
51
Ritor1
parents:
diff changeset
52 uType = type;
Ritor1
parents:
diff changeset
53
Ritor1
parents:
diff changeset
54 v4 = 1;
Ritor1
parents:
diff changeset
55 if (uType == TYPE_Fullscreen)
Ritor1
parents:
diff changeset
56 {
Ritor1
parents:
diff changeset
57 v5 = 0;
2429
6d5877899730 * -novideo disables shop videos
a.parshin
parents: 2420
diff changeset
58 //v6 = (int)&field_10;
0
Ritor1
parents:
diff changeset
59 do
Ritor1
parents:
diff changeset
60 {
2429
6d5877899730 * -novideo disables shop videos
a.parshin
parents: 2420
diff changeset
61 if ( field_10[v4] == 1 )
0
Ritor1
parents:
diff changeset
62 ++v5;
Ritor1
parents:
diff changeset
63 ++v4;
Ritor1
parents:
diff changeset
64 }
Ritor1
parents:
diff changeset
65 while ( v4 <= 5 );
Ritor1
parents:
diff changeset
66 if ( v5 == 5 )
2429
6d5877899730 * -novideo disables shop videos
a.parshin
parents: 2420
diff changeset
67 memset(field_10, 0, 8);
0
Ritor1
parents:
diff changeset
68 v7 = rand() % 5 + 1;
2429
6d5877899730 * -novideo disables shop videos
a.parshin
parents: 2420
diff changeset
69 if ( field_10[v7] == 1 )
0
Ritor1
parents:
diff changeset
70 {
Ritor1
parents:
diff changeset
71 do
Ritor1
parents:
diff changeset
72 v7 = rand() % 5 + 1;
2429
6d5877899730 * -novideo disables shop videos
a.parshin
parents: 2420
diff changeset
73 while ( field_10[v7] == 1 );
0
Ritor1
parents:
diff changeset
74 }
Ritor1
parents:
diff changeset
75 sprintf(Str1, "loading%d.pcx", v7);
Ritor1
parents:
diff changeset
76 pLoadingBg.Load(Str1, 2);
Ritor1
parents:
diff changeset
77 uProgressCurrent = 0;
Ritor1
parents:
diff changeset
78 uX = 122;
Ritor1
parents:
diff changeset
79 uY = 151;
Ritor1
parents:
diff changeset
80 uWidth = 449;
Ritor1
parents:
diff changeset
81 uHeight = 56;
Ritor1
parents:
diff changeset
82 uProgressMax = 26;
Ritor1
parents:
diff changeset
83 pIcons_LOD->_410522(&pLoadingProgress, "loadprog", 2u);
Ritor1
parents:
diff changeset
84 Draw();
Ritor1
parents:
diff changeset
85 return true;
Ritor1
parents:
diff changeset
86 }
373
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
87
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
88 switch (pParty->alignment)
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
89 {
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
90 case PartyAlignment_Good: pIcons_LOD->_410522(&pBardata, "bardata-b", 2); break;
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
91 case PartyAlignment_Neutral: pIcons_LOD->_410522(&pBardata, "bardata", 2); break;
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
92 case PartyAlignment_Evil: pIcons_LOD->_410522(&pBardata, "bardata-c", 2); break;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1421
diff changeset
93 default: Error("Invalid alignment type: %u", pParty->alignment);
0
Ritor1
parents:
diff changeset
94 }
373
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
95
0
Ritor1
parents:
diff changeset
96 uProgressCurrent = 0;
Ritor1
parents:
diff changeset
97 uProgressMax = 26;
Ritor1
parents:
diff changeset
98 Draw();
Ritor1
parents:
diff changeset
99 return true;
Ritor1
parents:
diff changeset
100 }
Ritor1
parents:
diff changeset
101
Ritor1
parents:
diff changeset
102 //----- (004435BB) --------------------------------------------------------
Ritor1
parents:
diff changeset
103 void GUIProgressBar::Reset(unsigned __int8 uMaxProgress)
Ritor1
parents:
diff changeset
104 {
Ritor1
parents:
diff changeset
105 field_9 = 0;
Ritor1
parents:
diff changeset
106 uProgressCurrent = 0;
Ritor1
parents:
diff changeset
107 uProgressMax = uMaxProgress;
Ritor1
parents:
diff changeset
108 }
Ritor1
parents:
diff changeset
109
Ritor1
parents:
diff changeset
110 //----- (004435CD) --------------------------------------------------------
Ritor1
parents:
diff changeset
111 void GUIProgressBar::Progress()
Ritor1
parents:
diff changeset
112 {
Ritor1
parents:
diff changeset
113 ++this->uProgressCurrent;
2271
7ffddbe09e55 DrawMessageBox
Ritor1
parents: 2253
diff changeset
114 if ( this->uProgressCurrent > this->uProgressMax )
7ffddbe09e55 DrawMessageBox
Ritor1
parents: 2253
diff changeset
115 this->uProgressCurrent = this->uProgressMax;
0
Ritor1
parents:
diff changeset
116 Draw();
Ritor1
parents:
diff changeset
117 }
Ritor1
parents:
diff changeset
118
Ritor1
parents:
diff changeset
119 //----- (004435E2) --------------------------------------------------------
Ritor1
parents:
diff changeset
120 void GUIProgressBar::Release()
Ritor1
parents:
diff changeset
121 {
Ritor1
parents:
diff changeset
122 int v3; // edi@7
Ritor1
parents:
diff changeset
123
2440
2b10278bc7ac some more memory access fixed
Grumpy7
parents: 2429
diff changeset
124 pLoadingBg.Release();
2271
7ffddbe09e55 DrawMessageBox
Ritor1
parents: 2253
diff changeset
125 if ( this->uType == 1 )
0
Ritor1
parents:
diff changeset
126 {
2271
7ffddbe09e55 DrawMessageBox
Ritor1
parents: 2253
diff changeset
127 if ( this->uProgressCurrent != this->uProgressMax )
0
Ritor1
parents:
diff changeset
128 {
2271
7ffddbe09e55 DrawMessageBox
Ritor1
parents: 2253
diff changeset
129 this->uProgressCurrent = this->uProgressMax - 1;
0
Ritor1
parents:
diff changeset
130 Progress();
Ritor1
parents:
diff changeset
131 }
2271
7ffddbe09e55 DrawMessageBox
Ritor1
parents: 2253
diff changeset
132 v3 = (int)&this->pLoadingProgress.pLevelOfDetail0_prolly_alpha_mask;
7ffddbe09e55 DrawMessageBox
Ritor1
parents: 2253
diff changeset
133 free(this->pLoadingProgress.pLevelOfDetail0_prolly_alpha_mask);
7ffddbe09e55 DrawMessageBox
Ritor1
parents: 2253
diff changeset
134 free(this->pLoadingProgress.pPalette16);
7ffddbe09e55 DrawMessageBox
Ritor1
parents: 2253
diff changeset
135 this->pLoadingProgress.pPalette16 = 0;
0
Ritor1
parents:
diff changeset
136 }
Ritor1
parents:
diff changeset
137 else
Ritor1
parents:
diff changeset
138 {
2271
7ffddbe09e55 DrawMessageBox
Ritor1
parents: 2253
diff changeset
139 if ( !this->pBardata.pLevelOfDetail0_prolly_alpha_mask )
0
Ritor1
parents:
diff changeset
140 return;
2271
7ffddbe09e55 DrawMessageBox
Ritor1
parents: 2253
diff changeset
141 free(this->pBardata.pLevelOfDetail0_prolly_alpha_mask);
7ffddbe09e55 DrawMessageBox
Ritor1
parents: 2253
diff changeset
142 v3 = (int)&this->pBardata.pPalette16;
7ffddbe09e55 DrawMessageBox
Ritor1
parents: 2253
diff changeset
143 free(this->pBardata.pPalette16);
7ffddbe09e55 DrawMessageBox
Ritor1
parents: 2253
diff changeset
144 this->pBardata.pLevelOfDetail0_prolly_alpha_mask = 0;
0
Ritor1
parents:
diff changeset
145 }
Ritor1
parents:
diff changeset
146 *(int *)v3 = 0;
Ritor1
parents:
diff changeset
147 }
Ritor1
parents:
diff changeset
148
Ritor1
parents:
diff changeset
149 //----- (00443670) --------------------------------------------------------
Ritor1
parents:
diff changeset
150 void GUIProgressBar::Draw()
Ritor1
parents:
diff changeset
151 {
Ritor1
parents:
diff changeset
152 pRenderer->BeginScene();
Ritor1
parents:
diff changeset
153 if (uType != TYPE_Fullscreen)
Ritor1
parents:
diff changeset
154 {
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 709
diff changeset
155 if (pBardata.pLevelOfDetail0_prolly_alpha_mask)
0
Ritor1
parents:
diff changeset
156 {
2271
7ffddbe09e55 DrawMessageBox
Ritor1
parents: 2253
diff changeset
157 pRenderer->Sub01();
2153
d28d3c006077 Some Render decoupling.
Nomad
parents: 2098
diff changeset
158
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
159 pRenderer->DrawTextureIndexed(80, 122, &pBardata);//прогрессбар для данжей
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
160 pRenderer->DrawTextureTransparent(100, 146, &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconID_TurnHour, 0)->uTextureID]);
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
161 //pRenderer->FillRectFast(174, 164, floorf(((double)(113 * uProgressCurrent) / (double)uProgressMax) + 0.5f),//COERCE_UNSIGNED_INT64(v4 + 6.7553994e15),
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
162 //16, pRenderer->uTargetRMask);
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
163 pRenderer->FillRectFast(174, 164, floorf(((double)(113 * uProgressCurrent) / (double)uProgressMax) + 0.5f),//COERCE_UNSIGNED_INT64(v4 + 6.7553994e15),
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
164 16, 0xF800);
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
165 pRenderer->EndScene();
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
166 pRenderer->Present();
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
167 return;
0
Ritor1
parents:
diff changeset
168 }
Ritor1
parents:
diff changeset
169 pRenderer->EndScene();
Ritor1
parents:
diff changeset
170 return;
Ritor1
parents:
diff changeset
171 }
Ritor1
parents:
diff changeset
172
Ritor1
parents:
diff changeset
173 if (!pLoadingBg.pPixels)
1421
4fff79f04dbd more label cleaning 4
zipi
parents: 1165
diff changeset
174 {
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
175 pRenderer->EndScene();
1421
4fff79f04dbd more label cleaning 4
zipi
parents: 1165
diff changeset
176 return;
4fff79f04dbd more label cleaning 4
zipi
parents: 1165
diff changeset
177 }
0
Ritor1
parents:
diff changeset
178
Ritor1
parents:
diff changeset
179 pRenderer->DrawTextureRGB(0, 0, &pLoadingBg);
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
180 pRenderer->SetRasterClipRect(0, 0, 639, 479);
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
181 pRenderer->SetTextureClipRect(172, 459, 15 * (signed int)(signed __int64)((double)(300 * uProgressCurrent) / (double)uProgressMax) / 15 + 172, 471);
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
182 pRenderer->DrawTextureTransparent(172, 459, &pLoadingProgress);
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
183 pRenderer->ResetTextureClipRect();
0
Ritor1
parents:
diff changeset
184 pRenderer->EndScene();
Ritor1
parents:
diff changeset
185 pRenderer->Present();
Ritor1
parents:
diff changeset
186 }