mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 03:59:36 +00:00
Refactoring. Add line drawing.
This commit is contained in:
@@ -42,13 +42,12 @@ extern Boolean quickerTransitions, demoGoing, isUseSecondScreen;
|
|||||||
void DrawBanner (Point *topLeft)
|
void DrawBanner (Point *topLeft)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
Rect wholePage, partPage, mapBounds;
|
Rect wholePage, partPage, mapBounds;
|
||||||
GWorldPtr tempMap;
|
GWorldPtr tempMap;
|
||||||
GWorldPtr tempMask;
|
GWorldPtr tempMask;
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
QSetRect(&wholePage, 0, 0, 330, 220);
|
QSetRect(&wholePage, 0, 0, 330, 220);
|
||||||
mapBounds = thisMac.screen;
|
mapBounds = thisMac.screen;
|
||||||
@@ -58,7 +57,7 @@ void DrawBanner (Point *topLeft)
|
|||||||
topLeft->v = wholePage.top;
|
topLeft->v = wholePage.top;
|
||||||
partPage = wholePage;
|
partPage = wholePage;
|
||||||
partPage.bottom = partPage.top + 190;
|
partPage.bottom = partPage.top + 190;
|
||||||
SetGWorld(workSrcMap, nil);
|
SetGraphicsPort(workSrcMap);
|
||||||
LoadScaledGraphic(kBannerPageTopPICT, &partPage);
|
LoadScaledGraphic(kBannerPageTopPICT, &partPage);
|
||||||
|
|
||||||
partPage = wholePage;
|
partPage = wholePage;
|
||||||
@@ -66,20 +65,19 @@ void DrawBanner (Point *topLeft)
|
|||||||
mapBounds = partPage;
|
mapBounds = partPage;
|
||||||
ZeroRectCorner(&mapBounds);
|
ZeroRectCorner(&mapBounds);
|
||||||
theErr = CreateOffScreenGWorld(&tempMap, &mapBounds, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&tempMap, &mapBounds, kPreferredDepth);
|
||||||
SetGWorld(tempMap, nil);
|
SetGraphicsPort(tempMap);
|
||||||
LoadGraphic(kBannerPageBottomPICT);
|
LoadGraphic(kBannerPageBottomPICT);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&tempMask, &mapBounds, 1);
|
theErr = CreateOffScreenGWorld(&tempMask, &mapBounds, 1);
|
||||||
SetGWorld(tempMask, nil);
|
SetGraphicsPort(tempMask);
|
||||||
LoadGraphic(kBannerPageBottomMask);
|
LoadGraphic(kBannerPageBottomMask);
|
||||||
|
|
||||||
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
||||||
(BitMap *)*GetGWorldPixMap(tempMask),
|
(BitMap *)*GetGWorldPixMap(tempMask),
|
||||||
(BitMap *)*GetGWorldPixMap(workSrcMap),
|
(BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||||
&mapBounds, &mapBounds, &partPage);
|
&mapBounds, &mapBounds, &partPage);
|
||||||
SetPort((GrafPtr)workSrcMap);
|
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
DisposeGWorld(tempMap);
|
DisposeGWorld(tempMap);
|
||||||
DisposeGWorld(tempMask);
|
DisposeGWorld(tempMask);
|
||||||
}
|
}
|
||||||
@@ -116,11 +114,9 @@ void DrawBannerMessage (Point topLeft)
|
|||||||
Str255 bannerStr, subStr;
|
Str255 bannerStr, subStr;
|
||||||
short count;
|
short count;
|
||||||
|
|
||||||
CGrafPtr wasGWorld;
|
CGrafPtr wasGWorld = GetGraphicsPort();
|
||||||
GDHandle wasDevice;
|
|
||||||
GetGWorld(&wasGWorld, &wasDevice);
|
|
||||||
|
|
||||||
SetGWorld(workSrcMap, nullptr);
|
SetGraphicsPort(workSrcMap);
|
||||||
|
|
||||||
PasStringCopy((*thisHouse)->banner, bannerStr);
|
PasStringCopy((*thisHouse)->banner, bannerStr);
|
||||||
|
|
||||||
@@ -163,7 +159,7 @@ void DrawBannerMessage (Point topLeft)
|
|||||||
}
|
}
|
||||||
ForeColor(blackColor);
|
ForeColor(blackColor);
|
||||||
|
|
||||||
SetGWorld(wasGWorld, wasDevice);
|
SetGraphicsPort(wasGWorld);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- BringUpBanner
|
//-------------------------------------------------------------- BringUpBanner
|
||||||
|
|||||||
@@ -289,7 +289,6 @@ void CheckOurEnvirons (void)
|
|||||||
thisMac.hasQT = DoWeHaveQuickTime();
|
thisMac.hasQT = DoWeHaveQuickTime();
|
||||||
thisMac.hasDrag = DoWeHaveDragManager();
|
thisMac.hasDrag = DoWeHaveDragManager();
|
||||||
|
|
||||||
FindOurDevice();
|
|
||||||
thisMac.can1Bit = true;
|
thisMac.can1Bit = true;
|
||||||
thisMac.can4Bit = true;
|
thisMac.can4Bit = true;
|
||||||
thisMac.can8Bit = true;
|
thisMac.can8Bit = true;
|
||||||
|
|||||||
@@ -253,23 +253,22 @@ void InitDiedGameOver (void)
|
|||||||
#define kPageBackUp 128
|
#define kPageBackUp 128
|
||||||
short i;
|
short i;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
QSetRect(&pageSrcRect, 0, 0, 25, 32 * 8);
|
QSetRect(&pageSrcRect, 0, 0, 25, 32 * 8);
|
||||||
theErr = CreateOffScreenGWorld(&gameOverSrcMap, &pageSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&gameOverSrcMap, &pageSrcRect, kPreferredDepth);
|
||||||
SetGWorld(gameOverSrcMap, nil);
|
SetGraphicsPort(gameOverSrcMap);
|
||||||
LoadGraphic(kLettersPictID);
|
LoadGraphic(kLettersPictID);
|
||||||
|
|
||||||
QSetRect(&pageSrcRect, 0, 0, 32, 32 * kPageFrames);
|
QSetRect(&pageSrcRect, 0, 0, 32, 32 * kPageFrames);
|
||||||
theErr = CreateOffScreenGWorld(&pageSrcMap, &pageSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&pageSrcMap, &pageSrcRect, kPreferredDepth);
|
||||||
SetGWorld(pageSrcMap, nil);
|
SetGraphicsPort(pageSrcMap);
|
||||||
LoadGraphic(kPagesPictID);
|
LoadGraphic(kPagesPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&pageMaskMap, &pageSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&pageMaskMap, &pageSrcRect, 1);
|
||||||
SetGWorld(pageMaskMap, nil);
|
SetGraphicsPort(pageMaskMap);
|
||||||
LoadGraphic(kPagesMaskID);
|
LoadGraphic(kPagesMaskID);
|
||||||
|
|
||||||
for (i = 0; i < kPageFrames; i++) // initialize src page rects
|
for (i = 0; i < kPageFrames; i++) // initialize src page rects
|
||||||
|
|||||||
@@ -103,19 +103,16 @@ void HandleGrease (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort = GetGraphicsPort();
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
SetGWorld(backSrcMap, nil);
|
|
||||||
PaintRect(&src);
|
PaintRect(&src);
|
||||||
|
|
||||||
SetGWorld(workSrcMap, nil);
|
SetGraphicsPort(workSrcMap);
|
||||||
PaintRect(&src);
|
PaintRect(&src);
|
||||||
AddRectToWorkRects(&src);
|
AddRectToWorkRects(&src);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (grease[i].isRight)
|
if (grease[i].isRight)
|
||||||
@@ -270,7 +267,6 @@ void SpillGrease (short who, short index)
|
|||||||
void RedrawAllGrease (void)
|
void RedrawAllGrease (void)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
Rect src;
|
Rect src;
|
||||||
short i;
|
short i;
|
||||||
|
|
||||||
@@ -286,16 +282,16 @@ void RedrawAllGrease (void)
|
|||||||
{
|
{
|
||||||
QOffsetRect(&src, playOriginH, playOriginV);
|
QOffsetRect(&src, playOriginH, playOriginV);
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
PaintRect(&src);
|
PaintRect(&src);
|
||||||
|
|
||||||
SetGWorld(workSrcMap, nil);
|
SetGraphicsPort(workSrcMap);
|
||||||
PaintRect(&src);
|
PaintRect(&src);
|
||||||
AddRectToWorkRects(&src);
|
AddRectToWorkRects(&src);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ void DrawHighScores (void)
|
|||||||
{
|
{
|
||||||
GWorldPtr tempMap, tempMask;
|
GWorldPtr tempMap, tempMask;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
houseType *thisHousePtr;
|
houseType *thisHousePtr;
|
||||||
Rect tempRect, tempRect2;
|
Rect tempRect, tempRect2;
|
||||||
@@ -107,15 +106,15 @@ void DrawHighScores (void)
|
|||||||
scoreLeft = ((thisMac.screen.right - thisMac.screen.left) - kScoreWide) / 2;
|
scoreLeft = ((thisMac.screen.right - thisMac.screen.left) - kScoreWide) / 2;
|
||||||
dropIt = 129 + splashOriginV;
|
dropIt = 129 + splashOriginV;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
QSetRect(&tempRect, 0, 0, 332, 30);
|
QSetRect(&tempRect, 0, 0, 332, 30);
|
||||||
theErr = CreateOffScreenGWorld(&tempMap, &tempRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&tempMap, &tempRect, kPreferredDepth);
|
||||||
SetGWorld(tempMap, nil);
|
SetGraphicsPort(tempMap);
|
||||||
LoadGraphic(kHighScoresPictID);
|
LoadGraphic(kHighScoresPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&tempMask, &tempRect, 1);
|
theErr = CreateOffScreenGWorld(&tempMask, &tempRect, 1);
|
||||||
SetGWorld(tempMask, nil);
|
SetGraphicsPort(tempMask);
|
||||||
LoadGraphic(kHighScoresMaskID);
|
LoadGraphic(kHighScoresMaskID);
|
||||||
|
|
||||||
tempRect2 = tempRect;
|
tempRect2 = tempRect;
|
||||||
@@ -129,7 +128,7 @@ void DrawHighScores (void)
|
|||||||
DisposeGWorld(tempMap);
|
DisposeGWorld(tempMap);
|
||||||
DisposeGWorld(tempMask);
|
DisposeGWorld(tempMask);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
TextFont(applFont);
|
TextFont(applFont);
|
||||||
TextFace(bold);
|
TextFace(bold);
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ short splashOriginH, splashOriginV;
|
|||||||
short theMode;
|
short theMode;
|
||||||
Boolean fadeGraysOut, isDoColorFade, splashDrawn;
|
Boolean fadeGraysOut, isDoColorFade, splashDrawn;
|
||||||
|
|
||||||
extern GDHandle thisGDevice;
|
|
||||||
extern short toolSelected;
|
extern short toolSelected;
|
||||||
extern Boolean noRoomAtAll, isUseSecondScreen;
|
extern Boolean noRoomAtAll, isUseSecondScreen;
|
||||||
extern Boolean quickerTransitions, houseIsReadOnly;
|
extern Boolean quickerTransitions, houseIsReadOnly;
|
||||||
|
|||||||
@@ -724,19 +724,18 @@ Boolean QueryNewRoom (void)
|
|||||||
void CreateNailOffscreen (void)
|
void CreateNailOffscreen (void)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
if (nailSrcMap == nil)
|
if (nailSrcMap == nil)
|
||||||
{
|
{
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
QSetRect(&nailSrcRect, 0, 0, kMapRoomWidth, kMapRoomHeight * (kNumBackgrounds + 1));
|
QSetRect(&nailSrcRect, 0, 0, kMapRoomWidth, kMapRoomHeight * (kNumBackgrounds + 1));
|
||||||
theErr = CreateOffScreenGWorld(&nailSrcMap, &nailSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&nailSrcMap, &nailSrcRect, kPreferredDepth);
|
||||||
SetGWorld(nailSrcMap, nil);
|
SetGraphicsPort(nailSrcMap);
|
||||||
LoadGraphic(kThumbnailPictID);
|
LoadGraphic(kThumbnailPictID);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ void DoMarquee (void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
SetPortWindowPort(mainWindow);
|
SetPortWindowPort(mainWindow);
|
||||||
PenMode(patXor);
|
PenInvertMode(true);
|
||||||
PenPat(&theMarquee.pats[theMarquee.index]);
|
PenPat(&theMarquee.pats[theMarquee.index]);
|
||||||
DrawMarquee();
|
DrawMarquee();
|
||||||
theMarquee.index++;
|
theMarquee.index++;
|
||||||
@@ -64,7 +64,7 @@ void StartMarquee (Rect *theRect)
|
|||||||
theMarquee.active = true;
|
theMarquee.active = true;
|
||||||
theMarquee.paused = false;
|
theMarquee.paused = false;
|
||||||
theMarquee.handled = false;
|
theMarquee.handled = false;
|
||||||
PenMode(patXor);
|
PenInvertMode(true);
|
||||||
PenPat(&theMarquee.pats[theMarquee.index]);
|
PenPat(&theMarquee.pats[theMarquee.index]);
|
||||||
DrawMarquee();
|
DrawMarquee();
|
||||||
PenNormal();
|
PenNormal();
|
||||||
@@ -127,7 +127,7 @@ void StartMarqueeHandled (Rect *theRect, short direction, short dist)
|
|||||||
theMarquee.direction = direction;
|
theMarquee.direction = direction;
|
||||||
theMarquee.dist = dist;
|
theMarquee.dist = dist;
|
||||||
|
|
||||||
PenMode(patXor);
|
PenInvertMode(true);
|
||||||
PenPat(&theMarquee.pats[theMarquee.index]);
|
PenPat(&theMarquee.pats[theMarquee.index]);
|
||||||
DrawMarquee();
|
DrawMarquee();
|
||||||
PenNormal();
|
PenNormal();
|
||||||
@@ -148,7 +148,7 @@ void StopMarquee (void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
SetPortWindowPort(mainWindow);
|
SetPortWindowPort(mainWindow);
|
||||||
PenMode(patXor);
|
PenInvertMode(true);
|
||||||
PenPat(&theMarquee.pats[theMarquee.index]);
|
PenPat(&theMarquee.pats[theMarquee.index]);
|
||||||
DrawMarquee();
|
DrawMarquee();
|
||||||
PenNormal();
|
PenNormal();
|
||||||
@@ -192,7 +192,7 @@ void DragOutMarqueeRect (Point start, Rect *theRect)
|
|||||||
SetPortWindowPort(mainWindow);
|
SetPortWindowPort(mainWindow);
|
||||||
InitCursor();
|
InitCursor();
|
||||||
QSetRect(theRect, start.h, start.v, start.h, start.v);
|
QSetRect(theRect, start.h, start.v, start.h, start.v);
|
||||||
PenMode(patXor);
|
PenInvertMode(true);
|
||||||
PenPat(&theMarquee.pats[theMarquee.index]);
|
PenPat(&theMarquee.pats[theMarquee.index]);
|
||||||
FrameRect(theRect);
|
FrameRect(theRect);
|
||||||
wasPt = start;
|
wasPt = start;
|
||||||
@@ -222,7 +222,7 @@ void DragMarqueeRect (Point start, Rect *theRect, Boolean lockH, Boolean lockV)
|
|||||||
|
|
||||||
SetCursor(&handCursor);
|
SetCursor(&handCursor);
|
||||||
StopMarquee();
|
StopMarquee();
|
||||||
PenMode(patXor);
|
PenInvertMode(true);
|
||||||
PenPat(&theMarquee.pats[theMarquee.index]);
|
PenPat(&theMarquee.pats[theMarquee.index]);
|
||||||
theMarquee.bounds = *theRect;
|
theMarquee.bounds = *theRect;
|
||||||
FrameRect(&theMarquee.bounds);
|
FrameRect(&theMarquee.bounds);
|
||||||
@@ -266,7 +266,7 @@ void DragMarqueeHandle (Point start, short *dragged)
|
|||||||
else
|
else
|
||||||
SetCursor(&horiCursor);
|
SetCursor(&horiCursor);
|
||||||
StopMarquee();
|
StopMarquee();
|
||||||
PenMode(patXor);
|
PenInvertMode(true);
|
||||||
PenPat(&theMarquee.pats[theMarquee.index]);
|
PenPat(&theMarquee.pats[theMarquee.index]);
|
||||||
FrameRect(&theMarquee.bounds);
|
FrameRect(&theMarquee.bounds);
|
||||||
PaintRect(&theMarquee.handle);
|
PaintRect(&theMarquee.handle);
|
||||||
@@ -349,7 +349,7 @@ void DragMarqueeCorner (Point start, short *hDragged, short *vDragged, Boolean i
|
|||||||
|
|
||||||
SetCursor(&diagCursor);
|
SetCursor(&diagCursor);
|
||||||
StopMarquee();
|
StopMarquee();
|
||||||
PenMode(patXor);
|
PenInvertMode(true);
|
||||||
PenPat(&theMarquee.pats[theMarquee.index]);
|
PenPat(&theMarquee.pats[theMarquee.index]);
|
||||||
FrameRect(&theMarquee.bounds);
|
FrameRect(&theMarquee.bounds);
|
||||||
PaintRect(&theMarquee.handle);
|
PaintRect(&theMarquee.handle);
|
||||||
|
|||||||
@@ -74,10 +74,9 @@ void DrawTiki (Rect *theRect, short down)
|
|||||||
#define kTikiPoleBase 300
|
#define kTikiPoleBase 300
|
||||||
long darkGrayC, lightWoodC, darkWoodC;
|
long darkGrayC, lightWoodC, darkWoodC;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
{
|
{
|
||||||
@@ -106,7 +105,7 @@ void DrawTiki (Rect *theRect, short down)
|
|||||||
theRect->left + 15, kTikiPoleBase + down - 1, darkGrayC);
|
theRect->left + 15, kTikiPoleBase + down - 1, darkGrayC);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
CopyMask((BitMap *)*GetGWorldPixMap(blowerSrcMap),
|
CopyMask((BitMap *)*GetGWorldPixMap(blowerSrcMap),
|
||||||
(BitMap *)*GetGWorldPixMap(blowerMaskMap),
|
(BitMap *)*GetGWorldPixMap(blowerMaskMap),
|
||||||
@@ -120,16 +119,15 @@ void DrawInvisibleBlower (Rect *theRect)
|
|||||||
{
|
{
|
||||||
Rect tempRect;
|
Rect tempRect;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
QSetRect(&tempRect, 0, 0, 24, 24);
|
QSetRect(&tempRect, 0, 0, 24, 24);
|
||||||
QOffsetRect(&tempRect, theRect->left, theRect->top);
|
QOffsetRect(&tempRect, theRect->left, theRect->top);
|
||||||
|
|
||||||
ColorFrameRect(&tempRect, 192);
|
ColorFrameRect(&tempRect, 192);
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawLiftArea
|
//-------------------------------------------------------------- DrawLiftArea
|
||||||
@@ -137,12 +135,11 @@ void DrawInvisibleBlower (Rect *theRect)
|
|||||||
void DrawLiftArea (Rect *theRect)
|
void DrawLiftArea (Rect *theRect)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
ColorFrameRect(theRect, 192);
|
ColorFrameRect(theRect, 192);
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawTable
|
//-------------------------------------------------------------- DrawTable
|
||||||
@@ -156,7 +153,6 @@ void DrawTable (Rect *tableTop, short down)
|
|||||||
long brownC, tanC, dkRedC, blackC;
|
long brownC, tanC, dkRedC, blackC;
|
||||||
short hCenter, vShadow;
|
short hCenter, vShadow;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
Pattern dummyPattern;
|
Pattern dummyPattern;
|
||||||
|
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
@@ -174,8 +170,8 @@ void DrawTable (Rect *tableTop, short down)
|
|||||||
blackC = k8BlackColor;
|
blackC = k8BlackColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
QSetRect(&tempRect, tableTop->left, 0, tableTop->right,
|
QSetRect(&tempRect, tableTop->left, 0, tableTop->right,
|
||||||
RectWide(tableTop) / 10);
|
RectWide(tableTop) / 10);
|
||||||
@@ -183,7 +179,7 @@ void DrawTable (Rect *tableTop, short down)
|
|||||||
-HalfRectTall(&tempRect) + kTableShadowTop + down);
|
-HalfRectTall(&tempRect) + kTableShadowTop + down);
|
||||||
QOffsetRect(&tempRect, kTableShadowOffset, -kTableShadowOffset);
|
QOffsetRect(&tempRect, kTableShadowOffset, -kTableShadowOffset);
|
||||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||||
PenMode(patOr);
|
PenMask(true);
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
ColorOval(&tempRect, 15);
|
ColorOval(&tempRect, 15);
|
||||||
else
|
else
|
||||||
@@ -250,7 +246,7 @@ void DrawTable (Rect *tableTop, short down)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
tempRect = tableSrc;
|
tempRect = tableSrc;
|
||||||
QOffsetRect(&tempRect, -HalfRectWide(&tableSrc) + tableTop->left +
|
QOffsetRect(&tempRect, -HalfRectWide(&tableSrc) + tableTop->left +
|
||||||
@@ -273,7 +269,6 @@ void DrawShelf (Rect *shelfTop)
|
|||||||
long brownC, ltTanC, tanC, dkRedC, blackC;
|
long brownC, ltTanC, tanC, dkRedC, blackC;
|
||||||
RgnHandle shadowRgn;
|
RgnHandle shadowRgn;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
Pattern dummyPattern;
|
Pattern dummyPattern;
|
||||||
|
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
@@ -293,8 +288,8 @@ void DrawShelf (Rect *shelfTop)
|
|||||||
blackC = k8BlackColor;
|
blackC = k8BlackColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
shadowRgn = NewRgn();
|
shadowRgn = NewRgn();
|
||||||
if (shadowRgn == nil)
|
if (shadowRgn == nil)
|
||||||
@@ -312,7 +307,7 @@ void DrawShelf (Rect *shelfTop)
|
|||||||
OpenRgn();
|
OpenRgn();
|
||||||
CloseRgn(shadowRgn);
|
CloseRgn(shadowRgn);
|
||||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||||
PenMode(patOr);
|
PenMask(true);
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
ColorRegion(shadowRgn, 15);
|
ColorRegion(shadowRgn, 15);
|
||||||
else
|
else
|
||||||
@@ -343,7 +338,7 @@ void DrawShelf (Rect *shelfTop)
|
|||||||
ColorLine(shelfTop->right - 1, shelfTop->top + 1,
|
ColorLine(shelfTop->right - 1, shelfTop->top + 1,
|
||||||
shelfTop->right - 1, shelfTop->bottom - 2, blackC);
|
shelfTop->right - 1, shelfTop->bottom - 2, blackC);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
tempRect = shelfSrc;
|
tempRect = shelfSrc;
|
||||||
ZeroRectCorner(&tempRect);
|
ZeroRectCorner(&tempRect);
|
||||||
@@ -372,7 +367,6 @@ void DrawCabinet (Rect *cabinet)
|
|||||||
long brownC, dkGrayC, ltTanC, tanC, dkRedC, blackC;
|
long brownC, dkGrayC, ltTanC, tanC, dkRedC, blackC;
|
||||||
RgnHandle shadowRgn;
|
RgnHandle shadowRgn;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
Pattern dummyPattern;
|
Pattern dummyPattern;
|
||||||
|
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
@@ -394,8 +388,8 @@ void DrawCabinet (Rect *cabinet)
|
|||||||
blackC = k8BlackColor;
|
blackC = k8BlackColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
MoveTo(cabinet->left, cabinet->bottom);
|
MoveTo(cabinet->left, cabinet->bottom);
|
||||||
shadowRgn = NewRgn();
|
shadowRgn = NewRgn();
|
||||||
@@ -409,7 +403,7 @@ void DrawCabinet (Rect *cabinet)
|
|||||||
LineTo(cabinet->left, cabinet->bottom);
|
LineTo(cabinet->left, cabinet->bottom);
|
||||||
CloseRgn(shadowRgn);
|
CloseRgn(shadowRgn);
|
||||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||||
PenMode(patOr);
|
PenMask(true);
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
ColorRegion(shadowRgn, 15);
|
ColorRegion(shadowRgn, 15);
|
||||||
else
|
else
|
||||||
@@ -462,7 +456,7 @@ void DrawCabinet (Rect *cabinet)
|
|||||||
ColorLine(cabinet->left + kCabinetDeep + 10, cabinet->bottom - 10,
|
ColorLine(cabinet->left + kCabinetDeep + 10, cabinet->bottom - 10,
|
||||||
cabinet->right - 11, cabinet->bottom - 10, tanC);
|
cabinet->right - 11, cabinet->bottom - 10, tanC);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
tempRect = hingeSrc;
|
tempRect = hingeSrc;
|
||||||
ZeroRectCorner(&tempRect);
|
ZeroRectCorner(&tempRect);
|
||||||
@@ -515,7 +509,6 @@ void DrawCounter (Rect *counter)
|
|||||||
long brownC, dkGrayC, tanC, blackC, dkstRedC;
|
long brownC, dkGrayC, tanC, blackC, dkstRedC;
|
||||||
short nRects, width, i;
|
short nRects, width, i;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
Pattern dummyPattern;
|
Pattern dummyPattern;
|
||||||
|
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
@@ -535,8 +528,8 @@ void DrawCounter (Rect *counter)
|
|||||||
dkstRedC = k8DkRed2Color;
|
dkstRedC = k8DkRed2Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
MoveTo(counter->right - 2, counter->bottom);
|
MoveTo(counter->right - 2, counter->bottom);
|
||||||
shadowRgn = NewRgn();
|
shadowRgn = NewRgn();
|
||||||
@@ -551,7 +544,7 @@ void DrawCounter (Rect *counter)
|
|||||||
LineTo(counter->right - 2, counter->bottom);
|
LineTo(counter->right - 2, counter->bottom);
|
||||||
CloseRgn(shadowRgn);
|
CloseRgn(shadowRgn);
|
||||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||||
PenMode(patOr);
|
PenMask(true);
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
ColorRegion(shadowRgn, 15);
|
ColorRegion(shadowRgn, 15);
|
||||||
else
|
else
|
||||||
@@ -628,7 +621,7 @@ void DrawCounter (Rect *counter)
|
|||||||
ColorLine(counter->left + 1, counter->top + 8,
|
ColorLine(counter->left + 1, counter->top + 8,
|
||||||
counter->right - 2, counter->top + 8, dkstRedC);
|
counter->right - 2, counter->top + 8, dkstRedC);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
nRects = RectWide(counter) / 40;
|
nRects = RectWide(counter) / 40;
|
||||||
if (nRects == 0)
|
if (nRects == 0)
|
||||||
@@ -660,7 +653,6 @@ void DrawDresser (Rect *dresser)
|
|||||||
RgnHandle shadowRgn;
|
RgnHandle shadowRgn;
|
||||||
short nRects, height, i;
|
short nRects, height, i;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
Pattern dummyPattern;
|
Pattern dummyPattern;
|
||||||
|
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
@@ -680,8 +672,8 @@ void DrawDresser (Rect *dresser)
|
|||||||
dkstRedC = k8DkRed2Color;
|
dkstRedC = k8DkRed2Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
MoveTo(dresser->left + 10, dresser->bottom + 9);
|
MoveTo(dresser->left + 10, dresser->bottom + 9);
|
||||||
shadowRgn = NewRgn();
|
shadowRgn = NewRgn();
|
||||||
@@ -696,7 +688,7 @@ void DrawDresser (Rect *dresser)
|
|||||||
LineTo(dresser->left + 10, dresser->bottom + 9);
|
LineTo(dresser->left + 10, dresser->bottom + 9);
|
||||||
CloseRgn(shadowRgn);
|
CloseRgn(shadowRgn);
|
||||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||||
PenMode(patOr);
|
PenMask(true);
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
ColorRegion(shadowRgn, 15);
|
ColorRegion(shadowRgn, 15);
|
||||||
else
|
else
|
||||||
@@ -756,7 +748,7 @@ void DrawDresser (Rect *dresser)
|
|||||||
QOffsetRect(&tempRect, 0, kDresserTopThick + height);
|
QOffsetRect(&tempRect, 0, kDresserTopThick + height);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
dest = leftFootSrc;
|
dest = leftFootSrc;
|
||||||
ZeroRectCorner(&dest);
|
ZeroRectCorner(&dest);
|
||||||
@@ -789,7 +781,6 @@ void DrawDeckTable (Rect *tableTop, short down)
|
|||||||
long bambooC, brownC, dkGrayC;
|
long bambooC, brownC, dkGrayC;
|
||||||
short hCenter, vShadow;
|
short hCenter, vShadow;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
Pattern dummyPattern;
|
Pattern dummyPattern;
|
||||||
|
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
@@ -805,8 +796,8 @@ void DrawDeckTable (Rect *tableTop, short down)
|
|||||||
dkGrayC = k8DkstGrayColor;
|
dkGrayC = k8DkstGrayColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
QSetRect(&tempRect, tableTop->left, 0, tableTop->right,
|
QSetRect(&tempRect, tableTop->left, 0, tableTop->right,
|
||||||
RectWide(tableTop) / 10);
|
RectWide(tableTop) / 10);
|
||||||
@@ -814,7 +805,7 @@ void DrawDeckTable (Rect *tableTop, short down)
|
|||||||
-HalfRectTall(&tempRect) + kTableShadowTop + down);
|
-HalfRectTall(&tempRect) + kTableShadowTop + down);
|
||||||
QOffsetRect(&tempRect, kTableShadowOffset, -kTableShadowOffset);
|
QOffsetRect(&tempRect, kTableShadowOffset, -kTableShadowOffset);
|
||||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||||
PenMode(patOr);
|
PenMask(true);
|
||||||
ColorOval(&tempRect, dkGrayC);
|
ColorOval(&tempRect, dkGrayC);
|
||||||
PenNormal();
|
PenNormal();
|
||||||
|
|
||||||
@@ -878,7 +869,7 @@ void DrawDeckTable (Rect *tableTop, short down)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
tempRect = deckSrc;
|
tempRect = deckSrc;
|
||||||
ZeroRectCorner(&tempRect);
|
ZeroRectCorner(&tempRect);
|
||||||
@@ -897,10 +888,9 @@ void DrawStool (Rect *theRect, short down)
|
|||||||
#define kStoolBase 304
|
#define kStoolBase 304
|
||||||
long grayC, dkGrayC;
|
long grayC, dkGrayC;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
{
|
{
|
||||||
@@ -929,7 +919,7 @@ void DrawStool (Rect *theRect, short down)
|
|||||||
theRect->left + 26, kStoolBase + down - 1, dkGrayC);
|
theRect->left + 26, kStoolBase + down - 1, dkGrayC);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
CopyMask((BitMap *)*GetGWorldPixMap(furnitureSrcMap),
|
CopyMask((BitMap *)*GetGWorldPixMap(furnitureSrcMap),
|
||||||
(BitMap *)*GetGWorldPixMap(furnitureMaskMap),
|
(BitMap *)*GetGWorldPixMap(furnitureMaskMap),
|
||||||
@@ -942,12 +932,11 @@ void DrawStool (Rect *theRect, short down)
|
|||||||
void DrawInvisObstacle (Rect *theRect)
|
void DrawInvisObstacle (Rect *theRect)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
ColorFrameRect(theRect, k8BrownColor);
|
ColorFrameRect(theRect, k8BrownColor);
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawInvisBounce
|
//-------------------------------------------------------------- DrawInvisBounce
|
||||||
@@ -955,12 +944,11 @@ void DrawInvisObstacle (Rect *theRect)
|
|||||||
void DrawInvisBounce (Rect *theRect)
|
void DrawInvisBounce (Rect *theRect)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
ColorFrameRect(theRect, k8RedColor);
|
ColorFrameRect(theRect, k8RedColor);
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawRedClock
|
//-------------------------------------------------------------- DrawRedClock
|
||||||
@@ -1071,10 +1059,9 @@ void DrawCuckoo (Rect *theRect)
|
|||||||
void DrawClockHands (Point where, short bigHand, short littleHand)
|
void DrawClockHands (Point where, short bigHand, short littleHand)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
MoveTo(where.h, where.v);
|
MoveTo(where.h, where.v);
|
||||||
switch (bigHand)
|
switch (bigHand)
|
||||||
{
|
{
|
||||||
@@ -1179,7 +1166,7 @@ void DrawClockHands (Point where, short bigHand, short littleHand)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawClockHands
|
//-------------------------------------------------------------- DrawClockHands
|
||||||
@@ -1187,10 +1174,9 @@ void DrawClockHands (Point where, short bigHand, short littleHand)
|
|||||||
void DrawLargeClockHands (Point where, short bigHand, short littleHand)
|
void DrawLargeClockHands (Point where, short bigHand, short littleHand)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
ForeColor(whiteColor);
|
ForeColor(whiteColor);
|
||||||
|
|
||||||
MoveTo(where.h, where.v);
|
MoveTo(where.h, where.v);
|
||||||
@@ -1298,7 +1284,7 @@ void DrawLargeClockHands (Point where, short bigHand, short littleHand)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ForeColor(blackColor);
|
ForeColor(blackColor);
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawSimplePrizes
|
//-------------------------------------------------------------- DrawSimplePrizes
|
||||||
@@ -1317,7 +1303,6 @@ void DrawGreaseRt (Rect *theRect, short distance, Boolean state)
|
|||||||
{
|
{
|
||||||
Rect spill, dest;
|
Rect spill, dest;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
dest = *theRect;
|
dest = *theRect;
|
||||||
if (state) // grease upright
|
if (state) // grease upright
|
||||||
@@ -1335,12 +1320,12 @@ void DrawGreaseRt (Rect *theRect, short distance, Boolean state)
|
|||||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||||
&greaseSrcRt[3], &greaseSrcRt[3], &dest);
|
&greaseSrcRt[3], &greaseSrcRt[3], &dest);
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
QSetRect(&spill, 0, -2, distance - 5, 0);
|
QSetRect(&spill, 0, -2, distance - 5, 0);
|
||||||
QOffsetRect(&spill, dest.right - 1, dest.bottom);
|
QOffsetRect(&spill, dest.right - 1, dest.bottom);
|
||||||
PaintRect(&spill);
|
PaintRect(&spill);
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1350,7 +1335,6 @@ void DrawGreaseLf (Rect *theRect, short distance, Boolean state)
|
|||||||
{
|
{
|
||||||
Rect spill, dest;
|
Rect spill, dest;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
dest = *theRect;
|
dest = *theRect;
|
||||||
if (state) // grease upright
|
if (state) // grease upright
|
||||||
@@ -1368,12 +1352,12 @@ void DrawGreaseLf (Rect *theRect, short distance, Boolean state)
|
|||||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||||
&greaseSrcLf[3], &greaseSrcLf[3], &dest);
|
&greaseSrcLf[3], &greaseSrcLf[3], &dest);
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
QSetRect(&spill, -distance + 5, -2, 0, 0);
|
QSetRect(&spill, -distance + 5, -2, 0, 0);
|
||||||
QOffsetRect(&spill, dest.left + 1, dest.bottom);
|
QOffsetRect(&spill, dest.left + 1, dest.bottom);
|
||||||
PaintRect(&spill);
|
PaintRect(&spill);
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1392,12 +1376,11 @@ void DrawFoil (Rect *theRect)
|
|||||||
void DrawInvisBonus (Rect *theRect)
|
void DrawInvisBonus (Rect *theRect)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
wasCPort = GetGraphicsPort();
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
SetGraphicsPort(backSrcMap);
|
||||||
SetGWorld(backSrcMap, nil);
|
|
||||||
ColorFrameOval(theRect, 227);
|
ColorFrameOval(theRect, 227);
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawSlider
|
//-------------------------------------------------------------- DrawSlider
|
||||||
@@ -1405,11 +1388,10 @@ void DrawInvisBonus (Rect *theRect)
|
|||||||
void DrawSlider (Rect *theRect)
|
void DrawSlider (Rect *theRect)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
wasCPort = GetGraphicsPort();
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
SetGraphicsPort(backSrcMap);
|
||||||
SetGWorld(backSrcMap, nil);
|
|
||||||
FrameRect(theRect);
|
FrameRect(theRect);
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -117,11 +117,10 @@ void DrawMailboxLeft (Rect *theRect, short down)
|
|||||||
GWorldPtr tempMask;
|
GWorldPtr tempMask;
|
||||||
long darkGrayC, lightWoodC, darkWoodC;
|
long darkGrayC, lightWoodC, darkWoodC;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
{
|
{
|
||||||
@@ -168,15 +167,15 @@ void DrawMailboxLeft (Rect *theRect, short down)
|
|||||||
theRect->left + 62, down + kMailboxBase + 3, darkGrayC);
|
theRect->left + 62, down + kMailboxBase + 3, darkGrayC);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
bounds = srcRects[kMailboxLf];
|
bounds = srcRects[kMailboxLf];
|
||||||
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredDepth);
|
||||||
SetGWorld(tempMap, nil);
|
SetGraphicsPort(tempMap);
|
||||||
LoadGraphic(kMailboxLeftPictID);
|
LoadGraphic(kMailboxLeftPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&tempMask, &bounds, 1);
|
theErr = CreateOffScreenGWorld(&tempMask, &bounds, 1);
|
||||||
SetGWorld(tempMask, nil);
|
SetGraphicsPort(tempMask);
|
||||||
LoadGraphic(kMailboxLeftMaskID);
|
LoadGraphic(kMailboxLeftMaskID);
|
||||||
|
|
||||||
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
||||||
@@ -184,7 +183,7 @@ void DrawMailboxLeft (Rect *theRect, short down)
|
|||||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||||
&srcRects[kMailboxLf], &srcRects[kMailboxLf], theRect);
|
&srcRects[kMailboxLf], &srcRects[kMailboxLf], theRect);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
DisposeGWorld(tempMap);
|
DisposeGWorld(tempMap);
|
||||||
DisposeGWorld(tempMask);
|
DisposeGWorld(tempMask);
|
||||||
@@ -200,11 +199,10 @@ void DrawMailboxRight (Rect *theRect, short down)
|
|||||||
GWorldPtr tempMask;
|
GWorldPtr tempMask;
|
||||||
long darkGrayC, lightWoodC, darkWoodC;
|
long darkGrayC, lightWoodC, darkWoodC;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
{
|
{
|
||||||
@@ -251,15 +249,15 @@ void DrawMailboxRight (Rect *theRect, short down)
|
|||||||
theRect->left + 47, down + kMailboxBase + 3, darkGrayC);
|
theRect->left + 47, down + kMailboxBase + 3, darkGrayC);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
bounds = srcRects[kMailboxRt];
|
bounds = srcRects[kMailboxRt];
|
||||||
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredDepth);
|
||||||
SetGWorld(tempMap, nil);
|
SetGraphicsPort(tempMap);
|
||||||
LoadGraphic(kMailboxRightPictID);
|
LoadGraphic(kMailboxRightPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&tempMask, &bounds, 1);
|
theErr = CreateOffScreenGWorld(&tempMask, &bounds, 1);
|
||||||
SetGWorld(tempMask, nil);
|
SetGraphicsPort(tempMask);
|
||||||
LoadGraphic(kMailboxRightMaskID);
|
LoadGraphic(kMailboxRightMaskID);
|
||||||
|
|
||||||
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
||||||
@@ -267,7 +265,7 @@ void DrawMailboxRight (Rect *theRect, short down)
|
|||||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||||
&srcRects[kMailboxRt], &srcRects[kMailboxRt], theRect);
|
&srcRects[kMailboxRt], &srcRects[kMailboxRt], theRect);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
DisposeGWorld(tempMap);
|
DisposeGWorld(tempMap);
|
||||||
DisposeGWorld(tempMask);
|
DisposeGWorld(tempMask);
|
||||||
@@ -289,12 +287,11 @@ void DrawSimpleTransport (short what, Rect *theRect)
|
|||||||
void DrawInvisTransport (Rect *theRect)
|
void DrawInvisTransport (Rect *theRect)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
wasCPort = GetGraphicsPort();
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
SetGraphicsPort(backSrcMap);
|
||||||
SetGWorld(backSrcMap, nil);
|
|
||||||
ColorFrameRect(theRect, 32);
|
ColorFrameRect(theRect, 32);
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawLightSwitch
|
//-------------------------------------------------------------- DrawLightSwitch
|
||||||
@@ -376,12 +373,11 @@ void DrawKnifeSwitch (Rect *theRect, Boolean state)
|
|||||||
void DrawInvisibleSwitch (Rect *theRect)
|
void DrawInvisibleSwitch (Rect *theRect)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
wasCPort = GetGraphicsPort();
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
SetGraphicsPort(backSrcMap);
|
||||||
SetGWorld(backSrcMap, nil);
|
|
||||||
ColorFrameRect(theRect, kIntenseGreenColor);
|
ColorFrameRect(theRect, kIntenseGreenColor);
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawTrigger
|
//-------------------------------------------------------------- DrawTrigger
|
||||||
@@ -389,12 +385,11 @@ void DrawInvisibleSwitch (Rect *theRect)
|
|||||||
void DrawTrigger (Rect *theRect)
|
void DrawTrigger (Rect *theRect)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
ColorFrameRect(theRect, kIntenseBlueColor);
|
ColorFrameRect(theRect, kIntenseBlueColor);
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawSoundTrigger
|
//-------------------------------------------------------------- DrawSoundTrigger
|
||||||
@@ -402,12 +397,11 @@ void DrawTrigger (Rect *theRect)
|
|||||||
void DrawSoundTrigger (Rect *theRect)
|
void DrawSoundTrigger (Rect *theRect)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
ColorFrameRect(theRect, kIntenseYellowColor);
|
ColorFrameRect(theRect, kIntenseYellowColor);
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawSimpleLight
|
//-------------------------------------------------------------- DrawSimpleLight
|
||||||
@@ -427,7 +421,6 @@ void DrawFlourescent (Rect *theRect)
|
|||||||
Rect partRect;
|
Rect partRect;
|
||||||
long grayC, gray2C, gray3C, gray4C, violetC;
|
long grayC, gray2C, gray3C, gray4C, violetC;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
{
|
{
|
||||||
@@ -446,8 +439,8 @@ void DrawFlourescent (Rect *theRect)
|
|||||||
violetC = kPaleVioletColor;
|
violetC = kPaleVioletColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
ColorLine(theRect->left + 16, theRect->top,
|
ColorLine(theRect->left + 16, theRect->top,
|
||||||
theRect->right - 17, theRect->top, grayC);
|
theRect->right - 17, theRect->top, grayC);
|
||||||
@@ -474,7 +467,7 @@ void DrawFlourescent (Rect *theRect)
|
|||||||
ColorLine(theRect->left + 16, theRect->top + 11,
|
ColorLine(theRect->left + 16, theRect->top + 11,
|
||||||
theRect->right - 17, theRect->top + 11, violetC);
|
theRect->right - 17, theRect->top + 11, violetC);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
partRect = flourescentSrc1;
|
partRect = flourescentSrc1;
|
||||||
ZeroRectCorner(&partRect);
|
ZeroRectCorner(&partRect);
|
||||||
@@ -505,7 +498,6 @@ void DrawTrackLight (Rect *theRect)
|
|||||||
long grayC, gray2C, gray3C, gray4C;
|
long grayC, gray2C, gray3C, gray4C;
|
||||||
short which, howMany, i, spread;
|
short which, howMany, i, spread;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
{
|
{
|
||||||
@@ -522,8 +514,8 @@ void DrawTrackLight (Rect *theRect)
|
|||||||
gray4C = k8DkGrayColor;
|
gray4C = k8DkGrayColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
ColorLine(theRect->left, theRect->top - 3,
|
ColorLine(theRect->left, theRect->top - 3,
|
||||||
theRect->right - 1, theRect->top - 3, gray2C);
|
theRect->right - 1, theRect->top - 3, gray2C);
|
||||||
@@ -538,7 +530,7 @@ void DrawTrackLight (Rect *theRect)
|
|||||||
ColorLine(theRect->left, theRect->top + 2,
|
ColorLine(theRect->left, theRect->top + 2,
|
||||||
theRect->right - 1, theRect->top + 2, gray3C);
|
theRect->right - 1, theRect->top + 2, gray3C);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
partRect = trackLightSrc[0]; // left most track light
|
partRect = trackLightSrc[0]; // left most track light
|
||||||
ZeroRectCorner(&partRect);
|
ZeroRectCorner(&partRect);
|
||||||
@@ -587,12 +579,11 @@ void DrawTrackLight (Rect *theRect)
|
|||||||
void DrawInvisLight (Rect *theRect)
|
void DrawInvisLight (Rect *theRect)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
ColorFrameOval(theRect, 17);
|
ColorFrameOval(theRect, 17);
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawSimpleAppliance
|
//-------------------------------------------------------------- DrawSimpleAppliance
|
||||||
@@ -644,20 +635,19 @@ void DrawTV (Rect *theRect, Boolean isOn, Boolean isLit)
|
|||||||
GWorldPtr tempMap;
|
GWorldPtr tempMap;
|
||||||
GWorldPtr tempMask;
|
GWorldPtr tempMask;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
if (isLit)
|
if (isLit)
|
||||||
{
|
{
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
bounds = srcRects[kTV];
|
bounds = srcRects[kTV];
|
||||||
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredDepth);
|
||||||
SetGWorld(tempMap, nil);
|
SetGraphicsPort(tempMap);
|
||||||
LoadGraphic(kTVPictID);
|
LoadGraphic(kTVPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&tempMask, &bounds, 1);
|
theErr = CreateOffScreenGWorld(&tempMask, &bounds, 1);
|
||||||
SetGWorld(tempMask, nil);
|
SetGraphicsPort(tempMask);
|
||||||
LoadGraphic(kTVMaskID);
|
LoadGraphic(kTVMaskID);
|
||||||
|
|
||||||
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
||||||
@@ -665,7 +655,7 @@ void DrawTV (Rect *theRect, Boolean isOn, Boolean isLit)
|
|||||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||||
&srcRects[kTV], &srcRects[kTV], theRect);
|
&srcRects[kTV], &srcRects[kTV], theRect);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
DisposeGWorld(tempMap);
|
DisposeGWorld(tempMap);
|
||||||
DisposeGWorld(tempMask);
|
DisposeGWorld(tempMask);
|
||||||
@@ -738,20 +728,19 @@ void DrawVCR (Rect *theRect, Boolean isOn, Boolean isLit)
|
|||||||
GWorldPtr tempMap;
|
GWorldPtr tempMap;
|
||||||
GWorldPtr tempMask;
|
GWorldPtr tempMask;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
if (isLit)
|
if (isLit)
|
||||||
{
|
{
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
bounds = srcRects[kVCR];
|
bounds = srcRects[kVCR];
|
||||||
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredDepth);
|
||||||
SetGWorld(tempMap, nil);
|
SetGraphicsPort(tempMap);
|
||||||
LoadGraphic(kVCRPictID);
|
LoadGraphic(kVCRPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&tempMask, &bounds, 1);
|
theErr = CreateOffScreenGWorld(&tempMask, &bounds, 1);
|
||||||
SetGWorld(tempMask, nil);
|
SetGraphicsPort(tempMask);
|
||||||
LoadGraphic(kVCRMaskID);
|
LoadGraphic(kVCRMaskID);
|
||||||
|
|
||||||
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
||||||
@@ -759,7 +748,7 @@ void DrawVCR (Rect *theRect, Boolean isOn, Boolean isLit)
|
|||||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||||
&srcRects[kVCR], &srcRects[kVCR], theRect);
|
&srcRects[kVCR], &srcRects[kVCR], theRect);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
DisposeGWorld(tempMap);
|
DisposeGWorld(tempMap);
|
||||||
DisposeGWorld(tempMask);
|
DisposeGWorld(tempMask);
|
||||||
@@ -792,21 +781,20 @@ void DrawStereo (Rect *theRect, Boolean isOn, Boolean isLit)
|
|||||||
GWorldPtr tempMap;
|
GWorldPtr tempMap;
|
||||||
GWorldPtr tempMask;
|
GWorldPtr tempMask;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
|
|
||||||
if (isLit)
|
if (isLit)
|
||||||
{
|
{
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
bounds = srcRects[kStereo];
|
bounds = srcRects[kStereo];
|
||||||
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredDepth);
|
||||||
SetGWorld(tempMap, nil);
|
SetGraphicsPort(tempMap);
|
||||||
LoadGraphic(kStereoPictID);
|
LoadGraphic(kStereoPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&tempMask, &bounds, 1);
|
theErr = CreateOffScreenGWorld(&tempMask, &bounds, 1);
|
||||||
SetGWorld(tempMask, nil);
|
SetGraphicsPort(tempMask);
|
||||||
LoadGraphic(kStereoMaskID);
|
LoadGraphic(kStereoMaskID);
|
||||||
|
|
||||||
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
||||||
@@ -814,7 +802,7 @@ void DrawStereo (Rect *theRect, Boolean isOn, Boolean isLit)
|
|||||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||||
&srcRects[kStereo], &srcRects[kStereo], theRect);
|
&srcRects[kStereo], &srcRects[kStereo], theRect);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
DisposeGWorld(tempMap);
|
DisposeGWorld(tempMap);
|
||||||
DisposeGWorld(tempMask);
|
DisposeGWorld(tempMask);
|
||||||
@@ -847,21 +835,20 @@ void DrawMicrowave (Rect *theRect, Boolean isOn, Boolean isLit)
|
|||||||
GWorldPtr tempMap;
|
GWorldPtr tempMap;
|
||||||
GWorldPtr tempMask;
|
GWorldPtr tempMask;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
|
|
||||||
if (isLit)
|
if (isLit)
|
||||||
{
|
{
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
bounds = srcRects[kMicrowave];
|
bounds = srcRects[kMicrowave];
|
||||||
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredDepth);
|
||||||
SetGWorld(tempMap, nil);
|
SetGraphicsPort(tempMap);
|
||||||
LoadGraphic(kMicrowavePictID);
|
LoadGraphic(kMicrowavePictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&tempMask, &bounds, 1);
|
theErr = CreateOffScreenGWorld(&tempMask, &bounds, 1);
|
||||||
SetGWorld(tempMask, nil);
|
SetGraphicsPort(tempMask);
|
||||||
LoadGraphic(kMicrowaveMaskID);
|
LoadGraphic(kMicrowaveMaskID);
|
||||||
|
|
||||||
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
||||||
@@ -869,7 +856,7 @@ void DrawMicrowave (Rect *theRect, Boolean isOn, Boolean isLit)
|
|||||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||||
&srcRects[kMicrowave], &srcRects[kMicrowave], theRect);
|
&srcRects[kMicrowave], &srcRects[kMicrowave], theRect);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
DisposeGWorld(tempMap);
|
DisposeGWorld(tempMap);
|
||||||
DisposeGWorld(tempMask);
|
DisposeGWorld(tempMask);
|
||||||
@@ -987,7 +974,6 @@ void DrawMirror (Rect *mirror)
|
|||||||
Rect tempRect;
|
Rect tempRect;
|
||||||
long grayC;
|
long grayC;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
{
|
{
|
||||||
@@ -998,8 +984,8 @@ void DrawMirror (Rect *mirror)
|
|||||||
grayC = k8DkGray2Color;
|
grayC = k8DkGray2Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
tempRect = *mirror;
|
tempRect = *mirror;
|
||||||
ColorRect(&tempRect, k8WhiteColor);
|
ColorRect(&tempRect, k8WhiteColor);
|
||||||
@@ -1011,7 +997,7 @@ void DrawMirror (Rect *mirror)
|
|||||||
InsetRect(&tempRect, 1, 1);
|
InsetRect(&tempRect, 1, 1);
|
||||||
ColorFrameRect(&tempRect, grayC);
|
ColorFrameRect(&tempRect, grayC);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawSimpleClutter
|
//-------------------------------------------------------------- DrawSimpleClutter
|
||||||
@@ -1043,7 +1029,6 @@ void DrawWallWindow (Rect *window)
|
|||||||
long brownC, tanC, dkstRedC;
|
long brownC, tanC, dkstRedC;
|
||||||
short halfWay;
|
short halfWay;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
if (thisMac.isDepth == 4)
|
if (thisMac.isDepth == 4)
|
||||||
{
|
{
|
||||||
@@ -1058,8 +1043,8 @@ void DrawWallWindow (Rect *window)
|
|||||||
dkstRedC = k8DkRed2Color;
|
dkstRedC = k8DkRed2Color;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
tempRect = *window;
|
tempRect = *window;
|
||||||
InsetRect(&tempRect, 3, 0);
|
InsetRect(&tempRect, 3, 0);
|
||||||
@@ -1125,7 +1110,7 @@ void DrawWallWindow (Rect *window)
|
|||||||
ColorLine(tempRect2.left - 5, tempRect2.top - 7,
|
ColorLine(tempRect2.left - 5, tempRect2.top - 7,
|
||||||
tempRect2.right + 5, tempRect2.top - 7, tanC);
|
tempRect2.right + 5, tempRect2.top - 7, tanC);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawCalendar
|
//-------------------------------------------------------------- DrawCalendar
|
||||||
@@ -1137,10 +1122,9 @@ void DrawCalendar (Rect *theRect)
|
|||||||
PicHandle thePicture;
|
PicHandle thePicture;
|
||||||
Str255 monthStr;
|
Str255 monthStr;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
thePicture = GetPicture(kCalendarPictID);
|
thePicture = GetPicture(kCalendarPictID);
|
||||||
if (thePicture == nil)
|
if (thePicture == nil)
|
||||||
@@ -1161,7 +1145,7 @@ void DrawCalendar (Rect *theRect)
|
|||||||
MoveTo(theRect->left + ((64 - StringWidth(monthStr)) / 2), theRect->top + 55);
|
MoveTo(theRect->left + ((64 - StringWidth(monthStr)) / 2), theRect->top + 55);
|
||||||
ColorText(monthStr, kDarkFleshColor);
|
ColorText(monthStr, kDarkFleshColor);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawBulletin
|
//-------------------------------------------------------------- DrawBulletin
|
||||||
@@ -1171,10 +1155,9 @@ void DrawBulletin (Rect *theRect)
|
|||||||
Rect bounds;
|
Rect bounds;
|
||||||
PicHandle thePicture;
|
PicHandle thePicture;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
thePicture = GetPicture(kBulletinPictID);
|
thePicture = GetPicture(kBulletinPictID);
|
||||||
if (thePicture == nil)
|
if (thePicture == nil)
|
||||||
@@ -1186,7 +1169,7 @@ void DrawBulletin (Rect *theRect)
|
|||||||
DrawPicture(thePicture, &bounds);
|
DrawPicture(thePicture, &bounds);
|
||||||
ReleaseResource((Handle)thePicture);
|
ReleaseResource((Handle)thePicture);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawPictObject
|
//-------------------------------------------------------------- DrawPictObject
|
||||||
@@ -1197,7 +1180,6 @@ void DrawPictObject (short what, Rect *theRect)
|
|||||||
PicHandle thePicture;
|
PicHandle thePicture;
|
||||||
short pictID;
|
short pictID;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
switch (what)
|
switch (what)
|
||||||
{
|
{
|
||||||
@@ -1230,8 +1212,8 @@ void DrawPictObject (short what, Rect *theRect)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
thePicture = GetPicture(pictID);
|
thePicture = GetPicture(pictID);
|
||||||
if (thePicture == nil)
|
if (thePicture == nil)
|
||||||
@@ -1242,7 +1224,7 @@ void DrawPictObject (short what, Rect *theRect)
|
|||||||
DrawPicture(thePicture, &bounds);
|
DrawPicture(thePicture, &bounds);
|
||||||
ReleaseResource((Handle)thePicture);
|
ReleaseResource((Handle)thePicture);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- DrawPictWithMaskObject
|
//-------------------------------------------------------------- DrawPictWithMaskObject
|
||||||
@@ -1254,10 +1236,9 @@ void DrawPictWithMaskObject (short what, Rect *theRect)
|
|||||||
GWorldPtr tempMask;
|
GWorldPtr tempMask;
|
||||||
short pictID, maskID;
|
short pictID, maskID;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
switch (what)
|
switch (what)
|
||||||
{
|
{
|
||||||
@@ -1274,11 +1255,11 @@ void DrawPictWithMaskObject (short what, Rect *theRect)
|
|||||||
|
|
||||||
bounds = srcRects[what];
|
bounds = srcRects[what];
|
||||||
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredDepth);
|
||||||
SetGWorld(tempMap, nil);
|
SetGraphicsPort(tempMap);
|
||||||
LoadGraphic(pictID);
|
LoadGraphic(pictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&tempMask, &bounds, 1);
|
theErr = CreateOffScreenGWorld(&tempMask, &bounds, 1);
|
||||||
SetGWorld(tempMask, nil);
|
SetGraphicsPort(tempMask);
|
||||||
LoadGraphic(maskID);
|
LoadGraphic(maskID);
|
||||||
|
|
||||||
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
||||||
@@ -1286,7 +1267,7 @@ void DrawPictWithMaskObject (short what, Rect *theRect)
|
|||||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||||
&srcRects[what], &srcRects[what], theRect);
|
&srcRects[what], &srcRects[what], theRect);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
DisposeGWorld(tempMap);
|
DisposeGWorld(tempMap);
|
||||||
DisposeGWorld(tempMask);
|
DisposeGWorld(tempMask);
|
||||||
@@ -1302,10 +1283,9 @@ void DrawPictSansWhiteObject (short what, Rect *theRect)
|
|||||||
CGrafPtr tempMap;
|
CGrafPtr tempMap;
|
||||||
short pictID;
|
short pictID;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
switch (what)
|
switch (what)
|
||||||
{
|
{
|
||||||
@@ -1392,14 +1372,14 @@ void DrawPictSansWhiteObject (short what, Rect *theRect)
|
|||||||
|
|
||||||
bounds = srcRects[what];
|
bounds = srcRects[what];
|
||||||
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredDepth);
|
||||||
SetGWorld(tempMap, nil);
|
SetGraphicsPort(tempMap);
|
||||||
LoadGraphic(pictID);
|
LoadGraphic(pictID);
|
||||||
|
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(tempMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(tempMap),
|
||||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||||
&srcRects[what], theRect, transparent, nil);
|
&srcRects[what], theRect, transparent, nil);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
DisposeGWorld(tempMap);
|
DisposeGWorld(tempMap);
|
||||||
// SetPort((GrafPtr)backSrcMap);
|
// SetPort((GrafPtr)backSrcMap);
|
||||||
@@ -1411,22 +1391,21 @@ void DrawCustPictSansWhite (short pictID, Rect *theRect)
|
|||||||
Rect bounds;
|
Rect bounds;
|
||||||
GWorldPtr tempMap;
|
GWorldPtr tempMap;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
bounds = *theRect;
|
bounds = *theRect;
|
||||||
ZeroRectCorner(&bounds);
|
ZeroRectCorner(&bounds);
|
||||||
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredDepth);
|
||||||
SetGWorld(tempMap, nil);
|
SetGraphicsPort(tempMap);
|
||||||
LoadGraphic(pictID);
|
LoadGraphic(pictID);
|
||||||
|
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(tempMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(tempMap),
|
||||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||||
&bounds, theRect, transparent, nil);
|
&bounds, theRect, transparent, nil);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
DisposeGWorld(tempMap);
|
DisposeGWorld(tempMap);
|
||||||
// SetPort((GrafPtr)backSrcMap);
|
// SetPort((GrafPtr)backSrcMap);
|
||||||
|
|||||||
@@ -2303,11 +2303,10 @@ void DrawThisRoomsObjects (void)
|
|||||||
Rect tempRect;
|
Rect tempRect;
|
||||||
short i;
|
short i;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
Pattern dummyPattern;
|
Pattern dummyPattern;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
if ((noRoomAtAll) || (!houseUnlocked))
|
if ((noRoomAtAll) || (!houseUnlocked))
|
||||||
return;
|
return;
|
||||||
@@ -2315,7 +2314,7 @@ void DrawThisRoomsObjects (void)
|
|||||||
{
|
{
|
||||||
if (GetNumberOfLights(thisRoomNumber) <= 0)
|
if (GetNumberOfLights(thisRoomNumber) <= 0)
|
||||||
{
|
{
|
||||||
PenMode(srcOr);
|
PenMask(true);
|
||||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||||
PaintRect(&backSrcRect);
|
PaintRect(&backSrcRect);
|
||||||
PenNormal();
|
PenNormal();
|
||||||
@@ -2657,8 +2656,6 @@ void DrawThisRoomsObjects (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
|
||||||
|
|
||||||
if (isFirstRoom)
|
if (isFirstRoom)
|
||||||
{
|
{
|
||||||
CopyMask((BitMap *)*GetGWorldPixMap(glidSrcMap),
|
CopyMask((BitMap *)*GetGWorldPixMap(glidSrcMap),
|
||||||
@@ -2698,7 +2695,7 @@ void HiliteAllObjects (void)
|
|||||||
PauseMarquee();
|
PauseMarquee();
|
||||||
SetPort((GrafPtr)mainWindow);
|
SetPort((GrafPtr)mainWindow);
|
||||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||||
PenMode(patXor);
|
PenInvertMode(true);
|
||||||
|
|
||||||
for (i = 0; i < kMaxRoomObs; i++)
|
for (i = 0; i < kMaxRoomObs; i++)
|
||||||
FrameRect(&roomObjectRects[i]);
|
FrameRect(&roomObjectRects[i]);
|
||||||
|
|||||||
@@ -254,20 +254,17 @@ void NewGame (short mode)
|
|||||||
|
|
||||||
if (!gameOver)
|
if (!gameOver)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort = GetGraphicsPort();
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
|
||||||
|
|
||||||
InvalWindowRect(mainWindow, &mainWindowRect);
|
InvalWindowRect(mainWindow, &mainWindowRect);
|
||||||
|
|
||||||
SetGWorld(workSrcMap, nil);
|
SetGraphicsPort(workSrcMap);
|
||||||
PaintRect(&workSrcRect);
|
PaintRect(&workSrcRect);
|
||||||
QSetRect(&tempRect, 0, 0, 640, 460);
|
QSetRect(&tempRect, 0, 0, 640, 460);
|
||||||
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
|
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
|
||||||
LoadScaledGraphic(kSplash8BitPICT, &tempRect);
|
LoadScaledGraphic(kSplash8BitPICT, &tempRect);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
WaitCommandQReleased();
|
WaitCommandQReleased();
|
||||||
demoGoing = false;
|
demoGoing = false;
|
||||||
@@ -498,10 +495,7 @@ void PlayGame (void)
|
|||||||
countDown--;
|
countDown--;
|
||||||
if (countDown <= 0)
|
if (countDown <= 0)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort = GetGraphicsPort();
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
|
||||||
|
|
||||||
HideGlider(&theGlider);
|
HideGlider(&theGlider);
|
||||||
RefreshScoreboard(kNormalTitleMode);
|
RefreshScoreboard(kNormalTitleMode);
|
||||||
@@ -509,7 +503,7 @@ void PlayGame (void)
|
|||||||
#if BUILD_ARCADE_VERSION
|
#if BUILD_ARCADE_VERSION
|
||||||
// Need to paint over the scoreboard black.
|
// Need to paint over the scoreboard black.
|
||||||
|
|
||||||
SetGWorld(boardSrcMap, nil);
|
SetGraphicsPort(boardSrcMap);
|
||||||
PaintRect(&boardSrcRect);
|
PaintRect(&boardSrcRect);
|
||||||
|
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(boardSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(boardSrcMap),
|
||||||
@@ -543,26 +537,23 @@ void PlayGame (void)
|
|||||||
else
|
else
|
||||||
DoGameOver();
|
DoGameOver();
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILD_ARCADE_VERSION
|
#if BUILD_ARCADE_VERSION
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort = GetGraphicsPort();
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
SetGraphicsPort(boardSrcMap);
|
||||||
|
|
||||||
SetGWorld(boardSrcMap, nil);
|
|
||||||
PaintRect(&boardSrcRect);
|
PaintRect(&boardSrcRect);
|
||||||
|
|
||||||
CopyBits((BitMap *)*GetGWorldPixMap(boardSrcMap),
|
CopyBits((BitMap *)*GetGWorldPixMap(boardSrcMap),
|
||||||
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
||||||
&boardSrcRect, &boardDestRect, srcCopy, 0L);
|
&boardSrcRect, &boardDestRect, srcCopy, 0L);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ void DrawLocale (void)
|
|||||||
short i, roomV;
|
short i, roomV;
|
||||||
char wasState;
|
char wasState;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
ZeroFlamesAndTheLike();
|
ZeroFlamesAndTheLike();
|
||||||
ZeroDinahs();
|
ZeroDinahs();
|
||||||
@@ -67,8 +66,8 @@ void DrawLocale (void)
|
|||||||
}
|
}
|
||||||
ListAllLocalObjects();
|
ListAllLocalObjects();
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
PaintRect(&backSrcRect);
|
PaintRect(&backSrcRect);
|
||||||
|
|
||||||
if (numNeighbors > 3)
|
if (numNeighbors > 3)
|
||||||
@@ -115,14 +114,14 @@ void DrawLocale (void)
|
|||||||
DrawRoomBackground(localNumbers[kCentralRoom], kCentralRoom, roomV);
|
DrawRoomBackground(localNumbers[kCentralRoom], kCentralRoom, roomV);
|
||||||
DrawARoomsObjects(kCentralRoom, false);
|
DrawARoomsObjects(kCentralRoom, false);
|
||||||
DrawLighting();
|
DrawLighting();
|
||||||
|
|
||||||
if (numNeighbors > 3)
|
if (numNeighbors > 3)
|
||||||
DrawFloorSupport();
|
DrawFloorSupport();
|
||||||
RestoreWorkMap();
|
RestoreWorkMap();
|
||||||
shadowVisible = IsShadowVisible();
|
shadowVisible = IsShadowVisible();
|
||||||
takingTheStairs = false;
|
takingTheStairs = false;
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- LoadGraphicSpecial
|
//-------------------------------------------------------------- LoadGraphicSpecial
|
||||||
@@ -170,14 +169,13 @@ void DrawRoomBackground (short who, short where, short elevation)
|
|||||||
if ((numLights == 0) && (who != kRoomIsEmpty))
|
if ((numLights == 0) && (who != kRoomIsEmpty))
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
PaintRect(&localRoomsDest[where]);
|
PaintRect(&localRoomsDest[where]);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,14 +184,13 @@ void DrawRoomBackground (short who, short where, short elevation)
|
|||||||
if (wardBitSet)
|
if (wardBitSet)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
SetGWorld(backSrcMap, nil);
|
SetGraphicsPort(backSrcMap);
|
||||||
|
|
||||||
PaintRect(&localRoomsDest[where]);
|
PaintRect(&localRoomsDest[where]);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,10 +244,9 @@ void DrawFloorSupport (void)
|
|||||||
Rect src, dest, whoCares;
|
Rect src, dest, whoCares;
|
||||||
short i;
|
short i;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
|
wasCPort = GetGraphicsPort();
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
SetGraphicsPort(backSrcMap);
|
||||||
SetGWorld(backSrcMap, nil);
|
|
||||||
src = suppSrcRect;
|
src = suppSrcRect;
|
||||||
|
|
||||||
if (isStructure[kNorthWestRoom])
|
if (isStructure[kNorthWestRoom])
|
||||||
@@ -360,7 +356,7 @@ void DrawFloorSupport (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- ReadyBackMap
|
//-------------------------------------------------------------- ReadyBackMap
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ void DragMiniTile (Point mouseIs, short *newTileOver)
|
|||||||
QOffsetRect(&dragRect,
|
QOffsetRect(&dragRect,
|
||||||
tileSrc.left + (tileOver * kMiniTileWide),
|
tileSrc.left + (tileOver * kMiniTileWide),
|
||||||
tileSrc.top);
|
tileSrc.top);
|
||||||
PenMode(patXor);
|
PenInvertMode(true);
|
||||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||||
FrameRect(&dragRect);
|
FrameRect(&dragRect);
|
||||||
mouseWas = mouseIs;
|
mouseWas = mouseIs;
|
||||||
@@ -170,7 +170,7 @@ void DragMiniTile (Point mouseIs, short *newTileOver)
|
|||||||
}
|
}
|
||||||
ForeColor(blackColor);
|
ForeColor(blackColor);
|
||||||
PenNormal();
|
PenNormal();
|
||||||
PenMode(patXor);
|
PenInvertMode(true);
|
||||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||||
wasTileOver = *newTileOver;
|
wasTileOver = *newTileOver;
|
||||||
}
|
}
|
||||||
@@ -191,7 +191,7 @@ void DragMiniTile (Point mouseIs, short *newTileOver)
|
|||||||
Line(kMiniTileWide, 0);
|
Line(kMiniTileWide, 0);
|
||||||
ForeColor(blackColor);
|
ForeColor(blackColor);
|
||||||
PenNormal();
|
PenNormal();
|
||||||
PenMode(patXor);
|
PenInvertMode(true);
|
||||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||||
wasTileOver = -1;
|
wasTileOver = -1;
|
||||||
}
|
}
|
||||||
@@ -211,7 +211,7 @@ void DragMiniTile (Point mouseIs, short *newTileOver)
|
|||||||
Line(kMiniTileWide, 0);
|
Line(kMiniTileWide, 0);
|
||||||
ForeColor(blackColor);
|
ForeColor(blackColor);
|
||||||
PenNormal();
|
PenNormal();
|
||||||
PenMode(patXor);
|
PenInvertMode(true);
|
||||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||||
wasTileOver = -1;
|
wasTileOver = -1;
|
||||||
}
|
}
|
||||||
@@ -386,10 +386,9 @@ void DoRoomInfo (void)
|
|||||||
Boolean leaving, wasFirstRoom, forceDraw;
|
Boolean leaving, wasFirstRoom, forceDraw;
|
||||||
ModalFilterUPP roomFilterUPP;
|
ModalFilterUPP roomFilterUPP;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
roomFilterUPP = NewModalFilterUPP(RoomFilter);
|
roomFilterUPP = NewModalFilterUPP(RoomFilter);
|
||||||
|
|
||||||
tileOver = -1;
|
tileOver = -1;
|
||||||
@@ -406,7 +405,7 @@ void DoRoomInfo (void)
|
|||||||
ParamText(floorStr, suiteStr, objectsStr, PSTR(""));
|
ParamText(floorStr, suiteStr, objectsStr, PSTR(""));
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&tileSrcMap, &tileSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&tileSrcMap, &tileSrcRect, kPreferredDepth);
|
||||||
SetGWorld(tileSrcMap, nil);
|
SetGraphicsPort(tileSrcMap);
|
||||||
// CreateOffScreenPixMap(&tileSrcRect, &tileSrcMap);
|
// CreateOffScreenPixMap(&tileSrcRect, &tileSrcMap);
|
||||||
// SetPort((GrafPtr)tileSrcMap);
|
// SetPort((GrafPtr)tileSrcMap);
|
||||||
if ((tempBack > kStars) && (!PictIDExists(tempBack)))
|
if ((tempBack > kStars) && (!PictIDExists(tempBack)))
|
||||||
@@ -420,7 +419,7 @@ void DoRoomInfo (void)
|
|||||||
else
|
else
|
||||||
LoadScaledGraphic(tempBack, &tileSrcRect);
|
LoadScaledGraphic(tempBack, &tileSrcRect);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
|
|
||||||
for (i = 0; i < kNumTiles; i++)
|
for (i = 0; i < kNumTiles; i++)
|
||||||
tempTiles[i] = thisRoom->tiles[i];
|
tempTiles[i] = thisRoom->tiles[i];
|
||||||
|
|||||||
@@ -61,18 +61,17 @@ void InitScoreboardMap (void)
|
|||||||
Rect bounds;
|
Rect bounds;
|
||||||
PicHandle thePicture;
|
PicHandle thePicture;
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
short hOffset;
|
short hOffset;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
wasScoreboardMode = kScoreboardHigh;
|
wasScoreboardMode = kScoreboardHigh;
|
||||||
boardSrcRect = houseRect;
|
boardSrcRect = houseRect;
|
||||||
ZeroRectCorner(&boardSrcRect);
|
ZeroRectCorner(&boardSrcRect);
|
||||||
boardSrcRect.bottom = kScoreboardTall;
|
boardSrcRect.bottom = kScoreboardTall;
|
||||||
theErr = CreateOffScreenGWorld(&boardSrcMap, &boardSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&boardSrcMap, &boardSrcRect, kPreferredDepth);
|
||||||
SetGWorld(boardSrcMap, nil);
|
SetGraphicsPort(boardSrcMap);
|
||||||
|
|
||||||
if (boardSrcRect.right >= 640)
|
if (boardSrcRect.right >= 640)
|
||||||
hOffset = (RectWide(&boardSrcRect) - kMaxViewWidth) / 2;
|
hOffset = (RectWide(&boardSrcRect) - kMaxViewWidth) / 2;
|
||||||
@@ -89,7 +88,7 @@ void InitScoreboardMap (void)
|
|||||||
|
|
||||||
QSetRect(&badgeSrcRect, 0, 0, 32, 66); // 2144 pixels
|
QSetRect(&badgeSrcRect, 0, 0, 32, 66); // 2144 pixels
|
||||||
theErr = CreateOffScreenGWorld(&badgeSrcMap, &badgeSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&badgeSrcMap, &badgeSrcRect, kPreferredDepth);
|
||||||
SetGWorld(badgeSrcMap, nil);
|
SetGraphicsPort(badgeSrcMap);
|
||||||
LoadGraphic(kBadgePictID);
|
LoadGraphic(kBadgePictID);
|
||||||
|
|
||||||
boardDestRect = boardSrcRect;
|
boardDestRect = boardSrcRect;
|
||||||
@@ -100,7 +99,7 @@ void InitScoreboardMap (void)
|
|||||||
|
|
||||||
QSetRect(&boardTSrcRect, 0, 0, 256, 12); // room title
|
QSetRect(&boardTSrcRect, 0, 0, 256, 12); // room title
|
||||||
theErr = CreateOffScreenGWorld(&boardTSrcMap, &boardTSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&boardTSrcMap, &boardTSrcRect, kPreferredDepth);
|
||||||
SetGWorld(boardTSrcMap, nil);
|
SetGraphicsPort(boardTSrcMap);
|
||||||
boardTDestRect = boardTSrcRect;
|
boardTDestRect = boardTSrcRect;
|
||||||
QOffsetRect(&boardTDestRect, 137 + hOffset, 5);
|
QOffsetRect(&boardTDestRect, 137 + hOffset, 5);
|
||||||
TextFont(applFont);
|
TextFont(applFont);
|
||||||
@@ -109,7 +108,7 @@ void InitScoreboardMap (void)
|
|||||||
|
|
||||||
QSetRect(&boardGSrcRect, 0, 0, 20, 10); // # gliders
|
QSetRect(&boardGSrcRect, 0, 0, 20, 10); // # gliders
|
||||||
theErr = CreateOffScreenGWorld(&boardGSrcMap, &boardGSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&boardGSrcMap, &boardGSrcRect, kPreferredDepth);
|
||||||
SetGWorld(boardGSrcMap, nil);
|
SetGraphicsPort(boardGSrcMap);
|
||||||
boardGDestRect = boardGSrcRect;
|
boardGDestRect = boardGSrcRect;
|
||||||
QOffsetRect(&boardGDestRect, 526 + hOffset, 5);
|
QOffsetRect(&boardGDestRect, 526 + hOffset, 5);
|
||||||
TextFont(applFont);
|
TextFont(applFont);
|
||||||
@@ -118,7 +117,7 @@ void InitScoreboardMap (void)
|
|||||||
|
|
||||||
QSetRect(&boardPSrcRect, 0, 0, 64, 10); // points
|
QSetRect(&boardPSrcRect, 0, 0, 64, 10); // points
|
||||||
theErr = CreateOffScreenGWorld(&boardPSrcMap, &boardPSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&boardPSrcMap, &boardPSrcRect, kPreferredDepth);
|
||||||
SetGWorld(boardPSrcMap, nil);
|
SetGraphicsPort(boardPSrcMap);
|
||||||
boardPDestRect = boardPSrcRect;
|
boardPDestRect = boardPSrcRect;
|
||||||
QOffsetRect(&boardPDestRect, 570 + hOffset, 5); // total = 6396 pixels
|
QOffsetRect(&boardPDestRect, 570 + hOffset, 5); // total = 6396 pixels
|
||||||
boardPQDestRect = boardPDestRect;
|
boardPQDestRect = boardPDestRect;
|
||||||
@@ -153,8 +152,8 @@ void InitScoreboardMap (void)
|
|||||||
QOffsetRect(&badgesDestRects[2], 467 + hOffset, 1);
|
QOffsetRect(&badgesDestRects[2], 467 + hOffset, 1);
|
||||||
QSetRect(&badgesDestRects[3], 0, 0, 16, 17); // helium
|
QSetRect(&badgesDestRects[3], 0, 0, 16, 17); // helium
|
||||||
QOffsetRect(&badgesDestRects[3], 467 + hOffset, 1);
|
QOffsetRect(&badgesDestRects[3], 467 + hOffset, 1);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- InitGliderMap
|
//-------------------------------------------------------------- InitGliderMap
|
||||||
@@ -164,23 +163,22 @@ void InitScoreboardMap (void)
|
|||||||
void InitGliderMap (void)
|
void InitGliderMap (void)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
short i;
|
short i;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
QSetRect(&glidSrcRect, 0, 0, kGliderWide, 668); // 32112 pixels
|
QSetRect(&glidSrcRect, 0, 0, kGliderWide, 668); // 32112 pixels
|
||||||
theErr = CreateOffScreenGWorld(&glidSrcMap, &glidSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&glidSrcMap, &glidSrcRect, kPreferredDepth);
|
||||||
SetGWorld(glidSrcMap, nil);
|
SetGraphicsPort(glidSrcMap);
|
||||||
LoadGraphic(kGliderPictID);
|
LoadGraphic(kGliderPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&glid2SrcMap, &glidSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&glid2SrcMap, &glidSrcRect, kPreferredDepth);
|
||||||
SetGWorld(glid2SrcMap, nil);
|
SetGraphicsPort(glid2SrcMap);
|
||||||
LoadGraphic(kGlider2PictID);
|
LoadGraphic(kGlider2PictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&glidMaskMap, &glidSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&glidMaskMap, &glidSrcRect, 1);
|
||||||
SetGWorld(glidMaskMap, nil);
|
SetGraphicsPort(glidMaskMap);
|
||||||
LoadGraphic(kGliderPictID + 1000);
|
LoadGraphic(kGliderPictID + 1000);
|
||||||
|
|
||||||
for (i = 0; i <= 20; i++)
|
for (i = 0; i <= 20; i++)
|
||||||
@@ -201,11 +199,11 @@ void InitGliderMap (void)
|
|||||||
|
|
||||||
QSetRect(&shadowSrcRect, 0, 0, kGliderWide, kShadowHigh * kNumShadowSrcRects);
|
QSetRect(&shadowSrcRect, 0, 0, kGliderWide, kShadowHigh * kNumShadowSrcRects);
|
||||||
theErr = CreateOffScreenGWorld(&shadowSrcMap, &shadowSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&shadowSrcMap, &shadowSrcRect, kPreferredDepth);
|
||||||
SetGWorld(shadowSrcMap, nil);
|
SetGraphicsPort(shadowSrcMap);
|
||||||
LoadGraphic(kShadowPictID);
|
LoadGraphic(kShadowPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&shadowMaskMap, &shadowSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&shadowMaskMap, &shadowSrcRect, 1);
|
||||||
SetGWorld(shadowMaskMap, nil);
|
SetGraphicsPort(shadowMaskMap);
|
||||||
LoadGraphic(kShadowPictID + 1000);
|
LoadGraphic(kShadowPictID + 1000);
|
||||||
|
|
||||||
for (i = 0; i < kNumShadowSrcRects; i++)
|
for (i = 0; i < kNumShadowSrcRects; i++)
|
||||||
@@ -216,11 +214,11 @@ void InitGliderMap (void)
|
|||||||
|
|
||||||
QSetRect(&bandsSrcRect, 0, 0, 16, 18); // 304 pixels
|
QSetRect(&bandsSrcRect, 0, 0, 16, 18); // 304 pixels
|
||||||
theErr = CreateOffScreenGWorld(&bandsSrcMap, &bandsSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&bandsSrcMap, &bandsSrcRect, kPreferredDepth);
|
||||||
SetGWorld(bandsSrcMap, nil);
|
SetGraphicsPort(bandsSrcMap);
|
||||||
LoadGraphic(kRubberBandsPictID);
|
LoadGraphic(kRubberBandsPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&bandsMaskMap, &bandsSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&bandsMaskMap, &bandsSrcRect, 1);
|
||||||
SetGWorld(bandsMaskMap, nil);
|
SetGraphicsPort(bandsMaskMap);
|
||||||
LoadGraphic(kRubberBandsPictID + 1000);
|
LoadGraphic(kRubberBandsPictID + 1000);
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
@@ -229,7 +227,7 @@ void InitGliderMap (void)
|
|||||||
QOffsetRect(&bandRects[i], 0, 6 * i);
|
QOffsetRect(&bandRects[i], 0, 6 * i);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- InitBlowers
|
//-------------------------------------------------------------- InitBlowers
|
||||||
@@ -239,19 +237,18 @@ void InitGliderMap (void)
|
|||||||
void InitBlowers (void)
|
void InitBlowers (void)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
short i;
|
short i;
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
QSetRect(&blowerSrcRect, 0, 0, 48, 402); // 19344 pixels
|
QSetRect(&blowerSrcRect, 0, 0, 48, 402); // 19344 pixels
|
||||||
theErr = CreateOffScreenGWorld(&blowerSrcMap, &blowerSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&blowerSrcMap, &blowerSrcRect, kPreferredDepth);
|
||||||
SetGWorld(blowerSrcMap, nil);
|
SetGraphicsPort(blowerSrcMap);
|
||||||
LoadGraphic(kBlowerPictID);
|
LoadGraphic(kBlowerPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&blowerMaskMap, &blowerSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&blowerMaskMap, &blowerSrcRect, 1);
|
||||||
SetGWorld(blowerMaskMap, nil);
|
SetGraphicsPort(blowerMaskMap);
|
||||||
LoadGraphic(kBlowerPictID + 1000);
|
LoadGraphic(kBlowerPictID + 1000);
|
||||||
|
|
||||||
for (i = 0; i < kNumCandleFlames; i++)
|
for (i = 0; i < kNumCandleFlames; i++)
|
||||||
@@ -278,7 +275,7 @@ void InitBlowers (void)
|
|||||||
QSetRect(&rightStartGliderSrc, 0, 0, 48, 16);
|
QSetRect(&rightStartGliderSrc, 0, 0, 48, 16);
|
||||||
QOffsetRect(&rightStartGliderSrc, 0, 374);
|
QOffsetRect(&rightStartGliderSrc, 0, 374);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- InitFurniture
|
//-------------------------------------------------------------- InitFurniture
|
||||||
@@ -288,18 +285,17 @@ void InitBlowers (void)
|
|||||||
void InitFurniture (void)
|
void InitFurniture (void)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
QSetRect(&furnitureSrcRect, 0, 0, 64, 278); // 17856 pixels
|
QSetRect(&furnitureSrcRect, 0, 0, 64, 278); // 17856 pixels
|
||||||
theErr = CreateOffScreenGWorld(&furnitureSrcMap, &furnitureSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&furnitureSrcMap, &furnitureSrcRect, kPreferredDepth);
|
||||||
SetGWorld(furnitureSrcMap, nil);
|
SetGraphicsPort(furnitureSrcMap);
|
||||||
LoadGraphic(kFurniturePictID);
|
LoadGraphic(kFurniturePictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&furnitureMaskMap, &furnitureSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&furnitureMaskMap, &furnitureSrcRect, 1);
|
||||||
SetGWorld(furnitureMaskMap, nil);
|
SetGraphicsPort(furnitureMaskMap);
|
||||||
LoadGraphic(kFurniturePictID + 1000);
|
LoadGraphic(kFurniturePictID + 1000);
|
||||||
|
|
||||||
QSetRect(&tableSrc, 0, 0, 64, 22);
|
QSetRect(&tableSrc, 0, 0, 64, 22);
|
||||||
@@ -326,7 +322,7 @@ void InitFurniture (void)
|
|||||||
QSetRect(&deckSrc, 0, 0, 64, 21);
|
QSetRect(&deckSrc, 0, 0, 64, 21);
|
||||||
QOffsetRect(&deckSrc, 0, 162);
|
QOffsetRect(&deckSrc, 0, 162);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- InitPrizes
|
//-------------------------------------------------------------- InitPrizes
|
||||||
@@ -336,19 +332,18 @@ void InitFurniture (void)
|
|||||||
void InitPrizes (void)
|
void InitPrizes (void)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
short i;
|
short i;
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
QSetRect(&bonusSrcRect, 0, 0, 88, 378); // 33264 pixels
|
QSetRect(&bonusSrcRect, 0, 0, 88, 378); // 33264 pixels
|
||||||
theErr = CreateOffScreenGWorld(&bonusSrcMap, &bonusSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&bonusSrcMap, &bonusSrcRect, kPreferredDepth);
|
||||||
SetGWorld(bonusSrcMap, nil);
|
SetGraphicsPort(bonusSrcMap);
|
||||||
LoadGraphic(kBonusPictID);
|
LoadGraphic(kBonusPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&bonusMaskMap, &bonusSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&bonusMaskMap, &bonusSrcRect, 1);
|
||||||
SetGWorld(bonusMaskMap, nil);
|
SetGraphicsPort(bonusMaskMap);
|
||||||
LoadGraphic(kBonusPictID + 1000);
|
LoadGraphic(kBonusPictID + 1000);
|
||||||
|
|
||||||
for (i = 0; i < 11; i++)
|
for (i = 0; i < 11; i++)
|
||||||
@@ -397,11 +392,11 @@ void InitPrizes (void)
|
|||||||
|
|
||||||
QSetRect(&pointsSrcRect, 0, 0, 24, 120); // 2880 pixels
|
QSetRect(&pointsSrcRect, 0, 0, 24, 120); // 2880 pixels
|
||||||
theErr = CreateOffScreenGWorld(&pointsSrcMap, &pointsSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&pointsSrcMap, &pointsSrcRect, kPreferredDepth);
|
||||||
SetGWorld(pointsSrcMap, nil);
|
SetGraphicsPort(pointsSrcMap);
|
||||||
LoadGraphic(kPointsPictID);
|
LoadGraphic(kPointsPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&pointsMaskMap, &pointsSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&pointsMaskMap, &pointsSrcRect, 1);
|
||||||
SetGWorld(pointsMaskMap, nil);
|
SetGraphicsPort(pointsMaskMap);
|
||||||
LoadGraphic(kPointsPictID + 1000);
|
LoadGraphic(kPointsPictID + 1000);
|
||||||
|
|
||||||
for (i = 0; i < 15; i++)
|
for (i = 0; i < 15; i++)
|
||||||
@@ -410,7 +405,7 @@ void InitPrizes (void)
|
|||||||
QOffsetRect(&pointsSrc[i], 0, i * 8);
|
QOffsetRect(&pointsSrc[i], 0, i * 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- InitTransports
|
//-------------------------------------------------------------- InitTransports
|
||||||
@@ -420,21 +415,20 @@ void InitPrizes (void)
|
|||||||
void InitTransports (void)
|
void InitTransports (void)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld); // GlidePort: this line was missing?
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
QSetRect(&transSrcRect, 0, 0, 56, 32); // 1848 pixels
|
QSetRect(&transSrcRect, 0, 0, 56, 32); // 1848 pixels
|
||||||
theErr = CreateOffScreenGWorld(&transSrcMap, &transSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&transSrcMap, &transSrcRect, kPreferredDepth);
|
||||||
SetGWorld(transSrcMap, nil);
|
SetGraphicsPort(transSrcMap);
|
||||||
LoadGraphic(kTransportPictID);
|
LoadGraphic(kTransportPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&transMaskMap, &transSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&transMaskMap, &transSrcRect, 1);
|
||||||
SetGWorld(transMaskMap, nil);
|
SetGraphicsPort(transMaskMap);
|
||||||
LoadGraphic(kTransportPictID + 1000);
|
LoadGraphic(kTransportPictID + 1000);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- InitSwitches
|
//-------------------------------------------------------------- InitSwitches
|
||||||
@@ -444,14 +438,13 @@ void InitTransports (void)
|
|||||||
void InitSwitches (void)
|
void InitSwitches (void)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
QSetRect(&switchSrcRect, 0, 0, 32, 104); // 3360 pixels
|
QSetRect(&switchSrcRect, 0, 0, 32, 104); // 3360 pixels
|
||||||
theErr = CreateOffScreenGWorld(&switchSrcMap, &switchSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&switchSrcMap, &switchSrcRect, kPreferredDepth);
|
||||||
SetGWorld(switchSrcMap, nil);
|
SetGraphicsPort(switchSrcMap);
|
||||||
LoadGraphic(kSwitchPictID);
|
LoadGraphic(kSwitchPictID);
|
||||||
|
|
||||||
QSetRect(&lightSwitchSrc[0], 0, 0, 15, 24);
|
QSetRect(&lightSwitchSrc[0], 0, 0, 15, 24);
|
||||||
@@ -479,7 +472,7 @@ void InitSwitches (void)
|
|||||||
QSetRect(&knifeSwitchSrc[1], 0, 0, 16, 24);
|
QSetRect(&knifeSwitchSrc[1], 0, 0, 16, 24);
|
||||||
QOffsetRect(&knifeSwitchSrc[1], 16, 80);
|
QOffsetRect(&knifeSwitchSrc[1], 16, 80);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- InitLights
|
//-------------------------------------------------------------- InitLights
|
||||||
@@ -489,19 +482,18 @@ void InitSwitches (void)
|
|||||||
void InitLights (void)
|
void InitLights (void)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
short i;
|
short i;
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
QSetRect(&lightSrcRect, 0, 0, 72, 126); // 9144 pixels
|
QSetRect(&lightSrcRect, 0, 0, 72, 126); // 9144 pixels
|
||||||
theErr = CreateOffScreenGWorld(&lightSrcMap, &lightSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&lightSrcMap, &lightSrcRect, kPreferredDepth);
|
||||||
SetGWorld(lightSrcMap, nil);
|
SetGraphicsPort(lightSrcMap);
|
||||||
LoadGraphic(kLightPictID);
|
LoadGraphic(kLightPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&lightMaskMap, &lightSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&lightMaskMap, &lightSrcRect, 1);
|
||||||
SetGWorld(lightMaskMap, nil);
|
SetGraphicsPort(lightMaskMap);
|
||||||
LoadGraphic(kLightPictID + 1000);
|
LoadGraphic(kLightPictID + 1000);
|
||||||
|
|
||||||
QSetRect(&flourescentSrc1, 0, 0, 16, 12);
|
QSetRect(&flourescentSrc1, 0, 0, 16, 12);
|
||||||
@@ -516,7 +508,7 @@ void InitLights (void)
|
|||||||
QOffsetRect(&trackLightSrc[i], 24 * i, 102);
|
QOffsetRect(&trackLightSrc[i], 24 * i, 102);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- InitAppliances
|
//-------------------------------------------------------------- InitAppliances
|
||||||
@@ -526,37 +518,36 @@ void InitLights (void)
|
|||||||
void InitAppliances (void)
|
void InitAppliances (void)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
short i;
|
short i;
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
QSetRect(&applianceSrcRect, 0, 0, 80, 269); // 21600 pixels
|
QSetRect(&applianceSrcRect, 0, 0, 80, 269); // 21600 pixels
|
||||||
theErr = CreateOffScreenGWorld(&applianceSrcMap, &applianceSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&applianceSrcMap, &applianceSrcRect, kPreferredDepth);
|
||||||
SetGWorld(applianceSrcMap, nil);
|
SetGraphicsPort(applianceSrcMap);
|
||||||
LoadGraphic(kAppliancePictID);
|
LoadGraphic(kAppliancePictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&applianceMaskMap, &applianceSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&applianceMaskMap, &applianceSrcRect, 1);
|
||||||
SetGWorld(applianceMaskMap, nil);
|
SetGraphicsPort(applianceMaskMap);
|
||||||
LoadGraphic(kAppliancePictID + 1000);
|
LoadGraphic(kAppliancePictID + 1000);
|
||||||
|
|
||||||
QSetRect(&toastSrcRect, 0, 0, 32, 174); // 5600 pixels
|
QSetRect(&toastSrcRect, 0, 0, 32, 174); // 5600 pixels
|
||||||
theErr = CreateOffScreenGWorld(&toastSrcMap, &toastSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&toastSrcMap, &toastSrcRect, kPreferredDepth);
|
||||||
SetGWorld(toastSrcMap, nil);
|
SetGraphicsPort(toastSrcMap);
|
||||||
LoadGraphic(kToastPictID);
|
LoadGraphic(kToastPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&toastMaskMap, &toastSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&toastMaskMap, &toastSrcRect, 1);
|
||||||
SetGWorld(toastMaskMap, nil);
|
SetGraphicsPort(toastMaskMap);
|
||||||
LoadGraphic(kToastPictID + 1000);
|
LoadGraphic(kToastPictID + 1000);
|
||||||
|
|
||||||
QSetRect(&shredSrcRect, 0, 0, 40, 35); // 1440 pixels
|
QSetRect(&shredSrcRect, 0, 0, 40, 35); // 1440 pixels
|
||||||
theErr = CreateOffScreenGWorld(&shredSrcMap, &shredSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&shredSrcMap, &shredSrcRect, kPreferredDepth);
|
||||||
SetGWorld(shredSrcMap, nil);
|
SetGraphicsPort(shredSrcMap);
|
||||||
LoadGraphic(kShreddedPictID);
|
LoadGraphic(kShreddedPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&shredMaskMap, &shredSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&shredMaskMap, &shredSrcRect, 1);
|
||||||
SetGWorld(shredMaskMap, nil);
|
SetGraphicsPort(shredMaskMap);
|
||||||
LoadGraphic(kShreddedPictID + 1000);
|
LoadGraphic(kShreddedPictID + 1000);
|
||||||
|
|
||||||
QSetRect(&plusScreen1, 0, 0, 32, 22);
|
QSetRect(&plusScreen1, 0, 0, 32, 22);
|
||||||
@@ -601,7 +592,7 @@ void InitAppliances (void)
|
|||||||
QSetRect(µOff, 0, 0, 16, 35);
|
QSetRect(µOff, 0, 0, 16, 35);
|
||||||
QOffsetRect(µOff, 64, 187);
|
QOffsetRect(µOff, 64, 187);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- InitEnemies
|
//-------------------------------------------------------------- InitEnemies
|
||||||
@@ -611,73 +602,72 @@ void InitAppliances (void)
|
|||||||
void InitEnemies (void)
|
void InitEnemies (void)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
short i;
|
short i;
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
QSetRect(&balloonSrcRect, 0, 0, 24, 30 * kNumBalloonFrames);
|
QSetRect(&balloonSrcRect, 0, 0, 24, 30 * kNumBalloonFrames);
|
||||||
theErr = CreateOffScreenGWorld(&balloonSrcMap, &balloonSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&balloonSrcMap, &balloonSrcRect, kPreferredDepth);
|
||||||
SetGWorld(balloonSrcMap, nil);
|
SetGraphicsPort(balloonSrcMap);
|
||||||
LoadGraphic(kBalloonPictID);
|
LoadGraphic(kBalloonPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&balloonMaskMap, &balloonSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&balloonMaskMap, &balloonSrcRect, 1);
|
||||||
SetGWorld(balloonMaskMap, nil);
|
SetGraphicsPort(balloonMaskMap);
|
||||||
LoadGraphic(kBalloonPictID + 1000);
|
LoadGraphic(kBalloonPictID + 1000);
|
||||||
|
|
||||||
QSetRect(&copterSrcRect, 0, 0, 32, 30 * kNumCopterFrames);
|
QSetRect(&copterSrcRect, 0, 0, 32, 30 * kNumCopterFrames);
|
||||||
theErr = CreateOffScreenGWorld(&copterSrcMap, &copterSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&copterSrcMap, &copterSrcRect, kPreferredDepth);
|
||||||
SetGWorld(copterSrcMap, nil);
|
SetGraphicsPort(copterSrcMap);
|
||||||
LoadGraphic(kCopterPictID);
|
LoadGraphic(kCopterPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&copterMaskMap, &copterSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&copterMaskMap, &copterSrcRect, 1);
|
||||||
SetGWorld(copterMaskMap, nil);
|
SetGraphicsPort(copterMaskMap);
|
||||||
LoadGraphic(kCopterPictID + 1000);
|
LoadGraphic(kCopterPictID + 1000);
|
||||||
|
|
||||||
QSetRect(&dartSrcRect, 0, 0, 64, 19 * kNumDartFrames);
|
QSetRect(&dartSrcRect, 0, 0, 64, 19 * kNumDartFrames);
|
||||||
theErr = CreateOffScreenGWorld(&dartSrcMap, &dartSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&dartSrcMap, &dartSrcRect, kPreferredDepth);
|
||||||
SetGWorld(dartSrcMap, nil);
|
SetGraphicsPort(dartSrcMap);
|
||||||
LoadGraphic(kDartPictID);
|
LoadGraphic(kDartPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&dartMaskMap, &dartSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&dartMaskMap, &dartSrcRect, 1);
|
||||||
SetGWorld(dartMaskMap, nil);
|
SetGraphicsPort(dartMaskMap);
|
||||||
LoadGraphic(kDartPictID + 1000);
|
LoadGraphic(kDartPictID + 1000);
|
||||||
|
|
||||||
QSetRect(&ballSrcRect, 0, 0, 32, 32 * kNumBallFrames);
|
QSetRect(&ballSrcRect, 0, 0, 32, 32 * kNumBallFrames);
|
||||||
theErr = CreateOffScreenGWorld(&ballSrcMap, &ballSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&ballSrcMap, &ballSrcRect, kPreferredDepth);
|
||||||
SetGWorld(ballSrcMap, nil);
|
SetGraphicsPort(ballSrcMap);
|
||||||
LoadGraphic(kBallPictID);
|
LoadGraphic(kBallPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&ballMaskMap, &ballSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&ballMaskMap, &ballSrcRect, 1);
|
||||||
SetGWorld(ballMaskMap, nil);
|
SetGraphicsPort(ballMaskMap);
|
||||||
LoadGraphic(kBallPictID + 1000);
|
LoadGraphic(kBallPictID + 1000);
|
||||||
|
|
||||||
QSetRect(&dripSrcRect, 0, 0, 16, 12 * kNumDripFrames);
|
QSetRect(&dripSrcRect, 0, 0, 16, 12 * kNumDripFrames);
|
||||||
theErr = CreateOffScreenGWorld(&dripSrcMap, &dripSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&dripSrcMap, &dripSrcRect, kPreferredDepth);
|
||||||
SetGWorld(dripSrcMap, nil);
|
SetGraphicsPort(dripSrcMap);
|
||||||
LoadGraphic(kDripPictID);
|
LoadGraphic(kDripPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&dripMaskMap, &dripSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&dripMaskMap, &dripSrcRect, 1);
|
||||||
SetGWorld(dripMaskMap, nil);
|
SetGraphicsPort(dripMaskMap);
|
||||||
LoadGraphic(kDripPictID + 1000);
|
LoadGraphic(kDripPictID + 1000);
|
||||||
|
|
||||||
QSetRect(&enemySrcRect, 0, 0, 36, 33);
|
QSetRect(&enemySrcRect, 0, 0, 36, 33);
|
||||||
theErr = CreateOffScreenGWorld(&enemySrcMap, &enemySrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&enemySrcMap, &enemySrcRect, kPreferredDepth);
|
||||||
SetGWorld(enemySrcMap, nil);
|
SetGraphicsPort(enemySrcMap);
|
||||||
LoadGraphic(kEnemyPictID);
|
LoadGraphic(kEnemyPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&enemyMaskMap, &enemySrcRect, 1);
|
theErr = CreateOffScreenGWorld(&enemyMaskMap, &enemySrcRect, 1);
|
||||||
SetGWorld(enemyMaskMap, nil);
|
SetGraphicsPort(enemyMaskMap);
|
||||||
LoadGraphic(kEnemyPictID + 1000);
|
LoadGraphic(kEnemyPictID + 1000);
|
||||||
|
|
||||||
QSetRect(&fishSrcRect, 0, 0, 16, 16 * kNumFishFrames);
|
QSetRect(&fishSrcRect, 0, 0, 16, 16 * kNumFishFrames);
|
||||||
theErr = CreateOffScreenGWorld(&fishSrcMap, &fishSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&fishSrcMap, &fishSrcRect, kPreferredDepth);
|
||||||
SetGWorld(fishSrcMap, nil);
|
SetGraphicsPort(fishSrcMap);
|
||||||
LoadGraphic(kFishPictID);
|
LoadGraphic(kFishPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&fishMaskMap, &fishSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&fishMaskMap, &fishSrcRect, 1);
|
||||||
SetGWorld(fishMaskMap, nil);
|
SetGraphicsPort(fishMaskMap);
|
||||||
LoadGraphic(kFishPictID + 1000);
|
LoadGraphic(kFishPictID + 1000);
|
||||||
|
|
||||||
for (i = 0; i < kNumBalloonFrames; i++)
|
for (i = 0; i < kNumBalloonFrames; i++)
|
||||||
@@ -716,6 +706,6 @@ void InitEnemies (void)
|
|||||||
QOffsetRect(&fishSrc[i], 0, 16 * i);
|
QOffsetRect(&fishSrc[i], 0, 16 * i);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ void InitAngel (void);
|
|||||||
|
|
||||||
extern Rect suppSrcRect, justRoomsRect;
|
extern Rect suppSrcRect, justRoomsRect;
|
||||||
extern Rect tileSrcRect, angelSrcRect;
|
extern Rect tileSrcRect, angelSrcRect;
|
||||||
extern GDHandle thisGDevice;
|
|
||||||
extern CGrafPtr tileSrcMap;
|
extern CGrafPtr tileSrcMap;
|
||||||
extern FSSpecPtr theHousesSpecs;
|
extern FSSpecPtr theHousesSpecs;
|
||||||
extern hotPtr hotSpots;
|
extern hotPtr hotSpots;
|
||||||
@@ -54,18 +53,17 @@ extern short maxFiles;
|
|||||||
void InitClutter (void)
|
void InitClutter (void)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
QSetRect(&clutterSrcRect, 0, 0, 128, 69);
|
QSetRect(&clutterSrcRect, 0, 0, 128, 69);
|
||||||
theErr = CreateOffScreenGWorld(&clutterSrcMap, &clutterSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&clutterSrcMap, &clutterSrcRect, kPreferredDepth);
|
||||||
SetGWorld(clutterSrcMap, nil);
|
SetGraphicsPort(clutterSrcMap);
|
||||||
LoadGraphic(kClutterPictID);
|
LoadGraphic(kClutterPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&clutterMaskMap, &clutterSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&clutterMaskMap, &clutterSrcRect, 1);
|
||||||
SetGWorld(clutterMaskMap, nil);
|
SetGraphicsPort(clutterMaskMap);
|
||||||
LoadGraphic(kClutterPictID + 1000);
|
LoadGraphic(kClutterPictID + 1000);
|
||||||
|
|
||||||
QSetRect(&flowerSrc[0], 0, 0, 10, 28);
|
QSetRect(&flowerSrc[0], 0, 0, 10, 28);
|
||||||
@@ -86,7 +84,7 @@ void InitClutter (void)
|
|||||||
QSetRect(&flowerSrc[5], 0, 0, 32, 51);
|
QSetRect(&flowerSrc[5], 0, 0, 32, 51);
|
||||||
QOffsetRect(&flowerSrc[5], 95, 0);
|
QOffsetRect(&flowerSrc[5], 95, 0);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- InitSupport
|
//-------------------------------------------------------------- InitSupport
|
||||||
@@ -97,17 +95,16 @@ void InitClutter (void)
|
|||||||
void InitSupport (void)
|
void InitSupport (void)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
QSetRect(&suppSrcRect, 0, 0, kRoomWide, kFloorSupportTall); // 44
|
QSetRect(&suppSrcRect, 0, 0, kRoomWide, kFloorSupportTall); // 44
|
||||||
theErr = CreateOffScreenGWorld(&suppSrcMap, &suppSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&suppSrcMap, &suppSrcRect, kPreferredDepth);
|
||||||
SetGWorld(suppSrcMap, nil);
|
SetGraphicsPort(suppSrcMap);
|
||||||
LoadGraphic(kSupportPictID);
|
LoadGraphic(kSupportPictID);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- InitAngel
|
//-------------------------------------------------------------- InitAngel
|
||||||
@@ -118,21 +115,20 @@ void InitSupport (void)
|
|||||||
void InitAngel (void)
|
void InitAngel (void)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
QSetRect(&angelSrcRect, 0, 0, 96, 44);
|
QSetRect(&angelSrcRect, 0, 0, 96, 44);
|
||||||
theErr = CreateOffScreenGWorld(&angelSrcMap, &angelSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&angelSrcMap, &angelSrcRect, kPreferredDepth);
|
||||||
SetGWorld(angelSrcMap, nil);
|
SetGraphicsPort(angelSrcMap);
|
||||||
LoadGraphic(kAngelPictID);
|
LoadGraphic(kAngelPictID);
|
||||||
|
|
||||||
theErr = CreateOffScreenGWorld(&angelMaskMap, &angelSrcRect, 1);
|
theErr = CreateOffScreenGWorld(&angelMaskMap, &angelSrcRect, 1);
|
||||||
SetGWorld(angelMaskMap, nil);
|
SetGraphicsPort(angelMaskMap);
|
||||||
LoadGraphic(kAngelPictID + 1);
|
LoadGraphic(kAngelPictID + 1);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- CreateOffscreens
|
//-------------------------------------------------------------- CreateOffscreens
|
||||||
@@ -144,10 +140,9 @@ void InitAngel (void)
|
|||||||
void CreateOffscreens (void)
|
void CreateOffscreens (void)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
justRoomsRect = houseRect;
|
justRoomsRect = houseRect;
|
||||||
ZeroRectCorner(&justRoomsRect);
|
ZeroRectCorner(&justRoomsRect);
|
||||||
|
|||||||
@@ -74,19 +74,18 @@ Boolean isToolsOpen;
|
|||||||
void CreateToolsOffscreen (void)
|
void CreateToolsOffscreen (void)
|
||||||
{
|
{
|
||||||
CGrafPtr wasCPort;
|
CGrafPtr wasCPort;
|
||||||
GDHandle wasWorld;
|
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
if (toolSrcMap == nil)
|
if (toolSrcMap == nil)
|
||||||
{
|
{
|
||||||
GetGWorld(&wasCPort, &wasWorld);
|
wasCPort = GetGraphicsPort();
|
||||||
|
|
||||||
QSetRect(&toolSrcRect, 0, 0, 360, 216);
|
QSetRect(&toolSrcRect, 0, 0, 360, 216);
|
||||||
theErr = CreateOffScreenGWorld(&toolSrcMap, &toolSrcRect, kPreferredDepth);
|
theErr = CreateOffScreenGWorld(&toolSrcMap, &toolSrcRect, kPreferredDepth);
|
||||||
SetGWorld(toolSrcMap, nil);
|
SetGraphicsPort(toolSrcMap);
|
||||||
LoadGraphic(kToolsPictID);
|
LoadGraphic(kToolsPictID);
|
||||||
|
|
||||||
SetGWorld(wasCPort, wasWorld);
|
SetGraphicsPort(wasCPort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#include "Utilities.h"
|
#include "Utilities.h"
|
||||||
|
|
||||||
|
|
||||||
GDHandle thisGDevice;
|
|
||||||
UInt32 theSeed;
|
UInt32 theSeed;
|
||||||
|
|
||||||
|
|
||||||
@@ -138,17 +137,6 @@ void RedAlert (short errorNumber)
|
|||||||
ExitToShell();
|
ExitToShell();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- FindOurDevice
|
|
||||||
|
|
||||||
// Finds the main device (monitor with the menu bar on it).
|
|
||||||
|
|
||||||
void FindOurDevice (void)
|
|
||||||
{
|
|
||||||
thisGDevice = GetMainDevice();
|
|
||||||
if (thisGDevice == nil)
|
|
||||||
RedAlert(kErrFailedGetDevice);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-------------------------------------------------------------- CreateOffScreenBitMap
|
//-------------------------------------------------------------- CreateOffScreenBitMap
|
||||||
// Creates an offscreen bit map (b&w - 1 bit depth).
|
// Creates an offscreen bit map (b&w - 1 bit depth).
|
||||||
|
|
||||||
@@ -245,10 +233,10 @@ OSErr CreateOffScreenGWorld (GWorldPtr *theGWorld, Rect *bounds, short depth)
|
|||||||
{
|
{
|
||||||
OSErr theErr;
|
OSErr theErr;
|
||||||
|
|
||||||
theErr = NewGWorld(theGWorld, depth, bounds, nil, nil, useTempMem);
|
theErr = NewGWorld(theGWorld, depth, bounds, nil, useTempMem);
|
||||||
|
|
||||||
if (theErr)
|
if (theErr)
|
||||||
theErr = NewGWorld(theGWorld, depth, bounds, nil, nil, 0);
|
theErr = NewGWorld(theGWorld, depth, bounds, nil, 0);
|
||||||
|
|
||||||
if (!theErr)
|
if (!theErr)
|
||||||
LockPixels(GetGWorldPixMap(*theGWorld));
|
LockPixels(GetGWorldPixMap(*theGWorld));
|
||||||
|
|||||||
@@ -1270,7 +1270,8 @@ int main(int argc, const char **argv)
|
|||||||
|
|
||||||
for (const char *filename : files)
|
for (const char *filename : files)
|
||||||
{
|
{
|
||||||
std::string filePath = "D:\\Source Code\\GlidePort\\Packaged\\Houses\\";
|
std::string fnameStr = filename;
|
||||||
|
std::string filePath = (fnameStr == "ApplicationResources") ? "D:\\Source Code\\GlidePort\\Packaged\\" : "D:\\Source Code\\GlidePort\\Packaged\\Houses\\";
|
||||||
filePath += filename;
|
filePath += filename;
|
||||||
filePath += ".gpr";
|
filePath += ".gpr";
|
||||||
|
|
||||||
@@ -1294,7 +1295,7 @@ int main(int argc, const char **argv)
|
|||||||
const MMHandleBlock *hBlock = resFile->GetResource('PICT', typeList->m_firstRef[i].m_resID, true);
|
const MMHandleBlock *hBlock = resFile->GetResource('PICT', typeList->m_firstRef[i].m_resID, true);
|
||||||
const void *pictData = hBlock->m_contents;
|
const void *pictData = hBlock->m_contents;
|
||||||
|
|
||||||
std::string dumpPath = "D:\\Source Code\\GlidePort\\PictDump\\";
|
std::string dumpPath = "D:\\Source Code\\GlidePort\\DebugData\\PictDump\\";
|
||||||
|
|
||||||
dumpPath += filename;
|
dumpPath += filename;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "DisplayDeviceManager.h"
|
#include "DisplayDeviceManager.h"
|
||||||
|
|
||||||
#include "HostDisplayDriver.h"
|
#include "HostDisplayDriver.h"
|
||||||
|
#include "IGpDisplayDriver.h"
|
||||||
#include "PLQDraw.h"
|
#include "PLQDraw.h"
|
||||||
#include "MemoryManager.h"
|
#include "MemoryManager.h"
|
||||||
#include "QDStandardPalette.h"
|
#include "QDStandardPalette.h"
|
||||||
@@ -15,8 +16,8 @@ namespace PortabilityLayer
|
|||||||
void Init() override;
|
void Init() override;
|
||||||
void Shutdown() override;
|
void Shutdown() override;
|
||||||
|
|
||||||
GDevice **GetMainDevice() override;
|
GpPixelFormat_t GetPixelFormat() const override;
|
||||||
|
void SyncPalette(IGpDisplayDriver *displayDriver) override;
|
||||||
|
|
||||||
void IncrementTickCount(uint32_t count) override;
|
void IncrementTickCount(uint32_t count) override;
|
||||||
uint32_t GetTickCount() override;
|
uint32_t GetTickCount() override;
|
||||||
@@ -24,50 +25,62 @@ namespace PortabilityLayer
|
|||||||
static DisplayDeviceManagerImpl *GetInstance();
|
static DisplayDeviceManagerImpl *GetInstance();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GDHandle m_mainDevice;
|
|
||||||
uint32_t m_tickCount;
|
uint32_t m_tickCount;
|
||||||
|
GpPixelFormat_t m_pixelFormat;
|
||||||
|
bool m_paletteIsDirty;
|
||||||
|
|
||||||
|
PortabilityLayer::RGBAColor *m_palette;
|
||||||
|
uint8_t m_paletteStorage[256 * sizeof(PortabilityLayer::RGBAColor) + PL_SYSTEM_MEMORY_ALIGNMENT];
|
||||||
|
|
||||||
static DisplayDeviceManagerImpl ms_instance;
|
static DisplayDeviceManagerImpl ms_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
DisplayDeviceManagerImpl::DisplayDeviceManagerImpl()
|
DisplayDeviceManagerImpl::DisplayDeviceManagerImpl()
|
||||||
: m_mainDevice(nullptr)
|
: m_tickCount(1)
|
||||||
, m_tickCount(1)
|
, m_paletteIsDirty(true)
|
||||||
|
, m_pixelFormat(GpPixelFormats::k8BitStandard)
|
||||||
{
|
{
|
||||||
|
uint8_t *paletteStorage = m_paletteStorage;
|
||||||
|
while (reinterpret_cast<intptr_t>(paletteStorage) % PL_SYSTEM_MEMORY_ALIGNMENT != 0)
|
||||||
|
paletteStorage++;
|
||||||
|
|
||||||
|
m_palette = reinterpret_cast<PortabilityLayer::RGBAColor*>(paletteStorage);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < 256; i++)
|
||||||
|
{
|
||||||
|
PortabilityLayer::RGBAColor &color = m_palette[i];
|
||||||
|
color.r = color.g = color.b = i;
|
||||||
|
color.a = 255;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDeviceManagerImpl::Init()
|
void DisplayDeviceManagerImpl::Init()
|
||||||
{
|
{
|
||||||
m_mainDevice = MemoryManager::GetInstance()->NewHandle<GDevice>();
|
HostDisplayDriver::GetInstance()->GetDisplayResolution(nullptr, nullptr, &m_pixelFormat);
|
||||||
if (m_mainDevice)
|
|
||||||
{
|
|
||||||
GDevice *device = *m_mainDevice;
|
|
||||||
|
|
||||||
HostDisplayDriver::GetInstance()->GetDisplayResolution(nullptr, nullptr, &device->pixelFormat);
|
const PortabilityLayer::RGBAColor *spColors = StandardPalette::GetInstance()->GetColors();
|
||||||
|
for (size_t i = 0; i < 256; i++)
|
||||||
|
m_palette[i] = spColors[i];
|
||||||
|
|
||||||
uint8_t *paletteStorage = device->paletteStorage;
|
m_paletteIsDirty = true;
|
||||||
while (reinterpret_cast<intptr_t>(paletteStorage) % PL_SYSTEM_MEMORY_ALIGNMENT != 0)
|
|
||||||
paletteStorage++;
|
|
||||||
|
|
||||||
PortabilityLayer::RGBAColor *paletteData = reinterpret_cast<PortabilityLayer::RGBAColor*>(paletteStorage);
|
|
||||||
device->paletteDataOffset = static_cast<uint8_t>(paletteStorage - device->paletteStorage);
|
|
||||||
|
|
||||||
const PortabilityLayer::RGBAColor *spColors = StandardPalette::GetInstance()->GetColors();
|
|
||||||
for (size_t i = 0; i < 256; i++)
|
|
||||||
paletteData[i] = spColors[i];
|
|
||||||
|
|
||||||
device->paletteIsDirty = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDeviceManagerImpl::Shutdown()
|
void DisplayDeviceManagerImpl::Shutdown()
|
||||||
{
|
{
|
||||||
MemoryManager::GetInstance()->ReleaseHandle(reinterpret_cast<MMHandleBlock*>(m_mainDevice));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GDevice **DisplayDeviceManagerImpl::GetMainDevice()
|
GpPixelFormat_t DisplayDeviceManagerImpl::GetPixelFormat() const
|
||||||
{
|
{
|
||||||
return m_mainDevice;
|
return m_pixelFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisplayDeviceManagerImpl::SyncPalette(IGpDisplayDriver *displayDriver)
|
||||||
|
{
|
||||||
|
if (m_paletteIsDirty)
|
||||||
|
{
|
||||||
|
displayDriver->UpdatePalette(m_palette);
|
||||||
|
m_paletteIsDirty = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayDeviceManagerImpl::IncrementTickCount(uint32_t count)
|
void DisplayDeviceManagerImpl::IncrementTickCount(uint32_t count)
|
||||||
|
|||||||
@@ -2,9 +2,10 @@
|
|||||||
#ifndef __PL_DEVICE_MANAGER_H__
|
#ifndef __PL_DEVICE_MANAGER_H__
|
||||||
#define __PL_DEVICE_MANAGER_H__
|
#define __PL_DEVICE_MANAGER_H__
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include "GpPixelFormat.h"
|
||||||
struct GDevice;
|
|
||||||
|
struct IGpDisplayDriver;
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
{
|
{
|
||||||
@@ -12,9 +13,11 @@ namespace PortabilityLayer
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Init() = 0;
|
virtual void Init() = 0;
|
||||||
virtual void Shutdown() = 0;
|
virtual void Shutdown() = 0;
|
||||||
|
|
||||||
|
virtual GpPixelFormat_t GetPixelFormat() const = 0;
|
||||||
|
virtual void SyncPalette(IGpDisplayDriver *displayDriver) = 0;
|
||||||
|
|
||||||
virtual GDevice **GetMainDevice() = 0;
|
|
||||||
virtual void IncrementTickCount(uint32_t count) = 0;
|
virtual void IncrementTickCount(uint32_t count) = 0;
|
||||||
virtual uint32_t GetTickCount() = 0;
|
virtual uint32_t GetTickCount() = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -553,7 +553,7 @@ namespace PortabilityLayer
|
|||||||
{
|
{
|
||||||
int depth = PortabilityLayer::QDManager::GetInstance()->DepthForPixelFormat(pixelFormat);
|
int depth = PortabilityLayer::QDManager::GetInstance()->DepthForPixelFormat(pixelFormat);
|
||||||
|
|
||||||
if (qdManager->NewGWorld(&m_menuBarGraf, depth, menuRect, nullptr, nullptr, 0) != 0)
|
if (qdManager->NewGWorld(&m_menuBarGraf, depth, menuRect, nullptr, 0) != 0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -569,11 +569,9 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
RefreshMenuBarLayout();
|
RefreshMenuBarLayout();
|
||||||
|
|
||||||
CGraf *oldGraf;
|
CGraf *oldGraf = GetGraphicsPort();
|
||||||
GDHandle oldDevice;
|
|
||||||
GetGWorld(&oldGraf, &oldDevice);
|
|
||||||
|
|
||||||
SetGWorld(m_menuBarGraf, nullptr);
|
SetGraphicsPort(m_menuBarGraf);
|
||||||
|
|
||||||
PortabilityLayer::QDState *qdState = qdManager->GetState();
|
PortabilityLayer::QDState *qdState = qdManager->GetState();
|
||||||
|
|
||||||
@@ -705,7 +703,7 @@ namespace PortabilityLayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetGWorld(oldGraf, oldDevice);
|
SetGraphicsPort(oldGraf);
|
||||||
|
|
||||||
m_menuBarGraf->m_port.SetDirty(QDPortDirtyFlag_Contents);
|
m_menuBarGraf->m_port.SetDirty(QDPortDirtyFlag_Contents);
|
||||||
}
|
}
|
||||||
@@ -1019,15 +1017,13 @@ namespace PortabilityLayer
|
|||||||
GpPixelFormat_t pixelFormat;
|
GpPixelFormat_t pixelFormat;
|
||||||
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(nullptr, nullptr, &pixelFormat);
|
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(nullptr, nullptr, &pixelFormat);
|
||||||
|
|
||||||
if (qdManager->NewGWorld(&m_menuGraf, qdManager->DepthForPixelFormat(pixelFormat), menuRect, nullptr, nullptr, 0) != 0)
|
if (qdManager->NewGWorld(&m_menuGraf, qdManager->DepthForPixelFormat(pixelFormat), menuRect, nullptr, 0) != 0)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGrafPtr oldGraf = nullptr;
|
CGrafPtr oldGraf = GetGraphicsPort();
|
||||||
GDHandle oldDevice = nullptr;
|
|
||||||
GetGWorld(&oldGraf, &oldDevice);
|
|
||||||
|
|
||||||
SetGWorld(m_menuGraf, nullptr);
|
SetGraphicsPort(m_menuGraf);
|
||||||
|
|
||||||
QDState *qdState = qdManager->GetState();
|
QDState *qdState = qdManager->GetState();
|
||||||
|
|
||||||
@@ -1077,7 +1073,7 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
m_menuGraf->m_port.SetDirty(QDPortDirtyFlag_Contents);
|
m_menuGraf->m_port.SetDirty(QDPortDirtyFlag_Contents);
|
||||||
|
|
||||||
SetGWorld(oldGraf, oldDevice);
|
SetGraphicsPort(oldGraf);
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuManager *MenuManager::GetInstance()
|
MenuManager *MenuManager::GetInstance()
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
void *imageData = m_pixMap->GetPixelData();
|
void *imageData = m_pixMap->GetPixelData();
|
||||||
|
|
||||||
if (m_pixMap->GetPixelFormat() == GpPixelFormats::k8BitStandard)
|
if (m_pixMap->GetPixelFormat() == GpPixelFormats::k8BitStandard || m_pixMap->GetPixelFormat() == GpPixelFormats::kBW1)
|
||||||
{
|
{
|
||||||
switch (m_blitType)
|
switch (m_blitType)
|
||||||
{
|
{
|
||||||
@@ -232,9 +232,9 @@ namespace PortabilityLayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OSErr NewGWorld(GWorldPtr *gworld, int depth, const Rect *bounds, CTabHandle colorTable, GDHandle device, int flags)
|
OSErr NewGWorld(GWorldPtr *gworld, int depth, const Rect *bounds, CTabHandle colorTable, int flags)
|
||||||
{
|
{
|
||||||
return PortabilityLayer::QDManager::GetInstance()->NewGWorld(gworld, depth, *bounds, colorTable, device, flags);
|
return PortabilityLayer::QDManager::GetInstance()->NewGWorld(gworld, depth, *bounds, colorTable, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisposeGWorld(GWorldPtr gworld)
|
void DisposeGWorld(GWorldPtr gworld)
|
||||||
@@ -288,8 +288,7 @@ void DrawPicture(PicHandle pict, Rect *bounds)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PortabilityLayer::QDManager *qdManager = PortabilityLayer::QDManager::GetInstance();
|
PortabilityLayer::QDManager *qdManager = PortabilityLayer::QDManager::GetInstance();
|
||||||
PortabilityLayer::QDPort *port;
|
PortabilityLayer::QDPort *port = qdManager->GetPort();
|
||||||
qdManager->GetPort(&port, nullptr);
|
|
||||||
|
|
||||||
if (!port)
|
if (!port)
|
||||||
return;
|
return;
|
||||||
@@ -299,12 +298,15 @@ void DrawPicture(PicHandle pict, Rect *bounds)
|
|||||||
long handleSize = GetHandleSize(reinterpret_cast<Handle>(pict));
|
long handleSize = GetHandleSize(reinterpret_cast<Handle>(pict));
|
||||||
PortabilityLayer::MemReaderStream stream(picPtr, handleSize);
|
PortabilityLayer::MemReaderStream stream(picPtr, handleSize);
|
||||||
|
|
||||||
|
// Adjust draw origin
|
||||||
|
const PortabilityLayer::Vec2i drawOrigin = PortabilityLayer::Vec2i(bounds->left - picPtr->picFrame.left, bounds->top - picPtr->picFrame.top);
|
||||||
|
|
||||||
switch (pixMap->GetPixelFormat())
|
switch (pixMap->GetPixelFormat())
|
||||||
{
|
{
|
||||||
case GpPixelFormats::kBW1:
|
case GpPixelFormats::kBW1:
|
||||||
case GpPixelFormats::k8BitStandard:
|
case GpPixelFormats::k8BitStandard:
|
||||||
{
|
{
|
||||||
PortabilityLayer::PixMapBlitEmitter blitEmitter(PortabilityLayer::Vec2i(bounds->left, bounds->top), pixMap);
|
PortabilityLayer::PixMapBlitEmitter blitEmitter(drawOrigin, pixMap);
|
||||||
PortabilityLayer::QDPictDecoder decoder;
|
PortabilityLayer::QDPictDecoder decoder;
|
||||||
|
|
||||||
decoder.DecodePict(&stream, &blitEmitter);
|
decoder.DecodePict(&stream, &blitEmitter);
|
||||||
@@ -317,18 +319,17 @@ void DrawPicture(PicHandle pict, Rect *bounds)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetGWorld(CGrafPtr *gw, GDHandle *gdHandle)
|
CGraf *GetGraphicsPort()
|
||||||
{
|
{
|
||||||
PortabilityLayer::QDPort *port;
|
PortabilityLayer::QDPort *port = PortabilityLayer::QDManager::GetInstance()->GetPort();
|
||||||
PortabilityLayer::QDManager::GetInstance()->GetPort(&port, gdHandle);
|
|
||||||
|
|
||||||
CGrafPtr grafPtr = reinterpret_cast<CGrafPtr>(port);
|
CGraf *grafPtr = reinterpret_cast<CGraf *>(port);
|
||||||
assert(&grafPtr->m_port == port);
|
assert(&grafPtr->m_port == port);
|
||||||
|
|
||||||
*gw = grafPtr;
|
return grafPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetGWorld(CGrafPtr gw, GDHandle gdHandle)
|
void SetGraphicsPort(CGrafPtr gw)
|
||||||
{
|
{
|
||||||
PortabilityLayer::QDManager::GetInstance()->SetPort(&gw->m_port, gdHandle);
|
PortabilityLayer::QDManager::GetInstance()->SetPort(&gw->m_port);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ enum QDFlags
|
|||||||
useTempMem = 1,
|
useTempMem = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
OSErr NewGWorld(GWorldPtr *gworld, int depth, const Rect *bounds, CTabHandle colorTable, GDHandle device, int flags);
|
OSErr NewGWorld(GWorldPtr *gworld, int depth, const Rect *bounds, CTabHandle colorTable, int flags);
|
||||||
void DisposeGWorld(GWorldPtr gworld);
|
void DisposeGWorld(GWorldPtr gworld);
|
||||||
|
|
||||||
PixMapHandle GetGWorldPixMap(GWorldPtr gworld);
|
PixMapHandle GetGWorldPixMap(GWorldPtr gworld);
|
||||||
@@ -37,8 +37,8 @@ void OffsetRect(Rect *rect, int right, int down);
|
|||||||
|
|
||||||
void DrawPicture(PicHandle pict, Rect *bounds);
|
void DrawPicture(PicHandle pict, Rect *bounds);
|
||||||
|
|
||||||
void GetGWorld(CGrafPtr *gw, GDHandle *gdHandle);
|
CGrafPtr GetGraphicsPort();
|
||||||
void SetGWorld(CGrafPtr gw, GDHandle gdHandle);
|
void SetGraphicsPort(CGrafPtr gw);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -4,12 +4,14 @@
|
|||||||
#include "DisplayDeviceManager.h"
|
#include "DisplayDeviceManager.h"
|
||||||
#include "FontFamily.h"
|
#include "FontFamily.h"
|
||||||
#include "FontManager.h"
|
#include "FontManager.h"
|
||||||
|
#include "LinePlotter.h"
|
||||||
#include "MMHandleBlock.h"
|
#include "MMHandleBlock.h"
|
||||||
#include "MemoryManager.h"
|
#include "MemoryManager.h"
|
||||||
#include "HostFontHandler.h"
|
#include "HostFontHandler.h"
|
||||||
#include "PLPasStr.h"
|
#include "PLPasStr.h"
|
||||||
#include "RenderedFont.h"
|
#include "RenderedFont.h"
|
||||||
#include "RenderedGlyphMetrics.h"
|
#include "RenderedGlyphMetrics.h"
|
||||||
|
#include "Rect2i.h"
|
||||||
#include "ResourceManager.h"
|
#include "ResourceManager.h"
|
||||||
#include "ResTypeID.h"
|
#include "ResTypeID.h"
|
||||||
#include "RGBAColor.h"
|
#include "RGBAColor.h"
|
||||||
@@ -18,10 +20,21 @@
|
|||||||
#include "QDGraf.h"
|
#include "QDGraf.h"
|
||||||
#include "QDPixMap.h"
|
#include "QDPixMap.h"
|
||||||
#include "QDUtils.h"
|
#include "QDUtils.h"
|
||||||
|
#include "Vec2i.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
|
enum PaintColorResolution
|
||||||
|
{
|
||||||
|
PaintColorResolution_Fore,
|
||||||
|
PaintColorResolution_Back,
|
||||||
|
PaintColorResolution_Pen,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void PaintRectWithPCR(const Rect &rect, PaintColorResolution pcr);
|
||||||
|
|
||||||
void GetPort(GrafPtr *graf)
|
void GetPort(GrafPtr *graf)
|
||||||
{
|
{
|
||||||
PL_NotYetImplemented();
|
PL_NotYetImplemented();
|
||||||
@@ -29,11 +42,7 @@ void GetPort(GrafPtr *graf)
|
|||||||
|
|
||||||
void SetPort(GrafPtr graf)
|
void SetPort(GrafPtr graf)
|
||||||
{
|
{
|
||||||
PortabilityLayer::QDManager *qd = PortabilityLayer::QDManager::GetInstance();
|
PortabilityLayer::QDManager::GetInstance()->SetPort(graf);
|
||||||
|
|
||||||
GDHandle device;
|
|
||||||
qd->GetPort(nullptr, &device);
|
|
||||||
qd->SetPort(graf, device);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BeginUpdate(WindowPtr graf)
|
void BeginUpdate(WindowPtr graf)
|
||||||
@@ -83,18 +92,10 @@ void SetRect(Rect *rect, short left, short top, short right, short bottom)
|
|||||||
rect->right = right;
|
rect->right = right;
|
||||||
}
|
}
|
||||||
|
|
||||||
GDHandle GetMainDevice()
|
|
||||||
{
|
|
||||||
return PortabilityLayer::DisplayDeviceManager::GetInstance()->GetMainDevice();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetPortWindowPort(WindowPtr window)
|
void SetPortWindowPort(WindowPtr window)
|
||||||
{
|
{
|
||||||
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||||
|
PortabilityLayer::QDManager::GetInstance()->SetPort(&window->m_graf.m_port);
|
||||||
GDevice **device = wm->GetWindowDevice(window);
|
|
||||||
|
|
||||||
PortabilityLayer::QDManager::GetInstance()->SetPort(&window->m_graf.m_port, device);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetPortDialogPort(Dialog *dialog)
|
void SetPortDialogPort(Dialog *dialog)
|
||||||
@@ -131,9 +132,136 @@ void MoveTo(int x, int y)
|
|||||||
penPos.v = y;
|
penPos.v = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void PlotLine(PortabilityLayer::QDState *qdState, PortabilityLayer::QDPort *qdPort, const PortabilityLayer::Vec2i &pointA, const PortabilityLayer::Vec2i &pointB)
|
||||||
|
{
|
||||||
|
const Rect lineRect = Rect::Create(
|
||||||
|
std::min(pointA.m_y, pointB.m_y),
|
||||||
|
std::min(pointA.m_x, pointB.m_x),
|
||||||
|
std::max(pointA.m_y, pointB.m_y) + 1,
|
||||||
|
std::max(pointA.m_x, pointB.m_x) + 1);
|
||||||
|
|
||||||
|
// If the points are a straight line, paint as a rect
|
||||||
|
if (pointA.m_y == pointB.m_y || pointA.m_x == pointB.m_x)
|
||||||
|
{
|
||||||
|
PaintRectWithPCR(lineRect, PaintColorResolution_Fore);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GpPixelFormat_t pixelFormat = qdPort->GetPixelFormat();
|
||||||
|
|
||||||
|
Rect constrainedRect = qdPort->GetRect();
|
||||||
|
|
||||||
|
if (qdState->m_clipRegion)
|
||||||
|
{
|
||||||
|
const Region ®ion = **qdState->m_clipRegion;
|
||||||
|
|
||||||
|
if (region.size > sizeof(Region))
|
||||||
|
PL_NotYetImplemented();
|
||||||
|
|
||||||
|
constrainedRect = constrainedRect.Intersect(region.rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
constrainedRect = constrainedRect.Intersect(lineRect);
|
||||||
|
|
||||||
|
if (!constrainedRect.IsValid())
|
||||||
|
return;
|
||||||
|
|
||||||
|
PortabilityLayer::Vec2i upperPoint = pointA;
|
||||||
|
PortabilityLayer::Vec2i lowerPoint = pointB;
|
||||||
|
|
||||||
|
if (pointA.m_y > pointB.m_y)
|
||||||
|
std::swap(upperPoint, lowerPoint);
|
||||||
|
|
||||||
|
PortabilityLayer::PixMapImpl *pixMap = static_cast<PortabilityLayer::PixMapImpl*>(*qdPort->GetPixMap());
|
||||||
|
const size_t pitch = pixMap->GetPitch();
|
||||||
|
uint8_t *pixData = static_cast<uint8_t*>(pixMap->GetPixelData());
|
||||||
|
|
||||||
|
PortabilityLayer::LinePlotter plotter;
|
||||||
|
plotter.Reset(upperPoint, lowerPoint);
|
||||||
|
|
||||||
|
PortabilityLayer::Vec2i currentPoint = pointA;
|
||||||
|
while (currentPoint.m_x < constrainedRect.left || currentPoint.m_y < constrainedRect.top || currentPoint.m_x >= constrainedRect.right)
|
||||||
|
{
|
||||||
|
PortabilityLayer::PlotDirection plotDir = plotter.PlotNext();
|
||||||
|
if (plotDir == PortabilityLayer::PlotDirection_Exhausted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
currentPoint = plotter.GetPoint();
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(currentPoint.m_y < constrainedRect.bottom);
|
||||||
|
|
||||||
|
size_t plotIndex = static_cast<size_t>(currentPoint.m_y) * pitch + static_cast<size_t>(currentPoint.m_x);
|
||||||
|
const size_t plotLimit = pixMap->GetPitch() * (pixMap->m_rect.bottom - pixMap->m_rect.top);
|
||||||
|
|
||||||
|
switch (pixelFormat)
|
||||||
|
{
|
||||||
|
case GpPixelFormats::k8BitStandard:
|
||||||
|
{
|
||||||
|
const size_t pixelSize = 1;
|
||||||
|
const uint8_t color = qdState->ResolveForeColor8(nullptr, 0);
|
||||||
|
|
||||||
|
while (currentPoint.m_x >= constrainedRect.left && currentPoint.m_x < constrainedRect.right && currentPoint.m_y < constrainedRect.bottom)
|
||||||
|
{
|
||||||
|
assert(plotIndex < plotLimit);
|
||||||
|
pixData[plotIndex] = color;
|
||||||
|
|
||||||
|
PortabilityLayer::PlotDirection plotDir = plotter.PlotNext();
|
||||||
|
if (plotDir == PortabilityLayer::PlotDirection_Exhausted)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (plotDir)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case PortabilityLayer::PlotDirection_Exhausted:
|
||||||
|
return;
|
||||||
|
|
||||||
|
case PortabilityLayer::PlotDirection_NegX_NegY:
|
||||||
|
case PortabilityLayer::PlotDirection_0X_NegY:
|
||||||
|
case PortabilityLayer::PlotDirection_PosX_NegY:
|
||||||
|
// These should never happen, the point order is swapped so that Y is always 0 or positive
|
||||||
|
assert(false);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case PortabilityLayer::PlotDirection_NegX_PosY:
|
||||||
|
currentPoint.m_x--;
|
||||||
|
currentPoint.m_y++;
|
||||||
|
plotIndex = plotIndex + pitch - pixelSize;
|
||||||
|
break;
|
||||||
|
case PortabilityLayer::PlotDirection_0X_PosY:
|
||||||
|
currentPoint.m_y++;
|
||||||
|
plotIndex = plotIndex + pitch;
|
||||||
|
break;
|
||||||
|
case PortabilityLayer::PlotDirection_PosX_PosY:
|
||||||
|
currentPoint.m_x++;
|
||||||
|
currentPoint.m_y++;
|
||||||
|
plotIndex = plotIndex + pitch + pixelSize;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PortabilityLayer::PlotDirection_NegX_0Y:
|
||||||
|
currentPoint.m_x--;
|
||||||
|
plotIndex = plotIndex - pixelSize;
|
||||||
|
break;
|
||||||
|
case PortabilityLayer::PlotDirection_PosX_0Y:
|
||||||
|
currentPoint.m_x++;
|
||||||
|
plotIndex = plotIndex + pixelSize;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
PL_NotYetImplemented();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LineTo(int x, int y)
|
void LineTo(int x, int y)
|
||||||
{
|
{
|
||||||
PL_NotYetImplemented_TODO("Polys");
|
PortabilityLayer::QDManager *qdManager = PortabilityLayer::QDManager::GetInstance();
|
||||||
|
PortabilityLayer::QDState *qdState = qdManager->GetState();
|
||||||
|
|
||||||
|
PlotLine(qdState, qdManager->GetPort(), PortabilityLayer::Vec2i(qdState->m_penPos.h, qdState->m_penPos.v), PortabilityLayer::Vec2i(x, y));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetOrigin(int x, int y)
|
void SetOrigin(int x, int y)
|
||||||
@@ -216,9 +344,7 @@ void GetForeColor(RGBColor *color)
|
|||||||
|
|
||||||
void Index2Color(int index, RGBColor *color)
|
void Index2Color(int index, RGBColor *color)
|
||||||
{
|
{
|
||||||
PortabilityLayer::QDPort *port;
|
PortabilityLayer::QDPort *port = PortabilityLayer::QDManager::GetInstance()->GetPort();
|
||||||
|
|
||||||
PortabilityLayer::QDManager::GetInstance()->GetPort(&port, nullptr);
|
|
||||||
|
|
||||||
GpPixelFormat_t pf = port->GetPixelFormat();
|
GpPixelFormat_t pf = port->GetPixelFormat();
|
||||||
if (pf == GpPixelFormats::k8BitCustom)
|
if (pf == GpPixelFormats::k8BitCustom)
|
||||||
@@ -315,8 +441,7 @@ void DrawString(const PLPasStr &str)
|
|||||||
{
|
{
|
||||||
PortabilityLayer::QDManager *qdManager = PortabilityLayer::QDManager::GetInstance();
|
PortabilityLayer::QDManager *qdManager = PortabilityLayer::QDManager::GetInstance();
|
||||||
|
|
||||||
PortabilityLayer::QDPort *port = nullptr;
|
PortabilityLayer::QDPort *port = qdManager->GetPort();
|
||||||
qdManager->GetPort(&port, nullptr);
|
|
||||||
|
|
||||||
PortabilityLayer::QDState *qdState = qdManager->GetState();
|
PortabilityLayer::QDState *qdState = qdManager->GetState();
|
||||||
|
|
||||||
@@ -368,17 +493,16 @@ void DrawString(const PLPasStr &str)
|
|||||||
DrawGlyph(qdState, pixMap, rect, penPos, rfont, chars[i]);
|
DrawGlyph(qdState, pixMap, rect, penPos, rfont, chars[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PaintRect(const Rect *rect)
|
void PaintRectWithPCR(const Rect &rect, PaintColorResolution pcr)
|
||||||
{
|
{
|
||||||
if (!rect->IsValid())
|
if (!rect.IsValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PortabilityLayer::QDPort *qdPort;
|
PortabilityLayer::QDPort *qdPort = PortabilityLayer::QDManager::GetInstance()->GetPort();
|
||||||
PortabilityLayer::QDManager::GetInstance()->GetPort(&qdPort, nullptr);
|
|
||||||
|
|
||||||
GpPixelFormat_t pixelFormat = qdPort->GetPixelFormat();
|
GpPixelFormat_t pixelFormat = qdPort->GetPixelFormat();
|
||||||
|
|
||||||
Rect constrainedRect = *rect;
|
Rect constrainedRect = rect;
|
||||||
|
|
||||||
PortabilityLayer::QDState *qdState = qdPort->GetState();
|
PortabilityLayer::QDState *qdState = qdPort->GetState();
|
||||||
|
|
||||||
@@ -408,7 +532,19 @@ void PaintRect(const Rect *rect)
|
|||||||
{
|
{
|
||||||
case GpPixelFormats::k8BitStandard:
|
case GpPixelFormats::k8BitStandard:
|
||||||
{
|
{
|
||||||
const uint8_t color = qdState->ResolveForeColor8(nullptr, 0);
|
uint8_t color = 0;
|
||||||
|
switch (pcr)
|
||||||
|
{
|
||||||
|
case PaintColorResolution_Fore:
|
||||||
|
color = qdState->ResolveForeColor8(nullptr, 0);
|
||||||
|
break;
|
||||||
|
case PaintColorResolution_Back:
|
||||||
|
color = qdState->ResolveBackColor8(nullptr, 0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
size_t scanlineIndex = 0;
|
size_t scanlineIndex = 0;
|
||||||
for (size_t ln = 0; ln < numLines; ln++)
|
for (size_t ln = 0; ln < numLines; ln++)
|
||||||
@@ -425,6 +561,12 @@ void PaintRect(const Rect *rect)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PaintRect(const Rect *rect)
|
||||||
|
{
|
||||||
|
PaintRectWithPCR(*rect, PaintColorResolution_Fore);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void PaintOval(const Rect *rect)
|
void PaintOval(const Rect *rect)
|
||||||
{
|
{
|
||||||
PL_NotYetImplemented_TODO("Ovals");
|
PL_NotYetImplemented_TODO("Ovals");
|
||||||
@@ -462,14 +604,16 @@ void FrameRoundRect(const Rect *rect, int w, int h)
|
|||||||
PL_NotYetImplemented_TODO("Ovals");
|
PL_NotYetImplemented_TODO("Ovals");
|
||||||
}
|
}
|
||||||
|
|
||||||
void PenMode(CopyBitsMode copyBitsMode)
|
void PenInvertMode(bool invertMode)
|
||||||
{
|
{
|
||||||
PL_NotYetImplemented();
|
PortabilityLayer::QDState *qdState = PortabilityLayer::QDManager::GetInstance()->GetState();
|
||||||
|
qdState->m_penInvert = invertMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PenMode(PenModeID penMode)
|
void PenMask(bool maskMode)
|
||||||
{
|
{
|
||||||
PL_NotYetImplemented_TODO("Polys");
|
PortabilityLayer::QDState *qdState = PortabilityLayer::QDManager::GetInstance()->GetState();
|
||||||
|
qdState->m_penMask = maskMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PenPat(const Pattern *pattern)
|
void PenPat(const Pattern *pattern)
|
||||||
@@ -484,7 +628,9 @@ void PenSize(int w, int h)
|
|||||||
|
|
||||||
void PenNormal()
|
void PenNormal()
|
||||||
{
|
{
|
||||||
PL_NotYetImplemented_TODO("Polys");
|
PortabilityLayer::QDState *qdState = PortabilityLayer::QDManager::GetInstance()->GetState();
|
||||||
|
qdState->m_penInvert = false;
|
||||||
|
qdState->m_penMask = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EraseRect(const Rect *rect)
|
void EraseRect(const Rect *rect)
|
||||||
@@ -507,7 +653,18 @@ void InsetRect(Rect *rect, int x, int y)
|
|||||||
|
|
||||||
void Line(int x, int y)
|
void Line(int x, int y)
|
||||||
{
|
{
|
||||||
PL_NotYetImplemented_TODO("Polys");
|
PortabilityLayer::QDManager *qdManager = PortabilityLayer::QDManager::GetInstance();
|
||||||
|
PortabilityLayer::QDState *qdState = qdManager->GetState();
|
||||||
|
|
||||||
|
const PortabilityLayer::Vec2i oldPos = PortabilityLayer::Vec2i(qdState->m_penPos.h, qdState->m_penPos.v);
|
||||||
|
|
||||||
|
qdState->m_penPos.h += x;
|
||||||
|
qdState->m_penPos.v += y;
|
||||||
|
|
||||||
|
const PortabilityLayer::Vec2i newPos = PortabilityLayer::Vec2i(qdState->m_penPos.h, qdState->m_penPos.v);
|
||||||
|
|
||||||
|
PlotLine(qdState, qdManager->GetPort(), oldPos, newPos);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Pattern *GetQDGlobalsGray(Pattern *pattern)
|
Pattern *GetQDGlobalsGray(Pattern *pattern)
|
||||||
@@ -555,6 +712,7 @@ static void CopyBitsComplete(const BitMap *srcBitmap, const BitMap *maskBitmap,
|
|||||||
const GpPixelFormat_t pixelFormat = srcBitmap->m_pixelFormat;
|
const GpPixelFormat_t pixelFormat = srcBitmap->m_pixelFormat;
|
||||||
const size_t srcPitch = srcBitmap->m_pitch;
|
const size_t srcPitch = srcBitmap->m_pitch;
|
||||||
const size_t destPitch = destBitmap->m_pitch;
|
const size_t destPitch = destBitmap->m_pitch;
|
||||||
|
const size_t maskPitch = (maskBitmap != nullptr) ? maskBitmap->m_pitch : 0;
|
||||||
|
|
||||||
if (srcRectBase->right - srcRectBase->left != destRectBase->right - destRectBase->left ||
|
if (srcRectBase->right - srcRectBase->left != destRectBase->right - destRectBase->left ||
|
||||||
srcRectBase->bottom - srcRectBase->top != destRectBase->bottom - destRectBase->top)
|
srcRectBase->bottom - srcRectBase->top != destRectBase->bottom - destRectBase->top)
|
||||||
@@ -566,7 +724,8 @@ static void CopyBitsComplete(const BitMap *srcBitmap, const BitMap *maskBitmap,
|
|||||||
if (maskBitmap)
|
if (maskBitmap)
|
||||||
{
|
{
|
||||||
assert(maskRectBase);
|
assert(maskRectBase);
|
||||||
assert(maskRectBase->right - maskRectBase->left == destRectBase->right - destRectBase->left);
|
assert(maskRectBase->right - maskRectBase->left == srcRectBase->right - srcRectBase->left);
|
||||||
|
assert(maskBitmap->m_pixelFormat == GpPixelFormats::kBW1 || maskBitmap->m_pixelFormat == GpPixelFormats::k8BitStandard);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert((maskBitmap == nullptr) == (maskRectBase == nullptr));
|
assert((maskBitmap == nullptr) == (maskRectBase == nullptr));
|
||||||
@@ -589,6 +748,15 @@ static void CopyBitsComplete(const BitMap *srcBitmap, const BitMap *maskBitmap,
|
|||||||
const int32_t srcTop = srcRectBase->top + topNudge;
|
const int32_t srcTop = srcRectBase->top + topNudge;
|
||||||
const int32_t srcBottom = srcRectBase->bottom + bottomNudge;
|
const int32_t srcBottom = srcRectBase->bottom + bottomNudge;
|
||||||
|
|
||||||
|
maskRect = Rect::Create(0, 0, 0, 0);
|
||||||
|
if (maskRectBase)
|
||||||
|
{
|
||||||
|
maskRect.left = maskRectBase->left + leftNudge;
|
||||||
|
maskRect.right = maskRectBase->right + rightNudge;
|
||||||
|
maskRect.top = maskRectBase->top + topNudge;
|
||||||
|
maskRect.bottom = maskRectBase->bottom + bottomNudge;
|
||||||
|
}
|
||||||
|
|
||||||
if (srcTop >= srcBottom)
|
if (srcTop >= srcBottom)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -639,12 +807,24 @@ static void CopyBitsComplete(const BitMap *srcBitmap, const BitMap *maskBitmap,
|
|||||||
constrainedSrcRect.top += constrainedDestRect.top - destRect.top;
|
constrainedSrcRect.top += constrainedDestRect.top - destRect.top;
|
||||||
constrainedSrcRect.bottom += constrainedDestRect.bottom - destRect.bottom;
|
constrainedSrcRect.bottom += constrainedDestRect.bottom - destRect.bottom;
|
||||||
|
|
||||||
|
Rect constrainedMaskRect = maskRect;
|
||||||
|
if (maskRectBase != nullptr)
|
||||||
|
{
|
||||||
|
constrainedMaskRect.left += constrainedDestRect.left - destRect.left;
|
||||||
|
constrainedMaskRect.right += constrainedDestRect.right - destRect.right;
|
||||||
|
constrainedMaskRect.top += constrainedDestRect.top - destRect.top;
|
||||||
|
constrainedMaskRect.bottom += constrainedDestRect.bottom - destRect.bottom;
|
||||||
|
}
|
||||||
|
|
||||||
const size_t srcFirstCol = constrainedSrcRect.left - srcBitmap->m_rect.left;
|
const size_t srcFirstCol = constrainedSrcRect.left - srcBitmap->m_rect.left;
|
||||||
const size_t srcFirstRow = constrainedSrcRect.top - srcBitmap->m_rect.top;
|
const size_t srcFirstRow = constrainedSrcRect.top - srcBitmap->m_rect.top;
|
||||||
|
|
||||||
const size_t destFirstCol = constrainedDestRect.left - destBitmap->m_rect.left;
|
const size_t destFirstCol = constrainedDestRect.left - destBitmap->m_rect.left;
|
||||||
const size_t destFirstRow = constrainedDestRect.top - destBitmap->m_rect.top;
|
const size_t destFirstRow = constrainedDestRect.top - destBitmap->m_rect.top;
|
||||||
|
|
||||||
|
const size_t maskFirstCol = maskBitmap ? constrainedMaskRect.left - maskBitmap->m_rect.left : 0;
|
||||||
|
const size_t maskFirstRow = maskBitmap ? constrainedMaskRect.top - maskBitmap->m_rect.top : 0;
|
||||||
|
|
||||||
if (mask && mask->size != sizeof(Region))
|
if (mask && mask->size != sizeof(Region))
|
||||||
{
|
{
|
||||||
PL_NotYetImplemented();
|
PL_NotYetImplemented();
|
||||||
@@ -672,22 +852,65 @@ static void CopyBitsComplete(const BitMap *srcBitmap, const BitMap *maskBitmap,
|
|||||||
|
|
||||||
const uint8_t *srcBytes = static_cast<const uint8_t*>(srcBitmap->m_data);
|
const uint8_t *srcBytes = static_cast<const uint8_t*>(srcBitmap->m_data);
|
||||||
uint8_t *destBytes = static_cast<uint8_t*>(destBitmap->m_data);
|
uint8_t *destBytes = static_cast<uint8_t*>(destBitmap->m_data);
|
||||||
|
const uint8_t *maskBytes = maskBitmap ? static_cast<uint8_t*>(maskBitmap->m_data) : nullptr;
|
||||||
|
|
||||||
const size_t firstSrcByte = srcFirstRow * srcPitch + srcFirstCol * pixelSizeBytes;
|
const size_t firstSrcByte = srcFirstRow * srcPitch + srcFirstCol * pixelSizeBytes;
|
||||||
const size_t firstDestByte = destFirstRow * destPitch + destFirstCol * pixelSizeBytes;
|
const size_t firstDestByte = destFirstRow * destPitch + destFirstCol * pixelSizeBytes;
|
||||||
|
const size_t firstMaskRowByte = maskBitmap ? maskFirstRow * maskPitch : 0;
|
||||||
|
|
||||||
const size_t numCopiedRows = srcRect.bottom - srcRect.top;
|
const size_t numCopiedRows = srcRect.bottom - srcRect.top;
|
||||||
const size_t numCopiedCols = srcRect.right - srcRect.left;
|
const size_t numCopiedCols = srcRect.right - srcRect.left;
|
||||||
const size_t numCopiedBytesPerScanline = numCopiedCols * pixelSizeBytes;
|
const size_t numCopiedBytesPerScanline = numCopiedCols * pixelSizeBytes;
|
||||||
|
|
||||||
for (size_t i = 0; i < numCopiedRows; i++)
|
if (maskBitmap)
|
||||||
memcpy(destBytes + firstDestByte + i * destPitch, srcBytes + firstSrcByte + i * srcPitch, numCopiedBytesPerScanline);
|
{
|
||||||
|
for (size_t i = 0; i < numCopiedRows; i++)
|
||||||
|
{
|
||||||
|
uint8_t *destRow = destBytes + firstDestByte + i * destPitch;
|
||||||
|
const uint8_t *srcRow = srcBytes + firstSrcByte + i * srcPitch;
|
||||||
|
const uint8_t *rowMaskBytes = maskBytes + firstMaskRowByte + i * maskPitch;
|
||||||
|
|
||||||
|
size_t span = 0;
|
||||||
|
|
||||||
|
for (size_t col = 0; col < numCopiedCols; col++)
|
||||||
|
{
|
||||||
|
const size_t maskBitOffset = maskFirstCol + col;
|
||||||
|
//const bool maskBit = ((maskBytes[maskBitOffset / 8] & (0x80 >> (maskBitOffset & 7))) != 0);
|
||||||
|
const bool maskBit = (rowMaskBytes[maskBitOffset] != 0);
|
||||||
|
if (maskBit)
|
||||||
|
span += pixelSizeBytes;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (span != 0)
|
||||||
|
memcpy(destRow + col * pixelSizeBytes - span, srcRow + col * pixelSizeBytes - span, span);
|
||||||
|
|
||||||
|
span = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (span != 0)
|
||||||
|
memcpy(destRow + numCopiedCols * pixelSizeBytes - span, srcRow + numCopiedCols * pixelSizeBytes - span, span);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < numCopiedRows; i++)
|
||||||
|
memcpy(destBytes + firstDestByte + i * destPitch, srcBytes + firstSrcByte + i * srcPitch, numCopiedBytesPerScanline);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyBits(const BitMap *srcBitmap, BitMap *destBitmap, const Rect *srcRectBase, const Rect *destRectBase, CopyBitsMode copyMode, RgnHandle maskRegion)
|
void CopyBits(const BitMap *srcBitmap, BitMap *destBitmap, const Rect *srcRectBase, const Rect *destRectBase, CopyBitsMode copyMode, RgnHandle maskRegion)
|
||||||
{
|
{
|
||||||
CopyBitsComplete(srcBitmap, nullptr, destBitmap, srcRectBase, nullptr, destRectBase, maskRegion);
|
const BitMap *maskBitmap = nullptr;
|
||||||
|
const Rect *maskRect = nullptr;
|
||||||
|
if (copyMode == transparent && srcBitmap->m_pixelFormat == GpPixelFormats::k8BitStandard)
|
||||||
|
{
|
||||||
|
maskBitmap = srcBitmap;
|
||||||
|
maskRect = srcRectBase;
|
||||||
|
}
|
||||||
|
|
||||||
|
CopyBitsComplete(srcBitmap, maskBitmap, destBitmap, srcRectBase, maskRect, destRectBase, maskRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyMask(const BitMap *srcBitmap, const BitMap *maskBitmap, BitMap *destBitmap, const Rect *srcRectBase, const Rect *maskRectBase, const Rect *destRectBase)
|
void CopyMask(const BitMap *srcBitmap, const BitMap *maskBitmap, BitMap *destBitmap, const Rect *srcRectBase, const Rect *maskRectBase, const Rect *destRectBase)
|
||||||
|
|||||||
@@ -56,8 +56,9 @@ enum CopyBitsMode
|
|||||||
|
|
||||||
enum PenModeID
|
enum PenModeID
|
||||||
{
|
{
|
||||||
patOr = transparent + 1,
|
PenMode_Solid,
|
||||||
patXor,
|
PenMode_Pattern,
|
||||||
|
PenMode_PatternInvert,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CIcon
|
struct CIcon
|
||||||
@@ -81,9 +82,6 @@ struct RGBColor
|
|||||||
unsigned short blue;
|
unsigned short blue;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef GDevice *GDPtr;
|
|
||||||
typedef GDPtr *GDHandle;
|
|
||||||
|
|
||||||
typedef CIcon *CIconPtr;
|
typedef CIcon *CIconPtr;
|
||||||
typedef CIconPtr *CIconHandle;
|
typedef CIconPtr *CIconHandle;
|
||||||
|
|
||||||
@@ -109,8 +107,6 @@ void DisposeCIcon(CIconHandle icon);
|
|||||||
|
|
||||||
void SetRect(Rect *rect, short left, short top, short right, short bottom);
|
void SetRect(Rect *rect, short left, short top, short right, short bottom);
|
||||||
|
|
||||||
GDHandle GetMainDevice();
|
|
||||||
|
|
||||||
void TextSize(int sz);
|
void TextSize(int sz);
|
||||||
void TextFace(int face);
|
void TextFace(int face);
|
||||||
void TextFont(int fontID);
|
void TextFont(int fontID);
|
||||||
@@ -132,8 +128,8 @@ void ClipRect(const Rect *rect); // Sets the clipping area
|
|||||||
void FrameRect(const Rect *rect);
|
void FrameRect(const Rect *rect);
|
||||||
void FrameOval(const Rect *rect);
|
void FrameOval(const Rect *rect);
|
||||||
void FrameRoundRect(const Rect *rect, int w, int h);
|
void FrameRoundRect(const Rect *rect, int w, int h);
|
||||||
void PenMode(CopyBitsMode copyBitsMode);
|
void PenInvertMode(bool invertMode);
|
||||||
void PenMode(PenModeID mode);
|
void PenMask(bool maskMode);
|
||||||
void PenPat(const Pattern *pattern);
|
void PenPat(const Pattern *pattern);
|
||||||
void PenSize(int w, int h);
|
void PenSize(int w, int h);
|
||||||
void PenNormal();
|
void PenNormal();
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ namespace PortabilityLayer
|
|||||||
QDManagerImpl();
|
QDManagerImpl();
|
||||||
|
|
||||||
void Init() override;
|
void Init() override;
|
||||||
void GetPort(QDPort **port, GDevice ***gdHandle) override;
|
QDPort *GetPort() const override;
|
||||||
void SetPort(QDPort *gw, GDevice **gdHandle) override;
|
void SetPort(QDPort *gw) override;
|
||||||
int NewGWorld(CGraf **gw, int depth, const Rect &bounds, ColorTable **colorTable, GDevice **device, int flags) override;
|
int NewGWorld(CGraf **gw, int depth, const Rect &bounds, ColorTable **colorTable, int flags) override;
|
||||||
void DisposeGWorld(CGraf *gw) override;
|
void DisposeGWorld(CGraf *gw) override;
|
||||||
QDState *GetState() override;
|
QDState *GetState() override;
|
||||||
|
|
||||||
@@ -28,14 +28,12 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QDPort *m_port;
|
QDPort *m_port;
|
||||||
GDHandle m_gdHandle;
|
|
||||||
|
|
||||||
static QDManagerImpl ms_instance;
|
static QDManagerImpl ms_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
QDManagerImpl::QDManagerImpl()
|
QDManagerImpl::QDManagerImpl()
|
||||||
: m_port(nullptr)
|
: m_port(nullptr)
|
||||||
, m_gdHandle(nullptr)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,21 +41,17 @@ namespace PortabilityLayer
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDManagerImpl::GetPort(QDPort **port, GDevice ***gdHandle)
|
QDPort *QDManagerImpl::GetPort() const
|
||||||
{
|
{
|
||||||
if (port)
|
return m_port;
|
||||||
*port = m_port;
|
|
||||||
if (gdHandle)
|
|
||||||
*gdHandle = m_gdHandle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QDManagerImpl::SetPort(QDPort *gw, GDevice **gdHandle)
|
void QDManagerImpl::SetPort(QDPort *gw)
|
||||||
{
|
{
|
||||||
m_port = gw;
|
m_port = gw;
|
||||||
m_gdHandle = gdHandle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int QDManagerImpl::NewGWorld(CGraf **gw, int depth, const Rect &bounds, ColorTable **colorTable, GDevice **device, int flags)
|
int QDManagerImpl::NewGWorld(CGraf **gw, int depth, const Rect &bounds, ColorTable **colorTable, int flags)
|
||||||
{
|
{
|
||||||
GpPixelFormat_t pixelFormat;
|
GpPixelFormat_t pixelFormat;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
struct ColorTable;
|
struct ColorTable;
|
||||||
struct CGraf;
|
struct CGraf;
|
||||||
struct GDevice;
|
|
||||||
struct Rect;
|
struct Rect;
|
||||||
|
|
||||||
namespace PortabilityLayer
|
namespace PortabilityLayer
|
||||||
@@ -16,9 +15,9 @@ namespace PortabilityLayer
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void Init() = 0;
|
virtual void Init() = 0;
|
||||||
virtual void GetPort(QDPort **gw, GDevice ***gdHandle) = 0;
|
virtual QDPort *GetPort() const = 0;
|
||||||
virtual void SetPort(QDPort *gw, GDevice **gdHandle) = 0;
|
virtual void SetPort(QDPort *gw) = 0;
|
||||||
virtual int NewGWorld(CGraf **gw, int depth, const Rect &bounds, ColorTable **colorTable, GDevice **device, int flags) = 0;
|
virtual int NewGWorld(CGraf **gw, int depth, const Rect &bounds, ColorTable **colorTable, int flags) = 0;
|
||||||
virtual void DisposeGWorld(CGraf *gw) = 0;
|
virtual void DisposeGWorld(CGraf *gw) = 0;
|
||||||
|
|
||||||
virtual QDState *GetState() = 0;
|
virtual QDState *GetState() = 0;
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ namespace PortabilityLayer
|
|||||||
, m_isForeResolved8(false)
|
, m_isForeResolved8(false)
|
||||||
, m_isBackResolved8(false)
|
, m_isBackResolved8(false)
|
||||||
, m_clipRegion(nullptr)
|
, m_clipRegion(nullptr)
|
||||||
|
, m_penInvert(false)
|
||||||
|
, m_penMask(false)
|
||||||
{
|
{
|
||||||
m_backUnresolvedColor.r = m_backUnresolvedColor.g = m_backUnresolvedColor.b = m_backUnresolvedColor.a = 255;
|
m_backUnresolvedColor.r = m_backUnresolvedColor.g = m_backUnresolvedColor.b = m_backUnresolvedColor.a = 255;
|
||||||
m_foreUnresolvedColor.r = m_foreUnresolvedColor.g = m_foreUnresolvedColor.b = 0;
|
m_foreUnresolvedColor.r = m_foreUnresolvedColor.g = m_foreUnresolvedColor.b = 0;
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ namespace PortabilityLayer
|
|||||||
int m_textSize;
|
int m_textSize;
|
||||||
Region **m_clipRegion;
|
Region **m_clipRegion;
|
||||||
Point m_penPos;
|
Point m_penPos;
|
||||||
|
bool m_penInvert;
|
||||||
|
bool m_penMask;
|
||||||
|
|
||||||
void SetForeColor(const RGBAColor &color);
|
void SetForeColor(const RGBAColor &color);
|
||||||
void SetBackColor(const RGBAColor &color);
|
void SetBackColor(const RGBAColor &color);
|
||||||
|
|||||||
@@ -6,6 +6,19 @@ namespace PortabilityLayer
|
|||||||
{
|
{
|
||||||
struct RGBAColor
|
struct RGBAColor
|
||||||
{
|
{
|
||||||
uint8_t r, g, b, a;
|
uint8_t r, g, b, a;
|
||||||
};
|
|
||||||
|
static RGBAColor Create(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
|
||||||
|
};
|
||||||
|
|
||||||
|
inline RGBAColor RGBAColor::Create(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
|
||||||
|
{
|
||||||
|
RGBAColor color;
|
||||||
|
color.r = r;
|
||||||
|
color.g = g;
|
||||||
|
color.b = b;
|
||||||
|
color.a = a;
|
||||||
|
|
||||||
|
return color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,12 +143,12 @@ namespace PortabilityLayer
|
|||||||
m_bottomRight.m_x = i;
|
m_bottomRight.m_x = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Rect2i::IsValid() const
|
inline bool Rect2i::IsValid() const
|
||||||
{
|
{
|
||||||
return m_bottomRight.m_x >= m_topLeft.m_x && m_bottomRight.m_y >= m_topLeft.m_y;
|
return m_bottomRight.m_x >= m_topLeft.m_x && m_bottomRight.m_y >= m_topLeft.m_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect2i Rect2i::Intersect(const Rect2i &other) const
|
inline Rect2i Rect2i::Intersect(const Rect2i &other) const
|
||||||
{
|
{
|
||||||
const int32_t top = std::max(m_topLeft.m_y, other.m_topLeft.m_y);
|
const int32_t top = std::max(m_topLeft.m_y, other.m_topLeft.m_y);
|
||||||
const int32_t left = std::max(m_topLeft.m_x, other.m_topLeft.m_x);
|
const int32_t left = std::max(m_topLeft.m_x, other.m_topLeft.m_x);
|
||||||
@@ -158,7 +158,7 @@ namespace PortabilityLayer
|
|||||||
return Rect2i(top, left, bottom, right);
|
return Rect2i(top, left, bottom, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect Rect2i::ToShortRect() const
|
inline Rect Rect2i::ToShortRect() const
|
||||||
{
|
{
|
||||||
return Rect::Create(static_cast<int16_t>(m_topLeft.m_y), static_cast<int16_t>(m_topLeft.m_x), static_cast<int16_t>(m_bottomRight.m_y), static_cast<int16_t>(m_bottomRight.m_x));
|
return Rect::Create(static_cast<int16_t>(m_topLeft.m_y), static_cast<int16_t>(m_topLeft.m_x), static_cast<int16_t>(m_bottomRight.m_y), static_cast<int16_t>(m_bottomRight.m_x));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace PortabilityLayer
|
|||||||
WindowImpl();
|
WindowImpl();
|
||||||
~WindowImpl();
|
~WindowImpl();
|
||||||
|
|
||||||
bool Init(const WindowDef &windowDef, GDevice **device);
|
bool Init(const WindowDef &windowDef);
|
||||||
bool Resize(int width, int height);
|
bool Resize(int width, int height);
|
||||||
|
|
||||||
WindowImpl *GetWindowAbove() const;
|
WindowImpl *GetWindowAbove() const;
|
||||||
@@ -38,12 +38,9 @@ namespace PortabilityLayer
|
|||||||
bool IsVisible() const;
|
bool IsVisible() const;
|
||||||
void SetVisible(bool visible);
|
void SetVisible(bool visible);
|
||||||
|
|
||||||
GDevice **GetDevice() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WindowImpl *m_windowAbove;
|
WindowImpl *m_windowAbove;
|
||||||
WindowImpl *m_windowBelow;
|
WindowImpl *m_windowBelow;
|
||||||
GDevice **m_device;
|
|
||||||
|
|
||||||
bool m_visible;
|
bool m_visible;
|
||||||
};
|
};
|
||||||
@@ -59,7 +56,6 @@ namespace PortabilityLayer
|
|||||||
void PutWindowBehind(Window *window, Window *otherWindow) override;
|
void PutWindowBehind(Window *window, Window *otherWindow) override;
|
||||||
void ShowWindow(Window *window) override;
|
void ShowWindow(Window *window) override;
|
||||||
void HideWindow(Window *window) override;
|
void HideWindow(Window *window) override;
|
||||||
GDevice **GetWindowDevice(Window *window) override;
|
|
||||||
void FindWindow(const Point &point, Window **outWindow, short *outRegion) const override;
|
void FindWindow(const Point &point, Window **outWindow, short *outRegion) const override;
|
||||||
|
|
||||||
void RenderFrame(IGpDisplayDriver *displayDriver) override;
|
void RenderFrame(IGpDisplayDriver *displayDriver) override;
|
||||||
@@ -82,7 +78,6 @@ namespace PortabilityLayer
|
|||||||
WindowImpl::WindowImpl()
|
WindowImpl::WindowImpl()
|
||||||
: m_windowAbove(nullptr)
|
: m_windowAbove(nullptr)
|
||||||
, m_windowBelow(nullptr)
|
, m_windowBelow(nullptr)
|
||||||
, m_device(nullptr)
|
|
||||||
, m_visible(true)
|
, m_visible(true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -92,7 +87,7 @@ namespace PortabilityLayer
|
|||||||
PL_NotYetImplemented();
|
PL_NotYetImplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WindowImpl::Init(const WindowDef &windowDef, GDevice **device)
|
bool WindowImpl::Init(const WindowDef &windowDef)
|
||||||
{
|
{
|
||||||
const Rect bounds = windowDef.m_initialRect;
|
const Rect bounds = windowDef.m_initialRect;
|
||||||
|
|
||||||
@@ -101,10 +96,10 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
const Rect adjustedBounds = Rect::Create(0, 0, bounds.bottom - bounds.top, bounds.right - bounds.left);
|
const Rect adjustedBounds = Rect::Create(0, 0, bounds.bottom - bounds.top, bounds.right - bounds.left);
|
||||||
|
|
||||||
if (int errorCode = m_graf.Init(adjustedBounds, (*device)->pixelFormat))
|
GpPixelFormat_t pixelFormat = PortabilityLayer::DisplayDeviceManager::GetInstance()->GetPixelFormat();
|
||||||
return false;
|
|
||||||
|
|
||||||
m_device = device;
|
if (int errorCode = m_graf.Init(adjustedBounds, pixelFormat))
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -148,11 +143,6 @@ namespace PortabilityLayer
|
|||||||
m_visible = visible;
|
m_visible = visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
GDevice **WindowImpl::GetDevice() const
|
|
||||||
{
|
|
||||||
return m_device;
|
|
||||||
}
|
|
||||||
|
|
||||||
WindowManagerImpl::WindowManagerImpl()
|
WindowManagerImpl::WindowManagerImpl()
|
||||||
: m_windowStackTop(nullptr)
|
: m_windowStackTop(nullptr)
|
||||||
, m_windowStackBottom(nullptr)
|
, m_windowStackBottom(nullptr)
|
||||||
@@ -165,14 +155,12 @@ namespace PortabilityLayer
|
|||||||
if (!windowMem)
|
if (!windowMem)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
GDevice **device = DisplayDeviceManager::GetInstance()->GetMainDevice();
|
|
||||||
|
|
||||||
Rect portRect = windowDef.m_initialRect;
|
Rect portRect = windowDef.m_initialRect;
|
||||||
if (!portRect.IsValid())
|
if (!portRect.IsValid())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
WindowImpl *window = new (windowMem) WindowImpl();
|
WindowImpl *window = new (windowMem) WindowImpl();
|
||||||
if (!window->Init(windowDef, device))
|
if (!window->Init(windowDef))
|
||||||
{
|
{
|
||||||
window->~WindowImpl();
|
window->~WindowImpl();
|
||||||
MemoryManager::GetInstance()->Release(windowMem);
|
MemoryManager::GetInstance()->Release(windowMem);
|
||||||
@@ -243,11 +231,6 @@ namespace PortabilityLayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GDevice **WindowManagerImpl::GetWindowDevice(Window *window)
|
|
||||||
{
|
|
||||||
return static_cast<WindowImpl*>(window)->GetDevice();
|
|
||||||
}
|
|
||||||
|
|
||||||
void WindowManagerImpl::FindWindow(const Point &point, Window **outWindow, short *outRegion) const
|
void WindowManagerImpl::FindWindow(const Point &point, Window **outWindow, short *outRegion) const
|
||||||
{
|
{
|
||||||
// outRegion = One of:
|
// outRegion = One of:
|
||||||
@@ -304,24 +287,15 @@ namespace PortabilityLayer
|
|||||||
|
|
||||||
void WindowManagerImpl::RenderFrame(IGpDisplayDriver *displayDriver)
|
void WindowManagerImpl::RenderFrame(IGpDisplayDriver *displayDriver)
|
||||||
{
|
{
|
||||||
GDevice **mainDeviceHdl = PortabilityLayer::DisplayDeviceManager::GetInstance()->GetMainDevice();
|
PortabilityLayer::DisplayDeviceManager *dd = PortabilityLayer::DisplayDeviceManager::GetInstance();
|
||||||
|
|
||||||
if (mainDeviceHdl)
|
dd->SyncPalette(displayDriver);
|
||||||
|
|
||||||
|
WindowImpl *window = m_windowStackBottom;
|
||||||
|
while (window)
|
||||||
{
|
{
|
||||||
GDevice *mainDevice = *mainDeviceHdl;
|
RenderWindow(window, displayDriver);
|
||||||
|
window = window->GetWindowAbove();
|
||||||
if (mainDevice->paletteIsDirty)
|
|
||||||
{
|
|
||||||
displayDriver->UpdatePalette(mainDevice->paletteStorage + mainDevice->paletteDataOffset);
|
|
||||||
mainDevice->paletteIsDirty = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
WindowImpl *window = m_windowStackBottom;
|
|
||||||
while (window)
|
|
||||||
{
|
|
||||||
RenderWindow(window, displayDriver);
|
|
||||||
window = window->GetWindowAbove();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ namespace PortabilityLayer
|
|||||||
virtual void PutWindowBehind(Window *window, Window *otherWindow) = 0;
|
virtual void PutWindowBehind(Window *window, Window *otherWindow) = 0;
|
||||||
virtual void ShowWindow(Window *window) = 0;
|
virtual void ShowWindow(Window *window) = 0;
|
||||||
virtual void HideWindow(Window *window) = 0;
|
virtual void HideWindow(Window *window) = 0;
|
||||||
virtual GDevice **GetWindowDevice(Window *window) = 0;
|
|
||||||
virtual void FindWindow(const Point &point, Window **outWindow, short *outRegion) const = 0;
|
virtual void FindWindow(const Point &point, Window **outWindow, short *outRegion) const = 0;
|
||||||
|
|
||||||
virtual void RenderFrame(IGpDisplayDriver *displayDriver) = 0;
|
virtual void RenderFrame(IGpDisplayDriver *displayDriver) = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user