Interpolate eye level

This commit is contained in:
nukeykt 2019-11-09 01:45:10 +09:00 committed by Christoph Oelckers
parent 590a165e16
commit aff6ef67c0
3 changed files with 7 additions and 5 deletions

View file

@ -109,7 +109,7 @@ short nPlayerViewSect[kMaxPlayers];
short nPlayerFloorSprite[kMaxPlayers];
PlayerSave sPlayerSave[kMaxPlayers];
int totalvel[kMaxPlayers] = { 0 };
int16_t eyelevel[kMaxPlayers];
int16_t eyelevel[kMaxPlayers], oeyelevel[kMaxPlayers];
short nNetStartSprite[kMaxPlayers] = { 0 };
short nStandHeight;
@ -770,7 +770,7 @@ void RestartPlayer(short nPlayer)
}
nPlayerGrenade[nPlayer] = -1;
eyelevel[nPlayer] = -14080;
oeyelevel[nPlayer] = eyelevel[nPlayer] = -14080;
dVertPan[nPlayer] = 0;
nTemperature[nPlayer] = 0;
@ -881,7 +881,7 @@ void StartDeathSeq(int nPlayer, int nVal)
StopFiringWeapon(nPlayer);
PlayerList[nPlayer].q16ohoriz = PlayerList[nPlayer].q16horiz = nVertPan[nPlayer] = F16(92);
eyelevel[nPlayer] = -14080;
oeyelevel[nPlayer] = eyelevel[nPlayer] = -14080;
nPlayerInvisible[nPlayer] = 0;
dVertPan[nPlayer] = 15;
@ -1050,6 +1050,7 @@ void FuncPlayer(int pA, int nDamage, int nRun)
PlayerList[nPlayer].opos = sprite[nPlayerSprite].pos;
PlayerList[nPlayer].q16oangle = PlayerList[nPlayer].q16angle;
PlayerList[nPlayer].q16ohoriz = PlayerList[nPlayer].q16horiz;
oeyelevel[nPlayer] = eyelevel[nPlayer];
switch (nMessage)
{

View file

@ -89,7 +89,7 @@ extern short nPlayerClip[];
extern short bobangle;
extern int totalvel[];
extern short eyelevel[];
extern int16_t eyelevel[], oeyelevel[];
extern short nNetStartSprite[kMaxPlayers];
extern short nNetStartSprites;

View file

@ -406,7 +406,8 @@ void DrawView(int smoothRatio)
{
playerX = interpolate16(PlayerList[nLocalPlayer].opos.x, sprite[nPlayerSprite].x, smoothRatio);
playerY = interpolate16(PlayerList[nLocalPlayer].opos.y, sprite[nPlayerSprite].y, smoothRatio);
playerZ = interpolate16(PlayerList[nLocalPlayer].opos.z, sprite[nPlayerSprite].z, smoothRatio) + eyelevel[nLocalPlayer];
playerZ = interpolate16(PlayerList[nLocalPlayer].opos.z, sprite[nPlayerSprite].z, smoothRatio)
+ interpolate16(oeyelevel[nLocalPlayer], eyelevel[nLocalPlayer], smoothRatio);
nSector = nPlayerViewSect[nLocalPlayer];
nAngle = q16angle_interpolate16(PlayerList[nLocalPlayer].q16oangle, PlayerList[nLocalPlayer].q16angle, smoothRatio);