- data/levels/default/ moved to data/levels/worldmap/
[supertux.git] / src / setup.cpp
index 1e1b22b..a248d2c 100644 (file)
@@ -1,16 +1,24 @@
-/*
-  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 <iostream>
 #include <stdio.h>
 #include <stdlib.h>
 #include "defines.h"
 #include "globals.h"
 #include "setup.h"
-#include "screen.h"
-#include "texture.h"
+#include "screen/screen.h"
+#include "screen/texture.h"
 #include "menu.h"
 #include "gameloop.h"
 #include "configfile.h"
 #include "scene.h"
+#include "worldmap.h"
+#include "resources.h"
+#include "intro.h"
+#include "sound_manager.h"
+#include "gettext.h"
+
+#include "player.h"
 
 #ifdef WIN32
 #define mkdir(dir, mode)    mkdir(dir)
 #define DATA_PREFIX "./data/"
 #endif
 
+/* Screen proprities: */
+/* Don't use this to test for the actual screen sizes. Use screen->w/h instead! */
+#define SCREEN_W 800
+#define SCREEN_H 600
+
 /* Local function prototypes: */
 
 void seticon(void);
@@ -332,10 +352,10 @@ void st_directory_setup(void)
         {
           std::string exedir = std::string(dirname(exe_file)) + "/";
           
-          datadir = exedir + "../data/"; // SuperTux run from source dir
+          datadir = exedir + "../data"; // SuperTux run from source dir
           if (access(datadir.c_str(), F_OK) != 0)
             {
-              datadir = exedir + "../share/supertux/"; // SuperTux run from PATH
+              datadir = exedir + "../share/supertux"; // SuperTux run from PATH
               if (access(datadir.c_str(), F_OK) != 0) 
                 { // If all fails, fall back to compiled path
                   datadir = DATA_PREFIX; 
@@ -354,141 +374,151 @@ void st_menu(void)
 {
   main_menu      = new Menu();
   options_menu   = new Menu();
-  options_controls_menu   = new Menu();
+  options_keys_menu     = new Menu();
+  options_joystick_menu = new Menu();
   load_game_menu = new Menu();
   save_game_menu = new Menu();
   game_menu      = new Menu();
   highscore_menu = new Menu();
   contrib_menu   = new Menu();
+  contrib_subset_menu   = new Menu();
+  worldmap_menu  = new Menu();
 
   main_menu->set_pos(screen->w/2, 335);
-  main_menu->additem(MN_GOTO, "Start Game",0,load_game_menu);
-  main_menu->additem(MN_GOTO, "Contrib Levels",0,contrib_menu);
-  main_menu->additem(MN_GOTO, "Options",0,options_menu);
-  main_menu->additem(MN_ACTION,"Level editor",0,0);
-  main_menu->additem(MN_ACTION,"Credits",0,0);
-  main_menu->additem(MN_ACTION,"Quit",0,0);
-
-  contrib_menu->additem(MN_LABEL,"Contrib Levels",0,0);
-  contrib_menu->additem(MN_HL,"",0,0);
-  contrib_menu->additem(MN_ACTION, "Some Levelset", 0, 0);
-  contrib_menu->additem(MN_ACTION, "Someother Levelset", 0, 0);
-  contrib_menu->additem(MN_ACTION, "Yet another Levelset", 0, 0);
-  contrib_menu->additem(MN_HL,"",0,0);
-  contrib_menu->additem(MN_BACK,"Back",0,0);
-
-  options_menu->additem(MN_LABEL,"Options",0,0);
+  main_menu->additem(MN_GOTO, _("Start Game"),0,load_game_menu, MNID_STARTGAME);
+  main_menu->additem(MN_GOTO, _("Contrib Levels"),0,contrib_menu, MNID_CONTRIB);
+  main_menu->additem(MN_GOTO, _("Options"),0,options_menu, MNID_OPTIONMENU);
+  main_menu->additem(MN_ACTION, _("Level Editor"),0,0, MNID_LEVELEDITOR);
+  main_menu->additem(MN_ACTION, _("Credits"),0,0, MNID_CREDITS);
+  main_menu->additem(MN_ACTION, _("Quit"),0,0, MNID_QUITMAINMENU);
+
+  options_menu->additem(MN_LABEL,_("Options"),0,0);
   options_menu->additem(MN_HL,"",0,0);
-  options_menu->additem(MN_TOGGLE,"Fullscreen",use_fullscreen,0);
+#ifndef NOOPENGL
+  options_menu->additem(MN_TOGGLE,_("OpenGL    "),use_gl,0, MNID_OPENGL);
+#else
+  options_menu->additem(MN_DEACTIVE,_("OpenGL (not supported)"),use_gl, 0, MNID_OPENGL);
+#endif
+  options_menu->additem(MN_TOGGLE,_("Fullscreen"),use_fullscreen,0, MNID_FULLSCREEN);
   if(audio_device)
     {
-      options_menu->additem(MN_TOGGLE,"Sound     ",use_sound,0);
-      options_menu->additem(MN_TOGGLE,"Music     ",use_music,0);
+      options_menu->additem(MN_TOGGLE,_("Sound     "), use_sound,0, MNID_SOUND);
+      options_menu->additem(MN_TOGGLE,_("Music     "), use_music,0, MNID_MUSIC);
     }
   else
     {
-      options_menu->additem(MN_DEACTIVE,"Sound     ",use_sound,0);
-      options_menu->additem(MN_DEACTIVE,"Music     ",use_music,0);
+      options_menu->additem(MN_DEACTIVE,_("Sound     "), false,0, MNID_SOUND);
+      options_menu->additem(MN_DEACTIVE,_("Music     "), false,0, MNID_MUSIC);
     }
-  options_menu->additem(MN_TOGGLE,"Show FPS  ",show_fps,0);
-  options_menu->additem(MN_GOTO,"Controls  ",0,options_controls_menu);
+  options_menu->additem(MN_TOGGLE,_("Show FPS  "),show_fps,0, MNID_SHOWFPS);
+  options_menu->additem(MN_GOTO,_("Setup Keys"),0,options_keys_menu);
+
+  if(use_joystick)
+    options_menu->additem(MN_GOTO,_("Setup Joystick"),0,options_joystick_menu);
+
   options_menu->additem(MN_HL,"",0,0);
-  options_menu->additem(MN_BACK,"Back",0,0);
+  options_menu->additem(MN_BACK,_("Back"),0,0);
   
-  options_controls_menu->additem(MN_LABEL,"Controls",0,0);
-  options_controls_menu->additem(MN_HL,"",0,0);
-  options_controls_menu->additem(MN_CONTROLFIELD,"Move Right",tux.keymap.right,0);
-  options_controls_menu->additem(MN_HL,"",0,0);
-  options_controls_menu->additem(MN_BACK,"Back",0,0);
-
-  load_game_menu->additem(MN_LABEL,"Start Game",0,0);
+  options_keys_menu->additem(MN_LABEL,_("Keyboard Setup"),0,0);
+  options_keys_menu->additem(MN_HL,"",0,0);
+  options_keys_menu->additem(MN_CONTROLFIELD_KB,_("Left move"), 0,0, 0,&keymap.left);
+  options_keys_menu->additem(MN_CONTROLFIELD_KB,_("Right move"), 0,0, 0,&keymap.right);
+  options_keys_menu->additem(MN_CONTROLFIELD_KB,_("Jump"), 0,0, 0,&keymap.jump);
+  options_keys_menu->additem(MN_CONTROLFIELD_KB,_("Duck"), 0,0, 0,&keymap.duck);
+  options_keys_menu->additem(MN_CONTROLFIELD_KB,_("Activate"), 0, 0, 0,
+          &keymap.activate);
+  options_keys_menu->additem(MN_CONTROLFIELD_KB,_("Power/Run"), 0,0, 0,&keymap.fire);
+  options_keys_menu->additem(MN_HL,"",0,0);
+  options_keys_menu->additem(MN_BACK,_("Back"),0,0);
+
+  if(use_joystick)
+    {
+    options_joystick_menu->additem(MN_LABEL,_("Joystick Setup"),0,0);
+    options_joystick_menu->additem(MN_HL,"",0,0);
+    //options_joystick_menu->additem(MN_CONTROLFIELD_JS,"X axis", 0,0, 0,&joystick_keymap.x_axis);
+    //options_joystick_menu->additem(MN_CONTROLFIELD_JS,"Y axis", 0,0, 0,&joystick_keymap.y_axis);
+    options_joystick_menu->additem(MN_CONTROLFIELD_JS,_("A button"), 0,0, 0,&joystick_keymap.a_button);
+    options_joystick_menu->additem(MN_CONTROLFIELD_JS,_("B button"), 0,0, 0,&joystick_keymap.b_button);
+    //options_joystick_menu->additem(MN_CONTROLFIELD_JS,"Start", 0,0, 0,&joystick_keymap.start_button);
+    //options_joystick_menu->additem(MN_CONTROLFIELD_JS,"DeadZone", 0,0, 0,&joystick_keymap.dead_zone);
+    options_joystick_menu->additem(MN_HL,"",0,0);
+    options_joystick_menu->additem(MN_BACK,_("Back"),0,0);
+    }
+  
+  load_game_menu->additem(MN_LABEL,_("Start Game"),0,0);
   load_game_menu->additem(MN_HL,"",0,0);
-  load_game_menu->additem(MN_DEACTIVE,"Slot 1",0,0);
-  load_game_menu->additem(MN_DEACTIVE,"Slot 2",0,0);
-  load_game_menu->additem(MN_DEACTIVE,"Slot 3",0,0);
-  load_game_menu->additem(MN_DEACTIVE,"Slot 4",0,0);
-  load_game_menu->additem(MN_DEACTIVE,"Slot 5",0,0);
+  load_game_menu->additem(MN_DEACTIVE,"Slot 1",0,0, 1);
+  load_game_menu->additem(MN_DEACTIVE,"Slot 2",0,0, 2);
+  load_game_menu->additem(MN_DEACTIVE,"Slot 3",0,0, 3);
+  load_game_menu->additem(MN_DEACTIVE,"Slot 4",0,0, 4);
+  load_game_menu->additem(MN_DEACTIVE,"Slot 5",0,0, 5);
   load_game_menu->additem(MN_HL,"",0,0);
-  load_game_menu->additem(MN_BACK,"Back",0,0);
+  load_game_menu->additem(MN_BACK,_("Back"),0,0);
 
-  save_game_menu->additem(MN_LABEL,"Save Game",0,0);
+  save_game_menu->additem(MN_LABEL,_("Save Game"),0,0);
   save_game_menu->additem(MN_HL,"",0,0);
-  save_game_menu->additem(MN_DEACTIVE,"Slot 1",0,0);
-  save_game_menu->additem(MN_DEACTIVE,"Slot 2",0,0);
-  save_game_menu->additem(MN_DEACTIVE,"Slot 3",0,0);
-  save_game_menu->additem(MN_DEACTIVE,"Slot 4",0,0);
-  save_game_menu->additem(MN_DEACTIVE,"Slot 5",0,0);
+  save_game_menu->additem(MN_DEACTIVE,"Slot 1",0,0, 1);
+  save_game_menu->additem(MN_DEACTIVE,"Slot 2",0,0, 2);
+  save_game_menu->additem(MN_DEACTIVE,"Slot 3",0,0, 3);
+  save_game_menu->additem(MN_DEACTIVE,"Slot 4",0,0, 4);
+  save_game_menu->additem(MN_DEACTIVE,"Slot 5",0,0, 5);
   save_game_menu->additem(MN_HL,"",0,0);
   save_game_menu->additem(MN_BACK,"Back",0,0);
 
-  game_menu->additem(MN_LABEL,"InGame Menu",0,0);
+  game_menu->additem(MN_LABEL,_("Pause"),0,0);
   game_menu->additem(MN_HL,"",0,0);
-  game_menu->additem(MN_ACTION,"Return To Game",0,0);
-  game_menu->additem(MN_GOTO,"Save Game",0,save_game_menu);
-  game_menu->additem(MN_GOTO,"Load Game",0,load_game_menu);
-  game_menu->additem(MN_GOTO,"Options",0,options_menu);
+  game_menu->additem(MN_ACTION,_("Continue"),0,0,MNID_CONTINUE);
+  game_menu->additem(MN_GOTO,_("Options"),0,options_menu);
   game_menu->additem(MN_HL,"",0,0);
-  game_menu->additem(MN_ACTION,"Quit Game",0,0);
+  game_menu->additem(MN_ACTION,_("Abort Level"),0,0,MNID_ABORTLEVEL);
 
-  highscore_menu->additem(MN_TEXTFIELD,"Enter your name:",0,0);
+  worldmap_menu->additem(MN_LABEL,_("Pause"),0,0);
+  worldmap_menu->additem(MN_HL,"",0,0);
+  worldmap_menu->additem(MN_ACTION,_("Continue"),0,0,MNID_RETURNWORLDMAP);
+  worldmap_menu->additem(MN_GOTO,_("Options"),0,options_menu);
+  worldmap_menu->additem(MN_HL,"",0,0);
+  worldmap_menu->additem(MN_ACTION,_("Quit Game"),0,0,MNID_QUITWORLDMAP);
+
+  highscore_menu->additem(MN_TEXTFIELD,_("Enter your name:"),0,0);
 }
 
-void update_load_save_game_menu(Menu* pmenu, int load)
+void update_load_save_game_menu(Menu* pmenu)
 {
   for(int i = 2; i < 7; ++i)
     {
       // FIXME: Insert a real savegame struct/class here instead of
       // doing string vodoo
-      std::string tmp = slotinfo(i-1);
-
-      if(load && tmp.length() == strlen("Slot X - Free"))
-        pmenu->item[i].kind = MN_ACTION;
-      else
-        pmenu->item[i].kind = MN_ACTION;
-      menu_item_change_text(&pmenu->item[i], tmp.c_str());
+      std::string tmp = slotinfo(i - 1);
+      pmenu->item[i].kind = MN_ACTION;
+      pmenu->item[i].change_text(tmp.c_str());
     }
 }
 
-void process_save_game_menu()
-{
-  int slot = save_game_menu->check();
-  if (slot != -1)
-    savegame(slot - 1);
-}
-
 bool process_load_game_menu()
 {
   int slot = load_game_menu->check();
 
-  if(slot != -1)
+  if(slot != -1 && load_game_menu->get_item_by_id(slot).kind == MN_ACTION)
     {
-      // FIXME: Insert a real savegame struct/class here instead of
-      // doing string vodoo
-      std::string tmp = slotinfo(slot-1);
-
-      if (tmp.length() == strlen("Slot X - Free"))
-        { // Slot is free, so start a new game
-          GameSession session("default", 1, ST_GL_PLAY);
-          session.run();
+      char slotfile[1024];
+      snprintf(slotfile, 1024, "%s/slot%d.stsg", st_save_dir, slot);
 
-          show_menu = true;
-          Menu::set_current(main_menu);
+      if (access(slotfile, F_OK) != 0)
+        {
+          draw_intro();
         }
-      else
-        { // Slot contains a level, so load it
-          if (game_started)
-            {
-              GameSession session("default",slot - 1,ST_GL_LOAD_GAME);
-              session.run();
 
-              show_menu = true;
-              Menu::set_current(main_menu);
-            }
-          else
-            {
-              loadgame(slot - 1);
-            }
-        }
+      // shrink_fade(Point((screen->w/2),(screen->h/2)), 1000);
+      fadeout(256);
+      WorldMapNS::WorldMap worldmap;
+     
+      // Load the game or at least set the savegame_file variable
+      worldmap.loadgame(slotfile);
+
+      worldmap.display();
+      
+      Menu::set_current(main_menu);
+
       st_pause_ticks_stop();
       return true;
     }
@@ -503,40 +533,37 @@ void process_options_menu(void)
 {
   switch (options_menu->check())
     {
-    case 2:
-      if(use_fullscreen != options_menu->item[2].toggled)
+    case MNID_OPENGL:
+#ifndef NOOPENGL
+      if(use_gl != options_menu->isToggled(MNID_OPENGL))
+        {
+          use_gl = !use_gl;
+          st_video_setup();
+        }
+#else
+      options_menu->get_item_by_id(MNID_OPENGL).toggled = false;
+#endif
+      break;
+    case MNID_FULLSCREEN:
+      if(use_fullscreen != options_menu->isToggled(MNID_FULLSCREEN))
         {
           use_fullscreen = !use_fullscreen;
           st_video_setup();
         }
       break;
-    case 3:
-      if(use_sound != options_menu->item[3].toggled)
+    case MNID_SOUND:
+      if(use_sound != options_menu->isToggled(MNID_SOUND))
         use_sound = !use_sound;
       break;
-    case 4:
-      if(use_music != options_menu->item[4].toggled)
+    case MNID_MUSIC:
+      if(use_music != options_menu->isToggled(MNID_MUSIC))
         {
-          if(use_music)
-            {
-              if(playing_music())
-                {
-                  halt_music();
-                }
-              use_music = false;
-            }
-          else
-            {
-              use_music = true;
-              if (!playing_music())
-                {
-                  play_current_music();
-                }
-            }
+          use_music = !use_music;
+          sound_manager->enable_music(use_music);
         }
       break;
-    case 5:
-      if(show_fps != options_menu->item[5].toggled)
+    case MNID_SHOWFPS:
+      if(show_fps != options_menu->isToggled(MNID_SHOWFPS))
         show_fps = !show_fps;
       break;
     }
@@ -557,25 +584,27 @@ void st_general_setup(void)
   SDL_EnableUNICODE(1);
 
   /* Load global images: */
-
-  text_load(&black_text, datadir + "/images/status/letters-black.png", TEXT_TEXT, 16,18);
-  text_load(&gold_text,datadir + "/images/status/letters-gold.png", TEXT_TEXT, 16,18);
-  text_load(&blue_text,datadir + "/images/status/letters-blue.png", TEXT_TEXT, 16,18);
-  text_load(&red_text,datadir + "/images/status/letters-red.png", TEXT_TEXT, 16,18);
-  text_load(&white_text,datadir + "/images/status/letters-white.png", TEXT_TEXT, 16,18);
-  text_load(&white_small_text,datadir + "/images/status/letters-white-small.png", TEXT_TEXT, 8,9);
-  text_load(&white_big_text,datadir + "/images/status/letters-white-big.png", TEXT_TEXT, 20,23);
-  text_load(&yellow_nums,datadir + "/images/status/numbers.png", TEXT_NUM, 32,32);
+  gold_text = new Font(datadir + "/images/fonts/gold.png", Font::TEXT, 16,18);
+  blue_text = new Font(datadir + "/images/fonts/blue.png", Font::TEXT, 16,18,3);
+  white_text  = new Font(datadir + "/images/fonts/white.png",
+      Font::TEXT, 16,18);
+  white_small_text = new Font(datadir + "/images/fonts/white-small.png",
+          Font::TEXT, 8,9, 1);
+  white_big_text   = new Font(datadir + "/images/fonts/white-big.png",
+      Font::TEXT, 20,22, 3);
+  yellow_nums = new Font(datadir + "/images/fonts/numbers.png",
+      Font::NUM, 32,32);
 
   /* Load GUI/menu images: */
-  texture_load(&checkbox, datadir + "/images/status/checkbox.png", USE_ALPHA);
-  texture_load(&checkbox_checked, datadir + "/images/status/checkbox-checked.png", USE_ALPHA);
-  texture_load(&back, datadir + "/images/status/back.png", USE_ALPHA);
-  texture_load(&arrow_left, datadir + "/images/icons/left.png", USE_ALPHA);
-  texture_load(&arrow_right, datadir + "/images/icons/right.png", USE_ALPHA);
+  checkbox = new Surface(datadir + "/images/status/checkbox.png", USE_ALPHA);
+  checkbox_checked = new Surface(datadir + "/images/status/checkbox-checked.png", USE_ALPHA);
+  back = new Surface(datadir + "/images/status/back.png", USE_ALPHA);
+  arrow_left = new Surface(datadir + "/images/icons/left.png", USE_ALPHA);
+  arrow_right = new Surface(datadir + "/images/icons/right.png", USE_ALPHA);
 
   /* Load the mouse-cursor */
   mouse_cursor = new MouseCursor( datadir + "/images/status/mousecursor.png",1);
+  MouseCursor::set_current(mouse_cursor);
   
 }
 
@@ -583,21 +612,19 @@ void st_general_free(void)
 {
 
   /* Free global images: */
-
-  text_free(&black_text);
-  text_free(&gold_text);
-  text_free(&white_text);
-  text_free(&blue_text);
-  text_free(&red_text);
-  text_free(&white_small_text);
-  text_free(&white_big_text);
+  delete gold_text;
+  delete white_text;
+  delete blue_text;
+  delete white_small_text;
+  delete white_big_text;
+  delete yellow_nums;
 
   /* Free GUI/menu images: */
-  texture_free(&checkbox);
-  texture_free(&checkbox_checked);
-  texture_free(&back);
-  texture_free(&arrow_left);
-  texture_free(&arrow_right);
+  delete checkbox;
+  delete checkbox_checked;
+  delete back;
+  delete arrow_left;
+  delete arrow_right;
 
   /* Free mouse-cursor */
   delete mouse_cursor;
@@ -613,12 +640,7 @@ void st_general_free(void)
 
 void st_video_setup(void)
 {
-
-  if(screen != NULL)
-    SDL_FreeSurface(screen);
-
   /* Init SDL Video: */
-
   if (SDL_Init(SDL_INIT_VIDEO) < 0)
     {
       fprintf(stderr,
@@ -629,27 +651,22 @@ void st_video_setup(void)
     }
 
   /* Open display: */
-
   if(use_gl)
     st_video_setup_gl();
   else
     st_video_setup_sdl();
 
-  texture_setup();
+  Surface::reload_all();
 
   /* Set window manager stuff: */
-
   SDL_WM_SetCaption("SuperTux " VERSION, "SuperTux");
-
 }
 
 void st_video_setup_sdl(void)
 {
-  SDL_FreeSurface(screen);
-
   if (use_fullscreen)
     {
-      screen = SDL_SetVideoMode(640, 480, 0, SDL_FULLSCREEN ) ; /* | SDL_HWSURFACE); */
+      screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 0, SDL_FULLSCREEN ) ; /* | SDL_HWSURFACE); */
       if (screen == NULL)
         {
           fprintf(stderr,
@@ -662,7 +679,7 @@ void st_video_setup_sdl(void)
     }
   else
     {
-      screen = SDL_SetVideoMode(640, 480, 0, SDL_HWSURFACE | SDL_DOUBLEBUF );
+      screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 0, SDL_HWSURFACE | SDL_DOUBLEBUF );
 
       if (screen == NULL)
         {
@@ -687,7 +704,7 @@ void st_video_setup_gl(void)
 
   if (use_fullscreen)
     {
-      screen = SDL_SetVideoMode(640, 480, 0, SDL_FULLSCREEN | SDL_OPENGL) ; /* | SDL_HWSURFACE); */
+      screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 0, SDL_FULLSCREEN | SDL_OPENGL) ; /* | SDL_HWSURFACE); */
       if (screen == NULL)
         {
           fprintf(stderr,
@@ -700,7 +717,7 @@ void st_video_setup_gl(void)
     }
   else
     {
-      screen = SDL_SetVideoMode(640, 480, 0, SDL_OPENGL);
+      screen = SDL_SetVideoMode(SCREEN_W, SCREEN_H, 0, SDL_OPENGL);
 
       if (screen == NULL)
         {
@@ -769,8 +786,6 @@ void st_joystick_setup(void)
             }
           else
             {
-              /* Check for proper joystick configuration: */
-
               if (SDL_JoystickNumAxes(js) < 2)
                 {
                   fprintf(stderr,
@@ -868,44 +883,43 @@ void st_abort(const std::string& reason, const std::string& details)
   abort();
 }
 
-
 /* Set Icon (private) */
 
 void seticon(void)
 {
-  int masklen;
-  Uint8 * mask;
+//  int masklen;
+//  Uint8 * mask;
   SDL_Surface * icon;
 
 
   /* Load icon into a surface: */
 
-  icon = IMG_Load((datadir + "/images/icon.png").c_str());
+  icon = IMG_Load((datadir + "/images/supertux.xpm").c_str());
   if (icon == NULL)
     {
       fprintf(stderr,
               "\nError: I could not load the icon image: %s%s\n"
               "The Simple DirectMedia error that occured was:\n"
-              "%s\n\n", datadir.c_str(), "/images/icon.png", SDL_GetError());
+              "%s\n\n", datadir.c_str(), "/images/supertux.xpm", SDL_GetError());
       exit(1);
     }
 
 
   /* Create mask: */
-
+/*
   masklen = (((icon -> w) + 7) / 8) * (icon -> h);
   mask = (Uint8*) malloc(masklen * sizeof(Uint8));
   memset(mask, 0xFF, masklen);
-
+*/
 
   /* Set icon: */
 
-  SDL_WM_SetIcon(icon, mask);
+  SDL_WM_SetIcon(icon, NULL);//mask);
 
 
   /* Free icon surface & mask: */
 
-  free(mask);
+//  free(mask);
   SDL_FreeSurface(icon);
 }
 
@@ -934,9 +948,32 @@ void parseargs(int argc, char * argv[])
           assert(i+1 < argc);
           joystick_num = atoi(argv[++i]);
         }
-      else if (strcmp(argv[i], "--worldmap") == 0)
+      else if (strcmp(argv[i], "--joymap") == 0)
         {
-          launch_worldmap_mode = true;
+          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], "--leveleditor") == 0)
+        {
+          launch_leveleditor_mode = true;
         }
       else if (strcmp(argv[i], "--datadir") == 0 
                || strcmp(argv[i], "-d") == 0 )
@@ -980,6 +1017,7 @@ void parseargs(int argc, char * argv[])
           /* Disable the compiled in sound feature */
           printf("Sounds disabled \n");
           use_sound = false;
+          audio_device = false;
         }
       else if (strcmp(argv[i], "--disable-music") == 0)
         {
@@ -995,14 +1033,14 @@ void parseargs(int argc, char * argv[])
         }
       else if (strcmp(argv[i], "--help") == 0)
         {     /* Show help: */
-          puts("Super Tux " VERSION "\n"
-               "  Please see the file \"README.txt\" for more details.\n");
-          printf("Usage: %s [OPTIONS] FILENAME\n\n", argv[0]);
-          puts("Display Options:\n"
+          puts(_("  SuperTux  " VERSION "\n"
+               "  Please see the file \"README.txt\" for more details.\n"));
+          printf(_("Usage: %s [OPTIONS] FILENAME\n\n"), argv[0]);
+          puts(_("Display Options:\n"
                "  --fullscreen        Run in fullscreen mode.\n"
-               "  --opengl            If opengl support was compiled in, this will enable\n"
-               "                      the EXPERIMENTAL OpenGL mode.\n"
-               "  --sdl               Use non-opengl renderer\n"
+               "  --opengl            If OpenGL support was compiled in, this will tell\n"
+               "                      SuperTux to make use of it.\n"
+               "  --sdl               Use the SDL software graphical renderer\n"
                "\n"
                "Sound Options:\n"
                "  --disable-sound     If sound support was compiled in,  this will\n"
@@ -1011,14 +1049,16 @@ void parseargs(int argc, char * argv[])
                "\n"
                "Misc Options:\n"
                "  -j, --joystick NUM  Use joystick NUM (default: 0)\n" 
-               "  --worldmap          Start in worldmap-mode (EXPERIMENTAL)\n"          
+               "  --joymap XAXIS:YAXIS:A:B:START\n"
+               "                      Define how joystick buttons and axis should be mapped\n"
+               "  --leveleditor       Opens the leveleditor in a file. (Only works when a file is provided.)\n"
                "  -d, --datadir DIR   Load Game data from DIR (default: automatic)\n"
                "  --debug-mode        Enables the debug-mode, which is useful for developers.\n"
                "  --help              Display a help message summarizing command-line\n"
                "                      options, license and game controls.\n"
                "  --usage             Display a brief message summarizing command-line options.\n"
                "  --version           Display the version of SuperTux you're running.\n\n"
-               );
+               ));
           exit(0);
         }
       else if (argv[i][0] != '-')
@@ -1052,7 +1092,7 @@ void usage(char * prog, int ret)
 
   /* Display the usage message: */
 
-  fprintf(fi, "Usage: %s [--fullscreen] [--opengl] [--disable-sound] [--disable-music] [--debug-mode] | [--usage | --help | --version] [--worldmap] FILENAME\n",
+  fprintf(fi, _("Usage: %s [--fullscreen] [--opengl] [--disable-sound] [--disable-music] [--debug-mode] | [--usage | --help | --version] [--leveleditor] FILENAME\n"),
           prog);