mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 03:59:36 +00:00
Level editor work
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "HostDisplayDriver.h"
|
||||
#include "IGpColorCursor.h"
|
||||
#include "IGpCursor.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "ResourceManager.h"
|
||||
|
||||
@@ -37,7 +37,7 @@ typedef struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
IGpColorCursor *hwCursor;
|
||||
IGpCursor *hwCursor;
|
||||
} frame[1];
|
||||
} compiledAcurRec;
|
||||
|
||||
@@ -61,7 +61,7 @@ compiledAcurHandle compiledAnimCursorH = nil;
|
||||
Boolean GetColorCursors (acurHandle ballCursH, compiledAcurHandle compiledBallCursH)
|
||||
{
|
||||
short i, j;
|
||||
IGpColorCursor *hwCursor;
|
||||
IGpCursor *hwCursor;
|
||||
Boolean result = true;
|
||||
|
||||
if (ballCursH)
|
||||
@@ -70,7 +70,7 @@ Boolean GetColorCursors (acurHandle ballCursH, compiledAcurHandle compiledBallCu
|
||||
HideCursor(); // Hide the cursor
|
||||
for (i = 0; i < j; i++) // Walk through the acur resource
|
||||
{
|
||||
hwCursor = PortabilityLayer::HostDisplayDriver::GetInstance()->LoadColorCursor((*ballCursH)->frame[i].resID); // Get the cursor
|
||||
hwCursor = PortabilityLayer::HostDisplayDriver::GetInstance()->LoadCursor(true, (*ballCursH)->frame[i].resID); // Get the cursor
|
||||
if (hwCursor == nil) // Make sure a real cursor was returned
|
||||
{ // If not, trash all cursors loaded
|
||||
for (j = 0; j < i; j++)
|
||||
@@ -81,7 +81,7 @@ Boolean GetColorCursors (acurHandle ballCursH, compiledAcurHandle compiledBallCu
|
||||
else // But, if the cursor loaded ok
|
||||
{ // add it to our list or cursor handles
|
||||
(*compiledBallCursH)->frame[i].hwCursor = hwCursor;
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetColorCursor(hwCursor);
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor(hwCursor);
|
||||
}
|
||||
}
|
||||
InitCursor(); // Show the cursor again (as arrow)
|
||||
@@ -168,10 +168,10 @@ void IncrementCursor (void)
|
||||
(*animCursorH)->index++;
|
||||
(*animCursorH)->index %= (*animCursorH)->n;
|
||||
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetColorCursor((*compiledAnimCursorH)->frame[(*animCursorH)->index].hwCursor);
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor((*compiledAnimCursorH)->frame[(*animCursorH)->index].hwCursor);
|
||||
}
|
||||
else
|
||||
SetBuiltinCursor(watchCursor);
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetStandardCursor(EGpStandardCursors::kWait);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DecrementCursor
|
||||
@@ -188,10 +188,10 @@ void DecrementCursor (void)
|
||||
if (((*animCursorH)->index) < 0)
|
||||
(*animCursorH)->index = ((*animCursorH)->n) - 1;
|
||||
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetColorCursor((*compiledAnimCursorH)->frame[(*animCursorH)->index].hwCursor);
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor((*compiledAnimCursorH)->frame[(*animCursorH)->index].hwCursor);
|
||||
}
|
||||
else
|
||||
SetBuiltinCursor(watchCursor);
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetStandardCursor(EGpStandardCursors::kWait);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- SpinCursor
|
||||
|
||||
@@ -127,15 +127,15 @@ void OpenCoordWindow (void)
|
||||
|
||||
if (coordWindow == nil)
|
||||
{
|
||||
const uint16_t windowStyle = PortabilityLayer::WindowStyleFlags::kTitleBar | PortabilityLayer::WindowStyleFlags::kMiniBar;
|
||||
const uint16_t windowStyle = PortabilityLayer::WindowStyleFlags::kTitleBar | PortabilityLayer::WindowStyleFlags::kMiniBar | PortabilityLayer::WindowStyleFlags::kCloseBox;
|
||||
|
||||
QSetRect(&coordWindowRect, 0, 0, 50, 38);
|
||||
if (thisMac.hasColor)
|
||||
coordWindow = NewCWindow(nil, &coordWindowRect,
|
||||
PSTR("Tools"), false, windowStyle, kPutInFront, true, 0L);
|
||||
PSTR("Tools"), false, windowStyle, kPutInFront, 0L);
|
||||
else
|
||||
coordWindow = NewWindow(nil, &coordWindowRect,
|
||||
PSTR("Tools"), false, windowStyle, kPutInFront, true, 0L);
|
||||
PSTR("Tools"), false, windowStyle, kPutInFront, 0L);
|
||||
|
||||
if (coordWindow == nil)
|
||||
RedAlert(kErrNoMemory);
|
||||
|
||||
@@ -397,7 +397,9 @@ void GetDialogString (Dialog *theDialog, short item, StringPtr theString)
|
||||
|
||||
void SetDialogString (Dialog *theDialog, short item, const PLPasStr &theString)
|
||||
{
|
||||
theDialog->GetItems()[item - 1].GetWidget()->SetString(theString);
|
||||
PortabilityLayer::Widget *widget = theDialog->GetItems()[item - 1].GetWidget();
|
||||
widget->SetString(theString);
|
||||
widget->DrawControl(theDialog->GetWindow()->GetDrawSurface());
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- GetDialogStringLen
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "Environ.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Objects.h"
|
||||
#include "QDPixMap.h"
|
||||
#include "RectUtils.h"
|
||||
#include "Room.h"
|
||||
#include "Utilities.h"
|
||||
|
||||
@@ -442,7 +442,7 @@ void HandleIdleTask (void)
|
||||
{
|
||||
if (theMode == kEditMode)
|
||||
{
|
||||
SetPort((GrafPtr)mainWindow);
|
||||
SetPort(&mainWindow->GetDrawSurface()->m_port);
|
||||
DoMarquee();
|
||||
|
||||
if ((autoRoomEdit) && (newRoomNow))
|
||||
|
||||
@@ -69,7 +69,7 @@ void DoHighScores (void)
|
||||
Rect tempRect;
|
||||
|
||||
SpinCursor(3);
|
||||
SetPort((GrafPtr)workSrcMap);
|
||||
SetPort(&workSrcMap->m_port);
|
||||
workSrcMap->FillRect(workSrcRect);
|
||||
QSetRect(&tempRect, 0, 0, 640, 480);
|
||||
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
void UpdateGoToDialog (Dialog *);
|
||||
Boolean GoToFilter (Dialog *, EventRecord *, short *);
|
||||
|
||||
extern PortabilityLayer::ResourceArchive *houseResFork;
|
||||
|
||||
|
||||
houseHand thisHouse;
|
||||
linksPtr linksList;
|
||||
@@ -241,11 +243,7 @@ void WhereDoesGliderBegin (Rect *theRect, short mode)
|
||||
|
||||
Boolean HouseHasOriginalPicts (void)
|
||||
{
|
||||
short nPicts;
|
||||
|
||||
PL_NotYetImplemented(); nPicts = 0;
|
||||
//nPicts = Count1Resources('PICT');
|
||||
return (nPicts > 0);
|
||||
return houseResFork->HasAnyResourcesOfType('PICT');
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- CountHouseLinks
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "Externs.h"
|
||||
#include "DialogManager.h"
|
||||
#include "DialogUtils.h"
|
||||
#include "HostDisplayDriver.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
|
||||
|
||||
#define kHouseInfoDialogID 1001
|
||||
@@ -181,7 +183,7 @@ Boolean HouseFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
{
|
||||
if (houseCursorIs != kBeamCursor)
|
||||
{
|
||||
SetBuiltinCursor(iBeamCursor);
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetStandardCursor(EGpStandardCursors::kIBeam);
|
||||
houseCursorIs = kBeamCursor;
|
||||
}
|
||||
}
|
||||
@@ -231,7 +233,7 @@ void DoHouseInfo (void)
|
||||
houseInfoDialog = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kHouseInfoDialogID, kPutInFront, &substitutions);
|
||||
if (houseInfoDialog == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetPort((GrafPtr)houseInfoDialog);
|
||||
SetPort(&houseInfoDialog->GetWindow()->GetDrawSurface()->m_port);
|
||||
ShowWindow(houseInfoDialog->GetWindow());
|
||||
|
||||
SetDialogString(houseInfoDialog, kBannerTextItem, banner);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "Externs.h"
|
||||
#include "InputManager.h"
|
||||
#include "MainWindow.h"
|
||||
#include "QDPixMap.h"
|
||||
#include "RectUtils.h"
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "HostDisplayDriver.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "Map.h"
|
||||
#include "MenuManager.h"
|
||||
#include "PLKeyEncoding.h"
|
||||
@@ -20,15 +22,14 @@
|
||||
#define kHoriCursorID 130
|
||||
#define kDiagCursorID 131
|
||||
|
||||
struct IGpCursor;
|
||||
|
||||
extern THandle<Rect> mirrorRects;
|
||||
extern WindowPtr mapWindow, toolsWindow, linkWindow;
|
||||
extern WindowPtr menuWindow;
|
||||
extern Rect shieldRect, boardSrcRect, localRoomsDest[];
|
||||
extern CursHandle handCursorH, vertCursorH, horiCursorH;
|
||||
extern CursHandle diagCursorH;
|
||||
extern Cursor handCursor, vertCursor, horiCursor;
|
||||
extern Cursor diagCursor;
|
||||
extern IGpCursor *handCursor, *vertCursor, *horiCursor;
|
||||
extern IGpCursor *diagCursor;
|
||||
extern MenuHandle appleMenu, gameMenu, optionsMenu, houseMenu;
|
||||
extern Point shieldPt;
|
||||
extern long incrementModeTime;
|
||||
@@ -81,25 +82,21 @@ void InitializeMenus (void)
|
||||
|
||||
void GetExtraCursors (void)
|
||||
{
|
||||
handCursorH = GetCursor(kHandCursorID);
|
||||
if (handCursorH == nil)
|
||||
handCursor = PortabilityLayer::HostDisplayDriver::GetInstance()->LoadCursor(false, kHandCursorID);
|
||||
if (handCursor == nil)
|
||||
RedAlert(kErrFailedResourceLoad);
|
||||
handCursor = **handCursorH;
|
||||
|
||||
vertCursorH = GetCursor(kVertCursorID);
|
||||
if (vertCursorH == nil)
|
||||
vertCursor = PortabilityLayer::HostDisplayDriver::GetInstance()->LoadCursor(false, kVertCursorID);
|
||||
if (vertCursor == nil)
|
||||
RedAlert(kErrFailedResourceLoad);
|
||||
vertCursor = **vertCursorH;
|
||||
|
||||
horiCursorH = GetCursor(kHoriCursorID);
|
||||
if (horiCursorH == nil)
|
||||
horiCursor = PortabilityLayer::HostDisplayDriver::GetInstance()->LoadCursor(false, kHoriCursorID);
|
||||
if (horiCursor == nil)
|
||||
RedAlert(kErrFailedResourceLoad);
|
||||
horiCursor = **horiCursorH;
|
||||
|
||||
diagCursorH = GetCursor(kDiagCursorID);
|
||||
if (diagCursorH == nil)
|
||||
diagCursor = PortabilityLayer::HostDisplayDriver::GetInstance()->LoadCursor(false, kDiagCursorID);
|
||||
if (diagCursor == nil)
|
||||
RedAlert(kErrFailedResourceLoad);
|
||||
diagCursor = **diagCursorH;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- VariableInit
|
||||
|
||||
@@ -221,15 +221,15 @@ void OpenLinkWindow (void)
|
||||
|
||||
if (linkWindow == nil)
|
||||
{
|
||||
const uint16_t windowStyle = PortabilityLayer::WindowStyleFlags::kTitleBar | PortabilityLayer::WindowStyleFlags::kMiniBar;
|
||||
const uint16_t windowStyle = PortabilityLayer::WindowStyleFlags::kTitleBar | PortabilityLayer::WindowStyleFlags::kMiniBar | PortabilityLayer::WindowStyleFlags::kCloseBox;
|
||||
|
||||
QSetRect(&linkWindowRect, 0, 0, 129, 30);
|
||||
if (thisMac.hasColor)
|
||||
linkWindow = NewCWindow(nil, &linkWindowRect,
|
||||
PSTR("Link"), false, windowStyle, kPutInFront, true, 0L);
|
||||
PSTR("Link"), false, windowStyle, kPutInFront, 0L);
|
||||
else
|
||||
linkWindow = NewWindow(nil, &linkWindowRect,
|
||||
PSTR("Link"), false, windowStyle, kPutInFront, true, 0L);
|
||||
PSTR("Link"), false, windowStyle, kPutInFront, 0L);
|
||||
|
||||
MoveWindow(linkWindow, isLinkH, isLinkV, true);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "House.h"
|
||||
#include "InputManager.h"
|
||||
#include "MenuManager.h"
|
||||
#include "QDPixMap.h"
|
||||
#include "RectUtils.h"
|
||||
#include "PLKeyEncoding.h"
|
||||
#include "PLStandardColors.h"
|
||||
@@ -35,10 +36,8 @@ CTabHandle theCTab;
|
||||
PixMapHandle thePMap;
|
||||
ColorSpec * wasColors;
|
||||
ColorSpec * newColors;
|
||||
CursHandle handCursorH, vertCursorH, horiCursorH;
|
||||
CursHandle diagCursorH;
|
||||
Cursor handCursor, vertCursor, horiCursor;
|
||||
Cursor diagCursor;
|
||||
IGpCursor *handCursor, *vertCursor, *horiCursor;
|
||||
IGpCursor *diagCursor;
|
||||
Rect workSrcRect;
|
||||
DrawSurface *workSrcMap;
|
||||
Rect mainWindowRect;
|
||||
@@ -209,8 +208,8 @@ void OpenMainWindow (void)
|
||||
|
||||
if (OptionKeyDown())
|
||||
{
|
||||
isEditH = 3;
|
||||
isEditV = 41;
|
||||
isEditH = 10;
|
||||
isEditV = 46;
|
||||
}
|
||||
MoveWindow(mainWindow, isEditH, isEditV, true);
|
||||
ShowWindow(mainWindow);
|
||||
@@ -242,7 +241,7 @@ void OpenMainWindow (void)
|
||||
Rect scorebarRect = thisMac.screen;
|
||||
scorebarRect.bottom = scorebarRect.top + kScoreboardTall;
|
||||
|
||||
PortabilityLayer::WindowDef windowDef = PortabilityLayer::WindowDef::Create(scorebarRect, PortabilityLayer::WindowStyleFlags::kBorderless, true, false, 0, 0, PSTR("Scoreboard"));
|
||||
PortabilityLayer::WindowDef windowDef = PortabilityLayer::WindowDef::Create(scorebarRect, PortabilityLayer::WindowStyleFlags::kBorderless, true, 0, 0, PSTR("Scoreboard"));
|
||||
boardWindow = windowManager->CreateWindow(windowDef);
|
||||
if (boardWindow != nil)
|
||||
windowManager->PutWindowBehind(boardWindow, PL_GetPutInFrontWindowPtr());
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "PLWidgets.h"
|
||||
#include "WindowDef.h"
|
||||
#include "WindowManager.h"
|
||||
#include "QDPixMap.h"
|
||||
#include "RectUtils.h"
|
||||
#include "Utilities.h"
|
||||
|
||||
@@ -111,8 +112,7 @@ void FlagMapRoomsForUpdate (void)
|
||||
return;
|
||||
|
||||
// SetPortWindowPort(mapWindow);
|
||||
InvalWindowRect(mapWindow, &wasActiveRoomRect);
|
||||
InvalWindowRect(mapWindow, &activeRoomRect);
|
||||
UpdateMapWindow();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -343,8 +343,8 @@ void ResizeMapWindow (short newH, short newV)
|
||||
mapVScroll->SetPosition(Point::Create(mapWindowRect.right - kMapScrollBarWidth + 2, 0));
|
||||
mapVScroll->Resize(kMapScrollBarWidth, mapWindowRect.bottom - kMapScrollBarWidth + 3);
|
||||
mapTopRoom = mapVScroll->GetState();
|
||||
|
||||
InvalWindowRect(mapWindow, &mapWindowRect);
|
||||
|
||||
UpdateMapWindow();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -362,9 +362,9 @@ void OpenMapWindow (void)
|
||||
mapRoomsWide * kMapRoomWidth + kMapScrollBarWidth - 2,
|
||||
mapRoomsHigh * kMapRoomHeight + kMapScrollBarWidth - 2);
|
||||
|
||||
const uint16_t windowStyle = PortabilityLayer::WindowStyleFlags::kTitleBar | PortabilityLayer::WindowStyleFlags::kResizable | PortabilityLayer::WindowStyleFlags::kMiniBar;
|
||||
const uint16_t windowStyle = PortabilityLayer::WindowStyleFlags::kTitleBar | PortabilityLayer::WindowStyleFlags::kResizable | PortabilityLayer::WindowStyleFlags::kMiniBar | PortabilityLayer::WindowStyleFlags::kCloseBox;;
|
||||
|
||||
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(mapWindowRect, windowStyle, false, true, 0, 0, PSTR("Map"));
|
||||
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(mapWindowRect, windowStyle, false, 0, 0, PSTR("Map"));
|
||||
|
||||
mapWindow = PortabilityLayer::WindowManager::GetInstance()->CreateWindow(wdef);
|
||||
|
||||
@@ -386,7 +386,7 @@ void OpenMapWindow (void)
|
||||
PortabilityLayer::WindowManager::GetInstance()->ShowWindow(mapWindow);
|
||||
// FlagWindowFloating(mapWindow); TEMP - use flaoting windows
|
||||
|
||||
SetPort((GrafPtr)mapWindow);
|
||||
SetPort(&mapWindow->GetDrawSurface()->m_port);
|
||||
QSetRect(&mapHScrollRect, -1, mapRoomsHigh * kMapRoomHeight,
|
||||
mapRoomsWide * kMapRoomWidth + 1,
|
||||
mapRoomsHigh * kMapRoomHeight + kMapScrollBarWidth);
|
||||
@@ -425,6 +425,8 @@ void OpenMapWindow (void)
|
||||
mapWindowRect.bottom + 2);
|
||||
|
||||
CenterMapOnRoom(thisRoom->suite, thisRoom->floor);
|
||||
|
||||
UpdateMapWindow();
|
||||
}
|
||||
|
||||
UpdateMapCheckmark(true);
|
||||
@@ -579,7 +581,7 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
|
||||
{
|
||||
#ifndef COMPILEDEMO
|
||||
Rect aRoom;
|
||||
ControlHandle whichControl;
|
||||
PortabilityLayer::Widget *whichControl = nullptr;
|
||||
Point wherePt, globalWhere;
|
||||
long controlRef;
|
||||
short whichPart, localH, localV;
|
||||
@@ -665,7 +667,7 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
|
||||
}
|
||||
else
|
||||
{
|
||||
controlRef = GetControlReference(whichControl);
|
||||
controlRef = whichControl->GetReferenceConstant();
|
||||
if (controlRef == kHScrollRef)
|
||||
{
|
||||
switch (whichPart)
|
||||
@@ -683,7 +685,7 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
|
||||
case kControlIndicatorPart:
|
||||
if (TrackControl(whichControl, wherePt, nil))
|
||||
{
|
||||
mapLeftRoom = GetControlValue(whichControl);
|
||||
mapLeftRoom = whichControl->GetState();
|
||||
RedrawMapContents();
|
||||
}
|
||||
break;
|
||||
@@ -706,7 +708,7 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
|
||||
case kControlIndicatorPart:
|
||||
if (TrackControl(whichControl, wherePt, nil))
|
||||
{
|
||||
mapTopRoom = GetControlValue(whichControl);
|
||||
mapTopRoom = whichControl->GetState();
|
||||
RedrawMapContents();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -6,11 +6,15 @@
|
||||
|
||||
|
||||
#include "Externs.h"
|
||||
#include "HostDisplayDriver.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "Marquee.h"
|
||||
#include "Objects.h"
|
||||
#include "ObjectEdit.h"
|
||||
#include "RectUtils.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
#define kMarqueePatListID 128
|
||||
#define kHandleSideLong 9
|
||||
@@ -25,7 +29,7 @@ Rect marqueeGliderRect;
|
||||
Boolean gliderMarqueeUp;
|
||||
|
||||
|
||||
extern Cursor handCursor, vertCursor, horiCursor, diagCursor;
|
||||
extern IGpCursor *handCursor, *vertCursor, *horiCursor, *diagCursor;
|
||||
extern Rect leftStartGliderSrc;
|
||||
|
||||
|
||||
@@ -216,7 +220,7 @@ void DragMarqueeRect (DrawSurface *surface, Point start, Rect *theRect, Boolean
|
||||
Point wasPt, newPt;
|
||||
short deltaH, deltaV;
|
||||
|
||||
SetCursor(&handCursor);
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor(handCursor);
|
||||
StopMarquee();
|
||||
|
||||
const uint8_t *pattern = theMarquee.pats[theMarquee.index];
|
||||
@@ -259,9 +263,9 @@ void DragMarqueeHandle (DrawSurface *surface, Point start, short *dragged)
|
||||
short deltaH, deltaV;
|
||||
|
||||
if ((theMarquee.direction == kAbove) || (theMarquee.direction == kBelow))
|
||||
SetCursor(&vertCursor);
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor(vertCursor);
|
||||
else
|
||||
SetCursor(&horiCursor);
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor(horiCursor);
|
||||
StopMarquee();
|
||||
|
||||
const uint8_t *pattern = theMarquee.pats[theMarquee.index];
|
||||
@@ -344,7 +348,7 @@ void DragMarqueeCorner (DrawSurface *surface, Point start, short *hDragged, shor
|
||||
Point wasPt, newPt;
|
||||
short deltaH, deltaV;
|
||||
|
||||
SetCursor(&diagCursor);
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor(diagCursor);
|
||||
StopMarquee();
|
||||
|
||||
const uint8_t *pattern = theMarquee.pats[theMarquee.index];
|
||||
@@ -428,11 +432,9 @@ Boolean PtInMarqueeHandle (Point where)
|
||||
|
||||
void DrawGliderMarquee (void)
|
||||
{
|
||||
CopyBits((BitMap *)*GetGWorldPixMap(blowerMaskMap),
|
||||
GetPortBitMapForCopyBits(GetWindowPort(mainWindow)),
|
||||
&leftStartGliderSrc,
|
||||
&marqueeGliderRect,
|
||||
srcXor);
|
||||
DrawSurface *surface = GetWindowPort(mainWindow);
|
||||
ImageInvert(*GetGWorldPixMap(blowerMaskMap), GetPortBitMapForCopyBits(surface), leftStartGliderSrc, marqueeGliderRect);
|
||||
surface->m_port.SetDirty(PortabilityLayer::QDPortDirtyFlag_Contents);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- SetMarqueeGliderCenter
|
||||
@@ -488,7 +490,7 @@ void DrawMarquee (DrawSurface *surface, const uint8_t *pattern)
|
||||
break;
|
||||
}
|
||||
|
||||
surface->InvertDrawLine(points[0], points[1], pattern);
|
||||
surface->InvertFillRect(Rect::Create(points[0].v, points[0].h, points[1].v, points[1].h), pattern);
|
||||
}
|
||||
|
||||
if (gliderMarqueeUp)
|
||||
|
||||
@@ -747,7 +747,7 @@ short QueryResumeGame (void)
|
||||
theDial = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kResumeGameDial, kPutInFront, &substitutions);
|
||||
if (theDial == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetPort((GrafPtr)theDial);
|
||||
SetPort(&theDial->GetWindow()->GetDrawSurface()->m_port);
|
||||
|
||||
ShowWindow(theDial->GetWindow());
|
||||
DrawDefaultButton(theDial);
|
||||
|
||||
@@ -789,7 +789,7 @@ Boolean AddNewObject (Point where, short what, Boolean showItNow)
|
||||
ReadyBackground(thisRoom->background, thisRoom->tiles);
|
||||
GetThisRoomsObjRects();
|
||||
DrawThisRoomsObjects();
|
||||
InvalWindowRect(mainWindow, &mainWindowRect);
|
||||
UpdateMainWindow();
|
||||
|
||||
if (handled)
|
||||
{
|
||||
|
||||
@@ -2316,8 +2316,7 @@ void DrawThisRoomsObjects (void)
|
||||
if (GetNumberOfLights(thisRoomNumber) <= 0)
|
||||
{
|
||||
surface->SetMaskMode(true);
|
||||
surface->SetPattern8x8(*GetQDGlobalsGray(&dummyPattern));
|
||||
surface->FillRect(backSrcRect);
|
||||
surface->FillRectWithPattern8x8(backSrcRect, *GetQDGlobalsGray(&dummyPattern));
|
||||
surface->SetMaskMode(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -947,7 +947,7 @@ void DoBlowerObjectInfo (short what)
|
||||
infoDial = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kBlowerInfoDialogID, kPutInFront, &substitutions);
|
||||
if (infoDial == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetPort((GrafPtr)infoDial);
|
||||
SetPort(&infoDial->GetWindow()->GetDrawSurface()->m_port);
|
||||
|
||||
newDirection = thisRoom->objects[objActive].data.a.vector & 0x0F;
|
||||
if (thisRoom->objects[objActive].data.a.initial)
|
||||
@@ -1544,7 +1544,7 @@ void DoLightObjectInfo (void)
|
||||
infoDial = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kLightInfoDialogID, kPutInFront, &substitutions);
|
||||
if (infoDial == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetPort((GrafPtr)infoDial);
|
||||
SetPort(&infoDial->GetWindow()->GetDrawSurface()->m_port);
|
||||
|
||||
if (thisRoom->objects[objActive].data.f.initial)
|
||||
SetDialogItemValue(infoDial, kInitialStateCheckbox, 1);
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "Objects.h"
|
||||
#include "Play.h"
|
||||
#include "Player.h"
|
||||
#include "QDPixMap.h"
|
||||
#include "RectUtils.h"
|
||||
#include "Room.h"
|
||||
#include "RubberBands.h"
|
||||
@@ -148,7 +149,7 @@ void DrawReflection (gliderPtr thisGlider, Boolean oneOrTwo)
|
||||
dest = thisGlider->dest;
|
||||
QOffsetRect(&dest, playOriginH - 20, playOriginV - 16);
|
||||
|
||||
SetPort((GrafPtr)workSrcMap);
|
||||
SetPort(&workSrcMap->m_port);
|
||||
|
||||
long numMirrorRects = GetHandleSize(mirrorRects.StaticCast<void>()) / sizeof(Rect);
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "House.h"
|
||||
#include "InputManager.h"
|
||||
#include "MainWindow.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "RectUtils.h"
|
||||
|
||||
|
||||
@@ -197,13 +198,13 @@ Boolean CreateNewRoom (short h, short v)
|
||||
|
||||
if (availableRoom == -1) // found no available rooms
|
||||
{
|
||||
howMuch = sizeof(roomType); // add new room to end of house
|
||||
theErr = PtrAndHand((Ptr)thisRoom, thisHouse.StaticCast<void>(), howMuch);
|
||||
if (theErr != PLErrors::kNone)
|
||||
// add new room to end of house
|
||||
if (!PortabilityLayer::MemoryManager::GetInstance()->ResizeHandle(thisHouse.MMBlock(), thisHouse.MMBlock()->m_size + sizeof(roomType)))
|
||||
{
|
||||
YellowAlert(kYellowUnaccounted, theErr);
|
||||
YellowAlert(kYellowUnaccounted, PLErrors::kOutOfMemory);
|
||||
return (false);
|
||||
}
|
||||
(*thisHouse)->rooms[(*thisHouse)->nRooms] = *thisRoom;
|
||||
(*thisHouse)->nRooms++; // increment nRooms
|
||||
numberRooms = (*thisHouse)->nRooms;
|
||||
previousRoom = thisRoomNumber;
|
||||
@@ -336,7 +337,7 @@ void ReflectCurrentRoom (Boolean forceMapRedraw)
|
||||
|
||||
PL_NotYetImplemented_TODO("FixMe");
|
||||
DebugPixMap(backSrcMap->m_port.GetPixMap(), "DebugData/EditorSplash6");
|
||||
//InvalWindowRect(mainWindow, &mainWindowRect);
|
||||
UpdateMainWindow();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,11 @@
|
||||
#include "DialogManager.h"
|
||||
#include "DialogUtils.h"
|
||||
#include "Externs.h"
|
||||
#include "HostDisplayDriver.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "RectUtils.h"
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
#include "QDPixMap.h"
|
||||
#include "ResourceCompiledRef.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "Utilities.h"
|
||||
@@ -41,7 +45,8 @@
|
||||
void UpdateRoomInfoDialog (Dialog *);
|
||||
void DragMiniTile (DrawSurface *, Point, short *);
|
||||
void HiliteTileOver (DrawSurface *, Point);
|
||||
Boolean RoomFilter (Dialog *, EventRecord *, short *);
|
||||
int16_t RoomFilter (Dialog *dialog, const TimeTaggedVOSEvent *evt);
|
||||
|
||||
short ChooseOriginalArt (short);
|
||||
void UpdateOriginalArt (Dialog *);
|
||||
Boolean OriginalArtFilter (Dialog *, EventRecord *, short *);
|
||||
@@ -58,7 +63,7 @@ short tileOver, tempBack, cursorIs;
|
||||
Boolean originalLeftOpen, originalTopOpen, originalRightOpen, originalBottomOpen;
|
||||
Boolean originalFloor;
|
||||
|
||||
extern Cursor handCursor;
|
||||
extern IGpCursor *handCursor;
|
||||
extern short lastBackground;
|
||||
|
||||
|
||||
@@ -71,7 +76,6 @@ void UpdateRoomInfoDialog (Dialog *theDialog)
|
||||
Rect src, dest;
|
||||
short i;
|
||||
|
||||
DrawDialog(theDialog);
|
||||
if (tempBack >= kUserBackground)
|
||||
SetPopUpMenuValue(theDialog, kRoomPopupItem, kOriginalArtworkItem);
|
||||
else
|
||||
@@ -81,7 +85,7 @@ void UpdateRoomInfoDialog (Dialog *theDialog)
|
||||
|
||||
|
||||
CopyBits(GetPortBitMapForCopyBits(tileSrcMap),
|
||||
GetPortBitMapForCopyBits(GetDialogPort(theDialog)),
|
||||
GetPortBitMapForCopyBits(theDialog->GetWindow()->GetDrawSurface()),
|
||||
&tileSrcRect, &tileSrc, srcCopy);
|
||||
/*
|
||||
CopyBits(&((GrafPtr)tileSrcMap)->portBits,
|
||||
@@ -96,7 +100,7 @@ void UpdateRoomInfoDialog (Dialog *theDialog)
|
||||
QOffsetRect(&src, tempTiles[i] * kMiniTileWide, 0);
|
||||
|
||||
CopyBits(GetPortBitMapForCopyBits(tileSrcMap),
|
||||
GetPortBitMapForCopyBits(GetDialogPort(theDialog)),
|
||||
GetPortBitMapForCopyBits(theDialog->GetWindow()->GetDrawSurface()),
|
||||
&src, &dest, srcCopy);
|
||||
/*
|
||||
CopyBits(&((GrafPtr)tileSrcMap)->portBits,
|
||||
@@ -263,7 +267,7 @@ void HiliteTileOver (DrawSurface *surface, Point mouseIs)
|
||||
{
|
||||
if (cursorIs != kHandCursor)
|
||||
{
|
||||
SetCursor(&handCursor);
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor(handCursor);
|
||||
cursorIs = kHandCursor;
|
||||
}
|
||||
|
||||
@@ -327,7 +331,7 @@ void HiliteTileOver (DrawSurface *surface, Point mouseIs)
|
||||
{
|
||||
if (cursorIs != kBeamCursor)
|
||||
{
|
||||
SetBuiltinCursor(iBeamCursor);
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetStandardCursor(EGpStandardCursors::kIBeam);
|
||||
cursorIs = kBeamCursor;
|
||||
}
|
||||
}
|
||||
@@ -346,78 +350,66 @@ void HiliteTileOver (DrawSurface *surface, Point mouseIs)
|
||||
//-------------------------------------------------------------- RoomFilter
|
||||
#ifndef COMPILEDEMO
|
||||
|
||||
Boolean RoomFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
int16_t RoomFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
|
||||
{
|
||||
Point mouseIs;
|
||||
short newTileOver;
|
||||
|
||||
if (!evt)
|
||||
return -1;
|
||||
|
||||
DrawSurface *surface = dial->GetWindow()->GetDrawSurface();
|
||||
|
||||
switch (event->what)
|
||||
|
||||
if (evt->IsKeyDownEvent())
|
||||
{
|
||||
case keyDown:
|
||||
switch (event->message)
|
||||
switch (PackVOSKeyCode(evt->m_vosEvent.m_event.m_keyboardInputEvent))
|
||||
{
|
||||
case PL_KEY_SPECIAL(kEnter):
|
||||
case PL_KEY_NUMPAD_SPECIAL(kEnter):
|
||||
case PL_KEY_SPECIAL(kEnter):
|
||||
case PL_KEY_NUMPAD_SPECIAL(kEnter):
|
||||
FlashDialogButton(dial, kOkayButton);
|
||||
*item = kOkayButton;
|
||||
return(true);
|
||||
break;
|
||||
return kOkayButton;
|
||||
|
||||
case PL_KEY_SPECIAL(kEscape):
|
||||
case PL_KEY_SPECIAL(kEscape):
|
||||
FlashDialogButton(dial, kCancelButton);
|
||||
*item = kCancelButton;
|
||||
return(true);
|
||||
break;
|
||||
return kCancelButton;
|
||||
|
||||
case PL_KEY_SPECIAL(kTab):
|
||||
case PL_KEY_SPECIAL(kTab):
|
||||
SelectDialogItemText(dial, kRoomNameItem, 0, 1024);
|
||||
return(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
return(false);
|
||||
}
|
||||
break;
|
||||
|
||||
case mouseDown:
|
||||
mouseIs = event->where;
|
||||
mouseIs -= dial->GetWindow()->TopLeftCoord();
|
||||
if (tileSrc.Contains(mouseIs))
|
||||
{
|
||||
if (StillDown())
|
||||
{
|
||||
DragMiniTile(surface, mouseIs, &newTileOver);
|
||||
if ((newTileOver >= 0) && (newTileOver < kNumTiles))
|
||||
{
|
||||
tempTiles[newTileOver] = tileOver;
|
||||
UpdateRoomInfoDialog(dial);
|
||||
}
|
||||
}
|
||||
return(true);
|
||||
}
|
||||
else
|
||||
return(false);
|
||||
break;
|
||||
|
||||
case mouseUp:
|
||||
return(false);
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPortDialogPort(dial);
|
||||
UpdateRoomInfoDialog(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
|
||||
return 0;
|
||||
|
||||
default:
|
||||
GetMouse(&mouseIs);
|
||||
HiliteTileOver(surface, mouseIs);
|
||||
return(false);
|
||||
break;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (evt->m_vosEvent.m_eventType == GpVOSEventTypes::kMouseInput)
|
||||
{
|
||||
const GpMouseInputEvent &mouseEvent = evt->m_vosEvent.m_event.m_mouseInputEvent;
|
||||
|
||||
if (evt->IsLMouseDownEvent())
|
||||
{
|
||||
mouseIs = Point::Create(mouseEvent.m_x, mouseEvent.m_y);
|
||||
mouseIs -= dial->GetWindow()->TopLeftCoord();
|
||||
if (tileSrc.Contains(mouseIs))
|
||||
{
|
||||
if (StillDown())
|
||||
{
|
||||
DragMiniTile(surface, mouseIs, &newTileOver);
|
||||
if ((newTileOver >= 0) && (newTileOver < kNumTiles))
|
||||
{
|
||||
tempTiles[newTileOver] = tileOver;
|
||||
UpdateRoomInfoDialog(dial);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
else if (mouseEvent.m_eventType == GpMouseEventTypes::kMove)
|
||||
{
|
||||
mouseIs = dial->GetWindow()->MouseToLocal(mouseEvent);
|
||||
HiliteTileOver(surface, mouseIs);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -470,7 +462,7 @@ void DoRoomInfo (void)
|
||||
roomInfoDialog = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kRoomInfoDialogID, kPutInFront, &substitutions);
|
||||
if (roomInfoDialog == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetPort((GrafPtr)roomInfoDialog);
|
||||
SetPort(&roomInfoDialog->GetWindow()->GetDrawSurface()->m_port);
|
||||
|
||||
// Fix this later. TEMP
|
||||
// AddMenuToPopUp(roomInfoDialog, kRoomPopupItem, backgroundsMenu);
|
||||
@@ -497,10 +489,12 @@ void DoRoomInfo (void)
|
||||
MyDisableControl(roomInfoDialog, kBoundsButton);
|
||||
|
||||
leaving = false;
|
||||
|
||||
UpdateRoomInfoDialog(roomInfoDialog);
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(RoomFilter, &item);
|
||||
item = roomInfoDialog->ExecuteModal(RoomFilter);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "MenuManager.h"
|
||||
#include "QDPixMap.h"
|
||||
#include "QDStandardPalette.h"
|
||||
#include "RectUtils.h"
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "FontFamily.h"
|
||||
#include "PLWidgets.h"
|
||||
#include "PLPopupMenuWidget.h"
|
||||
#include "QDPixMap.h"
|
||||
#include "RectUtils.h"
|
||||
#include "Utilities.h"
|
||||
#include "WindowDef.h"
|
||||
@@ -199,7 +200,7 @@ void EraseSelectedTool (void)
|
||||
if (toolsWindow == nil)
|
||||
return;
|
||||
|
||||
SetPort((GrafPtr)toolsWindow);
|
||||
SetPort(&toolsWindow->GetDrawSurface()->m_port);
|
||||
|
||||
toolIcon = toolSelected;
|
||||
if ((toolMode == kBlowerMode) && (toolIcon >= 7))
|
||||
@@ -299,9 +300,9 @@ void OpenToolsWindow (void)
|
||||
QOffsetRect(&toolTextRect, 0, 157 - 15);
|
||||
|
||||
{
|
||||
const uint16_t windowStyle = PortabilityLayer::WindowStyleFlags::kTitleBar | PortabilityLayer::WindowStyleFlags::kMiniBar;
|
||||
const uint16_t windowStyle = PortabilityLayer::WindowStyleFlags::kTitleBar | PortabilityLayer::WindowStyleFlags::kMiniBar | PortabilityLayer::WindowStyleFlags::kCloseBox;
|
||||
|
||||
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(toolsWindowRect, windowStyle, false, true, 0, 0, PSTR("Tools"));
|
||||
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(toolsWindowRect, windowStyle, false, 0, 0, PSTR("Tools"));
|
||||
toolsWindow = wm->CreateWindow(wdef);
|
||||
}
|
||||
|
||||
@@ -333,6 +334,8 @@ void OpenToolsWindow (void)
|
||||
classPopUp = PortabilityLayer::PopupMenuWidget::Create(state);
|
||||
}
|
||||
|
||||
toolsWindow->DrawControls();
|
||||
|
||||
if (classPopUp == nil)
|
||||
RedAlert(kErrFailedResourceLoad);
|
||||
|
||||
@@ -473,7 +476,7 @@ void HandleToolsClick (Point wherePt)
|
||||
part = FindControl(wherePt, toolsWindow, &theControl);
|
||||
if ((theControl != nil) && (part != 0))
|
||||
{
|
||||
part = TrackControl(theControl, wherePt, nullptr);
|
||||
part = theControl->Capture(wherePt, nullptr);
|
||||
if (part != 0)
|
||||
{
|
||||
newMode = theControl->GetState();
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "Externs.h"
|
||||
#include "Environ.h"
|
||||
#include "MainWindow.h"
|
||||
#include "QDPixMap.h"
|
||||
#include "PLQDraw.h"
|
||||
#include "RectUtils.h"
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ void OpenMessageWindow (const PLPasStr &title)
|
||||
|
||||
SetRect(&mssgWindowRect, 0, 0, 256, kMessageWindowTall);
|
||||
|
||||
const PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(mssgWindowRect, windowStyle, false, false, 0, 0, title);
|
||||
const PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(mssgWindowRect, windowStyle, false, 0, 0, title);
|
||||
|
||||
mssgWindow = PortabilityLayer::WindowManager::GetInstance()->CreateWindow(wdef);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user