From eaa1746f4ee6c546a4c2d0e9f311e8bd508977b0 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Fri, 20 Oct 2023 03:53:29 +0200 Subject: [PATCH] tentative fix for particle flip not working properly in some cases --- BBGE/Emitter.cpp | 10 +++++----- BBGE/Particles.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/BBGE/Emitter.cpp b/BBGE/Emitter.cpp index e71455d..1a3a3fe 100644 --- a/BBGE/Emitter.cpp +++ b/BBGE/Emitter.cpp @@ -240,11 +240,12 @@ void Emitter::onRender(const RenderState& rs) const texture->apply(); - - if (hasRot) + const bool flip = data.flipH != (data.copyParentFlip && pe->isfhr()); + if (flip || hasRot) { Vector colorMult = data.inheritColor ? pe->color : Vector(1, 1, 1); float alphaMult = data.inheritAlpha ? pe->alpha.x : 1; + for (Particles::const_iterator i = particles.begin(); i != particles.end(); i++) { Particle *p = *i; @@ -257,7 +258,7 @@ void Emitter::onRender(const RenderState& rs) const glColor4f(col.x, col.y, col.z, p->alpha.x * alphaMult); - if (p->rot.z != 0 || p->rot.isInterpolating()) + if (flip || p->rot.z != 0 || p->rot.isInterpolating()) { glPushMatrix(); @@ -265,9 +266,8 @@ void Emitter::onRender(const RenderState& rs) const glRotatef(p->rot.z, 0, 0, 1); - if (data.flipH || (data.copyParentFlip && (pe->isfh() || (pe->getParent() && pe->getParent()->isfh())))) + if (flip) { - glRotatef(180, 0, 1, 0); } diff --git a/BBGE/Particles.h b/BBGE/Particles.h index 193ab4f..952debe 100644 --- a/BBGE/Particles.h +++ b/BBGE/Particles.h @@ -133,7 +133,7 @@ public: Vector getSpawnPosition(); - bool hasRot; + bool hasRot; // FIXME: this should be removed eventually protected: Vector currentSpawn, lastSpawn; void onRender(const RenderState& rs) const OVERRIDE;