Deadly Dash directional fix + Additive Blending toggle.

mac-build
NicoNicoNii 7 months ago
parent 873e25f927
commit 00bb4fd22a
  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};
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){

@ -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);
}
@ -1642,3 +1648,11 @@ 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;
}

@ -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;

Loading…
Cancel
Save