Skip to content

Commit

Permalink
fix grounded jumpjet's bug
Browse files Browse the repository at this point in the history
  • Loading branch information
NetsuNegi committed Feb 25, 2025
1 parent 3347f41 commit c07cecd
Showing 1 changed file with 30 additions and 10 deletions.
40 changes: 30 additions & 10 deletions src/Misc/Hooks.BugFixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1225,21 +1225,27 @@ size_t __fastcall HexStr2Int_replacement(const char* str)
DEFINE_JUMP(CALL, 0x6E8305, GET_OFFSET(HexStr2Int_replacement)); // TaskForce
DEFINE_JUMP(CALL, 0x6E5FA6, GET_OFFSET(HexStr2Int_replacement)); // TagType

DEFINE_HOOK(0x4DB36C, FootClass_Limbo_RemoveSensorsAt, 0x5)
DEFINE_HOOK(0x54BA1A, JumpjetLocomotionClass_ProcessGrounded_AddSensors, 0x5)
{
enum { SkipGameCode = 0x4DB37C };
GET(FootClass*, pLinkedTo, EAX);

GET(FootClass*, pThis, EDI);
if (pLinkedTo->GetTechnoType()->SensorsSight)
pLinkedTo->AddSensorsAt(pLinkedTo->GetMapCoords());

if (pThis->LastFlightMapCoords != CellStruct::Empty)
pThis->RemoveSensorsAt(pThis->LastFlightMapCoords);
else
pThis->RemoveSensorsAt(pThis->LastMapCoords);
return 0;
}

return SkipGameCode;
DEFINE_HOOK(0x54C9D7, JumpjetLocomotionClass_ProcessDescending_RemoveSensors, 0x5)
{
GET(FootClass*, pLinkedTo, ECX);

if (pLinkedTo->GetTechnoType()->SensorsSight)
pLinkedTo->RemoveSensorsAt(pLinkedTo->LastFlightMapCoords);

return 0;
}

DEFINE_HOOK(0x54D06F, JumpjetLocomotionClass_ProcessCrashing_RemoveSensorsAt, 0x5)
DEFINE_HOOK(0x54D06F, JumpjetLocomotionClass_ProcessCrashing_RemoveSensors, 0x5)
{
GET(FootClass*, pLinkedTo, EAX);

Expand All @@ -1249,7 +1255,21 @@ DEFINE_HOOK(0x54D06F, JumpjetLocomotionClass_ProcessCrashing_RemoveSensorsAt, 0x
return 0;
}

DEFINE_HOOK(0x4DBEE7, FootClass_SetOwningHouse_RemoveSensorsAt, 0x6)
DEFINE_HOOK(0x4DB36C, FootClass_Limbo_RemoveSensors, 0x5)
{
enum { SkipGameCode = 0x4DB37C };

GET(FootClass*, pThis, EDI);

if (pThis->LastFlightMapCoords != CellStruct::Empty)
pThis->RemoveSensorsAt(pThis->LastFlightMapCoords);
else
pThis->RemoveSensorsAt(pThis->LastMapCoords);

return SkipGameCode;
}

DEFINE_HOOK(0x4DBEE7, FootClass_SetOwningHouse_RemoveSensors, 0x6)
{
enum { SkipGameCode = 0x4DBF01 };

Expand Down

0 comments on commit c07cecd

Please sign in to comment.