Limitated the number of bullets to be shot at the same time.
[supertux.git] / src / configfile.cpp
index 514c249..df637ec 100644 (file)
@@ -23,6 +23,7 @@
 #include "setup.h"
 #include "globals.h"
 #include "lispreader.h"
+#include "player.h"
 
 #ifdef WIN32
 const char * config_filename = "/st_config.dat";
@@ -90,6 +91,19 @@ void loadconfig(void)
     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);
+
+  reader.read_int ("keyboard-jump", &keymap.jump);
+  reader.read_int ("keyboard-duck", &keymap.duck);
+  reader.read_int ("keyboard-left", &keymap.left);
+  reader.read_int ("keyboard-right", &keymap.right);
+  reader.read_int ("keyboard-fire", &keymap.fire);
 }
 
 void saveconfig (void)
@@ -112,6 +126,20 @@ void saveconfig (void)
 
       fprintf(config, "\n\t;; joystick number (-1 means no joystick):\n");
       fprintf(config, "\t(joystick   %d)\n", use_joystick ? joystick_num : -1);
+
+      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);
+      fprintf(config, "\t(keyboard-left  %d)\n", keymap.left);
+      fprintf(config, "\t(keyboard-right %d)\n", keymap.right);
+      fprintf(config, "\t(keyboard-fire  %d)\n", keymap.fire);
+
       fprintf(config, ")\n");
     }
 }