mirror of
https://github.com/AxioDL/PrimeWorldEditor.git
synced 2025-07-02 19:26:03 +00:00
SScanParametersMP1: Make use of std::array
This commit is contained in:
parent
665d1f3560
commit
4a9695a698
@ -613,31 +613,33 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||||||
debugf("Processing scans");
|
debugf("Processing scans");
|
||||||
for (TResourceIterator<EResourceType::Scan> It(pStore); It; ++It)
|
for (TResourceIterator<EResourceType::Scan> It(pStore); It; ++It)
|
||||||
{
|
{
|
||||||
if (It->IsNamed()) continue;
|
if (It->IsNamed())
|
||||||
CScan *pScan = (CScan*) It->Load();
|
continue;
|
||||||
|
|
||||||
|
auto* pScan = static_cast<CScan*>(It->Load());
|
||||||
TString ScanName;
|
TString ScanName;
|
||||||
|
|
||||||
if (ScanName.IsEmpty())
|
if (ScanName.IsEmpty())
|
||||||
{
|
{
|
||||||
CAssetID StringID = pScan->ScanStringPropertyRef().Get();
|
const CAssetID StringID = pScan->ScanStringPropertyRef().Get();
|
||||||
CStringTable *pString = (CStringTable*) gpResourceStore->LoadResource(StringID, EResourceType::StringTable);
|
if (const auto* pString = static_cast<CStringTable*>(gpResourceStore->LoadResource(StringID, EResourceType::StringTable)))
|
||||||
if (pString) ScanName = pString->Entry()->Name();
|
ScanName = pString->Entry()->Name();
|
||||||
}
|
}
|
||||||
|
|
||||||
ApplyGeneratedName(pScan->Entry(), It->DirectoryPath(), ScanName);
|
ApplyGeneratedName(pScan->Entry(), It->DirectoryPath(), ScanName);
|
||||||
|
|
||||||
if (!ScanName.IsEmpty() && pProj->Game() <= EGame::Prime)
|
if (!ScanName.IsEmpty() && pProj->Game() <= EGame::Prime)
|
||||||
{
|
{
|
||||||
const SScanParametersMP1& kParms = *static_cast<SScanParametersMP1*>(pScan->ScanData().DataPointer());
|
const auto& kParms = *static_cast<SScanParametersMP1*>(pScan->ScanData().DataPointer());
|
||||||
|
|
||||||
CResourceEntry *pEntry = pStore->FindEntry(kParms.GuiFrame);
|
if (CResourceEntry* pEntry = pStore->FindEntry(kParms.GuiFrame))
|
||||||
if (pEntry) ApplyGeneratedName(pEntry, pEntry->DirectoryPath(), "ScanFrame");
|
ApplyGeneratedName(pEntry, pEntry->DirectoryPath(), "ScanFrame");
|
||||||
|
|
||||||
for (uint32 iImg = 0; iImg < 4; iImg++)
|
for (size_t iImg = 0; iImg < kParms.ScanImages.size(); iImg++)
|
||||||
{
|
{
|
||||||
CAssetID ImageID = kParms.ScanImages[iImg].Texture;
|
const CAssetID ImageID = kParms.ScanImages[iImg].Texture;
|
||||||
CResourceEntry *pImgEntry = pStore->FindEntry(ImageID);
|
if (CResourceEntry* pImgEntry = pStore->FindEntry(ImageID))
|
||||||
if (pImgEntry) ApplyGeneratedName(pImgEntry, pImgEntry->DirectoryPath(), TString::Format("%s_Image%d", *ScanName, iImg));
|
ApplyGeneratedName(pImgEntry, pImgEntry->DirectoryPath(), TString::Format("%s_Image%zu", *ScanName, iImg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -648,15 +650,12 @@ void GenerateAssetNames(CGameProject *pProj)
|
|||||||
debugf("Processing fonts");
|
debugf("Processing fonts");
|
||||||
for (TResourceIterator<EResourceType::Font> It(pStore); It; ++It)
|
for (TResourceIterator<EResourceType::Font> It(pStore); It; ++It)
|
||||||
{
|
{
|
||||||
CFont *pFont = (CFont*) It->Load();
|
if (auto* pFont = static_cast<CFont*>(It->Load()))
|
||||||
|
|
||||||
if (pFont)
|
|
||||||
{
|
{
|
||||||
ApplyGeneratedName(pFont->Entry(), pFont->Entry()->DirectoryPath(), pFont->FontName());
|
ApplyGeneratedName(pFont->Entry(), pFont->Entry()->DirectoryPath(), pFont->FontName());
|
||||||
|
|
||||||
CTexture *pFontTex = pFont->Texture();
|
|
||||||
|
|
||||||
if (pFontTex)
|
if (CTexture* pFontTex = pFont->Texture())
|
||||||
ApplyGeneratedName(pFontTex->Entry(), pFont->Entry()->DirectoryPath(), pFont->Entry()->Name() + "_tex");
|
ApplyGeneratedName(pFontTex->Entry(), pFont->Entry()->DirectoryPath(), pFont->Entry()->Name() + "_tex");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "ELogbookCategory.h"
|
#include "ELogbookCategory.h"
|
||||||
#include <Common/Common.h>
|
#include <Common/Common.h>
|
||||||
|
#include <array>
|
||||||
|
|
||||||
/** Struct mapping to SCAN property layout in MP1 */
|
/** Struct mapping to SCAN property layout in MP1 */
|
||||||
enum class EScanSpeed
|
enum class EScanSpeed
|
||||||
@ -54,7 +55,7 @@ struct SScanParametersMP1
|
|||||||
EScanSpeed Speed;
|
EScanSpeed Speed;
|
||||||
ELogbookCategory LogbookCategory;
|
ELogbookCategory LogbookCategory;
|
||||||
bool IsCritical;
|
bool IsCritical;
|
||||||
SScanImage ScanImages[4];
|
std::array<SScanImage, 4> ScanImages;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SSCANPARAMETERSMP1_H
|
#endif // SSCANPARAMETERSMP1_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user