Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions section/WeaponAimFix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,22 @@ void asm__fixWeaponAim()
"movss xmm1, dword ptr ss:[eax];" // targetPos.z
"movss xmm2, dword ptr ss:[eax+0x8];" // targetPos.y

"mov eax, dword ptr ds:[esi+0x4];" // CAiTarget->entity
"mov eax, dword ptr ds:[esi+0x4];" // CAiTarget->wp_entity->weakObj
"test eax, eax;"

"je EXIT;" // no targetEnity when groundfiring

"push ebx;"
"cmp dword ptr ds:[esi+0x10], 0xF;" // 0xF = auto fire, no attack order.
// "cmp dword ptr ds:[esi+0x10], 0xF;" // 0xF = auto fire, no attack order.
// the route to entity->lastUpdateTick is different
"je noAttackOrder;" // when there is an attack order
// "je noAttackOrder;" // when there is an attack order

"mov eax, dword ptr ds:[eax+0x5C];"
"sub eax, 0x5C;"
"lea eax, dword ptr ds:[eax-4];" // *weakObj - 4 = entity

"noAttackOrder:;"
"mov ebx, dword ptr ds:[eax+0x144];"
// "noAttackOrder:;"
"mov ebx, dword ptr ds:[eax+0x148];"
"mov ebx, dword ptr ds:[ebx+0x900];" // sim->currentTick
"cmp ebx, dword ptr ds:[eax+0x170];" // entity->lastUpdateTick
"cmp ebx, dword ptr ds:[eax+0x174];" // entity->lastUpdateTick
"pop ebx;"

"je EXIT;" // entityLastUpdateTick == currentSimTick means the target's pos is up-to-date
Expand Down