diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index e52b9fcc..13ebbfbb 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -2068,7 +2068,6 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){ Audio::UpdateBGMVolume(); #endif game->view.SetZoom(1.f,game->view.WorldToScreen(game->camera.GetViewPosition())); - SetMosaicEffect(1U); worldColor=WHITE; worldColorFunc=[&](vi2d pos){return game->worldColor;}; levelTime=0; @@ -2106,6 +2105,7 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){ #pragma region Monster Spawn Data Setup (Loading phase 2) LoadingScreen::AddPhase([&](){ + SetMosaicEffect(1U); for(auto&[key,value]:MAP_DATA[GetCurrentLevel()].SpawnerData){ SpawnerTag&spawnData=MAP_DATA[GetCurrentLevel()].SpawnerData[key]; std::vector>monster_list; diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index a8e690e0..ed8c2beb 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -315,13 +315,13 @@ void Player::Update(float fElapsedTime){ castInfo.castTimer-=fElapsedTime; if(castInfo.castTimer<=0){ bool allowed=castPrepAbility->actionPerformedDuringCast; + SetState(State::NORMAL); if(!allowed&&castPrepAbility->action(this,castInfo.castPos))allowed=true; if(allowed){ castPrepAbility->cooldown=castPrepAbility->GetCooldownTime(); ConsumeMana(castPrepAbility->manaCost); } castInfo.castTimer=0; - SetState(State::NORMAL); } } @@ -605,6 +605,9 @@ void Player::Update(float fElapsedTime){ #pragma region Ranger if(GetState()==State::SHOOT_ARROW){ + if(rangerShootAnimationTimer>0.f){ + rangerShootAnimationTimer=std::max(0.f,rangerShootAnimationTimer-fElapsedTime); + }else if(attack_cooldown_timer<=ARROW_ATTACK_COOLDOWN-0.3){ SetState(State::NORMAL); } @@ -773,9 +776,9 @@ void Player::AddAnimation(std::string state){ animation.AddState(state,ANIMATION_DATA.at(state)); } -void Player::UpdateAnimation(std::string animState,int specificClass,const bool force){ +void Player::UpdateAnimation(std::string animState,int specificClass){ if(specificClass==ANY||specificClass&GetClass()){ - animation.ChangeState(internal_animState,animState,force); + animation.ChangeState(internal_animState,animState); } } @@ -974,31 +977,31 @@ void Player::SetAnimationBasedOnTargetingDirection(float targetDirection){ case Class::WARRIOR: case Class::THIEF:{ if(FacingNorth()){ - UpdateAnimation("WARRIOR_SWINGSWORD_N",true); + UpdateAnimation("WARRIOR_SWINGSWORD_N"); }else if(FacingSouth()){ - UpdateAnimation("WARRIOR_SWINGSWORD_S",true); + UpdateAnimation("WARRIOR_SWINGSWORD_S"); }else if(FacingWest()){ - UpdateAnimation("WARRIOR_SWINGSWORD_W",true); + UpdateAnimation("WARRIOR_SWINGSWORD_W"); }else if(FacingEast()){ - UpdateAnimation("WARRIOR_SWINGSWORD_E",true); + UpdateAnimation("WARRIOR_SWINGSWORD_E"); } }break; case Class::RANGER: case Class::TRAPPER:{ if(FacingNorth()){ - UpdateAnimation("RANGER_SHOOT_N",true); + UpdateAnimation("RANGER_SHOOT_N"); }else if(FacingSouth()){ - UpdateAnimation("RANGER_SHOOT_S",true); + UpdateAnimation("RANGER_SHOOT_S"); }else if(FacingWest()){ - UpdateAnimation("RANGER_SHOOT_W",true); + UpdateAnimation("RANGER_SHOOT_W"); }else if(FacingEast()){ - UpdateAnimation("RANGER_SHOOT_E",true); + UpdateAnimation("RANGER_SHOOT_E"); } }break; } diff --git a/Adventures in Lestoria/Player.h b/Adventures in Lestoria/Player.h index 2d0231dd..6b2b008e 100644 --- a/Adventures in Lestoria/Player.h +++ b/Adventures in Lestoria/Player.h @@ -178,7 +178,7 @@ public: bool Heal(int damage,bool suppressDamageNumber=false); //specificClass is a bitwise-combination of classes from the Class enum. It makes sure certain animations only play if you are a certain class. //Set force to true to force the animation to restart evne if the animation were already playing. - void UpdateAnimation(std::string animState,int specificClass=ANY,const bool force=false); + void UpdateAnimation(std::string animState,int specificClass=ANY); Animate2D::Frame GetFrame(); Key GetLastReleasedMovementKey(); float GetSwordSwingTimer(); @@ -316,6 +316,7 @@ private: const bool UsingAutoAim()const; bool lowHealthSoundPlayed=false; float lowHealthSoundPlayedTimer=0.f; + float rangerShootAnimationTimer=0.f; protected: const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F; const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F; diff --git a/Adventures in Lestoria/Ranger.cpp b/Adventures in Lestoria/Ranger.cpp index ede6494b..6493331d 100644 --- a/Adventures in Lestoria/Ranger.cpp +++ b/Adventures in Lestoria/Ranger.cpp @@ -114,6 +114,8 @@ void Ranger::InitializeClassAbilities(){ [](Player*p,vf2d pos={}){ vf2d arrowVelocity=util::pointTo(p->GetPos(),p->GetWorldAimingLocation()); BULLET_LIST.push_back(std::make_unique(p->GetPos(),arrowVelocity*"Ranger.Ability 2.Speed"_F,12*"Ranger.Ability 2.Radius"_F/100,p->GetAttack()*"Ranger.Ability 2.DamageMult"_F,p->OnUpperLevel(),true)); + p->SetState(State::SHOOT_ARROW); + p->rangerShootAnimationTimer=0.3f; p->SetAnimationBasedOnTargetingDirection(atan2(arrowVelocity.y,arrowVelocity.x)); game->SetupWorldShake("Ranger.Ability 2.WorldShakeTime"_F); p->Knockback(-1.f*arrowVelocity.norm()*"Ranger.Ability 2.Knockback"_F); @@ -139,6 +141,8 @@ void Ranger::InitializeClassAbilities(){ vf2d extendedLine=pointTowardsCursor.upoint(1.1f); BULLET_LIST.push_back(std::make_unique(Arrow(p->GetPos(),extendedLine,vf2d{cos(newAngle)*"Ranger.Ability 3.ArrowSpd"_F,float(sin(newAngle)*"Ranger.Ability 3.ArrowSpd"_F-PI/8*"Ranger.Ability 3.ArrowSpd"_F)}+p->movementVelocity,12*"Ranger.Ability 3.ArrowRadius"_F/100,int(p->GetAttack()*"Ranger.Ability 3.DamageMult"_F),p->OnUpperLevel(),true))); } + p->rangerShootAnimationTimer=0.3f; + p->SetState(State::SHOOT_ARROW); p->SetAnimationBasedOnTargetingDirection(shootingAngle); SoundEffect::PlaySFX("Ranger.Ability 3.Sound"_S,SoundEffect::CENTERED); return true; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 7112383d..a905c8ee 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 1 #define VERSION_MINOR 0 #define VERSION_PATCH 0 -#define VERSION_BUILD 8357 +#define VERSION_BUILD 8367 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/olcUTIL_Animate2D.h b/Adventures in Lestoria/olcUTIL_Animate2D.h index a0ff9075..a4438eb7 100644 --- a/Adventures in Lestoria/olcUTIL_Animate2D.h +++ b/Adventures in Lestoria/olcUTIL_Animate2D.h @@ -172,11 +172,10 @@ namespace olc::utils::Animate2D Animation() = default; // Change an animation state token to a new state - //If force is set, will reset the animation even if it's the same animation. - inline bool ChangeState(AnimationState& state, const StatesEnum& sStateName, bool force=false) const + inline bool ChangeState(AnimationState& state, const StatesEnum& sStateName) const { size_t idx = m_mapStateIndices.at(sStateName); - if (state.nIndex != idx ) + if (state.nIndex != idx) { state.fTime = 0.0f; state.nIndex = idx; diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 73a5d247..73d5b5e3 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ