annotate GUIProgressBar.cpp @ 170:f089d88b6739

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