Repository navigation
Fix the per-step check for a path toward an item or object - #246
Closed
ResurrectedTrader wants to merge 1 commit into
Closed
ResurrectedTrader wants to merge 1 commit into
ResurrectedTrader wants to merge 1 commit into
Conversation
sub_6FD5DB70 (the per-step check for a path with a target unit) kept the current path only for a player or monster target that moved at most 5 subtiles. Any other target type fell through to D2Common_10236 and re-pathed on every step. The game applies the "moved more than 5 subtiles" re-path to players and monsters only, and then keeps any target's path while points remain or while the unit stands on the final point. 1.10f, inlined in D2Common_10226 (D2Common.0x6FDACAC2-0x6FDACB22): a target of type > 1 jumps past the distance test straight to the remaining-points test. 1.14d is the same (Game.exe.0x650480-0x6504D2). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Superseded by #253, which keeps the game's NULL check on pTargetUnit (D2Common.0x6FDACAC5 / Game.exe 0x00650483) that this PR dropped. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
sub_6FD5DB70is the per-step check for a path with a target unit. In MOO it only keeps the current path for a player or monster target that has moved at most 5 subtiles. Every other target type (item, object, ...) falls through toD2Common_10236and re-paths on every step, so walking to an item or an object re-solves the path each step and stalls whenever that re-path fails.In the game, the "moved more than 5 subtiles" re-path applies only to players and monsters. After that, any target keeps its path while points remain, or while the unit stands on the final point.
1.10f
Inlined in
D2Common_10226(D2Common.0x6FDAC9A0). This is the whole inlined function (esi=pDynamicPath;+0x14tPrevTargetCoord,+0x18tFinalTargetCoord,+0x24/+0x28point index / count,+0x30pUnit,+0x3CdwPathType,+0x58pTargetUnit,+0x93nStepNum).6FDACB47continues the step (TRUE),6FDACB32stops it (FALSE). Any target of type > 1 jumps past the distance test straight to the remaining-points test:1.14d
PATH_CheckIfTargetReached(Game.exe0x6503F0) is the same function, not inlined:Change
Most of the diff is re-nesting. For a player or monster target the result is unchanged: re-path if it moved more than 5 subtiles, otherwise keep the path while points remain or the unit stands on the final point. The behaviour change is for item, object and other targets, which now take the points test too instead of re-pathing every step.
pTargetUnitis already known to be non-NULL at this point (the function returns earlier otherwise), so I dropped the redundant check. Not version-gated, since 1.10f and 1.14d agree.🤖 Generated with Claude Code