mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- Removed specific Button_Speed handling from the controllers' AddAxes()
methods. Analog axes now respond Button_Speed and cl_run in exactly the same way as digital buttons do. - Changed rounding slightly for analog axis -> integer in G_BuildTiccmd(). - Fixed: FXInputController::ProcessThumbstick() was slightly off when it converted to the range [-1.0,+1.0]. SVN r1733 (trunk)
This commit is contained in:
parent
6906e1b0e3
commit
bc3448e958
5 changed files with 28 additions and 32 deletions
|
@ -1,4 +1,10 @@
|
|||
July 22, 2009
|
||||
- Removed specific Button_Speed handling from the controllers' AddAxes()
|
||||
methods. Analog axes now respond Button_Speed and cl_run in exactly the
|
||||
same way as digital buttons do.
|
||||
- Changed rounding slightly for analog axis -> integer in G_BuildTiccmd().
|
||||
- Fixed: FXInputController::ProcessThumbstick() was slightly off when it
|
||||
converted to the range [-1.0,+1.0].
|
||||
- Added default bindings for the Xbox 360 controller buttons.
|
||||
- Fixed: Redefining an existing skill would set that skills ACSReturn to be
|
||||
the same as the next new skill defined, if neither definition explicitly set
|
||||
|
|
|
@ -458,6 +458,18 @@ CCMD (select)
|
|||
who->player->inventorytics = 5*TICRATE;
|
||||
}
|
||||
|
||||
static inline int joyint(double val)
|
||||
{
|
||||
if (val >= 0)
|
||||
{
|
||||
return int(ceil(val));
|
||||
}
|
||||
else
|
||||
{
|
||||
return int(floor(val));
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// G_BuildTiccmd
|
||||
// Builds a ticcmd from all of the available inputs
|
||||
|
@ -605,10 +617,10 @@ void G_BuildTiccmd (ticcmd_t *cmd)
|
|||
LocalKeyboardTurner = true;
|
||||
}
|
||||
|
||||
side -= int(MAXPLMOVE * joyaxes[JOYAXIS_Side]);
|
||||
forward += int(joyaxes[JOYAXIS_Forward] * MAXPLMOVE);
|
||||
fly += int(joyaxes[JOYAXIS_Up] * 2048);
|
||||
|
||||
side -= joyint(sidemove[speed] * joyaxes[JOYAXIS_Side]);
|
||||
forward += joyint(joyaxes[JOYAXIS_Forward] * forwardmove[speed]);
|
||||
fly += joyint(joyaxes[JOYAXIS_Up] * 2048);
|
||||
Printf("%d %d %.9f %.9f\n", forward, side, joyaxes[JOYAXIS_Forward], joyaxes[JOYAXIS_Side]);
|
||||
// Handle mice.
|
||||
if (!Button_Mlook.bDown && !freelook)
|
||||
{
|
||||
|
|
|
@ -458,16 +458,10 @@ void FDInputJoystick::ProcessInput()
|
|||
|
||||
void FDInputJoystick::AddAxes(float axes[NUM_JOYAXIS])
|
||||
{
|
||||
float mul = Multiplier;
|
||||
if (Button_Speed.bDown)
|
||||
{
|
||||
mul *= 0.5f;
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < Axes.Size(); ++i)
|
||||
{
|
||||
// Add to the game axis.
|
||||
axes[Axes[i].GameAxis] -= float(Axes[i].Value * mul * Axes[i].Multiplier);
|
||||
axes[Axes[i].GameAxis] -= float(Axes[i].Value * Multiplier * Axes[i].Multiplier);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -593,18 +593,10 @@ void FRawPS2Controller::NeutralInput()
|
|||
|
||||
void FRawPS2Controller::AddAxes(float axes[NUM_JOYAXIS])
|
||||
{
|
||||
float mul = Multiplier;
|
||||
int i;
|
||||
|
||||
if (Button_Speed.bDown)
|
||||
{
|
||||
mul *= 0.5f;
|
||||
}
|
||||
|
||||
// Add to game axes.
|
||||
for (i = 0; i < NUM_AXES; ++i)
|
||||
for (int i = 0; i < NUM_AXES; ++i)
|
||||
{
|
||||
axes[Axes[i].GameAxis] -= float(Axes[i].Value * mul * Axes[i].Multiplier);
|
||||
axes[Axes[i].GameAxis] -= float(Axes[i].Value * Multiplier * Axes[i].Multiplier);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -267,7 +267,7 @@ void FXInputController::ProcessThumbstick(int value, AxisInfo *axis, int base)
|
|||
BYTE buttonstate;
|
||||
double axisval;
|
||||
|
||||
axisval = (value - SHRT_MIN) * 2.0 / (SHRT_MAX - SHRT_MIN) - 1.0;
|
||||
axisval = (value - SHRT_MIN) * 2.0 / 65536 - 1.0;
|
||||
axisval = Joy_RemoveDeadZone(axisval, axis->DeadZone, &buttonstate);
|
||||
Joy_GenerateButtonEvents(axis->ButtonValue, buttonstate, 2, base);
|
||||
axis->ButtonValue = buttonstate;
|
||||
|
@ -354,18 +354,10 @@ void FXInputController::Detached()
|
|||
|
||||
void FXInputController::AddAxes(float axes[NUM_JOYAXIS])
|
||||
{
|
||||
float mul = Multiplier;
|
||||
int i;
|
||||
|
||||
if (Button_Speed.bDown)
|
||||
{
|
||||
mul *= 0.5f;
|
||||
}
|
||||
|
||||
// Add to game axes.
|
||||
for (i = 0; i < NUM_AXES; ++i)
|
||||
for (int i = 0; i < NUM_AXES; ++i)
|
||||
{
|
||||
axes[Axes[i].GameAxis] -= float(Axes[i].Value * mul * Axes[i].Multiplier);
|
||||
axes[Axes[i].GameAxis] -= float(Axes[i].Value * Multiplier * Axes[i].Multiplier);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue