|
5 | 5 | #include "FileLoader.h"
|
6 | 6 | #include <vector>
|
7 | 7 |
|
8 |
| -#define ROUNDSIZE(x) if((x) & 3) (x) += 4 - ((x)&3) // credits to github.com/aap for the great macro |
9 |
| -#define IFP_TOTAL_SEQUENCES 32 // 32 because there are 32 bones in a ped model |
10 |
| - |
11 |
| - |
12 |
| -struct IFP_BASE |
13 |
| -{ |
14 |
| - char FourCC[4]; |
15 |
| - uint32_t Size; |
16 |
| -}; |
17 |
| - |
18 |
| -struct IFP_INFO |
19 |
| -{ |
20 |
| - IFP_BASE Base; |
21 |
| - int32_t Entries; |
22 |
| - char Name[24]; |
23 |
| -}; |
24 |
| - |
25 |
| -struct IFP_ANPK |
26 |
| -{ |
27 |
| - IFP_BASE Base; |
28 |
| - IFP_INFO Info; |
29 |
| -}; |
30 |
| - |
31 |
| -struct IFP_NAME |
32 |
| -{ |
33 |
| - IFP_BASE Base; |
34 |
| -}; |
35 |
| - |
36 |
| -struct IFP_DGAN |
37 |
| -{ |
38 |
| - IFP_BASE Base; |
39 |
| - IFP_INFO Info; |
40 |
| -}; |
41 |
| - |
42 |
| -struct IFP_CPAN |
43 |
| -{ |
44 |
| - IFP_BASE Base; |
45 |
| -}; |
46 |
| - |
47 |
| -struct IFP_ANIM |
48 |
| -{ |
49 |
| - IFP_BASE Base; |
50 |
| - char Name[28]; |
51 |
| - int32_t Frames; |
52 |
| - int32_t Unk; |
53 |
| - int32_t Next; |
54 |
| - int32_t Previous; |
55 |
| - |
56 |
| - // According to https://www.gtamodding.com/wiki/IFP, Unk2 should not exist, but for some reason, it's there |
57 |
| - // I don't know why. Let's just go with the flow and ignore it. The value "seems" to be always zero. |
58 |
| - int32_t Unk2; |
59 |
| -}; |
60 |
| - |
61 |
| -struct IFP_KFRM |
62 |
| -{ |
63 |
| - IFP_BASE Base; |
64 |
| -}; |
65 |
| - |
66 |
| -struct Quaternion |
67 |
| -{ |
68 |
| - float X, Y, Z, W; |
69 |
| -}; |
70 |
| - |
71 |
| -struct IFP_CVector |
72 |
| -{ |
73 |
| - float X, Y, Z; |
74 |
| -}; |
75 |
| - |
76 |
| -struct IFP_KR00 |
77 |
| -{ |
78 |
| - Quaternion Rotation; |
79 |
| - float Time; |
80 |
| -}; |
81 |
| - |
82 |
| -struct IFP_KRT0 |
83 |
| -{ |
84 |
| - Quaternion Rotation; |
85 |
| - IFP_CVector Translation; |
86 |
| - float Time; |
87 |
| -}; |
88 |
| - |
89 |
| -struct IFP_KRTS |
90 |
| -{ |
91 |
| - Quaternion Rotation; |
92 |
| - IFP_CVector Translation; |
93 |
| - IFP_CVector Scale; |
94 |
| - float Time; |
95 |
| -}; |
96 |
| - |
97 |
| -struct CompressedQuaternion |
98 |
| -{ |
99 |
| - int16_t X, Y, Z, W; |
100 |
| -}; |
101 |
| - |
102 |
| -struct CompressedCVector |
103 |
| -{ |
104 |
| - int16_t X, Y, Z; |
105 |
| -}; |
106 |
| - |
107 |
| - |
108 |
| -struct IFP_Compressed_KR00 |
109 |
| -{ |
110 |
| - CompressedQuaternion Rotation; |
111 |
| - int16_t Time; |
112 |
| -}; |
113 |
| - |
114 |
| -struct IFP_Compressed_KRT0 : IFP_Compressed_KR00 |
115 |
| -{ |
116 |
| - CompressedCVector Translation; |
117 |
| -}; |
118 |
| - |
119 |
| - |
120 |
| -enum IFP_FrameType |
121 |
| -{ |
122 |
| - UNKNOWN_FRAME = -1, |
123 |
| - KR00 = 0, |
124 |
| - KRT0 = 1, |
125 |
| - KRTS = 2 |
126 |
| -}; |
127 |
| - |
128 |
| -struct IFPHeaderV2 |
129 |
| -{ |
130 |
| - int32_t OffsetEOF; |
131 |
| - char InternalFileName[24]; |
132 |
| - int32_t TotalAnimations; |
133 |
| -}; |
134 |
| - |
135 |
| -struct IFP_Animation |
136 |
| -{ |
137 |
| - SString Name; |
138 |
| - _CAnimBlendHierarchy Hierarchy; |
139 |
| - char * pSequencesMemory; |
140 |
| -}; |
141 |
| - |
142 |
| -struct Animation |
143 |
| -{ |
144 |
| - // 24 + 4 + 4 + 4 = 36 bytes |
145 |
| - |
146 |
| - char Name[24]; |
147 |
| - int32_t TotalObjects; |
148 |
| - int32_t FrameSize; |
149 |
| - int32_t isCompressed; // The value is always 1 |
150 |
| -}; |
151 |
| - |
152 |
| - |
153 |
| -struct Object |
154 |
| -{ |
155 |
| - // 24 + 4 + 4 + 4 = 36 bytes |
156 |
| - |
157 |
| - char Name[24]; |
158 |
| - int32_t FrameType; |
159 |
| - int32_t TotalFrames; |
160 |
| - int32_t BoneID; |
161 |
| -}; |
162 |
| - |
163 |
| -struct IFP2_ChildFrame |
164 |
| -{ |
165 |
| - int16_t x, y, z, w, time; |
166 |
| -}; |
167 |
| - |
168 |
| -enum BoneType |
169 |
| -{ |
170 |
| - NORMAL = 0, // Normal or Root, both are same |
171 |
| - PELVIS = 1, |
172 |
| - SPINE = 2, |
173 |
| - SPINE1 = 3, |
174 |
| - NECK = 4, |
175 |
| - HEAD = 5, |
176 |
| - JAW = 8, |
177 |
| - L_BROW = 6, |
178 |
| - R_BROW = 7, |
179 |
| - L_CLAVICLE = 31, |
180 |
| - L_UPPER_ARM = 32, |
181 |
| - L_FORE_ARM = 33, |
182 |
| - L_HAND = 34, |
183 |
| - L_FINGER = 35, |
184 |
| - L_FINGER_01 = 36, |
185 |
| - R_CLAVICLE = 21, |
186 |
| - R_UPPER_ARM = 22, |
187 |
| - R_FORE_ARM = 23, |
188 |
| - R_HAND = 24, |
189 |
| - R_FINGER = 25, |
190 |
| - R_FINGER_01 = 26, |
191 |
| - L_BREAST = 302, |
192 |
| - R_BREAST = 301, |
193 |
| - BELLY = 201, |
194 |
| - L_THIGH = 41, |
195 |
| - L_CALF = 42, |
196 |
| - L_FOOT = 43, |
197 |
| - L_TOE_0 = 44, |
198 |
| - R_THIGH = 51, |
199 |
| - R_CALF = 52, |
200 |
| - R_FOOT = 53, |
201 |
| - R_TOE_0 = 54 |
202 |
| -}; |
203 | 8 |
|
204 | 9 | typedef void *(__cdecl* hCMemoryMgr_Malloc)
|
205 | 10 | (
|
|
0 commit comments