Skip to content

Commit 3de494f

Browse files
committed
Merge branch 'develop' into fryone/owner_changer
2 parents f00d0e6 + 963b54d commit 3de494f

8 files changed

Lines changed: 81 additions & 24 deletions

File tree

docs/Fixed-or-Improved-Logics.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
130130
- Objects with `Palette` set now have their color tint adjusted accordingly by superweapons, map retint actions etc. if they belong to a house using any color scheme instead of only those from the first half of `[Colors]` list.
131131
- Animations using `AltPalette` are now remapped to their owner's color scheme instead of first listed color scheme and no longer draw over shroud. Color scheme from `[AudioVisual]` -> `AnimRemapDefaultColorScheme` is used if anim has no owner, which defaults to first listed color scheme from `[Colors]` still.
132132
- They can also have map lighting apply on them if `AltPalette.ApplyLighting` is set to true.
133+
- Fixed `DeployToFire` not considering building placement rules for `DeploysInto` buildings and as a result not working properly with `WaterBound` buildings.
134+
- Fixed `DeployToFire` not recalculating firer's position on land if it cannot currently deploy.
133135

134136
## Fixes / interactions with other extensions
135137

docs/New-or-Enhanced-Logics.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,10 @@ Strength=0 ; integer
449449
Armor= ; ArmorType
450450
```
451451

452+
```{note}
453+
Currently interceptor weapons with projectiles that do not have `Inviso=true` will be unable to intercept projectiles if the firer of the interceptor weapon dies before the interceptor weapon projectile reaches its target. This may change in future.
454+
```
455+
452456
### Projectile trajectories
453457

454458
- Projectiles can now have customizable trajectories.

docs/Whats-New.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ You can use the migration utility (can be found on [Phobos supplementaries repo]
263263

264264
### Version TBD (develop branch nightly builds)
265265

266-
<details>
266+
<details open>
267267
<summary>Click to show</summary>
268268

269269
New:
@@ -367,6 +367,8 @@ Vanilla fixes:
367367
- Suppressed the BuildingCaptured EVA events when capturing a building considered as a vehicle (by Trsdy)
368368
- Objects with `Palette` set now have their color tint adjusted accordingly by superweapons, map retint actions etc. if they belong to a house using any color scheme instead of only those from the first half of `[Colors]` list (by Starkku)
369369
- Animations using `AltPalette` are now remapped to their owner's color scheme instead of first listed color scheme and no longer draw over shroud (by Starkku)
370+
- Fixed `DeployToFire` not considering building placement rules for `DeploysInto` buildings and as a result not working properly with `WaterBound` buildings (by Starkku)
371+
- Fixed `DeployToFire` not recalculating firer's position on land if it cannot currently deploy (by Starkku)
370372

371373
Phobos fixes:
372374
- Fixed a few errors of calling for superweapon launch by `LaunchSW` or building infiltration (by Trsdy)
@@ -383,6 +385,7 @@ Phobos fixes:
383385
- Fixed an issue with `Gunner=true` vehicles not correctly using the first passenger's mode with multiple passengers inside (by Starkku)
384386
- Used `MindControl.Anim` for buildings deployed from mind-controlled vehicles (by Trsdy)
385387
- Optimized extension class implementation, should improve performance all around (by Otamaa & Starkku)
388+
- Fixed `Interceptor` not resetting target if the intercepted projectile changes type to non-interceptable one afterwards (by Starkku)
386389

387390
Fixes / interactions with other extensions:
388391
- Fixed an issue introduced by Ares that caused `Grinding=true` building `ActiveAnim` to be incorrectly restored while `SpecialAnim` was playing and the building was sold, erased or destroyed (by Starkku)
@@ -392,6 +395,7 @@ Fixes / interactions with other extensions:
392395

393396
<details>
394397
<summary>Click to show</summary>
398+
395399
New:
396400
- Additional sync logging in case of desync errors occuring (by Starkku)
397401

src/Ext/Anim/Hooks.cpp

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -264,32 +264,13 @@ DEFINE_HOOK(0x4232E2, AnimClass_DrawIt_AltPalette, 0x6)
264264
return SkipGameCode;
265265
}
266266

267-
namespace ConvertTemp
268-
{
269-
int shadeCount = -1;
270-
}
271-
272267
// Set ShadeCount to 53 to initialize the palette fully shaded - this is required to make it not draw over shroud for some reason.
273268
DEFINE_HOOK(0x68C4C4, GenerateColorSpread_ShadeCountSet, 0x5)
274269
{
275270
GET(int, shadeCount, EDX);
276271

277-
ConvertTemp::shadeCount = shadeCount;
278-
R->EDX(53);
279-
280-
return 0;
281-
}
282-
283-
// Restore original ShadeCount.
284-
DEFINE_HOOK(0x68C4E7, GenerateColorSpread_ShadeCountUnset, 0x5)
285-
{
286-
GET(LightConvertClass*, pConvert, EAX);
287-
288-
if (pConvert && ConvertTemp::shadeCount != -1)
289-
{
290-
pConvert->ShadeCount = ConvertTemp::shadeCount;
291-
ConvertTemp::shadeCount = -1;
292-
}
272+
if (shadeCount == 1)
273+
R->EDX(53);
293274

294275
return 0;
295276
}

src/Ext/Bullet/Body.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ void BulletExt::ExtData::InterceptBullet(TechnoClass* pSource, WeaponTypeClass*
1414
return;
1515

1616
auto const pThis = this->OwnerObject();
17-
auto const pTypeExt = this->TypeExtData;
17+
auto pTypeExt = this->TypeExtData;
1818
bool canAffect = false;
1919
bool isIntercepted = false;
2020

@@ -60,7 +60,8 @@ void BulletExt::ExtData::InterceptBullet(TechnoClass* pSource, WeaponTypeClass*
6060
{
6161
pThis->Speed = pWeaponOverride->Speed;
6262
pThis->Type = pWeaponOverride->Projectile;
63-
this->TypeExtData = BulletTypeExt::ExtMap.Find(pThis->Type);
63+
pTypeExt = BulletTypeExt::ExtMap.Find(pThis->Type);
64+
this->TypeExtData = pTypeExt;
6465

6566
if (this->LaserTrails.size())
6667
{
@@ -69,6 +70,10 @@ void BulletExt::ExtData::InterceptBullet(TechnoClass* pSource, WeaponTypeClass*
6970
if (!pThis->Type->Inviso)
7071
this->InitializeLaserTrails();
7172
}
73+
74+
// Lose target if the current bullet is no longer interceptable.
75+
if (!pTypeExt->Interceptable || (pTypeExt->Armor.isset() && GeneralUtils::GetWarheadVersusArmor(pWeapon->Warhead, pTypeExt->Armor.Get()) == 0.0))
76+
pSource->SetTarget(nullptr);
7277
}
7378
}
7479

src/Ext/Techno/Body.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,42 @@ void TechnoExt::GetValuesForDisplay(TechnoClass* pThis, DisplayInfoType infoType
577577
}
578578
}
579579

580+
// Checks if vehicle can deploy into a building at its current location. If unit has no DeploysInto set returns noDeploysIntoDefaultValue (def = false) instead.
581+
bool TechnoExt::CanDeployIntoBuilding(UnitClass* pThis, bool noDeploysIntoDefaultValue)
582+
{
583+
if (!pThis)
584+
return false;
585+
586+
auto const pDeployType = pThis->Type->DeploysInto;
587+
588+
if (!pDeployType)
589+
return noDeploysIntoDefaultValue;
590+
591+
bool canDeploy = true;
592+
auto mapCoords = CellClass::Coord2Cell(pThis->GetCoords());
593+
594+
if (pDeployType->GetFoundationWidth() > 2 || pDeployType->GetFoundationHeight(false) > 2)
595+
mapCoords += CellStruct { -1, -1 };
596+
597+
pThis->Mark(MarkType::Up);
598+
599+
if (!pThis->Locomotor)
600+
Game::RaiseError(E_POINTER);
601+
602+
pThis->Locomotor->Mark_All_Occupation_Bits(MarkType::Up);
603+
604+
if (!pDeployType->CanCreateHere(mapCoords, pThis->Owner))
605+
canDeploy = false;
606+
607+
if (!pThis->Locomotor)
608+
Game::RaiseError(E_POINTER);
609+
610+
pThis->Locomotor->Mark_All_Occupation_Bits(MarkType::Down);
611+
pThis->Mark(MarkType::Down);
612+
613+
return canDeploy;
614+
}
615+
580616
// =============================
581617
// load / save
582618

src/Ext/Techno/Body.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ class TechnoExt
136136
static bool AllowedTargetByZone(TechnoClass* pThis, TechnoClass* pTarget, TargetZoneScanType zoneScanType, WeaponTypeClass* pWeapon = nullptr, bool useZone = false, int zone = -1);
137137
static void UpdateAttachedAnimLayers(TechnoClass* pThis);
138138
static bool ConvertToType(FootClass* pThis, TechnoTypeClass* toType);
139+
static bool CanDeployIntoBuilding(UnitClass* pThis, bool noDeploysIntoDefaultValue = false);
139140

140141
// WeaponHelpers.cpp
141142
static int PickWeaponIndex(TechnoClass* pThis, TechnoClass* pTargetTechno, AbstractClass* pTarget, int weaponIndexOne, int weaponIndexTwo, bool allowFallback = true, bool allowAAFallback = true);

src/Misc/Hooks.BugFixes.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,3 +723,27 @@ DEFINE_HOOK(0x4834E5, CellClass_IsClearToMove_BridgeEdges, 0x5)
723723

724724
return 0;
725725
}
726+
727+
// Fix DeployToFire not working properly for WaterBound DeploysInto buildings and not recalculating position on land if can't deploy.
728+
DEFINE_HOOK(0x4D580B, FootClass_ApproachTarget_DeployToFire, 0x6)
729+
{
730+
enum { SkipGameCode = 0x4D583F };
731+
732+
GET(UnitClass*, pThis, EBX);
733+
734+
R->EAX(TechnoExt::CanDeployIntoBuilding(pThis, true));
735+
736+
return SkipGameCode;
737+
}
738+
739+
DEFINE_HOOK(0x741050, UnitClass_CanFire_DeployToFire, 0x6)
740+
{
741+
enum { SkipGameCode = 0x741086, MustDeploy = 0x7410A8 };
742+
743+
GET(UnitClass*, pThis, ESI);
744+
745+
if (pThis->Type->DeployToFire && pThis->CanDeployNow() && !TechnoExt::CanDeployIntoBuilding(pThis, true))
746+
return MustDeploy;
747+
748+
return SkipGameCode;
749+
}

0 commit comments

Comments
 (0)