Skip to content

Commit 9d40e32

Browse files
committed
Add zone property structs
1 parent ec9f760 commit 9d40e32

File tree

1 file changed

+159
-0
lines changed

1 file changed

+159
-0
lines changed
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
#pragma once
2+
#include "common/Typedefs.h"
3+
#include "types/Vec3.h"
4+
#include "types/Mat3.h"
5+
6+
/* This file has some data structures stored in RFG zone object properties */
7+
8+
//Used by DistrictFlags properties
9+
enum class DistrictFlags : u8
10+
{
11+
None = 0,
12+
AllowCough = 1,
13+
AllowAmbEdfCivilianDump = 2,
14+
PlayCapstoneUnlockedLines = 4,
15+
DisableMoraleChange = 8,
16+
DisableControlChange = 16,
17+
};
18+
19+
//For path_road_struct property. Actual data stored in path_road_data buffer property
20+
struct RoadSplineHeader
21+
{
22+
i32 NumPoints;
23+
u32 PointsOffset;
24+
i32 NumConnections;
25+
u32 ConnectionsOffset;
26+
};
27+
28+
//navpoint_data property
29+
enum class NavpointBranchType : i32
30+
{
31+
None = 0,
32+
Start = 1,
33+
Bridge = 2,
34+
End = 3
35+
};
36+
37+
struct NavpointData
38+
{
39+
i32 Version;
40+
i32 Type;
41+
bool DontFollowRoad;
42+
f32 Radius;
43+
f32 SpeedLimit;
44+
bool IgnoreLanes;
45+
NavpointBranchType BranchType;
46+
};
47+
static_assert(sizeof(NavpointData) == 28, "sizeof(NavpointData) must be 28 bytes for zone serialization to work");
48+
49+
//covernode_data property
50+
struct CovernodeData
51+
{
52+
i32 Version;
53+
f32 Heading;
54+
i8 DefaultAngleLeft;
55+
i8 DefaultAngleRight;
56+
i8 AngleLeft;
57+
i8 AngleRight;
58+
u16 Flags;
59+
};
60+
static_assert(sizeof(CovernodeData) == 16, "sizeof(CovernodeData) must be 16 bytes for zone serialization to work");
61+
62+
//Physics constraint data
63+
enum class ConstraintType : u32
64+
{
65+
None = 0xFFFFFFFF,
66+
Point = 0,
67+
Hinge = 1,
68+
Prismatic = 2,
69+
Ragdoll = 3,
70+
Motor = 4,
71+
Fake = 5
72+
};
73+
74+
struct PointConstraintData
75+
{
76+
i32 Type;
77+
f32 xLimitMin;
78+
f32 xLimitMax;
79+
f32 yLimitMin;
80+
f32 yLimitMax;
81+
f32 zLimitMin;
82+
f32 zLimitMax;
83+
f32 StiffSpringLength;
84+
};
85+
constexpr size_t a3 = sizeof(PointConstraintData);
86+
87+
struct HingeConstraintData
88+
{
89+
i32 Limited;
90+
f32 LimitMinAngle;
91+
f32 LimitMaxAngle;
92+
f32 LimitFriction;
93+
};
94+
95+
struct PrismaticConstraintData
96+
{
97+
i32 Limited;
98+
f32 LimitMinAngle;
99+
f32 LimitMaxAngle;
100+
f32 LimitFriction;
101+
};
102+
103+
struct RagdollConstraintData
104+
{
105+
f32 TwistMin;
106+
f32 TwistMax;
107+
f32 ConeMin;
108+
f32 ConeMax;
109+
f32 PlaneMin;
110+
f32 PlaneMax;
111+
};
112+
113+
struct MotorConstraintData
114+
{
115+
f32 AngularSpeed;
116+
f32 Gain;
117+
i32 Axis;
118+
f32 AxisInBodySpaceX;
119+
f32 AxisInBodySpaceY;
120+
f32 AxisInBodySpaceZ;
121+
};
122+
123+
struct FakeConstraintData
124+
{
125+
126+
};
127+
128+
union ConstraintTemplateData
129+
{
130+
PointConstraintData Point;
131+
HingeConstraintData Hinge;
132+
PrismaticConstraintData Prismatic;
133+
RagdollConstraintData Ragdoll;
134+
MotorConstraintData Motor;
135+
FakeConstraintData Fake;
136+
};
137+
138+
struct ConstraintTemplate
139+
{
140+
ConstraintType Type;
141+
142+
//Body 1
143+
u32 Unused0;
144+
u32 Unused1;
145+
u32 Body1Index;
146+
Mat3 Body1Orient;
147+
Vec3 Body1Pos;
148+
149+
//Body 2
150+
u32 Unused2;
151+
u32 Body2Index;
152+
Mat3 Body2Orient;
153+
Vec3 Body2Pos;
154+
155+
f32 Threshold;
156+
ConstraintTemplateData Data;
157+
};
158+
159+
static_assert(sizeof(ConstraintTemplate) == 156, "ConstraintTemplate must be 156 bytes for zone property serialization to work correctly.");

0 commit comments

Comments
 (0)