Skip to content

Commit

Permalink
Skip turret rotation and jumpjet wobbling under EMP
Browse files Browse the repository at this point in the history
  • Loading branch information
chaserli committed Jan 12, 2024
1 parent b25d8a4 commit 5243923
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ This page lists all the individual contributions to the project by their author.
- Permanent healthbar display on units targeted by temporal weapons fix
- Powered anims on buildings cease playing upon capture by different house fix
- TechnoType conversion placeholder
- EIP 00529A14 crash fix on Linux
- EIP 00529A14 crash fix on Linux
- Skip units' turret rotation and jumpjets' wobbling under EMP
- Misc code refactor & maintenance, CN doc fixes, bugfixes
- **FlyStar**
- Campaign load screen PCX support
Expand Down
2 changes: 2 additions & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- Fixed the issue where the powered anims of `Powered`/`PoweredSpecial` buildings cease to update when being captured by enemies.
- Fix a glitch related to incorrect target setting for missiles.
- Fix [EIP 00529A14](https://modenc.renegadeprojects.com/Internal_Error/YR#eip_00529A14) when attempting to read `[Header]` section of campaign maps.
- Units will no longer rotate its turret under EMP.
- Jumpjets will no longer wobble under EMP.

## Fixes / interactions with other extensions

Expand Down
1 change: 1 addition & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ Vanilla fixes:
- `Powered`/`PoweredSpecial` buildings' powered anims will update as usual when being captured by enemies (by Trsdy)
- Fixed a glitch related to incorrect target setting for missiles (by Belonit)
- Skipped parsing `[Header]` section of compaign maps which led to occasional crashes on Linux (by Trsdy)
- Fixed units' turret rotation and jumpjet wobble under EMP (by Trsdy)
Phobos fixes:
- Fixed a few errors of calling for superweapon launch by `LaunchSW` or building infiltration (by Trsdy)
Expand Down
24 changes: 23 additions & 1 deletion src/Ext/Unit/Hooks.Jumpjet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,30 @@ DEFINE_HOOK(0x736EE9, UnitClass_UpdateFiring_FireErrorIsOK, 0x6)
return 0;
}

DEFINE_HOOK(0x54D208, JumpjetLocomotionClass_ProcessMove_EMPWobble, 0x5)
{
GET(JumpjetLocomotionClass* const, pThis, ESI);
enum { ZeroWobble = 0x54D22C };

if (pThis->LinkedTo->IsUnderEMP())
return ZeroWobble;

return 0;
}

DEFINE_HOOK(0x736990, UnitClass_UpdateRotation_TurretFacing_EMP, 0x6)
{
GET(UnitClass* const, pThis, ECX);
enum { SkipAll = 0x736C0E };

if (pThis->Deactivated || pThis->IsUnderEMP())
return SkipAll;

return 0;
}

// Bugfix: Align jumpjet turret's facing with body's
DEFINE_HOOK(0x736BA3, UnitClass_UpdateRotation_TurretFacing_TemporaryFix, 0x6)
DEFINE_HOOK(0x736BA3, UnitClass_UpdateRotation_TurretFacing_Jumpjet, 0x6)
{
GET(UnitClass* const, pThis, ESI);
enum { SkipCheckDestination = 0x736BCA, GetDirectionTowardsDestination = 0x736BBB };
Expand Down
2 changes: 1 addition & 1 deletion src/Misc/Hooks.BugFixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ DEFINE_HOOK(0x6D9781, Tactical_RenderLayers_DrawInfoTipAndSpiedSelection, 0x5)

bool __fastcall BuildingClass_SetOwningHouse_Wrapper(BuildingClass* pThis, void*, HouseClass* pHouse, bool announce)
{
// Fix : Suppress capture EVA event if ConsideredVehicle=no
// Fix : Suppress capture EVA event if ConsideredVehicle=yes
announce = announce && !pThis->Type->IsVehicle();

using this_func_sig = bool(__thiscall*)(BuildingClass*, HouseClass*, bool);
Expand Down

0 comments on commit 5243923

Please sign in to comment.