32-bit color support

This commit is contained in:
elasota
2020-06-13 04:33:41 -04:00
parent 24f43b973a
commit 4920781619
42 changed files with 1161 additions and 450 deletions

View File

@@ -68,10 +68,10 @@ void DrawBanner (Point *topLeft)
partPage.top = partPage.bottom - 30;
mapBounds = partPage;
ZeroRectCorner(&mapBounds);
theErr = CreateOffScreenGWorld(&tempMap, &mapBounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &mapBounds);
LoadGraphicCustom(tempMap, kBannerPageBottomPICT);
theErr = CreateOffScreenGWorld(&tempMask, &mapBounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &mapBounds, GpPixelFormats::kBW1);
LoadGraphicCustom(tempMask, kBannerPageBottomMask);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),

View File

@@ -82,7 +82,7 @@ short BackUpToSavedMap (Rect *theRect, SInt16 where, SInt16 who, SInt16 componen
ZeroRectCorner(&mapRect);
savedMaps[numSavedMaps].dest = *theRect;
// CreateOffScreenPixMap(&mapRect, &savedMaps[numSavedMaps].map);
theErr = CreateOffScreenGWorld(&savedMaps[numSavedMaps].map, &mapRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&savedMaps[numSavedMaps].map, &mapRect);
CopyBits((BitMap *)*GetGWorldPixMap(backSrcMap),
GetPortBitMapForCopyBits(savedMaps[numSavedMaps].map),

View File

@@ -207,30 +207,6 @@ Boolean DoWeHaveDragManager (void)
return true;
}
//-------------------------------------------------------------- WhatsOurDepth
// Determines the pixel bit depth for current device (monitor).
short WhatsOurDepth (void)
{
GpPixelFormat_t pixelFormat;
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(nil, nil, &pixelFormat);
switch (pixelFormat)
{
case GpPixelFormats::k8BitCustom:
case GpPixelFormats::k8BitStandard:
return 8;
case GpPixelFormats::kRGB555:
return 16;
case GpPixelFormats::kRGB24:
case GpPixelFormats::kRGB32:
return 32;
default:
return 0;
}
}
void SwitchToDepth (short, Boolean)
{
}
@@ -321,9 +297,6 @@ void CheckOurEnvirons (void)
thisMac.can4Bit = true;
thisMac.can8Bit = true;
thisMac.numScreens = HowManyUsableScreens(false, true, true);
thisMac.wasDepth = WhatsOurDepth();
thisMac.wasColorOrGray = AreWeColorOrGrayscale();
thisMac.isResolutionDirty = true;
FlushResolutionChange();
@@ -417,53 +390,21 @@ void ReflectSecondMonitorEnvirons (Boolean use1Bit, Boolean use4Bit, Boolean use
void HandleDepthSwitching (void)
{
if (thisMac.hasColor)
switch (isDepthPref)
{
switch (isDepthPref)
{
case kSwitchIfNeeded:
if ((thisMac.wasDepth != 8) &&
((thisMac.wasDepth != 4) || (thisMac.wasColorOrGray)))
SwitchDepthOrAbort();
break;
case kSwitchTo256Colors:
if (thisMac.wasDepth != 8)
{
if (thisMac.can8Bit)
SwitchToDepth(8, true);
else
SwitchDepthOrAbort();
}
break;
case kSwitchTo16Grays:
if ((thisMac.wasDepth != 4) || (thisMac.wasColorOrGray))
{
if (thisMac.can4Bit)
SwitchToDepth(4, false);
else
SwitchDepthOrAbort();
}
break;
default:
break;
}
case 32:
PortabilityLayer::DisplayDeviceManager::GetInstance()->SetPixelFormat(GpPixelFormats::kRGB32);
break;
case 8:
PortabilityLayer::DisplayDeviceManager::GetInstance()->SetPixelFormat(GpPixelFormats::k8BitStandard);
break;
default:
isDepthPref = 8;
PortabilityLayer::DisplayDeviceManager::GetInstance()->SetPixelFormat(GpPixelFormats::k8BitStandard);
break;
}
thisMac.isDepth = WhatsOurDepth();
}
//-------------------------------------------------------------- RestoreColorDepth
// Restores a monitor to its previous depth when we quit (if we changed it).
void RestoreColorDepth (void)
{
if ((thisMac.hasColor) && ((thisMac.wasDepth != thisMac.isDepth) ||
(thisMac.wasColorOrGray != AreWeColorOrGrayscale())))
SwitchToDepth(thisMac.wasDepth, true);
thisMac.isDepth = isDepthPref;
}
//-------------------------------------------------------------- CheckMemorySize
@@ -574,7 +515,7 @@ void GetDeviceRect(Rect *rect)
{
unsigned int width;
unsigned int height;
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(&width, &height, nil);
PortabilityLayer::HostDisplayDriver::GetInstance()->GetDisplayResolution(&width, &height);
SetRect(rect, 0, 0, static_cast<short>(width), static_cast<short>(height));
}

View File

@@ -12,7 +12,7 @@ typedef struct
{
Rect fullScreen, constrainedScreen, gray;
long dirID;
short wasDepth, isDepth;
short isDepth;
short numScreens;
short vRefNum;
Boolean can1Bit;

View File

@@ -21,10 +21,6 @@ namespace PortabilityLayer
class RenderedFont;
}
#define kPreferredDepth 8
#define kPreferredPixelFormat (GpPixelFormats::k8BitStandard)
#define kNilPointer 0L
#define kPutInFront (PL_GetPutInFrontWindowPtr())
#define kNormalUpdates TRUE
@@ -168,15 +164,12 @@ void DumpToResEditFile (Ptr, long);
void HandleEvent (void); // --- Event.c
void IgnoreThisClick (void);
short WhatsOurDepth (void); // --- Environs.c
void SwitchToDepth (short, Boolean);
void SwitchToDepth (short, Boolean); // --- Environs.c
void CheckOurEnvirons (void);
void InstallResolutionHandler (void);
//void ReflectSecondMonitorEnvirons (Boolean, Boolean, Boolean);
void HandleDepthSwitching (void);
void RestoreColorDepth (void);
void CheckMemorySize (void);
void SetAppMemorySize (long);
Boolean CheckFileError (short, const PLPasStr &); // --- File Error.c

View File

@@ -278,14 +278,14 @@ void InitDiedGameOver (void)
PLError_t theErr;
QSetRect(&pageSrcRect, 0, 0, 25, 32 * 8);
theErr = CreateOffScreenGWorld(&gameOverSrcMap, &pageSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&gameOverSrcMap, &pageSrcRect);
LoadGraphic(gameOverSrcMap, kLettersPictID);
QSetRect(&pageSrcRect, 0, 0, 32, 32 * kPageFrames);
theErr = CreateOffScreenGWorld(&pageSrcMap, &pageSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&pageSrcMap, &pageSrcRect);
LoadGraphic(pageSrcMap, kPagesPictID);
theErr = CreateOffScreenGWorld(&pageMaskMap, &pageSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&pageMaskMap, &pageSrcRect, GpPixelFormats::kBW1);
LoadGraphic(pageMaskMap, kPagesMaskID);
for (i = 0; i < kPageFrames; i++) // initialize src page rects

View File

@@ -41,8 +41,6 @@
#define kYellowCantOrderLinks 24
#define kSwitchIfNeeded 0
#define kSwitchTo256Colors 1
#define kSwitchTo16Grays 2
#define kProdGameScoreMode -4
#define kKickGameScoreMode -3

View File

@@ -131,10 +131,10 @@ void DrawHighScores (DrawSurface *surface)
dropIt = 129 + splashOriginV;
QSetRect(&tempRect, 0, 0, 332, 30);
theErr = CreateOffScreenGWorld(&tempMap, &tempRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &tempRect);
LoadGraphic(tempMap, kHighScoresPictID);
theErr = CreateOffScreenGWorld(&tempMask, &tempRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &tempRect, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kHighScoresMaskID);
tempRect2 = tempRect;

View File

@@ -395,7 +395,6 @@ int gpAppMain()
}
}
WriteOutPrefs();
RestoreColorDepth();
PL_DEAD(FlushEvents());
// theErr = LoadScrap();

View File

@@ -762,7 +762,7 @@ void CreateNailOffscreen (void)
if (nailSrcMap == nil)
{
QSetRect(&nailSrcRect, 0, 0, kMapRoomWidth, kMapRoomHeight * (kNumBackgrounds + 1));
theErr = CreateOffScreenGWorld(&nailSrcMap, &nailSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&nailSrcMap, &nailSrcRect);
LoadGraphic(nailSrcMap, kThumbnailPictID);
}

View File

@@ -169,10 +169,10 @@ void DrawMailboxLeft (Rect *theRect, short down)
}
bounds = srcRects[kMailboxLf];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, kMailboxLeftPictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kMailboxLeftMaskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -241,10 +241,10 @@ void DrawMailboxRight (Rect *theRect, short down)
}
bounds = srcRects[kMailboxRt];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, kMailboxRightPictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kMailboxRightMaskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -604,10 +604,10 @@ void DrawTV (Rect *theRect, Boolean isOn, Boolean isLit)
if (isLit)
{
bounds = srcRects[kTV];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, kTVPictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kTVMaskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -690,10 +690,10 @@ void DrawVCR (Rect *theRect, Boolean isOn, Boolean isLit)
if (isLit)
{
bounds = srcRects[kVCR];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, kVCRPictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kVCRMaskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -737,10 +737,10 @@ void DrawStereo (Rect *theRect, Boolean isOn, Boolean isLit)
if (isLit)
{
bounds = srcRects[kStereo];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, kStereoPictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kStereoMaskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -784,10 +784,10 @@ void DrawMicrowave (Rect *theRect, Boolean isOn, Boolean isLit)
if (isLit)
{
bounds = srcRects[kMicrowave];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, kMicrowavePictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, kMicrowaveMaskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -1162,10 +1162,10 @@ void DrawPictWithMaskObject (short what, Rect *theRect)
}
bounds = srcRects[what];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, pictID);
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&tempMask, &bounds, GpPixelFormats::kBW1);
LoadGraphic(tempMask, maskID);
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
@@ -1273,7 +1273,7 @@ void DrawPictSansWhiteObject (short what, Rect *theRect)
}
bounds = srcRects[what];
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphic(tempMap, pictID);
CopyBits((BitMap *)*GetGWorldPixMap(tempMap),
@@ -1293,7 +1293,7 @@ void DrawCustPictSansWhite (short pictID, Rect *theRect)
bounds = *theRect;
ZeroRectCorner(&bounds);
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tempMap, &bounds);
LoadGraphicCustom(tempMap, pictID);
CopyBits((BitMap *)*GetGWorldPixMap(tempMap),

View File

@@ -436,7 +436,7 @@ void DoRoomInfo(void)
NumToString(thisRoom->numObjects, objectsStr);
DialogTextSubstitutions substitutions(floorStr, suiteStr, objectsStr);
theErr = CreateOffScreenGWorld(&tileSrcMap, &tileSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&tileSrcMap, &tileSrcRect);
// CreateOffScreenPixMap(&tileSrcRect, &tileSrcMap);
// SetPort((GrafPtr)tileSrcMap);
if ((tempBack > kStars) && (!PictIDExists(tempBack)))

View File

@@ -34,12 +34,12 @@
#define kDisplay9Item 5
#define kBorder1Item 8
#define kDoColorFadeItem 9
//#define kCurrentDepth 10
#define k32BitColorItem 10
//#define k256Depth 11
//#define k16Depth 12
#define kBorder2Item 10
#define kBorder3Item 11
#define kDispDefault 12
#define kBorder2Item 11
#define kBorder3Item 12
#define kDispDefault 13
//#define kUseQDItem 13
//#define kUseScreen2Item 14
#define kSofterItem 4
@@ -906,6 +906,7 @@ void DisplayUpdate (Dialog *theDialog)
DrawDefaultButton(theDialog);
SetDialogItemValue(theDialog, kDoColorFadeItem, (short)wasFade);
SetDialogItemValue(theDialog, k32BitColorItem, wasDepthPref == 32);
FrameDisplayIcon(theDialog, StdColors::Red());
FrameDialogItemC(theDialog, kBorder1Item, kRedOrangeColor8);
@@ -1001,9 +1002,6 @@ void DoDisplayPrefs (void)
BringUpDialog(&prefDlg, kDisplayPrefsDialID, nullptr);
if (!thisMac.can8Bit)
MyDisableControl(prefDlg, kDoColorFadeItem);
wasNeighbors = numNeighbors;
wasFade = isDoColorFade;
wasDepthPref = isDepthPref;
@@ -1060,6 +1058,14 @@ void DoDisplayPrefs (void)
SetDialogItemValue(prefDlg, kDoColorFadeItem, (short)wasFade);
break;
case k32BitColorItem:
if (wasDepthPref == 32)
wasDepthPref = 8;
else
wasDepthPref = 32;
SetDialogItemValue(prefDlg, k32BitColorItem, wasDepthPref == 32);
break;
case kDispDefault:
FrameDisplayIcon(prefDlg, StdColors::White());
DisplayDefaults();

View File

@@ -73,7 +73,7 @@ void InitScoreboardMap(void)
boardSrcRect = houseRect;
ZeroRectCorner(&boardSrcRect);
boardSrcRect.bottom = kScoreboardTall;
theErr = CreateOffScreenGWorld(&boardSrcMap, &boardSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&boardSrcMap, &boardSrcRect);
if (boardSrcRect.right >= 640)
hOffset = (RectWide(&boardSrcRect) - kMaxViewWidth) / 2;
@@ -91,7 +91,7 @@ void InitScoreboardMap(void)
QSetRect(&badgeSrcRect, 0, 0, 32, 66); // 2144 pixels
if (!badgeSrcMap)
{
theErr = CreateOffScreenGWorld(&badgeSrcMap, &badgeSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&badgeSrcMap, &badgeSrcRect);
LoadGraphic(badgeSrcMap, kBadgePictID);
}
@@ -104,7 +104,7 @@ void InitScoreboardMap(void)
QSetRect(&boardTSrcRect, 0, 0, 256, 12); // room title
if (!boardTSrcMap)
{
theErr = CreateOffScreenGWorld(&boardTSrcMap, &boardTSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&boardTSrcMap, &boardTSrcRect);
}
boardTDestRect = boardTSrcRect;
QOffsetRect(&boardTDestRect, 137 + hOffset, 5);
@@ -112,7 +112,7 @@ void InitScoreboardMap(void)
QSetRect(&boardGSrcRect, 0, 0, 20, 10); // # gliders
if (!boardGSrcMap)
{
theErr = CreateOffScreenGWorld(&boardGSrcMap, &boardGSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&boardGSrcMap, &boardGSrcRect);
}
boardGDestRect = boardGSrcRect;
QOffsetRect(&boardGDestRect, 526 + hOffset, 5);
@@ -121,7 +121,7 @@ void InitScoreboardMap(void)
QSetRect(&boardPSrcRect, 0, 0, 64, 10); // points
if (!boardPSrcMap)
{
theErr = CreateOffScreenGWorld(&boardPSrcMap, &boardPSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&boardPSrcMap, &boardPSrcRect);
}
boardPDestRect = boardPSrcRect;
QOffsetRect(&boardPDestRect, 570 + hOffset, 5); // total = 6396 pixels
@@ -166,13 +166,13 @@ void InitGliderMap (void)
short i;
QSetRect(&glidSrcRect, 0, 0, kGliderWide, 668); // 32112 pixels
theErr = CreateOffScreenGWorld(&glidSrcMap, &glidSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&glidSrcMap, &glidSrcRect);
LoadGraphic(glidSrcMap, kGliderPictID);
theErr = CreateOffScreenGWorld(&glid2SrcMap, &glidSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&glid2SrcMap, &glidSrcRect);
LoadGraphic(glid2SrcMap, kGlider2PictID);
theErr = CreateOffScreenGWorld(&glidMaskMap, &glidSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&glidMaskMap, &glidSrcRect, GpPixelFormats::kBW1);
LoadGraphic(glidMaskMap, kGliderPictID + 1000);
for (i = 0; i <= 20; i++)
@@ -192,10 +192,10 @@ void InitGliderMap (void)
QOffsetRect(&gliderSrc[30], 0, 648);
QSetRect(&shadowSrcRect, 0, 0, kGliderWide, kShadowHigh * kNumShadowSrcRects);
theErr = CreateOffScreenGWorld(&shadowSrcMap, &shadowSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&shadowSrcMap, &shadowSrcRect);
LoadGraphic(shadowSrcMap, kShadowPictID);
theErr = CreateOffScreenGWorld(&shadowMaskMap, &shadowSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&shadowMaskMap, &shadowSrcRect, GpPixelFormats::kBW1);
LoadGraphic(shadowMaskMap, kShadowPictID + 1000);
for (i = 0; i < kNumShadowSrcRects; i++)
@@ -205,10 +205,10 @@ void InitGliderMap (void)
}
QSetRect(&bandsSrcRect, 0, 0, 16, 18); // 304 pixels
theErr = CreateOffScreenGWorld(&bandsSrcMap, &bandsSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&bandsSrcMap, &bandsSrcRect);
LoadGraphic(bandsSrcMap, kRubberBandsPictID);
theErr = CreateOffScreenGWorld(&bandsMaskMap, &bandsSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&bandsMaskMap, &bandsSrcRect, GpPixelFormats::kBW1);
LoadGraphic(bandsMaskMap, kRubberBandsPictID + 1000);
for (i = 0; i < 3; i++)
@@ -228,10 +228,10 @@ void InitBlowers (void)
PLError_t theErr;
QSetRect(&blowerSrcRect, 0, 0, 48, 402); // 19344 pixels
theErr = CreateOffScreenGWorld(&blowerSrcMap, &blowerSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&blowerSrcMap, &blowerSrcRect);
LoadGraphic(blowerSrcMap, kBlowerPictID);
theErr = CreateOffScreenGWorld(&blowerMaskMap, &blowerSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&blowerMaskMap, &blowerSrcRect, GpPixelFormats::kBW1);
LoadGraphic(blowerMaskMap, kBlowerPictID + 1000);
for (i = 0; i < kNumCandleFlames; i++)
@@ -271,10 +271,10 @@ void InitFurniture (void)
wasCPort = GetGraphicsPort();
QSetRect(&furnitureSrcRect, 0, 0, 64, 278); // 17856 pixels
theErr = CreateOffScreenGWorld(&furnitureSrcMap, &furnitureSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&furnitureSrcMap, &furnitureSrcRect);
LoadGraphic(furnitureSrcMap, kFurniturePictID);
theErr = CreateOffScreenGWorld(&furnitureMaskMap, &furnitureSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&furnitureMaskMap, &furnitureSrcRect, GpPixelFormats::kBW1);
LoadGraphic(furnitureMaskMap, kFurniturePictID + 1000);
QSetRect(&tableSrc, 0, 0, 64, 22);
@@ -314,10 +314,10 @@ void InitPrizes (void)
PLError_t theErr;
QSetRect(&bonusSrcRect, 0, 0, 88, 378); // 33264 pixels
theErr = CreateOffScreenGWorld(&bonusSrcMap, &bonusSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&bonusSrcMap, &bonusSrcRect);
LoadGraphic(bonusSrcMap, kBonusPictID);
theErr = CreateOffScreenGWorld(&bonusMaskMap, &bonusSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&bonusMaskMap, &bonusSrcRect, GpPixelFormats::kBW1);
LoadGraphic(bonusMaskMap, kBonusPictID + 1000);
for (i = 0; i < 11; i++)
@@ -365,10 +365,10 @@ void InitPrizes (void)
sparkleSrc[1] = sparkleSrc[3];
QSetRect(&pointsSrcRect, 0, 0, 24, 120); // 2880 pixels
theErr = CreateOffScreenGWorld(&pointsSrcMap, &pointsSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&pointsSrcMap, &pointsSrcRect);
LoadGraphic(pointsSrcMap, kPointsPictID);
theErr = CreateOffScreenGWorld(&pointsMaskMap, &pointsSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&pointsMaskMap, &pointsSrcRect, GpPixelFormats::kBW1);
LoadGraphic(pointsMaskMap, kPointsPictID + 1000);
for (i = 0; i < 15; i++)
@@ -387,10 +387,10 @@ void InitTransports (void)
PLError_t theErr;
QSetRect(&transSrcRect, 0, 0, 56, 32); // 1848 pixels
theErr = CreateOffScreenGWorld(&transSrcMap, &transSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&transSrcMap, &transSrcRect);
LoadGraphic(transSrcMap, kTransportPictID);
theErr = CreateOffScreenGWorld(&transMaskMap, &transSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&transMaskMap, &transSrcRect, GpPixelFormats::kBW1);
LoadGraphic(transMaskMap, kTransportPictID + 1000);
}
@@ -403,7 +403,7 @@ void InitSwitches (void)
PLError_t theErr;
QSetRect(&switchSrcRect, 0, 0, 32, 104); // 3360 pixels
theErr = CreateOffScreenGWorld(&switchSrcMap, &switchSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&switchSrcMap, &switchSrcRect);
LoadGraphic(switchSrcMap, kSwitchPictID);
QSetRect(&lightSwitchSrc[0], 0, 0, 15, 24);
@@ -442,10 +442,10 @@ void InitLights (void)
PLError_t theErr;
QSetRect(&lightSrcRect, 0, 0, 72, 126); // 9144 pixels
theErr = CreateOffScreenGWorld(&lightSrcMap, &lightSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&lightSrcMap, &lightSrcRect);
LoadGraphic(lightSrcMap, kLightPictID);
theErr = CreateOffScreenGWorld(&lightMaskMap, &lightSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&lightMaskMap, &lightSrcRect, GpPixelFormats::kBW1);
LoadGraphic(lightMaskMap, kLightPictID + 1000);
QSetRect(&flourescentSrc1, 0, 0, 16, 12);
@@ -471,24 +471,24 @@ void InitAppliances (void)
PLError_t theErr;
QSetRect(&applianceSrcRect, 0, 0, 80, 269); // 21600 pixels
theErr = CreateOffScreenGWorld(&applianceSrcMap, &applianceSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&applianceSrcMap, &applianceSrcRect);
LoadGraphic(applianceSrcMap, kAppliancePictID);
theErr = CreateOffScreenGWorld(&applianceMaskMap, &applianceSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&applianceMaskMap, &applianceSrcRect, GpPixelFormats::kBW1);
LoadGraphic(applianceMaskMap, kAppliancePictID + 1000);
QSetRect(&toastSrcRect, 0, 0, 32, 174); // 5600 pixels
theErr = CreateOffScreenGWorld(&toastSrcMap, &toastSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&toastSrcMap, &toastSrcRect);
LoadGraphic(toastSrcMap, kToastPictID);
theErr = CreateOffScreenGWorld(&toastMaskMap, &toastSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&toastMaskMap, &toastSrcRect, GpPixelFormats::kBW1);
LoadGraphic(toastMaskMap, kToastPictID + 1000);
QSetRect(&shredSrcRect, 0, 0, 40, 35); // 1440 pixels
theErr = CreateOffScreenGWorld(&shredSrcMap, &shredSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&shredSrcMap, &shredSrcRect);
LoadGraphic(shredSrcMap, kShreddedPictID);
theErr = CreateOffScreenGWorld(&shredMaskMap, &shredSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&shredMaskMap, &shredSrcRect, GpPixelFormats::kBW1);
LoadGraphic(shredMaskMap, kShreddedPictID + 1000);
QSetRect(&plusScreen1, 0, 0, 32, 22);
@@ -544,52 +544,52 @@ void InitEnemies (void)
PLError_t theErr;
QSetRect(&balloonSrcRect, 0, 0, 24, 30 * kNumBalloonFrames);
theErr = CreateOffScreenGWorld(&balloonSrcMap, &balloonSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&balloonSrcMap, &balloonSrcRect);
LoadGraphic(balloonSrcMap, kBalloonPictID);
theErr = CreateOffScreenGWorld(&balloonMaskMap, &balloonSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&balloonMaskMap, &balloonSrcRect, GpPixelFormats::kBW1);
LoadGraphic(balloonMaskMap, kBalloonPictID + 1000);
QSetRect(&copterSrcRect, 0, 0, 32, 30 * kNumCopterFrames);
theErr = CreateOffScreenGWorld(&copterSrcMap, &copterSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&copterSrcMap, &copterSrcRect);
LoadGraphic(copterSrcMap, kCopterPictID);
theErr = CreateOffScreenGWorld(&copterMaskMap, &copterSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&copterMaskMap, &copterSrcRect, GpPixelFormats::kBW1);
LoadGraphic(copterMaskMap, kCopterPictID + 1000);
QSetRect(&dartSrcRect, 0, 0, 64, 19 * kNumDartFrames);
theErr = CreateOffScreenGWorld(&dartSrcMap, &dartSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&dartSrcMap, &dartSrcRect);
LoadGraphic(dartSrcMap, kDartPictID);
theErr = CreateOffScreenGWorld(&dartMaskMap, &dartSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&dartMaskMap, &dartSrcRect, GpPixelFormats::kBW1);
LoadGraphic(dartMaskMap, kDartPictID + 1000);
QSetRect(&ballSrcRect, 0, 0, 32, 32 * kNumBallFrames);
theErr = CreateOffScreenGWorld(&ballSrcMap, &ballSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&ballSrcMap, &ballSrcRect);
LoadGraphic(ballSrcMap, kBallPictID);
theErr = CreateOffScreenGWorld(&ballMaskMap, &ballSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&ballMaskMap, &ballSrcRect, GpPixelFormats::kBW1);
LoadGraphic(ballMaskMap, kBallPictID + 1000);
QSetRect(&dripSrcRect, 0, 0, 16, 12 * kNumDripFrames);
theErr = CreateOffScreenGWorld(&dripSrcMap, &dripSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&dripSrcMap, &dripSrcRect);
LoadGraphic(dripSrcMap, kDripPictID);
theErr = CreateOffScreenGWorld(&dripMaskMap, &dripSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&dripMaskMap, &dripSrcRect, GpPixelFormats::kBW1);
LoadGraphic(dripMaskMap, kDripPictID + 1000);
QSetRect(&enemySrcRect, 0, 0, 36, 33);
theErr = CreateOffScreenGWorld(&enemySrcMap, &enemySrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&enemySrcMap, &enemySrcRect);
LoadGraphic(enemySrcMap, kEnemyPictID);
theErr = CreateOffScreenGWorld(&enemyMaskMap, &enemySrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&enemyMaskMap, &enemySrcRect, GpPixelFormats::kBW1);
LoadGraphic(enemyMaskMap, kEnemyPictID + 1000);
QSetRect(&fishSrcRect, 0, 0, 16, 16 * kNumFishFrames);
theErr = CreateOffScreenGWorld(&fishSrcMap, &fishSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&fishSrcMap, &fishSrcRect);
LoadGraphic(fishSrcMap, kFishPictID);
theErr = CreateOffScreenGWorld(&fishMaskMap, &fishSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&fishMaskMap, &fishSrcRect, GpPixelFormats::kBW1);
LoadGraphic(fishMaskMap, kFishPictID + 1000);
for (i = 0; i < kNumBalloonFrames; i++)

View File

@@ -57,10 +57,10 @@ void InitClutter (void)
PLError_t theErr;
QSetRect(&clutterSrcRect, 0, 0, 128, 69);
theErr = CreateOffScreenGWorld(&clutterSrcMap, &clutterSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&clutterSrcMap, &clutterSrcRect);
LoadGraphic(clutterSrcMap, kClutterPictID);
theErr = CreateOffScreenGWorld(&clutterMaskMap, &clutterSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&clutterMaskMap, &clutterSrcRect, GpPixelFormats::kBW1);
LoadGraphic(clutterMaskMap, kClutterPictID + 1000);
QSetRect(&flowerSrc[0], 0, 0, 10, 28);
@@ -92,7 +92,7 @@ void InitSupport (void)
PLError_t theErr;
QSetRect(&suppSrcRect, 0, 0, kRoomWide, kFloorSupportTall); // 44
theErr = CreateOffScreenGWorld(&suppSrcMap, &suppSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&suppSrcMap, &suppSrcRect);
LoadGraphic(suppSrcMap, kSupportPictID);
}
@@ -106,10 +106,10 @@ void InitAngel (void)
PLError_t theErr;
QSetRect(&angelSrcRect, 0, 0, 96, 44);
theErr = CreateOffScreenGWorld(&angelSrcMap, &angelSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&angelSrcMap, &angelSrcRect);
LoadGraphic(angelSrcMap, kAngelPictID);
theErr = CreateOffScreenGWorld(&angelMaskMap, &angelSrcRect, GpPixelFormats::kBW1);
theErr = CreateOffScreenGWorldCustomDepth(&angelMaskMap, &angelSrcRect, GpPixelFormats::kBW1);
LoadGraphic(angelMaskMap, kAngelPictID + 1);
}
@@ -132,11 +132,11 @@ PLError_t RecreateOffscreens(void)
workSrcRect = houseRect; // Set up work map
ZeroRectCorner(&workSrcRect);
theErr = CreateOffScreenGWorld(&workSrcMap, &workSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&workSrcMap, &workSrcRect);
backSrcRect = houseRect; // Set up background map
ZeroRectCorner(&backSrcRect);
theErr = CreateOffScreenGWorld(&backSrcMap, &backSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&backSrcMap, &backSrcRect);
return PLErrors::kNone;
}

View File

@@ -87,7 +87,7 @@ void CreateToolsOffscreen (void)
if (toolSrcMap == nil)
{
QSetRect(&toolSrcRect, 0, 0, 360, 216);
theErr = CreateOffScreenGWorld(&toolSrcMap, &toolSrcRect, kPreferredPixelFormat);
theErr = CreateOffScreenGWorld(&toolSrcMap, &toolSrcRect);
LoadGraphic(toolSrcMap, kToolsPictID);
}
}

View File

@@ -15,6 +15,7 @@
#include "QDPixMap.h"
#include "BitmapImage.h"
#include "DialogManager.h"
#include "DisplayDeviceManager.h"
#include "Externs.h"
#include "HostSystemServices.h"
#include "IconLoader.h"
@@ -211,13 +212,17 @@ void CreateOffScreenPixMap (Rect *theRect, CGrafPtr *offScreen)
//-------------------------------------------------------------------- CreateOffScreenGWorld
// Creates an offscreen GWorld<6C>using the depth passed in.
PLError_t CreateOffScreenGWorld (DrawSurface **theGWorld, Rect *bounds, GpPixelFormat_t pixelFormat)
PLError_t CreateOffScreenGWorld (DrawSurface **theGWorld, Rect *bounds)
{
PLError_t theErr;
GpPixelFormat_t pixelFormat = PortabilityLayer::DisplayDeviceManager::GetInstance()->GetPixelFormat();
theErr = NewGWorld(theGWorld, pixelFormat, bounds, nil);
return theErr;
return NewGWorld(theGWorld, pixelFormat, bounds, nil);
}
PLError_t CreateOffScreenGWorldCustomDepth(DrawSurface **theGWorld, Rect *bounds, GpPixelFormat_t pixelFormat)
{
return NewGWorld(theGWorld, pixelFormat, bounds, nil);
}
//-------------------------------------------------------------- KillOffScreenPixMap

View File

@@ -9,4 +9,5 @@
#include "GpPixelFormat.h"
PLError_t CreateOffScreenGWorld (DrawSurface **surface, Rect *bounds, GpPixelFormat_t pixelFormat);
PLError_t CreateOffScreenGWorld (DrawSurface **surface, Rect *bounds);
PLError_t CreateOffScreenGWorldCustomDepth (DrawSurface **surface, Rect *bounds, GpPixelFormat_t pixelFormat);