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