Mercurial > mm7
diff Engine/Tables/IconFrameTable.cpp @ 2575:a76d408c5132 tip
DrawTranslucent -> DrawTextureGrayShade
Removed old texture drawing stuff
author | a.parshin |
---|---|
date | Wed, 09 Mar 2016 01:39:52 +0200 |
parents | a902abdfc7f2 |
children |
line wrap: on
line diff
--- a/Engine/Tables/IconFrameTable.cpp Mon Mar 07 03:48:40 2016 +0200 +++ b/Engine/Tables/IconFrameTable.cpp Wed Mar 09 01:39:52 2016 +0200 @@ -5,33 +5,57 @@ #define _CRT_SECURE_NO_WARNINGS #include "Engine/Engine.h" +#include "Engine/Serialization/LegacyImages.h" #include "IconFrameTable.h" #include "../LOD.h" #include "FrameTableInc.h" + +Icon *IconFrameTable::GetIcon(unsigned int idx) +{ + if (idx < this->uNumIcons) + return &this->pIcons[idx]; + return nullptr; +} + +Icon *IconFrameTable::GetIcon(const char *pIconName) +{ + for (unsigned int i = 0; i < this->uNumIcons; i++) + { + if (!_stricmp(pIconName, this->pIcons[i].GetAnimationName())) + return &this->pIcons[i]; + } + return nullptr; +} + + + //----- (00494F3A) -------------------------------------------------------- unsigned int IconFrameTable::FindIcon(const char *pIconName) { for ( uint i = 0; i < (signed int)this->uNumIcons; i++ ) { - if ( !_stricmp(pIconName, this->pIcons[i].pAnimationName) ) + if ( !_stricmp(pIconName, this->pIcons[i].GetAnimationName()) ) return i; } return 0; } //----- (00494F70) -------------------------------------------------------- -IconFrame *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int uFrameID) +Icon *IconFrameTable::GetFrame(unsigned int uIconID, unsigned int frame_time) { int v6; // edx@3 uint i; - if ( this->pIcons[uIconID].uFlags & 1 && this->pIcons[uIconID].uAnimLength != 0 ) + if ( this->pIcons[uIconID].uFlags & 1 && this->pIcons[uIconID].GetAnimLength() != 0 ) { - v6 = ((signed int)uFrameID >> 3) % (unsigned __int16)this->pIcons[uIconID].uAnimLength; - for ( i = uIconID; v6 > this->pIcons[i].uAnimTime; i++ ) - v6 -= this->pIcons[i].uAnimTime; + int t = frame_time; + + t = (t /*/ 8*/) % (unsigned __int16)this->pIcons[uIconID].GetAnimLength(); + t /= 8; + for ( i = uIconID; t > this->pIcons[i].GetAnimTime(); i++ ) + t -= this->pIcons[i].GetAnimTime(); return &this->pIcons[i]; } else @@ -45,7 +69,8 @@ { for ( uint i = uIconID; ; ++i ) { - this->pIcons[i].uTextureID = pIcons_LOD->LoadTexture(this->pIcons[i].pTextureName, TEXTURE_16BIT_PALETTE); + //this->pIcons[i].uTextureID = pIcons_LOD->LoadTexture(this->pIcons[i].pTextureName, TEXTURE_16BIT_PALETTE); + this->pIcons[i].texture = assets->GetImage_16BitColorKey(this->pIcons[i].pTextureName, 0x7FF); if ( !(this->pIcons[i].uFlags & 1) ) break; } @@ -80,14 +105,24 @@ uNumIcons = num_mm6_frames + num_mm7_frames + num_mm8_frames; Assert(uNumIcons); + Assert(!num_mm6_frames); Assert(!num_mm8_frames); - pIcons = (IconFrame *)malloc(uNumIcons * sizeof(IconFrame)); - memcpy(pIcons, (char *)data_mm7 + 4, num_mm7_frames * sizeof(IconFrame)); - memcpy(pIcons + num_mm7_frames, (char *)data_mm6 + 4, num_mm6_frames * sizeof(IconFrame)); - memcpy(pIcons + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 4, num_mm8_frames * sizeof(IconFrame)); + IconFrame_MM7 *pIcons = (IconFrame_MM7 *)malloc(uNumIcons * sizeof(IconFrame_MM7)); + memcpy(pIcons, (char *)data_mm7 + 4, num_mm7_frames * sizeof(IconFrame_MM7)); + //memcpy(pIcons + num_mm7_frames, (char *)data_mm6 + 4, num_mm6_frames * sizeof(IconFrame_MM7)); + //memcpy(pIcons + num_mm6_frames + num_mm7_frames, (char *)data_mm8 + 4, num_mm8_frames * sizeof(IconFrame_MM7)); + + this->pIcons = new Icon[uNumIcons]; + for (unsigned int i = 0; i < uNumIcons; ++i) + { + pIcons[i].Deserialize(&this->pIcons[i]); + + this->pIcons[i].id = i; + } } +/* //----- (0049509D) -------------------------------------------------------- int IconFrameTable::FromFileTxt(const char *Args) { @@ -103,7 +138,7 @@ int v11; // ecx@21 int v12; // eax@22 signed int j; // edx@25 - IconFrame *v14; // ecx@26 + IconFrame_MM7 *v14; // ecx@26 int v15; // esi@26 int k; // eax@27 signed int result; // eax@11 @@ -144,7 +179,7 @@ } this->uNumIcons = v4; v5 = malloc(32 * v4);//, "I Frames"); - this->pIcons = (IconFrame *)v5; + this->pIcons = (IconFrame_MM7 *)v5; if ( v5 ) { v6 = File; @@ -210,9 +245,11 @@ result = 0; } return result; -} +}*/ + +/* //----- (0042EB78) -------------------------------------------------------- int IconFrameTable::GetIconAnimLength(unsigned int uIconID) { return 8 * this->pIcons[uIconID].uAnimLength; -} \ No newline at end of file +}*/ \ No newline at end of file