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