From 75cca4cd5cd9b4c68eccb03eb095534a97014214 Mon Sep 17 00:00:00 2001 From: terminx Date: Wed, 12 Dec 2007 15:27:34 +0000 Subject: [PATCH] git-svn-id: https://svn.eduke32.com/eduke32@583 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/src/engine.c | 24 ++++---------- polymer/eduke32/source/astub.c | 56 ++++++++++++++++++++++---------- polymer/eduke32/source/mdump.cpp | 2 +- 3 files changed, 45 insertions(+), 37 deletions(-) diff --git a/polymer/build/src/engine.c b/polymer/build/src/engine.c index 351a799ca..d4c2ea923 100644 --- a/polymer/build/src/engine.c +++ b/polymer/build/src/engine.c @@ -5519,31 +5519,19 @@ int preinitengine(void) char *e; if (initsystem()) exit(1); - if (sector != NULL) - Bfree(sector); + makeasmwriteable(); + + // this shite is to help get around data segment size limits on some platforms + sector = Bcalloc(MAXSECTORS,sizeof(sectortype)); - - if (wall != NULL) - Bfree(wall); wall = Bcalloc(MAXWALLS,sizeof(walltype)); - - if (sprite != NULL) - Bfree(sprite); sprite = Bcalloc(MAXSPRITES,sizeof(spritetype)); - - if (tsprite != NULL) - Bfree(tsprite); tsprite = Bcalloc(MAXSPRITESONSCREEN,sizeof(spritetype)); - - if (spriteext != NULL) - Bfree(spriteext); spriteext = Bcalloc(MAXSPRITES+MAXUNIQHUDID,sizeof(spriteexttype)); - - if (spritesmooth != NULL) - Bfree(spritesmooth); spritesmooth = Bcalloc(MAXSPRITES+MAXUNIQHUDID,sizeof(spritesmoothtype)); - makeasmwriteable(); + if (!sector || !wall || !sprite || !tsprite || !spriteext || !spritesmooth) + return 1; if ((e = Bgetenv("BUILD_NOP6")) != NULL) if (!Bstrcasecmp(e, "TRUE")) { diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 836ee8ec5..cc093c36b 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -55,7 +55,7 @@ static struct strllist struct strllist *next; char *str; } -*CommandPaths = NULL; +*CommandPaths = NULL, *CommandGrps = NULL; #define MAXHELP2D (signed int)(sizeof(Help2d)/sizeof(Help2d[0])) static char *Help2d[]= @@ -5057,13 +5057,22 @@ static void addgamepath(const char *buffer) CommandPaths = s; } -static char **grps = NULL; -static signed char grpstoadd = 0; - -static void buildaddgroup(const char *buffer) +static void addgroup(const char *buffer) { - grps = (char**)realloc(grps, sizeof(char*)*(grpstoadd+1)); - grps[grpstoadd++] = strdup(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 checkcommandline(int argc,const char **argv) @@ -5084,11 +5093,11 @@ static void checkcommandline(int argc,const char **argv) exit(0); } - if (!Bstrcasecmp(c+1, "-g") || !Bstrcasecmp(c+1, "-grp")) + if (!Bstrcasecmp(c+1, "g") || !Bstrcasecmp(c+1, "grp")) { if (argc > i+1) { - buildaddgroup(argv[i+1]); + addgroup(argv[i+1]); i++; } i++; @@ -5185,7 +5194,7 @@ static void checkcommandline(int argc,const char **argv) case 'G': c++; if (!*c) break; - buildaddgroup(c); + addgroup(c); break; } } @@ -5904,17 +5913,28 @@ int ExtInit(void) } loadgroupfiles(defsfilename); - if (grps && grpstoadd > 0) { - for (i=0;inext; + j = initgroupfile(CommandGrps->str); + if (j == -1) initprintf("Could not find group file '%s'.\n",CommandGrps->str); + else + { + 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; diff --git a/polymer/eduke32/source/mdump.cpp b/polymer/eduke32/source/mdump.cpp index 679a0bb09..3187fa2bc 100644 --- a/polymer/eduke32/source/mdump.cpp +++ b/polymer/eduke32/source/mdump.cpp @@ -111,4 +111,4 @@ LONG MiniDumper::TopLevelFilter( struct _EXCEPTION_POINTERS *pExceptionInfo ) ::MessageBox( NULL, szResult, m_szAppName, MB_OK ); return retval; -} +} \ No newline at end of file