diff --git a/polymer/eduke32/build/include/compat.h b/polymer/eduke32/build/include/compat.h index f161c44df..9fd530d33 100644 --- a/polymer/eduke32/build/include/compat.h +++ b/polymer/eduke32/build/include/compat.h @@ -864,11 +864,13 @@ void *xrealloc(void *ptr, bsize_t size); # define Xmalloc(size) (EDUKE32_PRE_XALLLOC, xmalloc(size)) # define Xcalloc(nmemb, size) (EDUKE32_PRE_XALLLOC, xcalloc(nmemb, size)) # define Xrealloc(ptr, size) (EDUKE32_PRE_XALLLOC, xrealloc(ptr, size)) +# define Bexit(status) do { initprintf("exit(%d) at %s:%d in %s()\n", status, __FILE__, __LINE__, EDUKE32_FUNCTION); exit(status); } while (0) #else # define Xstrdup xstrdup # define Xmalloc xmalloc # define Xcalloc xcalloc # define Xrealloc xrealloc +# define Bexit exit #endif ////////// diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index 09a2dddca..8aae57e49 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -573,7 +573,7 @@ int32_t app_main(int32_t argc, const char **argv) if (quitevent || !startwin_run()) { uninitengine(); - exit(0); + Bexit(0); } } #endif @@ -680,7 +680,7 @@ int32_t app_main(int32_t argc, const char **argv) ExtUnInit(); uninitengine(); Bprintf("%d * %d not supported in this graphics mode\n",xdim2d,ydim2d); - exit(0); + Bexit(0); } // executed once per init, but after setgamemode so that OSD has the right width @@ -706,7 +706,7 @@ int32_t app_main(int32_t argc, const char **argv) ExtUnInit(); uninitengine(); Bprintf("%d * %d not supported in this graphics mode\n",xdim,ydim); - exit(0); + Bexit(0); } // executed once per init, but after setgamemode so that OSD has the right width @@ -7554,7 +7554,7 @@ end_insert_points: if ((j&0xffff) != 0xebf) { printf("Don't screw with my name.\n"); - exit(0); + Bexit(0); }*/ //printext16(9L,336+9L,4,-1,kensig,0); //printext16(8L,336+8L,12,-1,kensig,0); @@ -7884,7 +7884,7 @@ CANCEL: // clearfilenames(); uninitengine(); - exit(0); + Bexit(0); } // printmessage16(""); @@ -7919,7 +7919,7 @@ CANCEL: ExtUnInit(); // clearfilenames(); uninitengine(); - exit(1); + Bexit(1); } setbrightness(GAMMA_CALC,0,0); diff --git a/polymer/eduke32/build/src/cache1d.c b/polymer/eduke32/build/src/cache1d.c index 449341053..0c07a5ca9 100644 --- a/polymer/eduke32/build/src/cache1d.c +++ b/polymer/eduke32/build/src/cache1d.c @@ -323,7 +323,7 @@ static void reportandexit(const char *errormessage) Bprintf("Cache length sum = %d\n",j); #endif initprintf("ERROR: %s\n",errormessage); - exit(1); + Bexit(1); } #include @@ -840,7 +840,7 @@ int32_t kopen4load(const char *filename, char searchfirst) if (newhandle < 0) { Bprintf("TOO MANY FILES OPEN IN FILE GROUPING SYSTEM!"); - exit(0); + Bexit(0); } } diff --git a/polymer/eduke32/build/src/compat.c b/polymer/eduke32/build/src/compat.c index 775755015..4fb8ea754 100644 --- a/polymer/eduke32/build/src/compat.c +++ b/polymer/eduke32/build/src/compat.c @@ -77,7 +77,7 @@ static void handle_potential_memerr(void *ptr) #endif } - exit(EXIT_FAILURE); + Bexit(EXIT_FAILURE); } } diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 70266289c..09e584b9d 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -8700,7 +8700,7 @@ void *blockptr = NULL; int32_t preinitengine(void) { char *e; - if (initsystem()) exit(9); + if (initsystem()) Bexit(9); makeasmwriteable(); @@ -9081,7 +9081,7 @@ int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, //if (smostwallcnt < 0) // if (getkensmessagecrc(FP_OFF(kensmessage)) != 0x56c764d4) - // { /* setvmode(0x3);*/ OSD_Printf("Nice try.\n"); exit(0); } + // { /* setvmode(0x3);*/ OSD_Printf("Nice try.\n"); Bexit(0); } numhits = xdimen; numscans = 0; numbunches = 0; maskwallcnt = 0; smostwallcnt = 0; smostcnt = 0; spritesortcnt = 0; @@ -11237,7 +11237,7 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da Bstrcpy(kensmessage,"!!!! BUILD engine&tools programmed by Ken Silverman of E.G. RI." " (c) Copyright 1995 Ken Silverman. Summary: BUILD = Ken. !!!!"); // if (getkensmessagecrc(FP_OFF(kensmessage)) != 0x56c764d4) - // { OSD_Printf("Nice try.\n"); exit(0); } + // { OSD_Printf("Nice try.\n"); Bexit(0); } //if (checkvideomode(&daxdim, &daydim, dabpp, davidoption)<0) return (-1); @@ -11666,7 +11666,7 @@ void loadtile(int16_t tilenume) { initprintf("Failed opening ART file \"%s\"!\n", fn); uninitengine(); - exit(11); + Bexit(11); } artfilnum = i; @@ -14816,7 +14816,7 @@ static void maybe_alloc_palookup(int32_t palnum) { alloc_palookup(palnum); if (palookup[palnum] == NULL) - exit(1); + Bexit(1); } } diff --git a/polymer/eduke32/build/src/lunatic.c b/polymer/eduke32/build/src/lunatic.c index 895b7c760..8ca3763c4 100644 --- a/polymer/eduke32/build/src/lunatic.c +++ b/polymer/eduke32/build/src/lunatic.c @@ -142,7 +142,7 @@ static void L_OnOutOfMem(void) extern void uninitengine(void); OSD_Printf("Out of memory in Lunatic.\n"); uninitengine(); - exit(127); + Bexit(127); } void (*L_ErrorFunc)(const char *) = NULL; diff --git a/polymer/eduke32/build/src/mdsprite.c b/polymer/eduke32/build/src/mdsprite.c index 9f0ae69e4..3cb3e1ed7 100644 --- a/polymer/eduke32/build/src/mdsprite.c +++ b/polymer/eduke32/build/src/mdsprite.c @@ -29,7 +29,7 @@ static void QuitOnFatalError(const char *msg) if (msg) initprintf("%s\n", msg); uninitengine(); - exit(1); + Bexit(1); } diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index 0e217c85a..9cb2e8252 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -384,7 +384,7 @@ static void sighandler(int signum) attach_debugger_here(); app_crashhandler(); uninitsystem(); - exit(8); + Bexit(8); } } diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 3e2c09540..e1f1f0167 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -8598,7 +8598,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) if (!Bstrcasecmp(c+1,"?") || !Bstrcasecmp(c+1,"help") || !Bstrcasecmp(c+1,"-help")) { G_ShowParameterHelp(); - exit(0); + Bexit(0); } if (!Bstrcasecmp(c+1, "g") || !Bstrcasecmp(c+1, "grp")) @@ -8962,7 +8962,7 @@ static int32_t osdcmd_quit(const osdfuncparm_t *parm) Bfflush(NULL); - exit(0); + Bexit(0); } static int32_t osdcmd_editorgridextent(const osdfuncparm_t *parm) diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 8dcc98c41..0a0f35c02 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -9752,7 +9752,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) if (!Bstrcasecmp(c+1,"?") || !Bstrcasecmp(c+1,"help") || !Bstrcasecmp(c+1,"-help")) { G_ShowParameterHelp(); - exit(0); + Bexit(0); } if (!Bstrcasecmp(c+1,"addon")) { @@ -9772,7 +9772,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv) if (!Bstrcasecmp(c+1,"debughelp") || !Bstrcasecmp(c+1,"-debughelp")) { G_ShowDebugHelp(); - exit(0); + Bexit(0); } if (!Bstrcasecmp(c+1,"grp") || !Bstrcasecmp(c+1,"g")) { @@ -10822,7 +10822,7 @@ static void G_Startup(void) "There was a problem initializing the Build engine: %s", engineerrstr); G_Cleanup(); ERRprintf("G_Startup: There was a problem initializing the Build engine: %s\n", engineerrstr); - exit(6); + Bexit(6); } setbasepaltable(basepaltable, BASEPALCOUNT); @@ -11420,7 +11420,7 @@ int32_t app_main(int32_t argc, const char **argv) wm_msgbox("Build Engine Initialization Error", "There was a problem initializing the Build engine: %s", engineerrstr); ERRprintf("app_main: There was a problem initializing the Build engine: %s\n", engineerrstr); - exit(2); + Bexit(2); } if (Bstrcmp(setupfilename, SETUPFILENAME)) @@ -11470,7 +11470,7 @@ int32_t app_main(int32_t argc, const char **argv) if (quitevent || !startwin_run()) { uninitengine(); - exit(0); + Bexit(0); } } #endif @@ -11726,7 +11726,7 @@ int32_t app_main(int32_t argc, const char **argv) { ERRprintf("There was an error initializing the CONTROL system.\n"); uninitengine(); - exit(5); + Bexit(5); } G_SetupGameButtons(); diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 59bc9ce22..689b7e6f0 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -2530,7 +2530,7 @@ static int32_t C_ParseCommand(int32_t loop) { initprintf("Aborted.\n"); G_Shutdown(); - exit(0); + Bexit(0); } if (g_numCompilerErrors > 63 || (*textptr == '\0') || (*(textptr+1) == '\0') || C_SkipComments()) diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index 7dfcc0bb1..5fa3afdb5 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -1496,7 +1496,7 @@ void Gv_InitWeaponPointers(void) if (!aplWeaponClip[i]) { initprintf("ERROR: NULL weapon! WTF?!\n"); - // exit(0); + // Bexit(0); G_Shutdown(); } Bsprintf(aszBuf,"WEAPON%d_RELOAD",i);