Compare commits

...

7 Commits
1.0.4 ... 1.0.5

Author SHA1 Message Date
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
8 changed files with 151 additions and 42 deletions

View File

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

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

@@ -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;
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;
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;
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;
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);
}
}
//-------------------------------------------------------------- DumpScreenOn
void DumpScreenOn (Rect *theRect)
void DissolveScreenOn(Rect *theRect)
{
DrawSurface *graf = mainWindow->GetDrawSurface();
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
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)
{
if (quickerTransitions)
{
DrawSurface *graf = mainWindow->GetDrawSurface();
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 5
#define GP_APPLICATION_VERSION_STRING "1.0.4"
#define GP_APPLICATION_VERSION_STRING "1.0.5"
#define GP_APPLICATION_COPYRIGHT_STRING "2019-2020 Eric Lasota"
#define GP_APPLICATION_WEBSITE_STRING "https://github.com/elasota/Aerofoil"

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;