@@ -1387,8 +1387,8 @@ namespace animation {
13871387 }
13881388
13891389
1390- ModelAnimationSegmentParticlesDuring::ModelAnimationSegmentParticlesDuring (std::shared_ptr<ModelAnimationSegment> segment, particle::ParticleEffectHandle effect, float atTime, std::shared_ptr<ModelAnimationSubmodel> submodel, std::optional<vec3d> position, std::optional<matrix> orientation) :
1391- m_segment (std::move(segment)), m_submodel(std::move(submodel)), m_position(std::move(position)), m_orientation(std::move(orientation)), m_effect(effect), m_atTime(atTime) { }
1390+ ModelAnimationSegmentParticlesDuring::ModelAnimationSegmentParticlesDuring (std::shared_ptr<ModelAnimationSegment> segment, particle::ParticleEffectHandle effect, float atTime, std::shared_ptr<ModelAnimationSubmodel> submodel, std::optional<vec3d> position, std::optional<matrix> orientation, std::optional<ModelAnimationDirection> limitDirection ) :
1391+ m_segment (std::move(segment)), m_submodel(std::move(submodel)), m_position(std::move(position)), m_orientation(std::move(orientation)), m_limitDirection(std::move(limitDirection)), m_effect(effect), m_atTime(atTime) { }
13921392
13931393 ModelAnimationSegment* ModelAnimationSegmentParticlesDuring::copy () const {
13941394 auto newCopy = new ModelAnimationSegmentParticlesDuring (*this );
@@ -1407,8 +1407,8 @@ namespace animation {
14071407
14081408 void ModelAnimationSegmentParticlesDuring::executeAnimation (const ModelAnimationSubmodelBuffer& state, float timeboundLower, float timeboundUpper, ModelAnimationDirection direction, int pmi_id) {
14091409 float atTime = fminf (fmaxf (m_atTime, 0 .0f ), m_duration.at (pmi_id));
1410- if (timeboundLower <= atTime && atTime <= timeboundUpper) {
1411- createParticleSource (model_get_instance (pmi_id));
1410+ if (timeboundLower <= atTime && atTime <= timeboundUpper && (!m_limitDirection || direction == *m_limitDirection) ) {
1411+ createParticleSource (model_get_instance (pmi_id));
14121412 }
14131413 m_segment->executeAnimation (state, timeboundLower, timeboundUpper, direction, pmi_id);
14141414 }
@@ -1483,7 +1483,17 @@ namespace animation {
14831483 orientation = std::move (mat);
14841484 }
14851485
1486- auto segment = std::make_shared<ModelAnimationSegmentParticlesDuring>(data->parseSegment (), effect, atTime, submodel, position, orientation);
1486+ std::optional<ModelAnimationDirection> limitDirection = std::nullopt ;
1487+ if (optional_string (" +Limit Direction:" )) {
1488+ SCP_string buf;
1489+ stuff_string (buf, F_NAME );
1490+ if (!stricmp (buf.c_str (), " FWD" ))
1491+ limitDirection = ModelAnimationDirection::FWD ;
1492+ else if (!stricmp (buf.c_str (), " RWD" ))
1493+ limitDirection = ModelAnimationDirection::RWD ;
1494+ }
1495+
1496+ auto segment = std::make_shared<ModelAnimationSegmentParticlesDuring>(data->parseSegment (), effect, atTime, submodel, position, orientation, limitDirection);
14871497
14881498 return segment;
14891499 }
0 commit comments