git-svn-id: https://svn.eduke32.com/eduke32@583 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2007-12-12 15:27:34 +00:00
parent b27a43ff2a
commit 75cca4cd5c
3 changed files with 45 additions and 37 deletions

View file

@ -5519,31 +5519,19 @@ int preinitengine(void)
char *e; char *e;
if (initsystem()) exit(1); if (initsystem()) exit(1);
if (sector != NULL) makeasmwriteable();
Bfree(sector);
// this shite is to help get around data segment size limits on some platforms
sector = Bcalloc(MAXSECTORS,sizeof(sectortype)); sector = Bcalloc(MAXSECTORS,sizeof(sectortype));
if (wall != NULL)
Bfree(wall);
wall = Bcalloc(MAXWALLS,sizeof(walltype)); wall = Bcalloc(MAXWALLS,sizeof(walltype));
if (sprite != NULL)
Bfree(sprite);
sprite = Bcalloc(MAXSPRITES,sizeof(spritetype)); sprite = Bcalloc(MAXSPRITES,sizeof(spritetype));
if (tsprite != NULL)
Bfree(tsprite);
tsprite = Bcalloc(MAXSPRITESONSCREEN,sizeof(spritetype)); tsprite = Bcalloc(MAXSPRITESONSCREEN,sizeof(spritetype));
if (spriteext != NULL)
Bfree(spriteext);
spriteext = Bcalloc(MAXSPRITES+MAXUNIQHUDID,sizeof(spriteexttype)); spriteext = Bcalloc(MAXSPRITES+MAXUNIQHUDID,sizeof(spriteexttype));
if (spritesmooth != NULL)
Bfree(spritesmooth);
spritesmooth = Bcalloc(MAXSPRITES+MAXUNIQHUDID,sizeof(spritesmoothtype)); spritesmooth = Bcalloc(MAXSPRITES+MAXUNIQHUDID,sizeof(spritesmoothtype));
makeasmwriteable(); if (!sector || !wall || !sprite || !tsprite || !spriteext || !spritesmooth)
return 1;
if ((e = Bgetenv("BUILD_NOP6")) != NULL) if ((e = Bgetenv("BUILD_NOP6")) != NULL)
if (!Bstrcasecmp(e, "TRUE")) { if (!Bstrcasecmp(e, "TRUE")) {

View file

@ -55,7 +55,7 @@ static struct strllist
struct strllist *next; struct strllist *next;
char *str; char *str;
} }
*CommandPaths = NULL; *CommandPaths = NULL, *CommandGrps = NULL;
#define MAXHELP2D (signed int)(sizeof(Help2d)/sizeof(Help2d[0])) #define MAXHELP2D (signed int)(sizeof(Help2d)/sizeof(Help2d[0]))
static char *Help2d[]= static char *Help2d[]=
@ -5057,13 +5057,22 @@ static void addgamepath(const char *buffer)
CommandPaths = s; CommandPaths = s;
} }
static char **grps = NULL; static void addgroup(const char *buffer)
static signed char grpstoadd = 0;
static void buildaddgroup(const char *buffer)
{ {
grps = (char**)realloc(grps, sizeof(char*)*(grpstoadd+1)); struct strllist *s;
grps[grpstoadd++] = strdup(buffer); 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 checkcommandline(int argc,const char **argv) static void checkcommandline(int argc,const char **argv)
@ -5084,11 +5093,11 @@ static void checkcommandline(int argc,const char **argv)
exit(0); exit(0);
} }
if (!Bstrcasecmp(c+1, "-g") || !Bstrcasecmp(c+1, "-grp")) if (!Bstrcasecmp(c+1, "g") || !Bstrcasecmp(c+1, "grp"))
{ {
if (argc > i+1) if (argc > i+1)
{ {
buildaddgroup(argv[i+1]); addgroup(argv[i+1]);
i++; i++;
} }
i++; i++;
@ -5185,7 +5194,7 @@ static void checkcommandline(int argc,const char **argv)
case 'G': case 'G':
c++; c++;
if (!*c) break; if (!*c) break;
buildaddgroup(c); addgroup(c);
break; break;
} }
} }
@ -5904,17 +5913,28 @@ int ExtInit(void)
} }
loadgroupfiles(defsfilename); loadgroupfiles(defsfilename);
if (grps && grpstoadd > 0)
{ {
for (i=0;i<grpstoadd;i++) struct strllist *s;
int j;
pathsearchmode = 1;
while (CommandGrps)
{ {
initprintf("Adding %s\n",grps[i]); s = CommandGrps->next;
initgroupfile(grps[i]); j = initgroupfile(CommandGrps->str);
if (!NoAutoLoad) if (j == -1) initprintf("Could not find group file '%s'.\n",CommandGrps->str);
autoloadgrps(grps[i]); else
free(grps[i]); {
initprintf("Using group file '%s'.\n",CommandGrps->str);
if (!NoAutoLoad)
autoloadgrps(CommandGrps->str);
}
free(CommandGrps->str);
free(CommandGrps);
CommandGrps = s;
} }
free(grps); pathsearchmode = 0;
} }
bpp = 32; bpp = 32;

View file

@ -111,4 +111,4 @@ LONG MiniDumper::TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo )
::MessageBox( NULL, szResult, m_szAppName, MB_OK ); ::MessageBox( NULL, szResult, m_szAppName, MB_OK );
return retval; return retval;
} }