Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ This page lists all the individual contributions to the project by their author.
- Fast access structure
- Iron Curtain/Custom Tint Support for SHP Turreted Vehicles
- Reactivate unused trigger events 2, 53, and 54
- The target of death is excluded from automatic target selection
- **NetsuNegi**:
- Forbidding parallel AI queues by type
- Jumpjet crash speed fix when crashing onto building
Expand Down
1 change: 1 addition & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- Reactivate unused trigger events 2, 53, and 54.
- Fixed the bug that vehicle fall on infantry will make all cell content has been removed.
- Fixed `MovementZone=Subterannean` harvesters being unable to find docks if in area enclosed by water, cliffs etc.
- The target of death is excluded from automatic target selection.

## 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 @@ -491,6 +491,7 @@ Vanilla fixes:
- Fixed the bug that vehicle fall on infantry will make all cell content has been removed (by NetsuNegi)
- Fixed buildings that have their owner changed during buildup skipping buildup and sometimes not correctly clearing the state (by Starkku)
- Fixed `MovementZone=Subterannean` harvesters being unable to find docks if in area enclosed by water, cliffs etc.
- The target of death is excluded from automatic target selection (by FlyStar)

Phobos fixes:
- Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi)
Expand Down
33 changes: 33 additions & 0 deletions src/Misc/Hooks.BugFixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2818,3 +2818,36 @@ DEFINE_HOOK(0x54CC9C, JumpjetLocomotionClass_ProcessCrashing_DropFix, 0x5)

return fallOnSomething ? SkipGameCode2 : SkipGameCode;
}

#pragma region CanAutoTargetFix

DEFINE_JUMP(LJMP, 0x6F7D88, 0x6F7DA9) // They should be placed at the front.

DEFINE_HOOK_AGAIN(0x6F8B56, TechnoClass_CheckAutoTargetObject_OnMap, 0x5) // TechnoClass::TryAutoTargetObject
DEFINE_HOOK_AGAIN(0x6F9C89, TechnoClass_CheckAutoTargetObject_OnMap, 0x8) // TechnoClass::SelectAutoTargetObject_TechnoClass.Array
DEFINE_HOOK_AGAIN(0x6F9B9C, TechnoClass_CheckAutoTargetObject_OnMap, 0x8) // TechnoClass::SelectAutoTargetObject_AircraftClass.Array
DEFINE_HOOK(0x6F91F2, TechnoClass_CheckAutoTargetObject_OnMap, 0x9) // TechnoClass::SelectAutoTargetObject_AircraftTrackerClass
{
const DWORD address = R->Origin();
TechnoClass* const pTarget = (address == 0x6F91F2 || address == 0x6F8B56) ?
R->EBP<TechnoClass*>() : R->EDI<TechnoClass*>();

if (!pTarget->IsAlive || pTarget->Health <= 0 || pTarget->InLimbo)
{
switch (address)
{
case 0x6F91F2:
return 0x6F9377;
case 0x6F9B9C:
return 0x6F9C48;
case 0x6F8B56:
return 0x6F8C07;
default:
return 0x6F9D93;
}
}

return 0;
}

#pragma endregion