0
|
1 #include "GUIProgressBar.h"
|
|
2 #include "LOD.h"
|
|
3 #include "Mouse.h"
|
|
4 #include "Party.h"
|
|
5 #include "Render.h"
|
|
6 #include "IconFrameTable.h"
|
|
7
|
|
8 #include "mm7_data.h"
|
|
9
|
|
10
|
|
11
|
|
12
|
|
13 struct GUIProgressBar *pGameLoadingUI_ProgressBar = new GUIProgressBar;
|
|
14
|
|
15
|
|
16
|
|
17
|
434
|
18 //----- (00Initialize) --------------------------------------------------------
|
|
19 bool GUIProgressBar::Initialize(Type type)
|
0
|
20 {
|
|
21 //GUIProgressBar *v2; // esi@1
|
|
22 signed int v4; // eax@7
|
|
23 int v5; // ecx@8
|
|
24 int v6; // edi@8
|
|
25 int v7; // edx@14
|
373
|
26 //const char *v8; // [sp-8h] [bp-84h]@20
|
|
27 //unsigned int v9; // [sp-4h] [bp-80h]@20
|
0
|
28 char Str1[64]; // [sp+4h] [bp-78h]@16
|
|
29
|
434
|
30 switch (type)
|
0
|
31 {
|
434
|
32 case TYPE_None:
|
|
33 return true;
|
|
34
|
|
35 case TYPE_Box:
|
|
36 case TYPE_Fullscreen:
|
|
37 break;
|
|
38
|
|
39 default:
|
1545
|
40 Error("Invalid GUIProgressBar type: %u", type);
|
0
|
41 }
|
|
42
|
|
43 //v2 = this;
|
|
44 if (pLoadingBg.pPixels)
|
|
45 return false;
|
|
46
|
|
47 uType = type;
|
|
48
|
|
49 v4 = 1;
|
|
50 if (uType == TYPE_Fullscreen)
|
|
51 {
|
|
52 v5 = 0;
|
|
53 v6 = (int)&field_10;
|
|
54 do
|
|
55 {
|
|
56 if ( *(char *)(v6 + v4) == 1 )
|
|
57 ++v5;
|
|
58 ++v4;
|
|
59 }
|
|
60 while ( v4 <= 5 );
|
|
61 if ( v5 == 5 )
|
|
62 memset(&field_10, 0, 8u);
|
|
63 v7 = rand() % 5 + 1;
|
|
64 if ( *(&field_10 + v7) == 1 )
|
|
65 {
|
|
66 do
|
|
67 v7 = rand() % 5 + 1;
|
|
68 while ( *(char *)(v6 + v7) == 1 );
|
|
69 }
|
|
70 sprintf(Str1, "loading%d.pcx", v7);
|
|
71 pLoadingBg.Load(Str1, 2);
|
|
72 uProgressCurrent = 0;
|
|
73 uX = 122;
|
|
74 uY = 151;
|
|
75 uWidth = 449;
|
|
76 uHeight = 56;
|
|
77 uProgressMax = 26;
|
|
78 pIcons_LOD->_410522(&pLoadingProgress, "loadprog", 2u);
|
|
79 Draw();
|
|
80 return true;
|
|
81 }
|
373
|
82
|
|
83 /*if ( !pParty->uAlignment )
|
0
|
84 {
|
|
85 v9 = 2;
|
|
86 v8 = "bardata-b";
|
|
87 goto LABEL_23;
|
|
88 }
|
|
89 if ( pParty->uAlignment == 1 )
|
|
90 {
|
|
91 v9 = 2;
|
|
92 v8 = "bardata";
|
|
93 goto LABEL_23;
|
|
94 }
|
|
95 if ( pParty->uAlignment == 2 )
|
|
96 {
|
|
97 v9 = 2;
|
|
98 v8 = "bardata-c";
|
|
99 LABEL_23:
|
|
100 pIcons_LOD->_410522(&pBardata, v8, v9);
|
373
|
101 }*/
|
|
102 switch (pParty->alignment)
|
|
103 {
|
|
104 case PartyAlignment_Good: pIcons_LOD->_410522(&pBardata, "bardata-b", 2); break;
|
|
105 case PartyAlignment_Neutral: pIcons_LOD->_410522(&pBardata, "bardata", 2); break;
|
|
106 case PartyAlignment_Evil: pIcons_LOD->_410522(&pBardata, "bardata-c", 2); break;
|
1545
|
107 default: Error("Invalid alignment type: %u", pParty->alignment);
|
0
|
108 }
|
373
|
109
|
0
|
110 uProgressCurrent = 0;
|
|
111 uProgressMax = 26;
|
|
112 Draw();
|
|
113 return true;
|
|
114 }
|
|
115
|
|
116 //----- (004435BB) --------------------------------------------------------
|
|
117 void GUIProgressBar::Reset(unsigned __int8 uMaxProgress)
|
|
118 {
|
|
119 field_9 = 0;
|
|
120 uProgressCurrent = 0;
|
|
121 uProgressMax = uMaxProgress;
|
|
122 }
|
|
123
|
|
124 //----- (004435CD) --------------------------------------------------------
|
|
125 void GUIProgressBar::Progress()
|
|
126 {
|
|
127 unsigned __int8 v1; // al@1
|
|
128
|
|
129 ++this->uProgressCurrent;
|
|
130 v1 = this->uProgressMax;
|
|
131 if ( this->uProgressCurrent > v1 )
|
|
132 this->uProgressCurrent = v1;
|
|
133 Draw();
|
|
134 }
|
|
135
|
|
136 //----- (004435E2) --------------------------------------------------------
|
|
137 void GUIProgressBar::Release()
|
|
138 {
|
|
139 GUIProgressBar *v1; // esi@1
|
|
140 char v2; // al@5
|
|
141 int v3; // edi@7
|
|
142
|
|
143 v1 = this;
|
|
144 if ( v1->uType == 1 )
|
|
145 {
|
|
146 if ( !v1->pLoadingBg.pPixels )
|
|
147 return;
|
|
148 v2 = v1->uProgressMax;
|
|
149 if ( v1->uProgressCurrent != v2 )
|
|
150 {
|
|
151 v1->uProgressCurrent = v2 - 1;
|
|
152 Progress();
|
|
153 }
|
|
154 free(v1->pLoadingBg.pPixels);
|
710
|
155 v3 = (int)&v1->pLoadingProgress.pLevelOfDetail0_prolly_alpha_mask;
|
|
156 free(v1->pLoadingProgress.pLevelOfDetail0_prolly_alpha_mask);
|
0
|
157 free(v1->pLoadingProgress.pPalette16);
|
|
158 v1->pLoadingProgress.pPalette16 = 0;
|
|
159 v1->pLoadingBg.pPixels = 0;
|
|
160 }
|
|
161 else
|
|
162 {
|
710
|
163 if ( !v1->pBardata.pLevelOfDetail0_prolly_alpha_mask )
|
0
|
164 return;
|
710
|
165 free(v1->pBardata.pLevelOfDetail0_prolly_alpha_mask);
|
0
|
166 v3 = (int)&v1->pBardata.pPalette16;
|
|
167 free(v1->pBardata.pPalette16);
|
710
|
168 v1->pBardata.pLevelOfDetail0_prolly_alpha_mask = 0;
|
0
|
169 }
|
|
170 *(int *)v3 = 0;
|
|
171 }
|
|
172
|
|
173 //----- (00443670) --------------------------------------------------------
|
|
174 void GUIProgressBar::Draw()
|
|
175 {
|
|
176 pRenderer->BeginScene();
|
|
177 if (uType != TYPE_Fullscreen)
|
|
178 {
|
710
|
179 if (pBardata.pLevelOfDetail0_prolly_alpha_mask)
|
0
|
180 {
|
2153
|
181 pRenderer->Sub01();
|
|
182
|
2098
|
183 pRenderer->DrawTextureIndexed(80, 122, &pBardata);//
|
|
184 pRenderer->DrawTextureTransparent(100, 146, &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconID_TurnHour, 0)->uTextureID]);
|
|
185 //pRenderer->FillRectFast(174, 164, floorf(((double)(113 * uProgressCurrent) / (double)uProgressMax) + 0.5f),//COERCE_UNSIGNED_INT64(v4 + 6.7553994e15),
|
|
186 //16, pRenderer->uTargetRMask);
|
|
187 pRenderer->FillRectFast(174, 164, floorf(((double)(113 * uProgressCurrent) / (double)uProgressMax) + 0.5f),//COERCE_UNSIGNED_INT64(v4 + 6.7553994e15),
|
|
188 16, 0xF800);
|
|
189 pRenderer->EndScene();
|
|
190 pRenderer->Present();
|
|
191 return;
|
0
|
192 }
|
|
193 pRenderer->EndScene();
|
|
194 return;
|
|
195 }
|
|
196
|
|
197 if (!pLoadingBg.pPixels)
|
1421
|
198 {
|
2098
|
199 pRenderer->EndScene();
|
1421
|
200 return;
|
|
201 }
|
0
|
202
|
|
203 pRenderer->DrawTextureRGB(0, 0, &pLoadingBg);
|
2098
|
204 pRenderer->SetRasterClipRect(0, 0, 639, 479);
|
|
205 pRenderer->SetTextureClipRect(172, 459, 15 * (signed int)(signed __int64)((double)(300 * uProgressCurrent) / (double)uProgressMax) / 15 + 172, 471);
|
|
206 pRenderer->DrawTextureTransparent(172, 459, &pLoadingProgress);
|
727
|
207 pRenderer->ResetTextureClipRect();
|
0
|
208 pRenderer->EndScene();
|
|
209 pRenderer->Present();
|
|
210 } |