- Blood: Floatify all the bobbing/swaying code.

This commit is contained in:
Mitchell Richters 2022-09-12 21:16:31 +10:00 committed by Christoph Oelckers
parent 33def4bd6e
commit b127c37939
5 changed files with 51 additions and 51 deletions

View file

@ -118,13 +118,13 @@ void hudDraw(PLAYER* pPlayer, sectortype* pSector, double bobx, double boby, dou
{
if (cl_hudinterpolation)
{
cX += (bobx / 256.);
cY += (boby / 256.) + (zDelta * 2.);
cX += bobx;
cY += boby + (zDelta * 2.);
}
else
{
cX += (int(bobx) >> 8);
cY += (int(boby) >> 8) + int(zDelta * 2);
cX += int(bobx);
cY += int(boby) + int(zDelta * 2);
}
}
else

View file

@ -102,30 +102,30 @@ POSTURE gPostureDefaults[kModeMax][kPostureMax] = {
// normal human
{
{ 0x4000, 0x4000, 0x4000, 14, 17, 24, 16, 32, 80, 22, 18, 0xc00, 0x90, -0xbaaaa, -0x175555 },
{ 0x1200, 0x1200, 0x1200, 14, 17, 24, 16, 32, 80, 20, 16, -0x600, 0xb0, 0x5b05, 0 },
{ 0x2000, 0x2000, 0x2000, 22, 28, 24, 16, 16, 40, 8, 6, -0x600, 0xb0, 0, 0 },
{ 0x4000, 0x4000, 0x4000, 14, 17, 0.09375, 0.0625, 0.125, 0.3125, 22, 18, 0xc00, 0x90, -0xbaaaa, -0x175555 },
{ 0x1200, 0x1200, 0x1200, 14, 17, 0.09375, 0.0625, 0.125, 0.3125, 20, 16, -0x600, 0xb0, 0x5b05, 0 },
{ 0x2000, 0x2000, 0x2000, 22, 28, 0.09375, 0.0625, 0.0625, 0.15625, 8, 6, -0x600, 0xb0, 0, 0 },
},
// normal beast
{
{ 0x4000, 0x4000, 0x4000, 14, 17, 24, 16, 32, 80, 22, 18, 0xc00, 0x90, -0xbaaaa, -0x175555 },
{ 0x1200, 0x1200, 0x1200, 14, 17, 24, 16, 32, 80, 20, 16, -0x600, 0xb0, 0x5b05, 0 },
{ 0x2000, 0x2000, 0x2000, 22, 28, 24, 16, 16, 40, 8, 6, -0x600, 0xb0, 0, 0 },
{ 0x4000, 0x4000, 0x4000, 14, 17, 0.09375, 0.0625, 0.125, 0.3125, 22, 18, 0xc00, 0x90, -0xbaaaa, -0x175555 },
{ 0x1200, 0x1200, 0x1200, 14, 17, 0.09375, 0.0625, 0.125, 0.3125, 20, 16, -0x600, 0xb0, 0x5b05, 0 },
{ 0x2000, 0x2000, 0x2000, 22, 28, 0.09375, 0.0625, 0.0625, 0.15625, 8, 6, -0x600, 0xb0, 0, 0 },
},
// shrink human
{
{ 10384, 10384, 10384, 14, 17, 24, 16, 32, 80, 22, 18, 3072, 144, -564586, -1329173 },
{ 2108, 2108, 2108, 14, 17, 24, 16, 32, 80, 20, 16, -1536, 176, 0x5b05, 0 },
{ 2192, 2192, 2192, 22, 28, 24, 16, 16, 40, 8, 6, -1536, 176, 0, 0 },
{ 10384, 10384, 10384, 14, 17, 0.09375, 0.0625, 0.125, 0.3125, 22, 18, 3072, 144, -564586, -1329173 },
{ 2108, 2108, 2108, 14, 17, 0.09375, 0.0625, 0.125, 0.3125, 20, 16, -1536, 176, 0x5b05, 0 },
{ 2192, 2192, 2192, 22, 28, 0.09375, 0.0625, 0.0625, 0.15625, 8, 6, -1536, 176, 0, 0 },
},
// grown human
{
{ 19384, 19384, 19384, 14, 17, 24, 16, 32, 80, 22, 18, 3072, 144, -1014586, -1779173 },
{ 5608, 5608, 5608, 14, 17, 24, 16, 32, 80, 20, 16, -1536, 176, 0x5b05, 0 },
{ 11192, 11192, 11192, 22, 28, 24, 16, 16, 40, 8, 6, -1536, 176, 0, 0 },
{ 19384, 19384, 19384, 14, 17, 0.09375, 0.0625, 0.125, 0.3125, 22, 18, 3072, 144, -1014586, -1779173 },
{ 5608, 5608, 5608, 14, 17, 0.09375, 0.0625, 0.125, 0.3125, 20, 16, -1536, 176, 0x5b05, 0 },
{ 11192, 11192, 11192, 22, 28, 0.09375, 0.0625, 0.0625, 0.15625, 8, 6, -1536, 176, 0, 0 },
},
};
@ -1884,10 +1884,10 @@ void playerProcess(PLAYER* pPlayer)
{
pPlayer->bobAmp = (pPlayer->bobAmp + 17) & 2047;
pPlayer->swayAmp = (pPlayer->swayAmp + 17) & 2047;
pPlayer->bobHeight = MulScale(pPosture->bobV * 10, Sin(pPlayer->bobAmp * 2), 30);
pPlayer->bobWidth = MulScale(pPosture->bobH * pPlayer->bobPhase, Sin(pPlayer->bobAmp - 256), 30);
pPlayer->swayHeight = MulScale(pPosture->swayV * pPlayer->bobPhase, Sin(pPlayer->swayAmp * 2), 30);
pPlayer->swayWidth = MulScale(pPosture->swayH * pPlayer->bobPhase, Sin(pPlayer->swayAmp - 0x155), 30);
pPlayer->bobHeight = pPosture->bobV * 10 * BobVal(pPlayer->bobAmp * 2);
pPlayer->bobWidth = pPosture->bobH * pPlayer->bobPhase * BobVal(pPlayer->bobAmp - 256);
pPlayer->swayHeight = pPosture->swayV * pPlayer->bobPhase * BobVal(pPlayer->swayAmp * 2);
pPlayer->swayWidth = pPosture->swayH * pPlayer->bobPhase * BobVal(pPlayer->swayAmp - 0x155);
}
else
{
@ -1907,10 +1907,10 @@ void playerProcess(PLAYER* pPlayer)
pPlayer->bobPhase = ClipHigh(pPlayer->bobPhase + nSpeed, 30);
}
}
pPlayer->bobHeight = MulScale(pPosture->bobV * pPlayer->bobPhase, Sin(pPlayer->bobAmp * 2), 30);
pPlayer->bobWidth = MulScale(pPosture->bobH * pPlayer->bobPhase, Sin(pPlayer->bobAmp - 256), 30);
pPlayer->swayHeight = MulScale(pPosture->swayV * pPlayer->bobPhase, Sin(pPlayer->swayAmp * 2), 30);
pPlayer->swayWidth = MulScale(pPosture->swayH * pPlayer->bobPhase, Sin(pPlayer->swayAmp - 0x155), 30);
pPlayer->bobHeight = pPosture->bobV * pPlayer->bobPhase * BobVal(pPlayer->bobAmp * 2);
pPlayer->bobWidth = pPosture->bobH * pPlayer->bobPhase * BobVal(pPlayer->bobAmp - 256);
pPlayer->swayHeight = pPosture->swayV * pPlayer->bobPhase * BobVal(pPlayer->swayAmp * 2);
pPlayer->swayWidth = pPosture->swayH * pPlayer->bobPhase * BobVal(pPlayer->swayAmp - 0x155);
}
pPlayer->flickerEffect = 0;
pPlayer->quakeEffect = ClipLow(pPlayer->quakeEffect - 4, 0);

View file

@ -64,10 +64,10 @@ struct POSTURE
int sideAccel;
int backAccel;
int pace[2];
int bobV;
int bobH;
int swayV;
int swayH;
double bobV;
double bobH;
double swayV;
double swayH;
double eyeAboveZ;
double weaponAboveZ;
int xOffset;
@ -94,16 +94,16 @@ struct PLAYER
int sceneQav; // by NoOne: used to keep qav id
int bobPhase;
int bobAmp;
int bobHeight;
int bobWidth;
int obobHeight;
int obobWidth;
double bobHeight;
double bobWidth;
double obobHeight;
double obobWidth;
int swayPhase;
int swayAmp;
int swayHeight;
int swayWidth;
int oswayHeight;
int oswayWidth;
double swayHeight;
double swayWidth;
double oswayHeight;
double oswayWidth;
int nPlayer; // Connect id
int lifeMode;
int bloodlust; // ---> useless

View file

@ -412,13 +412,13 @@ void viewUpdateShake(PLAYER* pPlayer, DVector3& cPos, DAngle& cA, fixedhoriz& cH
if (effectType)
{
int nValue = ClipHigh(effectType * 8, 2000);
cH += buildhoriz(QRandom2(nValue >> 8));
cA += mapangle(QRandom2(nValue >> 8));
cH += buildfhoriz(QRandom2F(nValue * (1. / 256.)));
cA += DAngle::fromBuildf(QRandom2F(nValue * (1. / 256.)));
cPos.X += QRandom2F(nValue * inttoworld) * inttoworld;
cPos.Y += QRandom2F(nValue * inttoworld) * inttoworld;
cPos.Z += QRandom2F(nValue) * zinttoworld;
pshakeX += QRandom2(nValue);
pshakeY += QRandom2(nValue);
pshakeX += QRandom2F(nValue) * (1. / 256.);
pshakeY += QRandom2F(nValue) * (1. / 256.);
}
};
doEffect(pPlayer->flickerEffect);
@ -493,10 +493,10 @@ static void SetupView(PLAYER* pPlayer, DVector3& cPos, DAngle& cA, fixedhoriz& c
cPos.XY() = pPlayer->actor->interpolatedpos(interpfrac).XY();
cPos.Z = interpolatedvalue(pPlayer->ozView, pPlayer->zView, interpfrac);
zDelta = interpolatedvalue(pPlayer->ozWeapon, pPlayer->zWeapon - pPlayer->zView - 12, interpfrac);
bobWidth = interpolatedvalue<double>(pPlayer->obobWidth, pPlayer->bobWidth, interpfrac);
bobHeight = interpolatedvalue<double>(pPlayer->obobHeight, pPlayer->bobHeight, interpfrac);
shakeX = interpolatedvalue<double>(pPlayer->oswayWidth, pPlayer->swayWidth, interpfrac);
shakeY = interpolatedvalue<double>(pPlayer->oswayHeight, pPlayer->swayHeight, interpfrac);
bobWidth = interpolatedvalue(pPlayer->obobWidth, pPlayer->bobWidth, interpfrac);
bobHeight = interpolatedvalue(pPlayer->obobHeight, pPlayer->bobHeight, interpfrac);
shakeX = interpolatedvalue(pPlayer->oswayWidth, pPlayer->swayWidth, interpfrac);
shakeY = interpolatedvalue(pPlayer->oswayHeight, pPlayer->swayHeight, interpfrac);
if (!SyncInput())
{
@ -518,12 +518,12 @@ static void SetupView(PLAYER* pPlayer, DVector3& cPos, DAngle& cA, fixedhoriz& c
{
if (cl_viewhbob)
{
cPos.X -= bobWidth * cA.Sin() * (1. / 256.);
cPos.Y += bobWidth * cA.Cos() * (1. / 256.);
cPos.X -= bobWidth * cA.Sin();
cPos.Y += bobWidth * cA.Cos();
}
if (cl_viewvbob)
{
cPos.Z += bobHeight * zinttoworld;
cPos.Z += bobHeight;
}
cPos.Z += FixedToFloat<24>(cH.asq16() * 10);
}

View file

@ -64,12 +64,12 @@ struct BloodPlayer native
native int sceneQav; // by NoOne: used to keep qav id
native int bobPhase;
native int bobAmp;
native int bobHeight;
native int bobWidth;
native double bobHeight;
native double bobWidth;
native int swayPhase;
native int swayAmp;
native int swayHeight;
native int swayWidth;
native double swayHeight;
native double swayWidth;
native int nPlayer; // Connect id
//native int nSprite;
native int lifeMode;