-/*
- setup.c
-
- Super Tux - Setup
-
- by Bill Kendrick
- bill@newbreedsoftware.com
- http://www.newbreedsoftware.com/supertux/
-
- April 11, 2000 - March 15, 2004
-*/
+// $Id$
+//
+// SuperTux - A Jump'n Run
+// Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <assert.h>
#include <stdio.h>
#include "scene.h"
#include "worldmap.h"
+#include "player.h"
+
#ifdef WIN32
#define mkdir(dir, mode) mkdir(dir)
// on win32 we typically don't want LFS paths
options_controls_menu->additem(MN_LABEL,"Controls",0,0);
options_controls_menu->additem(MN_HL,"",0,0);
- //FIXME:options_controls_menu->additem(MN_CONTROLFIELD,"Move Right", tux.keymap.right,0);
+ options_controls_menu->additem(MN_CONTROLFIELD,"Right move", 0,0, &keymap.right);
+ options_controls_menu->additem(MN_CONTROLFIELD,"Left move", 0,0, &keymap.left);
+ options_controls_menu->additem(MN_CONTROLFIELD,"Jump", 0,0, &keymap.jump);
+ options_controls_menu->additem(MN_CONTROLFIELD,"Duck", 0,0, &keymap.duck);
+ options_controls_menu->additem(MN_CONTROLFIELD,"Power", 0,0, &keymap.fire);
options_controls_menu->additem(MN_HL,"",0,0);
options_controls_menu->additem(MN_BACK,"Back",0,0);
{
int slot = load_game_menu->check();
- if(slot != -1)
+ if(slot != -1 && load_game_menu->get_item(slot).kind == MN_ACTION)
{
WorldMapNS::WorldMap worldmap;
worldmap.display();
- show_menu = true;
Menu::set_current(main_menu);
st_pause_ticks_stop();
}
else
{
- /* Check for proper joystick configuration: */
-
if (SDL_JoystickNumAxes(js) < 2)
{
fprintf(stderr,
assert(i+1 < argc);
joystick_num = atoi(argv[++i]);
}
+ else if (strcmp(argv[i], "--joymap") == 0)
+ {
+ assert(i+1 < argc);
+ if (sscanf(argv[++i],
+ "%d:%d:%d:%d:%d",
+ &joystick_keymap.x_axis,
+ &joystick_keymap.y_axis,
+ &joystick_keymap.a_button,
+ &joystick_keymap.b_button,
+ &joystick_keymap.start_button) != 5)
+ {
+ puts("Warning: Invalid or incomplete joymap, should be: 'XAXIS:YAXIS:A:B:START'");
+ }
+ else
+ {
+ std::cout << "Using new joymap:\n"
+ << " X-Axis: " << joystick_keymap.x_axis << "\n"
+ << " Y-Axis: " << joystick_keymap.y_axis << "\n"
+ << " A-Button: " << joystick_keymap.a_button << "\n"
+ << " B-Button: " << joystick_keymap.b_button << "\n"
+ << " Start-Button: " << joystick_keymap.start_button << std::endl;
+ }
+ }
else if (strcmp(argv[i], "--worldmap") == 0)
{
launch_worldmap_mode = true;
"\n"
"Misc Options:\n"
" -j, --joystick NUM Use joystick NUM (default: 0)\n"
+ " --joymap XAXIS:YAXIS:A:B:START\n"
+ " Define how joystick buttons and axis should be mapped\n"
" --worldmap Start in worldmap-mode (EXPERIMENTAL)\n"
" -d, --datadir DIR Load Game data from DIR (default: automatic)\n"
" --debug-mode Enables the debug-mode, which is useful for developers.\n"