Mercurial > mm7
annotate Texture.cpp @ 1557:6292a522d322
Merge
author | Nomad |
---|---|
date | Sat, 07 Sep 2013 22:46:18 +0200 |
parents | c4ab816fcc5e |
children | 75fafd8ced59 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1119
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1119
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1119
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1119
diff
changeset
|
4 |
0 | 5 #include <stdlib.h> |
6 | |
7 #include "Texture.h" | |
8 #include "FrameTableInc.h" | |
9 #include "Allocator.h" | |
10 #include "LOD.h" | |
11 #include "PaletteManager.h" | |
12 #include "Render.h" | |
13 | |
14 #include "mm7_data.h" | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | |
21 | |
22 | |
23 | |
24 | |
25 struct TextureFrameTable *pTextureFrameTable; | |
26 | |
27 | |
28 | |
29 | |
30 | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1205
diff
changeset
|
31 std::array<Texture *, 2> pTexture_LloydBeacons; |
0 | 32 Texture *pTexture_50635C; |
1453 | 33 Texture *pTex_book_button8_off; |
34 Texture *pTex_book_button8_on; | |
35 Texture *pTex_book_button7_off; | |
36 Texture *pTex_book_button7_on; | |
37 Texture *pTex_book_button6_off; | |
38 Texture *pTex_book_button6_on; | |
39 Texture *pTex_book_button5_off; | |
40 Texture *pTex_book_button5_on; | |
41 Texture *pTex_book_button4_off; | |
42 Texture *pTex_book_button4_on; | |
43 Texture *pTex_book_button3_off; | |
44 Texture *pTex_book_button3_on; | |
45 Texture *pTex_book_button2_off; | |
46 Texture *pTex_book_button1_off; | |
47 Texture *pTex_book_button2_on; | |
48 Texture *pTex_book_button1_on; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1205
diff
changeset
|
49 std::array<Texture *, 6> pTexture_TownPortalIcons; // [0]Harmonale, [1]Pierpont, [2]Nighon, [3]Evenmorn Island, [4]Celestia, [5]The Pit |
1402 | 50 std::array<Texture *, 12> SBPageCSpellsTextureList; |
51 std::array<Texture *, 12> SBPageSSpellsTextureList; | |
52 Texture *pSBQuickSpellBtnTextr; | |
53 Texture *pSpellBookClickCloseBtnTextr; | |
54 Texture *pSBClickQuickSpellBtnTextr; | |
55 Texture *pSpellBookCloseBtnTextr; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1205
diff
changeset
|
56 std::array<std::array<Texture *, 2>, 9> pTextures_tabs; |
0 | 57 Texture *pTexture_mapbordr; // idb |
58 Texture *pTexture_pagemask; // idb | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1205
diff
changeset
|
59 std::array<Texture *, 9> pSpellBookPagesTextr; |
688 | 60 Texture *pSpellBookPagesTextr_9; |
61 Texture *pSpellBookPagesTextr_10; | |
62 Texture *pSpellBookPagesTextr_11; | |
63 Texture *pSpellBookPagesTextr_12; | |
64 Texture *pSpellBookPagesTextr_13; | |
0 | 65 Texture *pTexture_AutonotesBook; |
66 Texture *pTexture_CurrentBook; | |
67 Texture *pTex_moon_new; | |
68 Texture *pTex_moon_4; | |
69 Texture *pTex_moon_2; | |
70 Texture *pTex_moon_2_2; | |
71 Texture *pTex_moon_ful; | |
72 | |
73 | |
74 | |
75 RGBTexture stru_506E40; // weak | |
76 RGBTexture pTexture_PCX; | |
77 | |
78 | |
79 int uTextureID_RestUI_restb4; // weak | |
80 int uTextureID_RestUI_restexit; // weak | |
81 int uTextureID_RestUI_restb3; // weak | |
82 int uTextureID_RestUI_restb1; // weak | |
83 int uTextureID_RestUI_restb2; // weak | |
84 int uTextureID_RestUI_restmain; // weak | |
85 unsigned int uTextureID_Leather; | |
86 int uTextureID_ar_dn_dn; // weak | |
87 int uTextureID_ar_dn_up; // weak | |
88 int uTextureID_ar_up_dn; // weak | |
89 int uTextureID_ar_up_up; // weak | |
90 | |
91 | |
92 int uTextureID_507698; // weak | |
93 int uTextureID_50769C; // weak | |
94 int uTextureID_5076A0; // weak | |
95 int uTextureID_5076A4; // weak | |
96 int uTextureID_5076A8; // weak | |
97 int uTextureID_5076AC; // weak | |
98 int uTextureID_5076B0; // weak | |
99 int uTextureID_5076B4; // weak | |
100 int uTextureID_Parchment; // weak | |
101 unsigned int uTextureID_mhp_yel; | |
102 unsigned int uTextureID_mhp_red; | |
103 unsigned int uTextureID_mhp_grn; | |
104 unsigned int uTextureID_mhp_capr; | |
105 unsigned int uTextureID_mhp_capl; | |
106 unsigned int uTextureID_mhp_bd; | |
107 unsigned int uTextureID_BUTTDESC2; | |
108 unsigned int uTextureID_x_x_u; | |
109 unsigned int uTextureID_BUTTMAKE2; | |
110 unsigned int uTextureID_BUTTMAKE; | |
111 unsigned int uTextureID_BUTTYES2; | |
112 unsigned int uTextureID_x_ok_u; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1205
diff
changeset
|
113 std::array<Texture *, 22> pPlayerPortraits; |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1205
diff
changeset
|
114 std::array<Texture *, 9> pTexture_IC_KNIGHT; |
0 | 115 Texture *pTexture_MAKESKY; |
116 Texture *pTexture_MAKETOP; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1205
diff
changeset
|
117 std::array<Texture *, 20> pTextures_arrowr; |
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1205
diff
changeset
|
118 std::array<Texture *, 20> pTextures_arrowl; |
0 | 119 Texture *pTexture_presleft; |
120 Texture *pTexture_pressrigh; | |
121 Texture *pTexture_buttminu; | |
122 Texture *pTexture_buttplus; | |
362 | 123 unsigned int uTextureID_Quit1; // weak |
124 unsigned int uTextureID_Resume1; // weak | |
125 unsigned int uTextureID_Controls1; // weak | |
126 unsigned int uTextureID_Save1; // weak | |
127 unsigned int uTextureID_Load1; // weak | |
128 unsigned int uTextureID_New1; // weak | |
129 unsigned int uTextureID_Options; // weak | |
0 | 130 |
131 | |
132 unsigned int uTextureID_ib_td5_A; | |
133 unsigned int uTextureID_ib_td2_A; // weak | |
134 unsigned int uTextureID_ib_td1_A; | |
984 | 135 int uTextureID_CharacterUI_InventoryBackground; // weak |
0 | 136 int uTextureID_50795C; // weak |
137 | |
138 | |
319 | 139 unsigned int uTextureID_Btn_GameSettings; |
0 | 140 |
141 | |
319 | 142 unsigned int uTextureID_Btn_Rest; |
143 unsigned int uTextureID_Btn_CastSpell; | |
144 unsigned int uTextureID_Btn_ZoomIn; | |
145 unsigned int uTextureID_Btn_ZoomOut; | |
0 | 146 unsigned int uTextureID_FONTPAL; |
319 | 147 unsigned int uTextureID_Btn_NPCRight; |
148 unsigned int uTextureID_Btn_NPCLeft; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1205
diff
changeset
|
149 std::array<unsigned int, 8> pTextureIDs_pMapDirs; |
0 | 150 |
151 | |
152 unsigned int uTextureID_BarRed; | |
153 unsigned int uTextureID_BarYellow; | |
154 unsigned int uTextureID_BarGreen; | |
155 unsigned int uTextureID_BarBlue; | |
156 | |
157 | |
158 unsigned int uTextureID_right_panel; // weak | |
159 | |
160 | |
161 RGBTexture *pTexture_StatusBar = new RGBTexture; | |
162 RGBTexture *pTexture_LeftFrame = new RGBTexture; | |
163 RGBTexture *pTexture_TopFrame = new RGBTexture; | |
164 RGBTexture *pTexture_BottomFrame = new RGBTexture; | |
165 RGBTexture *pTexture_RightFrame = new RGBTexture; | |
166 | |
167 | |
910 | 168 unsigned int uTextureID_right_panel_loop; |
0 | 169 |
170 | |
171 Texture *pTexture_Leather; | |
172 Texture *pTexture_RestUI_CurrentSkyFrame; // idb | |
173 Texture *pTexture_RestUI_CurrentHourglassFrame; // idb | |
174 | |
175 | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1205
diff
changeset
|
176 std::array<unsigned int, 5> uTextureID_Optkb; |
0 | 177 |
178 unsigned int uTextureID_507C10; // weak | |
179 unsigned int uTextureID_507C14; // weak | |
180 unsigned int uTextureID_507C18; // weak | |
181 unsigned int uTextureID_507C1C; // weak | |
182 unsigned int uTextureID_507C20; // weak | |
183 unsigned int uTextureID_507C24; // weak | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1205
diff
changeset
|
184 std::array<unsigned int, 10> pTextureIDs_GammaPositions; |
0 | 185 unsigned int uTextureID_507C50; // weak |
186 unsigned int uTextureID_507C54; // weak | |
187 unsigned int uTextureID_507C58; // weak | |
188 | |
189 | |
910 | 190 unsigned int uTextureID_detaliz_close_button; // weak |
0 | 191 unsigned int uTextureID_MAGNIF_B; // weak |
192 unsigned int uTextureID_BACKDOLL; // weak | |
193 unsigned int uTextureID_BACKHAND; // weak | |
194 | |
1262 | 195 stru355 stru_4E82A4 = {0x20, 0x41, 0, 0x20, 0xFF0000, 0xFF00, 0xFF, 0xFF000000}; |
196 stru355 stru_4EFCBC = {0x20, 0x41, 0, 0x10, 0x7C00, 0x3E0, 0x1F, 0x8000}; | |
0 | 197 |
198 Texture pTex_F7CE30; | |
199 | |
200 | |
201 RGBTexture stru_5773C4; // idb | |
202 | |
203 | |
204 | |
205 | |
206 | |
207 | |
208 | |
209 | |
210 | |
211 | |
212 | |
213 /* 245 */ | |
214 #pragma pack(push, 1) | |
215 struct PCXHeader1 | |
216 { | |
217 char magic; | |
218 char version; | |
219 char encoding; | |
220 char bpp; | |
221 __int16 left; | |
222 __int16 up; | |
223 __int16 right; | |
224 __int16 bottom; | |
225 __int16 hres; | |
226 __int16 vres; | |
227 }; | |
228 #pragma pack(pop) | |
229 | |
230 /* 246 */ | |
231 #pragma pack(push, 1) | |
232 struct PCXHeader2 | |
233 { | |
234 char reserved; | |
235 char planes; | |
236 __int16 pitch; | |
237 __int16 palette_info; | |
238 }; | |
239 #pragma pack(pop) | |
240 | |
241 | |
242 | |
243 | |
244 | |
245 | |
246 | |
247 | |
248 | |
249 //----- (0044E054) -------------------------------------------------------- | |
250 void TextureFrameTable::ToFile() | |
251 { | |
252 TextureFrameTable *v1; // esi@1 | |
253 FILE *v2; // eax@1 | |
254 FILE *v3; // edi@1 | |
255 | |
256 v1 = this; | |
257 v2 = fopen("data\\dtft.bin", "wb"); | |
258 v3 = v2; | |
259 if ( !v2 ) | |
1545 | 260 Error("Unable to save dtft.bin!"); |
0 | 261 fwrite(v1, 4u, 1u, v2); |
711 | 262 fwrite(v1->pTextures, 0x14u, v1->sNumTextures, v3); |
0 | 263 fclose(v3); |
264 } | |
265 | |
266 //----- (0044E0A0) -------------------------------------------------------- | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1453
diff
changeset
|
267 void TextureFrameTable::FromFile(void *data_mm6, void *data_mm7, void *data_mm8) |
0 | 268 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1453
diff
changeset
|
269 uint num_mm6_frames = data_mm6 ? *(int *)data_mm6 : 0, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1453
diff
changeset
|
270 num_mm7_frames = data_mm7 ? *(int *)data_mm7 : 0, |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1453
diff
changeset
|
271 num_mm8_frames = data_mm8 ? *(int *)data_mm8 : 0; |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1453
diff
changeset
|
272 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1453
diff
changeset
|
273 sNumTextures = num_mm6_frames + num_mm7_frames + num_mm8_frames; |
1545 | 274 Assert(sNumTextures); |
275 Assert(!num_mm8_frames); | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1453
diff
changeset
|
276 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1453
diff
changeset
|
277 pTextures = (TextureFrame *)pAllocator->AllocNamedChunk(pTextures, sNumTextures * sizeof(TextureFrame), "Txt Frames"); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1453
diff
changeset
|
278 |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1453
diff
changeset
|
279 memcpy(pTextures, (char *)data_mm7 + 4, num_mm7_frames * sizeof(TextureFrame)); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1453
diff
changeset
|
280 memcpy(pTextures + num_mm7_frames, (char *)data_mm6 + 4, num_mm6_frames * sizeof(TextureFrame)); |
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1453
diff
changeset
|
281 memcpy(pTextures + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 4, num_mm8_frames * sizeof(TextureFrame)); |
0 | 282 } |
283 | |
284 //----- (0044E0ED) -------------------------------------------------------- | |
711 | 285 void TextureFrameTable::LoadAnimationSequenceAndPalettes( signed int uIconID ) |
286 { | |
0 | 287 TextureFrameTable *v3; // ebx@1 |
288 unsigned int i; // edi@3 | |
289 | |
290 v3 = this; | |
711 | 291 if ( (uIconID <= this->sNumTextures) && uIconID >= 0 ) |
0 | 292 { |
293 for ( i = uIconID; ; ++i ) | |
294 { | |
295 v3->pTextures[i].uTextureID = pBitmaps_LOD->LoadTexture(v3->pTextures[i].pTextureName, TEXTURE_DEFAULT); | |
973 | 296 |
1108
a1fd8045ffb1
probably erroneous semicolons removed, mace and staff stun chance work as they should
Grumpy7
parents:
1104
diff
changeset
|
297 if (v3->pTextures[i].uTextureID != -1) |
973 | 298 pBitmaps_LOD->pTextures[v3->pTextures[i].uTextureID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v3->pTextures[i].uTextureID].palette_id1); |
711 | 299 //result = (unsigned int)v3->pTextures; |
300 //if ( !(*(char *)(result + i * 20 + 18) & 1) ) | |
973 | 301 if( v3->pTextures[i].uFlags & 1) |
0 | 302 break; |
303 } | |
304 } | |
711 | 305 return; |
0 | 306 } |
307 | |
308 //----- (0044E163) -------------------------------------------------------- | |
309 unsigned int TextureFrameTable::FindTextureByName(const char *Str2) | |
310 { | |
311 TextureFrameTable *v2; // esi@1 | |
312 int v3; // ebx@1 | |
313 unsigned int uID; // edi@1 | |
314 unsigned int result; // eax@4 | |
315 | |
316 v2 = this; | |
317 v3 = 0; | |
318 uID = 0; | |
711 | 319 if ( (signed int)this->sNumTextures <= 0 ) |
0 | 320 { |
321 LABEL_4: | |
322 result = -1; | |
323 } | |
324 else | |
325 { | |
1104 | 326 while ( _stricmp(v2->pTextures[v3].pTextureName, Str2) ) |
0 | 327 { |
328 ++uID; | |
329 ++v3; | |
711 | 330 if ( (signed int)uID >= (signed int)v2->sNumTextures ) |
0 | 331 goto LABEL_4; |
332 } | |
333 result = uID; | |
334 } | |
335 return result; | |
336 } | |
337 | |
338 //----- (0044E19A) -------------------------------------------------------- | |
339 unsigned int TextureFrameTable::GetFrameTexture(int uFrameID, signed int a3) | |
340 { | |
341 int v3; // esi@1 | |
342 TextureFrame *v4; // edi@1 | |
343 TextureFrame *v5; // ecx@1 | |
344 __int16 v6; // dx@2 | |
345 int v7; // edx@3 | |
346 char *i; // eax@3 | |
347 int v9; // ecx@5 | |
348 unsigned int result; // eax@6 | |
349 | |
350 v3 = uFrameID; | |
351 v4 = this->pTextures; | |
352 v5 = &v4[uFrameID]; | |
353 if ( v5->uFlags & 1 && (v6 = v5->uAnimLength) != 0 ) | |
354 { | |
355 v7 = (a3 >> 3) % v6; | |
356 for ( i = (char *)&v5->uAnimTime; ; i += 20 ) | |
357 { | |
358 v9 = *(short *)i; | |
359 if ( v7 <= v9 ) | |
360 break; | |
361 v7 -= v9; | |
362 ++v3; | |
363 } | |
364 result = v4[v3].uTextureID; | |
365 } | |
366 else | |
367 { | |
368 result = v5->uTextureID; | |
369 } | |
370 return result; | |
371 } | |
372 | |
373 | |
374 | |
375 | |
376 | |
377 | |
378 //----- (0040F806) -------------------------------------------------------- | |
379 void *Texture::UnzipPalette() | |
380 { | |
381 Texture *v1; // esi@1 | |
1093 | 382 |
0 | 383 void *v2; // edi@1 |
384 Texture *pSource; // [sp+0h] [bp-4h]@1 | |
385 | |
386 pSource = this; | |
387 v1 = this; | |
388 v2 = malloc(this->uDecompressedSize); | |
710 | 389 zlib::MemUnzip(v2, (unsigned int *)&pSource, v1->pLevelOfDetail0_prolly_alpha_mask, v1->uTextureSize); |
0 | 390 return v2; |
391 } | |
392 | |
393 //----- (0040F77C) -------------------------------------------------------- | |
394 void Texture::Release() | |
395 { | |
396 if (this) | |
397 { | |
398 pName[0] = 0; | |
399 | |
400 if (pBits & 0x0400) | |
401 { | |
1093 | 402 __debugbreak(); |
403 } | |
404 | |
405 pAllocator->FreeChunk(pLevelOfDetail0_prolly_alpha_mask); | |
0 | 406 pAllocator->FreeChunk(pPalette16); |
407 pAllocator->FreeChunk(pPalette24); | |
1093 | 408 |
0 | 409 |
710 | 410 pLevelOfDetail0_prolly_alpha_mask = nullptr; |
0 | 411 pLevelOfDetail1 = nullptr; |
412 pLevelOfDetail2 = nullptr; | |
413 pLevelOfDetail3 = nullptr; | |
414 | |
415 pPalette16 = nullptr; | |
416 pPalette24 = nullptr; | |
417 | |
418 uSizeOfMaxLevelOfDetail = 0; | |
419 uTextureSize = 0; | |
420 uTextureHeight = 0; | |
421 uTextureWidth = 0; | |
422 uHeightLn2 = 0; | |
423 uWidthLn2 = 0; | |
424 palette_id1 = 0; | |
425 palette_id2 = 0; | |
426 pBits &= 0xFFFF0000; | |
427 } | |
428 } | |
429 | |
430 //----- (0040F5F5) -------------------------------------------------------- | |
431 int RGBTexture::Reload(const char *pContainer) | |
432 { | |
433 RGBTexture *v2; // esi@1 | |
434 FILE *v3; // eax@3 | |
435 FILE *v4; // edi@3 | |
436 void *v5; // ebx@7 | |
437 signed int result; // eax@11 | |
438 unsigned int v7; // ecx@12 | |
439 unsigned __int16 *v8; // ST20_4@14 | |
440 int v9; // eax@14 | |
441 char color_map[48]; // [sp+8h] [bp-98h]@9 | |
442 Texture DstBuf; // [sp+38h] [bp-68h]@1 | |
443 PCXHeader1 header1; // [sp+80h] [bp-20h]@9 | |
444 PCXHeader2 header2; // [sp+90h] [bp-10h]@9 | |
445 FILE *File; // [sp+98h] [bp-8h]@3 | |
446 size_t Count; // [sp+9Ch] [bp-4h]@6 | |
447 void *uSourceLena; // [sp+A8h] [bp+8h]@7 | |
448 | |
449 v2 = this; | |
450 if ( !v2->pPixels ) | |
451 return 2; | |
452 v3 = pIcons_LOD->FindContainer(pContainer, 0); | |
453 v4 = v3; | |
454 File = v3; | |
455 if ( !v3 ) | |
1545 | 456 Error("Unable to load %s", pContainer); |
457 | |
0 | 458 fread(&DstBuf, 1u, 0x30u, v3); |
459 Count = DstBuf.uTextureSize; | |
460 if ( DstBuf.uDecompressedSize ) | |
461 { | |
462 v5 = malloc(DstBuf.uDecompressedSize); | |
463 uSourceLena = pAllocator->AllocNamedChunk(0, DstBuf.uTextureSize, DstBuf.pName); | |
464 fread(uSourceLena, 1u, Count, File); | |
465 zlib::MemUnzip(v5, &DstBuf.uDecompressedSize, uSourceLena, DstBuf.uTextureSize); | |
466 DstBuf.uTextureSize = DstBuf.uDecompressedSize; | |
467 pAllocator->FreeChunk(uSourceLena); | |
468 } | |
469 else | |
470 { | |
471 v5 = malloc(DstBuf.uTextureSize); | |
472 fread(v5, 1u, Count, v4); | |
473 } | |
474 memcpy(&header1, v5, 0x10u); | |
475 memcpy(color_map, (char *)v5 + 16, 0x30u); | |
476 memcpy(&header2, (char *)v5 + 64, 6u); | |
477 if ( header1.bpp != 8 ) | |
478 return 3; | |
479 v7 = (signed __int16)(header1.right - header1.left + 1); | |
480 if ( (signed int)(v7 * (signed __int16)(header1.bottom - header1.up + 1)) <= (signed int)v2->uNumPixels ) | |
481 { | |
482 v2->uWidth = header1.right - header1.left + 1; | |
483 v8 = v2->pPixels; | |
484 v9 = v7 * v2->uHeight; | |
485 v2->uNumPixels = v9; | |
486 v2->uHeight = v9; | |
487 v2->DecodePCX((char *)v5, v8, v7); | |
488 free(v5); | |
489 result = 0; | |
490 } | |
491 else | |
492 { | |
493 result = -1; | |
494 } | |
495 return result; | |
496 } | |
497 | |
498 //----- (0040F5BE) -------------------------------------------------------- | |
499 Texture::Texture() | |
500 { | |
501 pName[0] = 0; | |
502 uSizeOfMaxLevelOfDetail = 0; | |
503 uTextureSize = 0; | |
504 uTextureHeight = 0; | |
505 uTextureWidth = 0; | |
506 uHeightLn2 = 0; | |
507 uWidthLn2 = 0; | |
508 palette_id1 = 0; | |
509 palette_id2 = 0; | |
710 | 510 pLevelOfDetail0_prolly_alpha_mask = 0; |
0 | 511 pLevelOfDetail3 = 0; |
512 pLevelOfDetail2 = 0; | |
513 pLevelOfDetail1 = 0; | |
514 pPalette16 = 0; | |
515 pPalette24 = 0; | |
516 } | |
517 | |
518 //----- (0040F414) -------------------------------------------------------- | |
519 int RGBTexture::Load(const char *pContainer, int mode) | |
520 { | |
521 RGBTexture *v3; // esi@1 | |
522 FILE *v4; // eax@1 | |
523 FILE *v5; // ebx@1 | |
524 void *v6; // ebx@5 | |
525 unsigned __int16 v7; // ax@9 | |
526 unsigned __int16 v8; // cx@9 | |
527 int v9; // ecx@9 | |
528 void *v10; // eax@9 | |
529 void *v11; // eax@13 | |
530 unsigned __int16 *v12; // eax@17 | |
531 char color_map[48]; // [sp+Ch] [bp-98h]@7 | |
532 Texture DstBuf; // [sp+3Ch] [bp-68h]@1 | |
533 PCXHeader1 header1; // [sp+84h] [bp-20h]@7 | |
534 PCXHeader2 header2; // [sp+94h] [bp-10h]@7 | |
535 FILE *File; // [sp+9Ch] [bp-8h]@1 | |
536 size_t Count; // [sp+A0h] [bp-4h]@4 | |
537 char *Str1a; // [sp+ACh] [bp+8h]@5 | |
538 | |
539 v3 = this; | |
540 v4 = pIcons_LOD->FindContainer(pContainer, 0); | |
541 v5 = v4; | |
542 File = v4; | |
543 if ( !v4 ) | |
1545 | 544 Error("Unable to load %s", pContainer); |
545 | |
0 | 546 fread(&DstBuf, 1u, 0x30u, v4); |
547 Count = DstBuf.uTextureSize; | |
548 if ( DstBuf.uDecompressedSize ) | |
549 { | |
550 Str1a = (char *)malloc(DstBuf.uDecompressedSize); | |
551 v6 = pAllocator->AllocNamedChunk(0, DstBuf.uTextureSize, DstBuf.pName); | |
552 fread(v6, 1u, Count, File); | |
553 zlib::MemUnzip(Str1a, &DstBuf.uDecompressedSize, v6, DstBuf.uTextureSize); | |
554 DstBuf.uTextureSize = DstBuf.uDecompressedSize; | |
555 pAllocator->FreeChunk(v6); | |
556 } | |
557 else | |
558 { | |
559 Str1a = (char *)malloc(DstBuf.uTextureSize); | |
560 fread(Str1a, 1u, Count, v5); | |
561 } | |
562 memcpy(&header1, Str1a, 0x10u); | |
563 memcpy(color_map, Str1a + 16, 0x30u); | |
564 memcpy(&header2, Str1a + 64, 6u); | |
565 if ( header1.bpp != 8 ) | |
566 return 3; | |
567 v7 = header1.right - header1.left + 1; | |
568 v8 = header1.bottom - header1.up + 1; | |
569 v3->uWidth = v7; | |
570 v3->uHeight = v8; | |
571 v9 = (signed __int16)v7 * (signed __int16)v8; | |
572 v10 = v3->pPixels; | |
573 v3->uNumPixels = v9; | |
574 if ( v10 ) | |
575 { | |
576 if ( mode ) | |
577 goto LABEL_14; | |
578 pAllocator->FreeChunk(v10); | |
579 } | |
580 if ( !mode ) | |
581 { | |
582 v11 = pAllocator->AllocNamedChunk(v3->pPixels, 2 * v3->uNumPixels + 4, "16bit PCX"); | |
583 goto LABEL_16; | |
584 } | |
585 LABEL_14: | |
586 if ( mode != 2 ) | |
587 goto LABEL_17; | |
588 v11 = malloc(2 * v3->uNumPixels + 4); | |
589 *(unsigned int *)&v3->field_20 |= 1u; | |
590 LABEL_16: | |
591 v3->pPixels = (unsigned __int16 *)v11; | |
592 LABEL_17: | |
593 v12 = v3->pPixels; | |
594 if ( !v12 ) | |
595 return 2; | |
596 v3->DecodePCX(Str1a, v12, v3->uWidth); | |
597 free(Str1a); | |
598 return 0; | |
599 } | |
600 | |
601 | |
602 //----- (0040F037) -------------------------------------------------------- | |
603 signed int RGBTexture::DecodePCX(char *pPcx, unsigned __int16 *pOutPixels, unsigned int uNumPixels) | |
604 { | |
605 signed int result; // eax@2 | |
606 unsigned char test_byte; // edx@3 | |
607 unsigned int read_offset; // ebx@37 | |
608 unsigned int row_position; // edi@40 | |
609 unsigned char value; // cl@63 | |
610 char count; // [sp+50h] [bp-Ch]@43 | |
611 unsigned short current_line; // [sp+54h] [bp-8h]@38 | |
612 unsigned short *dec_position; | |
613 unsigned short *temp_dec_position; | |
614 PCXHeader1 psx_head1; | |
615 PCXHeader2 psx_head2; | |
616 short int width, height; | |
617 BYTE color_map[48]; // Colormap for 16-color images | |
618 | |
619 | |
620 memcpy(&psx_head1, pPcx , 16); | |
621 memcpy(&color_map, pPcx + 16, 48); | |
622 memcpy(&psx_head2, pPcx + 64, 6); | |
623 | |
624 | |
625 if (psx_head1.bpp!=8) | |
626 return 3; | |
627 uWidth=(short int )(psx_head1.right-psx_head1.left+1); // word @ 000014 | |
628 uHeight=(short int )(psx_head1.bottom-psx_head1.up+1); // word @ 000016 | |
629 | |
630 | |
631 uNumPixels=uWidth*uHeight; // dword @ 000010 | |
632 | |
633 memset(pOutPixels, 0, uNumPixels * sizeof(__int16)); | |
634 short i=1; | |
635 while ( (1<<i) !=uWidth) | |
636 { | |
637 ++i; | |
638 if (i >= 15) | |
639 break; | |
640 } | |
641 field_18=i; | |
642 short i_=1; | |
643 while ( (1<<i_) !=uHeight) | |
644 { | |
645 ++i_; | |
646 if (i_ >= 15) | |
647 break; | |
648 } | |
649 field_1A=i_; | |
650 switch (field_18) | |
651 { | |
652 case 2: field_1C = 3; break; | |
653 case 3: field_1C = 7; break; | |
654 case 4: field_1C = 15; break; | |
655 case 5: field_1C = 31; break; | |
656 case 6: field_1C = 63; break; | |
657 case 7: field_1C = 127; break; | |
658 case 8: field_1C = 255; break; | |
659 case 9: field_1C = 511; break; | |
660 case 10: field_1C = 1023; break; | |
661 case 11: field_1C = 2047; break; | |
662 case 12: field_1C = 4095; break; | |
663 } | |
664 | |
665 switch (field_1A) | |
666 { | |
667 case 2: field_1E = 3; break; | |
668 case 3: field_1E = 7; break; | |
669 case 4: field_1E = 15; break; | |
670 case 5: field_1E = 31; break; | |
671 case 6: field_1E = 63; break; | |
672 case 7: field_1E = 127; break; | |
673 case 8: field_1E = 255; break; | |
674 case 9: field_1E = 511; break; | |
675 case 10: field_1E = 1023; break; | |
676 case 11: field_1E = 2047; break; | |
677 case 12: field_1E = 4095; break; | |
678 } | |
679 | |
680 | |
681 read_offset = 128; | |
682 if (psx_head2.planes != 3) | |
683 return 0; | |
684 current_line = 0; | |
685 if ( uHeight > 0 ) | |
686 { | |
687 dec_position = pOutPixels; | |
688 do | |
689 { | |
690 temp_dec_position = dec_position; | |
691 row_position = 0; | |
692 //decode red line | |
693 if (psx_head2.pitch) | |
694 { | |
695 do | |
696 { | |
697 test_byte = pPcx[read_offset]; | |
698 ++read_offset; | |
699 if ((test_byte & 0xC0) == 0xC0) | |
700 { | |
701 value = pPcx[read_offset]; | |
702 ++read_offset; | |
703 | |
704 if ((test_byte & 0x3F) > 0) | |
705 { | |
706 count = test_byte & 0x3F; | |
707 do | |
708 { | |
709 | |
710 ++row_position; | |
711 //*temp_dec_position =0xFF000000; | |
712 //*temp_dec_position|=(unsigned long)value<<16; | |
713 *temp_dec_position |= LOWORD(pRenderer->uTargetRMask) & ((unsigned __int8)value << (LOBYTE(pRenderer->uTargetGBits) | |
714 + LOBYTE(pRenderer->uTargetRBits) | |
715 + LOBYTE(pRenderer->uTargetBBits) | |
716 - 8)); | |
717 | |
718 temp_dec_position++; | |
719 if (row_position == psx_head2.pitch) | |
720 break; | |
721 } | |
722 while (count-- != 1); | |
723 } | |
724 } | |
725 else | |
726 { | |
727 ++row_position; | |
728 //*temp_dec_position =0xFF000000; | |
729 //*temp_dec_position|= (unsigned long)test_byte<<16; | |
730 | |
731 *temp_dec_position |= LOWORD(pRenderer->uTargetRMask) & ((unsigned __int8)test_byte << (LOBYTE(pRenderer->uTargetGBits) | |
732 + LOBYTE(pRenderer->uTargetRBits) | |
733 + LOBYTE(pRenderer->uTargetBBits) | |
734 - 8)); | |
735 | |
736 temp_dec_position++; | |
737 } | |
738 | |
739 } | |
740 while (row_position < psx_head2.pitch); | |
741 } | |
742 | |
743 temp_dec_position = dec_position; | |
744 row_position=0; | |
745 //decode green line | |
746 while (row_position < psx_head2.pitch) | |
747 { | |
748 test_byte = *(pPcx + read_offset); | |
749 ++read_offset; | |
750 if ((test_byte & 0xC0) == 0xC0) | |
751 { | |
752 value = *(pPcx + read_offset); | |
753 ++read_offset; | |
754 if ((test_byte & 0x3F) > 0) | |
755 { | |
756 count = test_byte & 0x3F; | |
757 do | |
758 { | |
759 //*temp_dec_position|= (unsigned int)value<<8; | |
760 //temp_dec_position++; | |
761 | |
762 *temp_dec_position|= pRenderer->uTargetGMask & (unsigned __int16)((unsigned __int8)value << (LOBYTE(pRenderer->uTargetGBits) | |
763 + LOBYTE(pRenderer->uTargetBBits) | |
764 - 8)); | |
765 | |
766 temp_dec_position++; | |
767 ++row_position; | |
768 if (row_position == psx_head2.pitch) | |
769 break; | |
770 | |
771 } | |
772 while (count-- != 1); | |
773 } | |
774 } | |
775 else | |
776 { | |
777 //*temp_dec_position |=(unsigned int) test_byte<<8; | |
778 //temp_dec_position++; | |
779 | |
780 *temp_dec_position|= pRenderer->uTargetGMask & (unsigned __int16)((unsigned __int8)test_byte << (LOBYTE(pRenderer->uTargetGBits) | |
781 + LOBYTE(pRenderer->uTargetBBits) | |
782 - 8)); | |
783 temp_dec_position++; | |
784 ++row_position; | |
785 } | |
786 } | |
787 | |
788 temp_dec_position = dec_position; | |
789 row_position=0; | |
790 //decode blue line | |
791 while (row_position < psx_head2.pitch) | |
792 { | |
793 test_byte = *(pPcx + read_offset); | |
794 read_offset++; | |
795 if ((test_byte & 0xC0) == 0xC0) | |
796 { | |
797 value = *(pPcx + read_offset); | |
798 ++read_offset; | |
799 if ((test_byte & 0x3F) > 0) | |
800 { | |
801 count = test_byte & 0x3F; | |
802 do | |
803 { | |
804 //*temp_dec_position|= value; | |
805 //temp_dec_position++; | |
806 | |
807 *temp_dec_position |= value >> (8 - LOBYTE(pRenderer->uTargetBBits)); | |
808 temp_dec_position++; | |
809 | |
810 ++row_position; | |
811 if (row_position == psx_head2.pitch) | |
812 break; | |
813 } | |
814 while (count-- != 1); | |
815 } | |
816 } | |
817 else | |
818 { | |
819 //*temp_dec_position|= test_byte; | |
820 //temp_dec_position++; | |
821 *temp_dec_position |= test_byte >> (8 - LOBYTE(pRenderer->uTargetBBits)); | |
822 temp_dec_position++; | |
823 | |
824 ++row_position; | |
825 } | |
826 | |
827 } | |
828 ++current_line; | |
829 dec_position += uWidth; | |
830 } | |
831 while (current_line < uHeight); | |
832 } | |
833 return 0; | |
834 /* | |
835 RGBTexture *v4; // esi@1 | |
836 signed int result; // eax@2 | |
837 unsigned __int16 v6; // ax@3 | |
838 unsigned __int16 *v7; // ecx@3 | |
839 unsigned int v8; // edx@3 | |
840 signed int v9; // ecx@3 | |
841 signed int v10; // ecx@8 | |
842 signed int v11; // ebx@37 | |
843 unsigned __int16 *v12; // eax@40 | |
844 int v13; // edi@40 | |
845 int v14; // ebx@41 | |
846 char v15; // bl@42 | |
847 unsigned __int16 *v16; // eax@50 | |
848 int v17; // ebx@51 | |
849 char v18; // bl@52 | |
850 unsigned __int16 *v19; // eax@61 | |
851 unsigned __int8 v20; // dl@62 | |
852 unsigned __int8 v21; // dl@63 | |
853 unsigned __int8 v22; // cl@63 | |
854 char color_map[48]; // [sp+8h] [bp-54h]@1 | |
855 PCXHeader1 header1; // [sp+38h] [bp-24h]@1 | |
856 PCXHeader2 header2; // [sp+48h] [bp-14h]@1 | |
857 unsigned int v26; // [sp+50h] [bp-Ch]@43 | |
858 int v27; // [sp+54h] [bp-8h]@38 | |
859 unsigned __int16 *v28; // [sp+58h] [bp-4h]@3 | |
860 int pOutPixelsa; // [sp+68h] [bp+Ch]@41 | |
861 int pOutPixelsb; // [sp+68h] [bp+Ch]@51 | |
862 | |
863 v4 = this; | |
864 memcpy(&header1, pPcx, 0x10u); | |
865 memcpy(color_map, pPcx + 16, 0x30u); | |
866 memcpy(&header2, pPcx + 64, 6u); | |
867 if ( header1.bpp == 8 ) | |
868 { | |
869 v6 = header1.right - header1.left + 1; | |
870 LOWORD(v7) = header1.bottom - header1.up + 1; | |
871 v4->uWidth = v6; | |
872 v4->uHeight = (unsigned __int16)v7; | |
873 v7 = (unsigned __int16 *)(signed __int16)v7; | |
874 v28 = v7; | |
875 v4->uNumPixels = (signed __int16)v7 * (signed __int16)v6; | |
876 HIWORD(v8) = 0; | |
877 v9 = 1; | |
878 while ( 1 << v9 != (signed __int16)v6 ) | |
879 { | |
880 ++v9; | |
881 if ( v9 >= 15 ) | |
882 goto LABEL_8; | |
883 } | |
884 v4->field_18 = v9; | |
885 LABEL_8: | |
886 v10 = 1; | |
887 while ( (unsigned __int16 *)(1 << v10) != v28 ) | |
888 { | |
889 ++v10; | |
890 if ( v10 >= 15 ) | |
891 goto LABEL_13; | |
892 } | |
893 v4->field_1A = v10; | |
894 LABEL_13: | |
895 switch ( v4->field_18 ) | |
896 { | |
897 case 2: | |
898 v4->field_1C = 3; | |
899 break; | |
900 case 3: | |
901 v4->field_1C = 7; | |
902 break; | |
903 case 4: | |
904 v4->field_1C = 15; | |
905 break; | |
906 case 5: | |
907 v4->field_1C = 31; | |
908 break; | |
909 case 6: | |
910 v4->field_1C = 63; | |
911 break; | |
912 case 7: | |
913 v4->field_1C = 127; | |
914 break; | |
915 case 8: | |
916 v4->field_1C = 255; | |
917 break; | |
918 case 9: | |
919 v4->field_1C = 511; | |
920 break; | |
921 case 10: | |
922 v4->field_1C = 1023; | |
923 break; | |
924 case 11: | |
925 v4->field_1C = 2047; | |
926 break; | |
927 case 12: | |
928 v4->field_1C = 4095; | |
929 break; | |
930 default: | |
931 break; | |
932 } | |
933 switch ( v4->field_1A ) | |
934 { | |
935 case 2: | |
936 v4->field_1E = 3; | |
937 break; | |
938 case 3: | |
939 v4->field_1E = 7; | |
940 break; | |
941 case 4: | |
942 v4->field_1E = 15; | |
943 break; | |
944 case 5: | |
945 v4->field_1E = 31; | |
946 break; | |
947 case 6: | |
948 v4->field_1E = 63; | |
949 break; | |
950 case 7: | |
951 v4->field_1E = 127; | |
952 break; | |
953 case 8: | |
954 v4->field_1E = 255; | |
955 break; | |
956 case 9: | |
957 v4->field_1E = 511; | |
958 break; | |
959 case 10: | |
960 v4->field_1E = 1023; | |
961 break; | |
962 case 11: | |
963 v4->field_1E = 2047; | |
964 break; | |
965 case 12: | |
966 v4->field_1E = 4095; | |
967 break; | |
968 default: | |
969 break; | |
970 } | |
971 v11 = 128; | |
972 if ( header2.planes == 3 ) | |
973 { | |
974 v27 = 0; | |
975 if ( (signed int)v28 > 0 ) | |
976 { | |
977 v28 = pOutPixels; | |
978 do | |
979 { | |
980 v12 = v28; | |
981 v13 = 0; | |
982 if ( header2.pitch ) | |
983 { | |
984 do | |
985 { | |
986 LOBYTE(v8) = pPcx[v11]; | |
987 v14 = v11 + 1; | |
988 pOutPixelsa = v14; | |
989 if ( (v8 & 0xC0) == -64 ) | |
990 { | |
991 pOutPixelsa = v14 + 1; | |
992 v15 = pPcx[v14]; | |
993 if ( (signed int)(v8 & 0x3F) > 0 ) | |
994 { | |
995 v26 = v8 & 0x3F; | |
996 do | |
997 { | |
998 ++v13; | |
999 *v12 = LOWORD(pRenderer->uTargetRMask) & ((unsigned __int8)v15 << (LOBYTE(pRenderer->uTargetGBits) | |
1000 + LOBYTE(pRenderer->uTargetRBits) | |
1001 + LOBYTE(pRenderer->uTargetBBits) | |
1002 - 8)); | |
1003 ++v12; | |
1004 if ( v13 == (unsigned __int16)header2.pitch ) | |
1005 v12 = &v12[uNumPixels - (unsigned __int16)header2.pitch - 1]; | |
1006 --v26; | |
1007 } | |
1008 while ( v26 ); | |
1009 } | |
1010 } | |
1011 else | |
1012 { | |
1013 LOWORD(v8) = (unsigned __int8)v8; | |
1014 v8 = pRenderer->uTargetRMask & (v8 << (LOBYTE(pRenderer->uTargetGBits) | |
1015 + LOBYTE(pRenderer->uTargetRBits) | |
1016 + LOBYTE(pRenderer->uTargetBBits) | |
1017 - 8)); | |
1018 ++v13; | |
1019 *v12 = v8; | |
1020 ++v12; | |
1021 } | |
1022 v11 = pOutPixelsa; | |
1023 } | |
1024 while ( v13 < (unsigned __int16)header2.pitch ); | |
1025 } | |
1026 v16 = v28; | |
1027 while ( v13 < 2 * (unsigned __int16)header2.pitch ) | |
1028 { | |
1029 LOBYTE(v8) = pPcx[v11]; | |
1030 v17 = v11 + 1; | |
1031 pOutPixelsb = v17; | |
1032 if ( (v8 & 0xC0) == -64 ) | |
1033 { | |
1034 pOutPixelsb = v17 + 1; | |
1035 v18 = pPcx[v17]; | |
1036 if ( (signed int)(v8 & 0x3F) > 0 ) | |
1037 { | |
1038 v26 = v8 & 0x3F; | |
1039 do | |
1040 { | |
1041 *v16 |= pRenderer->uTargetGMask & (unsigned __int16)((unsigned __int8)v18 << (LOBYTE(pRenderer->uTargetGBits) | |
1042 + LOBYTE(pRenderer->uTargetBBits) | |
1043 - 8)); | |
1044 ++v13; | |
1045 ++v16; | |
1046 if ( v13 == (unsigned __int16)header2.pitch ) | |
1047 v16 = &v16[uNumPixels - (unsigned __int16)header2.pitch - 1]; | |
1048 --v26; | |
1049 } | |
1050 while ( v26 ); | |
1051 } | |
1052 } | |
1053 else | |
1054 { | |
1055 LOWORD(v8) = (unsigned __int8)v8; | |
1056 v8 = pRenderer->uTargetGMask & (v8 << (LOBYTE(pRenderer->uTargetGBits) + LOBYTE(pRenderer->uTargetBBits) - 8)); | |
1057 *v16 |= v8; | |
1058 ++v13; | |
1059 ++v16; | |
1060 } | |
1061 v11 = pOutPixelsb; | |
1062 } | |
1063 v19 = v28; | |
1064 while ( v13 < 3 * (unsigned __int16)header2.pitch ) | |
1065 { | |
1066 v20 = pPcx[v11++]; | |
1067 if ( (v20 & 0xC0) == -64 ) | |
1068 { | |
1069 v21 = v20 & 0x3F; | |
1070 v22 = pPcx[v11++]; | |
1071 if ( (signed int)v21 > 0 ) | |
1072 { | |
1073 v26 = v21; | |
1074 do | |
1075 { | |
1076 *v19 |= v22 >> (8 - LOBYTE(pRenderer->uTargetBBits)); | |
1077 ++v13; | |
1078 ++v19; | |
1079 if ( v13 == (unsigned __int16)header2.pitch ) | |
1080 { | |
1081 v8 = uNumPixels - (unsigned __int16)header2.pitch; | |
1082 v19 = &v19[uNumPixels - (unsigned __int16)header2.pitch - 1]; | |
1083 } | |
1084 --v26; | |
1085 } | |
1086 while ( v26 ); | |
1087 } | |
1088 } | |
1089 else | |
1090 { | |
1091 *v19 |= v20 >> (8 - LOBYTE(pRenderer->uTargetBBits)); | |
1092 ++v13; | |
1093 ++v19; | |
1094 } | |
1095 } | |
1096 ++v27; | |
1097 v28 += uNumPixels; | |
1098 } | |
1099 while ( v27 < v4->uHeight ); | |
1100 } | |
1101 } | |
1102 result = 0; | |
1103 } | |
1104 else | |
1105 { | |
1106 result = 3; | |
1107 } | |
1108 return result; | |
1109 */ | |
1110 } | |
1111 | |
1112 //----- (0040EAD8) -------------------------------------------------------- | |
1113 unsigned int RGBTexture::LoadFromFILE(FILE *pFile, unsigned int mode, unsigned int bCloseFile) | |
1114 { | |
1115 signed int result; // eax@2 | |
1116 unsigned char test_byte; // edx@3 | |
1117 //unsigned int read_offset; // ebx@37 | |
1118 unsigned int row_position; // edi@40 | |
1119 unsigned char value; // cl@63 | |
1120 char count; // [sp+50h] [bp-Ch]@43 | |
1121 unsigned short current_line; // [sp+54h] [bp-8h]@38 | |
1122 unsigned short *dec_position; | |
1123 unsigned short *temp_dec_position; | |
1124 PCXHeader1 psx_head1; | |
1125 PCXHeader2 psx_head2; | |
1126 short int width, height; | |
1127 BYTE color_map[48]; // Colormap for 16-color images | |
1128 | |
1129 if (!pFile) | |
1130 return 1; | |
1131 | |
1132 | |
1133 fread(&psx_head1, 1, 16, pFile); | |
1134 fread(&color_map, 1, 48, pFile); | |
1135 fread(&psx_head2, 1, 6, pFile); | |
1136 | |
1137 if (psx_head1.bpp!=8) | |
1138 return 3; | |
1139 uWidth=(short int )(psx_head1.right-psx_head1.left+1); // word @ 000014 | |
1140 uHeight=(short int )(psx_head1.bottom-psx_head1.up+1); // word @ 000016 | |
1141 | |
1142 | |
1143 uNumPixels=uWidth*uHeight; // dword @ 000010 | |
1144 | |
1145 | |
1146 if ( mode == 0 ) | |
1147 { | |
1148 if ( pPixels ) | |
1149 { | |
1150 pAllocator->FreeChunk(pPixels); | |
1151 pPixels = 0; | |
1152 } | |
1153 pPixels = (unsigned __int16 *)pAllocator->AllocNamedChunk( | |
1154 pPixels, | |
1155 2 * uNumPixels + 4, | |
1156 pName); | |
1157 } | |
1158 else | |
1159 { | |
1160 if ( mode != 1 && mode == 2 ) | |
1161 { | |
1162 pPixels = (unsigned __int16 *)malloc((uNumPixels + 2) * sizeof(unsigned __int16)); | |
1163 field_20 |= 1; | |
1164 } | |
1165 } | |
1166 | |
1167 | |
1168 | |
1169 | |
1170 auto pOutPixels = pPixels; | |
1171 | |
1172 memset(pOutPixels, 0, uNumPixels * sizeof(__int16)); | |
1173 | |
1174 short i=1; | |
1175 while ( (1<<i) !=uWidth) | |
1176 { | |
1177 ++i; | |
1178 if (i >= 15) | |
1179 break; | |
1180 } | |
1181 field_18=i; | |
1182 short i_=1; | |
1183 while ( (1<<i_) !=uHeight) | |
1184 { | |
1185 ++i_; | |
1186 if (i_ >= 15) | |
1187 break; | |
1188 } | |
1189 field_1A=i_; | |
1190 switch (field_18) | |
1191 { | |
1192 case 2: field_1C = 3; break; | |
1193 case 3: field_1C = 7; break; | |
1194 case 4: field_1C = 15; break; | |
1195 case 5: field_1C = 31; break; | |
1196 case 6: field_1C = 63; break; | |
1197 case 7: field_1C = 127; break; | |
1198 case 8: field_1C = 255; break; | |
1199 case 9: field_1C = 511; break; | |
1200 case 10: field_1C = 1023; break; | |
1201 case 11: field_1C = 2047; break; | |
1202 case 12: field_1C = 4095; break; | |
1203 } | |
1204 | |
1205 switch (field_1A) | |
1206 { | |
1207 case 2: field_1E = 3; break; | |
1208 case 3: field_1E = 7; break; | |
1209 case 4: field_1E = 15; break; | |
1210 case 5: field_1E = 31; break; | |
1211 case 6: field_1E = 63; break; | |
1212 case 7: field_1E = 127; break; | |
1213 case 8: field_1E = 255; break; | |
1214 case 9: field_1E = 511; break; | |
1215 case 10: field_1E = 1023; break; | |
1216 case 11: field_1E = 2047; break; | |
1217 case 12: field_1E = 4095; break; | |
1218 } | |
1219 | |
1220 | |
1221 fseek(pFile, 128 - 70, SEEK_CUR); | |
1222 | |
1223 | |
1224 for (uint y = 0; y < uHeight; ++y) | |
1225 { | |
1226 unsigned __int16 *pDst = pPixels + y * uWidth; | |
1227 | |
1228 uint x = 0; | |
1229 do | |
1230 { | |
1231 uint ctrl = 0; | |
1232 fread(&ctrl, 1, 1, pFile); | |
1233 if ((ctrl & 0xC0) == 0xC0) | |
1234 { | |
1235 uint uNumPixels = ctrl & 0x3F; | |
1236 uint clr = 0; | |
1237 fread(&clr, 1, 1, pFile); | |
1238 for (uint i = 0; i < uNumPixels; ++i) | |
1239 pDst[x++] = pRenderer->uTargetRMask & (clr << (pRenderer->uTargetGBits + | |
1240 pRenderer->uTargetRBits + | |
1241 pRenderer->uTargetBBits - 8)); | |
1242 } | |
1243 else | |
1244 { | |
1245 pDst[x++] = pRenderer->uTargetRMask & (ctrl << (pRenderer->uTargetGBits + | |
1246 pRenderer->uTargetRBits + | |
1247 pRenderer->uTargetBBits - 8)); | |
1248 } | |
1249 } while (x < psx_head2.pitch); | |
1250 | |
1251 | |
1252 | |
1253 | |
1254 | |
1255 x = 0; | |
1256 do | |
1257 { | |
1258 uint ctrl = 0; | |
1259 fread(&ctrl, 1, 1, pFile); | |
1260 if ((ctrl & 0xC0) == 0xC0) | |
1261 { | |
1262 uint uNumPixels = ctrl & 0x3F; | |
1263 uint clr = 0; | |
1264 fread(&clr, 1, 1, pFile); | |
1265 for (uint i = 0; i < uNumPixels; ++i) | |
1266 pDst[x++] |= pRenderer->uTargetGMask & (clr << (pRenderer->uTargetGBits + | |
1267 pRenderer->uTargetBBits - 8)); | |
1268 } | |
1269 else | |
1270 { | |
1271 pDst[x++] |= pRenderer->uTargetGMask & (ctrl << (pRenderer->uTargetGBits + | |
1272 pRenderer->uTargetBBits - 8)); | |
1273 } | |
1274 } while (x < psx_head2.pitch); | |
1275 | |
1276 | |
1277 | |
1278 | |
1279 | |
1280 x = 0; | |
1281 do | |
1282 { | |
1283 uint ctrl = 0; | |
1284 fread(&ctrl, 1, 1, pFile); | |
1285 if ((ctrl & 0xC0) == 0xC0) | |
1286 { | |
1287 uint uNumPixels = ctrl & 0x3F; | |
1288 uint clr = 0; | |
1289 fread(&clr, 1, 1, pFile); | |
1290 for (uint i = 0; i < uNumPixels; ++i) | |
1291 pDst[x++] |= pRenderer->uTargetBMask & (clr >> (8 - pRenderer->uTargetBBits)); | |
1292 } | |
1293 else | |
1294 { | |
1295 pDst[x++] |= pRenderer->uTargetBMask & (ctrl >> (8 - pRenderer->uTargetRBits)); | |
1296 } | |
1297 } while (x < psx_head2.pitch); | |
1298 } | |
1299 | |
1300 if (bCloseFile) | |
1301 fclose(pFile); | |
1302 return 0; | |
1303 } | |
1304 | |
1305 //----- (0040E51F) -------------------------------------------------------- | |
1306 void RGBTexture::Release() | |
1307 { | |
1308 RGBTexture *v1; // esi@1 | |
1309 char v2; // zf@1 | |
1310 void *v3; // [sp-4h] [bp-Ch]@1 | |
1311 | |
1312 v1 = this; | |
1313 v2 = (this->field_20 & 1) == 0; | |
1314 v3 = this->pPixels; | |
1315 this->pName[0] = 0; | |
1316 if ( v2 ) | |
1317 pAllocator->FreeChunk(v3); | |
1318 else | |
1319 free(v3); | |
1320 *(unsigned int *)&v1->field_20 = 0; | |
1321 v1->pPixels = 0; | |
1322 v1->uNumPixels = 0; | |
1323 v1->uHeight = 0; | |
1324 v1->uWidth = 0; | |
1325 v1->field_1A = 0; | |
1326 v1->field_18 = 0; | |
1327 } | |
1328 | |
1329 //----- (0040E55E) -------------------------------------------------------- | |
1330 int RGBTexture::_40E55E(const char *Filename, unsigned int a3) | |
1331 { | |
1332 RGBTexture *v3; // esi@1 | |
1333 signed int result; // eax@2 | |
1334 char *v6; // eax@3 | |
1335 int v7; // edx@3 | |
1336 char v8; // cl@4 | |
1337 unsigned __int16 v9; // cx@9 | |
1338 unsigned __int16 v10; // ax@9 | |
1339 int v11; // eax@9 | |
1340 char v12; // zf@9 | |
1341 void *v13; // eax@12 | |
1342 signed int v14; // ecx@19 | |
1343 signed int v15; // ecx@24 | |
1344 int v16; // eax@57 | |
1345 unsigned __int16 *v17; // ecx@57 | |
1346 unsigned __int16 *v18; // edi@57 | |
1347 signed int v19; // eax@59 | |
1348 unsigned __int16 *v20; // edi@64 | |
1349 signed int v21; // eax@66 | |
1350 unsigned __int16 *v22; // edi@71 | |
1351 signed int v23; // eax@73 | |
1352 int v24; // eax@78 | |
71 | 1353 char v25[48]; // [sp+Ch] [bp-54h]@3 |
1354 PCXHeader1 pcx_header1; | |
1355 PCXHeader2 pcx_header2; | |
0 | 1356 int v37; // [sp+54h] [bp-Ch]@3 |
1357 int v38; // [sp+58h] [bp-8h]@57 | |
1358 FILE *File; // [sp+5Ch] [bp-4h]@1 | |
1359 | |
1360 v3 = this; | |
1361 File = fopen(Filename, "rb"); | |
1362 if ( !File ) | |
1363 return 1; | |
71 | 1364 |
1365 fread(&pcx_header1, sizeof(pcx_header1), 1, File); | |
1366 fread(&v25,48,1,File); | |
1367 fread(&pcx_header2, 4, 1, File); | |
1368 | |
0 | 1369 v6 = (char *)Filename; |
1370 v37 = 0; | |
1371 v7 = (char *)v3 - Filename; | |
1372 do | |
1373 { | |
1374 v8 = *v6; | |
1375 if ( !*v6 ) | |
1376 break; | |
1377 if ( v8 == 46 ) | |
1378 break; | |
1379 ++v37; | |
1380 (v6++)[v7] = v8; | |
1381 } | |
1382 while ( v37 < 15 ); | |
1383 v3->pName[v37] = 0; | |
71 | 1384 if ( pcx_header1.bpp != 8 ) |
0 | 1385 return 3; |
71 | 1386 v9 = pcx_header1.right - pcx_header1.left + 1; |
1387 v10 = pcx_header1.bottom - pcx_header1.up; | |
0 | 1388 v3->uWidth = v9; |
1389 ++v10; | |
1390 v3->uHeight = v10; | |
1391 v11 = (signed __int16)v9 * (signed __int16)v10; | |
1392 v12 = a3 == 0; | |
1393 v3->uNumPixels = v11; | |
1394 if ( v12 ) | |
1395 { | |
1396 if ( v3->pPixels ) | |
1397 pAllocator->FreeChunk(v3->pPixels); | |
1398 v13 = pAllocator->AllocNamedChunk(v3->pPixels, 2 * v3->uNumPixels + 4, v3->pName); | |
1399 goto LABEL_16; | |
1400 } | |
1401 if ( a3 != 1 && a3 == 2 ) | |
1402 { | |
1403 v13 = operator new(4 * v11 + 8); | |
1404 *(unsigned int *)&v3->field_20 |= 1u; | |
1405 LABEL_16: | |
1406 v3->pPixels = (unsigned __int16 *)v13; | |
1407 } | |
1408 if ( v3->pPixels ) | |
1409 { | |
1410 v14 = 1; | |
1411 while ( 1 << v14 != v3->uWidth ) | |
1412 { | |
1413 ++v14; | |
1414 if ( v14 >= 15 ) | |
1415 goto LABEL_24; | |
1416 } | |
1417 v3->field_18 = v14; | |
1418 LABEL_24: | |
1419 v15 = 1; | |
1420 while ( 1 << v15 != v3->uHeight ) | |
1421 { | |
1422 ++v15; | |
1423 if ( v15 >= 15 ) | |
1424 goto LABEL_29; | |
1425 } | |
1426 v3->field_1A = v15; | |
1427 LABEL_29: | |
1428 switch ( v3->field_18 ) | |
1429 { | |
1430 case 2: | |
1431 v3->field_1C = 3; | |
1432 break; | |
1433 case 3: | |
1434 v3->field_1C = 7; | |
1435 break; | |
1436 case 4: | |
1437 v3->field_1C = 15; | |
1438 break; | |
1439 case 5: | |
1440 v3->field_1C = 31; | |
1441 break; | |
1442 case 6: | |
1443 v3->field_1C = 63; | |
1444 break; | |
1445 case 7: | |
1446 v3->field_1C = 127; | |
1447 break; | |
1448 case 8: | |
1449 v3->field_1C = 255; | |
1450 break; | |
1451 case 9: | |
1452 v3->field_1C = 511; | |
1453 break; | |
1454 case 10: | |
1455 v3->field_1C = 1023; | |
1456 break; | |
1457 case 11: | |
1458 v3->field_1C = 2047; | |
1459 break; | |
1460 case 12: | |
1461 v3->field_1C = 4095; | |
1462 break; | |
1463 default: | |
1464 break; | |
1465 } | |
1466 switch ( v3->field_1A ) | |
1467 { | |
1468 case 2: | |
1469 v3->field_1E = 3; | |
1470 break; | |
1471 case 3: | |
1472 v3->field_1E = 7; | |
1473 break; | |
1474 case 4: | |
1475 v3->field_1E = 15; | |
1476 break; | |
1477 case 5: | |
1478 v3->field_1E = 31; | |
1479 break; | |
1480 case 6: | |
1481 v3->field_1E = 63; | |
1482 break; | |
1483 case 7: | |
1484 v3->field_1E = 127; | |
1485 break; | |
1486 case 8: | |
1487 v3->field_1E = 255; | |
1488 break; | |
1489 case 9: | |
1490 v3->field_1E = 511; | |
1491 break; | |
1492 case 10: | |
1493 v3->field_1E = 1023; | |
1494 break; | |
1495 case 11: | |
1496 v3->field_1E = 2047; | |
1497 break; | |
1498 case 12: | |
1499 v3->field_1E = 4095; | |
1500 break; | |
1501 default: | |
1502 break; | |
1503 } | |
1504 fseek(File, 128, 0); | |
1505 ftell(File); | |
71 | 1506 if ( pcx_header2.planes == 1 ) |
1545 | 1507 Error("24bit PCX Only!"); |
1508 | |
71 | 1509 if ( pcx_header2.planes == 3 ) |
0 | 1510 { |
1511 v37 = 0; | |
1512 if ( v3->uHeight > 0 ) | |
1513 { | |
1514 do | |
1515 { | |
1516 v16 = v37 * v3->uWidth; | |
1517 v17 = v3->pPixels; | |
1518 v38 = 0; | |
1519 v18 = &v17[v16]; | |
71 | 1520 if ( pcx_header2.pitch ) |
0 | 1521 { |
1522 do | |
1523 { | |
1524 fread((char *)&Filename + 3, 1u, 1u, File); | |
1525 if ( (BYTE3(Filename) & 0xC0) == -64 ) | |
1526 { | |
1527 BYTE3(Filename) &= 0x3Fu; | |
1528 fread((char *)&a3 + 3, 1u, 1u, File); | |
1529 v19 = 0; | |
1530 if ( BYTE3(Filename) ) | |
1531 { | |
1532 do | |
1533 { | |
1534 ++v38; | |
1535 *v18 = LOWORD(pRenderer->uTargetRMask) & (BYTE3(a3) << (LOBYTE(pRenderer->uTargetGBits) | |
1536 + LOBYTE(pRenderer->uTargetRBits) | |
1537 + LOBYTE(pRenderer->uTargetBBits) | |
1538 - 8)); | |
1539 ++v18; | |
1540 ++v19; | |
1541 } | |
1542 while ( v19 < BYTE3(Filename) ); | |
1543 } | |
1544 } | |
1545 else | |
1546 { | |
1547 ++v38; | |
1548 *v18 = LOWORD(pRenderer->uTargetRMask) & (BYTE3(Filename) << (LOBYTE(pRenderer->uTargetGBits) | |
1549 + LOBYTE(pRenderer->uTargetRBits) | |
1550 + LOBYTE(pRenderer->uTargetBBits) | |
1551 - 8)); | |
1552 ++v18; | |
1553 } | |
1554 } | |
71 | 1555 while ( v38 < (unsigned __int16)pcx_header2.pitch); |
0 | 1556 } |
1557 v20 = &v3->pPixels[v37 * v3->uWidth]; | |
71 | 1558 while ( v38 < 2 * (unsigned __int16)pcx_header2.pitch ) |
0 | 1559 { |
1560 fread((char *)&Filename + 3, 1u, 1u, File); | |
1561 if ( (BYTE3(Filename) & 0xC0) == -64 ) | |
1562 { | |
1563 BYTE3(Filename) &= 0x3Fu; | |
1564 fread((char *)&a3 + 3, 1u, 1u, File); | |
1565 v21 = 0; | |
1566 if ( BYTE3(Filename) ) | |
1567 { | |
1568 do | |
1569 { | |
1570 *v20 |= pRenderer->uTargetGMask & (unsigned __int16)(BYTE3(a3) << (LOBYTE(pRenderer->uTargetGBits) | |
1571 + LOBYTE(pRenderer->uTargetBBits) | |
1572 - 8)); | |
1573 ++v38; | |
1574 ++v20; | |
1575 ++v21; | |
1576 } | |
1577 while ( v21 < BYTE3(Filename) ); | |
1578 } | |
1579 } | |
1580 else | |
1581 { | |
1582 *v20 |= pRenderer->uTargetGMask & (unsigned __int16)(BYTE3(Filename) << (LOBYTE(pRenderer->uTargetGBits) | |
1583 + LOBYTE(pRenderer->uTargetBBits) | |
1584 - 8)); | |
1585 ++v38; | |
1586 ++v20; | |
1587 } | |
1588 } | |
1589 v22 = &v3->pPixels[v37 * v3->uWidth]; | |
71 | 1590 while ( v38 < 3 * (unsigned __int16)pcx_header2.pitch ) |
0 | 1591 { |
1592 fread((char *)&Filename + 3, 1u, 1u, File); | |
1593 if ( (BYTE3(Filename) & 0xC0) == -64 ) | |
1594 { | |
1595 BYTE3(Filename) &= 0x3Fu; | |
1596 fread((char *)&a3 + 3, 1u, 1u, File); | |
1597 v23 = 0; | |
1598 if ( BYTE3(Filename) ) | |
1599 { | |
1600 do | |
1601 { | |
1602 *v22 |= BYTE3(a3) >> (8 - LOBYTE(pRenderer->uTargetBBits)); | |
1603 ++v38; | |
1604 ++v22; | |
1605 ++v23; | |
1606 } | |
1607 while ( v23 < BYTE3(Filename) ); | |
1608 } | |
1609 } | |
1610 else | |
1611 { | |
1612 *v22 |= BYTE3(Filename) >> (8 - LOBYTE(pRenderer->uTargetBBits)); | |
1613 ++v38; | |
1614 ++v22; | |
1615 } | |
1616 } | |
1617 v24 = v3->uHeight; | |
1618 ++v37; | |
1619 } | |
1620 while ( v37 < v24 ); | |
1621 } | |
1622 } | |
1623 fclose(File); | |
1624 result = 0; | |
1625 } | |
1626 else | |
1627 { | |
1628 result = 2; | |
1629 } | |
1630 return result; | |
1631 } | |
1632 | |
1633 | |
1634 //----- (0040D73D) -------------------------------------------------------- | |
1635 RGBTexture::RGBTexture() | |
1636 { | |
1637 pName[0] = 0; | |
1638 pPixels = 0; | |
1639 uNumPixels = 0; | |
1640 uHeight = 0; | |
1641 uWidth = 0; | |
1642 field_1A = 0; | |
1643 field_18 = 0; | |
1644 field_20 = 0; | |
1645 field_22 = 0; | |
1297 | 1646 } |
1647 //----- (0044E1EC) -------------------------------------------------------- | |
1648 int TextureFrameTable::FromFileTxt(const char *Args) | |
1649 { | |
1650 TextureFrameTable *v2; // ebx@1 | |
1651 FILE *v3; // eax@1 | |
1652 int v4; // esi@3 | |
1653 const void *v5; // ST0C_4@10 | |
1654 void *v6; // eax@10 | |
1655 FILE *v7; // ST0C_4@12 | |
1656 char *i; // eax@12 | |
1657 signed int v9; // esi@15 | |
1658 int v10; // eax@17 | |
1659 int v11; // edx@22 | |
1660 int v12; // ecx@23 | |
1661 int v13; // eax@24 | |
1662 signed int j; // eax@27 | |
1663 TextureFrame *v15; // edx@28 | |
1664 int v16; // esi@28 | |
1665 int k; // ecx@29 | |
1666 char Buf; // [sp+Ch] [bp-2F8h]@3 | |
1667 FrameTableTxtLine v20; // [sp+200h] [bp-104h]@4 | |
1668 int v21; // [sp+27Ch] [bp-88h]@4 | |
1669 char *Str1; // [sp+280h] [bp-84h]@5 | |
1670 char *Str; // [sp+284h] [bp-80h]@15 | |
1671 int v24; // [sp+2F8h] [bp-Ch]@3 | |
1672 int v25; // [sp+2FCh] [bp-8h]@3 | |
1673 FILE *File; // [sp+300h] [bp-4h]@1 | |
1674 int Argsa; // [sp+30Ch] [bp+8h]@28 | |
1675 | |
1676 v2 = this; | |
1677 v3 = fopen(Args, "r"); | |
1678 File = v3; | |
1679 if ( !v3 ) | |
1545 | 1680 Error("CTextureFrameTable::load - Unable to open file: %s.", Args); |
1681 | |
1297 | 1682 v4 = 0; |
1683 v24 = 0; | |
1684 v25 = 1; | |
1685 if ( fgets(&Buf, 490, v3) ) | |
1686 { | |
1687 do | |
1688 { | |
1689 *strchr(&Buf, 10) = 0; | |
1690 memcpy(&v21, txt_file_frametable_parser(&Buf, &v20), 0x7Cu); | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1402
diff
changeset
|
1691 __debugbreak(); // warning C4700: uninitialized local variable 'Str1' used |
1297 | 1692 if ( v21 && *Str1 != 47 ) |
1693 { | |
1694 if ( v21 < 2 ) | |
1545 | 1695 Error("CTextureFrameTable::load, too few arguments, %s line %i.", Args, v25); |
1297 | 1696 ++v24; |
1697 } | |
1698 ++v25; | |
1699 } | |
1700 while ( fgets(&Buf, 490, File) ); | |
1701 v4 = v24; | |
1702 } | |
1703 v5 = v2->pTextures; | |
1704 v2->sNumTextures = v4; | |
1705 v6 = pAllocator->AllocNamedChunk(v5, 20 * v4, "Txt Frames"); | |
1706 v2->pTextures = (TextureFrame *)v6; | |
1707 if ( !v6 ) | |
1545 | 1708 Error("CTextureFrameTable::load - Out of Memory!"); |
1297 | 1709 v7 = File; |
1710 v2->sNumTextures = 0; | |
1711 fseek(v7, 0, 0); | |
1712 for ( i = fgets(&Buf, 490, File); i; i = fgets(&Buf, 490, File) ) | |
1713 { | |
1714 *strchr(&Buf, 10) = 0; | |
1715 memcpy(&v21, txt_file_frametable_parser(&Buf, &v20), 0x7Cu); | |
1716 if ( v21 && *Str1 != 47 ) | |
1717 { | |
1718 strcpy(v2->pTextures[v2->sNumTextures].pTextureName, Str1); | |
1409
c9e3b93ec570
Highlighted locations with "using uninitialized variable" warning.
Nomad
parents:
1402
diff
changeset
|
1719 __debugbreak(); // warning C4700: uninitialized local variable 'Str' used |
1297 | 1720 v2->pTextures[v2->sNumTextures].uAnimTime = atoi(Str); |
1721 v9 = 2; | |
1722 for ( v2->pTextures[v2->sNumTextures].uFlags = 0; v9 < v21; ++v9 ) | |
1723 { | |
1724 if ( !_stricmp((&Str1)[4 * v9], "New") ) | |
1725 { | |
1726 v10 = (int)&v2->pTextures[v2->sNumTextures].uFlags; | |
1727 *(char *)v10 |= 2u; | |
1728 } | |
1729 } | |
1730 ++v2->sNumTextures; | |
1731 } | |
1732 } | |
1733 fclose(File); | |
1734 v11 = 0; | |
1735 if ( (signed int)(v2->sNumTextures - 1) > 0 ) | |
1736 { | |
1737 v12 = 0; | |
1738 do | |
1739 { | |
1740 v13 = (int)&v2->pTextures[v12]; | |
1741 if ( !(*(char *)(v13 + 38) & 2) ) | |
1742 *(char *)(v13 + 18) |= 1u; | |
1743 ++v11; | |
1744 ++v12; | |
1745 } | |
1746 while ( v11 < (signed int)(v2->sNumTextures - 1) ); | |
1747 } | |
1748 for ( j = 0; j < (signed int)v2->sNumTextures; *(short *)(Argsa + 16) = v16 ) | |
1749 { | |
1750 v15 = v2->pTextures; | |
1751 Argsa = (int)&v15[j]; | |
1752 v16 = *(short *)(Argsa + 14); | |
1753 if ( *(char *)(Argsa + 18) & 1 ) | |
1754 { | |
1755 ++j; | |
1756 for ( k = (int)&v15[j]; *(char *)(k + 18) & 1; k += 20 ) | |
1757 { | |
1758 v16 += *(short *)(k + 14); | |
1759 ++j; | |
1760 } | |
1761 LOWORD(v16) = v15[j].uAnimTime + v16; | |
1762 } | |
1763 ++j; | |
1764 } | |
1765 return 1; | |
1766 } |