mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 06:53:43 +00:00
Fix more dynamics, fix end screen stars with large vertical resolutions
This commit is contained in:
@@ -94,6 +94,11 @@ void GpAppEnvironment::Render()
|
|||||||
GpAppInterface_Get()->PL_Render(m_displayDriver);
|
GpAppInterface_Get()->PL_Render(m_displayDriver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GpAppEnvironment::AdjustRequestedResolution(unsigned int &width, unsigned int &height)
|
||||||
|
{
|
||||||
|
GpAppInterface_Get()->PL_AdjustRequestedResolution(width, height);
|
||||||
|
}
|
||||||
|
|
||||||
void GpAppEnvironment::SetDisplayDriver(IGpDisplayDriver *displayDriver)
|
void GpAppEnvironment::SetDisplayDriver(IGpDisplayDriver *displayDriver)
|
||||||
{
|
{
|
||||||
m_displayDriver = displayDriver;
|
m_displayDriver = displayDriver;
|
||||||
|
@@ -28,6 +28,7 @@ public:
|
|||||||
|
|
||||||
GpDisplayDriverTickStatus_t Tick(IGpFiber *vosFiber);
|
GpDisplayDriverTickStatus_t Tick(IGpFiber *vosFiber);
|
||||||
void Render();
|
void Render();
|
||||||
|
void AdjustRequestedResolution(unsigned int &width, unsigned int &height);
|
||||||
|
|
||||||
void SetDisplayDriver(IGpDisplayDriver *displayDriver);
|
void SetDisplayDriver(IGpDisplayDriver *displayDriver);
|
||||||
void SetAudioDriver(IGpAudioDriver *audioDriver);
|
void SetAudioDriver(IGpAudioDriver *audioDriver);
|
||||||
|
@@ -27,6 +27,11 @@ namespace
|
|||||||
{
|
{
|
||||||
static_cast<GpAppEnvironment*>(context)->Render();
|
static_cast<GpAppEnvironment*>(context)->Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AdjustRequestedResolution(void *context, unsigned int &width, unsigned int &height)
|
||||||
|
{
|
||||||
|
static_cast<GpAppEnvironment*>(context)->AdjustRequestedResolution(width, height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int GpMain::Run()
|
int GpMain::Run()
|
||||||
@@ -52,6 +57,9 @@ int GpMain::Run()
|
|||||||
ddProps.m_renderFunc = RenderAppEnvironment;
|
ddProps.m_renderFunc = RenderAppEnvironment;
|
||||||
ddProps.m_renderFuncContext = appEnvironment;
|
ddProps.m_renderFuncContext = appEnvironment;
|
||||||
|
|
||||||
|
ddProps.m_adjustRequestedResolutionFunc = AdjustRequestedResolution;
|
||||||
|
ddProps.m_adjustRequestedResolutionFuncContext = appEnvironment;
|
||||||
|
|
||||||
ddProps.m_type = g_gpGlobalConfig.m_displayDriverType;
|
ddProps.m_type = g_gpGlobalConfig.m_displayDriverType;
|
||||||
ddProps.m_osGlobals = g_gpGlobalConfig.m_osGlobals;
|
ddProps.m_osGlobals = g_gpGlobalConfig.m_osGlobals;
|
||||||
ddProps.m_eventQueue = eventQueue;
|
ddProps.m_eventQueue = eventQueue;
|
||||||
|
@@ -149,10 +149,10 @@ static void UpdateMainPict (Dialog *theDial)
|
|||||||
DrawDialogUserText2(theDial, 7, theStr);
|
DrawDialogUserText2(theDial, 7, theStr);
|
||||||
|
|
||||||
PasStringCopy(PSTR("Screen: "), theStr); // display screen size/depth
|
PasStringCopy(PSTR("Screen: "), theStr); // display screen size/depth
|
||||||
NumToString((long)(thisMac.screen.right - thisMac.screen.left), theStr2);
|
NumToString((long)(thisMac.fullScreen.right - thisMac.fullScreen.left), theStr2);
|
||||||
PasStringConcat(theStr, theStr2);
|
PasStringConcat(theStr, theStr2);
|
||||||
PasStringConcat(theStr, PSTR("x"));
|
PasStringConcat(theStr, PSTR("x"));
|
||||||
NumToString((long)(thisMac.screen.bottom - thisMac.screen.top), theStr2);
|
NumToString((long)(thisMac.fullScreen.bottom - thisMac.fullScreen.top), theStr2);
|
||||||
PasStringConcat(theStr, theStr2);
|
PasStringConcat(theStr, theStr2);
|
||||||
PasStringConcat(theStr, PSTR("x"));
|
PasStringConcat(theStr, PSTR("x"));
|
||||||
NumToString((long)thisMac.isDepth, theStr2);
|
NumToString((long)thisMac.isDepth, theStr2);
|
||||||
|
@@ -50,7 +50,7 @@ void DrawBanner (Point *topLeft)
|
|||||||
PLError_t theErr;
|
PLError_t theErr;
|
||||||
|
|
||||||
QSetRect(&wholePage, 0, 0, 330, 220);
|
QSetRect(&wholePage, 0, 0, 330, 220);
|
||||||
mapBounds = thisMac.screen;
|
mapBounds = thisMac.fullScreen;
|
||||||
ZeroRectCorner(&mapBounds);
|
ZeroRectCorner(&mapBounds);
|
||||||
CenterRectInRect(&wholePage, &mapBounds);
|
CenterRectInRect(&wholePage, &mapBounds);
|
||||||
topLeft->h = wholePage.left;
|
topLeft->h = wholePage.left;
|
||||||
@@ -203,8 +203,8 @@ void DisplayStarsRemaining (void)
|
|||||||
DrawSurface *surface = mainWindow->GetDrawSurface();
|
DrawSurface *surface = mainWindow->GetDrawSurface();
|
||||||
|
|
||||||
QSetRect(&bounds, 0, 0, 256, 64);
|
QSetRect(&bounds, 0, 0, 256, 64);
|
||||||
CenterRectInRect(&bounds, &thisMac.screen);
|
CenterRectInRect(&bounds, &thisMac.fullScreen);
|
||||||
QOffsetRect(&bounds, -thisMac.screen.left, -thisMac.screen.top);
|
QOffsetRect(&bounds, -thisMac.fullScreen.left, -thisMac.fullScreen.top);
|
||||||
src = bounds;
|
src = bounds;
|
||||||
InsetRect(&src, 64, 32);
|
InsetRect(&src, 64, 32);
|
||||||
|
|
||||||
|
@@ -482,56 +482,74 @@ short AddDynamicObject (short what, Rect *where, objectType *who,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case kBalloon:
|
case kBalloon:
|
||||||
dinahs[dynIndex].dest = balloonSrc[0];
|
|
||||||
ZeroRectCorner(&dinahs[dynIndex].dest);
|
|
||||||
QOffsetRect(&dinahs[dynIndex].dest, where->left, 0);
|
|
||||||
dinahs[dynIndex].dest.bottom = kBalloonStart;
|
|
||||||
dinahs[dynIndex].dest.top = dinahs[dynIndex].dest.bottom -
|
|
||||||
RectTall(&balloonSrc[0]);
|
|
||||||
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
|
|
||||||
|
|
||||||
if (!keepExisting)
|
|
||||||
{
|
{
|
||||||
dinahs[dynIndex].hVel = 0;
|
short baselineDelta = 0;
|
||||||
dinahs[dynIndex].vVel = -2;
|
if (keepExisting)
|
||||||
dinahs[dynIndex].count = ((short)who->data.h.delay * 6) / kTicksPerFrame;
|
baselineDelta = dinahs[dynIndex].dest.bottom - kBalloonStart;
|
||||||
dinahs[dynIndex].frame = 0;
|
|
||||||
dinahs[dynIndex].timer = dinahs[dynIndex].count;
|
dinahs[dynIndex].dest = balloonSrc[0];
|
||||||
dinahs[dynIndex].position = 0;
|
ZeroRectCorner(&dinahs[dynIndex].dest);
|
||||||
dinahs[dynIndex].room = room;
|
QOffsetRect(&dinahs[dynIndex].dest, where->left, 0);
|
||||||
dinahs[dynIndex].byte0 = (Byte)index;
|
dinahs[dynIndex].dest.bottom = kBalloonStart + baselineDelta;
|
||||||
dinahs[dynIndex].byte1 = 0;
|
dinahs[dynIndex].dest.top = dinahs[dynIndex].dest.bottom -
|
||||||
dinahs[dynIndex].moving = false;
|
RectTall(&balloonSrc[0]);
|
||||||
dinahs[dynIndex].active = isOn; // initially idle
|
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
|
||||||
|
|
||||||
|
if (!keepExisting)
|
||||||
|
{
|
||||||
|
dinahs[dynIndex].hVel = 0;
|
||||||
|
dinahs[dynIndex].vVel = -2;
|
||||||
|
dinahs[dynIndex].count = ((short)who->data.h.delay * 6) / kTicksPerFrame;
|
||||||
|
dinahs[dynIndex].frame = 0;
|
||||||
|
dinahs[dynIndex].timer = dinahs[dynIndex].count;
|
||||||
|
dinahs[dynIndex].position = 0;
|
||||||
|
dinahs[dynIndex].room = room;
|
||||||
|
dinahs[dynIndex].byte0 = (Byte)index;
|
||||||
|
dinahs[dynIndex].byte1 = 0;
|
||||||
|
dinahs[dynIndex].moving = false;
|
||||||
|
dinahs[dynIndex].active = isOn; // initially idle
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kCopterLf:
|
case kCopterLf:
|
||||||
case kCopterRt:
|
case kCopterRt:
|
||||||
dinahs[dynIndex].dest = copterSrc[0];
|
|
||||||
ZeroRectCorner(&dinahs[dynIndex].dest);
|
|
||||||
QOffsetRect(&dinahs[dynIndex].dest, where->left, 0);
|
|
||||||
dinahs[dynIndex].dest.top = kCopterStart;
|
|
||||||
dinahs[dynIndex].dest.bottom = dinahs[dynIndex].dest.top +
|
|
||||||
RectTall(&copterSrc[0]);
|
|
||||||
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
|
|
||||||
dinahs[dynIndex].position = dinahs[dynIndex].dest.left;
|
|
||||||
|
|
||||||
if (!keepExisting)
|
|
||||||
{
|
{
|
||||||
if (what == kCopterLf)
|
short baselineDeltaH = 0;
|
||||||
dinahs[dynIndex].hVel = -1;
|
short baselineDeltaV = 0;
|
||||||
else
|
|
||||||
dinahs[dynIndex].hVel = 1;
|
if (keepExisting)
|
||||||
dinahs[dynIndex].vVel = 2;
|
{
|
||||||
dinahs[dynIndex].count = ((short)who->data.h.delay * 6) / kTicksPerFrame;
|
baselineDeltaH = dinahs[dynIndex].dest.left - dinahs[dynIndex].position;
|
||||||
dinahs[dynIndex].frame = 0;
|
baselineDeltaV = dinahs[dynIndex].dest.top - kCopterStart;
|
||||||
dinahs[dynIndex].timer = dinahs[dynIndex].count;
|
}
|
||||||
dinahs[dynIndex].room = room;
|
|
||||||
dinahs[dynIndex].byte0 = (Byte)index;
|
dinahs[dynIndex].dest = copterSrc[0];
|
||||||
dinahs[dynIndex].byte1 = 0;
|
ZeroRectCorner(&dinahs[dynIndex].dest);
|
||||||
dinahs[dynIndex].moving = false;
|
QOffsetRect(&dinahs[dynIndex].dest, where->left, 0);
|
||||||
dinahs[dynIndex].active = isOn; // initially idle
|
dinahs[dynIndex].dest.top = kCopterStart + baselineDeltaV;
|
||||||
|
dinahs[dynIndex].dest.bottom = dinahs[dynIndex].dest.top +
|
||||||
|
RectTall(&copterSrc[0]);
|
||||||
|
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
|
||||||
|
|
||||||
|
if (!keepExisting)
|
||||||
|
{
|
||||||
|
dinahs[dynIndex].position = dinahs[dynIndex].dest.left;
|
||||||
|
|
||||||
|
if (what == kCopterLf)
|
||||||
|
dinahs[dynIndex].hVel = -1;
|
||||||
|
else
|
||||||
|
dinahs[dynIndex].hVel = 1;
|
||||||
|
dinahs[dynIndex].vVel = 2;
|
||||||
|
dinahs[dynIndex].count = ((short)who->data.h.delay * 6) / kTicksPerFrame;
|
||||||
|
dinahs[dynIndex].frame = 0;
|
||||||
|
dinahs[dynIndex].timer = dinahs[dynIndex].count;
|
||||||
|
dinahs[dynIndex].room = room;
|
||||||
|
dinahs[dynIndex].byte0 = (Byte)index;
|
||||||
|
dinahs[dynIndex].byte1 = 0;
|
||||||
|
dinahs[dynIndex].moving = false;
|
||||||
|
dinahs[dynIndex].active = isOn; // initially idle
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -568,93 +586,117 @@ short AddDynamicObject (short what, Rect *where, objectType *who,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case kBall:
|
case kBall:
|
||||||
dinahs[dynIndex].dest = ballSrc[0];
|
|
||||||
ZeroRectCorner(&dinahs[dynIndex].dest);
|
|
||||||
QOffsetRect(&dinahs[dynIndex].dest,
|
|
||||||
where->left, where->top);
|
|
||||||
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
|
|
||||||
dinahs[dynIndex].position = dinahs[dynIndex].dest.bottom;
|
|
||||||
|
|
||||||
if (!keepExisting)
|
|
||||||
{
|
{
|
||||||
dinahs[dynIndex].hVel = 0;
|
short baselineDelta = 0;
|
||||||
position = who->data.h.length; // reverse engineer init. vel.
|
|
||||||
velocity = 0;
|
if (keepExisting)
|
||||||
evenFrame = true;
|
baselineDelta = dinahs[dynIndex].dest.bottom - dinahs[dynIndex].position;
|
||||||
lilFrame = true;
|
|
||||||
do
|
dinahs[dynIndex].dest = ballSrc[0];
|
||||||
|
ZeroRectCorner(&dinahs[dynIndex].dest);
|
||||||
|
QOffsetRect(&dinahs[dynIndex].dest,
|
||||||
|
where->left, where->top + baselineDelta);
|
||||||
|
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
|
||||||
|
|
||||||
|
if (!keepExisting)
|
||||||
{
|
{
|
||||||
if (lilFrame)
|
dinahs[dynIndex].position = dinahs[dynIndex].dest.bottom;
|
||||||
velocity++;
|
|
||||||
lilFrame = !lilFrame;
|
dinahs[dynIndex].hVel = 0;
|
||||||
position -= velocity;
|
position = who->data.h.length; // reverse engineer init. vel.
|
||||||
} while (position > 0);
|
velocity = 0;
|
||||||
dinahs[dynIndex].vVel = -velocity;
|
evenFrame = true;
|
||||||
dinahs[dynIndex].moving = false;
|
lilFrame = true;
|
||||||
dinahs[dynIndex].count = -velocity; // count = initial velocity
|
do
|
||||||
dinahs[dynIndex].frame = 0;
|
{
|
||||||
dinahs[dynIndex].timer = 0;
|
if (lilFrame)
|
||||||
dinahs[dynIndex].room = room;
|
velocity++;
|
||||||
dinahs[dynIndex].byte0 = (Byte)index;
|
lilFrame = !lilFrame;
|
||||||
dinahs[dynIndex].byte1 = 0;
|
position -= velocity;
|
||||||
dinahs[dynIndex].active = isOn;
|
} while (position > 0);
|
||||||
|
dinahs[dynIndex].vVel = -velocity;
|
||||||
|
dinahs[dynIndex].moving = false;
|
||||||
|
dinahs[dynIndex].count = -velocity; // count = initial velocity
|
||||||
|
dinahs[dynIndex].frame = 0;
|
||||||
|
dinahs[dynIndex].timer = 0;
|
||||||
|
dinahs[dynIndex].room = room;
|
||||||
|
dinahs[dynIndex].byte0 = (Byte)index;
|
||||||
|
dinahs[dynIndex].byte1 = 0;
|
||||||
|
dinahs[dynIndex].active = isOn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kDrip:
|
case kDrip:
|
||||||
dinahs[dynIndex].dest = dripSrc[0];
|
|
||||||
CenterRectInRect(&dinahs[dynIndex].dest, where);
|
|
||||||
VOffsetRect(&dinahs[dynIndex].dest,
|
|
||||||
where->top - dinahs[dynIndex].dest.top);
|
|
||||||
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
|
|
||||||
dinahs[dynIndex].hVel = dinahs[dynIndex].dest.top; // remember
|
|
||||||
dinahs[dynIndex].position = dinahs[dynIndex].dest.top +
|
|
||||||
who->data.h.length;
|
|
||||||
|
|
||||||
if (!keepExisting)
|
|
||||||
{
|
{
|
||||||
dinahs[dynIndex].vVel = 0;
|
short baselineDelta = 0;
|
||||||
dinahs[dynIndex].count = ((short)who->data.h.delay * 6) / kTicksPerFrame;
|
|
||||||
dinahs[dynIndex].frame = 3;
|
if (keepExisting)
|
||||||
dinahs[dynIndex].timer = dinahs[dynIndex].count;
|
baselineDelta = dinahs[dynIndex].dest.top - dinahs[dynIndex].hVel;
|
||||||
dinahs[dynIndex].room = room;
|
|
||||||
dinahs[dynIndex].byte0 = (Byte)index;
|
dinahs[dynIndex].dest = dripSrc[0];
|
||||||
dinahs[dynIndex].byte1 = 0;
|
CenterRectInRect(&dinahs[dynIndex].dest, where);
|
||||||
dinahs[dynIndex].moving = false;
|
VOffsetRect(&dinahs[dynIndex].dest,
|
||||||
dinahs[dynIndex].active = isOn;
|
where->top - dinahs[dynIndex].dest.top + baselineDelta);
|
||||||
|
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
|
||||||
|
|
||||||
|
if (!keepExisting)
|
||||||
|
{
|
||||||
|
dinahs[dynIndex].hVel = dinahs[dynIndex].dest.top; // remember
|
||||||
|
dinahs[dynIndex].position = dinahs[dynIndex].dest.top +
|
||||||
|
who->data.h.length;
|
||||||
|
|
||||||
|
dinahs[dynIndex].vVel = 0;
|
||||||
|
dinahs[dynIndex].count = ((short)who->data.h.delay * 6) / kTicksPerFrame;
|
||||||
|
dinahs[dynIndex].frame = 3;
|
||||||
|
dinahs[dynIndex].timer = dinahs[dynIndex].count;
|
||||||
|
dinahs[dynIndex].room = room;
|
||||||
|
dinahs[dynIndex].byte0 = (Byte)index;
|
||||||
|
dinahs[dynIndex].byte1 = 0;
|
||||||
|
dinahs[dynIndex].moving = false;
|
||||||
|
dinahs[dynIndex].active = isOn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kFish:
|
case kFish:
|
||||||
dinahs[dynIndex].dest = fishSrc[0];
|
|
||||||
QOffsetRect(&dinahs[dynIndex].dest,
|
|
||||||
where->left + 10, where->top + 8);
|
|
||||||
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
|
|
||||||
dinahs[dynIndex].position = dinahs[dynIndex].dest.bottom;
|
|
||||||
|
|
||||||
if (!keepExisting)
|
|
||||||
{
|
{
|
||||||
dinahs[dynIndex].hVel = ((short)who->data.h.delay * 6) / kTicksPerFrame;
|
short baselineDelta = 0;
|
||||||
position = who->data.g.height; // reverse engineer init. vel.
|
|
||||||
velocity = 0;
|
if (keepExisting)
|
||||||
evenFrame = true;
|
baselineDelta = dinahs[dynIndex].dest.bottom - dinahs[dynIndex].position;
|
||||||
lilFrame = true;
|
|
||||||
do
|
dinahs[dynIndex].dest = fishSrc[0];
|
||||||
|
QOffsetRect(&dinahs[dynIndex].dest,
|
||||||
|
where->left + 10, where->top + 8 + baselineDelta);
|
||||||
|
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
|
||||||
|
|
||||||
|
if (!keepExisting)
|
||||||
{
|
{
|
||||||
if (lilFrame)
|
dinahs[dynIndex].position = dinahs[dynIndex].dest.bottom;
|
||||||
velocity++;
|
|
||||||
lilFrame = !lilFrame;
|
dinahs[dynIndex].hVel = ((short)who->data.h.delay * 6) / kTicksPerFrame;
|
||||||
position -= velocity;
|
position = who->data.g.height; // reverse engineer init. vel.
|
||||||
} while (position > 0);
|
velocity = 0;
|
||||||
dinahs[dynIndex].vVel = -velocity;
|
evenFrame = true;
|
||||||
dinahs[dynIndex].count = -velocity; // count = initial velocity
|
lilFrame = true;
|
||||||
dinahs[dynIndex].frame = 0;
|
do
|
||||||
dinahs[dynIndex].timer = dinahs[dynIndex].hVel;
|
{
|
||||||
dinahs[dynIndex].room = room;
|
if (lilFrame)
|
||||||
dinahs[dynIndex].byte0 = (Byte)index;
|
velocity++;
|
||||||
dinahs[dynIndex].byte1 = 0;
|
lilFrame = !lilFrame;
|
||||||
dinahs[dynIndex].moving = false;
|
position -= velocity;
|
||||||
dinahs[dynIndex].active = isOn;
|
} while (position > 0);
|
||||||
|
dinahs[dynIndex].vVel = -velocity;
|
||||||
|
dinahs[dynIndex].count = -velocity; // count = initial velocity
|
||||||
|
dinahs[dynIndex].frame = 0;
|
||||||
|
dinahs[dynIndex].timer = dinahs[dynIndex].hVel;
|
||||||
|
dinahs[dynIndex].room = room;
|
||||||
|
dinahs[dynIndex].byte0 = (Byte)index;
|
||||||
|
dinahs[dynIndex].byte1 = 0;
|
||||||
|
dinahs[dynIndex].moving = false;
|
||||||
|
dinahs[dynIndex].active = isOn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@@ -279,8 +279,20 @@ void FlushResolutionChange(void)
|
|||||||
{
|
{
|
||||||
if (thisMac.isResolutionDirty)
|
if (thisMac.isResolutionDirty)
|
||||||
{
|
{
|
||||||
GetDeviceRect(&thisMac.screen);
|
GetDeviceRect(&thisMac.fullScreen);
|
||||||
thisMac.gray = thisMac.screen;
|
thisMac.constrainedScreen = thisMac.fullScreen;
|
||||||
|
if (thisMac.constrainedScreen.Width() > kMaxViewWidth)
|
||||||
|
{
|
||||||
|
thisMac.constrainedScreen.left = 0;
|
||||||
|
thisMac.constrainedScreen.right = kMaxViewWidth;
|
||||||
|
}
|
||||||
|
if (thisMac.constrainedScreen.Height() > kMaxViewHeight)
|
||||||
|
{
|
||||||
|
thisMac.constrainedScreen.top = 0;
|
||||||
|
thisMac.constrainedScreen.bottom = kMaxViewHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
thisMac.gray = thisMac.fullScreen;
|
||||||
thisMac.gray.top = 20;
|
thisMac.gray.top = 20;
|
||||||
thisMac.isResolutionDirty = false;
|
thisMac.isResolutionDirty = false;
|
||||||
}
|
}
|
||||||
@@ -332,6 +344,10 @@ public:
|
|||||||
HandleResolutionChange(prevWidth, prevHeight, newWidth, newHeight);
|
HandleResolutionChange(prevWidth, prevHeight, newWidth, newHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AdjustRequestedResolution(uint32_t &width, uint32_t &height) override
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
static GpAppResolutionChangeHandler ms_instance;
|
static GpAppResolutionChangeHandler ms_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -455,7 +471,7 @@ void CheckMemorySize (void)
|
|||||||
RedAlert(kErrNoMemory);
|
RedAlert(kErrNoMemory);
|
||||||
else
|
else
|
||||||
bytesNeeded += musicBytes;
|
bytesNeeded += musicBytes;
|
||||||
bytesNeeded += 4L * (long)thisMac.screen.bottom; // main screen
|
bytesNeeded += 4L * (long)thisMac.constrainedScreen.bottom; // main screen
|
||||||
bytesNeeded += (((long)houseRect.right - (long)houseRect.left) *
|
bytesNeeded += (((long)houseRect.right - (long)houseRect.left) *
|
||||||
((long)houseRect.bottom + 1 - (long)houseRect.top) *
|
((long)houseRect.bottom + 1 - (long)houseRect.top) *
|
||||||
(long)thisMac.isDepth) / 8L; // work map
|
(long)thisMac.isDepth) / 8L; // work map
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Rect screen, gray;
|
Rect fullScreen, constrainedScreen, gray;
|
||||||
long dirID;
|
long dirID;
|
||||||
short wasDepth, isDepth;
|
short wasDepth, isDepth;
|
||||||
short numScreens;
|
short numScreens;
|
||||||
|
@@ -81,7 +81,7 @@ void HandleMouseEvent (const GpMouseInputEvent &theEvent, uint32_t tick)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case RegionIDs::kTitleBar:
|
case RegionIDs::kTitleBar:
|
||||||
PortabilityLayer::WindowManager::GetInstance()->DragWindow(whichWindow, evtPoint, thisMac.screen);
|
PortabilityLayer::WindowManager::GetInstance()->DragWindow(whichWindow, evtPoint, thisMac.fullScreen);
|
||||||
if (whichWindow == mainWindow)
|
if (whichWindow == mainWindow)
|
||||||
GetWindowLeftTop(whichWindow, &isEditH, &isEditV);
|
GetWindowLeftTop(whichWindow, &isEditH, &isEditV);
|
||||||
else if (whichWindow == mapWindow)
|
else if (whichWindow == mapWindow)
|
||||||
|
@@ -102,7 +102,7 @@ void SetUpFinalScreen (void)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
GetLineOfText(tempStr, count, subStr);
|
GetLineOfText(tempStr, count, subStr);
|
||||||
offset = ((thisMac.screen.right - thisMac.screen.left) -
|
offset = ((thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) -
|
||||||
surface->MeasureString(subStr)) / 2;
|
surface->MeasureString(subStr)) / 2;
|
||||||
|
|
||||||
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
||||||
@@ -146,6 +146,12 @@ void DoGameOverStarAnimation (void)
|
|||||||
long nextLoop;
|
long nextLoop;
|
||||||
short which, i, count, pass;
|
short which, i, count, pass;
|
||||||
Boolean noInteruption;
|
Boolean noInteruption;
|
||||||
|
|
||||||
|
short starFallSpeed = kStarFalls;
|
||||||
|
const int kStarSpacing = 32;
|
||||||
|
const int kAngelSpeed = 2;
|
||||||
|
const int kStarsReserved = 5;
|
||||||
|
const int kMaxFramesAlive = (kStarSpacing * kStarsReserved + kAngelSpeed - 1) / kAngelSpeed;
|
||||||
|
|
||||||
angelDest = angelSrcRect;
|
angelDest = angelSrcRect;
|
||||||
QOffsetRect(&angelDest, -96, 0);
|
QOffsetRect(&angelDest, -96, 0);
|
||||||
@@ -154,16 +160,19 @@ void DoGameOverStarAnimation (void)
|
|||||||
count = 0;
|
count = 0;
|
||||||
pass = 0;
|
pass = 0;
|
||||||
FlushEvents(everyEvent, 0);
|
FlushEvents(everyEvent, 0);
|
||||||
|
|
||||||
|
if (workSrcRect.bottom - angelDest.bottom > kMaxFramesAlive * starFallSpeed)
|
||||||
|
starFallSpeed = (workSrcRect.bottom - angelDest.bottom + kMaxFramesAlive - 1) / kMaxFramesAlive;
|
||||||
|
|
||||||
while (noInteruption)
|
while (noInteruption)
|
||||||
{
|
{
|
||||||
if ((angelDest.left % 32) == 0) // add a star
|
if ((angelDest.left % kStarSpacing) == 0) // add a star
|
||||||
{
|
{
|
||||||
PlayPrioritySound(kMysticSound, kMysticPriority);
|
PlayPrioritySound(kMysticSound, kMysticPriority);
|
||||||
which = angelDest.left / 32;
|
which = angelDest.left / kStarSpacing;
|
||||||
which = which % 5;
|
which = which % kStarsReserved;
|
||||||
if (which < 0)
|
if (which < 0)
|
||||||
which += 5;
|
which += kStarsReserved;
|
||||||
ZeroRectCorner(&pages[which].dest);
|
ZeroRectCorner(&pages[which].dest);
|
||||||
QOffsetRect(&pages[which].dest, angelDest.left, angelDest.bottom);
|
QOffsetRect(&pages[which].dest, angelDest.left, angelDest.bottom);
|
||||||
if (count < (which + 1))
|
if (count < (which + 1))
|
||||||
@@ -184,13 +193,13 @@ void DoGameOverStarAnimation (void)
|
|||||||
&pages[i].dest);
|
&pages[i].dest);
|
||||||
|
|
||||||
pages[i].was = pages[i].dest;
|
pages[i].was = pages[i].dest;
|
||||||
pages[i].was.top -= kStarFalls;
|
pages[i].was.top -= starFallSpeed;
|
||||||
|
|
||||||
AddRectToWorkRectsWhole(&pages[i].was);
|
AddRectToWorkRectsWhole(&pages[i].was);
|
||||||
AddRectToBackRects(&pages[i].dest);
|
AddRectToBackRects(&pages[i].dest);
|
||||||
|
|
||||||
if (pages[i].dest.top < workSrcRect.bottom)
|
if (pages[i].dest.top < workSrcRect.bottom)
|
||||||
QOffsetRect(&pages[i].dest, 0, kStarFalls);
|
QOffsetRect(&pages[i].dest, 0, starFallSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (angelDest.left <= (workSrcRect.right + 2))
|
if (angelDest.left <= (workSrcRect.right + 2))
|
||||||
@@ -199,11 +208,11 @@ void DoGameOverStarAnimation (void)
|
|||||||
(BitMap *)*GetGWorldPixMap(angelMaskMap),
|
(BitMap *)*GetGWorldPixMap(angelMaskMap),
|
||||||
(BitMap *)*GetGWorldPixMap(workSrcMap),
|
(BitMap *)*GetGWorldPixMap(workSrcMap),
|
||||||
&angelSrcRect, &angelSrcRect, &angelDest);
|
&angelSrcRect, &angelSrcRect, &angelDest);
|
||||||
angelDest.left -= 2;
|
angelDest.left -= kAngelSpeed;
|
||||||
AddRectToWorkRectsWhole(&angelDest);
|
AddRectToWorkRectsWhole(&angelDest);
|
||||||
angelDest.left += 2;
|
angelDest.left += kAngelSpeed;
|
||||||
AddRectToBackRects(&angelDest);
|
AddRectToBackRects(&angelDest);
|
||||||
QOffsetRect(&angelDest, 2, 0);
|
QOffsetRect(&angelDest, kAngelSpeed, 0);
|
||||||
pass = 0;
|
pass = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,14 +294,14 @@ void InitDiedGameOver (void)
|
|||||||
for (i = 0; i < 8; i++) // initialize dest page rects
|
for (i = 0; i < 8; i++) // initialize dest page rects
|
||||||
{
|
{
|
||||||
QSetRect(&pages[i].dest, 0, 0, 32, 32);
|
QSetRect(&pages[i].dest, 0, 0, 32, 32);
|
||||||
CenterRectInRect(&pages[i].dest, &thisMac.screen);
|
CenterRectInRect(&pages[i].dest, &thisMac.constrainedScreen);
|
||||||
QOffsetRect(&pages[i].dest, -thisMac.screen.left, -thisMac.screen.top);
|
QOffsetRect(&pages[i].dest, -thisMac.constrainedScreen.left, -thisMac.constrainedScreen.top);
|
||||||
if (i < 4)
|
if (i < 4)
|
||||||
QOffsetRect(&pages[i].dest, -kPageSpacing * (4 - i), 0);
|
QOffsetRect(&pages[i].dest, -kPageSpacing * (4 - i), 0);
|
||||||
else
|
else
|
||||||
QOffsetRect(&pages[i].dest, kPageSpacing * (i - 3), 0);
|
QOffsetRect(&pages[i].dest, kPageSpacing * (i - 3), 0);
|
||||||
QOffsetRect(&pages[i].dest, (thisMac.screen.right - thisMac.screen.left) / -2,
|
QOffsetRect(&pages[i].dest, (thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) / -2,
|
||||||
(thisMac.screen.right - thisMac.screen.left) / -2);
|
(thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) / -2);
|
||||||
if (pages[i].dest.left % 2 == 1)
|
if (pages[i].dest.left % 2 == 1)
|
||||||
QOffsetRect(&pages[i].dest, 1, 0);
|
QOffsetRect(&pages[i].dest, 1, 0);
|
||||||
pages[i].was = pages[i].dest;
|
pages[i].was = pages[i].dest;
|
||||||
@@ -308,7 +317,7 @@ void InitDiedGameOver (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pagesStuck = 0;
|
pagesStuck = 0;
|
||||||
stopPages = ((thisMac.screen.bottom - thisMac.screen.top) / 2) - 16;
|
stopPages = ((thisMac.constrainedScreen.bottom - thisMac.constrainedScreen.top) / 2) - 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------- HandlePages
|
//-------------------------------------------------------------- HandlePages
|
||||||
|
@@ -265,7 +265,7 @@
|
|||||||
#define kMaxDynamicObs 18
|
#define kMaxDynamicObs 18
|
||||||
#define kMaxMasterObjects 216 // kMaxRoomObs * 9
|
#define kMaxMasterObjects 216 // kMaxRoomObs * 9
|
||||||
#define kMaxViewWidth 1536
|
#define kMaxViewWidth 1536
|
||||||
#define kMaxViewHeight 1026
|
#define kMaxViewHeight (kTileHigh*3+20)
|
||||||
|
|
||||||
#define kSelectTool 0
|
#define kSelectTool 0
|
||||||
|
|
||||||
|
@@ -25,6 +25,7 @@ public:
|
|||||||
void PL_HostFontHandler_SetInstance(PortabilityLayer::HostFontHandler *instance) override;
|
void PL_HostFontHandler_SetInstance(PortabilityLayer::HostFontHandler *instance) override;
|
||||||
void PL_HostVOSEventQueue_SetInstance(PortabilityLayer::HostVOSEventQueue *instance) override;
|
void PL_HostVOSEventQueue_SetInstance(PortabilityLayer::HostVOSEventQueue *instance) override;
|
||||||
void PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context) override;
|
void PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context) override;
|
||||||
|
void PL_AdjustRequestedResolution(unsigned int &width, unsigned int &height) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -79,6 +80,16 @@ void GpAppInterfaceImpl::PL_InstallHostSuspendHook(PortabilityLayer::HostSuspend
|
|||||||
PortabilityLayer::InstallHostSuspendHook(hook, context);
|
PortabilityLayer::InstallHostSuspendHook(hook, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GpAppInterfaceImpl::PL_AdjustRequestedResolution(unsigned int &width, unsigned int &height)
|
||||||
|
{
|
||||||
|
uint32_t w32 = width;
|
||||||
|
uint32_t h32 = height;
|
||||||
|
PortabilityLayer::DisplayDeviceManager::GetInstance()->GetResolutionChangeHandler()->AdjustRequestedResolution(w32, h32);
|
||||||
|
width = w32;
|
||||||
|
height = h32;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static GpAppInterfaceImpl gs_application;
|
static GpAppInterfaceImpl gs_application;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -123,7 +123,7 @@ void DrawHighScores (DrawSurface *surface)
|
|||||||
PortabilityLayer::RGBAColor whiteColor = PortabilityLayer::RGBAColor::Create(255, 255, 255, 255);
|
PortabilityLayer::RGBAColor whiteColor = PortabilityLayer::RGBAColor::Create(255, 255, 255, 255);
|
||||||
PortabilityLayer::RGBAColor blueColor = PortabilityLayer::RGBAColor::Create(0, 0, 255, 255);
|
PortabilityLayer::RGBAColor blueColor = PortabilityLayer::RGBAColor::Create(0, 0, 255, 255);
|
||||||
|
|
||||||
scoreLeft = ((thisMac.screen.right - thisMac.screen.left) - kScoreWide) / 2;
|
scoreLeft = ((thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) - kScoreWide) / 2;
|
||||||
dropIt = 129 + splashOriginV;
|
dropIt = 129 + splashOriginV;
|
||||||
|
|
||||||
QSetRect(&tempRect, 0, 0, 332, 30);
|
QSetRect(&tempRect, 0, 0, 332, 30);
|
||||||
|
@@ -101,15 +101,21 @@ void GetExtraCursors (void)
|
|||||||
//-------------------------------------------------------------- RecomputeScreenRects
|
//-------------------------------------------------------------- RecomputeScreenRects
|
||||||
void RecomputeInterfaceRects (void)
|
void RecomputeInterfaceRects (void)
|
||||||
{
|
{
|
||||||
houseRect = thisMac.screen;
|
houseRect = thisMac.constrainedScreen;
|
||||||
houseRect.bottom -= kScoreboardTall;
|
houseRect.bottom -= kScoreboardTall;
|
||||||
if (houseRect.right > kMaxViewWidth)
|
if (houseRect.right > kMaxViewWidth)
|
||||||
houseRect.right = kMaxViewWidth;
|
houseRect.right = kMaxViewWidth;
|
||||||
if (houseRect.bottom > kMaxViewHeight)
|
if (houseRect.bottom > kMaxViewHeight)
|
||||||
houseRect.bottom = kMaxViewHeight;
|
houseRect.bottom = kMaxViewHeight;
|
||||||
|
|
||||||
playOriginH = (RectWide(&thisMac.screen) - kRoomWide) / 2;
|
// NOTE: This is actually buggy, since the visible area is houseRect, not screen.
|
||||||
playOriginV = (RectTall(&thisMac.screen) - kTileHigh) / 2;
|
// We preserve the buggy behavior for authenticity unless the window is very tall.
|
||||||
|
short poHeight = RectTall(&thisMac.constrainedScreen);
|
||||||
|
if (poHeight > kMaxViewHeight - kScoreboardTall)
|
||||||
|
poHeight = kMaxViewHeight - kScoreboardTall;
|
||||||
|
|
||||||
|
playOriginH = (RectWide(&thisMac.constrainedScreen) - kRoomWide) / 2;
|
||||||
|
playOriginV = (poHeight - kTileHigh) / 2;
|
||||||
|
|
||||||
for (int i = 0; i < 9; i++)
|
for (int i = 0; i < 9; i++)
|
||||||
{
|
{
|
||||||
|
@@ -204,7 +204,7 @@ void ReadInPrefs (void)
|
|||||||
doBitchDialogs = true;
|
doBitchDialogs = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((numNeighbors > 1) && (thisMac.screen.right <= 512))
|
if ((numNeighbors > 1) && (thisMac.constrainedScreen.right <= 512))
|
||||||
numNeighbors = 1;
|
numNeighbors = 1;
|
||||||
|
|
||||||
UnivGetSoundVolume(&wasVolume, thisMac.hasSM3);
|
UnivGetSoundVolume(&wasVolume, thisMac.hasSM3);
|
||||||
|
@@ -229,16 +229,16 @@ void OpenMainWindow (void)
|
|||||||
if (menuWindow == nil)
|
if (menuWindow == nil)
|
||||||
{
|
{
|
||||||
menuWindow = GetNewCWindow(kMenuWindowID, nil, kPutInFront);
|
menuWindow = GetNewCWindow(kMenuWindowID, nil, kPutInFront);
|
||||||
SizeWindow(menuWindow, RectWide(&thisMac.screen), 20, false);
|
SizeWindow(menuWindow, RectWide(&thisMac.constrainedScreen), 20, false);
|
||||||
MoveWindow(menuWindow, thisMac.screen.left,
|
MoveWindow(menuWindow, thisMac.constrainedScreen.left,
|
||||||
thisMac.screen.top, true);
|
thisMac.constrainedScreen.top, true);
|
||||||
ShowWindow(menuWindow);
|
ShowWindow(menuWindow);
|
||||||
}
|
}
|
||||||
if (boardWindow == nil)
|
if (boardWindow == nil)
|
||||||
{
|
{
|
||||||
PortabilityLayer::WindowManager *windowManager = PortabilityLayer::WindowManager::GetInstance();
|
PortabilityLayer::WindowManager *windowManager = PortabilityLayer::WindowManager::GetInstance();
|
||||||
|
|
||||||
Rect scorebarRect = thisMac.screen;
|
Rect scorebarRect = thisMac.constrainedScreen;
|
||||||
scorebarRect.bottom = scorebarRect.top + kScoreboardTall;
|
scorebarRect.bottom = scorebarRect.top + kScoreboardTall;
|
||||||
|
|
||||||
PortabilityLayer::WindowDef windowDef = PortabilityLayer::WindowDef::Create(scorebarRect, PortabilityLayer::WindowStyleFlags::kBorderless, true, 0, 0, PSTR("Scoreboard"));
|
PortabilityLayer::WindowDef windowDef = PortabilityLayer::WindowDef::Create(scorebarRect, PortabilityLayer::WindowStyleFlags::kBorderless, true, 0, 0, PSTR("Scoreboard"));
|
||||||
@@ -248,14 +248,14 @@ void OpenMainWindow (void)
|
|||||||
else
|
else
|
||||||
PL_NotYetImplemented_TODO("Errors");
|
PL_NotYetImplemented_TODO("Errors");
|
||||||
}
|
}
|
||||||
mainWindowRect = thisMac.screen;
|
mainWindowRect = thisMac.constrainedScreen;
|
||||||
ZeroRectCorner(&mainWindowRect);
|
ZeroRectCorner(&mainWindowRect);
|
||||||
mainWindowRect.bottom -= 20; // thisMac.menuHigh
|
mainWindowRect.bottom -= 20; // thisMac.menuHigh
|
||||||
mainWindow = GetNewCWindow(kMainWindowID, nil, kPutInFront);
|
mainWindow = GetNewCWindow(kMainWindowID, nil, kPutInFront);
|
||||||
SizeWindow(mainWindow, mainWindowRect.right - mainWindowRect.left,
|
SizeWindow(mainWindow, mainWindowRect.right - mainWindowRect.left,
|
||||||
mainWindowRect.bottom - mainWindowRect.top, false);
|
mainWindowRect.bottom - mainWindowRect.top, false);
|
||||||
MoveWindow(mainWindow, thisMac.screen.left,
|
MoveWindow(mainWindow, thisMac.constrainedScreen.left,
|
||||||
thisMac.screen.top + 20, true); // thisMac.menuHigh
|
thisMac.constrainedScreen.top + 20, true); // thisMac.menuHigh
|
||||||
ShowWindow(mainWindow);
|
ShowWindow(mainWindow);
|
||||||
SetPortWindowPort(mainWindow);
|
SetPortWindowPort(mainWindow);
|
||||||
|
|
||||||
@@ -267,10 +267,10 @@ void OpenMainWindow (void)
|
|||||||
mainWindowSurface->SetBackColor(StdColors::White());
|
mainWindowSurface->SetBackColor(StdColors::White());
|
||||||
mainWindowSurface->FillRect(mainWindowRect);
|
mainWindowSurface->FillRect(mainWindowRect);
|
||||||
|
|
||||||
splashOriginH = ((thisMac.screen.right - thisMac.screen.left) - 640) / 2;
|
splashOriginH = ((thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) - 640) / 2;
|
||||||
if (splashOriginH < 0)
|
if (splashOriginH < 0)
|
||||||
splashOriginH = 0;
|
splashOriginH = 0;
|
||||||
splashOriginV = ((thisMac.screen.bottom - thisMac.screen.top) - 480) / 2;
|
splashOriginV = ((thisMac.constrainedScreen.bottom - thisMac.constrainedScreen.top) - 480) / 2;
|
||||||
if (splashOriginV < 0)
|
if (splashOriginV < 0)
|
||||||
splashOriginV = 0;
|
splashOriginV = 0;
|
||||||
|
|
||||||
|
@@ -138,7 +138,7 @@ void NewGame (short mode)
|
|||||||
|
|
||||||
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
|
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
|
||||||
|
|
||||||
tempRect = thisMac.screen;
|
tempRect = thisMac.constrainedScreen;
|
||||||
tempRect.top = tempRect.bottom - 20; // thisMac.menuHigh
|
tempRect.top = tempRect.bottom - 20; // thisMac.menuHigh
|
||||||
mainWindowSurface->FillRect(tempRect);
|
mainWindowSurface->FillRect(tempRect);
|
||||||
|
|
||||||
@@ -366,12 +366,12 @@ void SetHouseToSavedRoom (void)
|
|||||||
|
|
||||||
//-------------------------------------------------------------- HandleGameResolutionChange
|
//-------------------------------------------------------------- HandleGameResolutionChange
|
||||||
|
|
||||||
|
extern DrawSurface *backSrcMap;
|
||||||
void HandleGameResolutionChange(void)
|
void HandleGameResolutionChange(void)
|
||||||
{
|
{
|
||||||
short prevPlayOriginH = playOriginH;
|
short prevPlayOriginH = playOriginH;
|
||||||
short prevPlayOriginV = playOriginV;
|
short prevPlayOriginV = playOriginV;
|
||||||
|
|
||||||
Rect prevResolution = thisMac.screen;
|
|
||||||
FlushResolutionChange();
|
FlushResolutionChange();
|
||||||
|
|
||||||
RecomputeInterfaceRects();
|
RecomputeInterfaceRects();
|
||||||
@@ -385,6 +385,7 @@ void HandleGameResolutionChange(void)
|
|||||||
OffsetDynamics(playOriginH - prevPlayOriginH, playOriginV - prevPlayOriginV);
|
OffsetDynamics(playOriginH - prevPlayOriginH, playOriginV - prevPlayOriginV);
|
||||||
|
|
||||||
ResetLocale(true);
|
ResetLocale(true);
|
||||||
|
InitScoreboardMap();
|
||||||
RefreshScoreboard(wasScoreboardTitleMode);
|
RefreshScoreboard(wasScoreboardTitleMode);
|
||||||
DumpScreenOn(&justRoomsRect);
|
DumpScreenOn(&justRoomsRect);
|
||||||
}
|
}
|
||||||
@@ -757,7 +758,7 @@ void RestoreEntireGameScreen (void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
DrawSurface *surface = mainWindow->GetDrawSurface();
|
DrawSurface *surface = mainWindow->GetDrawSurface();
|
||||||
tempRect = thisMac.screen;
|
tempRect = thisMac.constrainedScreen;
|
||||||
|
|
||||||
surface->SetForeColor(StdColors::Black());
|
surface->SetForeColor(StdColors::Black());
|
||||||
surface->FillRect(tempRect);
|
surface->FillRect(tempRect);
|
||||||
|
@@ -1031,7 +1031,7 @@ void DoDisplayPrefs (void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case kDisplay3Item:
|
case kDisplay3Item:
|
||||||
if (thisMac.screen.right > 512)
|
if (thisMac.constrainedScreen.right > 512)
|
||||||
{
|
{
|
||||||
FrameDisplayIcon(prefDlg, StdColors::White());
|
FrameDisplayIcon(prefDlg, StdColors::White());
|
||||||
numNeighbors = 3;
|
numNeighbors = 3;
|
||||||
@@ -1040,7 +1040,7 @@ void DoDisplayPrefs (void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case kDisplay9Item:
|
case kDisplay9Item:
|
||||||
if (thisMac.screen.right > 512)
|
if (thisMac.constrainedScreen.right > 512)
|
||||||
{
|
{
|
||||||
FrameDisplayIcon(prefDlg, StdColors::White());
|
FrameDisplayIcon(prefDlg, StdColors::White());
|
||||||
numNeighbors = 9;
|
numNeighbors = 9;
|
||||||
|
@@ -60,20 +60,23 @@ extern short wasScoreboardMode;
|
|||||||
// Any graphics and structures relating to the scoreboard that appears<72>
|
// Any graphics and structures relating to the scoreboard that appears<72>
|
||||||
// across the top of the game are initialized and loaded up here.
|
// across the top of the game are initialized and loaded up here.
|
||||||
|
|
||||||
void InitScoreboardMap (void)
|
void InitScoreboardMap(void)
|
||||||
{
|
{
|
||||||
Rect bounds;
|
Rect bounds;
|
||||||
THandle<BitmapImage> thePicture;
|
THandle<BitmapImage> thePicture;
|
||||||
DrawSurface *wasCPort;
|
DrawSurface *wasCPort;
|
||||||
PLError_t theErr;
|
PLError_t theErr;
|
||||||
short hOffset;
|
short hOffset;
|
||||||
|
|
||||||
|
if (boardSrcMap)
|
||||||
|
DisposeGWorld(boardSrcMap);
|
||||||
|
|
||||||
wasScoreboardMode = kScoreboardHigh;
|
wasScoreboardMode = kScoreboardHigh;
|
||||||
boardSrcRect = houseRect;
|
boardSrcRect = houseRect;
|
||||||
ZeroRectCorner(&boardSrcRect);
|
ZeroRectCorner(&boardSrcRect);
|
||||||
boardSrcRect.bottom = kScoreboardTall;
|
boardSrcRect.bottom = kScoreboardTall;
|
||||||
theErr = CreateOffScreenGWorld(&boardSrcMap, &boardSrcRect, kPreferredPixelFormat);
|
theErr = CreateOffScreenGWorld(&boardSrcMap, &boardSrcRect, kPreferredPixelFormat);
|
||||||
|
|
||||||
if (boardSrcRect.right >= 640)
|
if (boardSrcRect.right >= 640)
|
||||||
hOffset = (RectWide(&boardSrcRect) - kMaxViewWidth) / 2;
|
hOffset = (RectWide(&boardSrcRect) - kMaxViewWidth) / 2;
|
||||||
else
|
else
|
||||||
@@ -86,40 +89,50 @@ void InitScoreboardMap (void)
|
|||||||
QOffsetRect(&bounds, hOffset, 0);
|
QOffsetRect(&bounds, hOffset, 0);
|
||||||
boardSrcMap->DrawPicture(thePicture, bounds);
|
boardSrcMap->DrawPicture(thePicture, bounds);
|
||||||
thePicture.Dispose();
|
thePicture.Dispose();
|
||||||
|
|
||||||
QSetRect(&badgeSrcRect, 0, 0, 32, 66); // 2144 pixels
|
QSetRect(&badgeSrcRect, 0, 0, 32, 66); // 2144 pixels
|
||||||
theErr = CreateOffScreenGWorld(&badgeSrcMap, &badgeSrcRect, kPreferredPixelFormat);
|
if (!badgeSrcMap)
|
||||||
LoadGraphic(badgeSrcMap, kBadgePictID);
|
{
|
||||||
|
theErr = CreateOffScreenGWorld(&badgeSrcMap, &badgeSrcRect, kPreferredPixelFormat);
|
||||||
|
LoadGraphic(badgeSrcMap, kBadgePictID);
|
||||||
|
}
|
||||||
|
|
||||||
boardDestRect = boardSrcRect;
|
boardDestRect = boardSrcRect;
|
||||||
|
|
||||||
hOffset = (RectWide(&houseRect) - 640) / 2;
|
hOffset = (RectWide(&houseRect) - 640) / 2;
|
||||||
if (hOffset < 0)
|
if (hOffset < 0)
|
||||||
hOffset = -128;
|
hOffset = -128;
|
||||||
|
|
||||||
QSetRect(&boardTSrcRect, 0, 0, 256, 12); // room title
|
QSetRect(&boardTSrcRect, 0, 0, 256, 12); // room title
|
||||||
theErr = CreateOffScreenGWorld(&boardTSrcMap, &boardTSrcRect, kPreferredPixelFormat);
|
if (!boardTSrcMap)
|
||||||
|
{
|
||||||
|
theErr = CreateOffScreenGWorld(&boardTSrcMap, &boardTSrcRect, kPreferredPixelFormat);
|
||||||
|
boardTSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
||||||
|
}
|
||||||
boardTDestRect = boardTSrcRect;
|
boardTDestRect = boardTSrcRect;
|
||||||
QOffsetRect(&boardTDestRect, 137 + hOffset, 5);
|
QOffsetRect(&boardTDestRect, 137 + hOffset, 5);
|
||||||
|
|
||||||
boardTSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
|
||||||
|
|
||||||
QSetRect(&boardGSrcRect, 0, 0, 20, 10); // # gliders
|
QSetRect(&boardGSrcRect, 0, 0, 20, 10); // # gliders
|
||||||
theErr = CreateOffScreenGWorld(&boardGSrcMap, &boardGSrcRect, kPreferredPixelFormat);
|
if (!boardGSrcMap)
|
||||||
|
{
|
||||||
|
theErr = CreateOffScreenGWorld(&boardGSrcMap, &boardGSrcRect, kPreferredPixelFormat);
|
||||||
|
boardGSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
||||||
|
}
|
||||||
boardGDestRect = boardGSrcRect;
|
boardGDestRect = boardGSrcRect;
|
||||||
QOffsetRect(&boardGDestRect, 526 + hOffset, 5);
|
QOffsetRect(&boardGDestRect, 526 + hOffset, 5);
|
||||||
|
|
||||||
boardGSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
|
||||||
|
|
||||||
QSetRect(&boardPSrcRect, 0, 0, 64, 10); // points
|
QSetRect(&boardPSrcRect, 0, 0, 64, 10); // points
|
||||||
theErr = CreateOffScreenGWorld(&boardPSrcMap, &boardPSrcRect, kPreferredPixelFormat);
|
if (!boardPSrcMap)
|
||||||
|
{
|
||||||
|
theErr = CreateOffScreenGWorld(&boardPSrcMap, &boardPSrcRect, kPreferredPixelFormat);
|
||||||
|
boardPSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
||||||
|
}
|
||||||
boardPDestRect = boardPSrcRect;
|
boardPDestRect = boardPSrcRect;
|
||||||
QOffsetRect(&boardPDestRect, 570 + hOffset, 5); // total = 6396 pixels
|
QOffsetRect(&boardPDestRect, 570 + hOffset, 5); // total = 6396 pixels
|
||||||
boardPQDestRect = boardPDestRect;
|
boardPQDestRect = boardPDestRect;
|
||||||
boardGQDestRect = boardGDestRect;
|
boardGQDestRect = boardGDestRect;
|
||||||
|
|
||||||
boardPSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
|
||||||
|
|
||||||
QSetRect(&badgesBlankRects[0], 0, 0, 16, 16); // foil
|
QSetRect(&badgesBlankRects[0], 0, 0, 16, 16); // foil
|
||||||
QOffsetRect(&badgesBlankRects[0], 0, 0);
|
QOffsetRect(&badgesBlankRects[0], 0, 0);
|
||||||
QSetRect(&badgesBlankRects[1], 0, 0, 16, 16); // rubber bands
|
QSetRect(&badgesBlankRects[1], 0, 0, 16, 16); // rubber bands
|
||||||
|
@@ -109,7 +109,7 @@ void OpenMessageWindow (const PLPasStr &title)
|
|||||||
SetRect(&mssgWindowRect, 0, 0, 256, kMessageWindowTall);
|
SetRect(&mssgWindowRect, 0, 0, 256, kMessageWindowTall);
|
||||||
|
|
||||||
Rect placementRect = mssgWindowRect;
|
Rect placementRect = mssgWindowRect;
|
||||||
CenterRectInRect(&placementRect, &thisMac.screen);
|
CenterRectInRect(&placementRect, &thisMac.fullScreen);
|
||||||
|
|
||||||
const PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(placementRect, windowStyle, false, 0, 0, title);
|
const PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(placementRect, windowStyle, false, 0, 0, title);
|
||||||
|
|
||||||
|
@@ -11,6 +11,7 @@ struct GpDisplayDriverProperties
|
|||||||
{
|
{
|
||||||
typedef GpDisplayDriverTickStatus_t (*TickFunc_t)(void *context, IGpFiber *vosFiber);
|
typedef GpDisplayDriverTickStatus_t (*TickFunc_t)(void *context, IGpFiber *vosFiber);
|
||||||
typedef void(*RenderFunc_t)(void *context);
|
typedef void(*RenderFunc_t)(void *context);
|
||||||
|
typedef void(*AdjustRequestedResolutionFunc_t)(void *context, unsigned int &width, unsigned int &height);
|
||||||
|
|
||||||
EGpDisplayDriverType m_type;
|
EGpDisplayDriverType m_type;
|
||||||
|
|
||||||
@@ -32,5 +33,8 @@ struct GpDisplayDriverProperties
|
|||||||
RenderFunc_t m_renderFunc;
|
RenderFunc_t m_renderFunc;
|
||||||
void *m_renderFuncContext;
|
void *m_renderFuncContext;
|
||||||
|
|
||||||
|
AdjustRequestedResolutionFunc_t m_adjustRequestedResolutionFunc;
|
||||||
|
void *m_adjustRequestedResolutionFuncContext;
|
||||||
|
|
||||||
IGpVOSEventQueue *m_eventQueue;
|
IGpVOSEventQueue *m_eventQueue;
|
||||||
};
|
};
|
||||||
|
@@ -683,13 +683,15 @@ void GpDisplayDriverD3D11::Run()
|
|||||||
RECT clientRect;
|
RECT clientRect;
|
||||||
GetClientRect(m_hwnd, &clientRect);
|
GetClientRect(m_hwnd, &clientRect);
|
||||||
|
|
||||||
LONG desiredWidth = clientRect.right - clientRect.left;
|
unsigned int desiredWidth = clientRect.right - clientRect.left;
|
||||||
LONG desiredHeight = clientRect.bottom - clientRect.top;
|
unsigned int desiredHeight = clientRect.bottom - clientRect.top;
|
||||||
if (clientRect.right - clientRect.left != m_windowWidth || clientRect.bottom - clientRect.top != m_windowHeight)
|
if (clientRect.right - clientRect.left != m_windowWidth || clientRect.bottom - clientRect.top != m_windowHeight)
|
||||||
{
|
{
|
||||||
uint32_t prevWidth = m_windowWidth;
|
uint32_t prevWidth = m_windowWidth;
|
||||||
uint32_t prevHeight = m_windowHeight;
|
uint32_t prevHeight = m_windowHeight;
|
||||||
|
|
||||||
|
m_properties.m_adjustRequestedResolutionFunc(m_properties.m_adjustRequestedResolutionFuncContext, desiredWidth, desiredHeight);
|
||||||
|
|
||||||
bool resizedOK = ResizeD3DWindow(m_hwnd, m_windowWidth, m_windowHeight, desiredWidth, desiredHeight, windowStyle, menus);
|
bool resizedOK = ResizeD3DWindow(m_hwnd, m_windowWidth, m_windowHeight, desiredWidth, desiredHeight, windowStyle, menus);
|
||||||
resizedOK = resizedOK && DetachSwapChain();
|
resizedOK = resizedOK && DetachSwapChain();
|
||||||
resizedOK = resizedOK && ResizeSwapChain(m_swapChain, m_windowWidth, m_windowHeight);
|
resizedOK = resizedOK && ResizeSwapChain(m_swapChain, m_windowWidth, m_windowHeight);
|
||||||
|
@@ -15,6 +15,7 @@ namespace PortabilityLayer
|
|||||||
struct IResolutionChangeHandler
|
struct IResolutionChangeHandler
|
||||||
{
|
{
|
||||||
virtual void OnResolutionChanged(uint32_t prevWidth, uint32_t prevHeight, uint32_t newWidth, uint32_t newHeight) = 0;
|
virtual void OnResolutionChanged(uint32_t prevWidth, uint32_t prevHeight, uint32_t newWidth, uint32_t newHeight) = 0;
|
||||||
|
virtual void AdjustRequestedResolution(uint32_t &width, uint32_t &height) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void Init() = 0;
|
virtual void Init() = 0;
|
||||||
|
@@ -38,14 +38,15 @@ public:
|
|||||||
virtual int ApplicationMain() = 0;
|
virtual int ApplicationMain() = 0;
|
||||||
virtual void PL_IncrementTickCounter(uint32_t count) = 0;
|
virtual void PL_IncrementTickCounter(uint32_t count) = 0;
|
||||||
virtual void PL_Render(IGpDisplayDriver *displayDriver) = 0;
|
virtual void PL_Render(IGpDisplayDriver *displayDriver) = 0;
|
||||||
|
virtual void PL_HostAudioDriver_SetInstance(IGpAudioDriver *instance) = 0;
|
||||||
virtual void PL_HostFileSystem_SetInstance(PortabilityLayer::HostFileSystem *instance) = 0;
|
virtual void PL_HostFileSystem_SetInstance(PortabilityLayer::HostFileSystem *instance) = 0;
|
||||||
virtual void PL_HostDisplayDriver_SetInstance(IGpDisplayDriver *instance) = 0;
|
virtual void PL_HostDisplayDriver_SetInstance(IGpDisplayDriver *instance) = 0;
|
||||||
virtual void PL_HostSystemServices_SetInstance(PortabilityLayer::HostSystemServices *instance) = 0;
|
virtual void PL_HostSystemServices_SetInstance(PortabilityLayer::HostSystemServices *instance) = 0;
|
||||||
virtual void PL_HostFontHandler_SetInstance(PortabilityLayer::HostFontHandler *instance) = 0;
|
virtual void PL_HostFontHandler_SetInstance(PortabilityLayer::HostFontHandler *instance) = 0;
|
||||||
virtual void PL_HostVOSEventQueue_SetInstance(PortabilityLayer::HostVOSEventQueue *instance) = 0;
|
virtual void PL_HostVOSEventQueue_SetInstance(PortabilityLayer::HostVOSEventQueue *instance) = 0;
|
||||||
virtual void PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context) = 0;
|
|
||||||
|
|
||||||
virtual void PL_HostAudioDriver_SetInstance(IGpAudioDriver *instance) = 0;
|
virtual void PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context) = 0;
|
||||||
|
virtual void PL_AdjustRequestedResolution(unsigned int &width, unsigned int &height) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
GP_APP_DLL_EXPORT_API GpAppInterface *GpAppInterface_Get();
|
GP_APP_DLL_EXPORT_API GpAppInterface *GpAppInterface_Get();
|
||||||
|
Reference in New Issue
Block a user