mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 14:41:55 +00:00
- All Games: Make use of new addadjustment()
overloads in PlayerAngle
struct created in 25207e4f1818a5ed38648ce87673329cd75e20e4.
This commit is contained in:
parent
2341ed4e25
commit
ea4ad0548a
5 changed files with 18 additions and 19 deletions
|
@ -1353,9 +1353,9 @@ void ProcessInput(PLAYER *pPlayer)
|
|||
char bSeqStat = playerSeqPlaying(pPlayer, 16);
|
||||
if (pPlayer->fraggerId != -1)
|
||||
{
|
||||
fixed_t fraggerAng = gethiq16angle(sprite[pPlayer->fraggerId].x - pSprite->x, sprite[pPlayer->fraggerId].y - pSprite->y);
|
||||
pPlayer->angold = pSprite->ang = FixedToInt(fraggerAng);
|
||||
pPlayer->angle.addadjustment(FixedToFloat(getincangleq16(pPlayer->angle.ang.asq16(), fraggerAng)));
|
||||
auto fraggerAng = bvectangbam(sprite[pPlayer->fraggerId].x - pSprite->x, sprite[pPlayer->fraggerId].y - pSprite->y);
|
||||
pPlayer->angold = pSprite->ang = fraggerAng.asbuild();
|
||||
pPlayer->angle.addadjustment(getincanglebam(pPlayer->angle.ang, fraggerAng));
|
||||
}
|
||||
pPlayer->deathTime += 4;
|
||||
if (!bSeqStat)
|
||||
|
|
|
@ -462,7 +462,7 @@ void moveplayers(void)
|
|||
|
||||
if (p->actorsqu != nullptr)
|
||||
{
|
||||
p->angle.addadjustment(FixedToFloat(getincangleq16(p->angle.ang.asq16(), gethiq16angle(p->actorsqu->s.x - p->posx, p->actorsqu->s.y - p->posy)) >> 2));
|
||||
p->angle.addadjustment(getincanglebam(p->angle.ang, bvectangbam(p->actorsqu->s.x - p->posx, p->actorsqu->s.y - p->posy)) >> 2);
|
||||
}
|
||||
|
||||
if (spri->extra > 0)
|
||||
|
@ -485,7 +485,7 @@ void moveplayers(void)
|
|||
|
||||
if (p->wackedbyactor != nullptr && p->wackedbyactor->s.statnum < MAXSTATUS)
|
||||
{
|
||||
p->angle.addadjustment(FixedToFloat(getincangleq16(p->angle.ang.asq16(), gethiq16angle(p->wackedbyactor->s.x - p->posx, p->wackedbyactor->s.y - p->posy)) >> 1));
|
||||
p->angle.addadjustment(getincanglebam(p->angle.ang, bvectangbam(p->wackedbyactor->s.x - p->posx, p->wackedbyactor->s.y - p->posy)) >> 1);
|
||||
}
|
||||
}
|
||||
spri->ang = p->angle.ang.asbuild();
|
||||
|
|
|
@ -1749,11 +1749,11 @@ static void onMotorcycle(int snum, ESyncBits &actions)
|
|||
}
|
||||
|
||||
int currSpeed = p->MotoSpeed;
|
||||
short currAngle = p->angle.ang.asbuild(), velAdjustment;
|
||||
short velAdjustment;
|
||||
if (p->MotoSpeed >= 20 && p->on_ground == 1 && (p->vehTurnLeft || p->vehTurnRight))
|
||||
{
|
||||
velAdjustment = p->vehTurnLeft ? -10 : 10;
|
||||
short angAdjustment = velAdjustment < 0 ? 350 : -350;
|
||||
auto angAdjustment = buildang(velAdjustment < 0 ? 350 : -350);
|
||||
|
||||
if (p->moto_on_mud || p->moto_on_oil || !p->NotOnWater)
|
||||
{
|
||||
|
@ -1789,17 +1789,17 @@ static void onMotorcycle(int snum, ESyncBits &actions)
|
|||
}
|
||||
}
|
||||
|
||||
p->posxv += currSpeed * bcos(velAdjustment * -51 + currAngle, 4);
|
||||
p->posyv += currSpeed * bsin(velAdjustment * -51 + currAngle, 4);
|
||||
p->angle.addadjustment(FixedToFloat(getincangleq16(p->angle.ang.asq16(), IntToFixed(currAngle - angAdjustment))));
|
||||
p->posxv += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
|
||||
p->posyv += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
|
||||
p->angle.addadjustment(getincanglebam(p->angle.ang, p->angle.ang - angAdjustment));
|
||||
}
|
||||
else if (p->MotoSpeed >= 20 && p->on_ground == 1 && (p->moto_on_mud || p->moto_on_oil))
|
||||
{
|
||||
rng = krand() & 1;
|
||||
velAdjustment = rng == 0 ? -10 : 10;
|
||||
currSpeed = mulscale7(currSpeed, p->moto_on_oil ? 10 : 5);
|
||||
p->posxv += currSpeed * bcos(velAdjustment * -51 + currAngle, 4);
|
||||
p->posyv += currSpeed * bsin(velAdjustment * -51 + currAngle, 4);
|
||||
p->posxv += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
|
||||
p->posyv += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
|
||||
}
|
||||
|
||||
p->moto_on_mud = 0;
|
||||
|
@ -2030,9 +2030,8 @@ static void onBoat(int snum, ESyncBits &actions)
|
|||
if (p->MotoSpeed > 0 && p->on_ground == 1 && (p->vehTurnLeft || p->vehTurnRight))
|
||||
{
|
||||
int currSpeed = p->MotoSpeed * 4.;
|
||||
short currAngle = p->angle.ang.asbuild();
|
||||
short velAdjustment = p->vehTurnLeft ? -10 : 10;
|
||||
short angAdjustment = velAdjustment < 0 ? 350 : -350;
|
||||
auto angAdjustment = buildang(velAdjustment < 0 ? 350 : -350);
|
||||
|
||||
if (p->moto_do_bump)
|
||||
{
|
||||
|
@ -2045,9 +2044,9 @@ static void onBoat(int snum, ESyncBits &actions)
|
|||
angAdjustment >>= 6;
|
||||
}
|
||||
|
||||
p->posxv += currSpeed * bcos(velAdjustment * -51 + currAngle, 4);
|
||||
p->posyv += currSpeed * bsin(velAdjustment * -51 + currAngle, 4);
|
||||
p->angle.addadjustment(FixedToFloat(getincangleq16(p->angle.ang.asq16(), IntToFixed(currAngle - angAdjustment))));
|
||||
p->posxv += currSpeed * bcos(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
|
||||
p->posyv += currSpeed * bsin(velAdjustment * -51 + p->angle.ang.asbuild(), 4);
|
||||
p->angle.addadjustment(getincanglebam(p->angle.ang, p->angle.ang - angAdjustment));
|
||||
}
|
||||
if (p->NotOnWater && p->MotoSpeed > 50)
|
||||
p->MotoSpeed -= (p->MotoSpeed / 2.);
|
||||
|
|
|
@ -6198,7 +6198,7 @@ void DoPlayerDeathFollowKiller(PLAYERp pp)
|
|||
|
||||
if (FAFcansee(kp->x, kp->y, SPRITEp_TOS(kp), kp->sectnum, pp->posx, pp->posy, pp->posz, pp->cursectnum))
|
||||
{
|
||||
pp->angle.addadjustment(getincangleq16(pp->angle.ang.asq16(), gethiq16angle(kp->x - pp->posx, kp->y - pp->posy)) / (double)(FRACUNIT << 4));
|
||||
pp->angle.addadjustment(getincanglebam(pp->angle.ang, bvectangbam(kp->x - pp->posx, kp->y - pp->posy)) >> 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1688,7 +1688,7 @@ MovePlayer(PLAYERp pp, SECTOR_OBJECTp sop, int nx, int ny)
|
|||
|
||||
// New angle is formed by taking last known angle and
|
||||
// adjusting by the delta angle
|
||||
pp->angle.addadjustment((pp->angle.ang - (pp->RevolveAng + buildang(pp->RevolveDeltaAng))).asbam() / (double)BAMUNIT);
|
||||
pp->angle.addadjustment(pp->angle.ang - (pp->RevolveAng + buildang(pp->RevolveDeltaAng)));
|
||||
|
||||
UpdatePlayerSprite(pp);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue