summaryrefslogtreecommitdiff
path: root/ZAPD/OtherStructs/SkinLimbStructs.h
blob: fd26f4d6ec37d4fddea22ade692e37939d318813 (plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#pragma once

#include <cstdint>
#include <string>
#include <vector>

#include "ZResource.h"
#include "ZDisplayList.h"

enum class ZLimbSkinType
{
	SkinType_Null,          // SkinLimb segment = NULL
	SkinType_Animated = 4,  // SkinLimb segment = SkinAnimatedLimbData*
	SkinType_Normal = 11,   // SkinLimb segment = Gfx*
};

class SkinVertex : public ZResource
{
public:
	SkinVertex(ZFile* nParent);

	void ParseRawData() override;

	std::string GetBodySourceCode() const override;

	std::string GetSourceTypeName() const override;
	ZResourceType GetResourceType() const override;

	size_t GetRawDataSize() const override;

public:
	uint16_t index;
	int16_t s;
	int16_t t;
	int8_t normX;
	int8_t normY;
	int8_t normZ;
	uint8_t alpha;
};

class SkinTransformation : public ZResource
{
public:
	SkinTransformation(ZFile* nParent);

	void ParseRawData() override;

	std::string GetBodySourceCode() const override;

	std::string GetSourceTypeName() const override;
	ZResourceType GetResourceType() const override;

	size_t GetRawDataSize() const override;

public:
	uint8_t limbIndex;
	int16_t x;
	int16_t y;
	int16_t z;
	uint8_t scale;
};

class SkinLimbModif : public ZResource
{
public:
	SkinLimbModif(ZFile* nParent);

	void ParseRawData() override;
	void DeclareReferences(const std::string& prefix) override;

	std::string GetBodySourceCode() const override;

	std::string GetSourceTypeName() const override;
	ZResourceType GetResourceType() const override;

	size_t GetRawDataSize() const override;
	
	uint16_t vtxCount;				// Number of vertices in this modif entry
	uint16_t transformCount;		// Length of limbTransformations
	uint16_t unk_4;					// 0 or 1, used as an index for limbTransformations
	segptr_t skinVertices;			// SkinVertex*
	segptr_t limbTransformations;	// SkinTransformation*

	std::vector<SkinVertex> skinVertices_arr;
	std::vector<SkinTransformation> limbTransformations_arr;
};

class SkinAnimatedLimbData : public ZResource
{
public:
	SkinAnimatedLimbData(ZFile* nParent);

	void ParseRawData() override;
	void DeclareReferences(const std::string& prefix) override;

	std::string GetBodySourceCode() const override;

	std::string GetSourceTypeName() const override;
	ZResourceType GetResourceType() const override;

	size_t GetRawDataSize() const override;

public:
	uint16_t totalVtxCount = 0;
	uint16_t limbModifCount;     // Length of limbModifications
	segptr_t limbModifications;  // SkinLimbModif*
	segptr_t dlist = SEGMENTED_NULL;  // Gfx*

	std::vector<SkinLimbModif> limbModifications_arr;
	// ZDisplayList* unk_8_dlist = nullptr;
};