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
This commit is contained in:
hendricks266 2015-01-25 12:16:22 +00:00
parent 6048f9d766
commit 74bb822804

View file

@ -2654,57 +2654,48 @@ CHECKINV1:
{ {
k = p->curr_weapon; k = p->curr_weapon;
j = (j == 10 ? -1 : 1); // JBF: prev (-1) or next (1) weapon choice 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)) 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) switch (k)
{ {
case DEVISTATOR_WEAPON: case DEVISTATOR_WEAPON:
if ((int32_t) j == -1) if ((int32_t) j == -1)
{ {
if (PLUTOPAK && p->gotweapon & (1 << GROW_WEAPON) && p->ammo_amount[GROW_WEAPON] > 0) if (PLUTOPAK)
{
k = GROW_WEAPON; k = GROW_WEAPON;
p->subweapon |= (1<<GROW_WEAPON);
}
else else
{ k--;
k = SHRINKER_WEAPON;
p->subweapon &= ~(1 << GROW_WEAPON);
}
}
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;
break;
case SHRINKER_WEAPON:
if ((int32_t)j == 1)
{
if (PLUTOPAK && p->gotweapon & (1 << GROW_WEAPON) && p->ammo_amount[GROW_WEAPON] > 0)
{
k = GROW_WEAPON;
p->subweapon |= (1<<GROW_WEAPON);
} }
else else
k++; k++;
}
else k--;
break; break;
default: k += j; break;
case GROW_WEAPON:
if ((int32_t)j == -1)
k = SHRINKER_WEAPON;
else
k = DEVISTATOR_WEAPON;
break;
case SHRINKER_WEAPON:
if ((int32_t)j == 1)
{
if (PLUTOPAK)
k = GROW_WEAPON;
else
k++;
}
else
k--;
break;
default:
k += j;
break;
} }
if (k == -1) k = FREEZE_WEAPON; if (k == -1) k = FREEZE_WEAPON;
@ -2716,12 +2707,17 @@ CHECKINV1:
break; break;
} }
if (++i == 10) // absolutely no weapons, so use foot if (i == k) // absolutely no weapons, so use foot
{ {
j = KNEE_WEAPON; j = KNEE_WEAPON;
break; break;
} }
} }
if (j == SHRINKER_WEAPON)
p->subweapon &= ~(1 << GROW_WEAPON);
else if (j == GROW_WEAPON)
p->subweapon |= (1<<GROW_WEAPON);
} }
P_SetWeaponGamevars(snum, p); P_SetWeaponGamevars(snum, p);