diff --git a/source/build/include/baselayer.h b/source/build/include/baselayer.h index b2ed46637..cc8cc4d57 100644 --- a/source/build/include/baselayer.h +++ b/source/build/include/baselayer.h @@ -56,9 +56,6 @@ void mouseGrabInput(bool grab); void getScreen(uint8_t* imgBuf); -int32_t wm_msgbox(const char *name, const char *fmt, ...) ATTRIBUTE((format(printf,2,3))); -int32_t wm_ynbox(const char *name, const char *fmt, ...) ATTRIBUTE((format(printf,2,3))); - #include "print.h" struct GameStats diff --git a/source/build/src/sdlayer.cpp b/source/build/src/sdlayer.cpp index 3096cf1db..aa3028e3f 100644 --- a/source/build/src/sdlayer.cpp +++ b/source/build/src/sdlayer.cpp @@ -151,52 +151,6 @@ void I_FatalError(const char* error, ...) } -int32_t wm_msgbox(const char *name, const char *fmt, ...) -{ - char buf[2048]; - va_list va; - - UNREFERENCED_PARAMETER(name); - - va_start(va,fmt); - vsnprintf(buf,sizeof(buf),fmt,va); - va_end(va); - -#if defined EDUKE32_OSX - return osx_msgbox(name, buf); -#elif defined _WIN32 - MessageBoxA(nullptr,buf,name,MB_OK|MB_TASKMODAL); - return 0; -#elif defined EDUKE32_TOUCH_DEVICES - initprintf("wm_msgbox called. Message: %s: %s",name,buf); - return 0; -#elif defined GEKKO - puts(buf); - return 0; -#else -# if defined HAVE_GTK2 - if (gtkbuild_msgbox(name, buf) >= 0) - return 0; -# endif -# if SDL_MAJOR_VERSION > 1 -# if !defined _WIN32 - // Replace all tab chars with spaces because the hand-rolled SDL message - // box diplays the former as N/L instead of whitespace. - for (size_t i=0; iapp_main(); } +void G_HandleMemErr(int32_t lineNum, const char* fileName, const char* funcName) +{ + I_FatalError("Out of memory in %s:%d (%s)\n", fileName, lineNum, funcName); +} + +void G_FatalEngineError(void) +{ + I_FatalError("Fatal Engine Initialization Error", + "There was a problem initializing the engine: %s\n\nThe application will now close.", engineerrstr); +} + + //========================================================================== // // diff --git a/source/common/gamecontrol.h b/source/common/gamecontrol.h index 3e1b52380..ca1ff4cac 100644 --- a/source/common/gamecontrol.h +++ b/source/common/gamecontrol.h @@ -149,3 +149,6 @@ const char* G_ConFile(void); TArray GrpScan(); void S_SetSoundPaused(int state); + +void G_HandleMemErr(int32_t lineNum, const char* fileName, const char* funcName); +void G_FatalEngineError(void); diff --git a/source/duke3d/src/game.cpp b/source/duke3d/src/game.cpp index fc35aa29d..22c55c8fd 100644 --- a/source/duke3d/src/game.cpp +++ b/source/duke3d/src/game.cpp @@ -5505,23 +5505,10 @@ void G_PostCreateGameState(void) A_InitEnemyFlags(); } -static void G_HandleMemErr(int32_t lineNum, const char *fileName, const char *funcName) -{ - I_FatalError("Out of memory in %s:%d (%s)\n", fileName, lineNum, funcName); -} - -static void G_FatalEngineError(void) -{ - I_FatalError("Fatal Engine Initialization Error", - "There was a problem initializing the engine: %s\n\nThe application will now close.", engineerrstr); -} - static void G_Startup(void) { int32_t i; - set_memerr_handler(&G_HandleMemErr); - timerInit(TICRATE); timerSetCallback(gameTimerHandler); diff --git a/source/rr/src/game.cpp b/source/rr/src/game.cpp index 47dcbba3a..316daf9a4 100644 --- a/source/rr/src/game.cpp +++ b/source/rr/src/game.cpp @@ -6947,31 +6947,10 @@ void G_PostCreateGameState(void) A_InitEnemyFlags(); } -static void G_HandleMemErr(int32_t lineNum, const char *fileName, const char *funcName) -{ - static char msg[128]; - Bsnprintf(msg, sizeof(msg), "Out of memory in %s:%d (%s)\n", fileName, lineNum, funcName); -#ifdef DEBUGGINGAIDS - Bassert(0); -#endif - G_GameExit(msg); -} - -static void G_FatalEngineError(void) -{ - wm_msgbox("Build Engine Initialization Error", - "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); -} - static void G_Startup(void) { int32_t i; - set_memerr_handler(&G_HandleMemErr); - timerInit(TICRATE); timerSetCallback(gameTimerHandler); diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index e9166f7d2..5dd6a63c2 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -703,19 +703,8 @@ void MultiSharewareCheck(void) if (!SW_SHAREWARE) return; if (numplayers > 4) { -#if 1 /* defined RENDERTYPEWIN */ - wm_msgbox(apptitle,"To play a Network game with more than 4 players you must purchase " + I_FatalError("To play a Network game with more than 4 players you must purchase " "the full version. Read the Ordering Info screens for details."); -#else - printf( - "\n\nTo play a Network game with more than 4 players you must purchase the\n" - "full version. Read the Ordering Info screens for details.\n\n"); -#endif - //uninitmultiplayers(); - //uninitkeys(); - engineUnInit(); - timerUninit(); - Bexit(0); } } @@ -2500,48 +2489,10 @@ void Control() void _Assert(const char *expr, const char *strFile, unsigned uLine) { - buildprintf(ds, "Assertion failed: %s %s, line %u", expr, strFile, uLine); - debug_break(); - - TerminateGame(); - -#if 1 /* defined RENDERTYPEWIN */ - wm_msgbox(apptitle, "%s", ds); -#else - printf("Assertion failed: %s\n %s, line %u\n", expr, strFile, uLine); -#endif - exit(0); + I_FatalError("Assertion failed: %s %s, line %u", expr, strFile, uLine); } -void _ErrMsg(const char *strFile, unsigned uLine, const char *format, ...) -{ - va_list arglist; - - //DSPRINTF(ds, "Error: %s, line %u", strFile, uLine); - //MONO_PRINT(ds); - TerminateGame(); - -#if 1 /* defined RENDERTYPEWIN */ - { - char msg[256], *p; - Bsnprintf(msg, sizeof(msg), "Error: %s, line %u\n", strFile, uLine); - p = &msg[strlen(msg)]; - va_start(arglist, format); - Bvsnprintf(msg, sizeof(msg) - (p-msg), format, arglist); - va_end(arglist); - wm_msgbox(apptitle, "%s", msg); - } -#else - printf("Error: %s, line %u\n", strFile, uLine); - - va_start(arglist, format); - vprintf(format, arglist); - va_end(arglist); -#endif - - exit(0); -} void dsprintf(char *str, const char *format, ...) { diff --git a/source/sw/src/rooms.cpp b/source/sw/src/rooms.cpp index bf3befdfe..1122691b2 100644 --- a/source/sw/src/rooms.cpp +++ b/source/sw/src/rooms.cpp @@ -33,7 +33,6 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms BEGIN_SW_NS -void _ErrMsg(const char *strFile, unsigned uLine, const char *format, ...); void FAF_DrawRooms(int posx, int posy, int posz, short ang, int horiz, short cursectnum); ////////////////////////////////////////////////////////////////////