mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Rework crouch toggle
This is almost entirely contained in P_GetInput() now. It still uses two separately mappable buttons but you can get away with only gamefunc_Crouch_Toggle. git-svn-id: https://svn.eduke32.com/eduke32@8057 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
cef3c33e5f
commit
dcf9768c20
2 changed files with 21 additions and 13 deletions
|
@ -5061,12 +5061,6 @@ FAKE_F3:
|
|||
P_DoQuote(QUOTE_RUN_MODE_OFF + ud.auto_run, &myplayer);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Crouch_Toggle))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Crouch_Toggle);
|
||||
myplayer.crouch_toggle = !myplayer.crouch_toggle;
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Map))
|
||||
{
|
||||
CONTROL_ClearButton(gamefunc_Map);
|
||||
|
|
|
@ -3033,7 +3033,6 @@ void P_GetInput(int const playerNum)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (BUTTON(gamefunc_Last_Weapon))
|
||||
weaponSelection = 14;
|
||||
else if (BUTTON(gamefunc_Alt_Weapon))
|
||||
|
@ -3046,10 +3045,25 @@ void P_GetInput(int const playerNum)
|
|||
weaponSelection = 0;
|
||||
|
||||
localInput.bits = (weaponSelection << SK_WEAPON_BITS) | (BUTTON(gamefunc_Fire) << SK_FIRE);
|
||||
|
||||
localInput.bits |= (BUTTON(gamefunc_Open) << SK_OPEN);
|
||||
|
||||
localInput.bits |= (BUTTON(gamefunc_Jump) << SK_JUMP) | (BUTTON(gamefunc_Crouch) << SK_CROUCH);
|
||||
int const sectorLotag = pPlayer->cursectnum != -1 ? sector[pPlayer->cursectnum].lotag : 0;
|
||||
int const crouchable = pPlayer->on_ground && sectorLotag != 2 && (sectorLotag != 1 || pPlayer->spritebridge);
|
||||
|
||||
if (BUTTON(gamefunc_Crouch_Toggle))
|
||||
{
|
||||
pPlayer->crouch_toggle = !pPlayer->crouch_toggle && crouchable;
|
||||
|
||||
if (crouchable)
|
||||
CONTROL_ClearButton(gamefunc_Crouch_Toggle);
|
||||
}
|
||||
|
||||
if (BUTTON(gamefunc_Crouch) || pPlayer->jetpack_on || (!crouchable && pPlayer->on_ground))
|
||||
pPlayer->crouch_toggle = 0;
|
||||
|
||||
int const crouching = BUTTON(gamefunc_Crouch) || BUTTON(gamefunc_Crouch_Toggle) || pPlayer->crouch_toggle;
|
||||
|
||||
localInput.bits |= (BUTTON(gamefunc_Jump) << SK_JUMP) | (crouching << SK_CROUCH);
|
||||
|
||||
localInput.bits |= (BUTTON(gamefunc_Aim_Up) || (BUTTON(gamefunc_Dpad_Aiming) && input.fvel > 0)) << SK_AIM_UP;
|
||||
localInput.bits |= (BUTTON(gamefunc_Aim_Down) || (BUTTON(gamefunc_Dpad_Aiming) && input.fvel < 0)) << SK_AIM_DOWN;
|
||||
|
@ -4098,7 +4112,7 @@ static void P_ProcessWeapon(int playerNum)
|
|||
int pipeBombZvel;
|
||||
int pipeBombFwdVel;
|
||||
|
||||
if (pPlayer->on_ground && (TEST_SYNC_KEY(playerBits, SK_CROUCH) ^ pPlayer->crouch_toggle))
|
||||
if (pPlayer->on_ground && TEST_SYNC_KEY(playerBits, SK_CROUCH))
|
||||
{
|
||||
pipeBombFwdVel = 15;
|
||||
pipeBombZvel = (fix16_to_int(pPlayer->q16horiz + pPlayer->q16horizoff - F16(100)) * 20);
|
||||
|
@ -5041,7 +5055,7 @@ void P_ProcessInput(int playerNum)
|
|||
if (pPlayer->pos.z < (floorZ-(floorZOffset<<8))) //falling
|
||||
{
|
||||
// not jumping or crouching
|
||||
if ((!TEST_SYNC_KEY(playerBits, SK_JUMP) && !(TEST_SYNC_KEY(playerBits, SK_CROUCH) ^ pPlayer->crouch_toggle)) && pPlayer->on_ground &&
|
||||
if ((!TEST_SYNC_KEY(playerBits, SK_JUMP) && !(TEST_SYNC_KEY(playerBits, SK_CROUCH))) && pPlayer->on_ground &&
|
||||
(sector[pPlayer->cursectnum].floorstat & 2) && pPlayer->pos.z >= (floorZ - (floorZOffset << 8) - ZOFFSET2))
|
||||
pPlayer->pos.z = floorZ - (floorZOffset << 8);
|
||||
else
|
||||
|
@ -5137,7 +5151,7 @@ void P_ProcessInput(int playerNum)
|
|||
}
|
||||
}
|
||||
|
||||
if (TEST_SYNC_KEY(playerBits, SK_CROUCH) ^ pPlayer->crouch_toggle)
|
||||
if (TEST_SYNC_KEY(playerBits, SK_CROUCH))
|
||||
{
|
||||
// crouching
|
||||
if (VM_OnEvent(EVENT_CROUCH,pPlayer->i,playerNum) == 0)
|
||||
|
@ -5339,7 +5353,7 @@ void P_ProcessInput(int playerNum)
|
|||
|
||||
if (sectorLotag == ST_2_UNDERWATER)
|
||||
playerSpeedReduction = 0x1400;
|
||||
else if (((pPlayer->on_ground && (TEST_SYNC_KEY(playerBits, SK_CROUCH) ^ pPlayer->crouch_toggle))
|
||||
else if (((pPlayer->on_ground && TEST_SYNC_KEY(playerBits, SK_CROUCH))
|
||||
|| (*weaponFrame > 10 && PWEAPON(playerNum, pPlayer->curr_weapon, WorksLike) == KNEE_WEAPON)))
|
||||
playerSpeedReduction = 0x2000;
|
||||
|
||||
|
|
Loading…
Reference in a new issue