diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index c01f966c..715e5ca0 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -63,6 +63,8 @@ Crawler::Crawler() std::string MONSTERSTRATEGIES_CONFIG = CONFIG_PATH + "monsterstrategies_config"_S; utils::datafile::Read(DATA,MONSTERSTRATEGIES_CONFIG); + DEBUG_PATHFINDING="debug_pathfinding"_I; + for(std::string&cl:DATA.GetProperty("class_list").GetValues()){ std::cout<damage); view.DrawStringPropDecal(dn->pos-GetTextSizeProp(text)/2,text,DARK_RED); } + + if(DEBUG_PATHFINDING){ + std::vectorpathing=game->pathfinder.Solve_AStar(player.get()->GetPos(),GetWorldMousePos(),8,player.get()->OnUpperLevel()); + for(vf2d&square:pathing){ + view.FillRectDecal(square*24,{24,24},DARK_GREEN); + } + } } Player*Crawler::GetPlayer(){ @@ -1077,7 +1086,7 @@ geom2d::rectCrawler::GetTileCollision(MapName map,vf2d pos,bool upperLevel) if(!upperLevel){ //We are looking for lower bridge collisions. for(geom2d::rect&zone:MAP_DATA[map].ZoneData["LowerBridgeCollision"]){ if(geom2d::contains(zone,pos)){ - return {{0,0},{32,32}}; + return {{0,0},{24,24}}; } } } diff --git a/Crawler/Crawler.h b/Crawler/Crawler.h index 7e2a1dba..33cc6179 100644 --- a/Crawler/Crawler.h +++ b/Crawler/Crawler.h @@ -53,6 +53,7 @@ private: int bridgeLayerIndex=-1; float bridgeFadeFactor=0.f; void InitializeClasses(); + int DEBUG_PATHFINDING=0; public: Crawler(); bool OnUserCreate() override; diff --git a/Crawler/Pathfinding.cpp b/Crawler/Pathfinding.cpp index d8414111..a1c7a646 100644 --- a/Crawler/Pathfinding.cpp +++ b/Crawler/Pathfinding.cpp @@ -88,6 +88,7 @@ std::vector Pathfinding::Solve_AStar(vf2d startPos,vf2d endPos,float maxRa nodeStart->fGlobalGoal = heuristic(nodeStart, nodeEnd); std::list listNotTestedNodes; + //if((!upperLevel && nodeStart->bObstacle)||(upperLevel && nodeStart->bObstacleUpper))return {}; listNotTestedNodes.push_back(nodeStart); while (!listNotTestedNodes.empty() && nodeCurrent != nodeEnd) diff --git a/Crawler/Wizard.cpp b/Crawler/Wizard.cpp index e32d592c..07503f77 100644 --- a/Crawler/Wizard.cpp +++ b/Crawler/Wizard.cpp @@ -81,7 +81,7 @@ void Wizard::InitializeClassAbilities(){ if(dist<"Wizard.Right Click Ability.TilesMin"_I*12)return false; vf2d teleportPoint=p->GetPos()+pointTowardsMouse*dist; while(dist>0&&game->HasTileCollision(game->GetCurrentLevel(),teleportPoint)&&p->CanPathfindTo(p->GetPos(),teleportPoint,"Wizard.Right Click Ability.TilesMax"_I)){ - dist-=24; + dist-=4; teleportPoint=p->GetPos()+pointTowardsMouse*dist; } if(dist>0&&p->CanPathfindTo(p->GetPos(),teleportPoint,"Wizard.Right Click Ability.TilesMax"_I)){ diff --git a/Crawler/assets/config/configuration.txt b/Crawler/assets/config/configuration.txt index 30bc0452..b9dd8226 100644 --- a/Crawler/assets/config/configuration.txt +++ b/Crawler/assets/config/configuration.txt @@ -34,4 +34,7 @@ debug_access_options = 0 debug_player_info = 0 # Shows collision boxes of tiles. -debug_collision_boxes = 0 \ No newline at end of file +debug_collision_boxes = 0 + +# Shows pathfinding debugging +debug_pathfinding = 0 \ No newline at end of file