Improved the unlimited ammo exploit fix to prevent crashes during map transition in RP new areas. (from Crafty)

Updated set_new_results_hack with Crafty's newer code base.
This commit is contained in:
NovaRain
2016-07-12 09:47:26 +08:00
parent 86163bf94c
commit 924c35d011
+11 -9
View File
@@ -293,8 +293,10 @@ static void __declspec(naked) invenWieldFunc_item_get_type_hook() {
push ebx push ebx
mov cl, byte ptr [edi+0x27] mov cl, byte ptr [edi+0x27]
and cl, 0x3 and cl, 0x3
xchg edx, eax // eax=who, edx=item xchg edx, eax // eax = who, edx = item
call item_remove_mult_ call item_remove_mult_
pop ebx
xchg ebp, eax
nextWeapon: nextWeapon:
mov eax, esi mov eax, esi
test cl, 0x2 // Right hand? test cl, 0x2 // Right hand?
@@ -310,10 +312,12 @@ removeFlag:
jmp nextWeapon jmp nextWeapon
noWeapon: noWeapon:
or byte ptr [edi+0x27], cl // Set flag of a weapon in hand or byte ptr [edi+0x27], cl // Set flag of a weapon in hand
inc ebp
jz skip
xchg esi, eax xchg esi, eax
mov edx, edi mov edx, edi
pop ebx
call item_add_force_ call item_add_force_
skip:
popad popad
jmp item_get_type_ jmp item_get_type_
} }
@@ -591,12 +595,10 @@ static void __declspec(naked) set_new_results_hack() {
__asm { __asm {
test ah, 0x1 // DAM_KNOCKED_OUT? test ah, 0x1 // DAM_KNOCKED_OUT?
jz end // No jz end // No
mov dword ptr ds:[_critterClearObj], esi mov eax, esi
mov edx, critterClearObjDrugs_ xor edx, edx
xor eax, eax inc edx // type = knockout
inc eax // type = knockout jmp queue_remove_this_ // Remove knockout from queue (if there is one)
call queue_clear_type_ // Remove knockout from queue (if there is one)
retn
end: end:
pop eax // Destroying return address pop eax // Destroying return address
mov eax, 0x424FC6 mov eax, 0x424FC6
@@ -619,7 +621,7 @@ end:
pop esi pop esi
pop ecx pop ecx
pop ebx pop ebx
retn retn
} }
} }