Repository navigation
Clamp path velocity only when it exceeds the maximum - #258
Open
ResurrectedTrader wants to merge 1 commit into
Open
ResurrectedTrader wants to merge 1 commit into
ResurrectedTrader wants to merge 1 commit into
Conversation
sub_6FD5CEB0 clamped dwVelocity and cleared dwAcceleration when the
velocity reached dwMaxVelocity. The game does that only when the
velocity exceeds it; at exactly the maximum the acceleration is kept.
1.10f inlines this in D2Common_10226 (0x6FDAC9A0), Hex-Rays (v2 =
pDynamicPath; +124 dwVelocity, +132 dwMaxVelocity, +136 dwAcceleration,
+140 dwAccelerationsCounter):
v16 = *(_DWORD *)(v2 + 136);
if ( v16 != 0 )
{
v17 = *(_DWORD *)(v2 + 140) + 1;
*(_DWORD *)(v2 + 140) = v17;
if ( v17 >= 5 )
{
v18 = v16 + *(_DWORD *)(v2 + 124);
v19 = *(_DWORD *)(v2 + 132);
*(_DWORD *)(v2 + 124) = v18;
if ( v18 <= v19 )
{
if ( v18 < 0 )
*(_DWORD *)(v2 + 124) = 0;
}
else
{
*(_DWORD *)(v2 + 124) = v19;
*(_DWORD *)(v2 + 136) = 0;
}
*(_DWORD *)(v2 + 140) = 0;
}
}
Disassembly:
6FDACB7E mov ebp, [esi+7Ch] ; dwVelocity
6FDACB81 add ebp, eax ; + dwAcceleration
6FDACB83 mov eax, [esi+84h] ; dwMaxVelocity
6FDACB89 mov ecx, ebp
6FDACB8B mov [esi+7Ch], ebp
6FDACB8E cmp ecx, eax
6FDACB90 jle 6FDACB9D ; <= max: keep acceleration
6FDACB92 mov [esi+7Ch], eax
6FDACB95 mov [esi+88h], ebx ; dwAcceleration = 0
1.14d (Game.exe 0x006502D0) is the same: if ( v4 <= v5 ) ... else
{ clamp; result[34] = 0; }, 0x00650302 cmp edx, ecx / jle. 1.13c was
not checked.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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_6FD5CEB0clampeddwVelocityand cleareddwAccelerationas soon as the velocity reacheddwMaxVelocity. The game does that only when the velocity exceeds it; at exactly the maximum the acceleration is kept.1.10f
Inlined in
D2Common_10226(D2Common.0x6FDAC9A0), Hex-Rays (v2=pDynamicPath;+124dwVelocity,+132dwMaxVelocity,+136dwAcceleration,+140dwAccelerationsCounter):1.14d
PATH_UpdateVelocityWithAcceleration(Game.exe0x006502D0), Hex-Rays:Change
if (pDynamicPath->dwVelocity > nOldVelocity). Not version-gated, since 1.10f and 1.14d agree; I have not checked 1.13c, whose address the function is annotated with. Also adds the 1.14d address.🤖 Generated with Claude Code