annotate GUIProgressBar.cpp @ 2176:2f9689a85c31

Слияние
author Ritor1
date Tue, 21 Jan 2014 18:32:43 +0600
parents d28d3c006077
children aff7a7b072b7
rev   line source
0
Ritor1
parents:
diff changeset
1 #include "GUIProgressBar.h"
Ritor1
parents:
diff changeset
2 #include "LOD.h"
Ritor1
parents:
diff changeset
3 #include "Mouse.h"
Ritor1
parents:
diff changeset
4 #include "Party.h"
Ritor1
parents:
diff changeset
5 #include "Render.h"
Ritor1
parents:
diff changeset
6 #include "IconFrameTable.h"
Ritor1
parents:
diff changeset
7
Ritor1
parents:
diff changeset
8 #include "mm7_data.h"
Ritor1
parents:
diff changeset
9
Ritor1
parents:
diff changeset
10
Ritor1
parents:
diff changeset
11
Ritor1
parents:
diff changeset
12
Ritor1
parents:
diff changeset
13 struct GUIProgressBar *pGameLoadingUI_ProgressBar = new GUIProgressBar;
Ritor1
parents:
diff changeset
14
Ritor1
parents:
diff changeset
15
Ritor1
parents:
diff changeset
16
Ritor1
parents:
diff changeset
17
434
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
18 //----- (00Initialize) --------------------------------------------------------
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
19 bool GUIProgressBar::Initialize(Type type)
0
Ritor1
parents:
diff changeset
20 {
Ritor1
parents:
diff changeset
21 //GUIProgressBar *v2; // esi@1
Ritor1
parents:
diff changeset
22 signed int v4; // eax@7
Ritor1
parents:
diff changeset
23 int v5; // ecx@8
Ritor1
parents:
diff changeset
24 int v6; // edi@8
Ritor1
parents:
diff changeset
25 int v7; // edx@14
373
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
26 //const char *v8; // [sp-8h] [bp-84h]@20
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
27 //unsigned int v9; // [sp-4h] [bp-80h]@20
0
Ritor1
parents:
diff changeset
28 char Str1[64]; // [sp+4h] [bp-78h]@16
Ritor1
parents:
diff changeset
29
434
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
30 switch (type)
0
Ritor1
parents:
diff changeset
31 {
434
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
32 case TYPE_None:
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
33 return true;
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
34
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
35 case TYPE_Box:
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
36 case TYPE_Fullscreen:
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
37 break;
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
38
137c59c3dbc4 Temple of Moon and Dragon Lair can now be entered.
Nomad
parents: 373
diff changeset
39 default:
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1421
diff changeset
40 Error("Invalid GUIProgressBar type: %u", type);
0
Ritor1
parents:
diff changeset
41 }
Ritor1
parents:
diff changeset
42
Ritor1
parents:
diff changeset
43 //v2 = this;
Ritor1
parents:
diff changeset
44 if (pLoadingBg.pPixels)
Ritor1
parents:
diff changeset
45 return false;
Ritor1
parents:
diff changeset
46
Ritor1
parents:
diff changeset
47 uType = type;
Ritor1
parents:
diff changeset
48
Ritor1
parents:
diff changeset
49 v4 = 1;
Ritor1
parents:
diff changeset
50 if (uType == TYPE_Fullscreen)
Ritor1
parents:
diff changeset
51 {
Ritor1
parents:
diff changeset
52 v5 = 0;
Ritor1
parents:
diff changeset
53 v6 = (int)&field_10;
Ritor1
parents:
diff changeset
54 do
Ritor1
parents:
diff changeset
55 {
Ritor1
parents:
diff changeset
56 if ( *(char *)(v6 + v4) == 1 )
Ritor1
parents:
diff changeset
57 ++v5;
Ritor1
parents:
diff changeset
58 ++v4;
Ritor1
parents:
diff changeset
59 }
Ritor1
parents:
diff changeset
60 while ( v4 <= 5 );
Ritor1
parents:
diff changeset
61 if ( v5 == 5 )
Ritor1
parents:
diff changeset
62 memset(&field_10, 0, 8u);
Ritor1
parents:
diff changeset
63 v7 = rand() % 5 + 1;
Ritor1
parents:
diff changeset
64 if ( *(&field_10 + v7) == 1 )
Ritor1
parents:
diff changeset
65 {
Ritor1
parents:
diff changeset
66 do
Ritor1
parents:
diff changeset
67 v7 = rand() % 5 + 1;
Ritor1
parents:
diff changeset
68 while ( *(char *)(v6 + v7) == 1 );
Ritor1
parents:
diff changeset
69 }
Ritor1
parents:
diff changeset
70 sprintf(Str1, "loading%d.pcx", v7);
Ritor1
parents:
diff changeset
71 pLoadingBg.Load(Str1, 2);
Ritor1
parents:
diff changeset
72 uProgressCurrent = 0;
Ritor1
parents:
diff changeset
73 uX = 122;
Ritor1
parents:
diff changeset
74 uY = 151;
Ritor1
parents:
diff changeset
75 uWidth = 449;
Ritor1
parents:
diff changeset
76 uHeight = 56;
Ritor1
parents:
diff changeset
77 uProgressMax = 26;
Ritor1
parents:
diff changeset
78 pIcons_LOD->_410522(&pLoadingProgress, "loadprog", 2u);
Ritor1
parents:
diff changeset
79 Draw();
Ritor1
parents:
diff changeset
80 return true;
Ritor1
parents:
diff changeset
81 }
373
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
82
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
83 /*if ( !pParty->uAlignment )
0
Ritor1
parents:
diff changeset
84 {
Ritor1
parents:
diff changeset
85 v9 = 2;
Ritor1
parents:
diff changeset
86 v8 = "bardata-b";
Ritor1
parents:
diff changeset
87 goto LABEL_23;
Ritor1
parents:
diff changeset
88 }
Ritor1
parents:
diff changeset
89 if ( pParty->uAlignment == 1 )
Ritor1
parents:
diff changeset
90 {
Ritor1
parents:
diff changeset
91 v9 = 2;
Ritor1
parents:
diff changeset
92 v8 = "bardata";
Ritor1
parents:
diff changeset
93 goto LABEL_23;
Ritor1
parents:
diff changeset
94 }
Ritor1
parents:
diff changeset
95 if ( pParty->uAlignment == 2 )
Ritor1
parents:
diff changeset
96 {
Ritor1
parents:
diff changeset
97 v9 = 2;
Ritor1
parents:
diff changeset
98 v8 = "bardata-c";
Ritor1
parents:
diff changeset
99 LABEL_23:
Ritor1
parents:
diff changeset
100 pIcons_LOD->_410522(&pBardata, v8, v9);
373
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
101 }*/
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
102 switch (pParty->alignment)
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
103 {
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
104 case PartyAlignment_Good: pIcons_LOD->_410522(&pBardata, "bardata-b", 2); break;
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
105 case PartyAlignment_Neutral: pIcons_LOD->_410522(&pBardata, "bardata", 2); break;
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
106 case PartyAlignment_Evil: pIcons_LOD->_410522(&pBardata, "bardata-c", 2); break;
1545
c4ab816fcc5e assert, Abortf, AbortWithError -> Assert, Error
Nomad
parents: 1421
diff changeset
107 default: Error("Invalid alignment type: %u", pParty->alignment);
0
Ritor1
parents:
diff changeset
108 }
373
edd2d8b7e3c4 Interface reloading fix & party alignment enum
Nomad
parents: 0
diff changeset
109
0
Ritor1
parents:
diff changeset
110 uProgressCurrent = 0;
Ritor1
parents:
diff changeset
111 uProgressMax = 26;
Ritor1
parents:
diff changeset
112 Draw();
Ritor1
parents:
diff changeset
113 return true;
Ritor1
parents:
diff changeset
114 }
Ritor1
parents:
diff changeset
115
Ritor1
parents:
diff changeset
116 //----- (004435BB) --------------------------------------------------------
Ritor1
parents:
diff changeset
117 void GUIProgressBar::Reset(unsigned __int8 uMaxProgress)
Ritor1
parents:
diff changeset
118 {
Ritor1
parents:
diff changeset
119 field_9 = 0;
Ritor1
parents:
diff changeset
120 uProgressCurrent = 0;
Ritor1
parents:
diff changeset
121 uProgressMax = uMaxProgress;
Ritor1
parents:
diff changeset
122 }
Ritor1
parents:
diff changeset
123
Ritor1
parents:
diff changeset
124 //----- (004435CD) --------------------------------------------------------
Ritor1
parents:
diff changeset
125 void GUIProgressBar::Progress()
Ritor1
parents:
diff changeset
126 {
Ritor1
parents:
diff changeset
127 unsigned __int8 v1; // al@1
Ritor1
parents:
diff changeset
128
Ritor1
parents:
diff changeset
129 ++this->uProgressCurrent;
Ritor1
parents:
diff changeset
130 v1 = this->uProgressMax;
Ritor1
parents:
diff changeset
131 if ( this->uProgressCurrent > v1 )
Ritor1
parents:
diff changeset
132 this->uProgressCurrent = v1;
Ritor1
parents:
diff changeset
133 Draw();
Ritor1
parents:
diff changeset
134 }
Ritor1
parents:
diff changeset
135
Ritor1
parents:
diff changeset
136 //----- (004435E2) --------------------------------------------------------
Ritor1
parents:
diff changeset
137 void GUIProgressBar::Release()
Ritor1
parents:
diff changeset
138 {
Ritor1
parents:
diff changeset
139 GUIProgressBar *v1; // esi@1
Ritor1
parents:
diff changeset
140 char v2; // al@5
Ritor1
parents:
diff changeset
141 int v3; // edi@7
Ritor1
parents:
diff changeset
142
Ritor1
parents:
diff changeset
143 v1 = this;
Ritor1
parents:
diff changeset
144 if ( v1->uType == 1 )
Ritor1
parents:
diff changeset
145 {
Ritor1
parents:
diff changeset
146 if ( !v1->pLoadingBg.pPixels )
Ritor1
parents:
diff changeset
147 return;
Ritor1
parents:
diff changeset
148 v2 = v1->uProgressMax;
Ritor1
parents:
diff changeset
149 if ( v1->uProgressCurrent != v2 )
Ritor1
parents:
diff changeset
150 {
Ritor1
parents:
diff changeset
151 v1->uProgressCurrent = v2 - 1;
Ritor1
parents:
diff changeset
152 Progress();
Ritor1
parents:
diff changeset
153 }
Ritor1
parents:
diff changeset
154 free(v1->pLoadingBg.pPixels);
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 709
diff changeset
155 v3 = (int)&v1->pLoadingProgress.pLevelOfDetail0_prolly_alpha_mask;
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 709
diff changeset
156 free(v1->pLoadingProgress.pLevelOfDetail0_prolly_alpha_mask);
0
Ritor1
parents:
diff changeset
157 free(v1->pLoadingProgress.pPalette16);
Ritor1
parents:
diff changeset
158 v1->pLoadingProgress.pPalette16 = 0;
Ritor1
parents:
diff changeset
159 v1->pLoadingBg.pPixels = 0;
Ritor1
parents:
diff changeset
160 }
Ritor1
parents:
diff changeset
161 else
Ritor1
parents:
diff changeset
162 {
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 709
diff changeset
163 if ( !v1->pBardata.pLevelOfDetail0_prolly_alpha_mask )
0
Ritor1
parents:
diff changeset
164 return;
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 709
diff changeset
165 free(v1->pBardata.pLevelOfDetail0_prolly_alpha_mask);
0
Ritor1
parents:
diff changeset
166 v3 = (int)&v1->pBardata.pPalette16;
Ritor1
parents:
diff changeset
167 free(v1->pBardata.pPalette16);
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 709
diff changeset
168 v1->pBardata.pLevelOfDetail0_prolly_alpha_mask = 0;
0
Ritor1
parents:
diff changeset
169 }
Ritor1
parents:
diff changeset
170 *(int *)v3 = 0;
Ritor1
parents:
diff changeset
171 }
Ritor1
parents:
diff changeset
172
Ritor1
parents:
diff changeset
173 //----- (00443670) --------------------------------------------------------
Ritor1
parents:
diff changeset
174 void GUIProgressBar::Draw()
Ritor1
parents:
diff changeset
175 {
Ritor1
parents:
diff changeset
176 pRenderer->BeginScene();
Ritor1
parents:
diff changeset
177 if (uType != TYPE_Fullscreen)
Ritor1
parents:
diff changeset
178 {
710
735dab8d3c9a Town portal screen + misc gui const replacements
Nomad
parents: 709
diff changeset
179 if (pBardata.pLevelOfDetail0_prolly_alpha_mask)
0
Ritor1
parents:
diff changeset
180 {
2153
d28d3c006077 Some Render decoupling.
Nomad
parents: 2098
diff changeset
181 pRenderer->Sub01();
d28d3c006077 Some Render decoupling.
Nomad
parents: 2098
diff changeset
182
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
183 pRenderer->DrawTextureIndexed(80, 122, &pBardata);//
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
184 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
185 //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
186 //16, pRenderer->uTargetRMask);
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
187 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
188 16, 0xF800);
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
189 pRenderer->EndScene();
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
190 pRenderer->Present();
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
191 return;
0
Ritor1
parents:
diff changeset
192 }
Ritor1
parents:
diff changeset
193 pRenderer->EndScene();
Ritor1
parents:
diff changeset
194 return;
Ritor1
parents:
diff changeset
195 }
Ritor1
parents:
diff changeset
196
Ritor1
parents:
diff changeset
197 if (!pLoadingBg.pPixels)
1421
4fff79f04dbd more label cleaning 4
zipi
parents: 1165
diff changeset
198 {
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
199 pRenderer->EndScene();
1421
4fff79f04dbd more label cleaning 4
zipi
parents: 1165
diff changeset
200 return;
4fff79f04dbd more label cleaning 4
zipi
parents: 1165
diff changeset
201 }
0
Ritor1
parents:
diff changeset
202
Ritor1
parents:
diff changeset
203 pRenderer->DrawTextureRGB(0, 0, &pLoadingBg);
2098
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
204 pRenderer->SetRasterClipRect(0, 0, 639, 479);
7810cb3a5fb7 Popup window in MainMenu not shown
Ritor1
parents: 1545
diff changeset
205 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
206 pRenderer->DrawTextureTransparent(172, 459, &pLoadingProgress);
727
da130dd3092a Big time Travel ouverhaul
Nomad
parents: 710
diff changeset
207 pRenderer->ResetTextureClipRect();
0
Ritor1
parents:
diff changeset
208 pRenderer->EndScene();
Ritor1
parents:
diff changeset
209 pRenderer->Present();
Ritor1
parents:
diff changeset
210 }