Improve weapon switching:

1. If you switch away from a weapon and switch to a third when the gun is still going down, continue lowering the first weapon instead of immediately raising the third.
2. If you switch away from a weapon and switch back to it before it lowers completely, raise it from its current position instead of going all the way to the bottom.

git-svn-id: https://svn.eduke32.com/eduke32@4915 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2015-01-13 12:56:36 +00:00
parent 49ba033faa
commit 53306244f0

View file

@ -3095,15 +3095,23 @@ static void P_ChangeWeapon(DukePlayer_t *p, int32_t weapon)
if (i != -2) if (i != -2)
p->curr_weapon = weapon; p->curr_weapon = weapon;
p->last_weapon = curr_weapon;
p->random_club_frame = 0; p->random_club_frame = 0;
if (p->weapon_pos == 0) if (p->weapon_pos == 0)
{
p->weapon_pos = -1; p->weapon_pos = -1;
p->last_weapon = curr_weapon;
}
else if ((unsigned)p->weapon_pos < WEAPON_POS_RAISE) else if ((unsigned)p->weapon_pos < WEAPON_POS_RAISE)
{
p->weapon_pos = -p->weapon_pos; p->weapon_pos = -p->weapon_pos;
else p->weapon_pos = WEAPON_POS_LOWER; p->last_weapon = curr_weapon;
}
else if (p->last_weapon == weapon)
{
p->last_weapon = -1;
p->weapon_pos = -p->weapon_pos;
}
if (p->holster_weapon) if (p->holster_weapon)
{ {