Skip to content

Commit c5fafe5

Browse files
committed
Slight tweaks, but it occurs to me that the main movepath point-to-ground stuff isn't working just now regardless
1 parent f7209ca commit c5fafe5

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Source/Entities/Actor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ void Actor::OnNewMovePath() {
10911091
std::list<Vector>::iterator nextItr = m_MovePath.begin();
10921092
for (std::list<Vector>::iterator lItr = m_MovePath.begin(); lItr != finalItr; ++lItr) {
10931093
nextItr++;
1094-
smashedPoint = g_SceneMan.MovePointToGround((*lItr), m_CharHeight * 0.2, 0, g_SettingsMan.GetPathFinderGridNodeSize() * 2);
1094+
smashedPoint = g_SceneMan.MovePointToGround((*lItr), m_CharHeight * 0.2, 0, g_SettingsMan.GetPathFinderGridNodeSize() * 2.0f);
10951095

10961096
// Only smash if the new location doesn't cause the path to intersect hard terrain ahead or behind of it
10971097
// Try three times to halve the height to see if that won't intersect

Source/System/PathFinder.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,8 @@ void PathFinder::AdjacentCost(void* state, std::vector<micropather::StateCost>*
361361
break;
362362
}
363363

364-
totalMaterialCost += 1.0F + extraUpCost + (GetMaterialTransitionCost(*currentNode->UpMaterial) * 3.0F) + radiatedCost;
364+
float extraJumpCost = i * i * 0.5F; // Exponential cost increase for jumping higher
365+
totalMaterialCost += 1.0F + extraUpCost + extraJumpCost + (GetMaterialTransitionCost(*currentNode->UpMaterial) * 3.0F) + radiatedCost;
365366

366367
adjCost.cost = totalMaterialCost;
367368
adjCost.state = static_cast<void*>(currentNode->Up);
@@ -385,7 +386,8 @@ void PathFinder::AdjacentCost(void* state, std::vector<micropather::StateCost>*
385386
break;
386387
}
387388

388-
totalMaterialCost += 1.4F + (extraUpCost * 1.4F) + (GetMaterialTransitionCost(*currentNode->UpRightMaterial) * 1.4F * 3.0F) + radiatedCost;
389+
float extraJumpCost = i * i * 0.5F; // Exponential cost increase for jumping higher
390+
totalMaterialCost += 1.4F + (extraUpCost * 1.4F) + (extraJumpCost * 1.4f) + (GetMaterialTransitionCost(*currentNode->UpRightMaterial) * 1.4F * 3.0F) + radiatedCost;
389391

390392
adjCost.cost = totalMaterialCost;
391393
adjCost.state = static_cast<void*>(currentNode->UpRight);
@@ -404,7 +406,8 @@ void PathFinder::AdjacentCost(void* state, std::vector<micropather::StateCost>*
404406
break;
405407
}
406408

407-
totalMaterialCost += 1.4F + (extraUpCost * 1.4F) + (GetMaterialTransitionCost(*currentNode->LeftUpMaterial) * 1.4F * 3.0F) + radiatedCost;
409+
float extraJumpCost = i * i * 0.5F; // Exponential cost increase for jumping higher
410+
totalMaterialCost += 1.4F + (extraUpCost * 1.4F) + (extraJumpCost * 1.4f) + (GetMaterialTransitionCost(*currentNode->LeftUpMaterial) * 1.4F * 3.0F) + radiatedCost;
408411

409412
adjCost.cost = totalMaterialCost;
410413
adjCost.state = static_cast<void*>(currentNode->LeftUp);

0 commit comments

Comments
 (0)