diff -Naurd ../nethack-3.4.1/include/mac-carbon.h ./include/mac-carbon.h --- ../nethack-3.4.1/include/mac-carbon.h Thu Jan 1 01:00:00 1970 +++ ./include/mac-carbon.h Mon Sep 1 14:33:32 2003 @@ -0,0 +1,32 @@ +/* SCCS Id: @(#)mac-carbon.h 3.4 2003/06/01 */ +/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 2003. */ +/* NetHack may be freely redistributed. See license for details. */ + +/* Compiler prefix file for the Macintosh Carbon port. + * + * IMPORTANT: This file is intended only as a compiler prefix + * file and must NEVER be included by other source (.c or .h) + * files. + * + * Usage for MacOS X Project Builder: + * Project menu -> Edit Active Target '_target_' -> + * target settings dialog -> Settings -> Simple View -> + * GCC Compiler Settings -> + * set "Prefix Header" to include/mac-carbon.h + * + * Usage for Metrowerks CodeWarrior: + * Edit menu -> _target_ Settings -> Language Settings -> + * C/C++ Language -> + * set "Prefix File" to include/mac-carbon.h + */ + +#define MAC +#undef UNIX + +/* May already be defined by CodeWarrior as 0 or 1 */ +#ifdef TARGET_API_MAC_CARBON +# undef TARGET_API_MAC_CARBON +#endif +#define TARGET_API_MAC_CARBON 1 + +#define GCC_WARN diff -Naurd ../nethack-3.4.1/include/macconf.h ./include/macconf.h --- ../nethack-3.4.1/include/macconf.h Sun Feb 23 14:43:20 2003 +++ ./include/macconf.h Mon Sep 1 14:33:32 2003 @@ -25,8 +25,14 @@ #ifndef __powerc # define MAC68K /* 68K mac (non-powerpc) */ #endif +#ifndef TARGET_API_MAC_CARBON +# define TARGET_API_MAC_CARBON 0 +#endif + +#ifndef __MACH__ #define RANDOM +#endif #define NO_SIGNAL /* You wouldn't believe our signals ... */ #define FILENAME 256 #define NO_TERMS /* For tty port (see wintty.h) */ @@ -46,7 +52,13 @@ * Try and keep the number of files here to an ABSOLUTE minimum ! * include the relevant files in the relevant .c files instead ! */ -#include +#if TARGET_API_MAC_CARBON + /* Avoid including -- it has a conflicting expl() */ +# define __FP__ +# include +#else +# include +#endif /* * We could use the PSN under sys 7 here ... @@ -72,7 +84,7 @@ * MPW. With MPW, we make them into MPW tools, which use unix IO. SPEC_LEV * and DGN_COMP are defined when compiling for LevComp and DgnComp respectively. */ -#if !((defined(__SC__) || defined(__MRC__)) && (defined(SPEC_LEV) || defined(DGN_COMP))) +#if !((defined(__SC__) || defined(__MRC__) || defined(__MACH__)) && (defined(SPEC_LEV) || defined(DGN_COMP))) # define creat maccreat # define open macopen # define close macclose diff -Naurd ../nethack-3.4.1/include/macpopup.h ./include/macpopup.h --- ../nethack-3.4.1/include/macpopup.h Sun Feb 23 14:43:20 2003 +++ ./include/macpopup.h Mon Sep 1 14:33:32 2003 @@ -7,7 +7,7 @@ /* ### mmodal.c ### */ -extern void FlashButton(WindowPtr, short); +extern void FlashButton(DialogRef, short); extern char queued_resp(char *resp); extern char topl_yn_function(const char *query, const char *resp, char def); extern int get_line_from_key_queue(char *bufp); diff -Naurd ../nethack-3.4.1/include/mac-qt.h ./include/mac-qt.h --- ../nethack-3.4.1/include/mac-qt.h Thu Jan 1 01:00:00 1970 +++ ./include/mac-qt.h Mon Sep 1 14:33:32 2003 @@ -0,0 +1,33 @@ +/* SCCS Id: @(#)mac-qt.h 3.4 2003/06/01 */ +/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 2003. */ +/* NetHack may be freely redistributed. See license for details. */ + +/* Compiler prefix file for the Macintosh Qt port. + * + * IMPORTANT: This file is intended only as a compiler prefix + * file and must NEVER be included by other source (.c or .h) + * files. + * + * Usage for MacOS X Project Builder: + * Project menu -> Edit Active Target '_target_' -> + * target settings dialog -> Settings -> Simple View -> + * GCC Compiler Settings -> + * set "Prefix Header" to include/mac-qt.h + * + * Usage for Metrowerks CodeWarrior: + * Edit menu -> _target_ Settings -> Language Settings -> + * C/C++ Language -> + * set "Prefix File" to include/mac-qt.h + */ + +#undef MAC +#define UNIX +#define BSD + +/* May already be defined by CodeWarrior as 0 or 1 */ +#ifdef TARGET_API_MAC_CARBON +# undef TARGET_API_MAC_CARBON +#endif +#define TARGET_API_MAC_CARBON 0 + +#define GCC_WARN diff -Naurd ../nethack-3.4.1/include/mac-term.h ./include/mac-term.h --- ../nethack-3.4.1/include/mac-term.h Thu Jan 1 01:00:00 1970 +++ ./include/mac-term.h Mon Sep 1 14:33:32 2003 @@ -0,0 +1,33 @@ +/* SCCS Id: @(#)mac-term.h 3.4 2003/06/01 */ +/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 2003. */ +/* NetHack may be freely redistributed. See license for details. */ + +/* Compiler prefix file for the MacOS X Terminal.app port. + * + * IMPORTANT: This file is intended only as a compiler prefix + * file and must NEVER be included by other source (.c or .h) + * files. + * + * Usage for MacOS X Project Builder: + * Project menu -> Edit Active Target '_target_' -> + * target settings dialog -> Settings -> Simple View -> + * GCC Compiler Settings -> + * set "Prefix Header" to include/mac-term.h + * + * Usage for Metrowerks CodeWarrior: + * Edit menu -> _target_ Settings -> Language Settings -> + * C/C++ Language -> + * set "Prefix File" to include/mac-term.h + */ + +#undef MAC +#define UNIX +#define BSD + +/* May already be defined by CodeWarrior as 0 or 1 */ +#ifdef TARGET_API_MAC_CARBON +# undef TARGET_API_MAC_CARBON +#endif +#define TARGET_API_MAC_CARBON 0 + +#define GCC_WARN diff -Naurd ../nethack-3.4.1/include/mactty.h ./include/mactty.h --- ../nethack-3.4.1/include/mactty.h Sun Feb 23 14:43:20 2003 +++ ./include/mactty.h Mon Sep 1 14:33:32 2003 @@ -44,7 +44,9 @@ #undef red /* undef internal color const strings from decl */ #undef green #undef blue -#include +#if !TARGET_API_MAC_CARBON +# include +#endif /* * Error code returned when it's probably our fault, or diff -Naurd ../nethack-3.4.1/include/macwin.h ./include/macwin.h --- ../nethack-3.4.1/include/macwin.h Sun Feb 23 14:43:20 2003 +++ ./include/macwin.h Mon Sep 1 14:33:32 2003 @@ -7,8 +7,11 @@ #undef red /* undef internal color const strings from decl */ #undef green #undef blue + +#ifndef __MACH__ #include #include +#endif /* more headers */ #ifdef THINK_C @@ -19,7 +22,7 @@ #define PLAYER_NAME_RES_ID 1001 /* fake some things if we don't have universal headers.. */ -#ifndef NewUserItemProc +#if 0 /*ndef NewUserItemProc*/ typedef pascal void (*UserItemProcPtr)(WindowPtr theWindow, short itemNo); typedef UserItemProcPtr UserItemUPP; #define NewUserItemProc(p) (UserItemUPP)(p) diff -Naurd ../nethack-3.4.1/include/mttypriv.h ./include/mttypriv.h --- ../nethack-3.4.1/include/mttypriv.h Sun Feb 23 14:43:21 2003 +++ ./include/mttypriv.h Mon Sep 1 14:33:32 2003 @@ -15,9 +15,11 @@ #include "mactty.h" # endif -#include -#include -#include +#if !TARGET_API_MAC_CARBON +# include +# include +# include +#endif #define TA_TO_RGB(ta,rgb) (((rgb).red=(((ta)>>16)&0xff)*257),((rgb).green=(((ta)>>8)&0xff)*257),\ ((rgb).blue=((ta)&0xff)*257)),rgb diff -Naurd ../nethack-3.4.1/sys/mac/Files.r ./sys/mac/Files.r --- ../nethack-3.4.1/sys/mac/Files.r Sun Feb 23 14:43:34 2003 +++ ./sys/mac/Files.r Mon Sep 1 14:33:32 2003 @@ -2,6 +2,9 @@ #include "date.h" #include "patchlevel.h" +resource 'plst' (0, purgeable) { +}; + resource 'vers' (1, purgeable) { VERSION_MAJOR, (VERSION_MINOR<<4) | PATCHLEVEL, final, EDITLEVEL, verUS, VERSION_STRING, diff -Naurd ../nethack-3.4.1/sys/mac/maccurs.c ./sys/mac/maccurs.c --- ../nethack-3.4.1/sys/mac/maccurs.c Sun Feb 23 14:43:34 2003 +++ ./sys/mac/maccurs.c Mon Sep 1 14:33:32 2003 @@ -6,9 +6,11 @@ #include "mactty.h" #include "macwin.h" +#if !TARGET_API_MAC_CARBON #include #include #include +#endif static Boolean winFileInit = 0; @@ -100,7 +102,7 @@ *left = p.h; *top = p.v; dprintf ("Retrieve Kind %d Pt (%d,%d)", kind, p.h, p.v); - return PtInRgn (p, GetGrayRgn ()); + return (PtInRgn (p, GetGrayRgn ())); } @@ -131,12 +133,12 @@ dprintf ("Save bad kind %d", kind); return; } - InitWinFile (); - savePos [kind].validPos = 1; - savePos [kind].top = top; - savePos [kind].left = left; - dprintf ("Save kind %d pt (%d,%d)", kind, left, top); - FlushWinFile (); + InitWinFile(); + savePos[kind].validPos = 1; + savePos[kind].top = top; + savePos[kind].left = left; + dprintf("Save kind %d pt (%d,%d)", kind, left, top); + FlushWinFile(); } @@ -163,7 +165,7 @@ if (!CheckNhWin (win)) { return -1; } - kind = ((WindowPeek) win)->windowKind - WIN_BASE_KIND; + kind = GetWindowKind(win) - WIN_BASE_KIND; if (kind < 0 || kind > NHW_TEXT) { return -1; } @@ -190,32 +192,32 @@ Boolean -RetrieveWinPos (WindowPtr win, short *top, short *left) -{ return RetrievePosition (GetWinKind (win), top, left); +RetrieveWinPos(WindowPtr win, short *top, short *left) +{ + return RetrievePosition(GetWinKind (win), top, left); } void -SaveWindowPos (WindowPtr win) +SaveWindowPos(WindowPtr win) { - GrafPtr gp; - Point p = { 0, 0 }; + Rect r; - GetPort (&gp); - SetPort (win); - LocalToGlobal (&p); - AddPt (*(Point *) &(win->portRect), &p); /* Adjust for origin */ - SetPort (gp); - SavePosition (GetWinKind (win), p.v, p.h); + + GetWindowBounds(win, kWindowContentRgn, &r); + SavePosition(GetWinKind(win), r.top, r.left); } void -SaveWindowSize (WindowPtr win) +SaveWindowSize(WindowPtr win) { short width, height; + Rect r; - width = win->portRect.right - win->portRect.left; - height = win->portRect.bottom - win->portRect.top; - SaveSize (GetWinKind (win), height, width); + + GetWindowBounds(win, kWindowContentRgn, &r); + width = r.right - r.left; + height = r.bottom - r.top; + SaveSize(GetWinKind (win), height, width); } diff -Naurd ../nethack-3.4.1/sys/mac/macerrs.c ./sys/mac/macerrs.c --- ../nethack-3.4.1/sys/mac/macerrs.c Sun Feb 23 14:43:34 2003 +++ ./sys/mac/macerrs.c Mon Sep 1 14:33:32 2003 @@ -9,9 +9,11 @@ #include "hack.h" #include "macwin.h" +#if !TARGET_API_MAC_CARBON #include #include #include +#endif void error(const char *format,...) diff -Naurd ../nethack-3.4.1/sys/mac/macfile.c ./sys/mac/macfile.c --- ../nethack-3.4.1/sys/mac/macfile.c Sun Feb 23 14:43:34 2003 +++ ./sys/mac/macfile.c Mon Sep 1 14:33:32 2003 @@ -8,12 +8,16 @@ #include "hack.h" #include "macwin.h" + +#ifndef __MACH__ #include #include #include #include #include #include +#endif + #include "dlb.h" /* @@ -363,6 +367,18 @@ } +int +macunlink(const char *name) +{ + Str255 pname; + + + C2P(name, pname); + return (HDelete(theDirs.dataRefNum, theDirs.dataDirID, pname) == noErr ? 0 : -1); +} + + + /* ---------------------------------------------------------------------- */ boolean rsrc_dlb_init(void) { diff -Naurd ../nethack-3.4.1/sys/mac/macmain.c ./sys/mac/macmain.c --- ../nethack-3.4.1/sys/mac/macmain.c Sun Feb 23 14:43:35 2003 +++ ./sys/mac/macmain.c Mon Sep 1 14:33:32 2003 @@ -9,6 +9,7 @@ #include "macwin.h" #include "mactty.h" +#if !TARGET_API_MAC_CARBON #include #include #include @@ -17,6 +18,7 @@ #include #include #include +#endif #ifndef O_RDONLY #include diff -Naurd ../nethack-3.4.1/sys/mac/macmenu.c ./sys/mac/macmenu.c --- ../nethack-3.4.1/sys/mac/macmenu.c Sun Feb 23 14:43:35 2003 +++ ./sys/mac/macmenu.c Mon Sep 1 14:33:32 2003 @@ -28,12 +28,17 @@ #include "patchlevel.h" /******** Toolbox Defines ********/ +#if !TARGET_API_MAC_CARBON #include #include #include #include #include #include +#endif + +/* Borrowed from the Mac tty port */ +extern WindowPtr _mt_window; /******** Local Defines ********/ @@ -205,12 +210,12 @@ /******** Prototypes ********/ +#if !TARGET_API_MAC_CARBON static void alignAD(Rect *, short); +#endif static void mustGetMenuAlerts(void); static void menuError(short); -static pascal void drawANUserItem(WindowPtr, short); static void aboutNetHack(void); -static void optionEditor(void); static void askSave(void); static void askQuit(void); @@ -239,9 +244,9 @@ #define CH_ESCAPE 0x001b static void ask_restring(const char *cstr, unsigned char *pstr); -static void ask_enable(WindowPtr wind, short item, int enable); -static pascal void ask_redraw(WindowPtr wind, DialogItemIndex item); -static pascal Boolean ask_filter(WindowPtr wind, EventRecord *event, DialogItemIndex *item); +static void ask_enable(DialogRef wind, short item, int enable); +static pascal void ask_redraw(DialogRef wind, DialogItemIndex item); +static pascal Boolean ask_filter(DialogRef wind, EventRecord *event, DialogItemIndex *item); #define noresource(t,n) {SysBeep(3); ExitToShell();} #define fatal(s) {SysBeep(3); ExitToShell();} @@ -255,7 +260,7 @@ static RGBColor blackcolor = {0x0000, 0x0000, 0x0000}, - indentcolor = {0x4000, 0x4000, 0x4000}, +// indentcolor = {0x4000, 0x4000, 0x4000}, darkcolor = {0x8000, 0x8000, 0x8000}, backcolor = {0xdddd, 0xdddd, 0xdddd}, lightcolor = {0xffff, 0xffff, 0xffff}, @@ -280,7 +285,7 @@ /* Enable the dialog item with the given index */ static void -ask_enable (WindowPtr wind, short item, int enable) +ask_enable (DialogRef wind, short item, int enable) { short type; Handle handle; @@ -298,7 +303,7 @@ static pascal void -ask_redraw (WindowPtr wind, DialogItemIndex item) +ask_redraw (DialogRef wind, DialogItemIndex item) { short type; Handle handle; @@ -431,7 +436,7 @@ static pascal Boolean -ask_filter (WindowPtr wind, EventRecord *event, DialogItemIndex *item) +ask_filter (DialogRef wind, EventRecord *event, DialogItemIndex *item) { short ch, key; @@ -444,7 +449,7 @@ /* Handle equivalents for OK */ if ((ch == CH_RETURN) || (key == KEY_RETURN) || (ch == CH_ENTER) || (key == KEY_ENTER)) { - if ((*((DialogRecord *)wind)->textH)->teLength) { + if (GetDialogTextEditHandle(wind)[0]->teLength) { FlashButton(wind, RSRC_ASK_PLAY); *item = RSRC_ASK_PLAY; } else @@ -491,21 +496,21 @@ void mac_askname () { GrafPtr oldport; - WindowPtr askdialog; + DialogRef askdialog; short i, j, item, type; Handle handle; Rect rect; Str255 str; Point pt; - UserItemUPP redraw = NewUserItemProc(ask_redraw); - ModalFilterUPP filter = NewModalFilterProc(ask_filter); + UserItemUPP redraw = NewUserItemUPP(ask_redraw); + ModalFilterUPP filter = NewModalFilterUPP(ask_filter); /* Create the dialog */ - if (!(askdialog = GetNewDialog(RSRC_ASK, NULL, (WindowPtr)-1))) + if (!(askdialog = GetNewDialog(RSRC_ASK, NULL, (WindowRef)-1))) noresource('DLOG', RSRC_ASK); GetPort(&oldport); - SetPort(askdialog); + SetPortDialogPort(askdialog); /* Initialize the name text item */ ask_restring(plname, str); @@ -628,18 +633,18 @@ do { /* Adjust the Play button */ ask_enable(askdialog, RSRC_ASK_PLAY, - (*((DialogRecord *)askdialog)->textH)->teLength); + GetDialogTextEditHandle(askdialog)[0]->teLength); /* Adjust the race popup menu */ i = j = currrace; do { if (validrace(currrole, j)) { - EnableItem(askmenu[RSRC_ASK_RACE], j+1); - CheckItem(askmenu[RSRC_ASK_RACE], j+1, + EnableMenuItem(askmenu[RSRC_ASK_RACE], j+1); + CheckMenuItem(askmenu[RSRC_ASK_RACE], j+1, currrace == j); } else { - DisableItem(askmenu[RSRC_ASK_RACE], j+1); - CheckItem(askmenu[RSRC_ASK_RACE], j+1, FALSE); + DisableMenuItem(askmenu[RSRC_ASK_RACE], j+1); + CheckMenuItem(askmenu[RSRC_ASK_RACE], j+1, FALSE); if ((currrace == j) && !races[++currrace].noun) currrace = 0; } @@ -647,19 +652,19 @@ } while (i != j); if (currrace != i) { GetDialogItem(askdialog, RSRC_ASK_RACE, &type, &handle, &rect); - InvalRect(&rect); + InvalWindowRect(GetDialogWindow(askdialog), &rect); } /* Adjust the gender popup menu */ i = j = currgend; do { if (validgend(currrole, currrace, j)) { - EnableItem(askmenu[RSRC_ASK_GEND], j+1); - CheckItem(askmenu[RSRC_ASK_GEND], j+1, + EnableMenuItem(askmenu[RSRC_ASK_GEND], j+1); + CheckMenuItem(askmenu[RSRC_ASK_GEND], j+1, currgend == j); } else { - DisableItem(askmenu[RSRC_ASK_GEND], j+1); - CheckItem(askmenu[RSRC_ASK_GEND], j+1, FALSE); + DisableMenuItem(askmenu[RSRC_ASK_GEND], j+1); + CheckMenuItem(askmenu[RSRC_ASK_GEND], j+1, FALSE); if ((currgend == j) && (++currgend >= ROLE_GENDERS)) currgend = 0; } @@ -667,19 +672,19 @@ } while (i != j); if (currgend != i) { GetDialogItem(askdialog, RSRC_ASK_GEND, &type, &handle, &rect); - InvalRect(&rect); + InvalWindowRect(GetDialogWindow(askdialog), &rect); } /* Adjust the alignment popup menu */ i = j = curralign; do { if (validalign(currrole, currrace, j)) { - EnableItem(askmenu[RSRC_ASK_ALIGN], j+1); - CheckItem(askmenu[RSRC_ASK_ALIGN], j+1, + EnableMenuItem(askmenu[RSRC_ASK_ALIGN], j+1); + CheckMenuItem(askmenu[RSRC_ASK_ALIGN], j+1, curralign == j); } else { - DisableItem(askmenu[RSRC_ASK_ALIGN], j+1); - CheckItem(askmenu[RSRC_ASK_ALIGN], j+1, FALSE); + DisableMenuItem(askmenu[RSRC_ASK_ALIGN], j+1); + CheckMenuItem(askmenu[RSRC_ASK_ALIGN], j+1, FALSE); if ((curralign == j) && (++curralign >= ROLE_ALIGNS)) curralign = 0; } @@ -687,7 +692,7 @@ } while (i != j); if (curralign != i) { GetDialogItem(askdialog, RSRC_ASK_ALIGN, &type, &handle, &rect); - InvalRect(&rect); + InvalWindowRect(GetDialogWindow(askdialog), &rect); } /* Adjust the role popup menu */ @@ -695,14 +700,14 @@ ask_restring((currgend && roles[i].name.f) ? roles[i].name.f : roles[i].name.m, str); SetMenuItemText(askmenu[RSRC_ASK_ROLE], i+1, str); - CheckItem(askmenu[RSRC_ASK_ROLE], i+1, currrole == i); + CheckMenuItem(askmenu[RSRC_ASK_ROLE], i+1, currrole == i); } /* Adjust the mode popup menu */ - CheckItem(askmenu[RSRC_ASK_MODE], 1, currmode == 0); - CheckItem(askmenu[RSRC_ASK_MODE], 2, currmode == 1); + CheckMenuItem(askmenu[RSRC_ASK_MODE], 1, currmode == 0); + CheckMenuItem(askmenu[RSRC_ASK_MODE], 2, currmode == 1); #ifdef WIZARD - CheckItem(askmenu[RSRC_ASK_MODE], 3, currmode == 2); + CheckMenuItem(askmenu[RSRC_ASK_MODE], 3, currmode == 2); #endif /* Wait for an action on an item */ @@ -724,7 +729,7 @@ if (!!(i = PopUpMenuSelect(askmenu[item], pt.v, pt.h, askselect[item] + 1))) askselect[item] = LoWord(i) - 1; - InvalRect(&rect); + InvalWindowRect(GetDialogWindow(askdialog), &rect); break; case RSRC_ASK_NAME: #if 0 @@ -806,22 +811,29 @@ /*** Menu bar routines ***/ +#if !TARGET_API_MAC_CARBON static void alignAD(Rect *pRct, short vExempt) { + BitMap qbitmap; + + + GetQDGlobalsScreenBits(&qbitmap); (*pRct).right -= (*pRct).left; /* width */ (*pRct).bottom -= (*pRct).top; /* height */ - (*pRct).left = (qd.screenBits.bounds.right - (*pRct).right) / 2; - (*pRct).top = (qd.screenBits.bounds.bottom - (*pRct).bottom - vExempt) / 2; + (*pRct).left = (qbitmap.bounds.right - (*pRct).right) / 2; + (*pRct).top = (qbitmap.bounds.bottom - (*pRct).bottom - vExempt) / 2; (*pRct).top += vExempt; (*pRct).right += (*pRct).left; (*pRct).bottom += (*pRct).top; } +#endif + static void mustGetMenuAlerts() { - short i, mbarHgt = GetMBarHeight(); + short i; Rect **hRct; for (i = alrt_Menu_start; i < alrt_Menu_limit; i++) @@ -833,7 +845,9 @@ ExitToShell(); } - alignAD(*hRct, mbarHgt); +#if !TARGET_API_MAC_CARBON + alignAD(*hRct, GetMBarHeight()); +#endif } } @@ -857,7 +871,7 @@ static Boolean was_inited = 0; short i, j; menuListHandle mlHnd; - MenuHandle mHnd; + MenuHandle menu; if (was_inited) return; @@ -865,30 +879,30 @@ mustGetMenuAlerts(); - for (i = listMenubar; i <= listSubmenu; i++) - { + for (i = listMenubar; i <= listSubmenu; i++) { if (! (mlHnd = (menuListHandle) GetResource('MNU#', (menuBarListID + i)))) menuError(errGetMenuList); - pMenuList[i] = *mlHnd; + pMenuList[i] = (menuListPtr) NewPtr(GetHandleSize((Handle) mlHnd)); + *pMenuList[i] = **mlHnd; - for (j = 0; j < (**mlHnd).numMenus; j++) + for (j = 0; j < pMenuList[i]->numMenus; j++) { - if (! (mHnd = (MenuHandle) GetMenu((**mlHnd).mref[j].mresID))) { + if (! (menu = (MenuHandle) GetMenu((**mlHnd).mref[j].mresID))) { Str31 d; NumToString ((**mlHnd).mref[j].mresID, d); menuError(errGetMenu); } - (**mlHnd).mref[j].mhnd = mHnd; - * ((short *) *mHnd) = j + (**mlHnd).firstMenuID; /* consecutive IDs */ + pMenuList[i]->mref[j].mhnd = menu; + SetMenuID(menu, j + (**mlHnd).firstMenuID); /* consecutive IDs */ /* expand apple menu */ if ((i == listMenubar) && (j == menuApple)) { - AppendResMenu(mHnd, 'DRVR'); + AppendResMenu(menu, 'DRVR'); } - InsertMenu(mHnd, ((i == listSubmenu) ? hierMenu : 0)); + InsertMenu(menu, ((i == listSubmenu) ? hierMenu : 0)); } } DrawMenuBar(); @@ -899,7 +913,7 @@ AdjustMenus(short dimMenubar) { short newMenubar = mbarRegular; - WindowPeek peekWindow = (WindowPeek) FrontWindow(); + WindowRef win = FrontWindow(); short i; /* @@ -908,20 +922,14 @@ * } */ /* determine the new menubar state */ - if (dimMenubar) { + if (dimMenubar) newMenubar = mbarDim; - } else if (! peekWindow) { + else if (!win) newMenubar = mbarNoWindows; - } else if (peekWindow->windowKind < 0) { + else if (GetWindowKind(win) < 0) newMenubar = mbarDA; - } else { - while (peekWindow && (peekWindow->windowKind != WKND_MAP)) { - peekWindow = peekWindow->nextWindow; - } - if ((! peekWindow) || (! peekWindow->visible)) { - newMenubar = mbarNoMap; - } - } + else if (!IsWindowVisible(_mt_window)) + newMenubar = mbarNoMap; if (newMenubar != mbarRegular) ; /* we've already found its state */ @@ -949,7 +957,7 @@ SetMenuItemText(MHND_FILE, menuFilePlayMode, "\pExplore"); - for (i = CountMItems(MHND_WIZ); i > menuWizardAttributes; i--) + for (i = CountMenuItems(MHND_WIZ); i > menuWizardAttributes; i--) DeleteMenuItem(MHND_WIZ, i); } } @@ -962,25 +970,25 @@ case mbarDim: /* disable all menus (except the apple menu) */ for (i = menuFile; i < NUM_MBAR; i++) - DisableItem(MBARHND(i), 0); + DisableMenuItem(MBARHND(i), 0); break; case mbarNoWindows: case mbarDA: case mbarNoMap: /* enable the file menu, but ... */ - EnableItem(MHND_FILE, 0); + EnableMenuItem(MHND_FILE, 0); /* ... disable the window commands! */ for (i = menuFileRedraw; i <= menuFileEnterExplore; i++) - DisableItem(MHND_FILE, i); + DisableMenuItem(MHND_FILE, i); /* ... and disable the rest of the menus */ for (i = menuEdit; i < NUM_MBAR; i++) - DisableItem(MBARHND(i), 0); + DisableMenuItem(MBARHND(i), 0); if (theMenubar == mbarDA) - EnableItem(MHND_EDIT, 0); + EnableMenuItem(MHND_EDIT, 0); break; @@ -988,19 +996,19 @@ case mbarSpecial: /* enable all menus ... */ for (i = menuFile; i < NUM_MBAR; i++) - EnableItem(MBARHND(i), 0); + EnableMenuItem(MBARHND(i), 0); /* ... except the unused Edit menu */ - DisableItem(MHND_EDIT, 0); + DisableMenuItem(MHND_EDIT, 0); /* ... enable the window commands */ for (i = menuFileRedraw; i <= menuFileEnterExplore; i++) - EnableItem(MHND_FILE, i); + EnableMenuItem(MHND_FILE, i); if (theMenubar == mbarRegular) - DisableItem(MHND_FILE, menuFilePlayMode); + DisableMenuItem(MHND_FILE, menuFilePlayMode); else - DisableItem(MHND_FILE, menuFileEnterExplore); + DisableMenuItem(MHND_FILE, menuFileEnterExplore); break; } @@ -1020,6 +1028,7 @@ case menuApple: if (menuItem == menuAppleAboutBox) aboutNetHack(); +#if !TARGET_API_MAC_CARBON else { unsigned char daName[32]; @@ -1027,6 +1036,7 @@ GetMenuItemText(MHND_APPLE, menuItem, * (Str255 *) daName); (void) OpenDeskAcc(daName); } +#endif break; /* @@ -1064,7 +1074,9 @@ break; case menuEdit: +#if !TARGET_API_MAC_CARBON (void) SystemEdit(menuItem - 1); +#endif break; default: /* get associated string and add to key queue */ diff -Naurd ../nethack-3.4.1/sys/mac/macsnd.c ./sys/mac/macsnd.c --- ../nethack-3.4.1/sys/mac/macsnd.c Sun Feb 23 14:43:35 2003 +++ ./sys/mac/macsnd.c Mon Sep 1 14:33:32 2003 @@ -17,8 +17,12 @@ #include "hack.h" #include "mactty.h" #include "macwin.h" -#include -#include +#if !TARGET_API_MAC_CARBON +# include +# include +#else +# define freqDurationCmd 40 +#endif #define SND_BUFFER(s) (&(*s)[20]) #define SND_LEN(s) (GetHandleSize(s)-42) diff -Naurd ../nethack-3.4.1/sys/mac/mactty.c ./sys/mac/mactty.c --- ../nethack-3.4.1/sys/mac/mactty.c Sun Feb 23 14:43:35 2003 +++ ./sys/mac/mactty.c Mon Sep 1 14:33:32 2003 @@ -12,7 +12,9 @@ #include "hack.h" /* to get flags */ #include "mttypriv.h" +#if !TARGET_API_MAC_CARBON #include +#endif char game_active = 0; /* flag to window rendering routines not to use ppat */ @@ -103,6 +105,7 @@ } +#if 0 /* Use alloc.c instead */ /* * Allocate a pointer using the set memory-allocator */ @@ -111,6 +114,7 @@ *ptr = NewPtr (size); return MemError (); } +#endif /* @@ -185,6 +189,7 @@ if (record->uses_gworld) { s_err = deallocate_gworld (record); +#if !TARGET_API_MAC_CARBON } else { s_err = dispose_ptr (record->its_bits.baseAddr); if (!s_err) { @@ -197,6 +202,7 @@ } } } +#endif } return s_err; } @@ -207,14 +213,16 @@ * Otherwise, do nothing. */ -short create_tty (WindowPtr *window, short resource_id, Boolean in_color) { -tty_record * record; -Boolean was_allocated = !!*window; +short +create_tty (WindowRef *window, short resource_id, Boolean in_color) +{ + tty_record * record; + Boolean was_allocated = !!*window; if (in_color) { - *window = GetNewCWindow (resource_id, (Ptr) *window, (WindowPtr) -1L); + *window = GetNewCWindow (resource_id, (Ptr) *window, (WindowRef) -1L); } else { - *window = GetNewWindow (resource_id, (Ptr) *window, (WindowPtr) -1L); + *window = GetNewWindow (resource_id, (Ptr) *window, (WindowRef) -1L); } if (!*window) { return mem_err (); @@ -222,11 +230,15 @@ record = (tty_record *) NewPtrClear (sizeof (tty_record)); if (!record) { +#if !TARGET_API_MAC_CARBON if (was_allocated) { CloseWindow (*window); } else { +#endif DisposeWindow (*window); +#if !TARGET_API_MAC_CARBON } +#endif return mem_err (); } record->its_window = *window; @@ -243,8 +255,8 @@ if (in_color) { GDHandle gh; - SetPort (*window); - GetGWorld ( &(record ->its_window_world), &gh); + SetPortWindowPort(*window); + GetGWorld(&(record->its_window_world), &gh); } else { record->its_window_world = (GWorldPtr)0; } @@ -287,11 +299,15 @@ s_err = free_bits (record); if (!s_err) { +#if !TARGET_API_MAC_CARBON if (record->was_allocated) { CloseWindow (window); } else { +#endif DisposeWindow (window); +#if !TARGET_API_MAC_CARBON } +#endif s_err = dispose_ptr (record); } @@ -348,6 +364,7 @@ if (record->uses_gworld) { s_err = allocate_offscreen_world (record); +#if !TARGET_API_MAC_CARBON } else { s_err = alloc_ptr ((void **) &(record->its_bits.baseAddr), record->its_bits.rowBytes * record->its_bits.bounds.bottom); @@ -361,6 +378,7 @@ ClipRect (&(record->its_bits.bounds)); SetPortBits (&(record->its_bits)); } +#endif } return s_err; } @@ -427,9 +445,9 @@ select_onscreen_window (tty_record *record) { if (record->uses_gworld) { use_port (record, record->its_window_world); - SetPort (record->its_window); + SetPortWindowPort(record->its_window); } else { - use_port (record, record->its_window); + use_port(record, record->its_window); } } @@ -438,18 +456,21 @@ * Do bits copy depending on if we're using color or not */ static void -copy_bits (tty_record *record, Rect *bounds, short xfer_mode, RgnHandle mask_rgn) { -GWorldFlags pix_state; -BitMap * source; +copy_bits(tty_record *record, Rect *bounds, short xfer_mode, RgnHandle mask_rgn) +{ + GWorldFlags pix_state; + BitMap * source; if (record->uses_gworld) { pix_state = GetPixelsState (GetGWorldPixMap (record->offscreen_world)); LockPixels (GetGWorldPixMap (record->offscreen_world)); - source = (BitMap *) &record->offscreen_world->portPixMap; + source = (BitMapPtr) *GetGWorldPixMap(record->offscreen_world); } else source = &record->its_bits; - - CopyBits (source, &(record->its_window->portBits), bounds, bounds, xfer_mode, mask_rgn); + + SetPortWindowPort(record->its_window); + CopyBits(source, GetPortBitMapForCopyBits(GetWindowPort(record->its_window)), + bounds, bounds, xfer_mode, mask_rgn); if (record->uses_gworld) { SetPixelsState (GetGWorldPixMap (record->offscreen_world), pix_state); @@ -506,6 +527,7 @@ } +#if 0 /* * Update TTY according to new color environment for the window */ @@ -526,6 +548,7 @@ } return 0; } +#endif /* @@ -600,7 +623,7 @@ *inval_rect = record->invalid_rect; #else if (EmptyRgn (record->invalid_part)) { - return return general_failure; + return general_failure; } *inval_rect = (*(record->invalid_part))->rgnBBox; #endif @@ -835,12 +858,13 @@ * Add a null-terminated string of characters */ short -add_tty_string (WindowPtr window, const char *string) { -register const unsigned char * start_c; -register const unsigned char * the_c; -register unsigned char ch, is_control, tty_wrap; -register short max_x, pos_x; -RECORD_EXISTS (record); +add_tty_string(WindowPtr window, const char *string) +{ + register const unsigned char * start_c; + register const unsigned char * the_c; + register unsigned char ch, is_control = 0, tty_wrap; + register short max_x, pos_x; + RECORD_EXISTS (record); if (record->curs_state != 0) curs_pos (record, record->x_curs, record->y_curs, 0); diff -Naurd ../nethack-3.4.1/sys/mac/macwin.c ./sys/mac/macwin.c --- ../nethack-3.4.1/sys/mac/macwin.c Sun Feb 23 14:43:35 2003 +++ ./sys/mac/macwin.c Mon Sep 1 14:33:32 2003 @@ -8,14 +8,17 @@ #include "mactty.h" #include "wintty.h" +#if !TARGET_API_MAC_CARBON #include #include #include #include #include #include +#endif NhWindow *theWindows = (NhWindow *) 0; +Cursor qdarrow; /* Borrowed from the Mac tty port */ extern WindowPtr _mt_window; @@ -126,7 +129,7 @@ /* * The screen layouts on the small 512x342 screen need special cares. */ -Boolean small_screen; +Boolean small_screen = 0; #ifdef NHW_BASE # undef NHW_BASE @@ -285,6 +288,8 @@ long l; Str255 volName; + +#if !TARGET_API_MAC_CARBON if (LMGetDefltStack() < 50 * 1024L) { SetApplLimit ((void *) ((long) LMGetCurStackBase() - (50 * 1024L))); } @@ -298,6 +303,7 @@ InitMenus (); InitDialogs (0L); TEInit (); +#endif memset (&macFlags, 0, sizeof(macFlags)); if (!Gestalt (gestaltOSAttr, & l)) { @@ -330,12 +336,13 @@ macFlags.standardFile = (l & (1 << gestaltStandardFile58)) ? 1 : 0; gMouseRgn = NewRgn (); - InitCursor (); + InitCursor(); + GetQDGlobalsArrow(&qdarrow); ObscureCursor (); - MoveScrollUPP = NewControlActionProc(MoveScrollBar); + MoveScrollUPP = NewControlActionUPP(MoveScrollBar); - /* set up base fonts for all window types */ + /* Set up base fonts for all window types */ GetFNum ("\pHackFont", &i); if (i == 0) i = kFontIDMonaco; @@ -345,16 +352,19 @@ i = kFontIDGeneva; win_fonts [NHW_MESSAGE] = i; win_fonts [NHW_TEXT] = kFontIDGeneva; - + macFlags.hasAE = 0; if(!Gestalt(gestaltAppleEventsAttr, &l) && (l & (1L << gestaltAppleEventsPresent))){ if (AEInstallEventHandler (kCoreEventClass, typeWildCard, - NewAEEventHandlerProc (AppleEventHandler), + NewAEEventHandlerUPP(AppleEventHandler), 0, FALSE) == noErr) macFlags.hasAE = 1; } +#if TARGET_API_MAC_CARBON + HGetVol(volName, &theDirs.dataRefNum, &theDirs.dataDirID); +#else /* * We should try to get this data from a rsrc, in the profile file * the user double-clicked... This data should be saved with the @@ -362,6 +372,7 @@ */ GetVol (volName, &theDirs.dataRefNum ); GetWDInfo (theDirs.dataRefNum, &theDirs.dataRefNum, &theDirs.dataDirID, &l); +#endif if (volName [0] > 31) volName [0] = 31; for (l = 1; l <= volName [0]; l++) { if (volName [l] == ':') { @@ -403,27 +414,31 @@ static void -DrawScrollbar (NhWindow *aWin) { -WindowPtr theWindow = aWin->its_window; -Rect r = theWindow->portRect; -Boolean vis; -short val, lin, win_height; +DrawScrollbar (NhWindow *aWin) +{ + WindowPtr theWindow = aWin->its_window; + Rect crect, wrect; + Boolean vis; + short val, lin, win_height; - if (!aWin->scrollBar) { + + if (!aWin->scrollBar) return; - } - win_height = r.bottom - r.top; + GetControlBounds(aWin->scrollBar, &crect); + GetWindowBounds(aWin->its_window, kWindowContentRgn, &wrect); + OffsetRect(&wrect, -wrect.left, -wrect.top); + win_height = wrect.bottom - wrect.top; - if ((*aWin->scrollBar)->contrlRect.top != r.top - 1 || - (*aWin->scrollBar)->contrlRect.left != r.right - SBARWIDTH) { - MoveControl (aWin->scrollBar, r.right - SBARWIDTH, r.top - 1); + if (crect.top != wrect.top - 1 || + crect.left != wrect.right - SBARWIDTH) { + MoveControl (aWin->scrollBar, wrect.right - SBARWIDTH, wrect.top - 1); } - if ((*aWin->scrollBar)->contrlRect.bottom != r.bottom - SBARHEIGHT || - (*aWin->scrollBar)->contrlRect.right != r.right + 1) { + if (crect.bottom != wrect.bottom - SBARHEIGHT || + crect.right != wrect.right + 1) { SizeControl (aWin->scrollBar, SBARWIDTH+1, win_height - SBARHEIGHT + 2); } vis = (win_height > (50 + SBARHEIGHT)); - if (vis != (*aWin->scrollBar)->contrlVis) { + if (vis != IsControlVisible(aWin->scrollBar)) { /* current status != control */ if (vis)/* if visible, show */ ShowControl (aWin->scrollBar); @@ -450,7 +465,7 @@ HiliteControl (aWin->scrollBar, val); val = GetControlValue (aWin->scrollBar); if (val != aWin->scrollPos) { - InvalRect (&(theWindow->portRect)); + InvalWindowRect(theWindow, &wrect); aWin->scrollPos = val; } } @@ -464,14 +479,22 @@ * This function could be overloaded with any amount of intelligence... */ int -SanePositions (void) { +SanePositions (void) +{ +#if TARGET_API_MAC_CARBON + ConstrainWindowToScreen(_mt_window, kWindowStructureRgn, + kWindowConstrainMoveRegardlessOfFit, NULL, NULL); +#else short left, top, width, height; int ix, numText = 0, numMenu = 0; - int mbar_height = GetMBarHeight (); - Rect screenArea = qd.thePort->portBits.bounds; + int mbar_height = GetMBarHeight(); + BitMap qbitmap; + Rect screenArea; WindowPtr theWindow; NhWindow *nhWin; + + screenArea = GetQDGlobalsScreenBits(&qbitmap)->bounds; OffsetRect (&screenArea, - screenArea.left, - screenArea.top); /* Map Window */ @@ -544,7 +567,8 @@ } } } - return 0; +#endif + return (0); } @@ -566,12 +590,11 @@ if (i >= NUM_MACWINDOWS) { error ("cre_win: Win full; freeing extras"); for (i = 0; i < NUM_MACWINDOWS; i ++) { - WindowPeek w = (WindowPeek) theWindows [i].its_window; - if (w->visible || i == WIN_INVEN || - w->windowKind != WIN_BASE_KIND + NHW_MENU && - w->windowKind != WIN_BASE_KIND + NHW_TEXT) + if (IsWindowVisible(theWindows [i].its_window) || i == WIN_INVEN || + GetWindowKind(theWindows [i].its_window) != WIN_BASE_KIND + NHW_MENU && + GetWindowKind(theWindows [i].its_window) != WIN_BASE_KIND + NHW_TEXT) continue; - mac_destroy_nhwindow (i); + mac_destroy_nhwindow(i); goto got1; } error ("cre_win: Out of ids!"); @@ -608,8 +631,8 @@ } aWin->its_window = GetNewWindow (WIN_BASE_RES + kind, (WindowPtr) 0L, (WindowPtr) -1L); - ((WindowPeek) aWin->its_window)->windowKind = WIN_BASE_KIND + kind; - SetWRefCon (aWin->its_window, (long) aWin); + SetWindowKind(aWin->its_window, WIN_BASE_KIND + kind); + SetWRefCon(aWin->its_window, (long) aWin); if (!(aWin->windowText = NewHandle (TEXT_BLOCK))) { error ("cre_win: NewHandle fail(%ld)", (long) TEXT_BLOCK); DisposeWindow (aWin->its_window); @@ -621,8 +644,7 @@ aWin->drawn = TRUE; mac_clear_nhwindow (i); - /*HARDCODED*/ - SetPort (aWin->its_window); + SetPortWindowPort(aWin->its_window); if (kind == NHW_MESSAGE) { aWin->font_number = win_fonts [NHW_MESSAGE]; @@ -651,11 +673,13 @@ aWin->char_width = fi.widMax; if (kind == NHW_MENU || kind == NHW_TEXT || kind == NHW_MESSAGE) { - Rect r = aWin->its_window->portRect; + Rect r; + + GetWindowBounds(aWin->its_window, kWindowContentRgn, &r); + r.right -= (r.left - 1); r.left = r.right - SBARWIDTH; - r.bottom -= SBARHEIGHT; - r.top -= 1; - r.right += 1; + r.bottom -= (r.top + SBARHEIGHT); + r.top = -1; aWin->scrollBar = NewControl (aWin->its_window, &r, "\p", (r.bottom > r.top + 50), 0, 0, 0, 16, 0L); aWin->scrollPos = 0; } @@ -664,9 +688,14 @@ void -mac_init_nhwindows (int *argcp, char **argv) { +mac_init_nhwindows (int *argcp, char **argv) +{ +#if !TARGET_API_MAC_CARBON Rect scr = (*GetGrayRgn())->rgnBBox; small_screen = scr.bottom - scr.top <= (iflags.large_font ? 12*40 : 9*40); +#endif + Rect r; + InitMenuRes (); @@ -688,6 +717,13 @@ */ mac_create_nhwindow(NHW_BASE); tty_create_nhwindow(NHW_MESSAGE); + RetrievePosition(kMessageWindow, &r.top, &r.left); + RetrieveSize(kMessageWindow, r.top, r.left, &r.bottom, &r.right); + MoveWindow(theWindows[NHW_MESSAGE].its_window, r.left, r.top, false); + SizeWindow(theWindows[NHW_MESSAGE].its_window, r.right, r.bottom, true); + ConstrainWindowToScreen(theWindows[NHW_MESSAGE].its_window, kWindowStructureRgn, + kWindowConstrainMoveRegardlessOfFit, NULL, NULL); + return; } @@ -709,12 +745,13 @@ if (!aWin->drawn) return; - SetPort (theWindow); - r = theWindow->portRect; + SetPortWindowPort(theWindow); + GetWindowBounds(theWindow, kWindowContentRgn, &r); + OffsetRect(&r, -r.left, -r.top); if (aWin->scrollBar) r.right -= SBARWIDTH; - switch (((WindowPeek) theWindow)->windowKind - WIN_BASE_KIND) { + switch (GetWindowKind(theWindow) - WIN_BASE_KIND) { case NHW_MESSAGE : if (aWin->scrollPos == aWin->y_size - 1) /* if no change since last clear */ return; /* don't bother with redraw */ @@ -761,7 +798,7 @@ aWin->y_curs = 0; aWin->x_curs = 0; aWin->drawn = FALSE; - InvalRect (&r); + InvalWindowRect(theWindow, &r); } @@ -773,9 +810,15 @@ static Boolean -in_topl_mode(void) { - return WIN_MESSAGE != WIN_ERR && top_line && - (*top_line)->viewRect.left < theWindows[WIN_MESSAGE].its_window->portRect.right; +in_topl_mode(void) +{ + Rect rect; + + + GetWindowBounds(theWindows[WIN_MESSAGE].its_window, kWindowContentRgn, &rect); + OffsetRect(&rect, -rect.left, -rect.top); + return (WIN_MESSAGE != WIN_ERR && top_line && + (*top_line)->viewRect.left < rect.right); } @@ -784,11 +827,18 @@ #define BTN_H (SBARHEIGHT-3) static void -topl_resp_rect(int resp_idx, Rect *r) { +topl_resp_rect(int resp_idx, Rect *r) +{ + Rect rect; + + + GetWindowBounds(theWindows[WIN_MESSAGE].its_window, kWindowContentRgn, &rect); + OffsetRect(&rect, -rect.left, -rect.top); r->left = (BTN_IND + BTN_W) * resp_idx + BTN_IND; r->right = r->left + BTN_W; - r->bottom = theWindows[WIN_MESSAGE].its_window->portRect.bottom - 1; + r->bottom = rect.bottom - 1; r->top = r->bottom - BTN_H; + return; } @@ -813,7 +863,7 @@ void leave_topl_mode(char *answer) { - char *ap, *bp; + unsigned char *ap, *bp; int ans_len = (*top_line)->teLength - topl_query_len; NhWindow *aWin = theWindows + WIN_MESSAGE; @@ -913,7 +963,7 @@ topl_flash_resp(int resp_idx) { unsigned long dont_care; Rect frame; - SetPort(theWindows[WIN_MESSAGE].its_window); + SetPortWindowPort(theWindows[WIN_MESSAGE].its_window); topl_resp_rect(resp_idx, &frame); InsetRect(&frame, 1, 1); InvertRect(&frame); @@ -925,12 +975,12 @@ static void topl_set_def(int new_def_idx) { Rect frame; - SetPort(theWindows[WIN_MESSAGE].its_window); + SetPortWindowPort(theWindows[WIN_MESSAGE].its_window); topl_resp_rect(topl_def_idx, &frame); - InvalRect(&frame); + InvalWindowRect(theWindows[WIN_MESSAGE].its_window, &frame); topl_def_idx = new_def_idx; topl_resp_rect(new_def_idx, &frame); - InvalRect(&frame); + InvalWindowRect(theWindows[WIN_MESSAGE].its_window, &frame); } @@ -946,14 +996,14 @@ def = CHAR_ANY; } - SetPort(theWindows[WIN_MESSAGE].its_window); + SetPortWindowPort(theWindows[WIN_MESSAGE].its_window); r_len1 = strlen(resp); r_len = strlen(topl_resp); if (r_len < r_len1) r_len = r_len1; topl_resp_rect(0, &frame); frame.right = (BTN_IND + BTN_W) * r_len; - InvalRect(&frame); + InvalWindowRect(theWindows[WIN_MESSAGE].its_window, &frame); strcpy(topl_resp, resp); loc = strchr (resp, def); @@ -1020,8 +1070,20 @@ static void -adjust_window_pos(NhWindow *aWin, short width, short height) { - WindowPtr theWindow = aWin->its_window; +adjust_window_pos(NhWindow *aWin, short width, short height) +{ + WindowRef theWindow = aWin->its_window; +#if TARGET_API_MAC_CARBON + Rect r; + + + GetWindowBounds(theWindow, kWindowContentRgn, &r); + RetrieveWinPos(theWindow, &r.top, &r.left); + MoveWindow(theWindow, r.left, r.top, false); + SizeWindow(theWindow, width, height, true); + ConstrainWindowToScreen(theWindow, kWindowStructureRgn, + kWindowConstrainMoveRegardlessOfFit, NULL, NULL); +#else Rect scr_r = (*GetGrayRgn())->rgnBBox; const Rect win_ind = {2, 2, 3, 3}; const short min_w = theWindow->portRect.right - theWindow->portRect.left, @@ -1029,7 +1091,7 @@ Point pos; short max_h; - SetPort(theWindow); + SetPortWindowPort(theWindow); if (!RetrieveWinPos(theWindow, &pos.v, &pos.h)) { pos.v = 0; /* take window's existing position */ pos.h = 0; @@ -1050,6 +1112,8 @@ MoveWindow(theWindow, pos.h, pos.v, false); if (aWin->scrollBar) DrawScrollbar (aWin); +#endif + return; } @@ -1083,7 +1147,7 @@ putstr (win, flags.standout ? ATR_INVERSE : ATR_NONE, " --More--"); } - if (!((WindowPeek) theWindow)->visible) { + if (!IsWindowVisible(theWindow)) { if (win != WIN_MESSAGE) adjust_window_pos(aWin, aWin->x_size + SBARWIDTH+1, aWin->y_size *aWin->row_height); @@ -1146,12 +1210,12 @@ WIN_MESSAGE = WIN_ERR; } - kind = ((WindowPeek) theWindow)->windowKind - WIN_BASE_KIND; + kind = GetWindowKind(theWindow) - WIN_BASE_KIND; - if ((!((WindowPeek) theWindow)->visible || (kind != NHW_MENU && kind != NHW_TEXT))) { + if ((!IsWindowVisible(theWindow) || (kind != NHW_MENU && kind != NHW_TEXT))) { DisposeWindow (theWindow); if (aWin->windowText) { - DisposeHandle (aWin->windowText); + DisposeHandle(aWin->windowText); } aWin->its_window = (WindowPtr) 0; aWin->windowText = (Handle) 0; @@ -1214,8 +1278,11 @@ * ClickMenu, and UpdateMenu. Takes the NhWindow and a line ref relative to the scrollbar. */ static void ToggleMenuSelect (NhWindow *aWin, int line) { - Rect r = aWin->its_window->portRect; + Rect r; + + GetWindowBounds(aWin->its_window, kWindowContentRgn, &r); + OffsetRect(&r, -r.left, -r.top); if (aWin->scrollBar) r.right -= SBARWIDTH; r.top = line * aWin->row_height; @@ -1290,13 +1357,13 @@ MacMHMenuItem *mi; int l, ch = theEvent->message & 0xff; - if (aWin) { + if (aWin && aWin->menuInfo) { HLock ((char**)aWin->menuInfo); for (l = 0, mi = *aWin->menuInfo; l < aWin->miLen; l++, mi++) { if (mi->accelerator == ch) { ToggleMenuListItemSelected (aWin, l); if (mi->line >= aWin->scrollPos && mi->line <= aWin->y_size) { - SetPort(theWindow); + SetPortWindowPort(theWindow); ToggleMenuSelect (aWin, mi->line - aWin->scrollPos); } /* Dismiss window if only picking one item */ @@ -1314,11 +1381,15 @@ static void -macClickMenu (EventRecord *theEvent, WindowPtr theWindow) { +macClickMenu (EventRecord *theEvent, WindowRef theWindow) { Point p; - NhWindow *aWin = GetNhWin (theWindow); + NhWindow *aWin = GetNhWin(theWindow); + Rect wrect; - if (aWin->scrollBar && (*aWin->scrollBar)->contrlVis) { + + GetWindowBounds(theWindow, kWindowContentRgn, &wrect); + OffsetRect(&wrect, -wrect.left, -wrect.top); + if (aWin->scrollBar && IsControlVisible(aWin->scrollBar)) { short code; ControlHandle theBar; @@ -1329,8 +1400,6 @@ DoScrollBar (p, code, theBar, aWin); return; } - if (p.h >= theWindow->portRect.right - SBARWIDTH) - return; } if (inSelect != WIN_ERR && aWin->how != PICK_NONE) { short currentRow = -1, previousRow = -1; @@ -1338,11 +1407,13 @@ Boolean majorSelectState, firstRow = TRUE; do { +#if !TARGET_API_MAC_CARBON SystemTask (); +#endif GetMouse (&p); currentRow = p.v / aWin->row_height; - if (p.h < theWindow->portRect.left || p.h > theWindow->portRect.right || - p.v < 0 || p.v > theWindow->portRect.bottom || currentRow >= aWin->y_size) { + if (p.h < wrect.left || p.h > wrect.right || + p.v < 0 || p.v > wrect.bottom || currentRow >= aWin->y_size) { continue; /* not in window range */ } @@ -1408,7 +1479,7 @@ macClickText (EventRecord *theEvent, WindowPtr theWindow) { NhWindow *aWin = GetNhWin (theWindow); - if (aWin->scrollBar && (*aWin->scrollBar)->contrlVis) { + if (aWin->scrollBar && IsControlVisible(aWin->scrollBar)) { short code; Point p = theEvent->where; ControlHandle theBar; @@ -1437,7 +1508,9 @@ InvertRect(&frame); while (WaitMouseUp()) { +#if !TARGET_API_MAC_CARBON SystemTask(); +#endif GetMouse(&mouse); if (PtInRect(mouse, &frame) != in_btn) { in_btn = !in_btn; @@ -1471,9 +1544,11 @@ if (strchr(topl_resp, *click_to_cmd(where.h, where.v, clicked_mod))) nhbell(); else { +#if !TARGET_API_MAC_CARBON if (cursor_locked) while (WaitMouseUp()) SystemTask(); +#endif gClickedToMove = TRUE; clicked_pos = where; @@ -1492,12 +1567,14 @@ if (!part) return; - theWin = (*theBar)->contrlOwner; + theWin = GetControlOwner(theBar); + GetWindowBounds(theWin, kWindowContentRgn, &r); + OffsetRect(&r, -r.left, -r.top); winToScroll = (NhWindow*)(GetWRefCon(theWin)); now = GetControlValue (theBar); - + if (part == kControlPageUpPart || part == kControlPageDownPart) - amtToScroll = (theWin->portRect.bottom - theWin->portRect.top) / winToScroll->row_height; + amtToScroll = (r.bottom - r.top) / winToScroll->row_height; else amtToScroll = 1; @@ -1517,36 +1594,39 @@ SetControlValue (theBar, now + amtToScroll); winToScroll->scrollPos = now + amtToScroll; - r = theWin->portRect; r.right -= SBARWIDTH; if (winToScroll == theWindows + WIN_MESSAGE) r.bottom -= SBARHEIGHT; rgn = NewRgn (); ScrollRect (&r, 0, -amtToScroll * winToScroll->row_height, rgn); if (rgn) { - InvalRgn (rgn); - BeginUpdate (theWin); + InvalWindowRgn(theWin, rgn); + BeginUpdate(theWin); } - winUpdateFuncs [((WindowPeek)theWin)->windowKind - WIN_BASE_KIND] (&fake, theWin); + winUpdateFuncs [GetWindowKind(theWin) - WIN_BASE_KIND] (&fake, theWin); if (rgn) { - EndUpdate (theWin); - DisposeRgn (rgn); + EndUpdate(theWin); + DisposeRgn(rgn); } } static void -DoScrollBar (Point p, short code, ControlHandle theBar, NhWindow *aWin) { +DoScrollBar (Point p, short code, ControlHandle theBar, NhWindow *aWin) +{ ControlActionUPP func = NULL; + Rect rect; if (code == kControlUpButtonPart || code == kControlPageUpPart || code == kControlDownButtonPart || code == kControlPageDownPart) func = MoveScrollUPP; - (void) TrackControl (theBar, p, func); + (void) TrackControl(theBar, p, func); if (!func) { if (aWin->scrollPos != GetControlValue (theBar)) { aWin->scrollPos = GetControlValue (theBar); - InvalRect (&(aWin->its_window)->portRect); + GetWindowBounds(aWin->its_window, kWindowContentRgn, &rect); + OffsetRect(&rect, -rect.left, -rect.top); + InvalWindowRect(aWin->its_window, &rect); } } } @@ -1563,7 +1643,7 @@ part = kControlDownButtonPart; } if (part) { - SetPort(aWin->its_window); + SetPortWindowPort(aWin->its_window); MoveScrollBar(aWin->scrollBar, part); return 0; } @@ -1577,7 +1657,7 @@ if (WIN_MESSAGE) { NhWindow *winToScroll = &theWindows[WIN_MESSAGE]; mac_display_nhwindow(WIN_MESSAGE, FALSE); - SetPort(winToScroll->its_window); + SetPortWindowPort(winToScroll->its_window); MoveScrollBar(winToScroll->scrollBar, kControlUpButtonPart); } return 0; @@ -1591,15 +1671,18 @@ static void -draw_growicon_vert_only(WindowPtr wind) { +draw_growicon_vert_only(WindowPtr wind) +{ GrafPtr org_port; RgnHandle org_clip = NewRgn(); - Rect r = wind->portRect; - r.left = r.right - SBARWIDTH; + Rect r; GetPort(&org_port); - SetPort(wind); + SetPortWindowPort(wind); GetClip(org_clip); + GetWindowBounds(wind, kWindowContentRgn, &r); + OffsetRect(&r, -r.left, -r.top); + r.left = r.right - SBARWIDTH; ClipRect(&r); DrawGrowIcon(wind); SetClip(org_clip); @@ -1609,16 +1692,19 @@ static short -macUpdateMessage (EventRecord *theEvent, WindowPtr theWindow) { +macUpdateMessage (EventRecord *theEvent, WindowPtr theWindow) +{ RgnHandle org_clip = NewRgn(), clip = NewRgn(); - Rect r = theWindow->portRect; - NhWindow *aWin = GetNhWin (theWindow); + Rect r; + NhWindow *aWin = GetNhWin(theWindow); int l; if (!theEvent) return 0; GetClip(org_clip); + GetWindowBounds(theWindow, kWindowContentRgn, &r); + OffsetRect(&r, -r.left, -r.top); DrawControls(theWindow); DrawGrowIcon(theWindow); @@ -1717,7 +1803,7 @@ TETextBox (*aWin->windowText, aWin->windowTextLen, &r, teJustLeft); HUnlock (aWin->windowText); -#if 1 +#if !TARGET_API_MAC_CARBON r.bottom = r.top + aWin->save_lin * aWin->row_height; r.top = r.bottom - 1; FillRect(&r, (void *) &qd.gray); @@ -1752,15 +1838,18 @@ static short GeneralUpdate (EventRecord *theEvent, WindowPtr theWindow) { - Rect r = theWindow->portRect; - Rect r2 = r; + Rect r, r2; NhWindow *aWin = GetNhWin (theWindow); RgnHandle h; Boolean vis; + if (!theEvent) return 0; + GetWindowBounds(theWindow, kWindowContentRgn, &r); + OffsetRect(&r, -r.left, -r.top); + r2 = r; r2.left = r2.right - SBARWIDTH; r2.right += 1; r2.top -= 1; @@ -1807,7 +1896,7 @@ Rect r = {0, 0, 1, 1}; GetPort (&gp); - SetPort (theWindow); + SetPortWindowPort(theWindow); if (cursor_locked) dir = (char *)0; @@ -1826,7 +1915,7 @@ HUnlock ((Handle) ch); } else { - SetCursor(&qd.arrow); + SetCursor(&qdarrow); } OffsetRect (&r, theEvent->where.h, theEvent->where.v); RectRgn (mouseRgn, &r); @@ -1841,7 +1930,7 @@ #endif Rect r = {-1, -1, 2, 2}; - SetCursor(&qd.arrow); + SetCursor(&qdarrow); OffsetRect (&r, theEvent->where.h, theEvent->where.v); RectRgn (mouseRgn, &r); } @@ -1865,7 +1954,7 @@ dispatchKey : if (theWindow) { - int kind = ((WindowPeek)theWindow)->windowKind - WIN_BASE_KIND; + int kind = GetWindowKind(theWindow) - WIN_BASE_KIND; winKeyFuncs [kind] (theEvent, theWindow); } else { GeneralKey (theEvent, (WindowPtr) 0); @@ -1898,10 +1987,10 @@ unsigned long l; WindowPtr theWindow; NhWindow *aWin; - Rect r = (*GetGrayRgn ())->rgnBBox; + Rect r; Boolean not_inSelect; - InsetRect (&r, 4, 4); + InsetRect(GetRegionBounds(GetGrayRgn(), &r), 4, 4); code = FindWindow (theEvent->where, &theWindow); aWin = GetNhWin (theWindow); @@ -1910,10 +1999,10 @@ switch (code) { case inContent : if (not_inSelect) { - int kind = ((WindowPeek)theWindow)->windowKind - WIN_BASE_KIND; + int kind = GetWindowKind(theWindow) - WIN_BASE_KIND; winCursorFuncs [kind] (theEvent, theWindow, gMouseRgn); SelectWindow (theWindow); - SetPort (theWindow); + SetPortWindowPort(theWindow); winClickFuncs [kind] (theEvent, theWindow); } else { nhbell (); @@ -1922,9 +2011,9 @@ case inDrag : if (not_inSelect) { - SetCursor(&qd.arrow); + SetCursor(&qdarrow); DragWindow (theWindow, theEvent->where, &r); - SaveWindowPos (theWindow); + SaveWindowPos(theWindow); } else { nhbell (); } @@ -1932,15 +2021,17 @@ case inGrow : if (not_inSelect) { - SetCursor(&qd.arrow); + SetCursor(&qdarrow); SetRect (&r, 80, 2 * aWin->row_height + 1, r.right, r.bottom); if (aWin == theWindows + WIN_MESSAGE) r.top += SBARHEIGHT; l = GrowWindow (theWindow, theEvent->where, &r); SizeWindow (theWindow, l & 0xffff, l >> 16, FALSE); - SaveWindowSize (theWindow); - SetPort (theWindow); - InvalRect (&(theWindow->portRect)); + SaveWindowSize(theWindow); + SetPortWindowPort(theWindow); + GetWindowBounds(theWindow, kWindowContentRgn, &r); + OffsetRect(&r, -r.left, -r.top); + InvalWindowRect(theWindow, &r); if (aWin->scrollBar) { DrawScrollbar (aWin); } @@ -1957,8 +2048,10 @@ DoMenuEvt (MenuSelect (theEvent->where)); break; +#if !TARGET_API_MAC_CARBON case inSysWindow : SystemClick(theEvent, theWindow); +#endif default : break; } @@ -1969,6 +2062,8 @@ HandleUpdate (EventRecord *theEvent) { WindowPtr theWindow = (WindowPtr) theEvent->message; NhWindow *aWin = GetNhWin (theWindow); + Rect r; + char existing_update_region = FALSE; Rect rect; @@ -1977,9 +2072,11 @@ existing_update_region = (get_invalid_region (theWindow, &rect) == noErr); } BeginUpdate (theWindow); - SetPort (theWindow); - EraseRect (&(theWindow->portRect)); - winUpdateFuncs [((WindowPeek)theWindow)->windowKind - WIN_BASE_KIND] + SetPortWindowPort(theWindow); + GetWindowBounds(theWindow, kWindowContentRgn, &r); + OffsetRect(&r, -r.left, -r.top); + EraseRect(&r); + winUpdateFuncs [GetWindowKind(theWindow) - WIN_BASE_KIND] (theEvent, theWindow); if (theWindow == _mt_window && existing_update_region) { @@ -1992,24 +2089,23 @@ static void DoOsEvt (EventRecord *theEvent) { - WindowPtr wp; + WindowRef win; short code; if ((theEvent->message & 0xff000000) == 0xfa000000) { /* Mouse Moved */ - code = FindWindow (theEvent->where, &wp); + code = FindWindow (theEvent->where, &win); if (code != inContent) { Rect r = {-1, -1, 2, 2}; - SetCursor(&qd.arrow); + SetCursor(&qdarrow); OffsetRect (&r, theEvent->where.h, theEvent->where.v); RectRgn (gMouseRgn, &r); - } else { - int kind = ((WindowPeek)wp)->windowKind - WIN_BASE_KIND; + int kind = GetWindowKind(win) - WIN_BASE_KIND; if (kind >= 0 && kind <= NHW_TEXT) { - winCursorFuncs [kind] (theEvent, wp, gMouseRgn); + winCursorFuncs [kind] (theEvent, win, gMouseRgn); } } } @@ -2029,12 +2125,14 @@ case mouseDown : HandleClick (theEvent); break; +#if !TARGET_API_MAC_CARBON case diskEvt : if ((theEvent->message & 0xffff0000) != 0) { Point p = {150, 150}; (void) DIBadMount (p, theEvent->message); } break; +#endif case osEvt : DoOsEvt (theEvent); break; @@ -2054,8 +2152,8 @@ if (!iflags.window_inited) return; - (void) WaitNextEvent (everyEvent, &anEvent, 0, gMouseRgn); - HandleEvent (&anEvent); + (void) WaitNextEvent (everyEvent, &anEvent, -1, gMouseRgn); + HandleEvent(&anEvent); } @@ -2163,8 +2261,9 @@ in_putstr ++; slen = strlen (str); - SetPort (aWin->its_window); - r = aWin->its_window->portRect; + SetPortWindowPort(aWin->its_window); + GetWindowBounds(aWin->its_window, kWindowContentRgn, &r); + OffsetRect(&r, -r.left, -r.top); if (win == WIN_MESSAGE) { r.right -= SBARWIDTH; r.bottom -= SBARHEIGHT; @@ -2237,7 +2336,7 @@ SetControlMaximum (aWin->scrollBar, aWin->y_size); SetControlValue(aWin->scrollBar, min); } - InvalRect (&r); + InvalWindowRect(aWin->its_window, &r); } else /* Message has a fixed width, other windows base on content */ if (maxWidth > aWin->x_size) @@ -2255,7 +2354,7 @@ return; } - SetPort (aWin->its_window); + SetPortWindowPort(aWin->its_window); MoveTo (x * aWin->char_width, (y * aWin->row_height) + aWin->ascent_height); aWin->x_curs = x; aWin->y_curs = y; @@ -2492,9 +2591,9 @@ struct window_procs mac_procs = { "mac", WC_COLOR | WC_HILITE_PET | - WC_LARGE_FONT | /* obsolete */ WC_FONT_MAP | WC_FONT_MENU | WC_FONT_MESSAGE | WC_FONT_STATUS | WC_FONT_TEXT | WC_FONTSIZ_MAP | WC_FONTSIZ_MENU | WC_FONTSIZ_MESSAGE | WC_FONTSIZ_STATUS | WC_FONTSIZ_TEXT, + 0L, mac_init_nhwindows, mac_unimplemented, /* see macmenu.c:mac_askname() for player selection */ mac_askname, diff -Naurd ../nethack-3.4.1/sys/mac/mgetline.c ./sys/mac/mgetline.c --- ../nethack-3.4.1/sys/mac/mgetline.c Sun Feb 23 14:43:35 2003 +++ ./sys/mac/mgetline.c Mon Sep 1 14:33:32 2003 @@ -30,8 +30,6 @@ static void topl_getlin(const char *query, char *bufp, Boolean ext) { - int q_len = strlen(query); - if (get_line_from_key_queue (bufp)) return; diff -Naurd ../nethack-3.4.1/sys/mac/mmodal.c ./sys/mac/mmodal.c --- ../nethack-3.4.1/sys/mac/mmodal.c Sun Feb 23 14:43:35 2003 +++ ./sys/mac/mmodal.c Mon Sep 1 14:33:32 2003 @@ -2,13 +2,18 @@ /* Copyright (c) Jon W{tte, Hao-Yang Wang, Jonathan Handler 1992. */ /* NetHack may be freely redistributed. See license for details. */ -#include +#if !TARGET_API_MAC_CARBON +# include +# include +#else +# include +#endif + #include "macpopup.h" -#include /* Flash a dialog button when its accelerator key is pressed */ void -FlashButton (WindowPtr wind, short item) { +FlashButton(DialogRef wind, short item) { short type; Handle handle; Rect rect; diff -Naurd ../nethack-3.4.1/sys/mac/mttymain.c ./sys/mac/mttymain.c --- ../nethack-3.4.1/sys/mac/mttymain.c Sun Feb 23 14:43:35 2003 +++ ./sys/mac/mttymain.c Mon Sep 1 14:33:32 2003 @@ -8,7 +8,9 @@ #include "mactty.h" #include "wintty.h" +#if !TARGET_API_MAC_CARBON #include +#endif #define MT_WINDOW 135 #define MT_WIDTH 80 @@ -157,9 +159,9 @@ sprintf (ptr, "%s%s%x%x%x", count ? "/" : "" , flag ? "-" : "" , - (_mt_colors [count] [flag] >> 20) & 0xf , - (_mt_colors [count] [flag] >> 12) & 0xf , - (_mt_colors [count] [flag] >> 4) & 0xf); + (int)(_mt_colors [count] [flag] >> 20) & 0xf , + (int)(_mt_colors [count] [flag] >> 12) & 0xf , + (int)(_mt_colors [count] [flag] >> 4) & 0xf); ptr += strlen (ptr); } for (count = 0; count < 5; count ++) { @@ -167,9 +169,9 @@ sprintf (ptr, "/%s%x%x%x" , flag ? "-" : "" , - (_mt_attrs [count] [flag] >> 20) & 0xf , - (_mt_attrs [count] [flag] >> 12) & 0xf , - (_mt_attrs [count] [flag] >> 4) & 0xf); + (int)(_mt_attrs [count] [flag] >> 20) & 0xf , + (int)(_mt_attrs [count] [flag] >> 12) & 0xf , + (int)(_mt_attrs [count] [flag] >> 4) & 0xf); ptr += strlen (ptr); } @@ -183,7 +185,7 @@ char kill_char = CHAR_ESC; char erase_char = CHAR_BS; -WindowPtr _mt_window = (WindowPtr) 0; +WindowRef _mt_window = (WindowRef) 0; static Boolean _mt_in_color = 0; extern short win_fonts [NHW_TEXT + 1]; @@ -227,11 +229,11 @@ if (create_tty (&_mt_window, WIN_BASE_KIND + NHW_MAP, _mt_in_color) != noErr) error("_mt_init_stuff: Couldn't create tty."); - ((WindowPeek) _mt_window)->windowKind = (WIN_BASE_KIND + NHW_MAP); - SelectWindow (_mt_window); - SetPort (_mt_window); - SetOrigin (-1, -1); - + SetWindowKind(_mt_window, WIN_BASE_KIND + NHW_MAP); + SelectWindow(_mt_window); + SetPortWindowPort(_mt_window); + SetOrigin(-1, -1); + font_size = iflags.wc_fontsiz_map ? iflags.wc_fontsiz_map : (iflags.large_font && !small_screen) ? 12 : 9; if (init_tty_number (_mt_window, win_fonts [NHW_MAP], font_size, CO, LI) != noErr) @@ -300,18 +302,18 @@ #if defined(__SC__) || defined(__MRC__) # pragma unused(color) #endif -Rect r; -Point p = {0, 0}; -GDHandle gh; + Rect r; +// Point p = {0, 0}; + GDHandle gh; - if (!_mt_in_color) { + + if (!_mt_in_color) return 0; - } - r = _mt_window->portRect; - SetPort (_mt_window); - LocalToGlobal (&p); - OffsetRect (&r, p.h, p.v); + GetWindowBounds(_mt_window, kWindowContentRgn, &r); +// SetPortWindowPort(_mt_window); +// LocalToGlobal (&p); +// OffsetRect (&r, p.h, p.v); gh = GetMaxDevice (&r); if (!gh) { diff -Naurd ../nethack-3.4.1/util/lev_main.c ./util/lev_main.c --- ../nethack-3.4.1/util/lev_main.c Sun Feb 23 14:43:43 2003 +++ ./util/lev_main.c Mon Sep 1 14:33:32 2003 @@ -20,9 +20,11 @@ # if defined(__SC__) || defined(__MRC__) # define MPWTOOL # define PREFIX ":dungeon:" /* place output files here */ -#include +# include # else -# define PREFIX ":lib:" /* place output files here */ +# if !defined(__MACH__) +# define PREFIX ":lib:" /* place output files here */ +# endif # endif #endif diff -Naurd ../nethack-3.4.1/util/dgn_main.c ./util/dgn_main.c --- ../nethack-3.4.1/util/dgn_main.c Sun Feb 23 14:43:43 2003 +++ ./util/dgn_main.c Mon Sep 1 14:33:32 2003 @@ -11,6 +11,11 @@ #include "config.h" #include "dlb.h" +/* Macintosh-specific code */ +#if defined(__APPLE__) && defined(__MACH__) + /* MacOS X has Unix-style files and processes */ +# undef MAC +#endif #ifdef MAC # if defined(__SC__) || defined(__MRC__) # define MPWTOOL