Mercurial > mm7
comparison LOD.cpp @ 710:735dab8d3c9a
Town portal screen + misc gui const replacements
author | Nomad |
---|---|
date | Thu, 21 Mar 2013 20:30:17 +0200 |
parents | e39702f35283 |
children | 700b58aac975 |
comparison
equal
deleted
inserted
replaced
709:af08fc9e29c8 | 710:735dab8d3c9a |
---|---|
2368 v5 = pDst; | 2368 v5 = pDst; |
2369 fread(pDst, 1u, 0x30u, File); | 2369 fread(pDst, 1u, 0x30u, File); |
2370 strcpy(v5->pName, pContainer); | 2370 strcpy(v5->pName, pContainer); |
2371 pDst = (Texture *)v5->uTextureSize; | 2371 pDst = (Texture *)v5->uTextureSize; |
2372 v6 = v5->uDecompressedSize; | 2372 v6 = v5->uDecompressedSize; |
2373 v5->pLevelOfDetail0 = 0; | 2373 v5->pLevelOfDetail0_prolly_alpha_mask = 0; |
2374 if ( v6 ) | 2374 if ( v6 ) |
2375 { | 2375 { |
2376 v7 = operator new(v6); | 2376 v7 = operator new(v6); |
2377 v8 = v5->uTextureSize; | 2377 v8 = v5->uTextureSize; |
2378 v5->pLevelOfDetail0 = (unsigned __int8 *)v7; | 2378 v5->pLevelOfDetail0_prolly_alpha_mask = (unsigned __int8 *)v7; |
2379 pContainer = (const char *)operator new(v8); | 2379 pContainer = (const char *)operator new(v8); |
2380 fread((void *)pContainer, 1u, (size_t)pDst, File); | 2380 fread((void *)pContainer, 1u, (size_t)pDst, File); |
2381 zlib::MemUnzip(v5->pLevelOfDetail0, &v5->uDecompressedSize, pContainer, v5->uTextureSize); | 2381 zlib::MemUnzip(v5->pLevelOfDetail0_prolly_alpha_mask, &v5->uDecompressedSize, pContainer, v5->uTextureSize); |
2382 v9 = (void *)pContainer; | 2382 v9 = (void *)pContainer; |
2383 v5->uTextureSize = v5->uDecompressedSize; | 2383 v5->uTextureSize = v5->uDecompressedSize; |
2384 free(v9); | 2384 free(v9); |
2385 } | 2385 } |
2386 else | 2386 else |
2387 { | 2387 { |
2388 v10 = (unsigned __int8 *)operator new(0); | 2388 v10 = (unsigned __int8 *)operator new(0); |
2389 v11 = File; | 2389 v11 = File; |
2390 v5->pLevelOfDetail0 = v10; | 2390 v5->pLevelOfDetail0_prolly_alpha_mask = v10; |
2391 fread(v10, 1u, (size_t)pDst, v11); | 2391 fread(v10, 1u, (size_t)pDst, v11); |
2392 } | 2392 } |
2393 v5->pPalette24 = 0; | 2393 v5->pPalette24 = 0; |
2394 if ( uTextureType == 1 ) | 2394 if ( uTextureType == 1 ) |
2395 { | 2395 { |
2421 while ( v18 < 256 ); | 2421 while ( v18 < 256 ); |
2422 LABEL_11: | 2422 LABEL_11: |
2423 if ( v5->pBits & 2 ) | 2423 if ( v5->pBits & 2 ) |
2424 { | 2424 { |
2425 v14 = v5->uSizeOfMaxLevelOfDetail; | 2425 v14 = v5->uSizeOfMaxLevelOfDetail; |
2426 v15 = (int)&v5->pLevelOfDetail0[v14]; | 2426 v15 = (int)&v5->pLevelOfDetail0_prolly_alpha_mask[v14]; |
2427 v5->pLevelOfDetail1 = (unsigned __int8 *)v15; | 2427 v5->pLevelOfDetail1 = (unsigned __int8 *)v15; |
2428 v16 = (v14 >> 2) + v15; | 2428 v16 = (v14 >> 2) + v15; |
2429 v5->pLevelOfDetail2 = (unsigned __int8 *)v16; | 2429 v5->pLevelOfDetail2 = (unsigned __int8 *)v16; |
2430 v17 = v16 + (v14 >> 4); | 2430 v17 = v16 + (v14 >> 4); |
2431 } | 2431 } |
2699 | 2699 |
2700 v4 = this; | 2700 v4 = this; |
2701 v5 = FindContainer(pContainer, 0); | 2701 v5 = FindContainer(pContainer, 0); |
2702 File = v5; | 2702 File = v5; |
2703 if ( v5 | 2703 if ( v5 |
2704 && (v6 = pDst, pDst->pLevelOfDetail0) | 2704 && (v6 = pDst, pDst->pLevelOfDetail0_prolly_alpha_mask) |
2705 && mode == 2 | 2705 && mode == 2 |
2706 && pDst->pPalette16 | 2706 && pDst->pPalette16 |
2707 && !pDst->pPalette24 | 2707 && !pDst->pPalette24 |
2708 && (v7 = pDst->uTextureSize, | 2708 && (v7 = pDst->uTextureSize, |
2709 fread(pDst, 1u, 0x30u, v5), | 2709 fread(pDst, 1u, 0x30u, v5), |
2713 (signed int)v8 <= (signed int)v7) ) | 2713 (signed int)v8 <= (signed int)v7) ) |
2714 { | 2714 { |
2715 v10 = &pDst->uDecompressedSize; | 2715 v10 = &pDst->uDecompressedSize; |
2716 if ( !pDst->uDecompressedSize || v4->dword_011BA4 ) | 2716 if ( !pDst->uDecompressedSize || v4->dword_011BA4 ) |
2717 { | 2717 { |
2718 fread(pDst->pLevelOfDetail0, 1u, v8, File); | 2718 fread(pDst->pLevelOfDetail0_prolly_alpha_mask, 1u, v8, File); |
2719 } | 2719 } |
2720 else | 2720 else |
2721 { | 2721 { |
2722 Sourcea = malloc(pDst->uDecompressedSize); | 2722 Sourcea = malloc(pDst->uDecompressedSize); |
2723 DstBufa = malloc(pDst->uTextureSize); | 2723 DstBufa = malloc(pDst->uTextureSize); |
2724 fread(DstBufa, 1u, Counta, File); | 2724 fread(DstBufa, 1u, Counta, File); |
2725 zlib::MemUnzip(Sourcea, &v6->uDecompressedSize, DstBufa, v6->uTextureSize); | 2725 zlib::MemUnzip(Sourcea, &v6->uDecompressedSize, DstBufa, v6->uTextureSize); |
2726 v6->uTextureSize = *v10; | 2726 v6->uTextureSize = *v10; |
2727 free(DstBufa); | 2727 free(DstBufa); |
2728 memcpy(v6->pLevelOfDetail0, Sourcea, *v10); | 2728 memcpy(v6->pLevelOfDetail0_prolly_alpha_mask, Sourcea, *v10); |
2729 free(Sourcea); | 2729 free(Sourcea); |
2730 } | 2730 } |
2731 v11 = 0; | 2731 v11 = 0; |
2732 do | 2732 do |
2733 { | 2733 { |
2849 v16 = &v8->uDecompressedSize; | 2849 v16 = &v8->uDecompressedSize; |
2850 pOutTex = (Texture *)v8->uTextureSize; | 2850 pOutTex = (Texture *)v8->uTextureSize; |
2851 if ( !v8->uDecompressedSize || dword_011BA4 ) | 2851 if ( !v8->uDecompressedSize || dword_011BA4 ) |
2852 { | 2852 { |
2853 v20 = pAllocator; | 2853 v20 = pAllocator; |
2854 v32 = pAllocator->AllocNamedChunk(v8->pLevelOfDetail0, v15, v8->pName); | 2854 v32 = pAllocator->AllocNamedChunk(v8->pLevelOfDetail0_prolly_alpha_mask, v15, v8->pName); |
2855 v8->pLevelOfDetail0 = (unsigned __int8 *)v32; | 2855 v8->pLevelOfDetail0_prolly_alpha_mask = (unsigned __int8 *)v32; |
2856 fread(v32, 1u, (size_t)pOutTex, pFile); | 2856 fread(v32, 1u, (size_t)pOutTex, pFile); |
2857 } | 2857 } |
2858 else | 2858 else |
2859 { | 2859 { |
2860 v17 = malloc(v8->uDecompressedSize); | 2860 v17 = malloc(v8->uDecompressedSize); |
2869 { | 2869 { |
2870 v20 = pAllocator; | 2870 v20 = pAllocator; |
2871 pOutTex = (Texture *)(((signed int)v8->uSizeOfMaxLevelOfDetail >> 2) | 2871 pOutTex = (Texture *)(((signed int)v8->uSizeOfMaxLevelOfDetail >> 2) |
2872 + ((signed int)v8->uSizeOfMaxLevelOfDetail >> 4) | 2872 + ((signed int)v8->uSizeOfMaxLevelOfDetail >> 4) |
2873 + ((signed int)v8->uSizeOfMaxLevelOfDetail >> 6)); | 2873 + ((signed int)v8->uSizeOfMaxLevelOfDetail >> 6)); |
2874 v21 = pAllocator->AllocNamedChunk(v8->pLevelOfDetail0, (unsigned int)pOutTex, v8->pName); | 2874 v21 = pAllocator->AllocNamedChunk(v8->pLevelOfDetail0_prolly_alpha_mask, (unsigned int)pOutTex, v8->pName); |
2875 v22 = (size_t)pOutTex; | 2875 v22 = (size_t)pOutTex; |
2876 v23 = &pContainer[v8->uTextureWidth * v8->uTextureHeight]; | 2876 v23 = &pContainer[v8->uTextureWidth * v8->uTextureHeight]; |
2877 v8->pLevelOfDetail0 = (unsigned __int8 *)v21; | 2877 v8->pLevelOfDetail0_prolly_alpha_mask = (unsigned __int8 *)v21; |
2878 memcpy(v21, v23, v22); | 2878 memcpy(v21, v23, v22); |
2879 v8->uTextureWidth = (signed __int16)v8->uTextureWidth >> 1; | 2879 v8->uTextureWidth = (signed __int16)v8->uTextureWidth >> 1; |
2880 v24 = v8->uTextureWidth; | 2880 v24 = v8->uTextureWidth; |
2881 v8->uTextureHeight = (signed __int16)v8->uTextureHeight >> 1; | 2881 v8->uTextureHeight = (signed __int16)v8->uTextureHeight >> 1; |
2882 v25 = v8->uTextureHeight; | 2882 v25 = v8->uTextureHeight; |
2892 } | 2892 } |
2893 else | 2893 else |
2894 { | 2894 { |
2895 v29 = *v16; | 2895 v29 = *v16; |
2896 v20 = pAllocator; | 2896 v20 = pAllocator; |
2897 v30 = pAllocator->AllocNamedChunk(v8->pLevelOfDetail0, v29, v8->pName); | 2897 v30 = pAllocator->AllocNamedChunk(v8->pLevelOfDetail0_prolly_alpha_mask, v29, v8->pName); |
2898 v31 = v8->uDecompressedSize; | 2898 v31 = v8->uDecompressedSize; |
2899 v8->pLevelOfDetail0 = (unsigned __int8 *)v30; | 2899 v8->pLevelOfDetail0_prolly_alpha_mask = (unsigned __int8 *)v30; |
2900 memcpy(v30, pContainer, v31); | 2900 memcpy(v30, pContainer, v31); |
2901 } | 2901 } |
2902 free((void *)pContainer); | 2902 free((void *)pContainer); |
2903 } | 2903 } |
2904 pAllocator->FreeChunk(v8->pPalette16); | 2904 pAllocator->FreeChunk(v8->pPalette16); |
2935 v8->pPalette16 = 0; | 2935 v8->pPalette16 = 0; |
2936 LABEL_36: | 2936 LABEL_36: |
2937 if ( v8->pBits & 2 ) | 2937 if ( v8->pBits & 2 ) |
2938 { | 2938 { |
2939 v34 = v8->uSizeOfMaxLevelOfDetail; | 2939 v34 = v8->uSizeOfMaxLevelOfDetail; |
2940 v35 = &v8->pLevelOfDetail0[v34]; | 2940 v35 = &v8->pLevelOfDetail0_prolly_alpha_mask[v34]; |
2941 v8->pLevelOfDetail1 = v35; | 2941 v8->pLevelOfDetail1 = v35; |
2942 v36 = &v35[v34 >> 2]; | 2942 v36 = &v35[v34 >> 2]; |
2943 v8->pLevelOfDetail2 = v36; | 2943 v8->pLevelOfDetail2 = v36; |
2944 v37 = &v36[v34 >> 4]; | 2944 v37 = &v36[v34 >> 4]; |
2945 } | 2945 } |