Skip to content

Commit

Permalink
- Exhumed: Split out player death pitch code.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjr4077au committed Mar 24, 2023
1 parent 8812831 commit e256ac0
Showing 1 changed file with 45 additions and 35 deletions.
80 changes: 45 additions & 35 deletions source/games/exhumed/src/player.cpp
Expand Up @@ -1096,6 +1096,50 @@ static void doPlayerPitch(Player* const pPlayer)
}
}

//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------

static void doPlayerDeathPitch(Player* const pPlayer)
{
const auto pPlayerActor = pPlayer->pActor;
pPlayer->nThrust.Zero();

if (pPlayerActor->viewzoffset >= -11)
{
pPlayerActor->viewzoffset = -11;
pPlayer->dVertPan = 0;
}
else
{
if (pPlayerActor->spr.Angles.Pitch.Sgn() > 0)
{
pPlayerActor->spr.Angles.Pitch = nullAngle;
pPlayerActor->viewzoffset -= pPlayer->dVertPan;
}
else
{
pPlayerActor->spr.Angles.Pitch -= maphoriz(pPlayer->dVertPan);

if (pPlayerActor->spr.Angles.Pitch.Degrees() <= -38)
{
pPlayerActor->spr.Angles.Pitch = DAngle::fromDeg(-37.72);
}
else if (pPlayerActor->spr.Angles.Pitch.Sgn() >= 0)
{
if (!(pPlayerActor->sector()->Flag & kSectUnderwater))
{
SetNewWeapon(pPlayer->nPlayer, pPlayer->nDeathType + 8);
}
}

pPlayer->dVertPan--;
}
}
}

//---------------------------------------------------------------------------
//
// this function is pure spaghetti madness... :(
Expand Down Expand Up @@ -1635,41 +1679,7 @@ void AIPlayer::Tick(RunListEvent* ev)
}

if (!pPlayer->nHealth)
{
pPlayer->nThrust.Zero();

if (pPlayerActor->viewzoffset >= -11)
{
pPlayerActor->viewzoffset = -11;
pPlayer->dVertPan = 0;
}
else
{
if (pPlayer->pActor->spr.Angles.Pitch.Sgn() > 0)
{
pPlayerActor->spr.Angles.Pitch = nullAngle;
pPlayerActor->viewzoffset -= pPlayer->dVertPan;
}
else
{
pPlayer->pActor->spr.Angles.Pitch -= maphoriz(pPlayer->dVertPan);

if (pPlayer->pActor->spr.Angles.Pitch.Degrees() <= -38)
{
pPlayer->pActor->spr.Angles.Pitch = DAngle::fromDeg(-37.72);
}
else if (pPlayer->pActor->spr.Angles.Pitch.Sgn() >= 0)
{
if (!(pPlayerActor->sector()->Flag & kSectUnderwater))
{
SetNewWeapon(nPlayer, pPlayer->nDeathType + 8);
}
}

pPlayer->dVertPan--;
}
}
}
doPlayerDeathPitch(pPlayer);

// loc_1C4E1
pDopple->spr.pos = pPlayerActor->spr.pos;
Expand Down

0 comments on commit e256ac0

Please sign in to comment.