annotate GUIProgressBar.cpp @ 1711:69efd5d1ab5c

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