Skip to content

Commit d5d4e8e

Browse files
committed
Merge branch 'lifetime-variation' of https://github.com/cortex-command-community/Cortex-Command-Community-Project into lifetime-variation
2 parents 0c7c2d1 + 656d39e commit d5d4e8e

File tree

8 files changed

+6
-23
lines changed

8 files changed

+6
-23
lines changed

CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
88

99
<details><summary><b>Added</b></summary>
1010

11-
- New `MovableObject` INI and Lua (R/W) property `LifeVariation` which can be used to randomize the `Lifetime` of MOs from when they're added to the simulation.
12-
1311
</details>
1412

1513
<details><summary><b>Changed</b></summary>

Source/Entities/Emission.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void Emission::Clear() {
1515
m_Spread = 0;
1616
m_MinVelocity = 0;
1717
m_MaxVelocity = 0;
18-
m_LifeVariation = 0.1F;
18+
m_LifeVariation = 0.1;
1919
m_PushesEmitter = true;
2020
m_InheritsVel = 0;
2121
m_StartTimer.SetSimTimeLimitMS(0);

Source/Entities/Emission.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ namespace RTE {
151151
float m_MinVelocity;
152152
// The maximum velocity an emitted MO can have when emitted
153153
float m_MaxVelocity;
154-
// The variation in life time of each emitted particle, in percentage of the existing life time of the particle
154+
// The variation in life time of each emitted aprticle, in percentage of the existing life time of the partilcle
155155
float m_LifeVariation;
156156
// Whether these emissions push the emitter around with recoil or not.
157157
bool m_PushesEmitter;

Source/Entities/MovableObject.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ void MovableObject::Clear() {
5151
m_AgeTimer.Reset();
5252
m_RestTimer.Reset();
5353
m_Lifetime = 0;
54-
m_LifeVariation = 0.0F;
5554
m_Sharpness = 1.0;
5655
// m_MaterialId = 0;
5756
m_CheckTerrIntersection = false;
@@ -287,7 +286,6 @@ int MovableObject::ReadProperty(const std::string_view& propName, Reader& reader
287286
MatchProperty("PinStrength", { reader >> m_PinStrength; });
288287
MatchProperty("RestThreshold", { reader >> m_RestThreshold; });
289288
MatchProperty("LifeTime", { reader >> m_Lifetime; });
290-
MatchProperty("LifeVariation", { reader >> m_LifeVariation; });
291289
MatchProperty("Age", {
292290
double age;
293291
reader >> age;
@@ -417,8 +415,6 @@ int MovableObject::Save(Writer& writer) const {
417415
writer << m_RestThreshold;
418416
writer.NewProperty("LifeTime");
419417
writer << m_Lifetime;
420-
writer.NewProperty("LifeVariation");
421-
writer << m_LifeVariation;
422418
writer.NewProperty("Sharpness");
423419
writer << m_Sharpness;
424420
writer.NewProperty("HitsMOs");

Source/Entities/MovableObject.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,6 @@ namespace RTE {
225225
/// @return A unsigned long describing the current lifetime in ms. 0 means unlimited.
226226
unsigned long GetLifetime() const { return m_Lifetime; }
227227

228-
/// Gets the specified variation in lifetime of the emitted particles.
229-
/// @return The life variation rationally expressed.. 0.1 = up to 10% variation.
230-
float GetLifeVariation() const { return m_LifeVariation; }
231-
232-
/// Sets the specified variation in lifetime of the emitted particles.
233-
/// @param newVariation The life variation rationally expressed.. 0.1 = up to 10% variation.
234-
void SetLifeVariation(float newVariation) { m_LifeVariation = newVariation; }
235-
236228
/// Gets the MOID of this MovableObject for this frame.
237229
/// @return An int specifying the MOID that this MovableObject is
238230
/// assigned for the current frame only.
@@ -1135,8 +1127,6 @@ namespace RTE {
11351127
Timer m_RestTimer;
11361128

11371129
unsigned long m_Lifetime;
1138-
// The variation in life time of this MO, in percentage of the initial lifetime
1139-
float m_LifeVariation;
11401130
// The sharpness factor that gets added to single pixel hit impulses in
11411131
// applicable situations.
11421132
float m_Sharpness;

Source/Entities/Round.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void Round::Clear() {
2020
m_FireVel = 0;
2121
m_InheritsFirerVelocity = false;
2222
m_Separation = 0;
23-
m_LifeVariation = 0.0F;
23+
m_LifeVariation = 0;
2424
m_Shell = 0;
2525
m_ShellVel = 0;
2626
m_FireSound.Reset();

Source/Lua/LuaBindingsEntities.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,6 @@ LuaBindingRegisterFunctionDefinitionForType(EntityLuaBindings, MovableObject) {
893893
.property("AirThreshold", &MovableObject::GetAirThreshold, &MovableObject::SetAirThreshold)
894894
.property("Age", &MovableObject::GetAge, &MovableObject::SetAge)
895895
.property("Lifetime", &MovableObject::GetLifetime, &MovableObject::SetLifetime)
896-
.property("LifeVariation", &MovableObject::GetLifeVariation, &MovableObject::SetLifeVariation)
897896
.property("ID", &MovableObject::GetID)
898897
.property("UniqueID", &MovableObject::GetUniqueID)
899898
.property("RootID", &MovableObject::GetRootID)

Source/Managers/MovableMan.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ void MovableMan::AddActor(Actor* actorToAdd) {
667667
}
668668
actorToAdd->NotResting();
669669
actorToAdd->NewFrame();
670-
actorToAdd->SetAge(static_cast<int>(actorToAdd->GetLifetime() * actorToAdd->GetLifeVariation() * RandomNormalNum()));
670+
actorToAdd->SetAge(0);
671671
}
672672

673673
{
@@ -695,7 +695,7 @@ void MovableMan::AddItem(HeldDevice* itemToAdd) {
695695
}
696696
itemToAdd->NotResting();
697697
itemToAdd->NewFrame();
698-
itemToAdd->SetAge(static_cast<int>(itemToAdd->GetLifetime() * itemToAdd->GetLifeVariation() * RandomNormalNum()));
698+
itemToAdd->SetAge(0);
699699
}
700700

701701
std::lock_guard<std::mutex> lock(m_AddedItemsMutex);
@@ -718,7 +718,7 @@ void MovableMan::AddParticle(MovableObject* particleToAdd) {
718718
// TODO consider moving particles out of grass. It's old code that was removed because it's slow to do this for every particle.
719719
particleToAdd->NotResting();
720720
particleToAdd->NewFrame();
721-
particleToAdd->SetAge(static_cast<int>(particleToAdd->GetLifetime() * particleToAdd->GetLifeVariation() * RandomNormalNum()));
721+
particleToAdd->SetAge(0);
722722
}
723723
if (particleToAdd->IsDevice()) {
724724
std::lock_guard<std::mutex> lock(m_AddedItemsMutex);

0 commit comments

Comments
 (0)