From 423d31e70af48ee6178f613a8c85742c3e644d6a Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Sat, 22 May 2004 07:27:29 +0000 Subject: [PATCH] make next axis config key skip currently allocated axes (d1x r1.11) --- ChangeLog | 5 +++++ main/kconfig.c | 20 ++++++++++++-------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index d35f2931..e6b365a2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-05-22 Matthew Mueller + + * main/kconfig.c: make next axis config key skip currently + allocated axes (d1x r1.11) + 2004-05-22 David Cleaver * main/kconfig.c: joy configuration next axis key from WraithX diff --git a/main/kconfig.c b/main/kconfig.c index 7da6a0fe..9ff81f6e 100644 --- a/main/kconfig.c +++ b/main/kconfig.c @@ -1,4 +1,4 @@ -/* $Id: kconfig.c,v 1.29 2004-05-22 07:20:54 btb Exp $ */ +/* $Id: kconfig.c,v 1.30 2004-05-22 07:27:29 btb Exp $ */ /* THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO @@ -346,7 +346,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #endif #ifdef RCS -static char rcsid[] = "$Id: kconfig.c,v 1.29 2004-05-22 07:20:54 btb Exp $"; +static char rcsid[] = "$Id: kconfig.c,v 1.30 2004-05-22 07:27:29 btb Exp $"; #endif #ifdef WINDOWS @@ -2005,10 +2005,10 @@ WIN(DDGRUNLOCK(dd_grd_curcanv)); } -// the following function added by WraithX on 11/22/00 to work around the weird joystick bug... +// the following function added by WraithX on 11/22/00 to work around the weird joystick bug... - modified my Matt Mueller to skip already allocated axes void kc_next_joyaxis(kc_item *item) { - int n, i, k; + int n, i, k, max, tries; ubyte code = 0; k = 255; @@ -2018,10 +2018,12 @@ void kc_next_joyaxis(kc_item *item) // I modelled this ifdef after the code in the kc_change_joyaxis method. // So, if somethin's not workin here, it might not be workin there either. #ifdef USE_LINUX_JOY - code = (item->value + 1) % 32; + max = 32; #else - code = (item->value + 1) % JOY_NUM_AXES; + max = JOY_NUM_AXES; #endif + tries = 1; + code = (item->value + 1) % max; if (code != 255) { @@ -2030,8 +2032,10 @@ void kc_next_joyaxis(kc_item *item) n = item - All_items; if ((i != n) && (All_items[i].type == BT_JOY_AXIS) && (All_items[i].value == code)) { - All_items[i].value = 255; - kc_drawitem(&All_items[i], 0); + if (tries > max) + return; // all axes allocated already + i = -1; // -1 so the i++ will push back to 0 + code = (item->value + ++tries) % max; // try next axis }//end if }//end for -- 2.39.2