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 @@ -394,6 +394,7 @@ This page lists all the individual contributions to the project by their author.
- Health bar permanently displayed
- Unlimbo Detonate warhead
- Fast access structure
- 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 @@ -266,6 +266,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- Fixed an issue that infantry walking through a cell containing a tree would cause it to be impassable to other houses.
- Fixed the bug that techno unit will draw with ironcurtain and airstrike color and intensity who disguised as terrain or overlay.
- Fixed an issue that the AI would enter a combat state when its building receiving damage from friendly units or damage not greater than 0.
- 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 @@ -479,6 +479,7 @@ Vanilla fixes:
- Fixed an issue that infantry walking through a cell containing a tree would cause it to be impassable to other houses (by TaranDahl)
- Fixed the bug that techno unit will draw with ironcurtain and airstrike color and intensity who disguised as terrain or overlay (by NetsuNegi)
- Fixed an issue that the AI would enter a combat state when its building receiving damage from friendly units or damage not greater than 0 (by TaranDahl)
- 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 @@ -2744,3 +2744,36 @@ DEFINE_HOOK(0x44242A, BuildingClass_ReceiveDamage_SetLATime, 0x8)
}

#pragma endregion

#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