3 // SuperTux - A Jump'n Run
4 // Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 #include <SDL_image.h>
31 #include <SDL_opengl.h>
35 #include <sys/types.h>
49 #include "configfile.h"
56 #define mkdir(dir, mode) mkdir(dir)
57 // on win32 we typically don't want LFS paths
59 #define DATA_PREFIX "./data/"
62 /* Local function prototypes: */
65 void usage(char * prog, int ret);
67 /* Does the given file exist and is it accessible? */
68 int faccessible(const char *filename)
71 if (stat(filename, &filestat) == -1)
77 if(S_ISREG(filestat.st_mode))
84 /* Can we write to this location? */
85 int fwriteable(const char *filename)
88 fi = fopen(filename, "wa");
96 /* Makes sure a directory is created in either the SuperTux home directory or the SuperTux base directory.*/
97 int fcreatedir(const char* relative_dir)
100 snprintf(path, 1024, "%s/%s/", st_dir, relative_dir);
101 if(mkdir(path,0755) != 0)
103 snprintf(path, 1024, "%s/%s/", datadir.c_str(), relative_dir);
104 if(mkdir(path,0755) != 0)
119 FILE * opendata(const char * rel_filename, const char * mode)
121 char * filename = NULL;
124 filename = (char *) malloc(sizeof(char) * (strlen(st_dir) +
125 strlen(rel_filename) + 1));
127 strcpy(filename, st_dir);
128 /* Open the high score file: */
130 strcat(filename, rel_filename);
132 /* Try opening the file: */
133 fi = fopen(filename, mode);
137 fprintf(stderr, "Warning: Unable to open the file \"%s\" ", filename);
139 if (strcmp(mode, "r") == 0)
140 fprintf(stderr, "for read!!!\n");
141 else if (strcmp(mode, "w") == 0)
142 fprintf(stderr, "for write!!!\n");
149 /* Get all names of sub-directories in a certain directory. */
150 /* Returns the number of sub-directories found. */
151 /* Note: The user has to free the allocated space. */
152 string_list_type dsubdirs(const char *rel_path,const char* expected_file)
155 struct dirent *direntp;
156 string_list_type sdirs;
160 string_list_init(&sdirs);
161 sprintf(path,"%s/%s",st_dir,rel_path);
162 if((dirStructP = opendir(path)) != NULL)
164 while((direntp = readdir(dirStructP)) != NULL)
166 char absolute_filename[1024];
169 sprintf(absolute_filename, "%s/%s", path, direntp->d_name);
171 if (stat(absolute_filename, &buf) == 0 && S_ISDIR(buf.st_mode))
173 if(expected_file != NULL)
175 sprintf(filename,"%s/%s/%s",path,direntp->d_name,expected_file);
176 if(!faccessible(filename))
180 string_list_add_item(&sdirs,direntp->d_name);
183 closedir(dirStructP);
186 sprintf(path,"%s/%s",datadir.c_str(),rel_path);
187 if((dirStructP = opendir(path)) != NULL)
189 while((direntp = readdir(dirStructP)) != NULL)
191 char absolute_filename[1024];
194 sprintf(absolute_filename, "%s/%s", path, direntp->d_name);
196 if (stat(absolute_filename, &buf) == 0 && S_ISDIR(buf.st_mode))
198 if(expected_file != NULL)
200 sprintf(filename,"%s/%s/%s",path,direntp->d_name,expected_file);
201 if(!faccessible(filename))
207 sprintf(filename,"%s/%s/%s/%s",st_dir,rel_path,direntp->d_name,expected_file);
208 if(faccessible(filename))
213 string_list_add_item(&sdirs,direntp->d_name);
216 closedir(dirStructP);
222 string_list_type dfiles(const char *rel_path, const char* glob, const char* exception_str)
225 struct dirent *direntp;
226 string_list_type sdirs;
229 string_list_init(&sdirs);
230 sprintf(path,"%s/%s",st_dir,rel_path);
231 if((dirStructP = opendir(path)) != NULL)
233 while((direntp = readdir(dirStructP)) != NULL)
235 char absolute_filename[1024];
238 sprintf(absolute_filename, "%s/%s", path, direntp->d_name);
240 if (stat(absolute_filename, &buf) == 0 && S_ISREG(buf.st_mode))
242 if(exception_str != NULL)
244 if(strstr(direntp->d_name,exception_str) != NULL)
248 if(strstr(direntp->d_name,glob) == NULL)
251 string_list_add_item(&sdirs,direntp->d_name);
254 closedir(dirStructP);
257 sprintf(path,"%s/%s",datadir.c_str(),rel_path);
258 if((dirStructP = opendir(path)) != NULL)
260 while((direntp = readdir(dirStructP)) != NULL)
262 char absolute_filename[1024];
265 sprintf(absolute_filename, "%s/%s", path, direntp->d_name);
267 if (stat(absolute_filename, &buf) == 0 && S_ISREG(buf.st_mode))
269 if(exception_str != NULL)
271 if(strstr(direntp->d_name,exception_str) != NULL)
275 if(strstr(direntp->d_name,glob) == NULL)
278 string_list_add_item(&sdirs,direntp->d_name);
281 closedir(dirStructP);
287 void free_strings(char **strings, int num)
290 for(i=0; i < num; ++i)
295 /* Set SuperTux configuration and save directories */
296 void st_directory_setup(void)
300 /* Get home directory (from $HOME variable)... if we can't determine it,
301 use the current directory ("."): */
302 if (getenv("HOME") != NULL)
303 home = getenv("HOME");
307 st_dir = (char *) malloc(sizeof(char) * (strlen(home) +
308 strlen("/.supertux") + 1));
309 strcpy(st_dir, home);
310 strcat(st_dir, "/.supertux");
312 /* Remove .supertux config-file from old SuperTux versions */
313 if(faccessible(st_dir))
319 st_save_dir = (char *) malloc(sizeof(char) * (strlen(st_dir) + strlen("/save") + 1));
321 strcpy(st_save_dir,st_dir);
322 strcat(st_save_dir,"/save");
324 /* Create them. In the case they exist they won't destroy anything. */
326 mkdir(st_save_dir, 0755);
328 sprintf(str, "%s/levels", st_dir);
331 // User has not that a datadir, so we try some magic
336 char exe_file[PATH_MAX];
337 if (readlink("/proc/self/exe", exe_file, PATH_MAX) < 0)
339 puts("Couldn't read /proc/self/exe, using default path: " DATA_PREFIX);
340 datadir = DATA_PREFIX;
344 std::string exedir = std::string(dirname(exe_file)) + "/";
346 datadir = exedir + "../data/"; // SuperTux run from source dir
347 if (access(datadir.c_str(), F_OK) != 0)
349 datadir = exedir + "../share/supertux/"; // SuperTux run from PATH
350 if (access(datadir.c_str(), F_OK) != 0)
351 { // If all fails, fall back to compiled path
352 datadir = DATA_PREFIX;
357 datadir = DATA_PREFIX;
360 printf("Datadir: %s\n", datadir.c_str());
363 /* Create and setup menus. */
366 main_menu = new Menu();
367 options_menu = new Menu();
368 options_controls_menu = new Menu();
369 load_game_menu = new Menu();
370 save_game_menu = new Menu();
371 game_menu = new Menu();
372 highscore_menu = new Menu();
373 contrib_menu = new Menu();
374 contrib_subset_menu = new Menu();
375 worldmap_menu = new Menu();
377 main_menu->set_pos(screen->w/2, 335);
378 main_menu->additem(MN_GOTO, "Start Game",0,load_game_menu);
379 main_menu->additem(MN_GOTO, "Contrib Levels",0,contrib_menu);
380 main_menu->additem(MN_GOTO, "Options",0,options_menu);
381 main_menu->additem(MN_ACTION,"Level editor",0,0);
382 main_menu->additem(MN_ACTION,"Credits",0,0);
383 main_menu->additem(MN_ACTION,"Quit",0,0);
385 options_menu->additem(MN_LABEL,"Options",0,0);
386 options_menu->additem(MN_HL,"",0,0);
388 options_menu->additem(MN_TOGGLE,"OpenGL",use_gl,0);
390 options_menu->additem(MN_DEACTIVE,"OpenGL (not supported)",use_gl,0);
392 options_menu->additem(MN_TOGGLE,"Fullscreen",use_fullscreen,0);
395 options_menu->additem(MN_TOGGLE,"Sound ",use_sound,0);
396 options_menu->additem(MN_TOGGLE,"Music ",use_music,0);
400 options_menu->additem(MN_DEACTIVE,"Sound ",use_sound,0);
401 options_menu->additem(MN_DEACTIVE,"Music ",use_music,0);
403 options_menu->additem(MN_TOGGLE,"Show FPS ",show_fps,0);
404 options_menu->additem(MN_GOTO,"Controls ",0,options_controls_menu);
405 options_menu->additem(MN_HL,"",0,0);
406 options_menu->additem(MN_BACK,"Back",0,0);
408 options_controls_menu->additem(MN_LABEL,"Controls",0,0);
409 options_controls_menu->additem(MN_HL,"",0,0);
410 options_controls_menu->additem(MN_CONTROLFIELD,"Right move", 0,0, &keymap.right);
411 options_controls_menu->additem(MN_CONTROLFIELD,"Left move", 0,0, &keymap.left);
412 options_controls_menu->additem(MN_CONTROLFIELD,"Jump", 0,0, &keymap.jump);
413 options_controls_menu->additem(MN_CONTROLFIELD,"Duck", 0,0, &keymap.duck);
414 options_controls_menu->additem(MN_CONTROLFIELD,"Power", 0,0, &keymap.fire);
415 options_controls_menu->additem(MN_HL,"",0,0);
416 options_controls_menu->additem(MN_BACK,"Back",0,0);
418 load_game_menu->additem(MN_LABEL,"Start Game",0,0);
419 load_game_menu->additem(MN_HL,"",0,0);
420 load_game_menu->additem(MN_DEACTIVE,"Slot 1",0,0);
421 load_game_menu->additem(MN_DEACTIVE,"Slot 2",0,0);
422 load_game_menu->additem(MN_DEACTIVE,"Slot 3",0,0);
423 load_game_menu->additem(MN_DEACTIVE,"Slot 4",0,0);
424 load_game_menu->additem(MN_DEACTIVE,"Slot 5",0,0);
425 load_game_menu->additem(MN_HL,"",0,0);
426 load_game_menu->additem(MN_BACK,"Back",0,0);
428 save_game_menu->additem(MN_LABEL,"Save Game",0,0);
429 save_game_menu->additem(MN_HL,"",0,0);
430 save_game_menu->additem(MN_DEACTIVE,"Slot 1",0,0);
431 save_game_menu->additem(MN_DEACTIVE,"Slot 2",0,0);
432 save_game_menu->additem(MN_DEACTIVE,"Slot 3",0,0);
433 save_game_menu->additem(MN_DEACTIVE,"Slot 4",0,0);
434 save_game_menu->additem(MN_DEACTIVE,"Slot 5",0,0);
435 save_game_menu->additem(MN_HL,"",0,0);
436 save_game_menu->additem(MN_BACK,"Back",0,0);
438 game_menu->additem(MN_LABEL,"Pause",0,0);
439 game_menu->additem(MN_HL,"",0,0);
440 game_menu->additem(MN_ACTION,"Continue",0,0);
441 game_menu->additem(MN_GOTO,"Options",0,options_menu);
442 game_menu->additem(MN_HL,"",0,0);
443 game_menu->additem(MN_ACTION,"Abort Level",0,0);
445 worldmap_menu->additem(MN_LABEL,"Pause",0,0);
446 worldmap_menu->additem(MN_HL,"",0,0);
447 worldmap_menu->additem(MN_ACTION,"Continue",0,0);
448 worldmap_menu->additem(MN_ACTION,"Save",0,0);
449 worldmap_menu->additem(MN_GOTO,"Options",0,options_menu);
450 worldmap_menu->additem(MN_HL,"",0,0);
451 worldmap_menu->additem(MN_ACTION,"Quit Game",0,0);
453 highscore_menu->additem(MN_TEXTFIELD,"Enter your name:",0,0);
456 void update_load_save_game_menu(Menu* pmenu)
458 for(int i = 2; i < 7; ++i)
460 // FIXME: Insert a real savegame struct/class here instead of
461 // doing string vodoo
462 std::string tmp = slotinfo(i - 1);
463 pmenu->item[i].kind = MN_ACTION;
464 pmenu->item[i].change_text(tmp.c_str());
468 bool process_load_game_menu()
470 int slot = load_game_menu->check();
472 if(slot != -1 && load_game_menu->get_item(slot).kind == MN_ACTION)
474 WorldMapNS::WorldMap worldmap;
477 snprintf(slotfile, 1024, "%s/slot%d.stsg", st_save_dir, slot-1);
479 // Load the game or at least set the savegame_file variable
480 worldmap.loadgame(slotfile);
484 Menu::set_current(main_menu);
486 st_pause_ticks_stop();
495 /* Handle changes made to global settings in the options menu. */
496 void process_options_menu(void)
498 switch (options_menu->check())
502 if(use_gl != options_menu->item[2].toggled)
510 if(use_fullscreen != options_menu->item[3].toggled)
512 use_fullscreen = !use_fullscreen;
517 if(use_sound != options_menu->item[4].toggled)
518 use_sound = !use_sound;
521 if(use_music != options_menu->item[5].toggled)
523 enable_music(options_menu->item[5].toggled);
527 if(show_fps != options_menu->item[6].toggled)
528 show_fps = !show_fps;
533 void st_general_setup(void)
535 /* Seed random number generator: */
537 srand(SDL_GetTicks());
539 /* Set icon image: */
543 /* Unicode needed for input handling: */
545 SDL_EnableUNICODE(1);
547 /* Load global images: */
549 black_text = new Text(datadir + "/images/status/letters-black.png", TEXT_TEXT, 16,18);
550 gold_text = new Text(datadir + "/images/status/letters-gold.png", TEXT_TEXT, 16,18);
551 blue_text = new Text(datadir + "/images/status/letters-blue.png", TEXT_TEXT, 16,18);
552 red_text = new Text(datadir + "/images/status/letters-red.png", TEXT_TEXT, 16,18);
553 white_text = new Text(datadir + "/images/status/letters-white.png", TEXT_TEXT, 16,18);
554 white_small_text = new Text(datadir + "/images/status/letters-white-small.png", TEXT_TEXT, 8,9);
555 white_big_text = new Text(datadir + "/images/status/letters-white-big.png", TEXT_TEXT, 20,23);
556 yellow_nums = new Text(datadir + "/images/status/numbers.png", TEXT_NUM, 32,32);
558 /* Load GUI/menu images: */
559 checkbox = new Surface(datadir + "/images/status/checkbox.png", USE_ALPHA);
560 checkbox_checked = new Surface(datadir + "/images/status/checkbox-checked.png", USE_ALPHA);
561 back = new Surface(datadir + "/images/status/back.png", USE_ALPHA);
562 arrow_left = new Surface(datadir + "/images/icons/left.png", USE_ALPHA);
563 arrow_right = new Surface(datadir + "/images/icons/right.png", USE_ALPHA);
565 /* Load the mouse-cursor */
566 mouse_cursor = new MouseCursor( datadir + "/images/status/mousecursor.png",1);
570 void st_general_free(void)
573 /* Free global images: */
580 delete white_small_text;
581 delete white_big_text;
583 /* Free GUI/menu images: */
585 delete checkbox_checked;
590 /* Free mouse-cursor */
597 delete highscore_menu;
598 delete save_game_menu;
599 delete load_game_menu;
602 void st_video_setup(void)
605 SDL_FreeSurface(screen);
607 /* Init SDL Video: */
609 if (SDL_Init(SDL_INIT_VIDEO) < 0)
612 "\nError: I could not initialize video!\n"
613 "The Simple DirectMedia error that occured was:\n"
614 "%s\n\n", SDL_GetError());
622 st_video_setup_sdl();
624 Surface::reload_all();
626 /* Set window manager stuff: */
627 SDL_WM_SetCaption("SuperTux " VERSION, "SuperTux");
630 void st_video_setup_sdl(void)
632 SDL_FreeSurface(screen);
636 screen = SDL_SetVideoMode(640, 480, 0, SDL_FULLSCREEN ) ; /* | SDL_HWSURFACE); */
640 "\nWarning: I could not set up fullscreen video for "
642 "The Simple DirectMedia error that occured was:\n"
643 "%s\n\n", SDL_GetError());
644 use_fullscreen = false;
649 screen = SDL_SetVideoMode(640, 480, 0, SDL_HWSURFACE | SDL_DOUBLEBUF );
654 "\nError: I could not set up video for 640x480 mode.\n"
655 "The Simple DirectMedia error that occured was:\n"
656 "%s\n\n", SDL_GetError());
662 void st_video_setup_gl(void)
666 SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
667 SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
668 SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
669 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
670 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
674 screen = SDL_SetVideoMode(640, 480, 0, SDL_FULLSCREEN | SDL_OPENGL) ; /* | SDL_HWSURFACE); */
678 "\nWarning: I could not set up fullscreen video for "
680 "The Simple DirectMedia error that occured was:\n"
681 "%s\n\n", SDL_GetError());
682 use_fullscreen = false;
687 screen = SDL_SetVideoMode(640, 480, 0, SDL_OPENGL);
692 "\nError: I could not set up video for 640x480 mode.\n"
693 "The Simple DirectMedia error that occured was:\n"
694 "%s\n\n", SDL_GetError());
700 * Set up OpenGL for 2D rendering.
702 glDisable(GL_DEPTH_TEST);
703 glDisable(GL_CULL_FACE);
705 glViewport(0, 0, screen->w, screen->h);
706 glMatrixMode(GL_PROJECTION);
708 glOrtho(0, screen->w, screen->h, 0, -1.0, 1.0);
710 glMatrixMode(GL_MODELVIEW);
712 glTranslatef(0.0f, 0.0f, 0.0f);
718 void st_joystick_setup(void)
725 if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
727 fprintf(stderr, "Warning: I could not initialize joystick!\n"
728 "The Simple DirectMedia error that occured was:\n"
729 "%s\n\n", SDL_GetError());
731 use_joystick = false;
736 if (SDL_NumJoysticks() <= 0)
738 fprintf(stderr, "Warning: No joysticks are available.\n");
740 use_joystick = false;
744 js = SDL_JoystickOpen(joystick_num);
748 fprintf(stderr, "Warning: Could not open joystick %d.\n"
749 "The Simple DirectMedia error that occured was:\n"
750 "%s\n\n", joystick_num, SDL_GetError());
752 use_joystick = false;
756 if (SDL_JoystickNumAxes(js) < 2)
759 "Warning: Joystick does not have enough axes!\n");
761 use_joystick = false;
765 if (SDL_JoystickNumButtons(js) < 2)
769 "Joystick does not have enough buttons!\n");
771 use_joystick = false;
779 void st_audio_setup(void)
782 /* Init SDL Audio silently even if --disable-sound : */
786 if (SDL_Init(SDL_INIT_AUDIO) < 0)
788 /* only print out message if sound or music
789 was not disabled at command-line
791 if (use_sound || use_music)
794 "\nWarning: I could not initialize audio!\n"
795 "The Simple DirectMedia error that occured was:\n"
796 "%s\n\n", SDL_GetError());
798 /* keep the programming logic the same :-)
799 because in this case, use_sound & use_music' values are ignored
800 when there's no available audio device
804 audio_device = false;
809 /* Open sound silently regarless the value of "use_sound": */
813 if (open_audio(44100, AUDIO_S16, 2, 2048) < 0)
815 /* only print out message if sound or music
816 was not disabled at command-line
818 if (use_sound || use_music)
821 "\nWarning: I could not set up audio for 44100 Hz "
823 "The Simple DirectMedia error that occured was:\n"
824 "%s\n\n", SDL_GetError());
828 audio_device = false;
835 /* --- SHUTDOWN --- */
837 void st_shutdown(void)
846 void st_abort(const std::string& reason, const std::string& details)
848 fprintf(stderr, "\nError: %s\n%s\n\n", reason.c_str(), details.c_str());
854 /* Set Icon (private) */
863 /* Load icon into a surface: */
865 icon = IMG_Load((datadir + "/images/icon.xpm").c_str());
869 "\nError: I could not load the icon image: %s%s\n"
870 "The Simple DirectMedia error that occured was:\n"
871 "%s\n\n", datadir.c_str(), "/images/icon.xpm", SDL_GetError());
878 masklen = (((icon -> w) + 7) / 8) * (icon -> h);
879 mask = (Uint8*) malloc(masklen * sizeof(Uint8));
880 memset(mask, 0xFF, masklen);
885 SDL_WM_SetIcon(icon, NULL);//mask);
888 /* Free icon surface & mask: */
891 SDL_FreeSurface(icon);
895 /* Parse command-line arguments: */
897 void parseargs(int argc, char * argv[])
903 /* Parse arguments: */
905 for (i = 1; i < argc; i++)
907 if (strcmp(argv[i], "--fullscreen") == 0 ||
908 strcmp(argv[i], "-f") == 0)
910 /* Use full screen: */
912 use_fullscreen = true;
914 else if (strcmp(argv[i], "--joystick") == 0 || strcmp(argv[i], "-j") == 0)
917 joystick_num = atoi(argv[++i]);
919 else if (strcmp(argv[i], "--joymap") == 0)
922 if (sscanf(argv[++i],
924 &joystick_keymap.x_axis,
925 &joystick_keymap.y_axis,
926 &joystick_keymap.a_button,
927 &joystick_keymap.b_button,
928 &joystick_keymap.start_button) != 5)
930 puts("Warning: Invalid or incomplete joymap, should be: 'XAXIS:YAXIS:A:B:START'");
934 std::cout << "Using new joymap:\n"
935 << " X-Axis: " << joystick_keymap.x_axis << "\n"
936 << " Y-Axis: " << joystick_keymap.y_axis << "\n"
937 << " A-Button: " << joystick_keymap.a_button << "\n"
938 << " B-Button: " << joystick_keymap.b_button << "\n"
939 << " Start-Button: " << joystick_keymap.start_button << std::endl;
942 else if (strcmp(argv[i], "--worldmap") == 0)
944 launch_worldmap_mode = true;
946 else if (strcmp(argv[i], "--datadir") == 0
947 || strcmp(argv[i], "-d") == 0 )
952 else if (strcmp(argv[i], "--show-fps") == 0)
954 /* Use full screen: */
958 else if (strcmp(argv[i], "--opengl") == 0 ||
959 strcmp(argv[i], "-gl") == 0)
967 else if (strcmp(argv[i], "--sdl") == 0)
971 else if (strcmp(argv[i], "--usage") == 0)
977 else if (strcmp(argv[i], "--version") == 0)
980 printf("SuperTux " VERSION "\n");
983 else if (strcmp(argv[i], "--disable-sound") == 0)
985 /* Disable the compiled in sound feature */
986 printf("Sounds disabled \n");
988 audio_device = false;
990 else if (strcmp(argv[i], "--disable-music") == 0)
992 /* Disable the compiled in sound feature */
993 printf("Music disabled \n");
996 else if (strcmp(argv[i], "--debug-mode") == 0)
998 /* Enable the debug-mode */
1002 else if (strcmp(argv[i], "--help") == 0)
1004 puts("Super Tux " VERSION "\n"
1005 " Please see the file \"README.txt\" for more details.\n");
1006 printf("Usage: %s [OPTIONS] FILENAME\n\n", argv[0]);
1007 puts("Display Options:\n"
1008 " --fullscreen Run in fullscreen mode.\n"
1009 " --opengl If opengl support was compiled in, this will enable\n"
1010 " the EXPERIMENTAL OpenGL mode.\n"
1011 " --sdl Use non-opengl renderer\n"
1014 " --disable-sound If sound support was compiled in, this will\n"
1015 " disable sound for this session of the game.\n"
1016 " --disable-music Like above, but this will disable music.\n"
1019 " -j, --joystick NUM Use joystick NUM (default: 0)\n"
1020 " --joymap XAXIS:YAXIS:A:B:START\n"
1021 " Define how joystick buttons and axis should be mapped\n"
1022 " --worldmap Start in worldmap-mode (EXPERIMENTAL)\n"
1023 " -d, --datadir DIR Load Game data from DIR (default: automatic)\n"
1024 " --debug-mode Enables the debug-mode, which is useful for developers.\n"
1025 " --help Display a help message summarizing command-line\n"
1026 " options, license and game controls.\n"
1027 " --usage Display a brief message summarizing command-line options.\n"
1028 " --version Display the version of SuperTux you're running.\n\n"
1032 else if (argv[i][0] != '-')
1034 level_startup_file = argv[i];
1038 /* Unknown - complain! */
1046 /* Display usage: */
1048 void usage(char * prog, int ret)
1053 /* Determine which stream to write to: */
1061 /* Display the usage message: */
1063 fprintf(fi, "Usage: %s [--fullscreen] [--opengl] [--disable-sound] [--disable-music] [--debug-mode] | [--usage | --help | --version] [--worldmap] FILENAME\n",