Skip to content

Commit

Permalink
move a hook
Browse files Browse the repository at this point in the history
  • Loading branch information
NetsuNegi committed Feb 26, 2025
1 parent c31fddf commit 2605816
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
18 changes: 18 additions & 0 deletions src/Ext/Unit/Hooks.Jumpjet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <Utilities/Macro.h>
#include <Ext/TechnoType/Body.h>
#include <Ext/WeaponType/Body.h>
#include <Ext/Techno/Body.h>

// Misc jumpjet facing, turning, drawing fix -- Author: Trsdy
// Jumpjets stuck at FireError::FACING because Jumpjet has its own facing just for JumpjetTurnRate
Expand Down Expand Up @@ -165,6 +166,23 @@ FireError __stdcall JumpjetLocomotionClass_Can_Fire(ILocomotion* pThis)

DEFINE_JUMP(VTABLE, 0x7ECDF4, GET_OFFSET(JumpjetLocomotionClass_Can_Fire));

DEFINE_HOOK(0x54DAC4, JumpjetLocomotionClass_EndPiggyback_Blyat, 0x6)
{
GET(FootClass*, pLinkedTo, EAX);
auto const* pType = pLinkedTo->GetTechnoType();

pLinkedTo->PrimaryFacing.SetROT(pType->ROT);

if (pType->SensorsSight)
{
const auto pExt = TechnoExt::ExtMap.Find(pLinkedTo);
pLinkedTo->RemoveSensorsAt(pExt->LastSensorsMapCoords);
pLinkedTo->AddSensorsAt(CellStruct::Empty);
}

return 0;
}

// Fix initial facing when jumpjet locomotor is being attached
DEFINE_HOOK(0x54AE44, JumpjetLocomotionClass_LinkToObject_FixFacing, 0x7)
{
Expand Down
17 changes: 0 additions & 17 deletions src/Misc/Hooks.BugFixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1314,21 +1314,4 @@ DEFINE_HOOK(0x54D06F, JumpjetLocomotionClass_ProcessCrashing_RemoveSensors, 0x5)
return 0;
}

DEFINE_HOOK(0x54DAC4, JumpjetLocomotionClass_EndPiggyback_Blyat, 0x6)
{
GET(FootClass*, pLinkedTo, EAX);
auto const* pType = pLinkedTo->GetTechnoType();

pLinkedTo->PrimaryFacing.SetROT(pType->ROT);

if (pType->SensorsSight)
{
const auto pExt = TechnoExt::ExtMap.Find(pLinkedTo);
pLinkedTo->RemoveSensorsAt(pExt->LastSensorsMapCoords);
pLinkedTo->AddSensorsAt(CellStruct::Empty);
}

return 0;
}

#pragma endregion

0 comments on commit 2605816

Please sign in to comment.