mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-14 16:40:46 +00:00
- Rename ControlInfo joystick variables to names matching backend.
This commit is contained in:
parent
686bec5664
commit
1f97e73501
4 changed files with 19 additions and 19 deletions
|
@ -119,8 +119,8 @@ void processMovement(InputPacket* const currInput, InputPacket* const inputBuffe
|
||||||
|
|
||||||
// determine player input.
|
// determine player input.
|
||||||
const auto turning = buttonMap.ButtonDown(gamefunc_Turn_Right) - buttonMap.ButtonDown(gamefunc_Turn_Left);
|
const auto turning = buttonMap.ButtonDown(gamefunc_Turn_Right) - buttonMap.ButtonDown(gamefunc_Turn_Left);
|
||||||
const auto moving = buttonMap.ButtonDown(gamefunc_Move_Forward) - buttonMap.ButtonDown(gamefunc_Move_Backward) + hidInput->dz * scaleAdjustf;
|
const auto moving = buttonMap.ButtonDown(gamefunc_Move_Forward) - buttonMap.ButtonDown(gamefunc_Move_Backward) + hidInput->dforward * scaleAdjustf;
|
||||||
const auto strafing = buttonMap.ButtonDown(gamefunc_Strafe_Right) - buttonMap.ButtonDown(gamefunc_Strafe_Left) - hidInput->dx * scaleAdjustf;
|
const auto strafing = buttonMap.ButtonDown(gamefunc_Strafe_Right) - buttonMap.ButtonDown(gamefunc_Strafe_Left) - hidInput->dside * scaleAdjustf;
|
||||||
|
|
||||||
// process player angle input.
|
// process player angle input.
|
||||||
if (!(buttonMap.ButtonDown(gamefunc_Strafe) && allowstrafe))
|
if (!(buttonMap.ButtonDown(gamefunc_Strafe) && allowstrafe))
|
||||||
|
|
|
@ -215,9 +215,9 @@ ControlInfo CONTROL_GetInput()
|
||||||
I_GetAxes(joyaxes);
|
I_GetAxes(joyaxes);
|
||||||
|
|
||||||
hidInput.dyaw += -joyaxes[JOYAXIS_Yaw];
|
hidInput.dyaw += -joyaxes[JOYAXIS_Yaw];
|
||||||
hidInput.dx += joyaxes[JOYAXIS_Side] * .5f;
|
|
||||||
hidInput.dz += joyaxes[JOYAXIS_Forward] * .5f;
|
|
||||||
hidInput.dpitch += -joyaxes[JOYAXIS_Pitch];
|
hidInput.dpitch += -joyaxes[JOYAXIS_Pitch];
|
||||||
|
hidInput.dforward += joyaxes[JOYAXIS_Forward] * .5f;
|
||||||
|
hidInput.dside += joyaxes[JOYAXIS_Side] * .5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hidInput;
|
return hidInput;
|
||||||
|
@ -405,18 +405,18 @@ void ApplyGlobalInput(InputPacket& input, ControlInfo* hidInput, bool const crou
|
||||||
if (hidInput && buttonMap.ButtonDown(gamefunc_Dpad_Select))
|
if (hidInput && buttonMap.ButtonDown(gamefunc_Dpad_Select))
|
||||||
{
|
{
|
||||||
// These buttons should not autorepeat. The game handlers are not really equipped for that.
|
// These buttons should not autorepeat. The game handlers are not really equipped for that.
|
||||||
if (hidInput->dz > 0 && !(dpad_lock & 1)) { dpad_lock |= 1; input.setNewWeapon(WeaponSel_Prev); }
|
if (hidInput->dforward > 0 && !(dpad_lock & 1)) { dpad_lock |= 1; input.setNewWeapon(WeaponSel_Prev); }
|
||||||
else dpad_lock &= ~1;
|
else dpad_lock &= ~1;
|
||||||
if (hidInput->dz < 0 && !(dpad_lock & 2)) { dpad_lock |= 2; input.setNewWeapon(WeaponSel_Next); }
|
if (hidInput->dforward < 0 && !(dpad_lock & 2)) { dpad_lock |= 2; input.setNewWeapon(WeaponSel_Next); }
|
||||||
else dpad_lock &= ~2;
|
else dpad_lock &= ~2;
|
||||||
if ((hidInput->dx < 0 || hidInput->dyaw < 0) && !(dpad_lock & 4)) { dpad_lock |= 4; input.actions |= SB_INVPREV; }
|
if ((hidInput->dside < 0 || hidInput->dyaw < 0) && !(dpad_lock & 4)) { dpad_lock |= 4; input.actions |= SB_INVPREV; }
|
||||||
else dpad_lock &= ~4;
|
else dpad_lock &= ~4;
|
||||||
if ((hidInput->dx > 0 || hidInput->dyaw > 0) && !(dpad_lock & 8)) { dpad_lock |= 8; input.actions |= SB_INVNEXT; }
|
if ((hidInput->dside > 0 || hidInput->dyaw > 0) && !(dpad_lock & 8)) { dpad_lock |= 8; input.actions |= SB_INVNEXT; }
|
||||||
else dpad_lock &= ~8;
|
else dpad_lock &= ~8;
|
||||||
|
|
||||||
// This eats the controller input for regular use
|
// This eats the controller input for regular use
|
||||||
hidInput->dx = 0;
|
hidInput->dside = 0;
|
||||||
hidInput->dz = 0;
|
hidInput->dforward = 0;
|
||||||
hidInput->dyaw = 0;
|
hidInput->dyaw = 0;
|
||||||
}
|
}
|
||||||
else dpad_lock = 0;
|
else dpad_lock = 0;
|
||||||
|
@ -424,14 +424,14 @@ void ApplyGlobalInput(InputPacket& input, ControlInfo* hidInput, bool const crou
|
||||||
input.actions |= ActionsToSend;
|
input.actions |= ActionsToSend;
|
||||||
ActionsToSend = 0;
|
ActionsToSend = 0;
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Aim_Up) || (buttonMap.ButtonDown(gamefunc_Dpad_Aiming) && hidInput->dz > 0))
|
if (buttonMap.ButtonDown(gamefunc_Aim_Up) || (buttonMap.ButtonDown(gamefunc_Dpad_Aiming) && hidInput->dforward > 0))
|
||||||
input.actions |= SB_AIM_UP;
|
input.actions |= SB_AIM_UP;
|
||||||
|
|
||||||
if ((buttonMap.ButtonDown(gamefunc_Aim_Down) || (buttonMap.ButtonDown(gamefunc_Dpad_Aiming) && hidInput->dz < 0)))
|
if ((buttonMap.ButtonDown(gamefunc_Aim_Down) || (buttonMap.ButtonDown(gamefunc_Dpad_Aiming) && hidInput->dforward < 0)))
|
||||||
input.actions |= SB_AIM_DOWN;
|
input.actions |= SB_AIM_DOWN;
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Dpad_Aiming))
|
if (buttonMap.ButtonDown(gamefunc_Dpad_Aiming))
|
||||||
hidInput->dz = 0;
|
hidInput->dforward = 0;
|
||||||
|
|
||||||
if (buttonMap.ButtonDown(gamefunc_Jump))
|
if (buttonMap.ButtonDown(gamefunc_Jump))
|
||||||
input.actions |= SB_JUMP;
|
input.actions |= SB_JUMP;
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
|
|
||||||
struct ControlInfo
|
struct ControlInfo
|
||||||
{
|
{
|
||||||
float dx;
|
float dside;
|
||||||
float dy;
|
float dup;
|
||||||
float dz;
|
float dforward;
|
||||||
float dyaw;
|
float dyaw;
|
||||||
float dpitch;
|
float dpitch;
|
||||||
float droll;
|
float droll;
|
||||||
|
|
|
@ -582,7 +582,7 @@ static float motoApplyTurn(player_struct* p, ControlInfo* const hidInput, bool c
|
||||||
if (kbdLeft || kbdRight || p->moto_drink || hidInput->mouseturnx || hidInput->dyaw)
|
if (kbdLeft || kbdRight || p->moto_drink || hidInput->mouseturnx || hidInput->dyaw)
|
||||||
{
|
{
|
||||||
constexpr float velScale = (3.f / 10.f);
|
constexpr float velScale = (3.f / 10.f);
|
||||||
const float baseVel = (buttonMap.ButtonDown(gamefunc_Move_Backward) || hidInput->dz < 0) && p->MotoSpeed <= 0 ? -VEHICLETURN : VEHICLETURN;
|
const float baseVel = (buttonMap.ButtonDown(gamefunc_Move_Backward) || hidInput->dforward < 0) && p->MotoSpeed <= 0 ? -VEHICLETURN : VEHICLETURN;
|
||||||
|
|
||||||
if (kbdLeft || p->moto_drink < 0 || hidInput->mouseturnx < 0 || hidInput->dyaw < 0)
|
if (kbdLeft || p->moto_drink < 0 || hidInput->mouseturnx < 0 || hidInput->dyaw < 0)
|
||||||
{
|
{
|
||||||
|
@ -744,8 +744,8 @@ static void processVehicleInput(player_struct *p, ControlInfo* const hidInput, I
|
||||||
|
|
||||||
if (p->OnBoat || !p->moto_underwater)
|
if (p->OnBoat || !p->moto_underwater)
|
||||||
{
|
{
|
||||||
p->vehForwardScale = min((buttonMap.ButtonDown(gamefunc_Move_Forward) || buttonMap.ButtonDown(gamefunc_Strafe)) + hidInput->dz, 1.f);
|
p->vehForwardScale = min((buttonMap.ButtonDown(gamefunc_Move_Forward) || buttonMap.ButtonDown(gamefunc_Strafe)) + hidInput->dforward, 1.f);
|
||||||
p->vehReverseScale = min(buttonMap.ButtonDown(gamefunc_Move_Backward) + -hidInput->dz, 1.f);
|
p->vehReverseScale = min(buttonMap.ButtonDown(gamefunc_Move_Backward) + -hidInput->dforward, 1.f);
|
||||||
p->vehBraking = buttonMap.ButtonDown(gamefunc_Run);
|
p->vehBraking = buttonMap.ButtonDown(gamefunc_Run);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue