Support for -ww2gi, -nam, -cfg, -usecwd, -h, and -j in Mapster32. Because I am lazy, this is all code from game.c.

git-svn-id: https://svn.eduke32.com/eduke32@464 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2007-01-21 23:49:07 +00:00
parent 44e869c8d9
commit fe9004fafe
3 changed files with 130 additions and 9 deletions

View file

@ -26,6 +26,7 @@ extern long ydim16, xdimgame, ydimgame, bppgame, xdim2d, ydim2d, forcesetup;
extern int ExtInit(void); extern int ExtInit(void);
extern int ExtPreInit(int argc,char **argv);
extern void ExtUnInit(void); extern void ExtUnInit(void);
extern void ExtPreCheckKeys(void); extern void ExtPreCheckKeys(void);
#ifdef SUPERBUILD #ifdef SUPERBUILD
@ -45,7 +46,8 @@ extern void ExtShowSpriteData(short spritenum);
extern void ExtEditSectorData(short sectnum); extern void ExtEditSectorData(short sectnum);
extern void ExtEditWallData(short wallnum); extern void ExtEditWallData(short wallnum);
extern void ExtEditSpriteData(short spritenum); extern void ExtEditSpriteData(short spritenum);
extern char ExtCustomSpriteColor(short picnum);
extern void ExtSetupSpecialSpriteCols(void);
int loadsetup(const char *fn); // from config.c int loadsetup(const char *fn); // from config.c
int writesetup(const char *fn); // from config.c int writesetup(const char *fn); // from config.c

View file

@ -27,7 +27,7 @@ static long crctable[256];
static char kensig[24]; static char kensig[24];
extern int ExtInit(void); extern int ExtInit(void);
extern int ExtPreInit(int *argc,char ***argv); extern int ExtPreInit(int argc,char **argv);
extern void ExtUnInit(void); extern void ExtUnInit(void);
extern void ExtPreCheckKeys(void); extern void ExtPreCheckKeys(void);
#ifdef SUPERBUILD #ifdef SUPERBUILD
@ -257,7 +257,7 @@ int app_main(int argc, char **argv)
wm_setapptitle("Mapster32"); wm_setapptitle("Mapster32");
if ((i = ExtPreInit(&argc,&argv)) < 0) return -1; if ((i = ExtPreInit(argc,argv)) < 0) return -1;
#ifdef RENDERTYPEWIN #ifdef RENDERTYPEWIN
backgroundidle = 1; backgroundidle = 1;

View file

@ -45,7 +45,18 @@ Modifications for JonoF's port by Jonathon Fowler (jonof@edgenetwk.com)
short floor_over_floor; short floor_over_floor;
char *startwin_labeltext = "Starting Mapster32..."; static char *startwin_labeltext = "Starting Mapster32...";
static char setupfilename[BMAX_PATH]= "build.cfg";
static char defaultduke3dgrp[BMAX_PATH] = "duke3d.grp";
static char *duke3dgrp = defaultduke3dgrp;
static int usecwd = 0;
static struct strllist
{
struct strllist *next;
char *str;
}
*CommandPaths = NULL;
#define MAXHELP2D (signed int)(sizeof(Help2d)/sizeof(Help2d[0])) #define MAXHELP2D (signed int)(sizeof(Help2d)/sizeof(Help2d[0]))
char *Help2d[]= { char *Help2d[]= {
@ -3606,7 +3617,7 @@ static void Keys2d(void)
{if(keystatus[i]==1) {Bsprintf(tempbuf,"key %ld",i); printmessage16(tempbuf); {if(keystatus[i]==1) {Bsprintf(tempbuf,"key %ld",i); printmessage16(tempbuf);
}} }}
*/ */
Bsprintf(tempbuf, "Mapster32"VERSION""); Bsprintf(tempbuf, "Mapster32"VERSION"");
printext16(9L,ydim-STATUS2DSIZ+9L,4,-1,tempbuf,0); printext16(9L,ydim-STATUS2DSIZ+9L,4,-1,tempbuf,0);
printext16(8L,ydim-STATUS2DSIZ+8L,12,-1,tempbuf,0); printext16(8L,ydim-STATUS2DSIZ+8L,12,-1,tempbuf,0);
@ -4298,7 +4309,92 @@ void ExtPreSaveMap(void)
void ExtPreLoadMap(void) void ExtPreLoadMap(void)
{} {}
int ExtPreInit(int *argc,char ***argv) static void checkcommandline(int argc,char **argv)
{
int i = 1;
char *c;
if (argc > 1)
{
while (i < argc)
{
c = argv[i];
if (((*c == '/') || (*c == '-')))
{
if (!Bstrcasecmp(c+1,"cfg"))
{
if (argc > i+1)
{
Bstrcpy(setupfilename,argv[i+1]);
i++;
}
i++;
continue;
}
if (!Bstrcasecmp(c+1,"nam"))
{
strcpy(duke3dgrp, "nam.grp");
i++;
continue;
}
if (!Bstrcasecmp(c+1,"ww2gi"))
{
strcpy(duke3dgrp, "ww2gi.grp");
i++;
continue;
}
#if !defined(_WIN32)
if (!Bstrcasecmp(c+1,"usecwd"))
{
usecwd = 1;
i++;
continue;
}
#endif
}
if ((*c == '/') || (*c == '-'))
{
c++;
switch (*c)
{
case 'h':
case 'H':
c++;
if (*c)
{
defsfilename = c;
initprintf("Using DEF file: %s.\n",defsfilename);
}
break;
case 'j':
case 'J':
c++;
if (!*c) break;
{
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;
}
}
i++;
}
}
}
int ExtPreInit(int argc,char **argv)
{ {
wm_setapptitle("Mapster32"VERSION); wm_setapptitle("Mapster32"VERSION);
@ -4306,6 +4402,9 @@ int ExtPreInit(int *argc,char ***argv)
OSD_SetVersionString("Mapster32"VERSION); OSD_SetVersionString("Mapster32"VERSION);
initprintf("Mapster32"VERSION" ("__DATE__" "__TIME__")\n"); initprintf("Mapster32"VERSION" ("__DATE__" "__TIME__")\n");
initprintf("Copyright (c) 2006 EDuke32 team\n\n"); initprintf("Copyright (c) 2006 EDuke32 team\n\n");
checkcommandline(argc,argv);
return 0; return 0;
} }
@ -4401,10 +4500,28 @@ int loadgroupfiles(char *fn)
int ExtInit(void) int ExtInit(void)
{ {
long rv = 0; long rv = 0;
char *duke3dgrp = "duke3d.grp"; char cwd[BMAX_PATH];
if (getcwd(cwd,BMAX_PATH)) addsearchpath(cwd);
if (CommandPaths)
{
struct strllist *s;
while (CommandPaths)
{
s = CommandPaths->next;
addsearchpath(CommandPaths->str);
free(CommandPaths->str);
free(CommandPaths);
CommandPaths = s;
}
}
#if defined(_WIN32) #if defined(_WIN32)
if (!access("user_profiles_enabled", F_OK)) if (!access("user_profiles_enabled", F_OK))
#else
if (usecwd == 0)
#endif #endif
{ {
char cwd[BMAX_PATH]; char cwd[BMAX_PATH];
@ -4458,12 +4575,14 @@ int ExtInit(void)
initprintf("Using %s as definitions file\n", defsfilename); initprintf("Using %s as definitions file\n", defsfilename);
} }
loadgroupfiles(defsfilename); loadgroupfiles(defsfilename);
bpp = 32; bpp = 32;
#if defined(POLYMOST) && defined(USE_OPENGL) #if defined(POLYMOST) && defined(USE_OPENGL)
glusetexcache = glusetexcachecompression = -1; glusetexcache = glusetexcachecompression = -1;
if (loadsetup("build.cfg") < 0) initprintf("Configuration file not found, using defaults.\n"), rv = 1; initprintf("Using config file %s.\n",setupfilename);
if (loadsetup(setupfilename) < 0) initprintf("Configuration file not found, using defaults.\n"), rv = 1;
if (glusetexcache == -1 || glusetexcachecompression == -1) if (glusetexcache == -1 || glusetexcachecompression == -1)
{ {
@ -4517,7 +4636,7 @@ void ExtUnInit(void)
{ {
// setvmode(0x03); // setvmode(0x03);
uninitgroupfile(); uninitgroupfile();
writesetup("build.cfg"); writesetup(setupfilename);
} }
void ExtPreCheckKeys(void) // just before drawrooms void ExtPreCheckKeys(void) // just before drawrooms