don't use hardcoded descriptions of joystick buttons/axes
[btb/d2x.git] / main / kconfig.c
index c871338..c12fb75 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: kconfig.c,v 1.34 2004-12-03 10:06:22 btb Exp $ */
+/* $Id: kconfig.c,v 1.35 2005-04-04 08:56:34 btb Exp $ */
 /*
 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
@@ -23,7 +23,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
 #endif
 
 #ifdef RCS
-static char rcsid[] = "$Id: kconfig.c,v 1.34 2004-12-03 10:06:22 btb Exp $";
+static char rcsid[] = "$Id: kconfig.c,v 1.35 2005-04-04 08:56:34 btb Exp $";
 #endif
 
 #ifdef WINDOWS
@@ -117,6 +117,9 @@ int invert_text[2] = { TNUM_N, TNUM_Y };
          -1, -1, -1, -1
        };
        int joyaxis_text[7] = { TNUM_X1, TNUM_Y1, TNUM_Z1, TNUM_UN, TNUM_P1,TNUM_R1,TNUM_YA1 };
+#elif defined(SDL_INPUT)
+char *joybutton_text[MAX_BUTTONS];
+char *joyaxis_text[JOY_MAX_AXES];
 #else
        int joybutton_text[28] = 
        { TNUM_BTN_1, TNUM_BTN_2, TNUM_BTN_3, TNUM_BTN_4,
@@ -850,6 +853,8 @@ int get_item_height(kc_item *item)
                        case BT_JOY_BUTTON:
 #ifdef USE_LINUX_JOY
                                sprintf(btext, "J%d B%d", j_button[item->value].joydev, j_Get_joydev_button_number(item->value));
+#elif defined(SDL_INPUT)
+                               strncpy(btext, joybutton_text[item->value], 10);
 #else
                                if ( joybutton_text[item->value] !=-1 )
                                        strncpy( btext, Text_string[ joybutton_text[item->value]  ], 10 );
@@ -860,6 +865,8 @@ int get_item_height(kc_item *item)
                        case BT_JOY_AXIS:
 #ifdef USE_LINUX_JOY
                                sprintf( btext, "J%d A%d", j_axis[item->value].joydev, j_Get_joydev_axis_number (item->value) );
+#elif defined(SDL_INPUT)
+                               strncpy(btext, joyaxis_text[item->value], 10);
 #else
                                strncpy(btext, Text_string[joyaxis_text[item->value]], 10);
 #endif
@@ -1377,6 +1384,8 @@ WIN(DDGRUNLOCK(dd_grd_curcanv));
                        case BT_JOY_BUTTON:
 #ifdef USE_LINUX_JOY
                                sprintf(btext, "J%d B%d", j_button[item->value].joydev, j_Get_joydev_button_number(item->value));
+#elif defined(SDL_INPUT)
+                               strncpy(btext, joybutton_text[item->value], 10);
 #else
 # ifndef MACINTOSH
 #  ifdef WINDOWS
@@ -1400,6 +1409,8 @@ WIN(DDGRUNLOCK(dd_grd_curcanv));
                        case BT_JOY_AXIS:
 #ifdef USE_LINUX_JOY
                                sprintf(btext, "J%d A%d", j_axis[item->value].joydev, j_Get_joydev_axis_number(item->value));
+#elif defined(SDL_INPUT)
+                               strncpy(btext, joyaxis_text[item->value], 10);
 #else
                                strncpy(btext, Text_string[joyaxis_text[item->value]], 10);
 #endif
@@ -1597,7 +1608,8 @@ WIN(DDGRUNLOCK(dd_grd_curcanv));
                                }
                        }
                } else {
-                       for (i=0; i<MAX_BUTTONS; i++ )  {
+                       for (i = 0; i < MAX_BUTTONS; i++)
+                       {
                                if ( joy_get_button_state(i) )
                                        code = i;
                        }