Skip to content

Commit 2dc078e

Browse files
committed
Make IvanBomb detonation/image centering a toggle
1 parent a3a523b commit 2dc078e

File tree

5 files changed

+38
-26
lines changed

5 files changed

+38
-26
lines changed

docs/Fixed-or-Improved-Logics.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
8686
- Fixed railgun particles being drawn to wrong coordinate against buildings with non-default `TargetCoordOffset` or when force-firing on bridges.
8787
- Fixed building `TargetCoordOffset` not being taken into accord for several things like fire angle calculations and target lines.
8888
- In singleplayer missions, the player can now see cloaked objects owned by allied houses.
89-
- IvanBomb images now display and the bombs detonate at center of buildings instead of in top-leftmost cell of the building foundation.
89+
- IvanBomb images can now display and the bombs detonate at center of buildings instead of in top-leftmost cell of the building foundation if `[CombatDamage]` -> `IvanBombAttachToCenter` is set to true.
9090
- Fixed BibShape drawing for a couple of frames during buildup for buildings with long buildup animations.
9191
- Animation with `Tiled=yes` now supports `CustomPalette`.
9292
- Attempted to avoid units from retaining previous orders (attack,grind,garrison,etc) after changing ownership (mind-control,abduction,etc).
@@ -296,15 +296,6 @@ This page describes all ingame logics that are fixed or improved in Phobos witho
296296
- 1000 save files are supported, from `SVGM_000.NET` to `SVGM_999.NET`. When the limit is reached, the game will overwrite the latest save file.
297297
- The previous `SVGM_XXX.NET` files are cleaned up before first copy if it's a new game, otherwise the highest numbered `SVGM_XXX.NET` file is found and the index is incremented, if possible.
298298
- The game also automatically copies `spawn.ini` to the save folder as `spawnSG.ini` when saving a game.
299-
300-
```{note}
301-
The described behavior is a replica of and is compliant with XNA CnCNet Client's multiplayer save game support.
302-
```
303-
304-
```{note}
305-
At the moment this is only useful if you use a version of [YRpp Spawner](https://github.com/CnCNet/yrpp-spawner) with multiplayer saves support (along with [XNA CnCNet Client](https://github.com/CnCNet/xna-cncnet-client)).
306-
```
307-
308299
- Fixed an issue that Ares' Type Conversion not resetting barrel's direction by `FireAngle`.
309300
- Fixed an issue that jumpjet vehicles can not stop correctly when assigned a target in range.
310301
- Fixed an issue that jumpjet infantry stop incorrectly when assigned a target out of range.
@@ -314,6 +305,14 @@ At the moment this is only useful if you use a version of [YRpp Spawner](https:/
314305
- Fixed the issue where Ares' `Flash.Duration` cannot override the weapon's repair flash effect.
315306
- Fixed buildings that have their owner changed during buildup skipping buildup and sometimes not correctly clearing the state.
316307

308+
```{note}
309+
The described behavior is a replica of and is compliant with XNA CnCNet Client's multiplayer save game support.
310+
```
311+
312+
```{note}
313+
At the moment this is only useful if you use a version of [YRpp Spawner](https://github.com/CnCNet/yrpp-spawner) with multiplayer saves support (along with [XNA CnCNet Client](https://github.com/CnCNet/xna-cncnet-client)).
314+
```
315+
317316
## Aircraft
318317

319318
### Carryall pickup voice

docs/Whats-New.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ You can use the migration utility (can be found on [Phobos supplementaries repo]
3030

3131
#### From post-0.3 devbuilds
3232

33+
- Ivan bombs no longer automatically center on building when attached. Set `[CombatDamage]` -> `IvanBombAttachToCenter` to true to restore this behaviour. Due to technical constraints this cannot be customized per WeaponType.
3334
- `AlternateFLH` no longer affects vehicle passengers by default. To re-enable it, set `AlternateFLH.ApplyVehicle=true` on the transport unit.
3435
- Parsing priority of `ShowBriefing` and `BriefingTheme` between map file and `missionmd.ini` has been switched (from latter taking priority over former to vice-versa) due to technical limitations and compatibility issues with spawner DLL.
3536
- Game will now produce fatal error with an error message if any of the files listed in `[$Include]` in any INI file do not exist.
@@ -488,6 +489,7 @@ Vanilla fixes:
488489
- Iron Curtain/Custom Tint Support for SHP Turreted Vehicles (by NetsuNegi & FlyStar)
489490
- Reactivate unused trigger events 2, 53, and 54 (by FlyStar)
490491
- Fixed the bug that vehicle fall on infantry will make all cell content has been removed (by NetsuNegi)
492+
- Fixed buildings that have their owner changed during buildup skipping buildup and sometimes not correctly clearing the state (by Starkku)
491493
492494
Phobos fixes:
493495
- Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi)
@@ -527,7 +529,7 @@ New:
527529
- Super Weapons launching other Super Weapons (by Morton)
528530
- Launching Super Weapons on building infiltration (by Morton)
529531
- Building airstrike target eligibility customization (by Starkku)
530-
- IvanBomb detonation & image display centered on buildings (by Starkku)
532+
- IvanBomb detonation & image display optionally centered on buildings (by Starkku)
531533
- Forcing specific weapon against cloaked or disguised targets (by Starkku)
532534
- Customizable ROF random delay (by Starkku)
533535
- Animation with `Tiled=yes` now supports `CustomPalette` (by ststl)
@@ -833,7 +835,6 @@ Vanilla fixes:
833835
- Fixed the bug that hover vehicle will sink if destroyed on bridge (by NetsuNegi)
834836
- Fixed the fact that when the selected unit is in a rearmed state, it can unconditionally use attack mouse on the target (by FlyStar)
835837
- Fixed pathfinding crashes (EIP 0x42A525, 0x42C507, 0x42C554) that happened on bigger maps due to too small pathfinding node buffer (by CrimRecya)
836-
- Fixed buildings that have their owner changed during buildup skipping buildup and sometimes not correctly clearing the state (by Starkku)
837838
838839
Phobos fixes:
839840
- Fixed a few errors of calling for superweapon launch by `LaunchSW` or building infiltration (by Trsdy)

src/Ext/Rules/Body.cpp

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

328328
this->WarheadAnimZAdjust.Read(exINI, GameStrings::AudioVisual, "WarheadAnimZAdjust");
329329

330+
this->IvanBombAttachToCenter.Read(exINI, GameStrings::CombatDamage, "IvanBombAttachToCenter");
331+
330332
// Section AITargetTypes
331333
int itemsCount = pINI->GetKeyCount("AITargetTypes");
332334
for (int i = 0; i < itemsCount; ++i)
@@ -597,6 +599,7 @@ void RulesExt::ExtData::Serialize(T& Stm)
597599
.Process(this->InfantryAutoDeploy)
598600
.Process(this->AdjacentWallDamage)
599601
.Process(this->WarheadAnimZAdjust)
602+
.Process(this->IvanBombAttachToCenter)
600603
;
601604
}
602605

src/Ext/Rules/Body.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ class RulesExt
275275
Valueable<int> AdjacentWallDamage;
276276

277277
Valueable<int> WarheadAnimZAdjust;
278+
279+
Valueable<bool> IvanBombAttachToCenter;
278280

279281
ExtData(RulesClass* OwnerObject) : Extension<RulesClass>(OwnerObject)
280282
, Storage_TiberiumIndex { -1 }
@@ -490,6 +492,8 @@ class RulesExt
490492
, AdjacentWallDamage { 200 }
491493

492494
, WarheadAnimZAdjust { -15 }
495+
496+
, IvanBombAttachToCenter { false }
493497
{ }
494498

495499
virtual ~ExtData() = default;

src/Misc/Hooks.BugFixes.cpp

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -563,17 +563,19 @@ namespace FetchBomb
563563
BombClass* pThisBomb;
564564
}
565565

566-
// Fetch the BombClass context From earlier adress
566+
// Fetch the BombClass context From earlier address.
567567
DEFINE_HOOK(0x438771, BombClass_Detonate_SetContext, 0x6)
568568
{
569569
GET(BombClass*, pThis, ESI);
570570

571571
FetchBomb::pThisBomb = pThis;
572572

573-
// Also adjust detonation coordinate.
574-
CoordStruct coords = pThis->Target->GetCenterCoords();
573+
if (RulesExt::Global()->IvanBombAttachToCenter)
574+
{
575+
CoordStruct coords = pThis->Target->GetCenterCoords();
576+
R->EDX(&coords);
577+
}
575578

576-
R->EDX(&coords);
577579
return 0;
578580
}
579581

@@ -609,16 +611,6 @@ static DamageAreaResult __fastcall _BombClass_Detonate_DamageArea
609611
return nDamageAreaResult;
610612
}
611613

612-
DEFINE_HOOK(0x6F5201, TechnoClass_DrawExtras_IvanBombImage, 0x6)
613-
{
614-
GET(TechnoClass*, pThis, EBP);
615-
616-
auto coords = pThis->GetCenterCoords();
617-
618-
R->EAX(&coords);
619-
return 0;
620-
}
621-
622614
// skip the Explosion Anim block and clean up the context
623615
DEFINE_HOOK(0x4387A8, BombClass_Detonate_ExplosionAnimHandled, 0x5)
624616
{
@@ -629,6 +621,19 @@ DEFINE_HOOK(0x4387A8, BombClass_Detonate_ExplosionAnimHandled, 0x5)
629621
// redirect MapClass::DamageArea call to our dll for additional functionality and checks
630622
DEFINE_FUNCTION_JUMP(CALL, 0x4387A3, _BombClass_Detonate_DamageArea);
631623

624+
DEFINE_HOOK(0x6F5201, TechnoClass_DrawExtras_IvanBombImage, 0x6)
625+
{
626+
GET(TechnoClass*, pThis, EBP);
627+
628+
if (RulesExt::Global()->IvanBombAttachToCenter)
629+
{
630+
auto coords = pThis->GetCenterCoords();
631+
R->EAX(&coords);
632+
}
633+
634+
return 0;
635+
}
636+
632637
// Oct 20, 2022 - Starkku: BibShape checks for BuildingClass::BState which needs to not be 0 (constructing) for bib to draw.
633638
// It is possible for BState to be 1 early during construction for frame or two which can result in BibShape being drawn during buildup, which somehow depends on length of buildup.
634639
// Trying to fix this issue at its root is problematic and most of the time causes buildup to play twice, it is simpler to simply fix the BibShape to not draw until the buildup is done

0 commit comments

Comments
 (0)