Skip to content

Commit

Permalink
Merge branch 'develop' into develop-JumpjetTilt
Browse files Browse the repository at this point in the history
  • Loading branch information
CrimRecya committed Feb 13, 2025
2 parents 7f8c25a + c317e0c commit 4fe6a68
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 22 deletions.
2 changes: 2 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ This page lists all the individual contributions to the project by their author.
- Raise alert when technos are taking damage
- Toggle waypoint for building
- Parasite returning bug fix
- Bunkerable checks dehardcode
- Prevent the units with locomotors that cause problems from entering the tank bunker
- **tyuah8** - Drive/Jumpjet/Ship/Teleport locomotor did not power on when it is un-piggybacked bugfix
- **Aephiex** - initial fix for Ares academy not working on the initial payloads of vehicles built from a war factory
- **Ares developers**
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Documentation

- [Official docs](https://phobos.readthedocs.io) (also available in [Chinese](https://phobos.readthedocs.io/zh_CN/latest))

You can switch between versions (displays latest develop nightly version by default) in the bottom left corner, as well as download a PDF version.
You can switch between versions (displays latest develop nightly version by default) in the bottom right corner, as well as download a PDF version.

The documentation is split by a few major categories, each represented with a page on the sidebar. Each page has its contents grouped into multiple subcategories, be it buildings, technotypes, infantries, superweapons or something else.

Expand Down
18 changes: 18 additions & 0 deletions docs/Fixed-or-Improved-Logics.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
- Aircraft will now behave as expected according to it's `MovementZone` and `SpeedType` when moving onto different surfaces. In particular, this fixes erratic behavior when vanilla aircraft is ordered to move onto water surface and instead the movement order changes to a shore nearby.
- Allowed `AuxBuilding` to count building upgrades.
- Fix the bug that parasite will vanish if it missed its target when its previous cell is occupied.
- Prevent the units with locomotors that cause problems from entering the tank bunker.

## Fixes / interactions with other extensions

Expand Down Expand Up @@ -1189,6 +1190,23 @@ MinimapColor= ; integer - Red,Green,Blue

## Vehicles

### Bunker entering check dehardcode

- In vanilla, vehicles entering tank bunkers are subject to a series of hardcoding restrictions, including having to have turrets, having to have weapons, and not having Hover speed types. Now you can skip these restrictions.
- This needs to be used with `Bunkerable=yes`.
- This flag only skips the static check, that is, the check on the unit type. The dynamic check (cannot be parasitized) remains unchanged.

In `rulesmd.ini`:
```ini
[SOMEVEHICLE] ; VehicleType
BunkerableAnyway=false ; boolean
```

```{warning}
Skipping checks with this feature doesn't mean that vehicles and tank bunkers will interact correctly. Following the simple checks performed by the provider of this feature, bunkerability is mainly determined by Locomotor. The details about locomotors' bunkerability can be found on [ModEnc](https://modenc.renegadeprojects.com/Bunkerable).
```


### Customizing crushing tilt and slowdown

- Vehicles with `Crusher=true` and `OmniCrusher=true` / `MovementZone=CrusherAll` were hardcoded to tilt when crushing vehicles / walls respectively. This now obeys `TiltsWhenCrushes` but can be customized individually for these two scenarios using `TiltsWhenCrusher.Vehicles` and `TiltsWhenCrusher.Overlays`, which both default to `TiltsWhenCrushes`.
Expand Down
2 changes: 2 additions & 0 deletions docs/Whats-New.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,13 @@ New:
- Raise alert when technos are taking damage (by TaranDahl)
- Enhanced Bombard trajectory (by CrimRecya & Ollerus, based on knowledge of NaotoYuuki)
- Toggle waypoint for building (by TaranDahl)
- Bunkerable checks dehardcode (by TaranDahl)
- Jumpjet Tilts While Moving (by CrimRecya)
Vanilla fixes:
- Aircraft will now behave as expected according to it's `MovementZone` and `SpeedType` when moving onto different surfaces. In particular, this fixes erratic behavior when vanilla aircraft is ordered to move onto water surface and instead the movement order changes to a shore nearby (by CrimRecya)
- Fix the bug that parasite will vanish if it missed its target when its previous cell is occupied (by 航味麻酱)
- Prevent the units with locomotors that cause problems from entering the tank bunker (by TaranDahl)

Phobos fixes:
- Type conversion on Warheads and Superweapons will no longer recursively convert units if applicable conversion pairs are listed, and only first applicable pair takes effect (by Starkku)
Expand Down
4 changes: 2 additions & 2 deletions docs/locale/zh_CN/LC_MESSAGES/index.po
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,9 @@ msgstr ""
#: ../../README.md:59
msgid ""
"You can switch between versions (displays latest develop nightly version by "
"default) in the bottom left corner, as well as download a PDF version."
"default) in the bottom right corner, as well as download a PDF version."
msgstr ""
"您可以在左下角切换版本(默认显示最新开发的每夜构建版本),也可以下载 PDF 版"
"您可以在右下角切换版本(默认显示最新开发的每夜构建版本),也可以下载 PDF 版"
"本。"

#: ../../README.md:61
Expand Down
35 changes: 17 additions & 18 deletions src/Ext/Bullet/Trajectories/BombardTrajectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ void BombardTrajectoryType::Read(CCINIClass* const pINI, const char* pSection)
INI_EX exINI(pINI);

this->Height.Read(exINI, pSection, "Trajectory.Bombard.Height");
this->Height = Math::max(0.0, this->Height);
this->FallPercent.Read(exINI, pSection, "Trajectory.Bombard.FallPercent");
this->FallPercentShift.Read(exINI, pSection, "Trajectory.Bombard.FallPercentShift");
this->FallScatter_Max.Read(exINI, pSection, "Trajectory.Bombard.FallScatter.Max");
Expand Down Expand Up @@ -153,14 +154,12 @@ bool BombardTrajectory::OnAI(BulletClass* pBullet)
if (this->BulletDetonatePreCheck(pBullet))
return true;

// Extra check for trajectory falling
const auto pOwner = pBullet->Owner ? pBullet->Owner->Owner : BulletExt::ExtMap.Find(pBullet)->FirerHouse;
this->BulletVelocityChange(pBullet);

if (this->IsFalling && !this->Type->FreeFallOnTarget && this->BulletDetonateRemainCheck(pBullet, pOwner))
// Extra check for trajectory falling
if (this->IsFalling && !this->Type->FreeFallOnTarget && this->BulletDetonateRemainCheck(pBullet))
return true;

this->BulletVelocityChange(pBullet);

return false;
}

Expand Down Expand Up @@ -208,6 +207,7 @@ void BombardTrajectory::PrepareForOpenFire(BulletClass* pBullet)
pBullet->Velocity *= pType->Trajectory_Speed / pBullet->Velocity.Magnitude();

this->CalculateDisperseBurst(pBullet);
this->RemainingDistance += static_cast<int>(middleLocation.DistanceFrom(pBullet->SourceCoords) + pType->Trajectory_Speed);
}
else
{
Expand Down Expand Up @@ -241,8 +241,9 @@ void BombardTrajectory::PrepareForOpenFire(BulletClass* pBullet)
this->RefreshBulletLineTrail(pBullet);

pBullet->SetLocation(middleLocation);
const auto pOwner = pBullet->Owner ? pBullet->Owner->Owner : pExt->FirerHouse;
AnimExt::CreateRandomAnim(pType->TurningPointAnims, middleLocation, pBullet->Owner, pOwner, true);
const auto pTechno = pBullet->Owner;
const auto pOwner = pTechno ? pTechno->Owner : pExt->FirerHouse;
AnimExt::CreateRandomAnim(pType->TurningPointAnims, middleLocation, pTechno, pOwner, true);
}
}

Expand Down Expand Up @@ -496,7 +497,7 @@ bool BombardTrajectory::BulletDetonatePreCheck(BulletClass* pBullet)
return false;
}

bool BombardTrajectory::BulletDetonateRemainCheck(BulletClass* pBullet, HouseClass* pOwner)
bool BombardTrajectory::BulletDetonateRemainCheck(BulletClass* pBullet)
{
const auto pType = this->Type;
this->RemainingDistance -= static_cast<int>(pType->FallSpeed);
Expand All @@ -519,26 +520,23 @@ void BombardTrajectory::BulletVelocityChange(BulletClass* pBullet)

if (!this->IsFalling)
{
if (pBullet->Location.Z + pBullet->Velocity.Z >= this->Height)
this->RemainingDistance -= static_cast<int>(pType->Trajectory_Speed);

if (this->RemainingDistance < static_cast<int>(pType->Trajectory_Speed))
{
if (this->ToFalling)
{
this->IsFalling = true;
this->RemainingDistance = 1;
const auto pTarget = pBullet->Target;
auto middleLocation = CoordStruct::Empty;

if (!pType->FreeFallOnTarget)
{
middleLocation = CoordStruct
{
static_cast<int>(pBullet->Location.X + pBullet->Velocity.X),
static_cast<int>(pBullet->Location.Y + pBullet->Velocity.Y),
static_cast<int>(pBullet->Location.Z + pBullet->Velocity.Z)
};

if (pType->LeadTimeCalculate && pTarget)
pBullet->TargetCoords += pTarget->GetCoords() - this->InitialTargetCoord + this->CalculateBulletLeadTime(pBullet);

middleLocation = pBullet->Location;
pBullet->Velocity.X = static_cast<double>(pBullet->TargetCoords.X - middleLocation.X);
pBullet->Velocity.Y = static_cast<double>(pBullet->TargetCoords.Y - middleLocation.Y);
pBullet->Velocity.Z = static_cast<double>(pBullet->TargetCoords.Z - middleLocation.Z);
Expand Down Expand Up @@ -569,7 +567,8 @@ void BombardTrajectory::BulletVelocityChange(BulletClass* pBullet)

pBullet->SetLocation(middleLocation);
const auto pTechno = pBullet->Owner;
AnimExt::CreateRandomAnim(pType->TurningPointAnims, middleLocation, pTechno, pTechno ? pTechno->Owner : pExt->FirerHouse, true);
const auto pOwner = pTechno ? pTechno->Owner : pExt->FirerHouse;
AnimExt::CreateRandomAnim(pType->TurningPointAnims, middleLocation, pTechno, pOwner, true);
}
else
{
Expand All @@ -579,7 +578,7 @@ void BombardTrajectory::BulletVelocityChange(BulletClass* pBullet)
if (pType->LeadTimeCalculate && pTarget)
this->LastTargetCoord = pTarget->GetCoords();

pBullet->Velocity *= std::abs((this->Height - pBullet->Location.Z) / pBullet->Velocity.Z);
pBullet->Velocity *= this->RemainingDistance / pType->Trajectory_Speed;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Ext/Bullet/Trajectories/BombardTrajectory.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class BombardTrajectory final : public PhobosTrajectory
void CalculateDisperseBurst(BulletClass* pBullet);
bool BulletPrepareCheck(BulletClass* pBullet);
bool BulletDetonatePreCheck(BulletClass* pBullet);
bool BulletDetonateRemainCheck(BulletClass* pBullet, HouseClass* pOwner);
bool BulletDetonateRemainCheck(BulletClass* pBullet);
void BulletVelocityChange(BulletClass* pBullet);
void RefreshBulletLineTrail(BulletClass* pBullet);
};
26 changes: 26 additions & 0 deletions src/Ext/Techno/Hooks.Misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,4 +429,30 @@ DEFINE_HOOK(0x51D7E0, InfantryClass_DoAction_Water, 0x5)
return Continue;
}

bool __fastcall LocomotorCheckForBunkerable(TechnoTypeClass* pType)
{
auto const loco = pType->Locomotor;

// These locomotors either cause the game to crash or fail to enter the tank bunker properly.
return loco != LocomotionClass::CLSIDs::Hover
&& loco != LocomotionClass::CLSIDs::Mech
&& loco != LocomotionClass::CLSIDs::Fly
&& loco != LocomotionClass::CLSIDs::Droppod
&& loco != LocomotionClass::CLSIDs::Rocket
&& loco != LocomotionClass::CLSIDs::Ship;
}

DEFINE_HOOK(0x70FB73, FootClass_IsBunkerableNow_Dehardcode, 0x6)
{
enum { CanEnter = 0x70FBAF, NoEnter = 0x70FB7D };

GET(TechnoTypeClass*, pType, EAX);
GET(FootClass*, pThis, ESI);

if (!LocomotorCheckForBunkerable(pType) || pThis->ParasiteEatingMe)
return NoEnter;

auto const pTypeExt = TechnoTypeExt::ExtMap.Find(pType);
return pTypeExt->BunkerableAnyway ? CanEnter : 0;
}
#pragma endregion
2 changes: 2 additions & 0 deletions src/Ext/TechnoType/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ void TechnoTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
this->Wake.Read(exINI, pSection, "Wake");
this->Wake_Grapple.Read(exINI, pSection, "Wake.Grapple");
this->Wake_Sinking.Read(exINI, pSection, "Wake.Sinking");
this->BunkerableAnyway.Read(exINI, pSection, "BunkerableAnyway");

this->KeepTargetOnMove.Read(exINI, pSection, "KeepTargetOnMove");
this->KeepTargetOnMove_ExtraDistance.Read(exINI, pSection, "KeepTargetOnMove.ExtraDistance");
Expand Down Expand Up @@ -860,6 +861,7 @@ void TechnoTypeExt::ExtData::Serialize(T& Stm)
.Process(this->Wake_Grapple)
.Process(this->Wake_Sinking)

.Process(this->BunkerableAnyway)
.Process(this->KeepTargetOnMove)
.Process(this->KeepTargetOnMove_ExtraDistance)

Expand Down
2 changes: 2 additions & 0 deletions src/Ext/TechnoType/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ class TechnoTypeExt
Nullable<AnimTypeClass*> Wake_Grapple;
Nullable<AnimTypeClass*> Wake_Sinking;

Valueable<bool> BunkerableAnyway;
Valueable<bool> KeepTargetOnMove;
Valueable<Leptons> KeepTargetOnMove_ExtraDistance;

Expand Down Expand Up @@ -484,6 +485,7 @@ class TechnoTypeExt
, Wake_Grapple { }
, Wake_Sinking { }

, BunkerableAnyway { false }
, KeepTargetOnMove { false }
, KeepTargetOnMove_ExtraDistance { Leptons(0) }

Expand Down

0 comments on commit 4fe6a68

Please sign in to comment.