diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 515341d4..debd9452 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -1049,7 +1049,8 @@ void AiL::RenderWorld(float fElapsedTime){ Pixel playerCol{WHITE}; if(attackBuffs.size()>0)playerCol={255,uint8_t(255*abs(sin(1.4f*attackBuffs[0].duration))),uint8_t(255*abs(sin(1.4f*attackBuffs[0].duration)))}; else if(movespeedBuffs.size()>0)playerCol={uint8_t(255*abs(sin(2.f*movespeedBuffs[0].duration))),255,uint8_t(255*abs(sin(2.f*movespeedBuffs[0].duration)))}; - + if(player->IsUsingAdditiveBlending())SetDecalMode(DecalMode::ADDITIVE); + else SetDecalMode(DecalMode::NORMAL); view.DrawPartialSquishedRotatedDecal(pos+vf2d{0,-player->GetZ()*(std::signbit(scale.y)?-1:1)},player->GetFrame().GetSourceImage()->Decal(),player->GetSpinAngle(),{12,12},player->GetFrame().GetSourceRect().pos,player->GetFrame().GetSourceRect().size,playerScale*scale,{1.f,player->ySquishFactor},playerCol); SetDecalMode(DecalMode::NORMAL); if(player->GetState()==State::BLOCK){ diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index 30ef48ef..7d57940c 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -493,17 +493,23 @@ void Player::Update(float fElapsedTime){ deadlyDashAfterDashTimer-=fElapsedTime; if(deadlyDashWaitTimer<=0.f){ deadlyDashWaitTimer=INFINITY; + }else + if(deadlyDashAdditiveBlendingToggleTimer<=0.f){ + deadlyDashAdditiveBlendingToggleTimer=0.05f; + SetAdditiveBlending(!IsUsingAdditiveBlending()); } if(deadlyDashAfterDashTimer<=0.f){ deadlyDashAfterDashTimer=INFINITY; SoundEffect::PlaySFX("Deadly Dash",GetPos()); SetPos(deadlyDashEndingPos); SetState(State::NORMAL); + SetAdditiveBlending(false); } }break; default:{ spin_angle=0.f; ySquishFactor=1.f; + SetAdditiveBlending(false); //Update animations normally. animation.UpdateState(internal_animState,fElapsedTime); } @@ -1641,4 +1647,12 @@ const float Player::GetModdedStatBonuses(std::string_view stat)const{ const float Player::GetModdedStatBonuses(ItemAttribute stat)const{ return GetModdedStatBonuses(stat.ActualName()); +} + +void Player::SetAdditiveBlending(const bool additiveBlending){ + renderedSpriteUsesAdditiveBlending=additiveBlending; +} + +const bool Player::IsUsingAdditiveBlending()const{ + return renderedSpriteUsesAdditiveBlending; } \ No newline at end of file diff --git a/Adventures in Lestoria/Player.h b/Adventures in Lestoria/Player.h index 843c1b7d..8855b357 100644 --- a/Adventures in Lestoria/Player.h +++ b/Adventures in Lestoria/Player.h @@ -283,6 +283,9 @@ public: const float GetModdedStatBonuses(std::string_view stat)const; //An all-in-one function that applies a stat plus any % modifiers the stat may have as well. const float GetModdedStatBonuses(ItemAttribute stat)const; + //Flag to make the player character render using additive blending / normal blending. + void SetAdditiveBlending(const bool additiveBlending); + const bool IsUsingAdditiveBlending()const; private: int hp="Warrior.BaseHealth"_I; int mana="Player.BaseMana"_I; @@ -357,6 +360,8 @@ private: float deadlyDashWaitTimer{}; float deadlyDashAfterDashTimer{}; vf2d deadlyDashEndingPos{}; + bool renderedSpriteUsesAdditiveBlending{false}; + float deadlyDashAdditiveBlendingToggleTimer{}; protected: const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F; const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F;