Skip to content

Commit

Permalink
fix: projectile related crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbeBryssinck committed Dec 20, 2021
1 parent be717b6 commit 48eec06
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Code/client/Services/Generic/CharacterService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1073,9 +1073,7 @@ void CharacterService::OnNotifyProjectileLaunch(const NotifyProjectileLaunch& ac
ProjectileLaunchData launchData{};
#endif

#if TP_FALLOUT4
launchData.pShooter = RTTI_CAST(TESForm::GetById(formIdComponent.Id), TESForm, TESObjectREFR);
#endif

launchData.Origin.x = acMessage.OriginX;
launchData.Origin.y = acMessage.OriginY;
Expand All @@ -1084,6 +1082,11 @@ void CharacterService::OnNotifyProjectileLaunch(const NotifyProjectileLaunch& ac
const uint32_t cProjectileBaseId = modSystem.GetGameId(acMessage.ProjectileBaseID);
launchData.pProjectileBase = TESForm::GetById(cProjectileBaseId);

#if TP_SKYRIM64
const uint32_t cFromWeaponId = modSystem.GetGameId(acMessage.WeaponID);
launchData.pFromWeapon = RTTI_CAST(TESForm::GetById(cFromWeaponId), TESForm, TESObjectWEAP);
#endif

#if TP_FALLOUT4
Actor* pShooter = RTTI_CAST(launchData.pShooter, TESObjectREFR, Actor);
pShooter->GetCurrentWeapon(&launchData.FromWeapon, 0);
Expand Down

0 comments on commit 48eec06

Please sign in to comment.