mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-13 19:49:36 +00:00
Major draw code refactor
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include "PLSound.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "About.h"
|
||||
#include "DialogManager.h"
|
||||
#include "DialogUtils.h"
|
||||
#include "Environ.h"
|
||||
#include "Externs.h"
|
||||
@@ -18,8 +19,8 @@
|
||||
#include "ScanlineMask.h"
|
||||
|
||||
|
||||
static void HiLiteOkayButton (void);
|
||||
static void UnHiLiteOkayButton (void);
|
||||
static void HiLiteOkayButton (DrawSurface *surface);
|
||||
static void UnHiLiteOkayButton (DrawSurface *surface);
|
||||
static void UpdateMainPict (DialogPtr);
|
||||
static Boolean AboutFilter (DialogPtr, EventRecord *theEvent, short *hit);
|
||||
|
||||
@@ -52,7 +53,7 @@ void DoAbout (void)
|
||||
wasResFile = CurResFile();
|
||||
UseResFile(thisMac.thisResFile);
|
||||
|
||||
aboutDialog = GetNewDialog(kAboutDialogID, nil, (WindowRef)-1L);
|
||||
aboutDialog = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kAboutDialogID, PL_GetPutInFrontWindowPtr());
|
||||
// if (aboutDialog == nil)
|
||||
// RedAlert(kErrDialogDidntLoad);
|
||||
|
||||
@@ -99,7 +100,7 @@ void DoAbout (void)
|
||||
//-------------------------------------------------------------- HiLiteOkayButton
|
||||
// Draws my pseudo-button to appear as though it is clicked on.
|
||||
|
||||
static void HiLiteOkayButton (void)
|
||||
static void HiLiteOkayButton (DrawSurface *surface)
|
||||
{
|
||||
#define kOkayButtPICTHiLit 151 // res ID of unhilit button PICT
|
||||
PicHandle thePict;
|
||||
@@ -109,7 +110,7 @@ static void HiLiteOkayButton (void)
|
||||
thePict = GetPicture(kOkayButtPICTHiLit);
|
||||
if (thePict != nil)
|
||||
{
|
||||
DrawPicture(thePict, &okayButtonBounds);
|
||||
surface->DrawPicture(thePict, okayButtonBounds);
|
||||
thePict.Dispose();
|
||||
|
||||
okayButtIsHiLit = true;
|
||||
@@ -121,7 +122,7 @@ static void HiLiteOkayButton (void)
|
||||
|
||||
// Draws my pseudo-button normal (not clicked on).
|
||||
|
||||
static void UnHiLiteOkayButton (void)
|
||||
static void UnHiLiteOkayButton (DrawSurface *surface)
|
||||
{
|
||||
#define kOkayButtPICTNotHiLit 150 // res ID of hilit button PICT
|
||||
PicHandle thePict;
|
||||
@@ -131,7 +132,7 @@ static void UnHiLiteOkayButton (void)
|
||||
thePict = GetPicture(kOkayButtPICTNotHiLit);
|
||||
if (thePict != nil)
|
||||
{
|
||||
DrawPicture(thePict, &okayButtonBounds);
|
||||
surface->DrawPicture(thePict, okayButtonBounds);
|
||||
thePict.Dispose();
|
||||
|
||||
okayButtIsHiLit = false;
|
||||
@@ -179,14 +180,16 @@ static Boolean AboutFilter (DialogPtr theDial, EventRecord *theEvent, short *hit
|
||||
Point mousePt;
|
||||
UInt32 dummyLong;
|
||||
Boolean handledIt;
|
||||
|
||||
DrawSurface *surface = theDial->GetWindow()->GetDrawSurface();
|
||||
|
||||
if (Button() && clickedDownInOkay)
|
||||
{
|
||||
GetMouse(&mousePt);
|
||||
if(PointInScanlineMask(mousePt, okayButtScanlineMask))
|
||||
HiLiteOkayButton();
|
||||
HiLiteOkayButton(surface);
|
||||
else
|
||||
UnHiLiteOkayButton();
|
||||
UnHiLiteOkayButton(surface);
|
||||
}
|
||||
|
||||
switch (theEvent->what)
|
||||
@@ -196,9 +199,9 @@ static Boolean AboutFilter (DialogPtr theDial, EventRecord *theEvent, short *hit
|
||||
{
|
||||
case PL_KEY_SPECIAL(kEnter):
|
||||
case PL_KEY_NUMPAD_SPECIAL(kEnter):
|
||||
HiLiteOkayButton();
|
||||
HiLiteOkayButton(surface);
|
||||
Delay(8, &dummyLong);
|
||||
UnHiLiteOkayButton();
|
||||
UnHiLiteOkayButton(surface);
|
||||
*hit = kOkayButton;
|
||||
handledIt = true;
|
||||
break;
|
||||
@@ -225,7 +228,7 @@ static Boolean AboutFilter (DialogPtr theDial, EventRecord *theEvent, short *hit
|
||||
GlobalToLocal(&mousePt);
|
||||
if(PointInScanlineMask(mousePt, okayButtScanlineMask) && clickedDownInOkay)
|
||||
{
|
||||
UnHiLiteOkayButton();
|
||||
UnHiLiteOkayButton(surface);
|
||||
*hit = kOkayButton;
|
||||
handledIt = true;
|
||||
}
|
||||
@@ -240,7 +243,6 @@ static Boolean AboutFilter (DialogPtr theDial, EventRecord *theEvent, short *hit
|
||||
if ((WindowPtr)theEvent->message == mainWindow)
|
||||
{
|
||||
SetPort((GrafPtr)mainWindow);
|
||||
BeginUpdate((WindowPtr)theEvent->message);
|
||||
UpdateMainWindow();
|
||||
EndUpdate((WindowPtr)theEvent->message);
|
||||
SetPortDialogPort(theDial);
|
||||
@@ -249,7 +251,6 @@ static Boolean AboutFilter (DialogPtr theDial, EventRecord *theEvent, short *hit
|
||||
else if ((WindowPtr)theEvent->message == (WindowPtr)theDial)
|
||||
{
|
||||
SetPortDialogPort(theDial);
|
||||
BeginUpdate((WindowPtr)theEvent->message);
|
||||
UpdateMainPict(theDial);
|
||||
EndUpdate((WindowPtr)theEvent->message);
|
||||
handledIt = false;
|
||||
|
||||
@@ -7,8 +7,11 @@
|
||||
|
||||
#include "PLNumberFormatting.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "FontFamily.h"
|
||||
#include "FontManager.h"
|
||||
#include "MainWindow.h"
|
||||
#include "RectUtils.h"
|
||||
#include "Room.h"
|
||||
@@ -41,13 +44,10 @@ extern Boolean quickerTransitions, demoGoing, isUseSecondScreen;
|
||||
|
||||
void DrawBanner (Point *topLeft)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
Rect wholePage, partPage, mapBounds;
|
||||
GWorldPtr tempMap;
|
||||
GWorldPtr tempMask;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
DrawSurface *tempMap;
|
||||
DrawSurface *tempMask;
|
||||
PLError_t theErr;
|
||||
|
||||
QSetRect(&wholePage, 0, 0, 330, 220);
|
||||
mapBounds = thisMac.screen;
|
||||
@@ -57,27 +57,23 @@ void DrawBanner (Point *topLeft)
|
||||
topLeft->v = wholePage.top;
|
||||
partPage = wholePage;
|
||||
partPage.bottom = partPage.top + 190;
|
||||
SetGraphicsPort(workSrcMap);
|
||||
LoadScaledGraphic(kBannerPageTopPICT, &partPage);
|
||||
LoadScaledGraphic(workSrcMap, kBannerPageTopPICT, &partPage);
|
||||
|
||||
partPage = wholePage;
|
||||
partPage.top = partPage.bottom - 30;
|
||||
mapBounds = partPage;
|
||||
ZeroRectCorner(&mapBounds);
|
||||
theErr = CreateOffScreenGWorld(&tempMap, &mapBounds, kPreferredPixelFormat);
|
||||
SetGraphicsPort(tempMap);
|
||||
LoadGraphic(kBannerPageBottomPICT);
|
||||
LoadGraphic(tempMap, kBannerPageBottomPICT);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&tempMask, &mapBounds, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(tempMask);
|
||||
LoadGraphic(kBannerPageBottomMask);
|
||||
LoadGraphic(tempMask, kBannerPageBottomMask);
|
||||
|
||||
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
||||
(BitMap *)*GetGWorldPixMap(tempMask),
|
||||
(BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||
&mapBounds, &mapBounds, &partPage);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
DisposeGWorld(tempMap);
|
||||
DisposeGWorld(tempMask);
|
||||
}
|
||||
@@ -114,22 +110,19 @@ void DrawBannerMessage (Point topLeft)
|
||||
Str255 bannerStr, subStr;
|
||||
short count;
|
||||
|
||||
CGrafPtr wasGWorld = GetGraphicsPort();
|
||||
DrawSurface *wasGWorld = GetGraphicsPort();
|
||||
|
||||
SetGraphicsPort(workSrcMap);
|
||||
|
||||
PasStringCopy((*thisHouse)->banner, bannerStr);
|
||||
|
||||
TextFont(applFont);
|
||||
TextFace(bold);
|
||||
TextSize(12);
|
||||
ForeColor(blackColor);
|
||||
|
||||
workSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
||||
workSrcMap->SetForeColor(StdColors::Black());
|
||||
count = 0;
|
||||
do
|
||||
{
|
||||
GetLineOfText(bannerStr, count, subStr);
|
||||
MoveTo(topLeft.h + 16, topLeft.v + 32 + (count * 20));
|
||||
DrawString(subStr);
|
||||
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 32 + (count * 20)), subStr);
|
||||
count++;
|
||||
}
|
||||
while (subStr[0] > 0);
|
||||
@@ -149,15 +142,14 @@ void DrawBannerMessage (Point topLeft)
|
||||
else
|
||||
GetLocalizedString(4, subStr);
|
||||
PasStringConcat(bannerStr, subStr);
|
||||
|
||||
ForeColor(redColor);
|
||||
MoveTo(topLeft.h + 16, topLeft.v + 164);
|
||||
DrawString(bannerStr);
|
||||
MoveTo(topLeft.h + 16, topLeft.v + 180);
|
||||
|
||||
workSrcMap->SetForeColor(StdColors::Red());
|
||||
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 164), bannerStr);
|
||||
|
||||
GetLocalizedString(5, subStr);
|
||||
DrawString(subStr);
|
||||
workSrcMap->DrawString(Point::Create(topLeft.h + 16, topLeft.v + 180), subStr);
|
||||
}
|
||||
ForeColor(blackColor);
|
||||
workSrcMap->SetForeColor(StdColors::Black());
|
||||
|
||||
SetGraphicsPort(wasGWorld);
|
||||
}
|
||||
@@ -207,27 +199,26 @@ void DisplayStarsRemaining (void)
|
||||
{
|
||||
Rect src, bounds;
|
||||
Str255 theStr;
|
||||
|
||||
SetPortWindowPort(mainWindow);
|
||||
DrawSurface *surface = mainWindow->GetDrawSurface();
|
||||
|
||||
QSetRect(&bounds, 0, 0, 256, 64);
|
||||
CenterRectInRect(&bounds, &thisMac.screen);
|
||||
QOffsetRect(&bounds, -thisMac.screen.left, -thisMac.screen.top);
|
||||
src = bounds;
|
||||
InsetRect(&src, 64, 32);
|
||||
|
||||
TextFont(applFont);
|
||||
TextFace(bold);
|
||||
TextSize(12);
|
||||
|
||||
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
||||
|
||||
NumToString((long)numStarsRemaining, theStr);
|
||||
|
||||
QOffsetRect(&bounds, 0, -20);
|
||||
if (numStarsRemaining < 2)
|
||||
LoadScaledGraphic(kStarRemainingPICT, &bounds);
|
||||
LoadScaledGraphic(surface, kStarRemainingPICT, &bounds);
|
||||
else
|
||||
{
|
||||
LoadScaledGraphic(kStarsRemainingPICT, &bounds);
|
||||
MoveTo(bounds.left + 102 - (StringWidth(theStr) / 2), bounds.top + 23);
|
||||
ColorText(theStr, 4L);
|
||||
LoadScaledGraphic(surface, kStarsRemainingPICT, &bounds);
|
||||
const Point textPoint = Point::Create(bounds.left + 102 - (StringWidth(theStr) / 2), bounds.top + 23);
|
||||
ColorText(surface, textPoint, theStr, 4L);
|
||||
}
|
||||
|
||||
DelayTicks(60);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "Externs.h"
|
||||
#include "PLPalettes.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "QDStandardPalette.h"
|
||||
|
||||
|
||||
//============================================================== Functions
|
||||
@@ -18,15 +19,14 @@
|
||||
// this function draws text in that color. It assumes the current port,<2C>
|
||||
// the current font, the current pen location, etc.
|
||||
|
||||
void ColorText (StringPtr theStr, long color)
|
||||
void ColorText (DrawSurface *surface, const Point &point, StringPtr theStr, long color)
|
||||
{
|
||||
RGBColor theRGBColor, wasColor;
|
||||
|
||||
GetForeColor(&wasColor);
|
||||
Index2Color(color, &theRGBColor);
|
||||
RGBForeColor(&theRGBColor);
|
||||
DrawString(theStr);
|
||||
RGBForeColor(&wasColor);
|
||||
const PortabilityLayer::RGBAColor &rgbaColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[color];
|
||||
|
||||
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
|
||||
surface->SetForeColor(rgbaColor);
|
||||
surface->DrawString(point, theStr);
|
||||
surface->SetForeColor(wasColor);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- ColorRect
|
||||
@@ -34,15 +34,14 @@ void ColorText (StringPtr theStr, long color)
|
||||
// Given a rectangle and color index, this function draws a solid<69>
|
||||
// rectangle in that color. Current port, pen mode, etc. assumed.
|
||||
|
||||
void ColorRect (Rect *theRect, long color)
|
||||
void ColorRect (DrawSurface *surface, const Rect &theRect, long color)
|
||||
{
|
||||
RGBColor theRGBColor, wasColor;
|
||||
|
||||
GetForeColor(&wasColor);
|
||||
Index2Color(color, &theRGBColor);
|
||||
RGBForeColor(&theRGBColor);
|
||||
PaintRect(theRect);
|
||||
RGBForeColor(&wasColor);
|
||||
const PortabilityLayer::RGBAColor &rgbaColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[color];
|
||||
|
||||
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
|
||||
surface->SetForeColor(rgbaColor);
|
||||
surface->FillRect(theRect);
|
||||
surface->SetForeColor(wasColor);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- ColorOval
|
||||
@@ -50,15 +49,14 @@ void ColorRect (Rect *theRect, long color)
|
||||
// Given a rectangle and color index, this function draws a solid<69>
|
||||
// oval in that color. Current port, pen mode, etc. assumed.
|
||||
|
||||
void ColorOval (Rect *theRect, long color)
|
||||
void ColorOval (DrawSurface *surface, const Rect &theRect, long color)
|
||||
{
|
||||
RGBColor theRGBColor, wasColor;
|
||||
|
||||
GetForeColor(&wasColor);
|
||||
Index2Color(color, &theRGBColor);
|
||||
RGBForeColor(&theRGBColor);
|
||||
PaintOval(theRect);
|
||||
RGBForeColor(&wasColor);
|
||||
const PortabilityLayer::RGBAColor &rgbaColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[color];
|
||||
|
||||
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
|
||||
surface->SetForeColor(rgbaColor);
|
||||
surface->FillEllipse(theRect);
|
||||
surface->SetForeColor(wasColor);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- ColorRegion
|
||||
@@ -66,15 +64,14 @@ void ColorOval (Rect *theRect, long color)
|
||||
// Given a region and color index, this function draws a solid<69>
|
||||
// region in that color. Current port, pen mode, etc. assumed.
|
||||
|
||||
void ColorRegion (PortabilityLayer::ScanlineMask *scanlineMask, long colorIndex)
|
||||
void ColorRegion (DrawSurface *surface, PortabilityLayer::ScanlineMask *scanlineMask, long colorIndex)
|
||||
{
|
||||
RGBColor theRGBColor, wasColor;
|
||||
|
||||
GetForeColor(&wasColor);
|
||||
Index2Color(colorIndex, &theRGBColor);
|
||||
RGBForeColor(&theRGBColor);
|
||||
FillScanlineMask(scanlineMask);
|
||||
RGBForeColor(&wasColor);
|
||||
const PortabilityLayer::RGBAColor &rgbaColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[colorIndex];
|
||||
|
||||
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
|
||||
surface->SetForeColor(rgbaColor);
|
||||
surface->FillScanlineMask(scanlineMask);
|
||||
surface->SetForeColor(wasColor);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- ColorLine
|
||||
@@ -82,16 +79,14 @@ void ColorRegion (PortabilityLayer::ScanlineMask *scanlineMask, long colorIndex)
|
||||
// Given a the end points for a line and color index, this function<6F>
|
||||
// draws a line in that color. Current port, pen mode, etc. assumed.
|
||||
|
||||
void ColorLine (short h0, short v0, short h1, short v1, long color)
|
||||
void ColorLine (DrawSurface *surface, short h0, short v0, short h1, short v1, long color)
|
||||
{
|
||||
RGBColor theRGBColor, wasColor;
|
||||
|
||||
GetForeColor(&wasColor);
|
||||
Index2Color(color, &theRGBColor);
|
||||
RGBForeColor(&theRGBColor);
|
||||
MoveTo(h0, v0);
|
||||
LineTo(h1, v1);
|
||||
RGBForeColor(&wasColor);
|
||||
const PortabilityLayer::RGBAColor &rgbaColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[color];
|
||||
|
||||
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
|
||||
surface->SetForeColor(rgbaColor);
|
||||
surface->DrawLine(Point::Create(h0, v0), Point::Create(h1, v1));
|
||||
surface->SetForeColor(wasColor);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- HiliteRect
|
||||
@@ -101,16 +96,16 @@ void ColorLine (short h0, short v0, short h1, short v1, long color)
|
||||
// sides with color 2. A rect can be made to appear "hi-lit" or "3D"<22>
|
||||
// in this way.
|
||||
|
||||
void HiliteRect (Rect *theRect, short color1, short color2)
|
||||
void HiliteRect (DrawSurface *surface, const Rect &theRect, short color1, short color2)
|
||||
{
|
||||
ColorLine(theRect->left, theRect->top, theRect->right - 2,
|
||||
theRect->top, color1);
|
||||
ColorLine(theRect->left, theRect->top, theRect->left,
|
||||
theRect->bottom - 2, color1);
|
||||
ColorLine(theRect->right - 1, theRect->top, theRect->right - 1,
|
||||
theRect->bottom - 2, color2);
|
||||
ColorLine(theRect->left + 1, theRect->bottom - 1, theRect->right - 1,
|
||||
theRect->bottom - 1, color2);
|
||||
ColorLine(surface, theRect.left, theRect.top, theRect.right - 2,
|
||||
theRect.top, color1);
|
||||
ColorLine(surface, theRect.left, theRect.top, theRect.left,
|
||||
theRect.bottom - 2, color1);
|
||||
ColorLine(surface, theRect.right - 1, theRect.top, theRect.right - 1,
|
||||
theRect.bottom - 2, color2);
|
||||
ColorLine(surface, theRect.left + 1, theRect.bottom - 1, theRect.right - 1,
|
||||
theRect.bottom - 1, color2);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- ColorFrameRect
|
||||
@@ -118,15 +113,14 @@ void HiliteRect (Rect *theRect, short color1, short color2)
|
||||
// Given a rectangle and color index, this function frames a<>
|
||||
// rectangle in that color. Current port, pen mode, etc. assumed.
|
||||
|
||||
void ColorFrameRect (Rect *theRect, long color)
|
||||
void ColorFrameRect (DrawSurface *surface, const Rect &theRect, long color)
|
||||
{
|
||||
RGBColor theRGBColor, wasColor;
|
||||
|
||||
GetForeColor(&wasColor);
|
||||
Index2Color(color, &theRGBColor);
|
||||
RGBForeColor(&theRGBColor);
|
||||
FrameRect(theRect);
|
||||
RGBForeColor(&wasColor);
|
||||
const PortabilityLayer::RGBAColor &rgbaColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[color];
|
||||
|
||||
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
|
||||
surface->SetForeColor(rgbaColor);
|
||||
surface->FrameRect(theRect);
|
||||
surface->SetForeColor(wasColor);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- ColorFrameWHRect
|
||||
@@ -135,7 +129,7 @@ void ColorFrameRect (Rect *theRect, long color)
|
||||
// and a color index, this function frames a rectangle in that color.
|
||||
// Current port, pen mode, etc. assumed.
|
||||
|
||||
void ColorFrameWHRect (short left, short top, short wide, short high, long color)
|
||||
void ColorFrameWHRect (DrawSurface *surface, short left, short top, short wide, short high, long color)
|
||||
{
|
||||
Rect theRect;
|
||||
|
||||
@@ -143,7 +137,7 @@ void ColorFrameWHRect (short left, short top, short wide, short high, long color
|
||||
theRect.top = top;
|
||||
theRect.right = left + wide;
|
||||
theRect.bottom = top + high;
|
||||
ColorFrameRect(&theRect, color);
|
||||
ColorFrameRect(surface, theRect, color);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- ColorFrameOval
|
||||
@@ -151,15 +145,14 @@ void ColorFrameWHRect (short left, short top, short wide, short high, long color
|
||||
// Given a rectangle and color index, this function frames an<61>
|
||||
// oval in that color. Current port, pen mode, etc. assumed.
|
||||
|
||||
void ColorFrameOval (Rect *theRect, long color)
|
||||
void ColorFrameOval (DrawSurface *surface, const Rect &theRect, long color)
|
||||
{
|
||||
RGBColor theRGBColor, wasColor;
|
||||
|
||||
GetForeColor(&wasColor);
|
||||
Index2Color(color, &theRGBColor);
|
||||
RGBForeColor(&theRGBColor);
|
||||
FrameOval(theRect);
|
||||
RGBForeColor(&wasColor);
|
||||
const PortabilityLayer::RGBAColor &rgbaColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[color];
|
||||
|
||||
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
|
||||
surface->SetForeColor(rgbaColor);
|
||||
surface->FrameEllipse(theRect);
|
||||
surface->SetForeColor(wasColor);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- LtGrayForeColor
|
||||
@@ -167,15 +160,9 @@ void ColorFrameOval (Rect *theRect, long color)
|
||||
// This function finds the closest match to a "light gray" in the<68>
|
||||
// current palette and sets the pen color to that.
|
||||
|
||||
void LtGrayForeColor (void)
|
||||
void LtGrayForeColor (DrawSurface *surface)
|
||||
{
|
||||
RGBColor color;
|
||||
|
||||
color.red = (unsigned short) 0xBFFF;
|
||||
color.green = (unsigned short) 0xBFFF;
|
||||
color.blue = (unsigned short) 0xBFFF;
|
||||
|
||||
RGBForeColor(&color);
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(191, 191, 191, 255));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- GrayForeColor
|
||||
@@ -183,15 +170,9 @@ void LtGrayForeColor (void)
|
||||
// This function finds the closest match to a "medium gray" in the<68>
|
||||
// current palette and sets the pen color to that.
|
||||
|
||||
void GrayForeColor (void)
|
||||
void GrayForeColor (DrawSurface *surface)
|
||||
{
|
||||
RGBColor color;
|
||||
|
||||
color.red = (unsigned short) 0x7FFF;
|
||||
color.green = (unsigned short) 0x7FFF;
|
||||
color.blue = (unsigned short) 0x7FFF;
|
||||
|
||||
RGBForeColor(&color);
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(127, 127, 127, 255));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DkGrayForeColor
|
||||
@@ -199,13 +180,7 @@ void GrayForeColor (void)
|
||||
// This function finds the closest match to a "dark gray" in the<68>
|
||||
// current palette and sets the pen color to that.
|
||||
|
||||
void DkGrayForeColor (void)
|
||||
void DkGrayForeColor (DrawSurface *surface)
|
||||
{
|
||||
RGBColor color;
|
||||
|
||||
color.red = (unsigned short) 0x3FFF;
|
||||
color.green = (unsigned short) 0x3FFF;
|
||||
color.blue = (unsigned short) 0x3FFF;
|
||||
|
||||
RGBForeColor(&color);
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(63, 63, 63, 255));
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "PLNumberFormatting.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "Marquee.h"
|
||||
@@ -67,11 +68,14 @@ void UpdateCoordWindow (void)
|
||||
|
||||
if (coordWindow == nil)
|
||||
return;
|
||||
|
||||
DrawSurface *surface = coordWindow->GetDrawSurface();
|
||||
|
||||
surface->SetForeColor(StdColors::White());
|
||||
surface->FillRect(coordWindowRect);
|
||||
|
||||
GetPort(&wasPort);
|
||||
SetPort((GrafPtr)coordWindow);
|
||||
EraseRect(&coordWindowRect);
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
|
||||
PasStringCopy(PSTR("h: "), tempStr);
|
||||
if (coordH != -1)
|
||||
{
|
||||
@@ -80,8 +84,8 @@ void UpdateCoordWindow (void)
|
||||
}
|
||||
else
|
||||
PasStringConcat(tempStr, PSTR("-"));
|
||||
MoveTo(5, 12);
|
||||
DrawString(tempStr);
|
||||
|
||||
surface->DrawString(Point::Create(5, 12), tempStr);
|
||||
|
||||
PasStringCopy(PSTR("v: "), tempStr);
|
||||
if (coordV != -1)
|
||||
@@ -91,10 +95,10 @@ void UpdateCoordWindow (void)
|
||||
}
|
||||
else
|
||||
PasStringConcat(tempStr, PSTR("-"));
|
||||
MoveTo(4, 22);
|
||||
DrawString(tempStr);
|
||||
|
||||
surface->DrawString(Point::Create(4, 22), tempStr);
|
||||
|
||||
ForeColor(blueColor);
|
||||
surface->SetForeColor(StdColors::Blue());
|
||||
PasStringCopy(PSTR("d: "), tempStr);
|
||||
if (coordD != -1)
|
||||
{
|
||||
@@ -103,11 +107,9 @@ void UpdateCoordWindow (void)
|
||||
}
|
||||
else
|
||||
PasStringConcat(tempStr, PSTR("-"));
|
||||
MoveTo(5, 32);
|
||||
DrawString(tempStr);
|
||||
ForeColor(blackColor);
|
||||
|
||||
SetPort((GrafPtr)wasPort);
|
||||
|
||||
surface->DrawString(Point::Create(5, 32), tempStr);
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -152,8 +154,8 @@ void OpenCoordWindow (void)
|
||||
coordH = -1;
|
||||
coordV = -1;
|
||||
coordD = -1;
|
||||
TextFace(applFont);
|
||||
TextSize(9);
|
||||
|
||||
coordWindow->GetDrawSurface()->SetApplicationFont(9, 0);
|
||||
|
||||
if (objActive != kNoObjectSelected)
|
||||
{
|
||||
|
||||
@@ -4,13 +4,16 @@
|
||||
//----------------------------------------------------------------------------
|
||||
//============================================================================
|
||||
|
||||
|
||||
#include "DialogManager.h"
|
||||
#include "PLControlDefinitions.h"
|
||||
#include "PLLowMem.h"
|
||||
#include "PLNumberFormatting.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "QDStandardPalette.h"
|
||||
#include "DialogUtils.h"
|
||||
#include "Externs.h"
|
||||
#include "FontFamily.h"
|
||||
|
||||
|
||||
#define kActive 0
|
||||
@@ -24,12 +27,13 @@
|
||||
|
||||
void BringUpDialog (DialogPtr *theDialog, short dialogID)
|
||||
{
|
||||
*theDialog = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(dialogID, kPutInFront);
|
||||
|
||||
// CenterDialog(dialogID);
|
||||
*theDialog = GetNewDialog(dialogID, nil, kPutInFront);
|
||||
if (*theDialog == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetPort((GrafPtr)*theDialog);
|
||||
ShowWindow(GetDialogWindow(*theDialog));
|
||||
ShowWindow((*theDialog)->GetWindow());
|
||||
DrawDefaultButton(*theDialog);
|
||||
}
|
||||
|
||||
@@ -616,9 +620,10 @@ void DrawDialogUserText (DialogPtr dial, short item, StringPtr text, Boolean inv
|
||||
ControlHandle iHandle;
|
||||
Str255 newString, stringCopy;
|
||||
short iType, textLong, i, inset;
|
||||
|
||||
TextFont(applFont);
|
||||
TextSize(9);
|
||||
|
||||
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
|
||||
|
||||
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None);
|
||||
|
||||
PasStringCopy(text, stringCopy);
|
||||
GetDialogItem(dial, item, &iType, &iHandle, &iRect);
|
||||
@@ -629,7 +634,11 @@ void DrawDialogUserText (DialogPtr dial, short item, StringPtr text, Boolean inv
|
||||
newString[i] = stringCopy[i + 1];
|
||||
|
||||
OffsetRect(&iRect, 0, 1);
|
||||
EraseRect(&iRect);
|
||||
|
||||
surface->SetForeColor(StdColors::White());
|
||||
surface->FillRect(iRect);
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
|
||||
OffsetRect(&iRect, 0, -1);
|
||||
|
||||
inset = ((iRect.right - iRect.left) - (StringWidth(stringCopy) + 2)) / 2;
|
||||
@@ -655,16 +664,17 @@ void DrawDialogUserText2 (DialogPtr dial, short item, StringPtr text)
|
||||
ControlHandle iHandle;
|
||||
Str255 stringCopy;
|
||||
short iType;
|
||||
|
||||
TextFont(applFont);
|
||||
TextSize(9);
|
||||
|
||||
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
|
||||
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_None);
|
||||
|
||||
PasStringCopy(text, stringCopy);
|
||||
GetDialogItem(dial, item, &iType, &iHandle, &iRect);
|
||||
if ((StringWidth(stringCopy) + 2) > (iRect.right - iRect.left))
|
||||
CollapseStringToWidth(stringCopy, iRect.right - iRect.left - 2);
|
||||
MoveTo(iRect.left, iRect.bottom);
|
||||
DrawString(stringCopy);
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
surface->DrawString(Point::Create(iRect.left, iRect.bottom), stringCopy);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- LoadDialogPICT
|
||||
@@ -681,7 +691,7 @@ void LoadDialogPICT (DialogPtr theDialog, short item, short theID)
|
||||
GetDialogItem(theDialog, item, &iType, &iHandle, &iRect);
|
||||
thePict = GetPicture(theID);
|
||||
if (thePict)
|
||||
DrawPicture(thePict, &iRect);
|
||||
theDialog->GetWindow()->GetDrawSurface()->DrawPicture(thePict, iRect);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- FrameDialogItem
|
||||
@@ -692,9 +702,10 @@ void FrameDialogItem (DialogPtr theDialog, short item)
|
||||
Rect itemRect;
|
||||
ControlHandle itemHandle;
|
||||
short itemType;
|
||||
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
|
||||
|
||||
GetDialogItem(theDialog, item, &itemType, &itemHandle, &itemRect);
|
||||
FrameRect(&itemRect);
|
||||
surface->FrameRect(itemRect);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- FrameDialogItemC
|
||||
@@ -702,17 +713,17 @@ void FrameDialogItem (DialogPtr theDialog, short item)
|
||||
|
||||
void FrameDialogItemC (DialogPtr theDialog, short item, long color)
|
||||
{
|
||||
RGBColor theRGBColor, wasColor;
|
||||
Rect itemRect;
|
||||
ControlHandle itemHandle;
|
||||
short itemType;
|
||||
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
|
||||
|
||||
GetDialogItem(theDialog, item, &itemType, &itemHandle, &itemRect);
|
||||
GetForeColor(&wasColor);
|
||||
Index2Color(color, &theRGBColor);
|
||||
RGBForeColor(&theRGBColor);
|
||||
FrameRect(&itemRect);
|
||||
RGBForeColor(&wasColor);
|
||||
|
||||
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
|
||||
surface->SetForeColor(PortabilityLayer::StandardPalette::GetInstance()->GetColors()[color]);
|
||||
surface->FrameRect(itemRect);
|
||||
surface->SetForeColor(wasColor);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- FrameOvalDialogItem
|
||||
@@ -725,7 +736,8 @@ void FrameOvalDialogItem (DialogPtr theDialog, short item)
|
||||
short itemType;
|
||||
|
||||
GetDialogItem(theDialog, item, &itemType, &itemHandle, &itemRect);
|
||||
FrameOval(&itemRect);
|
||||
|
||||
theDialog->GetWindow()->GetDrawSurface()->FrameEllipse(itemRect);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- BorderDialogItem
|
||||
@@ -744,29 +756,35 @@ void BorderDialogItem (DialogPtr theDialog, short item, short sides)
|
||||
// 8 = right ... so 6 = top & bottom, 15 = all 4 sides
|
||||
|
||||
GetDialogItem(theDialog, item, &itemType, &itemHandle, &itemRect);
|
||||
|
||||
|
||||
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
|
||||
|
||||
if (sides >= 8) // 8 = right
|
||||
{
|
||||
MoveTo(itemRect.right, itemRect.top);
|
||||
LineTo(itemRect.right, itemRect.bottom);
|
||||
const Point pointA = Point::Create(itemRect.right, itemRect.top);
|
||||
const Point pointB = Point::Create(itemRect.right, itemRect.bottom);
|
||||
surface->DrawLine(pointA, pointB);
|
||||
sides -= 8;
|
||||
}
|
||||
if (sides >= 4) // 4 = bottom
|
||||
{
|
||||
MoveTo(itemRect.left, itemRect.bottom);
|
||||
LineTo(itemRect.right, itemRect.bottom);
|
||||
const Point pointA = Point::Create(itemRect.left, itemRect.bottom);
|
||||
const Point pointB = Point::Create(itemRect.right, itemRect.bottom);
|
||||
surface->DrawLine(pointA, pointB);
|
||||
sides -= 4;
|
||||
}
|
||||
if (sides >= 2) // 2 = top
|
||||
{
|
||||
MoveTo(itemRect.left, itemRect.top - 1);
|
||||
LineTo(itemRect.right, itemRect.top - 1);
|
||||
const Point pointA = Point::Create(itemRect.left, itemRect.top - 1);
|
||||
const Point pointB = Point::Create(itemRect.right, itemRect.top - 1);
|
||||
surface->DrawLine(pointA, pointB);
|
||||
sides -= 2;
|
||||
}
|
||||
if (sides >= 1) // 1 = left
|
||||
{
|
||||
MoveTo(itemRect.left - 1, itemRect.top);
|
||||
LineTo(itemRect.left - 1, itemRect.bottom);
|
||||
const Point pointA = Point::Create(itemRect.left - 1, itemRect.top);
|
||||
const Point pointB = Point::Create(itemRect.left - 1, itemRect.bottom);
|
||||
surface->DrawLine(pointA, pointB);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -778,14 +796,18 @@ void ShadowDialogItem (DialogPtr theDialog, short item, short thickness)
|
||||
Rect itemRect;
|
||||
ControlHandle itemHandle;
|
||||
short itemType;
|
||||
|
||||
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
|
||||
|
||||
GetDialogItem(theDialog, item, &itemType, &itemHandle, &itemRect);
|
||||
PenSize(thickness, thickness);
|
||||
MoveTo(itemRect.left + thickness, itemRect.bottom);
|
||||
Line(itemRect.right - itemRect.left - thickness, 0);
|
||||
MoveTo(itemRect.right, itemRect.top + thickness);
|
||||
Line(0, itemRect.bottom - itemRect.top - thickness);
|
||||
PenNormal();
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
const Point bottomLeftCorner = Point::Create(itemRect.left + thickness, itemRect.bottom);
|
||||
const Point topRightCorner = Point::Create(itemRect.right, itemRect.top + thickness);
|
||||
const Point bottomRightCorner = Point::Create(itemRect.right + thickness, itemRect.bottom + thickness);
|
||||
|
||||
surface->FillRect(Rect::Create(topRightCorner.v, topRightCorner.h, bottomRightCorner.v, bottomRightCorner.h));
|
||||
surface->FillRect(Rect::Create(bottomLeftCorner.v, bottomLeftCorner.h, bottomRightCorner.v, bottomRightCorner.h));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- EraseDialogItem
|
||||
@@ -798,6 +820,10 @@ void EraseDialogItem (DialogPtr theDialog, short item)
|
||||
short itemType;
|
||||
|
||||
GetDialogItem(theDialog, item, &itemType, &itemHandle, &itemRect);
|
||||
EraseRect(&itemRect);
|
||||
|
||||
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
|
||||
surface->SetForeColor(StdColors::White());
|
||||
surface->FillRect(itemRect);
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
}
|
||||
|
||||
|
||||
@@ -578,8 +578,7 @@ void HandleOutlet (short who)
|
||||
}
|
||||
else
|
||||
{
|
||||
// SetPort((GrafPtr)workSrcMap);
|
||||
PaintRect(&dinahs[who].dest);
|
||||
workSrcMap->FillRect(dinahs[who].dest);
|
||||
}
|
||||
AddRectToWorkRects(&dinahs[who].dest);
|
||||
}
|
||||
|
||||
@@ -70,10 +70,6 @@ void HandleMouseEvent (EventRecord *theEvent)
|
||||
|
||||
switch (thePart)
|
||||
{
|
||||
case inSysWindow:
|
||||
// SystemClick(theEvent, whichWindow);
|
||||
break;
|
||||
|
||||
case inMenuBar:
|
||||
menuChoice = MenuSelect(theEvent->where);
|
||||
DoMenuChoice(menuChoice);
|
||||
@@ -333,43 +329,36 @@ void HandleUpdateEvent (EventRecord *theEvent)
|
||||
if ((WindowPtr)theEvent->message == mainWindow)
|
||||
{
|
||||
SetPort((GrafPtr)mainWindow);
|
||||
BeginUpdate(mainWindow);
|
||||
UpdateMainWindow();
|
||||
EndUpdate(mainWindow);
|
||||
}
|
||||
else if ((WindowPtr)theEvent->message == mapWindow)
|
||||
{
|
||||
SetPort((GrafPtr)mapWindow);
|
||||
BeginUpdate(mapWindow);
|
||||
UpdateMapWindow();
|
||||
EndUpdate(mapWindow);
|
||||
}
|
||||
else if ((WindowPtr)theEvent->message == toolsWindow)
|
||||
{
|
||||
SetPort((GrafPtr)toolsWindow);
|
||||
BeginUpdate(toolsWindow);
|
||||
UpdateToolsWindow();
|
||||
EndUpdate(toolsWindow);
|
||||
}
|
||||
else if ((WindowPtr)theEvent->message == linkWindow)
|
||||
{
|
||||
SetPort((GrafPtr)linkWindow);
|
||||
BeginUpdate(linkWindow);
|
||||
UpdateLinkWindow();
|
||||
EndUpdate(linkWindow);
|
||||
}
|
||||
else if ((WindowPtr)theEvent->message == coordWindow)
|
||||
{
|
||||
SetPort((GrafPtr)coordWindow);
|
||||
BeginUpdate(coordWindow);
|
||||
UpdateCoordWindow();
|
||||
EndUpdate(coordWindow);
|
||||
}
|
||||
else if ((WindowPtr)theEvent->message == menuWindow)
|
||||
{
|
||||
SetPort((GrafPtr)menuWindow);
|
||||
BeginUpdate(menuWindow);
|
||||
UpdateMenuBarWindow();
|
||||
UpdateMenuBarWindow(menuWindow->GetDrawSurface());
|
||||
EndUpdate(menuWindow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,19 +130,19 @@ void DecrementCursor (void);
|
||||
void SpinCursor (short);
|
||||
void BackSpinCursor (short);
|
||||
|
||||
void ColorText (StringPtr, long); // --- ColorUtils.c
|
||||
void ColorRect (Rect *, long);
|
||||
void ColorOval (Rect *, long);
|
||||
void ColorRegion (PortabilityLayer::ScanlineMask *scanlineMask, long colorIndex);
|
||||
void ColorLine (short, short, short, short, long);
|
||||
void HiliteRect (Rect *, short, short);
|
||||
void ColorFrameRect (Rect *, long);
|
||||
void ColorFrameWHRect (short, short, short, short, long);
|
||||
void ColorFrameOval (Rect *, long);
|
||||
void LtGrayForeColor (void);
|
||||
void GrayForeColor (void);
|
||||
void DkGrayForeColor (void);
|
||||
void RestoreColorsSlam (void);
|
||||
void ColorText (DrawSurface *surface, const Point &, StringPtr, long); // --- ColorUtils.c
|
||||
void ColorRect (DrawSurface *surface, const Rect &, long);
|
||||
void ColorOval (DrawSurface *surface, const Rect &, long);
|
||||
void ColorRegion (DrawSurface *surface, PortabilityLayer::ScanlineMask *scanlineMask, long colorIndex);
|
||||
void ColorLine (DrawSurface *surface, short, short, short, short, long);
|
||||
void HiliteRect (DrawSurface *surface, const Rect &rect, short, short);
|
||||
void ColorFrameRect (DrawSurface *surface, const Rect &theRect, long colorIndex);
|
||||
void ColorFrameWHRect (DrawSurface *surface, short, short, short, short, long);
|
||||
void ColorFrameOval (DrawSurface *surface, const Rect &, long);
|
||||
void LtGrayForeColor (DrawSurface *surface);
|
||||
void GrayForeColor (DrawSurface *surface);
|
||||
void DkGrayForeColor (DrawSurface *surface);
|
||||
void RestoreColorsSlam (DrawSurface *surface);
|
||||
|
||||
void MonitorWait (void); // --- DebugUtils.c
|
||||
void DisplayRect (Rect *);
|
||||
@@ -155,7 +155,6 @@ void FlashShort (short);
|
||||
void DoBarGraph (short, short, short, short);
|
||||
short BetaOkay (void);
|
||||
void DebugNum (long);
|
||||
void DisplayCTSeed (CGrafPtr);
|
||||
void FillScreenRed (void);
|
||||
void DumpToResEditFile (Ptr, long);
|
||||
|
||||
@@ -195,27 +194,18 @@ short RandomInt (short);
|
||||
long RandomLong (long);
|
||||
void InitRandomLongQUS (void);
|
||||
UInt32 RandomLongQUS (void);
|
||||
//void CenterAlert (short);
|
||||
void RedAlert (short);
|
||||
//void CreateOffScreenBitMap (Rect *, GrafPtr *);
|
||||
//void CreateOffScreenPixMap (Rect *, CGrafPtr *);
|
||||
//void KillOffScreenPixMap (CGrafPtr);
|
||||
//void KillOffScreenBitMap (GrafPtr);
|
||||
void LoadGraphic (short);
|
||||
void LoadScaledGraphic (short, Rect *);
|
||||
//void PlotSICN (Rect *, SICNHand, long);
|
||||
void LoadGraphic (DrawSurface *, short);
|
||||
void LoadScaledGraphic (DrawSurface *, short, Rect *);
|
||||
void LargeIconPlot (Rect *, short);
|
||||
void DrawCIcon (short, short, short);
|
||||
char KeyMapOffsetFromRawKey (char);
|
||||
long LongSquareRoot (long);
|
||||
//void HideMenuBarOld (void);
|
||||
//void ShowMenuBarOld (void);
|
||||
Boolean WaitForInputEvent (short);
|
||||
void WaitCommandQReleased (void);
|
||||
void GetKeyName (intptr_t, StringPtr);
|
||||
Boolean OptionKeyDown (void);
|
||||
long ExtractCTSeed (CGrafPtr);
|
||||
//void ForceCTSeed (CGrafPtr, long);
|
||||
long ExtractCTSeed (DrawSurface *);
|
||||
void DelayTicks (long);
|
||||
void UnivGetSoundVolume (short *, Boolean);
|
||||
void UnivSetSoundVolume (short, Boolean);
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "FontManager.h"
|
||||
#include "FontFamily.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Objects.h"
|
||||
#include "RectUtils.h"
|
||||
@@ -41,8 +43,8 @@ void DrawPages (void);
|
||||
|
||||
pageType pages[8];
|
||||
Rect pageSrcRect, pageSrc[kPageFrames], lettersSrc[8], angelSrcRect;
|
||||
GWorldPtr pageSrcMap, gameOverSrcMap, angelSrcMap;
|
||||
GWorldPtr pageMaskMap, angelMaskMap;
|
||||
DrawSurface *pageSrcMap, *gameOverSrcMap, *angelSrcMap;
|
||||
DrawSurface *pageMaskMap, *angelMaskMap;
|
||||
short countDown, stopPages, pagesStuck;
|
||||
Boolean gameOver;
|
||||
|
||||
@@ -59,11 +61,12 @@ extern Boolean playing, shadowVisible, demoGoing;
|
||||
// completed the house.
|
||||
|
||||
void DoGameOver (void)
|
||||
{
|
||||
{
|
||||
DrawSurface *surface = mainWindow->GetDrawSurface();
|
||||
playing = false;
|
||||
SetUpFinalScreen();
|
||||
SetPort((GrafPtr)mainWindow);
|
||||
ColorRect(&mainWindowRect, 244);
|
||||
ColorRect(surface, mainWindowRect, 244);
|
||||
DoGameOverStarAnimation();
|
||||
if (!TestHighScore())
|
||||
RedrawSplashScreen();
|
||||
@@ -80,12 +83,12 @@ void SetUpFinalScreen (void)
|
||||
Str255 tempStr, subStr;
|
||||
short count, offset, i, textDown;
|
||||
char wasState;
|
||||
DrawSurface *surface = workSrcMap;
|
||||
|
||||
SetPort((GrafPtr)workSrcMap);
|
||||
ColorRect(&workSrcRect, 244);
|
||||
ColorRect(surface, workSrcRect, 244);
|
||||
QSetRect(&tempRect, 0, 0, 640, 460);
|
||||
CenterRectInRect(&tempRect, &workSrcRect);
|
||||
LoadScaledGraphic(kMilkywayPictID, &tempRect);
|
||||
LoadScaledGraphic(surface, kMilkywayPictID, &tempRect);
|
||||
textDown = tempRect.top;
|
||||
if (textDown < 0)
|
||||
textDown = 0;
|
||||
@@ -98,16 +101,17 @@ void SetUpFinalScreen (void)
|
||||
GetLineOfText(tempStr, count, subStr);
|
||||
offset = ((thisMac.screen.right - thisMac.screen.left) -
|
||||
TextWidth(subStr, 1, subStr[0])) / 2;
|
||||
TextFont(applFont);
|
||||
TextFace(bold);
|
||||
TextSize(12);
|
||||
ForeColor(blackColor);
|
||||
MoveTo(offset + 1, textDown + 33 + (count * 20));
|
||||
DrawString(subStr);
|
||||
ForeColor(whiteColor);
|
||||
MoveTo(offset, textDown + 32 + (count * 20));
|
||||
DrawString(subStr);
|
||||
ForeColor(blackColor);
|
||||
|
||||
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
||||
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
|
||||
const Point textShadowPos = Point::Create(offset + 1, textDown + 33 + (count * 20));
|
||||
|
||||
surface->DrawString(textShadowPos, subStr);
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
|
||||
|
||||
const Point textPos = Point::Create(offset, textDown + 32 + (count * 20));
|
||||
surface->DrawString(textPos, subStr);
|
||||
count++;
|
||||
}
|
||||
while (subStr[0] > 0);
|
||||
@@ -251,24 +255,18 @@ void InitDiedGameOver (void)
|
||||
#define kPageRightOffset 128
|
||||
#define kPageBackUp 128
|
||||
short i;
|
||||
CGrafPtr wasCPort;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
QSetRect(&pageSrcRect, 0, 0, 25, 32 * 8);
|
||||
theErr = CreateOffScreenGWorld(&gameOverSrcMap, &pageSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(gameOverSrcMap);
|
||||
LoadGraphic(kLettersPictID);
|
||||
LoadGraphic(gameOverSrcMap, kLettersPictID);
|
||||
|
||||
QSetRect(&pageSrcRect, 0, 0, 32, 32 * kPageFrames);
|
||||
theErr = CreateOffScreenGWorld(&pageSrcMap, &pageSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(pageSrcMap);
|
||||
LoadGraphic(kPagesPictID);
|
||||
LoadGraphic(pageSrcMap, kPagesPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&pageMaskMap, &pageSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(pageMaskMap);
|
||||
LoadGraphic(kPagesMaskID);
|
||||
LoadGraphic(pageMaskMap, kPagesMaskID);
|
||||
|
||||
for (i = 0; i < kPageFrames; i++) // initialize src page rects
|
||||
{
|
||||
|
||||
@@ -8,5 +8,5 @@
|
||||
#include "PLQDOffscreen.h"
|
||||
|
||||
|
||||
extern GWorldPtr angelSrcMap;
|
||||
extern GWorldPtr angelMaskMap;
|
||||
extern DrawSurface *angelSrcMap;
|
||||
extern DrawSurface *angelMaskMap;
|
||||
|
||||
@@ -146,7 +146,7 @@ void HandleLinkClick (Point);
|
||||
|
||||
void RedrawSplashScreen (void); // --- MainWindow.c
|
||||
void UpdateMainWindow (void);
|
||||
void UpdateMenuBarWindow (void);
|
||||
void UpdateMenuBarWindow (DrawSurface *surface);
|
||||
void OpenMainWindow (void);
|
||||
void CloseMainWindow (void);
|
||||
void ZoomBetweenWindows (void);
|
||||
@@ -173,9 +173,9 @@ void StopMarquee (void);
|
||||
void PauseMarquee (void);
|
||||
void ResumeMarquee (void);
|
||||
void DragOutMarqueeRect (Point, Rect *);
|
||||
void DragMarqueeRect (Point, Rect *, Boolean, Boolean);
|
||||
void DragMarqueeHandle (Point, SInt16 *);
|
||||
void DragMarqueeCorner (Point, SInt16 *, SInt16 *, Boolean);
|
||||
void DragMarqueeRect (DrawSurface *, Point, Rect *, Boolean, Boolean);
|
||||
void DragMarqueeHandle (DrawSurface *, Point, SInt16 *);
|
||||
void DragMarqueeCorner (DrawSurface *, Point, SInt16 *, SInt16 *, Boolean);
|
||||
Boolean MarqueeHasHandles (SInt16 *, SInt16 *);
|
||||
Boolean PtInMarqueeHandle (Point);
|
||||
void SetMarqueeGliderRect (SInt16, SInt16);
|
||||
@@ -305,7 +305,7 @@ void DrawCustPictSansWhite (SInt16, Rect *);
|
||||
|
||||
void DrawARoomsObjects (SInt16, Boolean); // --- ObjectDrawAll.c
|
||||
|
||||
void DoSelectionClick (Point, Boolean); // --- ObjectEdit.c
|
||||
void DoSelectionClick (DrawSurface *, Point, Boolean); // --- ObjectEdit.c
|
||||
void DoNewObjectClick (Point);
|
||||
void DeleteObject (void);
|
||||
void DuplicateObject (void);
|
||||
@@ -428,7 +428,7 @@ void QuickBandsRefresh (Boolean);
|
||||
void QuickFoilRefresh (Boolean);
|
||||
void HandleScore (void);
|
||||
void AdjustScoreboardHeight (void);
|
||||
void BlackenScoreboard (void);
|
||||
void BlackenScoreboard (DrawSurface *);
|
||||
|
||||
//void PutRoomScrap (void); // --- Scrap.c
|
||||
//void PutObjectScrap (void);
|
||||
|
||||
@@ -237,10 +237,10 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Rect dest;
|
||||
GWorldPtr map;
|
||||
short where;
|
||||
short who;
|
||||
Rect dest;
|
||||
DrawSurface *map;
|
||||
short where;
|
||||
short who;
|
||||
} savedType, *savedPtr;
|
||||
|
||||
typedef struct
|
||||
|
||||
@@ -103,16 +103,10 @@ void HandleGrease (void)
|
||||
}
|
||||
|
||||
{
|
||||
CGrafPtr wasCPort = GetGraphicsPort();
|
||||
backSrcMap->FillRect(src);
|
||||
|
||||
SetGraphicsPort(backSrcMap);
|
||||
PaintRect(&src);
|
||||
|
||||
SetGraphicsPort(workSrcMap);
|
||||
PaintRect(&src);
|
||||
workSrcMap->FillRect(src);
|
||||
AddRectToWorkRects(&src);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
|
||||
if (grease[i].isRight)
|
||||
@@ -266,7 +260,7 @@ void SpillGrease (short who, short index)
|
||||
|
||||
void RedrawAllGrease (void)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
DrawSurface *wasCPort;
|
||||
Rect src;
|
||||
short i;
|
||||
|
||||
@@ -284,11 +278,9 @@ void RedrawAllGrease (void)
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
SetGraphicsPort(backSrcMap);
|
||||
PaintRect(&src);
|
||||
backSrcMap->FillRect(src);
|
||||
|
||||
SetGraphicsPort(workSrcMap);
|
||||
PaintRect(&src);
|
||||
workSrcMap->FillRect(src);
|
||||
AddRectToWorkRects(&src);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "FileManager.h"
|
||||
#include "FontFamily.h"
|
||||
#include "FontManager.h"
|
||||
#include "House.h"
|
||||
#include "IOStream.h"
|
||||
#include "MainWindow.h"
|
||||
@@ -38,7 +40,7 @@ namespace PortabilityLayer
|
||||
#define kBannerScoreNCharsItem 5
|
||||
|
||||
|
||||
void DrawHighScores (void);
|
||||
void DrawHighScores (DrawSurface *);
|
||||
void UpdateNameDialog (DialogPtr);
|
||||
Boolean NameFilter (DialogPtr, EventRecord *, short *);
|
||||
void GetHighScoreName (short);
|
||||
@@ -67,17 +69,17 @@ void DoHighScores (void)
|
||||
|
||||
SpinCursor(3);
|
||||
SetPort((GrafPtr)workSrcMap);
|
||||
PaintRect(&workSrcRect);
|
||||
workSrcMap->FillRect(workSrcRect);
|
||||
QSetRect(&tempRect, 0, 0, 640, 480);
|
||||
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
|
||||
LoadScaledGraphic(kStarPictID, &tempRect);
|
||||
LoadScaledGraphic(workSrcMap, kStarPictID, &tempRect);
|
||||
// if (quickerTransitions)
|
||||
// DissBitsChunky(&workSrcRect);
|
||||
// else
|
||||
// DissBits(&workSrcRect);
|
||||
SpinCursor(3);
|
||||
SetPort((GrafPtr)workSrcMap);
|
||||
DrawHighScores();
|
||||
|
||||
DrawHighScores(workSrcMap);
|
||||
SpinCursor(3);
|
||||
// if (quickerTransitions)
|
||||
// DissBitsChunky(&workSrcRect);
|
||||
@@ -97,30 +99,31 @@ void DoHighScores (void)
|
||||
#define kScoreWide 352
|
||||
#define kKimsLifted 4
|
||||
|
||||
void DrawHighScores (void)
|
||||
void DrawHighScores (DrawSurface *surface)
|
||||
{
|
||||
GWorldPtr tempMap, tempMask;
|
||||
CGrafPtr wasCPort;
|
||||
DrawSurface *tempMap, *tempMask;
|
||||
DrawSurface *wasCPort;
|
||||
PLError_t theErr;
|
||||
houseType *thisHousePtr;
|
||||
Rect tempRect, tempRect2;
|
||||
Str255 tempStr;
|
||||
short scoreLeft, bannerWidth, i, dropIt;
|
||||
char wasState;
|
||||
PortabilityLayer::RGBAColor blackColor = PortabilityLayer::RGBAColor::Create(0, 0, 0, 255);
|
||||
PortabilityLayer::RGBAColor yellowColor = PortabilityLayer::RGBAColor::Create(255, 255, 0, 255);
|
||||
PortabilityLayer::RGBAColor cyanColor = PortabilityLayer::RGBAColor::Create(0, 255, 255, 255);
|
||||
PortabilityLayer::RGBAColor whiteColor = PortabilityLayer::RGBAColor::Create(255, 255, 255, 255);
|
||||
PortabilityLayer::RGBAColor blueColor = PortabilityLayer::RGBAColor::Create(0, 0, 255, 255);
|
||||
|
||||
scoreLeft = ((thisMac.screen.right - thisMac.screen.left) - kScoreWide) / 2;
|
||||
dropIt = 129 + splashOriginV;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
QSetRect(&tempRect, 0, 0, 332, 30);
|
||||
theErr = CreateOffScreenGWorld(&tempMap, &tempRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(tempMap);
|
||||
LoadGraphic(kHighScoresPictID);
|
||||
LoadGraphic(tempMap, kHighScoresPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&tempMask, &tempRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(tempMask);
|
||||
LoadGraphic(kHighScoresMaskID);
|
||||
LoadGraphic(tempMask, kHighScoresMaskID);
|
||||
|
||||
tempRect2 = tempRect;
|
||||
QOffsetRect(&tempRect2, scoreLeft + (kScoreWide - 332) / 2, dropIt - 60);
|
||||
@@ -132,149 +135,148 @@ void DrawHighScores (void)
|
||||
|
||||
DisposeGWorld(tempMap);
|
||||
DisposeGWorld(tempMask);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
|
||||
TextFont(applFont);
|
||||
TextFace(bold);
|
||||
TextSize(14);
|
||||
|
||||
surface->SetApplicationFont(14, PortabilityLayer::FontFamilyFlag_Bold);
|
||||
|
||||
PasStringCopy(PSTR("<EFBFBD> "), tempStr);
|
||||
PasStringConcat(tempStr, thisHouseName);
|
||||
PasStringConcat(tempStr, PSTR(" <20>"));
|
||||
MoveTo(scoreLeft + ((kScoreWide - StringWidth(tempStr)) / 2) - 1, dropIt - 66);
|
||||
ForeColor(blackColor);
|
||||
DrawString(tempStr);
|
||||
MoveTo(scoreLeft + ((kScoreWide - StringWidth(tempStr)) / 2), dropIt - 65);
|
||||
ForeColor(cyanColor);
|
||||
DrawString(tempStr);
|
||||
ForeColor(blackColor);
|
||||
|
||||
TextFont(applFont);
|
||||
TextFace(bold);
|
||||
TextSize(12);
|
||||
|
||||
|
||||
const Point scoreShadowPoint = Point::Create(scoreLeft + ((kScoreWide - StringWidth(tempStr)) / 2) - 1, dropIt - 66);
|
||||
surface->SetForeColor(blackColor);
|
||||
surface->DrawString(scoreShadowPoint, tempStr);
|
||||
|
||||
const Point scoreTextPoint = Point::Create(scoreLeft + ((kScoreWide - StringWidth(tempStr)) / 2), dropIt - 65);
|
||||
surface->SetForeColor(cyanColor);
|
||||
surface->DrawString(scoreTextPoint, tempStr);
|
||||
|
||||
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
||||
|
||||
thisHousePtr = *thisHouse;
|
||||
// message for score #1
|
||||
PasStringCopy(thisHousePtr->highScores.banner, tempStr);
|
||||
bannerWidth = StringWidth(tempStr);
|
||||
ForeColor(blackColor);
|
||||
MoveTo(scoreLeft + (kScoreWide - bannerWidth) / 2, dropIt - kKimsLifted);
|
||||
DrawString(tempStr);
|
||||
ForeColor(yellowColor);
|
||||
MoveTo(scoreLeft + (kScoreWide - bannerWidth) / 2, dropIt - kKimsLifted - 1);
|
||||
DrawString(tempStr);
|
||||
surface->SetForeColor(blackColor);
|
||||
const Point topScoreShadowPoint = Point::Create(scoreLeft + (kScoreWide - bannerWidth) / 2, dropIt - kKimsLifted);
|
||||
surface->DrawString(topScoreShadowPoint, tempStr);
|
||||
|
||||
surface->SetForeColor(yellowColor);
|
||||
const Point topScoreTextPoint = Point::Create(scoreLeft + (kScoreWide - bannerWidth) / 2, dropIt - kKimsLifted - 1);
|
||||
surface->DrawString(topScoreTextPoint, tempStr);
|
||||
|
||||
QSetRect(&tempRect, 0, 0, bannerWidth + 8, kScoreSpacing);
|
||||
QOffsetRect(&tempRect, scoreLeft - 3 + (kScoreWide - bannerWidth) / 2,
|
||||
dropIt + 5 - kScoreSpacing - kKimsLifted);
|
||||
ForeColor(blackColor);
|
||||
FrameRect(&tempRect);
|
||||
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
|
||||
surface->FrameRect(tempRect);
|
||||
QOffsetRect(&tempRect, -1, -1);
|
||||
ForeColor(yellowColor);
|
||||
FrameRect(&tempRect);
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 0, 255));
|
||||
surface->FrameRect(tempRect);
|
||||
|
||||
for (i = 0; i < kMaxScores; i++)
|
||||
{
|
||||
if (thisHousePtr->highScores.scores[i] > 0L)
|
||||
{
|
||||
Point strPos = Point::Create(0, 0);
|
||||
|
||||
SpinCursor(1);
|
||||
NumToString((long)i + 1L, tempStr); // draw placing number
|
||||
ForeColor(blackColor);
|
||||
surface->SetForeColor(blackColor);
|
||||
if (i == 0)
|
||||
MoveTo(scoreLeft + 1, dropIt - kScoreSpacing - kKimsLifted);
|
||||
strPos = Point::Create(scoreLeft + 1, dropIt - kScoreSpacing - kKimsLifted);
|
||||
else
|
||||
MoveTo(scoreLeft + 1, dropIt + (i * kScoreSpacing));
|
||||
DrawString(tempStr);
|
||||
strPos = Point::Create(scoreLeft + 1, dropIt + (i * kScoreSpacing));
|
||||
surface->DrawString(strPos, tempStr);
|
||||
if (i == lastHighScore)
|
||||
ForeColor(whiteColor);
|
||||
surface->SetForeColor(whiteColor);
|
||||
else
|
||||
ForeColor(cyanColor);
|
||||
surface->SetForeColor(cyanColor);
|
||||
if (i == 0)
|
||||
MoveTo(scoreLeft + 0, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
||||
strPos = Point::Create(scoreLeft + 0, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
||||
else
|
||||
MoveTo(scoreLeft + 0, dropIt - 1 + (i * kScoreSpacing));
|
||||
DrawString(tempStr);
|
||||
strPos = Point::Create(scoreLeft + 0, dropIt - 1 + (i * kScoreSpacing));
|
||||
surface->DrawString(strPos, tempStr);
|
||||
// draw high score name
|
||||
PasStringCopy(thisHousePtr->highScores.names[i], tempStr);
|
||||
ForeColor(blackColor);
|
||||
surface->SetForeColor(blackColor);
|
||||
if (i == 0)
|
||||
MoveTo(scoreLeft + 31, dropIt - kScoreSpacing - kKimsLifted);
|
||||
strPos = Point::Create(scoreLeft + 31, dropIt - kScoreSpacing - kKimsLifted);
|
||||
else
|
||||
MoveTo(scoreLeft + 31, dropIt + (i * kScoreSpacing));
|
||||
DrawString(tempStr);
|
||||
strPos = Point::Create(scoreLeft + 31, dropIt + (i * kScoreSpacing));
|
||||
surface->DrawString(strPos, tempStr);
|
||||
if (i == lastHighScore)
|
||||
ForeColor(whiteColor);
|
||||
surface->SetForeColor(whiteColor);
|
||||
else
|
||||
ForeColor(yellowColor);
|
||||
surface->SetForeColor(yellowColor);
|
||||
if (i == 0)
|
||||
MoveTo(scoreLeft + 30, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
||||
strPos = Point::Create(scoreLeft + 30, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
||||
else
|
||||
MoveTo(scoreLeft + 30, dropIt - 1 + (i * kScoreSpacing));
|
||||
DrawString(tempStr);
|
||||
strPos = Point::Create(scoreLeft + 30, dropIt - 1 + (i * kScoreSpacing));
|
||||
surface->DrawString(strPos, tempStr);
|
||||
// draw level number
|
||||
NumToString(thisHousePtr->highScores.levels[i], tempStr);
|
||||
ForeColor(blackColor);
|
||||
surface->SetForeColor(blackColor);
|
||||
if (i == 0)
|
||||
MoveTo(scoreLeft + 161, dropIt - kScoreSpacing - kKimsLifted);
|
||||
strPos = Point::Create(scoreLeft + 161, dropIt - kScoreSpacing - kKimsLifted);
|
||||
else
|
||||
MoveTo(scoreLeft + 161, dropIt + (i * kScoreSpacing));
|
||||
DrawString(tempStr);
|
||||
strPos = Point::Create(scoreLeft + 161, dropIt + (i * kScoreSpacing));
|
||||
surface->DrawString(strPos, tempStr);
|
||||
if (i == lastHighScore)
|
||||
ForeColor(whiteColor);
|
||||
surface->SetForeColor(whiteColor);
|
||||
else
|
||||
ForeColor(yellowColor);
|
||||
surface->SetForeColor(yellowColor);
|
||||
if (i == 0)
|
||||
MoveTo(scoreLeft + 160, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
||||
strPos = Point::Create(scoreLeft + 160, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
||||
else
|
||||
MoveTo(scoreLeft + 160, dropIt - 1 + (i * kScoreSpacing));
|
||||
DrawString(tempStr);
|
||||
strPos = Point::Create(scoreLeft + 160, dropIt - 1 + (i * kScoreSpacing));
|
||||
surface->DrawString(strPos, tempStr);
|
||||
// draw word "rooms"
|
||||
if (thisHousePtr->highScores.levels[i] == 1)
|
||||
GetLocalizedString(6, tempStr);
|
||||
else
|
||||
GetLocalizedString(7, tempStr);
|
||||
ForeColor(blackColor);
|
||||
surface->SetForeColor(blackColor);
|
||||
if (i == 0)
|
||||
MoveTo(scoreLeft + 193, dropIt - kScoreSpacing - kKimsLifted);
|
||||
strPos = Point::Create(scoreLeft + 193, dropIt - kScoreSpacing - kKimsLifted);
|
||||
else
|
||||
MoveTo(scoreLeft + 193, dropIt + (i * kScoreSpacing));
|
||||
DrawString(tempStr);
|
||||
ForeColor(cyanColor);
|
||||
strPos = Point::Create(scoreLeft + 193, dropIt + (i * kScoreSpacing));
|
||||
surface->DrawString(strPos, tempStr);
|
||||
surface->SetForeColor(cyanColor);
|
||||
if (i == 0)
|
||||
MoveTo(scoreLeft + 192, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
||||
strPos = Point::Create(scoreLeft + 192, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
||||
else
|
||||
MoveTo(scoreLeft + 192, dropIt - 1 + (i * kScoreSpacing));
|
||||
DrawString(tempStr);
|
||||
strPos = Point::Create(scoreLeft + 192, dropIt - 1 + (i * kScoreSpacing));
|
||||
surface->DrawString(strPos, tempStr);
|
||||
// draw high score points
|
||||
NumToString(thisHousePtr->highScores.scores[i], tempStr);
|
||||
ForeColor(blackColor);
|
||||
surface->SetForeColor(blackColor);
|
||||
if (i == 0)
|
||||
MoveTo(scoreLeft + 291, dropIt - kScoreSpacing - kKimsLifted);
|
||||
strPos = Point::Create(scoreLeft + 291, dropIt - kScoreSpacing - kKimsLifted);
|
||||
else
|
||||
MoveTo(scoreLeft + 291, dropIt + (i * kScoreSpacing));
|
||||
DrawString(tempStr);
|
||||
strPos = Point::Create(scoreLeft + 291, dropIt + (i * kScoreSpacing));
|
||||
surface->DrawString(strPos, tempStr);
|
||||
if (i == lastHighScore)
|
||||
ForeColor(whiteColor);
|
||||
surface->SetForeColor(whiteColor);
|
||||
else
|
||||
ForeColor(yellowColor);
|
||||
surface->SetForeColor(yellowColor);
|
||||
if (i == 0)
|
||||
MoveTo(scoreLeft + 290, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
||||
strPos = Point::Create(scoreLeft + 290, dropIt - 1 - kScoreSpacing - kKimsLifted);
|
||||
else
|
||||
MoveTo(scoreLeft + 290, dropIt - 1 + (i * kScoreSpacing));
|
||||
DrawString(tempStr);
|
||||
strPos = Point::Create(scoreLeft + 290, dropIt - 1 + (i * kScoreSpacing));
|
||||
surface->DrawString(strPos, tempStr);
|
||||
}
|
||||
}
|
||||
|
||||
ForeColor(blueColor);
|
||||
TextFont(applFont);
|
||||
TextFace(bold);
|
||||
TextSize(9);
|
||||
MoveTo(scoreLeft + 80, dropIt - 1 + (10 * kScoreSpacing));
|
||||
|
||||
surface->SetForeColor(blueColor);
|
||||
|
||||
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold);
|
||||
|
||||
const Point textPos = Point::Create(scoreLeft + 80, dropIt - 1 + (10 * kScoreSpacing));
|
||||
GetLocalizedString(8, tempStr);
|
||||
DrawString(tempStr);
|
||||
surface->DrawString(textPos, tempStr);
|
||||
|
||||
ForeColor(blackColor);
|
||||
surface->SetForeColor(blackColor);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- SortHighScores
|
||||
@@ -468,9 +470,8 @@ Boolean NameFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateNameDialog(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -576,9 +577,8 @@ Boolean BannerFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateBannerDialog(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
|
||||
@@ -624,9 +624,8 @@ Boolean GoToFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateGoToDialog(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "Externs.h"
|
||||
#include "DialogManager.h"
|
||||
#include "DialogUtils.h"
|
||||
|
||||
|
||||
@@ -166,9 +167,8 @@ Boolean HouseFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateHouseInfoDialog(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -230,11 +230,11 @@ void DoHouseInfo (void)
|
||||
ParamText(versStr, loVers, nRoomsStr, PSTR(""));
|
||||
|
||||
// CenterDialog(kHouseInfoDialogID);
|
||||
houseInfoDialog = GetNewDialog(kHouseInfoDialogID, nil, kPutInFront);
|
||||
houseInfoDialog = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kHouseInfoDialogID, kPutInFront);
|
||||
if (houseInfoDialog == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetPort((GrafPtr)houseInfoDialog);
|
||||
ShowWindow(GetDialogWindow(houseInfoDialog));
|
||||
ShowWindow(houseInfoDialog->GetWindow());
|
||||
|
||||
SetDialogString(houseInfoDialog, kBannerTextItem, banner);
|
||||
SetDialogString(houseInfoDialog, kTrailerTextItem, trailer);
|
||||
|
||||
@@ -80,14 +80,15 @@ void DoCommandKey (void)
|
||||
void DoPause (void)
|
||||
{
|
||||
Rect bounds;
|
||||
|
||||
SetPort((GrafPtr)mainWindow);
|
||||
|
||||
DrawSurface *surface = mainWindow->GetDrawSurface();
|
||||
|
||||
QSetRect(&bounds, 0, 0, 214, 54);
|
||||
CenterRectInRect(&bounds, &houseRect);
|
||||
if (isEscPauseKey)
|
||||
LoadScaledGraphic(kEscPausePictID, &bounds);
|
||||
LoadScaledGraphic(surface, kEscPausePictID, &bounds);
|
||||
else
|
||||
LoadScaledGraphic(kTabPausePictID, &bounds);
|
||||
LoadScaledGraphic(surface, kTabPausePictID, &bounds);
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
@@ -10,10 +10,12 @@
|
||||
#include "PLPasStr.h"
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "FontFamily.h"
|
||||
#include "House.h"
|
||||
#include "MenuManager.h"
|
||||
#include "RectUtils.h"
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "WindowDef.h"
|
||||
#include "WindowManager.h"
|
||||
|
||||
@@ -23,7 +25,7 @@
|
||||
#define kMenuWindowID 130
|
||||
|
||||
|
||||
void DrawOnSplash (void);
|
||||
void DrawOnSplash (DrawSurface *surface);
|
||||
void SetPaletteToGrays (void);
|
||||
void HardDrawMainWindow (void);
|
||||
|
||||
@@ -37,7 +39,7 @@ CursHandle diagCursorH;
|
||||
Cursor handCursor, vertCursor, horiCursor;
|
||||
Cursor diagCursor;
|
||||
Rect workSrcRect;
|
||||
GWorldPtr workSrcMap;
|
||||
DrawSurface *workSrcMap;
|
||||
Rect mainWindowRect;
|
||||
WindowPtr mainWindow, menuWindow, boardWindow;
|
||||
short isEditH, isEditV;
|
||||
@@ -56,7 +58,7 @@ extern Boolean quickerTransitions, houseIsReadOnly;
|
||||
|
||||
// Draws additional text on top of splash screen.
|
||||
|
||||
void DrawOnSplash (void)
|
||||
void DrawOnSplash(DrawSurface *surface)
|
||||
{
|
||||
Str255 houseLoadedStr;
|
||||
|
||||
@@ -64,22 +66,21 @@ void DrawOnSplash (void)
|
||||
PasStringConcat(houseLoadedStr, thisHouseName);
|
||||
if ((thisMac.hasQT) && (hasMovie))
|
||||
PasStringConcat(houseLoadedStr, PSTR(" (QT)"));
|
||||
TextSize(9);
|
||||
TextFace(1);
|
||||
TextFont(applFont);
|
||||
MoveTo(splashOriginH + 436, splashOriginV + 314);
|
||||
|
||||
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold);
|
||||
|
||||
const Point textPoint = Point::Create(splashOriginH + 436, splashOriginV + 314);
|
||||
if (thisMac.isDepth == 4)
|
||||
{
|
||||
ForeColor(whiteColor);
|
||||
DrawString(houseLoadedStr);
|
||||
ForeColor(blackColor);
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
|
||||
surface->DrawString(textPoint, houseLoadedStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (houseIsReadOnly)
|
||||
ColorText(houseLoadedStr, 5L);
|
||||
ColorText(surface, textPoint, houseLoadedStr, 5L);
|
||||
else
|
||||
ColorText(houseLoadedStr, 28L);
|
||||
ColorText(surface, textPoint, houseLoadedStr, 28L);
|
||||
}
|
||||
|
||||
#if defined(powerc) || defined(__powerc)
|
||||
@@ -101,13 +102,16 @@ void DrawOnSplash (void)
|
||||
void RedrawSplashScreen (void)
|
||||
{
|
||||
Rect tempRect;
|
||||
|
||||
SetPort((GrafPtr)workSrcMap);
|
||||
PaintRect(&workSrcRect);
|
||||
DrawSurface *surface = workSrcMap;
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
surface->FillRect(workSrcRect);
|
||||
|
||||
QSetRect(&tempRect, 0, 0, 640, 460);
|
||||
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
|
||||
LoadScaledGraphic(kSplash8BitPICT, &tempRect);
|
||||
DrawOnSplash();
|
||||
LoadScaledGraphic(surface, kSplash8BitPICT, &tempRect);
|
||||
DrawOnSplash(surface);
|
||||
|
||||
SetPortWindowPort(mainWindow);
|
||||
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||
@@ -144,17 +148,16 @@ void UpdateMainWindow (void)
|
||||
}
|
||||
else if ((theMode == kSplashMode) || (theMode == kPlayMode))
|
||||
{
|
||||
SetPort((GrafPtr)workSrcMap);
|
||||
PaintRect(&workSrcRect);
|
||||
workSrcMap->FillRect(workSrcRect);
|
||||
QSetRect(&tempRect, 0, 0, 640, 460);
|
||||
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
|
||||
LoadScaledGraphic(kSplash8BitPICT, &tempRect);
|
||||
LoadScaledGraphic(workSrcMap, kSplash8BitPICT, &tempRect);
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
||||
&workSrcRect, &mainWindowRect, srcCopy);
|
||||
SetPortWindowPort(mainWindow);
|
||||
|
||||
DrawOnSplash();
|
||||
DrawOnSplash(mainWindow->GetDrawSurface());
|
||||
}
|
||||
|
||||
splashDrawn = true;
|
||||
@@ -163,7 +166,7 @@ void UpdateMainWindow (void)
|
||||
//-------------------------------------------------------------- UpdateMenuBarWindow
|
||||
// Ugly kludge to cover over the menu bar when playing game on 2nd monitor.
|
||||
|
||||
void UpdateMenuBarWindow (void)
|
||||
void UpdateMenuBarWindow (DrawSurface *surface)
|
||||
{
|
||||
Rect bounds;
|
||||
|
||||
@@ -171,7 +174,9 @@ void UpdateMenuBarWindow (void)
|
||||
return;
|
||||
|
||||
GetLocalWindowRect(menuWindow, &bounds);
|
||||
PaintRect(&bounds);
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
surface->FillRect(bounds);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- OpenMainWindow
|
||||
@@ -206,10 +211,12 @@ void OpenMainWindow (void)
|
||||
}
|
||||
MoveWindow(mainWindow, isEditH, isEditV, true);
|
||||
ShowWindow(mainWindow);
|
||||
SetPortWindowPort(mainWindow);
|
||||
ClipRect(&mainWindowRect);
|
||||
ForeColor(blackColor);
|
||||
BackColor(whiteColor);
|
||||
|
||||
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
|
||||
|
||||
mainWindowSurface->SetClipRect(mainWindowRect);
|
||||
mainWindowSurface->SetForeColor(StdColors::Black());
|
||||
mainWindowSurface->SetBackColor(StdColors::White());
|
||||
|
||||
whichRoom = GetFirstRoomNumber();
|
||||
CopyRoomToThisRoom(whichRoom);
|
||||
@@ -249,11 +256,14 @@ void OpenMainWindow (void)
|
||||
thisMac.screen.top + 20, true); // thisMac.menuHigh
|
||||
ShowWindow(mainWindow);
|
||||
SetPortWindowPort(mainWindow);
|
||||
ClipRect(&mainWindowRect);
|
||||
|
||||
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
|
||||
|
||||
mainWindowSurface->SetClipRect(mainWindowRect);
|
||||
// CopyRgn(mainWindow->clipRgn, mainWindow->visRgn);
|
||||
ForeColor(blackColor);
|
||||
BackColor(whiteColor);
|
||||
PaintRect(&mainWindowRect);
|
||||
mainWindowSurface->SetForeColor(StdColors::Black());
|
||||
mainWindowSurface->SetBackColor(StdColors::White());
|
||||
mainWindowSurface->FillRect(mainWindowRect);
|
||||
|
||||
splashOriginH = ((thisMac.screen.right - thisMac.screen.left) - 640) / 2;
|
||||
if (splashOriginH < 0)
|
||||
@@ -262,9 +272,8 @@ void OpenMainWindow (void)
|
||||
if (splashOriginV < 0)
|
||||
splashOriginV = 0;
|
||||
|
||||
SetPort((GrafPtr)workSrcMap);
|
||||
PaintRect(&workSrcRect);
|
||||
LoadGraphic(kSplash8BitPICT);
|
||||
workSrcMap->FillRect(workSrcRect);
|
||||
LoadGraphic(workSrcMap, kSplash8BitPICT);
|
||||
|
||||
// if ((fadeGraysOut) && (isDoColorFade))
|
||||
// {
|
||||
@@ -369,9 +378,11 @@ void HandleMainClick (Point wherePt, Boolean isDoubleClick)
|
||||
|
||||
SetPortWindowPort(mainWindow);
|
||||
GlobalToLocal(&wherePt);
|
||||
|
||||
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
|
||||
|
||||
if (toolSelected == kSelectTool)
|
||||
DoSelectionClick(wherePt, isDoubleClick);
|
||||
DoSelectionClick(mainWindowSurface, wherePt, isDoubleClick);
|
||||
else
|
||||
DoNewObjectClick(wherePt);
|
||||
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
#include "PLQDOffscreen.h"
|
||||
|
||||
|
||||
extern GWorldPtr workSrcMap;
|
||||
extern DrawSurface *workSrcMap;
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "PLControlDefinitions.h"
|
||||
#include "PLResources.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "House.h"
|
||||
@@ -26,7 +27,7 @@
|
||||
#define kThumbnailPictID 1010
|
||||
|
||||
|
||||
void LoadGraphicPlus (short, Rect *);
|
||||
void LoadGraphicPlus (DrawSurface *, short, const Rect &);
|
||||
void RedrawMapContents (void);
|
||||
void LiveHScrollAction (ControlHandle, short);
|
||||
void LiveVScrollAction (ControlHandle, short);
|
||||
@@ -37,7 +38,7 @@ void KillNailOffscreen (void);
|
||||
Rect nailSrcRect, activeRoomRect, wasActiveRoomRect;
|
||||
Rect mapHScrollRect, mapVScrollRect, mapCenterRect;
|
||||
Rect mapWindowRect;
|
||||
GWorldPtr nailSrcMap;
|
||||
DrawSurface *nailSrcMap;
|
||||
WindowPtr mapWindow;
|
||||
ControlHandle mapHScroll, mapVScroll;
|
||||
short isMapH, isMapV, mapRoomsHigh, mapRoomsWide;
|
||||
@@ -158,7 +159,7 @@ void FindNewActiveRoomRect (void)
|
||||
|
||||
//-------------------------------------------------------------- LoadGraphicPlus
|
||||
|
||||
void LoadGraphicPlus (short resID, Rect *theRect)
|
||||
void LoadGraphicPlus (DrawSurface *surface, short resID, const Rect &theRect)
|
||||
{
|
||||
PicHandle thePicture;
|
||||
|
||||
@@ -171,7 +172,7 @@ void LoadGraphicPlus (short resID, Rect *theRect)
|
||||
return;
|
||||
}
|
||||
}
|
||||
DrawPicture(thePicture, theRect);
|
||||
surface->DrawPicture(thePicture, theRect);
|
||||
thePicture.Dispose();
|
||||
}
|
||||
|
||||
@@ -181,7 +182,6 @@ void LoadGraphicPlus (short resID, Rect *theRect)
|
||||
void RedrawMapContents (void)
|
||||
{
|
||||
Rect newClip, aRoom, src;
|
||||
Rect wasClip;
|
||||
short h, i, groundLevel;
|
||||
short floor, suite, whoCares, type;
|
||||
char wasState;
|
||||
@@ -197,11 +197,11 @@ void RedrawMapContents (void)
|
||||
newClip.top = mapWindowRect.top;
|
||||
newClip.right = mapWindowRect.right + 2 - kMapScrollBarWidth;
|
||||
newClip.bottom = mapWindowRect.bottom + 2 - kMapScrollBarWidth;
|
||||
|
||||
SetPort((GrafPtr)mapWindow);
|
||||
|
||||
GetClip(&wasClip);
|
||||
ClipRect(&newClip);
|
||||
DrawSurface *surface = mapWindow->GetDrawSurface();
|
||||
|
||||
const Rect wasClip = surface->GetClipRect();
|
||||
surface->SetClipRect(newClip);
|
||||
|
||||
for (i = 0; i < mapRoomsHigh; i++)
|
||||
{
|
||||
@@ -214,17 +214,17 @@ void RedrawMapContents (void)
|
||||
floor = kMapGroundValue - (i + mapTopRoom);
|
||||
if ((RoomExists(suite, floor, &whoCares)) && (houseUnlocked))
|
||||
{
|
||||
PenNormal();
|
||||
type = (*thisHouse)->rooms[whoCares].background - kBaseBackgroundID;
|
||||
if (type > kNumBackgrounds)
|
||||
{
|
||||
if (!doPrettyMap)
|
||||
type = kNumBackgrounds; // Draw "?" thumbnail.
|
||||
}
|
||||
ForeColor(blackColor);
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
if (type > kNumBackgrounds) // Do a "pretty" thumbnail.
|
||||
{
|
||||
LoadGraphicPlus(type + kBaseBackgroundID, &aRoom);
|
||||
LoadGraphicPlus(surface, type + kBaseBackgroundID, aRoom);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -243,46 +243,46 @@ void RedrawMapContents (void)
|
||||
}
|
||||
else
|
||||
{
|
||||
Pattern dummyPat;
|
||||
|
||||
PenPat(GetQDGlobalsGray(&dummyPat));
|
||||
if (i >= groundLevel)
|
||||
ForeColor(greenColor);
|
||||
surface->SetForeColor(StdColors::Green());
|
||||
else
|
||||
ForeColor(blueColor);
|
||||
PaintRect(&aRoom);
|
||||
surface->SetForeColor(StdColors::Blue());
|
||||
|
||||
Pattern dummyPat;
|
||||
surface->FillRectWithPattern8x8(aRoom, *GetQDGlobalsGray(&dummyPat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ForeColor(blackColor);
|
||||
PenNormal();
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
|
||||
for (i = 1; i < mapRoomsWide; i++)
|
||||
{
|
||||
MoveTo(i * kMapRoomWidth, 0);
|
||||
Line(0, mapRoomsHigh * kMapRoomHeight);
|
||||
const Point upperPoint = Point::Create(i * kMapRoomWidth, 0);
|
||||
const Point lowerPoint = Point::Create(upperPoint.h, upperPoint.v + mapRoomsHigh * kMapRoomHeight);
|
||||
surface->DrawLine(upperPoint, lowerPoint);
|
||||
}
|
||||
|
||||
for (i = 1; i < mapRoomsHigh; i++)
|
||||
{
|
||||
MoveTo(0, i * kMapRoomHeight);
|
||||
Line(mapRoomsWide * kMapRoomWidth, 0);
|
||||
const Point leftPoint = Point::Create(0, i * kMapRoomHeight);
|
||||
const Point rightPoint = leftPoint + Point::Create(mapRoomsWide * kMapRoomWidth, 0);
|
||||
surface->DrawLine(leftPoint, rightPoint);
|
||||
}
|
||||
|
||||
if (activeRoomVisible)
|
||||
{
|
||||
ForeColor(redColor);
|
||||
surface->SetForeColor(StdColors::Red());
|
||||
activeRoomRect.right++;
|
||||
activeRoomRect.bottom++;
|
||||
FrameRect(&activeRoomRect);
|
||||
surface->FrameRect(activeRoomRect);
|
||||
InsetRect(&activeRoomRect, 1, 1);
|
||||
FrameRect(&activeRoomRect);
|
||||
ForeColor(blackColor);
|
||||
surface->FrameRect(activeRoomRect);
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
InsetRect(&activeRoomRect, -1, -1);
|
||||
}
|
||||
|
||||
ClipRect(&wasClip);
|
||||
surface->SetClipRect(wasClip);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -311,8 +311,9 @@ void ResizeMapWindow (short newH, short newV)
|
||||
#ifndef COMPILEDEMO
|
||||
if ((newH == 0) && (newV == 0))
|
||||
return;
|
||||
|
||||
SetPortWindowPort(mapWindow);
|
||||
|
||||
DrawSurface *surface = mapWindow->GetDrawSurface();
|
||||
|
||||
mapRoomsWide = newH / kMapRoomWidth;
|
||||
if (mapRoomsWide < 3)
|
||||
mapRoomsWide = 3;
|
||||
@@ -322,7 +323,9 @@ void ResizeMapWindow (short newH, short newV)
|
||||
QSetRect(&mapWindowRect, 0, 0,
|
||||
mapRoomsWide * kMapRoomWidth + kMapScrollBarWidth - 2,
|
||||
mapRoomsHigh * kMapRoomHeight + kMapScrollBarWidth - 2);
|
||||
EraseRect(&mapWindowRect);
|
||||
|
||||
surface->SetForeColor(StdColors::White());
|
||||
surface->FillRect(mapWindowRect);
|
||||
SizeWindow(mapWindow, mapWindowRect.right, mapWindowRect.bottom, true);
|
||||
|
||||
SetControlMaximum(mapHScroll, kMaxNumRoomsH - mapRoomsWide);
|
||||
@@ -716,19 +719,15 @@ Boolean QueryNewRoom (void)
|
||||
#ifndef COMPILEDEMO
|
||||
void CreateNailOffscreen (void)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
DrawSurface *wasCPort;
|
||||
PLError_t theErr;
|
||||
|
||||
if (nailSrcMap == nil)
|
||||
{
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
QSetRect(&nailSrcRect, 0, 0, kMapRoomWidth, kMapRoomHeight * (kNumBackgrounds + 1));
|
||||
theErr = CreateOffScreenGWorld(&nailSrcMap, &nailSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(nailSrcMap);
|
||||
LoadGraphic(kThumbnailPictID);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
|
||||
LoadGraphic(nailSrcMap, kThumbnailPictID);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -8,5 +8,5 @@
|
||||
#include "PLQDOffscreen.h"
|
||||
|
||||
|
||||
extern GWorldPtr nailSrcMap;
|
||||
extern DrawSurface *nailSrcMap;
|
||||
extern WindowPtr mapWindow;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
void DrawGliderMarquee (void);
|
||||
void DrawMarquee (void);
|
||||
void DrawMarquee (DrawSurface *surface, const uint8_t *pattern);
|
||||
|
||||
|
||||
marquee theMarquee;
|
||||
@@ -37,16 +37,15 @@ void DoMarquee (void)
|
||||
if ((!theMarquee.active) || (theMarquee.paused))
|
||||
return;
|
||||
|
||||
SetPortWindowPort(mainWindow);
|
||||
PenInvertMode(true);
|
||||
PenPat(&theMarquee.pats[theMarquee.index]);
|
||||
DrawMarquee();
|
||||
DrawSurface *surface = mainWindow->GetDrawSurface();
|
||||
const uint8_t *pattern = theMarquee.pats[theMarquee.index];
|
||||
DrawMarquee(surface, pattern);
|
||||
theMarquee.index++;
|
||||
if (theMarquee.index >= kNumMarqueePats)
|
||||
theMarquee.index = 0;
|
||||
PenPat(&theMarquee.pats[theMarquee.index]);
|
||||
DrawMarquee();
|
||||
PenNormal();
|
||||
|
||||
pattern = theMarquee.pats[theMarquee.index];
|
||||
DrawMarquee(surface, pattern);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- StartMarquee
|
||||
@@ -58,16 +57,16 @@ void StartMarquee (Rect *theRect)
|
||||
|
||||
if (objActive == kNoObjectSelected)
|
||||
return;
|
||||
|
||||
SetPortWindowPort(mainWindow);
|
||||
|
||||
DrawSurface *surface = mainWindow->GetDrawSurface();
|
||||
|
||||
theMarquee.bounds = *theRect;
|
||||
theMarquee.active = true;
|
||||
theMarquee.paused = false;
|
||||
theMarquee.handled = false;
|
||||
PenInvertMode(true);
|
||||
PenPat(&theMarquee.pats[theMarquee.index]);
|
||||
DrawMarquee();
|
||||
PenNormal();
|
||||
|
||||
const uint8_t *pattern = theMarquee.pats[theMarquee.index];
|
||||
DrawMarquee(surface, pattern);
|
||||
SetCoordinateHVD(theMarquee.bounds.left, theMarquee.bounds.top, -1);
|
||||
}
|
||||
|
||||
@@ -81,7 +80,8 @@ void StartMarqueeHandled (Rect *theRect, short direction, short dist)
|
||||
if (objActive == kNoObjectSelected)
|
||||
return;
|
||||
|
||||
SetPortWindowPort(mainWindow);
|
||||
DrawSurface *surface = mainWindow->GetDrawSurface();
|
||||
|
||||
theMarquee.bounds = *theRect;
|
||||
theMarquee.active = true;
|
||||
theMarquee.paused = false;
|
||||
@@ -127,10 +127,8 @@ void StartMarqueeHandled (Rect *theRect, short direction, short dist)
|
||||
theMarquee.direction = direction;
|
||||
theMarquee.dist = dist;
|
||||
|
||||
PenInvertMode(true);
|
||||
PenPat(&theMarquee.pats[theMarquee.index]);
|
||||
DrawMarquee();
|
||||
PenNormal();
|
||||
const uint8_t *pattern = theMarquee.pats[theMarquee.index];
|
||||
DrawMarquee(surface, pattern);
|
||||
SetCoordinateHVD(theMarquee.bounds.left, theMarquee.bounds.top, dist);
|
||||
}
|
||||
|
||||
@@ -147,11 +145,10 @@ void StopMarquee (void)
|
||||
if (!theMarquee.active)
|
||||
return;
|
||||
|
||||
SetPortWindowPort(mainWindow);
|
||||
PenInvertMode(true);
|
||||
PenPat(&theMarquee.pats[theMarquee.index]);
|
||||
DrawMarquee();
|
||||
PenNormal();
|
||||
DrawSurface *surface = mainWindow->GetDrawSurface();
|
||||
const uint8_t *pattern = theMarquee.pats[theMarquee.index];
|
||||
DrawMarquee(surface, pattern);
|
||||
|
||||
theMarquee.active = false;
|
||||
SetCoordinateHVD(-1, -1, -1);
|
||||
}
|
||||
@@ -188,13 +185,13 @@ void ResumeMarquee (void)
|
||||
void DragOutMarqueeRect (Point start, Rect *theRect)
|
||||
{
|
||||
Point wasPt, newPt;
|
||||
DrawSurface *surface = mainWindow->GetDrawSurface();
|
||||
|
||||
SetPortWindowPort(mainWindow);
|
||||
InitCursor();
|
||||
QSetRect(theRect, start.h, start.v, start.h, start.v);
|
||||
PenInvertMode(true);
|
||||
PenPat(&theMarquee.pats[theMarquee.index]);
|
||||
FrameRect(theRect);
|
||||
|
||||
const uint8_t *pattern = theMarquee.pats[theMarquee.index];
|
||||
surface->InvertFrameRect(*theRect, pattern);
|
||||
wasPt = start;
|
||||
|
||||
while (WaitMouseUp())
|
||||
@@ -202,30 +199,29 @@ void DragOutMarqueeRect (Point start, Rect *theRect)
|
||||
GetMouse(&newPt);
|
||||
if (DeltaPoint(wasPt, newPt))
|
||||
{
|
||||
FrameRect(theRect);
|
||||
surface->InvertFrameRect(*theRect, pattern);
|
||||
QSetRect(theRect, start.h, start.v, newPt.h, newPt.v);
|
||||
NormalizeRect(theRect);
|
||||
FrameRect(theRect);
|
||||
surface->InvertFrameRect(*theRect, pattern);
|
||||
wasPt = newPt;
|
||||
}
|
||||
}
|
||||
FrameRect(theRect);
|
||||
PenNormal();
|
||||
surface->InvertFrameRect(*theRect, pattern);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DragMarqueeRect
|
||||
|
||||
void DragMarqueeRect (Point start, Rect *theRect, Boolean lockH, Boolean lockV)
|
||||
void DragMarqueeRect (DrawSurface *surface, Point start, Rect *theRect, Boolean lockH, Boolean lockV)
|
||||
{
|
||||
Point wasPt, newPt;
|
||||
short deltaH, deltaV;
|
||||
|
||||
SetCursor(&handCursor);
|
||||
StopMarquee();
|
||||
PenInvertMode(true);
|
||||
PenPat(&theMarquee.pats[theMarquee.index]);
|
||||
|
||||
const uint8_t *pattern = theMarquee.pats[theMarquee.index];
|
||||
theMarquee.bounds = *theRect;
|
||||
FrameRect(&theMarquee.bounds);
|
||||
surface->InvertFrameRect(theMarquee.bounds, pattern);
|
||||
|
||||
wasPt = start;
|
||||
while (WaitMouseUp())
|
||||
@@ -241,22 +237,23 @@ void DragMarqueeRect (Point start, Rect *theRect, Boolean lockH, Boolean lockV)
|
||||
deltaV = 0;
|
||||
else
|
||||
deltaV = newPt.v - wasPt.v;
|
||||
FrameRect(&theMarquee.bounds);
|
||||
surface->InvertFrameRect(theMarquee.bounds, pattern);
|
||||
QOffsetRect(&theMarquee.bounds, deltaH, deltaV);
|
||||
FrameRect(&theMarquee.bounds);
|
||||
surface->InvertFrameRect(theMarquee.bounds, pattern);
|
||||
wasPt = newPt;
|
||||
SetCoordinateHVD(theMarquee.bounds.left, theMarquee.bounds.top, -2);
|
||||
}
|
||||
}
|
||||
FrameRect(&theMarquee.bounds);
|
||||
surface->InvertFrameRect(theMarquee.bounds, pattern);
|
||||
|
||||
*theRect = theMarquee.bounds;
|
||||
PenNormal();
|
||||
|
||||
InitCursor();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DragMarqueeHandle
|
||||
|
||||
void DragMarqueeHandle (Point start, short *dragged)
|
||||
void DragMarqueeHandle (DrawSurface *surface, Point start, short *dragged)
|
||||
{
|
||||
Point wasPt, newPt;
|
||||
short deltaH, deltaV;
|
||||
@@ -266,10 +263,10 @@ void DragMarqueeHandle (Point start, short *dragged)
|
||||
else
|
||||
SetCursor(&horiCursor);
|
||||
StopMarquee();
|
||||
PenInvertMode(true);
|
||||
PenPat(&theMarquee.pats[theMarquee.index]);
|
||||
FrameRect(&theMarquee.bounds);
|
||||
PaintRect(&theMarquee.handle);
|
||||
|
||||
const uint8_t *pattern = theMarquee.pats[theMarquee.index];
|
||||
surface->InvertFrameRect(theMarquee.bounds, pattern);
|
||||
surface->InvertFillRect(theMarquee.handle, pattern);
|
||||
|
||||
wasPt = start;
|
||||
while (WaitMouseUp())
|
||||
@@ -327,32 +324,32 @@ void DragMarqueeHandle (Point start, short *dragged)
|
||||
DeltaCoordinateD(*dragged);
|
||||
break;
|
||||
}
|
||||
|
||||
PaintRect(&theMarquee.handle);
|
||||
|
||||
surface->InvertFillRect(theMarquee.handle, pattern);
|
||||
QOffsetRect(&theMarquee.handle, deltaH, deltaV);
|
||||
PaintRect(&theMarquee.handle);
|
||||
surface->InvertFillRect(theMarquee.handle, pattern);
|
||||
wasPt = newPt;
|
||||
}
|
||||
}
|
||||
FrameRect(&theMarquee.bounds);
|
||||
PaintRect(&theMarquee.handle);
|
||||
surface->InvertFrameRect(theMarquee.bounds, pattern);
|
||||
surface->InvertFillRect(theMarquee.handle, pattern);
|
||||
PenNormal();
|
||||
InitCursor();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DragMarqueeCorner
|
||||
|
||||
void DragMarqueeCorner (Point start, short *hDragged, short *vDragged, Boolean isTop)
|
||||
void DragMarqueeCorner (DrawSurface *surface, Point start, short *hDragged, short *vDragged, Boolean isTop)
|
||||
{
|
||||
Point wasPt, newPt;
|
||||
short deltaH, deltaV;
|
||||
|
||||
SetCursor(&diagCursor);
|
||||
StopMarquee();
|
||||
PenInvertMode(true);
|
||||
PenPat(&theMarquee.pats[theMarquee.index]);
|
||||
FrameRect(&theMarquee.bounds);
|
||||
PaintRect(&theMarquee.handle);
|
||||
|
||||
const uint8_t *pattern = theMarquee.pats[theMarquee.index];
|
||||
surface->InvertFrameRect(theMarquee.bounds, pattern);
|
||||
surface->InvertFillRect(theMarquee.handle, pattern);
|
||||
|
||||
wasPt = start;
|
||||
while (WaitMouseUp())
|
||||
@@ -377,8 +374,8 @@ void DragMarqueeCorner (Point start, short *hDragged, short *vDragged, Boolean i
|
||||
deltaV -= *vDragged;
|
||||
*vDragged = 0;
|
||||
}
|
||||
FrameRect(&theMarquee.bounds);
|
||||
PaintRect(&theMarquee.handle);
|
||||
surface->InvertFrameRect(theMarquee.bounds, pattern);
|
||||
surface->InvertFillRect(theMarquee.handle, pattern);
|
||||
if (isTop)
|
||||
{
|
||||
QOffsetRect(&theMarquee.handle, deltaH, -deltaV);
|
||||
@@ -391,13 +388,13 @@ void DragMarqueeCorner (Point start, short *hDragged, short *vDragged, Boolean i
|
||||
theMarquee.bounds.right += deltaH;
|
||||
theMarquee.bounds.bottom += deltaV;
|
||||
}
|
||||
FrameRect(&theMarquee.bounds);
|
||||
PaintRect(&theMarquee.handle);
|
||||
surface->InvertFrameRect(theMarquee.bounds, pattern);
|
||||
surface->InvertFillRect(theMarquee.handle, pattern);
|
||||
wasPt = newPt;
|
||||
}
|
||||
}
|
||||
FrameRect(&theMarquee.bounds);
|
||||
PaintRect(&theMarquee.handle);
|
||||
surface->InvertFrameRect(theMarquee.bounds, pattern);
|
||||
surface->InvertFillRect(theMarquee.handle, pattern);
|
||||
PenNormal();
|
||||
InitCursor();
|
||||
}
|
||||
@@ -452,42 +449,46 @@ void SetMarqueeGliderRect (short h, short v)
|
||||
|
||||
//-------------------------------------------------------------- DrawMarquee
|
||||
|
||||
void DrawMarquee (void)
|
||||
void DrawMarquee (DrawSurface *surface, const uint8_t *pattern)
|
||||
{
|
||||
FrameRect(&theMarquee.bounds);
|
||||
surface->InvertFrameRect(theMarquee.bounds, pattern);
|
||||
if (theMarquee.handled)
|
||||
{
|
||||
PaintRect(&theMarquee.handle);
|
||||
surface->InvertFillRect(theMarquee.handle, pattern);
|
||||
Point points[2] = { Point::Create(0, 0), Point::Create(0, 0) };
|
||||
|
||||
switch (theMarquee.direction)
|
||||
{
|
||||
case kAbove:
|
||||
MoveTo(theMarquee.handle.left + (kHandleSideLong / 2),
|
||||
points[0] = Point::Create(theMarquee.handle.left + (kHandleSideLong / 2),
|
||||
theMarquee.handle.bottom);
|
||||
LineTo(theMarquee.handle.left + (kHandleSideLong / 2),
|
||||
points[1] = Point::Create(theMarquee.handle.left + (kHandleSideLong / 2),
|
||||
theMarquee.bounds.top - 1);
|
||||
break;
|
||||
|
||||
case kToRight:
|
||||
MoveTo(theMarquee.handle.left,
|
||||
points[0] = Point::Create(theMarquee.handle.left,
|
||||
theMarquee.handle.top + (kHandleSideLong / 2));
|
||||
LineTo(theMarquee.bounds.right,
|
||||
points[1] = Point::Create(theMarquee.bounds.right,
|
||||
theMarquee.handle.top + (kHandleSideLong / 2));
|
||||
break;
|
||||
|
||||
case kBelow:
|
||||
MoveTo(theMarquee.handle.left + (kHandleSideLong / 2),
|
||||
points[0] = Point::Create(theMarquee.handle.left + (kHandleSideLong / 2),
|
||||
theMarquee.handle.top - 1);
|
||||
LineTo(theMarquee.handle.left + (kHandleSideLong / 2),
|
||||
points[1] = Point::Create(theMarquee.handle.left + (kHandleSideLong / 2),
|
||||
theMarquee.bounds.bottom);
|
||||
break;
|
||||
|
||||
case kToLeft:
|
||||
MoveTo(theMarquee.handle.right,
|
||||
points[1] = Point::Create(theMarquee.handle.right,
|
||||
theMarquee.handle.top + (kHandleSideLong / 2));
|
||||
LineTo(theMarquee.bounds.left,
|
||||
points[0] = Point::Create(theMarquee.bounds.left,
|
||||
theMarquee.handle.top + (kHandleSideLong / 2));
|
||||
break;
|
||||
}
|
||||
|
||||
surface->InvertDrawLine(points[0], points[1], pattern);
|
||||
}
|
||||
|
||||
if (gliderMarqueeUp)
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLToolUtils.h"
|
||||
#include "DialogManager.h"
|
||||
#include "DialogUtils.h"
|
||||
#include "Externs.h"
|
||||
#include "House.h"
|
||||
@@ -687,12 +688,11 @@ Boolean ResumeFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
if ((WindowPtr)event->message == GetDialogWindow(dial))
|
||||
if ((WindowPtr)event->message == dial->GetWindow())
|
||||
{
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateResumeDialog(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
}
|
||||
return(false);
|
||||
@@ -735,12 +735,12 @@ short QueryResumeGame (void)
|
||||
ParamText(glidStr, PSTR("s"), scoreStr, PSTR(""));
|
||||
|
||||
// CenterDialog(kResumeGameDial);
|
||||
theDial = GetNewDialog(kResumeGameDial, nil, kPutInFront);
|
||||
theDial = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kResumeGameDial, kPutInFront);
|
||||
if (theDial == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetPort((GrafPtr)theDial);
|
||||
|
||||
ShowWindow(GetDialogWindow(theDial));
|
||||
ShowWindow(theDial->GetWindow());
|
||||
DrawDefaultButton(theDial);
|
||||
leaving = false;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,8 @@
|
||||
#include "PLTextUtils.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "Externs.h"
|
||||
#include "FontFamily.h"
|
||||
#include "FontManager.h"
|
||||
#include "Environ.h"
|
||||
#include "Objects.h"
|
||||
#include "RectUtils.h"
|
||||
@@ -113,14 +115,11 @@
|
||||
void DrawMailboxLeft (Rect *theRect, short down)
|
||||
{
|
||||
Rect bounds;
|
||||
GWorldPtr tempMap;
|
||||
GWorldPtr tempMask;
|
||||
DrawSurface *tempMap;
|
||||
DrawSurface *tempMask;
|
||||
long darkGrayC, lightWoodC, darkWoodC;
|
||||
CGrafPtr wasCPort;
|
||||
DrawSurface *wasCPort;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
|
||||
if (thisMac.isDepth == 4)
|
||||
{
|
||||
@@ -137,54 +136,48 @@ void DrawMailboxLeft (Rect *theRect, short down)
|
||||
|
||||
if (theRect->bottom < down + kMailboxBase)
|
||||
{
|
||||
ColorLine(theRect->left + 49, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 49, theRect->bottom,
|
||||
theRect->left + 49, down + kMailboxBase, darkGrayC);
|
||||
ColorLine(theRect->left + 50, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 50, theRect->bottom,
|
||||
theRect->left + 50, down + kMailboxBase + 1, lightWoodC);
|
||||
ColorLine(theRect->left + 51, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 51, theRect->bottom,
|
||||
theRect->left + 51, down + kMailboxBase + 2, lightWoodC);
|
||||
ColorLine(theRect->left + 52, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 52, theRect->bottom,
|
||||
theRect->left + 52, down + kMailboxBase + 3, lightWoodC);
|
||||
ColorLine(theRect->left + 53, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 53, theRect->bottom,
|
||||
theRect->left + 53, down + kMailboxBase + 3, darkWoodC);
|
||||
ColorLine(theRect->left + 54, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 54, theRect->bottom,
|
||||
theRect->left + 54, down + kMailboxBase + 3, darkWoodC);
|
||||
ColorLine(theRect->left + 55, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 55, theRect->bottom,
|
||||
theRect->left + 55, down + kMailboxBase + 3, darkWoodC);
|
||||
ColorLine(theRect->left + 56, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 56, theRect->bottom,
|
||||
theRect->left + 56, down + kMailboxBase + 3, darkWoodC);
|
||||
ColorLine(theRect->left + 57, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 57, theRect->bottom,
|
||||
theRect->left + 57, down + kMailboxBase + 3, darkWoodC);
|
||||
ColorLine(theRect->left + 58, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 58, theRect->bottom,
|
||||
theRect->left + 58, down + kMailboxBase + 3, darkWoodC);
|
||||
ColorLine(theRect->left + 59, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 59, theRect->bottom,
|
||||
theRect->left + 59, down + kMailboxBase + 3, darkWoodC);
|
||||
ColorLine(theRect->left + 60, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 60, theRect->bottom,
|
||||
theRect->left + 60, down + kMailboxBase + 3, darkWoodC);
|
||||
ColorLine(theRect->left + 61, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 61, theRect->bottom,
|
||||
theRect->left + 61, down + kMailboxBase + 3, darkWoodC);
|
||||
ColorLine(theRect->left + 62, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 62, theRect->bottom,
|
||||
theRect->left + 62, down + kMailboxBase + 3, darkGrayC);
|
||||
}
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
|
||||
bounds = srcRects[kMailboxLf];
|
||||
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
|
||||
SetGraphicsPort(tempMap);
|
||||
LoadGraphic(kMailboxLeftPictID);
|
||||
LoadGraphic(tempMap, kMailboxLeftPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(tempMask);
|
||||
LoadGraphic(kMailboxLeftMaskID);
|
||||
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
|
||||
LoadGraphic(tempMask, kMailboxLeftMaskID);
|
||||
|
||||
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
||||
(BitMap *)*GetGWorldPixMap(tempMask),
|
||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||
&srcRects[kMailboxLf], &srcRects[kMailboxLf], theRect);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
|
||||
DisposeGWorld(tempMap);
|
||||
DisposeGWorld(tempMask);
|
||||
// SetPort((GrafPtr)backSrcMap);
|
||||
@@ -195,14 +188,10 @@ void DrawMailboxLeft (Rect *theRect, short down)
|
||||
void DrawMailboxRight (Rect *theRect, short down)
|
||||
{
|
||||
Rect bounds;
|
||||
GWorldPtr tempMap;
|
||||
GWorldPtr tempMask;
|
||||
DrawSurface *tempMap;
|
||||
DrawSurface *tempMask;
|
||||
long darkGrayC, lightWoodC, darkWoodC;
|
||||
CGrafPtr wasCPort;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
|
||||
if (thisMac.isDepth == 4)
|
||||
{
|
||||
@@ -219,54 +208,48 @@ void DrawMailboxRight (Rect *theRect, short down)
|
||||
|
||||
if (theRect->bottom < down + kMailboxBase)
|
||||
{
|
||||
ColorLine(theRect->left + 34, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 34, theRect->bottom,
|
||||
theRect->left + 34, down + kMailboxBase, darkGrayC);
|
||||
ColorLine(theRect->left + 35, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 35, theRect->bottom,
|
||||
theRect->left + 35, down + kMailboxBase + 1, lightWoodC);
|
||||
ColorLine(theRect->left + 36, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 36, theRect->bottom,
|
||||
theRect->left + 36, down + kMailboxBase + 2, lightWoodC);
|
||||
ColorLine(theRect->left + 37, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 37, theRect->bottom,
|
||||
theRect->left + 37, down + kMailboxBase + 3, lightWoodC);
|
||||
ColorLine(theRect->left + 38, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 38, theRect->bottom,
|
||||
theRect->left + 38, down + kMailboxBase + 3, darkWoodC);
|
||||
ColorLine(theRect->left + 39, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 39, theRect->bottom,
|
||||
theRect->left + 39, down + kMailboxBase + 3, darkWoodC);
|
||||
ColorLine(theRect->left + 40, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 40, theRect->bottom,
|
||||
theRect->left + 40, down + kMailboxBase + 3, darkWoodC);
|
||||
ColorLine(theRect->left + 41, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 41, theRect->bottom,
|
||||
theRect->left + 41, down + kMailboxBase + 3, darkWoodC);
|
||||
ColorLine(theRect->left + 42, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 42, theRect->bottom,
|
||||
theRect->left + 42, down + kMailboxBase + 3, darkWoodC);
|
||||
ColorLine(theRect->left + 43, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 43, theRect->bottom,
|
||||
theRect->left + 43, down + kMailboxBase + 3, darkWoodC);
|
||||
ColorLine(theRect->left + 44, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 44, theRect->bottom,
|
||||
theRect->left + 44, down + kMailboxBase + 3, darkWoodC);
|
||||
ColorLine(theRect->left + 45, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 45, theRect->bottom,
|
||||
theRect->left + 45, down + kMailboxBase + 3, darkWoodC);
|
||||
ColorLine(theRect->left + 46, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 46, theRect->bottom,
|
||||
theRect->left + 46, down + kMailboxBase + 3, darkWoodC);
|
||||
ColorLine(theRect->left + 47, theRect->bottom,
|
||||
ColorLine(backSrcMap, theRect->left + 47, theRect->bottom,
|
||||
theRect->left + 47, down + kMailboxBase + 3, darkGrayC);
|
||||
}
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
|
||||
bounds = srcRects[kMailboxRt];
|
||||
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
|
||||
SetGraphicsPort(tempMap);
|
||||
LoadGraphic(kMailboxRightPictID);
|
||||
LoadGraphic(tempMap, kMailboxRightPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(tempMask);
|
||||
LoadGraphic(kMailboxRightMaskID);
|
||||
LoadGraphic(tempMask, kMailboxRightMaskID);
|
||||
|
||||
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
||||
(BitMap *)*GetGWorldPixMap(tempMask),
|
||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||
&srcRects[kMailboxRt], &srcRects[kMailboxRt], theRect);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
|
||||
DisposeGWorld(tempMap);
|
||||
DisposeGWorld(tempMask);
|
||||
// SetPort((GrafPtr)backSrcMap);
|
||||
@@ -286,12 +269,7 @@ void DrawSimpleTransport (short what, Rect *theRect)
|
||||
|
||||
void DrawInvisTransport (Rect *theRect)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
ColorFrameRect(theRect, 32);
|
||||
SetGraphicsPort(wasCPort);
|
||||
ColorFrameRect(backSrcMap, *theRect, 32);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DrawLightSwitch
|
||||
@@ -372,36 +350,23 @@ void DrawKnifeSwitch (Rect *theRect, Boolean state)
|
||||
|
||||
void DrawInvisibleSwitch (Rect *theRect)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
DrawSurface *wasCPort;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
ColorFrameRect(theRect, kIntenseGreenColor);
|
||||
SetGraphicsPort(wasCPort);
|
||||
ColorFrameRect(backSrcMap, *theRect, kIntenseGreenColor);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DrawTrigger
|
||||
|
||||
void DrawTrigger (Rect *theRect)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
ColorFrameRect(theRect, kIntenseBlueColor);
|
||||
SetGraphicsPort(wasCPort);
|
||||
ColorFrameRect(backSrcMap, *theRect, kIntenseBlueColor);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DrawSoundTrigger
|
||||
|
||||
void DrawSoundTrigger (Rect *theRect)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
ColorFrameRect(theRect, kIntenseYellowColor);
|
||||
SetGraphicsPort(wasCPort);
|
||||
ColorFrameRect(backSrcMap, *theRect, kIntenseYellowColor);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DrawSimpleLight
|
||||
@@ -420,7 +385,6 @@ void DrawFlourescent (Rect *theRect)
|
||||
{
|
||||
Rect partRect;
|
||||
long grayC, gray2C, gray3C, gray4C, violetC;
|
||||
CGrafPtr wasCPort;
|
||||
|
||||
if (thisMac.isDepth == 4)
|
||||
{
|
||||
@@ -439,36 +403,31 @@ void DrawFlourescent (Rect *theRect)
|
||||
violetC = kPaleVioletColor;
|
||||
}
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
|
||||
ColorLine(theRect->left + 16, theRect->top,
|
||||
ColorLine(backSrcMap, theRect->left + 16, theRect->top,
|
||||
theRect->right - 17, theRect->top, grayC);
|
||||
ColorLine(theRect->left + 16, theRect->top + 1,
|
||||
ColorLine(backSrcMap, theRect->left + 16, theRect->top + 1,
|
||||
theRect->right - 17, theRect->top + 1, gray2C);
|
||||
ColorLine(theRect->left + 16, theRect->top + 2,
|
||||
ColorLine(backSrcMap, theRect->left + 16, theRect->top + 2,
|
||||
theRect->right - 17, theRect->top + 2, gray2C);
|
||||
ColorLine(theRect->left + 16, theRect->top + 3,
|
||||
ColorLine(backSrcMap, theRect->left + 16, theRect->top + 3,
|
||||
theRect->right - 17, theRect->top + 3, gray3C);
|
||||
ColorLine(theRect->left + 16, theRect->top + 4,
|
||||
ColorLine(backSrcMap, theRect->left + 16, theRect->top + 4,
|
||||
theRect->right - 17, theRect->top + 4, gray4C);
|
||||
ColorLine(theRect->left + 16, theRect->top + 5,
|
||||
ColorLine(backSrcMap, theRect->left + 16, theRect->top + 5,
|
||||
theRect->right - 17, theRect->top + 5, violetC);
|
||||
ColorLine(theRect->left + 16, theRect->top + 6,
|
||||
ColorLine(backSrcMap, theRect->left + 16, theRect->top + 6,
|
||||
theRect->right - 17, theRect->top + 6, k8WhiteColor);
|
||||
ColorLine(theRect->left + 16, theRect->top + 7,
|
||||
ColorLine(backSrcMap, theRect->left + 16, theRect->top + 7,
|
||||
theRect->right - 17, theRect->top + 7, k8WhiteColor);
|
||||
ColorLine(theRect->left + 16, theRect->top + 8,
|
||||
ColorLine(backSrcMap, theRect->left + 16, theRect->top + 8,
|
||||
theRect->right - 17, theRect->top + 8, k8WhiteColor);
|
||||
ColorLine(theRect->left + 16, theRect->top + 9,
|
||||
ColorLine(backSrcMap, theRect->left + 16, theRect->top + 9,
|
||||
theRect->right - 17, theRect->top + 9, k8WhiteColor);
|
||||
ColorLine(theRect->left + 16, theRect->top + 10,
|
||||
ColorLine(backSrcMap, theRect->left + 16, theRect->top + 10,
|
||||
theRect->right - 17, theRect->top + 10, k8WhiteColor);
|
||||
ColorLine(theRect->left + 16, theRect->top + 11,
|
||||
ColorLine(backSrcMap, theRect->left + 16, theRect->top + 11,
|
||||
theRect->right - 17, theRect->top + 11, violetC);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
|
||||
partRect = flourescentSrc1;
|
||||
ZeroRectCorner(&partRect);
|
||||
QOffsetRect(&partRect, theRect->left, theRect->top);
|
||||
@@ -497,7 +456,6 @@ void DrawTrackLight (Rect *theRect)
|
||||
Rect partRect;
|
||||
long grayC, gray2C, gray3C, gray4C;
|
||||
short which, howMany, i, spread;
|
||||
CGrafPtr wasCPort;
|
||||
|
||||
if (thisMac.isDepth == 4)
|
||||
{
|
||||
@@ -514,24 +472,19 @@ void DrawTrackLight (Rect *theRect)
|
||||
gray4C = k8DkGrayColor;
|
||||
}
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
|
||||
ColorLine(theRect->left, theRect->top - 3,
|
||||
ColorLine(backSrcMap, theRect->left, theRect->top - 3,
|
||||
theRect->right - 1, theRect->top - 3, gray2C);
|
||||
ColorLine(theRect->left, theRect->top - 2,
|
||||
ColorLine(backSrcMap, theRect->left, theRect->top - 2,
|
||||
theRect->right - 1, theRect->top - 2, grayC);
|
||||
ColorLine(theRect->left, theRect->top - 1,
|
||||
ColorLine(backSrcMap, theRect->left, theRect->top - 1,
|
||||
theRect->right - 1, theRect->top - 1, grayC);
|
||||
ColorLine(theRect->left, theRect->top,
|
||||
ColorLine(backSrcMap, theRect->left, theRect->top,
|
||||
theRect->right - 1, theRect->top, gray3C);
|
||||
ColorLine(theRect->left, theRect->top + 1,
|
||||
ColorLine(backSrcMap, theRect->left, theRect->top + 1,
|
||||
theRect->right - 1, theRect->top + 1, gray4C);
|
||||
ColorLine(theRect->left, theRect->top + 2,
|
||||
ColorLine(backSrcMap, theRect->left, theRect->top + 2,
|
||||
theRect->right - 1, theRect->top + 2, gray3C);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
|
||||
partRect = trackLightSrc[0]; // left most track light
|
||||
ZeroRectCorner(&partRect);
|
||||
QOffsetRect(&partRect, theRect->left, theRect->top);
|
||||
@@ -578,12 +531,7 @@ void DrawTrackLight (Rect *theRect)
|
||||
|
||||
void DrawInvisLight (Rect *theRect)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
ColorFrameOval(theRect, 17);
|
||||
SetGraphicsPort(wasCPort);
|
||||
ColorFrameOval(backSrcMap, *theRect, 17);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DrawSimpleAppliance
|
||||
@@ -629,15 +577,8 @@ void DrawMacPlus (Rect *theRect, Boolean isOn, Boolean isLit)
|
||||
|
||||
if (IsMacPlusGraphicBanned())
|
||||
{
|
||||
CGraf *oldPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
|
||||
RGBColor beigeColor;
|
||||
beigeColor.red = 255 * 0x0101;
|
||||
beigeColor.green = 255 * 0x0101;
|
||||
beigeColor.blue = 204 * 0x0101;
|
||||
|
||||
RGBForeColor(&beigeColor);
|
||||
const PortabilityLayer::RGBAColor beigeColor = PortabilityLayer::RGBAColor::Create(255, 255, 204, 255);
|
||||
const PortabilityLayer::RGBAColor wasColor = backSrcMap->GetForeColor();
|
||||
|
||||
Rect paintOverRect = *theRect;
|
||||
paintOverRect.left += 8;
|
||||
@@ -645,9 +586,9 @@ void DrawMacPlus (Rect *theRect, Boolean isOn, Boolean isLit)
|
||||
paintOverRect.right = paintOverRect.left + 17;
|
||||
paintOverRect.bottom = paintOverRect.top + 6;
|
||||
|
||||
PaintRect(&paintOverRect);
|
||||
|
||||
SetGraphicsPort(oldPort);
|
||||
backSrcMap->SetForeColor(beigeColor);
|
||||
backSrcMap->FillRect(paintOverRect);
|
||||
backSrcMap->SetForeColor(wasColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -656,31 +597,25 @@ void DrawMacPlus (Rect *theRect, Boolean isOn, Boolean isLit)
|
||||
void DrawTV (Rect *theRect, Boolean isOn, Boolean isLit)
|
||||
{
|
||||
Rect bounds;
|
||||
GWorldPtr tempMap;
|
||||
GWorldPtr tempMask;
|
||||
CGrafPtr wasCPort;
|
||||
DrawSurface *tempMap;
|
||||
DrawSurface *tempMask;
|
||||
DrawSurface *wasCPort;
|
||||
PLError_t theErr;
|
||||
|
||||
if (isLit)
|
||||
{
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
bounds = srcRects[kTV];
|
||||
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
|
||||
SetGraphicsPort(tempMap);
|
||||
LoadGraphic(kTVPictID);
|
||||
LoadGraphic(tempMap, kTVPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(tempMask);
|
||||
LoadGraphic(kTVMaskID);
|
||||
LoadGraphic(tempMask, kTVMaskID);
|
||||
|
||||
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
||||
(BitMap *)*GetGWorldPixMap(tempMask),
|
||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||
&srcRects[kTV], &srcRects[kTV], theRect);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
|
||||
DisposeGWorld(tempMap);
|
||||
DisposeGWorld(tempMask);
|
||||
// SetPort((GrafPtr)backSrcMap);
|
||||
@@ -749,31 +684,24 @@ void DrawOutlet (Rect *theRect)
|
||||
void DrawVCR (Rect *theRect, Boolean isOn, Boolean isLit)
|
||||
{
|
||||
Rect bounds;
|
||||
GWorldPtr tempMap;
|
||||
GWorldPtr tempMask;
|
||||
CGrafPtr wasCPort;
|
||||
DrawSurface *tempMap;
|
||||
DrawSurface *tempMask;
|
||||
PLError_t theErr;
|
||||
|
||||
if (isLit)
|
||||
{
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
bounds = srcRects[kVCR];
|
||||
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
|
||||
SetGraphicsPort(tempMap);
|
||||
LoadGraphic(kVCRPictID);
|
||||
LoadGraphic(tempMap, kVCRPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(tempMask);
|
||||
LoadGraphic(kVCRMaskID);
|
||||
LoadGraphic(tempMask, kVCRMaskID);
|
||||
|
||||
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
||||
(BitMap *)*GetGWorldPixMap(tempMask),
|
||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||
&srcRects[kVCR], &srcRects[kVCR], theRect);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
|
||||
DisposeGWorld(tempMap);
|
||||
DisposeGWorld(tempMask);
|
||||
|
||||
@@ -802,32 +730,25 @@ void DrawVCR (Rect *theRect, Boolean isOn, Boolean isLit)
|
||||
void DrawStereo (Rect *theRect, Boolean isOn, Boolean isLit)
|
||||
{
|
||||
Rect bounds;
|
||||
GWorldPtr tempMap;
|
||||
GWorldPtr tempMask;
|
||||
CGrafPtr wasCPort;
|
||||
DrawSurface *tempMap;
|
||||
DrawSurface *tempMask;
|
||||
PLError_t theErr;
|
||||
|
||||
|
||||
if (isLit)
|
||||
{
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
bounds = srcRects[kStereo];
|
||||
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
|
||||
SetGraphicsPort(tempMap);
|
||||
LoadGraphic(kStereoPictID);
|
||||
LoadGraphic(tempMap, kStereoPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(tempMask);
|
||||
LoadGraphic(kStereoMaskID);
|
||||
LoadGraphic(tempMask, kStereoMaskID);
|
||||
|
||||
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
||||
(BitMap *)*GetGWorldPixMap(tempMask),
|
||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||
&srcRects[kStereo], &srcRects[kStereo], theRect);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
|
||||
DisposeGWorld(tempMap);
|
||||
DisposeGWorld(tempMask);
|
||||
|
||||
@@ -856,32 +777,25 @@ void DrawStereo (Rect *theRect, Boolean isOn, Boolean isLit)
|
||||
void DrawMicrowave (Rect *theRect, Boolean isOn, Boolean isLit)
|
||||
{
|
||||
Rect bounds;
|
||||
GWorldPtr tempMap;
|
||||
GWorldPtr tempMask;
|
||||
CGrafPtr wasCPort;
|
||||
DrawSurface *tempMap;
|
||||
DrawSurface *tempMask;
|
||||
PLError_t theErr;
|
||||
|
||||
|
||||
if (isLit)
|
||||
{
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
bounds = srcRects[kMicrowave];
|
||||
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
|
||||
SetGraphicsPort(tempMap);
|
||||
LoadGraphic(kMicrowavePictID);
|
||||
LoadGraphic(tempMap, kMicrowavePictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(tempMask);
|
||||
LoadGraphic(kMicrowaveMaskID);
|
||||
LoadGraphic(tempMask, kMicrowaveMaskID);
|
||||
|
||||
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
||||
(BitMap *)*GetGWorldPixMap(tempMask),
|
||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||
&srcRects[kMicrowave], &srcRects[kMicrowave], theRect);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
|
||||
DisposeGWorld(tempMap);
|
||||
DisposeGWorld(tempMask);
|
||||
|
||||
@@ -997,7 +911,6 @@ void DrawMirror (Rect *mirror)
|
||||
{
|
||||
Rect tempRect;
|
||||
long grayC;
|
||||
CGrafPtr wasCPort;
|
||||
|
||||
if (thisMac.isDepth == 4)
|
||||
{
|
||||
@@ -1008,20 +921,15 @@ void DrawMirror (Rect *mirror)
|
||||
grayC = k8DkGray2Color;
|
||||
}
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
|
||||
tempRect = *mirror;
|
||||
ColorRect(&tempRect, k8WhiteColor);
|
||||
ColorFrameRect(&tempRect, grayC);
|
||||
ColorRect(backSrcMap, tempRect, k8WhiteColor);
|
||||
ColorFrameRect(backSrcMap, tempRect, grayC);
|
||||
InsetRect(&tempRect, 1, 1);
|
||||
ColorFrameRect(&tempRect, k8EarthBlueColor);
|
||||
ColorFrameRect(backSrcMap, tempRect, k8EarthBlueColor);
|
||||
InsetRect(&tempRect, 1, 1);
|
||||
ColorFrameRect(&tempRect, k8EarthBlueColor);
|
||||
ColorFrameRect(backSrcMap, tempRect, k8EarthBlueColor);
|
||||
InsetRect(&tempRect, 1, 1);
|
||||
ColorFrameRect(&tempRect, grayC);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
ColorFrameRect(backSrcMap, tempRect, grayC);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DrawSimpleClutter
|
||||
@@ -1052,7 +960,6 @@ void DrawWallWindow (Rect *window)
|
||||
Rect tempRect, tempRect2;
|
||||
long brownC, tanC, dkstRedC;
|
||||
short halfWay;
|
||||
CGrafPtr wasCPort;
|
||||
|
||||
if (thisMac.isDepth == 4)
|
||||
{
|
||||
@@ -1067,74 +974,69 @@ void DrawWallWindow (Rect *window)
|
||||
dkstRedC = k8DkRed2Color;
|
||||
}
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
|
||||
tempRect = *window;
|
||||
InsetRect(&tempRect, 3, 0);
|
||||
ColorRect(&tempRect, brownC);
|
||||
HiliteRect(&tempRect, tanC, dkstRedC);
|
||||
ColorRect(backSrcMap, tempRect, brownC);
|
||||
HiliteRect(backSrcMap, tempRect, tanC, dkstRedC);
|
||||
|
||||
tempRect = *window; // top sill
|
||||
tempRect.bottom = tempRect.top + kWindowSillThick;
|
||||
tempRect.left++;
|
||||
tempRect.right--;
|
||||
ColorRect(&tempRect, brownC);
|
||||
HiliteRect(&tempRect, tanC, dkstRedC);
|
||||
ColorRect(backSrcMap, tempRect, brownC);
|
||||
HiliteRect(backSrcMap, tempRect, tanC, dkstRedC);
|
||||
tempRect.left--;
|
||||
tempRect.right++;
|
||||
tempRect.top += 2;
|
||||
tempRect.bottom -= 2;
|
||||
ColorRect(&tempRect, brownC);
|
||||
HiliteRect(&tempRect, tanC, dkstRedC);
|
||||
ColorRect(backSrcMap, tempRect, brownC);
|
||||
HiliteRect(backSrcMap, tempRect, tanC, dkstRedC);
|
||||
|
||||
tempRect = *window; // bottom sill
|
||||
tempRect.top = tempRect.bottom - kWindowSillThick;
|
||||
QOffsetRect(&tempRect, 0, -4);
|
||||
tempRect.left++;
|
||||
tempRect.right--;
|
||||
ColorRect(&tempRect, brownC);
|
||||
HiliteRect(&tempRect, tanC, dkstRedC);
|
||||
ColorRect(backSrcMap, tempRect, brownC);
|
||||
HiliteRect(backSrcMap, tempRect, tanC, dkstRedC);
|
||||
tempRect.left--;
|
||||
tempRect.right++;
|
||||
tempRect.top += 2;
|
||||
tempRect.bottom -= 2;
|
||||
ColorRect(&tempRect, brownC);
|
||||
HiliteRect(&tempRect, tanC, dkstRedC);
|
||||
ColorRect(backSrcMap, tempRect, brownC);
|
||||
HiliteRect(backSrcMap, tempRect, tanC, dkstRedC);
|
||||
|
||||
tempRect = *window; // inside frame
|
||||
tempRect.left += 8;
|
||||
tempRect.right -= 8;
|
||||
tempRect.top += 11;
|
||||
tempRect.bottom -= 15;
|
||||
HiliteRect(&tempRect, dkstRedC, tanC);
|
||||
HiliteRect(backSrcMap, tempRect, dkstRedC, tanC);
|
||||
|
||||
halfWay = (tempRect.top + tempRect.bottom) / 2;
|
||||
|
||||
tempRect2 = tempRect; // top pane
|
||||
tempRect2.bottom = halfWay + 2;
|
||||
InsetRect(&tempRect2, 5, 5);
|
||||
HiliteRect(&tempRect2, dkstRedC, tanC);
|
||||
HiliteRect(backSrcMap, tempRect2, dkstRedC, tanC);
|
||||
InsetRect(&tempRect2, 1, 1);
|
||||
if (thisMac.isDepth == 4)
|
||||
ColorRect(&tempRect2, 5);
|
||||
ColorRect(backSrcMap, tempRect2, 5);
|
||||
else
|
||||
ColorRect(&tempRect2, k8SkyColor);
|
||||
ColorRect(backSrcMap, tempRect2, k8SkyColor);
|
||||
|
||||
tempRect2 = tempRect; // bottom pane
|
||||
tempRect2.top = halfWay - 3;
|
||||
InsetRect(&tempRect2, 5, 5);
|
||||
HiliteRect(&tempRect2, dkstRedC, tanC);
|
||||
HiliteRect(backSrcMap, tempRect2, dkstRedC, tanC);
|
||||
InsetRect(&tempRect2, 1, 1);
|
||||
if (thisMac.isDepth == 4)
|
||||
ColorRect(&tempRect2, 5);
|
||||
ColorRect(backSrcMap, tempRect2, 5);
|
||||
else
|
||||
ColorRect(&tempRect2, k8SkyColor);
|
||||
ColorRect(backSrcMap, tempRect2, k8SkyColor);
|
||||
|
||||
ColorLine(tempRect2.left - 5, tempRect2.top - 7,
|
||||
ColorLine(backSrcMap, tempRect2.left - 5, tempRect2.top - 7,
|
||||
tempRect2.right + 5, tempRect2.top - 7, tanC);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DrawCalendar
|
||||
@@ -1145,7 +1047,7 @@ void DrawCalendar (Rect *theRect)
|
||||
Rect bounds;
|
||||
PicHandle thePicture;
|
||||
Str255 monthStr;
|
||||
CGrafPtr wasCPort;
|
||||
DrawSurface *wasCPort;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
@@ -1157,19 +1059,16 @@ void DrawCalendar (Rect *theRect)
|
||||
bounds = (*thePicture)->picFrame.ToRect();
|
||||
QOffsetRect(&bounds, -bounds.left, -bounds.top);
|
||||
QOffsetRect(&bounds, theRect->left, theRect->top);
|
||||
DrawPicture(thePicture, &bounds);
|
||||
backSrcMap->DrawPicture(thePicture, bounds);
|
||||
thePicture.Dispose();
|
||||
|
||||
SetPort((GrafPtr)backSrcMap);
|
||||
TextFace(bold);
|
||||
TextFont(applFont);
|
||||
TextSize(9);
|
||||
|
||||
backSrcMap->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold);
|
||||
|
||||
GetTime(&timeRec);
|
||||
GetIndString(monthStr, kMonthStringID, timeRec.month);
|
||||
MoveTo(theRect->left + ((64 - StringWidth(monthStr)) / 2), theRect->top + 55);
|
||||
ColorText(monthStr, kDarkFleshColor);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
|
||||
const Point textPos = Point::Create(theRect->left + ((64 - StringWidth(monthStr)) / 2), theRect->top + 55);
|
||||
ColorText(backSrcMap, textPos, monthStr, kDarkFleshColor);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DrawBulletin
|
||||
@@ -1178,10 +1077,6 @@ void DrawBulletin (Rect *theRect)
|
||||
{
|
||||
Rect bounds;
|
||||
PicHandle thePicture;
|
||||
CGrafPtr wasCPort;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
|
||||
thePicture = GetPicture(kBulletinPictID);
|
||||
if (thePicture == nil)
|
||||
@@ -1190,10 +1085,8 @@ void DrawBulletin (Rect *theRect)
|
||||
bounds = (*thePicture)->picFrame.ToRect();
|
||||
QOffsetRect(&bounds, -bounds.left, -bounds.top);
|
||||
QOffsetRect(&bounds, theRect->left, theRect->top);
|
||||
DrawPicture(thePicture, &bounds);
|
||||
backSrcMap->DrawPicture(thePicture, bounds);
|
||||
thePicture.Dispose();
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DrawPictObject
|
||||
@@ -1203,7 +1096,6 @@ void DrawPictObject (short what, Rect *theRect)
|
||||
Rect bounds;
|
||||
PicHandle thePicture;
|
||||
short pictID;
|
||||
CGrafPtr wasCPort;
|
||||
|
||||
switch (what)
|
||||
{
|
||||
@@ -1236,19 +1128,14 @@ void DrawPictObject (short what, Rect *theRect)
|
||||
break;
|
||||
}
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
|
||||
thePicture = GetPicture(pictID);
|
||||
if (thePicture == nil)
|
||||
RedAlert(kErrFailedGraphicLoad);
|
||||
|
||||
bounds = srcRects[what];
|
||||
QOffsetRect(&bounds, theRect->left, theRect->top);
|
||||
DrawPicture(thePicture, &bounds);
|
||||
backSrcMap->DrawPicture(thePicture, bounds);
|
||||
thePicture.Dispose();
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DrawPictWithMaskObject
|
||||
@@ -1256,14 +1143,12 @@ void DrawPictObject (short what, Rect *theRect)
|
||||
void DrawPictWithMaskObject (short what, Rect *theRect)
|
||||
{
|
||||
Rect bounds;
|
||||
GWorldPtr tempMap;
|
||||
GWorldPtr tempMask;
|
||||
DrawSurface *tempMap;
|
||||
DrawSurface *tempMask;
|
||||
short pictID, maskID;
|
||||
CGrafPtr wasCPort;
|
||||
DrawSurface *wasCPort;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
switch (what)
|
||||
{
|
||||
case kCobweb:
|
||||
@@ -1279,20 +1164,16 @@ void DrawPictWithMaskObject (short what, Rect *theRect)
|
||||
|
||||
bounds = srcRects[what];
|
||||
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
|
||||
SetGraphicsPort(tempMap);
|
||||
LoadGraphic(pictID);
|
||||
LoadGraphic(tempMap, pictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&tempMask, &bounds, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(tempMask);
|
||||
LoadGraphic(maskID);
|
||||
LoadGraphic(tempMask, maskID);
|
||||
|
||||
CopyMask((BitMap *)*GetGWorldPixMap(tempMap),
|
||||
(BitMap *)*GetGWorldPixMap(tempMask),
|
||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||
&srcRects[what], &srcRects[what], theRect);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
|
||||
DisposeGWorld(tempMap);
|
||||
DisposeGWorld(tempMask);
|
||||
|
||||
@@ -1304,13 +1185,11 @@ void DrawPictWithMaskObject (short what, Rect *theRect)
|
||||
void DrawPictSansWhiteObject (short what, Rect *theRect)
|
||||
{
|
||||
Rect bounds;
|
||||
CGrafPtr tempMap;
|
||||
DrawSurface *tempMap;
|
||||
short pictID;
|
||||
CGrafPtr wasCPort;
|
||||
DrawSurface *wasCPort;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
switch (what)
|
||||
{
|
||||
case kBBQ:
|
||||
@@ -1396,15 +1275,12 @@ void DrawPictSansWhiteObject (short what, Rect *theRect)
|
||||
|
||||
bounds = srcRects[what];
|
||||
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
|
||||
SetGraphicsPort(tempMap);
|
||||
LoadGraphic(pictID);
|
||||
LoadGraphic(tempMap, pictID);
|
||||
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(tempMap),
|
||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||
&srcRects[what], theRect, transparent);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
|
||||
DisposeGWorld(tempMap);
|
||||
// SetPort((GrafPtr)backSrcMap);
|
||||
}
|
||||
@@ -1413,24 +1289,18 @@ void DrawPictSansWhiteObject (short what, Rect *theRect)
|
||||
void DrawCustPictSansWhite (short pictID, Rect *theRect)
|
||||
{
|
||||
Rect bounds;
|
||||
GWorldPtr tempMap;
|
||||
CGrafPtr wasCPort;
|
||||
DrawSurface *tempMap;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
bounds = *theRect;
|
||||
ZeroRectCorner(&bounds);
|
||||
theErr = CreateOffScreenGWorld(&tempMap, &bounds, kPreferredPixelFormat);
|
||||
SetGraphicsPort(tempMap);
|
||||
LoadGraphic(pictID);
|
||||
LoadGraphic(tempMap, pictID);
|
||||
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(tempMap),
|
||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||
&bounds, theRect, transparent);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
|
||||
DisposeGWorld(tempMap);
|
||||
// SetPort((GrafPtr)backSrcMap);
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
|
||||
short FindObjectSelected (Point);
|
||||
void DragHandle (Point);
|
||||
void DragObject (Point);
|
||||
void DragHandle (DrawSurface *, Point);
|
||||
void DragObject (DrawSurface *, Point);
|
||||
void AddObjectPairing (void);
|
||||
Boolean ObjectIsUpBlower (objectType *);
|
||||
|
||||
@@ -71,7 +71,7 @@ short FindObjectSelected (Point where)
|
||||
|
||||
//-------------------------------------------------------------- DoSelectionClick
|
||||
|
||||
void DoSelectionClick (Point where, Boolean isDoubleClick)
|
||||
void DoSelectionClick (DrawSurface *surface, Point where, Boolean isDoubleClick)
|
||||
{
|
||||
#ifndef COMPILEDEMO
|
||||
short direction, dist;
|
||||
@@ -81,7 +81,7 @@ void DoSelectionClick (Point where, Boolean isDoubleClick)
|
||||
if ((PtInMarqueeHandle(where)) && (objActive != kNoObjectSelected))
|
||||
{
|
||||
if (StillDown())
|
||||
DragHandle(where);
|
||||
DragHandle(surface, where);
|
||||
if (ObjectHasHandle(&direction, &dist))
|
||||
{
|
||||
StartMarqueeHandled(&roomObjectRects[objActive], direction, dist);
|
||||
@@ -114,7 +114,7 @@ void DoSelectionClick (Point where, Boolean isDoubleClick)
|
||||
else
|
||||
{
|
||||
if (StillDown())
|
||||
DragObject(where);
|
||||
DragObject(surface, where);
|
||||
if (ObjectHasHandle(&direction, &dist))
|
||||
{
|
||||
StartMarqueeHandled(&roomObjectRects[objActive], direction, dist);
|
||||
@@ -141,7 +141,7 @@ void DoSelectionClick (Point where, Boolean isDoubleClick)
|
||||
//-------------------------------------------------------------- DragHandle
|
||||
|
||||
#ifndef COMPILEDEMO
|
||||
void DragHandle (Point where)
|
||||
void DragHandle (DrawSurface *surface, Point where)
|
||||
{
|
||||
short hDelta, vDelta;
|
||||
Boolean whoCares;
|
||||
@@ -161,7 +161,7 @@ void DragHandle (Point where)
|
||||
case kGrecoVent:
|
||||
case kSewerBlower:
|
||||
vDelta = thisRoom->objects[objActive].data.a.distance;
|
||||
DragMarqueeHandle(where, &vDelta);
|
||||
DragMarqueeHandle(surface, where, &vDelta);
|
||||
thisRoom->objects[objActive].data.a.distance = vDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
break;
|
||||
@@ -169,7 +169,7 @@ void DragHandle (Point where)
|
||||
case kLiftArea:
|
||||
hDelta = thisRoom->objects[objActive].data.a.distance;
|
||||
vDelta = thisRoom->objects[objActive].data.a.tall * 2;
|
||||
DragMarqueeCorner(where, &hDelta, &vDelta, false);
|
||||
DragMarqueeCorner(surface, where, &hDelta, &vDelta, false);
|
||||
thisRoom->objects[objActive].data.a.distance = hDelta;
|
||||
thisRoom->objects[objActive].data.a.tall = vDelta / 2;
|
||||
whoCares = KeepObjectLegal();
|
||||
@@ -182,7 +182,7 @@ void DragHandle (Point where)
|
||||
case kLeftFan:
|
||||
case kRightFan:
|
||||
hDelta = thisRoom->objects[objActive].data.a.distance;
|
||||
DragMarqueeHandle(where, &hDelta);
|
||||
DragMarqueeHandle(surface, where, &hDelta);
|
||||
thisRoom->objects[objActive].data.a.distance = hDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
break;
|
||||
@@ -192,13 +192,13 @@ void DragHandle (Point where)
|
||||
((thisRoom->objects[objActive].data.a.vector & 0x0F) == 4))
|
||||
{
|
||||
vDelta = thisRoom->objects[objActive].data.a.distance;
|
||||
DragMarqueeHandle(where, &vDelta);
|
||||
DragMarqueeHandle(surface, where, &vDelta);
|
||||
thisRoom->objects[objActive].data.a.distance = vDelta;
|
||||
}
|
||||
else
|
||||
{
|
||||
hDelta = thisRoom->objects[objActive].data.a.distance;
|
||||
DragMarqueeHandle(where, &hDelta);
|
||||
DragMarqueeHandle(surface, where, &hDelta);
|
||||
thisRoom->objects[objActive].data.a.distance = hDelta;
|
||||
}
|
||||
whoCares = KeepObjectLegal();
|
||||
@@ -208,7 +208,7 @@ void DragHandle (Point where)
|
||||
case kShelf:
|
||||
case kDeckTable:
|
||||
hDelta = RectWide(&thisRoom->objects[objActive].data.b.bounds);
|
||||
DragMarqueeHandle(where, &hDelta);
|
||||
DragMarqueeHandle(surface, where, &hDelta);
|
||||
thisRoom->objects[objActive].data.b.bounds.right =
|
||||
thisRoom->objects[objActive].data.b.bounds.left + hDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
@@ -223,7 +223,7 @@ void DragHandle (Point where)
|
||||
case kInvisBounce:
|
||||
hDelta = RectWide(&thisRoom->objects[objActive].data.b.bounds);
|
||||
vDelta = RectTall(&thisRoom->objects[objActive].data.b.bounds);
|
||||
DragMarqueeCorner(where, &hDelta, &vDelta, false);
|
||||
DragMarqueeCorner(surface, where, &hDelta, &vDelta, false);
|
||||
thisRoom->objects[objActive].data.b.bounds.right =
|
||||
thisRoom->objects[objActive].data.b.bounds.left + hDelta;
|
||||
thisRoom->objects[objActive].data.b.bounds.bottom =
|
||||
@@ -239,7 +239,7 @@ void DragHandle (Point where)
|
||||
case kDresser:
|
||||
hDelta = RectWide(&thisRoom->objects[objActive].data.b.bounds);
|
||||
vDelta = RectTall(&thisRoom->objects[objActive].data.b.bounds);
|
||||
DragMarqueeCorner(where, &hDelta, &vDelta, true);
|
||||
DragMarqueeCorner(surface, where, &hDelta, &vDelta, true);
|
||||
thisRoom->objects[objActive].data.b.bounds.right =
|
||||
thisRoom->objects[objActive].data.b.bounds.left + hDelta;
|
||||
thisRoom->objects[objActive].data.b.bounds.top =
|
||||
@@ -255,7 +255,7 @@ void DragHandle (Point where)
|
||||
case kGreaseLf:
|
||||
case kSlider:
|
||||
hDelta = thisRoom->objects[objActive].data.c.length;
|
||||
DragMarqueeHandle(where, &hDelta);
|
||||
DragMarqueeHandle(surface, where, &hDelta);
|
||||
thisRoom->objects[objActive].data.c.length = hDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
InvalWindowRect(mainWindow, &mainWindowRect);
|
||||
@@ -267,7 +267,7 @@ void DragHandle (Point where)
|
||||
case kInvisTrans:
|
||||
hDelta = thisRoom->objects[objActive].data.d.wide;
|
||||
vDelta = thisRoom->objects[objActive].data.d.tall;
|
||||
DragMarqueeCorner(where, &hDelta, &vDelta, false);
|
||||
DragMarqueeCorner(surface, where, &hDelta, &vDelta, false);
|
||||
if (hDelta > 127)
|
||||
hDelta = 127;
|
||||
thisRoom->objects[objActive].data.d.wide = (Byte)hDelta;
|
||||
@@ -282,7 +282,7 @@ void DragHandle (Point where)
|
||||
case kDeluxeTrans:
|
||||
hDelta = ((thisRoom->objects[objActive].data.d.tall & 0xFF00) >> 8) * 4;
|
||||
vDelta = (thisRoom->objects[objActive].data.d.tall & 0x00FF) * 4;
|
||||
DragMarqueeCorner(where, &hDelta, &vDelta, false);
|
||||
DragMarqueeCorner(surface, where, &hDelta, &vDelta, false);
|
||||
if (hDelta < 64)
|
||||
hDelta = 64;
|
||||
if (vDelta < 32)
|
||||
@@ -298,7 +298,7 @@ void DragHandle (Point where)
|
||||
case kFlourescent:
|
||||
case kTrackLight:
|
||||
hDelta = thisRoom->objects[objActive].data.f.length;
|
||||
DragMarqueeHandle(where, &hDelta);
|
||||
DragMarqueeHandle(surface, where, &hDelta);
|
||||
thisRoom->objects[objActive].data.f.length = hDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
InvalWindowRect(mainWindow, &mainWindowRect);
|
||||
@@ -309,7 +309,7 @@ void DragHandle (Point where)
|
||||
|
||||
case kToaster:
|
||||
vDelta = thisRoom->objects[objActive].data.g.height;
|
||||
DragMarqueeHandle(where, &vDelta);
|
||||
DragMarqueeHandle(surface, where, &vDelta);
|
||||
thisRoom->objects[objActive].data.g.height = vDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
break;
|
||||
@@ -318,7 +318,7 @@ void DragHandle (Point where)
|
||||
case kDrip:
|
||||
case kFish:
|
||||
vDelta = thisRoom->objects[objActive].data.h.length;
|
||||
DragMarqueeHandle(where, &vDelta);
|
||||
DragMarqueeHandle(surface, where, &vDelta);
|
||||
thisRoom->objects[objActive].data.h.length = vDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
break;
|
||||
@@ -327,7 +327,7 @@ void DragHandle (Point where)
|
||||
case kWallWindow:
|
||||
hDelta = RectWide(&thisRoom->objects[objActive].data.i.bounds);
|
||||
vDelta = RectTall(&thisRoom->objects[objActive].data.i.bounds);
|
||||
DragMarqueeCorner(where, &hDelta, &vDelta, false);
|
||||
DragMarqueeCorner(surface, where, &hDelta, &vDelta, false);
|
||||
thisRoom->objects[objActive].data.i.bounds.right =
|
||||
thisRoom->objects[objActive].data.i.bounds.left + hDelta;
|
||||
thisRoom->objects[objActive].data.i.bounds.bottom =
|
||||
@@ -349,7 +349,7 @@ void DragHandle (Point where)
|
||||
//-------------------------------------------------------------- DragObject
|
||||
|
||||
#ifndef COMPILEDEMO
|
||||
void DragObject (Point where)
|
||||
void DragObject (DrawSurface *surface, Point where)
|
||||
{
|
||||
Rect newRect, wasRect;
|
||||
short deltaH, deltaV, increment;
|
||||
@@ -360,19 +360,19 @@ void DragObject (Point where)
|
||||
{
|
||||
wasRect = initialGliderRect;
|
||||
newRect = initialGliderRect;
|
||||
DragMarqueeRect(where, &newRect, false, false);
|
||||
DragMarqueeRect(surface, where, &newRect, false, false);
|
||||
}
|
||||
else if (objActive == kLeftGliderSelected)
|
||||
{
|
||||
wasRect = leftStartGliderDest;
|
||||
newRect = leftStartGliderDest;
|
||||
DragMarqueeRect(where, &newRect, false, true);
|
||||
DragMarqueeRect(surface, where, &newRect, false, true);
|
||||
}
|
||||
else if (objActive == kRightGliderSelected)
|
||||
{
|
||||
wasRect = rightStartGliderDest;
|
||||
newRect = rightStartGliderDest;
|
||||
DragMarqueeRect(where, &newRect, false, true);
|
||||
DragMarqueeRect(surface, where, &newRect, false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -409,13 +409,13 @@ void DragObject (Point where)
|
||||
case kCopterRt:
|
||||
case kMousehole:
|
||||
case kFireplace:
|
||||
DragMarqueeRect(where, &newRect, true, false);
|
||||
DragMarqueeRect(surface, where, &newRect, true, false);
|
||||
invalAll = false;
|
||||
break;
|
||||
|
||||
case kDartLf:
|
||||
case kDartRt:
|
||||
DragMarqueeRect(where, &newRect, false, true);
|
||||
DragMarqueeRect(surface, where, &newRect, false, true);
|
||||
invalAll = false;
|
||||
break;
|
||||
|
||||
@@ -436,14 +436,14 @@ void DragObject (Point where)
|
||||
case kDeluxeTrans:
|
||||
case kMirror:
|
||||
case kWallWindow:
|
||||
DragMarqueeRect(where, &newRect, false, false);
|
||||
DragMarqueeRect(surface, where, &newRect, false, false);
|
||||
invalAll = true;
|
||||
break;
|
||||
|
||||
case kCounter:
|
||||
case kDresser:
|
||||
case kTrackLight:
|
||||
DragMarqueeRect(where, &newRect, true, false);
|
||||
DragMarqueeRect(surface, where, &newRect, true, false);
|
||||
invalAll = true;
|
||||
break;
|
||||
|
||||
@@ -513,7 +513,7 @@ void DragObject (Point where)
|
||||
case kFaucet:
|
||||
case kRug:
|
||||
case kChimes:
|
||||
DragMarqueeRect(where, &newRect, false, false);
|
||||
DragMarqueeRect(surface, where, &newRect, false, false);
|
||||
invalAll = false;
|
||||
break;
|
||||
}
|
||||
@@ -2302,11 +2302,9 @@ void DrawThisRoomsObjects (void)
|
||||
{
|
||||
Rect tempRect;
|
||||
short i;
|
||||
CGrafPtr wasCPort;
|
||||
Pattern dummyPattern;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
DrawSurface *surface = backSrcMap;
|
||||
|
||||
if ((noRoomAtAll) || (!houseUnlocked))
|
||||
return;
|
||||
@@ -2314,10 +2312,10 @@ void DrawThisRoomsObjects (void)
|
||||
{
|
||||
if (GetNumberOfLights(thisRoomNumber) <= 0)
|
||||
{
|
||||
PenMask(true);
|
||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||
PaintRect(&backSrcRect);
|
||||
PenNormal();
|
||||
surface->SetMaskMode(true);
|
||||
surface->SetPattern8x8(*GetQDGlobalsGray(&dummyPattern));
|
||||
surface->FillRect(backSrcRect);
|
||||
surface->SetMaskMode(false);
|
||||
}
|
||||
|
||||
for (i = 0; i < kMaxRoomObs; i++)
|
||||
@@ -2693,12 +2691,13 @@ void HiliteAllObjects (void)
|
||||
return;
|
||||
|
||||
PauseMarquee();
|
||||
SetPort((GrafPtr)mainWindow);
|
||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||
PenInvertMode(true);
|
||||
|
||||
DrawSurface *surface = mainWindow->GetDrawSurface();
|
||||
|
||||
GetQDGlobalsGray(&dummyPattern);
|
||||
|
||||
for (i = 0; i < kMaxRoomObs; i++)
|
||||
FrameRect(&roomObjectRects[i]);
|
||||
surface->InvertFrameRect(roomObjectRects[i], dummyPattern);
|
||||
|
||||
do
|
||||
{
|
||||
@@ -2708,9 +2707,8 @@ void HiliteAllObjects (void)
|
||||
(BitTst(theseKeys, PL_KEY_EITHER_SPECIAL(kAlt))));
|
||||
|
||||
for (i = 0; i < kMaxRoomObs; i++)
|
||||
FrameRect(&roomObjectRects[i]);
|
||||
|
||||
PenNormal();
|
||||
surface->InvertFrameRect(roomObjectRects[i], dummyPattern);
|
||||
|
||||
ResumeMarquee();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -10,9 +10,11 @@
|
||||
#include "PLSound.h"
|
||||
#include "PLTextUtils.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "DialogManager.h"
|
||||
#include "DialogUtils.h"
|
||||
#include "Externs.h"
|
||||
#include "ObjectEdit.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "RectUtils.h"
|
||||
|
||||
|
||||
@@ -126,6 +128,8 @@ void UpdateBlowerInfo (DialogPtr theDialog)
|
||||
DrawDialog(theDialog);
|
||||
DrawDefaultButton(theDialog);
|
||||
FrameDialogItemC(theDialog, 5, kRedOrangeColor8);
|
||||
|
||||
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
|
||||
|
||||
if ((thisRoom->objects[objActive].what != kLeftFan) &&
|
||||
(thisRoom->objects[objActive].what != kRightFan))
|
||||
@@ -133,55 +137,62 @@ void UpdateBlowerInfo (DialogPtr theDialog)
|
||||
GetDialogItemRect(theDialog, 8, &bounds);
|
||||
bounds.right += 2;
|
||||
bounds.bottom += 2;
|
||||
EraseRect(&bounds);
|
||||
|
||||
surface->SetForeColor(StdColors::White());
|
||||
surface->FillRect(bounds);
|
||||
bounds.right -= 2;
|
||||
bounds.bottom -= 2;
|
||||
PenSize(2, 2);
|
||||
|
||||
switch (newDirection)
|
||||
|
||||
for (int16_t offsetChunk = 0; offsetChunk < 4; offsetChunk++)
|
||||
{
|
||||
case 1: // up
|
||||
MoveTo(bounds.left + HalfRectWide(&bounds), bounds.top);
|
||||
Line(0, RectTall(&bounds));
|
||||
MoveTo(bounds.left + HalfRectWide(&bounds), bounds.top);
|
||||
Line(kArrowheadLength, kArrowheadLength);
|
||||
MoveTo(bounds.left + HalfRectWide(&bounds), bounds.top);
|
||||
Line(-kArrowheadLength, kArrowheadLength);
|
||||
break;
|
||||
const int16_t xOffset = offsetChunk & 1;
|
||||
const int16_t yOffset = (offsetChunk >> 1) & 1;
|
||||
|
||||
const Point offset = Point::Create(xOffset, yOffset);
|
||||
|
||||
switch (newDirection)
|
||||
{
|
||||
case 1: // up
|
||||
surface->DrawLine(offset + Point::Create(bounds.left + HalfRectWide(&bounds), bounds.top),
|
||||
offset + Point::Create(0, RectTall(&bounds)));
|
||||
surface->DrawLine(offset + Point::Create(bounds.left + HalfRectWide(&bounds), bounds.top),
|
||||
offset + Point::Create(kArrowheadLength, kArrowheadLength));
|
||||
surface->DrawLine(offset + Point::Create(bounds.left + HalfRectWide(&bounds), bounds.top),
|
||||
offset + Point::Create(-kArrowheadLength, kArrowheadLength));
|
||||
break;
|
||||
|
||||
case 2: // right
|
||||
MoveTo(bounds.right, bounds.top + HalfRectTall(&bounds));
|
||||
Line(-RectWide(&bounds), 0);
|
||||
MoveTo(bounds.right, bounds.top + HalfRectTall(&bounds));
|
||||
Line(-kArrowheadLength, kArrowheadLength);
|
||||
MoveTo(bounds.right, bounds.top + HalfRectTall(&bounds));
|
||||
Line(-kArrowheadLength, -kArrowheadLength);
|
||||
break;
|
||||
case 2: // right
|
||||
surface->DrawLine(offset + Point::Create(bounds.right, bounds.top + HalfRectTall(&bounds)),
|
||||
offset + Point::Create(-RectWide(&bounds), 0));
|
||||
surface->DrawLine(offset + Point::Create(bounds.right, bounds.top + HalfRectTall(&bounds)),
|
||||
offset + Point::Create(-kArrowheadLength, kArrowheadLength));
|
||||
surface->DrawLine(offset + Point::Create(bounds.right, bounds.top + HalfRectTall(&bounds)),
|
||||
offset + Point::Create(-kArrowheadLength, -kArrowheadLength));
|
||||
break;
|
||||
|
||||
case 4: // down
|
||||
MoveTo(bounds.left + HalfRectWide(&bounds), bounds.top);
|
||||
Line(0, RectTall(&bounds));
|
||||
MoveTo(bounds.left + HalfRectWide(&bounds), bounds.bottom);
|
||||
Line(kArrowheadLength, -kArrowheadLength);
|
||||
MoveTo(bounds.left + HalfRectWide(&bounds), bounds.bottom);
|
||||
Line(-kArrowheadLength, -kArrowheadLength);
|
||||
break;
|
||||
case 4: // down
|
||||
surface->DrawLine(offset + Point::Create(bounds.left + HalfRectWide(&bounds), bounds.top),
|
||||
offset + Point::Create(0, RectTall(&bounds)));
|
||||
surface->DrawLine(offset + Point::Create(bounds.left + HalfRectWide(&bounds), bounds.bottom),
|
||||
offset + Point::Create(kArrowheadLength, -kArrowheadLength));
|
||||
surface->DrawLine(offset + Point::Create(bounds.left + HalfRectWide(&bounds), bounds.bottom),
|
||||
offset + Point::Create(-kArrowheadLength, -kArrowheadLength));
|
||||
break;
|
||||
|
||||
case 8: // left
|
||||
MoveTo(bounds.left, bounds.top + HalfRectTall(&bounds));
|
||||
Line(RectWide(&bounds), 0);
|
||||
MoveTo(bounds.left, bounds.top + HalfRectTall(&bounds));
|
||||
Line(kArrowheadLength, -kArrowheadLength);
|
||||
MoveTo(bounds.left, bounds.top + HalfRectTall(&bounds));
|
||||
Line(kArrowheadLength, kArrowheadLength);
|
||||
break;
|
||||
case 8: // left
|
||||
surface->DrawLine(offset + Point::Create(bounds.left, bounds.top + HalfRectTall(&bounds)),
|
||||
offset + Point::Create(RectWide(&bounds), 0));
|
||||
surface->DrawLine(offset + Point::Create(bounds.left, bounds.top + HalfRectTall(&bounds)),
|
||||
offset + Point::Create(kArrowheadLength, -kArrowheadLength));
|
||||
surface->DrawLine(offset + Point::Create(bounds.left, bounds.top + HalfRectTall(&bounds)),
|
||||
offset + Point::Create(kArrowheadLength, kArrowheadLength));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PenNormal();
|
||||
|
||||
if ((thisRoom->objects[objActive].what == kInvisBlower) ||
|
||||
(thisRoom->objects[objActive].what == kLiftArea))
|
||||
{
|
||||
@@ -376,9 +387,8 @@ Boolean BlowerFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateBlowerInfo(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -412,9 +422,8 @@ Boolean FurnitureFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateFurnitureInfo(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -448,9 +457,8 @@ Boolean CustPictFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateCustPictInfo(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -490,9 +498,8 @@ Boolean SwitchFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateSwitchInfo(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -537,9 +544,8 @@ Boolean TriggerFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateTriggerInfo(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -587,9 +593,8 @@ Boolean LightFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateLightInfo(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -642,9 +647,8 @@ Boolean ApplianceFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateApplianceInfo(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -692,9 +696,8 @@ Boolean MicrowaveFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateMicrowaveInfo(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -734,9 +737,8 @@ Boolean GreaseFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateGreaseInfo(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -770,9 +772,8 @@ Boolean InvisBonusFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateInvisBonusInfo(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -812,9 +813,8 @@ Boolean TransFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateTransInfo(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -867,9 +867,8 @@ Boolean EnemyFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateEnemyInfo(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -917,9 +916,8 @@ Boolean FlowerFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateFlowerInfo(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -948,7 +946,7 @@ void DoBlowerObjectInfo (short what)
|
||||
ParamText(numberStr, kindStr, distStr, PSTR(""));
|
||||
|
||||
// CenterDialog(kBlowerInfoDialogID);
|
||||
infoDial = GetNewDialog(kBlowerInfoDialogID, nil, kPutInFront);
|
||||
infoDial = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kBlowerInfoDialogID, kPutInFront);
|
||||
if (infoDial == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetPort((GrafPtr)infoDial);
|
||||
@@ -990,7 +988,7 @@ void DoBlowerObjectInfo (short what)
|
||||
if (retroLinkList[objActive].room == -1)
|
||||
HideDialogItem(infoDial, 15);
|
||||
|
||||
ShowWindow(GetDialogWindow(infoDial));
|
||||
ShowWindow(infoDial->GetWindow());
|
||||
|
||||
leaving = false;
|
||||
doReturn = false;
|
||||
@@ -1560,7 +1558,7 @@ void DoLightObjectInfo (void)
|
||||
ParamText(numberStr, kindStr, PSTR(""), PSTR(""));
|
||||
|
||||
// CenterDialog(kLightInfoDialogID);
|
||||
infoDial = GetNewDialog(kLightInfoDialogID, nil, kPutInFront);
|
||||
infoDial = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kLightInfoDialogID, kPutInFront);
|
||||
if (infoDial == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetPort((GrafPtr)infoDial);
|
||||
@@ -1573,7 +1571,7 @@ void DoLightObjectInfo (void)
|
||||
if (retroLinkList[objActive].room == -1)
|
||||
HideDialogItem(infoDial, 8);
|
||||
|
||||
ShowWindow(GetDialogWindow(infoDial));
|
||||
ShowWindow(infoDial->GetWindow());
|
||||
|
||||
leaving = false;
|
||||
doReturn = false;
|
||||
|
||||
@@ -17,37 +17,37 @@ void ListOneRoomsObjects (short);
|
||||
|
||||
|
||||
Rect blowerSrcRect; // Blowers
|
||||
GWorldPtr blowerSrcMap;
|
||||
GWorldPtr blowerMaskMap;
|
||||
DrawSurface *blowerSrcMap;
|
||||
DrawSurface *blowerMaskMap;
|
||||
Rect flame[kNumCandleFlames], tikiFlame[kNumTikiFlames];
|
||||
Rect coals[kNumBBQCoals];
|
||||
Rect furnitureSrcRect; // Furniture
|
||||
GWorldPtr furnitureSrcMap;
|
||||
GWorldPtr furnitureMaskMap;
|
||||
DrawSurface *furnitureSrcMap;
|
||||
DrawSurface *furnitureMaskMap;
|
||||
Rect tableSrc, shelfSrc, hingeSrc, handleSrc, knobSrc;
|
||||
Rect leftFootSrc, rightFootSrc, deckSrc;
|
||||
Rect bonusSrcRect; // Bonuses
|
||||
GWorldPtr bonusSrcMap;
|
||||
GWorldPtr bonusMaskMap;
|
||||
DrawSurface *bonusSrcMap;
|
||||
DrawSurface *bonusMaskMap;
|
||||
Rect pointsSrcRect;
|
||||
GWorldPtr pointsSrcMap;
|
||||
GWorldPtr pointsMaskMap;
|
||||
DrawSurface *pointsSrcMap;
|
||||
DrawSurface *pointsMaskMap;
|
||||
Rect starSrc[6], sparkleSrc[kNumSparkleModes];
|
||||
Rect digits[11], pendulumSrc[3], greaseSrcRt[4], greaseSrcLf[4];
|
||||
Rect transSrcRect; // Transport
|
||||
GWorldPtr transSrcMap;
|
||||
GWorldPtr transMaskMap;
|
||||
DrawSurface *transSrcMap;
|
||||
DrawSurface *transMaskMap;
|
||||
Rect switchSrcRect; // Switches
|
||||
GWorldPtr switchSrcMap;
|
||||
DrawSurface *switchSrcMap;
|
||||
Rect lightSwitchSrc[2], machineSwitchSrc[2], thermostatSrc[2];
|
||||
Rect powerSrc[2], knifeSwitchSrc[2];
|
||||
Rect lightSrcRect; // Lights
|
||||
GWorldPtr lightSrcMap;
|
||||
GWorldPtr lightMaskMap;
|
||||
DrawSurface *lightSrcMap;
|
||||
DrawSurface *lightMaskMap;
|
||||
Rect flourescentSrc1, flourescentSrc2, trackLightSrc[kNumTrackLights];
|
||||
Rect applianceSrcRect, toastSrcRect, shredSrcRect; // Appliances
|
||||
GWorldPtr applianceSrcMap, toastSrcMap, shredSrcMap;
|
||||
GWorldPtr applianceMaskMap, toastMaskMap, shredMaskMap;
|
||||
DrawSurface *applianceSrcMap, *toastSrcMap, *shredSrcMap;
|
||||
DrawSurface *applianceMaskMap, *toastMaskMap, *shredMaskMap;
|
||||
Rect plusScreen1, plusScreen2, tvScreen1, tvScreen2;
|
||||
Rect coffeeLight1, coffeeLight2, vcrTime1, vcrTime2;
|
||||
Rect stereoLight1, stereoLight2, microOn, microOff;
|
||||
@@ -55,17 +55,17 @@ Rect outletSrc[kNumOutletPicts];
|
||||
Rect balloonSrcRect, copterSrcRect, dartSrcRect; // Enemies
|
||||
Rect ballSrcRect, dripSrcRect, enemySrcRect;
|
||||
Rect fishSrcRect;
|
||||
GWorldPtr balloonSrcMap, copterSrcMap, dartSrcMap;
|
||||
GWorldPtr ballSrcMap, dripSrcMap, enemySrcMap;
|
||||
GWorldPtr fishSrcMap;
|
||||
GWorldPtr balloonMaskMap, copterMaskMap, dartMaskMap;
|
||||
GWorldPtr ballMaskMap, dripMaskMap, enemyMaskMap;
|
||||
GWorldPtr fishMaskMap;
|
||||
DrawSurface *balloonSrcMap, *copterSrcMap, *dartSrcMap;
|
||||
DrawSurface *ballSrcMap, *dripSrcMap, *enemySrcMap;
|
||||
DrawSurface *fishSrcMap;
|
||||
DrawSurface *balloonMaskMap, *copterMaskMap, *dartMaskMap;
|
||||
DrawSurface *ballMaskMap, *dripMaskMap, *enemyMaskMap;
|
||||
DrawSurface *fishMaskMap;
|
||||
Rect balloonSrc[kNumBalloonFrames], copterSrc[kNumCopterFrames];
|
||||
Rect dartSrc[kNumDartFrames], ballSrc[kNumBallFrames];
|
||||
Rect dripSrc[kNumDripFrames], fishSrc[kNumFishFrames];
|
||||
GWorldPtr clutterSrcMap; // Clutter
|
||||
GWorldPtr clutterMaskMap;
|
||||
DrawSurface *clutterSrcMap; // Clutter
|
||||
DrawSurface *clutterMaskMap;
|
||||
Rect clutterSrcRect;
|
||||
Rect flowerSrc[kNumFlowers];
|
||||
Rect *srcRects;
|
||||
|
||||
@@ -5,38 +5,38 @@
|
||||
//============================================================================
|
||||
|
||||
|
||||
extern GWorldPtr blowerSrcMap;
|
||||
extern GWorldPtr blowerMaskMap;
|
||||
extern GWorldPtr furnitureSrcMap;
|
||||
extern GWorldPtr furnitureMaskMap;
|
||||
extern GWorldPtr bonusSrcMap;
|
||||
extern GWorldPtr bonusMaskMap;
|
||||
extern GWorldPtr pointsSrcMap;
|
||||
extern GWorldPtr pointsMaskMap;
|
||||
extern GWorldPtr transSrcMap;
|
||||
extern GWorldPtr transMaskMap;
|
||||
extern GWorldPtr switchSrcMap;
|
||||
extern GWorldPtr lightSrcMap;
|
||||
extern GWorldPtr lightMaskMap;
|
||||
extern GWorldPtr applianceSrcMap;
|
||||
extern GWorldPtr applianceMaskMap;
|
||||
extern GWorldPtr toastSrcMap;
|
||||
extern GWorldPtr toastMaskMap;
|
||||
extern GWorldPtr shredSrcMap;
|
||||
extern GWorldPtr shredMaskMap;
|
||||
extern GWorldPtr balloonSrcMap;
|
||||
extern GWorldPtr balloonMaskMap;
|
||||
extern GWorldPtr copterSrcMap;
|
||||
extern GWorldPtr copterMaskMap;
|
||||
extern GWorldPtr dartSrcMap;
|
||||
extern GWorldPtr dartMaskMap;
|
||||
extern GWorldPtr ballSrcMap;
|
||||
extern GWorldPtr ballMaskMap;
|
||||
extern GWorldPtr dripSrcMap;
|
||||
extern GWorldPtr dripMaskMap;
|
||||
extern GWorldPtr enemySrcMap;
|
||||
extern GWorldPtr enemyMaskMap;
|
||||
extern GWorldPtr fishSrcMap;
|
||||
extern GWorldPtr fishMaskMap;
|
||||
extern GWorldPtr clutterSrcMap;
|
||||
extern GWorldPtr clutterMaskMap;
|
||||
extern DrawSurface *blowerSrcMap;
|
||||
extern DrawSurface *blowerMaskMap;
|
||||
extern DrawSurface *furnitureSrcMap;
|
||||
extern DrawSurface *furnitureMaskMap;
|
||||
extern DrawSurface *bonusSrcMap;
|
||||
extern DrawSurface *bonusMaskMap;
|
||||
extern DrawSurface *pointsSrcMap;
|
||||
extern DrawSurface *pointsMaskMap;
|
||||
extern DrawSurface *transSrcMap;
|
||||
extern DrawSurface *transMaskMap;
|
||||
extern DrawSurface *switchSrcMap;
|
||||
extern DrawSurface *lightSrcMap;
|
||||
extern DrawSurface *lightMaskMap;
|
||||
extern DrawSurface *applianceSrcMap;
|
||||
extern DrawSurface *applianceMaskMap;
|
||||
extern DrawSurface *toastSrcMap;
|
||||
extern DrawSurface *toastMaskMap;
|
||||
extern DrawSurface *shredSrcMap;
|
||||
extern DrawSurface *shredMaskMap;
|
||||
extern DrawSurface *balloonSrcMap;
|
||||
extern DrawSurface *balloonMaskMap;
|
||||
extern DrawSurface *copterSrcMap;
|
||||
extern DrawSurface *copterMaskMap;
|
||||
extern DrawSurface *dartSrcMap;
|
||||
extern DrawSurface *dartMaskMap;
|
||||
extern DrawSurface *ballSrcMap;
|
||||
extern DrawSurface *ballMaskMap;
|
||||
extern DrawSurface *dripSrcMap;
|
||||
extern DrawSurface *dripMaskMap;
|
||||
extern DrawSurface *enemySrcMap;
|
||||
extern DrawSurface *enemyMaskMap;
|
||||
extern DrawSurface *fishSrcMap;
|
||||
extern DrawSurface *fishMaskMap;
|
||||
extern DrawSurface *clutterSrcMap;
|
||||
extern DrawSurface *clutterMaskMap;
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
|
||||
#include "PLResources.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "House.h"
|
||||
@@ -46,8 +47,8 @@ short GetNumStarsRemaining (short, short);
|
||||
|
||||
phoneType thePhone, theChimes;
|
||||
Rect glidSrcRect, justRoomsRect;
|
||||
GWorldPtr glidSrcMap, glid2SrcMap;
|
||||
GWorldPtr glidMaskMap;
|
||||
DrawSurface *glidSrcMap, *glid2SrcMap;
|
||||
DrawSurface *glidMaskMap;
|
||||
long gameFrame;
|
||||
short batteryTotal, bandsTotal, foilTotal, mortals;
|
||||
Boolean playing, evenFrame, twoPlayerGame, showFoil, demoGoing;
|
||||
@@ -120,38 +121,35 @@ void NewGame (short mode)
|
||||
{
|
||||
InitGlider(&theGlider, kNewGameMode);
|
||||
InitGlider(&theGlider2, kNewGameMode);
|
||||
SetPort((GrafPtr)glidSrcMap);
|
||||
LoadGraphic(kGliderPictID);
|
||||
SetPort((GrafPtr)glid2SrcMap);
|
||||
LoadGraphic(kGlider2PictID);
|
||||
LoadGraphic(glidSrcMap, kGliderPictID);
|
||||
LoadGraphic(glid2SrcMap, kGlider2PictID);
|
||||
}
|
||||
else
|
||||
{
|
||||
InitGlider(&theGlider, mode);
|
||||
SetPort((GrafPtr)glidSrcMap);
|
||||
LoadGraphic(kGliderPictID);
|
||||
SetPort((GrafPtr)glid2SrcMap);
|
||||
LoadGraphic(kGliderFoilPictID);
|
||||
LoadGraphic(glidSrcMap, kGliderPictID);
|
||||
LoadGraphic(glid2SrcMap, kGliderFoilPictID);
|
||||
}
|
||||
|
||||
#if !BUILD_ARCADE_VERSION
|
||||
// HideMenuBarOld(); // TEMP
|
||||
#endif
|
||||
|
||||
SetPort((GrafPtr)mainWindow); // paint strip on screen black
|
||||
|
||||
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
|
||||
|
||||
tempRect = thisMac.screen;
|
||||
tempRect.top = tempRect.bottom - 20; // thisMac.menuHigh
|
||||
PaintRect(&tempRect);
|
||||
mainWindowSurface->FillRect(tempRect);
|
||||
|
||||
#ifdef COMPILEQT
|
||||
if ((thisMac.hasQT) && (hasMovie))
|
||||
{
|
||||
SetMovieGWorld(theMovie, (CGrafPtr)mainWindow, nil);
|
||||
SetMovieGWorld(theMovie, &mainWindow->m_graf, nil);
|
||||
}
|
||||
#endif
|
||||
|
||||
SetPort((GrafPtr)workSrcMap);
|
||||
PaintRect(&workSrcRect);
|
||||
workSrcMap->SetForeColor(StdColors::Black());
|
||||
workSrcMap->FillRect(workSrcRect);
|
||||
// if (quickerTransitions)
|
||||
// DissBitsChunky(&workSrcRect);
|
||||
// else
|
||||
@@ -249,22 +247,12 @@ void NewGame (short mode)
|
||||
}
|
||||
NilSavedMaps();
|
||||
SetPortWindowPort(mainWindow);
|
||||
BlackenScoreboard();
|
||||
BlackenScoreboard(mainWindow->GetDrawSurface());
|
||||
UpdateMenus(false);
|
||||
|
||||
if (!gameOver)
|
||||
{
|
||||
CGrafPtr wasCPort = GetGraphicsPort();
|
||||
|
||||
InvalWindowRect(mainWindow, &mainWindowRect);
|
||||
|
||||
SetGraphicsPort(workSrcMap);
|
||||
PaintRect(&workSrcRect);
|
||||
QSetRect(&tempRect, 0, 0, 640, 460);
|
||||
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
|
||||
LoadScaledGraphic(kSplash8BitPICT, &tempRect);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
RedrawSplashScreen();
|
||||
}
|
||||
WaitCommandQReleased();
|
||||
demoGoing = false;
|
||||
@@ -391,7 +379,6 @@ void HandlePlayEvent (void)
|
||||
{
|
||||
GetPort(&wasPort);
|
||||
SetPortWindowPort(mainWindow);
|
||||
BeginUpdate(mainWindow);
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
||||
&justRoomsRect, &justRoomsRect, srcCopy);
|
||||
@@ -495,16 +482,14 @@ void PlayGame (void)
|
||||
countDown--;
|
||||
if (countDown <= 0)
|
||||
{
|
||||
CGrafPtr wasCPort = GetGraphicsPort();
|
||||
|
||||
HideGlider(&theGlider);
|
||||
RefreshScoreboard(kNormalTitleMode);
|
||||
|
||||
#if BUILD_ARCADE_VERSION
|
||||
// Need to paint over the scoreboard black.
|
||||
|
||||
SetGraphicsPort(boardSrcMap);
|
||||
PaintRect(&boardSrcRect);
|
||||
boardSrcMap->SetForeColor(StdColors::Black());
|
||||
boardSrcMap->FillRect(boardSrcRect);
|
||||
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(boardSrcMap),
|
||||
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
|
||||
@@ -525,7 +510,7 @@ void PlayGame (void)
|
||||
bounds = (*thePicture)->picFrame.ToRect();
|
||||
QOffsetRect(&bounds, -bounds.left, -bounds.top);
|
||||
QOffsetRect(&bounds, hOffset, 0);
|
||||
DrawPicture(thePicture, &bounds);
|
||||
boardSrcMap->DrawPicture(thePicture, bounds);
|
||||
thePicture.Dispose();
|
||||
}
|
||||
#else
|
||||
@@ -536,18 +521,16 @@ void PlayGame (void)
|
||||
DoDiedGameOver();
|
||||
else
|
||||
DoGameOver();
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if BUILD_ARCADE_VERSION
|
||||
{
|
||||
CGrafPtr wasCPort = GetGraphicsPort();
|
||||
DrawSurface *wasCPort = GetGraphicsPort();
|
||||
|
||||
SetGraphicsPort(boardSrcMap);
|
||||
PaintRect(&boardSrcRect);
|
||||
boardSrcMap->SetForeColor(StdColors::Black());
|
||||
boardSrcMap->FillRect(boardSrcRect);
|
||||
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(boardSrcMap),
|
||||
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
|
||||
@@ -561,10 +544,6 @@ void PlayGame (void)
|
||||
PicHandle thePicture;
|
||||
SInt16 hOffset;
|
||||
|
||||
CGrafPtr wasCPort = GetGraphicsPort();
|
||||
|
||||
SetGraphicsPort(boardSrcMap);
|
||||
|
||||
if (boardSrcRect.right >= 640)
|
||||
hOffset = (RectWide(&boardSrcRect) - kMaxViewWidth) / 2;
|
||||
else
|
||||
@@ -575,10 +554,8 @@ void PlayGame (void)
|
||||
bounds = (*thePicture)->picFrame.ToRect();
|
||||
QOffsetRect(&bounds, -bounds.left, -bounds.top);
|
||||
QOffsetRect(&bounds, hOffset, 0);
|
||||
DrawPicture(thePicture, &bounds);
|
||||
boardSrcMap->DrawPicture(thePicture, bounds);
|
||||
thePicture.Dispose();
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -794,9 +771,11 @@ void RestoreEntireGameScreen (void)
|
||||
// HideMenuBarOld(); // TEMP
|
||||
#endif
|
||||
|
||||
SetPort((GrafPtr)mainWindow);
|
||||
DrawSurface *surface = mainWindow->GetDrawSurface();
|
||||
tempRect = thisMac.screen;
|
||||
PaintRect(&tempRect);
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
surface->FillRect(tempRect);
|
||||
|
||||
DrawLocale();
|
||||
RefreshScoreboard(kNormalTitleMode);
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
#include "PLQDOffscreen.h"
|
||||
|
||||
|
||||
extern GWorldPtr glidSrcMap;
|
||||
extern GWorldPtr glid2SrcMap;
|
||||
extern GWorldPtr glidMaskMap;
|
||||
extern DrawSurface *glidSrcMap;
|
||||
extern DrawSurface *glid2SrcMap;
|
||||
extern DrawSurface *glidMaskMap;
|
||||
|
||||
@@ -43,8 +43,8 @@ void HandleIdleGlider (gliderPtr);
|
||||
|
||||
gliderType theGlider, theGlider2;
|
||||
Rect shadowSrcRect;
|
||||
GWorldPtr shadowSrcMap;
|
||||
GWorldPtr shadowMaskMap;
|
||||
DrawSurface *shadowSrcMap;
|
||||
DrawSurface *shadowMaskMap;
|
||||
Rect shadowSrc[kNumShadowSrcRects];
|
||||
Rect gliderSrc[kNumGliderSrcRects];
|
||||
Rect transRect;
|
||||
@@ -1175,10 +1175,8 @@ void DeckGliderInFoil (gliderPtr thisGlider)
|
||||
|
||||
if (twoPlayerGame)
|
||||
{
|
||||
SetPort((GrafPtr)glidSrcMap);
|
||||
LoadGraphic(kGliderFoilPictID);
|
||||
SetPort((GrafPtr)glid2SrcMap);
|
||||
LoadGraphic(kGliderFoil2PictID);
|
||||
LoadGraphic(glidSrcMap, kGliderFoilPictID);
|
||||
LoadGraphic(glidSrcMap, kGliderFoil2PictID);
|
||||
}
|
||||
|
||||
if (thisGlider->facing == kFaceLeft)
|
||||
@@ -1235,10 +1233,8 @@ void RemoveFoilFromGlider (gliderPtr thisGlider)
|
||||
|
||||
if (twoPlayerGame)
|
||||
{
|
||||
SetPort((GrafPtr)glidSrcMap);
|
||||
LoadGraphic(kGliderPictID);
|
||||
SetPort((GrafPtr)glid2SrcMap);
|
||||
LoadGraphic(kGlider2PictID);
|
||||
LoadGraphic(glidSrcMap, kGliderPictID);
|
||||
LoadGraphic(glid2SrcMap, kGlider2PictID);
|
||||
}
|
||||
|
||||
if (thisGlider->facing == kFaceLeft)
|
||||
|
||||
@@ -8,5 +8,5 @@
|
||||
#include "PLQDOffscreen.h"
|
||||
|
||||
|
||||
extern GWorldPtr shadowSrcMap;
|
||||
extern GWorldPtr shadowMaskMap;
|
||||
extern DrawSurface *shadowSrcMap;
|
||||
extern DrawSurface *shadowMaskMap;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
// Given the top left corner and a width and height, this function<6F>
|
||||
// simply creates the necessary rectangle and frames it.
|
||||
|
||||
void FrameWHRect (short left, short top, short wide, short high)
|
||||
void FrameWHRect (DrawSurface *surface, short left, short top, short wide, short high)
|
||||
{
|
||||
Rect theRect;
|
||||
|
||||
@@ -24,7 +24,7 @@ void FrameWHRect (short left, short top, short wide, short high)
|
||||
theRect.top = top;
|
||||
theRect.right = left + wide;
|
||||
theRect.bottom = top + high;
|
||||
FrameRect(&theRect);
|
||||
surface->FrameRect(theRect);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- NormalizeRect
|
||||
@@ -296,23 +296,3 @@ void QUnionSimilarRect (Rect *rectA, Rect *rectB, Rect *rectC)
|
||||
else
|
||||
rectC->bottom = rectB->bottom;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- FrameRectSansCorners
|
||||
// This is similar to the ToolBox FrameRect() call. However, it doesn't<>
|
||||
// draw the pixels in the 4 corners of the Rect.
|
||||
|
||||
void FrameRectSansCorners (Rect *theRect)
|
||||
{
|
||||
MoveTo(theRect->left + 1, theRect->top);
|
||||
LineTo(theRect->right - 2, theRect->top);
|
||||
|
||||
MoveTo(theRect->right - 1, theRect->top + 1);
|
||||
LineTo(theRect->right - 1, theRect->bottom - 2);
|
||||
|
||||
MoveTo(theRect->left + 1, theRect->bottom - 1);
|
||||
LineTo(theRect->right - 2, theRect->bottom - 1);
|
||||
|
||||
MoveTo(theRect->left, theRect->top + 1);
|
||||
LineTo(theRect->left, theRect->bottom - 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,5 +29,4 @@ void QOffsetRect (Rect *, short, short);
|
||||
void QSetRect (Rect *, short, short, short, short);
|
||||
Boolean ForceRectInRect (Rect *, Rect *);
|
||||
void QUnionSimilarRect (Rect *, Rect *, Rect *);
|
||||
void FrameRectSansCorners (Rect *);
|
||||
void SetEraseRect (short, short, short, short);
|
||||
|
||||
@@ -613,7 +613,7 @@ void CopyRectsQD (void)
|
||||
{
|
||||
short i;
|
||||
|
||||
CGrafPtr mainWindowGraf = GetWindowPort(mainWindow);
|
||||
DrawSurface *mainWindowGraf = GetWindowPort(mainWindow);
|
||||
|
||||
for (i = 0; i < numWork2Main; i++)
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "PLResources.h"
|
||||
#include "PLToolUtils.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "Externs.h"
|
||||
#include "House.h"
|
||||
#include "MainWindow.h"
|
||||
@@ -24,7 +25,7 @@ void SetToNearestNeighborRoom (short, short);
|
||||
|
||||
roomPtr thisRoom;
|
||||
Rect backSrcRect;
|
||||
GWorldPtr backSrcMap;
|
||||
DrawSurface *backSrcMap;
|
||||
short numberRooms, thisRoomNumber, previousRoom;
|
||||
short leftThresh, rightThresh, lastBackground;
|
||||
Boolean autoRoomEdit, newRoomNow, noRoomAtAll;
|
||||
@@ -238,18 +239,17 @@ void ReadyBackground (short theID, short *theTiles)
|
||||
PicHandle thePicture;
|
||||
short i;
|
||||
|
||||
SetPort((GrafPtr)workSrcMap);
|
||||
|
||||
if ((noRoomAtAll) || (!houseUnlocked))
|
||||
{
|
||||
LtGrayForeColor();
|
||||
PaintRect(&workSrcRect);
|
||||
ForeColor(blackColor);
|
||||
MoveTo(10, 20);
|
||||
LtGrayForeColor(workSrcMap);
|
||||
workSrcMap->FillRect(workSrcRect);
|
||||
workSrcMap->SetForeColor(StdColors::Black());
|
||||
|
||||
const Point textPoint = Point::Create(10, 20);
|
||||
if (houseUnlocked)
|
||||
DrawString(PSTR("No rooms"));
|
||||
workSrcMap->DrawString(textPoint, PSTR("No rooms"));
|
||||
else
|
||||
DrawString(PSTR("Nothing to show"));
|
||||
workSrcMap->DrawString(textPoint, PSTR("Nothing to show"));
|
||||
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||
(BitMap *)*GetGWorldPixMap(backSrcMap),
|
||||
@@ -270,7 +270,7 @@ void ReadyBackground (short theID, short *theTiles)
|
||||
|
||||
dest = (*thePicture)->picFrame.ToRect();
|
||||
QOffsetRect(&dest, -dest.left, -dest.top);
|
||||
DrawPicture(thePicture, &dest);
|
||||
workSrcMap->DrawPicture(thePicture, dest);
|
||||
thePicture.Dispose();
|
||||
|
||||
QSetRect(&src, 0, 0, kTileWide, kTileHigh);
|
||||
|
||||
@@ -8,5 +8,5 @@
|
||||
#include "PLQDOffscreen.h"
|
||||
|
||||
|
||||
extern GWorldPtr backSrcMap;
|
||||
extern DrawSurface *backSrcMap;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
|
||||
#include "PLResources.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "MainWindow.h"
|
||||
@@ -16,7 +17,7 @@
|
||||
#define kManholeThruFloor 3957
|
||||
|
||||
|
||||
void LoadGraphicSpecial (short);
|
||||
void LoadGraphicSpecial (DrawSurface *surface, short);
|
||||
void DrawRoomBackground (short, short, short);
|
||||
void DrawFloorSupport (void);
|
||||
void ReadyBackMap (void);
|
||||
@@ -25,7 +26,7 @@ void DrawLighting (void);
|
||||
|
||||
|
||||
Rect suppSrcRect;
|
||||
GWorldPtr suppSrcMap;
|
||||
DrawSurface *suppSrcMap;
|
||||
Rect localRoomsDest[9];
|
||||
Rect houseRect;
|
||||
short numNeighbors, numLights, thisTiles[kNumTiles];
|
||||
@@ -44,7 +45,7 @@ void DrawLocale (void)
|
||||
{
|
||||
short i, roomV;
|
||||
char wasState;
|
||||
CGrafPtr wasCPort;
|
||||
DrawSurface *wasCPort;
|
||||
|
||||
ZeroFlamesAndTheLike();
|
||||
ZeroDinahs();
|
||||
@@ -67,8 +68,9 @@ void DrawLocale (void)
|
||||
ListAllLocalObjects();
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
PaintRect(&backSrcRect);
|
||||
|
||||
backSrcMap->SetForeColor(StdColors::Black());
|
||||
backSrcMap->FillRect(backSrcRect);
|
||||
|
||||
if (numNeighbors > 3)
|
||||
{
|
||||
@@ -126,7 +128,7 @@ void DrawLocale (void)
|
||||
|
||||
//-------------------------------------------------------------- LoadGraphicSpecial
|
||||
|
||||
void LoadGraphicSpecial (short resID)
|
||||
void LoadGraphicSpecial (DrawSurface *surface, short resID)
|
||||
{
|
||||
Rect bounds;
|
||||
PicHandle thePicture;
|
||||
@@ -145,7 +147,7 @@ void LoadGraphicSpecial (short resID)
|
||||
|
||||
bounds = (*thePicture)->picFrame.ToRect();
|
||||
OffsetRect(&bounds, -bounds.left, -bounds.top);
|
||||
DrawPicture(thePicture, &bounds);
|
||||
surface->DrawPicture(thePicture, bounds);
|
||||
|
||||
thePicture.Dispose();
|
||||
}
|
||||
@@ -168,15 +170,9 @@ void DrawRoomBackground (short who, short where, short elevation)
|
||||
|
||||
if ((numLights == 0) && (who != kRoomIsEmpty))
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
backSrcMap->SetForeColor(StdColors::Black());
|
||||
backSrcMap->FillRect(localRoomsDest[where]);
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
|
||||
ForeColor(blackColor);
|
||||
PaintRect(&localRoomsDest[where]);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -184,14 +180,8 @@ void DrawRoomBackground (short who, short where, short elevation)
|
||||
{
|
||||
if (wardBitSet)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
|
||||
PaintRect(&localRoomsDest[where]);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
backSrcMap->SetForeColor(StdColors::Black());
|
||||
backSrcMap->FillRect(localRoomsDest[where]);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -221,8 +211,7 @@ void DrawRoomBackground (short who, short where, short elevation)
|
||||
tiles[i] = (*thisHouse)->rooms[who].tiles[i];
|
||||
}
|
||||
|
||||
SetPort((GrafPtr)workSrcMap);
|
||||
LoadGraphicSpecial(pictID);
|
||||
LoadGraphicSpecial(workSrcMap, pictID);
|
||||
|
||||
QSetRect(&src, 0, 0, kTileWide, kTileHigh);
|
||||
QSetRect(&dest, 0, 0, kTileWide, kTileHigh);
|
||||
@@ -244,10 +233,9 @@ void DrawFloorSupport (void)
|
||||
{
|
||||
Rect src, dest, whoCares;
|
||||
short i;
|
||||
CGrafPtr wasCPort;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
SetGraphicsPort(backSrcMap);
|
||||
DrawSurface *surface = backSrcMap;
|
||||
|
||||
src = suppSrcRect;
|
||||
|
||||
if (isStructure[kNorthWestRoom])
|
||||
@@ -264,7 +252,7 @@ void DrawFloorSupport (void)
|
||||
{
|
||||
tempManholes[i].top = dest.top;
|
||||
tempManholes[i].bottom = dest.bottom;
|
||||
LoadScaledGraphic(kManholeThruFloor, &tempManholes[i]);
|
||||
LoadScaledGraphic(surface, kManholeThruFloor, &tempManholes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,7 +270,7 @@ void DrawFloorSupport (void)
|
||||
{
|
||||
tempManholes[i].top = dest.top;
|
||||
tempManholes[i].bottom = dest.bottom;
|
||||
LoadScaledGraphic(kManholeThruFloor, &tempManholes[i]);
|
||||
LoadScaledGraphic(surface, kManholeThruFloor, &tempManholes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +287,7 @@ void DrawFloorSupport (void)
|
||||
{
|
||||
tempManholes[i].top = dest.top;
|
||||
tempManholes[i].bottom = dest.bottom;
|
||||
LoadScaledGraphic(kManholeThruFloor, &tempManholes[i]);
|
||||
LoadScaledGraphic(surface, kManholeThruFloor, &tempManholes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,7 +305,7 @@ void DrawFloorSupport (void)
|
||||
{
|
||||
tempManholes[i].top = dest.top;
|
||||
tempManholes[i].bottom = dest.bottom;
|
||||
LoadScaledGraphic(kManholeThruFloor, &tempManholes[i]);
|
||||
LoadScaledGraphic(surface, kManholeThruFloor, &tempManholes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,7 +323,7 @@ void DrawFloorSupport (void)
|
||||
{
|
||||
tempManholes[i].top = dest.top;
|
||||
tempManholes[i].bottom = dest.bottom;
|
||||
LoadScaledGraphic(kManholeThruFloor, &tempManholes[i]);
|
||||
LoadScaledGraphic(surface, kManholeThruFloor, &tempManholes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,11 +341,9 @@ void DrawFloorSupport (void)
|
||||
{
|
||||
tempManholes[i].top = dest.top;
|
||||
tempManholes[i].bottom = dest.bottom;
|
||||
LoadScaledGraphic(kManholeThruFloor, &tempManholes[i]);
|
||||
LoadScaledGraphic(surface, kManholeThruFloor, &tempManholes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- ReadyBackMap
|
||||
|
||||
@@ -8,4 +8,4 @@
|
||||
#include "PLQDOffscreen.h"
|
||||
|
||||
|
||||
extern GWorldPtr suppSrcMap;
|
||||
extern DrawSurface *suppSrcMap;
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "PLResources.h"
|
||||
#include "PLSound.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "DialogManager.h"
|
||||
#include "DialogUtils.h"
|
||||
#include "Externs.h"
|
||||
#include "RectUtils.h"
|
||||
@@ -37,8 +39,8 @@
|
||||
|
||||
|
||||
void UpdateRoomInfoDialog (DialogPtr);
|
||||
void DragMiniTile (Point, short *);
|
||||
void HiliteTileOver (Point);
|
||||
void DragMiniTile (DrawSurface *, Point, short *);
|
||||
void HiliteTileOver (DrawSurface *, Point);
|
||||
Boolean RoomFilter (DialogPtr, EventRecord *, short *);
|
||||
short ChooseOriginalArt (short);
|
||||
void UpdateOriginalArt (DialogPtr);
|
||||
@@ -50,7 +52,7 @@ void BitchAboutPICTNotFound (void);
|
||||
|
||||
Rect tileSrc, tileDest, tileSrcRect, editTETextBox;
|
||||
Rect leftBound, topBound, rightBound, bottomBound;
|
||||
CGrafPtr tileSrcMap;
|
||||
DrawSurface *tileSrcMap;
|
||||
short tempTiles[kNumTiles];
|
||||
short tileOver, tempBack, cursorIs;
|
||||
Boolean originalLeftOpen, originalTopOpen, originalRightOpen, originalBottomOpen;
|
||||
@@ -119,7 +121,7 @@ void UpdateRoomInfoDialog (DialogPtr theDialog)
|
||||
//-------------------------------------------------------------- DragMiniTile
|
||||
|
||||
#ifndef COMPILEDEMO
|
||||
void DragMiniTile (Point mouseIs, short *newTileOver)
|
||||
void DragMiniTile (DrawSurface *surface, Point mouseIs, short *newTileOver)
|
||||
{
|
||||
Rect dragRect;
|
||||
Point mouseWas;
|
||||
@@ -132,48 +134,65 @@ void DragMiniTile (Point mouseIs, short *newTileOver)
|
||||
QOffsetRect(&dragRect,
|
||||
tileSrc.left + (tileOver * kMiniTileWide),
|
||||
tileSrc.top);
|
||||
PenInvertMode(true);
|
||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||
FrameRect(&dragRect);
|
||||
|
||||
const uint8_t *pattern = *GetQDGlobalsGray(&dummyPattern);
|
||||
|
||||
surface->InvertFrameRect(dragRect, pattern);
|
||||
|
||||
mouseWas = mouseIs;
|
||||
while (WaitMouseUp()) // loop until mouse button let up
|
||||
{
|
||||
GetMouse(&mouseIs); // get mouse coords
|
||||
if (DeltaPoint(mouseWas, mouseIs) != 0L) // the mouse has moved
|
||||
{
|
||||
FrameRect(&dragRect);
|
||||
surface->InvertFrameRect(dragRect, pattern);
|
||||
QOffsetRect(&dragRect, mouseIs.h - mouseWas.h, 0);
|
||||
FrameRect(&dragRect);
|
||||
|
||||
surface->InvertFrameRect(dragRect, pattern);
|
||||
|
||||
if (PtInRect(mouseIs, &tileDest)) // is cursor in the drop rect
|
||||
{
|
||||
*newTileOver = (mouseIs.h - tileDest.left) / kMiniTileWide;
|
||||
if (*newTileOver != wasTileOver)
|
||||
{
|
||||
PenNormal();
|
||||
PenSize(1, 2);
|
||||
ForeColor(blueColor);
|
||||
MoveTo(tileDest.left + (*newTileOver * kMiniTileWide),
|
||||
tileDest.top - 3);
|
||||
Line(kMiniTileWide, 0);
|
||||
MoveTo(tileDest.left + (*newTileOver * kMiniTileWide),
|
||||
tileDest.bottom + 1);
|
||||
Line(kMiniTileWide, 0);
|
||||
surface->SetForeColor(StdColors::Blue());
|
||||
|
||||
for (int offset = 0; offset < 2; offset++)
|
||||
{
|
||||
Point pointA = Point::Create(tileDest.left + (*newTileOver * kMiniTileWide), tileDest.top - 3 + offset);
|
||||
Point pointB = Point::Create(pointA.h + kMiniTileWide, pointA.v);
|
||||
|
||||
surface->DrawLine(pointA, pointB);
|
||||
}
|
||||
|
||||
for (int offset = 0; offset < 2; offset++)
|
||||
{
|
||||
Point pointA = Point::Create(tileDest.left + (*newTileOver * kMiniTileWide), tileDest.bottom + 1 + offset);
|
||||
Point pointB = Point::Create(pointA.h + kMiniTileWide, pointA.v);
|
||||
|
||||
surface->DrawLine(pointA, pointB);
|
||||
}
|
||||
|
||||
if (wasTileOver != -1)
|
||||
{
|
||||
ForeColor(whiteColor);
|
||||
MoveTo(tileDest.left + (wasTileOver * kMiniTileWide),
|
||||
tileDest.top - 3);
|
||||
Line(kMiniTileWide, 0);
|
||||
MoveTo(tileDest.left + (wasTileOver * kMiniTileWide),
|
||||
tileDest.bottom + 1);
|
||||
Line(kMiniTileWide, 0);
|
||||
surface->SetForeColor(StdColors::White());
|
||||
|
||||
for (int offset = 0; offset < 2; offset++)
|
||||
{
|
||||
Point pointA = Point::Create(tileDest.left + (wasTileOver * kMiniTileWide), tileDest.top - 3 + offset);
|
||||
Point pointB = Point::Create(pointA.h + kMiniTileWide, pointA.v);
|
||||
|
||||
surface->DrawLine(pointA, pointB);
|
||||
}
|
||||
|
||||
for (int offset = 0; offset < 2; offset++)
|
||||
{
|
||||
Point pointA = Point::Create(tileDest.left + (wasTileOver * kMiniTileWide), tileDest.bottom + 1 + offset);
|
||||
Point pointB = Point::Create(pointA.h + kMiniTileWide, pointA.v);
|
||||
|
||||
surface->DrawLine(pointA, pointB);
|
||||
}
|
||||
}
|
||||
ForeColor(blackColor);
|
||||
PenNormal();
|
||||
PenInvertMode(true);
|
||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||
|
||||
wasTileOver = *newTileOver;
|
||||
}
|
||||
}
|
||||
@@ -182,19 +201,24 @@ void DragMiniTile (Point mouseIs, short *newTileOver)
|
||||
*newTileOver = -1; // we're not in the drop zone
|
||||
if (wasTileOver != -1)
|
||||
{
|
||||
PenNormal();
|
||||
PenSize(1, 2);
|
||||
ForeColor(whiteColor);
|
||||
MoveTo(tileDest.left + (wasTileOver * kMiniTileWide),
|
||||
tileDest.top - 3);
|
||||
Line(kMiniTileWide, 0);
|
||||
MoveTo(tileDest.left + (wasTileOver * kMiniTileWide),
|
||||
tileDest.bottom + 1);
|
||||
Line(kMiniTileWide, 0);
|
||||
ForeColor(blackColor);
|
||||
PenNormal();
|
||||
PenInvertMode(true);
|
||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||
surface->SetForeColor(StdColors::White());
|
||||
|
||||
for (int offset = 0; offset < 2; offset++)
|
||||
{
|
||||
Point pointA = Point::Create(tileDest.left + (wasTileOver * kMiniTileWide), tileDest.top - 3 + offset);
|
||||
Point pointB = Point::Create(pointA.h + kMiniTileWide, pointA.v);
|
||||
|
||||
surface->DrawLine(pointA, pointB);
|
||||
}
|
||||
|
||||
for (int offset = 0; offset < 2; offset++)
|
||||
{
|
||||
Point pointA = Point::Create(tileDest.left + (wasTileOver * kMiniTileWide), tileDest.bottom + 1 + offset);
|
||||
Point pointB = Point::Create(pointA.h + kMiniTileWide, pointA.v);
|
||||
|
||||
surface->DrawLine(pointA, pointB);
|
||||
}
|
||||
|
||||
wasTileOver = -1;
|
||||
}
|
||||
}
|
||||
@@ -204,28 +228,34 @@ void DragMiniTile (Point mouseIs, short *newTileOver)
|
||||
}
|
||||
if (wasTileOver != -1)
|
||||
{
|
||||
PenNormal();
|
||||
PenSize(1, 2);
|
||||
ForeColor(whiteColor);
|
||||
MoveTo(tileDest.left + (wasTileOver * kMiniTileWide), tileDest.top - 3);
|
||||
Line(kMiniTileWide, 0);
|
||||
MoveTo(tileDest.left + (wasTileOver * kMiniTileWide), tileDest.bottom + 1);
|
||||
Line(kMiniTileWide, 0);
|
||||
ForeColor(blackColor);
|
||||
PenNormal();
|
||||
PenInvertMode(true);
|
||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||
surface->SetForeColor(StdColors::White());
|
||||
|
||||
for (int offset = 0; offset < 2; offset++)
|
||||
{
|
||||
Point pointA = Point::Create(tileDest.left + (wasTileOver * kMiniTileWide), tileDest.top - 3 + offset);
|
||||
Point pointB = Point::Create(pointA.h + kMiniTileWide, pointA.v);
|
||||
|
||||
surface->DrawLine(pointA, pointB);
|
||||
}
|
||||
|
||||
for (int offset = 0; offset < 2; offset++)
|
||||
{
|
||||
Point pointA = Point::Create(tileDest.left + (wasTileOver * kMiniTileWide), tileDest.bottom + 1 + offset);
|
||||
Point pointB = Point::Create(pointA.h + kMiniTileWide, pointA.v);
|
||||
|
||||
surface->DrawLine(pointA, pointB);
|
||||
}
|
||||
|
||||
wasTileOver = -1;
|
||||
}
|
||||
FrameRect(&dragRect);
|
||||
PenNormal();
|
||||
surface->InvertFrameRect(dragRect, pattern);
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------- HiliteTileOver
|
||||
|
||||
#ifndef COMPILEDEMO
|
||||
void HiliteTileOver (Point mouseIs)
|
||||
void HiliteTileOver (DrawSurface *surface, Point mouseIs)
|
||||
{
|
||||
short newTileOver;
|
||||
|
||||
@@ -240,23 +270,32 @@ void HiliteTileOver (Point mouseIs)
|
||||
newTileOver = (mouseIs.h - tileSrc.left) / kMiniTileWide;
|
||||
if (newTileOver != tileOver)
|
||||
{
|
||||
PenSize(1, 2);
|
||||
ForeColor(redColor);
|
||||
MoveTo(tileSrc.left + (newTileOver * kMiniTileWide), tileSrc.top - 3);
|
||||
Line(kMiniTileWide, 0);
|
||||
MoveTo(tileSrc.left + (newTileOver * kMiniTileWide), tileSrc.bottom + 1);
|
||||
Line(kMiniTileWide, 0);
|
||||
surface->SetForeColor(StdColors::Red());
|
||||
|
||||
{
|
||||
const Point tileLineTopLeft = Point::Create(tileSrc.left + (newTileOver * kMiniTileWide), tileSrc.top - 3);
|
||||
const Point tileLineBottomRight = Point::Create(tileLineTopLeft.h + kMiniTileWide + 1, tileLineTopLeft.v + 2);
|
||||
surface->FillRect(Rect::Create(tileLineTopLeft.v, tileLineTopLeft.h, tileLineBottomRight.v, tileLineBottomRight.h));
|
||||
}
|
||||
|
||||
if (tileOver != -1)
|
||||
{
|
||||
ForeColor(whiteColor);
|
||||
MoveTo(tileSrc.left + (tileOver * kMiniTileWide), tileSrc.top - 3);
|
||||
Line(kMiniTileWide, 0);
|
||||
MoveTo(tileSrc.left + (tileOver * kMiniTileWide), tileSrc.bottom + 1);
|
||||
Line(kMiniTileWide, 0);
|
||||
surface->SetForeColor(StdColors::White());
|
||||
|
||||
{
|
||||
const Point tileLineTopLeft = Point::Create(tileSrc.left + (tileOver * kMiniTileWide), tileSrc.top - 3);
|
||||
const Point tileLineBottomRight = Point::Create(tileLineTopLeft.h + kMiniTileWide + 1, tileLineTopLeft.v + 2);
|
||||
surface->FillRect(Rect::Create(tileLineTopLeft.v, tileLineTopLeft.h, tileLineBottomRight.v, tileLineBottomRight.h));
|
||||
}
|
||||
|
||||
{
|
||||
const Point tileLineTopLeft = Point::Create(tileSrc.left + (tileOver * kMiniTileWide), tileSrc.bottom + 1);
|
||||
const Point tileLineBottomRight = Point::Create(tileLineTopLeft.h + kMiniTileWide + 1, tileLineTopLeft.v + 2);
|
||||
surface->FillRect(Rect::Create(tileLineTopLeft.v, tileLineTopLeft.h, tileLineBottomRight.v, tileLineBottomRight.h));
|
||||
}
|
||||
}
|
||||
ForeColor(blackColor);
|
||||
PenNormal();
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
|
||||
tileOver = newTileOver;
|
||||
}
|
||||
@@ -265,13 +304,21 @@ void HiliteTileOver (Point mouseIs)
|
||||
{
|
||||
if (tileOver != -1)
|
||||
{
|
||||
PenSize(1, 2);
|
||||
ForeColor(whiteColor);
|
||||
MoveTo(tileSrc.left + (tileOver * kMiniTileWide), tileSrc.top - 3);
|
||||
Line(kMiniTileWide, 0);
|
||||
MoveTo(tileSrc.left + (tileOver * kMiniTileWide), tileSrc.bottom + 1);
|
||||
Line(kMiniTileWide, 0);
|
||||
ForeColor(blackColor);
|
||||
surface->SetForeColor(StdColors::White());
|
||||
|
||||
{
|
||||
const Point tileLineTopLeft = Point::Create(tileSrc.left + (tileOver * kMiniTileWide), tileSrc.top - 3);
|
||||
const Point tileLineBottomRight = Point::Create(tileLineTopLeft.h + kMiniTileWide + 1, tileLineTopLeft.v + 2);
|
||||
surface->FillRect(Rect::Create(tileLineTopLeft.v, tileLineTopLeft.h, tileLineBottomRight.v, tileLineBottomRight.h));
|
||||
}
|
||||
|
||||
{
|
||||
const Point tileLineTopLeft = Point::Create(tileSrc.left + (tileOver * kMiniTileWide), tileSrc.bottom + 1);
|
||||
const Point tileLineBottomRight = Point::Create(tileLineTopLeft.h + kMiniTileWide + 1, tileLineTopLeft.v + 2);
|
||||
surface->FillRect(Rect::Create(tileLineTopLeft.v, tileLineTopLeft.h, tileLineBottomRight.v, tileLineBottomRight.h));
|
||||
}
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
PenNormal();
|
||||
tileOver = -1;
|
||||
}
|
||||
@@ -303,6 +350,8 @@ Boolean RoomFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
{
|
||||
Point mouseIs;
|
||||
short newTileOver;
|
||||
|
||||
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
|
||||
|
||||
switch (event->what)
|
||||
{
|
||||
@@ -339,7 +388,7 @@ Boolean RoomFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
{
|
||||
if (StillDown())
|
||||
{
|
||||
DragMiniTile(mouseIs, &newTileOver);
|
||||
DragMiniTile(surface, mouseIs, &newTileOver);
|
||||
if ((newTileOver >= 0) && (newTileOver < kNumTiles))
|
||||
{
|
||||
tempTiles[newTileOver] = tileOver;
|
||||
@@ -358,16 +407,15 @@ Boolean RoomFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateRoomInfoDialog(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
GetMouse(&mouseIs);
|
||||
HiliteTileOver(mouseIs);
|
||||
HiliteTileOver(surface, mouseIs);
|
||||
return(false);
|
||||
break;
|
||||
}
|
||||
@@ -387,10 +435,8 @@ void DoRoomInfo (void)
|
||||
char wasState;
|
||||
Boolean leaving, wasFirstRoom, forceDraw;
|
||||
ModalFilterUPP roomFilterUPP;
|
||||
CGrafPtr wasCPort;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
roomFilterUPP = NewModalFilterUPP(RoomFilter);
|
||||
|
||||
tileOver = -1;
|
||||
@@ -407,7 +453,6 @@ void DoRoomInfo (void)
|
||||
ParamText(floorStr, suiteStr, objectsStr, PSTR(""));
|
||||
|
||||
theErr = CreateOffScreenGWorld(&tileSrcMap, &tileSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(tileSrcMap);
|
||||
// CreateOffScreenPixMap(&tileSrcRect, &tileSrcMap);
|
||||
// SetPort((GrafPtr)tileSrcMap);
|
||||
if ((tempBack > kStars) && (!PictIDExists(tempBack)))
|
||||
@@ -417,17 +462,15 @@ void DoRoomInfo (void)
|
||||
}
|
||||
if ((tempBack == 2002) || (tempBack == 2011) ||
|
||||
(tempBack == 2016) || (tempBack == 2017))
|
||||
LoadScaledGraphic(tempBack - 800, &tileSrcRect);
|
||||
LoadScaledGraphic(tileSrcMap, tempBack - 800, &tileSrcRect);
|
||||
else
|
||||
LoadScaledGraphic(tempBack, &tileSrcRect);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
LoadScaledGraphic(tileSrcMap, tempBack, &tileSrcRect);
|
||||
|
||||
for (i = 0; i < kNumTiles; i++)
|
||||
tempTiles[i] = thisRoom->tiles[i];
|
||||
|
||||
// CenterDialog(kRoomInfoDialogID);
|
||||
roomInfoDialog = GetNewDialog(kRoomInfoDialogID, nil, kPutInFront);
|
||||
roomInfoDialog = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kRoomInfoDialogID, kPutInFront);
|
||||
if (roomInfoDialog == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetPort((GrafPtr)roomInfoDialog);
|
||||
@@ -445,7 +488,7 @@ void DoRoomInfo (void)
|
||||
GetDialogItemRect(roomInfoDialog, kRoomNameItem, &editTETextBox);
|
||||
SelectDialogItemText(roomInfoDialog, kRoomNameItem, 0, 1024);
|
||||
|
||||
ShowWindow(GetDialogWindow(roomInfoDialog));
|
||||
ShowWindow(roomInfoDialog->GetWindow());
|
||||
DrawDefaultButton(roomInfoDialog);
|
||||
|
||||
wasFirstRoom = ((*thisHouse)->firstRoom == thisRoomNumber);
|
||||
@@ -507,10 +550,9 @@ void DoRoomInfo (void)
|
||||
if ((tempBack != newBack) || (forceDraw))
|
||||
{
|
||||
tempBack = newBack;
|
||||
SetPort((GrafPtr)tileSrcMap);
|
||||
LoadScaledGraphic(tempBack, &tileSrcRect);
|
||||
InvalWindowRect(GetDialogWindow(roomInfoDialog), &tileSrc);
|
||||
InvalWindowRect(GetDialogWindow(roomInfoDialog), &tileDest);
|
||||
LoadScaledGraphic(tileSrcMap, tempBack, &tileSrcRect);
|
||||
InvalWindowRect(roomInfoDialog->GetWindow(), &tileSrc);
|
||||
InvalWindowRect(roomInfoDialog->GetWindow(), &tileDest);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -532,14 +574,13 @@ void DoRoomInfo (void)
|
||||
if (newBack != tempBack)
|
||||
{
|
||||
tempBack = newBack;
|
||||
SetPort((GrafPtr)tileSrcMap);
|
||||
if ((tempBack == 2002) || (tempBack == 2011) ||
|
||||
(tempBack == 2016) || (tempBack == 2017))
|
||||
LoadScaledGraphic(tempBack - 800, &tileSrcRect);
|
||||
LoadScaledGraphic(tileSrcMap, tempBack - 800, &tileSrcRect);
|
||||
else
|
||||
LoadScaledGraphic(tempBack, &tileSrcRect);
|
||||
InvalWindowRect(GetDialogWindow(roomInfoDialog), &tileSrc);
|
||||
InvalWindowRect(GetDialogWindow(roomInfoDialog), &tileDest);
|
||||
LoadScaledGraphic(tileSrcMap, tempBack, &tileSrcRect);
|
||||
InvalWindowRect(roomInfoDialog->GetWindow(), &tileSrc);
|
||||
InvalWindowRect(roomInfoDialog->GetWindow(), &tileDest);
|
||||
}
|
||||
}
|
||||
else if (item == kBoundsButton)
|
||||
@@ -548,10 +589,9 @@ void DoRoomInfo (void)
|
||||
if (tempBack != newBack)
|
||||
{
|
||||
tempBack = newBack;
|
||||
SetPort((GrafPtr)tileSrcMap);
|
||||
LoadScaledGraphic(tempBack, &tileSrcRect);
|
||||
InvalWindowRect(GetDialogWindow(roomInfoDialog), &tileSrc);
|
||||
InvalWindowRect(GetDialogWindow(roomInfoDialog), &tileDest);
|
||||
LoadScaledGraphic(tileSrcMap, tempBack, &tileSrcRect);
|
||||
InvalWindowRect(roomInfoDialog->GetWindow(), &tileSrc);
|
||||
InvalWindowRect(roomInfoDialog->GetWindow(), &tileDest);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -688,9 +728,8 @@ Boolean OriginalArtFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateOriginalArt(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
|
||||
@@ -21,8 +21,8 @@ void KillBand (short);
|
||||
bandPtr bands;
|
||||
Rect bandsSrcRect;
|
||||
Rect bandRects[3];
|
||||
GWorldPtr bandsSrcMap;
|
||||
GWorldPtr bandsMaskMap;
|
||||
DrawSurface *bandsSrcMap;
|
||||
DrawSurface *bandsMaskMap;
|
||||
short numBands, bandHitLast;
|
||||
|
||||
extern hotPtr hotSpots;
|
||||
|
||||
@@ -8,5 +8,5 @@
|
||||
#include "PLQDOffscreen.h"
|
||||
|
||||
|
||||
extern GWorldPtr bandsSrcMap;
|
||||
extern GWorldPtr bandsMaskMap;
|
||||
extern DrawSurface *bandsSrcMap;
|
||||
extern DrawSurface *bandsMaskMap;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "MenuManager.h"
|
||||
#include "QDStandardPalette.h"
|
||||
#include "RectUtils.h"
|
||||
|
||||
|
||||
@@ -29,16 +30,16 @@ void RefreshPoints (void);
|
||||
|
||||
|
||||
Rect boardSrcRect, badgeSrcRect, boardDestRect;
|
||||
GWorldPtr boardSrcMap, badgeSrcMap;
|
||||
DrawSurface *boardSrcMap, *badgeSrcMap;
|
||||
Rect boardTSrcRect, boardTDestRect;
|
||||
GWorldPtr boardTSrcMap;
|
||||
DrawSurface *boardTSrcMap;
|
||||
Rect boardGSrcRect, boardGDestRect;
|
||||
GWorldPtr boardGSrcMap;
|
||||
DrawSurface *boardGSrcMap;
|
||||
Rect boardPSrcRect, boardPDestRect;
|
||||
Rect boardPQDestRect, boardGQDestRect;
|
||||
Rect badgesBlankRects[4], badgesBadgesRects[4];
|
||||
Rect badgesDestRects[4];
|
||||
GWorldPtr boardPSrcMap;
|
||||
DrawSurface *boardPSrcMap;
|
||||
long displayedScore;
|
||||
short wasScoreboardMode;
|
||||
Boolean doRollScore;
|
||||
@@ -148,52 +149,52 @@ void RefreshScoreboard (SInt16 mode)
|
||||
|
||||
void RefreshRoomTitle (short mode)
|
||||
{
|
||||
RGBColor theRGBColor, wasColor;
|
||||
DrawSurface *surface = boardTSrcMap;
|
||||
|
||||
PortabilityLayer::RGBAColor theRGBColor, wasColor;
|
||||
|
||||
SetPort((GrafPtr)boardTSrcMap);
|
||||
wasColor = surface->GetForeColor();
|
||||
theRGBColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[kGrayBackgroundColor];
|
||||
surface->SetForeColor(theRGBColor);
|
||||
surface->FillRect(boardTSrcRect);
|
||||
surface->SetForeColor(wasColor);
|
||||
|
||||
GetForeColor(&wasColor);
|
||||
if (thisMac.isDepth == 4)
|
||||
Index2Color(kGrayBackgroundColor4, &theRGBColor);
|
||||
else
|
||||
Index2Color(kGrayBackgroundColor, &theRGBColor);
|
||||
RGBForeColor(&theRGBColor);
|
||||
PaintRect(&boardTSrcRect);
|
||||
RGBForeColor(&wasColor);
|
||||
|
||||
MoveTo(1, 10);
|
||||
ForeColor(blackColor);
|
||||
const Point strShadowPoint = Point::Create(1, 10);
|
||||
const Point strPoint = Point::Create(0, 9);
|
||||
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case kEscapedTitleMode:
|
||||
DrawString(PSTR("Hit Delete key if unable to Follow"));
|
||||
surface->DrawString(strShadowPoint, PSTR("Hit Delete key if unable to Follow"));
|
||||
break;
|
||||
|
||||
case kSavingTitleMode:
|
||||
DrawString(PSTR("Saving Game<6D>"));
|
||||
surface->DrawString(strShadowPoint, PSTR("Saving Game<6D>"));
|
||||
break;
|
||||
|
||||
default:
|
||||
DrawString(thisRoom->name);
|
||||
surface->DrawString(strShadowPoint, thisRoom->name);
|
||||
break;
|
||||
}
|
||||
MoveTo(0, 9);
|
||||
ForeColor(whiteColor);
|
||||
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case kEscapedTitleMode:
|
||||
DrawString(PSTR("Hit Delete key if unable to Follow"));
|
||||
surface->DrawString(strPoint, PSTR("Hit Delete key if unable to Follow"));
|
||||
break;
|
||||
|
||||
case kSavingTitleMode:
|
||||
DrawString(PSTR("Saving Game<6D>"));
|
||||
surface->DrawString(strPoint, PSTR("Saving Game<6D>"));
|
||||
break;
|
||||
|
||||
default:
|
||||
DrawString(thisRoom->name);
|
||||
surface->DrawString(strPoint, thisRoom->name);
|
||||
break;
|
||||
}
|
||||
ForeColor(blackColor);
|
||||
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(boardTSrcMap),
|
||||
(BitMap *)*GetGWorldPixMap(boardSrcMap),
|
||||
@@ -204,35 +205,30 @@ void RefreshRoomTitle (short mode)
|
||||
|
||||
void RefreshNumGliders (void)
|
||||
{
|
||||
RGBColor theRGBColor, wasColor;
|
||||
PortabilityLayer::RGBAColor theRGBColor, wasColor;
|
||||
Str255 nGlidersStr;
|
||||
long displayMortals;
|
||||
|
||||
SetPort((GrafPtr)boardGSrcMap);
|
||||
|
||||
GetForeColor(&wasColor);
|
||||
if (thisMac.isDepth == 4)
|
||||
Index2Color(kGrayBackgroundColor4, &theRGBColor);
|
||||
else
|
||||
Index2Color(kGrayBackgroundColor, &theRGBColor);
|
||||
RGBForeColor(&theRGBColor);
|
||||
PaintRect(&boardGSrcRect);
|
||||
RGBForeColor(&wasColor);
|
||||
DrawSurface *surface = boardGSrcMap;
|
||||
|
||||
theRGBColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[kGrayBackgroundColor];
|
||||
|
||||
wasColor = surface->GetForeColor();
|
||||
surface->SetForeColor(theRGBColor);
|
||||
surface->FillRect(boardGSrcRect);
|
||||
|
||||
displayMortals = mortals;
|
||||
if (displayMortals < 0)
|
||||
displayMortals = 0;
|
||||
NumToString(displayMortals, nGlidersStr);
|
||||
|
||||
const Point shadowPoint = Point::Create(1, 10);
|
||||
const Point textPoint = Point::Create(0, 9);
|
||||
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
|
||||
surface->DrawString(shadowPoint, nGlidersStr);
|
||||
|
||||
MoveTo(1, 10);
|
||||
ForeColor(blackColor);
|
||||
DrawString(nGlidersStr);
|
||||
|
||||
MoveTo(0, 9);
|
||||
ForeColor(whiteColor);
|
||||
DrawString(nGlidersStr);
|
||||
|
||||
ForeColor(blackColor);
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
|
||||
surface->DrawString(textPoint, nGlidersStr);
|
||||
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(boardGSrcMap),
|
||||
(BitMap *)*GetGWorldPixMap(boardSrcMap),
|
||||
@@ -243,32 +239,26 @@ void RefreshNumGliders (void)
|
||||
|
||||
void RefreshPoints (void)
|
||||
{
|
||||
RGBColor theRGBColor, wasColor;
|
||||
PortabilityLayer::RGBAColor theRGBColor, wasColor;
|
||||
Str255 scoreStr;
|
||||
|
||||
SetPort((GrafPtr)boardPSrcMap);
|
||||
|
||||
GetForeColor(&wasColor);
|
||||
if (thisMac.isDepth == 4)
|
||||
Index2Color(kGrayBackgroundColor4, &theRGBColor);
|
||||
else
|
||||
Index2Color(kGrayBackgroundColor, &theRGBColor);
|
||||
RGBForeColor(&theRGBColor);
|
||||
PaintRect(&boardPSrcRect);
|
||||
RGBForeColor(&wasColor);
|
||||
DrawSurface *surface = boardPSrcMap;
|
||||
|
||||
theRGBColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[kGrayBackgroundColor];
|
||||
|
||||
surface->SetForeColor(theRGBColor);
|
||||
surface->FillRect(boardPSrcRect);
|
||||
|
||||
NumToString(theScore, scoreStr);
|
||||
|
||||
const Point shadowPoint = Point::Create(1, 10);
|
||||
const Point textPoint = Point::Create(0, 9);
|
||||
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
|
||||
surface->DrawString(shadowPoint, scoreStr);
|
||||
|
||||
MoveTo(1, 10);
|
||||
ForeColor(blackColor);
|
||||
DrawString(scoreStr);
|
||||
|
||||
MoveTo(0, 9);
|
||||
ForeColor(whiteColor);
|
||||
DrawString(scoreStr);
|
||||
|
||||
ForeColor(blackColor);
|
||||
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
|
||||
surface->DrawString(textPoint, scoreStr);
|
||||
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(boardPSrcMap),
|
||||
(BitMap *)*GetGWorldPixMap(boardSrcMap),
|
||||
&boardPSrcRect, &boardPDestRect, srcCopy);
|
||||
@@ -280,32 +270,26 @@ void RefreshPoints (void)
|
||||
|
||||
void QuickGlidersRefresh (void)
|
||||
{
|
||||
RGBColor theRGBColor, wasColor;
|
||||
PortabilityLayer::RGBAColor theRGBColor, wasColor;
|
||||
Str255 nGlidersStr;
|
||||
|
||||
SetPort((GrafPtr)boardGSrcMap);
|
||||
|
||||
GetForeColor(&wasColor);
|
||||
if (thisMac.isDepth == 4)
|
||||
Index2Color(kGrayBackgroundColor4, &theRGBColor);
|
||||
else
|
||||
Index2Color(kGrayBackgroundColor, &theRGBColor);
|
||||
RGBForeColor(&theRGBColor);
|
||||
PaintRect(&boardGSrcRect);
|
||||
RGBForeColor(&wasColor);
|
||||
DrawSurface *surface = boardGSrcMap;
|
||||
|
||||
theRGBColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[kGrayBackgroundColor];
|
||||
|
||||
surface->SetForeColor(theRGBColor);
|
||||
surface->FillRect(boardGSrcRect);
|
||||
|
||||
NumToString((long)mortals, nGlidersStr);
|
||||
|
||||
const Point shadowPoint = Point::Create(1, 10);
|
||||
const Point textPoint = Point::Create(0, 9);
|
||||
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
|
||||
surface->DrawString(shadowPoint, nGlidersStr);
|
||||
|
||||
MoveTo(1, 10);
|
||||
ForeColor(blackColor);
|
||||
DrawString(nGlidersStr);
|
||||
|
||||
MoveTo(0, 9);
|
||||
ForeColor(whiteColor);
|
||||
DrawString(nGlidersStr);
|
||||
|
||||
ForeColor(blackColor);
|
||||
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
|
||||
surface->DrawString(textPoint, nGlidersStr);
|
||||
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(boardGSrcMap),
|
||||
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
|
||||
&boardGSrcRect, &boardGQDestRect, srcCopy);
|
||||
@@ -317,31 +301,24 @@ void QuickGlidersRefresh (void)
|
||||
|
||||
void QuickScoreRefresh (void)
|
||||
{
|
||||
RGBColor theRGBColor, wasColor;
|
||||
PortabilityLayer::RGBAColor theRGBColor, wasColor;
|
||||
Str255 scoreStr;
|
||||
|
||||
SetPort((GrafPtr)boardPSrcMap);
|
||||
|
||||
GetForeColor(&wasColor);
|
||||
if (thisMac.isDepth == 4)
|
||||
Index2Color(kGrayBackgroundColor4, &theRGBColor);
|
||||
else
|
||||
Index2Color(kGrayBackgroundColor, &theRGBColor);
|
||||
RGBForeColor(&theRGBColor);
|
||||
PaintRect(&boardPSrcRect);
|
||||
RGBForeColor(&wasColor);
|
||||
DrawSurface *surface = boardPSrcMap;
|
||||
|
||||
theRGBColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[kGrayBackgroundColor];
|
||||
surface->SetForeColor(theRGBColor);
|
||||
surface->FillRect(boardPSrcRect);
|
||||
|
||||
NumToString(displayedScore, scoreStr);
|
||||
|
||||
MoveTo(1, 10);
|
||||
ForeColor(blackColor);
|
||||
DrawString(scoreStr);
|
||||
|
||||
MoveTo(0, 9);
|
||||
ForeColor(whiteColor);
|
||||
DrawString(scoreStr);
|
||||
|
||||
ForeColor(blackColor);
|
||||
|
||||
const Point shadowPoint = Point::Create(1, 10);
|
||||
const Point textPoint = Point::Create(0, 9);
|
||||
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
|
||||
surface->DrawString(shadowPoint, scoreStr);
|
||||
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
|
||||
surface->DrawString(textPoint, scoreStr);
|
||||
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(boardPSrcMap),
|
||||
GetPortBitMapForCopyBits(GetWindowPort(boardWindow)),
|
||||
@@ -473,8 +450,8 @@ void AdjustScoreboardHeight (void)
|
||||
|
||||
//-------------------------------------------------------------- BlackenScoreboard
|
||||
|
||||
void BlackenScoreboard (void)
|
||||
void BlackenScoreboard (DrawSurface *surface)
|
||||
{
|
||||
UpdateMenuBarWindow();
|
||||
UpdateMenuBarWindow(surface);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include "PLQDOffscreen.h"
|
||||
|
||||
|
||||
extern GWorldPtr boardSrcMap;
|
||||
extern GWorldPtr badgeSrcMap;
|
||||
extern GWorldPtr boardTSrcMap;
|
||||
extern GWorldPtr boardGSrcMap;
|
||||
extern GWorldPtr boardPSrcMap;
|
||||
extern DrawSurface *boardSrcMap;
|
||||
extern DrawSurface *badgeSrcMap;
|
||||
extern DrawSurface *boardTSrcMap;
|
||||
extern DrawSurface *boardGSrcMap;
|
||||
extern DrawSurface *boardPSrcMap;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "PLResources.h"
|
||||
#include "PLSound.h"
|
||||
#include "PLStringCompare.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "DialogUtils.h"
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
@@ -70,7 +71,7 @@ void UpdateLoadDialog (DialogPtr theDialog)
|
||||
WindowRef theWindow;
|
||||
// RgnHandle theRegion;
|
||||
|
||||
theWindow = GetDialogWindow(theDialog);
|
||||
theWindow = theDialog->GetWindow();
|
||||
GetWindowBounds(theWindow, kWindowContentRgn, &dialogRect);
|
||||
/*
|
||||
wasState = HGetState((Handle)(((DialogPeek)theDialog)->window).port.visRgn);
|
||||
@@ -80,7 +81,7 @@ void UpdateLoadDialog (DialogPtr theDialog)
|
||||
*/
|
||||
|
||||
DrawDialog(theDialog);
|
||||
ColorFrameWHRect(8, 39, 413, 184, kRedOrangeColor8); // box around files
|
||||
ColorFrameWHRect(theDialog->GetWindow()->GetDrawSurface(), 8, 39, 413, 184, kRedOrangeColor8); // box around files
|
||||
|
||||
houseStart = housePage;
|
||||
houseStop = housesFound;
|
||||
@@ -140,6 +141,7 @@ void UpdateLoadDialog (DialogPtr theDialog)
|
||||
void PageUpHouses (DialogPtr theDial)
|
||||
{
|
||||
Rect tempRect;
|
||||
DrawSurface *surface = theDial->GetWindow()->GetDrawSurface();
|
||||
|
||||
if (housePage < kDispFiles)
|
||||
{
|
||||
@@ -159,8 +161,11 @@ void PageUpHouses (DialogPtr theDial)
|
||||
}
|
||||
|
||||
QSetRect(&tempRect, 8, 39, 421, 223);
|
||||
EraseRect(&tempRect);
|
||||
InvalWindowRect(GetDialogWindow(theDial), &tempRect);
|
||||
|
||||
surface->SetForeColor(StdColors::White());
|
||||
surface->FillRect(tempRect);
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
InvalWindowRect(theDial->GetWindow(), &tempRect);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -170,6 +175,7 @@ void PageUpHouses (DialogPtr theDial)
|
||||
void PageDownHouses (DialogPtr theDial)
|
||||
{
|
||||
Rect tempRect;
|
||||
DrawSurface *surface = theDial->GetWindow()->GetDrawSurface();
|
||||
|
||||
if (housePage >= (housesFound - kDispFiles))
|
||||
{
|
||||
@@ -189,8 +195,10 @@ void PageDownHouses (DialogPtr theDial)
|
||||
}
|
||||
|
||||
QSetRect(&tempRect, 8, 39, 421, 223);
|
||||
EraseRect(&tempRect);
|
||||
InvalWindowRect(GetDialogWindow(theDial), &tempRect);
|
||||
surface->SetForeColor(StdColors::White());
|
||||
surface->FillRect(tempRect);
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
InvalWindowRect(theDial->GetWindow(), &tempRect);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -230,7 +238,7 @@ Boolean LoadFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case PL_KEY_SPECIAL(kUpArrow):
|
||||
InvalWindowRect(GetDialogWindow(dial), &loadHouseRects[thisHouseIndex]);
|
||||
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
|
||||
thisHouseIndex -= 4;
|
||||
if (thisHouseIndex < 0)
|
||||
{
|
||||
@@ -244,24 +252,24 @@ Boolean LoadFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
if (thisHouseIndex >= screenCount)
|
||||
thisHouseIndex -= 4;
|
||||
}
|
||||
InvalWindowRect(GetDialogWindow(dial), &loadHouseRects[thisHouseIndex]);
|
||||
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_SPECIAL(kDownArrow):
|
||||
InvalWindowRect(GetDialogWindow(dial), &loadHouseRects[thisHouseIndex]);
|
||||
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
|
||||
thisHouseIndex += 4;
|
||||
screenCount = housesFound - housePage;
|
||||
if (screenCount > kDispFiles)
|
||||
screenCount = kDispFiles;
|
||||
if (thisHouseIndex >= screenCount)
|
||||
thisHouseIndex %= 4;
|
||||
InvalWindowRect(GetDialogWindow(dial), &loadHouseRects[thisHouseIndex]);
|
||||
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_SPECIAL(kLeftArrow):
|
||||
InvalWindowRect(GetDialogWindow(dial), &loadHouseRects[thisHouseIndex]);
|
||||
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
|
||||
thisHouseIndex--;
|
||||
if (thisHouseIndex < 0)
|
||||
{
|
||||
@@ -270,20 +278,20 @@ Boolean LoadFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
screenCount = kDispFiles;
|
||||
thisHouseIndex = screenCount - 1;
|
||||
}
|
||||
InvalWindowRect(GetDialogWindow(dial), &loadHouseRects[thisHouseIndex]);
|
||||
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_SPECIAL(kTab):
|
||||
case PL_KEY_SPECIAL(kRightArrow):
|
||||
InvalWindowRect(GetDialogWindow(dial), &loadHouseRects[thisHouseIndex]);
|
||||
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
|
||||
thisHouseIndex++;
|
||||
screenCount = housesFound - housePage;
|
||||
if (screenCount > kDispFiles)
|
||||
screenCount = kDispFiles;
|
||||
if (thisHouseIndex >= screenCount)
|
||||
thisHouseIndex = 0;
|
||||
InvalWindowRect(GetDialogWindow(dial), &loadHouseRects[thisHouseIndex]);
|
||||
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
|
||||
return(true);
|
||||
break;
|
||||
|
||||
@@ -313,8 +321,8 @@ Boolean LoadFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
}
|
||||
if (wasIndex != thisHouseIndex)
|
||||
{
|
||||
InvalWindowRect(GetDialogWindow(dial), &loadHouseRects[wasIndex]);
|
||||
InvalWindowRect(GetDialogWindow(dial), &loadHouseRects[thisHouseIndex]);
|
||||
InvalWindowRect(dial->GetWindow(), &loadHouseRects[wasIndex]);
|
||||
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
|
||||
}
|
||||
}
|
||||
return(true);
|
||||
@@ -337,9 +345,8 @@ Boolean LoadFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateLoadDialog(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -437,9 +444,9 @@ void DoLoadHouse (void)
|
||||
if ((item - kLoadNameFirstItem != thisHouseIndex) &&
|
||||
(item - kLoadNameFirstItem < screenCount))
|
||||
{
|
||||
InvalWindowRect(GetDialogWindow(theDial), &loadHouseRects[thisHouseIndex]);
|
||||
InvalWindowRect(theDial->GetWindow(), &loadHouseRects[thisHouseIndex]);
|
||||
thisHouseIndex = item - kLoadNameFirstItem;
|
||||
InvalWindowRect(GetDialogWindow(theDial), &loadHouseRects[thisHouseIndex]);
|
||||
InvalWindowRect(theDial->GetWindow(), &loadHouseRects[thisHouseIndex]);
|
||||
}
|
||||
|
||||
if (lastWhereClick.h < 0)
|
||||
@@ -472,9 +479,9 @@ void DoLoadHouse (void)
|
||||
if ((item - kLoadIconFirstItem != thisHouseIndex) &&
|
||||
(item - kLoadIconFirstItem < screenCount))
|
||||
{
|
||||
InvalWindowRect(GetDialogWindow(theDial), &loadHouseRects[thisHouseIndex]);
|
||||
InvalWindowRect(theDial->GetWindow(), &loadHouseRects[thisHouseIndex]);
|
||||
thisHouseIndex = item - kLoadIconFirstItem;
|
||||
InvalWindowRect(GetDialogWindow(theDial), &loadHouseRects[thisHouseIndex]);
|
||||
InvalWindowRect(theDial->GetWindow(), &loadHouseRects[thisHouseIndex]);
|
||||
}
|
||||
|
||||
if (lastWhereClick.h < 0)
|
||||
@@ -559,7 +566,7 @@ void DoDirSearch (void)
|
||||
{
|
||||
#define kMaxDirectories 32
|
||||
PortabilityLayer::VirtualDirectory_t theDirs[kMaxDirectories];
|
||||
PLError_t theErr, notherErr;
|
||||
PLError_t theErr;
|
||||
short count, i, numDirs;
|
||||
int currentDir;
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLSound.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "PLTextUtils.h"
|
||||
#include "DialogManager.h"
|
||||
#include "DialogUtils.h"
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
@@ -203,9 +205,8 @@ Boolean BrainsFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateSettingsBrains(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -354,17 +355,30 @@ void UpdateControlKeyName (DialogPtr theDialog)
|
||||
void UpdateSettingsControl (DialogPtr theDialog)
|
||||
{
|
||||
short i;
|
||||
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
|
||||
|
||||
DrawDialog(theDialog);
|
||||
|
||||
PenSize(2, 2);
|
||||
ForeColor(whiteColor);
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 255, 255, 255));
|
||||
for (i = 0; i < 4; i++)
|
||||
FrameRect(&controlRects[i]);
|
||||
ForeColor(redColor);
|
||||
FrameRect(&controlRects[whichCtrl]);
|
||||
ForeColor(blackColor);
|
||||
PenNormal();
|
||||
{
|
||||
Rect rect = controlRects[i];
|
||||
surface->FrameRect(rect);
|
||||
InsetRect(&rect, 1, 1);
|
||||
surface->FrameRect(rect);
|
||||
}
|
||||
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(255, 0, 0, 255));
|
||||
|
||||
{
|
||||
Rect rect = controlRects[whichCtrl];
|
||||
surface->FrameRect(rect);
|
||||
InsetRect(&rect, 1, 1);
|
||||
surface->FrameRect(rect);
|
||||
}
|
||||
|
||||
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
|
||||
|
||||
UpdateControlKeyName(theDialog);
|
||||
FrameDialogItemC(theDialog, 3, kRedOrangeColor8);
|
||||
}
|
||||
@@ -478,9 +492,8 @@ Boolean ControlFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateSettingsControl(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -503,7 +516,7 @@ void DoControlPrefs (void)
|
||||
controlFilterUPP = NewModalFilterUPP(ControlFilter);
|
||||
|
||||
// CenterDialog(kControlPrefsDialID);
|
||||
prefDlg = GetNewDialog(kControlPrefsDialID, nil, kPutInFront);
|
||||
prefDlg = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kControlPrefsDialID, kPutInFront);
|
||||
if (prefDlg == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetPort((GrafPtr)prefDlg);
|
||||
@@ -526,13 +539,15 @@ void DoControlPrefs (void)
|
||||
|
||||
leaving = false;
|
||||
|
||||
ShowWindow(GetDialogWindow(prefDlg));
|
||||
ShowWindow(prefDlg->GetWindow());
|
||||
if (isEscPauseKey)
|
||||
SelectFromRadioGroup(prefDlg, kESCPausesRadio,
|
||||
kESCPausesRadio, kTABPausesRadio);
|
||||
else
|
||||
SelectFromRadioGroup(prefDlg, kTABPausesRadio,
|
||||
kESCPausesRadio, kTABPausesRadio);
|
||||
|
||||
DrawSurface *surface = prefDlg->GetWindow()->GetDrawSurface();
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
@@ -560,14 +575,23 @@ void DoControlPrefs (void)
|
||||
case kLeftControl:
|
||||
case kBattControl:
|
||||
case kBandControl:
|
||||
PenSize(2, 2);
|
||||
ForeColor(whiteColor);
|
||||
FrameRect(&controlRects[whichCtrl]);
|
||||
whichCtrl = itemHit - kRightControl;
|
||||
ForeColor(redColor);
|
||||
FrameRect(&controlRects[whichCtrl]);
|
||||
ForeColor(blackColor);
|
||||
PenNormal();
|
||||
{
|
||||
Rect ctrlRect = controlRects[whichCtrl];
|
||||
|
||||
surface->SetForeColor(StdColors::White());
|
||||
surface->FrameRect(ctrlRect);
|
||||
InsetRect(&ctrlRect, 1, 1);
|
||||
surface->FrameRect(ctrlRect);
|
||||
|
||||
whichCtrl = itemHit - kRightControl;
|
||||
|
||||
ctrlRect = controlRects[whichCtrl];
|
||||
surface->SetForeColor(StdColors::Red());
|
||||
surface->FrameRect(ctrlRect);
|
||||
InsetRect(&ctrlRect, 1, 1);
|
||||
surface->FrameRect(ctrlRect);
|
||||
}
|
||||
|
||||
UpdateControlKeyName(prefDlg);
|
||||
break;
|
||||
|
||||
@@ -731,9 +755,8 @@ Boolean SoundFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateSettingsSound(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -814,7 +837,7 @@ void DoSoundPrefs (void)
|
||||
SetDialogNumToStr(prefDlg, kVolNumberItem, (long)tempVolume);
|
||||
UnivSetSoundVolume(tempVolume, thisMac.hasSM3);
|
||||
HandleSoundMusicChange(tempVolume, true);
|
||||
InvalWindowRect(GetDialogWindow(prefDlg), &tempRect);
|
||||
InvalWindowRect(prefDlg->GetWindow(), &tempRect);
|
||||
DelayTicks(8);
|
||||
}
|
||||
break;
|
||||
@@ -832,7 +855,7 @@ void DoSoundPrefs (void)
|
||||
SetDialogNumToStr(prefDlg, kVolNumberItem, tempVolume);
|
||||
UnivSetSoundVolume(tempVolume, thisMac.hasSM3);
|
||||
HandleSoundMusicChange(tempVolume, true);
|
||||
InvalWindowRect(GetDialogWindow(prefDlg), &tempRect);
|
||||
InvalWindowRect(prefDlg->GetWindow(), &tempRect);
|
||||
DelayTicks(8);
|
||||
}
|
||||
break;
|
||||
@@ -902,14 +925,18 @@ void FrameDisplayIcon (DialogPtr theDialog)
|
||||
GetDialogItemRect(theDialog, kDisplay9Item, &theRect);
|
||||
break;
|
||||
}
|
||||
|
||||
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
|
||||
theRect.left -= 3;
|
||||
theRect.top += 0;
|
||||
theRect.right += 3;
|
||||
theRect.bottom -= 1;
|
||||
FrameRect(&theRect);
|
||||
surface->FrameRect(theRect);
|
||||
InsetRect(&theRect, 1, 1);
|
||||
FrameRect(&theRect);
|
||||
surface->FrameRect(theRect);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DisplayUpdate
|
||||
@@ -1075,9 +1102,8 @@ Boolean DisplayFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
|
||||
case updateEvt:
|
||||
SetPort((GrafPtr)dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
DisplayUpdate(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
@@ -1274,6 +1300,7 @@ void FlashSettingsButton (short who)
|
||||
void UpdateSettingsMain (DialogPtr theDialog)
|
||||
{
|
||||
Str255 theStr;
|
||||
DrawSurface *surface = theDialog->GetWindow()->GetDrawSurface();
|
||||
|
||||
DrawDialog(theDialog);
|
||||
|
||||
@@ -1288,10 +1315,10 @@ void UpdateSettingsMain (DialogPtr theDialog)
|
||||
GetIndString(theStr, 129, 4);
|
||||
DrawDialogUserText(theDialog, 10, theStr, false);
|
||||
|
||||
ColorFrameRect(&prefButton[0], kRedOrangeColor8);
|
||||
ColorFrameRect(&prefButton[1], kRedOrangeColor8);
|
||||
ColorFrameRect(&prefButton[2], kRedOrangeColor8);
|
||||
ColorFrameRect(&prefButton[3], kRedOrangeColor8);
|
||||
ColorFrameRect(surface, prefButton[0], kRedOrangeColor8);
|
||||
ColorFrameRect(surface, prefButton[1], kRedOrangeColor8);
|
||||
ColorFrameRect(surface, prefButton[2], kRedOrangeColor8);
|
||||
ColorFrameRect(surface, prefButton[3], kRedOrangeColor8);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- PrefsFilter
|
||||
@@ -1358,17 +1385,15 @@ Boolean PrefsFilter (DialogPtr dial, EventRecord *event, short *item)
|
||||
if ((WindowPtr)event->message == (WindowPtr)mainWindow)
|
||||
{
|
||||
SetPortWindowPort(mainWindow);
|
||||
BeginUpdate(mainWindow);
|
||||
UpdateMainWindow();
|
||||
EndUpdate(mainWindow);
|
||||
SetPort((GrafPtr)dial);
|
||||
}
|
||||
else if ((WindowPtr)event->message == GetDialogWindow(dial))
|
||||
else if ((WindowPtr)event->message == dial->GetWindow())
|
||||
{
|
||||
SetPortDialogPort(dial);
|
||||
BeginUpdate(GetDialogWindow(dial));
|
||||
UpdateSettingsMain(dial);
|
||||
EndUpdate(GetDialogWindow(dial));
|
||||
EndUpdate(dial->GetWindow());
|
||||
}
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "PLResources.h"
|
||||
#include "Externs.h"
|
||||
#include "FontFamily.h"
|
||||
#include "FontManager.h"
|
||||
#include "Objects.h"
|
||||
#include "Play.h"
|
||||
#include "Player.h"
|
||||
@@ -60,18 +62,15 @@ void InitScoreboardMap (void)
|
||||
{
|
||||
Rect bounds;
|
||||
PicHandle thePicture;
|
||||
CGrafPtr wasCPort;
|
||||
DrawSurface *wasCPort;
|
||||
PLError_t theErr;
|
||||
short hOffset;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
wasScoreboardMode = kScoreboardHigh;
|
||||
boardSrcRect = houseRect;
|
||||
ZeroRectCorner(&boardSrcRect);
|
||||
boardSrcRect.bottom = kScoreboardTall;
|
||||
theErr = CreateOffScreenGWorld(&boardSrcMap, &boardSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(boardSrcMap);
|
||||
|
||||
if (boardSrcRect.right >= 640)
|
||||
hOffset = (RectWide(&boardSrcRect) - kMaxViewWidth) / 2;
|
||||
@@ -83,13 +82,12 @@ void InitScoreboardMap (void)
|
||||
bounds = (*thePicture)->picFrame.ToRect();
|
||||
QOffsetRect(&bounds, -bounds.left, -bounds.top);
|
||||
QOffsetRect(&bounds, hOffset, 0);
|
||||
DrawPicture(thePicture, &bounds);
|
||||
boardSrcMap->DrawPicture(thePicture, bounds);
|
||||
thePicture.Dispose();
|
||||
|
||||
QSetRect(&badgeSrcRect, 0, 0, 32, 66); // 2144 pixels
|
||||
theErr = CreateOffScreenGWorld(&badgeSrcMap, &badgeSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(badgeSrcMap);
|
||||
LoadGraphic(kBadgePictID);
|
||||
LoadGraphic(badgeSrcMap, kBadgePictID);
|
||||
|
||||
boardDestRect = boardSrcRect;
|
||||
|
||||
@@ -99,33 +97,27 @@ void InitScoreboardMap (void)
|
||||
|
||||
QSetRect(&boardTSrcRect, 0, 0, 256, 12); // room title
|
||||
theErr = CreateOffScreenGWorld(&boardTSrcMap, &boardTSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(boardTSrcMap);
|
||||
boardTDestRect = boardTSrcRect;
|
||||
QOffsetRect(&boardTDestRect, 137 + hOffset, 5);
|
||||
TextFont(applFont);
|
||||
TextSize(12);
|
||||
TextFace(bold);
|
||||
|
||||
boardTSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
||||
|
||||
QSetRect(&boardGSrcRect, 0, 0, 20, 10); // # gliders
|
||||
theErr = CreateOffScreenGWorld(&boardGSrcMap, &boardGSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(boardGSrcMap);
|
||||
boardGDestRect = boardGSrcRect;
|
||||
QOffsetRect(&boardGDestRect, 526 + hOffset, 5);
|
||||
TextFont(applFont);
|
||||
TextSize(12);
|
||||
TextFace(bold);
|
||||
|
||||
boardGSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
||||
|
||||
QSetRect(&boardPSrcRect, 0, 0, 64, 10); // points
|
||||
theErr = CreateOffScreenGWorld(&boardPSrcMap, &boardPSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(boardPSrcMap);
|
||||
boardPDestRect = boardPSrcRect;
|
||||
QOffsetRect(&boardPDestRect, 570 + hOffset, 5); // total = 6396 pixels
|
||||
boardPQDestRect = boardPDestRect;
|
||||
boardGQDestRect = boardGDestRect;
|
||||
TextFont(applFont);
|
||||
TextSize(12);
|
||||
TextFace(bold);
|
||||
|
||||
|
||||
boardPSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
||||
|
||||
QSetRect(&badgesBlankRects[0], 0, 0, 16, 16); // foil
|
||||
QOffsetRect(&badgesBlankRects[0], 0, 0);
|
||||
QSetRect(&badgesBlankRects[1], 0, 0, 16, 16); // rubber bands
|
||||
@@ -152,8 +144,6 @@ void InitScoreboardMap (void)
|
||||
QOffsetRect(&badgesDestRects[2], 467 + hOffset, 1);
|
||||
QSetRect(&badgesDestRects[3], 0, 0, 16, 17); // helium
|
||||
QOffsetRect(&badgesDestRects[3], 467 + hOffset, 1);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- InitGliderMap
|
||||
@@ -162,24 +152,18 @@ void InitScoreboardMap (void)
|
||||
|
||||
void InitGliderMap (void)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
PLError_t theErr;
|
||||
short i;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
QSetRect(&glidSrcRect, 0, 0, kGliderWide, 668); // 32112 pixels
|
||||
theErr = CreateOffScreenGWorld(&glidSrcMap, &glidSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(glidSrcMap);
|
||||
LoadGraphic(kGliderPictID);
|
||||
LoadGraphic(glidSrcMap, kGliderPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&glid2SrcMap, &glidSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(glid2SrcMap);
|
||||
LoadGraphic(kGlider2PictID);
|
||||
LoadGraphic(glid2SrcMap, kGlider2PictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&glidMaskMap, &glidSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(glidMaskMap);
|
||||
LoadGraphic(kGliderPictID + 1000);
|
||||
LoadGraphic(glidMaskMap, kGliderPictID + 1000);
|
||||
|
||||
for (i = 0; i <= 20; i++)
|
||||
{
|
||||
@@ -199,12 +183,10 @@ void InitGliderMap (void)
|
||||
|
||||
QSetRect(&shadowSrcRect, 0, 0, kGliderWide, kShadowHigh * kNumShadowSrcRects);
|
||||
theErr = CreateOffScreenGWorld(&shadowSrcMap, &shadowSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(shadowSrcMap);
|
||||
LoadGraphic(kShadowPictID);
|
||||
LoadGraphic(shadowSrcMap, kShadowPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&shadowMaskMap, &shadowSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(shadowMaskMap);
|
||||
LoadGraphic(kShadowPictID + 1000);
|
||||
LoadGraphic(shadowMaskMap, kShadowPictID + 1000);
|
||||
|
||||
for (i = 0; i < kNumShadowSrcRects; i++)
|
||||
{
|
||||
@@ -214,20 +196,16 @@ void InitGliderMap (void)
|
||||
|
||||
QSetRect(&bandsSrcRect, 0, 0, 16, 18); // 304 pixels
|
||||
theErr = CreateOffScreenGWorld(&bandsSrcMap, &bandsSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(bandsSrcMap);
|
||||
LoadGraphic(kRubberBandsPictID);
|
||||
LoadGraphic(bandsSrcMap, kRubberBandsPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&bandsMaskMap, &bandsSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(bandsMaskMap);
|
||||
LoadGraphic(kRubberBandsPictID + 1000);
|
||||
LoadGraphic(bandsMaskMap, kRubberBandsPictID + 1000);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
QSetRect(&bandRects[i], 0, 0, 16, 6);
|
||||
QOffsetRect(&bandRects[i], 0, 6 * i);
|
||||
}
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- InitBlowers
|
||||
@@ -236,20 +214,15 @@ void InitGliderMap (void)
|
||||
|
||||
void InitBlowers (void)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
short i;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
QSetRect(&blowerSrcRect, 0, 0, 48, 402); // 19344 pixels
|
||||
theErr = CreateOffScreenGWorld(&blowerSrcMap, &blowerSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(blowerSrcMap);
|
||||
LoadGraphic(kBlowerPictID);
|
||||
LoadGraphic(blowerSrcMap, kBlowerPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&blowerMaskMap, &blowerSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(blowerMaskMap);
|
||||
LoadGraphic(kBlowerPictID + 1000);
|
||||
LoadGraphic(blowerMaskMap, kBlowerPictID + 1000);
|
||||
|
||||
for (i = 0; i < kNumCandleFlames; i++)
|
||||
{
|
||||
@@ -274,8 +247,6 @@ void InitBlowers (void)
|
||||
|
||||
QSetRect(&rightStartGliderSrc, 0, 0, 48, 16);
|
||||
QOffsetRect(&rightStartGliderSrc, 0, 374);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- InitFurniture
|
||||
@@ -284,19 +255,17 @@ void InitBlowers (void)
|
||||
|
||||
void InitFurniture (void)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
DrawSurface *wasCPort;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
QSetRect(&furnitureSrcRect, 0, 0, 64, 278); // 17856 pixels
|
||||
theErr = CreateOffScreenGWorld(&furnitureSrcMap, &furnitureSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(furnitureSrcMap);
|
||||
LoadGraphic(kFurniturePictID);
|
||||
LoadGraphic(furnitureSrcMap, kFurniturePictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&furnitureMaskMap, &furnitureSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(furnitureMaskMap);
|
||||
LoadGraphic(kFurniturePictID + 1000);
|
||||
LoadGraphic(furnitureMaskMap, kFurniturePictID + 1000);
|
||||
|
||||
QSetRect(&tableSrc, 0, 0, 64, 22);
|
||||
QOffsetRect(&tableSrc, 0, 0);
|
||||
@@ -331,20 +300,15 @@ void InitFurniture (void)
|
||||
|
||||
void InitPrizes (void)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
short i;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
QSetRect(&bonusSrcRect, 0, 0, 88, 378); // 33264 pixels
|
||||
theErr = CreateOffScreenGWorld(&bonusSrcMap, &bonusSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(bonusSrcMap);
|
||||
LoadGraphic(kBonusPictID);
|
||||
LoadGraphic(bonusSrcMap, kBonusPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&bonusMaskMap, &bonusSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(bonusMaskMap);
|
||||
LoadGraphic(kBonusPictID + 1000);
|
||||
LoadGraphic(bonusMaskMap, kBonusPictID + 1000);
|
||||
|
||||
for (i = 0; i < 11; i++)
|
||||
{
|
||||
@@ -392,20 +356,16 @@ void InitPrizes (void)
|
||||
|
||||
QSetRect(&pointsSrcRect, 0, 0, 24, 120); // 2880 pixels
|
||||
theErr = CreateOffScreenGWorld(&pointsSrcMap, &pointsSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(pointsSrcMap);
|
||||
LoadGraphic(kPointsPictID);
|
||||
LoadGraphic(pointsSrcMap, kPointsPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&pointsMaskMap, &pointsSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(pointsMaskMap);
|
||||
LoadGraphic(kPointsPictID + 1000);
|
||||
LoadGraphic(pointsMaskMap, kPointsPictID + 1000);
|
||||
|
||||
for (i = 0; i < 15; i++)
|
||||
{
|
||||
QSetRect(&pointsSrc[i], 0, 0, 24, 8);
|
||||
QOffsetRect(&pointsSrc[i], 0, i * 8);
|
||||
}
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- InitTransports
|
||||
@@ -414,21 +374,14 @@ void InitPrizes (void)
|
||||
|
||||
void InitTransports (void)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
QSetRect(&transSrcRect, 0, 0, 56, 32); // 1848 pixels
|
||||
theErr = CreateOffScreenGWorld(&transSrcMap, &transSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(transSrcMap);
|
||||
LoadGraphic(kTransportPictID);
|
||||
LoadGraphic(transSrcMap, kTransportPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&transMaskMap, &transSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(transMaskMap);
|
||||
LoadGraphic(kTransportPictID + 1000);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
LoadGraphic(transMaskMap, kTransportPictID + 1000);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- InitSwitches
|
||||
@@ -437,15 +390,11 @@ void InitTransports (void)
|
||||
|
||||
void InitSwitches (void)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
QSetRect(&switchSrcRect, 0, 0, 32, 104); // 3360 pixels
|
||||
theErr = CreateOffScreenGWorld(&switchSrcMap, &switchSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(switchSrcMap);
|
||||
LoadGraphic(kSwitchPictID);
|
||||
LoadGraphic(switchSrcMap, kSwitchPictID);
|
||||
|
||||
QSetRect(&lightSwitchSrc[0], 0, 0, 15, 24);
|
||||
QOffsetRect(&lightSwitchSrc[0], 0, 0);
|
||||
@@ -471,8 +420,6 @@ void InitSwitches (void)
|
||||
QOffsetRect(&knifeSwitchSrc[0], 0, 80);
|
||||
QSetRect(&knifeSwitchSrc[1], 0, 0, 16, 24);
|
||||
QOffsetRect(&knifeSwitchSrc[1], 16, 80);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- InitLights
|
||||
@@ -481,20 +428,15 @@ void InitSwitches (void)
|
||||
|
||||
void InitLights (void)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
short i;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
QSetRect(&lightSrcRect, 0, 0, 72, 126); // 9144 pixels
|
||||
theErr = CreateOffScreenGWorld(&lightSrcMap, &lightSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(lightSrcMap);
|
||||
LoadGraphic(kLightPictID);
|
||||
LoadGraphic(lightSrcMap, kLightPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&lightMaskMap, &lightSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(lightMaskMap);
|
||||
LoadGraphic(kLightPictID + 1000);
|
||||
LoadGraphic(lightMaskMap, kLightPictID + 1000);
|
||||
|
||||
QSetRect(&flourescentSrc1, 0, 0, 16, 12);
|
||||
QOffsetRect(&flourescentSrc1, 0, 78);
|
||||
@@ -507,8 +449,6 @@ void InitLights (void)
|
||||
QSetRect(&trackLightSrc[i], 0, 0, 24, 24);
|
||||
QOffsetRect(&trackLightSrc[i], 24 * i, 102);
|
||||
}
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- InitAppliances
|
||||
@@ -517,38 +457,29 @@ void InitLights (void)
|
||||
|
||||
void InitAppliances (void)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
short i;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
QSetRect(&applianceSrcRect, 0, 0, 80, 269); // 21600 pixels
|
||||
theErr = CreateOffScreenGWorld(&applianceSrcMap, &applianceSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(applianceSrcMap);
|
||||
LoadGraphic(kAppliancePictID);
|
||||
LoadGraphic(applianceSrcMap, kAppliancePictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&applianceMaskMap, &applianceSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(applianceMaskMap);
|
||||
LoadGraphic(kAppliancePictID + 1000);
|
||||
LoadGraphic(applianceMaskMap, kAppliancePictID + 1000);
|
||||
|
||||
QSetRect(&toastSrcRect, 0, 0, 32, 174); // 5600 pixels
|
||||
theErr = CreateOffScreenGWorld(&toastSrcMap, &toastSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(toastSrcMap);
|
||||
LoadGraphic(kToastPictID);
|
||||
LoadGraphic(toastSrcMap, kToastPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&toastMaskMap, &toastSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(toastMaskMap);
|
||||
LoadGraphic(kToastPictID + 1000);
|
||||
LoadGraphic(toastMaskMap, kToastPictID + 1000);
|
||||
|
||||
QSetRect(&shredSrcRect, 0, 0, 40, 35); // 1440 pixels
|
||||
theErr = CreateOffScreenGWorld(&shredSrcMap, &shredSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(shredSrcMap);
|
||||
LoadGraphic(kShreddedPictID);
|
||||
LoadGraphic(shredSrcMap, kShreddedPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&shredMaskMap, &shredSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(shredMaskMap);
|
||||
LoadGraphic(kShreddedPictID + 1000);
|
||||
LoadGraphic(shredMaskMap, kShreddedPictID + 1000);
|
||||
|
||||
QSetRect(&plusScreen1, 0, 0, 32, 22);
|
||||
QOffsetRect(&plusScreen1, 48, 127);
|
||||
@@ -591,8 +522,6 @@ void InitAppliances (void)
|
||||
QOffsetRect(µOn, 64, 222);
|
||||
QSetRect(µOff, 0, 0, 16, 35);
|
||||
QOffsetRect(µOff, 64, 187);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- InitEnemies
|
||||
@@ -601,74 +530,57 @@ void InitAppliances (void)
|
||||
|
||||
void InitEnemies (void)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
short i;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
QSetRect(&balloonSrcRect, 0, 0, 24, 30 * kNumBalloonFrames);
|
||||
theErr = CreateOffScreenGWorld(&balloonSrcMap, &balloonSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(balloonSrcMap);
|
||||
LoadGraphic(kBalloonPictID);
|
||||
LoadGraphic(balloonSrcMap, kBalloonPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&balloonMaskMap, &balloonSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(balloonMaskMap);
|
||||
LoadGraphic(kBalloonPictID + 1000);
|
||||
LoadGraphic(balloonMaskMap, kBalloonPictID + 1000);
|
||||
|
||||
QSetRect(&copterSrcRect, 0, 0, 32, 30 * kNumCopterFrames);
|
||||
theErr = CreateOffScreenGWorld(&copterSrcMap, &copterSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(copterSrcMap);
|
||||
LoadGraphic(kCopterPictID);
|
||||
LoadGraphic(copterSrcMap, kCopterPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&copterMaskMap, &copterSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(copterMaskMap);
|
||||
LoadGraphic(kCopterPictID + 1000);
|
||||
LoadGraphic(copterMaskMap, kCopterPictID + 1000);
|
||||
|
||||
QSetRect(&dartSrcRect, 0, 0, 64, 19 * kNumDartFrames);
|
||||
theErr = CreateOffScreenGWorld(&dartSrcMap, &dartSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(dartSrcMap);
|
||||
LoadGraphic(kDartPictID);
|
||||
LoadGraphic(dartSrcMap, kDartPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&dartMaskMap, &dartSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(dartMaskMap);
|
||||
LoadGraphic(kDartPictID + 1000);
|
||||
LoadGraphic(dartMaskMap, kDartPictID + 1000);
|
||||
|
||||
QSetRect(&ballSrcRect, 0, 0, 32, 32 * kNumBallFrames);
|
||||
theErr = CreateOffScreenGWorld(&ballSrcMap, &ballSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(ballSrcMap);
|
||||
LoadGraphic(kBallPictID);
|
||||
LoadGraphic(ballSrcMap, kBallPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&ballMaskMap, &ballSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(ballMaskMap);
|
||||
LoadGraphic(kBallPictID + 1000);
|
||||
LoadGraphic(ballMaskMap, kBallPictID + 1000);
|
||||
|
||||
QSetRect(&dripSrcRect, 0, 0, 16, 12 * kNumDripFrames);
|
||||
theErr = CreateOffScreenGWorld(&dripSrcMap, &dripSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(dripSrcMap);
|
||||
LoadGraphic(kDripPictID);
|
||||
LoadGraphic(dripSrcMap, kDripPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&dripMaskMap, &dripSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(dripMaskMap);
|
||||
LoadGraphic(kDripPictID + 1000);
|
||||
LoadGraphic(dripMaskMap, kDripPictID + 1000);
|
||||
|
||||
QSetRect(&enemySrcRect, 0, 0, 36, 33);
|
||||
theErr = CreateOffScreenGWorld(&enemySrcMap, &enemySrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(enemySrcMap);
|
||||
LoadGraphic(kEnemyPictID);
|
||||
LoadGraphic(enemySrcMap, kEnemyPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&enemyMaskMap, &enemySrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(enemyMaskMap);
|
||||
LoadGraphic(kEnemyPictID + 1000);
|
||||
LoadGraphic(enemyMaskMap, kEnemyPictID + 1000);
|
||||
|
||||
QSetRect(&fishSrcRect, 0, 0, 16, 16 * kNumFishFrames);
|
||||
theErr = CreateOffScreenGWorld(&fishSrcMap, &fishSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(fishSrcMap);
|
||||
LoadGraphic(kFishPictID);
|
||||
LoadGraphic(fishSrcMap, kFishPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&fishMaskMap, &fishSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(fishMaskMap);
|
||||
LoadGraphic(kFishPictID + 1000);
|
||||
LoadGraphic(fishMaskMap, kFishPictID + 1000);
|
||||
|
||||
for (i = 0; i < kNumBalloonFrames; i++)
|
||||
{
|
||||
@@ -705,7 +617,5 @@ void InitEnemies (void)
|
||||
QSetRect(&fishSrc[i], 0, 0, 16, 16);
|
||||
QOffsetRect(&fishSrc[i], 0, 16 * i);
|
||||
}
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ void InitAngel (void);
|
||||
|
||||
extern Rect suppSrcRect, justRoomsRect;
|
||||
extern Rect tileSrcRect, angelSrcRect;
|
||||
extern CGrafPtr tileSrcMap;
|
||||
extern DrawSurface *tileSrcMap;
|
||||
extern VFileSpec *theHousesSpecs;
|
||||
extern hotPtr hotSpots;
|
||||
extern sparklePtr sparkles;
|
||||
@@ -52,19 +52,14 @@ extern short maxFiles;
|
||||
|
||||
void InitClutter (void)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
QSetRect(&clutterSrcRect, 0, 0, 128, 69);
|
||||
theErr = CreateOffScreenGWorld(&clutterSrcMap, &clutterSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(clutterSrcMap);
|
||||
LoadGraphic(kClutterPictID);
|
||||
LoadGraphic(clutterSrcMap, kClutterPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&clutterMaskMap, &clutterSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(clutterMaskMap);
|
||||
LoadGraphic(kClutterPictID + 1000);
|
||||
LoadGraphic(clutterMaskMap, kClutterPictID + 1000);
|
||||
|
||||
QSetRect(&flowerSrc[0], 0, 0, 10, 28);
|
||||
QOffsetRect(&flowerSrc[0], 0, 23);
|
||||
@@ -83,8 +78,6 @@ void InitClutter (void)
|
||||
|
||||
QSetRect(&flowerSrc[5], 0, 0, 32, 51);
|
||||
QOffsetRect(&flowerSrc[5], 95, 0);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- InitSupport
|
||||
@@ -94,17 +87,11 @@ void InitClutter (void)
|
||||
|
||||
void InitSupport (void)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
QSetRect(&suppSrcRect, 0, 0, kRoomWide, kFloorSupportTall); // 44
|
||||
theErr = CreateOffScreenGWorld(&suppSrcMap, &suppSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(suppSrcMap);
|
||||
LoadGraphic(kSupportPictID);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
LoadGraphic(suppSrcMap, kSupportPictID);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- InitAngel
|
||||
@@ -114,21 +101,14 @@ void InitSupport (void)
|
||||
|
||||
void InitAngel (void)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
QSetRect(&angelSrcRect, 0, 0, 96, 44);
|
||||
theErr = CreateOffScreenGWorld(&angelSrcMap, &angelSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(angelSrcMap);
|
||||
LoadGraphic(kAngelPictID);
|
||||
LoadGraphic(angelSrcMap, kAngelPictID);
|
||||
|
||||
theErr = CreateOffScreenGWorld(&angelMaskMap, &angelSrcRect, GpPixelFormats::kBW1);
|
||||
SetGraphicsPort(angelMaskMap);
|
||||
LoadGraphic(kAngelPictID + 1);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
LoadGraphic(angelMaskMap, kAngelPictID + 1);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- CreateOffscreens
|
||||
@@ -139,11 +119,8 @@ void InitAngel (void)
|
||||
|
||||
void CreateOffscreens (void)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
PLError_t theErr;
|
||||
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
justRoomsRect = houseRect;
|
||||
ZeroRectCorner(&justRoomsRect);
|
||||
|
||||
@@ -222,7 +199,7 @@ void CreatePointers (void)
|
||||
if (pendulums == nil)
|
||||
RedAlert(kErrNoMemory);
|
||||
|
||||
// GlidePort: This is broken code, savedMaps is a flat buffer
|
||||
// GP: This is broken code, savedMaps is a flat buffer
|
||||
/*
|
||||
savedMaps = nil;
|
||||
savedMaps = (savedPtr)NewPtr(sizeof(savedType) * kMaxSavedMaps);
|
||||
|
||||
@@ -8,8 +8,10 @@
|
||||
#include "PLTextUtils.h"
|
||||
#include "PLControlDefinitions.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "FontFamily.h"
|
||||
#include "RectUtils.h"
|
||||
#include "Utilities.h"
|
||||
|
||||
@@ -50,8 +52,8 @@
|
||||
|
||||
void CreateToolsOffscreen (void);
|
||||
void KillToolsOffscreen (void);
|
||||
void FrameSelectedTool (void);
|
||||
void DrawToolName (void);
|
||||
void FrameSelectedTool (DrawSurface *);
|
||||
void DrawToolName (DrawSurface *);
|
||||
void DrawToolTiles (void);
|
||||
void SwitchToolModes (short);
|
||||
|
||||
@@ -59,7 +61,7 @@ void SwitchToolModes (short);
|
||||
Rect toolsWindowRect, toolSrcRect, toolTextRect;
|
||||
Rect toolRects[kTotalTools];
|
||||
ControlHandle classPopUp;
|
||||
GWorldPtr toolSrcMap;
|
||||
DrawSurface *toolSrcMap;
|
||||
WindowPtr toolsWindow;
|
||||
short isToolsH, isToolsV;
|
||||
short toolSelected, toolMode;
|
||||
@@ -73,19 +75,14 @@ Boolean isToolsOpen;
|
||||
#ifndef COMPILEDEMO
|
||||
void CreateToolsOffscreen (void)
|
||||
{
|
||||
CGrafPtr wasCPort;
|
||||
DrawSurface *wasCPort;
|
||||
PLError_t theErr;
|
||||
|
||||
if (toolSrcMap == nil)
|
||||
{
|
||||
wasCPort = GetGraphicsPort();
|
||||
|
||||
QSetRect(&toolSrcRect, 0, 0, 360, 216);
|
||||
theErr = CreateOffScreenGWorld(&toolSrcMap, &toolSrcRect, kPreferredPixelFormat);
|
||||
SetGraphicsPort(toolSrcMap);
|
||||
LoadGraphic(kToolsPictID);
|
||||
|
||||
SetGraphicsPort(wasCPort);
|
||||
LoadGraphic(toolSrcMap, kToolsPictID);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -107,7 +104,7 @@ void KillToolsOffscreen (void)
|
||||
//-------------------------------------------------------------- FrameSelectedTool
|
||||
|
||||
#ifndef COMPILEDEMO
|
||||
void FrameSelectedTool (void)
|
||||
void FrameSelectedTool (DrawSurface *surface)
|
||||
{
|
||||
Rect theRect;
|
||||
short toolIcon;
|
||||
@@ -126,9 +123,12 @@ void FrameSelectedTool (void)
|
||||
}
|
||||
|
||||
theRect = toolRects[toolIcon];
|
||||
PenSize(2, 2);
|
||||
ForeColor(redColor);
|
||||
FrameRect(&theRect);
|
||||
surface->SetForeColor(StdColors::Red());
|
||||
|
||||
surface->FrameRect(theRect);
|
||||
InsetRect(&theRect, 1, 1);
|
||||
surface->FrameRect(theRect);
|
||||
|
||||
PenNormal();
|
||||
ForeColor(blackColor);
|
||||
}
|
||||
@@ -137,7 +137,7 @@ void FrameSelectedTool (void)
|
||||
//-------------------------------------------------------------- DrawToolName
|
||||
|
||||
#ifndef COMPILEDEMO
|
||||
void DrawToolName (void)
|
||||
void DrawToolName (DrawSurface *surface)
|
||||
{
|
||||
Str255 theString;
|
||||
|
||||
@@ -146,13 +146,15 @@ void DrawToolName (void)
|
||||
else
|
||||
GetIndString(theString, kObjectNameStrings,
|
||||
toolSelected + ((toolMode - 1) * 0x0010));
|
||||
|
||||
EraseRect(&toolTextRect);
|
||||
MoveTo(toolTextRect.left + 3, toolTextRect.bottom - 6);
|
||||
TextFont(applFont);
|
||||
TextSize(9);
|
||||
TextFace(bold);
|
||||
ColorText(theString, 171L);
|
||||
|
||||
surface->SetForeColor(StdColors::White());
|
||||
surface->FillRect(toolTextRect);
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
|
||||
const Point textPoint = Point::Create(toolTextRect.left + 3, toolTextRect.bottom - 6);
|
||||
|
||||
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold);
|
||||
ColorText(surface, textPoint, theString, 171L);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -186,6 +188,7 @@ void DrawToolTiles (void)
|
||||
void EraseSelectedTool (void)
|
||||
{
|
||||
#ifndef COMPILEDEMO
|
||||
DrawSurface *surface = mainWindow->GetDrawSurface();
|
||||
Rect theRect;
|
||||
short toolIcon;
|
||||
|
||||
@@ -208,9 +211,10 @@ void EraseSelectedTool (void)
|
||||
}
|
||||
|
||||
theRect = toolRects[toolIcon];
|
||||
PenSize(2, 2);
|
||||
ForeColor(whiteColor);
|
||||
FrameRect(&theRect);
|
||||
surface->SetForeColor(StdColors::White());
|
||||
surface->FrameRect(theRect);
|
||||
InsetRect(&theRect, 1, 1);
|
||||
surface->FrameRect(theRect);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -224,8 +228,8 @@ void SelectTool (short which)
|
||||
|
||||
if (toolsWindow == nil)
|
||||
return;
|
||||
|
||||
SetPort((GrafPtr)toolsWindow);
|
||||
|
||||
DrawSurface *surface = toolsWindow->GetDrawSurface();
|
||||
|
||||
toolIcon = which;
|
||||
if ((toolMode == kBlowerMode) && (toolIcon >= 7))
|
||||
@@ -241,13 +245,14 @@ void SelectTool (short which)
|
||||
}
|
||||
|
||||
theRect = toolRects[toolIcon];
|
||||
ForeColor(redColor);
|
||||
FrameRect(&theRect);
|
||||
PenNormal();
|
||||
ForeColor(blackColor);
|
||||
|
||||
surface->SetForeColor(StdColors::Red());
|
||||
|
||||
surface->FrameRect(theRect);
|
||||
InsetRect(&theRect, 1, 1);
|
||||
surface->FrameRect(theRect);
|
||||
|
||||
toolSelected = which;
|
||||
DrawToolName();
|
||||
DrawToolName(surface);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -258,18 +263,17 @@ void UpdateToolsWindow (void)
|
||||
#ifndef COMPILEDEMO
|
||||
if (toolsWindow == nil)
|
||||
return;
|
||||
|
||||
SetPortWindowPort(toolsWindow);
|
||||
|
||||
DrawSurface *surface = toolsWindow->GetDrawSurface();
|
||||
DrawControls(toolsWindow);
|
||||
|
||||
DkGrayForeColor();
|
||||
MoveTo(4, 25);
|
||||
Line(108, 0);
|
||||
ForeColor(blackColor);
|
||||
DkGrayForeColor(surface);
|
||||
surface->DrawLine(Point::Create(4, 25), Point::Create(112, 25));
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
|
||||
DrawToolTiles();
|
||||
FrameSelectedTool();
|
||||
DrawToolName();
|
||||
FrameSelectedTool(surface);
|
||||
DrawToolName(surface);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -8,5 +8,5 @@
|
||||
#include "PLQDOffscreen.h"
|
||||
|
||||
|
||||
extern GWorldPtr toolSrcMap;
|
||||
extern DrawSurface *toolSrcMap;
|
||||
extern WindowPtr toolsWindow;
|
||||
|
||||
@@ -134,7 +134,7 @@ void WipeScreenOn (short direction, Rect *theRect)
|
||||
|
||||
void DumpScreenOn (Rect *theRect)
|
||||
{
|
||||
CGrafPtr graf = GetWindowPort(mainWindow);
|
||||
DrawSurface *graf = GetWindowPort(mainWindow);
|
||||
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||
GetPortBitMapForCopyBits(graf),
|
||||
|
||||
@@ -229,7 +229,7 @@ void CreateOffScreenPixMap (Rect *theRect, CGrafPtr *offScreen)
|
||||
//-------------------------------------------------------------------- CreateOffScreenGWorld
|
||||
// Creates an offscreen GWorld<6C>using the depth passed in.
|
||||
|
||||
PLError_t CreateOffScreenGWorld (GWorldPtr *theGWorld, Rect *bounds, GpPixelFormat_t pixelFormat)
|
||||
PLError_t CreateOffScreenGWorld (DrawSurface **theGWorld, Rect *bounds, GpPixelFormat_t pixelFormat)
|
||||
{
|
||||
PLError_t theErr;
|
||||
|
||||
@@ -275,7 +275,7 @@ void KillOffScreenBitMap (GrafPtr offScreen)
|
||||
// the current port (no scaling, clipping, etc, are done). Always<79>
|
||||
// draws in the upper left corner of current port.
|
||||
|
||||
void LoadGraphic (short resID)
|
||||
void LoadGraphic (DrawSurface *surface, short resID)
|
||||
{
|
||||
Rect bounds;
|
||||
PicHandle thePicture;
|
||||
@@ -286,7 +286,7 @@ void LoadGraphic (short resID)
|
||||
|
||||
bounds = (*thePicture)->picFrame.ToRect();
|
||||
OffsetRect(&bounds, -bounds.left, -bounds.top);
|
||||
DrawPicture(thePicture, &bounds);
|
||||
surface->DrawPicture(thePicture, bounds);
|
||||
|
||||
thePicture.Dispose();
|
||||
}
|
||||
@@ -296,14 +296,14 @@ void LoadGraphic (short resID)
|
||||
// specified. If this rect isn't the same size of the 'PICT', scaling<6E>
|
||||
// will occur.
|
||||
|
||||
void LoadScaledGraphic (short resID, Rect *theRect)
|
||||
void LoadScaledGraphic (DrawSurface *surface, short resID, Rect *theRect)
|
||||
{
|
||||
PicHandle thePicture;
|
||||
|
||||
thePicture = GetPicture(resID);
|
||||
if (thePicture == nil)
|
||||
RedAlert(kErrFailedGraphicLoad);
|
||||
DrawPicture(thePicture, theRect);
|
||||
surface->DrawPicture(thePicture, *theRect);
|
||||
thePicture.Dispose();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,4 +9,4 @@
|
||||
#include "GpPixelFormat.h"
|
||||
|
||||
|
||||
PLError_t CreateOffScreenGWorld (GWorldPtr *theGWorld, Rect *bounds, GpPixelFormat_t pixelFormat);
|
||||
PLError_t CreateOffScreenGWorld (DrawSurface **surface, Rect *bounds, GpPixelFormat_t pixelFormat);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "PLPasStr.h"
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "PLStandardColors.h"
|
||||
#include "RectUtils.h"
|
||||
|
||||
|
||||
@@ -119,11 +120,14 @@ void OpenMessageWindow (const PLPasStr &title)
|
||||
if (mssgWindow != nil)
|
||||
{
|
||||
ShowWindow(mssgWindow);
|
||||
SetPort((GrafPtr)mssgWindow);
|
||||
ClipRect(&mssgWindowRect);
|
||||
ForeColor(blackColor);
|
||||
BackColor(whiteColor);
|
||||
TextFont(systemFont);
|
||||
|
||||
DrawSurface *surface = mssgWindow->GetDrawSurface();
|
||||
|
||||
surface->SetClipRect(mssgWindowRect);
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
surface->SetBackColor(StdColors::White());
|
||||
|
||||
surface->SetSystemFont(12, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,12 +142,16 @@ void SetMessageWindowMessage (StringPtr message)
|
||||
|
||||
if (mssgWindow != nil)
|
||||
{
|
||||
SetPort((GrafPtr)mssgWindow);
|
||||
DrawSurface *surface = mssgWindow->GetDrawSurface();
|
||||
|
||||
SetRect(&mssgWindowRect, 0, 0, 256, kMessageWindowTall);
|
||||
InsetRect(&mssgWindowRect, 16, 16);
|
||||
EraseRect(&mssgWindowRect);
|
||||
MoveTo(mssgWindowRect.left, mssgWindowRect.bottom - 6);
|
||||
DrawString(message);
|
||||
surface->SetForeColor(StdColors::White());
|
||||
surface->FillRect(mssgWindowRect);
|
||||
|
||||
const Point textPoint = Point::Create(mssgWindowRect.left, mssgWindowRect.bottom - 6);
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
surface->DrawString(textPoint, message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
149
PortabilityLayer/DialogManager.cpp
Normal file
149
PortabilityLayer/DialogManager.cpp
Normal file
@@ -0,0 +1,149 @@
|
||||
#include "DialogManager.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "PLDialogs.h"
|
||||
#include "PLBigEndian.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "ResTypeID.h"
|
||||
#include "SharedTypes.h"
|
||||
#include "WindowDef.h"
|
||||
#include "WindowManager.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <new>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class DialogImpl final : public Dialog
|
||||
{
|
||||
public:
|
||||
void Destroy() override;
|
||||
Window *GetWindow() const override;
|
||||
|
||||
static DialogImpl *Create(Window *window);
|
||||
|
||||
private:
|
||||
explicit DialogImpl(Window *window);
|
||||
~DialogImpl();
|
||||
|
||||
Window *m_window;
|
||||
};
|
||||
|
||||
void DialogImpl::Destroy()
|
||||
{
|
||||
PortabilityLayer::WindowManager::GetInstance()->DestroyWindow(m_window);
|
||||
|
||||
this->~DialogImpl();
|
||||
free(this);
|
||||
}
|
||||
|
||||
Window *DialogImpl::GetWindow() const
|
||||
{
|
||||
return m_window;
|
||||
}
|
||||
|
||||
DialogImpl *DialogImpl::Create(Window *window)
|
||||
{
|
||||
void *storage = malloc(sizeof(DialogImpl));
|
||||
if (!storage)
|
||||
return nullptr;
|
||||
|
||||
return new (storage) DialogImpl(window);
|
||||
}
|
||||
|
||||
DialogImpl::DialogImpl(Window *window)
|
||||
: m_window(window)
|
||||
{
|
||||
}
|
||||
|
||||
DialogImpl::~DialogImpl()
|
||||
{
|
||||
}
|
||||
|
||||
// DLOG resource format:
|
||||
// DialogResourceDataHeader
|
||||
// Variable-length PStr: Title
|
||||
// Optional: Positioning (2 byte mask)
|
||||
|
||||
struct DialogResourceDataHeader
|
||||
{
|
||||
BERect m_rect;
|
||||
BEInt16_t m_style;
|
||||
uint8_t m_visible;
|
||||
uint8_t m_unusedA;
|
||||
uint8_t m_hasCloseBox;
|
||||
uint8_t m_unusedB;
|
||||
BEUInt32_t m_referenceConstant;
|
||||
BEInt16_t m_itemsResID;
|
||||
};
|
||||
|
||||
class DialogManagerImpl final : public DialogManager
|
||||
{
|
||||
public:
|
||||
Dialog *LoadDialog(int16_t resID, Window *behindWindow) override;
|
||||
|
||||
static DialogManagerImpl *GetInstance();
|
||||
|
||||
private:
|
||||
static DialogManagerImpl ms_instance;
|
||||
};
|
||||
|
||||
Dialog *DialogManagerImpl::LoadDialog(int16_t resID, Window *behindWindow)
|
||||
{
|
||||
ResourceManager *rm = ResourceManager::GetInstance();
|
||||
|
||||
THandle<uint8_t> dlogH = rm->GetResource('DLOG', resID).StaticCast<uint8_t>();
|
||||
const uint8_t *dlogData = *dlogH;
|
||||
const uint8_t *dlogDataEnd = dlogData + dlogH.MMBlock()->m_size;
|
||||
|
||||
DialogResourceDataHeader header;
|
||||
memcpy(&header, dlogData, sizeof(header));
|
||||
|
||||
const uint8_t *titlePStr = dlogData + sizeof(header);
|
||||
const uint8_t *positioningData = titlePStr + 1 + titlePStr[0]; // May be OOB
|
||||
|
||||
BEUInt16_t positionSpec(0);
|
||||
if (positioningData != dlogDataEnd)
|
||||
memcpy(&positionSpec, positioningData, 2);
|
||||
|
||||
const Rect rect = header.m_rect.ToRect();
|
||||
const int16_t style = header.m_style;
|
||||
|
||||
dlogH.Dispose();
|
||||
|
||||
if (!rect.IsValid())
|
||||
return nullptr;
|
||||
|
||||
WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||
|
||||
WindowDef wdef = WindowDef::Create(rect, 0, header.m_visible != 0, header.m_hasCloseBox != 0, header.m_referenceConstant, positionSpec, PLPasStr(titlePStr));
|
||||
Window *window = wm->CreateWindow(wdef);
|
||||
if (!window)
|
||||
return nullptr;
|
||||
|
||||
wm->PutWindowBehind(window, behindWindow);
|
||||
|
||||
THandle<uint8_t> dtemplateH = rm->GetResource('DITL', header.m_itemsResID).StaticCast<uint8_t>();
|
||||
|
||||
Dialog *dialog = DialogImpl::Create(window);
|
||||
|
||||
if (!dialog)
|
||||
{
|
||||
wm->DestroyWindow(window);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
DialogManagerImpl *DialogManagerImpl::GetInstance()
|
||||
{
|
||||
return &ms_instance;
|
||||
}
|
||||
|
||||
DialogManagerImpl DialogManagerImpl::ms_instance;
|
||||
|
||||
DialogManager *DialogManager::GetInstance()
|
||||
{
|
||||
return DialogManagerImpl::GetInstance();
|
||||
}
|
||||
}
|
||||
17
PortabilityLayer/DialogManager.h
Normal file
17
PortabilityLayer/DialogManager.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct Dialog;
|
||||
struct Window;
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class DialogManager
|
||||
{
|
||||
public:
|
||||
virtual Dialog *LoadDialog(int16_t resID, Window *behindWindow) = 0;
|
||||
|
||||
static DialogManager *GetInstance();
|
||||
};
|
||||
}
|
||||
@@ -146,7 +146,7 @@ namespace PortabilityLayer
|
||||
void Dismiss();
|
||||
|
||||
Menu **GetSelectedMenu() const;
|
||||
CGraf *GetRenderedMenu() const;
|
||||
DrawSurface *GetRenderedMenu() const;
|
||||
const unsigned int *GetSelectedItem() const;
|
||||
|
||||
void SelectItem(size_t item);
|
||||
@@ -156,7 +156,7 @@ namespace PortabilityLayer
|
||||
void RenderMenu(Menu *menu);
|
||||
|
||||
Menu **m_currentMenu;
|
||||
CGraf *m_menuGraf;
|
||||
DrawSurface *m_menuGraf;
|
||||
unsigned int m_itemIndex;
|
||||
bool m_haveItem;
|
||||
};
|
||||
@@ -184,7 +184,7 @@ namespace PortabilityLayer
|
||||
|
||||
static const int kMenuFontFlags = PortabilityLayer::FontFamilyFlag_Bold;
|
||||
|
||||
CGraf *m_menuBarGraf;
|
||||
DrawSurface *m_menuBarGraf;
|
||||
|
||||
Menu **m_firstMenu;
|
||||
Menu **m_lastMenu;
|
||||
@@ -555,7 +555,7 @@ namespace PortabilityLayer
|
||||
return;
|
||||
}
|
||||
|
||||
CGraf *graf = m_menuBarGraf;
|
||||
DrawSurface *graf = m_menuBarGraf;
|
||||
|
||||
assert(graf);
|
||||
|
||||
@@ -567,27 +567,26 @@ namespace PortabilityLayer
|
||||
|
||||
RefreshMenuBarLayout();
|
||||
|
||||
CGraf *oldGraf = GetGraphicsPort();
|
||||
DrawSurface *oldGraf = GetGraphicsPort();
|
||||
|
||||
SetGraphicsPort(m_menuBarGraf);
|
||||
|
||||
PortabilityLayer::QDState *qdState = qdManager->GetState();
|
||||
|
||||
qdState->SetForeColor(gs_barMidColor);
|
||||
PaintRect(&menuRect);
|
||||
|
||||
qdState->SetForeColor(gs_barBrightColor);
|
||||
graf->SetForeColor(gs_barMidColor);
|
||||
graf->FillRect(menuRect);
|
||||
graf->SetForeColor(gs_barBrightColor);
|
||||
|
||||
// Top stripe
|
||||
{
|
||||
const Rect rect = Rect::Create(0, 0, 1, static_cast<int16_t>(width) - 1);
|
||||
PaintRect(&rect);
|
||||
m_menuBarGraf->FillRect(rect);
|
||||
}
|
||||
|
||||
// Left stripe
|
||||
{
|
||||
const Rect rect = Rect::Create(0, 0, kMenuBarHeight - 1, 1);
|
||||
PaintRect(&rect);
|
||||
m_menuBarGraf->FillRect(rect);
|
||||
}
|
||||
|
||||
qdState->SetForeColor(gs_barDarkColor);
|
||||
@@ -595,13 +594,13 @@ namespace PortabilityLayer
|
||||
// Bottom stripe
|
||||
{
|
||||
const Rect rect = Rect::Create(kMenuBarHeight - 2, 1, kMenuBarHeight - 1, width);
|
||||
PaintRect(&rect);
|
||||
m_menuBarGraf->FillRect(rect);
|
||||
}
|
||||
|
||||
// Right stripe
|
||||
{
|
||||
const Rect rect = Rect::Create(0, width - 1, kMenuBarHeight - 1, width);
|
||||
PaintRect(&rect);
|
||||
m_menuBarGraf->FillRect(rect);
|
||||
}
|
||||
|
||||
qdState->SetForeColor(gs_barBottomEdgeColor);
|
||||
@@ -609,7 +608,7 @@ namespace PortabilityLayer
|
||||
// Bottom edge
|
||||
{
|
||||
const Rect rect = Rect::Create(kMenuBarHeight - 1, 0, kMenuBarHeight, width);
|
||||
PaintRect(&rect);
|
||||
m_menuBarGraf->FillRect(rect);
|
||||
}
|
||||
|
||||
PixMapHandle pixMap = m_menuBarGraf->m_port.GetPixMap();
|
||||
@@ -634,27 +633,26 @@ namespace PortabilityLayer
|
||||
qdState->SetForeColor(gs_barHighlightBrightColor);
|
||||
{
|
||||
const Rect rect = Rect::Create(0, left, 1, right);
|
||||
PaintRect(&rect);
|
||||
m_menuBarGraf->FillRect(rect);
|
||||
}
|
||||
|
||||
// Middle
|
||||
qdState->SetForeColor(gs_barHighlightMidColor);
|
||||
{
|
||||
const Rect rect = Rect::Create(1, left, kMenuBarHeight - 2, right);
|
||||
PaintRect(&rect);
|
||||
m_menuBarGraf->FillRect(rect);
|
||||
}
|
||||
|
||||
qdState->SetForeColor(gs_barHighlightDarkColor);
|
||||
{
|
||||
const Rect rect = Rect::Create(kMenuBarHeight - 2, left, kMenuBarHeight - 1, right);
|
||||
PaintRect(&rect);
|
||||
m_menuBarGraf->FillRect(rect);
|
||||
}
|
||||
}
|
||||
|
||||
// Text items
|
||||
qdState->SetForeColor(gs_barNormalTextColor);
|
||||
TextFont(systemFont);
|
||||
TextSize(kMenuFontSize);
|
||||
m_menuBarGraf->SetSystemFont(kMenuFontSize, PortabilityLayer::FontFamilyFlag_Bold);
|
||||
|
||||
{
|
||||
Menu **menuHdl = m_firstMenu;
|
||||
@@ -675,9 +673,8 @@ namespace PortabilityLayer
|
||||
{
|
||||
if (menuHdl != selectedMenuHdl)
|
||||
{
|
||||
qdState->m_penPos.h = static_cast<int16_t>(xCoordinate);
|
||||
qdState->m_penPos.v = kMenuBarTextYOffset;
|
||||
DrawString(PLPasStr(static_cast<const uint8_t*>(menu->stringBlobHandle->m_contents)));
|
||||
const Point itemPos = Point::Create(static_cast<int16_t>(xCoordinate), kMenuBarTextYOffset);
|
||||
graf->DrawString(itemPos, PLPasStr(static_cast<const uint8_t*>(menu->stringBlobHandle->m_contents)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -695,9 +692,8 @@ namespace PortabilityLayer
|
||||
qdState->SetForeColor(gs_barHighlightTextColor);
|
||||
size_t xCoordinate = menu->cumulativeOffset + (menu->menuIndex * 2) * kMenuBarItemPadding + kMenuBarInitialPadding;
|
||||
|
||||
qdState->m_penPos.h = static_cast<int16_t>(xCoordinate);
|
||||
qdState->m_penPos.v = kMenuBarTextYOffset;
|
||||
DrawString(PLPasStr(static_cast<const uint8_t*>(menu->stringBlobHandle->m_contents)));
|
||||
const Point itemPos = Point::Create(static_cast<int16_t>(xCoordinate), kMenuBarTextYOffset);
|
||||
graf->DrawString(itemPos, PLPasStr(static_cast<const uint8_t*>(menu->stringBlobHandle->m_contents)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -729,7 +725,7 @@ namespace PortabilityLayer
|
||||
}
|
||||
}
|
||||
|
||||
if (CGraf *renderedMenu = m_menuSelectionState.GetRenderedMenu())
|
||||
if (DrawSurface *renderedMenu = m_menuSelectionState.GetRenderedMenu())
|
||||
{
|
||||
renderedMenu->PushToDDSurface(displayDriver);
|
||||
|
||||
@@ -968,7 +964,7 @@ namespace PortabilityLayer
|
||||
return m_currentMenu;
|
||||
}
|
||||
|
||||
CGraf *MenuManagerImpl::MenuSelectionState::GetRenderedMenu() const
|
||||
DrawSurface *MenuManagerImpl::MenuSelectionState::GetRenderedMenu() const
|
||||
{
|
||||
return m_menuGraf;
|
||||
}
|
||||
@@ -1019,7 +1015,9 @@ namespace PortabilityLayer
|
||||
return;
|
||||
}
|
||||
|
||||
CGrafPtr oldGraf = GetGraphicsPort();
|
||||
DrawSurface *surface = m_menuGraf;
|
||||
|
||||
DrawSurface *oldGraf = GetGraphicsPort();
|
||||
|
||||
SetGraphicsPort(m_menuGraf);
|
||||
|
||||
@@ -1029,15 +1027,14 @@ namespace PortabilityLayer
|
||||
|
||||
{
|
||||
const Rect rect = Rect::Create(0, 0, menu->layoutHeight, menu->layoutWidth);
|
||||
PaintRect(&rect);
|
||||
surface->FillRect(rect);
|
||||
}
|
||||
|
||||
TextFont(systemFont);
|
||||
TextSize(kMenuFontSize);
|
||||
m_menuGraf->SetSystemFont(kMenuFontSize, PortabilityLayer::FontFamilyFlag_Bold);
|
||||
|
||||
const uint8_t *strBlob = static_cast<const uint8_t*>(menu->stringBlobHandle->m_contents);
|
||||
|
||||
qdState->m_penPos.h = kMenuItemLeftPadding;
|
||||
Point itemPos = Point::Create(kMenuItemLeftPadding, 0);
|
||||
|
||||
qdState->SetForeColor(gs_barNormalTextColor);
|
||||
|
||||
@@ -1048,9 +1045,9 @@ namespace PortabilityLayer
|
||||
|
||||
const MenuItem &item = menu->menuItems[i];
|
||||
|
||||
qdState->m_penPos.v = item.layoutYOffset + kMenuItemTextYOffset;
|
||||
itemPos.v = item.layoutYOffset + kMenuItemTextYOffset;
|
||||
|
||||
DrawString(PLPasStr(strBlob + item.nameOffsetInStringBlob));
|
||||
surface->DrawString(itemPos, PLPasStr(strBlob + item.nameOffsetInStringBlob));
|
||||
}
|
||||
|
||||
if (m_haveItem)
|
||||
@@ -1058,15 +1055,15 @@ namespace PortabilityLayer
|
||||
const MenuItem &selectedItem = menu->menuItems[m_itemIndex];
|
||||
qdState->SetForeColor(gs_barHighlightMidColor);
|
||||
const Rect itemRect = Rect::Create(selectedItem.layoutYOffset, 0, selectedItem.layoutYOffset + selectedItem.layoutHeight, menu->layoutWidth);
|
||||
PaintRect(&itemRect);
|
||||
surface->FillRect(itemRect);
|
||||
|
||||
qdState->SetForeColor(gs_barHighlightTextColor);
|
||||
|
||||
const MenuItem &item = menu->menuItems[m_itemIndex];
|
||||
|
||||
qdState->m_penPos.v = item.layoutYOffset + kMenuItemTextYOffset;
|
||||
itemPos.v = item.layoutYOffset + kMenuItemTextYOffset;
|
||||
|
||||
DrawString(PLPasStr(strBlob + item.nameOffsetInStringBlob));
|
||||
surface->DrawString(itemPos, PLPasStr(strBlob + item.nameOffsetInStringBlob));
|
||||
}
|
||||
|
||||
m_menuGraf->m_port.SetDirty(QDPortDirtyFlag_Contents);
|
||||
|
||||
@@ -779,33 +779,15 @@ short StringWidth(const PLPasStr &str)
|
||||
const PortabilityLayer::QDState *qdState = PortabilityLayer::QDManager::GetInstance()->GetState();
|
||||
PortabilityLayer::FontManager *fontManager = PortabilityLayer::FontManager::GetInstance();
|
||||
|
||||
const int textSize = qdState->m_textSize;
|
||||
const int textFace = qdState->m_textFace;
|
||||
const int fontID = qdState->m_fontID;
|
||||
|
||||
int variationFlags = 0;
|
||||
if (textFace & bold)
|
||||
variationFlags |= PortabilityLayer::FontFamilyFlag_Bold;
|
||||
|
||||
PortabilityLayer::FontFamily *fontFamily = nullptr;
|
||||
|
||||
switch (fontID)
|
||||
{
|
||||
case applFont:
|
||||
fontFamily = fontManager->GetApplicationFont(textSize, variationFlags);
|
||||
break;
|
||||
case systemFont:
|
||||
fontFamily = fontManager->GetSystemFont(textSize, variationFlags);
|
||||
break;
|
||||
default:
|
||||
PL_NotYetImplemented();
|
||||
return 0;
|
||||
}
|
||||
PortabilityLayer::FontFamily *fontFamily = qdState->m_fontFamily;
|
||||
|
||||
if (!fontFamily)
|
||||
return 0;
|
||||
|
||||
PortabilityLayer::RenderedFont *rfont = fontManager->GetRenderedFontFromFamily(fontFamily, textSize, variationFlags);
|
||||
const int variationFlags = qdState->m_fontVariationFlags;
|
||||
const int fontSize = qdState->m_fontSize;
|
||||
|
||||
PortabilityLayer::RenderedFont *rfont = fontManager->GetRenderedFontFromFamily(fontFamily, fontSize, variationFlags);
|
||||
if (!rfont)
|
||||
return 0;
|
||||
|
||||
@@ -1035,3 +1017,8 @@ Window::Window()
|
||||
, m_wmY(0)
|
||||
{
|
||||
}
|
||||
|
||||
DrawSurface *Window::GetDrawSurface() const
|
||||
{
|
||||
return const_cast<DrawSurface*>(&m_graf);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ typedef unsigned char Str255[256];
|
||||
typedef unsigned char *StringPtr;
|
||||
|
||||
class PLPasStr;
|
||||
struct CGraf;
|
||||
struct DrawSurface;
|
||||
struct Menu;
|
||||
|
||||
typedef void *Ptr;
|
||||
@@ -100,7 +100,9 @@ struct Window
|
||||
{
|
||||
Window();
|
||||
|
||||
CGraf m_graf; // Must be the first item
|
||||
DrawSurface *GetDrawSurface() const;
|
||||
|
||||
DrawSurface m_graf; // Must be the first item
|
||||
|
||||
// The port is always at 0,0
|
||||
// These are the WM coordinates
|
||||
@@ -161,8 +163,6 @@ struct EventRecord
|
||||
int modifiers;
|
||||
};
|
||||
|
||||
typedef CGraf *CGrafPtr;
|
||||
typedef CGrafPtr GWorldPtr;
|
||||
typedef Window *WindowPtr;
|
||||
typedef Cursor *CursPtr;
|
||||
typedef CCursor *CCrsrPtr;
|
||||
@@ -182,7 +182,6 @@ struct KeyMap;
|
||||
enum RegionID
|
||||
{
|
||||
inMenuBar = 1,
|
||||
inSysWindow,
|
||||
inContent,
|
||||
inDrag,
|
||||
inGrow,
|
||||
|
||||
@@ -5,19 +5,13 @@ void DrawDialog(DialogPtr dialog)
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
|
||||
WindowPtr GetDialogWindow(DialogPtr dialog)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DialogPtr GetNewDialog(int resID, void *unknown, WindowPtr behind)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CGrafPtr GetDialogPort(DialogPtr dialog)
|
||||
DrawSurface *GetDialogPort(DialogPtr dialog)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
return nullptr;
|
||||
|
||||
@@ -7,8 +7,10 @@
|
||||
class PLPasStr;
|
||||
struct Control;
|
||||
|
||||
struct Dialog : public PortabilityLayer::QDPort
|
||||
struct Dialog
|
||||
{
|
||||
virtual void Destroy() = 0;
|
||||
virtual Window *GetWindow() const = 0;
|
||||
};
|
||||
|
||||
struct DialogTemplate
|
||||
@@ -30,9 +32,7 @@ typedef THandle<DialogTemplate> DialogTHndl;
|
||||
typedef Boolean(*ModalFilterUPP)(DialogPtr dial, EventRecord *event, short *item);
|
||||
|
||||
void DrawDialog(DialogPtr dialog);
|
||||
WindowPtr GetDialogWindow(DialogPtr dialog);
|
||||
DialogPtr GetNewDialog(int resID, void *unknown, WindowPtr behind);
|
||||
CGrafPtr GetDialogPort(DialogPtr dialog);
|
||||
DrawSurface *GetDialogPort(DialogPtr dialog);
|
||||
|
||||
void GetDialogItem(DialogPtr dialog, int index, short *itemType, THandle<Control> *itemHandle, Rect *itemRect);
|
||||
void GetDialogItemText(THandle<Control> handle, StringPtr str);
|
||||
|
||||
@@ -109,7 +109,7 @@ void DisposeMovie(Movie movie)
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
|
||||
void SetMovieGWorld(Movie movie, CGrafPtr graf, void *unknown)
|
||||
void SetMovieGWorld(Movie movie, DrawSurface *graf, void *unknown)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ void SetMovieMasterTimeBase(Movie movie, TimeBase timeBase, void *unused);
|
||||
void GetMovieBox(Movie movie, Rect *rect);
|
||||
void StopMovie(Movie movie);
|
||||
void DisposeMovie(Movie movie);
|
||||
void SetMovieGWorld(Movie movie, CGrafPtr graf, void *unknown);
|
||||
void SetMovieGWorld(Movie movie, DrawSurface *graf, void *unknown);
|
||||
void SetMovieActive(Movie movie, Boolean active);
|
||||
void StartMovie(Movie movie);
|
||||
void MoviesTask(Movie movie, int unknown);
|
||||
|
||||
@@ -18,231 +18,17 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class PixMapBlitEmitter final : public QDPictEmitContext
|
||||
{
|
||||
public:
|
||||
PixMapBlitEmitter(const Vec2i &drawOrigin, PixMapImpl *pixMap);
|
||||
~PixMapBlitEmitter();
|
||||
|
||||
bool SpecifyFrame(const Rect &rect) override;
|
||||
Rect ConstrainRegion(const Rect &rect) const override;
|
||||
void Start(QDPictBlitSourceType sourceType, const QDPictEmitScanlineParameters ¶ms) override;
|
||||
void BlitScanlineAndAdvance(const void *) override;
|
||||
bool AllocTempBuffers(uint8_t *&buffer1, size_t buffer1Size, uint8_t *&buffer2, size_t buffer2Size) override;
|
||||
|
||||
private:
|
||||
PixMapImpl *m_pixMap;
|
||||
Vec2i m_drawOrigin;
|
||||
uint8_t *m_tempBuffer;
|
||||
Rect m_specFrame;
|
||||
|
||||
QDPictBlitSourceType m_blitType;
|
||||
QDPictEmitScanlineParameters m_params;
|
||||
|
||||
size_t m_constraintRegionWidth;
|
||||
size_t m_constraintRegionStartIndex;
|
||||
size_t m_constraintRegionEndIndex;
|
||||
size_t m_outputIndexStart;
|
||||
|
||||
uint8_t m_paletteMap[256];
|
||||
bool m_sourceAndDestPalettesAreSame;
|
||||
};
|
||||
|
||||
PixMapBlitEmitter::PixMapBlitEmitter(const Vec2i &drawOrigin, PixMapImpl *pixMap)
|
||||
: m_pixMap(pixMap)
|
||||
, m_drawOrigin(drawOrigin)
|
||||
, m_tempBuffer(nullptr)
|
||||
, m_sourceAndDestPalettesAreSame(false)
|
||||
{
|
||||
}
|
||||
|
||||
PixMapBlitEmitter::~PixMapBlitEmitter()
|
||||
{
|
||||
if (m_tempBuffer)
|
||||
PortabilityLayer::MemoryManager::GetInstance()->Release(m_tempBuffer);
|
||||
}
|
||||
|
||||
bool PixMapBlitEmitter::SpecifyFrame(const Rect &rect)
|
||||
{
|
||||
m_specFrame = rect;
|
||||
return true;
|
||||
}
|
||||
|
||||
Rect PixMapBlitEmitter::ConstrainRegion(const Rect &rect) const
|
||||
{
|
||||
const Rect pixMapRect = m_pixMap->m_rect;
|
||||
|
||||
const Rect2i rectInDrawSpace = Rect2i(rect) + m_drawOrigin;
|
||||
|
||||
const Rect2i constrainedRectInDrawSpace = rectInDrawSpace.Intersect(Rect2i(pixMapRect));
|
||||
|
||||
// If this got completely culled away, return an empty rect, but avoid int truncation
|
||||
if (!constrainedRectInDrawSpace.IsValid())
|
||||
return Rect::Create(rect.top, rect.left, rect.top, rect.left);
|
||||
|
||||
// Otherwise, it should still be valid in the picture space
|
||||
const Rect2i constrainedRectInPictSpace = constrainedRectInDrawSpace - m_drawOrigin;
|
||||
return constrainedRectInPictSpace.ToShortRect();
|
||||
}
|
||||
|
||||
void PixMapBlitEmitter::Start(QDPictBlitSourceType sourceType, const QDPictEmitScanlineParameters ¶ms)
|
||||
{
|
||||
// FIXME: Detect different system palette (if we ever do that)
|
||||
if (QDPictBlitSourceType_IsIndexed(sourceType))
|
||||
{
|
||||
if (params.m_numColors == 256 && !memcmp(params.m_colors, StandardPalette::GetInstance()->GetColors(), sizeof(RGBAColor) * 256))
|
||||
m_sourceAndDestPalettesAreSame = true;
|
||||
else
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
m_blitType = sourceType;
|
||||
m_params = params;
|
||||
|
||||
m_constraintRegionWidth = params.m_constrainedRegionRight - params.m_constrainedRegionLeft;
|
||||
m_constraintRegionStartIndex = params.m_constrainedRegionLeft - params.m_scanlineOriginX;
|
||||
m_constraintRegionEndIndex = params.m_constrainedRegionRight - params.m_scanlineOriginX;
|
||||
|
||||
const size_t firstCol = params.m_constrainedRegionLeft + m_drawOrigin.m_x - m_pixMap->m_rect.left;
|
||||
const size_t firstRow = params.m_firstY + m_drawOrigin.m_y - m_pixMap->m_rect.top;
|
||||
|
||||
m_outputIndexStart = firstRow * m_pixMap->GetPitch() + firstCol;
|
||||
}
|
||||
|
||||
void PixMapBlitEmitter::BlitScanlineAndAdvance(const void *data)
|
||||
{
|
||||
const int32_t crRight = m_params.m_constrainedRegionRight;
|
||||
const int32_t crLeft = m_params.m_constrainedRegionLeft;
|
||||
const size_t constraintRegionStartIndex = m_constraintRegionStartIndex;
|
||||
const uint8_t *dataBytes = static_cast<const uint8_t*>(data);
|
||||
const size_t outputIndexStart = m_outputIndexStart;
|
||||
const size_t planarSeparation = m_params.m_planarSeparation;
|
||||
const size_t constraintRegionWidth = m_constraintRegionWidth;
|
||||
|
||||
const uint8_t *paletteMapping = nullptr;
|
||||
|
||||
const uint8_t staticMapping1Bit[] = { 0, 255 };
|
||||
|
||||
void *imageData = m_pixMap->GetPixelData();
|
||||
|
||||
if (m_pixMap->GetPixelFormat() == GpPixelFormats::k8BitStandard || m_pixMap->GetPixelFormat() == GpPixelFormats::kBW1)
|
||||
{
|
||||
switch (m_blitType)
|
||||
{
|
||||
case QDPictBlitSourceType_Indexed1Bit:
|
||||
for (size_t i = 0; i < constraintRegionWidth; i++)
|
||||
{
|
||||
const size_t itemIndex = i + constraintRegionStartIndex;
|
||||
|
||||
const int bitShift = 7 - (itemIndex & 7);
|
||||
const int colorIndex = (dataBytes[itemIndex / 8] >> bitShift) & 0x1;
|
||||
static_cast<uint8_t*>(imageData)[i + outputIndexStart] = paletteMapping[colorIndex];
|
||||
}
|
||||
break;
|
||||
case QDPictBlitSourceType_Indexed2Bit:
|
||||
for (size_t i = 0; i < constraintRegionWidth; i++)
|
||||
{
|
||||
const size_t itemIndex = i + constraintRegionStartIndex;
|
||||
|
||||
const int bitShift = 6 - (2 * (itemIndex & 1));
|
||||
const int colorIndex = (dataBytes[itemIndex / 4] >> bitShift) & 0x3;
|
||||
static_cast<uint8_t*>(imageData)[i + outputIndexStart] = paletteMapping[colorIndex];
|
||||
}
|
||||
break;
|
||||
case QDPictBlitSourceType_Indexed4Bit:
|
||||
for (size_t i = 0; i < constraintRegionWidth; i++)
|
||||
{
|
||||
const size_t itemIndex = i + constraintRegionStartIndex;
|
||||
|
||||
const int bitShift = 4 - (4 * (itemIndex & 1));
|
||||
const int colorIndex = (dataBytes[itemIndex / 2] >> bitShift) & 0xf;
|
||||
static_cast<uint8_t*>(imageData)[i + outputIndexStart] = paletteMapping[colorIndex];
|
||||
}
|
||||
break;
|
||||
case QDPictBlitSourceType_Indexed8Bit:
|
||||
if (m_sourceAndDestPalettesAreSame)
|
||||
memcpy(static_cast<uint8_t*>(imageData) + outputIndexStart, dataBytes + constraintRegionStartIndex, m_constraintRegionWidth);
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < constraintRegionWidth; i++)
|
||||
{
|
||||
const size_t itemIndex = i + constraintRegionStartIndex;
|
||||
const uint8_t colorIndex = dataBytes[itemIndex];
|
||||
static_cast<uint8_t*>(imageData)[i + outputIndexStart] = paletteMapping[colorIndex];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QDPictBlitSourceType_1Bit:
|
||||
for (size_t i = 0; i < constraintRegionWidth; i++)
|
||||
{
|
||||
const size_t itemIndex = i + constraintRegionStartIndex;
|
||||
|
||||
const int bitShift = 7 - (itemIndex & 7);
|
||||
const int colorIndex = (dataBytes[itemIndex / 8] >> bitShift) & 0x1;
|
||||
static_cast<uint8_t*>(imageData)[i + outputIndexStart] = staticMapping1Bit[colorIndex];
|
||||
}
|
||||
break;
|
||||
case QDPictBlitSourceType_RGB15:
|
||||
for (size_t i = 0; i < constraintRegionWidth; i++)
|
||||
{
|
||||
const size_t itemIndex = i + constraintRegionStartIndex;
|
||||
|
||||
const uint16_t item = *reinterpret_cast<const uint16_t*>(dataBytes + itemIndex * 2);
|
||||
uint8_t &outputItem = static_cast<uint8_t*>(imageData)[i + outputIndexStart];
|
||||
|
||||
outputItem = StandardPalette::GetInstance()->MapColorLUT((item >> 1) & 0xf, (item >> 6) & 0xf, (item >> 11) & 0x1f);
|
||||
}
|
||||
break;
|
||||
case QDPictBlitSourceType_RGB24_Multiplane:
|
||||
for (size_t i = 0; i < m_constraintRegionWidth; i++)
|
||||
{
|
||||
const size_t itemIndex = i + constraintRegionStartIndex;
|
||||
|
||||
uint8_t &outputItem = static_cast<uint8_t*>(imageData)[i + outputIndexStart];
|
||||
|
||||
const uint8_t r = dataBytes[itemIndex];
|
||||
const uint8_t g = dataBytes[itemIndex + planarSeparation];
|
||||
const uint8_t b = dataBytes[itemIndex + planarSeparation * 2];
|
||||
|
||||
outputItem = StandardPalette::GetInstance()->MapColorLUT(r, g, b);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
m_outputIndexStart += m_pixMap->GetPitch();
|
||||
}
|
||||
|
||||
bool PixMapBlitEmitter::AllocTempBuffers(uint8_t *&buffer1, size_t buffer1Size, uint8_t *&buffer2, size_t buffer2Size)
|
||||
{
|
||||
m_tempBuffer = static_cast<uint8_t*>(PortabilityLayer::MemoryManager::GetInstance()->Alloc(buffer1Size + buffer2Size));
|
||||
if (!m_tempBuffer)
|
||||
return false;
|
||||
|
||||
buffer1 = m_tempBuffer;
|
||||
buffer2 = m_tempBuffer + buffer1Size;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
PLError_t NewGWorld(GWorldPtr *gworld, GpPixelFormat_t pixelFormat, const Rect *bounds, CTabHandle colorTable)
|
||||
PLError_t NewGWorld(DrawSurface **gworld, GpPixelFormat_t pixelFormat, const Rect *bounds, CTabHandle colorTable)
|
||||
{
|
||||
return PortabilityLayer::QDManager::GetInstance()->NewGWorld(gworld, pixelFormat, *bounds, colorTable);
|
||||
}
|
||||
|
||||
void DisposeGWorld(GWorldPtr gworld)
|
||||
void DisposeGWorld(DrawSurface *gworld)
|
||||
{
|
||||
return PortabilityLayer::QDManager::GetInstance()->DisposeGWorld(gworld);
|
||||
}
|
||||
|
||||
PixMapHandle GetGWorldPixMap(GWorldPtr gworld)
|
||||
PixMapHandle GetGWorldPixMap(DrawSurface *gworld)
|
||||
{
|
||||
if (!gworld)
|
||||
return nullptr;
|
||||
@@ -263,68 +49,17 @@ void OffsetRect(Rect *rect, int right, int down)
|
||||
rect->bottom += down;
|
||||
}
|
||||
|
||||
void DrawPicture(PicHandle pict, Rect *bounds)
|
||||
{
|
||||
if (!pict)
|
||||
return;
|
||||
|
||||
PicPtr picPtr = *pict;
|
||||
|
||||
if (!picPtr)
|
||||
return;
|
||||
|
||||
const Rect picRect = picPtr->picFrame.ToRect();
|
||||
|
||||
if (bounds->right - bounds->left != picRect.right - picRect.left || bounds->bottom - bounds->top != picRect.bottom - picRect.top)
|
||||
{
|
||||
// Scaled pict draw (not supported)
|
||||
assert(false);
|
||||
return;
|
||||
}
|
||||
|
||||
PortabilityLayer::QDManager *qdManager = PortabilityLayer::QDManager::GetInstance();
|
||||
PortabilityLayer::QDPort *port = qdManager->GetPort();
|
||||
|
||||
if (!port)
|
||||
return;
|
||||
|
||||
PortabilityLayer::PixMapImpl *pixMap = static_cast<PortabilityLayer::PixMapImpl*>(*port->GetPixMap());
|
||||
|
||||
long handleSize = pict.MMBlock()->m_size;
|
||||
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())
|
||||
{
|
||||
case GpPixelFormats::kBW1:
|
||||
case GpPixelFormats::k8BitStandard:
|
||||
{
|
||||
PortabilityLayer::PixMapBlitEmitter blitEmitter(drawOrigin, pixMap);
|
||||
PortabilityLayer::QDPictDecoder decoder;
|
||||
|
||||
decoder.DecodePict(&stream, &blitEmitter);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// TODO: Implement higher-resolution pixel blitters
|
||||
assert(false);
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
CGraf *GetGraphicsPort()
|
||||
DrawSurface *GetGraphicsPort()
|
||||
{
|
||||
PortabilityLayer::QDPort *port = PortabilityLayer::QDManager::GetInstance()->GetPort();
|
||||
|
||||
CGraf *grafPtr = reinterpret_cast<CGraf *>(port);
|
||||
DrawSurface *grafPtr = reinterpret_cast<DrawSurface *>(port);
|
||||
assert(&grafPtr->m_port == port);
|
||||
|
||||
return grafPtr;
|
||||
}
|
||||
|
||||
void SetGraphicsPort(CGrafPtr gw)
|
||||
void SetGraphicsPort(DrawSurface *gw)
|
||||
{
|
||||
PortabilityLayer::QDManager::GetInstance()->SetPort(&gw->m_port);
|
||||
}
|
||||
|
||||
@@ -25,19 +25,17 @@ enum QDFlags
|
||||
useTempMem = 1,
|
||||
};
|
||||
|
||||
PLError_t NewGWorld(GWorldPtr *gworld, GpPixelFormat_t pixelFormat, const Rect *bounds, CTabHandle colorTable);
|
||||
void DisposeGWorld(GWorldPtr gworld);
|
||||
PLError_t NewGWorld(DrawSurface **gworld, GpPixelFormat_t pixelFormat, const Rect *bounds, CTabHandle colorTable);
|
||||
void DisposeGWorld(DrawSurface *gworld);
|
||||
|
||||
PixMapHandle GetGWorldPixMap(GWorldPtr gworld);
|
||||
PixMapHandle GetGWorldPixMap(DrawSurface *gworld);
|
||||
|
||||
PicHandle GetPicture(short resID);
|
||||
|
||||
void OffsetRect(Rect *rect, int right, int down);
|
||||
|
||||
void DrawPicture(PicHandle pict, Rect *bounds);
|
||||
|
||||
CGrafPtr GetGraphicsPort();
|
||||
void SetGraphicsPort(CGrafPtr gw);
|
||||
DrawSurface *GetGraphicsPort();
|
||||
void SetGraphicsPort(DrawSurface *gw);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "LinePlotter.h"
|
||||
#include "MMHandleBlock.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "MemReaderStream.h"
|
||||
#include "HostFontHandler.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "RenderedFont.h"
|
||||
@@ -18,9 +19,13 @@
|
||||
#include "ScanlineMask.h"
|
||||
#include "ScanlineMaskConverter.h"
|
||||
#include "ScanlineMaskIterator.h"
|
||||
#include "QDGraf.h"
|
||||
#include "QDStandardPalette.h"
|
||||
#include "QDPictEmitContext.h"
|
||||
#include "QDPictEmitScanlineParameters.h"
|
||||
#include "WindowManager.h"
|
||||
#include "QDGraf.h"
|
||||
#include "QDPictDecoder.h"
|
||||
#include "QDPixMap.h"
|
||||
#include "Vec2i.h"
|
||||
|
||||
@@ -28,14 +33,219 @@
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
enum PaintColorResolution
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
PaintColorResolution_Fore,
|
||||
PaintColorResolution_Back,
|
||||
PaintColorResolution_Pen,
|
||||
};
|
||||
class PixMapBlitEmitter final : public QDPictEmitContext
|
||||
{
|
||||
public:
|
||||
PixMapBlitEmitter(const Vec2i &drawOrigin, PixMapImpl *pixMap);
|
||||
~PixMapBlitEmitter();
|
||||
|
||||
static void PaintRectWithPCR(const Rect &rect, PaintColorResolution pcr);
|
||||
bool SpecifyFrame(const Rect &rect) override;
|
||||
Rect ConstrainRegion(const Rect &rect) const override;
|
||||
void Start(QDPictBlitSourceType sourceType, const QDPictEmitScanlineParameters ¶ms) override;
|
||||
void BlitScanlineAndAdvance(const void *) override;
|
||||
bool AllocTempBuffers(uint8_t *&buffer1, size_t buffer1Size, uint8_t *&buffer2, size_t buffer2Size) override;
|
||||
|
||||
private:
|
||||
PixMapImpl *m_pixMap;
|
||||
Vec2i m_drawOrigin;
|
||||
uint8_t *m_tempBuffer;
|
||||
Rect m_specFrame;
|
||||
|
||||
QDPictBlitSourceType m_blitType;
|
||||
QDPictEmitScanlineParameters m_params;
|
||||
|
||||
size_t m_constraintRegionWidth;
|
||||
size_t m_constraintRegionStartIndex;
|
||||
size_t m_constraintRegionEndIndex;
|
||||
size_t m_outputIndexStart;
|
||||
|
||||
uint8_t m_paletteMap[256];
|
||||
bool m_sourceAndDestPalettesAreSame;
|
||||
};
|
||||
|
||||
PixMapBlitEmitter::PixMapBlitEmitter(const Vec2i &drawOrigin, PixMapImpl *pixMap)
|
||||
: m_pixMap(pixMap)
|
||||
, m_drawOrigin(drawOrigin)
|
||||
, m_tempBuffer(nullptr)
|
||||
, m_sourceAndDestPalettesAreSame(false)
|
||||
{
|
||||
}
|
||||
|
||||
PixMapBlitEmitter::~PixMapBlitEmitter()
|
||||
{
|
||||
if (m_tempBuffer)
|
||||
PortabilityLayer::MemoryManager::GetInstance()->Release(m_tempBuffer);
|
||||
}
|
||||
|
||||
bool PixMapBlitEmitter::SpecifyFrame(const Rect &rect)
|
||||
{
|
||||
m_specFrame = rect;
|
||||
return true;
|
||||
}
|
||||
|
||||
Rect PixMapBlitEmitter::ConstrainRegion(const Rect &rect) const
|
||||
{
|
||||
const Rect pixMapRect = m_pixMap->m_rect;
|
||||
|
||||
const Rect2i rectInDrawSpace = Rect2i(rect) + m_drawOrigin;
|
||||
|
||||
const Rect2i constrainedRectInDrawSpace = rectInDrawSpace.Intersect(Rect2i(pixMapRect));
|
||||
|
||||
// If this got completely culled away, return an empty rect, but avoid int truncation
|
||||
if (!constrainedRectInDrawSpace.IsValid())
|
||||
return Rect::Create(rect.top, rect.left, rect.top, rect.left);
|
||||
|
||||
// Otherwise, it should still be valid in the picture space
|
||||
const Rect2i constrainedRectInPictSpace = constrainedRectInDrawSpace - m_drawOrigin;
|
||||
return constrainedRectInPictSpace.ToShortRect();
|
||||
}
|
||||
|
||||
void PixMapBlitEmitter::Start(QDPictBlitSourceType sourceType, const QDPictEmitScanlineParameters ¶ms)
|
||||
{
|
||||
// FIXME: Detect different system palette (if we ever do that)
|
||||
if (QDPictBlitSourceType_IsIndexed(sourceType))
|
||||
{
|
||||
if (params.m_numColors == 256 && !memcmp(params.m_colors, StandardPalette::GetInstance()->GetColors(), sizeof(RGBAColor) * 256))
|
||||
m_sourceAndDestPalettesAreSame = true;
|
||||
else
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
m_blitType = sourceType;
|
||||
m_params = params;
|
||||
|
||||
m_constraintRegionWidth = params.m_constrainedRegionRight - params.m_constrainedRegionLeft;
|
||||
m_constraintRegionStartIndex = params.m_constrainedRegionLeft - params.m_scanlineOriginX;
|
||||
m_constraintRegionEndIndex = params.m_constrainedRegionRight - params.m_scanlineOriginX;
|
||||
|
||||
const size_t firstCol = params.m_constrainedRegionLeft + m_drawOrigin.m_x - m_pixMap->m_rect.left;
|
||||
const size_t firstRow = params.m_firstY + m_drawOrigin.m_y - m_pixMap->m_rect.top;
|
||||
|
||||
m_outputIndexStart = firstRow * m_pixMap->GetPitch() + firstCol;
|
||||
}
|
||||
|
||||
void PixMapBlitEmitter::BlitScanlineAndAdvance(const void *data)
|
||||
{
|
||||
const int32_t crRight = m_params.m_constrainedRegionRight;
|
||||
const int32_t crLeft = m_params.m_constrainedRegionLeft;
|
||||
const size_t constraintRegionStartIndex = m_constraintRegionStartIndex;
|
||||
const uint8_t *dataBytes = static_cast<const uint8_t*>(data);
|
||||
const size_t outputIndexStart = m_outputIndexStart;
|
||||
const size_t planarSeparation = m_params.m_planarSeparation;
|
||||
const size_t constraintRegionWidth = m_constraintRegionWidth;
|
||||
|
||||
const uint8_t *paletteMapping = nullptr;
|
||||
|
||||
const uint8_t staticMapping1Bit[] = { 0, 255 };
|
||||
|
||||
void *imageData = m_pixMap->GetPixelData();
|
||||
|
||||
if (m_pixMap->GetPixelFormat() == GpPixelFormats::k8BitStandard || m_pixMap->GetPixelFormat() == GpPixelFormats::kBW1)
|
||||
{
|
||||
switch (m_blitType)
|
||||
{
|
||||
case QDPictBlitSourceType_Indexed1Bit:
|
||||
for (size_t i = 0; i < constraintRegionWidth; i++)
|
||||
{
|
||||
const size_t itemIndex = i + constraintRegionStartIndex;
|
||||
|
||||
const int bitShift = 7 - (itemIndex & 7);
|
||||
const int colorIndex = (dataBytes[itemIndex / 8] >> bitShift) & 0x1;
|
||||
static_cast<uint8_t*>(imageData)[i + outputIndexStart] = paletteMapping[colorIndex];
|
||||
}
|
||||
break;
|
||||
case QDPictBlitSourceType_Indexed2Bit:
|
||||
for (size_t i = 0; i < constraintRegionWidth; i++)
|
||||
{
|
||||
const size_t itemIndex = i + constraintRegionStartIndex;
|
||||
|
||||
const int bitShift = 6 - (2 * (itemIndex & 1));
|
||||
const int colorIndex = (dataBytes[itemIndex / 4] >> bitShift) & 0x3;
|
||||
static_cast<uint8_t*>(imageData)[i + outputIndexStart] = paletteMapping[colorIndex];
|
||||
}
|
||||
break;
|
||||
case QDPictBlitSourceType_Indexed4Bit:
|
||||
for (size_t i = 0; i < constraintRegionWidth; i++)
|
||||
{
|
||||
const size_t itemIndex = i + constraintRegionStartIndex;
|
||||
|
||||
const int bitShift = 4 - (4 * (itemIndex & 1));
|
||||
const int colorIndex = (dataBytes[itemIndex / 2] >> bitShift) & 0xf;
|
||||
static_cast<uint8_t*>(imageData)[i + outputIndexStart] = paletteMapping[colorIndex];
|
||||
}
|
||||
break;
|
||||
case QDPictBlitSourceType_Indexed8Bit:
|
||||
if (m_sourceAndDestPalettesAreSame)
|
||||
memcpy(static_cast<uint8_t*>(imageData) + outputIndexStart, dataBytes + constraintRegionStartIndex, m_constraintRegionWidth);
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < constraintRegionWidth; i++)
|
||||
{
|
||||
const size_t itemIndex = i + constraintRegionStartIndex;
|
||||
const uint8_t colorIndex = dataBytes[itemIndex];
|
||||
static_cast<uint8_t*>(imageData)[i + outputIndexStart] = paletteMapping[colorIndex];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QDPictBlitSourceType_1Bit:
|
||||
for (size_t i = 0; i < constraintRegionWidth; i++)
|
||||
{
|
||||
const size_t itemIndex = i + constraintRegionStartIndex;
|
||||
|
||||
const int bitShift = 7 - (itemIndex & 7);
|
||||
const int colorIndex = (dataBytes[itemIndex / 8] >> bitShift) & 0x1;
|
||||
static_cast<uint8_t*>(imageData)[i + outputIndexStart] = staticMapping1Bit[colorIndex];
|
||||
}
|
||||
break;
|
||||
case QDPictBlitSourceType_RGB15:
|
||||
for (size_t i = 0; i < constraintRegionWidth; i++)
|
||||
{
|
||||
const size_t itemIndex = i + constraintRegionStartIndex;
|
||||
|
||||
const uint16_t item = *reinterpret_cast<const uint16_t*>(dataBytes + itemIndex * 2);
|
||||
uint8_t &outputItem = static_cast<uint8_t*>(imageData)[i + outputIndexStart];
|
||||
|
||||
outputItem = StandardPalette::GetInstance()->MapColorLUT((item >> 1) & 0xf, (item >> 6) & 0xf, (item >> 11) & 0x1f);
|
||||
}
|
||||
break;
|
||||
case QDPictBlitSourceType_RGB24_Multiplane:
|
||||
for (size_t i = 0; i < m_constraintRegionWidth; i++)
|
||||
{
|
||||
const size_t itemIndex = i + constraintRegionStartIndex;
|
||||
|
||||
uint8_t &outputItem = static_cast<uint8_t*>(imageData)[i + outputIndexStart];
|
||||
|
||||
const uint8_t r = dataBytes[itemIndex];
|
||||
const uint8_t g = dataBytes[itemIndex + planarSeparation];
|
||||
const uint8_t b = dataBytes[itemIndex + planarSeparation * 2];
|
||||
|
||||
outputItem = StandardPalette::GetInstance()->MapColorLUT(r, g, b);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
m_outputIndexStart += m_pixMap->GetPitch();
|
||||
}
|
||||
|
||||
bool PixMapBlitEmitter::AllocTempBuffers(uint8_t *&buffer1, size_t buffer1Size, uint8_t *&buffer2, size_t buffer2Size)
|
||||
{
|
||||
m_tempBuffer = static_cast<uint8_t*>(PortabilityLayer::MemoryManager::GetInstance()->Alloc(buffer1Size + buffer2Size));
|
||||
if (!m_tempBuffer)
|
||||
return false;
|
||||
|
||||
buffer1 = m_tempBuffer;
|
||||
buffer2 = m_tempBuffer + buffer1Size;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void GetPort(GrafPtr *graf)
|
||||
{
|
||||
@@ -47,11 +257,6 @@ void SetPort(GrafPtr graf)
|
||||
PortabilityLayer::QDManager::GetInstance()->SetPort(graf);
|
||||
}
|
||||
|
||||
void BeginUpdate(WindowPtr graf)
|
||||
{
|
||||
(void)graf;
|
||||
}
|
||||
|
||||
void EndUpdate(WindowPtr graf)
|
||||
{
|
||||
graf->m_graf.m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||
@@ -105,21 +310,6 @@ void SetPortDialogPort(Dialog *dialog)
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
|
||||
void TextSize(int sz)
|
||||
{
|
||||
PortabilityLayer::QDManager::GetInstance()->GetState()->m_textSize = sz;
|
||||
}
|
||||
|
||||
void TextFace(int face)
|
||||
{
|
||||
PortabilityLayer::QDManager::GetInstance()->GetState()->m_textFace = face;
|
||||
}
|
||||
|
||||
void TextFont(int fontID)
|
||||
{
|
||||
PortabilityLayer::QDManager::GetInstance()->GetState()->m_fontID = fontID;
|
||||
}
|
||||
|
||||
int TextWidth(const PLPasStr &str, int firstChar1Based, int length)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
@@ -134,7 +324,7 @@ void MoveTo(int x, int y)
|
||||
penPos.v = y;
|
||||
}
|
||||
|
||||
static void PlotLine(PortabilityLayer::QDState *qdState, PortabilityLayer::QDPort *qdPort, const PortabilityLayer::Vec2i &pointA, const PortabilityLayer::Vec2i &pointB)
|
||||
static void PlotLine(PortabilityLayer::QDState *qdState, DrawSurface *surface, const PortabilityLayer::Vec2i &pointA, const PortabilityLayer::Vec2i &pointB)
|
||||
{
|
||||
const Rect lineRect = Rect::Create(
|
||||
std::min(pointA.m_y, pointB.m_y),
|
||||
@@ -145,13 +335,15 @@ static void PlotLine(PortabilityLayer::QDState *qdState, PortabilityLayer::QDPor
|
||||
// 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);
|
||||
surface->FillRect(lineRect);
|
||||
return;
|
||||
}
|
||||
|
||||
GpPixelFormat_t pixelFormat = qdPort->GetPixelFormat();
|
||||
PortabilityLayer::QDPort *port = &surface->m_port;
|
||||
|
||||
Rect constrainedRect = qdPort->GetRect();
|
||||
GpPixelFormat_t pixelFormat = surface->m_port.GetPixelFormat();
|
||||
|
||||
Rect constrainedRect = port->GetRect();
|
||||
|
||||
constrainedRect = constrainedRect.Intersect(qdState->m_clipRect);
|
||||
constrainedRect = constrainedRect.Intersect(lineRect);
|
||||
@@ -165,7 +357,7 @@ static void PlotLine(PortabilityLayer::QDState *qdState, PortabilityLayer::QDPor
|
||||
if (pointA.m_y > pointB.m_y)
|
||||
std::swap(upperPoint, lowerPoint);
|
||||
|
||||
PortabilityLayer::PixMapImpl *pixMap = static_cast<PortabilityLayer::PixMapImpl*>(*qdPort->GetPixMap());
|
||||
PortabilityLayer::PixMapImpl *pixMap = static_cast<PortabilityLayer::PixMapImpl*>(*port->GetPixMap());
|
||||
const size_t pitch = pixMap->GetPitch();
|
||||
uint8_t *pixData = static_cast<uint8_t*>(pixMap->GetPixelData());
|
||||
|
||||
@@ -249,14 +441,6 @@ static void PlotLine(PortabilityLayer::QDState *qdState, PortabilityLayer::QDPor
|
||||
}
|
||||
}
|
||||
|
||||
void LineTo(int x, int y)
|
||||
{
|
||||
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)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
@@ -330,38 +514,7 @@ void BackColor(SystemColorID color)
|
||||
void GetForeColor(RGBColor *color)
|
||||
{
|
||||
const PortabilityLayer::RGBAColor foreColor = PortabilityLayer::QDManager::GetInstance()->GetState()->GetForeColor();
|
||||
color->red = foreColor.r * 0x0101;
|
||||
color->green = foreColor.g * 0x0101;
|
||||
color->blue = foreColor.b * 0x0101;
|
||||
}
|
||||
|
||||
void Index2Color(int index, RGBColor *color)
|
||||
{
|
||||
PortabilityLayer::QDPort *port = PortabilityLayer::QDManager::GetInstance()->GetPort();
|
||||
|
||||
GpPixelFormat_t pf = port->GetPixelFormat();
|
||||
if (pf == GpPixelFormats::k8BitCustom)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
else
|
||||
{
|
||||
const PortabilityLayer::RGBAColor color8 = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[index];
|
||||
color->red = color8.r * 0x0101;
|
||||
color->green = color8.g * 0x0101;
|
||||
color->blue = color8.b * 0x0101;
|
||||
}
|
||||
}
|
||||
|
||||
void RGBForeColor(const RGBColor *color)
|
||||
{
|
||||
PortabilityLayer::RGBAColor truncatedColor;
|
||||
truncatedColor.r = (color->red >> 8);
|
||||
truncatedColor.g = (color->green >> 8);
|
||||
truncatedColor.b = (color->blue >> 8);
|
||||
truncatedColor.a = 255;
|
||||
|
||||
PortabilityLayer::QDManager::GetInstance()->GetState()->SetForeColor(truncatedColor);
|
||||
*color = RGBColor(foreColor.r, foreColor.g, foreColor.b);
|
||||
}
|
||||
|
||||
static void DrawGlyph(PortabilityLayer::QDState *qdState, PixMap *pixMap, const Rect &rect, Point &penPos, const PortabilityLayer::RenderedFont *rfont, unsigned int character)
|
||||
@@ -430,48 +583,21 @@ static void DrawGlyph(PortabilityLayer::QDState *qdState, PixMap *pixMap, const
|
||||
}
|
||||
}
|
||||
|
||||
void DrawString(const PLPasStr &str)
|
||||
void DrawSurface::DrawString(const Point &point, const PLPasStr &str)
|
||||
{
|
||||
PortabilityLayer::QDManager *qdManager = PortabilityLayer::QDManager::GetInstance();
|
||||
PortabilityLayer::QDPort *port = &m_port;
|
||||
|
||||
PortabilityLayer::QDPort *port = qdManager->GetPort();
|
||||
|
||||
PortabilityLayer::QDState *qdState = qdManager->GetState();
|
||||
PortabilityLayer::QDState *qdState = m_port.GetState();
|
||||
|
||||
PortabilityLayer::FontManager *fontManager = PortabilityLayer::FontManager::GetInstance();
|
||||
|
||||
const int textSize = qdState->m_textSize;
|
||||
const int textFace = qdState->m_textFace;
|
||||
const int fontID = qdState->m_fontID;
|
||||
const int fontSize = qdState->m_fontSize;
|
||||
const int fontVariationFlags = qdState->m_fontVariationFlags;
|
||||
PortabilityLayer::FontFamily *fontFamily = qdState->m_fontFamily;
|
||||
|
||||
int variationFlags = 0;
|
||||
if (textFace & bold)
|
||||
variationFlags |= PortabilityLayer::FontFamilyFlag_Bold;
|
||||
PortabilityLayer::RenderedFont *rfont = fontManager->GetRenderedFontFromFamily(fontFamily, fontSize, fontVariationFlags);
|
||||
|
||||
const PortabilityLayer::FontFamily *fontFamily = nullptr;
|
||||
|
||||
switch (fontID)
|
||||
{
|
||||
case applFont:
|
||||
fontFamily = fontManager->GetApplicationFont(textSize, variationFlags);
|
||||
break;
|
||||
case systemFont:
|
||||
fontFamily = fontManager->GetSystemFont(textSize, variationFlags);
|
||||
break;
|
||||
default:
|
||||
PL_NotYetImplemented();
|
||||
return;
|
||||
}
|
||||
|
||||
const int realVariation = fontFamily->GetVariationForFlags(variationFlags);
|
||||
PortabilityLayer::HostFont *font = fontFamily->GetFontForVariation(realVariation);
|
||||
|
||||
if (!font)
|
||||
return;
|
||||
|
||||
PortabilityLayer::RenderedFont *rfont = fontManager->GetRenderedFont(font, textSize, fontFamily->GetHacksForVariation(realVariation));
|
||||
|
||||
Point penPos = qdState->m_penPos;
|
||||
Point penPos = point;
|
||||
const size_t len = str.Length();
|
||||
const uint8_t *chars = str.UChars();
|
||||
|
||||
@@ -486,12 +612,88 @@ void DrawString(const PLPasStr &str)
|
||||
DrawGlyph(qdState, pixMap, rect, penPos, rfont, chars[i]);
|
||||
}
|
||||
|
||||
void PaintRectWithPCR(const Rect &rect, PaintColorResolution pcr)
|
||||
|
||||
void DrawSurface::DrawPicture(THandle<Picture> pictHdl, const Rect &bounds)
|
||||
{
|
||||
if (!pictHdl)
|
||||
return;
|
||||
|
||||
Picture *picPtr = *pictHdl;
|
||||
if (!picPtr)
|
||||
return;
|
||||
|
||||
const Rect picRect = picPtr->picFrame.ToRect();
|
||||
|
||||
if (bounds.right - bounds.left != picRect.right - picRect.left || bounds.bottom - bounds.top != picRect.bottom - picRect.top)
|
||||
{
|
||||
// Scaled pict draw (not supported)
|
||||
assert(false);
|
||||
return;
|
||||
}
|
||||
|
||||
PortabilityLayer::QDPort *port = &m_port;
|
||||
|
||||
if (!port)
|
||||
return;
|
||||
|
||||
PortabilityLayer::PixMapImpl *pixMap = static_cast<PortabilityLayer::PixMapImpl*>(*port->GetPixMap());
|
||||
|
||||
long handleSize = pictHdl.MMBlock()->m_size;
|
||||
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())
|
||||
{
|
||||
case GpPixelFormats::kBW1:
|
||||
case GpPixelFormats::k8BitStandard:
|
||||
{
|
||||
PortabilityLayer::PixMapBlitEmitter blitEmitter(drawOrigin, pixMap);
|
||||
PortabilityLayer::QDPictDecoder decoder;
|
||||
|
||||
decoder.DecodePict(&stream, &blitEmitter);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// TODO: Implement higher-resolution pixel blitters
|
||||
assert(false);
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
void DrawSurface::SetPattern8x8(const uint8_t *pattern)
|
||||
{
|
||||
m_port.GetState()->SetPenPattern8x8(pattern);
|
||||
}
|
||||
|
||||
void DrawSurface::ClearPattern()
|
||||
{
|
||||
m_port.GetState()->SetPenPattern8x8(nullptr);
|
||||
}
|
||||
|
||||
void DrawSurface::SetMaskMode(bool maskMode)
|
||||
{
|
||||
m_port.GetState()->m_penMask = maskMode;
|
||||
}
|
||||
|
||||
Rect DrawSurface::GetClipRect() const
|
||||
{
|
||||
return m_port.GetState()->m_clipRect;
|
||||
}
|
||||
|
||||
void DrawSurface::SetClipRect(const Rect &rect)
|
||||
{
|
||||
m_port.GetState()->m_clipRect = rect;;
|
||||
}
|
||||
|
||||
void DrawSurface::FillRect(const Rect &rect)
|
||||
{
|
||||
if (!rect.IsValid())
|
||||
return;
|
||||
|
||||
PortabilityLayer::QDPort *qdPort = PortabilityLayer::QDManager::GetInstance()->GetPort();
|
||||
PortabilityLayer::QDPort *qdPort = &m_port;
|
||||
|
||||
GpPixelFormat_t pixelFormat = qdPort->GetPixelFormat();
|
||||
|
||||
@@ -515,19 +717,7 @@ void PaintRectWithPCR(const Rect &rect, PaintColorResolution pcr)
|
||||
{
|
||||
case GpPixelFormats::k8BitStandard:
|
||||
{
|
||||
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;
|
||||
}
|
||||
const uint8_t color = qdState->ResolveForeColor8(nullptr, 0);
|
||||
|
||||
size_t scanlineIndex = 0;
|
||||
for (size_t ln = 0; ln < numLines; ln++)
|
||||
@@ -544,18 +734,43 @@ void PaintRectWithPCR(const Rect &rect, PaintColorResolution pcr)
|
||||
}
|
||||
}
|
||||
|
||||
void PaintRect(const Rect *rect)
|
||||
void DrawSurface::FillRectWithPattern8x8(const Rect &rect, const uint8_t *pattern)
|
||||
{
|
||||
PaintRectWithPCR(*rect, PaintColorResolution_Fore);
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
|
||||
|
||||
void PaintOval(const Rect *rect)
|
||||
void DrawSurface::SetApplicationFont(int size, int variationFlags)
|
||||
{
|
||||
if (!rect->IsValid())
|
||||
PortabilityLayer::FontFamily *fontFamily = PortabilityLayer::FontManager::GetInstance()->GetApplicationFont(size, variationFlags);
|
||||
if (!fontFamily)
|
||||
return;
|
||||
|
||||
PortabilityLayer::ScanlineMask *mask = PortabilityLayer::ScanlineMaskConverter::CompileEllipse(PortabilityLayer::Rect2i(rect->top, rect->left, rect->bottom, rect->right));
|
||||
PortabilityLayer::QDState *qdState = m_port.GetState();
|
||||
|
||||
qdState->m_fontFamily = fontFamily;
|
||||
qdState->m_fontSize = size;
|
||||
qdState->m_fontVariationFlags = variationFlags;
|
||||
}
|
||||
|
||||
void DrawSurface::SetSystemFont(int size, int variationFlags)
|
||||
{
|
||||
PortabilityLayer::FontFamily *fontFamily = PortabilityLayer::FontManager::GetInstance()->GetSystemFont(size, variationFlags);
|
||||
if (!fontFamily)
|
||||
return;
|
||||
|
||||
PortabilityLayer::QDState *qdState = m_port.GetState();
|
||||
|
||||
qdState->m_fontFamily = fontFamily;
|
||||
qdState->m_fontSize = size;
|
||||
qdState->m_fontVariationFlags = variationFlags;
|
||||
}
|
||||
|
||||
void DrawSurface::FillEllipse(const Rect &rect)
|
||||
{
|
||||
if (!rect.IsValid())
|
||||
return;
|
||||
|
||||
PortabilityLayer::ScanlineMask *mask = PortabilityLayer::ScanlineMaskConverter::CompileEllipse(PortabilityLayer::Rect2i(rect.top, rect.left, rect.bottom, rect.right));
|
||||
if (mask)
|
||||
{
|
||||
FillScanlineMask(mask);
|
||||
@@ -563,6 +778,11 @@ void PaintOval(const Rect *rect)
|
||||
}
|
||||
}
|
||||
|
||||
void DrawSurface::FrameEllipse(const Rect &rect)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
|
||||
static void FillScanlineSpan(uint8_t *rowStart, size_t startCol, size_t endCol, uint8_t patternByte, uint8_t foreColor, uint8_t bgColor, bool mask)
|
||||
{
|
||||
if (patternByte == 0xff)
|
||||
@@ -593,15 +813,14 @@ static void FillScanlineSpan(uint8_t *rowStart, size_t startCol, size_t endCol,
|
||||
}
|
||||
}
|
||||
|
||||
void FillScanlineMask(const PortabilityLayer::ScanlineMask *scanlineMask)
|
||||
void DrawSurface::FillScanlineMask(const PortabilityLayer::ScanlineMask *scanlineMask)
|
||||
{
|
||||
if (!scanlineMask)
|
||||
return;
|
||||
|
||||
PortabilityLayer::QDManager *qdManager = PortabilityLayer::QDManager::GetInstance();
|
||||
PortabilityLayer::QDState *qdState = qdManager->GetState();
|
||||
PortabilityLayer::QDPort *port = &m_port;
|
||||
PortabilityLayer::QDState *qdState = port->GetState();
|
||||
|
||||
const PortabilityLayer::QDPort *port = qdManager->GetPort();
|
||||
PixMap *pixMap = *port->GetPixMap();
|
||||
const Rect portRect = port->GetRect();
|
||||
const Rect maskRect = scanlineMask->GetRect();
|
||||
@@ -742,6 +961,17 @@ void FillScanlineMask(const PortabilityLayer::ScanlineMask *scanlineMask)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DrawSurface::DrawLine(const Point &a, const Point &b)
|
||||
{
|
||||
PlotLine(m_port.GetState(), this, PortabilityLayer::Vec2i(a.h, a.v), PortabilityLayer::Vec2i(b.h, b.v));
|
||||
}
|
||||
|
||||
void DrawSurface::InvertDrawLine(const Point &a, const Point &b, const uint8_t *pattern)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
|
||||
void GetClip(Rect *rect)
|
||||
{
|
||||
PortabilityLayer::QDState *qdState = PortabilityLayer::QDManager::GetInstance()->GetState();
|
||||
@@ -757,42 +987,67 @@ void ClipRect(const Rect *rect)
|
||||
qdState->m_clipRect = *rect;
|
||||
}
|
||||
|
||||
void FrameRect(const Rect *rect)
|
||||
void DrawSurface::FrameRect(const Rect &rect)
|
||||
{
|
||||
if (!rect->IsValid())
|
||||
if (!rect.IsValid())
|
||||
return;
|
||||
|
||||
uint16_t width = rect->right - rect->left;
|
||||
uint16_t height = rect->bottom - rect->top;
|
||||
uint16_t width = rect.right - rect.left;
|
||||
uint16_t height = rect.bottom - rect.top;
|
||||
|
||||
if (width <= 2 || height <= 2)
|
||||
PaintRect(rect);
|
||||
FillRect(rect);
|
||||
else
|
||||
{
|
||||
// This is stupid, especially in the vertical case, but oh well
|
||||
Rect edgeRect;
|
||||
|
||||
edgeRect = *rect;
|
||||
edgeRect = rect;
|
||||
edgeRect.right = edgeRect.left + 1;
|
||||
PaintRect(&edgeRect);
|
||||
FillRect(edgeRect);
|
||||
|
||||
edgeRect = *rect;
|
||||
edgeRect = rect;
|
||||
edgeRect.left = edgeRect.right - 1;
|
||||
PaintRect(&edgeRect);
|
||||
FillRect(edgeRect);
|
||||
|
||||
edgeRect = *rect;
|
||||
edgeRect = rect;
|
||||
edgeRect.bottom = edgeRect.top + 1;
|
||||
PaintRect(&edgeRect);
|
||||
FillRect(edgeRect);
|
||||
|
||||
edgeRect = *rect;
|
||||
edgeRect = rect;
|
||||
edgeRect.top = edgeRect.bottom - 1;
|
||||
PaintRect(&edgeRect);
|
||||
FillRect(edgeRect);
|
||||
}
|
||||
}
|
||||
|
||||
void FrameOval(const Rect *rect)
|
||||
void DrawSurface::InvertFrameRect(const Rect &rect, const uint8_t *pattern)
|
||||
{
|
||||
PL_NotYetImplemented_TODO("Editor");
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
|
||||
void DrawSurface::InvertFillRect(const Rect &rect, const uint8_t *pattern)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
|
||||
void DrawSurface::SetForeColor(const PortabilityLayer::RGBAColor &color)
|
||||
{
|
||||
m_port.GetState()->SetForeColor(color);
|
||||
}
|
||||
|
||||
const PortabilityLayer::RGBAColor &DrawSurface::GetForeColor() const
|
||||
{
|
||||
return m_port.GetState()->GetForeColor();
|
||||
}
|
||||
|
||||
void DrawSurface::SetBackColor(const PortabilityLayer::RGBAColor &color)
|
||||
{
|
||||
m_port.GetState()->SetBackColor(color);
|
||||
}
|
||||
|
||||
const PortabilityLayer::RGBAColor &DrawSurface::GetBackColor() const
|
||||
{
|
||||
return m_port.GetState()->GetBackColor();
|
||||
}
|
||||
|
||||
void FrameRoundRect(const Rect *rect, int w, int h)
|
||||
@@ -830,11 +1085,6 @@ void PenNormal()
|
||||
qdState->m_penMask = false;
|
||||
}
|
||||
|
||||
void EraseRect(const Rect *rect)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
|
||||
void InvertRect(const Rect *rect)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
@@ -848,21 +1098,6 @@ void InsetRect(Rect *rect, int x, int y)
|
||||
rect->bottom -= y;
|
||||
}
|
||||
|
||||
void Line(int x, int y)
|
||||
{
|
||||
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)
|
||||
{
|
||||
uint8_t *patternBytes = *pattern;
|
||||
@@ -1120,12 +1355,12 @@ void CopyMask(const BitMap *srcBitmap, const BitMap *maskBitmap, BitMap *destBit
|
||||
CopyBitsComplete(srcBitmap, maskBitmap, destBitmap, srcRectBase, maskRectBase, destRectBase, nullptr);
|
||||
}
|
||||
|
||||
BitMap *GetPortBitMapForCopyBits(CGrafPtr grafPtr)
|
||||
BitMap *GetPortBitMapForCopyBits(DrawSurface *grafPtr)
|
||||
{
|
||||
return *grafPtr->m_port.GetPixMap();
|
||||
}
|
||||
|
||||
CGrafPtr GetWindowPort(WindowPtr window)
|
||||
DrawSurface *GetWindowPort(WindowPtr window)
|
||||
{
|
||||
return &window->m_graf;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
#pragma once
|
||||
#ifndef __PL_QUICKDRAW_H__
|
||||
#define __PL_QUICKDRAW_H__
|
||||
|
||||
#include "PLCore.h"
|
||||
#include "QDGraf.h"
|
||||
@@ -70,11 +68,20 @@ struct BitMap
|
||||
void Init(const Rect &rect, GpPixelFormat_t pixelFormat, size_t pitch, void *dataPtr);
|
||||
};
|
||||
|
||||
struct RGBColor
|
||||
class RGBColor
|
||||
{
|
||||
unsigned short red;
|
||||
unsigned short green;
|
||||
unsigned short blue;
|
||||
public:
|
||||
RGBColor(uint8_t r, uint8_t g, uint8_t b);
|
||||
RGBColor(const RGBColor &other);
|
||||
|
||||
uint8_t GetRed() const;
|
||||
uint8_t GetGreen() const;
|
||||
uint8_t GetBlue() const;
|
||||
|
||||
private:
|
||||
uint8_t m_r;
|
||||
uint8_t m_g;
|
||||
uint8_t m_b;
|
||||
};
|
||||
|
||||
typedef CIcon *CIconPtr;
|
||||
@@ -90,7 +97,6 @@ void SetPort(GrafPtr graf);
|
||||
void SetPortWindowPort(WindowPtr window);
|
||||
void SetPortDialogPort(Dialog *dialog);
|
||||
|
||||
void BeginUpdate(WindowPtr graf);
|
||||
void EndUpdate(WindowPtr graf);
|
||||
|
||||
PLError_t GetIconSuite(Handle *suite, short resID, IconSuiteFlags flags);
|
||||
@@ -102,27 +108,16 @@ void DisposeCIcon(CIconHandle icon);
|
||||
|
||||
void SetRect(Rect *rect, short left, short top, short right, short bottom);
|
||||
|
||||
void TextSize(int sz);
|
||||
void TextFace(int face);
|
||||
void TextFont(int fontID);
|
||||
int TextWidth(const PLPasStr &str, int firstChar1Based, int length);
|
||||
void MoveTo(int x, int y);
|
||||
void LineTo(int x, int y);
|
||||
void SetOrigin(int x, int y);
|
||||
void ForeColor(SystemColorID color);
|
||||
void BackColor(SystemColorID color);
|
||||
void GetForeColor(RGBColor *color);
|
||||
void Index2Color(int index, RGBColor *color);
|
||||
void RGBForeColor(const RGBColor *color);
|
||||
void DrawString(const PLPasStr &str);
|
||||
void PaintRect(const Rect *rect);
|
||||
void PaintOval(const Rect *rect);
|
||||
void FillScanlineMask(const PortabilityLayer::ScanlineMask *scanlineMask);
|
||||
|
||||
void ClipRect(const Rect *rect);
|
||||
void GetClip(Rect *rect);
|
||||
|
||||
void FrameRect(const Rect *rect);
|
||||
void FrameOval(const Rect *rect);
|
||||
void FrameRoundRect(const Rect *rect, int w, int h);
|
||||
void PenInvertMode(bool invertMode);
|
||||
@@ -130,10 +125,8 @@ void PenMask(bool maskMode);
|
||||
void PenPat(const Pattern *pattern);
|
||||
void PenSize(int w, int h);
|
||||
void PenNormal();
|
||||
void EraseRect(const Rect *rect);
|
||||
void InvertRect(const Rect *rect);
|
||||
void InsetRect(Rect *rect, int x, int y);
|
||||
void Line(int x, int y);
|
||||
Pattern *GetQDGlobalsGray(Pattern *pattern);
|
||||
Pattern *GetQDGlobalsBlack(Pattern *pattern);
|
||||
|
||||
@@ -150,8 +143,8 @@ void CopyMaskConstrained(const BitMap *srcBitmap, const BitMap *maskBitmap, BitM
|
||||
|
||||
bool PointInScanlineMask(Point point, PortabilityLayer::ScanlineMask *scanlineMask);
|
||||
|
||||
BitMap *GetPortBitMapForCopyBits(CGrafPtr grafPtr);
|
||||
CGrafPtr GetWindowPort(WindowPtr window);
|
||||
BitMap *GetPortBitMapForCopyBits(DrawSurface *grafPtr);
|
||||
DrawSurface *GetWindowPort(WindowPtr window);
|
||||
|
||||
// Computes A - B and returns it packed?
|
||||
Int32 DeltaPoint(Point pointA, Point pointB);
|
||||
@@ -165,4 +158,17 @@ Boolean PtInRect(Point point, const Rect *rect);
|
||||
|
||||
void RestoreDeviceClut(void *unknown);
|
||||
|
||||
#endif
|
||||
|
||||
inline RGBColor::RGBColor(uint8_t r, uint8_t g, uint8_t b)
|
||||
: m_r(r)
|
||||
, m_g(g)
|
||||
, m_b(b)
|
||||
{
|
||||
}
|
||||
|
||||
inline RGBColor::RGBColor(const RGBColor &other)
|
||||
: m_r(other.m_r)
|
||||
, m_g(other.m_g)
|
||||
, m_b(other.m_b)
|
||||
{
|
||||
}
|
||||
|
||||
27
PortabilityLayer/PLStandardColors.cpp
Normal file
27
PortabilityLayer/PLStandardColors.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "PLStandardColors.h"
|
||||
#include "RGBAColor.h"
|
||||
|
||||
PortabilityLayer::RGBAColor StdColors::Black()
|
||||
{
|
||||
return PortabilityLayer::RGBAColor::Create(0, 0, 0, 255);
|
||||
}
|
||||
|
||||
PortabilityLayer::RGBAColor StdColors::White()
|
||||
{
|
||||
return PortabilityLayer::RGBAColor::Create(255, 255, 255, 255);
|
||||
}
|
||||
|
||||
PortabilityLayer::RGBAColor StdColors::Red()
|
||||
{
|
||||
return PortabilityLayer::RGBAColor::Create(255, 0, 0, 255);
|
||||
}
|
||||
|
||||
PortabilityLayer::RGBAColor StdColors::Green()
|
||||
{
|
||||
return PortabilityLayer::RGBAColor::Create(0, 255, 0, 255);
|
||||
}
|
||||
|
||||
PortabilityLayer::RGBAColor StdColors::Blue()
|
||||
{
|
||||
return PortabilityLayer::RGBAColor::Create(0, 0, 255, 255);
|
||||
}
|
||||
16
PortabilityLayer/PLStandardColors.h
Normal file
16
PortabilityLayer/PLStandardColors.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
struct RGBAColor;
|
||||
}
|
||||
|
||||
class StdColors
|
||||
{
|
||||
public:
|
||||
static PortabilityLayer::RGBAColor Black();
|
||||
static PortabilityLayer::RGBAColor White();
|
||||
static PortabilityLayer::RGBAColor Red();
|
||||
static PortabilityLayer::RGBAColor Green();
|
||||
static PortabilityLayer::RGBAColor Blue();
|
||||
};
|
||||
@@ -138,6 +138,7 @@
|
||||
<ClInclude Include="CFileStream.h" />
|
||||
<ClInclude Include="ClientAudioChannelContext.h" />
|
||||
<ClInclude Include="DataTypes.h" />
|
||||
<ClInclude Include="DialogManager.h" />
|
||||
<ClInclude Include="DisplayDeviceManager.h" />
|
||||
<ClInclude Include="EllipsePlotter.h" />
|
||||
<ClInclude Include="FileManager.h" />
|
||||
@@ -199,6 +200,8 @@
|
||||
<ClInclude Include="PLMacTypes.h" />
|
||||
<ClInclude Include="MenuManager.h" />
|
||||
<ClInclude Include="PlotDirection.h" />
|
||||
<ClInclude Include="PLStandardColors.h" />
|
||||
<ClInclude Include="ResolvedColor.h" />
|
||||
<ClInclude Include="ScanlineMaskBuilder.h" />
|
||||
<ClInclude Include="ScanlineMaskConverter.h" />
|
||||
<ClInclude Include="QDGraf.h" />
|
||||
@@ -260,6 +263,7 @@
|
||||
<ClCompile Include="BinHex4.cpp" />
|
||||
<ClCompile Include="ByteSwap.cpp" />
|
||||
<ClCompile Include="CFileStream.cpp" />
|
||||
<ClCompile Include="DialogManager.cpp" />
|
||||
<ClCompile Include="DisplayDeviceManager.cpp" />
|
||||
<ClCompile Include="EllipsePlotter.cpp" />
|
||||
<ClCompile Include="FileManager.cpp" />
|
||||
@@ -300,6 +304,7 @@
|
||||
<ClCompile Include="PLResourceManager.cpp" />
|
||||
<ClCompile Include="PLResources.cpp" />
|
||||
<ClCompile Include="PLSound.cpp" />
|
||||
<ClCompile Include="PLStandardColors.cpp" />
|
||||
<ClCompile Include="PLStringCompare.cpp" />
|
||||
<ClCompile Include="ScanlineMask.cpp" />
|
||||
<ClCompile Include="ScanlineMaskBuilder.cpp" />
|
||||
|
||||
@@ -393,6 +393,15 @@
|
||||
<ClInclude Include="PLHandle.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DialogManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="PLStandardColors.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ResolvedColor.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CFileStream.cpp">
|
||||
@@ -596,5 +605,11 @@
|
||||
<ClCompile Include="PLHandle.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DialogManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PLStandardColors.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "IGpDisplayDriverSurface.h"
|
||||
|
||||
void CGraf::PushToDDSurface(IGpDisplayDriver *displayDriver)
|
||||
void DrawSurface::PushToDDSurface(IGpDisplayDriver *displayDriver)
|
||||
{
|
||||
const PixMap *pixMap = *m_port.GetPixMap();
|
||||
const size_t width = pixMap->m_rect.right - pixMap->m_rect.left;
|
||||
|
||||
@@ -3,23 +3,34 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "GpPixelFormat.h"
|
||||
#include "PLHandle.h"
|
||||
#include "QDState.h"
|
||||
#include "QDPort.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class FontFamily;
|
||||
struct RGBAColor;
|
||||
class ScanlineMask;
|
||||
}
|
||||
|
||||
struct PixMap;
|
||||
struct Picture;
|
||||
struct Point;
|
||||
struct Rect;
|
||||
struct IGpDisplayDriver;
|
||||
struct IGpDisplayDriverSurface;
|
||||
class PLPasStr;
|
||||
|
||||
struct CGraf final
|
||||
struct DrawSurface final
|
||||
{
|
||||
CGraf()
|
||||
: m_port(PortabilityLayer::QDPortType_CGraf)
|
||||
DrawSurface()
|
||||
: m_port(PortabilityLayer::QDPortType_DrawSurface)
|
||||
, m_ddSurface(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
explicit CGraf(PortabilityLayer::QDPortType overridePortType)
|
||||
explicit DrawSurface(PortabilityLayer::QDPortType overridePortType)
|
||||
: m_port(overridePortType)
|
||||
, m_ddSurface(nullptr)
|
||||
{
|
||||
@@ -40,6 +51,40 @@ struct CGraf final
|
||||
|
||||
void PushToDDSurface(IGpDisplayDriver *displayDriver);
|
||||
|
||||
void FillRect(const Rect &rect);
|
||||
void FillRectWithPattern8x8(const Rect &rect, const uint8_t *pattern);
|
||||
void FrameRect(const Rect &rect);
|
||||
void InvertFrameRect(const Rect &rect, const uint8_t *pattern);
|
||||
void InvertFillRect(const Rect &rect, const uint8_t *pattern);
|
||||
|
||||
void FillEllipse(const Rect &rect);
|
||||
void FrameEllipse(const Rect &rect);
|
||||
|
||||
void FillScanlineMask(const PortabilityLayer::ScanlineMask *scanlineMask);
|
||||
|
||||
void DrawLine(const Point &a, const Point &b);
|
||||
void InvertDrawLine(const Point &a, const Point &b, const uint8_t *pattern);
|
||||
|
||||
void SetForeColor(const PortabilityLayer::RGBAColor &color);
|
||||
const PortabilityLayer::RGBAColor &GetForeColor() const;
|
||||
|
||||
void SetBackColor(const PortabilityLayer::RGBAColor &color);
|
||||
const PortabilityLayer::RGBAColor &GetBackColor() const;
|
||||
|
||||
void SetApplicationFont(int size, int variationFlags);
|
||||
void SetSystemFont(int size, int variationFlags);
|
||||
void DrawString(const Point &point, const PLPasStr &str);
|
||||
|
||||
void DrawPicture(THandle<Picture> pictHandle, const Rect &rect);
|
||||
|
||||
void SetPattern8x8(const uint8_t *pattern);
|
||||
void ClearPattern();
|
||||
|
||||
void SetMaskMode(bool maskMode);
|
||||
|
||||
Rect GetClipRect() const;
|
||||
void SetClipRect(const Rect &rect);
|
||||
|
||||
// Must be the first item
|
||||
PortabilityLayer::QDPort m_port;
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ namespace PortabilityLayer
|
||||
void Init() override;
|
||||
QDPort *GetPort() const override;
|
||||
void SetPort(QDPort *gw) override;
|
||||
PLError_t NewGWorld(CGraf **gw, GpPixelFormat_t pixelFormat, const Rect &bounds, ColorTable **colorTable) override;
|
||||
void DisposeGWorld(CGraf *gw) override;
|
||||
PLError_t NewGWorld(DrawSurface **gw, GpPixelFormat_t pixelFormat, const Rect &bounds, ColorTable **colorTable) override;
|
||||
void DisposeGWorld(DrawSurface *gw) override;
|
||||
QDState *GetState() override;
|
||||
|
||||
static QDManagerImpl *GetInstance();
|
||||
@@ -49,16 +49,16 @@ namespace PortabilityLayer
|
||||
m_port = gw;
|
||||
}
|
||||
|
||||
PLError_t QDManagerImpl::NewGWorld(CGraf **gw, GpPixelFormat_t pixelFormat, const Rect &bounds, ColorTable **colorTable)
|
||||
PLError_t QDManagerImpl::NewGWorld(DrawSurface **gw, GpPixelFormat_t pixelFormat, const Rect &bounds, ColorTable **colorTable)
|
||||
{
|
||||
void *grafStorage = MemoryManager::GetInstance()->Alloc(sizeof(CGraf));
|
||||
void *grafStorage = MemoryManager::GetInstance()->Alloc(sizeof(DrawSurface));
|
||||
if (!grafStorage)
|
||||
return PLErrors::kOutOfMemory;
|
||||
|
||||
if (!bounds.IsValid())
|
||||
return PLErrors::kInvalidParameter;
|
||||
|
||||
CGraf *graf = new (grafStorage) CGraf();
|
||||
DrawSurface *graf = new (grafStorage) DrawSurface();
|
||||
PLError_t initError = graf->Init(bounds, pixelFormat);
|
||||
if (initError)
|
||||
{
|
||||
@@ -70,9 +70,9 @@ namespace PortabilityLayer
|
||||
return PLErrors::kNone;
|
||||
}
|
||||
|
||||
void QDManagerImpl::DisposeGWorld(CGraf *gw)
|
||||
void QDManagerImpl::DisposeGWorld(DrawSurface *gw)
|
||||
{
|
||||
gw->~CGraf();
|
||||
gw->~DrawSurface();
|
||||
MemoryManager::GetInstance()->Release(gw);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "PLErrorCodes.h"
|
||||
|
||||
struct ColorTable;
|
||||
struct CGraf;
|
||||
struct DrawSurface;
|
||||
struct Rect;
|
||||
|
||||
namespace PortabilityLayer
|
||||
@@ -18,8 +18,8 @@ namespace PortabilityLayer
|
||||
virtual void Init() = 0;
|
||||
virtual QDPort *GetPort() const = 0;
|
||||
virtual void SetPort(QDPort *gw) = 0;
|
||||
virtual PLError_t NewGWorld(CGraf **gw, GpPixelFormat_t pixelFormat, const Rect &bounds, ColorTable **colorTable) = 0;
|
||||
virtual void DisposeGWorld(CGraf *gw) = 0;
|
||||
virtual PLError_t NewGWorld(DrawSurface **gw, GpPixelFormat_t pixelFormat, const Rect &bounds, ColorTable **colorTable) = 0;
|
||||
virtual void DisposeGWorld(DrawSurface *gw) = 0;
|
||||
|
||||
virtual QDState *GetState() = 0;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace PortabilityLayer
|
||||
{
|
||||
QDPortType_Invalid,
|
||||
|
||||
QDPortType_CGraf,
|
||||
QDPortType_DrawSurface,
|
||||
QDPortType_Window,
|
||||
};
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
QDState::QDState()
|
||||
: m_fontID(applFont)
|
||||
, m_textSize(12)
|
||||
, m_textFace(0)
|
||||
: m_fontFamily(nullptr)
|
||||
, m_fontSize(12)
|
||||
, m_fontVariationFlags(0)
|
||||
, m_foreResolvedColor16(0)
|
||||
, m_backResolvedColor16(0)
|
||||
, m_foreResolvedColor8(0)
|
||||
|
||||
@@ -5,13 +5,15 @@
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class FontFamily;
|
||||
|
||||
struct QDState
|
||||
{
|
||||
QDState();
|
||||
|
||||
int m_fontID;
|
||||
int m_textFace;
|
||||
int m_textSize;
|
||||
FontFamily *m_fontFamily;
|
||||
int m_fontVariationFlags;
|
||||
int m_fontSize;
|
||||
Rect m_clipRect;
|
||||
Point m_penPos;
|
||||
bool m_penInvert;
|
||||
|
||||
9
PortabilityLayer/ResolvedColor.h
Normal file
9
PortabilityLayer/ResolvedColor.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include "RGBAColor.h"
|
||||
|
||||
union ResolvedColor
|
||||
{
|
||||
uint8_t m_indexed;
|
||||
PortabilityLayer::RGBAColor m_rgba;
|
||||
};
|
||||
@@ -9,6 +9,11 @@ struct Point
|
||||
{
|
||||
int16_t v;
|
||||
int16_t h;
|
||||
|
||||
Point operator-(const Point &other) const;
|
||||
Point operator+(const Point &other) const;
|
||||
|
||||
static Point Create(int16_t h, int16_t v);
|
||||
};
|
||||
|
||||
struct Rect
|
||||
@@ -21,7 +26,9 @@ struct Rect
|
||||
bool IsValid() const;
|
||||
Rect Intersect(const Rect &rect) const;
|
||||
Rect MakeValid() const;
|
||||
|
||||
static Rect Create(int16_t top, int16_t left, int16_t bottom, int16_t right);
|
||||
static Rect CreateFromPoints(const Point &topLeft, const Point &bottomRight);
|
||||
};
|
||||
|
||||
struct BERect
|
||||
@@ -93,6 +100,25 @@ struct GDevice
|
||||
bool paletteIsDirty;
|
||||
};
|
||||
|
||||
inline Point Point::operator-(const Point &other) const
|
||||
{
|
||||
return Point::Create(this->h - other.h, this->v - other.v);
|
||||
}
|
||||
|
||||
inline Point Point::operator+(const Point &other) const
|
||||
{
|
||||
return Point::Create(this->h + other.h, this->v + other.v);
|
||||
}
|
||||
|
||||
inline Point Point::Create(int16_t h, int16_t v)
|
||||
{
|
||||
Point p;
|
||||
p.h = h;
|
||||
p.v = v;
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
inline bool Rect::IsValid() const
|
||||
{
|
||||
return this->top <= this->bottom && this->left <= this->right;
|
||||
@@ -136,3 +162,8 @@ inline Rect Rect::Create(int16_t top, int16_t left, int16_t bottom, int16_t righ
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
inline Rect Rect::CreateFromPoints(const Point &topLeft, const Point &bottomRight)
|
||||
{
|
||||
return Rect::Create(topLeft.v, topLeft.h, bottomRight.v, bottomRight.h);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ namespace PortabilityLayer
|
||||
void ShowWindow(Window *window) override;
|
||||
void HideWindow(Window *window) override;
|
||||
void FindWindow(const Point &point, Window **outWindow, short *outRegion) const override;
|
||||
void DestroyWindow(Window *window) override;
|
||||
|
||||
void RenderFrame(IGpDisplayDriver *displayDriver) override;
|
||||
|
||||
@@ -236,7 +237,6 @@ namespace PortabilityLayer
|
||||
// outRegion = One of:
|
||||
/*
|
||||
inMenuBar,
|
||||
inSysWindow,
|
||||
inContent,
|
||||
inDrag,
|
||||
inGrow,
|
||||
@@ -285,6 +285,16 @@ namespace PortabilityLayer
|
||||
*outRegion = 0;
|
||||
}
|
||||
|
||||
void WindowManagerImpl::DestroyWindow(Window *window)
|
||||
{
|
||||
WindowImpl *windowImpl = static_cast<WindowImpl*>(window);
|
||||
|
||||
DetachWindow(window);
|
||||
|
||||
windowImpl->~WindowImpl();
|
||||
PortabilityLayer::MemoryManager::GetInstance()->Release(windowImpl);
|
||||
}
|
||||
|
||||
void WindowManagerImpl::RenderFrame(IGpDisplayDriver *displayDriver)
|
||||
{
|
||||
PortabilityLayer::DisplayDeviceManager *dd = PortabilityLayer::DisplayDeviceManager::GetInstance();
|
||||
@@ -342,7 +352,7 @@ namespace PortabilityLayer
|
||||
|
||||
void WindowManagerImpl::RenderWindow(WindowImpl *window, IGpDisplayDriver *displayDriver)
|
||||
{
|
||||
CGraf &graf = window->m_graf;
|
||||
DrawSurface &graf = window->m_graf;
|
||||
|
||||
graf.PushToDDSurface(displayDriver);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
struct Window;
|
||||
struct CGraf;
|
||||
struct DrawSurface;
|
||||
struct GDevice;
|
||||
struct IGpDisplayDriver;
|
||||
struct Point;
|
||||
@@ -22,6 +22,7 @@ namespace PortabilityLayer
|
||||
virtual void ShowWindow(Window *window) = 0;
|
||||
virtual void HideWindow(Window *window) = 0;
|
||||
virtual void FindWindow(const Point &point, Window **outWindow, short *outRegion) const = 0;
|
||||
virtual void DestroyWindow(Window *window) = 0;
|
||||
|
||||
virtual void RenderFrame(IGpDisplayDriver *displayDriver) = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user