mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 04:20:42 +00:00
- Duke: Clean up player/actor accesses in ifhitbyweapon_r()
.
This commit is contained in:
parent
8584745ce4
commit
6c72a2a1fa
1 changed files with 7 additions and 9 deletions
|
@ -160,7 +160,6 @@ void lotsoffeathers_r(DDukeActor *actor, int n)
|
|||
|
||||
int ifhitbyweapon_r(DDukeActor *actor)
|
||||
{
|
||||
int p;
|
||||
auto hitowner = actor->GetHitOwner();
|
||||
|
||||
if (actor->hitextra >= 0)
|
||||
|
@ -172,7 +171,7 @@ int ifhitbyweapon_r(DDukeActor *actor)
|
|||
{
|
||||
if (ud.god) return -1;
|
||||
|
||||
p = actor->PlayerIndex();
|
||||
const auto p = getPlayer(actor->PlayerIndex());
|
||||
|
||||
if (hitowner &&
|
||||
hitowner->isPlayer() &&
|
||||
|
@ -187,24 +186,23 @@ int ifhitbyweapon_r(DDukeActor *actor)
|
|||
if (actor->spr.extra <= 0 && !(adef->flags2 & SFLAG2_FREEZEDAMAGE))
|
||||
{
|
||||
actor->spr.extra = 0;
|
||||
p->wackedbyactor = hitowner;
|
||||
|
||||
getPlayer(p)->wackedbyactor = hitowner;
|
||||
|
||||
if (hitowner->isPlayer() && p != hitowner->PlayerIndex())
|
||||
if (hitowner->isPlayer() && p != getPlayer(hitowner->PlayerIndex()))
|
||||
{
|
||||
getPlayer(p)->frag_ps = hitowner->PlayerIndex();
|
||||
p->frag_ps = hitowner->PlayerIndex();
|
||||
}
|
||||
actor->SetHitOwner(getPlayer(p)->GetActor());
|
||||
actor->SetHitOwner(actor);
|
||||
}
|
||||
}
|
||||
|
||||
if (adef->flags2 & SFLAG2_DOUBLEDMGTHRUST)
|
||||
{
|
||||
getPlayer(p)->vel.XY() += actor->hitang.ToVector() * actor->hitextra * 0.25;
|
||||
p->vel.XY() += actor->hitang.ToVector() * actor->hitextra * 0.25;
|
||||
}
|
||||
else
|
||||
{
|
||||
getPlayer(p)->vel.XY() += actor->hitang.ToVector() * actor->hitextra * 0.125;
|
||||
p->vel.XY() += actor->hitang.ToVector() * actor->hitextra * 0.125;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue