- 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:
Randy Heit 2009-07-23 05:37:03 +00:00
parent 6906e1b0e3
commit bc3448e958
5 changed files with 28 additions and 32 deletions

View file

@ -1,4 +1,10 @@
July 22, 2009 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. - Added default bindings for the Xbox 360 controller buttons.
- Fixed: Redefining an existing skill would set that skills ACSReturn to be - 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 the same as the next new skill defined, if neither definition explicitly set

View file

@ -458,6 +458,18 @@ CCMD (select)
who->player->inventorytics = 5*TICRATE; 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 // G_BuildTiccmd
// Builds a ticcmd from all of the available inputs // Builds a ticcmd from all of the available inputs
@ -605,10 +617,10 @@ void G_BuildTiccmd (ticcmd_t *cmd)
LocalKeyboardTurner = true; LocalKeyboardTurner = true;
} }
side -= int(MAXPLMOVE * joyaxes[JOYAXIS_Side]); side -= joyint(sidemove[speed] * joyaxes[JOYAXIS_Side]);
forward += int(joyaxes[JOYAXIS_Forward] * MAXPLMOVE); forward += joyint(joyaxes[JOYAXIS_Forward] * forwardmove[speed]);
fly += int(joyaxes[JOYAXIS_Up] * 2048); fly += joyint(joyaxes[JOYAXIS_Up] * 2048);
Printf("%d %d %.9f %.9f\n", forward, side, joyaxes[JOYAXIS_Forward], joyaxes[JOYAXIS_Side]);
// Handle mice. // Handle mice.
if (!Button_Mlook.bDown && !freelook) if (!Button_Mlook.bDown && !freelook)
{ {

View file

@ -458,16 +458,10 @@ void FDInputJoystick::ProcessInput()
void FDInputJoystick::AddAxes(float axes[NUM_JOYAXIS]) 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) for (unsigned i = 0; i < Axes.Size(); ++i)
{ {
// Add to the game axis. // 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);
} }
} }

View file

@ -593,18 +593,10 @@ void FRawPS2Controller::NeutralInput()
void FRawPS2Controller::AddAxes(float axes[NUM_JOYAXIS]) void FRawPS2Controller::AddAxes(float axes[NUM_JOYAXIS])
{ {
float mul = Multiplier;
int i;
if (Button_Speed.bDown)
{
mul *= 0.5f;
}
// Add to game axes. // 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);
} }
} }

View file

@ -267,7 +267,7 @@ void FXInputController::ProcessThumbstick(int value, AxisInfo *axis, int base)
BYTE buttonstate; BYTE buttonstate;
double axisval; 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); axisval = Joy_RemoveDeadZone(axisval, axis->DeadZone, &buttonstate);
Joy_GenerateButtonEvents(axis->ButtonValue, buttonstate, 2, base); Joy_GenerateButtonEvents(axis->ButtonValue, buttonstate, 2, base);
axis->ButtonValue = buttonstate; axis->ButtonValue = buttonstate;
@ -354,18 +354,10 @@ void FXInputController::Detached()
void FXInputController::AddAxes(float axes[NUM_JOYAXIS]) void FXInputController::AddAxes(float axes[NUM_JOYAXIS])
{ {
float mul = Multiplier;
int i;
if (Button_Speed.bDown)
{
mul *= 0.5f;
}
// Add to game axes. // 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);
} }
} }