Skip to content

Commit 51f60a5

Browse files
committed
code
1 parent 03e42a1 commit 51f60a5

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

src/Ext/Rules/Body.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ void RulesExt::ExtData::LoadBeforeTypeData(RulesClass* pThis, CCINIClass* pINI)
267267

268268
this->HarvesterScanAfterUnload.Read(exINI, GameStrings::General, "HarvesterScanAfterUnload");
269269

270+
this->BalloonHoverPathingFix.Read(exINI, GameStrings::General, "BalloonHoverPathingFix");
271+
270272
// Section AITargetTypes
271273
int itemsCount = pINI->GetKeyCount("AITargetTypes");
272274
for (int i = 0; i < itemsCount; ++i)
@@ -489,6 +491,7 @@ void RulesExt::ExtData::Serialize(T& Stm)
489491
.Process(this->ProneSpeed_NoCrawls)
490492
.Process(this->DamagedSpeed)
491493
.Process(this->HarvesterScanAfterUnload)
494+
.Process(this->BalloonHoverPathingFix)
492495
;
493496
}
494497

src/Ext/Rules/Body.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ class RulesExt
220220

221221
Valueable<bool> HarvesterScanAfterUnload;
222222

223+
Valueable<bool> BalloonHoverPathingFix;
224+
223225
ExtData(RulesClass* OwnerObject) : Extension<RulesClass>(OwnerObject)
224226
, Storage_TiberiumIndex { -1 }
225227
, HarvesterDumpAmount { 0.0f }
@@ -385,6 +387,7 @@ class RulesExt
385387
, DamagedSpeed { 0.75 }
386388

387389
, HarvesterScanAfterUnload { false }
390+
, BalloonHoverPathingFix { false }
388391
{ }
389392

390393
virtual ~ExtData() = default;

src/Misc/Hooks.BugFixes.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,3 +1929,42 @@ DEFINE_HOOK(0x47EAF7, CellClass_RemoveContent_BeforeUnmarkOccupationBits, 0x7)
19291929
R->EAX(pContent->WhatAmI());
19301930
return ContinueCheck;
19311931
}
1932+
1933+
#pragma region BalloonHoverPathingFix
1934+
1935+
DEFINE_HOOK(0x64D592, Game_PreProcessMegaMissionList_CheckForTargetCrdRecal1, 0x6)
1936+
{
1937+
enum { SkipTargetCrdRecal = 0x64D598 };
1938+
GET(TechnoClass*, pTechno, EBP);
1939+
return pTechno->GetTechnoType()->BalloonHover && RulesExt::Global()->BalloonHoverPathingFix ? SkipTargetCrdRecal : 0;
1940+
}
1941+
1942+
DEFINE_HOOK(0x64D575, Game_PreProcessMegaMissionList_CheckForTargetCrdRecal2, 0x6)
1943+
{
1944+
enum { SkipTargetCrdRecal = 0x64D598 };
1945+
GET(TechnoClass*, pTechno, EBP);
1946+
return pTechno->GetTechnoType()->BalloonHover && RulesExt::Global()->BalloonHoverPathingFix ? SkipTargetCrdRecal : 0;
1947+
}
1948+
1949+
DEFINE_HOOK(0x64D5C5, Game_PreProcessMegaMissionList_CheckForTargetCrdRecal3, 0x6)
1950+
{
1951+
enum { SkipTargetCrdRecal = 0x64D659 };
1952+
GET(TechnoClass*, pTechno, EBP);
1953+
return pTechno->GetTechnoType()->BalloonHover && RulesExt::Global()->BalloonHoverPathingFix ? SkipTargetCrdRecal : 0;
1954+
}
1955+
1956+
DEFINE_HOOK(0x51BFA2, InfantryClass_IsCellOccupied_Start, 0x6)
1957+
{
1958+
enum { MoveOK = 0x51C02D };
1959+
GET(InfantryClass*, pThis, EBP);
1960+
return pThis->IsInAir() && pThis->Type->BalloonHover && RulesExt::Global()->BalloonHoverPathingFix ? MoveOK : 0;
1961+
}
1962+
1963+
DEFINE_HOOK(0x73F0A7, UnitClass_IsCellOccupied_Start, 0x9)
1964+
{
1965+
enum { MoveOK = 0x73F23F };
1966+
GET(UnitClass*, pThis, ECX);
1967+
return pThis->IsInAir() && pThis->Type->BalloonHover && RulesExt::Global()->BalloonHoverPathingFix ? MoveOK : 0;
1968+
}
1969+
1970+
#pragma endregion

0 commit comments

Comments
 (0)