Skip to content

Commit 39949cf

Browse files
committed
Renamed EffectDrawEveryFrame to PostEffectEnabled, made it INI and Lua readable, changed default to false outside of pixels and particles
1 parent b90d521 commit 39949cf

File tree

8 files changed

+19
-8
lines changed

8 files changed

+19
-8
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
<details><summary><b>Added</b></summary>
10+
11+
- New `MovableObject` INI and Lua property `PostEffectEnabled` (R/W), which determines whether or not the screen effect of an MO is enabled. Defaults to `true` for `MOPixels` and `MOSParticles`, `false` for everything else (to avoid backwards compatibility issues).
12+
13+
</details>
14+
915
<details><summary><b>Changed</b></summary>
1016

1117
- Massacre now displays the remaining kill count to each player's screen instead of just the first one.
@@ -14,7 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
1420

1521
- Improvements to AI navigation in automovers, so they get stuck less often.
1622

17-
- Screen effects (glows) now show on *any* `MovableObject` they're attached to; you may need to set `EffectAlwaysShows = 1` to see them. Try `InheritEffectRotAngle = 1` on a `MOSRotating`!
23+
- Screen effects (glows) can now show on *any* `MovableObject` they're attached to; you may need to set `EffectAlwaysShows = 1` to see them on `MOSRotatings`. Try `InheritEffectRotAngle = 1` on one of them!
1824

1925
</details>
2026

Source/Entities/AEmitter.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,6 @@ void AEmitter::SetFlash(Attachable* newFlash) {
339339
m_pFlash->SetInheritsRotAngle(false);
340340
m_pFlash->SetDeleteWhenRemovedFromParent(true);
341341
m_pFlash->SetCollidesWithTerrainWhileAttached(false);
342-
m_pFlash->MovableObject::SetEffectDrawEveryFrame(false);
343342
}
344343
}
345344

Source/Entities/HDFirearm.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,6 @@ void HDFirearm::SetFlash(Attachable* newFlash) {
407407
m_pFlash->SetDrawnNormallyByParent(false);
408408
m_pFlash->SetDeleteWhenRemovedFromParent(true);
409409
m_pFlash->SetCollidesWithTerrainWhileAttached(false);
410-
m_pFlash->MovableObject::SetEffectDrawEveryFrame(false);
411410
}
412411
}
413412

Source/Entities/MOPixel.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ void MOPixel::Clear() {
2424
m_MaxLethalRange = 1;
2525
m_LethalSharpness = 1;
2626
m_Staininess = 0;
27+
m_PostEffectEnabled = true;
2728
}
2829

2930
int MOPixel::Create() {

Source/Entities/MOSParticle.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ MOSParticle::~MOSParticle() {
2020
void MOSParticle::Clear() {
2121
m_Atom = nullptr;
2222
m_SpriteAnimMode = OVERLIFETIME;
23+
m_PostEffectEnabled = true;
2324
}
2425

2526
int MOSParticle::Create() {

Source/Entities/MovableObject.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void MovableObject::Clear() {
9797
m_EffectStartStrength = 128;
9898
m_EffectStopStrength = 128;
9999
m_EffectAlwaysShows = false;
100-
m_EffectDrawEveryFrame = true;
100+
m_PostEffectEnabled = false;
101101

102102
m_UniqueID = 0;
103103

@@ -221,6 +221,7 @@ int MovableObject::Create(const MovableObject& reference) {
221221
m_MissionCritical = reference.m_MissionCritical;
222222
m_CanBeSquished = reference.m_CanBeSquished;
223223
m_HUDVisible = reference.m_HUDVisible;
224+
m_PostEffectEnabled = reference.m_PostEffectEnabled;
224225

225226
m_ForceIntoMasterLuaState = reference.m_ForceIntoMasterLuaState;
226227
for (auto& [scriptPath, scriptEnabled]: reference.m_AllLoadedScripts) {
@@ -342,6 +343,7 @@ int MovableObject::ReadProperty(const std::string_view& propName, Reader& reader
342343
m_pScreenEffect = m_ScreenEffectFile.GetAsBitmap();
343344
m_ScreenEffectHash = m_ScreenEffectFile.GetHash();
344345
});
346+
MatchProperty("PostEffectEnabled", { reader >> m_PostEffectEnabled; });
345347
MatchProperty("EffectStartTime", { reader >> m_EffectStartTime; });
346348
MatchProperty("EffectRotAngle", { reader >> m_EffectRotAngle; });
347349
MatchProperty("InheritEffectRotAngle", { reader >> m_InheritEffectRotAngle; });
@@ -447,6 +449,8 @@ int MovableObject::Save(Writer& writer) const {
447449
}
448450
writer.NewProperty("ScreenEffect");
449451
writer << m_ScreenEffectFile;
452+
writer.NewProperty("PostEffectEnabled");
453+
writer << m_PostEffectEnabled;
450454
writer.NewProperty("EffectStartTime");
451455
writer << m_EffectStartTime;
452456
writer.NewProperty("EffectStopTime");
@@ -895,7 +899,7 @@ void MovableObject::Update() {
895899
m_EffectRotAngle = c_PI * 2.0F * RandomNormalNum();
896900
}
897901

898-
if (m_pScreenEffect && m_EffectDrawEveryFrame) {
902+
if (m_pScreenEffect && m_PostEffectEnabled) {
899903
MovableObject::SetPostScreenEffectToDraw();
900904
}
901905
}

Source/Entities/MovableObject.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,11 +400,11 @@ namespace RTE {
400400

401401
/// Gets whether or not this MovableObject's effect is drawn every frame.
402402
/// @return Boolean indicating whether or not the effect is drawn.
403-
bool GetEffectDrawEveryFrame() const { return m_EffectDrawEveryFrame; }
403+
bool GetPostEffectEnabled() const { return m_PostEffectEnabled; }
404404

405405
/// Sets whether or not to draw this MovableObject's effect every frame.
406406
/// @param Boolean indicating whether or not to draw the effect.
407-
void SetEffectDrawEveryFrame(bool newValue) { m_EffectDrawEveryFrame = newValue; }
407+
void SetPostEffectEnabled(bool newValue) { m_PostEffectEnabled = newValue; }
408408

409409
/// Sets the current angular velocity of this MovableObject. Positive is
410410
/// a counter clockwise rotation.
@@ -1240,7 +1240,7 @@ namespace RTE {
12401240
// Whether effects rot angle should be randomized every frame
12411241
bool m_RandomizeEffectRotAngleEveryFrame;
12421242
// Whether or not to draw the effect every frame; used for flashes
1243-
bool m_EffectDrawEveryFrame;
1243+
bool m_PostEffectEnabled;
12441244

12451245
// This object's unique persistent ID
12461246
long m_UniqueID;

Source/Lua/LuaBindingsEntities.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,7 @@ LuaBindingRegisterFunctionDefinitionForType(EntityLuaBindings, MovableObject) {
921921
.property("ApplyWoundDamageOnCollision", &MovableObject::GetApplyWoundDamageOnCollision, &MovableObject::SetApplyWoundDamageOnCollision)
922922
.property("ApplyWoundBurstDamageOnCollision", &MovableObject::GetApplyWoundBurstDamageOnCollision, &MovableObject::SetApplyWoundBurstDamageOnCollision)
923923
.property("SimUpdatesBetweenScriptedUpdates", &MovableObject::GetSimUpdatesBetweenScriptedUpdates, &MovableObject::SetSimUpdatesBetweenScriptedUpdates)
924+
.property("PostEffectEnabled", &MovableObject::GetPostEffectEnabled, &MovableObject::SetPostEffectEnabled)
924925

925926
.def("GetParent", (MOSRotating * (MovableObject::*)()) & MovableObject::GetParent)
926927
.def("GetParent", (const MOSRotating* (MovableObject::*)() const) & MovableObject::GetParent)

0 commit comments

Comments
 (0)