mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-25 02:52:06 +00:00
Do a whitespace run.
Just for long-term sanity's sake.
This commit is contained in:
parent
e3e0d6aaa9
commit
1a33d2f682
2 changed files with 179 additions and 164 deletions
|
@ -140,10 +140,13 @@ JOY_Move (void)
|
||||||
|
|
||||||
for (i = 0; i < JOY_MAX_AXES; i++) {
|
for (i = 0; i < JOY_MAX_AXES; i++) {
|
||||||
ja = &joy_axes[i];
|
ja = &joy_axes[i];
|
||||||
if (abs(ja->offset) + abs(ja->current) < abs(ja->offset) + abs(ja->deadzone))
|
if (abs (ja->offset) + abs (ja->current) <
|
||||||
|
abs (ja->offset) + abs (ja->deadzone))
|
||||||
ja->current = -ja->offset;
|
ja->current = -ja->offset;
|
||||||
|
|
||||||
value = amp * ja->amp * (ja->offset + ja->current * pre * ja->pre_amp) / 100.0f;
|
value =
|
||||||
|
amp * ja->amp * (ja->offset +
|
||||||
|
ja->current * pre * ja->pre_amp) / 100.0f;
|
||||||
switch (ja->dest) {
|
switch (ja->dest) {
|
||||||
case js_none:
|
case js_none:
|
||||||
// ignore axis
|
// ignore axis
|
||||||
|
@ -231,6 +234,7 @@ const char *
|
||||||
JOY_GetOption_c (int i)
|
JOY_GetOption_c (int i)
|
||||||
{
|
{
|
||||||
js_opts_t *opt;
|
js_opts_t *opt;
|
||||||
|
|
||||||
for (opt = &js_opts[0]; opt->name; opt++) {
|
for (opt = &js_opts[0]; opt->name; opt++) {
|
||||||
if ((int) opt->optnum == i)
|
if ((int) opt->optnum == i)
|
||||||
return opt->name;
|
return opt->name;
|
||||||
|
@ -243,6 +247,7 @@ int
|
||||||
JOY_GetOption_i (const char *c)
|
JOY_GetOption_i (const char *c)
|
||||||
{
|
{
|
||||||
js_opts_t *opt;
|
js_opts_t *opt;
|
||||||
|
|
||||||
for (opt = &js_opts[0]; opt->name; opt++) {
|
for (opt = &js_opts[0]; opt->name; opt++) {
|
||||||
if (!strcmp (opt->name, c))
|
if (!strcmp (opt->name, c))
|
||||||
return opt->optnum;
|
return opt->optnum;
|
||||||
|
@ -255,6 +260,7 @@ const char *
|
||||||
JOY_GetDest_c (int i)
|
JOY_GetDest_c (int i)
|
||||||
{
|
{
|
||||||
js_dests_t *dest;
|
js_dests_t *dest;
|
||||||
|
|
||||||
for (dest = &js_dests[0]; dest->name; dest++) {
|
for (dest = &js_dests[0]; dest->name; dest++) {
|
||||||
if ((int) dest->destnum == i)
|
if ((int) dest->destnum == i)
|
||||||
return dest->name;
|
return dest->name;
|
||||||
|
@ -267,6 +273,7 @@ int
|
||||||
JOY_GetDest_i (const char *c)
|
JOY_GetDest_i (const char *c)
|
||||||
{
|
{
|
||||||
js_dests_t *dest;
|
js_dests_t *dest;
|
||||||
|
|
||||||
for (dest = &js_dests[0]; dest->name; dest++) {
|
for (dest = &js_dests[0]; dest->name; dest++) {
|
||||||
if (!strcmp (dest->name, c))
|
if (!strcmp (dest->name, c))
|
||||||
return dest->destnum;
|
return dest->destnum;
|
||||||
|
@ -278,6 +285,7 @@ JOY_GetDest_i (const char *c)
|
||||||
static void
|
static void
|
||||||
in_joy_f (void)
|
in_joy_f (void)
|
||||||
{
|
{
|
||||||
|
const char *arg;
|
||||||
int i, ax, c = Cmd_Argc ();
|
int i, ax, c = Cmd_Argc ();
|
||||||
|
|
||||||
if (c == 2) {
|
if (c == 2) {
|
||||||
|
@ -320,30 +328,29 @@ in_joy_f (void)
|
||||||
Sys_Printf ("pre_amp: %f\n", joy_axes[ax].pre_amp);
|
Sys_Printf ("pre_amp: %f\n", joy_axes[ax].pre_amp);
|
||||||
Sys_Printf ("deadzone: %i\n", joy_axes[ax].deadzone);
|
Sys_Printf ("deadzone: %i\n", joy_axes[ax].deadzone);
|
||||||
Sys_Printf ("offset: %f\n", joy_axes[ax].offset);
|
Sys_Printf ("offset: %f\n", joy_axes[ax].offset);
|
||||||
Sys_Printf ("type: %s\n", JOY_GetDest_c(joy_axes[ax].dest));
|
Sys_Printf ("type: %s\n",
|
||||||
|
JOY_GetDest_c (joy_axes[ax].dest));
|
||||||
Sys_Printf ("<====================>\n");
|
Sys_Printf ("<====================>\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
} else if (c < 4) {
|
||||||
else if (c < 4) {
|
|
||||||
if (JOY_GetOption_i (Cmd_Argv (2)) == js_clear) {
|
if (JOY_GetOption_i (Cmd_Argv (2)) == js_clear) {
|
||||||
ax = strtol (Cmd_Argv (1), NULL, 0);
|
ax = strtol (Cmd_Argv (1), NULL, 0);
|
||||||
|
|
||||||
joy_clear_axis (ax);
|
joy_clear_axis (ax);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
Sys_Printf ("in_joy <axis#> [<var> <value>]* : Configures the joystick behaviour\n");
|
Sys_Printf ("in_joy <axis#> [<var> <value>]*\n"
|
||||||
|
" Configures the joystick behaviour\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ax = strtol (Cmd_Argv (1), NULL, 0);
|
ax = strtol (Cmd_Argv (1), NULL, 0);
|
||||||
|
|
||||||
const char *arg;
|
|
||||||
i = 2;
|
i = 2;
|
||||||
while(i<c)
|
while (i < c) {
|
||||||
{
|
|
||||||
int var = JOY_GetOption_i (Cmd_Argv (i++));
|
int var = JOY_GetOption_i (Cmd_Argv (i++));
|
||||||
|
|
||||||
switch (var) {
|
switch (var) {
|
||||||
|
@ -371,11 +378,15 @@ in_joy_f (void)
|
||||||
arg = Cmd_Argv (i++);
|
arg = Cmd_Argv (i++);
|
||||||
if (!strcmp ("add", arg)) {
|
if (!strcmp ("add", arg)) {
|
||||||
int n = joy_axes[ax].num_buttons++;
|
int n = joy_axes[ax].num_buttons++;
|
||||||
joy_axes[ax].axis_buttons = realloc(joy_axes[ax].axis_buttons,
|
|
||||||
/*sizeof*/ n*sizeof(joy_axes[ax].axis_buttons));
|
|
||||||
|
|
||||||
joy_axes[ax].axis_buttons[n].key = strtol (Cmd_Argv(i++), NULL, 10) + QFJ_AXIS1;
|
joy_axes[ax].axis_buttons =
|
||||||
joy_axes[ax].axis_buttons[n].threshold = strtof(Cmd_Argv(i++), NULL);
|
realloc (joy_axes[ax].axis_buttons,
|
||||||
|
n * sizeof (joy_axes[ax].axis_buttons));
|
||||||
|
|
||||||
|
joy_axes[ax].axis_buttons[n].key =
|
||||||
|
strtol (Cmd_Argv (i++), NULL, 10) + QFJ_AXIS1;
|
||||||
|
joy_axes[ax].axis_buttons[n].threshold =
|
||||||
|
strtof (Cmd_Argv (i++), NULL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -388,8 +399,10 @@ in_joy_f (void)
|
||||||
VISIBLE void
|
VISIBLE void
|
||||||
JOY_Init_Cvars (void)
|
JOY_Init_Cvars (void)
|
||||||
{
|
{
|
||||||
joy_device = Cvar_Get ("joy_device", "/dev/input/js0", CVAR_NONE | CVAR_ROM, 0,
|
int i;
|
||||||
"Joystick device");
|
|
||||||
|
joy_device = Cvar_Get ("joy_device", "/dev/input/js0",
|
||||||
|
CVAR_NONE | CVAR_ROM, 0, "Joystick device");
|
||||||
joy_enable = Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE, 0,
|
joy_enable = Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE, 0,
|
||||||
"Joystick enable flag");
|
"Joystick enable flag");
|
||||||
joy_amp = Cvar_Get ("joy_amp", "1", CVAR_NONE | CVAR_ARCHIVE, joyamp_f,
|
joy_amp = Cvar_Get ("joy_amp", "1", CVAR_NONE | CVAR_ARCHIVE, joyamp_f,
|
||||||
|
@ -398,9 +411,8 @@ JOY_Init_Cvars (void)
|
||||||
joyamp_f, "Joystick pre-amplification");
|
joyamp_f, "Joystick pre-amplification");
|
||||||
|
|
||||||
Cmd_AddCommand ("in_joy", in_joy_f, "Configures the joystick behaviour");
|
Cmd_AddCommand ("in_joy", in_joy_f, "Configures the joystick behaviour");
|
||||||
int i;
|
|
||||||
for (i=0;i<JOY_MAX_AXES;i++)
|
for (i = 0; i < JOY_MAX_AXES; i++) {
|
||||||
{
|
|
||||||
joy_axes[i].dest = js_none;
|
joy_axes[i].dest = js_none;
|
||||||
joy_axes[i].amp = 1;
|
joy_axes[i].amp = 1;
|
||||||
joy_axes[i].pre_amp = 1;
|
joy_axes[i].pre_amp = 1;
|
||||||
|
@ -413,14 +425,17 @@ void
|
||||||
Joy_WriteBindings (QFile * f)
|
Joy_WriteBindings (QFile * f)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i<JOY_MAX_AXES;i++)
|
|
||||||
{
|
for (i = 0; i < JOY_MAX_AXES; i++) {
|
||||||
Qprintf(f, "in_joy %i amp %f pre_amp %f deadzone %i offset %f type %s %i\n",
|
Qprintf (f,
|
||||||
|
"in_joy %i amp %f pre_amp %f deadzone %i offset %f type %s %i\n",
|
||||||
i, joy_axes[i].amp, joy_axes[i].pre_amp, joy_axes[i].deadzone,
|
i, joy_axes[i].amp, joy_axes[i].pre_amp, joy_axes[i].deadzone,
|
||||||
joy_axes[i].offset, JOY_GetDest_c (joy_axes[i].dest), joy_axes[i].axis);
|
joy_axes[i].offset, JOY_GetDest_c (joy_axes[i].dest),
|
||||||
|
joy_axes[i].axis);
|
||||||
|
|
||||||
if (joy_axes[i].num_buttons > 0) {
|
if (joy_axes[i].num_buttons > 0) {
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
for (n = 0; n < joy_axes[i].num_buttons; n++) {
|
for (n = 0; n < joy_axes[i].num_buttons; n++) {
|
||||||
Qprintf (f, "in_joy %i button add %i %f\n", i,
|
Qprintf (f, "in_joy %i button add %i %f\n", i,
|
||||||
joy_axes[i].axis_buttons[n].key - QFJ_AXIS1,
|
joy_axes[i].axis_buttons[n].key - QFJ_AXIS1,
|
||||||
|
|
Loading…
Reference in a new issue