From 4fa20a3d9fd14fd131f944ad6f2bca4c4944fbd0 Mon Sep 17 00:00:00 2001 From: Chris Taylor Date: Sun, 28 Nov 2010 20:08:29 +0800 Subject: [PATCH] Add support for OS native error/warning boxes, only implemented for Mac for now --- CHANGELOG.txt | 1 + SConstruct | 7 +- arch/carbon/findfile.c | 134 -------------------------- arch/carbon/gui.c | 34 ------- arch/carbon/messagebox.c | 83 ++++++++++++++++ arch/include/messagebox.h | 18 ++++ arch/linux/messagebox.c | 37 +++++++ arch/sdl/rbaudio.c | 4 +- arch/win32/messagebox.c | 37 +++++++ d2x-rebirth.xcodeproj/project.pbxproj | 72 ++++++-------- main/editor/med.c | 2 +- main/game.c | 8 -- main/inferno.c | 14 +-- 13 files changed, 221 insertions(+), 230 deletions(-) delete mode 100644 arch/carbon/findfile.c delete mode 100644 arch/carbon/gui.c create mode 100644 arch/carbon/messagebox.c create mode 100644 arch/include/messagebox.h create mode 100644 arch/linux/messagebox.c create mode 100644 arch/win32/messagebox.c diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 7d34e14f7..61ff92766 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,7 @@ D2X-Rebirth Changelog -------- main/multi.c: In multi_new_game when initializing Players structures, also correctly init connected variable which is highly important for spreading pdata to clients and should be set correctly anyways (Thanks to Gold Leader and Flip for help with debugging/testing recent Multiplayer bugs) main/powerup.c: in do_powerup added check for distance of other players to powerup object to make redundant pickups less likely +arch/carbon/messagebox.c, arch/include/messagebox.h, arch/linux/messagebox.c, arch/sdl/rbaudio.c, arch/win32/messagebox.c, d2x-rebirth.xcodeproj/project.pbxproj, main/editor/med.c, main/game.c, main/inferno.c, SConstruct: Add support for OS native error/warning boxes, only implemented for Mac for now 20101126 -------- diff --git a/SConstruct b/SConstruct index 7cea93dbb..d8910d6f5 100644 --- a/SConstruct +++ b/SConstruct @@ -308,6 +308,7 @@ if sys.platform == 'win32': ogldefines = ['OGL'] if (use_ipx == 1): common_sources += ['arch/win32/ipx.c'] + common_sources += ['arch/win32/messagebox.c'] ogllibs = '' libs += ['glu32', 'wsock32', 'winmm', 'mingw32', 'SDLmain', 'SDL'] lflags = '-mwindows arch/win32/d2xr.res' @@ -319,11 +320,12 @@ elif sys.platform == 'darwin': asm = 0 env.Append(CPPPATH = ['arch/linux/include']) ogldefines = ['OGL'] - common_sources += 'arch/cocoa/SDLMain.m' + common_sources += ['arch/cocoa/SDLMain.m', 'arch/carbon/messagebox.c'] ogllibs = '' libs = '' # Ugly way of linking to frameworks, but kreator has seen uglier - lflags = '-framework Cocoa -framework SDL -framework physfs' + lflags = '-framework ApplicationServices -framework Carbon -framework Cocoa -framework SDL' + libs += '../physfs/build/Debug/libphysfs.dylib' if (sdl_only == 0): lflags += ' -framework OpenGL' if (sdlmixer == 1): @@ -348,6 +350,7 @@ else: ogldefines = ['OGL'] if (use_ipx == 1): common_sources += ['arch/linux/ipx.c', 'arch/linux/ipx_kali.c', 'arch/linux/ukali.c'] + common_sources += 'arch/linux/messagebox.c' libs += env['LIBS'] ogllibs = ['GL', 'GLU'] lflags = '-L/usr/X11R6/lib' diff --git a/arch/carbon/findfile.c b/arch/carbon/findfile.c deleted file mode 100644 index f11491f9f..000000000 --- a/arch/carbon/findfile.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * findfile.c - * D2X (Descent2) - * - * Created by Chris Taylor on Tue Jun 22 2004. - * - */ - -#include "pstypes.h" -#include "findfile.h" -#include "u_mem.h" -#include "strutil.h" - -#ifdef macintosh -#include -extern void macify_posix_path(char *posix_path, char *mac_path); -#else -#include -#endif - -// Global Variables - -FSIterator iterator; -int path_len; -FSRef *refs; -int i; -char type[5]; -ItemCount num_new_files; - - -// Functions - -int FileFindFirst(char *search_str, FILEFINDSTRUCT *ffstruct) -{ - FSRef parent; - char path[_MAX_PATH]; - OSStatus myErr; - - for (path_len = 0; *search_str && *search_str != '*'; path_len ++) - path[path_len] = *search_str++; - path[path_len] = 0; - if (*search_str == '*') - search_str++; - strcpy(type, search_str); - -#ifdef macintosh - // Convert the search directory to an FSRef in a way that OS 9 can handle - { - FSSpec parentSpec; - Str255 pascalPath; - - macify_posix_path(path, path); - CopyCStringToPascal(path, pascalPath); - if (FSMakeFSSpec(0, 0, pascalPath, &parentSpec) != noErr) - return 1; - if (FSpMakeFSRef(&parentSpec, &parent) != noErr) - return 1; - } -#else -// "This function, though available through Carbon on Mac OS 8 and 9, is only implemented on Mac OS X." - if ((myErr = FSPathMakeRef((unsigned char const *) (path_len? path : "."), &parent, NULL)) != noErr) - return 1; -#endif - if (FSRefMakePath(&parent, (unsigned char *) path, _MAX_PATH) != noErr) // Get the full path, to get the length - return 1; - path_len = strlen(path) -#ifndef macintosh - + 1 // For the '/' -#endif - ; - - if (FSOpenIterator(&parent, kFSIterateFlat, &iterator) != noErr) - return 1; - - MALLOC(refs, FSRef, 256); - - myErr = FSGetCatalogInfoBulk(iterator, 256, &num_new_files, NULL, kFSCatInfoNone, NULL, refs, NULL, NULL); - - i = 0; - do { - char *p = path + path_len; - - if (i >= num_new_files) { - if (!myErr) { - myErr = FSGetCatalogInfoBulk(iterator, 256, &num_new_files, NULL, kFSCatInfoNone, NULL, refs, NULL, NULL); - i = 0; - } else - return 1; // The last file - } - - FSRefMakePath (refs + i, (unsigned char *) path, 255); - - i++; - if (!stricmp(p + strlen(p) - strlen(search_str), search_str)) { - strncpy(ffstruct->name, p, 256); - return 0; // Found one - } - } while (1); -} - -int FileFindNext(FILEFINDSTRUCT *ffstruct) -{ - OSErr myErr; - - do { - char path[_MAX_PATH]; - char *p = path + path_len; - - if (i >= num_new_files) { - if (!myErr) { - myErr = FSGetCatalogInfoBulk(iterator, 256, &num_new_files, NULL, kFSCatInfoNone, NULL, refs, NULL, NULL); - i = 0; - } else - return 1; // The last file - } - - FSRefMakePath (refs + i, (unsigned char *) path, 255); - - i++; - if (!stricmp(p + strlen(p) - strlen(type), type)) { - strncpy(ffstruct->name, p, 256); - return 0; // Found one - } - } while (1); -} - -int FileFindClose(void) -{ - d_free(refs); - if (FSCloseIterator(iterator) != noErr) - return 1; - - return 0; -} diff --git a/arch/carbon/gui.c b/arch/carbon/gui.c deleted file mode 100644 index 282bf3354..000000000 --- a/arch/carbon/gui.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * gui.c - * D2X (Descent2) - * - * Created by Chris Taylor on Sat Jul 03 2004. - * - */ - -#ifdef __APPLE__ -#include -#else -#include -#endif - -void ErrorDialog(char *message) -{ - Str255 pascal_message; - short itemHit; // Insists on returning this - - CopyCStringToPascal(message, pascal_message); - ShowCursor(); - StandardAlert(kAlertStopAlert, pascal_message, NULL, 0, &itemHit); -} - -void WarningDialog(char *s) -{ - Str255 pascal_message; - short itemHit; // Insists on returning this - - CopyCStringToPascal(s, pascal_message); - ShowCursor(); - StandardAlert(kAlertCautionAlert, pascal_message, NULL, 0, &itemHit); - HideCursor(); -} diff --git a/arch/carbon/messagebox.c b/arch/carbon/messagebox.c new file mode 100644 index 000000000..b80281f47 --- /dev/null +++ b/arch/carbon/messagebox.c @@ -0,0 +1,83 @@ +/* + * messagebox.c + * d1x-rebirth + * + * Display an error or warning messagebox using the OS's window server. + * + */ + +#ifdef __APPLE__ +#include +#else +#include +#endif + +#include "window.h" +#include "event.h" +#include "messagebox.h" + +void display_mac_alert(char *message, int error) +{ + int16_t itemHit; + uint response; + bool osX = FALSE; + d_event event = { EVENT_WINDOW_DEACTIVATED }; + window *wind; + + // Handle Descent's windows properly + if ((wind = window_get_front())) + window_send_event(window_get_front(), &event); + event.type = EVENT_WINDOW_ACTIVATED; + + osX = ( Gestalt(gestaltSystemVersion, (long *) &response) == noErr) + && (response >= 0x01000 ); + + if (osX) + { +#ifdef TARGET_API_MAC_CARBON + DialogRef alert; + CFStringRef error_text = CFSTR("Sorry, a critical error has occurred."); + CFStringRef text = NULL; + + text = CFStringCreateWithCString(CFAllocatorGetDefault(), message, kCFStringEncodingMacRoman); + if (!text) + { + if (wind) window_send_event(window_get_front(), &event); + return; + } + + if (CreateStandardAlert(error ? kAlertStopAlert : kAlertNoteAlert, error ? error_text : text, error ? text : NULL, 0, &alert) != noErr) + { + CFRelease(text); + if (wind) window_send_event(window_get_front(), &event); + return; + } + + RunStandardAlert(alert, 0, &itemHit); + CFRelease(text); +#endif + } + else + { + Str255 error_text = "\pSorry, a critical error has occurred."; + Str255 text; + +#if !defined(MAC_OS_X_VERSION_MAX_ALLOWED) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4) // kill warning + CopyCStringToPascal(message, text); +#endif + StandardAlert(error ? kAlertStopAlert : kAlertNoteAlert, error ? error_text : text, error ? text : NULL, 0, &itemHit); + } + + if (wind) + window_send_event(window_get_front(), &event); +} + +void msgbox_warning(char *message) +{ + display_mac_alert(message, 0); +} + +void msgbox_error(char *message) +{ + display_mac_alert(message, 1); +} diff --git a/arch/include/messagebox.h b/arch/include/messagebox.h new file mode 100644 index 000000000..62d5ebe58 --- /dev/null +++ b/arch/include/messagebox.h @@ -0,0 +1,18 @@ +/* + * messagebox.h + * d1x-rebirth + * + * Display an error or warning messagebox using the OS's window server. + * + */ + +#ifndef _MESSAGEBOX_H +#define _MESSAGEBOX_H + +// Display a warning in a messagebox +extern void msgbox_warning(char *message); + +// Display an error in a messagebox +extern void msgbox_error(char *message); + +#endif \ No newline at end of file diff --git a/arch/linux/messagebox.c b/arch/linux/messagebox.c new file mode 100644 index 000000000..2c464f163 --- /dev/null +++ b/arch/linux/messagebox.c @@ -0,0 +1,37 @@ +/* + * messagebox.c + * d1x-rebirth + * + * Display an error or warning messagebox using the OS's window server. + * + */ + +#include "window.h" +#include "event.h" +#include "messagebox.h" + +void display_linux_alert(char *message, int error) +{ + d_event event = { EVENT_WINDOW_DEACTIVATED }; + window *wind; + + // Handle Descent's windows properly + if ((wind = window_get_front())) + window_send_event(window_get_front(), &event); + event.type = EVENT_WINDOW_ACTIVATED; + + // TODO: insert messagebox code... + + if (wind) + window_send_event(window_get_front(), &event); +} + +void msgbox_warning(char *message) +{ + display_linux_alert(message, 0); +} + +void msgbox_error(char *message) +{ + display_linux_alert(message, 1); +} diff --git a/arch/sdl/rbaudio.c b/arch/sdl/rbaudio.c index 6bb9d464b..46a52182e 100644 --- a/arch/sdl/rbaudio.c +++ b/arch/sdl/rbaudio.c @@ -53,7 +53,7 @@ void RBAInit() num_cds = SDL_CDNumDrives(); if (num_cds < 1) { - Warning("No cdrom drives found!\n"); + con_printf(CON_NORMAL, "No cdrom drives found!\n"); #if defined(__APPLE__) || defined(macintosh) SDL_QuitSubSystem(SDL_INIT_CDROM); // necessary for rescanning CDROMs #endif @@ -83,7 +83,7 @@ void RBAInit() if (i == num_cds) { - Warning("No audio CDs found\n"); + con_printf(CON_NORMAL, "No audio CDs found\n"); if (s_cd) // if there's no audio CD, say that there's no redbook and hence play MIDI instead { SDL_CDClose(s_cd); diff --git a/arch/win32/messagebox.c b/arch/win32/messagebox.c new file mode 100644 index 000000000..10609d20b --- /dev/null +++ b/arch/win32/messagebox.c @@ -0,0 +1,37 @@ +/* + * messagebox.c + * d1x-rebirth + * + * Display an error or warning messagebox using the OS's window server. + * + */ + +#include "window.h" +#include "event.h" +#include "messagebox.h" + +void display_win32_alert(char *message, int error) +{ + d_event event = { EVENT_WINDOW_DEACTIVATED }; + window *wind; + + // Handle Descent's windows properly + if ((wind = window_get_front())) + window_send_event(window_get_front(), &event); + event.type = EVENT_WINDOW_ACTIVATED; + + // TODO: insert messagebox code... + + if (wind) + window_send_event(window_get_front(), &event); +} + +void msgbox_warning(char *message) +{ + display_win32_alert(message, 0); +} + +void msgbox_error(char *message) +{ + display_win32_alert(message, 1); +} diff --git a/d2x-rebirth.xcodeproj/project.pbxproj b/d2x-rebirth.xcodeproj/project.pbxproj index bed7d5998..34b3c4647 100755 --- a/d2x-rebirth.xcodeproj/project.pbxproj +++ b/d2x-rebirth.xcodeproj/project.pbxproj @@ -340,6 +340,8 @@ 67F6FED3066B13B400443922 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = 67F6FED1066B13B400443922 /* SDLMain.m */; }; 67F6FED4066B13B400443922 /* SDLMain.h in Headers */ = {isa = PBXBuildFile; fileRef = 67F6FED0066B13B400443922 /* SDLMain.h */; }; 67F6FED5066B13B400443922 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = 67F6FED1066B13B400443922 /* SDLMain.m */; }; + EB092A8012A25AFB004D9A79 /* messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = EB092A7F12A25AFB004D9A79 /* messagebox.c */; }; + EB092A8112A25AFB004D9A79 /* messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = EB092A7F12A25AFB004D9A79 /* messagebox.c */; }; EB1405E9121044B5002B1CC6 /* physfsx.c in Sources */ = {isa = PBXBuildFile; fileRef = EB1405E8121044B5002B1CC6 /* physfsx.c */; }; EB1405EA121044B5002B1CC6 /* physfsx.c in Sources */ = {isa = PBXBuildFile; fileRef = EB1405E8121044B5002B1CC6 /* physfsx.c */; }; EB28D9A30ECEAF1C00E68E9B /* init.c in Sources */ = {isa = PBXBuildFile; fileRef = EB28D9A20ECEAF1C00E68E9B /* init.c */; }; @@ -640,6 +642,16 @@ EB0421040A341042002CC961 /* ai.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ai.h; sourceTree = ""; }; EB0421050A341042002CC961 /* controls.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = controls.h; sourceTree = ""; }; EB0421060A341042002CC961 /* config.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = ""; }; + EB092A7F12A25AFB004D9A79 /* messagebox.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = messagebox.c; sourceTree = ""; }; + EB092A8412A25EB1004D9A79 /* messagebox.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = messagebox.c; sourceTree = ""; }; + EB092A8512A25EC8004D9A79 /* messagebox.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = messagebox.c; sourceTree = ""; }; + EB092A8712A25EE4004D9A79 /* d3dhelp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = d3dhelp.h; sourceTree = ""; }; + EB092A8812A25EE4004D9A79 /* debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = debug.h; sourceTree = ""; }; + EB092A8912A25EE4004D9A79 /* pch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pch.h; sourceTree = ""; }; + EB092A8A12A25EE4004D9A79 /* resource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resource.h; sourceTree = ""; }; + EB092A8B12A25EE4004D9A79 /* scene.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scene.h; sourceTree = ""; }; + EB092A8C12A25EE4004D9A79 /* texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = texture.h; sourceTree = ""; }; + EB092A8D12A25EE4004D9A79 /* wsipx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wsipx.h; sourceTree = ""; }; EB1405E8121044B5002B1CC6 /* physfsx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = physfsx.c; sourceTree = ""; }; EB28D9A20ECEAF1C00E68E9B /* init.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = init.c; sourceTree = ""; }; EB91A437126175ED009E0095 /* libphysfs.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libphysfs.dylib; path = ../physfs/build/Release/libphysfs.dylib; sourceTree = SOURCE_ROOT; }; @@ -661,8 +673,6 @@ EBAFC24B088E4C53006329AD /* physfsrwops.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = physfsrwops.h; sourceTree = ""; }; EBAFC269088E508D006329AD /* conf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = conf.h; sourceTree = ""; }; EBAFC26A088E508D006329AD /* descent.r */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.rez; path = descent.r; sourceTree = ""; }; - EBAFC26B088E508D006329AD /* findfile.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = findfile.c; sourceTree = ""; }; - EBAFC26C088E508D006329AD /* gui.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = gui.c; sourceTree = ""; }; EBAFC26D088E508D006329AD /* SDL_main.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_main.c; sourceTree = ""; }; EBAFC28F088E67CD006329AD /* digiobj.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = digiobj.c; sourceTree = ""; }; EBAFC2B0088E695F006329AD /* ignorecase.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ignorecase.c; sourceTree = ""; }; @@ -673,15 +683,6 @@ EBB9E5330D8E82B3003466E6 /* clip.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = clip.h; sourceTree = ""; }; EBB9E5380D8E82FF003466E6 /* clipper.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = clipper.h; sourceTree = ""; }; EBB9E5390D8E82FF003466E6 /* globvars.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = globvars.h; sourceTree = ""; }; - EBB9E53B0D8E8378003466E6 /* hmpfile.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = hmpfile.c; sourceTree = ""; }; - EBB9E53D0D8E8378003466E6 /* d3dhelp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = d3dhelp.h; sourceTree = ""; }; - EBB9E53E0D8E8378003466E6 /* debug.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = debug.h; sourceTree = ""; }; - EBB9E53F0D8E8378003466E6 /* hmpfile.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = hmpfile.h; sourceTree = ""; }; - EBB9E5400D8E8378003466E6 /* pch.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = pch.h; sourceTree = ""; }; - EBB9E5410D8E8378003466E6 /* resource.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = resource.h; sourceTree = ""; }; - EBB9E5420D8E8378003466E6 /* scene.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = scene.h; sourceTree = ""; }; - EBB9E5430D8E8378003466E6 /* texture.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = texture.h; sourceTree = ""; }; - EBB9E5450D8E8378003466E6 /* wsipx.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = wsipx.h; sourceTree = ""; }; EBB9E5480D8E83F2003466E6 /* internal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = internal.h; sourceTree = ""; }; EBB9E5490D8E83F2003466E6 /* loadgl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = loadgl.h; sourceTree = ""; }; EBB9E54B0D8E8429003466E6 /* decoders.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = decoders.h; sourceTree = ""; }; @@ -689,7 +690,6 @@ EBB9E54D0D8E8429003466E6 /* mvelib.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = mvelib.h; sourceTree = ""; }; EBB9E5620D8E8690003466E6 /* alsadigi.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = alsadigi.c; sourceTree = ""; }; EBB9E5630D8E8691003466E6 /* hmiplay.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = hmiplay.c; sourceTree = ""; }; - EBB9E5640D8E8691003466E6 /* hmistub.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = hmistub.c; sourceTree = ""; }; EBB9E5670D8E8691003466E6 /* music.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = music.h; sourceTree = ""; }; EBB9E5680D8E8691003466E6 /* ukali.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ukali.h; sourceTree = ""; }; EBB9E56C0D8E8691003466E6 /* ukali.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ukali.c; sourceTree = ""; }; @@ -923,13 +923,6 @@ name = Frameworks; sourceTree = ""; }; - 67603357066B3AE0008A67A3 /* include */ = { - isa = PBXGroup; - children = ( - ); - path = include; - sourceTree = ""; - }; 676AC04B0668A814007173EB /* ogl */ = { isa = PBXGroup; children = ( @@ -1005,14 +998,13 @@ 67B44193066879B000DF26D8 /* linux */ = { isa = PBXGroup; children = ( + EB092A8412A25EB1004D9A79 /* messagebox.c */, EBB9E5620D8E8690003466E6 /* alsadigi.c */, EBB9E5630D8E8691003466E6 /* hmiplay.c */, - EBB9E5640D8E8691003466E6 /* hmistub.c */, EBB9E5650D8E8691003466E6 /* include */, EBF6589B0F936BA200CB5C73 /* ipx.c */, EBF6589C0F936BA200CB5C73 /* ipx_kali.c */, EBB9E56C0D8E8691003466E6 /* ukali.c */, - 67603357066B3AE0008A67A3 /* include */, ); name = linux; path = arch/linux; @@ -1324,13 +1316,26 @@ path = include; sourceTree = SOURCE_ROOT; }; + EB092A8612A25EE4004D9A79 /* include */ = { + isa = PBXGroup; + children = ( + EB092A8712A25EE4004D9A79 /* d3dhelp.h */, + EB092A8812A25EE4004D9A79 /* debug.h */, + EB092A8912A25EE4004D9A79 /* pch.h */, + EB092A8A12A25EE4004D9A79 /* resource.h */, + EB092A8B12A25EE4004D9A79 /* scene.h */, + EB092A8C12A25EE4004D9A79 /* texture.h */, + EB092A8D12A25EE4004D9A79 /* wsipx.h */, + ); + path = include; + sourceTree = ""; + }; EBAFC268088E508D006329AD /* carbon */ = { isa = PBXGroup; children = ( + EB092A7F12A25AFB004D9A79 /* messagebox.c */, EBAFC269088E508D006329AD /* conf.h */, EBAFC26A088E508D006329AD /* descent.r */, - EBAFC26B088E508D006329AD /* findfile.c */, - EBAFC26C088E508D006329AD /* gui.c */, EBAFC26D088E508D006329AD /* SDL_main.c */, ); name = carbon; @@ -1340,29 +1345,14 @@ EBB9E53A0D8E8378003466E6 /* win32 */ = { isa = PBXGroup; children = ( - EBB9E53B0D8E8378003466E6 /* hmpfile.c */, - EBB9E53C0D8E8378003466E6 /* include */, + EB092A8612A25EE4004D9A79 /* include */, + EB092A8512A25EC8004D9A79 /* messagebox.c */, EBF6589D0F936BD800CB5C73 /* ipx.c */, ); name = win32; path = arch/win32; sourceTree = ""; }; - EBB9E53C0D8E8378003466E6 /* include */ = { - isa = PBXGroup; - children = ( - EBB9E53D0D8E8378003466E6 /* d3dhelp.h */, - EBB9E53E0D8E8378003466E6 /* debug.h */, - EBB9E53F0D8E8378003466E6 /* hmpfile.h */, - EBB9E5400D8E8378003466E6 /* pch.h */, - EBB9E5410D8E8378003466E6 /* resource.h */, - EBB9E5420D8E8378003466E6 /* scene.h */, - EBB9E5430D8E8378003466E6 /* texture.h */, - EBB9E5450D8E8378003466E6 /* wsipx.h */, - ); - path = include; - sourceTree = ""; - }; EBB9E5650D8E8691003466E6 /* include */ = { isa = PBXGroup; children = ( @@ -1838,6 +1828,7 @@ 17DFA6B910C1A2D100674D11 /* net_udp.c in Sources */, 179E6ECE11F37C0500175C54 /* hmp.c in Sources */, EB1405EA121044B5002B1CC6 /* physfsx.c in Sources */, + EB092A8112A25AFB004D9A79 /* messagebox.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1980,6 +1971,7 @@ EB2EEB5810C50CE2005256F2 /* net_udp.c in Sources */, 179E6ECF11F37C0500175C54 /* hmp.c in Sources */, EB1405E9121044B5002B1CC6 /* physfsx.c in Sources */, + EB092A8012A25AFB004D9A79 /* messagebox.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/main/editor/med.c b/main/editor/med.c index 6cd565d9e..0db74566a 100644 --- a/main/editor/med.c +++ b/main/editor/med.c @@ -1350,7 +1350,7 @@ void editor(void) // _MARK_("end of editor");//Nuked to compile -KRB - clear_warn_func(med_show_warning); + set_warn_func(msgbox_warning); //kill our camera object diff --git a/main/game.c b/main/game.c index ac0de55d5..a98927238 100644 --- a/main/game.c +++ b/main/game.c @@ -193,11 +193,6 @@ void reset_palette_add() } -void game_show_warning(char *s) -{ - nm_messagebox( TXT_WARNING, 1, TXT_OK, s ); -} - u_int32_t Game_screen_mode = SM(640,480); //initialize the various canvases on the game screen @@ -1128,7 +1123,6 @@ window *game_setup(void) return NULL; reset_palette_add(); - set_warn_func(game_show_warning); init_cockpit(); init_gauges(); @@ -1238,7 +1232,6 @@ int game_handler(window *wind, d_event *event, void *data) songs_play_song( SONG_TITLE, 1 ); - clear_warn_func(game_show_warning); //don't use this func anymore game_disable_cheats(); Game_mode = GM_GAME_OVER; show_menus(); @@ -1274,7 +1267,6 @@ void close_game() close_gauges(); restore_effect_bitmap_icons(); - clear_warn_func(game_show_warning); //don't use this func anymore } diff --git a/main/inferno.c b/main/inferno.c index d93b31caf..80338000f 100644 --- a/main/inferno.c +++ b/main/inferno.c @@ -87,6 +87,7 @@ char copyright[] = "DESCENT II COPYRIGHT (C) 1994-1996 PARALLAX SOFTWARE CORPOR #include "../texmap/scanline.h" //for select_tmap -MM #include "event.h" #include "rbaudio.h" +#include "messagebox.h" #ifdef EDITOR #include "editor/editor.h" @@ -323,7 +324,8 @@ char Auto_file[128] = ""; int main(int argc, char *argv[]) { mem_init(); - error_init(NULL, NULL); + error_init(msgbox_error, NULL); + set_warn_func(msgbox_warning); PHYSFSX_init(argc, argv); con_init(); // Initialise the console @@ -343,7 +345,7 @@ int main(int argc, char *argv[]) printf("\nType %s -help' for a list of command-line options.\n\n", PROGNAME); PHYSFSX_listSearchPathContent(); - + if (!PHYSFSX_checkSupportedArchiveTypes()) return(0); @@ -383,10 +385,7 @@ int main(int argc, char *argv[]) con_printf(CON_NORMAL, " Copyright (c) 2005 Christian Beckhaeuser\n\n"); if (GameArg.DbgVerbose) - { - con_printf(CON_VERBOSE,"%s", TXT_VERBOSE_1); - con_printf(CON_VERBOSE,"%s", "\n"); - } + con_printf(CON_VERBOSE,"%s%s", TXT_VERBOSE_1, "\n"); ReadConfigFile(); @@ -430,8 +429,6 @@ int main(int argc, char *argv[]) if (GameArg.DbgNoRun) return(0); - error_init(error_messagebox, NULL); - con_printf( CON_DEBUG, "\nInitializing texture caching system..." ); texmerge_init( 10 ); // 10 cache bitmaps @@ -499,7 +496,6 @@ int main(int argc, char *argv[]) show_order_form(); con_printf( CON_DEBUG, "\nCleanup...\n" ); - error_init(NULL, NULL); // clear error func (won't have newmenu stuff loaded) close_game(); texmerge_close(); gamedata_close();