Mercurial > mm7
comparison Engine/LOD.cpp @ 2574:dd36326a9994
More texture refactoring
GetLeather -> DrawTextureCustomHeight
author | a.parshin |
---|---|
date | Mon, 07 Mar 2016 03:48:40 +0200 |
parents | d87bfbd3bb3b |
children | a76d408c5132 |
comparison
equal
deleted
inserted
replaced
2573:0c67be4ec900 | 2574:dd36326a9994 |
---|---|
1039 | 1039 |
1040 //----- (0040F9C5) -------------------------------------------------------- | 1040 //----- (0040F9C5) -------------------------------------------------------- |
1041 void LODFile_IconsBitmaps::SyncLoadedFilesCount() | 1041 void LODFile_IconsBitmaps::SyncLoadedFilesCount() |
1042 { | 1042 { |
1043 signed int loaded_files; // eax@1 | 1043 signed int loaded_files; // eax@1 |
1044 Texture *pTex; // edx@1 | 1044 Texture_MM7 *pTex; // edx@1 |
1045 | 1045 |
1046 loaded_files = this->uNumLoadedFiles; | 1046 loaded_files = this->uNumLoadedFiles; |
1047 for ( pTex = &this->pTextures[loaded_files]; !pTex->pName[0]; --pTex ) | 1047 for ( pTex = &this->pTextures[loaded_files]; !pTex->pName[0]; --pTex ) |
1048 --loaded_files; | 1048 --loaded_files; |
1049 if ( loaded_files < (signed int)this->uNumLoadedFiles ) | 1049 if ( loaded_files < (signed int)this->uNumLoadedFiles ) |
1141 { | 1141 { |
1142 /*v2 = v1->pTextures; | 1142 /*v2 = v1->pTextures; |
1143 v3 = 1000; | 1143 v3 = 1000; |
1144 do | 1144 do |
1145 { | 1145 { |
1146 Texture::Texture(v2); | 1146 Texture_MM7::Texture_MM7(v2); |
1147 ++v2; | 1147 ++v2; |
1148 --v3; | 1148 --v3; |
1149 } | 1149 } |
1150 while ( v3 );*/ | 1150 while ( v3 );*/ |
1151 this->uTexturePacksCount = 0; | 1151 this->uTexturePacksCount = 0; |
1730 this->uTextureRedBits = uTargetRBits; | 1730 this->uTextureRedBits = uTargetRBits; |
1731 this->uTextureGreenBits = uTargetGBits; | 1731 this->uTextureGreenBits = uTargetGBits; |
1732 this->uTextureBlueBits = uTargetBBits; | 1732 this->uTextureBlueBits = uTargetBBits; |
1733 for ( uint i = 0; i < this->uNumLoadedFiles; ++i ) | 1733 for ( uint i = 0; i < this->uNumLoadedFiles; ++i ) |
1734 { | 1734 { |
1735 Texture DstBuf; // [sp+4h] [bp-50h]@6 | 1735 Texture_MM7 DstBuf; // [sp+4h] [bp-50h]@6 |
1736 //Texture::Texture(&DstBuf); | 1736 //Texture_MM7::Texture_MM7(&DstBuf); |
1737 if ( this->pTextures[i].pPalette16 ) | 1737 if ( this->pTextures[i].pPalette16 ) |
1738 { | 1738 { |
1739 File = FindContainer((const char *)this->pTextures[i].pName, 0); | 1739 File = FindContainer((const char *)this->pTextures[i].pName, 0); |
1740 if ( File ) | 1740 if ( File ) |
1741 { | 1741 { |
1762 void *LOD::File::LoadRaw(const char *pContainer, int a3) | 1762 void *LOD::File::LoadRaw(const char *pContainer, int a3) |
1763 { | 1763 { |
1764 FILE *File; // eax@1 | 1764 FILE *File; // eax@1 |
1765 void *v7; // ebx@7 | 1765 void *v7; // ebx@7 |
1766 void *v8; // edi@7 | 1766 void *v8; // edi@7 |
1767 Texture DstBuf; // [sp+Ch] [bp-4Ch]@1 | 1767 Texture_MM7 DstBuf; // [sp+Ch] [bp-4Ch]@1 |
1768 | 1768 |
1769 File = FindContainer(pContainer, 0); | 1769 File = FindContainer(pContainer, 0); |
1770 if ( !File ) | 1770 if ( !File ) |
1771 Error("Unable to load %s", pContainer); | 1771 Error("Unable to load %s", pContainer); |
1772 | 1772 |
1793 } | 1793 } |
1794 return v7; | 1794 return v7; |
1795 } | 1795 } |
1796 | 1796 |
1797 //----- (00410522) -------------------------------------------------------- | 1797 //----- (00410522) -------------------------------------------------------- |
1798 int LODFile_IconsBitmaps::_410522(Texture *pDst, const char *pContainer, unsigned int uTextureType) | 1798 int LODFile_IconsBitmaps::_410522(Texture_MM7 *pDst, const char *pContainer, unsigned int uTextureType) |
1799 { | 1799 { |
1800 void *v9; // ST2C_4@6 | 1800 void *v9; // ST2C_4@6 |
1801 int v15; // ecx@12 | 1801 int v15; // ecx@12 |
1802 int v16; // ecx@12 | 1802 int v16; // ecx@12 |
1803 int v17; // eax@12 | 1803 int v17; // eax@12 |
2053 } | 2053 } |
2054 } | 2054 } |
2055 } | 2055 } |
2056 | 2056 |
2057 //----- (004101B1) -------------------------------------------------------- | 2057 //----- (004101B1) -------------------------------------------------------- |
2058 int LODFile_IconsBitmaps::ReloadTexture(Texture *pDst, const char *pContainer, int mode) | 2058 int LODFile_IconsBitmaps::ReloadTexture(Texture_MM7 *pDst, const char *pContainer, int mode) |
2059 { | 2059 { |
2060 Texture *v6; // esi@2 | 2060 Texture_MM7 *v6; // esi@2 |
2061 unsigned int v7; // ebx@6 | 2061 unsigned int v7; // ebx@6 |
2062 unsigned int v8; // ecx@6 | 2062 unsigned int v8; // ecx@6 |
2063 signed int result; // eax@7 | 2063 signed int result; // eax@7 |
2064 FILE *File; // [sp+Ch] [bp-8h]@1 | 2064 FILE *File; // [sp+Ch] [bp-8h]@1 |
2065 unsigned __int8 v15; // [sp+11h] [bp-3h]@13 | 2065 unsigned __int8 v15; // [sp+11h] [bp-3h]@13 |
2111 result = -1; | 2111 result = -1; |
2112 return result; | 2112 return result; |
2113 } | 2113 } |
2114 | 2114 |
2115 //----- (0040FC08) -------------------------------------------------------- | 2115 //----- (0040FC08) -------------------------------------------------------- |
2116 int LODFile_IconsBitmaps::LoadTextureFromLOD(Texture *pOutTex, const char *pContainer, enum TEXTURE_TYPE eTextureType) | 2116 int LODFile_IconsBitmaps::LoadTextureFromLOD(Texture_MM7 *pOutTex, const char *pContainer, enum TEXTURE_TYPE eTextureType) |
2117 { | 2117 { |
2118 Texture *v8; // esi@3 | 2118 Texture_MM7 *v8; // esi@3 |
2119 enum TEXTURE_TYPE v12; // eax@14 | 2119 enum TEXTURE_TYPE v12; // eax@14 |
2120 signed int result; // esi@14 | 2120 signed int result; // esi@14 |
2121 unsigned int v14; // eax@21 | 2121 unsigned int v14; // eax@21 |
2122 void *v19; // ST3C_4@27 | 2122 void *v19; // ST3C_4@27 |
2123 size_t v22; // ST2C_4@29 | 2123 size_t v22; // ST2C_4@29 |
2181 zlib::MemUnzip((void *)pContainer, &v8->uDecompressedSize, v19, v8->uTextureSize); | 2181 zlib::MemUnzip((void *)pContainer, &v8->uDecompressedSize, v19, v8->uTextureSize); |
2182 v8->uTextureSize = v8->uDecompressedSize; | 2182 v8->uTextureSize = v8->uDecompressedSize; |
2183 free(v19); | 2183 free(v19); |
2184 if ( /*bUseLoResSprites*/false && v8->pBits & 2 ) | 2184 if ( /*bUseLoResSprites*/false && v8->pBits & 2 ) |
2185 { | 2185 { |
2186 pOutTex = (Texture *)(((signed int)v8->uSizeOfMaxLevelOfDetail >> 2) | 2186 pOutTex = (Texture_MM7 *)(((signed int)v8->uSizeOfMaxLevelOfDetail >> 2) |
2187 + ((signed int)v8->uSizeOfMaxLevelOfDetail >> 4) | 2187 + ((signed int)v8->uSizeOfMaxLevelOfDetail >> 4) |
2188 + ((signed int)v8->uSizeOfMaxLevelOfDetail >> 6)); | 2188 + ((signed int)v8->uSizeOfMaxLevelOfDetail >> 6)); |
2189 v22 = (size_t)pOutTex; | 2189 v22 = (size_t)pOutTex; |
2190 v23 = &pContainer[v8->uTextureWidth * v8->uTextureHeight]; | 2190 v23 = &pContainer[v8->uTextureWidth * v8->uTextureHeight]; |
2191 v8->paletted_pixels = (unsigned __int8 *)malloc((unsigned int)pOutTex); | 2191 v8->paletted_pixels = (unsigned __int8 *)malloc((unsigned int)pOutTex); |
2337 return 1; | 2337 return 1; |
2338 } | 2338 } |
2339 return 1; | 2339 return 1; |
2340 } | 2340 } |
2341 | 2341 |
2342 Texture *LODFile_IconsBitmaps::LoadTexturePtr(const char *pContainer, enum TEXTURE_TYPE uTextureType) | 2342 Texture_MM7 *LODFile_IconsBitmaps::LoadTexturePtr(const char *pContainer, enum TEXTURE_TYPE uTextureType) |
2343 { | 2343 { |
2344 uint id = LoadTexture(pContainer, uTextureType); | 2344 uint id = LoadTexture(pContainer, uTextureType); |
2345 | 2345 |
2346 Assert(id != -1 && L"Texture not found"); | 2346 Assert(id != -1 && L"Texture_MM7 not found"); |
2347 | 2347 |
2348 return &pTextures[id]; | 2348 return &pTextures[id]; |
2349 } | 2349 } |
2350 | 2350 |
2351 //----- (0040FB20) -------------------------------------------------------- | 2351 //----- (0040FB20) -------------------------------------------------------- |
2391 // goto LABEL_5; | 2391 // goto LABEL_5; |
2392 // } | 2392 // } |
2393 // return v4; | 2393 // return v4; |
2394 } | 2394 } |
2395 | 2395 |
2396 Texture * LODFile_IconsBitmaps::GetTexture( int idx ) | 2396 Texture_MM7 * LODFile_IconsBitmaps::GetTexture( int idx ) |
2397 { | 2397 { |
2398 Assert(idx < MAX_LOD_TEXTURES, "Texture index out of bounds (%u)", idx); | 2398 Assert(idx < MAX_LOD_TEXTURES, "Texture_MM7 index out of bounds (%u)", idx); |
2399 if (idx == -1) | 2399 if (idx == -1) |
2400 { | 2400 { |
2401 //Log::Warning(L"Texture id = %d missing", idx); | 2401 //Log::Warning(L"Texture_MM7 id = %d missing", idx); |
2402 return pTextures + LoadDummyTexture(); | 2402 return pTextures + LoadDummyTexture(); |
2403 } | 2403 } |
2404 return pTextures + idx; | 2404 return pTextures + idx; |
2405 } | 2405 } |
2406 | 2406 |