1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#include "ZSurfaceType.h"
#include "Globals.h"
#include "Utils/BitConverter.h"
#include <ship/utils/StringHelper.h>
REGISTER_ZFILENODE(SurfaceType, ZSurfaceType);
ZSurfaceType::ZSurfaceType(ZFile* nParent) : ZResource(nParent)
{
}
ZSurfaceType::~ZSurfaceType()
{
}
void ZSurfaceType::ParseRawData()
{
const auto& rawData = parent->GetRawData();
data[0] = BitConverter::ToUInt32BE(rawData, rawDataIndex + 0);
data[1] = BitConverter::ToUInt32BE(rawData, rawDataIndex + 4);
}
void ZSurfaceType::DeclareReferences(const std::string& prefix)
{
std::string declaration;
std::string auxName = name;
if (name == "")
auxName = GetDefaultName(prefix);
parent->AddDeclaration(rawDataIndex, DeclarationAlignment::Align4, GetRawDataSize(),
GetSourceTypeName(), name.c_str(), GetBodySourceCode());
}
std::string ZSurfaceType::GetBodySourceCode() const
{
return StringHelper::Sprintf("{0x%08X, 0x%08X}", data[0], data[1]);
}
std::string ZSurfaceType::GetDefaultName(const std::string& prefix) const
{
return StringHelper::Sprintf("%sSurfaceType_%06X", prefix.c_str(), rawDataIndex);
}
ZResourceType ZSurfaceType::GetResourceType() const
{
return ZResourceType::SurfaceType;
}
size_t ZSurfaceType::GetRawDataSize() const
{
return 8;
}
std::string ZSurfaceType::GetSourceTypeName() const
{
return "SurfaceType";
}
bool ZSurfaceType::DoesSupportArray() const
{
return true;
}
|