1 diff -purN bomberclone-0.11.8.orig/src/configuration.c bomberclone-0.11.8/src/configuration.c
2 --- bomberclone-0.11.8.orig/src/configuration.c 2010-01-21 19:34:52.000000000 +0100
3 +++ bomberclone-0.11.8/src/configuration.c 2010-01-21 19:40:17.000000000 +0100
4 @@ -545,6 +545,7 @@ config_video ()
7 _charlist screenres[] = {
12 diff -purN bomberclone-0.11.8.orig/src/configuration.c~ bomberclone-0.11.8/src/configuration.c~
13 --- bomberclone-0.11.8.orig/src/configuration.c~ 1970-01-01 01:00:00.000000000 +0100
14 +++ bomberclone-0.11.8/src/configuration.c~ 2010-01-21 19:38:07.000000000 +0100
16 +/* $Id: configuration.c,v 1.82 2007/12/07 22:06:57 stpohle Exp $
22 +#include "bomberclone.h"
34 + * try to find the datapath and set the variable bman.datapath
35 + * test: 1) PACKAGE_DATA_DIR
40 +config_get_datapath ()
45 + sprintf (bman.datapath, PACKAGE_DATA_DIR);
46 + sprintf (filename, "%s/gfx/logo.png", bman.datapath);
47 + f = fopen (filename, "r");
50 + sprintf (bman.datapath, "data");
51 + sprintf (filename, "%s/gfx/logo.png", bman.datapath);
52 + f = fopen (filename, "r");
54 + sprintf (bman.datapath, "../data");
55 + sprintf (filename, "%s/gfx/logo.png", bman.datapath);
56 + f = fopen (filename, "r");
58 + printf ("Can't find Datafiles.\n");
68 + * reset all variables and load all configs.
71 +config_init (int argc, char **argv)
73 + SDL_Surface *icon_img;
79 + config_get_datapath ();
81 + srand (((int) time (NULL))); // initialize randomgenerator
83 + for (i = 0; i < MAX_TEAMS; i++) {
85 + sprintf (teams[i].name, "Team %d", i + 1);
86 + for (j = 0; j < MAX_PLAYERS; j++)
87 + teams[i].players[j] = NULL;
91 + chat.oldscreen = NULL;
94 + keyb_config_reset ();
95 + keybinput_new (&chat.input, KEYBI_text, 255);
97 + for (i = 0; i < CHAT_MAX_LINES; i++)
98 + chat.lines[i].text[0] = 0;
100 + bman.maxplayer = MAX_PLAYERS;
101 + bman.net_ai_family = PF_INET;
105 + bman.gamename[0] = 0;
106 + sprintf (bman.playername, "Player1");
107 + sprintf (bman.player2name, "Player2");
108 + sprintf (bman.port, "%d", DEFAULT_UDPPORT);
109 + sprintf (bman.ogcserver, DEFAULT_GAMECACHE);
110 + sprintf (bman.ogc_port, DEFAULT_GAMECACHEPORT);
112 + bman.notifygamemaster = 1;
113 + bman.broadcast = 1;
114 + bman.autostart = AUTOSTART;
115 + bman.askplayername = 0;
120 + gfx.players = NULL;
121 + bman.password[0] = 0;
122 + bman.passwordenabled = 0;
123 + map.tileset[0] = 0;
124 + map.random_tileset = 1;
128 + map.map_selection = 2;
131 + bman.init_timeout = GAME_TIMEOUT;
132 + bman.ai_players = 1;
133 + bman.minplayers = 0;
135 + snd.audio_rate = 22050;
136 + snd.audio_format = AUDIO_S16;
137 + snd.audio_channels = 2;
140 + map.bombs = GAME_SPECIAL_ITEMBOMB;
141 + map.fire = GAME_SPECIAL_ITEMFIRE;
142 + map.shoes = GAME_SPECIAL_ITEMSHOE;
143 + map.mixed = GAME_SPECIAL_ITEMMIXED;
144 + map.death = GAME_SPECIAL_ITEMDEATH;
145 + map.sp_trigger = GAME_SPECIAL_ITEMSTRIGGER;
146 + map.sp_row = GAME_SPECIAL_ITEMSROW;
147 + map.sp_push = GAME_SPECIAL_ITEMSPUSH;
148 + map.sp_kick = GAME_SPECIAL_ITEMSKICK;
150 + bman.start_bombs = START_BOMBS;
151 + bman.start_speed = START_SPEED;
152 + bman.start_range = START_RANGE;
153 + bman.bomb_tickingtime = BOMB_TIMEOUT;
154 + bman.dropitemsondeath = 0;
155 + d_printf ("\n\n ***** Bomberclone Version %s \n\n", VERSION);
158 + ReadPrgArgs (argc, argv);
162 + if (bman.askplayername)
168 + SDL_Flip (gfx.screen);
170 + sprintf (text, "Bomberclone %s", VERSION);
171 + sprintf (icon, "%s/pixmaps/bomberclone.png", bman.datapath);
172 + SDL_WM_SetCaption (text, NULL);
173 + icon_img = IMG_Load (icon);
174 + if (icon_img == NULL)
175 + d_printf ("could not load icon. (%s)\n", icon);
179 + SDL_Surface *tmp = icon_img;
180 + icon_img = scale_image (tmp, 32, 32);
181 + SDL_FreeSurface (tmp);
184 + SDL_WM_SetIcon (icon_img, NULL);
186 + ReadPrgArgs_Jump (argc, argv);
190 +/* read the configuration file
191 + * return -1 if something went wrong and 0 if no problem */
201 + char filename[512];
204 + sprintf (filename, "%sbomberclone.cfg", s_gethomedir ());
206 + sprintf (filename, "%s.bomberclone.cfg", s_gethomedir ());
209 + config = fopen (filename, "r");
210 + if (config == NULL) {
211 + d_printf ("Error: Config file not found!\n");
214 + d_printf ("Reading Config-file: %s", filename);
216 + while (fgets (buf, sizeof (buf), config) != NULL) {
217 + findit = strchr (buf, '\n');
220 + if (buf[0] == '\0')
224 + while (isspace (*keyword))
227 + value = strchr (buf, '=');
232 + while (*value == ' ')
234 + while (keyword[strlen (keyword) - 1] == ' ')
235 + keyword[strlen (keyword) - 1] = 0;
236 + while (value[strlen (value) - 1] == ' ')
237 + value[strlen (value) - 1] = 0;
238 + if (strlen (value) == 0)
240 + for (i = 0; i < (int) strlen (keyword); i++)
241 + keyword[i] = tolower (keyword[i]);
243 + if (!strcmp (keyword, "playername")) {
244 + if (strlen (value) > LEN_PLAYERNAME) {
246 + ("*** Error - playername too long (maximum size permitted is %d characters)!\n\n",
249 + value[LEN_PLAYERNAME - 1] = 0;
250 + strcpy (bman.playername, value);
253 + if (!strcmp (keyword, "player2name")) {
254 + if (strlen (value) > LEN_PLAYERNAME) {
256 + ("*** Error - playername too long (maximum size permitted is %d characters)!\n\n",
259 + value[LEN_PLAYERNAME - 1] = 0;
260 + strcpy (bman.player2name, value);
263 + if (!strcmp (keyword, "gamename")) {
264 + if (strlen (value) > LEN_GAMENAME) {
266 + ("*** Error - servername too long (maximum size permitted is %d characters)!\n\n",
269 + value[LEN_GAMENAME - 1] = 0;
270 + strcpy (bman.gamename, value);
272 + if (!strcmp (keyword, "askplayername")) {
273 + bman.askplayername = atoi (value);
275 + if (!strcmp (keyword, "password")) {
276 + if (strlen (value) > LEN_PASSWORD) {
278 + ("*** Error - Password is too long (maximum size permitted is %d characters)!\n\n",
281 + value[LEN_PASSWORD - 1] = 0;
282 + strcpy (bman.password, value);
284 + if (!strcmp (keyword, "passwordenabled")) {
285 + bman.passwordenabled = atoi (value);
287 + if (!strcmp (keyword, "resolutionx")) {
288 + gfx.res.x = atoi (value);
290 + if (!strcmp (keyword, "resolutiony")) {
291 + gfx.res.y = atoi (value);
293 + if (!strcmp (keyword, "tileset")) {
294 + strcpy (map.tileset, value);
296 + if (!strcmp (keyword, "mapname")) {
297 + if (strlen (value) > LEN_PATHFILENAME) {
299 + ("*** Error - fieldpath too long (maximum size permitted is %d characters)!\n\n",
303 + strcpy (map.map, value);
305 + if (!strcmp (keyword, "udpport")) {
306 + if (strlen (value) > LEN_PORT) {
308 + ("*** Error - servername too long (maximum size permitted is %d characters)!\n\n",
311 + value[LEN_PORT - 1] = 0;
312 + strcpy (bman.port, value);
314 + if (!strcmp (keyword, "ai_players")) {
315 + bman.ai_players = atoi (value);
317 + if (!strcmp (keyword, "fieldsizex")) {
318 + map.size.x = atoi (value);
320 + if (!strcmp (keyword, "fieldsizey")) {
321 + map.size.y = atoi (value);
323 + if (!strcmp (keyword, "fullscreen")) {
324 + gfx.fullscreen = atoi (value);
326 + if (!strcmp (keyword, "bitsperpixel")) {
327 + gfx.bpp = atoi (value);
329 + if (!strcmp (keyword, "ai_family")) {
330 + bman.net_ai_family = atoi (value);
332 + if (!strcmp (keyword, "debug")) {
333 + debug = atoi (value);
335 + if (!strcmp (keyword, "notify")) {
336 + bman.notifygamemaster = atoi (value);
338 + if (!strcmp (keyword, "broadcast")) {
339 + bman.broadcast = atoi (value);
341 + if (!strcmp (keyword, "ogcserver")) {
342 + strcpy (bman.ogcserver, value);
344 + if (!strcmp (keyword, "ogc_port")) {
345 + strcpy (bman.ogc_port, value);
347 + if (!strcmp (keyword, "maxplayer")) {
348 + bman.maxplayer = atoi (value);
350 + if (!strcmp (keyword, "mapselection")) {
351 + map.map_selection = atoi (value);
353 + if (!strcmp (keyword, "randomtileset")) {
354 + map.random_tileset = atoi (value);
356 + if (!strcmp (keyword, "gametimeout")) {
357 + bman.init_timeout = atoi (value);
359 + if (!strcmp (keyword, "gametype")) {
360 + bman.gametype = atoi (value);
362 + if (!strcmp (keyword, "sndrate")) {
363 + snd.audio_rate = atoi (value);
365 + if (!strcmp (keyword, "sndchannels")) {
366 + snd.audio_channels = atoi (value);
368 + if (!strcmp (keyword, "sndformat")) {
369 + snd.audio_format = atoi (value);
371 + if (!strcmp (keyword, "sndplaymusic")) {
372 + snd.playmusic = atoi (value);
374 + if (!strcmp (keyword, "sndplaysound")) {
375 + snd.playsound = atoi (value);
377 + if (!strcmp (keyword, "start_bombs")) {
378 + bman.start_bombs = atoi (value);
380 + if (!strcmp (keyword, "start_range")) {
381 + bman.start_range = atoi (value);
383 + if (!strcmp (keyword, "start_speed")) {
384 + sscanf (value, "%f", &bman.start_speed);
386 + if (!strcmp (keyword, "special_trigger")) {
387 + sscanf (value, "%d", &map.sp_trigger);
389 + if (!strcmp (keyword, "special_row")) {
390 + sscanf (value, "%d", &map.sp_row);
392 + if (!strcmp (keyword, "special_push")) {
393 + sscanf (value, "%d", &map.sp_push);
395 + if (!strcmp (keyword, "special_kick")) {
396 + sscanf (value, "%d", &map.sp_kick);
398 + if (!strcmp (keyword, "bomb_ticking")) {
399 + sscanf (value, "%f", &bman.bomb_tickingtime);
401 + if (!strcmp (keyword, "dropitemsondeath")) {
402 + bman.dropitemsondeath = atoi (value);
405 + for (i = 0; i < MAX_TEAMS; i++) {
407 + sprintf (txt, "teamcol%d", i);
408 + if (!strcmp (keyword, txt)) {
409 + teams[i].col = atoi (value);
411 + sprintf (txt, "teamname%d", i);
412 + if (!strcmp (keyword, txt)) {
413 + strncpy (teams[i].name, value, LEN_PLAYERNAME);
418 + * keyboard config, i will give names to the keys insteed of the numbers,
419 + * this is done to add more keys to the game without destroying the config.
421 + if (!strcmp (keyword, "key_p1_up"))
422 + keyb_gamekeys.keycode[BCPK_up] = atoi (value);
423 + if (!strcmp (keyword, "key_p1_down"))
424 + keyb_gamekeys.keycode[BCPK_down] = atoi (value);
425 + if (!strcmp (keyword, "key_p1_left"))
426 + keyb_gamekeys.keycode[BCPK_left] = atoi (value);
427 + if (!strcmp (keyword, "key_p1_right"))
428 + keyb_gamekeys.keycode[BCPK_right] = atoi (value);
429 + if (!strcmp (keyword, "key_p1_bomb"))
430 + keyb_gamekeys.keycode[BCPK_drop] = atoi (value);
431 + if (!strcmp (keyword, "key_p1_special"))
432 + keyb_gamekeys.keycode[BCPK_special] = atoi (value);
434 + if (!strcmp (keyword, "key_p2_up"))
435 + keyb_gamekeys.keycode[BCPK_max + BCPK_up] = atoi (value);
436 + if (!strcmp (keyword, "key_p2_down"))
437 + keyb_gamekeys.keycode[BCPK_max + BCPK_down] = atoi (value);
438 + if (!strcmp (keyword, "key_p2_left"))
439 + keyb_gamekeys.keycode[BCPK_max + BCPK_left] = atoi (value);
440 + if (!strcmp (keyword, "key_p2_right"))
441 + keyb_gamekeys.keycode[BCPK_max + BCPK_right] = atoi (value);
442 + if (!strcmp (keyword, "key_p2_bomb"))
443 + keyb_gamekeys.keycode[BCPK_max + BCPK_drop] = atoi (value);
444 + if (!strcmp (keyword, "key_p2_special"))
445 + keyb_gamekeys.keycode[BCPK_max + BCPK_special] = atoi (value);
447 + if (!strcmp (keyword, "key_help"))
448 + keyb_gamekeys.keycode[BCK_help] = atoi (value);
449 + if (!strcmp (keyword, "key_playermenu"))
450 + keyb_gamekeys.keycode[BCK_playermenu] = atoi (value);
451 + if (!strcmp (keyword, "key_mapmenu"))
452 + keyb_gamekeys.keycode[BCK_mapmenu] = atoi (value);
453 + if (!strcmp (keyword, "key_chat"))
454 + keyb_gamekeys.keycode[BCK_chat] = atoi (value);
455 + if (!strcmp (keyword, "key_pause"))
456 + keyb_gamekeys.keycode[BCK_pause] = atoi (value);
457 + if (!strcmp (keyword, "key_fullscreen"))
458 + keyb_gamekeys.keycode[BCK_fullscreen] = atoi (value);
470 + char filename[512];
473 + sprintf (filename, "%sbomberclone.cfg", s_gethomedir ());
475 + sprintf (filename, "%s.bomberclone.cfg", s_gethomedir ());
477 + if ((config = fopen (filename, "w")) == NULL)
479 + fprintf (config, "resolutionx=%d\n", gfx.res.x);
480 + fprintf (config, "resolutiony=%d\n", gfx.res.y);
481 + fprintf (config, "fullscreen=%d\n", gfx.fullscreen);
482 + fprintf (config, "tileset=%s\n", map.tileset);
483 + fprintf (config, "mapname=%s\n", map.map);
484 + fprintf (config, "udpport=%s\n", bman.port);
485 + fprintf (config, "ai_players=%d\n", bman.ai_players);
486 + fprintf (config, "fieldsizex=%d\n", map.size.x);
487 + fprintf (config, "fieldsizey=%d\n", map.size.y);
488 + fprintf (config, "notify=%d\n", bman.notifygamemaster);
489 + fprintf (config, "broadcast=%d\n", bman.broadcast);
490 + fprintf (config, "ai_family=%d\n", bman.net_ai_family);
491 + fprintf (config, "ogcserver=%s\n", bman.ogcserver);
492 + fprintf (config, "ogc_port=%s\n", bman.ogc_port);
493 + fprintf (config, "gamename=%s\n", bman.gamename);
494 + fprintf (config, "gametimeout=%d\n", bman.init_timeout);
495 + fprintf (config, "gametype=%d\n", bman.gametype);
496 + fprintf (config, "maxplayer=%d\n", bman.maxplayer);
497 + fprintf (config, "debug=%d\n", debug);
498 + fprintf (config, "password=%s\n", bman.password);
499 + fprintf (config, "passwordenabled=%d\n", bman.passwordenabled);
500 + fprintf (config, "askplayername=%d\n", bman.askplayername);
501 + fprintf (config, "playername=%s\n", bman.playername);
502 + fprintf (config, "player2name=%s\n", bman.player2name);
503 + fprintf (config, "bitsperpixel=%d\n", gfx.bpp);
504 + fprintf (config, "randomtileset=%d\n", map.random_tileset);
505 + fprintf (config, "mapselection=%d\n", map.map_selection);
506 + fprintf (config, "sndrate=%d\n", snd.audio_rate);
507 + fprintf (config, "sndchannels=%d\n", snd.audio_channels);
508 + fprintf (config, "sndformat=%d\n", snd.audio_format);
509 + fprintf (config, "sndplaymusic=%d\n", snd.playmusic);
510 + fprintf (config, "sndplaysound=%d\n", snd.playsound);
511 + fprintf (config, "start_bombs=%d\n", bman.start_bombs);
512 + fprintf (config, "start_range=%d\n", bman.start_range);
513 + fprintf (config, "start_speed=%f\n", bman.start_speed);
514 + fprintf (config, "special_trigger=%d\n", map.sp_trigger);
515 + fprintf (config, "special_row=%d\n", map.sp_row);
516 + fprintf (config, "special_push=%d\n", map.sp_push);
517 + fprintf (config, "special_kick=%d\n", map.sp_kick);
519 + fprintf (config, "bomb_ticking=%f\n", bman.bomb_tickingtime);
520 + fprintf (config, "dropitemsondeath=%d\n",bman.dropitemsondeath);
522 + for (i = 0; i < MAX_TEAMS; i++) {
523 + fprintf (config, "teamcol%d=%d\n", i, teams[i].col);
524 + fprintf (config, "teamname%d=%s\n", i, teams[i].name);
530 + fprintf (config, "key_p1_up=%d\n", keyb_gamekeys.keycode[BCPK_up]);
531 + fprintf (config, "key_p1_down=%d\n", keyb_gamekeys.keycode[BCPK_down]);
532 + fprintf (config, "key_p1_left=%d\n", keyb_gamekeys.keycode[BCPK_left]);
533 + fprintf (config, "key_p1_right=%d\n", keyb_gamekeys.keycode[BCPK_right]);
534 + fprintf (config, "key_p1_bomb=%d\n", keyb_gamekeys.keycode[BCPK_drop]);
535 + fprintf (config, "key_p1_special=%d\n", keyb_gamekeys.keycode[BCPK_special]);
536 + fprintf (config, "key_p2_up=%d\n", keyb_gamekeys.keycode[BCPK_max + BCPK_up]);
537 + fprintf (config, "key_p2_down=%d\n", keyb_gamekeys.keycode[BCPK_max + BCPK_down]);
538 + fprintf (config, "key_p2_left=%d\n", keyb_gamekeys.keycode[BCPK_max + BCPK_left]);
539 + fprintf (config, "key_p2_right=%d\n", keyb_gamekeys.keycode[BCPK_max + BCPK_right]);
540 + fprintf (config, "key_p2_bomb=%d\n", keyb_gamekeys.keycode[BCPK_max + BCPK_drop]);
541 + fprintf (config, "key_p2_special=%d\n", keyb_gamekeys.keycode[BCPK_max + BCPK_special]);
542 + fprintf (config, "key_help=%d\n", keyb_gamekeys.keycode[BCK_help]);
543 + fprintf (config, "key_fullscreen=%d\n", keyb_gamekeys.keycode[BCK_fullscreen]);
544 + fprintf (config, "key_chat=%d\n", keyb_gamekeys.keycode[BCK_chat]);
545 + fprintf (config, "key_mapmenu=%d\n", keyb_gamekeys.keycode[BCK_mapmenu]);
546 + fprintf (config, "key_pause=%d\n", keyb_gamekeys.keycode[BCK_pause]);
547 + fprintf (config, "key_playermenu=%d\n", keyb_gamekeys.keycode[BCK_playermenu]);
562 + _charlist screenres[] = {
566 + {"1024x768", NULL},
567 + {"1280x1024", NULL},
568 + {"1600x1200", NULL},
569 + {"1920x1080", NULL},
570 + {"1920x1200", NULL},
573 + _charlist screenbpp[] = {
578 + _charlist *selres = NULL;
579 + _charlist *selbpp = NULL;
584 + /* set all pointers in this array */
585 + charlist_fillarraypointer (screenres, 6);
586 + charlist_fillarraypointer (screenbpp, 3);
588 + /* select the current settings */
589 + sprintf (text, "%dx%d", gfx.res.x, gfx.res.y);
590 + selres = charlist_findtext (screenres, text);
591 + sprintf (text, "%d", gfx.bpp);
592 + selbpp = charlist_findtext (screenbpp, text);
594 + while (!done && bman.state != GS_quit) {
595 + menu = menu_new ("Video Setup", 325, 300);
596 + menu_create_label (menu, "Resolution", 25, 70, 0, COLOR_brown);
597 + menu_create_list (menu, "res", 155, 55, 150, 85, screenres, &selres, 1);
598 + menu_create_label (menu, "Colors", 65, 170, 0, COLOR_brown);
599 + menu_create_list (menu, "bpp", 195, 155, 50, 55, screenbpp, &selbpp, 2);
600 + menu_create_bool (menu, "Fullscreen", -1, 220, 150, &gfx.fullscreen, 3);
601 + menu_create_button (menu, "OK", -1, 260, 100, 0);
602 + menuselect = menu_loop (menu);
603 + menu_delete (menu);
605 + switch (menuselect) {
611 + case (1): // new resolution
613 + sscanf (selres->text, "%dx%d", &x, &y);
619 + case (2): // new color depth
621 + sscanf (selbpp->text, "%d", &x);
632 + SDL_Flip (gfx.screen);
639 +/* Configuration Menu */
643 + int menuselect = 0;
646 + while (menuselect != -1 && bman.state != GS_quit) {
647 + menu = menu_new ("Configuration", 400, 300);
648 + menu_create_label (menu, "General Option", -1, 50, 1, COLOR_brown);
649 + menu_create_button (menu, "Playernames", 25, 85, 150, 1);
650 + menu_create_button (menu, "Keyboard", 225, 85, 150, 2);
651 + menu_create_button (menu, "Video Setup", -1, 120, 200, 3);
652 + menu_create_label (menu, "Sound", 25, 154, 0, COLOR_brown);
653 + menu_create_bool (menu, "ON", 100, 150, 50, &snd.playsound, 4);
654 + menu_create_label (menu, "Music", 250, 154, 0, COLOR_brown);
655 + menu_create_bool (menu, "ON", 325, 150, 50, &snd.playmusic, 5);
656 + menu_create_label (menu, "Extended Option", -1, 200, 1, COLOR_brown);
657 + menu_create_bool (menu, "Debug", 25, 230, 150, &debug, 6);
658 + menu_create_bool (menu, "Ask Playername", 250, 230, 150, &bman.askplayername, 7);
659 + menu_create_button (menu, "Ok", -1, 270, 150, 0);
660 + if (bman.playername[0] == '\0')
661 + menu_focus_id (menu, 1);
663 + menu_focus_id (menu, 0);
665 + menu_reload (menu);
666 + menuselect = menu_loop (menu);
668 + menu_delete (menu);
669 + switch (menuselect) {
670 + case (0): // Back to the Main Menu
671 + if (bman.playername[0] == '\0')
676 + case (1): // player screen
679 + case (2): // keyboard settings
682 + case (3): // Screen Options
691 +/* Read Programm parameter */
693 +ReadPrgArgs (int argc, char **argv)
697 + while (argv[++i] != NULL) {
698 + if (!strcmp (argv[i], "-h")||!strcmp (argv[i], "-help")||!strcmp (argv[i], "--help")) {
699 + printf ("BomberClone Version " VERSION "\n");
700 + printf (" WebPage : http://www.bomberclone.de\n");
701 + printf (" Bug Report to :\n");
702 + printf (" http://sourceforge.net/tracker/?group_id=79449&atid=556629\n");
703 + printf (" Other Comments: steffen@bomberclone.de\n");
704 + printf ("\nProgramm options:\n");
705 + printf (" -name PLAYERNAME - set the Playername\n");
706 + printf (" -name2 PLAYERNAME - set the Playername for the second player\n");
707 + printf (" -gamename GAMENAME - set the name of the game\n");
708 + printf (" -port PORT - set the local BomberClone port\n");
709 + printf (" (Def.: 11000)\n");
710 + printf (" -ogcport PORT - set the local OGC Port (Def.: 11100)\n");
711 + printf (" -ogc 0/1 - Enable/Disable OGC\n");
712 + printf (" -broadcast 0/1 - Enable/Disable broadcast requests.\n");
713 + printf (" -host - start a network game\n");
714 + printf (" -join - go into the join menu\n");
715 + printf (" -connect ADDRESS - connect to a server\n");
716 + printf (" -debug 0/1 - enable/disable debug\n");
717 + printf (" -autostart SECONDS - time before a game starts\n");
722 + while (argv[++i] != NULL) {
723 + if (argv[i][0]=='-') {
724 + if (argv[i+1] != NULL)
728 + if (!strcmp (argv[i], "-port")) {
730 + strncpy (bman.port, argv[++i], LEN_PORT);
732 + printf("Error: Parameter required for -port\n");
736 + if (!strcmp (argv[i], "-ogcport")) {
738 + strncpy (bman.ogc_port, argv[++i], LEN_PORT);
740 + printf("Error: Parameter required for -ogcport\n");
744 + if (!strcmp (argv[i], "-name")) {
746 + strncpy (bman.playername, argv[++i], LEN_PLAYERNAME);
748 + printf("Error: Parameter required for -name\n");
752 + if (!strcmp (argv[i], "-name2")) {
754 + strncpy (bman.player2name, argv[++i], LEN_PLAYERNAME);
756 + printf("Error: Parameter required for -name2\n");
760 + if (!strcmp (argv[i], "-gamename")) {
762 + strncpy (bman.gamename, argv[++i], LEN_GAMENAME);
764 + printf("Error: Parameter required for -gamename\n");
768 + if (!strcmp (argv[i], "-autostart")) {
770 + bman.autostart = atoi (argv[++i]);
772 + printf("Error: Parameter required for -autostart\n");
776 + if (!strcmp (argv[i], "-ogc")) {
778 + bman.notifygamemaster = atoi (argv[++i]);
780 + bman.notifygamemaster = 1;
782 + if (!strcmp (argv[i], "-broadcast")) {
784 + bman.broadcast = atoi (argv[++i]);
786 + bman.broadcast = 1;
788 + if (!strcmp (argv[i], "-debug")) {
790 + debug = atoi (argv[++i]);
800 +/* Read Programm Parameter which will drop us in a special menu */
802 +ReadPrgArgs_Jump (int argc, char **argv)
806 + while (argv[++i] != NULL) {
807 + /* check for commands which will put us into a certain menu */
808 + if (!strcmp (argv[i], "-host")) {
809 + host_multiplayer_game ();
811 + else if (!strcmp (argv[i], "-join")) {
812 + join_multiplayer_game ();
814 + else if (!strcmp (argv[i], "-connect")) {
815 + strncpy (bman.servername, argv[++i], LEN_SERVERNAME + LEN_PORT + 2);
816 + join_multiplayer_game ();
822 +/* check the version number, return [ 0 =] [-1 <] [ 1 >] */
824 +check_version (int ma, int mi, int su, char *ver)
831 + sscanf (ver, "%d.%d.%d", &v1, &v2, &v3);
845 + // d_printf ("version_check (%d.%d.%d, %s = %d\n" , ma, mi, su, ver, res);