From 74bb822804e62fa67219c219b0976101b1ba20c7 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Sun, 25 Jan 2015 12:16:22 +0000 Subject: [PATCH] Revise r4707 to fix some remaining issues with next/previous weapon. git-svn-id: https://svn.eduke32.com/eduke32@4943 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/sector.c | 52 +++++++++++++++------------------ 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index 667e2aec9..ed6148646 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -2654,57 +2654,48 @@ CHECKINV1: { k = p->curr_weapon; j = (j == 10 ? -1 : 1); // JBF: prev (-1) or next (1) weapon choice - i = 0; + i = k; while ((k >= 0 && k < 10) || (PLUTOPAK && k == GROW_WEAPON)) { - // this is handling next/previous with the grower selected + // this accounts for the expander when handling next/previous switch (k) { case DEVISTATOR_WEAPON: if ((int32_t) j == -1) { - if (PLUTOPAK && p->gotweapon & (1 << GROW_WEAPON) && p->ammo_amount[GROW_WEAPON] > 0) - { + if (PLUTOPAK) k = GROW_WEAPON; - p->subweapon |= (1<subweapon &= ~(1 << GROW_WEAPON); - } + k--; } - else k++; + else + k++; break; + case GROW_WEAPON: if ((int32_t)j == -1) - { - if (PLUTOPAK && p->gotweapon & (1 << SHRINKER_WEAPON) && p->ammo_amount[SHRINKER_WEAPON] > 0) - { - k = SHRINKER_WEAPON; - p->subweapon &= ~(1 << GROW_WEAPON); - } - else - k = HANDBOMB_WEAPON; - } - else k = DEVISTATOR_WEAPON; + k = SHRINKER_WEAPON; + else + k = DEVISTATOR_WEAPON; break; + case SHRINKER_WEAPON: if ((int32_t)j == 1) { - if (PLUTOPAK && p->gotweapon & (1 << GROW_WEAPON) && p->ammo_amount[GROW_WEAPON] > 0) - { + if (PLUTOPAK) k = GROW_WEAPON; - p->subweapon |= (1<subweapon &= ~(1 << GROW_WEAPON); + else if (j == GROW_WEAPON) + p->subweapon |= (1<