- 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) if (weap == WeaponSel_Alt)
{ {
j = p->curr_weapon;
switch (p->curr_weapon) switch (p->curr_weapon)
{ {
case SHRINKER_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; break;
case GROW_WEAPON: case GROW_WEAPON:
if (p->ammo_amount[SHRINKER_WEAPON] > 0 && p->gotweapon[SHRINKER_WEAPON])
{
j = SHRINKER_WEAPON; j = SHRINKER_WEAPON;
p->subweapon &= ~(1 << GROW_WEAPON);
}
break; break;
case FREEZE_WEAPON: 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; break;
case FLAMETHROWER_WEAPON: case FLAMETHROWER_WEAPON:
if (p->ammo_amount[FREEZE_WEAPON] > 0 && p->gotweapon[FREEZE_WEAPON])
{
j = FREEZE_WEAPON; j = FREEZE_WEAPON;
p->subweapon &= ~(1 << FLAMETHROWER_WEAPON);
}
break; break;
default: default:
j = p->curr_weapon;
break; break;
} }
} }

View file

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

View file

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