From 53306244f006f08868c2f4d0bc41609f42ab3026 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Tue, 13 Jan 2015 12:56:36 +0000 Subject: [PATCH] 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 --- polymer/eduke32/source/player.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/polymer/eduke32/source/player.c b/polymer/eduke32/source/player.c index 55ffc2b39..a365d64e8 100644 --- a/polymer/eduke32/source/player.c +++ b/polymer/eduke32/source/player.c @@ -3095,15 +3095,23 @@ static void P_ChangeWeapon(DukePlayer_t *p, int32_t weapon) if (i != -2) p->curr_weapon = weapon; - p->last_weapon = curr_weapon; - p->random_club_frame = 0; if (p->weapon_pos == 0) + { p->weapon_pos = -1; + p->last_weapon = curr_weapon; + } else if ((unsigned)p->weapon_pos < WEAPON_POS_RAISE) + { 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) {