Skip to content

Commit 19c15f6

Browse files
committed
Fix ReturnWeapon cannot fire ROT projectile when hit a target on the ground
1 parent baf292c commit 19c15f6

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/Ext/Bullet/Hooks.DetonateLogics.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ DEFINE_HOOK(0x469AA4, BulletClass_Logics_Extras, 0x5)
297297
GET(BulletClass*, pThis, ESI);
298298
GET_BASE(CoordStruct*, coords, 0x8);
299299

300-
auto const pOwner = pThis->Owner ? pThis->Owner->Owner : BulletExt::ExtMap.Find(pThis)->FirerHouse;
300+
auto const pTechno = pThis->Owner;
301+
auto const pOwner = pTechno ? pTechno->Owner : BulletExt::ExtMap.Find(pThis)->FirerHouse;
301302

302303
// Extra warheads
303304
if (pThis->WeaponType)
@@ -336,14 +337,14 @@ DEFINE_HOOK(0x469AA4, BulletClass_Logics_Extras, 0x5)
336337
continue;
337338

338339
if (isFull)
339-
WarheadTypeExt::DetonateAt(pWH, *coords, pThis->Owner, damage, pOwner, pThis->Target);
340+
WarheadTypeExt::DetonateAt(pWH, *coords, pTechno, damage, pOwner, pThis->Target);
340341
else
341-
WarheadTypeExt::ExtMap.Find(pWH)->DamageAreaWithTarget(*coords, damage, pThis->Owner, pWH, true, pOwner, abstract_cast<TechnoClass*>(pThis->Target));
342+
WarheadTypeExt::ExtMap.Find(pWH)->DamageAreaWithTarget(*coords, damage, pTechno, pWH, true, pOwner, abstract_cast<TechnoClass*>(pThis->Target));
342343
}
343344
}
344345

345346
// Return to sender
346-
if (pThis->Type && pThis->Owner)
347+
if (pThis->Type && pTechno)
347348
{
348349
auto const pTypeExt = BulletTypeExt::ExtMap.Find(pThis->Type);
349350

@@ -352,13 +353,13 @@ DEFINE_HOOK(0x469AA4, BulletClass_Logics_Extras, 0x5)
352353
auto damage = pWeapon->Damage;
353354

354355
if (pTypeExt->ReturnWeapon_ApplyFirepowerMult)
355-
damage = static_cast<int>(damage * pThis->Owner->FirepowerMultiplier * TechnoExt::ExtMap.Find(pThis->Owner)->AE.FirepowerMultiplier);
356+
damage = static_cast<int>(damage * pTechno->FirepowerMultiplier * TechnoExt::ExtMap.Find(pTechno)->AE.FirepowerMultiplier);
356357

357-
if (BulletClass* pBullet = pWeapon->Projectile->CreateBullet(pThis->Owner, pThis->Owner,
358+
if (BulletClass* pBullet = pWeapon->Projectile->CreateBullet(pTechno, pTechno,
358359
damage, pWeapon->Warhead, pWeapon->Speed, pWeapon->Bright))
359360
{
360-
BulletExt::SimulatedFiringUnlimbo(pBullet, pThis->Owner->Owner, pWeapon, pThis->Location, true);
361-
BulletExt::SimulatedFiringEffects(pBullet, pThis->Owner->Owner, nullptr, false, true);
361+
BulletExt::SimulatedFiringUnlimbo(pBullet, pOwner, pWeapon, pThis->Location, false);
362+
BulletExt::SimulatedFiringEffects(pBullet, pOwner, nullptr, false, true);
362363
}
363364
}
364365
}

0 commit comments

Comments
 (0)