mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 00:42:08 +00:00
- Exhumed: Clean up player accesses in map.cpp
and move.cpp
.
This commit is contained in:
parent
51b5393a23
commit
33296e61fb
2 changed files with 15 additions and 12 deletions
|
@ -45,8 +45,9 @@ void GrabMap()
|
|||
|
||||
void UpdateMap()
|
||||
{
|
||||
const auto initsectp = getPlayer(nLocalPlayer)->GetActor()->sector();
|
||||
if (initsectp->ceilingpal != 3 || (getPlayer(nLocalPlayer)->nTorch != 0)) {
|
||||
const auto pPlayer = getPlayer(nLocalPlayer);
|
||||
const auto initsectp = pPlayer->GetActor()->sector();
|
||||
if (initsectp->ceilingpal != 3 || (pPlayer->nTorch != 0)) {
|
||||
MarkSectorSeen(initsectp);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -231,9 +231,10 @@ Collision movespritez(DExhumedActor* pActor, double z, double height, double cli
|
|||
|
||||
*overridesect = pSector;
|
||||
const auto pSect2 = pSector;
|
||||
const auto pPlayer = (pActor->spr.statnum == 100) ? getPlayer(GetPlayerFromActor(pActor)) : nullptr;
|
||||
|
||||
if (pActor->spr.statnum == 100)
|
||||
getPlayer(GetPlayerFromActor(pActor))->bTouchFloor = false;
|
||||
if (pPlayer)
|
||||
pPlayer->bTouchFloor = false;
|
||||
|
||||
// backup cstat
|
||||
const auto cstat = pActor->spr.cstat;
|
||||
|
@ -305,8 +306,8 @@ Collision movespritez(DExhumedActor* pActor, double z, double height, double cli
|
|||
{
|
||||
if (z > 0)
|
||||
{
|
||||
if (pActor->spr.statnum == 100)
|
||||
getPlayer(GetPlayerFromActor(pActor))->bTouchFloor = true;
|
||||
if (pPlayer)
|
||||
pPlayer->bTouchFloor = true;
|
||||
|
||||
if (loHit.type == kHitSprite)
|
||||
{
|
||||
|
@ -436,16 +437,16 @@ Collision movesprite(DExhumedActor* pActor, DVector2 vect, double dz, double flo
|
|||
|
||||
if (pActor->spr.statnum == 100)
|
||||
{
|
||||
int nPlayer = GetPlayerFromActor(pActor);
|
||||
const auto pPlayer = getPlayer(GetPlayerFromActor(pActor));
|
||||
DVector2 thrust(0, 0);
|
||||
|
||||
CheckSectorFloor(overridesect, pActor->spr.pos.Z, thrust);
|
||||
if (!thrust.isZero())
|
||||
{
|
||||
getPlayer(nPlayer)->nThrust = thrust;
|
||||
pPlayer->nThrust = thrust;
|
||||
}
|
||||
|
||||
vect += getPlayer(nPlayer)->nThrust;
|
||||
vect += pPlayer->nThrust;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -930,16 +931,17 @@ void SetQuake(DExhumedActor* pActor, int nVal)
|
|||
{
|
||||
for (int i = 0; i < nTotalPlayers; i++)
|
||||
{
|
||||
auto nSqrt = ((getPlayer(i)->GetActor()->spr.pos.XY() - pActor->spr.pos.XY()) * (1. / 16.)).Length();
|
||||
const auto pPlayer = getPlayer(i);
|
||||
auto nSqrt = ((pPlayer->GetActor()->spr.pos.XY() - pActor->spr.pos.XY()) * (1. / 16.)).Length();
|
||||
|
||||
if (nSqrt)
|
||||
{
|
||||
nVal = clamp(int(nVal / nSqrt), 0, 15);
|
||||
}
|
||||
|
||||
if (nVal > getPlayer(i)->nQuake)
|
||||
if (nVal > pPlayer->nQuake)
|
||||
{
|
||||
getPlayer(i)->nQuake = nVal;
|
||||
pPlayer->nQuake = nVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue