diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 14b88d93..e52b9fcc 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -134,6 +134,7 @@ InputGroup AiL::KEY_SCROLLLEFT; InputGroup AiL::KEY_SCROLLRIGHT; InputGroup AiL::KEY_SCROLLHORZ; InputGroup AiL::KEY_SCROLLHORZ_L; +InputGroup AiL::KEY_SCROLLHORZ_R; InputGroup AiL::KEY_SCROLLVERT; InputGroup AiL::KEY_SCROLLVERT_R; InputGroup AiL::KEY_SCROLLVERT_L; @@ -2980,9 +2981,11 @@ void AiL::InitializeDefaultKeybinds(){ KEY_SCROLLVERT_L.AddKeybind({STEAM,Steam::SCROLL}); KEY_SCROLLVERT_R.AddKeybind({ANALOG,static_cast(GPAxes::RY)}); KEY_SCROLLVERT_R.AddKeybind({STEAM,Steam::SCROLL}); - KEY_SCROLLHORZ.AddKeybind({ANALOG,static_cast(GPAxes::LX)}); KEY_SCROLLHORZ_L.AddKeybind({ANALOG,static_cast(GPAxes::LX)}); KEY_SCROLLHORZ_L.AddKeybind({STEAM,Steam::SCROLL}); + KEY_SCROLLHORZ_R.AddKeybind({ANALOG,static_cast(GPAxes::RX)}); + KEY_SCROLLHORZ_R.AddKeybind({STEAM,Steam::SCROLL}); + KEY_SCROLLHORZ.AddKeybind({ANALOG,static_cast(GPAxes::LX)}); KEY_SCROLLHORZ.AddKeybind({ANALOG,static_cast(GPAxes::RX)}); KEY_SCROLLHORZ.AddKeybind({STEAM,Steam::SCROLL}); KEY_SCROLL.AddKeybind({KEY,ARROWS}); diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h index 64f896e2..afdc3edb 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.h +++ b/Adventures in Lestoria/AdventuresInLestoria.h @@ -105,6 +105,7 @@ public: static InputGroup KEY_SCROLLRIGHT; static InputGroup KEY_SCROLLHORZ; static InputGroup KEY_SCROLLHORZ_L; + static InputGroup KEY_SCROLLHORZ_R; static InputGroup KEY_SCROLLVERT; static InputGroup KEY_SCROLLVERT_R; static InputGroup KEY_SCROLLVERT_L; diff --git a/Adventures in Lestoria/Key.cpp b/Adventures in Lestoria/Key.cpp index a3d7d6ad..eb10520a 100644 --- a/Adventures in Lestoria/Key.cpp +++ b/Adventures in Lestoria/Key.cpp @@ -1056,20 +1056,26 @@ const bool Input::UsingGamepad(){ const bool Input::AxesActive(){ float xAxis=0.f,yAxis=0.f; - for(GamePad*gamepad:GamePad::getGamepads()){ - if(gamepad->stillConnected){ - if(fabs(gamepad->getAxis(GPAxes::RX))>0.f){ - xAxis=gamepad->getAxis(GPAxes::RX); - } - - if(fabs(gamepad->getAxis(GPAxes::RY))>0.f){ - yAxis=gamepad->getAxis(GPAxes::RY); + if(SteamInput()){ + if(fabs(game->KEY_SCROLLHORZ_R.Analog())>0.f){ + return true; + } + if(fabs(game->KEY_SCROLLVERT_R.Analog())>0.f){ + return true; + } + }else{ + for(GamePad*gamepad:GamePad::getGamepads()){ + if(gamepad->stillConnected){ + if(fabs(gamepad->getAxis(GPAxes::RX))>0.f){ + return true; + } + if(fabs(gamepad->getAxis(GPAxes::RY))>0.f){ + return true; + } } - - if(xAxis!=0.f||yAxis!=0.f)break; //Found a controller, so we're good to break. } } - return xAxis!=0.f||yAxis!=0.f; + return false; } void Input::StartVibration(const bool override){ diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index a689862d..a8e690e0 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -773,9 +773,9 @@ void Player::AddAnimation(std::string state){ animation.AddState(state,ANIMATION_DATA.at(state)); } -void Player::UpdateAnimation(std::string animState,int specificClass){ +void Player::UpdateAnimation(std::string animState,int specificClass,const bool force){ if(specificClass==ANY||specificClass&GetClass()){ - animation.ChangeState(internal_animState,animState); + animation.ChangeState(internal_animState,animState,force); } } @@ -974,31 +974,31 @@ void Player::SetAnimationBasedOnTargetingDirection(float targetDirection){ case Class::WARRIOR: case Class::THIEF:{ if(FacingNorth()){ - UpdateAnimation("WARRIOR_SWINGSWORD_N"); + UpdateAnimation("WARRIOR_SWINGSWORD_N",true); }else if(FacingSouth()){ - UpdateAnimation("WARRIOR_SWINGSWORD_S"); + UpdateAnimation("WARRIOR_SWINGSWORD_S",true); }else if(FacingWest()){ - UpdateAnimation("WARRIOR_SWINGSWORD_W"); + UpdateAnimation("WARRIOR_SWINGSWORD_W",true); }else if(FacingEast()){ - UpdateAnimation("WARRIOR_SWINGSWORD_E"); + UpdateAnimation("WARRIOR_SWINGSWORD_E",true); } }break; case Class::RANGER: case Class::TRAPPER:{ if(FacingNorth()){ - UpdateAnimation("RANGER_SHOOT_N"); + UpdateAnimation("RANGER_SHOOT_N",true); }else if(FacingSouth()){ - UpdateAnimation("RANGER_SHOOT_S"); + UpdateAnimation("RANGER_SHOOT_S",true); }else if(FacingWest()){ - UpdateAnimation("RANGER_SHOOT_W"); + UpdateAnimation("RANGER_SHOOT_W",true); }else if(FacingEast()){ - UpdateAnimation("RANGER_SHOOT_E"); + UpdateAnimation("RANGER_SHOOT_E",true); } }break; } @@ -1390,17 +1390,26 @@ const vf2d Player::GetAimingLocation(bool useWalkDir,bool invert){ } #pragma region Manual Aiming - for(GamePad*gamepad:GamePad::getGamepads()){ - if(gamepad->stillConnected){ - if(fabs(gamepad->getAxis(GPAxes::RX))>0.f){ - xAxis=gamepad->getAxis(GPAxes::RX); - } + if(SteamInput()){ + if(fabs(game->KEY_SCROLLHORZ_R.Analog())>0.f){ + xAxis=game->KEY_SCROLLHORZ_R.Analog(); + } + if(fabs(game->KEY_SCROLLVERT_R.Analog())>0.f){ + yAxis=game->KEY_SCROLLVERT_R.Analog(); + } + }else{ + for(GamePad*gamepad:GamePad::getGamepads()){ + if(gamepad->stillConnected){ + if(fabs(gamepad->getAxis(GPAxes::RX))>0.f){ + xAxis=gamepad->getAxis(GPAxes::RX); + } - if(fabs(gamepad->getAxis(GPAxes::RY))>0.f){ - yAxis=gamepad->getAxis(GPAxes::RY); - } + if(fabs(gamepad->getAxis(GPAxes::RY))>0.f){ + yAxis=gamepad->getAxis(GPAxes::RY); + } - if(xAxis!=0.f||yAxis!=0.f)break; //Found a controller, so we're good to break. + if(xAxis!=0.f||yAxis!=0.f)break; //Found a controller, so we're good to break. + } } } #pragma endregion diff --git a/Adventures in Lestoria/Player.h b/Adventures in Lestoria/Player.h index c0caa663..2d0231dd 100644 --- a/Adventures in Lestoria/Player.h +++ b/Adventures in Lestoria/Player.h @@ -177,7 +177,8 @@ public: //Return false if healing was not possible. 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. - void UpdateAnimation(std::string animState,int specificClass=ANY); + //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); Animate2D::Frame GetFrame(); Key GetLastReleasedMovementKey(); float GetSwordSwingTimer(); diff --git a/Adventures in Lestoria/Tutorial.h b/Adventures in Lestoria/Tutorial.h index 8abe607a..fb42b2f4 100644 --- a/Adventures in Lestoria/Tutorial.h +++ b/Adventures in Lestoria/Tutorial.h @@ -170,6 +170,7 @@ private: attackGroup.ClearAllKeybinds(); ADDKEYBIND(attackGroup,game->KEY_ATTACK,CONTROLLER); ADDKEYBIND(attackGroup,game->KEY_ATTACK,KEY); + ADDKEYBIND(attackGroup,game->KEY_ATTACK,STEAM); } virtual inline bool CompleteCondition()override final{ return I(A::ATTACK_COUNT)>=10; @@ -177,7 +178,11 @@ private: virtual inline void OnComplete()override final{} virtual inline void Draw()const override final{ if(Input::UsingGamepad()){ - attackGroup.DrawInput(game,{game->ScreenWidth()/2.f,48.f},"Attack",180,InputType::CONTROLLER); + if(SteamInput()){ + attackGroup.DrawInput(game,{game->ScreenWidth()/2.f,48.f},"Attack",180,InputType::STEAM); + }else{ + attackGroup.DrawInput(game,{game->ScreenWidth()/2.f,48.f},"Attack",180,InputType::CONTROLLER); + } }else{ attackGroup.DrawInput(game,{game->ScreenWidth()/2.f,48.f},"Attack",180,InputType::KEY); } @@ -193,10 +198,13 @@ private: abilityGroup.ClearAllKeybinds(); ADDKEYBIND(abilityGroup,game->GetPlayer()->KEY_ABILITY1,CONTROLLER); ADDKEYBIND(abilityGroup,game->GetPlayer()->KEY_ABILITY1,KEY); + ADDKEYBIND(abilityGroup,game->GetPlayer()->KEY_ABILITY1,STEAM); ADDKEYBIND(abilityGroup,game->GetPlayer()->KEY_ABILITY2,CONTROLLER); ADDKEYBIND(abilityGroup,game->GetPlayer()->KEY_ABILITY2,KEY); + ADDKEYBIND(abilityGroup,game->GetPlayer()->KEY_ABILITY2,STEAM); ADDKEYBIND(abilityGroup,game->GetPlayer()->KEY_ABILITY3,CONTROLLER); ADDKEYBIND(abilityGroup,game->GetPlayer()->KEY_ABILITY3,KEY); + ADDKEYBIND(abilityGroup,game->GetPlayer()->KEY_ABILITY3,STEAM); } virtual inline bool CompleteCondition()override final{ return I(A::ABILITY_COUNT)>=5; @@ -204,7 +212,11 @@ private: virtual inline void OnComplete()override final{} virtual inline void Draw()const override final{ if(Input::UsingGamepad()){ - abilityGroup.DrawInput(game,{game->ScreenWidth()/2.f,48.f},"Use Abilities",180,InputType::CONTROLLER); + if(SteamInput()){ + abilityGroup.DrawInput(game,{game->ScreenWidth()/2.f,48.f},"Use Abilities",180,InputType::STEAM); + }else{ + abilityGroup.DrawInput(game,{game->ScreenWidth()/2.f,48.f},"Use Abilities",180,InputType::CONTROLLER); + } }else{ abilityGroup.DrawInput(game,{game->ScreenWidth()/2.f,48.f},"Use Abilities",180,InputType::KEY); } @@ -220,6 +232,7 @@ private: defensiveGroup.ClearAllKeybinds(); ADDKEYBIND(defensiveGroup,game->GetPlayer()->KEY_DEFENSIVE,CONTROLLER); ADDKEYBIND(defensiveGroup,game->GetPlayer()->KEY_DEFENSIVE,KEY); + ADDKEYBIND(defensiveGroup,game->GetPlayer()->KEY_DEFENSIVE,STEAM); } virtual inline bool CompleteCondition()override final{ return I(A::DEFENSIVE_COUNT)>=2; @@ -227,7 +240,11 @@ private: virtual inline void OnComplete()override final{} virtual inline void Draw()const override final{ if(Input::UsingGamepad()){ - defensiveGroup.DrawInput(game,{game->ScreenWidth()/2.f,48.f},"Defensive Ability",180,InputType::CONTROLLER); + if(SteamInput()){ + defensiveGroup.DrawInput(game,{game->ScreenWidth()/2.f,48.f},"Defensive Ability",180,InputType::STEAM); + }else{ + defensiveGroup.DrawInput(game,{game->ScreenWidth()/2.f,48.f},"Defensive Ability",180,InputType::CONTROLLER); + } }else{ defensiveGroup.DrawInput(game,{game->ScreenWidth()/2.f,48.f},"Defensive Ability",180,InputType::KEY); } @@ -244,14 +261,17 @@ private: if(!ISBLANK(game->GetLoadoutItem(0))){ ADDKEYBIND(itemsGroup,game->GetPlayer()->KEY_ITEM1,CONTROLLER); ADDKEYBIND(itemsGroup,game->GetPlayer()->KEY_ITEM1,KEY); + ADDKEYBIND(itemsGroup,game->GetPlayer()->KEY_ITEM1,STEAM); } if(!ISBLANK(game->GetLoadoutItem(1))){ ADDKEYBIND(itemsGroup,game->GetPlayer()->KEY_ITEM2,CONTROLLER); ADDKEYBIND(itemsGroup,game->GetPlayer()->KEY_ITEM2,KEY); + ADDKEYBIND(itemsGroup,game->GetPlayer()->KEY_ITEM2,STEAM); } if(!ISBLANK(game->GetLoadoutItem(2))){ ADDKEYBIND(itemsGroup,game->GetPlayer()->KEY_ITEM3,CONTROLLER); ADDKEYBIND(itemsGroup,game->GetPlayer()->KEY_ITEM3,KEY); + ADDKEYBIND(itemsGroup,game->GetPlayer()->KEY_ITEM3,STEAM); } } virtual inline bool CompleteCondition()override final{ @@ -260,7 +280,11 @@ private: virtual inline void OnComplete()override final{} virtual inline void Draw()const override final{ if(Input::UsingGamepad()){ - itemsGroup.DrawInput(game,{game->ScreenWidth()/2.f,48.f},"Use Consumables",180,InputType::CONTROLLER); + if(SteamInput()){ + itemsGroup.DrawInput(game,{game->ScreenWidth()/2.f,48.f},"Use Consumables",180,InputType::STEAM); + }else{ + itemsGroup.DrawInput(game,{game->ScreenWidth()/2.f,48.f},"Use Consumables",180,InputType::CONTROLLER); + } }else{ itemsGroup.DrawInput(game,{game->ScreenWidth()/2.f,48.f},"Use Consumables",180,InputType::KEY); } diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index a368c0f4..7112383d 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 8351 +#define VERSION_BUILD 8357 #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 a4438eb7..a0ff9075 100644 --- a/Adventures in Lestoria/olcUTIL_Animate2D.h +++ b/Adventures in Lestoria/olcUTIL_Animate2D.h @@ -172,10 +172,11 @@ namespace olc::utils::Animate2D Animation() = default; // Change an animation state token to a new state - inline bool ChangeState(AnimationState& state, const StatesEnum& sStateName) const + //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 { 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 f2979209..73a5d247 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ