Replace implementation of crouch toggle in a way that won't interfere with other uses of the crouch key, such as swimming and jetpacking.

TODO: Make this work over the network.

git-svn-id: https://svn.eduke32.com/eduke32@7991 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2019-08-14 03:49:45 +00:00 committed by Christoph Oelckers
parent 9a1a3f01e8
commit 73fb1d467f
3 changed files with 7 additions and 7 deletions

View file

@ -3554,7 +3554,7 @@ ACTOR_STATIC void G_MoveTransports(void)
if (onFloor == 0 && klabs(SZ(spriteNum) - pPlayer->pos.z) < 6144) if (onFloor == 0 && klabs(SZ(spriteNum) - pPlayer->pos.z) < 6144)
if (!pPlayer->jetpack_on || TEST_SYNC_KEY(g_player[playerNum].input->bits, SK_JUMP) if (!pPlayer->jetpack_on || TEST_SYNC_KEY(g_player[playerNum].input->bits, SK_JUMP)
|| TEST_SYNC_KEY(g_player[playerNum].input->bits, SK_CROUCH)) || (TEST_SYNC_KEY(g_player[playerNum].input->bits, SK_CROUCH) ^ pPlayer->crouch_toggle))
{ {
pPlayer->pos.x += sprite[OW(spriteNum)].x - SX(spriteNum); pPlayer->pos.x += sprite[OW(spriteNum)].x - SX(spriteNum);
pPlayer->pos.y += sprite[OW(spriteNum)].y - SY(spriteNum); pPlayer->pos.y += sprite[OW(spriteNum)].y - SY(spriteNum);

View file

@ -4904,7 +4904,7 @@ badindex:
int const playerXVel = sprite[vm.pPlayer->i].xvel; int const playerXVel = sprite[vm.pPlayer->i].xvel;
int const syncBits = g_player[vm.playerNum].input->bits; int const syncBits = g_player[vm.playerNum].input->bits;
if (((moveFlags & pducking) && vm.pPlayer->on_ground && TEST_SYNC_KEY(syncBits, SK_CROUCH)) if (((moveFlags & pducking) && vm.pPlayer->on_ground && (TEST_SYNC_KEY(syncBits, SK_CROUCH) ^ vm.pPlayer->crouch_toggle))
|| ((moveFlags & pfalling) && vm.pPlayer->jumping_counter == 0 && !vm.pPlayer->on_ground && vm.pPlayer->vel.z > 2048) || ((moveFlags & pfalling) && vm.pPlayer->jumping_counter == 0 && !vm.pPlayer->on_ground && vm.pPlayer->vel.z > 2048)
|| ((moveFlags & pjumping) && vm.pPlayer->jumping_counter > 348) || ((moveFlags & pjumping) && vm.pPlayer->jumping_counter > 348)
|| ((moveFlags & pstanding) && playerXVel >= 0 && playerXVel < 8) || ((moveFlags & pstanding) && playerXVel >= 0 && playerXVel < 8)

View file

@ -3051,7 +3051,7 @@ void P_GetInput(int const playerNum)
localInput.bits |= (BUTTON(gamefunc_Open) << SK_OPEN); localInput.bits |= (BUTTON(gamefunc_Open) << SK_OPEN);
localInput.bits |= (BUTTON(gamefunc_Jump) << SK_JUMP) | ((BUTTON(gamefunc_Crouch)|pPlayer->crouch_toggle) << SK_CROUCH); localInput.bits |= (BUTTON(gamefunc_Jump) << SK_JUMP) | (BUTTON(gamefunc_Crouch) << 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;
@ -4100,7 +4100,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)) if (pPlayer->on_ground && (TEST_SYNC_KEY(playerBits, SK_CROUCH) ^ pPlayer->crouch_toggle))
{ {
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);
@ -5042,7 +5042,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->on_ground && if ((!TEST_SYNC_KEY(playerBits, SK_JUMP) && !(TEST_SYNC_KEY(playerBits, SK_CROUCH) ^ pPlayer->crouch_toggle)) && 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
@ -5138,7 +5138,7 @@ void P_ProcessInput(int playerNum)
} }
} }
if (TEST_SYNC_KEY(playerBits, SK_CROUCH)) if (TEST_SYNC_KEY(playerBits, SK_CROUCH) ^ pPlayer->crouch_toggle)
{ {
// crouching // crouching
if (VM_OnEvent(EVENT_CROUCH,pPlayer->i,playerNum) == 0) if (VM_OnEvent(EVENT_CROUCH,pPlayer->i,playerNum) == 0)
@ -5340,7 +5340,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))) else if (((pPlayer->on_ground && (TEST_SYNC_KEY(playerBits, SK_CROUCH) ^ pPlayer->crouch_toggle))
|| (*weaponFrame > 10 && PWEAPON(playerNum, pPlayer->curr_weapon, WorksLike) == KNEE_WEAPON))) || (*weaponFrame > 10 && PWEAPON(playerNum, pPlayer->curr_weapon, WorksLike) == KNEE_WEAPON)))
playerSpeedReduction = 0x2000; playerSpeedReduction = 0x2000;