- interpolate p->weapon_pos for smooth switching of weapons.

This commit is contained in:
Mitchell Richters 2020-08-02 23:00:53 +10:00 committed by Christoph Oelckers
parent 85dcffc442
commit 0bcb37860a
3 changed files with 7 additions and 2 deletions

View file

@ -300,7 +300,9 @@ void displayweapon_d(int snum, double smoothratio)
animateknee(gs,snum);
gun_pos = 80-(p->weapon_pos*p->weapon_pos);
int opos = p->oweapon_pos * p->oweapon_pos;
int npos = p->weapon_pos * p->weapon_pos;
gun_pos = 80 - (opos + fmulscale16(npos - opos, smoothratio));
weapon_xoffset = (160)-90;
weapon_xoffset -= calcSinTableValue(fmod((weapon_sway / 2.) + 512, 2048)) / (1024. + 512.);

View file

@ -253,6 +253,9 @@ void hud_input(int snum)
if (p->aim_mode < i)
p->return_to_center = 9;
// Backup weapon_pos here as this is the earliest occurence where weapon_pos can change.
p->oweapon_pos = p->weapon_pos;
if (isRR())
{
if (PlayerInput(snum, SKB_QUICK_KICK) && p->last_pissed_time == 0)

View file

@ -146,7 +146,7 @@ struct player_struct
short dead_flag, show_empty_weapon; // JBF 20031220: added orotscrnang
short scuba_amount, jetpack_amount, steroids_amount, shield_amount;
short holoduke_on, pycount, weapon_pos, frag_ps;
short holoduke_on, pycount, weapon_pos, frag_ps, oweapon_pos;
short transporter_hold, last_full_weapon, footprintshade, boot_amount;
int scream_voice;