mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
- SW: Migrate crouch toggling to backend solution implemented in 4ef0d20e0e
.
This commit is contained in:
parent
01c494e29d
commit
a153ebab7e
4 changed files with 11 additions and 69 deletions
|
@ -24,8 +24,7 @@ enum ESyncBits_ : uint32_t
|
||||||
SB_OPEN = 1 << 17,
|
SB_OPEN = 1 << 17,
|
||||||
|
|
||||||
SB_AIMMODE = 1 << 18,
|
SB_AIMMODE = 1 << 18,
|
||||||
SB_QUICK_KICK = 1 << 19, // Duke only.
|
SB_QUICK_KICK = 1 << 19,
|
||||||
SB_CROUCH_LOCK = 1 << 19, // SW only.
|
|
||||||
SB_ESCAPE = 1 << 20,
|
SB_ESCAPE = 1 << 20,
|
||||||
|
|
||||||
SB_AIM_UP = 1 << 21,
|
SB_AIM_UP = 1 << 21,
|
||||||
|
|
|
@ -1004,6 +1004,7 @@ struct PLAYERstruct
|
||||||
int cookieTime;
|
int cookieTime;
|
||||||
|
|
||||||
char WpnReloadState;
|
char WpnReloadState;
|
||||||
|
bool crouch_toggle;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern PLAYER Player[MAX_SW_PLAYERS_REG+1];
|
extern PLAYER Player[MAX_SW_PLAYERS_REG+1];
|
||||||
|
|
|
@ -99,11 +99,8 @@ static void processInputBits(PLAYERp const pp, ControlInfo* const hidInput)
|
||||||
RESET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
RESET(Player[myconnectindex].Flags, PF_AUTO_AIM);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Toggle_Crouch))
|
// Handle crouch toggling.
|
||||||
{
|
checkCrouchToggle(&loc, &pp->crouch_toggle);
|
||||||
// this shares a bit with another function so cannot be in the common code.
|
|
||||||
loc.actions |= SB_CROUCH_LOCK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
|
@ -1521,7 +1521,7 @@ UpdatePlayerSpriteAngle(PLAYERp pp)
|
||||||
void
|
void
|
||||||
DoPlayerTurn(PLAYERp pp, float const avel, double const scaleAdjust)
|
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);
|
UpdatePlayerSpriteAngle(pp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3788,53 +3788,14 @@ DoPlayerCrawl(PLAYERp pp)
|
||||||
//#define PLAYER_STANDING_ROOM(pp) ((pp)->posz + PLAYER_CRAWL_HEIGHT - PLAYER_HEIGHT - PLAYER_RUN_CEILING_DIST)
|
//#define PLAYER_STANDING_ROOM(pp) ((pp)->posz + PLAYER_CRAWL_HEIGHT - PLAYER_HEIGHT - PLAYER_RUN_CEILING_DIST)
|
||||||
#define PLAYER_STANDING_ROOM Z(68)
|
#define PLAYER_STANDING_ROOM Z(68)
|
||||||
|
|
||||||
if (TEST(pp->Flags, PF_LOCK_CRAWL))
|
// Let off of crawl to get up
|
||||||
|
if (!(pp->input.actions & SB_CROUCH))
|
||||||
{
|
{
|
||||||
if (pp->input.actions & SB_CROUCH_LOCK)
|
if (labs(pp->loz - pp->hiz) >= PLAYER_STANDING_ROOM)
|
||||||
{
|
{
|
||||||
if (pp->KeyPressBits & SB_CROUCH_LOCK)
|
RESET(pp->Flags, PF_CRAWLING);
|
||||||
{
|
DoPlayerBeginRun(pp);
|
||||||
//if (pp->hiz < PLAYER_STANDING_ROOM(pp))
|
return;
|
||||||
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))
|
|
||||||
{
|
|
||||||
if (labs(pp->loz - pp->hiz) >= PLAYER_STANDING_ROOM)
|
|
||||||
{
|
|
||||||
RESET(pp->Flags, PF_CRAWLING);
|
|
||||||
DoPlayerBeginRun(pp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6785,22 +6746,6 @@ DoPlayerRun(PLAYERp pp)
|
||||||
pp->KeyPressBits |= SB_JUMP;
|
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())
|
if (PlayerFlyKey())
|
||||||
{
|
{
|
||||||
DoPlayerBeginFly(pp);
|
DoPlayerBeginFly(pp);
|
||||||
|
|
Loading…
Reference in a new issue