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