- Blood: Add crouch toggle mechanism.

* Fixes #151.
This commit is contained in:
Mitchell Richters 2020-11-07 13:23:16 +11:00
parent a52ee89969
commit 7c8efde38c
3 changed files with 18 additions and 3 deletions

View file

@ -42,16 +42,30 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput)
return; return;
} }
PLAYER* pPlayer = &gPlayer[myconnectindex];
double const scaleAdjust = InputScale(); double const scaleAdjust = InputScale();
InputPacket input {}; InputPacket input {};
ApplyGlobalInput(gInput, hidInput); ApplyGlobalInput(gInput, hidInput);
processMovement(&input, &gInput, hidInput, scaleAdjust); processMovement(&input, &gInput, hidInput, scaleAdjust);
// Handle crouch toggling.
if (buttonMap.ButtonDown(gamefunc_Toggle_Crouch) || pPlayer->crouch_toggle)
{
gInput.actions |= SB_CROUCH;
}
if (buttonMap.ButtonDown(gamefunc_Toggle_Crouch))
{
pPlayer->crouch_toggle = !pPlayer->crouch_toggle;
buttonMap.ClearButton(gamefunc_Toggle_Crouch);
}
if (buttonMap.ButtonDown(gamefunc_Crouch) || buttonMap.ButtonDown(gamefunc_Jump))
{
pPlayer->crouch_toggle = false;
}
if (!cl_syncinput && gamestate == GS_LEVEL) if (!cl_syncinput && gamestate == GS_LEVEL)
{ {
PLAYER* pPlayer = &gPlayer[myconnectindex];
// Perform unsynchronised angle/horizon if not dead. // Perform unsynchronised angle/horizon if not dead.
if (gView->pXSprite->health != 0) if (gView->pXSprite->health != 0)
{ {

View file

@ -183,6 +183,7 @@ struct PLAYER
int player_par; int player_par;
int nWaterPal; int nWaterPal;
POSTURE pPosture[kModeMax][kPostureMax]; POSTURE pPosture[kModeMax][kPostureMax];
bool crouch_toggle;
}; };
struct PROFILE struct PROFILE

View file

@ -514,7 +514,7 @@ OptionMenu "ActionControlsMenu" protected
StaticText "" StaticText ""
Control "$CNTRLMNU_JUMP" , "+jump" Control "$CNTRLMNU_JUMP" , "+jump"
Control "$CNTRLMNU_CROUCH" , "+crouch" Control "$CNTRLMNU_CROUCH" , "+crouch"
ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides) ifgame(Duke, Nam, WW2GI, Redneck, RedneckRides, Blood)
{ {
// Fixme: Make this work in all games // Fixme: Make this work in all games
Control "$CNTRLMNU_TOGGLECROUCH" , "+toggle_crouch" Control "$CNTRLMNU_TOGGLECROUCH" , "+toggle_crouch"