mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Alter weapon switching to cycle through GROW_WEAPON when using next/previous weapon keys. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@4707 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
633cb8764b
commit
7f232bcbd1
3 changed files with 56 additions and 44 deletions
|
@ -750,7 +750,7 @@ enum {
|
|||
GVX_BADSECTOR,
|
||||
GVX_BADWALL,
|
||||
GVX_BADINDEX,
|
||||
} gvxerror_t;
|
||||
};
|
||||
|
||||
static const char *gvxerrs [] ={ "Gv_GetVarX(): invalid gamevar ID",
|
||||
"Gv_GetVarX(): invalid player ID",
|
||||
|
|
|
@ -2734,9 +2734,7 @@ void P_GetInput(int32_t snum)
|
|||
in.avel = clamp(in.avel, -MAXANGVEL, MAXANGVEL);
|
||||
in.horz = clamp(in.horz, -MAXHORIZ, MAXHORIZ);
|
||||
|
||||
j=0;
|
||||
|
||||
for (j = gamefunc_Weapon_1; j <= gamefunc_Weapon_10; j++)
|
||||
for (j = gamefunc_Weapon_10; j >= gamefunc_Weapon_1; j--)
|
||||
{
|
||||
if (BUTTON(j))
|
||||
{
|
||||
|
@ -2745,14 +2743,14 @@ void P_GetInput(int32_t snum)
|
|||
}
|
||||
}
|
||||
|
||||
if (j == gamefunc_Weapon_1-1)
|
||||
j = 0;
|
||||
|
||||
if (BUTTON(gamefunc_Previous_Weapon) || (BUTTON(gamefunc_Dpad_Select) && in.fvel < 0))
|
||||
j = 11;
|
||||
if (BUTTON(gamefunc_Next_Weapon) || (BUTTON(gamefunc_Dpad_Select) && in.fvel > 0))
|
||||
j = 12;
|
||||
|
||||
if (j > 12)
|
||||
j = 0;
|
||||
|
||||
if (BUTTON(gamefunc_Jump) && p->on_ground)
|
||||
g_emuJumpTics = 4;
|
||||
|
||||
|
@ -2765,8 +2763,7 @@ void P_GetInput(int32_t snum)
|
|||
loc.bits |= BUTTON(gamefunc_Fire)<<SK_FIRE;
|
||||
loc.bits |= (BUTTON(gamefunc_Aim_Up) || (BUTTON(gamefunc_Dpad_Aiming) && in.fvel > 0))<<SK_AIM_UP;
|
||||
loc.bits |= (BUTTON(gamefunc_Aim_Down) || (BUTTON(gamefunc_Dpad_Aiming) && in.fvel < 0))<<SK_AIM_DOWN;
|
||||
if (ud.runkey_mode) loc.bits |= (ud.auto_run | BUTTON(gamefunc_Run))<<SK_RUN;
|
||||
else loc.bits |= (BUTTON(gamefunc_Run) ^ ud.auto_run)<<SK_RUN;
|
||||
loc.bits |= ((ud.runkey_mode) ? (ud.auto_run | BUTTON(gamefunc_Run)) : (BUTTON(gamefunc_Run) ^ ud.auto_run))<<SK_RUN;
|
||||
loc.bits |= BUTTON(gamefunc_Look_Left)<<SK_LOOK_LEFT;
|
||||
loc.bits |= BUTTON(gamefunc_Look_Right)<<SK_LOOK_RIGHT;
|
||||
loc.bits |= j<<SK_WEAPON_BITS;
|
||||
|
@ -2799,8 +2796,7 @@ void P_GetInput(int32_t snum)
|
|||
if (PWEAPON(snum, g_player[snum].ps->curr_weapon, Flags) & WEAPON_SEMIAUTO && BUTTON(gamefunc_Fire))
|
||||
CONTROL_ClearButton(gamefunc_Fire);
|
||||
|
||||
loc.extbits = 0;
|
||||
loc.extbits |= (BUTTON(gamefunc_Move_Forward) || (in.fvel > 0));
|
||||
loc.extbits = (BUTTON(gamefunc_Move_Forward) || (in.fvel > 0));
|
||||
loc.extbits |= (BUTTON(gamefunc_Move_Backward) || (in.fvel < 0))<<1;
|
||||
loc.extbits |= (BUTTON(gamefunc_Strafe_Left) || (in.svel > 0))<<2;
|
||||
loc.extbits |= (BUTTON(gamefunc_Strafe_Right) || (in.svel < 0))<<3;
|
||||
|
|
|
@ -2653,49 +2653,65 @@ CHECKINV1:
|
|||
j = (j == 10 ? -1 : 1); // JBF: prev (-1) or next (1) weapon choice
|
||||
i = 0;
|
||||
|
||||
while ((k >= 0 && k < 10) || (PLUTOPAK && k == GROW_WEAPON && (p->subweapon&(1<<GROW_WEAPON)))) // JBF 20040116: so we don't select grower with v1.3d
|
||||
while ((k >= 0 && k < 10) || (PLUTOPAK && k == GROW_WEAPON))
|
||||
{
|
||||
if (k == GROW_WEAPON) // JBF: this is handling next/previous with the grower selected
|
||||
// this is handling next/previous with the grower selected
|
||||
|
||||
switch (k)
|
||||
{
|
||||
if ((int32_t)j == -1)
|
||||
k = 5;
|
||||
else k = 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
k += j;
|
||||
if (PLUTOPAK) // JBF 20040116: so we don't select grower with v1.3d
|
||||
if (k == SHRINKER_WEAPON && (p->subweapon&(1<<GROW_WEAPON))) // JBF: activates grower
|
||||
k = GROW_WEAPON; // if enabled
|
||||
case DEVISTATOR_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
|
||||
{
|
||||
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
|
||||
k++;
|
||||
}
|
||||
else k--;
|
||||
break;
|
||||
default: k += j; break;
|
||||
}
|
||||
|
||||
if (k == -1) k = 9;
|
||||
else if (k == 10) k = 0;
|
||||
if (k == -1) k = FREEZE_WEAPON;
|
||||
else if (k == 10) k = KNEE_WEAPON;
|
||||
|
||||
if ((p->gotweapon & (1<<k)) && p->ammo_amount[k] > 0)
|
||||
{
|
||||
if (PLUTOPAK) // JBF 20040116: so we don't select grower with v1.3d
|
||||
if (k == SHRINKER_WEAPON && (p->subweapon&(1<<GROW_WEAPON)))
|
||||
k = GROW_WEAPON;
|
||||
j = k;
|
||||
break;
|
||||
}
|
||||
else // JBF: grower with no ammo, but shrinker with ammo, switch to shrink
|
||||
if (PLUTOPAK && k == GROW_WEAPON && p->ammo_amount[GROW_WEAPON] == 0 &&
|
||||
(p->gotweapon & (1<<SHRINKER_WEAPON)) && p->ammo_amount[SHRINKER_WEAPON] > 0) // JBF 20040116: added PLUTOPAK so we don't select grower with v1.3d
|
||||
{
|
||||
j = SHRINKER_WEAPON;
|
||||
p->subweapon &= ~(1<<GROW_WEAPON);
|
||||
break;
|
||||
}
|
||||
else // JBF: shrinker with no ammo, but grower with ammo, switch to grow
|
||||
if (PLUTOPAK && k == SHRINKER_WEAPON && p->ammo_amount[SHRINKER_WEAPON] == 0 &&
|
||||
(p->gotweapon & (1<<SHRINKER_WEAPON)) && p->ammo_amount[GROW_WEAPON] > 0) // JBF 20040116: added PLUTOPAK so we don't select grower with v1.3d
|
||||
{
|
||||
j = GROW_WEAPON;
|
||||
p->subweapon |= (1<<GROW_WEAPON);
|
||||
break;
|
||||
}
|
||||
|
||||
if (++i == 10) // absolutely no weapons, so use foot
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue