Skip to content
Draft
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
2 changes: 2 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ This page lists all the individual contributions to the project by their author.
- Warhead activation target health thresholds
- MP saves support for quicksave command and savegame trigger action
- Ported XNA CnCNet Client MP save handling
- Open-topped buildings
- Building unload self-attack fix
- **Uranusian (Thrifinesma)**:
- Mind Control enhancement
- Custom warhead splash list
Expand Down
2 changes: 1 addition & 1 deletion YRpp
2 changes: 2 additions & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- `DeployingAnim` using unit drawer now also tint accordingly with the unit.
- Fixed an issue that jumpjets in air can not correctly spawn missiles.
- Fixed an issue that the currently hovered planning node not update up-to-date, such as using hotkeys to select technos.
- Fixed `OpenTopped` to work with buildings.
- Fixed buildings giving an order to attack self when unloading (manifested with opentopped buildings and garrisons leaving buildings sometimes).

## Fixes / interactions with other extensions

Expand Down
2 changes: 2 additions & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,8 @@ Vanilla fixes:
- `DeployingAnim` using unit drawer now also tint accordingly with the unit (by Starkku)
- Jumpjets in air now can correctly spawn missiles (by TaranDahl)
- Fixed an issue that the currently hovered planning node not update up-to-date, such as using hotkeys to select technos (by CrimRecya)
- Fixed `OpenTopped` to work with buildings (by Kerbiter)
- Fixed buildings giving an order to attack self when unloading (manifested with opentopped buildings and garrisons leaving buildings sometimes) (by Kerbiter)

Phobos fixes:
- Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi)
Expand Down
1 change: 1 addition & 0 deletions src/Ext/Techno/Body.Update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,7 @@ void TechnoExt::ExtData::UpdateTypeData_Foot()

// Update open topped state of potential passengers if transport's OpenTopped value changes.
// OpenTopped does not work properly with buildings to begin with which is why this is here rather than in the Techno update one.
// TODO move to non-foot since we now have proper building open-topped support
if (pThis->Passengers.NumPassengers > 0)
{
const bool toOpenTopped = pCurrentType->OpenTopped;
Expand Down
73 changes: 73 additions & 0 deletions src/Misc/Hooks.BugFixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2657,3 +2657,76 @@ DEFINE_HOOK(0x741A66, UnitClass_SetDestination_JJVehFix, 0x5)
}

#pragma endregion

#pragma region OpenTopped on buildings

DEFINE_HOOK(0x51A320, InfantryClass_PerCellProcess_SubmitToOpenToppedOnBuildingEnter, 0x7)
{
GET(BuildingClass* const, pBuilding, EDI);
GET(InfantryClass* const, pThis, ESI);

if (pBuilding->Type->OpenTopped)
pBuilding->EnteredOpenTopped(pThis);

// there's no opentopped infantry... yet :P
if (pThis->Type->OpenTopped)
pThis->SetTargetForPassengers(nullptr);

// where's Multfinite's cncnet5 cli... erm, I mean, fixup of the stolen relative address instructions???
// return 0;

R->EAX(pBuilding->IsAbsorbAllowed());
return 0x51A327;
}

DEFINE_HOOK(0x73A2F4, UnitClass_PerCellProcess_SubmitToOpenToppedOnBuildingEnter, 0x6)
{
GET(UnitClass* const, pThis, EBP);
GET(BuildingClass* const, pBuilding, EBX);

if (pBuilding->Type->OpenTopped)
pBuilding->EnteredOpenTopped(pThis);

if (pThis->Type->OpenTopped)
pThis->SetTargetForPassengers(nullptr);

return 0;
}

DEFINE_HOOK(0x44DBA9, BuildingClass_MissionUnload_DisableOpenToppedForUnloading, 0x6)
{
GET(BuildingClass* const, pThis, EBP);
GET(FootClass* const, pFoot, ESI);

if (pThis->Type->OpenTopped)
pThis->ExitedOpenTopped(pFoot);

if (pThis->Type->OpenTopped && pFoot->Owner != pThis->Owner)
pFoot->SetTarget(nullptr);

return 0;
}

// misleading WW name, Drop_Debris also handles survivors
DEFINE_HOOK(0x442D97, BuildingClass_DropDebris_DisableOpenTopped, 0x6)
{
GET(BuildingClass* const, pThis, ECX);

if (pThis->Type->OpenTopped)
pThis->MarkPassengersAsExited();

return 0;
}

#pragma endregion

// previously the building was given as a target for the unload order, unlike unit unload order which uses null target
DEFINE_HOOK_AGAIN(0x443557, BuildingClass_ActiveClickWith_NullTargetForUnload, 0x0)
DEFINE_HOOK(0x443534, BuildingClass_ActiveClickWith_NullTargetForUnload, 0x0)
{
GET(BuildingClass* const, pThis, EBX);

R->EAX(pThis->ClickedMission(Mission::Unload, nullptr, nullptr, nullptr));

return R->Origin() + 17;
}
Loading