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