mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +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);
|
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))
|
if (BUTTON(gamefunc_Map))
|
||||||
{
|
{
|
||||||
CONTROL_ClearButton(gamefunc_Map);
|
CONTROL_ClearButton(gamefunc_Map);
|
||||||
|
|
|
@ -3033,7 +3033,6 @@ void P_GetInput(int const playerNum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (BUTTON(gamefunc_Last_Weapon))
|
if (BUTTON(gamefunc_Last_Weapon))
|
||||||
weaponSelection = 14;
|
weaponSelection = 14;
|
||||||
else if (BUTTON(gamefunc_Alt_Weapon))
|
else if (BUTTON(gamefunc_Alt_Weapon))
|
||||||
|
@ -3046,10 +3045,25 @@ void P_GetInput(int const playerNum)
|
||||||
weaponSelection = 0;
|
weaponSelection = 0;
|
||||||
|
|
||||||
localInput.bits = (weaponSelection << SK_WEAPON_BITS) | (BUTTON(gamefunc_Fire) << SK_FIRE);
|
localInput.bits = (weaponSelection << SK_WEAPON_BITS) | (BUTTON(gamefunc_Fire) << SK_FIRE);
|
||||||
|
|
||||||
localInput.bits |= (BUTTON(gamefunc_Open) << SK_OPEN);
|
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_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;
|
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 pipeBombZvel;
|
||||||
int pipeBombFwdVel;
|
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;
|
pipeBombFwdVel = 15;
|
||||||
pipeBombZvel = (fix16_to_int(pPlayer->q16horiz + pPlayer->q16horizoff - F16(100)) * 20);
|
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
|
if (pPlayer->pos.z < (floorZ-(floorZOffset<<8))) //falling
|
||||||
{
|
{
|
||||||
// not jumping or crouching
|
// 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))
|
(sector[pPlayer->cursectnum].floorstat & 2) && pPlayer->pos.z >= (floorZ - (floorZOffset << 8) - ZOFFSET2))
|
||||||
pPlayer->pos.z = floorZ - (floorZOffset << 8);
|
pPlayer->pos.z = floorZ - (floorZOffset << 8);
|
||||||
else
|
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
|
// crouching
|
||||||
if (VM_OnEvent(EVENT_CROUCH,pPlayer->i,playerNum) == 0)
|
if (VM_OnEvent(EVENT_CROUCH,pPlayer->i,playerNum) == 0)
|
||||||
|
@ -5339,7 +5353,7 @@ void P_ProcessInput(int playerNum)
|
||||||
|
|
||||||
if (sectorLotag == ST_2_UNDERWATER)
|
if (sectorLotag == ST_2_UNDERWATER)
|
||||||
playerSpeedReduction = 0x1400;
|
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)))
|
|| (*weaponFrame > 10 && PWEAPON(playerNum, pPlayer->curr_weapon, WorksLike) == KNEE_WEAPON)))
|
||||||
playerSpeedReduction = 0x2000;
|
playerSpeedReduction = 0x2000;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue