Skip to content

Commit 75b3e95

Browse files
committed
Merge branch 'develop' into BalloonHoverPathingFix
2 parents 794054b + 0fc6584 commit 75b3e95

File tree

8 files changed

+48
-16
lines changed

8 files changed

+48
-16
lines changed

CREDITS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ This page lists all the individual contributions to the project by their author.
390390
- Fix the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it
391391
- Fix the bug that infantry ignored `Passengers` and `SizeLimit` when entering buildings
392392
- Tiberium eater logic
393+
- Fix the bug that ships can travel on elevated bridges
393394
- **Apollo** - Translucent SHP drawing patches
394395
- **ststl**:
395396
- Customizable `ShowTimer` priority of superweapons

docs/Fixed-or-Improved-Logics.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
224224
- Fixed the issue where computer players did not search for new enemies after defeating them or forming alliances with them.
225225
- Fixed the bug that infantry ignored `Passengers` and `SizeLimit` when entering buildings.
226226
- Fixed `VoiceDeploy` not played, when deployed through hot-key/command bar.
227+
- Fixed the bug that ships can travel on elevated bridges.
227228
- Fixed the bug where technos with `BalloonHover=yes` incorrectly considered ground factors when setting the destination and distributing moving commands. If you don't want this anyway, use `[General]->BalloonHoverPathingFix=false` to disable this fix.
228229

229230
## Fixes / interactions with other extensions

docs/Whats-New.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ Vanilla fixes:
395395
- Fixed the bug that buildings will always be tinted as airstrike owner (by NetsuNegi)
396396
- Fixed the issue where computer players did not search for new enemies after defeating them or forming alliances with them (by FlyStar)
397397
- Fixed the bug that infantry ignored `Passengers` and `SizeLimit` when entering buildings (by NetsuNegi)
398+
- Fixed the bug that ships can travel on elevated bridges (by NetsuNegi)
398399
- Fix BalloonHover incorrectly considering ground factors when pathfinding
399400
400401
Phobos fixes:

src/Ext/SWType/FireSuperWeapon.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,8 @@ inline void LimboCreate(BuildingTypeClass* pType, HouseClass* pOwner, int ID)
7676
pBuilding->DiscoveredBy(pOwner);
7777

7878
pOwner->RegisterGain(pBuilding, false);
79-
pOwner->UpdatePower();
8079
pOwner->RecheckTechTree = true;
8180
pOwner->RecheckPower = true;
82-
pOwner->RecheckRadar = true;
8381
pOwner->Buildings.AddItem(pBuilding);
8482

8583
// Different types of building logics

src/Ext/Techno/Body.Update.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,9 @@ void TechnoExt::ExtData::EatPassengers()
305305
}
306306

307307
// Handle gunner change.
308-
if (pThis->GetTechnoType()->Gunner)
308+
auto const pTransportType = pThis->GetTechnoType();
309+
310+
if (pTransportType->Gunner)
309311
{
310312
if (auto const pFoot = abstract_cast<FootClass*>(pThis))
311313
{
@@ -327,6 +329,13 @@ void TechnoExt::ExtData::EatPassengers()
327329
pPassenger->KillPassengers(pSource);
328330
pPassenger->RegisterDestruction(pSource);
329331
pPassenger->UnInit();
332+
333+
// Handle extra power
334+
if (auto const pBldType = abstract_cast<BuildingTypeClass*, true>(pTransportType))
335+
{
336+
if (pBldType->ExtraPowerBonus || pBldType->ExtraPowerDrain)
337+
pThis->Owner->RecheckPower = true;
338+
}
330339
}
331340

332341
this->PassengerDeletionTimer.Stop();
@@ -868,6 +877,11 @@ void TechnoExt::KillSelf(TechnoClass* pThis, AutoDeathBehavior deathOption, Anim
868877

869878
pThis->RegisterKill(pThis->Owner);
870879
pThis->UnInit();
880+
881+
// Handle extra power
882+
if (pThis->Absorbed && pThis->Transporter)
883+
pThis->Transporter->Owner->RecheckPower = true;
884+
871885
return;
872886
}
873887

src/Ext/Techno/Hooks.Misc.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -767,32 +767,34 @@ DEFINE_HOOK(0x70FB73, FootClass_IsBunkerableNow_Dehardcode, 0x6)
767767

768768
DEFINE_HOOK(0x730D1F, DeployCommandClass_Execute_VoiceDeploy, 0x5)
769769
{
770-
GET_STACK(int, unitsToDeploy, STACK_OFFSET(0x18, -0x4));
770+
GET_STACK(const int, unitsToDeploy, STACK_OFFSET(0x18, -0x4));
771771

772772
if (unitsToDeploy != 1)
773773
return 0;
774774

775775
GET(TechnoClass* const, pThis, ESI);
776-
auto const whatAmI = pThis->WhatAmI();
776+
777+
const auto whatAmI = pThis->WhatAmI();
777778

778779
if (whatAmI == AbstractType::Infantry)
779780
{
780-
auto pInfantry = static_cast<InfantryClass*>(pThis);
781+
const auto pInfantry = static_cast<InfantryClass*>(pThis);
781782

782783
if (!pInfantry->IsDeploying)
783784
{
784785
if (pInfantry->IsDeployed())
785-
pThis->QueueVoice(pThis->GetTechnoType()->VoiceUndeploy);
786+
pThis->QueueVoice(pInfantry->Type->VoiceUndeploy);
786787
else
787-
pThis->QueueVoice(pThis->GetTechnoType()->VoiceDeploy);
788+
pThis->QueueVoice(pInfantry->Type->VoiceDeploy);
788789
}
789790
}
790791
else if (whatAmI == AbstractType::Unit)
791792
{
792-
auto pUnit = static_cast<UnitClass*>(pThis);
793+
const auto pUnit = static_cast<UnitClass*>(pThis);
794+
const auto pType = pUnit->Type;
793795

794-
if (pUnit->TryToDeploy() || pUnit->Type->IsSimpleDeployer)
795-
pThis->QueueVoice(pThis->GetTechnoType()->VoiceDeploy);
796+
if (pUnit->TryToDeploy() || pType->IsSimpleDeployer)
797+
pThis->QueueVoice(pType->VoiceDeploy);
796798
}
797799

798800
return 0;

src/Ext/Unit/Hooks.Crushing.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <Utilities/Macro.h>
77
#include <Utilities/TemplateDef.h>
88

9-
DEFINE_HOOK(0x073B05B, UnitClass_PerCellProcess_TiltWhenCrushes, 0x6)
9+
DEFINE_HOOK(0x73B05B, UnitClass_PerCellProcess_TiltWhenCrushes, 0x6)
1010
{
1111
enum { SkipGameCode = 0x73B074 };
1212

@@ -22,7 +22,7 @@ DEFINE_HOOK(0x073B05B, UnitClass_PerCellProcess_TiltWhenCrushes, 0x6)
2222
return SkipGameCode;
2323
}
2424

25-
DEFINE_HOOK(0x0741941, UnitClass_OverrunSquare_TiltWhenCrushes, 0x6)
25+
DEFINE_HOOK(0x741941, UnitClass_OverrunSquare_TiltWhenCrushes, 0x6)
2626
{
2727
enum { SkipGameCode = 0x74195E };
2828

@@ -91,7 +91,7 @@ DEFINE_HOOK(0x6A108D, ShipLocomotionClass_WhileMoving_CrushTilt, 0xD)
9191
{
9292
enum { SkipGameCode = 0x6A109A };
9393

94-
GET(DriveLocomotionClass*, pThis, EBP);
94+
GET(ShipLocomotionClass*, pThis, EBP);
9595

9696
auto const pLinkedTo = pThis->LinkedTo;
9797
auto const pTypeExt = TechnoTypeExt::ExtMap.Find(pLinkedTo->GetTechnoType());

src/Misc/Hooks.BugFixes.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,6 +1560,17 @@ DEFINE_HOOK(0x449462, BuildingClass_IsCellOccupied_UndeploysInto, 0x6)
15601560
return SkipGameCode;
15611561
}
15621562

1563+
DEFINE_HOOK(0x73FA92, UnitClass_IsCellOccupied_LandType, 0x8)
1564+
{
1565+
enum { ContinueCheck = 0x73FC24, NoMove = 0x73FACD };
1566+
1567+
GET(UnitClass*, pThis, EBX);
1568+
GET(CellClass*, pCell, EDI);
1569+
GET_STACK(bool, containsBridge, STACK_OFFSET(0x90, -0x7D));
1570+
1571+
return GroundType::Array[static_cast<int>(containsBridge ? LandType::Road : pCell->LandType)].Cost[static_cast<int>(pThis->Type->SpeedType)] == 0.0f ? NoMove : ContinueCheck;
1572+
}
1573+
15631574
#pragma region XSurfaceFix
15641575

15651576
// Fix a crash at 0x7BAEA1 when trying to access a point outside of surface bounds.
@@ -1832,11 +1843,13 @@ DEFINE_HOOK(0x5198C3, FootClass_UpdatePosition_EnterGrinderSound, 0x6)// Infantr
18321843
return 0;
18331844
}
18341845

1835-
DEFINE_HOOK(0x51A304, InfantryClass_UpdatePosition_EnterBioReactorSound, 0x6)
1846+
DEFINE_HOOK(0x51A304, InfantryClass_UpdatePosition_EnterBioReactor, 0x6)
18361847
{
18371848
enum { SkipGameCode = 0x51A30A };
18381849

18391850
GET(BuildingClass*, pReactor, EDI);
1851+
GET(FootClass*, pFoot, ESI);
1852+
pFoot->Transporter = pReactor;
18401853
const int enterSound = pReactor->Type->EnterBioReactorSound;
18411854

18421855
if (enterSound >= 0)
@@ -1848,11 +1861,13 @@ DEFINE_HOOK(0x51A304, InfantryClass_UpdatePosition_EnterBioReactorSound, 0x6)
18481861
return 0;
18491862
}
18501863

1851-
DEFINE_HOOK(0x44DBCF, BuildingClass_Mission_Unload_LeaveBioReactorSound, 0x6)
1864+
DEFINE_HOOK(0x44DBCF, BuildingClass_Mission_Unload_LeaveBioReactor, 0x6)
18521865
{
18531866
enum { SkipGameCode = 0x44DBD5 };
18541867

18551868
GET(BuildingClass*, pReactor, EBP);
1869+
GET(FootClass*, pFoot, ESI);
1870+
pFoot->Transporter = nullptr;
18561871
const int leaveSound = pReactor->Type->LeaveBioReactorSound;
18571872

18581873
if (leaveSound >= 0)

0 commit comments

Comments
 (0)