- 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) if (cl_hudinterpolation)
{ {
cX += (bobx / 256.); cX += bobx;
cY += (boby / 256.) + (zDelta * 2.); cY += boby + (zDelta * 2.);
} }
else else
{ {
cX += (int(bobx) >> 8); cX += int(bobx);
cY += (int(boby) >> 8) + int(zDelta * 2); cY += int(boby) + int(zDelta * 2);
} }
} }
else else

View file

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

View file

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

View file

@ -412,13 +412,13 @@ void viewUpdateShake(PLAYER* pPlayer, DVector3& cPos, DAngle& cA, fixedhoriz& cH
if (effectType) if (effectType)
{ {
int nValue = ClipHigh(effectType * 8, 2000); int nValue = ClipHigh(effectType * 8, 2000);
cH += buildhoriz(QRandom2(nValue >> 8)); cH += buildfhoriz(QRandom2F(nValue * (1. / 256.)));
cA += mapangle(QRandom2(nValue >> 8)); cA += DAngle::fromBuildf(QRandom2F(nValue * (1. / 256.)));
cPos.X += QRandom2F(nValue * inttoworld) * inttoworld; cPos.X += QRandom2F(nValue * inttoworld) * inttoworld;
cPos.Y += QRandom2F(nValue * inttoworld) * inttoworld; cPos.Y += QRandom2F(nValue * inttoworld) * inttoworld;
cPos.Z += QRandom2F(nValue) * zinttoworld; cPos.Z += QRandom2F(nValue) * zinttoworld;
pshakeX += QRandom2(nValue); pshakeX += QRandom2F(nValue) * (1. / 256.);
pshakeY += QRandom2(nValue); pshakeY += QRandom2F(nValue) * (1. / 256.);
} }
}; };
doEffect(pPlayer->flickerEffect); 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.XY() = pPlayer->actor->interpolatedpos(interpfrac).XY();
cPos.Z = interpolatedvalue(pPlayer->ozView, pPlayer->zView, interpfrac); cPos.Z = interpolatedvalue(pPlayer->ozView, pPlayer->zView, interpfrac);
zDelta = interpolatedvalue(pPlayer->ozWeapon, pPlayer->zWeapon - pPlayer->zView - 12, interpfrac); zDelta = interpolatedvalue(pPlayer->ozWeapon, pPlayer->zWeapon - pPlayer->zView - 12, interpfrac);
bobWidth = interpolatedvalue<double>(pPlayer->obobWidth, pPlayer->bobWidth, interpfrac); bobWidth = interpolatedvalue(pPlayer->obobWidth, pPlayer->bobWidth, interpfrac);
bobHeight = interpolatedvalue<double>(pPlayer->obobHeight, pPlayer->bobHeight, interpfrac); bobHeight = interpolatedvalue(pPlayer->obobHeight, pPlayer->bobHeight, interpfrac);
shakeX = interpolatedvalue<double>(pPlayer->oswayWidth, pPlayer->swayWidth, interpfrac); shakeX = interpolatedvalue(pPlayer->oswayWidth, pPlayer->swayWidth, interpfrac);
shakeY = interpolatedvalue<double>(pPlayer->oswayHeight, pPlayer->swayHeight, interpfrac); shakeY = interpolatedvalue(pPlayer->oswayHeight, pPlayer->swayHeight, interpfrac);
if (!SyncInput()) if (!SyncInput())
{ {
@ -518,12 +518,12 @@ static void SetupView(PLAYER* pPlayer, DVector3& cPos, DAngle& cA, fixedhoriz& c
{ {
if (cl_viewhbob) if (cl_viewhbob)
{ {
cPos.X -= bobWidth * cA.Sin() * (1. / 256.); cPos.X -= bobWidth * cA.Sin();
cPos.Y += bobWidth * cA.Cos() * (1. / 256.); cPos.Y += bobWidth * cA.Cos();
} }
if (cl_viewvbob) if (cl_viewvbob)
{ {
cPos.Z += bobHeight * zinttoworld; cPos.Z += bobHeight;
} }
cPos.Z += FixedToFloat<24>(cH.asq16() * 10); 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 sceneQav; // by NoOne: used to keep qav id
native int bobPhase; native int bobPhase;
native int bobAmp; native int bobAmp;
native int bobHeight; native double bobHeight;
native int bobWidth; native double bobWidth;
native int swayPhase; native int swayPhase;
native int swayAmp; native int swayAmp;
native int swayHeight; native double swayHeight;
native int swayWidth; native double swayWidth;
native int nPlayer; // Connect id native int nPlayer; // Connect id
//native int nSprite; //native int nSprite;
native int lifeMode; native int lifeMode;