#endif /* ANGBAND_LITE_MAC */
- GWorldPtr bufferPort;
- PixMapHandle bufferPixHndl;
- PixMapPtr bufferPix;
-
Str15 title;
s16b oops;
#endif
+#if TARGET_API_MAC_CARBON
+
static OSErr ChooseFile( StringPtr filename, FSSpec selfld )
{
NavReplyRecord reply;
return err;
}
+#endif
/*
* Activate a given window, if necessary
}
}
-static OSErr XDDSWUpDateGWorldFromPict( term_data *td );
/*
* Hack -- resize a term_data
*
{
/* Actually resize the window */
SizeWindow(td->w, td->size_wid, td->size_hgt, 0);
-
- XDDSWUpDateGWorldFromPict( td );
}
}
-/*
- * Lock a frame
- */
-static void XDDSWLockFrame( term_data *td )
-{
- PixMapHandle pixMapH;
-
- pixMapH = GetGWorldPixMap(td->bufferPort);
- (void)LockPixels(pixMapH);
- HLockHi((Handle)pixMapH);
- td->bufferPixHndl = pixMapH;
- td->bufferPix = (PixMapPtr)*(Handle)pixMapH;
-}
-
/*
* Unlock a frame
}
-/*
- * Unlock a frame
- */
-static void XDDSWUnlockFrame( term_data *td )
-{
- if (td->bufferPort != NULL)
- {
- HUnlock((Handle)td->bufferPixHndl);
- UnlockPixels(td->bufferPixHndl);
- }
-
- td->bufferPix = NULL;
-}
-
static OSErr BenSWCreateGWorldFromPict(
GWorldPtr *pictGWorld,
PicHandle pictH)
}
-static OSErr XDDSWCreateGWorldFromPict(
- GWorldPtr *pictGWorld,
- term_data *td )
-{
- OSErr err;
- GWorldPtr saveGWorld;
- GDHandle saveGDevice;
- GWorldPtr tempGWorld;
- Rect pictRect;
- short depth;
- GDHandle theGDH;
-
- tempGWorld = NULL;
-
- /* Reset */
- *pictGWorld = NULL;
-
- /* Get depth */
- depth = td->pixelDepth;
-
- /* Get GDH */
- theGDH = td->theGDH;
-
- /* Obtain size rectangle */
- pictRect.left = 0;
- pictRect.right = td->size_wid;
- pictRect.top = 0;
- pictRect.bottom = td->tile_hgt;
-
- /* Create a GWorld */
- err = NewGWorld(&tempGWorld, 0, &pictRect, 0, 0, 0);
-
- /* Success */
- if (err != noErr)
- {
- return (err);
- }
-
- /* Save pointer */
- *pictGWorld = tempGWorld;
-
- /* Save GWorld */
- GetGWorld(&saveGWorld, &saveGDevice);
-
- /* Activate */
- SetGWorld(tempGWorld, nil);
-
- /* Dump the pict into the GWorld
- (void)LockPixels(GetGWorldPixMap(tempGWorld));
- EraseRect(&pictRect);
-// DrawPicture(pictH, &pictRect);
- UnlockPixels(GetGWorldPixMap(tempGWorld));
-
- /* Restore GWorld */
- SetGWorld(saveGWorld, saveGDevice);
-
- return (0);
-}
-
-
-static OSErr XDDSWUpDateGWorldFromPict( term_data *td )
-{
- GWorldPtr saveGWorld;
- GDHandle saveGDevice;
- Rect pictRect;
- short depth;
- GDHandle theGDH;
-
- GWorldFlags errflag;
-
- /* */
-
- if( td->bufferPort == NULL )
- return;
- /* Get depth */
- depth = td->pixelDepth;
-
- /* Get GDH */
- theGDH = td->theGDH;
-
- /* Obtain size rectangle */
- pictRect.top = 0;
- pictRect.left = 0;
- pictRect.right = td->size_wid;
- pictRect.bottom = td->tile_hgt;
-
- XDDSWUnlockFrame(td);
-
- errflag = UpdateGWorld( &td->bufferPort, depth, &pictRect, 0, 0, 0);
- XDDSWLockFrame(td);
- if( errflag & gwFlagErr ){
- //SysBeep(0);
- return;
- }
-
-#if 0
- /* Save GWorld */
- GetGWorld(&saveGWorld, &saveGDevice);
-
- /* Activate */
- SetGWorld(td->bufferPort, nil);
-
- /* Dump the pict into the GWorld */
- (void)LockPixels(GetGWorldPixMap(td->bufferPort));
- EraseRect(&td->bufferPort->portRect);
-
- UnlockPixels(GetGWorldPixMap(td->bufferPort));
- /* Restore GWorld */
- SetGWorld(saveGWorld, saveGDevice);
-#endif
-
-}
/*
* Init the global "frameP"
/* Forget color */
td->last = -1;
- XDDSWCreateGWorldFromPict( &td->bufferPort, td );
-
- XDDSWLockFrame( td );
-
}
/* Oops */
/* if (err == noErr)
case TERM_XTRA_BORED:
{
/* Process an event */
- (void)CheckEvents(0);
+ (void)CheckEvents(FALSE);
/* Success */
return (0);
/* If needed */
if (v > 0)
{
+#if TARGET_API_MAC_CARBON
+ EventRecord tmp;
+ UInt32 ticks;
+
+ /* Convert millisecs to ticks */
+ ticks = (v * 60L) / 1000;
+
+ /*
+ * Hack? - Put the programme into sleep.
+ * No events match ~everyEvent, so nothing
+ * should be lost in Angband's event queue.
+ * Even if ticks are 0, it's worth calling for
+ * the above mentioned reasons.
+ */
+ WaitNextEvent(~everyEvent, &tmp, ticks, nil);
+#else
long m = TickCount() + (v * 60L) / 1000;
/* Wait for it */
while (TickCount() < m) /* loop */;
+#endif
}
/* Success */
{
int i;
Rect r2;
- bool use_buffer = false;
term_data *td = (term_data*)(Term->data);
GDHandle saveGDevice;
GWorldPtr saveGWorld;
PixMapHandle PortPix;
-
/* Save GWorld */
GetGWorld(&saveGWorld, &saveGDevice);
+ r2.left = x * td->tile_wid + td->size_ow1;
+ r2.right = r2.left + td->tile_wid;
+ r2.top = y * td->tile_hgt + td->size_oh1;
+ r2.bottom = r2.top + td->tile_hgt;
+
if( n > 1 )
{
- Rect portRect;
-
-#if TARGET_API_MAC_CARBON
- GetPortBounds( (CGrafPtr)td->bufferPort, &portRect );
-#else
- portRect = td->bufferPort->portRect;
-#endif
-
- /* Destination rectangle */
- r2.left = x * td->tile_wid + td->size_ow1;
- r2.right = r2.left + td->tile_wid;
- r2.top = 0;
- r2.bottom = r2.top + td->tile_hgt;
-
- /* Activate */
- SetGWorld(td->bufferPort, nil);
- PortPix = GetGWorldPixMap(td->bufferPort );
- LockPixels( PortPix );
-
/* Instantiate font */
TextFont(td->font_id);
TextSize(td->font_size);
/* Restore colors */
BackColor(blackColor);
ForeColor(whiteColor);
-
- /* Erase */
- EraseRect(&portRect);
-
- use_buffer = true;
}
else
{
/* Destination rectangle */
- r2.left = x * td->tile_wid + td->size_ow1;
+/* r2.left = x * td->tile_wid + td->size_ow1;
r2.top = y * td->tile_hgt + td->size_oh1;
- r2.bottom = r2.top + td->tile_hgt;
+ r2.bottom = r2.top + td->tile_hgt;*/
- /* no buffering, so we use the normal current port */
-
- use_buffer = false;
}
/* Scan the input */
ForeColor(blackColor);
/* Draw the picture */
-
- if (use_buffer)
- destBitMap = (BitMapPtr)(td->bufferPix);
- else
#if TARGET_API_MAC_CARBON
- destBitMap = GetPortPixMap(GetWindowPort( td->w ));
+ destBitMap = GetPortPixMap(GetWindowPort( td->w ));
#else
- destBitMap = (BitMapPtr)&(td->w->portBits);
+ destBitMap = (BitMapPtr)&(td->w->portBits);
#endif
if (use_bigtile) r2.right += td->tile_wid;
* assign this relative amount of background
* color to the destination pixel
*/
+#if TARGET_API_MAC_CARBON
+ CopyBits( (BitMap *) *srcBitMap, (BitMap *) *destBitMap, &terrain_r, &r2, srcCopy, NULL);
+#else
CopyBits( srcBitMap, destBitMap, &terrain_r, &r2, srcCopy, NULL );
-
+#endif
/*
* Draw transparent tile
* BackColor is ignored and the destination is
* left untouched
*/
BackColor(blackColor);
+#if TARGET_API_MAC_CARBON
+ CopyBits( (BitMap *) *srcBitMap, (BitMap *) *destBitMap, &r1, &r2, transparent, NULL);
+#else
CopyBits( srcBitMap, destBitMap, &r1, &r2, transparent, NULL );
+#endif
}
else
#endif /* USE_TRANSPARENCY */
/* Advance */
r2.left += td->tile_wid;
}
-
- if( use_buffer )
- {
- /* Now we blast the buffer pixmap onto the screen in the right place */
- BitMapPtr srcBitMap = (BitMapPtr)(td->bufferPix);
-#if TARGET_API_MAC_CARBON
- BitMapPtr destBitMap = GetPortPixMap(GetWindowPort( td->w ));
-#else
- BitMapPtr destBitMap = (BitMapPtr)&(td->w->portBits);
-#endif
-
- Rect srcRect;
- Rect destRect;
-
- srcRect.left = x * td->tile_wid + td->size_ow1;
- srcRect.top = 0;
- srcRect.right = srcRect.left + (td->tile_wid * n);
- srcRect.bottom = td->tile_hgt;
-
- destRect.left = x * td->tile_wid + td->size_ow1;
- destRect.right = destRect.left + (td->tile_wid * n);
- destRect.top = y * td->tile_hgt + td->size_oh1;
- destRect.bottom = destRect.top + td->tile_hgt;
-
- /* Double width rectangle */
- if (use_bigtile)
- {
- srcRect.right += td->tile_wid * n;
- destRect.right += td->tile_wid * n;
- }
-
- UnlockPixels( PortPix );
-
- /* Restore GWorld */
- SetGWorld(saveGWorld, saveGDevice);
-
- /* Hardwire CopyBits */
- BackColor(whiteColor);
- ForeColor(blackColor);
-
- CopyBits( srcBitMap, destBitMap, &srcRect, &destRect, srcCopy, NULL );
-
- /* Restore colors */
- BackColor(blackColor);
- ForeColor(whiteColor);
- }
-
/* Success */
return (0);
}
-
-
-
-
/*
* Create and initialize window number "i"
*/
soundmode[i] = getshort();
/* Special menu */
- m = GetMenuHandle(134); //m = GetMHandle(134);
+ m = GetMenuHandle(134);
#if TARGET_API_MAC_CARBON
/* Item "arg_sound" */
Rect r;
/* Get the button */
- GetDialogItem(dialog, i, &type, (Handle*)&control, &r); //GetDItem(dialog, i, &type, (Handle*)&control, &r);
+ GetDialogItem(dialog, i, &type, (Handle*)&control, &r);
/* Blink button for 1/10 second */
HiliteControl(control, 1);
TextSize(12);
/* Add the fonts to the menu */
- AppendResMenu(m, 'FONT'); //AddResMenu(m, 'FONT');
+ AppendResMenu(m, 'FONT');
/* Size of menu */
#if TARGET_API_MAC_CARBON
short fontNum;
/* Acquire the font name */
- /* GetMenuItemText(m, i, tmpName); */
- GetMenuItemText(m, i, tmpName); //GetItem(m, i, tmpName);
+ GetMenuItemText(m, i, tmpName);
/* Acquire the font index */
#if TARGET_API_MAC_CARBON
if ((CharWidth('i') != CharWidth('W')) || (CharWidth('W') == 0))
{
/* Delete the menu item XXX XXX XXX */
- /* DeleteMenuItem(m, i); */
- DeleteMenuItem (m, i); //DelMenuItem(m, i);
+ DeleteMenuItem (m, i);
}
}
AppendMenu(m, "\p-");
/* Add the fonts to the menu */
- AppendResMenu (m, 'FONT'); //AddResMenu(m, 'FONT');
+ AppendResMenu (m, 'FONT');
/* Make the "Size" menu */
/* Edit menu */
- m = GetMenuHandle(130); //m = GetMHandle(130);
+ m = GetMenuHandle(130);
/* Get menu size */
#if TARGET_API_MAC_CARBON
/* Font menu */
- m = GetMenuHandle(131); //m = GetMHandle(131);
+ m = GetMenuHandle(131);
/* Get menu size */
#if TARGET_API_MAC_CARBON
EnableMenuItem(m, i);
/* Analyze font */
- /* GetMenuItemText(m,i,s); */
- GetMenuItemText(m, i, s); //GetItem(m, i, s);
+ GetMenuItemText(m, i, s);
GetFNum(s, &value);
/* Check active font */
EnableItem(m, i);
/* Analyze font */
- /* GetMenuItemText(m,i,s); */
- GetMenuItemText(m, i, s); //GetItem(m, i, s);
+ GetMenuItemText(m, i, s);
GetFNum(s, &value);
/* Check active font */
/* Size menu */
- m = GetMenuHandle(132); //m = GetMHandle(132);
+ m = GetMenuHandle(132);
/* Get menu size */
#if TARGET_API_MAC_CARBON
{
#if TARGET_API_MAC_CARBON
/* Analyze size */
- /* GetMenuItemText(m,i,s); */
GetMenuItemText(m, i, s);
s[s[0]+1] = '\0';
value = atoi((char*)(s+1));
if (td->font_size == value) CheckMenuItem(m, i, TRUE);
#else
/* Analyze size */
- /* GetMenuItemText(m,i,s); */
- GetMenuItemText(m, i, s); //GetItem(m, i, s);
+ GetMenuItemText(m, i, s);
s[s[0]+1] = '\0';
value = atoi((char*)(s+1));
/* Windows menu */
- m = GetMenuHandle(133); //m = GetMHandle(133);
+ m = GetMenuHandle(133);
/* Get menu size */
#if TARGET_API_MAC_CARBON
/* Special menu */
- m = GetMenuHandle(134); //m = GetMHandle(134);
+ m = GetMenuHandle(134);
/* Get menu size */
#if TARGET_API_MAC_CARBON
#endif
/* TileWidth menu */
- m = GetMenuHandle(135); //m = GetMHandle(135);
+ m = GetMenuHandle(135);
/* Get menu size */
#if TARGET_API_MAC_CARBON
{
/* Analyze size */
/* GetMenuItemText(m,i,s); */
- GetMenuItemText(m, i, s); //GetItem(m, i, s);
+ GetMenuItemText(m, i, s);
s[s[0]+1] = '\0';
value = atoi((char*)(s+1));
/* TileHeight menu */
- m = GetMenuHandle(136); //m = GetMHandle(136);
+ m = GetMenuHandle(136);
/* Get menu size */
#if TARGET_API_MAC_CARBON
for (i = 1; i <= n; i++)
{
/* Analyze size */
- /* GetMenuItemText(m,i,s); */
- GetMenuItemText(m, i, s); //GetItem(m, i, s);
+ GetMenuItemText(m, i, s);
s[s[0]+1] = '\0';
value = atoi((char*)(s+1));
}
/* Get a new font name */
- /* GetMenuItemText(GetMHandle(131), selection, s); */
- GetMenuItemText(GetMenuHandle(131), selection, s); //GetItem(GetMHandle(131), selection, s);
+ GetMenuItemText(GetMenuHandle(131), selection, s);
GetFNum(s, &fid);
/* Save the new font id */
/* Activate */
activate(td->w);
- /* GetMenuItemText(GetMHandle(132), selection, s); */
- GetMenuItemText(GetMenuHandle(132), selection, s); //GetItem(GetMHandle(132), selection, s);
+ GetMenuItemText(GetMenuHandle(132), selection, s);
s[s[0]+1]=0;
td->font_size = atoi((char*)(s+1));
/* Activate */
activate(td->w);
- /* GetMenuItemText(GetMHandle(135), selection, s); */
- GetMenuItemText(GetMenuHandle(135), selection, s); //GetItem(GetMHandle(135), selection, s);
+ GetMenuItemText(GetMenuHandle(135), selection, s);
s[s[0]+1]=0;
td->tile_wid = atoi((char*)(s+1));
/* Activate */
activate(td->w);
- /* GetMenuItemText(GetMHandle(136), selection, s); */
- GetMenuItemText(GetMenuHandle(136), selection, s); //GetItem(GetMHandle(136), selection, s);
+ GetMenuItemText(GetMenuHandle(136), selection, s);
s[s[0]+1]=0;
td->tile_hgt = atoi((char*)(s+1));
/* Timestamp last check */
lastTicks = curTicks;
-#ifndef TARGET_API_MAC_CARBON
+#if TARGET_API_MAC_CARBON
+ WaitNextEvent( everyEvent, &event, 1L, nil );
+#else
/* Let the "system" run */
SystemTask();
-#endif
/* Get an event (or null) */
GetNextEvent(everyEvent, &event);
+#endif
/* Hack -- Nothing is ready yet */
if (event.what == nullEvent) return (FALSE);
-
/* Analyze the event */
switch (event.what)
{
HiliteMenu(0);
break;
}
-#ifndef TARGET_API_MAC_CARBON
+#if !TARGET_API_MAC_CARBON
case inSysWindow:
{
SystemClick(&event, w);
#endif
p.h = portRect.left;
p.v = portRect.top;
-#ifndef TARGET_API_MAC_CARBON
+#if !TARGET_API_MAC_CARBON
LocalToGlobal(&p);
#endif
td->r.left = p.h;
EventRecord tempEvent;
int numberOfMasters = 10;
-#ifndef TARGET_API_MAC_CARBON
+#if !TARGET_API_MAC_CARBON
/* Increase stack space by 64K */
SetApplLimit(GetApplLimit() - 131072L);//65536L);
/* Get more Masters */
while (numberOfMasters--) MoreMasters();
-#ifndef TARGET_API_MAC_CARBON
+#if !TARGET_API_MAC_CARBON
/* Set up the Macintosh */
InitGraf(&qd.thePort);
InitFonts();
#ifdef USE_SFL_CODE
-#if TARGET_API_MAC_CARBON
+#if ( TARGET_API_MAC_CARBON ) || ( !MAC_MPW )
/* Obtain a "Universal Procedure Pointer" */
AEH_Start_UPP = NewAEEventHandlerUPP(AEH_Start);
/* Install the hook (ignore error codes) */
#endif
/* Prompt the user */
- #ifdef JP
+#ifdef JP
prt("'¥Õ¥¡¥¤¥ë'¥á¥Ë¥å¡¼¤è¤ê'¿·µ¬'¤Þ¤¿¤Ï'³«¤¯...'¤òÁªÂò¤·¤Æ¤¯¤À¤µ¤¤¡£", 23, 10);
- #else
+#else
prt("[Choose 'New' or 'Open' from the 'File' menu]", 23, 15);
- #endif
+#endif
/* Flush the prompt */
Term_fresh();