mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-18 09:41:06 +00:00
- Duke: Clean up player/actor accesses in operateTripbomb()
.
This commit is contained in:
parent
c4792b1273
commit
e025e0d2a1
2 changed files with 8 additions and 8 deletions
|
@ -825,14 +825,14 @@ static void movement(DDukePlayer* const p, ESyncBits actions, sectortype* psect,
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
int operateTripbomb(int snum)
|
int operateTripbomb(DDukePlayer* const p)
|
||||||
{
|
{
|
||||||
auto p = getPlayer(snum);
|
const auto pact = p->GetActor();
|
||||||
HitInfo hit{};
|
HitInfo hit{};
|
||||||
double vel = 1024, zvel = 0;
|
double vel = 1024, zvel = 0;
|
||||||
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 16.);
|
setFreeAimVelocity(vel, zvel, p->Angles.getPitchWithView(), 16.);
|
||||||
|
|
||||||
hitscan(p->GetActor()->getPosWithOffsetZ(), p->cursector, DVector3(p->GetActor()->spr.Angles.Yaw.ToVector() * vel, zvel), hit, CLIPMASK1);
|
hitscan(pact->getPosWithOffsetZ(), p->cursector, DVector3(pact->spr.Angles.Yaw.ToVector() * vel, zvel), hit, CLIPMASK1);
|
||||||
|
|
||||||
if (hit.hitSector == nullptr || hit.actor())
|
if (hit.hitSector == nullptr || hit.actor())
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -859,10 +859,10 @@ int operateTripbomb(int snum)
|
||||||
if (act == nullptr && hit.hitWall != nullptr && (hit.hitWall->cstat & CSTAT_WALL_MASKED) == 0)
|
if (act == nullptr && hit.hitWall != nullptr && (hit.hitWall->cstat & CSTAT_WALL_MASKED) == 0)
|
||||||
if ((hit.hitWall->twoSided() && hit.hitWall->nextSector()->lotag <= 2) || (!hit.hitWall->twoSided() && hit.hitSector->lotag <= 2))
|
if ((hit.hitWall->twoSided() && hit.hitWall->nextSector()->lotag <= 2) || (!hit.hitWall->twoSided() && hit.hitSector->lotag <= 2))
|
||||||
{
|
{
|
||||||
auto delta = hit.hitpos.XY() - p->GetActor()->spr.pos.XY();
|
auto delta = hit.hitpos.XY() - pact->spr.pos.XY();
|
||||||
if (delta.LengthSquared() < (18.125 * 18.125))
|
if (delta.LengthSquared() < (18.125 * 18.125))
|
||||||
{
|
{
|
||||||
p->GetActor()->restorez();
|
pact->restorez();
|
||||||
p->vel.Z = 0;
|
p->vel.Z = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -926,7 +926,7 @@ static void fireweapon(int snum)
|
||||||
case TRIPBOMB_WEAPON:
|
case TRIPBOMB_WEAPON:
|
||||||
if (p->ammo_amount[TRIPBOMB_WEAPON] > 0)
|
if (p->ammo_amount[TRIPBOMB_WEAPON] > 0)
|
||||||
{
|
{
|
||||||
if (operateTripbomb(snum))
|
if (operateTripbomb(p))
|
||||||
p->kickback_pic = 1;
|
p->kickback_pic = 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -40,7 +40,7 @@ source as it is released.
|
||||||
|
|
||||||
BEGIN_DUKE_NS
|
BEGIN_DUKE_NS
|
||||||
|
|
||||||
int operateTripbomb(int snum);
|
int operateTripbomb(DDukePlayer* const p);
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
@ -219,7 +219,7 @@ void fireweapon_ww(int snum)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TRIPBOMB_WEAPON:
|
case TRIPBOMB_WEAPON:
|
||||||
if (operateTripbomb(snum))
|
if (operateTripbomb(p))
|
||||||
{
|
{
|
||||||
p->kickback_pic = 1;
|
p->kickback_pic = 1;
|
||||||
if (aplWeaponInitialSound(p->curr_weapon, p))
|
if (aplWeaponInitialSound(p->curr_weapon, p))
|
||||||
|
|
Loading…
Reference in a new issue