mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Interpolate bob angle
This commit is contained in:
parent
aff6ef67c0
commit
688fa2e778
7 changed files with 19 additions and 9 deletions
|
@ -2082,6 +2082,8 @@ static void GameMove(void)
|
|||
// YELLOW SECTION
|
||||
MoveThings();
|
||||
|
||||
obobangle = bobangle;
|
||||
|
||||
if (totalvel[nLocalPlayer] == 0)
|
||||
{
|
||||
bobangle = 0;
|
||||
|
|
|
@ -662,7 +662,7 @@ loc_flag:
|
|||
}
|
||||
|
||||
if (nPlayer == nLocalPlayer) {
|
||||
bobangle = 512;
|
||||
obobangle = bobangle = 512;
|
||||
}
|
||||
|
||||
if (nWeapon == kWeaponFlamer && (!(nSectFlag & kSectUnderwater)))
|
||||
|
@ -911,7 +911,7 @@ loc_flag:
|
|||
}
|
||||
}
|
||||
|
||||
void DrawWeapons()
|
||||
void DrawWeapons(int smooth)
|
||||
{
|
||||
if (bCamera) {
|
||||
return;
|
||||
|
@ -947,18 +947,19 @@ void DrawWeapons()
|
|||
int nVal = totalvel[nLocalPlayer] >> 1;
|
||||
|
||||
// CHECKME - not & 0x7FF?
|
||||
int yOffset = (nVal * (sintable[bobangle & 0x3FF] >> 8)) >> 9;
|
||||
int nBobAngle = angle_interpolate16(obobangle, bobangle, smooth);
|
||||
int yOffset = (nVal * (sintable[nBobAngle & 0x3FF] >> 8)) >> 9;
|
||||
|
||||
int xOffset = 0;
|
||||
|
||||
if (var_34 == 1)
|
||||
{
|
||||
xOffset = ((Sin(bobangle + 512) >> 8) * nVal) >> 8;
|
||||
xOffset = ((Sin(nBobAngle + 512) >> 8) * nVal) >> 8;
|
||||
}
|
||||
else
|
||||
{
|
||||
xOffset = 0;
|
||||
bobangle = 512;
|
||||
obobangle = bobangle = 512;
|
||||
}
|
||||
|
||||
if (nWeapon == 3 && var_34 == 1) {
|
||||
|
|
|
@ -45,6 +45,6 @@ void StopFiringWeapon(short nPlayer);
|
|||
void FireWeapon(short nPlayer);
|
||||
void CheckClip(short nPlayer);
|
||||
void MoveWeapons(short nPlayer);
|
||||
void DrawWeapons();
|
||||
void DrawWeapons(int smooth);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -47,7 +47,7 @@ struct PlayerSave
|
|||
fix16_t lPlayerXVel = 0;
|
||||
fix16_t lPlayerYVel = 0;
|
||||
fix16_t nPlayerDAng = 0;
|
||||
short bobangle = 0;
|
||||
short obobangle = 0, bobangle = 0;
|
||||
short bPlayerPan = 0;
|
||||
short bLockPan = 0;
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ extern short nPlayerScore[];
|
|||
|
||||
extern short nPlayerClip[];
|
||||
|
||||
extern short bobangle;
|
||||
extern short obobangle, bobangle;
|
||||
|
||||
extern int totalvel[];
|
||||
extern int16_t eyelevel[], oeyelevel[];
|
||||
|
|
|
@ -574,7 +574,7 @@ void DrawView(int smoothRatio)
|
|||
{
|
||||
if (nSnakeCam < 0)
|
||||
{
|
||||
DrawWeapons();
|
||||
DrawWeapons(smoothRatio);
|
||||
DrawStatus();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#ifndef __view_h__
|
||||
#define __view_h__
|
||||
|
||||
#include "build.h"
|
||||
|
||||
extern short bSubTitles;
|
||||
extern short nViewTop;
|
||||
extern short bClip;
|
||||
|
@ -39,4 +41,9 @@ extern short bTouchFloor;
|
|||
|
||||
extern short nChunkTotal;
|
||||
|
||||
static inline int angle_interpolate16(int a, int b, int smooth)
|
||||
{
|
||||
return a + mulscale16(((b+1024-a)&2047)-1024, smooth);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue