Deadly Dash directional fix + Additive Blending toggle.

removeExposedPackKey
NicoNicoNii 7 months ago
parent 7266e5eb2e
commit 11b45499fd
  1. 3
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 14
      Adventures in Lestoria/Player.cpp
  3. 5
      Adventures in Lestoria/Player.h

@ -1049,7 +1049,8 @@ void AiL::RenderWorld(float fElapsedTime){
Pixel playerCol{WHITE}; 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)))}; 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)))}; 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); 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); SetDecalMode(DecalMode::NORMAL);
if(player->GetState()==State::BLOCK){ if(player->GetState()==State::BLOCK){

@ -493,17 +493,23 @@ void Player::Update(float fElapsedTime){
deadlyDashAfterDashTimer-=fElapsedTime; deadlyDashAfterDashTimer-=fElapsedTime;
if(deadlyDashWaitTimer<=0.f){ if(deadlyDashWaitTimer<=0.f){
deadlyDashWaitTimer=INFINITY; deadlyDashWaitTimer=INFINITY;
}else
if(deadlyDashAdditiveBlendingToggleTimer<=0.f){
deadlyDashAdditiveBlendingToggleTimer=0.05f;
SetAdditiveBlending(!IsUsingAdditiveBlending());
} }
if(deadlyDashAfterDashTimer<=0.f){ if(deadlyDashAfterDashTimer<=0.f){
deadlyDashAfterDashTimer=INFINITY; deadlyDashAfterDashTimer=INFINITY;
SoundEffect::PlaySFX("Deadly Dash",GetPos()); SoundEffect::PlaySFX("Deadly Dash",GetPos());
SetPos(deadlyDashEndingPos); SetPos(deadlyDashEndingPos);
SetState(State::NORMAL); SetState(State::NORMAL);
SetAdditiveBlending(false);
} }
}break; }break;
default:{ default:{
spin_angle=0.f; spin_angle=0.f;
ySquishFactor=1.f; ySquishFactor=1.f;
SetAdditiveBlending(false);
//Update animations normally. //Update animations normally.
animation.UpdateState(internal_animState,fElapsedTime); animation.UpdateState(internal_animState,fElapsedTime);
} }
@ -1642,3 +1648,11 @@ const float Player::GetModdedStatBonuses(std::string_view stat)const{
const float Player::GetModdedStatBonuses(ItemAttribute stat)const{ const float Player::GetModdedStatBonuses(ItemAttribute stat)const{
return GetModdedStatBonuses(stat.ActualName()); return GetModdedStatBonuses(stat.ActualName());
} }
void Player::SetAdditiveBlending(const bool additiveBlending){
renderedSpriteUsesAdditiveBlending=additiveBlending;
}
const bool Player::IsUsingAdditiveBlending()const{
return renderedSpriteUsesAdditiveBlending;
}

@ -283,6 +283,9 @@ public:
const float GetModdedStatBonuses(std::string_view stat)const; 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. //An all-in-one function that applies a stat plus any % modifiers the stat may have as well.
const float GetModdedStatBonuses(ItemAttribute stat)const; 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: private:
int hp="Warrior.BaseHealth"_I; int hp="Warrior.BaseHealth"_I;
int mana="Player.BaseMana"_I; int mana="Player.BaseMana"_I;
@ -357,6 +360,8 @@ private:
float deadlyDashWaitTimer{}; float deadlyDashWaitTimer{};
float deadlyDashAfterDashTimer{}; float deadlyDashAfterDashTimer{};
vf2d deadlyDashEndingPos{}; vf2d deadlyDashEndingPos{};
bool renderedSpriteUsesAdditiveBlending{false};
float deadlyDashAdditiveBlendingToggleTimer{};
protected: protected:
const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F; const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F;
const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F; const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F;

Loading…
Cancel
Save