Skip to content

Commit b1afa62

Browse files
committed
apply AirburstWeapon fixes to ReturnWeapon & ReturnWeapon.ApplyFirepowerMult
1 parent 9af8d8d commit b1afa62

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

docs/New-or-Enhanced-Logics.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -945,15 +945,13 @@ SubjectToGround=false ; boolean
945945
### Return weapon
946946

947947
- It is now possible to make another weapon & projectile go off from a detonated projectile (in somewhat similar manner to `AirburstWeapon` or `ShrapnelWeapon`) straight back to the firer by setting `ReturnWeapon`. If the firer perishes before the initial projectile detonates, `ReturnWeapon` is not fired off.
948+
- `ReturnWeapon.ApplyFirepowerMult` determines whether or not the auxiliary weapon's damage should multiply the firer's firepower multipliers.
948949

949950
In `rulesmd.ini`:
950951
```ini
951-
[SOMEPROJECTILE] ; Projectile
952-
ReturnWeapon= ; WeaponType
953-
```
954-
955-
```{note}
956-
This currently has same limitations as `AirburstWeapon` in that it does not properly support `Arcing=true` projectiles.
952+
[SOMEPROJECTILE] ; Projectile
953+
ReturnWeapon= ; WeaponType
954+
ReturnWeapon.ApplyFirepowerMult=false ; boolean
957955
```
958956

959957
### Shrapnel enhancements

src/Ext/Bullet/Hooks.DetonateLogics.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,16 @@ DEFINE_HOOK(0x469AA4, BulletClass_Logics_Extras, 0x5)
349349

350350
if (auto const pWeapon = pTypeExt->ReturnWeapon)
351351
{
352+
auto damage = pWeapon->Damage;
353+
354+
if (pTypeExt->ReturnWeapon_ApplyFirepowerMult)
355+
damage = static_cast<int>(damage * pThis->Owner->FirepowerMultiplier * TechnoExt::ExtMap.Find(pThis->Owner)->AE.FirepowerMultiplier);
356+
352357
if (BulletClass* pBullet = pWeapon->Projectile->CreateBullet(pThis->Owner, pThis->Owner,
353-
pWeapon->Damage, pWeapon->Warhead, pWeapon->Speed, pWeapon->Bright))
358+
damage, pWeapon->Warhead, pWeapon->Speed, pWeapon->Bright))
354359
{
355-
pBullet->WeaponType = pWeapon;
356-
pBullet->MoveTo(pThis->Location, BulletVelocity::Empty);
357-
BulletExt::ExtMap.Find(pBullet)->FirerHouse = pOwner;
360+
BulletExt::SimulatedFiringUnlimbo(pBullet, pThis->Owner->Owner, pWeapon, pThis->Location, true);
361+
BulletExt::SimulatedFiringEffects(pBullet, pThis->Owner->Owner, nullptr, false, true);
358362
}
359363
}
360364
}

src/Ext/BulletType/Body.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ void BulletTypeExt::ExtData::LoadFromINIFile(CCINIClass* const pINI)
5252
this->AAOnly.Read(exINI, pSection, "AAOnly");
5353
this->Arcing_AllowElevationInaccuracy.Read(exINI, pSection, "Arcing.AllowElevationInaccuracy");
5454
this->ReturnWeapon.Read<true>(exINI, pSection, "ReturnWeapon");
55+
this->ReturnWeapon_ApplyFirepowerMult.Read(exINI, pSection, "ReturnWeapon.ApplyFirepowerMult");
5556
this->SubjectToGround.Read(exINI, pSection, "SubjectToGround");
5657

5758
this->Splits.Read(exINI, pSection, "Splits");
@@ -144,6 +145,7 @@ void BulletTypeExt::ExtData::Serialize(T& Stm)
144145
.Process(this->AAOnly)
145146
.Process(this->Arcing_AllowElevationInaccuracy)
146147
.Process(this->ReturnWeapon)
148+
.Process(this->ReturnWeapon_ApplyFirepowerMult)
147149
.Process(this->SubjectToGround)
148150
.Process(this->Splits)
149151
.Process(this->AirburstSpread)

src/Ext/BulletType/Body.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class BulletTypeExt
4444
Valueable<bool> AAOnly;
4545
Valueable<bool> Arcing_AllowElevationInaccuracy;
4646
Valueable<WeaponTypeClass*> ReturnWeapon;
47+
Valueable<bool> ReturnWeapon_ApplyFirepowerMult;
4748

4849
Valueable<bool> SubjectToGround;
4950

@@ -92,6 +93,7 @@ class BulletTypeExt
9293
, AAOnly { false }
9394
, Arcing_AllowElevationInaccuracy { true }
9495
, ReturnWeapon {}
96+
, ReturnWeapon_ApplyFirepowerMult { false }
9597
, SubjectToGround { false }
9698
, Splits { false }
9799
, AirburstSpread { 1.5 }

0 commit comments

Comments
 (0)