Update of /cvsroot/super-tux/supertux/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1839/src
Modified Files:
configfile.cpp setup.cpp
Log Message:
Should fix the joystick bug, when the user changes joystick port or something.
Index: setup.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/setup.cpp,v
retrieving revision 1.102
retrieving revision 1.103
diff -u -d -r1.102 -r1.103
--- setup.cpp 21 Jun 2004 21:21:01 -0000 1.102
+++ setup.cpp 22 Jun 2004 12:43:42 -0000 1.103
@@ -775,7 +775,7 @@
/* Open joystick: */
if (SDL_NumJoysticks() <= 0)
{
- fprintf(stderr, "Warning: No joysticks are available.\n");
+ fprintf(stderr, "Info: No joysticks were found.\n");
use_joystick = false;
}
Index: configfile.cpp
===================================================================
RCS file: /cvsroot/super-tux/supertux/src/configfile.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- configfile.cpp 20 Jun 2004 17:43:26 -0000 1.8
+++ configfile.cpp 22 Jun 2004 12:43:41 -0000 1.9
@@ -88,17 +88,16 @@
use_gl = false;
reader.read_int ("joystick", joystick_num);
- if (!(joystick_num >= 0))
- use_joystick = false;
- else
- use_joystick = true;
- reader.read_int ("joystick-x", joystick_keymap.x_axis);
- reader.read_int ("joystick-y", joystick_keymap.y_axis);
- reader.read_int ("joystick-a", joystick_keymap.a_button);
- reader.read_int ("joystick-b", joystick_keymap.b_button);
- reader.read_int ("joystick-start", joystick_keymap.start_button);
- reader.read_int ("joystick-deadzone", joystick_keymap.dead_zone);
+ if (joystick_num >= 0)
+ {
+ reader.read_int ("joystick-x", joystick_keymap.x_axis);
+ reader.read_int ("joystick-y", joystick_keymap.y_axis);
+ reader.read_int ("joystick-a", joystick_keymap.a_button);
+ reader.read_int ("joystick-b", joystick_keymap.b_button);
+ reader.read_int ("joystick-start", joystick_keymap.start_button);
+ reader.read_int ("joystick-deadzone", joystick_keymap.dead_zone);
+ }
reader.read_int ("keyboard-jump", keymap.jump);
reader.read_int ("keyboard-activate", keymap.activate);
@@ -127,15 +126,18 @@
fprintf(config, "\n\t;; either \"opengl\" or \"sdl\"\n");
fprintf(config, "\t(video \"%s\")\n", use_gl ? "opengl" : "sdl");
- fprintf(config, "\n\t;; joystick number (-1 means no joystick):\n");
- fprintf(config, "\t(joystick %d)\n", use_joystick ? joystick_num : -1);
+ if(use_joystick)
+ {
+ fprintf(config, "\n\t;; joystick number:\n");
+ fprintf(config, "\t(joystick %d)\n", joystick_num);
- fprintf(config, "\t(joystick-x %d)\n", joystick_keymap.x_axis);
- fprintf(config, "\t(joystick-y %d)\n", joystick_keymap.y_axis);
- fprintf(config, "\t(joystick-a %d)\n", joystick_keymap.a_button);
- fprintf(config, "\t(joystick-b %d)\n", joystick_keymap.b_button);
- fprintf(config, "\t(joystick-start %d)\n", joystick_keymap.start_button);
- fprintf(config, "\t(joystick-deadzone %d)\n", joystick_keymap.dead_zone);
+ fprintf(config, "\t(joystick-x %d)\n", joystick_keymap.x_axis);
+ fprintf(config, "\t(joystick-y %d)\n", joystick_keymap.y_axis);
+ fprintf(config, "\t(joystick-a %d)\n", joystick_keymap.a_button);
+ fprintf(config, "\t(joystick-b %d)\n", joystick_keymap.b_button);
+ fprintf(config, "\t(joystick-start %d)\n", joystick_keymap.start_button);
+ fprintf(config, "\t(joystick-deadzone %d)\n", joystick_keymap.dead_zone);
+ }
fprintf(config, "\t(keyboard-jump %d)\n", keymap.jump);
fprintf(config, "\t(keyboard-duck %d)\n", keymap.duck);
|