Skip to content

Commit 8a8d282

Browse files
committed
Added InheritsAngularVel to Emissions, unclamped it and InheritsVel so they can have any float value
1 parent 0edb67e commit 8a8d282

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

Source/Entities/AEmitter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ void AEmitter::Update() {
479479
emitVel = RotateOffset(emitVel);
480480
pParticle->SetVel(parentVel + rotationalVel + emitVel);
481481
pParticle->SetRotAngle(emitVel.GetAbsRadAngle() + (m_HFlipped ? -c_PI : 0));
482-
pParticle->SetAngularVel(pRootParent->GetAngularVel() * emission.InheritsVelocity());
482+
pParticle->SetAngularVel(pRootParent->GetAngularVel() * emission.InheritsAngularVelocity());
483483
pParticle->SetHFlipped(m_HFlipped);
484484

485485
// Scale the particle's lifetime based on life variation and throttle, as long as it's not 0

Source/Entities/Emission.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ void Emission::Clear() {
1717
m_MaxVelocity = 0;
1818
m_LifeVariation = 0.1;
1919
m_PushesEmitter = true;
20-
m_InheritsVel = 0;
20+
m_InheritsVel = 0.0F;
21+
m_InheritsAngularVel = 0.0F;
2122
m_StartTimer.SetSimTimeLimitMS(0);
2223
m_StartTimer.Reset();
2324
m_StopTimer.SetSimTimeLimitMS(1000000);
@@ -47,6 +48,7 @@ int Emission::Create(const Emission& reference) {
4748
m_LifeVariation = reference.m_LifeVariation;
4849
m_PushesEmitter = reference.m_PushesEmitter;
4950
m_InheritsVel = reference.m_InheritsVel;
51+
m_InheritsAngularVel = reference.m_InheritsAngularVel;
5052
m_StartTimer = reference.m_StartTimer;
5153
m_StopTimer = reference.m_StopTimer;
5254
m_Offset = reference.m_Offset;
@@ -72,11 +74,8 @@ int Emission::ReadProperty(const std::string_view& propName, Reader& reader) {
7274
MatchProperty("PushesEmitter", { reader >> m_PushesEmitter; });
7375
MatchProperty("Offset", { reader >> m_Offset; });
7476
MatchProperty("ParticleCount", { reader >> m_ParticleCount; });
75-
MatchProperty("InheritsVel",
76-
{
77-
reader >> m_InheritsVel;
78-
Clamp(m_InheritsVel, 1, 0);
79-
});
77+
MatchProperty("InheritsVel", { reader >> m_InheritsVel; });
78+
MatchProperty("InheritsAngularVel", { reader >> m_InheritsAngularVel; });
8079
MatchProperty("StartTimeMS",
8180
{
8281
double startTime;
@@ -114,6 +113,8 @@ int Emission::Save(Writer& writer) const {
114113
writer << m_PushesEmitter;
115114
writer.NewProperty("InheritsVel");
116115
writer << m_InheritsVel;
116+
writer.NewProperty("InheritsAngularVel");
117+
writer << m_InheritsAngularVel;
117118
writer.NewProperty("Offset");
118119
writer << m_Offset;
119120
writer.NewProperty("StartTimeMS");

Source/Entities/Emission.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ namespace RTE {
118118
/// @return The proportion of the velocity inherited. 0.1 = 10% inheritance.
119119
float InheritsVelocity() { return m_InheritsVel; }
120120

121+
/// How much of the root parent's angular velocity this emission inherit
122+
/// @return The proportion of the angular velocity inherited. 0.1 = 10% inheritance.
123+
float InheritsAngularVelocity() { return m_InheritsAngularVel; }
124+
121125
/// Gets offset of the emission point from Emitter's sprite center, which gets rotated with owner Emitter
122126
/// @return Returns emission offset.
123127
Vector GetOffset() const { return m_Offset; }
@@ -165,6 +169,8 @@ namespace RTE {
165169
bool m_PushesEmitter;
166170
// How much of the parents velocity this emission inherits
167171
float m_InheritsVel;
172+
// How much of the parents angular velocity this emission inherits
173+
float m_InheritsAngularVel;
168174
// Timers for measuring when to start and stop this emission the actual times are the set time limits of these
169175
Timer m_StartTimer;
170176
Timer m_StopTimer;

0 commit comments

Comments
 (0)