mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-22 22:45:39 +00:00
Fix the rest of house load and game over asserts
This commit is contained in:
@@ -639,14 +639,24 @@ void DrawDialogUserText (Dialog *dial, short item, StringPtr text, Boolean inver
|
||||
|
||||
const int32_t ascender = surface->MeasureFontAscender();
|
||||
|
||||
if (invert)
|
||||
{
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
surface->FillRect(iRect);
|
||||
surface->SetForeColor(StdColors::White());
|
||||
}
|
||||
else
|
||||
{
|
||||
surface->SetForeColor(StdColors::White());
|
||||
surface->FillRect(iRect);
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
}
|
||||
|
||||
const Point centeredDrawPoint = Point::Create((iRect.left + iRect.right - strWidth) / 2, (iRect.top + iRect.bottom + ascender) / 2);
|
||||
surface->DrawString(centeredDrawPoint, stringCopy, true);
|
||||
|
||||
if (invert)
|
||||
{
|
||||
OffsetRect(&iRect, 0, 1);
|
||||
surface->InvertFillRect(iRect, nullptr);
|
||||
}
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DrawDialogUserText
|
||||
|
@@ -103,7 +103,7 @@ void SetUpFinalScreen (void)
|
||||
{
|
||||
GetLineOfText(tempStr, count, subStr);
|
||||
offset = ((thisMac.screen.right - thisMac.screen.left) -
|
||||
TextWidth(subStr, 1, subStr[0])) / 2;
|
||||
surface->MeasureString(subStr)) / 2;
|
||||
|
||||
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
|
||||
|
||||
|
@@ -77,12 +77,6 @@ void UpdateLoadDialog (Dialog *theDialog)
|
||||
DrawSurface *surface = theWindow->GetDrawSurface();
|
||||
|
||||
GetWindowBounds(theWindow, kWindowContentRgn, &dialogRect);
|
||||
/*
|
||||
wasState = HGetState((Handle)(((DialogPeek)theDialog)->window).port.visRgn);
|
||||
HLock((Handle)(((DialogPeek)theDialog)->window).port.visRgn);
|
||||
dialogRect = (**((((DialogPeek)theDialog)->window).port.visRgn)).rgnBBox;
|
||||
HSetState((Handle)(((DialogPeek)theDialog)->window).port.visRgn, wasState);
|
||||
*/
|
||||
|
||||
ColorFrameWHRect(theDialog->GetWindow()->GetDrawSurface(), 8, 39, 413, 184, kRedOrangeColor8); // box around files
|
||||
|
||||
@@ -403,6 +397,8 @@ void DoLoadHouse (void)
|
||||
while (!leaving)
|
||||
{
|
||||
int16_t item = theDial->ExecuteModal(LoadFilter);
|
||||
|
||||
bool requiresRedraw = false;
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -431,9 +427,8 @@ void DoLoadHouse (void)
|
||||
if ((item - kLoadNameFirstItem != thisHouseIndex) &&
|
||||
(item - kLoadNameFirstItem < screenCount))
|
||||
{
|
||||
InvalWindowRect(theDial->GetWindow(), &loadHouseRects[thisHouseIndex]);
|
||||
thisHouseIndex = item - kLoadNameFirstItem;
|
||||
InvalWindowRect(theDial->GetWindow(), &loadHouseRects[thisHouseIndex]);
|
||||
requiresRedraw = true;
|
||||
}
|
||||
|
||||
if (lastWhereClick.h < 0)
|
||||
@@ -466,9 +461,8 @@ void DoLoadHouse (void)
|
||||
if ((item - kLoadIconFirstItem != thisHouseIndex) &&
|
||||
(item - kLoadIconFirstItem < screenCount))
|
||||
{
|
||||
InvalWindowRect(theDial->GetWindow(), &loadHouseRects[thisHouseIndex]);
|
||||
thisHouseIndex = item - kLoadIconFirstItem;
|
||||
InvalWindowRect(theDial->GetWindow(), &loadHouseRects[thisHouseIndex]);
|
||||
requiresRedraw = true;
|
||||
}
|
||||
|
||||
if (lastWhereClick.h < 0)
|
||||
@@ -500,6 +494,9 @@ void DoLoadHouse (void)
|
||||
{
|
||||
PageDownHouses(theDial);
|
||||
}
|
||||
|
||||
if (requiresRedraw)
|
||||
UpdateLoadDialog(theDial);
|
||||
}
|
||||
|
||||
theDial->Destroy();
|
||||
|
@@ -1,9 +1,12 @@
|
||||
#include "PLInvisibleWidget.h"
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
#include "PLWidgets.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
InvisibleWidget::InvisibleWidget(const WidgetBasicState &state)
|
||||
: WidgetSpec<InvisibleWidget>(state)
|
||||
, m_clickable(state.m_enabled)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -17,4 +20,12 @@ namespace PortabilityLayer
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
WidgetHandleState_t InvisibleWidget::ProcessEvent(const TimeTaggedVOSEvent &evt)
|
||||
{
|
||||
if (m_clickable && evt.IsLMouseDownEvent() && m_rect.Contains(m_window->MouseToLocal(evt.m_vosEvent.m_event.m_mouseInputEvent)))
|
||||
return WidgetHandleStates::kActivated;
|
||||
else
|
||||
return WidgetHandleStates::kIgnored;
|
||||
}
|
||||
}
|
||||
|
@@ -7,9 +7,14 @@ namespace PortabilityLayer
|
||||
class InvisibleWidget final : public WidgetSpec<InvisibleWidget>
|
||||
{
|
||||
public:
|
||||
InvisibleWidget(const WidgetBasicState &state);
|
||||
explicit InvisibleWidget(const WidgetBasicState &state);
|
||||
~InvisibleWidget();
|
||||
|
||||
bool Init(const WidgetBasicState &state) override;
|
||||
|
||||
WidgetHandleState_t ProcessEvent(const TimeTaggedVOSEvent &evt) override;
|
||||
|
||||
private:
|
||||
bool m_clickable;
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user