- Duke/RR: Selecting the alternative weapon must set the proper bits in 'subweapon'.

Otherwise the weapon cycling breaks.
Fixes #182
This commit is contained in:
Christoph Oelckers 2020-12-01 21:07:38 +01:00
parent 06a069750f
commit b0bf51ec5c
3 changed files with 62 additions and 17 deletions

View file

@ -1190,22 +1190,38 @@ void selectweapon_d(int snum, int weap) // playernum, weaponnum
{
if (weap == WeaponSel_Alt)
{
j = p->curr_weapon;
switch (p->curr_weapon)
{
case SHRINKER_WEAPON:
j = isPlutoPak() ? GROW_WEAPON : p->curr_weapon;
if (p->ammo_amount[GROW_WEAPON] > 0 && p->gotweapon[GROW_WEAPON] && isPlutoPak())
{
j = GROW_WEAPON;
p->subweapon |= (1 << GROW_WEAPON);
}
break;
case GROW_WEAPON:
j = SHRINKER_WEAPON;
if (p->ammo_amount[SHRINKER_WEAPON] > 0 && p->gotweapon[SHRINKER_WEAPON])
{
j = SHRINKER_WEAPON;
p->subweapon &= ~(1 << GROW_WEAPON);
}
break;
case FREEZE_WEAPON:
j = isWorldTour() ? FLAMETHROWER_WEAPON : p->curr_weapon;
if (p->ammo_amount[FLAMETHROWER_WEAPON] > 0 && p->gotweapon[FLAMETHROWER_WEAPON] && isWorldTour())
{
j = FLAMETHROWER_WEAPON;
p->subweapon |= (1 << FLAMETHROWER_WEAPON);
}
break;
case FLAMETHROWER_WEAPON:
j = FREEZE_WEAPON;
if (p->ammo_amount[FREEZE_WEAPON] > 0 && p->gotweapon[FREEZE_WEAPON])
{
j = FREEZE_WEAPON;
p->subweapon &= ~(1 << FLAMETHROWER_WEAPON);
}
break;
default:
j = p->curr_weapon;
break;
}
}

View file

@ -984,34 +984,63 @@ void selectweapon_r(int snum, int weap)
{
if (weap == WeaponSel_Alt)
{
j = p->curr_weapon;
switch (p->curr_weapon)
{
case THROWSAW_WEAPON:
j = BUZZSAW_WEAPON;
if (p->ammo_amount[BUZZSAW_WEAPON] > 0)
{
j = BUZZSAW_WEAPON;
p->subweapon = 1 << BUZZSAW_WEAPON;
}
break;
case BUZZSAW_WEAPON:
j = THROWSAW_WEAPON;
if (p->ammo_amount[THROWSAW_WEAPON] > 0)
{
j = THROWSAW_WEAPON;
p->subweapon = 0;
}
break;
case POWDERKEG_WEAPON:
j = BOWLING_WEAPON;
if (p->ammo_amount[BOWLING_WEAPON] > 0)
{
j = BOWLING_WEAPON;
p->subweapon = 1 << BOWLING_WEAPON;
}
break;
case BOWLING_WEAPON:
j = POWDERKEG_WEAPON;
if (p->ammo_amount[POWDERKEG_WEAPON] > 0)
{
j = POWDERKEG_WEAPON;
p->subweapon = 0;
}
break;
case KNEE_WEAPON:
j = isRRRA() ? SLINGBLADE_WEAPON : p->curr_weapon;
if (isRRRA())
{
j = SLINGBLADE_WEAPON;
p->subweapon = 2;
}
break;
case SLINGBLADE_WEAPON:
j = KNEE_WEAPON;
p->subweapon = 0;
break;
case DYNAMITE_WEAPON:
j = isRRRA() ? CHICKEN_WEAPON : p->curr_weapon;
if (p->ammo_amount[CHICKEN_WEAPON] > 0 && isRRRA())
{
j = CHICKEN_WEAPON;
p->subweapon = 4;
}
break;
case CHICKEN_WEAPON:
j = DYNAMITE_WEAPON;
if (p->ammo_amount[DYNAMITE_WEAPON] > 0)
{
j = DYNAMITE_WEAPON;
p->subweapon = 0;
}
break;
default:
j = p->curr_weapon;
break;
}
}

View file

@ -498,10 +498,6 @@ OptionMenu "ActionControlsMenu" protected
{
Control "$CNTRLMNU_ALTATTACK" , "+alt_fire"
}
ifnotgame(Exhumed)
{
Control "$CNTRLMNU_ALTWEAPON" , "weapalt"
}
StaticText ""
Control "$CNTRLMNU_USE" , "+open"
@ -563,6 +559,10 @@ OptionMenu "WeaponsControlMenu" protected
StaticText ""
Control "$CNTRLMNU_NEXTWEAPON" , "weapnext"
Control "$CNTRLMNU_PREVIOUSWEAPON" , "weapprev"
ifnotgame(Exhumed)
{
Control "$CNTRLMNU_ALTWEAPON" , "weapalt"
}
StaticText ""
Control "$CNTRLMNU_SLOT1" , "slot 1"