From 2e185dd4601d2e3f34ee7db4809899961f4a4a5b Mon Sep 17 00:00:00 2001 From: The Bearodactyl <114454115+TheBearodactyl@users.noreply.github.com> Date: Sun, 28 Apr 2024 13:20:59 -0500 Subject: [PATCH] refactor (please work lol) --- src/trail_customization/solid_trail.cpp | 26 +++++++++++-------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/trail_customization/solid_trail.cpp b/src/trail_customization/solid_trail.cpp index cdb6030..5ea4fdc 100644 --- a/src/trail_customization/solid_trail.cpp +++ b/src/trail_customization/solid_trail.cpp @@ -5,21 +5,17 @@ using namespace geode::prelude; class $modify(CCDrawNode) { - bool drawPolygon(CCPoint *verts, unsigned int cnt, const ccColor4F &fillColor, float borderWidth, const ccColor4F &borderColor) { - bool solid_wave = Mod::get()->getSettingValue("solid-wave-trail"); - - if (typeinfo_cast(this)) { - if (solid_wave) { - if (fillColor.r >= 1.0f && fillColor.g >= 1.0f && fillColor.b >= 1.0f && this->getColor() != ccc3(255, 255, 255)) { - return true; - } - - if (this->getTag() != 1) { - this->setTag(1); - this->setBlendFunc(CCSprite::create()->getBlendFunc()); - } + bool drawPolygon(CCPoint* verts, unsigned int cnt, const ccColor4F& fillColor, float borderWidth, const ccColor4F& borderColor) { + if (typeinfo_cast(this) && Mod::get()->getSettingValue("solid-wave-trail")) { + if (fillColor.r >= 1.0f && fillColor.g >= 1.0f && fillColor.b >= 1.0f && this->getColor() != ccc3(255, 255, 255)) { + return true; // Likely a shortcut under specific conditions + } - this->setZOrder(-1); + // Optimized blending if not already set + if (this->getTag() != 1) { + this->setTag(1); + this->setBlendFunc(CCSprite::create()->getBlendFunc()); + this->setZOrder(-1); } } @@ -27,4 +23,4 @@ class $modify(CCDrawNode) { } }; -#endif \ No newline at end of file +#endif \ No newline at end of file