1 //-------------------------------------------------------------------------
2 /*
3 Copyright (C) 2016 EDuke32 developers and contributors
4 
5 This file is part of EDuke32.
6 
7 EDuke32 is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License version 2
9 as published by the Free Software Foundation.
10 
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.
14 
15 See the GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 */
21 //-------------------------------------------------------------------------
22 
23 #include "duke3d.h"
24 #include "demo.h"
25 #include "screens.h"
26 #include "renderlayer.h"
27 #include "cmdline.h"
28 
29 int32_t g_commandSetup = 0;
30 int32_t g_noSetup = 0;
31 int32_t g_noAutoLoad = 0;
32 int32_t g_noSound = 0;
33 int32_t g_noMusic = 0;
34 const char *CommandMap = NULL;
35 const char *CommandName = NULL;
36 int32_t g_forceWeaponChoice = 0;
37 int32_t g_fakeMultiMode = 0;
38 
G_ShowParameterHelp(void)39 void G_ShowParameterHelp(void)
40 {
41     static char const s[] = "Usage: " APPBASENAME " [files] [options]\n"
42         "Example: " APPBASENAME " -usecwd -cfg myconfig.cfg -map nukeland.map\n\n"
43         "Files can be of type [grp|zip|map|con|def]\n"
44         "\n"
45         "-cfg [file.cfg]\tUse an alternate configuration file\n"
46 #ifdef HAVE_CLIPSHAPE_FEATURE
47         "-clipmap [file.map]\tLoad an additional clipping map for use with clipshape\n"
48 #endif
49         "-connect [host]\tConnect to a multiplayer game\n"
50         "-c#\t\tMultiplayer mode #, 1 = DM, 2 = Co-op, 3 = DM(no spawn)\n"
51         "-d [file.edm or #]\tPlay a demo\n"
52         "-g [file.grp]\tLoad additional game data\n"
53         "-h [file.def]\tLoad an alternate definitions file\n"
54         "-j [dir]\t\tAdd a directory to " APPNAME "'s search list\n"
55         "-l#\t\tStart game on level #, see -v\n"
56         "-map [file.map]\tLoad an external map file\n"
57         "-mh [file.def]\tInclude an additional definitions module\n"
58         "-mx [file.con]\tInclude an additional CON script module\n"
59         "-m\t\tDisable enemies\n"
60         "-noffire\t\tDisable friendly fire\n"
61 #ifndef EDUKE32_STANDALONE
62         "-nam\t\tRun in NAM compatibility mode\n"
63         "-napalm\t\tRun in NAPALM compatibility mode\n"
64 #endif
65 #if defined VW_ENABLED
66         "-nosteam\t\tDisable Steam support\n"
67 #endif
68         "-rts [file.rts]\tLoad a custom Remote Ridicule sound bank\n"
69         "-r\t\tRecord demo\n"
70         "-s#\t\tStart game on skill level #\n"
71         "-server\t\tStart a multiplayer server\n"
72 #ifdef STARTUP_SETUP_WINDOW
73         "-setup/nosetup\tEnable or disable startup window\n"
74 #endif
75         "-t#\t\tRespawn mode: 1 = enemies, 2 = weapons, 3 = items, x = all\n"
76         "-usecwd\t\tRead data and configuration from current directory\n"
77         "-u#########\tUser's favorite weapon order (default: 3425689071)\n"
78         "-v#\t\tStart game on episode #, see -l\n"
79 #ifndef EDUKE32_STANDALONE
80         "-ww2gi\t\tRun in WWII GI compatibility mode\n"
81 #endif
82         "-x [game.con]\tLoad custom CON script\n"
83         "-#\t\tLoad and run a game from slot # (0-9)\n"
84         //              "\n-?/--help\tDisplay this help message and exit\n"
85         "\nSee " APPBASENAME " -debughelp for additional parameters for debugging"
86         ;
87 #ifdef WM_MSGBOX_WINDOW
88     Bsnprintf(tempbuf, sizeof(tempbuf), HEAD2 " %s", s_buildRev);
89     wm_msgbox(tempbuf, s);
90 #else
91     initprintf("%s\n", s);
92 #endif
93 }
94 
G_ShowDebugHelp(void)95 void G_ShowDebugHelp(void)
96 {
97     static char const s[] = "Usage: " APPBASENAME " [files] [options]\n"
98         "\n"
99 #if 0
100         "-a\t\tUse fake player AI (fake multiplayer only)\n"
101 #endif
102         "-cachesize #\tSet cache size in kB\n"
103         "-game_dir [dir]\tSpecify game data directory\n"
104         "-gamegrp   \tSelect main grp file\n"
105         "-name [name]\tPlayer name in multiplayer\n"
106         "-noautoload\tDisable loading from autoload directory\n"
107 #if defined RENDERTYPEWIN
108         "-nodinput\t\tDisable DirectInput (joystick) support\n"
109 #endif
110         "-nologo\t\tSkip intro anim\n"
111         "-ns\t\tDisable sound\n"
112         "-nm\t\tDisable music\n"
113         "-q#\t\tFake multiplayer with # players\n"
114         "-z#/-condebug\tEnable line-by-line CON compile debugging at level #\n"
115         "-conversion YYYYMMDD\tSelects CON script version for compatibility with older mods\n"
116         "-rotatesprite-no-widescreen\tStretch screen drawing from scripts to fullscreen\n"
117         ;
118 #ifdef WM_MSGBOX_WINDOW
119     Bsnprintf(tempbuf, sizeof(tempbuf), HEAD2 " %s", s_buildRev);
120     wm_msgbox(tempbuf, s);
121 #else
122     initprintf("%s\n", s);
123 #endif
124 }
125 
G_AddDemo(const char * param)126 static void G_AddDemo(const char* param)
127 {
128     Bstrncpy(tempbuf, param, sizeof(tempbuf));
129     char * colon = (char *) Bstrchr(tempbuf, ':');
130     int32_t framespertic=-1, numrepeats=1;
131 
132     if (colon && colon != tempbuf)
133     {
134         // -d<filename>:<num>[,<num>]
135         // profiling options
136         *(colon++) = 0;
137         Bsscanf(colon, "%d,%d", &framespertic, &numrepeats);
138     }
139 
140     Demo_SetFirst(tempbuf);
141 
142     if (framespertic < 0)
143     {
144         initprintf("Play demo %s.\n", g_firstDemoFile);
145     }
146     else
147     {
148         framespertic = clamp(framespertic, 0, 8)+1;
149         // TODO: repeat count and gathering statistics.
150         initprintf("Profile demo %s, %d frames/gametic, repeated 1x.\n", g_firstDemoFile,
151             framespertic-1);
152         Demo_PlayFirst(framespertic, 1);
153         g_noLogo = 1;
154     }
155 }
156 
G_CheckCommandLine(int32_t argc,char const * const * argv)157 void G_CheckCommandLine(int32_t argc, char const * const * argv)
158 {
159     int16_t i = 1, j;
160     const char *c, *k;
161 
162     ud.fta_on = 1;
163     ud.god = 0;
164     ud.m_respawn_items = 0;
165     ud.m_respawn_monsters = 0;
166     ud.m_respawn_inventory = 0;
167     ud.warp_on = 0;
168     ud.cashman = 0;
169     ud.m_ffire = 1;
170     ud.m_player_skill = ud.player_skill = 2;
171     g_player[0].wchoice[0] = 3;
172     g_player[0].wchoice[1] = 4;
173     g_player[0].wchoice[2] = 5;
174     g_player[0].wchoice[3] = 7;
175     g_player[0].wchoice[4] = 8;
176     g_player[0].wchoice[5] = 6;
177     g_player[0].wchoice[6] = 0;
178     g_player[0].wchoice[7] = 2;
179     g_player[0].wchoice[8] = 9;
180     g_player[0].wchoice[9] = 1;
181     Bsprintf(ud.wchoice, "3457860291");
182 
183 #ifdef HAVE_CLIPSHAPE_FEATURE
184     // pre-form the default 10 clipmaps
185     for (j = '0'; j<='9'; ++j)
186     {
187         char clipshape[16] = "_clipshape0.map";
188 
189         clipshape[10] = j;
190         g_clipMapFiles.append(Xstrdup(clipshape));
191     }
192 #endif
193 
194     if (argc > 1)
195     {
196         initprintf("Application parameters: ");
197         while (i < argc)
198             initprintf("%s ", argv[i++]);
199         initprintf("\n");
200 
201         i = 1;
202         do
203         {
204             const char *const oc = argv[i];
205             int32_t shortopt = 0, ignored_short_opt = 0;
206 
207             c = oc;
208 
209             if ((*c == '-')
210 #ifdef _WIN32
211                 || (*c == '/')
212 #endif
213                 )
214             {
215                 shortopt = 0;
216 
217                 if (!Bstrcasecmp(c+1, "?") || !Bstrcasecmp(c+1, "help") || !Bstrcasecmp(c+1, "-help"))
218                 {
219                     G_ShowParameterHelp();
220                     exit(EXIT_SUCCESS);
221                 }
222                 if (!Bstrcasecmp(c+1, "addon"))
223                 {
224                     if (argc > i+1)
225                     {
226                         g_addonNum = Batoi(argv[i+1]);
227 
228                         if (g_addonNum > ADDON_NONE && g_addonNum < NUMADDONS)
229                             g_noSetup = 1;
230                         else g_addonNum = ADDON_NONE;
231 
232                         i++;
233                     }
234                     i++;
235                     continue;
236                 }
237                 if (!Bstrcasecmp(c+1, "debughelp") || !Bstrcasecmp(c+1, "-debughelp"))
238                 {
239                     G_ShowDebugHelp();
240                     exit(EXIT_SUCCESS);
241                 }
242                 if (!Bstrcasecmp(c+1, "grp") || !Bstrcasecmp(c+1, "g"))
243                 {
244                     if (argc > i+1)
245                     {
246                         G_AddGroup(argv[i+1]);
247                         i++;
248                     }
249                     i++;
250                     continue;
251                 }
252                 if (!Bstrcasecmp(c+1, "game_dir"))
253                 {
254                     if (argc > i+1)
255                     {
256                         Bstrncpyz(g_modDir, argv[i+1], sizeof(g_modDir));
257                         G_AddPath(argv[i+1]);
258                         i++;
259                     }
260                     i++;
261                     continue;
262                 }
263                 if (!Bstrcasecmp(c+1, "cfg"))
264                 {
265                     if (argc > i+1)
266                     {
267                         Bstrcpy(g_setupFileName, argv[i+1]);
268                         i++;
269                     }
270                     i++;
271                     continue;
272                 }
273                 if (!Bstrcasecmp(c+1, "gamegrp"))
274                 {
275                     if (argc > i+1)
276                     {
277                         clearGrpNamePtr();
278                         g_grpNamePtr = dup_filename(argv[i+1]);
279                         i++;
280                     }
281                     i++;
282                     continue;
283                 }
284 #ifndef EDUKE32_STANDALONE
285                 if (!Bstrcasecmp(c+1, "nam"))
286                 {
287                     g_gameType = GAMEFLAG_NAM;
288                     i++;
289                     continue;
290                 }
291                 if (!Bstrcasecmp(c+1, "napalm"))
292                 {
293                     g_gameType = GAMEFLAG_NAM|GAMEFLAG_NAPALM;
294                     i++;
295                     continue;
296                 }
297                 if (!Bstrcasecmp(c+1, "ww2gi"))
298                 {
299                     g_gameType = GAMEFLAG_WW2GI;
300                     i++;
301                     continue;
302                 }
303 #endif
304                 if (!Bstrcasecmp(c+1, "setup"))
305                 {
306                     g_commandSetup = TRUE;
307                     i++;
308                     continue;
309                 }
310                 if (!Bstrcasecmp(c+1, "nosetup"))
311                 {
312                     g_noSetup = 1;
313                     g_commandSetup = 0;
314                     i++;
315                     continue;
316                 }
317 #if defined RENDERTYPEWIN
318                 if (!Bstrcasecmp(c+1, "nodinput"))
319                 {
320                     initprintf("DirectInput (joystick) support disabled\n");
321                     di_disabled = 1;
322                     i++;
323                     continue;
324                 }
325 #endif
326                 if (!Bstrcasecmp(c+1, "noautoload"))
327                 {
328                     initprintf("Autoload disabled\n");
329                     g_noAutoLoad = 1;
330                     i++;
331                     continue;
332                 }
333 #ifndef NETCODE_DISABLE
334                 if (!Bstrcasecmp(c+1, "net"))
335                 {
336                     G_GameExit("EDuke32 no longer supports legacy networking.\n\n"
337                         "If using YANG or other launchers that only support legacy netplay, download an older build of EDuke32. "
338                         "Otherwise, run the following:\n\n"
339                         "eduke32 -server\n\n"
340                         "Other clients can then connect by typing \"connect [host]\" in the console.\n\n"
341                         "EDuke32 will now close.");
342                 }
343 #endif
344                 if (!Bstrcasecmp(c+1, "port"))
345                 {
346                     if (argc > i+1)
347                     {
348                         g_netPort = Batoi(argv[i+1]);
349                         i++;
350                     }
351                     i++;
352                     continue;
353                 }
354 #ifndef NETCODE_DISABLE
355                 if (!Bstrcasecmp(c+1, "server"))
356                 {
357                     g_networkMode = NET_SERVER;
358                     g_noSetup = g_noLogo = TRUE;
359                     i++;
360                     continue;
361                 }
362                 if (!Bstrcasecmp(c+1, "dedicated"))
363                 {
364                     g_networkMode = NET_DEDICATED_SERVER;
365                     g_noSetup = g_noLogo = TRUE;
366                     i++;
367                     continue;
368                 }
369                 if (!Bstrcasecmp(c+1, "connect"))
370                 {
371                     if (argc > i+1)
372                     {
373                         Net_Connect(argv[i+1]);
374                         g_noSetup = g_noLogo = TRUE;
375                         i++;
376                     }
377                     i++;
378                     continue;
379                 }
380                 if (!Bstrcasecmp(c+1, "password"))
381                 {
382                     if (argc > i+1)
383                     {
384                         Bstrncpyz(g_netPassword, argv[i+1], sizeof(g_netPassword));
385                         i++;
386                     }
387                     i++;
388                     continue;
389                 }
390 #endif
391                 if (!Bstrcasecmp(c+1, "name"))
392                 {
393                     if (argc > i+1)
394                     {
395                         CommandName = argv[i+1];
396                         i++;
397                     }
398                     i++;
399                     continue;
400                 }
401                 if (!Bstrcasecmp(c+1, "map"))
402                 {
403                     if (argc > i+1)
404                     {
405                         CommandMap = argv[i+1];
406                         i++;
407                     }
408                     i++;
409                     continue;
410                 }
411                 if (!Bstrcasecmp(c+1, "noffire"))
412                 {
413                     ud.m_ffire = 0;
414                     i++;
415                     continue;
416                 }
417                 if (!Bstrcasecmp(c+1, "rts"))
418                 {
419                     if (argc > i+1)
420                     {
421                         Bfree(g_rtsNamePtr);
422                         g_rtsNamePtr = dup_filename(argv[i+1]);
423                         initprintf("Using RTS file \"%s\".\n", g_rtsNamePtr);
424                         i++;
425                     }
426                     i++;
427                     continue;
428                 }
429                 if (!Bstrcasecmp(c+1, "x"))
430                 {
431                     if (argc > i+1)
432                     {
433                         G_AddCon(argv[i+1]);
434                         i++;
435                     }
436                     i++;
437                     continue;
438                 }
439                 if (!Bstrcasecmp(c+1, "mx"))
440                 {
441                     if (argc > i+1)
442                     {
443                         G_AddConModule(argv[i+1]);
444                         i++;
445                     }
446                     i++;
447                     continue;
448                 }
449                 if (!Bstrcasecmp(c+1, "h"))
450                 {
451                     if (argc > i+1)
452                     {
453                         G_AddDef(argv[i+1]);
454                         i++;
455                     }
456                     i++;
457                     continue;
458                 }
459                 if (!Bstrcasecmp(c+1, "mh"))
460                 {
461                     if (argc > i+1)
462                     {
463                         G_AddDefModule(argv[i+1]);
464                         i++;
465                     }
466                     i++;
467                     continue;
468                 }
469                 if (!Bstrcasecmp(c+1, "j"))
470                 {
471                     if (argc > i+1)
472                     {
473                         G_AddPath(argv[i+1]);
474                         i++;
475                     }
476                     i++;
477                     continue;
478                 }
479                 if (!Bstrcasecmp(c+1, "d"))
480                 {
481                     if (argc > i+1)
482                     {
483                         G_AddDemo(argv[i+1]);
484                         i++;
485                     }
486                     i++;
487                     continue;
488                 }
489 #ifdef HAVE_CLIPSHAPE_FEATURE
490                 if (!Bstrcasecmp(c+1, "clipmap"))
491                 {
492                     if (argc > i+1)
493                     {
494                         G_AddClipMap(argv[i+1]);
495                         i++;
496                     }
497                     i++;
498                     continue;
499                 }
500 #endif
501                 if (!Bstrcasecmp(c+1, "condebug"))
502                 {
503                     g_scriptDebug = 1;
504                     i++;
505                     continue;
506                 }
507                 if (!Bstrcasecmp(c+1, "nologo") || !Bstrcasecmp(c+1, "quick"))
508                 {
509                     g_noLogo = 1;
510                     i++;
511                     continue;
512                 }
513                 if (!Bstrcasecmp(c+1, "rotatesprite-no-widescreen"))
514                 {
515                     g_rotatespriteNoWidescreen = 1;
516                     i++;
517                     continue;
518                 }
519                 if (!Bstrcasecmp(c+1, "usecwd"))
520                 {
521                     g_useCwd = 1;
522                     i++;
523                     continue;
524                 }
525                 if (!Bstrcasecmp(c+1, "cachesize"))
526                 {
527                     if (argc > i+1)
528                     {
529                         uint32_t j = Batol(argv[i+1]);
530                         MAXCACHE1DSIZE = j<<10;
531                         initprintf("Cache size: %dkB\n", j);
532                         i++;
533                     }
534                     i++;
535                     continue;
536                 }
537                 if (!Bstrcasecmp(c+1, "noinstancechecking"))
538                 {
539                     i++;
540                     continue;
541                 }
542 #if defined(RENDERTYPEWIN) && defined(USE_OPENGL)
543                 if (!Bstrcasecmp(c+1, "forcegl"))
544                 {
545                     forcegl = 1;
546                     i++;
547                     continue;
548                 }
549 #endif
550 #ifdef VW_ENABLED
551                 if (!Bstrcasecmp(c+1, "nosteam"))
552                 {
553                     i++;
554                     continue;
555                 }
556 #endif
557                 // the following two dummy entries allow us to serve as a drop-in replacement for NAM on Steam
558                 if (!Bstrcasecmp(c+1, "noconsole"))
559                 {
560                     i++;
561                     continue;
562                 }
563                 if (!Bstrcasecmp(c+1, "conf"))
564                 {
565                     if (argc > i+1)
566                         i++;
567                     i++;
568                     continue;
569                 }
570             }
571 
572             if ((*c == '-')
573 #ifdef _WIN32
574                 || (*c == '/')
575 #endif
576                 )
577             {
578                 shortopt = 1;
579 
580                 c++;
581                 switch (Btolower(*c))
582                 {
583                 case 'a':
584                     ud.playerai = 1;
585                     initprintf("Other player AI.\n");
586                     break;
587                 case 'c':
588                     c++;
589                     ud.m_coop = 0;
590                     while ((*c >= '0')&&(*c <= '9'))
591                     {
592                         ud.m_coop *= 10;
593                         ud.m_coop += *c - '0';
594                         c++;
595                     }
596                     ud.m_coop--;
597                     break;
598                 case 'd':
599                 {
600                     c++;
601                     if (*c)
602                         G_AddDemo(c);
603                     break;
604                 }
605                 case 'g':
606                     c++;
607                     if (*c)
608                         G_AddGroup(c);
609                     break;
610                 case 'h':
611                     c++;
612                     if (*c)
613                         G_AddDef(c);
614                     break;
615                 case 'j':
616                     c++;
617                     if (*c)
618                         G_AddPath(c);
619                     break;
620                 case 'l':
621                     // NOTE: Overlaid with -Lopts=... options for Lunatic, hence the check.
622                     if (Bisdigit(c[1]))
623                     {
624                         ud.warp_on = 1;
625                         c++;
626                         ud.m_level_number = ud.level_number = ((unsigned) (Batoi(c)-1))%MAXLEVELS;
627                     }
628                     break;
629                 case 'm':
630                     if (*(c+1) != 'a' && *(c+1) != 'A')
631                     {
632                         ud.m_monsters_off = 1;
633                         ud.m_player_skill = ud.player_skill = 0;
634                         initprintf("Monsters off.\n");
635                     }
636                     break;
637                 case 'n':
638                     c++;
639                     if (*c == 's' || *c == 'S')
640                     {
641                         g_noSound = 2;
642                         initprintf("Sound off.\n");
643                     }
644                     else if (*c == 'm' || *c == 'M')
645                     {
646                         g_noMusic = 1;
647                         initprintf("Music off.\n");
648                     }
649                     else
650                     {
651                         G_ShowParameterHelp();
652                         exit(EXIT_SUCCESS);
653                     }
654                     break;
655                 case 'q':
656                     if (*(++c) == 0)
657                     {
658                         ud.multimode = 1;
659                         initprintf("Fake multiplayer mode: expected number after -q, falling back to 1 player.\n");
660                     }
661                     else
662                     {
663                         int32_t numpl = Batoi(c);
664 
665                         if (numpl < 2 || numpl > MAXPLAYERS)
666                         {
667                             initprintf("Fake multiplayer mode: expected 2-%d players, falling back to 1.\n",
668                                 MAXPLAYERS);
669                         }
670                         else
671                         {
672                             ud.multimode = numpl;
673                             initprintf("Fake multiplayer mode: %d players.\n", ud.multimode);
674 
675                             g_fakeMultiMode = numpl;
676                         }
677                     }
678 
679                     ud.m_coop = ud.coop = 0;
680                     ud.m_marker = ud.marker = 1;
681                     ud.m_respawn_monsters = ud.respawn_monsters = 1;
682                     ud.m_respawn_items = ud.respawn_items = 1;
683                     ud.m_respawn_inventory = ud.respawn_inventory = 1;
684                     break;
685                 case 'r':
686                     ud.m_recstat = 1;
687                     initprintf("Demo record mode on.\n");
688                     break;
689                 case 's':
690                     c++;
691                     ud.m_player_skill = ud.player_skill = (Batoi(c)%5);
692                     if (ud.m_player_skill == 4)
693                         ud.m_respawn_monsters = ud.respawn_monsters = 1;
694                     break;
695                 case 't':
696                     c++;
697                     if (*c == '1') ud.m_respawn_monsters = 1;
698                     else if (*c == '2') ud.m_respawn_items = 1;
699                     else if (*c == '3') ud.m_respawn_inventory = 1;
700                     else
701                     {
702                         ud.m_respawn_monsters = 1;
703                         ud.m_respawn_items = 1;
704                         ud.m_respawn_inventory = 1;
705                     }
706                     initprintf("Respawn on.\n");
707                     break;
708                 case 'u':
709                     g_forceWeaponChoice = 1;
710                     c++;
711                     j = 0;
712                     if (*c)
713                     {
714                         initprintf("Using favorite weapon order(s).\n");
715                         while (*c)
716                         {
717                             g_player[0].wchoice[j] = *c-'0';
718                             ud.wchoice[j] = *c;
719                             c++;
720                             j++;
721                         }
722 
723                         while (j < 10)
724                         {
725                             if (j == 9)
726                             {
727                                 g_player[0].wchoice[9] = 1;
728                                 ud.wchoice[9] = '1';
729                             }
730                             else
731                             {
732                                 g_player[0].wchoice[j] = 2;
733                                 ud.wchoice[j] = '2';
734                             }
735 
736                             j++;
737                         }
738                     }
739                     else
740                     {
741                         initprintf("Using default weapon orders.\n");
742                         g_player[0].wchoice[0] = 3;
743                         g_player[0].wchoice[1] = 4;
744                         g_player[0].wchoice[2] = 5;
745                         g_player[0].wchoice[3] = 7;
746                         g_player[0].wchoice[4] = 8;
747                         g_player[0].wchoice[5] = 6;
748                         g_player[0].wchoice[6] = 0;
749                         g_player[0].wchoice[7] = 2;
750                         g_player[0].wchoice[8] = 9;
751                         g_player[0].wchoice[9] = 1;
752 
753                         Bsprintf(ud.wchoice, "3457860291");
754                     }
755                     break;
756                 case 'v':
757                     c++;
758                     ud.warp_on = 1;
759                     ud.m_volume_number = ud.volume_number = ((unsigned) (Batoi(c)-1))%MAXVOLUMES;
760                     break;
761                 case 'w':
762                     ud.coords = 1;
763                     break;
764                 case 'x':
765                     c++;
766                     if (*c)
767                         G_AddCon(c);
768                     break;
769                 case 'z':
770                     c++;
771                     g_scriptDebug = Batoi(c);
772                     if (!g_scriptDebug)
773                         g_scriptDebug = 1;
774                     break;
775                 default:
776                     ignored_short_opt = 1;
777                     break;
778                 }
779             }
780             else
781             {
782                 shortopt = 0;
783 
784                 k = Bstrrchr(c, '.');
785                 if (k)
786                 {
787                     if (!Bstrcasecmp(k, ".map"))
788                     {
789                         CommandMap = argv[i++];
790                         continue;
791                     }
792                     if (!Bstrcasecmp(k, ".grp") || !Bstrcasecmp(k, ".zip") || !Bstrcasecmp(k, ".pk3") || !Bstrcasecmp(k, ".pk4"))
793                     {
794                         G_AddGroup(argv[i++]);
795                         continue;
796                     }
797                     if (!Bstrcasecmp(k, ".con"))
798                     {
799                         clearScriptNamePtr();
800                         g_scriptNamePtr = dup_filename(argv[i++]);
801                         initprintf("Using CON file \"%s\".\n", g_scriptNamePtr);
802                         continue;
803                     }
804                     if (!Bstrcasecmp(k, ".def"))
805                     {
806                         clearDefNamePtr();
807                         g_defNamePtr = dup_filename(argv[i++]);
808                         initprintf("Using DEF file \"%s\".\n", g_defNamePtr);
809                         continue;
810                     }
811                     if (!Bstrcasecmp(k, ".rts"))
812                     {
813                         Bfree(g_rtsNamePtr);
814                         g_rtsNamePtr = dup_filename(argv[i++]);
815                         initprintf("Using RTS file \"%s\".\n", g_rtsNamePtr);
816                         continue;
817                     }
818                 }
819             }
820 
821             if (!shortopt || ignored_short_opt)
822                 initprintf("Warning: ignored application parameter \"%s\".\n", oc);
823 
824             i++;
825         } while (i < argc);
826     }
827 }
828