Support for -game_dir similar to Duke3d_w32

git-svn-id: https://svn.eduke32.com/eduke32@465 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2007-01-22 02:35:54 +00:00
parent fe9004fafe
commit 76c2340c83
3 changed files with 91 additions and 45 deletions

View file

@ -4309,6 +4309,23 @@ void ExtPreSaveMap(void)
void ExtPreLoadMap(void) void ExtPreLoadMap(void)
{} {}
static void comlinehelp(void)
{
char *s = "Syntax: mapster32 [options]\n\n"
"-?\t\tThis help message\n"
"-gFILE\t\tUse multiple group files\n"
"-jDIRECTORY\tAdd a directory to the file path stack\n"
"-hFILE\t\tUse FILE instead of DUKE3D.DEF\n"
#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2)
"-setup\t\tDisplays the configuration dialog\n"
#endif
#if !defined(_WIN32)
"-usecwd\t\tRead game data and configuration file from working directory\n"
#endif
;
wm_msgbox("Mapster32 Command Line Help",s);
}
static void checkcommandline(int argc,char **argv) static void checkcommandline(int argc,char **argv)
{ {
int i = 1; int i = 1;
@ -4358,6 +4375,10 @@ static void checkcommandline(int argc,char **argv)
c++; c++;
switch (*c) switch (*c)
{ {
case '?':
comlinehelp();
exit(0);
break;
case 'h': case 'h':
case 'H': case 'H':
c++; c++;

View file

@ -2390,7 +2390,7 @@ static void operatefta(void)
j = quotebot; j = quotebot;
for (i=0;i<MAXUSERQUOTES;i++) for (i=0;i<MAXUSERQUOTES;i++)
{ {
if (user_quote_time[i] <= 0) break; if (user_quote_time[i] <= 0) break;
k = user_quote_time[i]; k = user_quote_time[i];
l = Bstrlen(user_quote[i]); l = Bstrlen(user_quote[i]);
while (l > TEXTWRAPLEN) while (l > TEXTWRAPLEN)
@ -2467,7 +2467,7 @@ void FTA(short q,struct player_struct *p)
if (ud.fta_on == 0) if (ud.fta_on == 0)
return; return;
if (p->fta > 0 && q != 115 && q != 116) if (p->fta > 0 && q != 115 && q != 116)
if (p->ftq == 115 || p->ftq == 116) return; if (p->ftq == 115 || p->ftq == 116) return;
@ -3831,7 +3831,7 @@ static long oyrepeat=-1;
void displayrooms(int snum,long smoothratio) void displayrooms(int snum,long smoothratio)
{ {
long cposx,cposy,cposz,dst,j,fz,cz; long cposx,cposy,cposz,dst,j,fz,cz;
long tposx,tposy,i; long tposx,tposy,i;
short sect, cang, k, choriz; short sect, cang, k, choriz;
struct player_struct *p = &ps[snum]; struct player_struct *p = &ps[snum];
short tang; short tang;
@ -8103,8 +8103,8 @@ FAKE_F3:
static void comlinehelp(void) static void comlinehelp(void)
{ {
char *s = "Command line help.\n" char *s = "Syntax: eduke32 [options]\n\n"
"?, -?\t\tThis help message\n" "-?\t\tThis help message\n"
"-l##\t\tLevel (1-11)\n" "-l##\t\tLevel (1-11)\n"
"-v#\t\tVolume (1-4)\n" "-v#\t\tVolume (1-4)\n"
"-s#\t\tSkill (1-4)\n" "-s#\t\tSkill (1-4)\n"
@ -8128,14 +8128,16 @@ static void comlinehelp(void)
"-map FILE\tUse a map FILE\n" "-map FILE\tUse a map FILE\n"
"-name NAME\tFoward NAME\n" "-name NAME\tFoward NAME\n"
"-net\t\tNet mode game\n" "-net\t\tNet mode game\n"
#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2)
"-setup\t\tDisplays the configuration dialog\n" "-setup\t\tDisplays the configuration dialog\n"
#endif
"-nD\t\tDump game definitions to gamevars.txt\n" "-nD\t\tDump game definitions to gamevars.txt\n"
#if !defined(_WIN32) #if !defined(_WIN32)
"-usecwd\t\tRead game data and configuration file from working directory\n" "-usecwd\t\tRead game data and configuration file from working directory\n"
#endif #endif
"-condebug, -z#\tLine-by-line CON compilation debugging" "-condebug, -z#\tLine-by-line CON compilation debugging"
; ;
wm_msgbox(apptitle,s); wm_msgbox("EDuke32 Command Line Help",s);
} }
signed int rancid_players = 0; signed int rancid_players = 0;
@ -8350,7 +8352,7 @@ static int loadgroupfiles(char *fn)
{ {
int j; int j;
if (scriptfile_getnumber(script,&j)) break; if (scriptfile_getnumber(script,&j)) break;
if (j > 0) MAXCACHE1DSIZE = j<<10; if (j > 0) MAXCACHE1DSIZE = j<<10;
} }
break; break;
@ -8367,6 +8369,41 @@ static int loadgroupfiles(char *fn)
return 0; return 0;
} }
static void addgroup(const char *buffer)
{
struct strllist *s;
s = (struct strllist *)calloc(1,sizeof(struct strllist));
s->str = Bstrdup(buffer);
if (Bstrchr(s->str,'.') == 0)
Bstrcat(s->str,".grp");
if (CommandGrps)
{
struct strllist *t;
for (t = CommandGrps; t->next; t=t->next) ;
t->next = s;
return;
}
CommandGrps = s;
}
static void addgamepath(const char *buffer)
{
struct strllist *s;
s = (struct strllist *)calloc(1,sizeof(struct strllist));
s->str = strdup(buffer);
if (CommandPaths)
{
struct strllist *t;
for (t = CommandPaths; t->next; t=t->next) ;
t->next = s;
return;
}
CommandPaths = s;
}
static void checkcommandline(int argc,char **argv) static void checkcommandline(int argc,char **argv)
{ {
short i, j; short i, j;
@ -8401,6 +8438,26 @@ static void checkcommandline(int argc,char **argv)
c = argv[i]; c = argv[i];
if (((*c == '/') || (*c == '-')) && (!firstnet)) if (((*c == '/') || (*c == '-')) && (!firstnet))
{ {
if (!Bstrcasecmp(c+1,"grp"))
{
if (argc > i+1)
{
addgroup(argv[i+1]);
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1,"game_dir"))
{
if (argc > i+1)
{
addgamepath(argv[i+1]);
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1,"cfg")) if (!Bstrcasecmp(c+1,"cfg"))
{ {
if (argc > i+1) if (argc > i+1)
@ -8595,25 +8652,7 @@ static void checkcommandline(int argc,char **argv)
case 'G': case 'G':
c++; c++;
if (!*c) break; if (!*c) break;
strcpy(tempbuf,c); addgroup(c);
if (strchr(tempbuf,'.') == 0)
strcat(tempbuf,".grp");
{
struct strllist *s;
s = (struct strllist *)calloc(1,sizeof(struct strllist));
s->str = strdup(tempbuf);
if (CommandGrps)
{
struct strllist *t;
for (t = CommandGrps; t->next; t=t->next) ;
t->next = s;
}
else
{
CommandGrps = s;
}
}
break; break;
case 'h': case 'h':
case 'H': case 'H':
@ -8635,21 +8674,7 @@ static void checkcommandline(int argc,char **argv)
case 'J': case 'J':
c++; c++;
if (!*c) break; if (!*c) break;
{ addgamepath(c);
struct strllist *s;
s = (struct strllist *)calloc(1,sizeof(struct strllist));
s->str = strdup(c);
if (CommandPaths)
{
struct strllist *t;
for (t = CommandPaths; t->next; t=t->next) ;
t->next = s;
}
else
{
CommandPaths = s;
}
}
break; break;
case 'l': case 'l':
case 'L': case 'L':
@ -10445,7 +10470,7 @@ RECHECK:
{ {
if (foundemo) while (totalclock >= (lockclock+TICSPERFRAME)) if (foundemo) while (totalclock >= (lockclock+TICSPERFRAME))
{ {
#if 0 #if 0
if (demo_version == 116 || demo_version == 117) if (demo_version == 116 || demo_version == 117)
{ {
if ((i == 0) || (i >= RECSYNCBUFSIZ)) if ((i == 0) || (i >= RECSYNCBUFSIZ))
@ -10475,7 +10500,7 @@ RECHECK:
} }
} }
else else
#endif #endif
{ {
if ((i == 0) || (i >= RECSYNCBUFSIZ)) if ((i == 0) || (i >= RECSYNCBUFSIZ))
{ {

View file

@ -2960,8 +2960,8 @@ void getinput(int snum)
momx += fricxv; momx += fricxv;
momy += fricyv; momy += fricyv;
if (momx == 0) momx = 1; // HACK; the game seems to "forget" about the rest of the data if we aren't moving // if (momx == 0) momx = 1; // HACK; the game seems to "forget" about the rest of the data if we aren't moving
if (momy == 0) momy = 1; // if (momy == 0) momy = 1;
loc.fvel = momx; loc.fvel = momx;
loc.svel = momy; loc.svel = momy;