mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 14:53:52 +00:00
Most remaining level editor work
This commit is contained in:
@@ -59,18 +59,28 @@ void ColorOval (DrawSurface *surface, const Rect &theRect, long color)
|
||||
surface->SetForeColor(wasColor);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- ColorRegion
|
||||
void ColorOvalMaskPattern(DrawSurface *surface, const Rect &theRect, long color, bool isMask, const uint8_t *pattern)
|
||||
{
|
||||
const PortabilityLayer::RGBAColor &rgbaColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[color];
|
||||
|
||||
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
|
||||
surface->SetForeColor(rgbaColor);
|
||||
surface->FillEllipseWithPattern(theRect, isMask, pattern);
|
||||
surface->SetForeColor(wasColor);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- ColorRegionMaskPattern
|
||||
|
||||
// Given a region and color index, this function draws a solid<69>
|
||||
// region in that color. Current port, pen mode, etc. assumed.
|
||||
|
||||
void ColorRegion (DrawSurface *surface, PortabilityLayer::ScanlineMask *scanlineMask, long colorIndex)
|
||||
void ColorRegionMaskPattern (DrawSurface *surface, PortabilityLayer::ScanlineMask *scanlineMask, long colorIndex, bool isMask, const uint8_t *pattern)
|
||||
{
|
||||
const PortabilityLayer::RGBAColor &rgbaColor = PortabilityLayer::StandardPalette::GetInstance()->GetColors()[colorIndex];
|
||||
|
||||
const PortabilityLayer::RGBAColor wasColor = surface->GetForeColor();
|
||||
surface->SetForeColor(rgbaColor);
|
||||
surface->FillScanlineMask(scanlineMask);
|
||||
surface->FillScanlineMaskWithPattern(scanlineMask, isMask, pattern);
|
||||
surface->SetForeColor(wasColor);
|
||||
}
|
||||
|
||||
|
@@ -124,18 +124,19 @@ void OpenCoordWindow (void)
|
||||
Rect src, dest;
|
||||
Point globalMouse;
|
||||
short direction, dist;
|
||||
|
||||
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||
|
||||
if (coordWindow == nil)
|
||||
{
|
||||
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, 0L);
|
||||
else
|
||||
coordWindow = NewWindow(nil, &coordWindowRect,
|
||||
PSTR("Tools"), false, windowStyle, kPutInFront, 0L);
|
||||
|
||||
{
|
||||
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(coordWindowRect, windowStyle, true, 0, 0, PSTR("Tools"));
|
||||
coordWindow = wm->CreateWindow(wdef);
|
||||
}
|
||||
|
||||
if (coordWindow == nil)
|
||||
RedAlert(kErrNoMemory);
|
||||
@@ -148,7 +149,7 @@ void OpenCoordWindow (void)
|
||||
MoveWindow(coordWindow, isCoordH, isCoordV, true);
|
||||
|
||||
GetWindowRect(coordWindow, &dest);
|
||||
BringToFront(coordWindow);
|
||||
wm->PutWindowBehind(coordWindow, wm->GetPutInFrontSentinel());
|
||||
PortabilityLayer::WindowManager::GetInstance()->ShowWindow(coordWindow);
|
||||
// FlagWindowFloating(coordWindow); TEMP - use flaoting windows
|
||||
HiliteAllWindows();
|
||||
|
@@ -374,8 +374,6 @@ void DrawDefaultButton (Dialog *theDialog)
|
||||
surface->FrameRoundRect(offsetRect, 8, 8);
|
||||
}
|
||||
}
|
||||
|
||||
PenNormal();
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- GetDialogString
|
||||
@@ -602,7 +600,6 @@ void DrawDialogUserText (Dialog *dial, short item, StringPtr text, Boolean inver
|
||||
iRect.right -= inset;
|
||||
|
||||
// Draw centered
|
||||
PL_NotYetImplemented_TODO("Clip to iRect");
|
||||
|
||||
const int32_t ascender = surface->MeasureFontAscender();
|
||||
|
||||
@@ -709,7 +706,7 @@ void FrameOvalDialogItem (Dialog *theDialog, short item)
|
||||
// Given a dialog item, this function draws any combination of 4 sides<65>
|
||||
// of a box around it. Which sides get drawn is encoded in "sides".
|
||||
|
||||
void BorderDialogItem (Dialog *theDialog, short item, short sides)
|
||||
void BorderDialogItem(Dialog *theDialog, short item, short sides, short thickness, const uint8_t *pattern)
|
||||
{
|
||||
// 1 = left
|
||||
// 2 = top
|
||||
@@ -725,29 +722,65 @@ void BorderDialogItem (Dialog *theDialog, short item, short sides)
|
||||
if (sides >= 8) // 8 = right
|
||||
{
|
||||
const Point pointA = Point::Create(itemRect.right, itemRect.top);
|
||||
const Point pointB = Point::Create(itemRect.right, itemRect.bottom);
|
||||
surface->DrawLine(pointA, pointB);
|
||||
const Point pointB = Point::Create(itemRect.right + thickness, itemRect.bottom + 1);
|
||||
const Rect rect = Rect::Create(pointA.v, pointA.h, pointB.v, pointB.h);
|
||||
if (pattern)
|
||||
{
|
||||
surface->SetForeColor(StdColors::White());
|
||||
surface->FillRect(rect);
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
surface->FillRectWithPattern8x8(rect, true, pattern);
|
||||
}
|
||||
else
|
||||
surface->FillRect(rect);
|
||||
sides -= 8;
|
||||
}
|
||||
if (sides >= 4) // 4 = bottom
|
||||
{
|
||||
const Point pointA = Point::Create(itemRect.left, itemRect.bottom);
|
||||
const Point pointB = Point::Create(itemRect.right, itemRect.bottom);
|
||||
surface->DrawLine(pointA, pointB);
|
||||
const Point pointB = Point::Create(itemRect.right + 1, itemRect.bottom + thickness);
|
||||
const Rect rect = Rect::Create(pointA.v, pointA.h, pointB.v, pointB.h);
|
||||
if (pattern)
|
||||
{
|
||||
surface->SetForeColor(StdColors::White());
|
||||
surface->FillRect(rect);
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
surface->FillRectWithPattern8x8(rect, true, pattern);
|
||||
}
|
||||
else
|
||||
surface->FillRect(rect);
|
||||
sides -= 4;
|
||||
}
|
||||
if (sides >= 2) // 2 = top
|
||||
{
|
||||
const Point pointA = Point::Create(itemRect.left, itemRect.top - 1);
|
||||
const Point pointB = Point::Create(itemRect.right, itemRect.top - 1);
|
||||
surface->DrawLine(pointA, pointB);
|
||||
const Point pointB = Point::Create(itemRect.right + 1, itemRect.top + thickness);
|
||||
const Rect rect = Rect::Create(pointA.v, pointA.h, pointB.v, pointB.h);
|
||||
if (pattern)
|
||||
{
|
||||
surface->SetForeColor(StdColors::White());
|
||||
surface->FillRect(rect);
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
surface->FillRectWithPattern8x8(rect, true, pattern);
|
||||
}
|
||||
else
|
||||
surface->FillRect(rect);
|
||||
sides -= 2;
|
||||
}
|
||||
if (sides >= 1) // 1 = left
|
||||
{
|
||||
const Point pointA = Point::Create(itemRect.left - 1, itemRect.top);
|
||||
const Point pointB = Point::Create(itemRect.left - 1, itemRect.bottom);
|
||||
surface->DrawLine(pointA, pointB);
|
||||
const Point pointB = Point::Create(itemRect.left - 1 + thickness, itemRect.bottom + 1);
|
||||
const Rect rect = Rect::Create(pointA.v, pointA.h, pointB.v, pointB.h);
|
||||
if (pattern)
|
||||
{
|
||||
surface->SetForeColor(StdColors::White());
|
||||
surface->FillRect(rect);
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
surface->FillRectWithPattern8x8(rect, true, pattern);
|
||||
}
|
||||
else
|
||||
surface->FillRect(rect);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -43,6 +43,6 @@ void LoadDialogPICT (Dialog *, short, short);
|
||||
void FrameDialogItem (Dialog *, short);
|
||||
void FrameDialogItemC (Dialog *, short, long);
|
||||
void FrameOvalDialogItem (Dialog *, short);
|
||||
void BorderDialogItem (Dialog *, short, short);
|
||||
void BorderDialogItem (Dialog *theDialog, short item, short sides, short thickness, const uint8_t *pattern);
|
||||
void ShadowDialogItem (Dialog *, short, short);
|
||||
void EraseDialogItem (Dialog *, short);
|
||||
|
@@ -135,7 +135,8 @@ void BackSpinCursor (short);
|
||||
void ColorText (DrawSurface *surface, const Point &, StringPtr, long); // --- ColorUtils.c
|
||||
void ColorRect (DrawSurface *surface, const Rect &, long);
|
||||
void ColorOval (DrawSurface *surface, const Rect &, long);
|
||||
void ColorRegion (DrawSurface *surface, PortabilityLayer::ScanlineMask *scanlineMask, long colorIndex);
|
||||
void ColorOvalMaskPattern (DrawSurface *surface, const Rect &, long, bool, const uint8_t *);
|
||||
void ColorRegionMaskPattern (DrawSurface *surface, PortabilityLayer::ScanlineMask *scanlineMask, long colorIndex, bool isMask, const uint8_t *pattern);
|
||||
void ColorLine (DrawSurface *surface, short, short, short, short, long);
|
||||
void HiliteRect (DrawSurface *surface, const Rect &rect, short, short);
|
||||
void ColorFrameRect (DrawSurface *surface, const Rect &theRect, long colorIndex);
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include "FileManager.h"
|
||||
#include "HostFileSystem.h"
|
||||
#include "House.h"
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
#include "RectUtils.h"
|
||||
#include "ResourceManager.h"
|
||||
|
||||
@@ -26,7 +27,7 @@
|
||||
|
||||
|
||||
void UpdateGoToDialog (Dialog *);
|
||||
Boolean GoToFilter (Dialog *, EventRecord *, short *);
|
||||
int16_t GoToFilter (Dialog *dial, const TimeTaggedVOSEvent *evt);
|
||||
|
||||
extern PortabilityLayer::ResourceArchive *houseResFork;
|
||||
|
||||
@@ -594,7 +595,6 @@ void GenerateRetroLinks (void)
|
||||
|
||||
void UpdateGoToDialog (Dialog *theDialog)
|
||||
{
|
||||
DrawDialog(theDialog);
|
||||
DrawDefaultButton(theDialog);
|
||||
FrameDialogItemC(theDialog, 10, kRedOrangeColor8);
|
||||
}
|
||||
@@ -602,37 +602,27 @@ void UpdateGoToDialog (Dialog *theDialog)
|
||||
//-------------------------------------------------------------- GoToFilter
|
||||
// Dialog filter for the "Go To Room..." dialog.
|
||||
|
||||
Boolean GoToFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
int16_t GoToFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
|
||||
{
|
||||
switch (event->what)
|
||||
if (!evt)
|
||||
return -1;
|
||||
|
||||
if (evt->IsKeyDownEvent())
|
||||
{
|
||||
case keyDown:
|
||||
switch (event->message)
|
||||
const GpKeyboardInputEvent &keyEvt = evt->m_vosEvent.m_event.m_keyboardInputEvent;
|
||||
switch (PackVOSKeyCode(keyEvt))
|
||||
{
|
||||
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;
|
||||
|
||||
default:
|
||||
return(false);
|
||||
}
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPortDialogPort(dial);
|
||||
UpdateGoToDialog(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
|
||||
return kOkayButton;
|
||||
|
||||
default:
|
||||
return(false);
|
||||
break;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DoGoToDialog
|
||||
@@ -664,10 +654,12 @@ Boolean GoToFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
|
||||
leaving = false;
|
||||
canceled = false;
|
||||
|
||||
UpdateGoToDialog(theDialog);
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(GoToFilter, &item);
|
||||
item = theDialog->ExecuteModal(GoToFilter);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include "DialogUtils.h"
|
||||
#include "HostDisplayDriver.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
|
||||
|
||||
#define kHouseInfoDialogID 1001
|
||||
@@ -31,7 +32,7 @@
|
||||
|
||||
long CountTotalHousePoints (void);
|
||||
void UpdateHouseInfoDialog (Dialog *);
|
||||
Boolean HouseFilter (Dialog *, EventRecord *, short *);
|
||||
int16_t HouseFilter(Dialog *dial, const TimeTaggedVOSEvent *evt);
|
||||
Boolean WarnLockingHouse (void);
|
||||
void HowToZeroScores (void);
|
||||
|
||||
@@ -109,7 +110,6 @@ void UpdateHouseInfoDialog (Dialog *theDialog)
|
||||
{
|
||||
short nChars;
|
||||
|
||||
DrawDialog(theDialog);
|
||||
nChars = GetDialogStringLen(theDialog, kBannerTextItem);
|
||||
SetDialogNumToStr(theDialog, kBannerNCharsItem, (long)nChars);
|
||||
nChars = GetDialogStringLen(theDialog, kTrailerTextItem);
|
||||
@@ -121,7 +121,7 @@ void UpdateHouseInfoDialog (Dialog *theDialog)
|
||||
|
||||
//-------------------------------------------------------------- HouseFilter
|
||||
|
||||
Boolean HouseFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
int16_t HouseFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
|
||||
{
|
||||
Point mouseIs;
|
||||
short nChars;
|
||||
@@ -134,70 +134,66 @@ Boolean HouseFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
SetDialogNumToStr(dial, kTrailerNCharsItem, (long)nChars);
|
||||
keyHit = false;
|
||||
}
|
||||
|
||||
switch (event->what)
|
||||
{
|
||||
case keyDown:
|
||||
switch (event->message)
|
||||
{
|
||||
case PL_KEY_SPECIAL(kEnter):
|
||||
case PL_KEY_NUMPAD_SPECIAL(kEnter):
|
||||
FlashDialogButton(dial, kOkayButton);
|
||||
*item = kOkayButton;
|
||||
return(true);
|
||||
break;
|
||||
|
||||
case PL_KEY_SPECIAL(kEscape):
|
||||
FlashDialogButton(dial, kCancelButton);
|
||||
*item = kCancelButton;
|
||||
return(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
keyHit = true;
|
||||
return(false);
|
||||
}
|
||||
break;
|
||||
|
||||
case mouseDown:
|
||||
return(false);
|
||||
break;
|
||||
|
||||
case mouseUp:
|
||||
return(false);
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPortDialogPort(dial);
|
||||
UpdateHouseInfoDialog(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
mouseIs = event->where;
|
||||
mouseIs -= dial->GetWindow()->TopLeftCoord();
|
||||
if ((houseEditText1.Contains(mouseIs)) ||
|
||||
(houseEditText2.Contains(mouseIs)))
|
||||
if (evt)
|
||||
{
|
||||
if (evt->m_vosEvent.m_eventType == GpVOSEventTypes::kKeyboardInput)
|
||||
{
|
||||
if (houseCursorIs != kBeamCursor)
|
||||
const GpKeyboardInputEvent &keyEvt = evt->m_vosEvent.m_event.m_keyboardInputEvent;
|
||||
|
||||
if (keyEvt.m_eventType == GpKeyboardInputEventTypes::kDown)
|
||||
{
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetStandardCursor(EGpStandardCursors::kIBeam);
|
||||
houseCursorIs = kBeamCursor;
|
||||
switch (PackVOSKeyCode(keyEvt))
|
||||
{
|
||||
case PL_KEY_NUMPAD_SPECIAL(kEnter):
|
||||
FlashDialogButton(dial, kOkayButton);
|
||||
return kOkayButton;
|
||||
|
||||
case PL_KEY_SPECIAL(kEscape):
|
||||
FlashDialogButton(dial, kCancelButton);
|
||||
return kCancelButton;
|
||||
|
||||
default:
|
||||
keyHit = true;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (keyEvt.m_eventType == GpKeyboardInputEventTypes::kDownChar || keyEvt.m_eventType == GpKeyboardInputEventTypes::kAutoChar)
|
||||
{
|
||||
keyHit = true;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (evt->m_vosEvent.m_eventType == GpVOSEventTypes::kMouseInput)
|
||||
{
|
||||
if (houseCursorIs != kArrowCursor)
|
||||
const GpMouseInputEvent &mouseEvt = evt->m_vosEvent.m_event.m_mouseInputEvent;
|
||||
|
||||
if (mouseEvt.m_eventType == GpMouseEventTypes::kMove)
|
||||
{
|
||||
InitCursor();
|
||||
houseCursorIs = kArrowCursor;
|
||||
mouseIs = Point::Create(mouseEvt.m_x, mouseEvt.m_y);
|
||||
mouseIs -= dial->GetWindow()->TopLeftCoord();
|
||||
if ((houseEditText1.Contains(mouseIs)) ||
|
||||
(houseEditText2.Contains(mouseIs)))
|
||||
{
|
||||
if (houseCursorIs != kBeamCursor)
|
||||
{
|
||||
PortabilityLayer::HostDisplayDriver::GetInstance()->SetStandardCursor(EGpStandardCursors::kIBeam);
|
||||
houseCursorIs = kBeamCursor;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (houseCursorIs != kArrowCursor)
|
||||
{
|
||||
InitCursor();
|
||||
houseCursorIs = kArrowCursor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return(false);
|
||||
break;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- DoHouseInfo
|
||||
@@ -243,10 +239,12 @@ void DoHouseInfo (void)
|
||||
GetDialogItemRect(houseInfoDialog, kTrailerTextItem, &houseEditText2);
|
||||
houseCursorIs = kArrowCursor;
|
||||
leaving = false;
|
||||
|
||||
UpdateHouseInfoDialog(houseInfoDialog);
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(HouseFilter, &item);
|
||||
item = houseInfoDialog->ExecuteModal(HouseFilter);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
|
@@ -66,9 +66,9 @@ void UpdateLinkControl (void)
|
||||
|
||||
switch (linkType)
|
||||
{
|
||||
case kSwitchLinkOnly:
|
||||
case kSwitchLinkOnly:
|
||||
if (objActive == kNoObjectSelected)
|
||||
HiliteControl(linkControl, kControlInactive);
|
||||
linkControl->SetEnabled(false);// HiliteControl(linkControl, kControlInactive);
|
||||
else
|
||||
switch (thisRoom->objects[objActive].what)
|
||||
{
|
||||
@@ -119,18 +119,18 @@ void UpdateLinkControl (void)
|
||||
case kBall:
|
||||
case kDrip:
|
||||
case kFish:
|
||||
HiliteControl(linkControl, kControlActive);
|
||||
linkControl->SetEnabled(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
HiliteControl(linkControl, kControlInactive);
|
||||
linkControl->SetEnabled(false);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case kTriggerLinkOnly:
|
||||
if (objActive == kNoObjectSelected)
|
||||
HiliteControl(linkControl, kControlInactive);
|
||||
linkControl->SetEnabled(false);
|
||||
else
|
||||
switch (thisRoom->objects[objActive].what)
|
||||
{
|
||||
@@ -147,7 +147,7 @@ void UpdateLinkControl (void)
|
||||
case kDartRt:
|
||||
case kDrip:
|
||||
case kFish:
|
||||
HiliteControl(linkControl, kControlActive);
|
||||
linkControl->SetEnabled(true);
|
||||
break;
|
||||
|
||||
case kLightSwitch:
|
||||
@@ -157,18 +157,18 @@ void UpdateLinkControl (void)
|
||||
case kKnifeSwitch:
|
||||
case kInvisSwitch:
|
||||
if (linkRoom == thisRoomNumber)
|
||||
HiliteControl(linkControl, kControlActive);
|
||||
linkControl->SetEnabled(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
HiliteControl(linkControl, kControlInactive);
|
||||
linkControl->SetEnabled(false);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case kTransportLinkOnly:
|
||||
if (objActive == kNoObjectSelected)
|
||||
HiliteControl(linkControl, kControlInactive);
|
||||
linkControl->SetEnabled(false);
|
||||
else
|
||||
switch (thisRoom->objects[objActive].what)
|
||||
{
|
||||
@@ -185,11 +185,11 @@ void UpdateLinkControl (void)
|
||||
case kCalendar:
|
||||
case kBulletin:
|
||||
case kCloud:
|
||||
HiliteControl(linkControl, kControlActive);
|
||||
linkControl->SetEnabled(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
HiliteControl(linkControl, kControlInactive);
|
||||
linkControl->SetEnabled(false);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -218,23 +218,25 @@ void OpenLinkWindow (void)
|
||||
#ifndef COMPILEDEMO
|
||||
Rect src, dest;
|
||||
Point globalMouse;
|
||||
|
||||
PortabilityLayer::WindowManager *wm = PortabilityLayer::WindowManager::GetInstance();
|
||||
|
||||
if (linkWindow == nil)
|
||||
{
|
||||
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, 0L);
|
||||
else
|
||||
linkWindow = NewWindow(nil, &linkWindowRect,
|
||||
PSTR("Link"), false, windowStyle, kPutInFront, 0L);
|
||||
|
||||
{
|
||||
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(linkWindowRect, windowStyle, true, 0, 0, PSTR("Link"));
|
||||
linkWindow = wm->CreateWindow(wdef);
|
||||
}
|
||||
|
||||
wm->PutWindowBehind(linkWindow, wm->GetPutInFrontSentinel());
|
||||
|
||||
MoveWindow(linkWindow, isLinkH, isLinkV, true);
|
||||
|
||||
GetWindowRect(linkWindow, &dest);
|
||||
BringToFront(linkWindow);
|
||||
PortabilityLayer::WindowManager::GetInstance()->ShowWindow(linkWindow);
|
||||
// FlagWindowFloating(linkWindow); TEMP - use flaoting windows
|
||||
HiliteAllWindows();
|
||||
@@ -250,6 +252,8 @@ void OpenLinkWindow (void)
|
||||
basicState.m_text.Set(6, "Unlink");
|
||||
basicState.m_window = linkWindow;
|
||||
unlinkControl = PortabilityLayer::ButtonWidget::Create(basicState);
|
||||
|
||||
linkWindow->DrawControls();
|
||||
|
||||
linkRoom = -1;
|
||||
linkObject = 255;
|
||||
@@ -265,7 +269,7 @@ void CloseLinkWindow (void)
|
||||
{
|
||||
#ifndef COMPILEDEMO
|
||||
if (linkWindow != nil)
|
||||
DisposeWindow(linkWindow);
|
||||
PortabilityLayer::WindowManager::GetInstance()->DestroyWindow(linkWindow);
|
||||
|
||||
linkWindow = nil;
|
||||
isLinkOpen = false;
|
||||
@@ -380,7 +384,7 @@ void HandleLinkClick (Point wherePt)
|
||||
part = FindControl(wherePt, linkWindow, &theControl);
|
||||
if ((theControl != nil) && (part != 0))
|
||||
{
|
||||
part = TrackControl(theControl, wherePt, nil);
|
||||
part = theControl->Capture(wherePt, nullptr);
|
||||
if (part != 0)
|
||||
{
|
||||
if (theControl == linkControl)
|
||||
|
@@ -368,7 +368,8 @@ void UpdateEditWindowTitle (void)
|
||||
}
|
||||
else
|
||||
PasStringConcat(newTitle, PSTR("House Locked"));
|
||||
SetWTitle(mainWindow, newTitle);
|
||||
|
||||
PortabilityLayer::WindowManager::GetInstance()->SetWindowTitle(mainWindow, newTitle);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -254,7 +254,7 @@ void RedrawMapContents (void)
|
||||
surface->SetForeColor(StdColors::Blue());
|
||||
|
||||
Pattern dummyPat;
|
||||
surface->FillRectWithPattern8x8(aRoom, *GetQDGlobalsGray(&dummyPat));
|
||||
surface->FillRectWithPattern8x8(aRoom, true, *GetQDGlobalsGray(&dummyPat));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -339,7 +339,6 @@ void DragMarqueeHandle (Window *window, DrawSurface *surface, Point start, short
|
||||
}
|
||||
surface->InvertFrameRect(theMarquee.bounds, pattern);
|
||||
surface->InvertFillRect(theMarquee.handle, pattern);
|
||||
PenNormal();
|
||||
InitCursor();
|
||||
}
|
||||
|
||||
@@ -401,7 +400,6 @@ void DragMarqueeCorner (Window *window, DrawSurface *surface, Point start, short
|
||||
}
|
||||
surface->InvertFrameRect(theMarquee.bounds, pattern);
|
||||
surface->InvertFillRect(theMarquee.handle, pattern);
|
||||
PenNormal();
|
||||
InitCursor();
|
||||
}
|
||||
|
||||
|
@@ -161,15 +161,12 @@ void DrawTable (Rect *tableTop, short down)
|
||||
-HalfRectTall(&tempRect) + kTableShadowTop + down);
|
||||
QOffsetRect(&tempRect, kTableShadowOffset, -kTableShadowOffset);
|
||||
|
||||
backSrcMap->SetPattern8x8(*GetQDGlobalsGray(&dummyPattern));
|
||||
backSrcMap->SetMaskMode(true);
|
||||
GetQDGlobalsGray(&dummyPattern);
|
||||
|
||||
if (thisMac.isDepth == 4)
|
||||
ColorOval(backSrcMap, tempRect, 15);
|
||||
ColorOvalMaskPattern(backSrcMap, tempRect, 15, true, dummyPattern);
|
||||
else
|
||||
ColorOval(backSrcMap, tempRect, k8DkstGrayColor);
|
||||
backSrcMap->ClearPattern();
|
||||
backSrcMap->SetMaskMode(false);
|
||||
ColorOvalMaskPattern(backSrcMap, tempRect, k8DkstGrayColor, true, dummyPattern);
|
||||
|
||||
InsetRect(tableTop, 0, 1);
|
||||
ColorRect(backSrcMap, *tableTop, brownC);
|
||||
@@ -280,14 +277,11 @@ void DrawShelf (Rect *shelfTop)
|
||||
|
||||
if (mask)
|
||||
{
|
||||
backSrcMap->SetPattern8x8(*GetQDGlobalsGray(&dummyPattern));
|
||||
backSrcMap->SetMaskMode(true);
|
||||
GetQDGlobalsGray(&dummyPattern);
|
||||
if (thisMac.isDepth == 4)
|
||||
ColorRegion(backSrcMap, mask, 15);
|
||||
ColorRegionMaskPattern(backSrcMap, mask, 15, true, dummyPattern);
|
||||
else
|
||||
ColorRegion(backSrcMap, mask, k8DkstGrayColor);
|
||||
backSrcMap->ClearPattern();
|
||||
backSrcMap->SetMaskMode(false);
|
||||
ColorRegionMaskPattern(backSrcMap, mask, k8DkstGrayColor, true, dummyPattern);
|
||||
mask->Destroy();
|
||||
}
|
||||
|
||||
@@ -371,14 +365,11 @@ void DrawCabinet (Rect *cabinet)
|
||||
|
||||
if (mask)
|
||||
{
|
||||
backSrcMap->SetPattern8x8(*GetQDGlobalsGray(&dummyPattern));
|
||||
backSrcMap->SetMaskMode(true);
|
||||
GetQDGlobalsGray(&dummyPattern);
|
||||
if (thisMac.isDepth == 4)
|
||||
ColorRegion(backSrcMap, mask, 15);
|
||||
ColorRegionMaskPattern(backSrcMap, mask, 15, true, dummyPattern);
|
||||
else
|
||||
ColorRegion(backSrcMap, mask, dkGrayC);
|
||||
backSrcMap->ClearPattern();
|
||||
backSrcMap->SetMaskMode(false);
|
||||
ColorRegionMaskPattern(backSrcMap, mask, dkGrayC, true, dummyPattern);
|
||||
|
||||
mask->Destroy();
|
||||
}
|
||||
@@ -511,14 +502,11 @@ void DrawCounter(Rect *counter)
|
||||
|
||||
if (mask)
|
||||
{
|
||||
backSrcMap->SetPattern8x8(*GetQDGlobalsGray(&dummyPattern));
|
||||
backSrcMap->SetMaskMode(true);
|
||||
GetQDGlobalsGray(&dummyPattern);
|
||||
if (thisMac.isDepth == 4)
|
||||
ColorRegion(backSrcMap, mask, 15);
|
||||
ColorRegionMaskPattern(backSrcMap, mask, 15, true, dummyPattern);
|
||||
else
|
||||
ColorRegion(backSrcMap, mask, dkGrayC);
|
||||
backSrcMap->ClearPattern();
|
||||
backSrcMap->SetMaskMode(false);
|
||||
ColorRegionMaskPattern(backSrcMap, mask, dkGrayC, true, dummyPattern);
|
||||
|
||||
mask->Destroy();
|
||||
}
|
||||
@@ -758,10 +746,8 @@ void DrawDeckTable (Rect *tableTop, short down)
|
||||
QOffsetRect(&tempRect, 0,
|
||||
-HalfRectTall(&tempRect) + kTableShadowTop + down);
|
||||
QOffsetRect(&tempRect, kTableShadowOffset, -kTableShadowOffset);
|
||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||
PenMask(true);
|
||||
ColorOval(backSrcMap, tempRect, dkGrayC);
|
||||
PenNormal();
|
||||
GetQDGlobalsGray(&dummyPattern);
|
||||
ColorOvalMaskPattern(backSrcMap, tempRect, dkGrayC, true, dummyPattern);
|
||||
|
||||
InsetRect(tableTop, 0, 1);
|
||||
ColorRect(backSrcMap, *tableTop, kGoldColor);
|
||||
|
@@ -148,49 +148,51 @@ void DragHandle (Window *window, DrawSurface *surface, Point where)
|
||||
{
|
||||
short hDelta, vDelta;
|
||||
Boolean whoCares;
|
||||
|
||||
bool redrawMainWindow = false;
|
||||
|
||||
switch (thisRoom->objects[objActive].what)
|
||||
{
|
||||
case kFloorVent:
|
||||
case kCeilingVent:
|
||||
case kFloorBlower:
|
||||
case kCeilingBlower:
|
||||
case kSewerGrate:
|
||||
case kTaper:
|
||||
case kCandle:
|
||||
case kStubby:
|
||||
case kTiki:
|
||||
case kBBQ:
|
||||
case kGrecoVent:
|
||||
case kSewerBlower:
|
||||
case kFloorVent:
|
||||
case kCeilingVent:
|
||||
case kFloorBlower:
|
||||
case kCeilingBlower:
|
||||
case kSewerGrate:
|
||||
case kTaper:
|
||||
case kCandle:
|
||||
case kStubby:
|
||||
case kTiki:
|
||||
case kBBQ:
|
||||
case kGrecoVent:
|
||||
case kSewerBlower:
|
||||
vDelta = thisRoom->objects[objActive].data.a.distance;
|
||||
DragMarqueeHandle(window, surface, where, &vDelta);
|
||||
thisRoom->objects[objActive].data.a.distance = vDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
break;
|
||||
|
||||
case kLiftArea:
|
||||
case kLiftArea:
|
||||
hDelta = thisRoom->objects[objActive].data.a.distance;
|
||||
vDelta = thisRoom->objects[objActive].data.a.tall * 2;
|
||||
DragMarqueeCorner(window, surface, where, &hDelta, &vDelta, false);
|
||||
thisRoom->objects[objActive].data.a.distance = hDelta;
|
||||
thisRoom->objects[objActive].data.a.tall = vDelta / 2;
|
||||
whoCares = KeepObjectLegal();
|
||||
InvalWindowRect(mainWindow, &mainWindowRect);
|
||||
redrawMainWindow = true;
|
||||
GetThisRoomsObjRects();
|
||||
ReadyBackground(thisRoom->background, thisRoom->tiles);
|
||||
DrawThisRoomsObjects();
|
||||
break;
|
||||
|
||||
case kLeftFan:
|
||||
case kRightFan:
|
||||
case kLeftFan:
|
||||
case kRightFan:
|
||||
hDelta = thisRoom->objects[objActive].data.a.distance;
|
||||
DragMarqueeHandle(window, surface, where, &hDelta);
|
||||
thisRoom->objects[objActive].data.a.distance = hDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
break;
|
||||
|
||||
case kInvisBlower:
|
||||
case kInvisBlower:
|
||||
if (((thisRoom->objects[objActive].data.a.vector & 0x0F) == 1) ||
|
||||
((thisRoom->objects[objActive].data.a.vector & 0x0F) == 4))
|
||||
{
|
||||
@@ -207,23 +209,23 @@ void DragHandle (Window *window, DrawSurface *surface, Point where)
|
||||
whoCares = KeepObjectLegal();
|
||||
break;
|
||||
|
||||
case kTable:
|
||||
case kShelf:
|
||||
case kDeckTable:
|
||||
case kTable:
|
||||
case kShelf:
|
||||
case kDeckTable:
|
||||
hDelta = RectWide(&thisRoom->objects[objActive].data.b.bounds);
|
||||
DragMarqueeHandle(window, surface, where, &hDelta);
|
||||
thisRoom->objects[objActive].data.b.bounds.right =
|
||||
thisRoom->objects[objActive].data.b.bounds.left + hDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
InvalWindowRect(mainWindow, &mainWindowRect);
|
||||
redrawMainWindow = true;
|
||||
GetThisRoomsObjRects();
|
||||
ReadyBackground(thisRoom->background, thisRoom->tiles);
|
||||
DrawThisRoomsObjects();
|
||||
break;
|
||||
|
||||
case kCabinet:
|
||||
case kInvisObstacle:
|
||||
case kInvisBounce:
|
||||
case kCabinet:
|
||||
case kInvisObstacle:
|
||||
case kInvisBounce:
|
||||
hDelta = RectWide(&thisRoom->objects[objActive].data.b.bounds);
|
||||
vDelta = RectTall(&thisRoom->objects[objActive].data.b.bounds);
|
||||
DragMarqueeCorner(window, surface, where, &hDelta, &vDelta, false);
|
||||
@@ -232,14 +234,14 @@ void DragHandle (Window *window, DrawSurface *surface, Point where)
|
||||
thisRoom->objects[objActive].data.b.bounds.bottom =
|
||||
thisRoom->objects[objActive].data.b.bounds.top + vDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
InvalWindowRect(mainWindow, &mainWindowRect);
|
||||
redrawMainWindow = true;
|
||||
GetThisRoomsObjRects();
|
||||
ReadyBackground(thisRoom->background, thisRoom->tiles);
|
||||
DrawThisRoomsObjects();
|
||||
break;
|
||||
|
||||
case kCounter:
|
||||
case kDresser:
|
||||
case kCounter:
|
||||
case kDresser:
|
||||
hDelta = RectWide(&thisRoom->objects[objActive].data.b.bounds);
|
||||
vDelta = RectTall(&thisRoom->objects[objActive].data.b.bounds);
|
||||
DragMarqueeCorner(window, surface, where, &hDelta, &vDelta, true);
|
||||
@@ -248,26 +250,26 @@ void DragHandle (Window *window, DrawSurface *surface, Point where)
|
||||
thisRoom->objects[objActive].data.b.bounds.top =
|
||||
thisRoom->objects[objActive].data.b.bounds.bottom - vDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
InvalWindowRect(mainWindow, &mainWindowRect);
|
||||
redrawMainWindow = true;
|
||||
GetThisRoomsObjRects();
|
||||
ReadyBackground(thisRoom->background, thisRoom->tiles);
|
||||
DrawThisRoomsObjects();
|
||||
break;
|
||||
|
||||
case kGreaseRt:
|
||||
case kGreaseLf:
|
||||
case kSlider:
|
||||
case kGreaseRt:
|
||||
case kGreaseLf:
|
||||
case kSlider:
|
||||
hDelta = thisRoom->objects[objActive].data.c.length;
|
||||
DragMarqueeHandle(window, surface, where, &hDelta);
|
||||
thisRoom->objects[objActive].data.c.length = hDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
InvalWindowRect(mainWindow, &mainWindowRect);
|
||||
redrawMainWindow = true;
|
||||
GetThisRoomsObjRects();
|
||||
ReadyBackground(thisRoom->background, thisRoom->tiles);
|
||||
DrawThisRoomsObjects();
|
||||
break;
|
||||
|
||||
case kInvisTrans:
|
||||
case kInvisTrans:
|
||||
hDelta = thisRoom->objects[objActive].data.d.wide;
|
||||
vDelta = thisRoom->objects[objActive].data.d.tall;
|
||||
DragMarqueeCorner(window, surface, where, &hDelta, &vDelta, false);
|
||||
@@ -276,13 +278,13 @@ void DragHandle (Window *window, DrawSurface *surface, Point where)
|
||||
thisRoom->objects[objActive].data.d.wide = (Byte)hDelta;
|
||||
thisRoom->objects[objActive].data.d.tall = vDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
InvalWindowRect(mainWindow, &mainWindowRect);
|
||||
redrawMainWindow = true;
|
||||
GetThisRoomsObjRects();
|
||||
ReadyBackground(thisRoom->background, thisRoom->tiles);
|
||||
DrawThisRoomsObjects();
|
||||
break;
|
||||
|
||||
case kDeluxeTrans:
|
||||
case kDeluxeTrans:
|
||||
hDelta = ((thisRoom->objects[objActive].data.d.tall & 0xFF00) >> 8) * 4;
|
||||
vDelta = (thisRoom->objects[objActive].data.d.tall & 0x00FF) * 4;
|
||||
DragMarqueeCorner(window, surface, where, &hDelta, &vDelta, false);
|
||||
@@ -292,14 +294,14 @@ void DragHandle (Window *window, DrawSurface *surface, Point where)
|
||||
vDelta = 32;
|
||||
thisRoom->objects[objActive].data.d.tall = ((hDelta / 4) << 8) + (vDelta / 4);
|
||||
whoCares = KeepObjectLegal();
|
||||
InvalWindowRect(mainWindow, &mainWindowRect);
|
||||
redrawMainWindow = true;
|
||||
GetThisRoomsObjRects();
|
||||
ReadyBackground(thisRoom->background, thisRoom->tiles);
|
||||
DrawThisRoomsObjects();
|
||||
break;
|
||||
|
||||
case kFlourescent:
|
||||
case kTrackLight:
|
||||
case kFlourescent:
|
||||
case kTrackLight:
|
||||
hDelta = thisRoom->objects[objActive].data.f.length;
|
||||
DragMarqueeHandle(window, surface, where, &hDelta);
|
||||
thisRoom->objects[objActive].data.f.length = hDelta;
|
||||
@@ -310,16 +312,16 @@ void DragHandle (Window *window, DrawSurface *surface, Point where)
|
||||
DrawThisRoomsObjects();
|
||||
break;
|
||||
|
||||
case kToaster:
|
||||
case kToaster:
|
||||
vDelta = thisRoom->objects[objActive].data.g.height;
|
||||
DragMarqueeHandle(window, surface, where, &vDelta);
|
||||
thisRoom->objects[objActive].data.g.height = vDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
break;
|
||||
|
||||
case kBall:
|
||||
case kDrip:
|
||||
case kFish:
|
||||
case kBall:
|
||||
case kDrip:
|
||||
case kFish:
|
||||
vDelta = thisRoom->objects[objActive].data.h.length;
|
||||
DragMarqueeHandle(window, surface, where, &vDelta);
|
||||
thisRoom->objects[objActive].data.h.length = vDelta;
|
||||
@@ -336,7 +338,7 @@ void DragHandle (Window *window, DrawSurface *surface, Point where)
|
||||
thisRoom->objects[objActive].data.i.bounds.bottom =
|
||||
thisRoom->objects[objActive].data.i.bounds.top + vDelta;
|
||||
whoCares = KeepObjectLegal();
|
||||
InvalWindowRect(mainWindow, &mainWindowRect);
|
||||
redrawMainWindow = true;
|
||||
GetThisRoomsObjRects();
|
||||
ReadyBackground(thisRoom->background, thisRoom->tiles);
|
||||
DrawThisRoomsObjects();
|
||||
@@ -346,6 +348,9 @@ void DragHandle (Window *window, DrawSurface *surface, Point where)
|
||||
|
||||
fileDirty = true;
|
||||
UpdateMenus(false);
|
||||
|
||||
if (redrawMainWindow)
|
||||
UpdateMainWindow();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2304,9 +2309,7 @@ void DrawThisRoomsObjects (void)
|
||||
{
|
||||
if (GetNumberOfLights(thisRoomNumber) <= 0)
|
||||
{
|
||||
surface->SetMaskMode(true);
|
||||
surface->FillRectWithPattern8x8(backSrcRect, *GetQDGlobalsGray(&dummyPattern));
|
||||
surface->SetMaskMode(false);
|
||||
surface->FillRectWithPattern8x8(backSrcRect, true, *GetQDGlobalsGray(&dummyPattern));
|
||||
}
|
||||
|
||||
for (i = 0; i < kMaxRoomObs; i++)
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -17,6 +17,7 @@
|
||||
#include "HostDisplayDriver.h"
|
||||
#include "IGpDisplayDriver.h"
|
||||
#include "RectUtils.h"
|
||||
#include "PLPopupMenuWidget.h"
|
||||
#include "PLTimeTaggedVOSEvent.h"
|
||||
#include "QDPixMap.h"
|
||||
#include "ResourceCompiledRef.h"
|
||||
@@ -49,7 +50,7 @@ int16_t RoomFilter (Dialog *dialog, const TimeTaggedVOSEvent *evt);
|
||||
|
||||
short ChooseOriginalArt (short);
|
||||
void UpdateOriginalArt (Dialog *);
|
||||
Boolean OriginalArtFilter (Dialog *, EventRecord *, short *);
|
||||
int16_t OriginalArtFilter (Dialog *dialog, const TimeTaggedVOSEvent *evt);
|
||||
Boolean PictIDExists (short);
|
||||
short GetFirstPICT (void);
|
||||
void BitchAboutPICTNotFound (void);
|
||||
@@ -66,6 +67,8 @@ Boolean originalFloor;
|
||||
extern IGpCursor *handCursor;
|
||||
extern short lastBackground;
|
||||
|
||||
extern PortabilityLayer::ResourceArchive *houseResFork;
|
||||
|
||||
|
||||
//============================================================== Functions
|
||||
//-------------------------------------------------------------- UpdateRoomInfoDialog
|
||||
@@ -323,7 +326,6 @@ void HiliteTileOver (DrawSurface *surface, Point mouseIs)
|
||||
}
|
||||
|
||||
surface->SetForeColor(StdColors::Black());
|
||||
PenNormal();
|
||||
tileOver = -1;
|
||||
}
|
||||
|
||||
@@ -417,56 +419,64 @@ int16_t RoomFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
|
||||
|
||||
//-------------------------------------------------------------- DoRoomInfo
|
||||
|
||||
void DoRoomInfo (void)
|
||||
void DoRoomInfo(void)
|
||||
{
|
||||
#ifndef COMPILEDEMO
|
||||
#define kBackgroundsMenuID 140
|
||||
#define kBackgroundsMenuID 140
|
||||
Dialog *roomInfoDialog;
|
||||
MenuHandle backgroundsMenu;
|
||||
Str255 floorStr, suiteStr, objectsStr, tempStr;
|
||||
short item, i, newBack;
|
||||
char wasState;
|
||||
Boolean leaving, wasFirstRoom, forceDraw;
|
||||
PLError_t theErr;
|
||||
|
||||
|
||||
tileOver = -1;
|
||||
cursorIs = kArrowCursor;
|
||||
tempBack = thisRoom->background;
|
||||
backgroundsMenu = GetMenu(kBackgroundsMenuID);
|
||||
// SetMenuItemTextStyle(backgroundsMenu, kOriginalArtworkItem, italic);
|
||||
if (HouseHasOriginalPicts())
|
||||
EnableMenuItem(backgroundsMenu, kOriginalArtworkItem);
|
||||
|
||||
// SetMenuItemTextStyle(backgroundsMenu, kOriginalArtworkItem, italic);
|
||||
|
||||
NumToString(thisRoom->floor, floorStr);
|
||||
NumToString(thisRoom->suite, suiteStr);
|
||||
NumToString(thisRoom->numObjects, objectsStr);
|
||||
DialogTextSubstitutions substitutions(floorStr, suiteStr, objectsStr);
|
||||
|
||||
|
||||
theErr = CreateOffScreenGWorld(&tileSrcMap, &tileSrcRect, kPreferredPixelFormat);
|
||||
// CreateOffScreenPixMap(&tileSrcRect, &tileSrcMap);
|
||||
// SetPort((GrafPtr)tileSrcMap);
|
||||
// CreateOffScreenPixMap(&tileSrcRect, &tileSrcMap);
|
||||
// SetPort((GrafPtr)tileSrcMap);
|
||||
if ((tempBack > kStars) && (!PictIDExists(tempBack)))
|
||||
{
|
||||
BitchAboutPICTNotFound();
|
||||
tempBack = kSimpleRoom;
|
||||
}
|
||||
if ((tempBack == 2002) || (tempBack == 2011) ||
|
||||
(tempBack == 2016) || (tempBack == 2017))
|
||||
if ((tempBack == 2002) || (tempBack == 2011) ||
|
||||
(tempBack == 2016) || (tempBack == 2017))
|
||||
LoadScaledGraphicCustom(tileSrcMap, tempBack - 800, &tileSrcRect);
|
||||
else
|
||||
LoadScaledGraphicCustom(tileSrcMap, tempBack, &tileSrcRect);
|
||||
|
||||
|
||||
for (i = 0; i < kNumTiles; i++)
|
||||
tempTiles[i] = thisRoom->tiles[i];
|
||||
|
||||
// CenterDialog(kRoomInfoDialogID);
|
||||
|
||||
// CenterDialog(kRoomInfoDialogID);
|
||||
roomInfoDialog = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kRoomInfoDialogID, kPutInFront, &substitutions);
|
||||
if (roomInfoDialog == nil)
|
||||
RedAlert(kErrDialogDidntLoad);
|
||||
SetPort(&roomInfoDialog->GetWindow()->GetDrawSurface()->m_port);
|
||||
|
||||
// Fix this later. TEMP
|
||||
// AddMenuToPopUp(roomInfoDialog, kRoomPopupItem, backgroundsMenu);
|
||||
|
||||
{
|
||||
PortabilityLayer::WidgetBasicState state;
|
||||
|
||||
GetDialogItemRect(roomInfoDialog, kRoomPopupItem, &state.m_rect);
|
||||
state.m_resID = kBackgroundsMenuID;
|
||||
state.m_enabled = true;
|
||||
|
||||
PortabilityLayer::PopupMenuWidget *roomPopupWidget = PortabilityLayer::PopupMenuWidget::Create(state);
|
||||
roomInfoDialog->ReplaceWidget(kRoomPopupItem - 1, roomPopupWidget);
|
||||
|
||||
if (HouseHasOriginalPicts())
|
||||
EnableMenuItem(roomPopupWidget->GetMenu(), kOriginalArtworkItem);
|
||||
}
|
||||
|
||||
if (tempBack >= kUserBackground)
|
||||
SetPopUpMenuValue(roomInfoDialog, kRoomPopupItem, kOriginalArtworkItem);
|
||||
else
|
||||
@@ -495,6 +505,8 @@ void DoRoomInfo (void)
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
bool needRedraw = false;
|
||||
|
||||
item = roomInfoDialog->ExecuteModal(RoomFilter);
|
||||
|
||||
if (item == kOkayButton)
|
||||
@@ -543,8 +555,7 @@ void DoRoomInfo (void)
|
||||
{
|
||||
tempBack = newBack;
|
||||
LoadScaledGraphicCustom(tileSrcMap, tempBack, &tileSrcRect);
|
||||
InvalWindowRect(roomInfoDialog->GetWindow(), &tileSrc);
|
||||
InvalWindowRect(roomInfoDialog->GetWindow(), &tileDest);
|
||||
needRedraw = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -571,8 +582,7 @@ void DoRoomInfo (void)
|
||||
LoadScaledGraphicCustom(tileSrcMap, tempBack - 800, &tileSrcRect);
|
||||
else
|
||||
LoadScaledGraphicCustom(tileSrcMap, tempBack, &tileSrcRect);
|
||||
InvalWindowRect(roomInfoDialog->GetWindow(), &tileSrc);
|
||||
InvalWindowRect(roomInfoDialog->GetWindow(), &tileDest);
|
||||
needRedraw = true;
|
||||
}
|
||||
}
|
||||
else if (item == kBoundsButton)
|
||||
@@ -582,10 +592,12 @@ void DoRoomInfo (void)
|
||||
{
|
||||
tempBack = newBack;
|
||||
LoadScaledGraphicCustom(tileSrcMap, tempBack, &tileSrcRect);
|
||||
InvalWindowRect(roomInfoDialog->GetWindow(), &tileSrc);
|
||||
InvalWindowRect(roomInfoDialog->GetWindow(), &tileDest);
|
||||
needRedraw = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (needRedraw)
|
||||
UpdateRoomInfoDialog(roomInfoDialog);
|
||||
}
|
||||
|
||||
InitCursor();
|
||||
@@ -602,133 +614,83 @@ void DoRoomInfo (void)
|
||||
#ifndef COMPILEDEMO
|
||||
void UpdateOriginalArt (Dialog *theDialog)
|
||||
{
|
||||
Pattern dummyPattern;
|
||||
Pattern grayPattern;
|
||||
GetQDGlobalsGray(&grayPattern);
|
||||
|
||||
DrawDialog(theDialog);
|
||||
DrawDefaultButton(theDialog);
|
||||
|
||||
PenSize(2, 1);
|
||||
if (!originalLeftOpen)
|
||||
BorderDialogItem(theDialog, 7, 8);
|
||||
BorderDialogItem(theDialog, 7, 8, 2, nullptr);
|
||||
else
|
||||
{
|
||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||
BorderDialogItem(theDialog, 7, 8);
|
||||
PenPat(GetQDGlobalsBlack(&dummyPattern));
|
||||
}
|
||||
BorderDialogItem(theDialog, 7, 8, 2, grayPattern);
|
||||
|
||||
PenSize(1, 2);
|
||||
if (!originalTopOpen)
|
||||
BorderDialogItem(theDialog, 8, 4);
|
||||
BorderDialogItem(theDialog, 8, 4, 2, nullptr);
|
||||
else
|
||||
{
|
||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||
BorderDialogItem(theDialog, 8, 4);
|
||||
PenPat(GetQDGlobalsBlack(&dummyPattern));
|
||||
}
|
||||
BorderDialogItem(theDialog, 8, 4, 2, grayPattern);
|
||||
|
||||
PenSize(2, 1);
|
||||
if (!originalRightOpen)
|
||||
BorderDialogItem(theDialog, 9, 1);
|
||||
BorderDialogItem(theDialog, 9, 1, 2, nullptr);
|
||||
else
|
||||
{
|
||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||
BorderDialogItem(theDialog, 9, 1);
|
||||
PenPat(GetQDGlobalsBlack(&dummyPattern));
|
||||
}
|
||||
BorderDialogItem(theDialog, 9, 1, 2, grayPattern);
|
||||
|
||||
PenSize(1, 2);
|
||||
if (!originalBottomOpen)
|
||||
BorderDialogItem(theDialog, 10, 2);
|
||||
BorderDialogItem(theDialog, 10, 2, 2, nullptr);
|
||||
else
|
||||
{
|
||||
PenPat(GetQDGlobalsGray(&dummyPattern));
|
||||
BorderDialogItem(theDialog, 10, 2);
|
||||
PenPat(GetQDGlobalsBlack(&dummyPattern));
|
||||
}
|
||||
|
||||
PenSize(1, 1);
|
||||
BorderDialogItem(theDialog, 10, 2, 2, grayPattern);
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------------------- OriginalArtFilter
|
||||
#ifndef COMPILEDEMO
|
||||
|
||||
Boolean OriginalArtFilter (Dialog *dial, EventRecord *event, short *item)
|
||||
int16_t OriginalArtFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
|
||||
{
|
||||
Point mouseIs;
|
||||
|
||||
switch (event->what)
|
||||
|
||||
if (!evt)
|
||||
return -1;
|
||||
|
||||
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, kPICTIDItem, 0, 1024);
|
||||
return(true);
|
||||
break;
|
||||
|
||||
default:
|
||||
return(false);
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case mouseDown:
|
||||
mouseIs = event->where;
|
||||
}
|
||||
else if (evt->IsLMouseDownEvent())
|
||||
{
|
||||
const GpMouseInputEvent &mouseEvt = evt->m_vosEvent.m_event.m_mouseInputEvent;
|
||||
|
||||
mouseIs = Point::Create(mouseEvt.m_x, mouseEvt.m_y);
|
||||
mouseIs -= dial->GetWindow()->TopLeftCoord();
|
||||
if (leftBound.Contains(mouseIs))
|
||||
{
|
||||
*item = 7;
|
||||
return(true);
|
||||
}
|
||||
return 7;
|
||||
else if (topBound.Contains(mouseIs))
|
||||
{
|
||||
*item = 8;
|
||||
return(true);
|
||||
}
|
||||
return 8;
|
||||
else if (rightBound.Contains(mouseIs))
|
||||
{
|
||||
*item = 9;
|
||||
return(true);
|
||||
}
|
||||
return 9;
|
||||
else if (bottomBound.Contains(mouseIs))
|
||||
{
|
||||
*item = 10;
|
||||
return(true);
|
||||
}
|
||||
return 10;
|
||||
else
|
||||
return(false);
|
||||
break;
|
||||
|
||||
case mouseUp:
|
||||
return(false);
|
||||
break;
|
||||
|
||||
case updateEvt:
|
||||
SetPortDialogPort(dial);
|
||||
UpdateOriginalArt(dial);
|
||||
EndUpdate(dial->GetWindow());
|
||||
event->what = nullEvent;
|
||||
return(false);
|
||||
break;
|
||||
|
||||
default:
|
||||
return(false);
|
||||
break;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -775,10 +737,12 @@ short ChooseOriginalArt (short was)
|
||||
SetDialogItemValue(theDialog, kFloorSupportCheck, (short)originalFloor);
|
||||
|
||||
leaving = false;
|
||||
|
||||
UpdateOriginalArt(theDialog);
|
||||
|
||||
while (!leaving)
|
||||
{
|
||||
ModalDialog(OriginalArtFilter, &item);
|
||||
item = theDialog->ExecuteModal(OriginalArtFilter);
|
||||
|
||||
if (item == kOkayButton)
|
||||
{
|
||||
@@ -903,18 +867,11 @@ short GetFirstPICT (void)
|
||||
Handle resHandle;
|
||||
Str255 resName;
|
||||
|
||||
PL_NotYetImplemented();
|
||||
int16_t resID = 0;
|
||||
if (!houseResFork->FindFirstResourceOfType('PICT', resID))
|
||||
return -1;
|
||||
|
||||
//resHandle = Get1IndResource('PICT', 1);
|
||||
resHandle = Handle();
|
||||
if (resHandle != nil)
|
||||
{
|
||||
const PortabilityLayer::ResourceArchiveRef *resRef = PortabilityLayer::ResourceManager::GetInstance()->ResourceForHandle(resHandle.MMBlock());
|
||||
resHandle.Dispose();
|
||||
return resRef->m_resID;
|
||||
}
|
||||
else
|
||||
return (-1);
|
||||
return resID;
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------- BitchAboutPICTNotFound
|
||||
|
@@ -134,7 +134,6 @@ void FrameSelectedTool (DrawSurface *surface)
|
||||
InsetRect(&theRect, 1, 1);
|
||||
surface->FrameRect(theRect);
|
||||
|
||||
PenNormal();
|
||||
ForeColor(blackColor);
|
||||
}
|
||||
#endif
|
||||
@@ -484,6 +483,7 @@ void HandleToolsClick (Point wherePt)
|
||||
{
|
||||
EraseSelectedTool();
|
||||
SwitchToolModes(newMode);
|
||||
UpdateToolsWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user