mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 03:59:36 +00:00
Remove regions, add framing (fixes mirrors)
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include "DialogUtils.h"
|
||||
#include "Environ.h"
|
||||
#include "Externs.h"
|
||||
#include "ScanlineMask.h"
|
||||
|
||||
|
||||
static void HiLiteOkayButton (void);
|
||||
@@ -21,7 +22,7 @@ static void UpdateMainPict (DialogPtr);
|
||||
static Boolean AboutFilter (DialogPtr, EventRecord *theEvent, short *hit);
|
||||
|
||||
|
||||
static RgnHandle okayButtRgn;
|
||||
static PortabilityLayer::ScanlineMask *okayButtScanlineMask;
|
||||
static Rect okayButtonBounds, mainPICTBounds;
|
||||
static Boolean okayButtIsHiLit, clickedDownInOkay;
|
||||
|
||||
@@ -63,6 +64,8 @@ void DoAbout (void)
|
||||
}
|
||||
|
||||
GetDialogItem(aboutDialog, kOkayButton, &itemType, &itemHandle, &okayButtonBounds);
|
||||
#if 0
|
||||
PL_NotYetImplemented_TODO("Misc");
|
||||
okayButtRgn = NewRgn(); // Create diagonal button region
|
||||
OpenRgn();
|
||||
MoveTo(okayButtonBounds.left + 1, okayButtonBounds.top + 45);
|
||||
@@ -71,6 +74,7 @@ void DoAbout (void)
|
||||
Line(-44, 44);
|
||||
Line(-16, -16);
|
||||
CloseRgn(okayButtRgn);
|
||||
#endif
|
||||
okayButtIsHiLit = false; // Initially, button is not hilit
|
||||
clickedDownInOkay = false; // Initially, didn't click in okay button
|
||||
GetDialogItem(aboutDialog, kPictItemMain, &itemType, &itemHandle, &mainPICTBounds);
|
||||
@@ -79,10 +83,10 @@ void DoAbout (void)
|
||||
{
|
||||
ModalDialog(aboutFilterUPP, &hit);
|
||||
}
|
||||
while ((hit != kOkayButton) && (okayButtRgn != nil));
|
||||
while ((hit != kOkayButton) && (okayButtScanlineMask != nil));
|
||||
|
||||
if (okayButtRgn != nil)
|
||||
DisposeRgn(okayButtRgn); // Clean up!
|
||||
if (okayButtScanlineMask != nil)
|
||||
okayButtScanlineMask->Destroy(); // Clean up!
|
||||
DisposeDialog(aboutDialog);
|
||||
DisposeModalFilterUPP(aboutFilterUPP);
|
||||
|
||||
@@ -175,7 +179,7 @@ static Boolean AboutFilter (DialogPtr theDial, EventRecord *theEvent, short *hit
|
||||
if (Button() && clickedDownInOkay)
|
||||
{
|
||||
GetMouse(&mousePt);
|
||||
if(PtInRgn(mousePt, okayButtRgn))
|
||||
if(PointInScanlineMask(mousePt, okayButtScanlineMask))
|
||||
HiLiteOkayButton();
|
||||
else
|
||||
UnHiLiteOkayButton();
|
||||
@@ -203,7 +207,7 @@ static Boolean AboutFilter (DialogPtr theDial, EventRecord *theEvent, short *hit
|
||||
case mouseDown:
|
||||
mousePt = theEvent->where;
|
||||
GlobalToLocal(&mousePt);
|
||||
if(PtInRgn(mousePt, okayButtRgn))
|
||||
if(PointInScanlineMask(mousePt, okayButtScanlineMask))
|
||||
{
|
||||
clickedDownInOkay = true;
|
||||
handledIt = false;
|
||||
@@ -215,7 +219,7 @@ static Boolean AboutFilter (DialogPtr theDial, EventRecord *theEvent, short *hit
|
||||
case mouseUp:
|
||||
mousePt = theEvent->where;
|
||||
GlobalToLocal(&mousePt);
|
||||
if(PtInRgn(mousePt, okayButtRgn) && clickedDownInOkay)
|
||||
if(PointInScanlineMask(mousePt, okayButtScanlineMask) && clickedDownInOkay)
|
||||
{
|
||||
UnHiLiteOkayButton();
|
||||
*hit = kOkayButton;
|
||||
|
||||
@@ -209,17 +209,3 @@ void DkGrayForeColor (void)
|
||||
|
||||
RGBForeColor(&color);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- RestoreColorsSlam
|
||||
|
||||
// This function forces the Macintosh to rebuild the palette. It is<69>
|
||||
// called to restore a sense or normality after some serious munging<6E>
|
||||
// with the palette.
|
||||
|
||||
void RestoreColorsSlam (void)
|
||||
{
|
||||
RestoreDeviceClut(nil);
|
||||
PaintBehind(nil, GetGrayRgn());
|
||||
DrawMenuBar();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
void DrawOnSplash (void);
|
||||
void SetPaletteToGrays (void);
|
||||
void HardDrawMainWindow (void);
|
||||
void RestoreColorsSlam (void);
|
||||
|
||||
|
||||
CTabHandle theCTab;
|
||||
@@ -132,18 +131,15 @@ void RedrawSplashScreen (void)
|
||||
void UpdateMainWindow (void)
|
||||
{
|
||||
Rect tempRect;
|
||||
RgnHandle dummyRgn;
|
||||
|
||||
dummyRgn = NewRgn();
|
||||
GetPortVisibleRegion(GetWindowPort(mainWindow), dummyRgn);
|
||||
SetPortWindowPort(mainWindow);
|
||||
|
||||
if (theMode == kEditMode)
|
||||
{
|
||||
PauseMarquee();
|
||||
CopyBitsConstrained((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
||||
&mainWindowRect, &mainWindowRect, srcCopy, &(*dummyRgn)->rect);
|
||||
&mainWindowRect, &mainWindowRect, srcCopy);
|
||||
ResumeMarquee();
|
||||
}
|
||||
else if ((theMode == kSplashMode) || (theMode == kPlayMode))
|
||||
@@ -153,15 +149,14 @@ void UpdateMainWindow (void)
|
||||
QSetRect(&tempRect, 0, 0, 640, 460);
|
||||
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
|
||||
LoadScaledGraphic(kSplash8BitPICT, &tempRect);
|
||||
CopyBitsConstrained((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
||||
&workSrcRect, &mainWindowRect, srcCopy, &(*dummyRgn)->rect);
|
||||
&workSrcRect, &mainWindowRect, srcCopy);
|
||||
SetPortWindowPort(mainWindow);
|
||||
|
||||
DrawOnSplash();
|
||||
}
|
||||
|
||||
DisposeRgn(dummyRgn);
|
||||
splashDrawn = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ void LoadGraphicPlus (short resID, Rect *theRect)
|
||||
void RedrawMapContents (void)
|
||||
{
|
||||
Rect newClip, aRoom, src;
|
||||
RgnHandle wasClip;
|
||||
Rect wasClip;
|
||||
short h, i, groundLevel;
|
||||
short floor, suite, whoCares, type;
|
||||
char wasState;
|
||||
@@ -199,12 +199,9 @@ void RedrawMapContents (void)
|
||||
newClip.bottom = mapWindowRect.bottom + 2 - kMapScrollBarWidth;
|
||||
|
||||
SetPort((GrafPtr)mapWindow);
|
||||
wasClip = NewRgn();
|
||||
if (wasClip != nil)
|
||||
{
|
||||
GetClip(wasClip);
|
||||
ClipRect(&newClip);
|
||||
}
|
||||
|
||||
GetClip(&wasClip);
|
||||
ClipRect(&newClip);
|
||||
|
||||
for (i = 0; i < mapRoomsHigh; i++)
|
||||
{
|
||||
@@ -285,11 +282,7 @@ void RedrawMapContents (void)
|
||||
InsetRect(&activeRoomRect, -1, -1);
|
||||
}
|
||||
|
||||
if (wasClip != nil)
|
||||
{
|
||||
SetClip(wasClip);
|
||||
DisposeRgn(wasClip);
|
||||
}
|
||||
ClipRect(&wasClip);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -656,7 +656,6 @@ void DrawDresser(Rect *dresser)
|
||||
#define kDresserSideSpare 14
|
||||
Rect tempRect, dest;
|
||||
long yellowC, brownC, dkGrayC, ltTanC, dkstRedC;
|
||||
RgnHandle shadowRgn;
|
||||
short nRects, height, i;
|
||||
CGrafPtr wasCPort;
|
||||
Pattern dummyPattern;
|
||||
|
||||
@@ -24,7 +24,6 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
|
||||
{
|
||||
objectType thisObject;
|
||||
Rect whoCares, itsRect, rectA, rectB, testRect;
|
||||
RgnHandle theRgn;
|
||||
short i, legit, dynamicNum, n;
|
||||
short floor, suite, room, obj;
|
||||
char wasState;
|
||||
@@ -683,10 +682,7 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
|
||||
GetMovieBox(theMovie, &movieRect);
|
||||
CenterRectInRect(&movieRect, &whoCares);
|
||||
SetMovieBox(theMovie, &movieRect);
|
||||
theRgn = NewRgn();
|
||||
RectRgn(theRgn, &whoCares);
|
||||
SetMovieDisplayClipRgn(theMovie, theRgn);
|
||||
DisposeRgn(theRgn);
|
||||
SetMovieDisplayClipRgn(theMovie, &whoCares);
|
||||
tvOn = thisObject.data.g.state;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -135,7 +135,6 @@ void AddRectToWorkRectsWhole (Rect *theRect)
|
||||
|
||||
void DrawReflection (gliderPtr thisGlider, Boolean oneOrTwo)
|
||||
{
|
||||
RgnHandle wasClip;
|
||||
Rect src, dest;
|
||||
short which;
|
||||
|
||||
@@ -150,10 +149,6 @@ void DrawReflection (gliderPtr thisGlider, Boolean oneOrTwo)
|
||||
dest = thisGlider->dest;
|
||||
QOffsetRect(&dest, playOriginH - 20, playOriginV - 16);
|
||||
|
||||
wasClip = NewRgn();
|
||||
if (wasClip == nil)
|
||||
return;
|
||||
|
||||
SetPort((GrafPtr)workSrcMap);
|
||||
|
||||
long numMirrorRects = GetHandleSize(reinterpret_cast<Handle>(mirrorRects)) / sizeof(Rect);
|
||||
@@ -184,8 +179,6 @@ void DrawReflection (gliderPtr thisGlider, Boolean oneOrTwo)
|
||||
}
|
||||
}
|
||||
|
||||
DisposeRgn(wasClip);
|
||||
|
||||
src =thisGlider->whole;
|
||||
QOffsetRect(&src, playOriginH - 20, playOriginV - 16);
|
||||
AddRectToWorkRects(&src);
|
||||
|
||||
@@ -76,7 +76,6 @@ void WipeScreenOn (short direction, Rect *theRect)
|
||||
{
|
||||
#define kWipeRectThick 4
|
||||
Rect wipeRect;
|
||||
RgnHandle dummyRgn;
|
||||
short hOffset, vOffset;
|
||||
short i, count;
|
||||
|
||||
@@ -112,14 +111,11 @@ void WipeScreenOn (short direction, Rect *theRect)
|
||||
break;
|
||||
}
|
||||
|
||||
dummyRgn = NewRgn();
|
||||
GetPortVisibleRegion(GetWindowPort(mainWindow), dummyRgn);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
CopyBitsConstrained((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
||||
&wipeRect, &wipeRect, srcCopy, &(*dummyRgn)->rect);
|
||||
&wipeRect, &wipeRect, srcCopy);
|
||||
|
||||
QOffsetRect(&wipeRect, hOffset, vOffset);
|
||||
|
||||
@@ -132,8 +128,6 @@ void WipeScreenOn (short direction, Rect *theRect)
|
||||
else if (wipeRect.bottom > theRect->bottom)
|
||||
wipeRect.bottom = theRect->bottom;
|
||||
}
|
||||
|
||||
DisposeRgn(dummyRgn);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DumpScreenOn
|
||||
|
||||
Reference in New Issue
Block a user