- SW: Migrate crouch toggling to backend solution implemented in 4ef0d20e0e.

This commit is contained in:
Mitchell Richters 2020-11-07 17:53:11 +11:00
parent 01c494e29d
commit a153ebab7e
4 changed files with 11 additions and 69 deletions

View File

@ -24,8 +24,7 @@ enum ESyncBits_ : uint32_t
SB_OPEN = 1 << 17,
SB_AIMMODE = 1 << 18,
SB_QUICK_KICK = 1 << 19, // Duke only.
SB_CROUCH_LOCK = 1 << 19, // SW only.
SB_QUICK_KICK = 1 << 19,
SB_ESCAPE = 1 << 20,
SB_AIM_UP = 1 << 21,

View File

@ -1004,6 +1004,7 @@ struct PLAYERstruct
int cookieTime;
char WpnReloadState;
bool crouch_toggle;
};
extern PLAYER Player[MAX_SW_PLAYERS_REG+1];

View File

@ -99,11 +99,8 @@ static void processInputBits(PLAYERp const pp, ControlInfo* const hidInput)
RESET(Player[myconnectindex].Flags, PF_AUTO_AIM);
}
if (buttonMap.ButtonDown(gamefunc_Toggle_Crouch))
{
// this shares a bit with another function so cannot be in the common code.
loc.actions |= SB_CROUCH_LOCK;
}
// Handle crouch toggling.
checkCrouchToggle(&loc, &pp->crouch_toggle);
}
//---------------------------------------------------------------------------

View File

@ -1521,7 +1521,7 @@ UpdatePlayerSpriteAngle(PLAYERp pp)
void
DoPlayerTurn(PLAYERp pp, float const avel, double const scaleAdjust)
{
applylook(&pp->angle, avel, &pp->input.actions, scaleAdjust, pp->input.actions & (SB_CROUCH|SB_CROUCH_LOCK));
applylook(&pp->angle, avel, &pp->input.actions, scaleAdjust, pp->input.actions & SB_CROUCH || pp->crouch_toggle);
UpdatePlayerSpriteAngle(pp);
}
@ -3788,44 +3788,6 @@ DoPlayerCrawl(PLAYERp pp)
//#define PLAYER_STANDING_ROOM(pp) ((pp)->posz + PLAYER_CRAWL_HEIGHT - PLAYER_HEIGHT - PLAYER_RUN_CEILING_DIST)
#define PLAYER_STANDING_ROOM Z(68)
if (TEST(pp->Flags, PF_LOCK_CRAWL))
{
if (pp->input.actions & SB_CROUCH_LOCK)
{
if (pp->KeyPressBits & SB_CROUCH_LOCK)
{
//if (pp->hiz < PLAYER_STANDING_ROOM(pp))
if (labs(pp->loz - pp->hiz) >= PLAYER_STANDING_ROOM)
{
pp->KeyPressBits&= ~SB_CROUCH_LOCK;
RESET(pp->Flags, PF_CRAWLING);
DoPlayerBeginRun(pp);
return;
}
}
}
else
{
pp->KeyPressBits |= SB_CROUCH_LOCK;
}
// Jump to get up
if (pp->input.actions & SB_JUMP)
{
if (labs(pp->loz - pp->hiz) >= PLAYER_STANDING_ROOM)
{
//pp->posz = pp->loz - PLAYER_HEIGHT;
RESET(pp->Flags, PF_CRAWLING);
DoPlayerBeginRun(pp);
return;
}
}
}
else
{
// Let off of crawl to get up
if (!(pp->input.actions & SB_CROUCH))
{
@ -3836,7 +3798,6 @@ DoPlayerCrawl(PLAYERp pp)
return;
}
}
}
if (pp->lo_sectp && TEST(pp->lo_sectp->extra, SECTFX_CURRENT))
{
@ -6785,22 +6746,6 @@ DoPlayerRun(PLAYERp pp)
pp->KeyPressBits |= SB_JUMP;
}
// Crawl lock
if (pp->input.actions & SB_CROUCH_LOCK)
{
if (pp->KeyPressBits & SB_CROUCH_LOCK)
{
pp->KeyPressBits &= ~SB_CROUCH_LOCK;
SET(pp->Flags, PF_LOCK_CRAWL);
DoPlayerBeginCrawl(pp);
return;
}
}
else
{
pp->KeyPressBits |= SB_CROUCH_LOCK;
}
if (PlayerFlyKey())
{
DoPlayerBeginFly(pp);