Compare commits

...

11 Commits
1.0.4 ... 1.0.6

Author SHA1 Message Date
elasota
53ecdabb43 Add full-screen option 2020-07-20 23:38:31 -04:00
elasota
7bf6147fa1 Fix transitions not spanning the entire screen and fix dissolve replaying when toggling full-screen 2020-07-20 12:17:36 -04:00
elasota
a77e1d868f Bump version to 1.0.6 2020-07-20 12:16:41 -04:00
elasota
c14d904ca7 Fix bad ZIP structure 2020-07-20 12:16:31 -04:00
elasota
ec275fcefd Bump version to 1.0.5 2020-07-04 00:35:18 -04:00
elasota
550465088e Remove architecture string code that doesn't work 2020-07-04 00:34:46 -04:00
elasota
68444a7240 Add transitions 2020-07-04 00:26:28 -04:00
elasota
7db0f8d7eb Fix loading empty house in the editor not working correctly 2020-07-03 19:40:26 -04:00
elasota
1fc846f7d8 Fix menu shortcuts activating disabled menu items 2020-07-03 19:31:30 -04:00
elasota
d978267c3e Remove selection scroll timer (which doesn't work anyway) 2020-07-03 18:06:30 -04:00
elasota
e05f37a28d Fix oval frames not drawing in 32-bit color mode 2020-07-03 17:32:26 -04:00
19 changed files with 210 additions and 59 deletions

View File

@@ -74,7 +74,7 @@
"enabled" : true
},
{
"name" : "Adjust resolution to fit window",
"name" : "Scale to fit window",
"itemType" : "CheckBox",
"pos" : [ 8, 105 ],
"size" : [ 256, 18 ],
@@ -97,6 +97,14 @@
"id" : 0,
"enabled" : true
},
{
"name" : "Full screen mode",
"itemType" : "CheckBox",
"pos" : [ 8, 172 ],
"size" : [ 256, 18 ],
"id" : 0,
"enabled" : true
},
{
"name" : "",
"itemType" : "UserItem",

View File

@@ -166,7 +166,7 @@ void BringUpBanner (void)
DrawBanner(&topLeft);
DrawBannerMessage(topLeft);
DumpScreenOn(&justRoomsRect);
DumpScreenOn(&justRoomsRect, false);
// if (quickerTransitions)
// DissBitsChunky(&justRoomsRect); // was workSrcRect

View File

@@ -498,7 +498,7 @@ void FollowTheLeader (void);
void PourScreenOn (Rect *); // --- Transitions.c
void WipeScreenOn (SInt16, Rect *);
void DumpScreenOn (Rect *);
void DumpScreenOn (Rect *, Boolean);
//void DissBits (Rect *);
//void DissBitsChunky (Rect *);
//void FillColorNoise (Rect *);

View File

@@ -82,13 +82,13 @@ void DoHighScores (void)
// else
// DissBits(&workSrcRect);
DumpScreenOn(&workSrcRect);
DumpScreenOn(&workSrcRect, false);
SpinCursor(3);
DrawHighScores(workSrcMap);
DumpScreenOn(&workSrcRect);
DumpScreenOn(&workSrcRect, false);
SpinCursor(3);
// if (quickerTransitions)

View File

@@ -668,7 +668,6 @@ Boolean ReadHouse (void)
numberRooms = 0;
noRoomAtAll = true;
YellowAlert(kYellowNoRooms, 0);
return(false);
}
wasHouseVersion = (*thisHouse)->version;

View File

@@ -10,6 +10,8 @@
#include "PLKeyEncoding.h"
#include "Externs.h"
#include "Environ.h"
#include "HostDisplayDriver.h"
#include "IGpDisplayDriver.h"
#include "IOStream.h"
#include "House.h"
#include "WindowManager.h"
@@ -215,6 +217,10 @@ void ReadInPrefs (void)
doPrettyMap = false;
doBitchDialogs = true;
IGpDisplayDriver *displayDriver = PortabilityLayer::HostDisplayDriver::GetInstance();
if (!displayDriver->IsFullScreen())
displayDriver->RequestToggleFullScreen(0);
modulePrefs.Dispose();
}

View File

@@ -83,19 +83,6 @@ void DrawOnSplash(DrawSurface *surface)
else
ColorText(surface, textPoint, houseLoadedStr, 28L, appFont);
}
#if defined(powerc) || defined(__powerc)
TextSize(12);
TextFace(0);
TextFont(systemFont);
ForeColor(blackColor);
MoveTo(splashOriginH + 5, splashOriginV + 457);
DrawString("\pPowerPC Native!");
ForeColor(whiteColor);
MoveTo(splashOriginH + 4, splashOriginV + 456);
DrawString("\pPowerPC Native!");
ForeColor(blackColor);
#endif
}
//-------------------------------------------------------------- RedrawSplashScreen

View File

@@ -168,16 +168,16 @@ void NewGame (short mode)
if (mode == kNewGameMode)
{
BringUpBanner();
DumpScreenOn(&justRoomsRect);
DumpScreenOn(&justRoomsRect, false);
}
else if (mode == kResumeGameMode)
{
DisplayStarsRemaining();
DumpScreenOn(&justRoomsRect);
DumpScreenOn(&justRoomsRect, false);
}
else
{
DumpScreenOn(&justRoomsRect);
DumpScreenOn(&justRoomsRect, false);
}
InitGarbageRects();
@@ -381,7 +381,7 @@ void HandleGameResolutionChange(void)
ResetLocale(true);
InitScoreboardMap();
RefreshScoreboard(wasScoreboardTitleMode);
DumpScreenOn(&justRoomsRect);
DumpScreenOn(&justRoomsRect, true);
}
//-------------------------------------------------------------- PlayGame

View File

@@ -41,9 +41,10 @@
#define kScaleResolutionItem 10
#define kUseICCProfileItem 11
#define kDoColorFadeItem 12
#define kBorder2Item 13
#define kBorder3Item 14
#define kDispDefault 15
#define kFullScreenItem 13
#define kBorder2Item 14
#define kBorder3Item 15
#define kDispDefault 16
// Sound dialog
#define kSofterItem 4
@@ -106,7 +107,7 @@ Str15 tempLeftStr, tempRightStr, tempBattStr, tempBandStr;
long tempLeftMap, tempRightMap, tempBattMap, tempBandMap;
short whichCtrl, wasDepthPref;
Boolean wasFade, wasIdle, wasPlay, wasTransit, wasZooms, wasBackground;
Boolean wasEscPauseKey, wasDemos, wasAutoScale, wasUseICCProfile, nextRestartChange, wasErrorCheck, needResolutionReset;
Boolean wasEscPauseKey, wasDemos, wasAutoScale, wasUseICCProfile, nextRestartChange, wasErrorCheck, wasFullscreenPref, needResolutionReset;
Boolean wasPrettyMap, wasBitchDialogs;
extern short numNeighbors, isDepthPref, maxFiles, willMaxFiles;
@@ -917,6 +918,9 @@ void DisplayUpdate (Dialog *theDialog)
SetDialogItemValue(theDialog, k32BitColorItem, wasDepthPref == 32);
SetDialogItemValue(theDialog, kScaleResolutionItem, (short)isAutoScale);
SetDialogItemValue(theDialog, kUseICCProfileItem, (short)isUseICCProfile);
wasFullscreenPref = PortabilityLayer::HostDisplayDriver::GetInstance()->IsFullScreen();
SetDialogItemValue(theDialog, kFullScreenItem, wasFullscreenPref);
FrameDisplayIcon(theDialog, StdColors::Red());
FrameDialogItemC(theDialog, kBorder1Item, kRedOrangeColor8);
@@ -1089,6 +1093,11 @@ void DoDisplayPrefs (void)
wasUseICCProfile = !wasUseICCProfile;
SetDialogItemValue(prefDlg, kUseICCProfileItem, (short)wasUseICCProfile);
break;
case kFullScreenItem:
wasFullscreenPref = !wasFullscreenPref;
SetDialogItemValue(prefDlg, kFullScreenItem, (short)wasFullscreenPref);
break;
case kDispDefault:
FrameDisplayIcon(prefDlg, StdColors::White());
@@ -1334,6 +1343,14 @@ void DoSettingsMain (void)
nextRestartChange = false;
}
IGpDisplayDriver *displayDriver = PortabilityLayer::HostDisplayDriver::GetInstance();
if (displayDriver->IsFullScreen() != (wasFullscreenPref != 0))
{
displayDriver->RequestToggleFullScreen(0);
needResolutionReset = false;
}
if (needResolutionReset)
{
PortabilityLayer::HostDisplayDriver::GetInstance()->RequestResetVirtualResolution();

View File

@@ -9,9 +9,15 @@
#include "Externs.h"
#include "Environ.h"
#include "MainWindow.h"
#include "MemoryManager.h"
#include "QDPixMap.h"
#include "PLQDraw.h"
#include "RectUtils.h"
#include "RandomNumberGenerator.h"
#include <algorithm>
extern Boolean quickerTransitions;
//============================================================== Functions
@@ -38,7 +44,10 @@ void PourScreenOn (Rect *theRect)
QSetRect(&columnRects[i], 0, 0, kChipWide, kChipHigh);
QOffsetRect(&columnRects[i], (i * kChipWide) + theRect->left, theRect->top);
}
const int kUnitsPerBlock = 128;
int unitsCommitted = 0;
while (working)
{
do
@@ -68,47 +77,73 @@ void PourScreenOn (Rect *theRect)
if (colsComplete >= colWide)
working = false;
}
unitsCommitted++;
if (unitsCommitted == kUnitsPerBlock)
{
mainWindow->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
Delay(1, nullptr);
unitsCommitted = 0;
}
}
mainWindow->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
}
//-------------------------------------------------------------- WipeScreenOn
void WipeScreenOn (short direction, Rect *theRect)
{
#define kWipeRectThick 4
if (quickerTransitions)
{
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(mainWindow->GetDrawSurface()),
theRect, theRect, srcCopy);
mainWindow->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
return;
}
Rect wipeRect;
short hOffset, vOffset;
short i, count;
const int kWipeTransitionTime = 10;
const int wipeRectThick = (theRect->Width() + kWipeTransitionTime - 1) / kWipeTransitionTime;
wipeRect = *theRect;
switch (direction)
{
case kAbove:
wipeRect.bottom = wipeRect.top + kWipeRectThick;
wipeRect.bottom = wipeRect.top + wipeRectThick;
hOffset = 0;
vOffset = kWipeRectThick;
count = ((theRect->bottom - theRect->top) / kWipeRectThick) + 1;
vOffset = wipeRectThick;
count = (theRect->bottom - theRect->top + wipeRectThick - 1) / wipeRectThick;
break;
case kToRight:
wipeRect.left = wipeRect.right - kWipeRectThick;
hOffset = -kWipeRectThick;
wipeRect.left = wipeRect.right - wipeRectThick;
hOffset = -wipeRectThick;
vOffset = 0;
count = workSrcRect.right / kWipeRectThick;
count = (workSrcRect.right + wipeRectThick - 1) / wipeRectThick;
break;
case kBelow:
wipeRect.top = wipeRect.bottom - kWipeRectThick;
wipeRect.top = wipeRect.bottom - wipeRectThick;
hOffset = 0;
vOffset = -kWipeRectThick;
count = ((theRect->bottom - theRect->top) / kWipeRectThick) + 1;
vOffset = -wipeRectThick;
count = (theRect->bottom - theRect->top + wipeRectThick - 1) / wipeRectThick;
break;
case kToLeft:
wipeRect.right = wipeRect.left + kWipeRectThick;
hOffset = kWipeRectThick;
wipeRect.right = wipeRect.left + wipeRectThick;
hOffset = wipeRectThick;
vOffset = 0;
count = workSrcRect.right / kWipeRectThick;
count = (workSrcRect.right + wipeRectThick - 1) / wipeRectThick;
break;
}
@@ -128,19 +163,95 @@ void WipeScreenOn (short direction, Rect *theRect)
wipeRect.bottom = theRect->top;
else if (wipeRect.bottom > theRect->bottom)
wipeRect.bottom = theRect->bottom;
mainWindow->GetDrawSurface()->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
Delay(1, nullptr);
}
}
//-------------------------------------------------------------- DissolveScreenOn
void DissolveScreenOn(Rect *theRect)
{
DrawSurface *graf = mainWindow->GetDrawSurface();
const int kChunkHeight = 15;
const int kChunkWidth = 20;
const int rows = (theRect->Height() + kChunkHeight - 1) / kChunkHeight;
const int cols = (theRect->Width() + kChunkWidth - 1) / kChunkWidth;
const int numCells = rows * cols;
const int targetTransitionTime = 30;
Point *points = static_cast<Point*>(PortabilityLayer::MemoryManager::GetInstance()->Alloc(sizeof(Point) * numCells));
int rectLeft = theRect->left;
int rectTop = theRect->top;
for (int row = 0; row < rows; row++)
{
for (int col = 0; col < cols; col++)
points[col + row * cols] = Point::Create(col * kChunkWidth + rectLeft, row * kChunkHeight + rectTop);
}
PortabilityLayer::RandomNumberGenerator *rng = PortabilityLayer::RandomNumberGenerator::GetInstance();
for (unsigned int shuffleIndex = 0; shuffleIndex < static_cast<unsigned int>(numCells - 1); shuffleIndex++)
{
unsigned int shuffleRange = static_cast<unsigned int>(numCells - 1) - shuffleIndex;
unsigned int shuffleTarget = (rng->GetNextAndAdvance() % shuffleRange) + shuffleIndex;
if (shuffleTarget != shuffleIndex)
std::swap(points[shuffleIndex], points[shuffleTarget]);
}
const int numCellsAtOnce = numCells / targetTransitionTime;
const BitMap *srcBitmap = *GetGWorldPixMap(workSrcMap);
BitMap *destBitmap = GetPortBitMapForCopyBits(graf);
for (unsigned int firstCell = 0; firstCell < static_cast<unsigned int>(numCells); firstCell += numCellsAtOnce)
{
unsigned int lastCell = firstCell + numCellsAtOnce;
if (lastCell > static_cast<unsigned int>(numCells))
lastCell = numCells;
for (unsigned int i = firstCell; i < lastCell; i++)
{
const Point &point = points[i];
const Rect copyRect = Rect::Create(point.v, point.h, point.v + kChunkHeight, point.h + kChunkWidth);
CopyBits(srcBitmap, destBitmap, &copyRect, &copyRect, srcCopy);
}
graf->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
Delay(1, nullptr);
}
graf->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
PortabilityLayer::MemoryManager::GetInstance()->Release(points);
}
//-------------------------------------------------------------- DumpScreenOn
void DumpScreenOn (Rect *theRect)
void DumpScreenOn(Rect *theRect, Boolean fast)
{
DrawSurface *graf = mainWindow->GetDrawSurface();
if (quickerTransitions || fast)
{
DrawSurface *graf = mainWindow->GetDrawSurface();
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
GetPortBitMapForCopyBits(graf),
theRect, theRect, srcCopy);
graf->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
graf->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
}
else
DissolveScreenOn(theRect);
}

View File

@@ -2,8 +2,8 @@
#define GP_BUILD_VERSION_MAJOR 1
#define GP_BUILD_VERSION_MINOR 0
#define GP_BUILD_VERSION_UPDATE 4
#define GP_BUILD_VERSION_UPDATE 6
#define GP_APPLICATION_VERSION_STRING "1.0.4"
#define GP_APPLICATION_VERSION_STRING "1.0.6"
#define GP_APPLICATION_COPYRIGHT_STRING "2019-2020 Eric Lasota"
#define GP_APPLICATION_WEBSITE_STRING "https://github.com/elasota/Aerofoil"

View File

@@ -47,6 +47,8 @@ public:
virtual void RequestToggleFullScreen(uint32_t timestamp) = 0;
virtual void RequestResetVirtualResolution() = 0;
virtual bool IsFullScreen() const = 0;
virtual const GpDisplayDriverProperties &GetProperties() const = 0;
virtual IGpPrefsHandler *GetPrefsHandler() const = 0;
};

View File

@@ -1458,7 +1458,7 @@ void GpDisplayDriverD3D11::SetUseICCProfile(bool useICCProfile)
void GpDisplayDriverD3D11::RequestToggleFullScreen(uint32_t timestamp)
{
// Alt-Enter gets re-sent after a full-screen toggle, so we ignore toggle requests until half a second has elapsed
if (timestamp > m_lastFullScreenToggleTimeStamp + 30)
if (timestamp == 0 || timestamp > m_lastFullScreenToggleTimeStamp + 30)
{
m_isFullScreenDesired = !m_isFullScreenDesired;
m_lastFullScreenToggleTimeStamp = timestamp;
@@ -1470,6 +1470,11 @@ void GpDisplayDriverD3D11::RequestResetVirtualResolution()
m_isResolutionResetDesired = true;
}
bool GpDisplayDriverD3D11::IsFullScreen() const
{
return m_isFullScreenDesired;
}
const GpDisplayDriverProperties &GpDisplayDriverD3D11::GetProperties() const
{
return m_properties;

View File

@@ -58,6 +58,8 @@ public:
void RequestToggleFullScreen(uint32_t timestamp) override;
void RequestResetVirtualResolution() override;
bool IsFullScreen() const override;
const GpDisplayDriverProperties &GetProperties() const override;
IGpPrefsHandler *GetPrefsHandler() const override;

View File

@@ -1,6 +1,8 @@
move ReleasePkg\en-us\Aerofoil-installpkg.msi ReleasePkg\Aerofoil-installpkg.msi
Tools\7z.exe a -bd -r -mx=9 ReleasePkg\Aerofoil.zip ReleasePkg\Aerofoil
Tools\7z.exe a -bd -r -mx=9 ReleasePkg\Aerofoil-PDBs.7z ReleasePkg\PDBs
cd ReleasePkg
..\Tools\7z.exe a -bd -r -mx=9 Aerofoil.zip Aerofoil
..\Tools\7z.exe a -bd -r -mx=9 Aerofoil-PDBs.7z PDBs
cd ..
rmdir /S /Q ReleasePkg\Aerofoil
rmdir /S /Q ReleasePkg\en-us
rmdir /S /Q ReleasePkg\PDBs

View File

@@ -654,7 +654,7 @@ namespace PortabilityLayer
for (size_t i = 0; i < numItems; i++)
{
if (items[i].key == shortcutChar)
if (items[i].key == shortcutChar && items[i].enabled)
{
menuID = menu->menuID;
itemID = static_cast<uint16_t>(i);

View File

@@ -31,7 +31,6 @@ namespace PortabilityLayer
, m_caratScrollLocked(false)
, m_hasFocus(false)
, m_caratTimer(0)
, m_selectionScrollTimer(0)
, m_isMultiLine(false)
, m_isDraggingSelection(false)
, m_dragSelectionStartChar(false)
@@ -273,7 +272,6 @@ namespace PortabilityLayer
{
m_window->FocusWidget(this);
m_isDraggingSelection = true;
m_selectionScrollTimer = kMouseScrollRate;
return HandleDragSelection(evt);
}
else
@@ -335,9 +333,6 @@ namespace PortabilityLayer
Redraw();
}
}
if (m_isDraggingSelection)
m_selectionScrollTimer++;
}
void EditboxWidget::HandleCharacter(uint8_t ch, const uint32_t numRepeatsRequested)
@@ -762,8 +757,7 @@ namespace PortabilityLayer
m_selStartChar = m_dragSelectionStartChar;
}
if (m_selectionScrollTimer >= kMouseScrollRate)
AdjustScrollToCarat();
AdjustScrollToCarat();
m_caratTimer = 0;
Redraw();

View File

@@ -92,6 +92,5 @@ namespace PortabilityLayer
size_t m_dragSelectionStartChar;
uint16_t m_caratTimer;
uint16_t m_selectionScrollTimer;
};
}

View File

@@ -1224,6 +1224,25 @@ void DrawSurface::FrameEllipse(const Rect &rect, PortabilityLayer::ResolveCachin
}
}
break;
case GpPixelFormats::kRGB32:
{
const uint32_t color32 = cacheColor.GetRGBAColor().AsUInt32();
for (;;)
{
const PortabilityLayer::Vec2i pt = plotter.GetPoint();
if (constraintRect32.Contains(pt))
{
const size_t pixelIndex = static_cast<size_t>(pt.m_y - portRect.top) * pitch + static_cast<size_t>(pt.m_x - portRect.left) * 4;
*reinterpret_cast<uint32_t*>(pixData + pixelIndex) = color32;
}
if (plotter.PlotNext() == PortabilityLayer::PlotDirection_Exhausted)
break;
}
}
break;
default:
PL_NotYetImplemented();
return;