diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 2f601fe4..7d78e3a8 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -895,6 +895,7 @@ void AiL::RenderWorld(float fElapsedTime){ if(!IsForegroundTile(tileSheet,tileSheetIndex)&&!IsUpperForegroundTile(tileSheetIndex)&&!IsReflectiveTile(tileSheet,tileSheetIndex)){ if(layer.tag.data["class"]!="CollisionOnly"){visibleTiles.erase({x,y});} RenderTile({x,y},tileSheet,tileSheetIndex,{tileSheetX,tileSheetY}); + #pragma region Debug Collision boxes #ifdef _DEBUG if("debug_collision_boxes"_I){ if(tileSheet.tileset->collision.find(tileSheetIndex)!=tileSheet.tileset->collision.end()){ @@ -904,6 +905,7 @@ void AiL::RenderWorld(float fElapsedTime){ } } #endif + #pragma endregion } } } @@ -948,17 +950,23 @@ void AiL::RenderWorld(float fElapsedTime){ } }break; } - for(int y2=0;y2<2;y2++){ - for(int x2=0;x2<2;x2++){ - vf2d tilePos=vf2d{float(x),float(y)}*24; - vf2d gridPos=tilePos+pathfinder.gridSpacing*vf2d{float(x2),float(y2)}; - Pixel col=RED; - if(!pathfinder.nodes[gridPos].bObstacle&&!pathfinder.nodes[gridPos].bObstacleUpper){ - col=GREEN; + #pragma region Debug A* Tiles + #ifdef _DEBUG + if(DEBUG_PATHFINDING){ + for(int y2=0;y2<2;y2++){ + for(int x2=0;x2<2;x2++){ + vf2d tilePos=vf2d{float(x),float(y)}*24; + vf2d gridPos=tilePos+pathfinder.gridSpacing*vf2d{float(x2),float(y2)}; + Pixel col=RED; + if(!pathfinder.nodes[gridPos].bObstacle&&!pathfinder.nodes[gridPos].bObstacleUpper){ + col=GREEN; + } + view.FillRectDecal(gridPos,pathfinder.gridSpacing,{col.r,col.g,col.b,128}); + } } - view.FillRectDecal(gridPos,pathfinder.gridSpacing,{col.r,col.g,col.b,128}); } - } + #endif + #pragma endregion }else{ if(GetCurrentMap().backdrop.length()>0){ vf2d tileWorldPos=vi2d{x,y}*GetCurrentMapData().tilewidth; @@ -977,7 +985,6 @@ void AiL::RenderWorld(float fElapsedTime){ } } #pragma endregion - //DrawDecal({0,0},MAP_TILESETS["assets/maps/"+MAP_DATA[LEVEL1].TilesetData[1].data["source"]]->Decal()); for(Monster&m:MONSTER_LIST){ m.strategyDraw(this); diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index f91d9642..c7e38c2f 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -235,29 +235,34 @@ void Monster::Draw(){ } game->view.DrawPartialRotatedDecal(GetPos()-vf2d{0,GetZ()},GetFrame().GetSourceImage()->Decal(),0,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,vf2d(GetSizeMult()*(GetFacingDirection()==RIGHT?-1:1),GetSizeMult()),GetBuffs(BuffType::SLOWDOWN).size()>0?Pixel{uint8_t(255*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration))),uint8_t(255*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration))),uint8_t(128+127*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration)))}:WHITE); + #pragma region Debug Pathfinding + #ifdef _DEBUG + if("debug_pathfinding"_I){ + for(float index=0.f;indexpathIndex+1){ + col=GREY; + } + game->view.FillRectDecal(path.GetSplinePoint(index).pos,{1,1},col); + } - for(float index=0.f;indexpathIndex+1){ - col=GREY; - } - game->view.FillRectDecal(path.GetSplinePoint(index).pos,{1,1},col); - } - - for(size_t counter=0;Pathfinding::sPoint2D&point:path.points){ - Pixel col=CYAN; - if(counterpathIndex+1){ - col=YELLOW; + for(size_t counter=0;Pathfinding::sPoint2D&point:path.points){ + Pixel col=CYAN; + if(counterpathIndex+1){ + col=YELLOW; + } + game->view.FillRectDecal(point.pos,{3,3},col); + counter++; + } } - game->view.FillRectDecal(point.pos,{3,3},col); - counter++; - } + #endif + #pragma endregion } void Monster::DrawReflection(float drawRatioX,float multiplierX){ game->SetDecalMode(DecalMode::ADDITIVE); @@ -436,7 +441,7 @@ void Monster::PathAroundBehavior(float fElapsedTime){ facingDirection=LEFT; } }else{ - if(pathIndex>=path.points.size()){ + if(pathIndex>=path.points.size()-1){ //We have reached the end of the path! pathIndex=0; targetAcquireTimer=0; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 79bbba6b..77e42156 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 1 -#define VERSION_BUILD 5681 +#define VERSION_BUILD 5682 #define stringify(a) stringify_(a) #define stringify_(a) #a