- fix cl_weaponsway for Duke.

This commit is contained in:
Mitchell Richters 2020-08-05 20:04:14 +10:00
parent 2919cdcb44
commit d1a68421bd
4 changed files with 27 additions and 34 deletions

View file

@ -250,6 +250,7 @@ void backupview(player_struct* p);
void backupweapon(player_struct* p); void backupweapon(player_struct* p);
void resetinputhelpers(player_struct* p); void resetinputhelpers(player_struct* p);
void checkhardlanding(player_struct* p); void checkhardlanding(player_struct* p);
void playerweaponsway(player_struct* p, spritetype* s);
void playerAddAngle(player_struct* p, int ang); void playerAddAngle(player_struct* p, int ang);
void playerSetAngle(player_struct* p, int ang); void playerSetAngle(player_struct* p, int ang);

View file

@ -927,6 +927,30 @@ void checkhardlanding(player_struct* p)
} }
} }
void playerweaponsway(player_struct* p, spritetype* s)
{
if (cl_weaponsway)
{
if (s->xvel < 32 || p->on_ground == 0 || p->bobcounter == 1024)
{
if ((p->weapon_sway & 2047) > (1024 + 96))
p->weapon_sway -= 96;
else if ((p->weapon_sway & 2047) < (1024 - 96))
p->weapon_sway += 96;
else p->oweapon_sway = p->weapon_sway = 1024;
}
else
{
p->weapon_sway = p->bobcounter;
if ((p->bobcounter - p->oweapon_sway) > 256)
{
p->oweapon_sway = p->weapon_sway;
}
}
}
}
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// //

View file

@ -2731,23 +2731,7 @@ void processinput_d(int snum)
if (p->on_crane >= 0) if (p->on_crane >= 0)
goto HORIZONLY; goto HORIZONLY;
if (s->xvel < 32 || p->on_ground == 0 || p->bobcounter == 1024) playerweaponsway(p, s);
{
if ((p->weapon_sway & 2047) > (1024 + 96))
p->weapon_sway -= 96;
else if ((p->weapon_sway & 2047) < (1024 - 96))
p->weapon_sway += 96;
else p->oweapon_sway = p->weapon_sway = 1024;
}
else
{
p->weapon_sway = p->bobcounter;
if ((p->bobcounter - p->oweapon_sway) > 256)
{
p->oweapon_sway = p->weapon_sway;
}
}
s->xvel = s->xvel =
ksqrt((p->posx - p->bobposx) * (p->posx - p->bobposx) + (p->posy - p->bobposy) * (p->posy - p->bobposy)); ksqrt((p->posx - p->bobposx) * (p->posx - p->bobposx) + (p->posy - p->bobposy) * (p->posy - p->bobposy));

View file

@ -3637,23 +3637,7 @@ void processinput_r(int snum)
if (p->on_crane >= 0) if (p->on_crane >= 0)
goto HORIZONLY; goto HORIZONLY;
if (s->xvel < 32 || p->on_ground == 0 || p->bobcounter == 1024) playerweaponsway(p, s);
{
if ((p->weapon_sway & 2047) > (1024 + 96))
p->weapon_sway -= 96;
else if ((p->weapon_sway & 2047) < (1024 - 96))
p->weapon_sway += 96;
else p->oweapon_sway = p->weapon_sway = 1024;
}
else
{
p->weapon_sway = p->bobcounter;
if ((p->bobcounter - p->oweapon_sway) > 256)
{
p->oweapon_sway = p->weapon_sway;
}
}
s->xvel = s->xvel =
ksqrt((p->posx - p->bobposx) * (p->posx - p->bobposx) + (p->posy - p->bobposy) * (p->posy - p->bobposy)); ksqrt((p->posx - p->bobposx) * (p->posx - p->bobposx) + (p->posy - p->bobposy) * (p->posy - p->bobposy));