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