diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 3706dc2f3..517063631 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -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{}; double vel = 1024, zvel = 0; 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()) return 0; @@ -859,10 +859,10 @@ int operateTripbomb(int snum) 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)) { - 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)) { - p->GetActor()->restorez(); + pact->restorez(); p->vel.Z = 0; return 1; } @@ -926,7 +926,7 @@ static void fireweapon(int snum) case TRIPBOMB_WEAPON: if (p->ammo_amount[TRIPBOMB_WEAPON] > 0) { - if (operateTripbomb(snum)) + if (operateTripbomb(p)) p->kickback_pic = 1; } break; diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index bea9dfe6a..e3f805a06 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -40,7 +40,7 @@ source as it is released. BEGIN_DUKE_NS -int operateTripbomb(int snum); +int operateTripbomb(DDukePlayer* const p); //--------------------------------------------------------------------------- // @@ -219,7 +219,7 @@ void fireweapon_ww(int snum) } break; case TRIPBOMB_WEAPON: - if (operateTripbomb(snum)) + if (operateTripbomb(p)) { p->kickback_pic = 1; if (aplWeaponInitialSound(p->curr_weapon, p))