Skip to content

Commit 016a0bc

Browse files
committed
Revert "Update Hooks.BugFixes.cpp"
This reverts commit 0483fbe.
1 parent 0483fbe commit 016a0bc

File tree

1 file changed

+12
-49
lines changed

1 file changed

+12
-49
lines changed

src/Misc/Hooks.BugFixes.cpp

Lines changed: 12 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1968,67 +1968,30 @@ DEFINE_HOOK(0x64D5C5, Game_PreProcessMegaMissionList_CheckForTargetCrdRecal3, 0x
19681968
return pTechno->GetTechnoType()->BalloonHover && RulesExt::Global()->BalloonHoverPathingFix ? SkipTargetCrdRecal : 0;
19691969
}
19701970

1971-
bool __fastcall ShouldSkipCellCheck(FootClass* pThis)
1971+
DEFINE_HOOK(0x51BFA2, InfantryClass_IsCellOccupied_Start, 0x6)
19721972
{
1973-
return pThis->GetTechnoType()->BalloonHover && RulesExt::Global()->BalloonHoverPathingFix && pThis->IsInAir();
1973+
enum { MoveOK = 0x51C02D };
1974+
GET(InfantryClass*, pThis, EBP);
1975+
return pThis->Type->BalloonHover && RulesExt::Global()->BalloonHoverPathingFix && pThis->IsInAir() ? MoveOK : 0;
19741976
}
19751977

1976-
DEFINE_NAKED_HOOK(0x51BFA2, InfantryClass_IsCellOccupied_Start)
1978+
DEFINE_HOOK(0x73F0A7, UnitClass_IsCellOccupied_Start, 0x9)
19771979
{
1978-
InfantryClass* pThis;
1979-
_asm { mov pThis, ebp }
1980-
_asm { mov esi, ecx }
1981-
if (ShouldSkipCellCheck(pThis))
1982-
{
1983-
_asm { mov eax, 0x51C02D }
1984-
}
1985-
else
1986-
{
1987-
_asm { mov ecx, esi }
1988-
_asm { test [ecx+140h], ebx }
1989-
_asm { mov eax, 0x51BFA8 }
1990-
}
1991-
_asm { jmp eax }
1992-
}
1993-
1994-
DEFINE_NAKED_HOOK(0x73F0A7, UnitClass_IsCellOccupied_Start)
1995-
{
1996-
UnitClass* pThis;
1997-
_asm { mov pThis, ecx }
1998-
if (ShouldSkipCellCheck(pThis))
1999-
{
2000-
_asm { mov eax, 0x73F23F }
2001-
}
2002-
else
2003-
{
2004-
_asm { mov ebx, ecx }
2005-
_asm { mov ecx, [esp+88h] }
2006-
_asm { mov eax, 0x73F0B0 }
2007-
}
2008-
_asm { jmp eax }
1980+
enum { MoveOK = 0x73F23F };
1981+
GET(UnitClass*, pThis, ECX);
1982+
return pThis->Type->BalloonHover && RulesExt::Global()->BalloonHoverPathingFix && pThis->IsInAir() ? MoveOK : 0;
20091983
}
20101984

20111985
namespace ApproachTargetContext
20121986
{
20131987
bool IsBalloonHover = false;
20141988
}
20151989

2016-
bool __fastcall ShouldSetContext(FootClass* pThis)
1990+
DEFINE_HOOK(0x4D5690, FootClass_ApproachTarget_SetContext, 0x6)
20171991
{
2018-
return pThis->GetTechnoType()->BalloonHover && RulesExt::Global()->BalloonHoverPathingFix;
2019-
}
2020-
2021-
DEFINE_NAKED_HOOK(0x4D5690, FootClass_ApproachTarget_SetContext)
2022-
{
2023-
FootClass* pThis;
2024-
_asm { mov pThis, ecx }
2025-
ShouldSetContext(pThis);
2026-
_asm { mov ApproachTargetContext::IsBalloonHover, al }
2027-
_asm { push ebp }
2028-
_asm { mov ebp, esp }
2029-
_asm { and esp, 0FFFFFFF8h }
2030-
_asm { mov eax, 0x4D5696 }
2031-
_asm { jmp eax }
1992+
GET(FootClass*, pThis, ECX);
1993+
ApproachTargetContext::IsBalloonHover = pThis->GetTechnoType()->BalloonHover && RulesExt::Global()->BalloonHoverPathingFix;
1994+
return 0;
20321995
}
20331996

20341997
DEFINE_HOOK_AGAIN(0x4D5A42, FootClass_ApproachTarget_ResetContext, 0x5);

0 commit comments

Comments
 (0)