mirror of
https://github.com/DrBeef/Raze.git
synced 2025-03-21 17:00:52 +00:00
- SW: Repair player height issues.
This commit is contained in:
parent
6d736aea19
commit
e6044bc0fd
3 changed files with 22 additions and 35 deletions
|
@ -796,7 +796,7 @@ static void analyzesprites(tspriteArray& tsprites, const DVector3& viewpos, doub
|
|||
pos.Y = pp->si.Y;
|
||||
}
|
||||
|
||||
pos.Z = tsp->pos.Z + pp->si.Z;
|
||||
pos.Z = tsp->pos.Z + pp->si.Z + pp->getViewHeightDiff();
|
||||
tsp->pos = pos;
|
||||
tsp->angle = pp->siang;
|
||||
//continue;
|
||||
|
|
|
@ -1881,9 +1881,15 @@ struct PLAYER
|
|||
|
||||
char cookieQuote[256]; // Should be an FString but must be POD for now so that PLAYER remains POD.
|
||||
int cookieTime;
|
||||
double height;
|
||||
|
||||
uint8_t WpnReloadState;
|
||||
|
||||
double getViewHeightDiff()
|
||||
{
|
||||
return actor->viewzoffset + height;
|
||||
}
|
||||
|
||||
|
||||
DVector2& posXY()
|
||||
{
|
||||
|
|
|
@ -1490,8 +1490,9 @@ void DoPlayerSetWadeDepth(PLAYER* pp)
|
|||
|
||||
void DoPlayerHeight(PLAYER* pp)
|
||||
{
|
||||
double diff = pp->posZget() - (pp->loz - PLAYER_HEIGHTF);
|
||||
pp->posZadd(-diff * 0.375);
|
||||
constexpr double scale = 0.375;
|
||||
pp->actor->viewzoffset -= pp->getViewHeightDiff() * scale;
|
||||
pp->actor->spr.pos.Z -= (pp->actor->spr.pos.Z - pp->loz) * scale;
|
||||
}
|
||||
|
||||
void DoPlayerJumpHeight(PLAYER* pp)
|
||||
|
@ -1506,12 +1507,6 @@ void DoPlayerJumpHeight(PLAYER* pp)
|
|||
}
|
||||
}
|
||||
|
||||
void DoPlayerCrawlHeight(PLAYER* pp)
|
||||
{
|
||||
double diff = pp->posZget() - (pp->loz - PLAYER_CRAWL_HEIGHTF);
|
||||
pp->posZadd(-diff * 0.375);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
|
@ -1870,57 +1865,43 @@ void UpdatePlayerSprite(PLAYER* pp)
|
|||
|
||||
if (pp->sop_control)
|
||||
{
|
||||
actor->spr.pos.Z = pp->cursector->floorz;
|
||||
ChangeActorSect(pp->actor, pp->cursector);
|
||||
pp->height = PLAYER_HEIGHTF;
|
||||
}
|
||||
else if (pp->DoPlayerAction == DoPlayerCrawl)
|
||||
{
|
||||
actor->spr.pos.Z = pp->posZget() + PLAYER_CRAWL_HEIGHTF;
|
||||
ChangeActorSect(pp->actor, pp->cursector);
|
||||
pp->height = PLAYER_CRAWL_HEIGHTF;
|
||||
}
|
||||
else if (pp->DoPlayerAction == DoPlayerWade)
|
||||
{
|
||||
actor->spr.pos.Z = pp->posZget() + PLAYER_HEIGHTF;
|
||||
ChangeActorSect(pp->actor, pp->cursector);
|
||||
pp->height = PLAYER_HEIGHTF;
|
||||
|
||||
if (pp->WadeDepth > Z(29))
|
||||
{
|
||||
DoPlayerSpriteBob(pp, PLAYER_HEIGHTF, 3, 3);
|
||||
DoPlayerSpriteBob(pp, pp->height, 3, 3);
|
||||
}
|
||||
}
|
||||
else if (pp->DoPlayerAction == DoPlayerDive)
|
||||
{
|
||||
// bobbing and sprite position taken care of in DoPlayerDive
|
||||
actor->spr.pos.Z = pp->posZget() + 10;
|
||||
ChangeActorSect(pp->actor, pp->cursector);
|
||||
pp->height = 10;
|
||||
}
|
||||
else if (pp->DoPlayerAction == DoPlayerClimb)
|
||||
{
|
||||
actor->spr.pos.Z = pp->posZget() + 17;
|
||||
ChangeActorSect(pp->actor, pp->cursector);
|
||||
pp->height = 17;
|
||||
}
|
||||
else if (pp->DoPlayerAction == DoPlayerFly)
|
||||
{
|
||||
// bobbing and sprite position taken care of in DoPlayerFly
|
||||
DoPlayerSpriteBob(pp, PLAYER_HEIGHTF, 6, 3);
|
||||
ChangeActorSect(pp->actor, pp->cursector);
|
||||
}
|
||||
else if (pp->DoPlayerAction == DoPlayerJump || pp->DoPlayerAction == DoPlayerFall || pp->DoPlayerAction == DoPlayerForceJump)
|
||||
{
|
||||
actor->spr.pos.Z = pp->posZget() + PLAYER_HEIGHTF;
|
||||
ChangeActorSect(pp->actor, pp->cursector);
|
||||
}
|
||||
else if (pp->DoPlayerAction == DoPlayerTeleportPause)
|
||||
{
|
||||
actor->spr.pos.Z = pp->posZget() + PLAYER_HEIGHTF;
|
||||
ChangeActorSect(pp->actor, pp->cursector);
|
||||
pp->height = PLAYER_HEIGHTF;
|
||||
DoPlayerSpriteBob(pp, pp->height, 6, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
actor->spr.pos.Z = pp->loz;
|
||||
ChangeActorSect(pp->actor, pp->cursector);
|
||||
pp->height = PLAYER_HEIGHTF;
|
||||
}
|
||||
|
||||
ChangeActorSect(pp->actor, pp->cursector);
|
||||
|
||||
UpdatePlayerUnderSprite(pp);
|
||||
|
||||
actor->spr.angle = pp->angle.ang;
|
||||
|
@ -3723,7 +3704,7 @@ void DoPlayerCrawl(PLAYER* pp)
|
|||
}
|
||||
|
||||
DoPlayerBob(pp);
|
||||
DoPlayerCrawlHeight(pp);
|
||||
DoPlayerHeight(pp);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue