Skip to content
Closed
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
72 changes: 71 additions & 1 deletion src/Misc/Hooks.BugFixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2181,6 +2181,76 @@ namespace DamageAreaTemp
// Note: Ares hook at 0x489562(0x6) and return 0
DEFINE_JUMP(LJMP, 0x489568, 0x489592);

DEFINE_NAKED_HOOK(0x4896BF, DamageArea_DamageItemsFix1)
{
// Use:
// ebx -> pCell , no change
// esi -> pObject , CHECK_THIS_OBJECT: change , CHECK_NEXT_CELL: will be covered later
// eax -> returnAddress , will be covered later
__asm
{
mov dword ptr [DamageAreaTemp::CheckingCell], ebx

mov esi, [ebx]CellClass.FirstObject
test esi, esi
jnz CHECK_THIS_OBJECT

mov esi, [ebx]CellClass.AltObject
test esi, esi
jz CHECK_NEXT_CELL

mov byte ptr [DamageAreaTemp::CheckingCellAlt], 1

CHECK_THIS_OBJECT:

mov eax, 0x4896DD
jmp eax

CHECK_NEXT_CELL:

mov eax, 0x4899BE
jmp eax
}
}

DEFINE_NAKED_HOOK(0x4899B3, DamageArea_DamageItemsFix2)
{
// Use:
// esi -> pObject , CHECK_THIS_OBJECT: change , CHECK_NEXT_CELL: will be covered later
// eax -> returnAddress , will be covered later
__asm
{
mov esi, [esi]ObjectClass.NextObject
test esi, esi
jnz CHECK_THIS_OBJECT

mov al, [DamageAreaTemp::CheckingCellAlt]
test al, al
jnz CHECK_NEXT_CELL_RESET

mov esi, [DamageAreaTemp::CheckingCell]
mov esi, [esi]CellClass.AltObject
test esi, esi
jz CHECK_NEXT_CELL

mov byte ptr [DamageAreaTemp::CheckingCellAlt], 1

CHECK_THIS_OBJECT:

mov eax, 0x4896DD
jmp eax

CHECK_NEXT_CELL_RESET:

mov byte ptr [DamageAreaTemp::CheckingCellAlt], 0

CHECK_NEXT_CELL:

mov eax, 0x4899BE
jmp eax
}
}
/*
DEFINE_HOOK(0x4896BF, DamageArea_DamageItemsFix1, 0x6)
{
enum { CheckNextCell = 0x4899BE, CheckThisObject = 0x4896DD };
Expand Down Expand Up @@ -2237,7 +2307,7 @@ DEFINE_HOOK(0x4899B3, DamageArea_DamageItemsFix2, 0x5)
R->ESI(pObject);
return CheckThisObject;
}

*/
DEFINE_HOOK(0x489BDB, DamageArea_RockerItemsFix1, 0x6)
{
enum { SkipGameCode = 0x489C29 };
Expand Down
Loading