- Blood/RR: Replace a few playerSet*() calls with playerAdd*(). Because the setters continually set until target is reached, can cause some perceivable smoothness issues if ticker re-targets's player's angle/horizon before input code has reached target.

This commit is contained in:
Mitchell Richters 2020-09-22 22:50:27 +10:00
parent 77265b3138
commit ac635ebd0f
2 changed files with 22 additions and 11 deletions

View file

@ -1358,12 +1358,13 @@ void ProcessInput(PLAYER *pPlayer)
char bSeqStat = playerSeqPlaying(pPlayer, 16); char bSeqStat = playerSeqPlaying(pPlayer, 16);
if (pPlayer->fraggerId != -1) if (pPlayer->fraggerId != -1)
{ {
pPlayer->angold = pSprite->ang = getangle(sprite[pPlayer->fraggerId].x - pSprite->x, sprite[pPlayer->fraggerId].y - pSprite->y); fixed_t fraggerAng = gethiq16angle(sprite[pPlayer->fraggerId].x - pSprite->x, sprite[pPlayer->fraggerId].y - pSprite->y);
playerSetAngle(&pPlayer->q16ang, &pPlayer->angTarget, pSprite->ang); pPlayer->angold = pSprite->ang = FixedToInt(fraggerAng);
playerAddAngle(&pPlayer->q16ang, &pPlayer->angAdjust, FixedToFloat(getincangleq16(pPlayer->q16ang, fraggerAng)));
} }
pPlayer->deathTime += 4; pPlayer->deathTime += 4;
if (!bSeqStat) if (!bSeqStat)
playerSetHoriz(&pPlayer->q16horiz, &pPlayer->horizTarget, FixedToFloat(mulscale16(0x8000-(Cos(ClipHigh(pPlayer->deathTime<<3, 1024))>>15), IntToFixed(120)))); playerAddHoriz(&pPlayer->q16horiz, &pPlayer->horizAdjust, FixedToFloat(mulscale16(0x8000-(Cos(ClipHigh(pPlayer->deathTime<<3, 1024))>>15), IntToFixed(120)) - pPlayer->q16horiz));
if (pPlayer->curWeapon) if (pPlayer->curWeapon)
pInput->setNewWeapon(pPlayer->curWeapon); pInput->setNewWeapon(pPlayer->curWeapon);
if (pInput->actions & SB_OPEN) if (pInput->actions & SB_OPEN)

View file

@ -1717,9 +1717,10 @@ static void onMotorcycle(int snum, ESyncBits &actions)
p->moto_drink--; p->moto_drink--;
} }
} }
int horiz = 0;
if (p->TurbCount) if (p->TurbCount)
{ {
int horiz;
if (p->TurbCount <= 1) if (p->TurbCount <= 1)
{ {
horiz = 100; horiz = 100;
@ -1733,7 +1734,6 @@ static void onMotorcycle(int snum, ESyncBits &actions)
p->TurbCount--; p->TurbCount--;
p->moto_drink = (krand() & 3) - 2; p->moto_drink = (krand() & 3) - 2;
} }
playerSetHoriz(&p->q16horiz, &p->horizTarget, horiz);
} }
else if (p->VBumpTarget > p->VBumpNow) else if (p->VBumpTarget > p->VBumpNow)
{ {
@ -1743,7 +1743,7 @@ static void onMotorcycle(int snum, ESyncBits &actions)
p->VBumpNow++; p->VBumpNow++;
if (p->VBumpTarget < p->VBumpNow) if (p->VBumpTarget < p->VBumpNow)
p->VBumpNow = p->VBumpTarget; p->VBumpNow = p->VBumpTarget;
playerSetHoriz(&p->q16horiz, &p->horizTarget, 100 + p->VBumpNow / 3); horiz = 100 + p->VBumpNow / 3;
} }
else if (p->VBumpTarget < p->VBumpNow) else if (p->VBumpTarget < p->VBumpNow)
{ {
@ -1753,13 +1753,18 @@ static void onMotorcycle(int snum, ESyncBits &actions)
p->VBumpNow--; p->VBumpNow--;
if (p->VBumpTarget > p->VBumpNow) if (p->VBumpTarget > p->VBumpNow)
p->VBumpNow = p->VBumpTarget; p->VBumpNow = p->VBumpTarget;
playerSetHoriz(&p->q16horiz, &p->horizTarget, 100 + p->VBumpNow / 3); horiz = 100 + p->VBumpNow / 3;
} }
else else
{ {
p->VBumpTarget = 0; p->VBumpTarget = 0;
p->moto_bump_fast = 0; p->moto_bump_fast = 0;
} }
if (horiz != 0)
{
playerAddHoriz(&p->q16horiz, &p->horizAdjust, horiz - FixedToFloat(p->q16horiz));
}
if (p->MotoSpeed >= 20 && p->on_ground == 1 && (var74 || var7c)) if (p->MotoSpeed >= 20 && p->on_ground == 1 && (var74 || var7c))
{ {
short var8c, var90, var94, var98; short var8c, var90, var94, var98;
@ -2041,9 +2046,10 @@ static void onBoat(int snum, ESyncBits &actions)
p->moto_drink--; p->moto_drink--;
} }
} }
int horiz = 0;
if (p->TurbCount) if (p->TurbCount)
{ {
int horiz;
if (p->TurbCount <= 1) if (p->TurbCount <= 1)
{ {
horiz = 100; horiz = 100;
@ -2057,7 +2063,6 @@ static void onBoat(int snum, ESyncBits &actions)
p->TurbCount--; p->TurbCount--;
p->moto_drink = (krand() & 3) - 2; p->moto_drink = (krand() & 3) - 2;
} }
playerSetHoriz(&p->q16horiz, &p->horizTarget, horiz);
} }
else if (p->VBumpTarget > p->VBumpNow) else if (p->VBumpTarget > p->VBumpNow)
{ {
@ -2067,7 +2072,7 @@ static void onBoat(int snum, ESyncBits &actions)
p->VBumpNow++; p->VBumpNow++;
if (p->VBumpTarget < p->VBumpNow) if (p->VBumpTarget < p->VBumpNow)
p->VBumpNow = p->VBumpTarget; p->VBumpNow = p->VBumpTarget;
playerSetHoriz(&p->q16horiz, &p->horizTarget, 100 + p->VBumpNow / 3); horiz = 100 + p->VBumpNow / 3;
} }
else if (p->VBumpTarget < p->VBumpNow) else if (p->VBumpTarget < p->VBumpNow)
{ {
@ -2077,13 +2082,18 @@ static void onBoat(int snum, ESyncBits &actions)
p->VBumpNow--; p->VBumpNow--;
if (p->VBumpTarget > p->VBumpNow) if (p->VBumpTarget > p->VBumpNow)
p->VBumpNow = p->VBumpTarget; p->VBumpNow = p->VBumpTarget;
playerSetHoriz(&p->q16horiz, &p->horizTarget, 100 + p->VBumpNow / 3); horiz = 100 + p->VBumpNow / 3;
} }
else else
{ {
p->VBumpTarget = 0; p->VBumpTarget = 0;
p->moto_bump_fast = 0; p->moto_bump_fast = 0;
} }
if (horiz != 0)
{
playerAddHoriz(&p->q16horiz, &p->horizAdjust, horiz - FixedToFloat(p->q16horiz));
}
if (p->MotoSpeed > 0 && p->on_ground == 1 && (varbc || varc4)) if (p->MotoSpeed > 0 && p->on_ground == 1 && (varbc || varc4))
{ {
short vard4, vard8, vardc, vare0; short vard4, vard8, vardc, vare0;