Skip to content

Commit

Permalink
refactor (please work lol)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBearodactyl authored Apr 28, 2024
1 parent b8b4b5d commit 2e185dd
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions src/trail_customization/solid_trail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,22 @@
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<bool>("solid-wave-trail");

if (typeinfo_cast<HardStreak*>(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<HardStreak*>(this) && Mod::get()->getSettingValue<bool>("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);
}
}

return CCDrawNode::drawPolygon(verts, cnt, fillColor, borderWidth, borderColor);
}
};

#endif
#endif

0 comments on commit 2e185dd

Please sign in to comment.