diff --git a/Adventures in Lestoria/State_OverworldMap.cpp b/Adventures in Lestoria/State_OverworldMap.cpp index a005ce14..8ab12144 100644 --- a/Adventures in Lestoria/State_OverworldMap.cpp +++ b/Adventures in Lestoria/State_OverworldMap.cpp @@ -111,23 +111,10 @@ void State_OverworldMap::OnUserUpdate(AiL*game){ ||game->KEY_LEFT.Pressed()||game->KEY_RIGHT.Pressed()||game->KEY_UP.Pressed()||game->KEY_DOWN.Pressed() ||(!analogMove&&(abs(game->KEY_SCROLLHORZ_L.Analog())>=0.2f||abs(game->KEY_SCROLLVERT_L.Analog())>=0.2f))){ bool mouseUsed=game->GetMouse(Mouse::LEFT).bPressed&&geom2d::overlaps(game->GetWorldMousePos(),cp.rect); - for(int directionInd=0;int neighborInd:currentConnectionPoint->neighbors){ - int targetDirection=-1; - if(game->KEY_LEFT.Pressed()||game->KEY_SCROLLHORZ_L.Analog()<=-0.2f)targetDirection=ConnectionPoint::WEST; - if(game->KEY_RIGHT.Pressed()||game->KEY_SCROLLHORZ_L.Analog()>=0.2f)targetDirection=ConnectionPoint::EAST; - if(game->KEY_UP.Pressed()||game->KEY_SCROLLVERT_L.Analog()<=-0.2f)targetDirection=ConnectionPoint::NORTH; - if(game->KEY_DOWN.Pressed()||game->KEY_SCROLLVERT_L.Analog()>=0.2f)targetDirection=ConnectionPoint::SOUTH; - - if(neighborInd==-1){ - directionInd++; - continue; - } - - ConnectionPoint&neighbor=ConnectionPointFromIndex(neighborInd); - if(Unlock::IsUnlocked(neighbor.unlockCondition)&&&cp==&neighbor - &&(mouseUsed||targetDirection==directionInd)){ - UpdateCurrentConnectionPoint(neighbor); + if(Unlock::IsUnlocked(cp)){ + if(mouseUsed){ + UpdateCurrentConnectionPoint(cp); playerTargetPos=currentConnectionPoint->rect.pos+currentConnectionPoint->rect.size/2+vf2d{0,16}; float angleTo=util::angleTo(game->GetPlayer()->GetPos(),playerTargetPos); if(angleTo>=-3*PI/4&&angleTo<-PI/4){ @@ -143,8 +130,42 @@ void State_OverworldMap::OnUserUpdate(AiL*game){ } if(abs(game->KEY_SCROLLHORZ_L.Analog())>=0.2f||abs(game->KEY_SCROLLVERT_L.Analog()>=0.2f))analogMove=true; goto doneNavigating; + }else{ + for(int directionInd=0;int neighborInd:currentConnectionPoint->neighbors){ + int targetDirection=-1; + + if(game->KEY_LEFT.Pressed()||game->KEY_SCROLLHORZ_L.Analog()<=-0.2f)targetDirection=ConnectionPoint::WEST; + if(game->KEY_RIGHT.Pressed()||game->KEY_SCROLLHORZ_L.Analog()>=0.2f)targetDirection=ConnectionPoint::EAST; + if(game->KEY_UP.Pressed()||game->KEY_SCROLLVERT_L.Analog()<=-0.2f)targetDirection=ConnectionPoint::NORTH; + if(game->KEY_DOWN.Pressed()||game->KEY_SCROLLVERT_L.Analog()>=0.2f)targetDirection=ConnectionPoint::SOUTH; + + if(neighborInd==-1){ + directionInd++; + continue; + } + + ConnectionPoint&neighbor=ConnectionPointFromIndex(neighborInd); + if(Unlock::IsUnlocked(neighbor.unlockCondition)&&targetDirection==directionInd){ + UpdateCurrentConnectionPoint(neighbor); + playerTargetPos=currentConnectionPoint->rect.pos+currentConnectionPoint->rect.size/2+vf2d{0,16}; + float angleTo=util::angleTo(game->GetPlayer()->GetPos(),playerTargetPos); + if(angleTo>=-3*PI/4&&angleTo<-PI/4){ + game->GetPlayer()->UpdateWalkingAnimation(UP); + }else + if(angleTo=-PI/4){ + game->GetPlayer()->UpdateWalkingAnimation(RIGHT); + }else + if(angleTo>=PI/4&&angleTo<3*PI/4){ + game->GetPlayer()->UpdateWalkingAnimation(DOWN); + }else{ + game->GetPlayer()->UpdateWalkingAnimation(LEFT); + } + if(abs(game->KEY_SCROLLHORZ_L.Analog())>=0.2f||abs(game->KEY_SCROLLVERT_L.Analog()>=0.2f))analogMove=true; + goto doneNavigating; + } + directionInd++; + } } - directionInd++; } } } @@ -172,7 +193,7 @@ void State_OverworldMap::Draw(AiL*game){ } bool highlightedAStage=false; for(ConnectionPoint&cp:connections){ - if(Unlock::IsUnlocked(cp)&&geom2d::overlaps(game->GetWorldMousePos(),cp.rect)&&(&cp==currentConnectionPoint||cp.IsNeighbor(*currentConnectionPoint))){ + if(Unlock::IsUnlocked(cp)&&geom2d::overlaps(game->GetWorldMousePos(),cp.rect)){ drawutil::DrawCrosshairDecalTransformedView(game->view,cp.rect,currentTime); highlightedAStage=true; break; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 0f57aff4..c08306e8 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 2 #define VERSION_PATCH 3 -#define VERSION_BUILD 9546 +#define VERSION_BUILD 9551 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 92d9573c..55f8b139 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ