Compare commits

...

61 Commits
0.0.4 ... 1.0a3

Author SHA1 Message Date
elasota
69e3fb3023 Handle Quit event more gracefully 2020-04-18 05:51:39 -04:00
elasota
94f26d0be1 Redraw grease on room lighting change. Fixes regression where grease would not be visible after turning lights on. 2020-04-18 05:23:40 -04:00
elasota
d893b356f1 Fix dynamic indexes desynchronizing on resolution change (fixes Slumberland boombox switch not working if you change resolution on the screen with the switch) 2020-04-18 00:42:45 -04:00
elasota
c3f3fb4621 Override alt-enter behavior, use borderless fullscreen instead of exclusive fullscreen. This should fix the game breaking when bringing up the open file dialog in fullscreen.
(Note that this doesn't handle resolution changes yet)
2020-04-18 00:18:20 -04:00
elasota
0335dd7786 Fix alt-enter 2020-04-06 03:34:31 -04:00
elasota
ffd9d9cc1f Keep level editor windows in screen bounds 2020-04-05 22:31:22 -04:00
elasota
f46ae55d62 Merge branch 'resizable' 2020-04-05 18:38:05 -04:00
elasota
5c1aacc268 Fix memory corruption on victory screen 2020-04-05 18:36:27 -04:00
elasota
d7353ff6ed Refactor neighboring rooms sync-ups. Remove all of the neighboring room objects and recreate them, which fixes a bunch of problems with objects becoming out-of-frame after resize. 2020-04-05 18:34:37 -04:00
elasota
b827048c36 Account for chrome padding and menu bar when auto-relocating windows 2020-04-05 18:30:04 -04:00
elasota
f56d879d12 Fix mirrors on resize 2020-04-05 04:51:58 -04:00
elasota
1269294d28 Center windows when over max resolution 2020-04-05 02:15:49 -04:00
elasota
643bc7b761 Remove scoreboard vertical offset (which doesn't work) 2020-04-05 01:51:42 -04:00
elasota
2f663646f5 Remove unused menu bar window 2020-04-05 00:35:01 -04:00
elasota
f4a57dba6e Redraw scoreboard on splash screen res change 2020-04-05 00:32:13 -04:00
elasota
7404c60a96 Disable Alt-Enter 2020-04-05 00:31:55 -04:00
elasota
805638f2c9 Fix TV and splash on res change 2020-04-04 18:50:45 -04:00
elasota
59e9a9480e Fix high score background drawing white after a win 2020-04-04 17:49:45 -04:00
elasota
49d1d6124a Fix off-center high score screen at high resolutions 2020-04-04 17:46:38 -04:00
elasota
129396ef53 Fix more dynamics, fix end screen stars with large vertical resolutions 2020-04-04 17:46:19 -04:00
elasota
1cdd372e35 Fix up most other appliances and enemies on res change 2020-04-02 20:44:24 -04:00
elasota
9a4f3f0e67 Fix candle flames and grease spill progression on res change 2020-04-02 01:47:25 -04:00
elasota
db89bf178c Fix grease on res change 2020-04-01 23:35:10 -04:00
elasota
793822fbb4 EOL fixes 2020-04-01 23:34:55 -04:00
elasota
66a709ad2a Fix memory corruption 2020-04-01 23:29:48 -04:00
elasota
6326a0b2d9 Partial resolution change support 2020-04-01 14:53:44 -04:00
elasota
e114d5c5dd Clean out unused API 2020-03-14 12:03:50 -04:00
elasota
cea0bde015 API cleanup, fix some lingering InvalWindowRects 2020-03-14 06:38:46 -04:00
elasota
3d37ded31d Button highlight behavior 2020-03-14 05:04:51 -04:00
elasota
3dcc787ca0 Add menu hints and checks 2020-03-14 05:04:01 -04:00
elasota
d394975336 Finish scroll bars 2020-03-14 04:29:47 -04:00
elasota
dd78b08a5f Fix WaitForEvent having an extra delay tick 2020-03-14 04:29:36 -04:00
elasota
088640b544 Replace "QT" tag with "TV" 2020-03-14 03:21:45 -04:00
elasota
d6d4aadeff Update docs 2020-03-14 03:21:30 -04:00
elasota
d90ea24405 Add support for GPA patching, remove some unusable video options 2020-03-14 03:21:20 -04:00
elasota
505e73e842 Restore converted CD Demo House movie 2020-03-14 00:00:54 -04:00
elasota
26bf033465 Fix crash if a movie fails to load 2020-03-14 00:00:38 -04:00
elasota
ed7f8783c0 Partial scroll bar implementation 2020-03-10 01:35:42 -04:00
elasota
699c3cf13c Selection drag support 2020-03-09 01:40:47 -04:00
elasota
424a09ccc8 Fix missing returns 2020-03-09 01:40:34 -04:00
elasota
e0fb300766 Return first res by ID, not by name 2020-03-09 01:40:26 -04:00
elasota
46f7a7cc69 More editbox functionality 2020-03-08 23:14:53 -04:00
elasota
e93b035d5c Fix bad window centering 2020-03-08 23:14:27 -04:00
elasota
f4929613aa Remove some debug checks 2020-03-01 23:37:28 -05:00
elasota
7b27d6c6b5 Most remaining level editor work 2020-03-01 17:01:35 -05:00
elasota
abd4f1a978 Menu separator support 2020-02-27 01:22:49 -05:00
elasota
5567250e14 Fix dialog label constraint not working 2020-02-27 01:22:38 -05:00
elasota
4efb44ddae Fix "House" menu title being overwritten 2020-02-26 22:27:07 -05:00
elasota
f1d7e1f52f Fix constant IDs, remove ZoomWindow 2020-02-26 12:26:19 -05:00
elasota
cc17911776 Fix up some level editor dialog behavior 2020-02-26 12:17:04 -05:00
elasota
d617795591 Level editor work 2020-02-25 23:09:09 -05:00
elasota
c78a20dafd Level editor work 2020-02-23 20:21:04 -05:00
elasota
d63ac98624 Update acknowledgments to include FreeType 2020-02-21 11:44:29 -05:00
elasota
36f10c60b4 Get TVs working 2020-02-20 03:13:15 -05:00
elasota
fcd8fdb17e Fix broken BMP decode 2020-02-20 01:30:25 -05:00
elasota
505941a9e4 Fixed alert substitutions not working 2020-02-20 01:30:09 -05:00
elasota
d5f3595350 Remove Roboto font 2020-02-19 23:43:42 -05:00
elasota
46fc16c97e Convert QuickTime movies to image sequences 2020-02-19 23:39:05 -05:00
elasota
9daee7af4e More editor progress 2020-02-18 20:53:54 -05:00
elasota
42826a5d58 Add flattenmov tool 2020-02-18 20:53:40 -05:00
elasota
fd5e3af4a3 Disclaimer 2020-02-18 20:53:18 -05:00
209 changed files with 7360 additions and 3549 deletions

View File

@@ -1,7 +1,3 @@
Roboto font:
(c)2011 Google
Distributed under the Apache License (see Resources/Fonts/Roboto/LICENSE)
Open Sans font:
(c)2011 Google
Distributed under the Apache License (see Resources/Fonts/OpenSans/LICENSE)

View File

@@ -41,6 +41,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bin2gp", "bin2gp\bin2gp.vcx
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MakeTimestamp", "MakeTimestamp\MakeTimestamp.vcxproj", "{9023DF2F-A33D-485A-B13D-0973348B2F9B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "flattenmov", "flattenmov\flattenmov.vcxproj", "{89F8D13E-F216-4B67-8DE9-7F842D349E94}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -123,6 +125,10 @@ Global
{9023DF2F-A33D-485A-B13D-0973348B2F9B}.Debug|x64.Build.0 = Debug|x64
{9023DF2F-A33D-485A-B13D-0973348B2F9B}.Release|x64.ActiveCfg = Release|x64
{9023DF2F-A33D-485A-B13D-0973348B2F9B}.Release|x64.Build.0 = Release|x64
{89F8D13E-F216-4B67-8DE9-7F842D349E94}.Debug|x64.ActiveCfg = Debug|x64
{89F8D13E-F216-4B67-8DE9-7F842D349E94}.Debug|x64.Build.0 = Debug|x64
{89F8D13E-F216-4B67-8DE9-7F842D349E94}.Release|x64.ActiveCfg = Release|x64
{89F8D13E-F216-4B67-8DE9-7F842D349E94}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -73,6 +73,7 @@
<Import Project="..\GpMainApp.props" />
<Import Project="..\FreeTypePublic.props" />
<Import Project="..\FreeTypeImport.props" />
<Import Project="..\Release.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
@@ -91,6 +92,7 @@
<Import Project="..\GpMainApp.props" />
<Import Project="..\FreeTypePublic.props" />
<Import Project="..\FreeTypeImport.props" />
<Import Project="..\Release.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
@@ -170,7 +172,7 @@
<ClInclude Include="..\GpCommon\GpDisplayDriverTickStatus.h" />
<ClInclude Include="..\GpCommon\GpFileCreationDisposition.h" />
<ClInclude Include="..\GpCommon\GpInputDriverProperties.h" />
<ClInclude Include="..\GpCommon\IGpColorCursor.h" />
<ClInclude Include="..\GpCommon\IGpCursor.h" />
<ClInclude Include="..\GpCommon\IGpAudioChannelCallbacks.h" />
<ClInclude Include="..\GpCommon\GpColorCursor_Win32.h" />
<ClInclude Include="..\GpCommon\IGpDisplayDriverSurface.h" />

View File

@@ -94,6 +94,11 @@ void GpAppEnvironment::Render()
GpAppInterface_Get()->PL_Render(m_displayDriver);
}
bool GpAppEnvironment::AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY)
{
return GpAppInterface_Get()->PL_AdjustRequestedResolution(physicalWidth, physicalHeight, virtualWidth, virtualheight, pixelScaleX, pixelScaleY);
}
void GpAppEnvironment::SetDisplayDriver(IGpDisplayDriver *displayDriver)
{
m_displayDriver = displayDriver;
@@ -170,6 +175,10 @@ void GpAppEnvironment::DispatchSystemCall(PortabilityLayer::HostSuspendCallID ca
m_applicationState = ApplicationState_TimedSuspend;
m_delaySuspendTicks = args[0].m_uint;
break;
case PortabilityLayer::HostSuspendCallID_CallOnVOSThread:
args[0].m_functionPtr(static_cast<const PortabilityLayer::HostSuspendCallArgument*>(args[1].m_constPointer), static_cast<PortabilityLayer::HostSuspendCallArgument*>(args[2].m_pointer));
m_applicationState = ApplicationState_Running;
break;
default:
assert(false);
}

View File

@@ -28,6 +28,7 @@ public:
GpDisplayDriverTickStatus_t Tick(IGpFiber *vosFiber);
void Render();
bool AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY);
void SetDisplayDriver(IGpDisplayDriver *displayDriver);
void SetAudioDriver(IGpAudioDriver *audioDriver);

View File

@@ -1,14 +1,14 @@
#include "GpColorCursor_Win32.h"
#include "GpCursor_Win32.h"
#include <stdlib.h>
#include <new>
void GpColorCursor_Win32::Destroy()
void GpCursor_Win32::Destroy()
{
this->DecRef();
}
IGpColorCursor_Win32 *GpColorCursor_Win32::Load(const wchar_t *path)
IGpCursor_Win32 *GpCursor_Win32::Load(const wchar_t *path)
{
HANDLE imageH = LoadImageW(nullptr, path, IMAGE_CURSOR, 0, 0, LR_LOADFROMFILE);
@@ -16,43 +16,43 @@ IGpColorCursor_Win32 *GpColorCursor_Win32::Load(const wchar_t *path)
return nullptr;
HCURSOR cursor = reinterpret_cast<HCURSOR>(imageH);
void *storage = malloc(sizeof(GpColorCursor_Win32));
void *storage = malloc(sizeof(GpCursor_Win32));
if (!storage)
{
DestroyCursor(cursor);
return nullptr;
}
return new (storage) GpColorCursor_Win32(reinterpret_cast<HCURSOR>(cursor));
return new (storage) GpCursor_Win32(reinterpret_cast<HCURSOR>(cursor));
}
GpColorCursor_Win32::GpColorCursor_Win32(HCURSOR cursor)
GpCursor_Win32::GpCursor_Win32(HCURSOR cursor)
: m_cursor(cursor)
, m_refCount(1)
{
}
GpColorCursor_Win32::~GpColorCursor_Win32()
GpCursor_Win32::~GpCursor_Win32()
{
DestroyCursor(m_cursor);
}
const HCURSOR &GpColorCursor_Win32::GetHCursor() const
const HCURSOR &GpCursor_Win32::GetHCursor() const
{
return m_cursor;
}
void GpColorCursor_Win32::IncRef()
void GpCursor_Win32::IncRef()
{
m_refCount++;
}
void GpColorCursor_Win32::DecRef()
void GpCursor_Win32::DecRef()
{
m_refCount--;
if (m_refCount == 0)
{
this->~GpColorCursor_Win32();
this->~GpCursor_Win32();
free(this);
}
}

View File

@@ -13,6 +13,8 @@
#include <assert.h>
extern GpWindowsGlobals g_gpWindowsGlobals;
class GpDirectoryCursor_Win32 final : public PortabilityLayer::HostDirectoryCursor
{
public:
@@ -307,6 +309,7 @@ bool GpFileSystem_Win32::PromptSaveFile(PortabilityLayer::VirtualDirectory_t vir
ofn.nMaxFile = MAX_PATH;
ofn.lpstrInitialDir = baseDir;
ofn.Flags = OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_OVERWRITEPROMPT;
ofn.hwndOwner = g_gpWindowsGlobals.m_hwnd;
if (!GetSaveFileNameW(&ofn))
return false;
@@ -387,6 +390,7 @@ bool GpFileSystem_Win32::PromptOpenFile(PortabilityLayer::VirtualDirectory_t vir
ofn.nMaxFile = MAX_PATH;
ofn.lpstrInitialDir = baseDir;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST;
ofn.hwndOwner = g_gpWindowsGlobals.m_hwnd;
if (!GetOpenFileNameW(&ofn))
return false;

View File

@@ -27,6 +27,11 @@ namespace
{
static_cast<GpAppEnvironment*>(context)->Render();
}
bool AdjustRequestedResolution(void *context, uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY)
{
return static_cast<GpAppEnvironment*>(context)->AdjustRequestedResolution(physicalWidth, physicalHeight, virtualWidth, virtualheight, pixelScaleX, pixelScaleY);
}
}
int GpMain::Run()
@@ -52,6 +57,9 @@ int GpMain::Run()
ddProps.m_renderFunc = RenderAppEnvironment;
ddProps.m_renderFuncContext = appEnvironment;
ddProps.m_adjustRequestedResolutionFunc = AdjustRequestedResolution;
ddProps.m_adjustRequestedResolutionFuncContext = appEnvironment;
ddProps.m_type = g_gpGlobalConfig.m_displayDriverType;
ddProps.m_osGlobals = g_gpGlobalConfig.m_osGlobals;
ddProps.m_eventQueue = eventQueue;
@@ -63,7 +71,11 @@ int GpMain::Run()
// This appears to be the "standard" Mac sample rate, probably rounded from 244800/11.
adProps.m_type = g_gpGlobalConfig.m_audioDriverType;
adProps.m_sampleRate = (244800 * 2 + 11) / (11 * 2);
#ifdef NDEBUG
adProps.m_debug = true;
#else
adProps.m_debug = false;
#endif
IGpInputDriver **inputDrivers = static_cast<IGpInputDriver**>(malloc(sizeof(IGpInputDriver*) * g_gpGlobalConfig.m_numInputDrivers));

View File

@@ -1,6 +1,6 @@
#include "GpMain.h"
#include "GpAudioDriverFactory.h"
#include "GpColorCursor_Win32.h"
#include "GpCursor_Win32.h"
#include "GpDisplayDriverFactory.h"
#include "GpGlobalConfig.h"
#include "GpFiber_Win32.h"
@@ -24,7 +24,7 @@ extern "C" __declspec(dllimport) IGpAudioDriver *GpDriver_CreateAudioDriver_XAud
extern "C" __declspec(dllimport) IGpDisplayDriver *GpDriver_CreateDisplayDriver_D3D11(const GpDisplayDriverProperties &properties);
extern "C" __declspec(dllimport) IGpInputDriver *GpDriver_CreateInputDriver_XInput(const GpInputDriverProperties &properties);
static void PostMouseEvent(IGpVOSEventQueue *eventQueue, GpMouseEventType_t eventType, GpMouseButton_t button, int32_t x, int32_t y)
static void PostMouseEvent(IGpVOSEventQueue *eventQueue, GpMouseEventType_t eventType, GpMouseButton_t button, int32_t x, int32_t y, float pixelScaleX, float pixelScaleY)
{
if (GpVOSEvent *evt = eventQueue->QueueEvent())
{
@@ -35,6 +35,12 @@ static void PostMouseEvent(IGpVOSEventQueue *eventQueue, GpMouseEventType_t even
mEvent.m_x = x;
mEvent.m_y = y;
mEvent.m_eventType = eventType;
if (pixelScaleX != 1.0f)
mEvent.m_x = static_cast<int32_t>(static_cast<float>(x) / pixelScaleX);
if (pixelScaleY != 1.0f)
mEvent.m_y = static_cast<int32_t>(static_cast<float>(y) / pixelScaleX);
}
}
@@ -291,7 +297,7 @@ static void PostKeyboardEvent(IGpVOSEventQueue *eventQueue, GpKeyboardInputEvent
}
}
static void TranslateWindowsMessage(const MSG *msg, IGpVOSEventQueue *eventQueue)
static void TranslateWindowsMessage(const MSG *msg, IGpVOSEventQueue *eventQueue, float pixelScaleX, float pixelScaleY)
{
WPARAM wParam = msg->wParam;
LPARAM lParam = msg->lParam;
@@ -299,40 +305,40 @@ static void TranslateWindowsMessage(const MSG *msg, IGpVOSEventQueue *eventQueue
switch (msg->message)
{
case WM_LBUTTONDOWN:
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kLeft, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kLeft, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
break;
case WM_LBUTTONUP:
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kLeft, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kLeft, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
break;
case WM_MBUTTONDOWN:
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kMiddle, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kMiddle, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
break;
case WM_MBUTTONUP:
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kMiddle, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kMiddle, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
break;
case WM_RBUTTONDOWN:
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kRight, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kRight, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
break;
case WM_RBUTTONUP:
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kRight, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kRight, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
break;
case WM_XBUTTONDOWN:
if (GET_XBUTTON_WPARAM(wParam) == XBUTTON1)
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kX1, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kX1, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
else if (GET_XBUTTON_WPARAM(wParam) == XBUTTON2)
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kX2, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
PostMouseEvent(eventQueue, GpMouseEventTypes::kDown, GpMouseButtons::kX2, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
break;
case WM_XBUTTONUP:
if (GET_XBUTTON_WPARAM(wParam) == XBUTTON1)
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kX1, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kX1, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
else if (GET_XBUTTON_WPARAM(wParam) == XBUTTON2)
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kX2, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
PostMouseEvent(eventQueue, GpMouseEventTypes::kUp, GpMouseButtons::kX2, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
break;
case WM_MOUSEMOVE:
PostMouseEvent(eventQueue, GpMouseEventTypes::kMove, GpMouseButtons::kNone, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
PostMouseEvent(eventQueue, GpMouseEventTypes::kMove, GpMouseButtons::kNone, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), pixelScaleX, pixelScaleY);
break;
case WM_MOUSELEAVE:
PostMouseEvent(eventQueue, GpMouseEventTypes::kLeave, GpMouseButtons::kNone, 0, 0);
PostMouseEvent(eventQueue, GpMouseEventTypes::kLeave, GpMouseButtons::kNone, 0, 0, pixelScaleX, pixelScaleY);
break;
case WM_KEYDOWN:
case WM_SYSKEYDOWN:
@@ -373,6 +379,12 @@ static void TranslateWindowsMessage(const MSG *msg, IGpVOSEventQueue *eventQueue
PostKeyboardEvent(eventQueue, keyEventType, subset, key, (lParam & 0xffff));
}
break;
case WM_QUIT:
{
if (GpVOSEvent *evt = eventQueue->QueueEvent())
evt->m_eventType = GpVOSEventTypes::kQuit;
}
break;
default:
break;
}
@@ -388,9 +400,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
g_gpWindowsGlobals.m_cmdLine = lpCmdLine;
g_gpWindowsGlobals.m_nCmdShow = nCmdShow;
g_gpWindowsGlobals.m_baseDir = GpFileSystem_Win32::GetInstance()->GetBasePath();
g_gpWindowsGlobals.m_hwnd = nullptr;
g_gpWindowsGlobals.m_createFiberFunc = GpFiber_Win32::Create;
g_gpWindowsGlobals.m_loadColorCursorFunc = GpColorCursor_Win32::Load;
g_gpWindowsGlobals.m_loadCursorFunc = GpCursor_Win32::Load;
g_gpWindowsGlobals.m_translateWindowsMessageFunc = TranslateWindowsMessage;
g_gpGlobalConfig.m_displayDriverType = EGpDisplayDriverType_D3D11;

View File

@@ -0,0 +1,101 @@
{
"items" :
[
{
"name" : "Okay",
"itemType" : "Button",
"pos" : [ 267, 211 ],
"size" : [ 58, 20 ],
"id" : 0,
"enabled" : true
},
{
"name" : "Cancel",
"itemType" : "Button",
"pos" : [ 201, 211 ],
"size" : [ 58, 20 ],
"id" : 0,
"enabled" : true
},
{
"name" : "",
"itemType" : "Icon",
"pos" : [ 209, 40 ],
"size" : [ 32, 32 ],
"id" : 1020,
"enabled" : true
},
{
"name" : "",
"itemType" : "Icon",
"pos" : [ 249, 40 ],
"size" : [ 32, 32 ],
"id" : 1021,
"enabled" : true
},
{
"name" : "",
"itemType" : "Icon",
"pos" : [ 289, 40 ],
"size" : [ 32, 32 ],
"id" : 1022,
"enabled" : true
},
{
"name" : "Number of Rooms to Display:\r(the less rooms, the faster)",
"itemType" : "Label",
"pos" : [ 8, 40 ],
"size" : [ 195, 32 ],
"id" : 0,
"enabled" : false
},
{
"name" : "",
"itemType" : "Image",
"pos" : [ 0, 0 ],
"size" : [ 333, 32 ],
"id" : 1006,
"enabled" : false
},
{
"name" : "",
"itemType" : "UserItem",
"pos" : [ 8, 80 ],
"size" : [ 317, 1 ],
"id" : 0,
"enabled" : false
},
{
"name" : "Beautiful opening color fade",
"itemType" : "CheckBox",
"pos" : [ 8, 142 ],
"size" : [ 256, 18 ],
"id" : 0,
"enabled" : true
},
{
"name" : "",
"itemType" : "UserItem",
"pos" : [ 8, 137 ],
"size" : [ 317, 1 ],
"id" : 0,
"enabled" : false
},
{
"name" : "",
"itemType" : "UserItem",
"pos" : [ 8, 200 ],
"size" : [ 317, 1 ],
"id" : 0,
"enabled" : false
},
{
"name" : "Defaults",
"itemType" : "Button",
"pos" : [ 8, 211 ],
"size" : [ 64, 20 ],
"id" : 0,
"enabled" : true
}
]
}

View File

@@ -0,0 +1,9 @@
{
"add" :
{
"DITL/1017.json" : "ApplicationResourcePatches/DITL/1017.json"
},
"delete" :
[
]
}

View File

@@ -41,4 +41,6 @@ struct __GpStaticAssertHelper<true>
static const size_t GP_SYSTEM_MEMORY_ALIGNMENT = 16;
#if !defined(NDEBUG)
#define GP_DEBUG_CONFIG 1
#endif

View File

@@ -1,4 +1,5 @@
#include "CFileStream.h"
#include "BMPFormat.h"
#include "MMHandleBlock.h"
#include "ResourceCompiledTypeList.h"
#include "ResourceFile.h"
@@ -8,6 +9,7 @@
#include <assert.h>
#include <string>
#include <vector>
#include "stb_image_write.h"
@@ -53,6 +55,14 @@ struct CursorHeader
BEUInt32_t m_cursorResourceID;
};
struct BWCursor
{
uint8_t m_pixels[32];
uint8_t m_mask[32];
BEUInt16_t m_hotSpotX;
BEUInt16_t m_hotSpotY;
};
struct IconDir
{
uint16_t m_reserved;
@@ -84,6 +94,108 @@ void WriteToFileCallback(void *context, void *data, int size)
fwrite(data, 1, size, static_cast<FILE*>(context));
}
void WriteToVectorCallback(void *context, void *data, int size)
{
std::vector<uint8_t> *vec = static_cast<std::vector<uint8_t>*>(context);
for (int i = 0; i < size; i++)
vec->push_back(static_cast<const uint8_t*>(data)[i]);
}
void ConvertBWCursors(PortabilityLayer::ResourceFile *resFile)
{
const PortabilityLayer::ResourceCompiledTypeList *typeList = resFile->GetResourceTypeList('CURS');
if (!typeList)
return;
const size_t numRefs = typeList->m_numRefs;
for (size_t i = 0; i < numRefs; i++)
{
const int resID = typeList->m_firstRef[i].m_resID;
const THandle<void> resHdl = resFile->LoadResource('CURS', resID);
const void *cursorDataBase = *resHdl;
const BWCursor *cursorData = static_cast<const BWCursor *>(cursorDataBase);
char outPathDebug[64];
sprintf_s(outPathDebug, "Packaged\\WinCursors\\b%i.bmp", resID);
char outPath[64];
sprintf_s(outPath, "Packaged\\WinCursors\\b%i.cur", resID);
FILE *outF = nullptr;
errno_t outErr = fopen_s(&outF, outPath, "wb");
if (!outErr)
{
IconDir iconDir;
iconDir.m_reserved = 0;
iconDir.m_type = 2;
iconDir.m_numImages = 1;
IconDirEntry iconDirEntry;
iconDirEntry.m_width = 16;
iconDirEntry.m_height = 16;
iconDirEntry.m_numColors = 0;
iconDirEntry.m_reserved = 0;
iconDirEntry.m_numPlanes_HotSpotX = cursorData->m_hotSpotX;
iconDirEntry.m_bpp_HotSpotY = cursorData->m_hotSpotY;
iconDirEntry.m_imageDataSize = 0;
iconDirEntry.m_imageDataOffset = sizeof(IconDir) + sizeof(IconDirEntry);
fwrite(&iconDir, 1, sizeof(IconDir), outF);
fwrite(&iconDirEntry, 1, sizeof(IconDirEntry), outF);
long imageDataStart = ftell(outF);
PortabilityLayer::BitmapInfoHeader bmpHeader;
bmpHeader.m_thisStructureSize = sizeof(bmpHeader);
bmpHeader.m_width = 16;
bmpHeader.m_height = 32;
bmpHeader.m_planes = 1;
bmpHeader.m_bitsPerPixel = 1;
bmpHeader.m_compression = 0;
bmpHeader.m_imageSize = (16 * 16 / 8);
bmpHeader.m_xPixelsPerMeter = 0;
bmpHeader.m_yPixelsPerMeter = 0;
bmpHeader.m_numColors = 2;
bmpHeader.m_importantColorCount = 2;
fwrite(&bmpHeader, 1, sizeof(bmpHeader), outF);
const uint8_t paletteData[] = {
0, 0, 0, 0,
255, 255, 255, 0 };
fwrite(paletteData, 1, sizeof(paletteData), outF);
uint8_t padding[2] = { 0, 0 };
for (int y = 0; y < 16; y++)
{
const uint8_t *maskRow = cursorData->m_mask + (15 - y) * 2;
const uint8_t *row = cursorData->m_pixels + (15 - y) * 2;
const uint8_t modifiedRow[] = { row[0] ^ maskRow[0], row[1] ^ maskRow[1] };
fwrite(modifiedRow, 1, 2, outF);
fwrite(padding, 1, 2, outF);
}
for (int y = 0; y < 16; y++)
{
const uint8_t *row = cursorData->m_mask + (15 - y) * 2;
const uint8_t modifiedRow[] = { row[0] ^ 255, row[1] ^ 255 };
fwrite(modifiedRow, 1, 2, outF);
fwrite(padding, 1, 2, outF);
}
long imageDataEnd = ftell(outF);
fseek(outF, sizeof(IconDir), SEEK_SET);
iconDirEntry.m_imageDataSize = static_cast<uint32_t>(imageDataEnd - imageDataStart);
fwrite(&iconDirEntry, 1, sizeof(IconDirEntry), outF);
fclose(outF);
}
}
}
void ConvertCursors(PortabilityLayer::ResourceFile *resFile)
{
const PortabilityLayer::ResourceCompiledTypeList *typeList = resFile->GetResourceTypeList('crsr');
@@ -196,7 +308,7 @@ void ConvertCursors(PortabilityLayer::ResourceFile *resFile)
}
char outPath[64];
sprintf_s(outPath, "Packaged\\WinCursors\\%i.cur", resID);
sprintf_s(outPath, "Packaged\\WinCursors\\c%i.cur", resID);
FILE *outF = nullptr;
errno_t outErr = fopen_s(&outF, outPath, "wb");
@@ -335,6 +447,7 @@ int main(int argc, const char **argv)
stream.Close();
ConvertCursors(resFile);
ConvertBWCursors(resFile);
ConvertIconFamily(resFile, 'ics#', 'ics8', "Small", 16);
ConvertIconFamily(resFile, 'ICN#', 'icl8', "Large", 32);

View File

@@ -4,7 +4,7 @@ mkdir Packaged\WinCursors
x64\Release\MiniRez.exe "GliderProData\Glider PRO.r" Packaged\ApplicationResources.gpr
x64\Release\gpr2gpa.exe "Packaged\ApplicationResources.gpr" "DefaultTimestamp.timestamp" "Packaged\ApplicationResources.gpa"
x64\Release\gpr2gpa.exe "Packaged\ApplicationResources.gpr" "DefaultTimestamp.timestamp" "Packaged\ApplicationResources.gpa" "ApplicationResourcePatches\manifest.json"
x64\Release\ConvertColorCursors.exe
@@ -56,25 +56,27 @@ x64\Release\gpr2gpa.exe "Packaged\Houses\Teddy World.gpr" "DefaultTimestamp.time
x64\Release\gpr2gpa.exe "Packaged\Houses\The Asylum Pro.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\The Asylum Pro.gpa"
x64\Release\gpr2gpa.exe "Packaged\Houses\Titanic.gpr" "DefaultTimestamp.timestamp" "Packaged\Houses\Titanic.gpa"
x64\Release\FTagData.exe "GliderProData\Houses\Art Museum.mov" "DefaultTimestamp.timestamp" "Packaged\Houses\Art Museum.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GliderProData\Houses\Castle o' the Air.mov" "DefaultTimestamp.timestamp" "Packaged\Houses\Castle o' the Air.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GliderProData\Houses\CD Demo House.mov" "DefaultTimestamp.timestamp" "Packaged\Houses\CD Demo House.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GliderProData\Houses\Davis Station.mov" "DefaultTimestamp.timestamp" "Packaged\Houses\Davis Station.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GliderProData\Houses\Demo House.mov" "DefaultTimestamp.timestamp" "Packaged\Houses\Demo House.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GliderProData\Houses\Grand Prix.mov" "DefaultTimestamp.timestamp" "Packaged\Houses\Grand Prix.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GliderProData\Houses\ImagineHouse PRO II.mov" "DefaultTimestamp.timestamp" "Packaged\Houses\ImagineHouse PRO II.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GliderProData\Houses\Land of Illusion.mov" "DefaultTimestamp.timestamp" "Packaged\Houses\Land of Illusion.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GliderProData\Houses\Leviathan.mov" "DefaultTimestamp.timestamp" "Packaged\Houses\Leviathan.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GliderProData\Houses\Nemo's Market.mov" "DefaultTimestamp.timestamp" "Packaged\Houses\Nemo's Market.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GliderProData\Houses\Rainbow's End.mov" "DefaultTimestamp.timestamp" "Packaged\Houses\Rainbow's End.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GliderProData\Houses\Slumberland.mov" "DefaultTimestamp.timestamp" "Packaged\Houses\Slumberland.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GliderProData\Houses\SpacePods.mov" "DefaultTimestamp.timestamp" "Packaged\Houses\SpacePods.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GliderProData\Houses\Teddy World.mov" "DefaultTimestamp.timestamp" "Packaged\Houses\Teddy World.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "GliderProData\Houses\Titanic.mov" "DefaultTimestamp.timestamp" "Packaged\Houses\Titanic.mov" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "DefaultTimestamp.timestamp" "Packaged\Houses\Art Museum.mov.gpf" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "DefaultTimestamp.timestamp" "Packaged\Houses\Castle o' the Air.mov.gpf" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "DefaultTimestamp.timestamp" "Packaged\Houses\CD Demo House.mov.gpf" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "DefaultTimestamp.timestamp" "Packaged\Houses\Davis Station.mov.gpf" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "DefaultTimestamp.timestamp" "Packaged\Houses\Demo House.mov.gpf" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "DefaultTimestamp.timestamp" "Packaged\Houses\Grand Prix.mov.gpf" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "DefaultTimestamp.timestamp" "Packaged\Houses\ImagineHouse PRO II.mov.gpf" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "DefaultTimestamp.timestamp" "Packaged\Houses\Land of Illusion.mov.gpf" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "DefaultTimestamp.timestamp" "Packaged\Houses\Leviathan.mov.gpf" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "DefaultTimestamp.timestamp" "Packaged\Houses\Nemo's Market.mov.gpf" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "DefaultTimestamp.timestamp" "Packaged\Houses\Rainbow's End.mov.gpf" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "DefaultTimestamp.timestamp" "Packaged\Houses\Slumberland.mov.gpf" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "DefaultTimestamp.timestamp" "Packaged\Houses\SpacePods.mov.gpf" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "DefaultTimestamp.timestamp" "Packaged\Houses\Teddy World.mov.gpf" MooV ozm5 0 0 locked
x64\Release\FTagData.exe "DefaultTimestamp.timestamp" "Packaged\Houses\Titanic.mov.gpf" MooV ozm5 0 0 locked
del /Q Packaged\Houses\*.gpr
del /Q Packaged\ApplicationResources.gpr
copy /Y GliderProData\ConvertedMovies\*.mov.gpa Packaged\Houses\
attrib +R Packaged\Houses\*
pause

View File

@@ -0,0 +1,24 @@
As with Glider PRO's Room Editor, custom backgrounds, sounds, and TV videos
are supported.
Since Glider PRO used formats that were very Mac-specific, Aerofoil has
replaced most of them with more current formats.
To add resources to a house, create a ZIP file with the extension ".gpa" with
the same name as the .gpd and .gpf files that already exist for the house.
You can add resources by adding them to a folder named as the resource type,
with the appropriate extension.
For example, for a "PICT" resource of ID "3000", create a file named "3000.bmp"
and put it in the "PICT" directory in the .gpa archive.
PICT resources, used for custom decorations and backgrounds, must be BMP files.
Sounds should go in a directory named "snd$20"
Sounds must be WAV format, monaural, 8-bit unsigned PCM, 22255 Hz.
Sounds recorded at a different sample rate will play back at the wrong speed.
Sounds that are not monaural or 8-bit unsigned PCM will fail to load.
Resource IDs must be between -32768 and 32767. Other resource IDs will fail
to load.

View File

@@ -1,7 +1,16 @@
Aerofoil is a third-party port of Glider PRO
Glider PRO is (c)1994-2000 Casady & Greene, Inc., written by John Calhoun
Aerofoil is (c)2019-2020 Eric Lasota
Glider PRO is (c)1994-2000 Casady & Greene, Inc., written by John Calhoun
Aerofoil is not maintained by, supported by, endorsed by, or otherwise associated with the authors and publishers of Glider PRO.
Please do not contact any of them regarding issues related to Aerofoil.
If you have an issue with Aerofoil, please post an issue to the Aerofoil issue tracker on GitHub:
https://github.com/elasota/Aerofoil/issues
Requires Windows 8 and the Visual Studio 2017 redistributable runtime.
Please see this page for more info:
@@ -14,12 +23,7 @@ Some shortcuts:
- Ctrl-Q quits the game.
-------------------------------------------------------------------------------
Roboto font:
(c)2011 Google
Distributed under the Apache License (see license_apache.txt)
Aerofoil uses the following third-party software:
-------------------------------------------------------------------------------
Open Sans font:
(c)2011 Google
@@ -67,4 +71,12 @@ zlib:
3. This notice may not be removed or altered from any source distribution.
Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu
jloup@gzip.org madler@alumni.caltech.edu
-------------------------------------------------------------------------------
FreeType:
Portions of this software are copyright (c)2020 The FreeType Project (www.freetype.org). All rights reserved.
Distributed under the GPLv2 license (see license_gplv2.txt)

View File

@@ -0,0 +1,16 @@
If you want to import an existing third-party Glider PRO house to Aerofoil, a few steps are required.
First, you need to generate a timestamp file. Use the "MakeTimestamp" utility to dump the current time to a timestamp file.
Second, you need to extract the house data from the original archive. Most existing Glider PRO houses are in StuffIt! archives (.sit extension), which can be difficult to extract. There is a utility called The Unarchiver for macOS which appears to support it. An alternative is to extract the file on an actual vintage Mac.
The next step depends on whether or not the house has custom resources. If the house doesn't have custom resources, then add a ".gpd" extension to the house and use the FTagData utility to generate a corresponding ".gpf" metadata file, using the timestamp you generated in the first step. You need to specify "gliH" as the file type ID and "ozm5" as the file creator ID.
If the house does have custom resources, then you need to get the resource data somehow, and you still need to generate the metadata. There are a few options there:
- If extracting the file generated a separate file containing the resource data, which I think is what happens when extracting files on macOS, then you can use the resource file directly, and handle the other steps the same as you would if it didn't have custom resources.
- If you can get the house into MacBinary format, then you can use the "bin2gp" utility to convert it to .gpf, .gpd, and .gpr files.
- If you can get the house into BinHex4 (.hqx) format, then you can use the "hqx2gp" utility to convert it to .gpf, .gpd, and .gpr files.
Once you have a .gpr file of the raw Mac-format resource data, you need to convert it to Aerofoil's ZIP-based resource archive format and convert the internal resources out of Mac-specific formats. Use the "gpr2gpa" utility to do this.
gpr2gpa's PICT converter may not support all PICT encodings. If you find a house with custom PICT resources that isn't supported, please submit a sample to Aerofoil's issue tracker.

View File

@@ -5,23 +5,22 @@
int main(int argc, const char **argv)
{
if (argc < 8)
if (argc < 7)
{
fprintf(stderr, "FTagData <input> <timestamp> <output> <file type ID> <file creator ID> <x pos> <y pos> [flags]");
fprintf(stderr, "FTagData <timestamp> <output.gpf> <file type ID> <file creator ID> <x pos> <y pos> [flags]");
return -1;
}
std::string inPath = argv[1];
std::string timestampPath = argv[2];
std::string outPath = argv[3];
std::string timestampPath = argv[1];
std::string outPath = argv[2];
if (strlen(argv[4]) != 4)
if (strlen(argv[3]) != 4)
{
fprintf(stderr, "File type ID must be 4 characters");
return -2;
}
if (strlen(argv[5]) != 4)
if (strlen(argv[4]) != 4)
{
fprintf(stderr, "File creator ID must be 4 characters");
return -3;
@@ -47,10 +46,10 @@ int main(int argc, const char **argv)
}
PortabilityLayer::MacFileProperties mfp;
memcpy(mfp.m_fileType, argv[4], 4);
memcpy(mfp.m_fileCreator, argv[5], 4);
mfp.m_xPos = atoi(argv[6]);
mfp.m_yPos = atoi(argv[7]);
memcpy(mfp.m_fileType, argv[3], 4);
memcpy(mfp.m_fileCreator, argv[4], 4);
mfp.m_xPos = atoi(argv[5]);
mfp.m_yPos = atoi(argv[6]);
mfp.m_finderFlags = 0;
mfp.m_protected = 0;
mfp.m_modifiedDate = mfp.m_creationDate = timestamp;
@@ -76,15 +75,11 @@ int main(int argc, const char **argv)
mfp.m_finderFlags |= PortabilityLayer::FINDER_FILE_FLAG_INITED;
}
std::string gpdPath = outPath + ".gpd";
CopyFile(inPath.c_str(), gpdPath.c_str(), 0);
PortabilityLayer::MacFilePropertiesSerialized mps;
mps.Serialize(mfp);
std::string gpfPath = outPath + ".gpf";
FILE *file = nullptr;
errno_t err = fopen_s(&file, gpfPath.c_str(), "wb");
errno_t err = fopen_s(&file, outPath.c_str(), "wb");
if (!err)
{
fwrite(mps.m_data, PortabilityLayer::MacFilePropertiesSerialized::kSize, 1, file);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -61,7 +61,7 @@ void DoAbout (void)
{
messagePtr = (**version).shortVersion + 1 + (**version).shortVersion[0];
BlockMove((Ptr)messagePtr, &longVersion, ((UInt8)*messagePtr) + 1);
memcpy(&longVersion, messagePtr, ((UInt8)*messagePtr) + 1);
SetDialogString(aboutDialog, kTextItemVers, longVersion);
}
@@ -149,10 +149,10 @@ static void UpdateMainPict (Dialog *theDial)
DrawDialogUserText2(theDial, 7, theStr);
PasStringCopy(PSTR("Screen: "), theStr); // display screen size/depth
NumToString((long)(thisMac.screen.right - thisMac.screen.left), theStr2);
NumToString((long)(thisMac.fullScreen.right - thisMac.fullScreen.left), theStr2);
PasStringConcat(theStr, theStr2);
PasStringConcat(theStr, PSTR("x"));
NumToString((long)(thisMac.screen.bottom - thisMac.screen.top), theStr2);
NumToString((long)(thisMac.fullScreen.bottom - thisMac.fullScreen.top), theStr2);
PasStringConcat(theStr, theStr2);
PasStringConcat(theStr, PSTR("x"));
NumToString((long)thisMac.isDepth, theStr2);

View File

@@ -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

View File

@@ -7,6 +7,7 @@
#include "PLAppleEvents.h"
#include "AppEventHandler.h"
#include "DialogManager.h"
#include "Externs.h"
#include "House.h"
@@ -56,6 +57,7 @@ PLError_t DoOpenDocAE (const AppleEvent *theAE, AppleEvent *reply, UInt32 ref)
DescType returnedType;
PLError_t theErr, whoCares;
short i;
bool redrawMainWindow = false;
theErr = AEGetParamDesc(theAE, keyDirectObject, typeAEList, &docList);
if (theErr != PLErrors::kNone)
@@ -112,7 +114,7 @@ PLError_t DoOpenDocAE (const AppleEvent *theAE, AppleEvent *reply, UInt32 ref)
Rect updateRect;
SetRect(&updateRect, splashOriginH + 474, splashOriginV + 304, splashOriginH + 474 + 166, splashOriginV + 304 + 12);
InvalWindowRect(mainWindow, &updateRect);
redrawMainWindow = true;
}
}
}
@@ -120,6 +122,9 @@ PLError_t DoOpenDocAE (const AppleEvent *theAE, AppleEvent *reply, UInt32 ref)
}
#endif
whoCares = AEDisposeDesc(&docList);
if (redrawMainWindow)
UpdateMainWindow();
return theErr;
}
@@ -164,12 +169,38 @@ PLError_t MyGotRequiredParams (const AppleEvent *theAE)
PLErrors::kInvalidParameter;
}
class SystemEventHandlerImpl : public PortabilityLayer::IAppEventHandler
{
public:
void OnQuit() override;
static SystemEventHandlerImpl *GetInstance();
private:
static SystemEventHandlerImpl ms_instance;
};
void SystemEventHandlerImpl::OnQuit()
{
quitting = true;
}
SystemEventHandlerImpl *SystemEventHandlerImpl::GetInstance()
{
return &ms_instance;
}
SystemEventHandlerImpl SystemEventHandlerImpl::ms_instance;
//-------------------------------------------------------------- SetUpAppleEvents
// Initializes all handlers, etc. for dealing with Apple Events.
void SetUpAppleEvents (void)
{
PLError_t theErr;
PortabilityLayer::AppEventHandler::SetInstance(SystemEventHandlerImpl::GetInstance());
openAppAEUPP = NewAEEventHandlerProc(DoOpenAppAE);
openDocAEUPP = NewAEEventHandlerProc(DoOpenDocAE);

View File

@@ -50,7 +50,7 @@ void DrawBanner (Point *topLeft)
PLError_t theErr;
QSetRect(&wholePage, 0, 0, 330, 220);
mapBounds = thisMac.screen;
mapBounds = thisMac.fullScreen;
ZeroRectCorner(&mapBounds);
CenterRectInRect(&wholePage, &mapBounds);
topLeft->h = wholePage.left;
@@ -203,8 +203,8 @@ void DisplayStarsRemaining (void)
DrawSurface *surface = mainWindow->GetDrawSurface();
QSetRect(&bounds, 0, 0, 256, 64);
CenterRectInRect(&bounds, &thisMac.screen);
QOffsetRect(&bounds, -thisMac.screen.left, -thisMac.screen.top);
CenterRectInRect(&bounds, &thisMac.fullScreen);
QOffsetRect(&bounds, -thisMac.fullScreen.left, -thisMac.fullScreen.top);
src = bounds;
InsetRect(&src, 64, 32);

View File

@@ -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);
}

View File

@@ -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;
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);
else
coordWindow = NewWindow(nil, &coordWindowRect,
PSTR("Tools"), false, windowStyle, kPutInFront, true, 0L);
{
PortabilityLayer::WindowDef wdef = PortabilityLayer::WindowDef::Create(coordWindowRect, windowStyle, true, 0, 0, PSTR("Tools"));
coordWindow = wm->CreateWindow(wdef);
}
if (coordWindow == nil)
RedAlert(kErrNoMemory);
@@ -148,10 +149,9 @@ 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();
coordH = -1;
coordV = -1;

View File

@@ -374,8 +374,6 @@ void DrawDefaultButton (Dialog *theDialog)
surface->FrameRoundRect(offsetRect, 8, 8);
}
}
PenNormal();
}
//-------------------------------------------------------------- GetDialogString
@@ -397,7 +395,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
@@ -433,18 +433,17 @@ void SetDialogItemValue (Dialog *theDialog, short item, short theState)
void ToggleDialogItemValue (Dialog *theDialog, short item)
{
Rect itemRect;
ControlHandle itemHandle;
int16_t itemType, theState;
const PortabilityLayer::DialogItem &itemRef = theDialog->GetItems()[item - 1];
int16_t theState;
theState = itemRef.GetWidget()->GetState();
PortabilityLayer::Widget *widget = theDialog->GetItems()[item - 1].GetWidget();
theState = widget->GetState();
if (theState == 0)
theState = 1;
else
theState = 0;
SetControlValue(itemHandle, theState);
widget->SetState(theState);
widget->DrawControl(theDialog->GetWindow()->GetDrawSurface());
}
//-------------------------------------------------------------- SetDialogNumToStr
@@ -601,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();
@@ -708,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
@@ -724,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);
}
}

View File

@@ -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);

View File

@@ -5,10 +5,12 @@
//============================================================================
#include "ArrayTools.h"
#include "Externs.h"
#include "Environ.h"
#include "MainWindow.h"
#include "Objects.h"
#include "QDPixMap.h"
#include "RectUtils.h"
#include "Room.h"
#include "Utilities.h"
@@ -67,7 +69,7 @@ void NilSavedMaps (void)
// room that it obscured so that, should the player get the object,<2C>
// it can be made to "disappear".
short BackUpToSavedMap (Rect *theRect, short where, short who)
short BackUpToSavedMap (Rect *theRect, SInt16 where, SInt16 who)
{
Rect mapRect;
PLError_t theErr;
@@ -97,7 +99,7 @@ short BackUpToSavedMap (Rect *theRect, short where, short who)
// a slot in the pixmap array for the object. It re-copies the background<6E>
// and is needed when the lights in the room go on or off.
short ReBackUpSavedMap (Rect *theRect, short where, short who)
SInt16 ReBackUpSavedMap (Rect *theRect, SInt16 where, SInt16 who)
{
Rect mapRect;
short i, foundIndex;
@@ -111,6 +113,8 @@ short ReBackUpSavedMap (Rect *theRect, short where, short who)
foundIndex = i;
mapRect = *theRect;
ZeroRectCorner(&mapRect);
savedMaps[foundIndex].dest = *theRect;
CopyBits((BitMap *)*GetGWorldPixMap(backSrcMap),
GetPortBitMapForCopyBits(savedMaps[foundIndex].map),
@@ -120,7 +124,54 @@ short ReBackUpSavedMap (Rect *theRect, short where, short who)
}
}
return (foundIndex);
return BackUpToSavedMap(theRect, where, who);
}
//-------------------------------------------------------------- RemoveFromSavedMap
template<class T>
void RemapDynamicObject(T *arr, short &count, int removedIndex, int substituteIndex)
{
short countCopy = count;
for (int i = 0; i < countCopy; i++)
{
if (arr[i].who == removedIndex)
{
PortabilityLayer::ArrayTools::RemoveFromArray(arr, countCopy, i);
i--;
}
else if (arr[i].who == substituteIndex)
arr[i].who = removedIndex;
}
count = countCopy;
}
SInt16 RemoveFromSavedMap (SInt16 index)
{
int swappedIn = numSavedMaps - 1;
RemapDynamicObject(flames, numFlames, index, swappedIn);
RemapDynamicObject(tikiFlames, numTikiFlames, index, swappedIn);
RemapDynamicObject(bbqCoals, numCoals, index, swappedIn);
RemapDynamicObject(pendulums, numPendulums, index, swappedIn);
RemapDynamicObject(theStars, numStars, index, swappedIn);
RemapGreaseSavedMap(index, swappedIn);
// Have to do this explicitly so we don't trash the draw surface pointer
if (swappedIn != index)
{
savedType &dest = savedMaps[index];
savedType &src = savedMaps[swappedIn];
DisposeGWorld(dest.map);
dest = src;
src.map = nil;
}
numSavedMaps--;
return -1;
}
//-------------------------------------------------------------- RestoreFromSavedMap
@@ -289,7 +340,7 @@ void BackUpFlames (Rect *src, short index)
// Like the above function but this is called when the lighting changes<65>
// in a room (lights go on or off).
void ReBackUpFlames (short where, short who)
Boolean ReBackUpFlames (short where, short who, short h, short v)
{
short i, f;
@@ -301,19 +352,22 @@ void ReBackUpFlames (short where, short who)
{
if (flames[f].who == i)
{
QOffsetRect(&flames[f].dest, h - 8 - flames[f].dest.left, v - 15 - flames[f].dest.top);
BackUpFlames(&flames[f].dest, i);
return;
return true;
}
}
}
}
return false;
}
//-------------------------------------------------------------- AddCandleFlame
// This adds a candle flame to tha array of flames.
void AddCandleFlame (short where, short who, short h, short v)
void AddCandleFlame (SInt16 where, SInt16 who, SInt16 h, SInt16 v)
{
Rect src, bounds;
short savedNum;
@@ -373,7 +427,7 @@ void BackUpTikiFlames (Rect *src, short index)
// This is like the function ReBackUpFlames() but customized for Tiki torches.
void ReBackUpTikiFlames (short where, short who)
Boolean ReBackUpTikiFlames (short where, short who, short h, short v)
{
short i, f;
@@ -385,12 +439,15 @@ void ReBackUpTikiFlames (short where, short who)
{
if (tikiFlames[f].who == i)
{
QOffsetRect(&tikiFlames[f].dest, h - tikiFlames[f].dest.left, v - tikiFlames[f].dest.top);
BackUpTikiFlames(&tikiFlames[f].dest, i);
return;
return true;
}
}
}
}
return false;
}
//-------------------------------------------------------------- AddTikiFlame
@@ -459,7 +516,7 @@ void BackUpBBQCoals (Rect *src, short index)
// Sense a pattern here?
void ReBackUpBBQCoals (short where, short who)
Boolean ReBackUpBBQCoals (short where, short who, short h, short v)
{
short i, f;
@@ -471,12 +528,15 @@ void ReBackUpBBQCoals (short where, short who)
{
if (bbqCoals[f].who == i)
{
QOffsetRect(&bbqCoals[f].dest, h - bbqCoals[f].dest.left, v - bbqCoals[f].dest.top);
BackUpBBQCoals(&bbqCoals[f].dest, i);
return;
return true;
}
}
}
}
return false;
}
//-------------------------------------------------------------- AddBBQCoals
@@ -543,7 +603,7 @@ void BackUpPendulum (Rect *src, short index)
// Backs up the pendulums in the event of lights going on or off.
void ReBackUpPendulum (short where, short who)
Boolean ReBackUpPendulum (short where, short who, short h, short v)
{
short i, f;
@@ -555,19 +615,26 @@ void ReBackUpPendulum (short where, short who)
{
if (pendulums[f].who == i)
{
BackUpPendulum(&pendulums[f].dest, i);
return;
Rect &pendulumDest = pendulums[f].dest;
pendulumDest.right += h - pendulumDest.left;
pendulumDest.bottom += v - pendulumDest.top;
pendulumDest.left = h;
pendulumDest.top = v;
BackUpPendulum(&pendulumDest, i);
return true;
}
}
}
}
return false;
}
//-------------------------------------------------------------- AddPendulum
// Adds a pendulum to the array of pendulums.
void AddPendulum (short where, short who, short h, short v)
void AddPendulum (SInt16 where, SInt16 who, SInt16 h, SInt16 v)
{
Rect src, bounds;
short savedNum;
@@ -635,7 +702,7 @@ void BackUpStar (Rect *src, short index)
// Re-backs up the stars - in the event of lighting switch.
void ReBackUpStar (short where, short who)
void ReBackUpStar (short where, short who, short h, short v)
{
short i, f;
@@ -647,6 +714,7 @@ void ReBackUpStar (short where, short who)
{
if (theStars[f].who == i)
{
QOffsetRect(&theStars[f].dest, h - theStars[f].dest.left, v - theStars[f].dest.top);
BackUpStar(&theStars[f].dest, i);
return;
}
@@ -796,3 +864,14 @@ void ZeroFlamesAndTheLike (void)
numChimes = 0;
}
void RemoveSavedMapsNotInRoom(SInt16 where)
{
for (int i = 0; i < numSavedMaps; i++)
{
if (savedMaps[i].where != where)
{
RemoveFromSavedMap(i);
i--;
}
}
}

View File

@@ -153,6 +153,48 @@ void RenderDynamics (void)
}
}
//-------------------------------------------------------------- ZeroDinah
void ZeroDinah(dynaType &dinah)
{
dinah.type = kObjectIsEmpty;
QSetRect(&dinah.dest, 0, 0, 0, 0);
QSetRect(&dinah.whole, 0, 0, 0, 0);
dinah.hVel = 0;
dinah.vVel = 0;
dinah.count = 0;
dinah.frame = 0;
dinah.timer = 0;
dinah.position = 0;
dinah.room = 0;
dinah.byte0 = 0;
dinah.active = false;
}
//-------------------------------------------------------------- ZeroDinahsNotInRoom
void ZeroDinahsNotInRoom (SInt16 room)
{
short i;
short newNumDynamics = 0;
for (i = 0; i < numDynamics; i++)
{
dynaType &dinah = dinahs[i];
if (dinah.room == room)
{
if (newNumDynamics != numDynamics)
memcpy(&dinahs[newNumDynamics], &dinahs[i], sizeof(dynaType));
newNumDynamics++;
}
}
for (i = newNumDynamics; i < kMaxDynamicObs; i++)
ZeroDinah(dinahs[i]);
numDynamics = newNumDynamics;
}
//-------------------------------------------------------------- ZeroDinahs
// This clears all dynamics - zeros them all out. Used to initialize them.
@@ -162,20 +204,8 @@ void ZeroDinahs (void)
short i;
for (i = 0; i < kMaxDynamicObs; i++)
{
dinahs[i].type = kObjectIsEmpty;
QSetRect(&dinahs[i].dest, 0, 0, 0, 0);
QSetRect(&dinahs[i].whole, 0, 0, 0, 0);
dinahs[i].hVel = 0;
dinahs[i].vVel = 0;
dinahs[i].count = 0;
dinahs[i].frame = 0;
dinahs[i].timer = 0;
dinahs[i].position = 0;
dinahs[i].room = 0;
dinahs[i].byte0 = 0;
dinahs[i].active = false;
}
ZeroDinah(dinahs[i]);
numDynamics = 0;
}
@@ -185,371 +215,494 @@ void ZeroDinahs (void)
// This function sets up the structures to handle them.
short AddDynamicObject (short what, Rect *where, objectType *who,
short room, short index, Boolean isOn)
short room, short index, Boolean isOn, Boolean keepExisting)
{
short position, velocity;
Boolean lilFrame;
if (numDynamics >= kMaxDynamicObs)
return (-1);
dinahs[numDynamics].type = what;
switch (what)
short dynIndex = -1;
if (!keepExisting)
{
case kSparkle:
dinahs[numDynamics].dest = sparkleSrc[0];
ZeroRectCorner(&dinahs[numDynamics].dest);
QOffsetRect(&dinahs[numDynamics].dest, where->left, where->top);
dinahs[numDynamics].whole = dinahs[numDynamics].dest;
dinahs[numDynamics].hVel = 0;
dinahs[numDynamics].vVel = 0;
dinahs[numDynamics].count = 0;
dinahs[numDynamics].frame = 0;
dinahs[numDynamics].timer = RandomInt(60) + 15;
dinahs[numDynamics].position = 0;
dinahs[numDynamics].room = room;
dinahs[numDynamics].byte0 = (Byte)index;
dinahs[numDynamics].byte1 = 0;
dinahs[numDynamics].moving = false;
dinahs[numDynamics].active = isOn;
break;
case kToaster:
dinahs[numDynamics].dest = breadSrc[0];
CenterRectInRect(&dinahs[numDynamics].dest, where);
VOffsetRect(&dinahs[numDynamics].dest,
where->top - dinahs[numDynamics].dest.top);
dinahs[numDynamics].whole = dinahs[numDynamics].dest;
dinahs[numDynamics].hVel = where->top + 2; // hVel used as clip
position = who->data.g.height; // reverse engineer init. vel.
velocity = 0;
do
if (numDynamics >= kMaxDynamicObs)
return (-1);
dynIndex = numDynamics;
numDynamics++;
dinahs[dynIndex].type = what;
}
else
{
for (int i = 0; i < numDynamics; i++)
{
velocity++;
position -= velocity;
if (dinahs[i].type == what && dinahs[i].room == room && dinahs[i].byte0 == index)
{
dynIndex = i;
break;
}
}
while (position > 0);
dinahs[numDynamics].vVel = -velocity;
dinahs[numDynamics].count = velocity; // count = initial velocity
dinahs[numDynamics].frame = (short)who->data.g.delay * 3;
dinahs[numDynamics].timer = dinahs[numDynamics].frame;
dinahs[numDynamics].position = 0; // launch/idle state
dinahs[numDynamics].room = room;
dinahs[numDynamics].byte0 = (Byte)index;
dinahs[numDynamics].byte1 = 0;
dinahs[numDynamics].moving = false;
dinahs[numDynamics].active = isOn;
break;
case kMacPlus:
dinahs[numDynamics].dest = plusScreen1;
ZeroRectCorner(&dinahs[numDynamics].dest);
QOffsetRect(&dinahs[numDynamics].dest,
where->left + playOriginH + 10,
where->top + playOriginV + 7);
dinahs[numDynamics].whole = dinahs[numDynamics].dest;
dinahs[numDynamics].hVel = 0;
dinahs[numDynamics].vVel = 0;
dinahs[numDynamics].count = 0;
dinahs[numDynamics].frame = 0;
dinahs[numDynamics].timer = 0;
dinahs[numDynamics].position = 0;
dinahs[numDynamics].room = room;
dinahs[numDynamics].byte0 = (Byte)index;
dinahs[numDynamics].byte1 = 0;
dinahs[numDynamics].moving = false;
dinahs[numDynamics].active = isOn;
break;
case kTV:
dinahs[numDynamics].dest = tvScreen1;
ZeroRectCorner(&dinahs[numDynamics].dest);
QOffsetRect(&dinahs[numDynamics].dest,
where->left + playOriginH + 17,
where->top + playOriginV + 10);
dinahs[numDynamics].whole = dinahs[numDynamics].dest;
dinahs[numDynamics].hVel = 0;
dinahs[numDynamics].vVel = 0;
dinahs[numDynamics].count = 0;
dinahs[numDynamics].frame = 0;
dinahs[numDynamics].timer = 0;
dinahs[numDynamics].position = 0;
dinahs[numDynamics].room = room;
dinahs[numDynamics].byte0 = (Byte)index;
dinahs[numDynamics].byte1 = 0;
dinahs[numDynamics].moving = false;
dinahs[numDynamics].active = isOn;
break;
case kCoffee:
dinahs[numDynamics].dest = coffeeLight1;
ZeroRectCorner(&dinahs[numDynamics].dest);
QOffsetRect(&dinahs[numDynamics].dest,
where->left + playOriginH + 32,
where->top + playOriginV + 57);
dinahs[numDynamics].whole = dinahs[numDynamics].dest;
dinahs[numDynamics].hVel = 0;
dinahs[numDynamics].vVel = 0;
dinahs[numDynamics].count = 0;
dinahs[numDynamics].frame = 0;
if (isOn)
dinahs[numDynamics].timer = 200;
else
dinahs[numDynamics].timer = 0;
dinahs[numDynamics].position = 0;
dinahs[numDynamics].room = room;
dinahs[numDynamics].byte0 = (Byte)index;
dinahs[numDynamics].byte1 = 0;
dinahs[numDynamics].moving = false;
dinahs[numDynamics].active = isOn;
break;
case kOutlet:
dinahs[numDynamics].dest = outletSrc[0];
ZeroRectCorner(&dinahs[numDynamics].dest);
QOffsetRect(&dinahs[numDynamics].dest,
where->left + playOriginH,
where->top + playOriginV);
dinahs[numDynamics].whole = dinahs[numDynamics].dest;
dinahs[numDynamics].hVel = numLights;
dinahs[numDynamics].vVel = 0;
dinahs[numDynamics].count = ((short)who->data.g.delay * 6) / kTicksPerFrame;
dinahs[numDynamics].frame = 0;
dinahs[numDynamics].timer = dinahs[numDynamics].count;
dinahs[numDynamics].position = 0; // launch/idle state
dinahs[numDynamics].room = room;
dinahs[numDynamics].byte0 = (Byte)index;
dinahs[numDynamics].byte1 = 0;
dinahs[numDynamics].moving = false;
dinahs[numDynamics].active = isOn;
break;
case kVCR:
dinahs[numDynamics].dest = vcrTime1;
ZeroRectCorner(&dinahs[numDynamics].dest);
QOffsetRect(&dinahs[numDynamics].dest,
where->left + playOriginH + 64,
where->top + playOriginV + 6);
dinahs[numDynamics].whole = dinahs[numDynamics].dest;
dinahs[numDynamics].hVel = 0;
dinahs[numDynamics].vVel = 0;
dinahs[numDynamics].count = 0;
dinahs[numDynamics].frame = 0;
if (isOn)
dinahs[numDynamics].timer = 115;
else
dinahs[numDynamics].timer = 0;
dinahs[numDynamics].position = 0;
dinahs[numDynamics].room = room;
dinahs[numDynamics].byte0 = (Byte)index;
dinahs[numDynamics].byte1 = 0;
dinahs[numDynamics].moving = false;
dinahs[numDynamics].active = isOn;
break;
case kStereo:
dinahs[numDynamics].dest = stereoLight1;
ZeroRectCorner(&dinahs[numDynamics].dest);
QOffsetRect(&dinahs[numDynamics].dest,
where->left + playOriginH + 56,
where->top + playOriginV + 20);
dinahs[numDynamics].whole = dinahs[numDynamics].dest;
dinahs[numDynamics].hVel = 0;
dinahs[numDynamics].vVel = 0;
dinahs[numDynamics].count = 0;
dinahs[numDynamics].frame = 0;
dinahs[numDynamics].timer = 0;
dinahs[numDynamics].position = 0;
dinahs[numDynamics].room = room;
dinahs[numDynamics].byte0 = (Byte)index;
dinahs[numDynamics].byte1 = 0;
dinahs[numDynamics].moving = false;
dinahs[numDynamics].active = isOn;
break;
case kMicrowave:
dinahs[numDynamics].dest = microOn;
ZeroRectCorner(&dinahs[numDynamics].dest);
QOffsetRect(&dinahs[numDynamics].dest,
where->left + playOriginH + 14,
where->top + playOriginV + 13);
dinahs[numDynamics].dest.right = dinahs[numDynamics].dest.left + 48;
dinahs[numDynamics].whole = dinahs[numDynamics].dest;
dinahs[numDynamics].hVel = 0;
dinahs[numDynamics].vVel = 0;
dinahs[numDynamics].count = 0;
dinahs[numDynamics].frame = 0;
dinahs[numDynamics].timer = 0;
dinahs[numDynamics].position = 0;
dinahs[numDynamics].room = room;
dinahs[numDynamics].byte0 = (Byte)index;
dinahs[numDynamics].byte1 = 0;
dinahs[numDynamics].moving = false;
dinahs[numDynamics].active = isOn;
break;
case kBalloon:
dinahs[numDynamics].dest = balloonSrc[0];
ZeroRectCorner(&dinahs[numDynamics].dest);
QOffsetRect(&dinahs[numDynamics].dest, where->left, 0);
dinahs[numDynamics].dest.bottom = kBalloonStart;
dinahs[numDynamics].dest.top = dinahs[numDynamics].dest.bottom -
RectTall(&balloonSrc[0]);
dinahs[numDynamics].whole = dinahs[numDynamics].dest;
dinahs[numDynamics].hVel = 0;
dinahs[numDynamics].vVel = -2;
dinahs[numDynamics].count = ((short)who->data.h.delay * 6) / kTicksPerFrame;
dinahs[numDynamics].frame = 0;
dinahs[numDynamics].timer = dinahs[numDynamics].count;
dinahs[numDynamics].position = 0;
dinahs[numDynamics].room = room;
dinahs[numDynamics].byte0 = (Byte)index;
dinahs[numDynamics].byte1 = 0;
dinahs[numDynamics].moving = false;
dinahs[numDynamics].active = isOn; // initially idle
break;
case kCopterLf:
case kCopterRt:
dinahs[numDynamics].dest = copterSrc[0];
ZeroRectCorner(&dinahs[numDynamics].dest);
QOffsetRect(&dinahs[numDynamics].dest, where->left, 0);
dinahs[numDynamics].dest.top = kCopterStart;
dinahs[numDynamics].dest.bottom = dinahs[numDynamics].dest.top +
RectTall(&copterSrc[0]);
dinahs[numDynamics].whole = dinahs[numDynamics].dest;
if (what == kCopterLf)
dinahs[numDynamics].hVel = -1;
else
dinahs[numDynamics].hVel = 1;
dinahs[numDynamics].vVel = 2;
dinahs[numDynamics].count = ((short)who->data.h.delay * 6) / kTicksPerFrame;
dinahs[numDynamics].frame = 0;
dinahs[numDynamics].timer = dinahs[numDynamics].count;
dinahs[numDynamics].position = dinahs[numDynamics].dest.left;
dinahs[numDynamics].room = room;
dinahs[numDynamics].byte0 = (Byte)index;
dinahs[numDynamics].byte1 = 0;
dinahs[numDynamics].moving = false;
dinahs[numDynamics].active = isOn; // initially idle
break;
case kDartLf:
case kDartRt:
dinahs[numDynamics].dest = dartSrc[0];
ZeroRectCorner(&dinahs[numDynamics].dest);
if (what == kDartLf)
{
QOffsetRect(&dinahs[numDynamics].dest,
kRoomWide - RectWide(&dartSrc[0]), where->top);
dinahs[numDynamics].hVel = -kDartVelocity;
dinahs[numDynamics].frame = 0;
}
else
{
QOffsetRect(&dinahs[numDynamics].dest, 0, where->top);
dinahs[numDynamics].hVel = kDartVelocity;
dinahs[numDynamics].frame = 2;
}
dinahs[numDynamics].whole = dinahs[numDynamics].dest;
dinahs[numDynamics].vVel = 2;
dinahs[numDynamics].count = ((short)who->data.h.delay * 6) / kTicksPerFrame;
dinahs[numDynamics].timer = dinahs[numDynamics].count;
dinahs[numDynamics].position = dinahs[numDynamics].dest.top;
dinahs[numDynamics].byte0 = (Byte)index;
dinahs[numDynamics].byte1 = 0;
dinahs[numDynamics].moving = false;
dinahs[numDynamics].active = isOn; // initially idle
break;
case kBall:
dinahs[numDynamics].dest = ballSrc[0];
ZeroRectCorner(&dinahs[numDynamics].dest);
QOffsetRect(&dinahs[numDynamics].dest,
where->left, where->top);
dinahs[numDynamics].whole = dinahs[numDynamics].dest;
dinahs[numDynamics].hVel = 0;
position = who->data.h.length; // reverse engineer init. vel.
velocity = 0;
evenFrame = true;
lilFrame = true;
do
{
if (lilFrame)
velocity++;
lilFrame = !lilFrame;
position -= velocity;
}
while (position > 0);
dinahs[numDynamics].vVel = -velocity;
dinahs[numDynamics].moving = false;
dinahs[numDynamics].count = -velocity; // count = initial velocity
dinahs[numDynamics].frame = 0;
dinahs[numDynamics].timer = 0;
dinahs[numDynamics].position = dinahs[numDynamics].dest.bottom;
dinahs[numDynamics].room = room;
dinahs[numDynamics].byte0 = (Byte)index;
dinahs[numDynamics].byte1 = 0;
dinahs[numDynamics].active = isOn;
break;
case kDrip:
dinahs[numDynamics].dest = dripSrc[0];
CenterRectInRect(&dinahs[numDynamics].dest, where);
VOffsetRect(&dinahs[numDynamics].dest,
where->top - dinahs[numDynamics].dest.top);
dinahs[numDynamics].whole = dinahs[numDynamics].dest;
dinahs[numDynamics].hVel = dinahs[numDynamics].dest.top; // remember
dinahs[numDynamics].vVel = 0;
dinahs[numDynamics].count = ((short)who->data.h.delay * 6) / kTicksPerFrame;
dinahs[numDynamics].frame = 3;
dinahs[numDynamics].timer = dinahs[numDynamics].count;
dinahs[numDynamics].position = dinahs[numDynamics].dest.top +
who->data.h.length;
dinahs[numDynamics].room = room;
dinahs[numDynamics].byte0 = (Byte)index;
dinahs[numDynamics].byte1 = 0;
dinahs[numDynamics].moving = false;
dinahs[numDynamics].active = isOn;
break;
case kFish:
dinahs[numDynamics].dest = fishSrc[0];
QOffsetRect(&dinahs[numDynamics].dest,
where->left + 10, where->top + 8);
dinahs[numDynamics].whole = dinahs[numDynamics].dest;
dinahs[numDynamics].hVel = ((short)who->data.h.delay * 6) / kTicksPerFrame;
position = who->data.g.height; // reverse engineer init. vel.
velocity = 0;
evenFrame = true;
lilFrame = true;
do
{
if (lilFrame)
velocity++;
lilFrame = !lilFrame;
position -= velocity;
}
while (position > 0);
dinahs[numDynamics].vVel = -velocity;
dinahs[numDynamics].count = -velocity; // count = initial velocity
dinahs[numDynamics].frame = 0;
dinahs[numDynamics].timer = dinahs[numDynamics].hVel;
dinahs[numDynamics].position = dinahs[numDynamics].dest.bottom;
dinahs[numDynamics].room = room;
dinahs[numDynamics].byte0 = (Byte)index;
dinahs[numDynamics].byte1 = 0;
dinahs[numDynamics].moving = false;
dinahs[numDynamics].active = isOn;
break;
default:
return (-1);
break;
if (dynIndex == -1)
return (-1);
}
numDynamics++;
return (numDynamics - 1);
}
switch (what)
{
case kSparkle:
dinahs[dynIndex].dest = sparkleSrc[0];
ZeroRectCorner(&dinahs[dynIndex].dest);
QOffsetRect(&dinahs[dynIndex].dest, where->left, where->top);
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
if (!keepExisting)
{
dinahs[dynIndex].hVel = 0;
dinahs[dynIndex].vVel = 0;
dinahs[dynIndex].count = 0;
dinahs[dynIndex].frame = 0;
dinahs[dynIndex].timer = RandomInt(60) + 15;
dinahs[dynIndex].position = 0;
dinahs[dynIndex].room = room;
dinahs[dynIndex].byte0 = (Byte)index;
dinahs[dynIndex].byte1 = 0;
dinahs[dynIndex].moving = false;
dinahs[dynIndex].active = isOn;
}
break;
case kToaster:
{
short baselineDelta = 0;
if (keepExisting)
baselineDelta = dinahs[dynIndex].dest.top - (where->top - 2);
dinahs[dynIndex].dest = breadSrc[0];
CenterRectInRect(&dinahs[dynIndex].dest, where);
VOffsetRect(&dinahs[dynIndex].dest,
where->top - dinahs[dynIndex].dest.top + baselineDelta);
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
dinahs[dynIndex].hVel = where->top + 2; // hVel used as clip
if (!keepExisting)
{
position = who->data.g.height; // reverse engineer init. vel.
velocity = 0;
do
{
velocity++;
position -= velocity;
} while (position > 0);
dinahs[dynIndex].vVel = -velocity;
dinahs[dynIndex].count = velocity; // count = initial velocity
dinahs[dynIndex].frame = (short)who->data.g.delay * 3;
dinahs[dynIndex].timer = dinahs[dynIndex].frame;
dinahs[dynIndex].position = 0; // launch/idle state
dinahs[dynIndex].room = room;
dinahs[dynIndex].byte0 = (Byte)index;
dinahs[dynIndex].byte1 = 0;
dinahs[dynIndex].moving = false;
dinahs[dynIndex].active = isOn;
}
}
break;
case kMacPlus:
dinahs[dynIndex].dest = plusScreen1;
ZeroRectCorner(&dinahs[dynIndex].dest);
QOffsetRect(&dinahs[dynIndex].dest,
where->left + playOriginH + 10,
where->top + playOriginV + 7);
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
if (!keepExisting)
{
dinahs[dynIndex].hVel = 0;
dinahs[dynIndex].vVel = 0;
dinahs[dynIndex].count = 0;
dinahs[dynIndex].frame = 0;
dinahs[dynIndex].timer = 0;
dinahs[dynIndex].position = 0;
dinahs[dynIndex].room = room;
dinahs[dynIndex].byte0 = (Byte)index;
dinahs[dynIndex].byte1 = 0;
dinahs[dynIndex].moving = false;
dinahs[dynIndex].active = isOn;
}
break;
case kTV:
dinahs[dynIndex].dest = tvScreen1;
ZeroRectCorner(&dinahs[dynIndex].dest);
QOffsetRect(&dinahs[dynIndex].dest,
where->left + playOriginH + 17,
where->top + playOriginV + 10);
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
if (!keepExisting)
{
dinahs[dynIndex].hVel = 0;
dinahs[dynIndex].vVel = 0;
dinahs[dynIndex].count = 0;
dinahs[dynIndex].frame = 0;
dinahs[dynIndex].timer = 0;
dinahs[dynIndex].position = 0;
dinahs[dynIndex].room = room;
dinahs[dynIndex].byte0 = (Byte)index;
dinahs[dynIndex].byte1 = 0;
dinahs[dynIndex].moving = false;
dinahs[dynIndex].active = isOn;
}
break;
case kCoffee:
dinahs[dynIndex].dest = coffeeLight1;
ZeroRectCorner(&dinahs[dynIndex].dest);
QOffsetRect(&dinahs[dynIndex].dest,
where->left + playOriginH + 32,
where->top + playOriginV + 57);
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
if (!keepExisting)
{
dinahs[dynIndex].hVel = 0;
dinahs[dynIndex].vVel = 0;
dinahs[dynIndex].count = 0;
dinahs[dynIndex].frame = 0;
if (isOn)
dinahs[dynIndex].timer = 200;
else
dinahs[dynIndex].timer = 0;
dinahs[dynIndex].position = 0;
dinahs[dynIndex].room = room;
dinahs[dynIndex].byte0 = (Byte)index;
dinahs[dynIndex].byte1 = 0;
dinahs[dynIndex].moving = false;
dinahs[dynIndex].active = isOn;
}
break;
case kOutlet:
dinahs[dynIndex].dest = outletSrc[0];
ZeroRectCorner(&dinahs[dynIndex].dest);
QOffsetRect(&dinahs[dynIndex].dest,
where->left + playOriginH,
where->top + playOriginV);
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
if (!keepExisting)
{
dinahs[dynIndex].hVel = numLights;
dinahs[dynIndex].vVel = 0;
dinahs[dynIndex].count = ((short)who->data.g.delay * 6) / kTicksPerFrame;
dinahs[dynIndex].frame = 0;
dinahs[dynIndex].timer = dinahs[dynIndex].count;
dinahs[dynIndex].position = 0; // launch/idle state
dinahs[dynIndex].room = room;
dinahs[dynIndex].byte0 = (Byte)index;
dinahs[dynIndex].byte1 = 0;
dinahs[dynIndex].moving = false;
dinahs[dynIndex].active = isOn;
}
break;
case kVCR:
dinahs[dynIndex].dest = vcrTime1;
ZeroRectCorner(&dinahs[dynIndex].dest);
QOffsetRect(&dinahs[dynIndex].dest,
where->left + playOriginH + 64,
where->top + playOriginV + 6);
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
if (!keepExisting)
{
dinahs[dynIndex].hVel = 0;
dinahs[dynIndex].vVel = 0;
dinahs[dynIndex].count = 0;
dinahs[dynIndex].frame = 0;
if (isOn)
dinahs[dynIndex].timer = 115;
else
dinahs[dynIndex].timer = 0;
dinahs[dynIndex].position = 0;
dinahs[dynIndex].room = room;
dinahs[dynIndex].byte0 = (Byte)index;
dinahs[dynIndex].byte1 = 0;
dinahs[dynIndex].moving = false;
dinahs[dynIndex].active = isOn;
}
break;
case kStereo:
dinahs[dynIndex].dest = stereoLight1;
ZeroRectCorner(&dinahs[dynIndex].dest);
QOffsetRect(&dinahs[dynIndex].dest,
where->left + playOriginH + 56,
where->top + playOriginV + 20);
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
if (!keepExisting)
{
dinahs[dynIndex].hVel = 0;
dinahs[dynIndex].vVel = 0;
dinahs[dynIndex].count = 0;
dinahs[dynIndex].frame = 0;
dinahs[dynIndex].timer = 0;
dinahs[dynIndex].position = 0;
dinahs[dynIndex].room = room;
dinahs[dynIndex].byte0 = (Byte)index;
dinahs[dynIndex].byte1 = 0;
dinahs[dynIndex].moving = false;
dinahs[dynIndex].active = isOn;
}
break;
case kMicrowave:
dinahs[dynIndex].dest = microOn;
ZeroRectCorner(&dinahs[dynIndex].dest);
QOffsetRect(&dinahs[dynIndex].dest,
where->left + playOriginH + 14,
where->top + playOriginV + 13);
dinahs[dynIndex].dest.right = dinahs[dynIndex].dest.left + 48;
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
if (!keepExisting)
{
dinahs[dynIndex].hVel = 0;
dinahs[dynIndex].vVel = 0;
dinahs[dynIndex].count = 0;
dinahs[dynIndex].frame = 0;
dinahs[dynIndex].timer = 0;
dinahs[dynIndex].position = 0;
dinahs[dynIndex].room = room;
dinahs[dynIndex].byte0 = (Byte)index;
dinahs[dynIndex].byte1 = 0;
dinahs[dynIndex].moving = false;
dinahs[dynIndex].active = isOn;
}
break;
case kBalloon:
{
short baselineDelta = 0;
if (keepExisting)
baselineDelta = dinahs[dynIndex].dest.bottom - kBalloonStart;
dinahs[dynIndex].dest = balloonSrc[0];
ZeroRectCorner(&dinahs[dynIndex].dest);
QOffsetRect(&dinahs[dynIndex].dest, where->left, 0);
dinahs[dynIndex].dest.bottom = kBalloonStart + baselineDelta;
dinahs[dynIndex].dest.top = dinahs[dynIndex].dest.bottom -
RectTall(&balloonSrc[0]);
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
if (!keepExisting)
{
dinahs[dynIndex].hVel = 0;
dinahs[dynIndex].vVel = -2;
dinahs[dynIndex].count = ((short)who->data.h.delay * 6) / kTicksPerFrame;
dinahs[dynIndex].frame = 0;
dinahs[dynIndex].timer = dinahs[dynIndex].count;
dinahs[dynIndex].position = 0;
dinahs[dynIndex].room = room;
dinahs[dynIndex].byte0 = (Byte)index;
dinahs[dynIndex].byte1 = 0;
dinahs[dynIndex].moving = false;
dinahs[dynIndex].active = isOn; // initially idle
}
}
break;
case kCopterLf:
case kCopterRt:
{
short baselineDeltaH = 0;
short baselineDeltaV = 0;
if (keepExisting)
{
baselineDeltaH = dinahs[dynIndex].dest.left - dinahs[dynIndex].position;
baselineDeltaV = dinahs[dynIndex].dest.top - kCopterStart;
}
dinahs[dynIndex].dest = copterSrc[0];
ZeroRectCorner(&dinahs[dynIndex].dest);
QOffsetRect(&dinahs[dynIndex].dest, where->left, 0);
dinahs[dynIndex].dest.top = kCopterStart + baselineDeltaV;
dinahs[dynIndex].dest.bottom = dinahs[dynIndex].dest.top +
RectTall(&copterSrc[0]);
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
if (!keepExisting)
{
dinahs[dynIndex].position = dinahs[dynIndex].dest.left;
if (what == kCopterLf)
dinahs[dynIndex].hVel = -1;
else
dinahs[dynIndex].hVel = 1;
dinahs[dynIndex].vVel = 2;
dinahs[dynIndex].count = ((short)who->data.h.delay * 6) / kTicksPerFrame;
dinahs[dynIndex].frame = 0;
dinahs[dynIndex].timer = dinahs[dynIndex].count;
dinahs[dynIndex].room = room;
dinahs[dynIndex].byte0 = (Byte)index;
dinahs[dynIndex].byte1 = 0;
dinahs[dynIndex].moving = false;
dinahs[dynIndex].active = isOn; // initially idle
}
}
break;
case kDartLf:
case kDartRt:
dinahs[dynIndex].dest = dartSrc[0];
ZeroRectCorner(&dinahs[dynIndex].dest);
if (what == kDartLf)
{
QOffsetRect(&dinahs[dynIndex].dest,
kRoomWide - RectWide(&dartSrc[0]), where->top);
dinahs[dynIndex].hVel = -kDartVelocity;
dinahs[dynIndex].frame = 0;
}
else
{
QOffsetRect(&dinahs[dynIndex].dest, 0, where->top);
dinahs[dynIndex].hVel = kDartVelocity;
dinahs[dynIndex].frame = 2;
}
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
dinahs[dynIndex].position = dinahs[dynIndex].dest.top;
if (!keepExisting)
{
dinahs[dynIndex].vVel = 2;
dinahs[dynIndex].count = ((short)who->data.h.delay * 6) / kTicksPerFrame;
dinahs[dynIndex].timer = dinahs[dynIndex].count;
dinahs[dynIndex].byte0 = (Byte)index;
dinahs[dynIndex].byte1 = 0;
dinahs[dynIndex].moving = false;
dinahs[dynIndex].active = isOn; // initially idle
}
break;
case kBall:
{
short baselineDelta = 0;
if (keepExisting)
baselineDelta = dinahs[dynIndex].dest.bottom - dinahs[dynIndex].position;
dinahs[dynIndex].dest = ballSrc[0];
ZeroRectCorner(&dinahs[dynIndex].dest);
QOffsetRect(&dinahs[dynIndex].dest,
where->left, where->top + baselineDelta);
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
if (!keepExisting)
{
dinahs[dynIndex].position = dinahs[dynIndex].dest.bottom;
dinahs[dynIndex].hVel = 0;
position = who->data.h.length; // reverse engineer init. vel.
velocity = 0;
evenFrame = true;
lilFrame = true;
do
{
if (lilFrame)
velocity++;
lilFrame = !lilFrame;
position -= velocity;
} while (position > 0);
dinahs[dynIndex].vVel = -velocity;
dinahs[dynIndex].moving = false;
dinahs[dynIndex].count = -velocity; // count = initial velocity
dinahs[dynIndex].frame = 0;
dinahs[dynIndex].timer = 0;
dinahs[dynIndex].room = room;
dinahs[dynIndex].byte0 = (Byte)index;
dinahs[dynIndex].byte1 = 0;
dinahs[dynIndex].active = isOn;
}
}
break;
case kDrip:
{
short baselineDelta = 0;
if (keepExisting)
baselineDelta = dinahs[dynIndex].dest.top - dinahs[dynIndex].hVel;
dinahs[dynIndex].dest = dripSrc[0];
CenterRectInRect(&dinahs[dynIndex].dest, where);
VOffsetRect(&dinahs[dynIndex].dest,
where->top - dinahs[dynIndex].dest.top + baselineDelta);
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
if (!keepExisting)
{
dinahs[dynIndex].hVel = dinahs[dynIndex].dest.top; // remember
dinahs[dynIndex].position = dinahs[dynIndex].dest.top +
who->data.h.length;
dinahs[dynIndex].vVel = 0;
dinahs[dynIndex].count = ((short)who->data.h.delay * 6) / kTicksPerFrame;
dinahs[dynIndex].frame = 3;
dinahs[dynIndex].timer = dinahs[dynIndex].count;
dinahs[dynIndex].room = room;
dinahs[dynIndex].byte0 = (Byte)index;
dinahs[dynIndex].byte1 = 0;
dinahs[dynIndex].moving = false;
dinahs[dynIndex].active = isOn;
}
}
break;
case kFish:
{
short baselineDelta = 0;
if (keepExisting)
baselineDelta = dinahs[dynIndex].dest.bottom - dinahs[dynIndex].position;
dinahs[dynIndex].dest = fishSrc[0];
QOffsetRect(&dinahs[dynIndex].dest,
where->left + 10, where->top + 8 + baselineDelta);
dinahs[dynIndex].whole = dinahs[dynIndex].dest;
if (!keepExisting)
{
dinahs[dynIndex].position = dinahs[dynIndex].dest.bottom;
dinahs[dynIndex].hVel = ((short)who->data.h.delay * 6) / kTicksPerFrame;
position = who->data.g.height; // reverse engineer init. vel.
velocity = 0;
evenFrame = true;
lilFrame = true;
do
{
if (lilFrame)
velocity++;
lilFrame = !lilFrame;
position -= velocity;
} while (position > 0);
dinahs[dynIndex].vVel = -velocity;
dinahs[dynIndex].count = -velocity; // count = initial velocity
dinahs[dynIndex].frame = 0;
dinahs[dynIndex].timer = dinahs[dynIndex].hVel;
dinahs[dynIndex].room = room;
dinahs[dynIndex].byte0 = (Byte)index;
dinahs[dynIndex].byte1 = 0;
dinahs[dynIndex].moving = false;
dinahs[dynIndex].active = isOn;
}
}
break;
default:
break;
}
return dynIndex;
}

View File

@@ -8,12 +8,16 @@
#include "PLResources.h"
#include "PLPasStr.h"
#include "DisplayDeviceManager.h"
#include "Externs.h"
#include "Environ.h"
#include "HostDisplayDriver.h"
#include "HostSystemServices.h"
#include "MenuManager.h"
#include "IGpDisplayDriver.h"
#include "WindowManager.h"
#include <algorithm>
#define kSwitchDepthAlert 130
#define kSetMemoryAlert 180
@@ -193,8 +197,7 @@ Boolean DoWeHaveSoundManager3 (void)
Boolean DoWeHaveQuickTime (void)
{
PL_NotYetImplemented_TODO("Movies");
return false;
return true;
}
//-------------------------------------------------------------- DoWeHaveDragManager
@@ -273,6 +276,30 @@ short HowManyUsableScreens (Boolean use1Bit, Boolean use4Bit, Boolean use8Bit)
return 1;
}
//-------------------------------------------------------------- FlushResolutionChange
void FlushResolutionChange(void)
{
if (thisMac.isResolutionDirty)
{
GetDeviceRect(&thisMac.fullScreen);
thisMac.constrainedScreen = thisMac.fullScreen;
if (thisMac.constrainedScreen.Width() > kMaxViewWidth)
{
thisMac.constrainedScreen.left = 0;
thisMac.constrainedScreen.right = kMaxViewWidth;
}
if (thisMac.constrainedScreen.Height() > kMaxViewHeight)
{
thisMac.constrainedScreen.top = 0;
thisMac.constrainedScreen.bottom = kMaxViewHeight;
}
thisMac.gray = thisMac.fullScreen;
thisMac.gray.top = 20;
thisMac.isResolutionDirty = false;
}
}
//-------------------------------------------------------------- CheckOurEnvirons
// Calls all the above functions in order to fill out a sort of "spec sheet"<22>
// for the current Mac.
@@ -294,10 +321,57 @@ void CheckOurEnvirons (void)
thisMac.can4Bit = true;
thisMac.can8Bit = true;
thisMac.numScreens = HowManyUsableScreens(false, true, true);
GetDeviceRect(&thisMac.screen);
thisMac.wasDepth = WhatsOurDepth();
thisMac.wasColorOrGray = AreWeColorOrGrayscale();
thisMac.isResolutionDirty = true;
FlushResolutionChange();
}
//-------------------------------------------------------------- HandleResolutionChange
// Installs handler
void HandleResolutionChange(uint32_t prevWidth, uint32_t prevHeight, uint32_t newWidth, uint32_t newHeight)
{
PortabilityLayer::WindowManager::GetInstance()->HandleScreenResolutionChange(prevWidth, prevHeight, newWidth, newHeight);
PortabilityLayer::MenuManager::GetInstance()->DrawMenuBar();
thisMac.isResolutionDirty = true; // Because of legacy code, we don't want to update thisMac.screen immediately, but rather, let the editor or game pick it up
}
class GpAppResolutionChangeHandler final : public PortabilityLayer::DisplayDeviceManager::IResolutionChangeHandler
{
public:
void OnResolutionChanged(uint32_t prevWidth, uint32_t prevHeight, uint32_t newWidth, uint32_t newHeight) override
{
HandleResolutionChange(prevWidth, prevHeight, newWidth, newHeight);
}
void AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualHeight, float &pixelScaleX, float &pixelScaleY) override
{
double xMul = static_cast<double>(physicalWidth) / 640;
double yMul = static_cast<double>(physicalHeight) / 480;
xMul = floor(xMul);
yMul = floor(yMul);
double minMul = std::max<double>(1.0, std::min(xMul, yMul));
virtualWidth = physicalWidth / minMul;
virtualHeight = physicalHeight / minMul;
pixelScaleX = static_cast<float>(minMul);
pixelScaleY = static_cast<float>(minMul);
}
static GpAppResolutionChangeHandler ms_instance;
};
GpAppResolutionChangeHandler GpAppResolutionChangeHandler::ms_instance;
//-------------------------------------------------------------- InstallResolutionHandler
// Installs handler
void InstallResolutionHandler(void)
{
PortabilityLayer::DisplayDeviceManager::GetInstance()->SetResolutionChangeHandler(&GpAppResolutionChangeHandler::ms_instance);
}
//-------------------------------------------------------------- ReflectMonitor2Environs
@@ -411,7 +485,7 @@ void CheckMemorySize (void)
RedAlert(kErrNoMemory);
else
bytesNeeded += musicBytes;
bytesNeeded += 4L * (long)thisMac.screen.bottom; // main screen
bytesNeeded += 4L * (long)thisMac.constrainedScreen.bottom; // main screen
bytesNeeded += (((long)houseRect.right - (long)houseRect.left) *
((long)houseRect.bottom + 1 - (long)houseRect.top) *
(long)thisMac.isDepth) / 8L; // work map

View File

@@ -10,7 +10,7 @@
typedef struct
{
Rect screen, gray;
Rect fullScreen, constrainedScreen, gray;
long dirID;
short wasDepth, isDepth;
short numScreens;
@@ -28,9 +28,10 @@ typedef struct
Boolean hasSM3;
Boolean hasQT;
Boolean hasDrag;
Boolean isResolutionDirty;
} macEnviron;
extern macEnviron thisMac;
void FlushResolutionChange(void);

View File

@@ -17,6 +17,8 @@
#include "House.h"
#include "InputManager.h"
#include "ObjectEdit.h"
#include "Rect2i.h"
#include "WindowManager.h"
short BitchAboutColorDepth (void);
@@ -29,6 +31,7 @@ void HandleIdleTask (void);
void IncrementMode (void);
long lastUp, incrementModeTime;
UInt32 doubleTime;
Point lastWhere;
@@ -74,18 +77,15 @@ void HandleMouseEvent (const GpMouseInputEvent &theEvent, uint32_t tick)
switch (thePart)
{
case inMenuBar:
case RegionIDs::kMenuBar:
menuChoice = MenuSelect(evtPoint);
DoMenuChoice(menuChoice);
break;
case inDrag:
DragWindow(whichWindow, evtPoint, &thisMac.screen);
case RegionIDs::kTitleBar:
PortabilityLayer::WindowManager::GetInstance()->DragWindow(whichWindow, evtPoint, thisMac.fullScreen);
if (whichWindow == mainWindow)
{
SendBehind(mainWindow, (WindowPtr)0L);
GetWindowLeftTop(whichWindow, &isEditH, &isEditV);
}
else if (whichWindow == mapWindow)
GetWindowLeftTop(whichWindow, &isMapH, &isMapV);
else if (whichWindow == toolsWindow)
@@ -94,10 +94,9 @@ void HandleMouseEvent (const GpMouseInputEvent &theEvent, uint32_t tick)
GetWindowLeftTop(whichWindow, &isLinkH, &isLinkV);
else if (whichWindow == coordWindow)
GetWindowLeftTop(whichWindow, &isCoordH, &isCoordV);
HiliteAllWindows();
break;
case inGoAway:
case RegionIDs::kClose:
if (TrackGoAway(whichWindow, evtPoint))
{
if (whichWindow == mapWindow)
@@ -111,7 +110,7 @@ void HandleMouseEvent (const GpMouseInputEvent &theEvent, uint32_t tick)
}
break;
case inGrow:
case RegionIDs::kExpand:
if (whichWindow == mapWindow)
{
newSize = GrowWindow(mapWindow, evtPoint, &thisMac.gray);
@@ -119,13 +118,7 @@ void HandleMouseEvent (const GpMouseInputEvent &theEvent, uint32_t tick)
}
break;
case inZoomIn:
case inZoomOut:
if (TrackBox(whichWindow, evtPoint, thePart))
ZoomWindow(whichWindow, thePart, true);
break;
case inContent:
case RegionIDs::kContent:
if (whichWindow == mainWindow)
{
hDelta = evtPoint.h - lastWhere.h;
@@ -153,7 +146,7 @@ void HandleMouseEvent (const GpMouseInputEvent &theEvent, uint32_t tick)
HandleLinkClick(evtPoint);
break;
default:
default:
break;
}
}
@@ -358,11 +351,6 @@ void HandleUpdateEvent (EventRecord *theEvent)
UpdateCoordWindow();
EndUpdate(coordWindow);
}
else if ((WindowPtr)theEvent->message == menuWindow)
{
UpdateMenuBarWindow(menuWindow->GetDrawSurface());
EndUpdate(menuWindow);
}
}
//-------------------------------------------------------------- HandleOSEvent
@@ -435,6 +423,68 @@ void HandleHighLevelEvent (EventRecord *theEvent)
}
#endif
//-------------------------------------------------------------- HandleSplashResolutionChange
void HandleSplashResolutionChange(void)
{
FlushResolutionChange();
RecomputeInterfaceRects();
RecreateOffscreens();
CloseMainWindow();
OpenMainWindow();
UpdateMainWindow();
//ResetLocale(true);
InitScoreboardMap();
//RefreshScoreboard(wasScoreboardTitleMode);
//DumpScreenOn(&justRoomsRect);
}
void KeepWindowInBounds(Window *window)
{
if (!window)
return;
PortabilityLayer::Rect2i windowRect = PortabilityLayer::WindowManager::GetInstance()->GetWindowFullRect(window);
int32_t topNudge = std::max<int32_t>(kScoreboardTall - windowRect.Top(), 0);
int32_t bottomNudge = std::min<int32_t>(thisMac.fullScreen.bottom - windowRect.Bottom(), 0);
int32_t leftNudge = std::max<int32_t>(-windowRect.Left(), 0);
int32_t rightNudge = std::min<int32_t>(thisMac.fullScreen.right - windowRect.Right(), 0);
window->m_wmX += leftNudge + rightNudge;
window->m_wmY += topNudge + bottomNudge;
}
void HandleEditorResolutionChange(void)
{
FlushResolutionChange();
RecomputeInterfaceRects();
RecreateOffscreens();
CloseMainWindow();
OpenMainWindow();
UpdateMainWindow();
//ResetLocale(true);
InitScoreboardMap();
//RefreshScoreboard(wasScoreboardTitleMode);
//DumpScreenOn(&justRoomsRect);
if (toolsWindow)
PortabilityLayer::WindowManager::GetInstance()->PutWindowBehind(toolsWindow, PortabilityLayer::WindowManager::GetInstance()->GetPutInFrontSentinel());
if (mapWindow)
PortabilityLayer::WindowManager::GetInstance()->PutWindowBehind(mapWindow, PortabilityLayer::WindowManager::GetInstance()->GetPutInFrontSentinel());
KeepWindowInBounds(mainWindow);
KeepWindowInBounds(toolsWindow);
KeepWindowInBounds(mapWindow);
}
//-------------------------------------------------------------- HandleIdleTask
// Handle some processing during event lulls.
@@ -442,7 +492,12 @@ void HandleIdleTask (void)
{
if (theMode == kEditMode)
{
SetPort((GrafPtr)mainWindow);
if (thisMac.isResolutionDirty)
{
HandleEditorResolutionChange();
}
SetPort(&mainWindow->GetDrawSurface()->m_port);
DoMarquee();
if ((autoRoomEdit) && (newRoomNow))
@@ -452,6 +507,14 @@ void HandleIdleTask (void)
newRoomNow = false;
}
}
if (theMode == kSplashMode)
{
if (thisMac.isResolutionDirty)
{
HandleSplashResolutionChange();
}
}
}
//-------------------------------------------------------------- HandleEvent
@@ -515,28 +578,6 @@ void HandleEvent (void)
}
}
//-------------------------------------------------------------- HiliteAllWindows
// Ugly kludge in order to keep "floating windows" (palettes) on top of<6F>
// the main window.
void HiliteAllWindows (void)
{
PL_NotYetImplemented_TODO("DeleteMe");
#if 0
if (mainWindow != nil)
HiliteWindow(mainWindow, true);
if (mapWindow != nil)
HiliteWindow(mapWindow, true);
if (toolsWindow != nil)
HiliteWindow(toolsWindow, true);
if (coordWindow != nil)
HiliteWindow(coordWindow, true);
if (linkWindow != nil)
HiliteWindow(linkWindow, true);
#endif
}
//-------------------------------------------------------------- IgnoreThisClick
// Another inelegant kludge designed to temporarily prevent an unwanted<65>

View File

@@ -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);
@@ -161,12 +162,12 @@ void FillScreenRed (void);
void DumpToResEditFile (Ptr, long);
void HandleEvent (void); // --- Event.c
void HiliteAllWindows (void);
void IgnoreThisClick (void);
short WhatsOurDepth (void); // --- Environs.c
void SwitchToDepth (short, Boolean);
void CheckOurEnvirons (void);
void InstallResolutionHandler (void);
//void ReflectSecondMonitorEnvirons (Boolean, Boolean, Boolean);
void HandleDepthSwitching (void);
void RestoreColorDepth (void);

View File

@@ -102,10 +102,10 @@ void SetUpFinalScreen (void)
do
{
GetLineOfText(tempStr, count, subStr);
offset = ((thisMac.screen.right - thisMac.screen.left) -
surface->MeasureString(subStr)) / 2;
surface->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
offset = ((thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) -
surface->MeasureString(subStr)) / 2;
surface->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
const Point textShadowPos = Point::Create(offset + 1, textDown + 33 + (count * 20));
@@ -146,6 +146,12 @@ void DoGameOverStarAnimation (void)
long nextLoop;
short which, i, count, pass;
Boolean noInteruption;
short starFallSpeed = kStarFalls;
const int kStarSpacing = 32;
const int kAngelSpeed = 2;
const int kStarsReserved = 5;
const int kMaxFramesAlive = (kStarSpacing * kStarsReserved + kAngelSpeed - 1) / kAngelSpeed;
angelDest = angelSrcRect;
QOffsetRect(&angelDest, -96, 0);
@@ -154,14 +160,19 @@ void DoGameOverStarAnimation (void)
count = 0;
pass = 0;
FlushEvents(everyEvent, 0);
if (workSrcRect.bottom - angelDest.bottom > kMaxFramesAlive * starFallSpeed)
starFallSpeed = (workSrcRect.bottom - angelDest.bottom + kMaxFramesAlive - 1) / kMaxFramesAlive;
while (noInteruption)
{
if ((angelDest.left % 32) == 0) // add a star
if ((angelDest.left % kStarSpacing) == 0) // add a star
{
PlayPrioritySound(kMysticSound, kMysticPriority);
which = angelDest.left / 32;
which = which % 5;
which = angelDest.left / kStarSpacing;
which = which % kStarsReserved;
if (which < 0)
which += kStarsReserved;
ZeroRectCorner(&pages[which].dest);
QOffsetRect(&pages[which].dest, angelDest.left, angelDest.bottom);
if (count < (which + 1))
@@ -182,13 +193,13 @@ void DoGameOverStarAnimation (void)
&pages[i].dest);
pages[i].was = pages[i].dest;
pages[i].was.top -= kStarFalls;
pages[i].was.top -= starFallSpeed;
AddRectToWorkRectsWhole(&pages[i].was);
AddRectToBackRects(&pages[i].dest);
if (pages[i].dest.top < workSrcRect.bottom)
QOffsetRect(&pages[i].dest, 0, kStarFalls);
QOffsetRect(&pages[i].dest, 0, starFallSpeed);
}
if (angelDest.left <= (workSrcRect.right + 2))
@@ -197,11 +208,11 @@ void DoGameOverStarAnimation (void)
(BitMap *)*GetGWorldPixMap(angelMaskMap),
(BitMap *)*GetGWorldPixMap(workSrcMap),
&angelSrcRect, &angelSrcRect, &angelDest);
angelDest.left -= 2;
angelDest.left -= kAngelSpeed;
AddRectToWorkRectsWhole(&angelDest);
angelDest.left += 2;
angelDest.left += kAngelSpeed;
AddRectToBackRects(&angelDest);
QOffsetRect(&angelDest, 2, 0);
QOffsetRect(&angelDest, kAngelSpeed, 0);
pass = 0;
}
@@ -283,14 +294,14 @@ void InitDiedGameOver (void)
for (i = 0; i < 8; i++) // initialize dest page rects
{
QSetRect(&pages[i].dest, 0, 0, 32, 32);
CenterRectInRect(&pages[i].dest, &thisMac.screen);
QOffsetRect(&pages[i].dest, -thisMac.screen.left, -thisMac.screen.top);
CenterRectInRect(&pages[i].dest, &thisMac.constrainedScreen);
QOffsetRect(&pages[i].dest, -thisMac.constrainedScreen.left, -thisMac.constrainedScreen.top);
if (i < 4)
QOffsetRect(&pages[i].dest, -kPageSpacing * (4 - i), 0);
else
QOffsetRect(&pages[i].dest, kPageSpacing * (i - 3), 0);
QOffsetRect(&pages[i].dest, (thisMac.screen.right - thisMac.screen.left) / -2,
(thisMac.screen.right - thisMac.screen.left) / -2);
QOffsetRect(&pages[i].dest, (thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) / -2,
(thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) / -2);
if (pages[i].dest.left % 2 == 1)
QOffsetRect(&pages[i].dest, 1, 0);
pages[i].was = pages[i].dest;
@@ -306,7 +317,7 @@ void InitDiedGameOver (void)
}
pagesStuck = 0;
stopPages = ((thisMac.screen.bottom - thisMac.screen.top) / 2) - 16;
stopPages = ((thisMac.constrainedScreen.bottom - thisMac.constrainedScreen.top) / 2) - 16;
}
//-------------------------------------------------------------- HandlePages

View File

@@ -265,7 +265,7 @@
#define kMaxDynamicObs 18
#define kMaxMasterObjects 216 // kMaxRoomObs * 9
#define kMaxViewWidth 1536
#define kMaxViewHeight 1026
#define kMaxViewHeight (kTileHigh*3+20)
#define kSelectTool 0
@@ -510,8 +510,6 @@
#define kNoCeilingLimit -10
#define kNoFloorLimit 332
#define kScoreboardHigh 0
#define kScoreboardLow 1
#define kScoreboardTall 20
#define kHouseVersion 0x0200

View File

@@ -25,24 +25,26 @@ void ToggleCoordinateWindow (void);
void NilSavedMaps (void); // --- DynamicMaps.c
SInt16 BackUpToSavedMap (Rect *, SInt16, SInt16);
SInt16 ReBackUpSavedMap (Rect *, SInt16, SInt16);
SInt16 RemoveFromSavedMap(SInt16);
void RestoreFromSavedMap (SInt16, SInt16, Boolean);
void AddSparkle (Rect *);
void AddFlyingPoint (Rect *, SInt16, SInt16, SInt16);
void ReBackUpFlames (SInt16, SInt16);
Boolean ReBackUpFlames (SInt16, SInt16, SInt16, SInt16);
void AddCandleFlame (SInt16, SInt16, SInt16, SInt16);
void ReBackUpTikiFlames (SInt16, SInt16);
Boolean ReBackUpTikiFlames (SInt16, SInt16, SInt16, SInt16);
void AddTikiFlame (SInt16, SInt16, SInt16, SInt16);
void ReBackUpBBQCoals (SInt16, SInt16);
Boolean ReBackUpBBQCoals (SInt16, SInt16, SInt16, SInt16);
void AddBBQCoals (SInt16, SInt16, SInt16, SInt16);
void ReBackUpPendulum (SInt16, SInt16);
Boolean ReBackUpPendulum (SInt16, SInt16, SInt16, SInt16);
void AddPendulum (SInt16, SInt16, SInt16, SInt16);
void ReBackUpStar (SInt16, SInt16);
void ReBackUpStar (SInt16, SInt16, SInt16, SInt16);
void AddStar (SInt16, SInt16, SInt16, SInt16);
void StopPendulum (SInt16, SInt16);
void StopStar (SInt16, SInt16);
void AddAShreddedGlider (Rect *);
void RemoveShreds (void);
void ZeroFlamesAndTheLike (void);
void RemoveSavedMapsNotInRoom (SInt16);
void CheckDynamicCollision (SInt16, gliderPtr, Boolean); // --- Dynamics.c
Boolean DidBandHitDynamic (SInt16);
@@ -73,17 +75,21 @@ void HandleFish (SInt16);
void HandleDynamics (void); // --- Dynamics3.c
void RenderDynamics (void);
void ZeroDinahs (void);
SInt16 AddDynamicObject (SInt16, Rect *, objectType *, SInt16, SInt16, Boolean);
void ZeroDinahsNotInRoom (SInt16);
SInt16 AddDynamicObject(SInt16 what, Rect *where, objectType *who, SInt16 room, SInt16 index, Boolean isOn, Boolean keepExisting);
void DoGameOver (void); // --- GameOver.c
void FlagGameOver (void);
void DoDiedGameOver (void);
void HandleGrease (void); // --- Grease.c
SInt16 ReBackUpGrease (SInt16, SInt16);
SInt16 ReBackUpGrease (SInt16 where, SInt16 who, SInt16 h, SInt16 v);
SInt16 AddGrease (SInt16, SInt16, SInt16, SInt16, SInt16, Boolean);
void SpillGrease (SInt16, SInt16);
void RedrawAllGrease (void);
void FixupFallenGrease(SInt16 where, SInt16 who, SInt16 h, SInt16 v, Boolean *isDynamic);
void RemapGreaseSavedMap(SInt16 removedItem, SInt16 substituteItem);
void DoHighScores (void); // --- HighScores.c
void SortHighScores (void);
@@ -132,6 +138,7 @@ void FlagStillOvers (gliderPtr);
void InitializeMenus (void); // --- InterfaceInit.c
void GetExtraCursors (void);
void RecomputeInterfaceRects (void);
void VariableInit (void);
void GetDemoInput (gliderPtr); // --- Input.c
@@ -147,7 +154,6 @@ void HandleLinkClick (Point);
void RedrawSplashScreen (void); // --- MainWindow.c
void UpdateMainWindow (void);
void UpdateMenuBarWindow (DrawSurface *surface);
void OpenMainWindow (void);
void CloseMainWindow (void);
void ZoomBetweenWindows (void);
@@ -173,10 +179,10 @@ void StartMarqueeHandled (Rect *, SInt16, SInt16);
void StopMarquee (void);
void PauseMarquee (void);
void ResumeMarquee (void);
void DragOutMarqueeRect (Point, Rect *);
void DragMarqueeRect (DrawSurface *, Point, Rect *, Boolean, Boolean);
void DragMarqueeHandle (DrawSurface *, Point, SInt16 *);
void DragMarqueeCorner (DrawSurface *, Point, SInt16 *, SInt16 *, Boolean);
void DragOutMarqueeRect (Window *, Point, Rect *);
void DragMarqueeRect (Window *, DrawSurface *, Point, Rect *, Boolean, Boolean);
void DragMarqueeHandle (Window *, DrawSurface *, Point, SInt16 *);
void DragMarqueeCorner (Window *, DrawSurface *, Point, SInt16 *, SInt16 *, Boolean);
Boolean MarqueeHasHandles (SInt16 *, SInt16 *);
Boolean PtInMarqueeHandle (Point);
void SetMarqueeGliderRect (SInt16, SInt16);
@@ -257,8 +263,8 @@ void DrawBlueClock (Rect *);
void DrawYellowClock (Rect *);
void DrawCuckoo (Rect *);
void DrawSimplePrizes (SInt16, Rect *);
void DrawGreaseRt (Rect *, SInt16, Boolean);
void DrawGreaseLf (Rect *, SInt16, Boolean);
void DrawGreaseRt (Rect *, SInt16, Boolean, Boolean);
void DrawGreaseLf (Rect *, SInt16, Boolean, Boolean);
void DrawFoil (Rect *);
void DrawInvisBonus (Rect *);
void DrawSlider (Rect *);
@@ -306,7 +312,7 @@ void DrawCustPictSansWhite (SInt16, Rect *);
void DrawARoomsObjects (SInt16, Boolean); // --- ObjectDrawAll.c
void DoSelectionClick (DrawSurface *, Point, Boolean); // --- ObjectEdit.c
void DoSelectionClick (Window *, DrawSurface *, Point, Boolean); // --- ObjectEdit.c
void DoNewObjectClick (Point);
void DeleteObject (void);
void DuplicateObject (void);
@@ -407,7 +413,8 @@ Boolean DoesRoomHaveFloor (void);
Boolean DoesRoomHaveCeiling (void);
void ReadyLevel (void); // --- RoomGraphics.c
void DrawLocale (void);
void ResetLocale (Boolean soft);
void DrawLocale (Boolean soft);
void RedrawRoomLighting (void);
Boolean PictIDExists (SInt16); // --- RoomInfo.c
@@ -428,8 +435,6 @@ void QuickBatteryRefresh (Boolean);
void QuickBandsRefresh (Boolean);
void QuickFoilRefresh (Boolean);
void HandleScore (void);
void AdjustScoreboardHeight (void);
void BlackenScoreboard (DrawSurface *);
//void PutRoomScrap (void); // --- Scrap.c
//void PutObjectScrap (void);
@@ -470,6 +475,7 @@ void InitEnemies (void);
void CreateOffscreens (void); // --- StructuresInit2.c
void CreatePointers (void);
void InitSrcRects (void);
PLError_t RecreateOffscreens (void);
void UpdateToolsWindow (void); // --- Tools.c
void EraseSelectedTool (void);

View File

@@ -39,7 +39,7 @@ extern Rect clutterSrcRect;
extern Rect flowerSrc[];
extern Rect *srcRects;
extern Movie theMovie;
extern AnimationPlayer theMovie;
extern Rect movieRect;
extern Boolean hasMovie, tvInRoom;

View File

@@ -25,6 +25,7 @@ public:
void PL_HostFontHandler_SetInstance(PortabilityLayer::HostFontHandler *instance) override;
void PL_HostVOSEventQueue_SetInstance(PortabilityLayer::HostVOSEventQueue *instance) override;
void PL_InstallHostSuspendHook(PortabilityLayer::HostSuspendHook_t hook, void *context) override;
bool PL_AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY) override;
};
@@ -79,6 +80,19 @@ void GpAppInterfaceImpl::PL_InstallHostSuspendHook(PortabilityLayer::HostSuspend
PortabilityLayer::InstallHostSuspendHook(hook, context);
}
bool GpAppInterfaceImpl::PL_AdjustRequestedResolution(uint32_t &physicalWidth, uint32_t &physicalHeight, uint32_t &virtualWidth, uint32_t &virtualheight, float &pixelScaleX, float &pixelScaleY)
{
PortabilityLayer::DisplayDeviceManager::IResolutionChangeHandler *handler = PortabilityLayer::DisplayDeviceManager::GetInstance()->GetResolutionChangeHandler();
if (!handler)
return false;
handler->AdjustRequestedResolution(physicalWidth, physicalHeight, virtualWidth, virtualheight, pixelScaleX, pixelScaleY);
return true;
}
static GpAppInterfaceImpl gs_application;

View File

@@ -28,8 +28,7 @@ short numGrease;
extern hotPtr hotSpots;
extern savedType savedMaps[];
extern Point shieldPt;
extern Rect greaseSrcRt[], greaseSrcLf[], shieldRect;
extern Rect greaseSrcRt[], greaseSrcLf[];
//============================================================== Functions
@@ -168,7 +167,7 @@ void BackupGrease (Rect *src, short index, Boolean isRight)
// off or on the lights). It assumes certain data strucutures are<72>
// already declared from an earlier call to the above funciton.
short ReBackUpGrease (short where, short who)
short ReBackUpGrease (short where, short who, short h, short v)
{
Rect src;
short i;
@@ -179,6 +178,13 @@ short ReBackUpGrease (short where, short who)
{
if ((grease[i].mode == kGreaseIdle) || (grease[i].mode == kGreaseFalling))
{
greasePtr greaseItem = &grease[i];
const short hDelta = h - grease[i].dest.left;
const short vDelta = v - grease[i].dest.top;
QOffsetRect(&greaseItem->dest, hDelta, vDelta);
greaseItem->start += hDelta;
greaseItem->stop += hDelta;
src = grease[i].dest;
BackupGrease(&src, grease[i].mapNum, grease[i].isRight);
}
@@ -269,10 +275,12 @@ void RedrawAllGrease (void)
for (i = 0; i < numGrease; i++)
{
if (grease[i].mode == kGreaseIdle)
continue;
src = hotSpots[grease[i].hotNum].bounds;
if ((grease[i].where == thisRoomNumber) &&
((src.bottom - src.top) == 2) &&
(grease[i].mode != kGreaseIdle))
((src.bottom - src.top) == 2))
{
QOffsetRect(&src, playOriginH, playOriginV);
@@ -288,3 +296,41 @@ void RedrawAllGrease (void)
}
}
void FixupFallenGrease(SInt16 where, SInt16 who, SInt16 h, SInt16 v, Boolean *isDynamic)
{
short i;
for (i = 0; i < numGrease; i++)
{
greasePtr greaseItem = grease + i;
if ((greaseItem->where == where) && (greaseItem->who == who))
{
short hDelta = h - greaseItem->dest.left;
short vDelta = v - greaseItem->dest.top;
QOffsetRect(&greaseItem->dest, hDelta, vDelta);
greaseItem->start += hDelta;
greaseItem->stop += hDelta;
if (greaseItem->mode != kGreaseIdle)
{
hotPtr hotSpot = &hotSpots[greaseItem->hotNum];
//QOffsetRect(&hotSpot->bounds, hDelta, vDelta);
}
*isDynamic = true;
return;
}
}
*isDynamic = false;
}
void RemapGreaseSavedMap(SInt16 removedItem, SInt16 substituteItem)
{
for (int i = 0; i < numGrease; i++)
{
if (grease[i].mapNum == substituteItem)
{
grease[i].mapNum = removedItem;
return;
}
}
}

View File

@@ -23,6 +23,7 @@
#include "IOStream.h"
#include "MainWindow.h"
#include "RectUtils.h"
#include "PLStandardColors.h"
#include "PLTimeTaggedVOSEvent.h"
#include "Utilities.h"
@@ -69,7 +70,8 @@ void DoHighScores (void)
Rect tempRect;
SpinCursor(3);
SetPort((GrafPtr)workSrcMap);
SetPort(&workSrcMap->m_port);
workSrcMap->SetForeColor(StdColors::Black());
workSrcMap->FillRect(workSrcRect);
QSetRect(&tempRect, 0, 0, 640, 480);
QOffsetRect(&tempRect, splashOriginH, splashOriginV);
@@ -123,7 +125,7 @@ void DrawHighScores (DrawSurface *surface)
PortabilityLayer::RGBAColor whiteColor = PortabilityLayer::RGBAColor::Create(255, 255, 255, 255);
PortabilityLayer::RGBAColor blueColor = PortabilityLayer::RGBAColor::Create(0, 0, 255, 255);
scoreLeft = ((thisMac.screen.right - thisMac.screen.left) - kScoreWide) / 2;
scoreLeft = ((thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) - kScoreWide) / 2;
dropIt = 129 + splashOriginV;
QSetRect(&tempRect, 0, 0, 332, 30);

View File

@@ -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,9 @@
void UpdateGoToDialog (Dialog *);
Boolean GoToFilter (Dialog *, EventRecord *, short *);
int16_t GoToFilter (Dialog *dial, const TimeTaggedVOSEvent *evt);
extern PortabilityLayer::ResourceArchive *houseResFork;
houseHand thisHouse;
@@ -241,11 +244,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
@@ -596,7 +595,6 @@ void GenerateRetroLinks (void)
void UpdateGoToDialog (Dialog *theDialog)
{
DrawDialog(theDialog);
DrawDefaultButton(theDialog);
FrameDialogItemC(theDialog, 10, kRedOrangeColor8);
}
@@ -604,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
@@ -666,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)
{

View File

@@ -11,6 +11,7 @@
#include "PLStringCompare.h"
#include "PLTextUtils.h"
#include "PLPasStr.h"
#include "BitmapImage.h"
#include "DialogManager.h"
#include "Externs.h"
#include "Environ.h"
@@ -34,7 +35,7 @@ void CloseHouseMovie (void);
Boolean IsFileReadOnly (const VFileSpec &);
Movie theMovie;
AnimationPlayer theMovie;
Rect movieRect;
PortabilityLayer::ResourceArchive *houseResFork;
short wasHouseVersion;
@@ -52,31 +53,12 @@ extern Boolean phoneBitSet, bannerStarCountOn;
//============================================================== Functions
//-------------------------------------------------------------- LoopMovie
void LoopMovie (void)
{
THandle<long> theLoop;
UserData theUserData;
short theCount;
theLoop = NewHandle(sizeof(long)).StaticCast<long>();
(**theLoop) = 0;
theUserData = GetMovieUserData(theMovie);
theCount = CountUserDataType(theUserData, 'LOOP');
while (theCount--)
{
RemoveUserData(theUserData, 'LOOP', 1);
}
AddUserData(theUserData, theLoop.StaticCast<void>(), 'LOOP');
}
//-------------------------------------------------------------- OpenHouseMovie
void OpenHouseMovie (void)
{
#ifdef COMPILEQT
TimeBase theTime;
VFileSpec theSpec;
VFileInfo finderInfo;
Handle spaceSaver;
@@ -92,60 +74,24 @@ void OpenHouseMovie (void)
theErr = FSpGetFInfo(theSpec, finderInfo);
if (theErr != PLErrors::kNone)
return;
theErr = OpenMovieFile(theSpec, &movieRefNum, 0);
if (theErr != PLErrors::kNone)
AnimationPackage *anim = AnimationPackage::Create();
if (!anim)
return;
if (!anim->Load(theSpec.m_dir, theSpec.m_name))
{
anim->Destroy();
YellowAlert(kYellowQTMovieNotLoaded, theErr);
return;
}
theErr = NewMovieFromFile(&theMovie, movieRefNum, nil, theSpec.m_name,
newMovieActive, &dataRefWasChanged);
if (theErr != PLErrors::kNone)
{
YellowAlert(kYellowQTMovieNotLoaded, theErr);
theErr = CloseMovieFile(movieRefNum);
return;
}
theErr = CloseMovieFile(movieRefNum);
spaceSaver = NewHandle(307200L);
if (spaceSaver == nil)
{
YellowAlert(kYellowQTMovieNotLoaded, 749);
CloseHouseMovie();
return;
}
GoToBeginningOfMovie(theMovie);
theErr = LoadMovieIntoRam(theMovie,
GetMovieTime(theMovie, 0L), GetMovieDuration(theMovie), 0);
if (theErr != PLErrors::kNone)
{
YellowAlert(kYellowQTMovieNotLoaded, theErr);
spaceSaver.Dispose();
CloseHouseMovie();
return;
}
spaceSaver.Dispose();
theErr = PrerollMovie(theMovie, 0, 0x000F0000);
if (theErr != PLErrors::kNone)
{
YellowAlert(kYellowQTMovieNotLoaded, theErr);
CloseHouseMovie();
return;
}
theTime = GetMovieTimeBase(theMovie);
SetTimeBaseFlags(theTime, loopTimeBase);
SetMovieMasterTimeBase(theMovie, theTime, nil);
LoopMovie();
GetMovieBox(theMovie, &movieRect);
movieRect = (*anim->GetFrame(0))->GetRect();
hasMovie = true;
theMovie.SetPackage(anim);
AnimationManager::GetInstance()->RegisterPlayer(&theMovie);
}
#endif
}
@@ -159,9 +105,10 @@ void CloseHouseMovie (void)
if ((thisMac.hasQT) && (hasMovie))
{
theErr = LoadMovieIntoRam(theMovie,
GetMovieTime(theMovie, 0L), GetMovieDuration(theMovie), flushFromRam);
DisposeMovie(theMovie);
AnimationManager::GetInstance()->RemovePlayer(&theMovie);
theMovie.m_animPackage->Destroy();
theMovie.m_animPackage = nullptr;
}
#endif
hasMovie = false;
@@ -195,8 +142,10 @@ Boolean OpenHouse (void)
houseOpen = true;
OpenHouseResFork();
hasMovie = false;
if (hasMovie)
CloseHouseMovie();
tvInRoom = false;
tvWithMovieNumber = -1;
OpenHouseMovie();

View File

@@ -12,6 +12,11 @@
#include "Externs.h"
#include "DialogManager.h"
#include "DialogUtils.h"
#include "HostDisplayDriver.h"
#include "IGpDisplayDriver.h"
#include "PLArrayView.h"
#include "PLEditboxWidget.h"
#include "PLTimeTaggedVOSEvent.h"
#define kHouseInfoDialogID 1001
@@ -29,7 +34,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);
@@ -107,7 +112,6 @@ void UpdateHouseInfoDialog (Dialog *theDialog)
{
short nChars;
DrawDialog(theDialog);
nChars = GetDialogStringLen(theDialog, kBannerTextItem);
SetDialogNumToStr(theDialog, kBannerNCharsItem, (long)nChars);
nChars = GetDialogStringLen(theDialog, kTrailerTextItem);
@@ -119,7 +123,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;
@@ -132,70 +136,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 ((PtInRect(mouseIs, &houseEditText1)) ||
(PtInRect(mouseIs, &houseEditText2)))
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)
{
SetBuiltinCursor(iBeamCursor);
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
@@ -231,9 +231,12 @@ 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());
static_cast<PortabilityLayer::EditboxWidget*>(houseInfoDialog->GetItems()[kBannerTextItem - 1].GetWidget())->SetMultiLine(true);
static_cast<PortabilityLayer::EditboxWidget*>(houseInfoDialog->GetItems()[kTrailerTextItem - 1].GetWidget())->SetMultiLine(true);
SetDialogString(houseInfoDialog, kBannerTextItem, banner);
SetDialogString(houseInfoDialog, kTrailerTextItem, trailer);
SelectDialogItemText(houseInfoDialog, kBannerTextItem, 0, 1024);
@@ -241,10 +244,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)
{

View File

@@ -648,8 +648,8 @@ void CheckDuplicateFloorSuite (void)
{
bitPlace = (((*thisHouse)->rooms[i].floor + 7) * 128) +
(*thisHouse)->rooms[i].suite;
if ((bitPlace < 0) || (bitPlace >= 8192))
DebugStr(PSTR("Blew array"));
//if ((bitPlace < 0) || (bitPlace >= 8192))
// DebugStr(PSTR("Blew array"));
if (pidgeonHoles[bitPlace] != 0)
{
houseErrors++;

View File

@@ -12,6 +12,7 @@
#include "Externs.h"
#include "InputManager.h"
#include "MainWindow.h"
#include "QDPixMap.h"
#include "RectUtils.h"

View File

@@ -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,17 +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 Rect boardSrcRect, localRoomsDest[];
extern IGpCursor *handCursor, *vertCursor, *horiCursor;
extern IGpCursor *diagCursor;
extern MenuHandle appleMenu, gameMenu, optionsMenu, houseMenu;
extern Point shieldPt;
extern long incrementModeTime;
extern UInt32 doubleTime;
extern short fadeInSequence[], idleMode;
@@ -81,25 +80,55 @@ 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;
}
//-------------------------------------------------------------- RecomputeScreenRects
void RecomputeInterfaceRects (void)
{
houseRect = thisMac.constrainedScreen;
houseRect.bottom -= kScoreboardTall;
if (houseRect.right > kMaxViewWidth)
houseRect.right = kMaxViewWidth;
if (houseRect.bottom > kMaxViewHeight)
houseRect.bottom = kMaxViewHeight;
// NOTE: This is actually buggy, since the visible area is houseRect, not screen.
// We preserve the buggy behavior for authenticity unless the window is very tall.
short poHeight = RectTall(&thisMac.constrainedScreen);
if (poHeight > kMaxViewHeight - kScoreboardTall)
poHeight = kMaxViewHeight - kScoreboardTall;
playOriginH = (RectWide(&thisMac.constrainedScreen) - kRoomWide) / 2;
playOriginV = (poHeight - kTileHigh) / 2;
for (int i = 0; i < 9; i++)
{
QSetRect(&localRoomsDest[i], 0, 0, kRoomWide, kTileHigh);
QOffsetRect(&localRoomsDest[i], playOriginH, playOriginV);
}
QOffsetRect(&localRoomsDest[kNorthRoom], 0, -kVertLocalOffset);
QOffsetRect(&localRoomsDest[kNorthEastRoom], kRoomWide, -kVertLocalOffset);
QOffsetRect(&localRoomsDest[kEastRoom], kRoomWide, 0);
QOffsetRect(&localRoomsDest[kSouthEastRoom], kRoomWide, kVertLocalOffset);
QOffsetRect(&localRoomsDest[kSouthRoom], 0, kVertLocalOffset);
QOffsetRect(&localRoomsDest[kSouthWestRoom], -kRoomWide, kVertLocalOffset);
QOffsetRect(&localRoomsDest[kWestRoom], -kRoomWide, 0);
QOffsetRect(&localRoomsDest[kNorthWestRoom], -kRoomWide, -kVertLocalOffset);
}
//-------------------------------------------------------------- VariableInit
@@ -111,10 +140,6 @@ void VariableInit (void)
{
short i;
shieldPt.h = 0;
shieldPt.v = 0;
shieldRect = thisMac.screen;
menusUp = false;
quitting = false;
houseOpen = false;
@@ -176,7 +201,7 @@ void VariableInit (void)
fadeInSequence[14] = 9;
fadeInSequence[15] = 10;
doubleTime = GetDblTime();
doubleTime = 30; // PL_NotYetImplemented_TODO: Get this from the system settings
mirrorRects = nil;
mainWindow = nil;
@@ -187,30 +212,6 @@ void VariableInit (void)
coordWindow = nil;
toolSrcMap = nil;
nailSrcMap = nil;
menuWindow = nil;
houseRect = thisMac.screen;
houseRect.bottom -= kScoreboardTall;
if (houseRect.right > kMaxViewWidth)
houseRect.right = kMaxViewWidth;
if (houseRect.bottom > kMaxViewHeight)
houseRect.bottom = kMaxViewHeight;
playOriginH = (RectWide(&thisMac.screen) - kRoomWide) / 2;
playOriginV = (RectTall(&thisMac.screen) - kTileHigh) / 2;
for (i = 0; i < 9; i++)
{
QSetRect(&localRoomsDest[i], 0, 0, kRoomWide, kTileHigh);
QOffsetRect(&localRoomsDest[i], playOriginH, playOriginV);
}
QOffsetRect(&localRoomsDest[kNorthRoom], 0, -kVertLocalOffset);
QOffsetRect(&localRoomsDest[kNorthEastRoom], kRoomWide, -kVertLocalOffset);
QOffsetRect(&localRoomsDest[kEastRoom], kRoomWide, 0);
QOffsetRect(&localRoomsDest[kSouthEastRoom], kRoomWide, kVertLocalOffset);
QOffsetRect(&localRoomsDest[kSouthRoom], 0, kVertLocalOffset);
QOffsetRect(&localRoomsDest[kSouthWestRoom], -kRoomWide, kVertLocalOffset);
QOffsetRect(&localRoomsDest[kWestRoom], -kRoomWide, 0);
QOffsetRect(&localRoomsDest[kNorthWestRoom], -kRoomWide, -kVertLocalOffset);
RecomputeInterfaceRects();
}

View File

@@ -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;
@@ -206,7 +206,6 @@ void UpdateLinkWindow (void)
return;
SetPortWindowPort(linkWindow);
DrawControls(linkWindow);
UpdateLinkControl();
#endif
}
@@ -218,26 +217,27 @@ 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;
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);
else
linkWindow = NewWindow(nil, &linkWindowRect,
PSTR("Link"), false, windowStyle, kPutInFront, true, 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();
PortabilityLayer::WidgetBasicState basicState;
basicState.m_rect = Rect::Create(5, 70, 25, 124);
@@ -250,11 +250,15 @@ void OpenLinkWindow (void)
basicState.m_text.Set(6, "Unlink");
basicState.m_window = linkWindow;
unlinkControl = PortabilityLayer::ButtonWidget::Create(basicState);
linkWindow->DrawControls();
linkRoom = -1;
linkObject = 255;
isLinkOpen = true;
UpdateLinkWindow();
}
#endif
}
@@ -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)

View File

@@ -204,7 +204,7 @@ void ReadInPrefs (void)
doBitchDialogs = true;
}
if ((numNeighbors > 1) && (thisMac.screen.right <= 512))
if ((numNeighbors > 1) && (thisMac.constrainedScreen.right <= 512))
numNeighbors = 1;
UnivGetSoundVolume(&wasVolume, thisMac.hasSM3);
@@ -315,6 +315,7 @@ int gpAppMain()
ToolBoxInit();
CheckOurEnvirons();
InstallResolutionHandler();
if (!thisMac.hasColor)
RedAlert(kErrNeedColorQD);
if (!thisMac.hasSystem7)
@@ -351,14 +352,6 @@ int gpAppMain()
InitSrcRects();
CreateOffscreens(); SpinCursor(2);
OpenMainWindow();
if (thisMac.hasQT)
{
theErr = EnterMovies();
if (theErr != PLErrors::kNone)
thisMac.hasQT = false;
}
InitSound(); SpinCursor(2);
InitMusic(); SpinCursor(2);
BuildHouseList();

View File

@@ -11,9 +11,12 @@
#include "Externs.h"
#include "Environ.h"
#include "FontFamily.h"
#include "HostDisplayDriver.h"
#include "House.h"
#include "IGpDisplayDriver.h"
#include "InputManager.h"
#include "MenuManager.h"
#include "QDPixMap.h"
#include "RectUtils.h"
#include "PLKeyEncoding.h"
#include "PLStandardColors.h"
@@ -29,20 +32,18 @@
void DrawOnSplash (DrawSurface *surface);
void SetPaletteToGrays (void);
void HardDrawMainWindow (void);
void KeepWindowInBounds(Window *window);
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;
WindowPtr mainWindow, menuWindow, boardWindow;
WindowPtr mainWindow, boardWindow;
short isEditH, isEditV;
short playOriginH, playOriginV;
short splashOriginH, splashOriginV;
@@ -66,7 +67,7 @@ void DrawOnSplash(DrawSurface *surface)
PasStringCopy(PSTR("House: "), houseLoadedStr);
PasStringConcat(houseLoadedStr, thisHouseName);
if ((thisMac.hasQT) && (hasMovie))
PasStringConcat(houseLoadedStr, PSTR(" (QT)"));
PasStringConcat(houseLoadedStr, PSTR(" (TV)"));
surface->SetApplicationFont(9, PortabilityLayer::FontFamilyFlag_Bold);
@@ -166,22 +167,6 @@ void UpdateMainWindow (void)
splashDrawn = true;
}
//-------------------------------------------------------------- UpdateMenuBarWindow
// Ugly kludge to cover over the menu bar when playing game on 2nd monitor.
void UpdateMenuBarWindow (DrawSurface *surface)
{
Rect bounds;
if (menuWindow == nil)
return;
GetLocalWindowRect(menuWindow, &bounds);
surface->SetForeColor(StdColors::Black());
surface->FillRect(bounds);
}
//-------------------------------------------------------------- OpenMainWindow
// Opens up the main window (how it does this depends on mode were in).
@@ -198,10 +183,8 @@ void OpenMainWindow (void)
if (theMode == kEditMode)
{
if (menuWindow != nil)
PortabilityLayer::WindowManager::GetInstance()->DestroyWindow(menuWindow);
menuWindow = nil;
PortabilityLayer::HostDisplayDriver::GetInstance()->SetBackgroundColor(51, 51, 102, 255);
QSetRect(&mainWindowRect, 0, 0, 512, 322);
mainWindow = GetNewCWindow(kEditWindowID, nil, kPutInFront);
SizeWindow(mainWindow, mainWindowRect.right,
@@ -209,8 +192,8 @@ void OpenMainWindow (void)
if (OptionKeyDown())
{
isEditH = 3;
isEditV = 41;
isEditH = 10;
isEditV = 46;
}
MoveWindow(mainWindow, isEditH, isEditV, true);
ShowWindow(mainWindow);
@@ -224,39 +207,43 @@ void OpenMainWindow (void)
whichRoom = GetFirstRoomNumber();
CopyRoomToThisRoom(whichRoom);
ReflectCurrentRoom(false);
KeepWindowInBounds(mainWindow);
}
else
{
if (menuWindow == nil)
{
menuWindow = GetNewCWindow(kMenuWindowID, nil, kPutInFront);
SizeWindow(menuWindow, RectWide(&thisMac.screen), 20, false);
MoveWindow(menuWindow, thisMac.screen.left,
thisMac.screen.top, true);
ShowWindow(menuWindow);
}
#ifdef NDEBUG
PortabilityLayer::HostDisplayDriver::GetInstance()->SetBackgroundColor(0, 0, 0, 255);
#else
PortabilityLayer::HostDisplayDriver::GetInstance()->SetBackgroundColor(51, 0, 0, 255);
#endif
if (boardWindow == nil)
{
PortabilityLayer::WindowManager *windowManager = PortabilityLayer::WindowManager::GetInstance();
Rect scorebarRect = thisMac.screen;
Rect scorebarRect = thisMac.constrainedScreen;
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());
else
PL_NotYetImplemented_TODO("Errors");
}
mainWindowRect = thisMac.screen;
mainWindowRect = thisMac.constrainedScreen;
ZeroRectCorner(&mainWindowRect);
mainWindowRect.bottom -= 20; // thisMac.menuHigh
mainWindowRect.bottom -= kScoreboardTall; // thisMac.menuHigh
mainWindow = GetNewCWindow(kMainWindowID, nil, kPutInFront);
SizeWindow(mainWindow, mainWindowRect.right - mainWindowRect.left,
mainWindowRect.bottom - mainWindowRect.top, false);
MoveWindow(mainWindow, thisMac.screen.left,
thisMac.screen.top + 20, true); // thisMac.menuHigh
const short mainWindowLeft = (thisMac.fullScreen.left + thisMac.fullScreen.right + thisMac.constrainedScreen.left - thisMac.constrainedScreen.right) / 2;
const short mainWindowTop = (thisMac.fullScreen.top + thisMac.fullScreen.bottom + thisMac.constrainedScreen.top - thisMac.constrainedScreen.bottom) / 2 + kScoreboardTall;
MoveWindow(boardWindow, mainWindowLeft, 0, true);
MoveWindow(mainWindow, mainWindowLeft, mainWindowTop, true); // thisMac.menuHigh
ShowWindow(mainWindow);
SetPortWindowPort(mainWindow);
@@ -268,15 +255,14 @@ void OpenMainWindow (void)
mainWindowSurface->SetBackColor(StdColors::White());
mainWindowSurface->FillRect(mainWindowRect);
splashOriginH = ((thisMac.screen.right - thisMac.screen.left) - 640) / 2;
splashOriginH = ((thisMac.constrainedScreen.right - thisMac.constrainedScreen.left) - 640) / 2;
if (splashOriginH < 0)
splashOriginH = 0;
splashOriginV = ((thisMac.screen.bottom - thisMac.screen.top) - 480) / 2;
splashOriginV = ((thisMac.constrainedScreen.bottom - thisMac.constrainedScreen.top) - 480) / 2;
if (splashOriginV < 0)
splashOriginV = 0;
workSrcMap->FillRect(workSrcRect);
LoadGraphic(workSrcMap, kSplash8BitPICT);
// if ((fadeGraysOut) && (isDoColorFade))
// {
@@ -289,6 +275,7 @@ void OpenMainWindow (void)
// }
SetPortWindowPort(mainWindow);
UpdateMainWindow();
}
CopyBits((BitMap *)*GetGWorldPixMap(workSrcMap),
@@ -369,7 +356,8 @@ void UpdateEditWindowTitle (void)
}
else
PasStringConcat(newTitle, PSTR("House Locked"));
SetWTitle(mainWindow, newTitle);
PortabilityLayer::WindowManager::GetInstance()->SetWindowTitle(mainWindow, newTitle);
}
#endif
@@ -390,7 +378,7 @@ void HandleMainClick (Point wherePt, Boolean isDoubleClick)
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
if (toolSelected == kSelectTool)
DoSelectionClick(mainWindowSurface, wherePt, isDoubleClick);
DoSelectionClick(mainWindow, mainWindowSurface, wherePt, isDoubleClick);
else
DoNewObjectClick(wherePt);

View File

@@ -17,6 +17,7 @@
#include "PLWidgets.h"
#include "WindowDef.h"
#include "WindowManager.h"
#include "QDPixMap.h"
#include "RectUtils.h"
#include "Utilities.h"
@@ -39,6 +40,7 @@ void LiveVScrollAction (ControlHandle, short);
Boolean QueryNewRoom (void);
void CreateNailOffscreen (void);
void KillNailOffscreen (void);
void KeepWindowInBounds (Window *window);
Rect nailSrcRect, activeRoomRect, wasActiveRoomRect;
Rect mapHScrollRect, mapVScrollRect, mapCenterRect;
@@ -111,8 +113,7 @@ void FlagMapRoomsForUpdate (void)
return;
// SetPortWindowPort(mapWindow);
InvalWindowRect(mapWindow, &wasActiveRoomRect);
InvalWindowRect(mapWindow, &activeRoomRect);
UpdateMapWindow();
}
#endif
@@ -248,13 +249,16 @@ void RedrawMapContents (void)
}
else
{
surface->SetForeColor(StdColors::White());
surface->FillRect(aRoom);
if (i >= groundLevel)
surface->SetForeColor(StdColors::Green());
else
surface->SetForeColor(StdColors::Blue());
Pattern dummyPat;
surface->FillRectWithPattern8x8(aRoom, *GetQDGlobalsGray(&dummyPat));
surface->FillRectWithPattern8x8(aRoom, true, *GetQDGlobalsGray(&dummyPat));
}
}
}
@@ -327,24 +331,24 @@ void ResizeMapWindow (short newH, short newV)
if (mapRoomsHigh < 3)
mapRoomsHigh = 3;
QSetRect(&mapWindowRect, 0, 0,
mapRoomsWide * kMapRoomWidth + kMapScrollBarWidth - 2,
mapRoomsHigh * kMapRoomHeight + kMapScrollBarWidth - 2);
mapRoomsWide * kMapRoomWidth + kMapScrollBarWidth - 1,
mapRoomsHigh * kMapRoomHeight + kMapScrollBarWidth - 1);
surface->SetForeColor(StdColors::White());
surface->FillRect(mapWindowRect);
SizeWindow(mapWindow, mapWindowRect.right, mapWindowRect.bottom, true);
mapHScroll->SetMax(kMaxNumRoomsH - mapRoomsWide);
mapHScroll->SetPosition(Point::Create(0, mapWindowRect.bottom - kMapScrollBarWidth + 2));
mapHScroll->SetPosition(Point::Create(0, mapWindowRect.bottom - kMapScrollBarWidth + 1));
mapHScroll->Resize(mapWindowRect.right - kMapScrollBarWidth + 3, kMapScrollBarWidth);
mapLeftRoom = mapHScroll->GetState();
mapVScroll->SetMax(kMaxNumRoomsV - mapRoomsHigh);
mapVScroll->SetPosition(Point::Create(mapWindowRect.right - kMapScrollBarWidth + 2, 0));
mapVScroll->SetPosition(Point::Create(mapWindowRect.right - kMapScrollBarWidth + 1, 0));
mapVScroll->Resize(kMapScrollBarWidth, mapWindowRect.bottom - kMapScrollBarWidth + 3);
mapTopRoom = mapVScroll->GetState();
InvalWindowRect(mapWindow, &mapWindowRect);
UpdateMapWindow();
#endif
}
@@ -359,12 +363,12 @@ void OpenMapWindow (void)
{
CreateNailOffscreen();
QSetRect(&mapWindowRect, 0, 0,
mapRoomsWide * kMapRoomWidth + kMapScrollBarWidth - 2,
mapRoomsHigh * kMapRoomHeight + kMapScrollBarWidth - 2);
mapRoomsWide * kMapRoomWidth + kMapScrollBarWidth - 1,
mapRoomsHigh * kMapRoomHeight + kMapScrollBarWidth - 1);
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 +390,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 +429,10 @@ void OpenMapWindow (void)
mapWindowRect.bottom + 2);
CenterMapOnRoom(thisRoom->suite, thisRoom->floor);
UpdateMapWindow();
KeepWindowInBounds(mapWindow);
}
UpdateMapCheckmark(true);
@@ -462,50 +470,50 @@ void ToggleMapWindow (void)
//-------------------------------------------------------------- LiveHScrollAction
#ifndef COMPILEDEMO
void LiveHScrollAction (ControlHandle theControl, short thePart)
void LiveHScrollAction (PortabilityLayer::Widget *theControl, int thePart)
{
short wasValue, newValue;
switch (thePart)
{
case kControlUpButtonPart:
wasValue = GetControlValue(theControl);
SetControlValue(theControl, wasValue - 1);
if (GetControlValue(theControl) != wasValue)
wasValue = theControl->GetState();
theControl->SetState(wasValue - 1);
if (theControl->GetState() != wasValue)
{
mapLeftRoom = GetControlValue(theControl);
mapLeftRoom = theControl->GetState();
RedrawMapContents();
}
break;
case kControlDownButtonPart:
wasValue = GetControlValue(theControl);
SetControlValue(theControl, wasValue + 1);
if (GetControlValue(theControl) != wasValue)
wasValue = theControl->GetState();
theControl->SetState(wasValue + 1);
if (theControl->GetState() != wasValue)
{
mapLeftRoom = GetControlValue(theControl);
mapLeftRoom = theControl->GetState();
RedrawMapContents();
}
break;
case kControlPageUpPart:
wasValue = GetControlValue(theControl);
wasValue = theControl->GetState();
newValue = wasValue - (mapRoomsWide / 2);
SetControlValue(theControl, newValue);
if (GetControlValue(theControl) != wasValue)
theControl->SetState(newValue);
if (theControl->GetState() != wasValue)
{
mapLeftRoom = GetControlValue(theControl);
mapLeftRoom = theControl->GetState();
RedrawMapContents();
}
break;
case kControlPageDownPart:
wasValue = GetControlValue(theControl);
wasValue = theControl->GetState();
newValue = wasValue + (mapRoomsWide / 2);
SetControlValue(theControl, newValue);
if (GetControlValue(theControl) != wasValue)
theControl->SetState(newValue);
if (theControl->GetState() != wasValue)
{
mapLeftRoom = GetControlValue(theControl);
mapLeftRoom = theControl->GetState();
RedrawMapContents();
}
break;
@@ -519,50 +527,50 @@ void LiveHScrollAction (ControlHandle theControl, short thePart)
//-------------------------------------------------------------- LiveVScrollAction
#ifndef COMPILEDEMO
void LiveVScrollAction (ControlHandle theControl, short thePart)
void LiveVScrollAction (PortabilityLayer::Widget *theControl, int thePart)
{
short wasValue, newValue;
switch (thePart)
{
case kControlUpButtonPart:
wasValue = GetControlValue(theControl);
SetControlValue(theControl, wasValue - 1);
if (GetControlValue(theControl) != wasValue)
wasValue = theControl->GetState();
theControl->SetState(wasValue - 1);
if (theControl->GetState() != wasValue)
{
mapTopRoom = GetControlValue(theControl);
mapTopRoom = theControl->GetState();
RedrawMapContents();
}
break;
case kControlDownButtonPart:
wasValue = GetControlValue(theControl);
SetControlValue(theControl, wasValue + 1);
if (GetControlValue(theControl) != wasValue)
wasValue = theControl->GetState();
theControl->SetState(wasValue + 1);
if (theControl->GetState() != wasValue)
{
mapTopRoom = GetControlValue(theControl);
mapTopRoom = theControl->GetState();
RedrawMapContents();
}
break;
case kControlPageUpPart:
wasValue = GetControlValue(theControl);
wasValue = theControl->GetState();
newValue = wasValue - (mapRoomsHigh / 2);
SetControlValue(theControl, newValue);
if (GetControlValue(theControl) != wasValue)
theControl->SetState(newValue);
if (theControl->GetState() != wasValue)
{
mapTopRoom = GetControlValue(theControl);
mapTopRoom = theControl->GetState();
RedrawMapContents();
}
break;
case kControlPageDownPart:
wasValue = GetControlValue(theControl);
wasValue = theControl->GetState();
newValue = wasValue + (mapRoomsHigh / 2);
SetControlValue(theControl, newValue);
if (GetControlValue(theControl) != wasValue)
theControl->SetState(newValue);
if (theControl->GetState() != wasValue)
{
mapTopRoom = GetControlValue(theControl);
mapTopRoom = theControl->GetState();
RedrawMapContents();
}
break;
@@ -579,18 +587,14 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
{
#ifndef COMPILEDEMO
Rect aRoom;
ControlHandle whichControl;
PortabilityLayer::Widget *whichControl = nullptr;
Point wherePt, globalWhere;
long controlRef;
short whichPart, localH, localV;
short roomH, roomV, itsNumber;
ControlActionUPP scrollHActionUPP, scrollVActionUPP;
wherePt = Point::Create(theEvent.m_x, theEvent.m_y);
scrollHActionUPP = NewControlActionUPP(LiveHScrollAction);
scrollVActionUPP = NewControlActionUPP(LiveVScrollAction);
if (mapWindow == nil)
return;
@@ -665,7 +669,7 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
}
else
{
controlRef = GetControlReference(whichControl);
controlRef = whichControl->GetReferenceConstant();
if (controlRef == kHScrollRef)
{
switch (whichPart)
@@ -674,16 +678,13 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
case kControlDownButtonPart:
case kControlPageUpPart:
case kControlPageDownPart:
if (TrackControl(whichControl, wherePt, scrollHActionUPP))
{
}
whichControl->Capture(wherePt, LiveHScrollAction);
break;
case kControlIndicatorPart:
if (TrackControl(whichControl, wherePt, nil))
if (whichControl->Capture(wherePt, nil))
{
mapLeftRoom = GetControlValue(whichControl);
mapLeftRoom = whichControl->GetState();
RedrawMapContents();
}
break;
@@ -697,25 +698,19 @@ void HandleMapClick (const GpMouseInputEvent &theEvent)
case kControlDownButtonPart:
case kControlPageUpPart:
case kControlPageDownPart:
if (TrackControl(whichControl, wherePt, scrollVActionUPP))
{
}
whichControl->Capture(wherePt, LiveVScrollAction);
break;
case kControlIndicatorPart:
if (TrackControl(whichControl, wherePt, nil))
if (whichControl->Capture(wherePt, nil))
{
mapTopRoom = GetControlValue(whichControl);
mapTopRoom = whichControl->GetState();
RedrawMapContents();
}
break;
}
}
}
DisposeControlActionUPP(scrollHActionUPP);
DisposeControlActionUPP(scrollVActionUPP);
#endif
}

View File

@@ -6,11 +6,17 @@
#include "Externs.h"
#include "HostDisplayDriver.h"
#include "IGpDisplayDriver.h"
#include "InputManager.h"
#include "Marquee.h"
#include "Objects.h"
#include "ObjectEdit.h"
#include "RectUtils.h"
#include <assert.h>
#include <algorithm>
#define kMarqueePatListID 128
#define kHandleSideLong 9
@@ -25,7 +31,7 @@ Rect marqueeGliderRect;
Boolean gliderMarqueeUp;
extern Cursor handCursor, vertCursor, horiCursor, diagCursor;
extern IGpCursor *handCursor, *vertCursor, *horiCursor, *diagCursor;
extern Rect leftStartGliderSrc;
@@ -182,7 +188,7 @@ void ResumeMarquee (void)
//-------------------------------------------------------------- DragOutMarqueeRect
void DragOutMarqueeRect (Point start, Rect *theRect)
void DragOutMarqueeRect (Window *window, Point start, Rect *theRect)
{
Point wasPt, newPt;
DrawSurface *surface = mainWindow->GetDrawSurface();
@@ -196,8 +202,8 @@ void DragOutMarqueeRect (Point start, Rect *theRect)
while (WaitMouseUp())
{
GetMouse(&newPt);
if (DeltaPoint(wasPt, newPt))
GetMouse(window, &newPt);
if (wasPt != newPt)
{
surface->InvertFrameRect(*theRect, pattern);
QSetRect(theRect, start.h, start.v, newPt.h, newPt.v);
@@ -211,12 +217,12 @@ void DragOutMarqueeRect (Point start, Rect *theRect)
//-------------------------------------------------------------- DragMarqueeRect
void DragMarqueeRect (DrawSurface *surface, Point start, Rect *theRect, Boolean lockH, Boolean lockV)
void DragMarqueeRect (Window *window, DrawSurface *surface, Point start, Rect *theRect, Boolean lockH, Boolean lockV)
{
Point wasPt, newPt;
short deltaH, deltaV;
SetCursor(&handCursor);
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor(handCursor);
StopMarquee();
const uint8_t *pattern = theMarquee.pats[theMarquee.index];
@@ -226,8 +232,8 @@ void DragMarqueeRect (DrawSurface *surface, Point start, Rect *theRect, Boolean
wasPt = start;
while (WaitMouseUp())
{
GetMouse(&newPt);
if (DeltaPoint(wasPt, newPt))
GetMouse(window, &newPt);
if (wasPt != newPt)
{
if (lockV)
deltaH = 0;
@@ -253,15 +259,15 @@ void DragMarqueeRect (DrawSurface *surface, Point start, Rect *theRect, Boolean
//-------------------------------------------------------------- DragMarqueeHandle
void DragMarqueeHandle (DrawSurface *surface, Point start, short *dragged)
void DragMarqueeHandle (Window *window, DrawSurface *surface, Point start, short *dragged)
{
Point wasPt, newPt;
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];
@@ -271,8 +277,8 @@ void DragMarqueeHandle (DrawSurface *surface, Point start, short *dragged)
wasPt = start;
while (WaitMouseUp())
{
GetMouse(&newPt);
if (DeltaPoint(wasPt, newPt))
GetMouse(window, &newPt);
if (wasPt != newPt)
{
switch (theMarquee.direction)
{
@@ -333,18 +339,17 @@ void DragMarqueeHandle (DrawSurface *surface, Point start, short *dragged)
}
surface->InvertFrameRect(theMarquee.bounds, pattern);
surface->InvertFillRect(theMarquee.handle, pattern);
PenNormal();
InitCursor();
}
//-------------------------------------------------------------- DragMarqueeCorner
void DragMarqueeCorner (DrawSurface *surface, Point start, short *hDragged, short *vDragged, Boolean isTop)
void DragMarqueeCorner (Window *window, DrawSurface *surface, Point start, short *hDragged, short *vDragged, Boolean isTop)
{
Point wasPt, newPt;
short deltaH, deltaV;
SetCursor(&diagCursor);
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor(diagCursor);
StopMarquee();
const uint8_t *pattern = theMarquee.pats[theMarquee.index];
@@ -354,8 +359,8 @@ void DragMarqueeCorner (DrawSurface *surface, Point start, short *hDragged, shor
wasPt = start;
while (WaitMouseUp())
{
GetMouse(&newPt);
if (DeltaPoint(wasPt, newPt))
GetMouse(window, &newPt);
if (wasPt != newPt)
{
deltaH = newPt.h - wasPt.h;
if (isTop)
@@ -395,7 +400,6 @@ void DragMarqueeCorner (DrawSurface *surface, Point start, short *hDragged, shor
}
surface->InvertFrameRect(theMarquee.bounds, pattern);
surface->InvertFillRect(theMarquee.handle, pattern);
PenNormal();
InitCursor();
}
@@ -421,18 +425,16 @@ Boolean MarqueeHasHandles (short *direction, short *dist)
Boolean PtInMarqueeHandle (Point where)
{
return (PtInRect(where, &theMarquee.handle));
return theMarquee.handle.Contains(where);
}
//-------------------------------------------------------------- DrawGliderMarquee
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,12 @@ void DrawMarquee (DrawSurface *surface, const uint8_t *pattern)
break;
}
surface->InvertDrawLine(points[0], points[1], pattern);
if (points[1].h < points[0].h)
std::swap(points[0].h, points[1].h);
if (points[1].v < points[0].v)
std::swap(points[0].v, points[1].v);
surface->InvertFillRect(Rect::Create(points[0].v, points[0].h, points[1].v + 1, points[1].h + 1), pattern);
}
if (gliderMarqueeUp)

View File

@@ -29,9 +29,6 @@ void UpdateMenusEditMode (void);
void UpdateMenusNonEditMode (void);
void UpdateMenusHouseOpen (void);
void UpdateMenusHouseClosed (void);
void UpdateResumeDialog (Dialog *);
Boolean ResumeFilter (Dialog *, EventRecord *, short *);
short QueryResumeGame (void);
void HeyYourPissingAHighScore (void);
@@ -187,7 +184,7 @@ void UpdateClipboardMenus (void)
mm->SetItemText(houseMenu, iCopy - 1, title);
GetLocalizedString(38, title);
mm->SetItemText(houseMenu, iClear - 1, title);
mm->SetItemEnabled(houseMenu, iDuplicate - 1, false);
mm->SetItemEnabled(houseMenu, iDuplicate - 1, true);
}
else
{
@@ -666,106 +663,6 @@ void UpdateCoordinateCheckmark (Boolean checkIt)
CheckMenuItem(houseMenu, iCoordinateWindow, checkIt);
}
//-------------------------------------------------------------- UpdateResumeDialog
// Update function for Resume dialog (below).
void UpdateResumeDialog (Dialog *theDialog)
{
DrawDialog(theDialog);
DrawDefaultButton(theDialog);
}
//-------------------------------------------------------------- ResumeFilter
// Dialog filter for the Resume dialog (below).
Boolean ResumeFilter (Dialog *dial, EventRecord *event, short *item)
{
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;
default:
return(false);
}
break;
case updateEvt:
if ((WindowPtr)event->message == dial->GetWindow())
{
SetPortDialogPort(dial);
UpdateResumeDialog(dial);
EndUpdate(dial->GetWindow());
event->what = nullEvent;
}
return(false);
break;
default:
return(false);
break;
}
}
//-------------------------------------------------------------- QueryResumeGame
// Dialog that asks user whether they want to resume a saved game or<6F>
// begin a new one. It displays a little info on the state of their<69>
// saved game (number of glider left, points, etc.).
short QueryResumeGame (void)
{
#define kResumeGameDial 1025
Dialog *theDial;
houseType *thisHousePtr;
Str255 scoreStr, glidStr;
long hadPoints;
short hitWhat, hadGliders;
char wasState;
Boolean leaving;
// get score & num. gliders
thisHousePtr = *thisHouse;
hadPoints = thisHousePtr->savedGame.score;
hadGliders = thisHousePtr->savedGame.numGliders;
NumToString(hadPoints, scoreStr); // param text strings
NumToString((long)hadGliders, glidStr);
DialogTextSubstitutions substitutions;
if (hadGliders == 1)
substitutions = DialogTextSubstitutions(glidStr, PSTR(""), scoreStr);
else
substitutions = DialogTextSubstitutions(glidStr, PSTR("s"), scoreStr);
// CenterDialog(kResumeGameDial);
theDial = PortabilityLayer::DialogManager::GetInstance()->LoadDialog(kResumeGameDial, kPutInFront, &substitutions);
if (theDial == nil)
RedAlert(kErrDialogDidntLoad);
SetPort((GrafPtr)theDial);
ShowWindow(theDial->GetWindow());
DrawDefaultButton(theDial);
leaving = false;
while (!leaving)
{
ModalDialog(ResumeFilter, &hitWhat);
if ((hitWhat == kSheWantsNewGame) || (hitWhat == kSheWantsResumeGame))
{
leaving = true;
}
}
theDial->Destroy();
return (hitWhat);
}
//-------------------------------------------------------------- DoNotInDemo
// Only compiled for "demo version" of Glider PRO. It brings up a<>
// dialog that says, essentially, "x" feature is not implemented in<69>

View File

@@ -222,7 +222,7 @@ PLError_t LoadMusicSounds (void)
if (theMusicData[i] == nil)
return PLErrors::kOutOfMemory;
BlockMove(static_cast<Byte*>(*theSound), theMusicData[i], soundDataSize);
memcpy(theMusicData[i], static_cast<Byte*>(*theSound), soundDataSize);
theSound.Dispose();
}
return (theErr);

View File

@@ -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)
{

View File

@@ -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);
@@ -1238,7 +1224,7 @@ void DrawSimplePrizes (short what, Rect *theRect)
//-------------------------------------------------------------- DrawGreaseRt
void DrawGreaseRt (Rect *theRect, short distance, Boolean state)
void DrawGreaseRt (Rect *theRect, short distance, Boolean state, Boolean drawSpill)
{
Rect spill, dest;
@@ -1257,18 +1243,21 @@ void DrawGreaseRt (Rect *theRect, short distance, Boolean state)
(BitMap *)*GetGWorldPixMap(bonusMaskMap),
(BitMap *)*GetGWorldPixMap(backSrcMap),
&greaseSrcRt[3], &greaseSrcRt[3], &dest);
QSetRect(&spill, 0, -2, distance - 5, 0);
QOffsetRect(&spill, dest.right - 1, dest.bottom);
backSrcMap->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
backSrcMap->FillRect(spill);
if (drawSpill)
{
QSetRect(&spill, 0, -2, distance - 5, 0);
QOffsetRect(&spill, dest.right - 1, dest.bottom);
backSrcMap->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
backSrcMap->FillRect(spill);
}
}
}
//-------------------------------------------------------------- DrawGreaseLf
void DrawGreaseLf (Rect *theRect, short distance, Boolean state)
void DrawGreaseLf (Rect *theRect, short distance, Boolean state, Boolean drawSpill)
{
Rect spill, dest;
DrawSurface *wasCPort;
@@ -1289,11 +1278,14 @@ void DrawGreaseLf (Rect *theRect, short distance, Boolean state)
(BitMap *)*GetGWorldPixMap(backSrcMap),
&greaseSrcLf[3], &greaseSrcLf[3], &dest);
backSrcMap->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
if (drawSpill)
{
backSrcMap->SetForeColor(PortabilityLayer::RGBAColor::Create(0, 0, 0, 255));
QSetRect(&spill, -distance + 5, -2, 0, 0);
QOffsetRect(&spill, dest.left + 1, dest.bottom);
backSrcMap->FillRect(spill);
QSetRect(&spill, -distance + 5, -2, 0, 0);
QOffsetRect(&spill, dest.left + 1, dest.bottom);
backSrcMap->FillRect(spill);
}
}
}

View File

@@ -5,7 +5,7 @@
//----------------------------------------------------------------------------
//============================================================================
#include "BitmapImage.h"
#include "Externs.h"
#include "Environ.h"
#include "RectUtils.h"
@@ -73,11 +73,13 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
DrawSimpleBlowers(thisObject.what, &itsRect);
if (neighbor == kCentralRoom)
{
const short h = itsRect.left + 10;
const short v = itsRect.top + 7;
if (redraw)
ReBackUpFlames(localNumbers[neighbor], i);
ReBackUpFlames(localNumbers[neighbor], i, h, v);
else
AddCandleFlame(localNumbers[neighbor], i,
itsRect.left + 10, itsRect.top + 7);
h, v);
}
else
{
@@ -88,11 +90,13 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
rectB.bottom += kFloorSupportTall;
if (!SectRect(&rectA, &rectB, &whoCares))
{
const short h = itsRect.left + 10;
const short v = itsRect.top + 7;
if (redraw)
ReBackUpFlames(localNumbers[neighbor], i);
ReBackUpFlames(localNumbers[neighbor], i, h, v);
else
AddCandleFlame(localNumbers[neighbor], i,
itsRect.left + 10, itsRect.top + 7);
h, v);
}
}
}
@@ -107,11 +111,13 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
DrawSimpleBlowers(thisObject.what, &itsRect);
if (neighbor == kCentralRoom)
{
const short h = itsRect.left + 14;
const short v = itsRect.top + 7;
if (redraw)
ReBackUpFlames(localNumbers[neighbor], i);
ReBackUpFlames(localNumbers[neighbor], i, h, v);
else
AddCandleFlame(localNumbers[neighbor], i,
itsRect.left + 14, itsRect.top + 7);
h, v);
}
else
{
@@ -122,11 +128,13 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
rectB.bottom += kFloorSupportTall;
if (!SectRect(&rectA, &rectB, &whoCares))
{
const short h = itsRect.left + 14;
const short v = itsRect.top + 7;
if (redraw)
ReBackUpFlames(localNumbers[neighbor], i);
ReBackUpFlames(localNumbers[neighbor], i, h, v);
else
AddCandleFlame(localNumbers[neighbor], i,
itsRect.left + 14, itsRect.top + 7);
h, v);
}
}
}
@@ -141,11 +149,13 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
DrawSimpleBlowers(thisObject.what, &itsRect);
if (neighbor == kCentralRoom)
{
const short h = itsRect.left + 9;
const short v = itsRect.top + 7;
if (redraw)
ReBackUpFlames(localNumbers[neighbor], i);
ReBackUpFlames(localNumbers[neighbor], i, h, v);
else
AddCandleFlame(localNumbers[neighbor], i,
itsRect.left + 9, itsRect.top + 7);
h, v);
}
else
{
@@ -156,26 +166,31 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
rectB.bottom += kFloorSupportTall;
if (!SectRect(&rectA, &rectB, &whoCares))
{
const short h = itsRect.left + 9;
const short v = itsRect.top + 7;
if (redraw)
ReBackUpFlames(localNumbers[neighbor], i);
ReBackUpFlames(localNumbers[neighbor], i, h, v);
else
AddCandleFlame(localNumbers[neighbor], i,
itsRect.left + 9, itsRect.top + 7);
h, v);
}
}
}
break;
case kTiki:
GetObjectRect(&thisObject, &itsRect);
OffsetRectRoomRelative(&itsRect, neighbor);
if (isLit)
DrawTiki(&itsRect, playOriginV + VerticalRoomOffset(neighbor));
if (redraw)
ReBackUpTikiFlames(localNumbers[neighbor], i);
else
AddTikiFlame(localNumbers[neighbor], i,
itsRect.left + 10, itsRect.top - 9);
{
GetObjectRect(&thisObject, &itsRect);
OffsetRectRoomRelative(&itsRect, neighbor);
const short h = itsRect.left + 10;
const short v = itsRect.top - 9;
if (isLit)
DrawTiki(&itsRect, playOriginV + VerticalRoomOffset(neighbor));
if (redraw)
ReBackUpTikiFlames(localNumbers[neighbor], i, h, v);
else
AddTikiFlame(localNumbers[neighbor], i, h, v);
}
break;
case kBBQ:
@@ -183,13 +198,14 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
OffsetRectRoomRelative(&itsRect, neighbor);
if (SectRect(&itsRect, &testRect, &whoCares))
{
const short h = itsRect.left + 16;
const short v = itsRect.top + 9;
if (isLit)
DrawPictSansWhiteObject(thisObject.what, &itsRect);
if (redraw)
ReBackUpBBQCoals(localNumbers[neighbor], i);
ReBackUpBBQCoals(localNumbers[neighbor], i, h, v);
else
AddBBQCoals(localNumbers[neighbor], i,
itsRect.left + 16, itsRect.top + 9);
AddBBQCoals(localNumbers[neighbor], i, h, v);
}
break;
@@ -333,8 +349,10 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (legit != -1)
{
DrawCuckoo(&itsRect);
short pendulumH = itsRect.left + 4;
short pendulumV = itsRect.top + 46;
if (redraw)
ReBackUpPendulum(localNumbers[neighbor], i);
ReBackUpPendulum(localNumbers[neighbor], i, pendulumH, pendulumV);
else
AddPendulum(localNumbers[neighbor], i,
itsRect.left + 4, itsRect.top + 46);
@@ -367,17 +385,22 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (SectRect(&itsRect, &testRect, &whoCares))
{
if (redraw)
dynamicNum = ReBackUpGrease(localNumbers[neighbor], i);
dynamicNum = ReBackUpGrease(localNumbers[neighbor], i, itsRect.left, itsRect.top);
else
dynamicNum = AddGrease(localNumbers[neighbor], i,
itsRect.left, itsRect.top,
thisObject.data.c.length, true);
if (dynamicNum != -1)
DrawGreaseRt(&itsRect, thisObject.data.c.length, true);
DrawGreaseRt(&itsRect, thisObject.data.c.length, true, false);
}
}
else // fallen
DrawGreaseRt(&itsRect, thisObject.data.c.length, false);
{
Boolean isDynamic = false;
if (redraw)
FixupFallenGrease(localNumbers[neighbor], i, itsRect.left, itsRect.top, &isDynamic);
DrawGreaseRt(&itsRect, thisObject.data.c.length, false, !isDynamic);
}
break;
case kGreaseLf:
@@ -388,17 +411,22 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (SectRect(&itsRect, &testRect, &whoCares))
{
if (redraw)
dynamicNum = ReBackUpGrease(localNumbers[neighbor], i);
dynamicNum = ReBackUpGrease(localNumbers[neighbor], i, itsRect.left, itsRect.top);
else
dynamicNum = AddGrease(localNumbers[neighbor], i,
itsRect.left, itsRect.top,
thisObject.data.c.length, false);
if (dynamicNum != -1)
DrawGreaseLf(&itsRect, thisObject.data.c.length, true);
DrawGreaseLf(&itsRect, thisObject.data.c.length, true, false);
}
}
else
DrawGreaseLf(&itsRect, thisObject.data.c.length, false);
{
Boolean isDynamic = false;
if (redraw)
FixupFallenGrease(localNumbers[neighbor], i, itsRect.left, itsRect.top, &isDynamic);
DrawGreaseLf(&itsRect, thisObject.data.c.length, false, !isDynamic);
}
break;
case kFoil:
@@ -431,7 +459,7 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (legit != -1)
{
if (redraw)
ReBackUpStar(localNumbers[neighbor], i);
ReBackUpStar(localNumbers[neighbor], i, itsRect.left, itsRect.top);
else
AddStar(localNumbers[neighbor], i, itsRect.left,
itsRect.top);
@@ -445,12 +473,12 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
OffsetRectRoomRelative(&itsRect, neighbor);
if (SectRect(&itsRect, &testRect, &whoCares))
{
if ((!redraw) && (neighbor == kCentralRoom))
if (neighbor == kCentralRoom)
{
rectA = itsRect;
QOffsetRect(&rectA, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kSparkle, &rectA, &thisObject,
localNumbers[neighbor], i, thisObject.data.c.state);
localNumbers[neighbor], i, thisObject.data.c.state, redraw);
}
}
break;
@@ -641,12 +669,12 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (SectRect(&itsRect, &testRect, &whoCares))
{
DrawSimpleAppliance(thisObject.what, &itsRect);
if ((!redraw) && (neighbor == kCentralRoom))
if (neighbor == kCentralRoom)
{
rectA = itsRect;
QOffsetRect(&rectA, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kToaster, &rectA, &thisObject,
localNumbers[neighbor], i, thisObject.data.g.state);
localNumbers[neighbor], i, thisObject.data.g.state, redraw);
}
}
break;
@@ -657,13 +685,10 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (SectRect(&itsRect, &testRect, &whoCares))
{
DrawMacPlus(&itsRect, thisObject.data.g.state, isLit);
if (!redraw)
{
rectA = itsRect;
QOffsetRect(&rectA, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kMacPlus, &rectA, &thisObject,
localNumbers[neighbor], i, thisObject.data.g.state);
}
rectA = itsRect;
QOffsetRect(&rectA, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kMacPlus, &rectA, &thisObject,
localNumbers[neighbor], i, thisObject.data.g.state, redraw);
}
break;
@@ -673,26 +698,27 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (SectRect(&itsRect, &testRect, &whoCares))
{
#ifdef COMPILEQT
if ((thisMac.hasQT) && (hasMovie) && (neighbor == kCentralRoom) &&
(!tvInRoom))
if ((thisMac.hasQT) && (hasMovie) && (neighbor == kCentralRoom))
{
whoCares = tvScreen1;
ZeroRectCorner(&whoCares);
OffsetRect(&whoCares, itsRect.left + 17, itsRect.top + 10);
GetMovieBox(theMovie, &movieRect);
movieRect = (*theMovie.m_animPackage->GetFrame(0))->GetRect();
CenterRectInRect(&movieRect, &whoCares);
SetMovieBox(theMovie, &movieRect);
SetMovieDisplayClipRgn(theMovie, &whoCares);
tvOn = thisObject.data.g.state;
theMovie.m_renderRect = movieRect;
theMovie.m_constrainRect = whoCares;
if (!tvInRoom)
tvOn = thisObject.data.g.state;
}
#endif
DrawTV(&itsRect, thisObject.data.g.state, isLit);
rectA = itsRect;
QOffsetRect(&rectA, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kTV, &rectA, &thisObject,
localNumbers[neighbor], i, thisObject.data.g.state, redraw);
if (!redraw)
{
rectA = itsRect;
QOffsetRect(&rectA, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kTV, &rectA, &thisObject,
localNumbers[neighbor], i, thisObject.data.g.state);
#ifdef COMPILEQT
if ((thisMac.hasQT) && (hasMovie) && (neighbor == kCentralRoom) &&
(!tvInRoom))
@@ -711,13 +737,10 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (SectRect(&itsRect, &testRect, &whoCares))
{
DrawCoffee(&itsRect, thisObject.data.g.state, isLit);
if (!redraw)
{
rectA = itsRect;
QOffsetRect(&rectA, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kCoffee, &rectA, &thisObject,
localNumbers[neighbor], i, thisObject.data.g.state);
}
rectA = itsRect;
QOffsetRect(&rectA, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kCoffee, &rectA, &thisObject,
localNumbers[neighbor], i, thisObject.data.g.state, redraw);
}
break;
@@ -728,13 +751,10 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
{
if (isLit)
DrawOutlet(&itsRect);
if (!redraw)
{
rectA = itsRect;
QOffsetRect(&rectA, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kOutlet, &rectA, &thisObject,
localNumbers[neighbor], i, thisObject.data.g.state);
}
rectA = itsRect;
QOffsetRect(&rectA, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kOutlet, &rectA, &thisObject,
localNumbers[neighbor], i, thisObject.data.g.state, redraw);
}
break;
@@ -744,13 +764,10 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (SectRect(&itsRect, &testRect, &whoCares))
{
DrawVCR(&itsRect, thisObject.data.g.state, isLit);
if (!redraw)
{
rectA = itsRect;
QOffsetRect(&rectA, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kVCR, &rectA, &thisObject,
localNumbers[neighbor], i, thisObject.data.g.state);
}
rectA = itsRect;
QOffsetRect(&rectA, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kVCR, &rectA, &thisObject,
localNumbers[neighbor], i, thisObject.data.g.state, redraw);
}
break;
@@ -760,13 +777,10 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (SectRect(&itsRect, &testRect, &whoCares))
{
DrawStereo(&itsRect, isPlayMusicGame, isLit);
if (!redraw)
{
rectA = itsRect;
QOffsetRect(&rectA, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kStereo, &rectA, &thisObject,
localNumbers[neighbor], i, thisObject.data.g.state);
}
rectA = itsRect;
QOffsetRect(&rectA, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kStereo, &rectA, &thisObject,
localNumbers[neighbor], i, thisObject.data.g.state, redraw);
}
break;
@@ -776,79 +790,76 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (SectRect(&itsRect, &testRect, &whoCares))
{
DrawMicrowave(&itsRect, thisObject.data.g.state, isLit);
if (!redraw)
{
rectA = itsRect;
QOffsetRect(&rectA, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kMicrowave, &rectA, &thisObject,
localNumbers[neighbor], i, thisObject.data.g.state);
}
rectA = itsRect;
QOffsetRect(&rectA, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kMicrowave, &rectA, &thisObject,
localNumbers[neighbor], i, thisObject.data.g.state, redraw);
}
break;
case kBalloon:
if ((neighbor == kCentralRoom) && (!redraw))
if (neighbor == kCentralRoom)
{
GetObjectRect(&thisObject, &itsRect);
OffsetRectRoomRelative(&itsRect, neighbor);
QOffsetRect(&itsRect, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kBalloon, &itsRect, &thisObject,
localNumbers[neighbor], i, thisObject.data.h.state);
localNumbers[neighbor], i, thisObject.data.h.state, redraw);
}
break;
case kCopterLf:
if ((neighbor == kCentralRoom) && (!redraw))
if (neighbor == kCentralRoom)
{
GetObjectRect(&thisObject, &itsRect);
OffsetRectRoomRelative(&itsRect, neighbor);
QOffsetRect(&itsRect, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kCopterLf, &itsRect, &thisObject,
localNumbers[neighbor], i, thisObject.data.h.state);
localNumbers[neighbor], i, thisObject.data.h.state, redraw);
}
break;
case kCopterRt:
if ((neighbor == kCentralRoom) && (!redraw))
if (neighbor == kCentralRoom)
{
GetObjectRect(&thisObject, &itsRect);
OffsetRectRoomRelative(&itsRect, neighbor);
QOffsetRect(&itsRect, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kCopterRt, &itsRect, &thisObject,
localNumbers[neighbor], i, thisObject.data.h.state);
localNumbers[neighbor], i, thisObject.data.h.state, redraw);
}
break;
case kDartLf:
if ((neighbor == kCentralRoom) && (!redraw))
if (neighbor == kCentralRoom)
{
GetObjectRect(&thisObject, &itsRect);
OffsetRectRoomRelative(&itsRect, neighbor);
QOffsetRect(&itsRect, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kDartLf, &itsRect, &thisObject,
localNumbers[neighbor], i, thisObject.data.h.state);
localNumbers[neighbor], i, thisObject.data.h.state, redraw);
}
break;
case kDartRt:
if ((neighbor == kCentralRoom) && (!redraw))
if (neighbor == kCentralRoom)
{
GetObjectRect(&thisObject, &itsRect);
OffsetRectRoomRelative(&itsRect, neighbor);
QOffsetRect(&itsRect, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kDartRt, &itsRect, &thisObject,
localNumbers[neighbor], i, thisObject.data.h.state);
localNumbers[neighbor], i, thisObject.data.h.state, redraw);
}
break;
case kBall:
if ((neighbor == kCentralRoom) && (!redraw))
if (neighbor == kCentralRoom)
{
GetObjectRect(&thisObject, &itsRect);
OffsetRectRoomRelative(&itsRect, neighbor);
QOffsetRect(&itsRect, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kBall, &itsRect, &thisObject,
localNumbers[neighbor], i, thisObject.data.h.state);
localNumbers[neighbor], i, thisObject.data.h.state, redraw);
}
break;
@@ -858,12 +869,12 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (SectRect(&itsRect, &testRect, &whoCares))
{
DrawDrip(&itsRect);
if ((!redraw) && (neighbor == kCentralRoom))
if (neighbor == kCentralRoom)
{
rectA = itsRect;
QOffsetRect(&rectA, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kDrip, &rectA, &thisObject,
localNumbers[neighbor], i, thisObject.data.h.state);
localNumbers[neighbor], i, thisObject.data.h.state, redraw);
}
}
break;
@@ -874,12 +885,12 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
if (SectRect(&itsRect, &testRect, &whoCares))
{
DrawFish(thisObject.what, &itsRect);
if ((!redraw) && (neighbor == kCentralRoom))
if (neighbor == kCentralRoom)
{
rectA = itsRect;
QOffsetRect(&rectA, -playOriginH, -playOriginV);
dynamicNum = AddDynamicObject(kFish, &rectA, &thisObject,
localNumbers[neighbor], i, thisObject.data.h.state);
localNumbers[neighbor], i, thisObject.data.h.state, redraw);
}
}
break;
@@ -897,7 +908,7 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
OffsetRectRoomRelative(&itsRect, neighbor);
if ((SectRect(&itsRect, &testRect, &whoCares)) && isLit)
DrawMirror(&itsRect);
if ((neighbor == kCentralRoom) && (!redraw))
if (neighbor == kCentralRoom)
{
InsetRect(&itsRect, 4, 4);
AddToMirrorRegion(&itsRect);
@@ -942,15 +953,12 @@ void DrawARoomsObjects (short neighbor, Boolean redraw)
}
}
if (!redraw) // set up links
for (n = 0; n < numMasterObjects; n++)
{
for (n = 0; n < numMasterObjects; n++)
{
if ((masterObjects[n].objectNum == i) &&
(masterObjects[n].roomNum == localNumbers[neighbor]))
masterObjects[n].dynaNum = dynamicNum;
}
if ((masterObjects[n].objectNum == i) &&
(masterObjects[n].roomNum == localNumbers[neighbor]))
masterObjects[n].dynaNum = dynamicNum;
}
}
}

View File

@@ -23,8 +23,8 @@
short FindObjectSelected (Point);
void DragHandle (DrawSurface *, Point);
void DragObject (DrawSurface *, Point);
void DragHandle (Window *, DrawSurface *, Point);
void DragObject (Window *, DrawSurface *, Point);
void AddObjectPairing (void);
Boolean ObjectIsUpBlower (objectType *);
@@ -53,16 +53,16 @@ short FindObjectSelected (Point where)
found = kNoObjectSelected;
if (PtInRect(where, &initialGliderRect))
if (initialGliderRect.Contains(where))
return (kInitialGliderSelected);
else if (PtInRect(where, &leftStartGliderDest))
else if (leftStartGliderDest.Contains(where))
return (kLeftGliderSelected);
else if (PtInRect(where, &rightStartGliderDest))
else if (rightStartGliderDest.Contains(where))
return (kRightGliderSelected);
for (i = kMaxRoomObs - 1; i >= 0; i--)
{
if (PtInRect(where, &roomObjectRects[i]))
if (roomObjectRects[i].Contains(where))
{
found = i;
break;
@@ -74,7 +74,7 @@ short FindObjectSelected (Point where)
//-------------------------------------------------------------- DoSelectionClick
void DoSelectionClick (DrawSurface *surface, Point where, Boolean isDoubleClick)
void DoSelectionClick (Window *window, DrawSurface *surface, Point where, Boolean isDoubleClick)
{
#ifndef COMPILEDEMO
short direction, dist;
@@ -84,7 +84,7 @@ void DoSelectionClick (DrawSurface *surface, Point where, Boolean isDoubleClick)
if ((PtInMarqueeHandle(where)) && (objActive != kNoObjectSelected))
{
if (StillDown())
DragHandle(surface, where);
DragHandle(window, surface, where);
if (ObjectHasHandle(&direction, &dist))
{
StartMarqueeHandled(&roomObjectRects[objActive], direction, dist);
@@ -117,7 +117,7 @@ void DoSelectionClick (DrawSurface *surface, Point where, Boolean isDoubleClick)
else
{
if (StillDown())
DragObject(surface, where);
DragObject(window, surface, where);
if (ObjectHasHandle(&direction, &dist))
{
StartMarqueeHandled(&roomObjectRects[objActive], direction, dist);
@@ -144,184 +144,186 @@ void DoSelectionClick (DrawSurface *surface, Point where, Boolean isDoubleClick)
//-------------------------------------------------------------- DragHandle
#ifndef COMPILEDEMO
void DragHandle (DrawSurface *surface, Point where)
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(surface, where, &vDelta);
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(surface, where, &hDelta, &vDelta, false);
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(surface, where, &hDelta);
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))
{
vDelta = thisRoom->objects[objActive].data.a.distance;
DragMarqueeHandle(surface, where, &vDelta);
DragMarqueeHandle(window, surface, where, &vDelta);
thisRoom->objects[objActive].data.a.distance = vDelta;
}
else
{
hDelta = thisRoom->objects[objActive].data.a.distance;
DragMarqueeHandle(surface, where, &hDelta);
DragMarqueeHandle(window, surface, where, &hDelta);
thisRoom->objects[objActive].data.a.distance = hDelta;
}
whoCares = KeepObjectLegal();
break;
case kTable:
case kShelf:
case kDeckTable:
case kTable:
case kShelf:
case kDeckTable:
hDelta = RectWide(&thisRoom->objects[objActive].data.b.bounds);
DragMarqueeHandle(surface, where, &hDelta);
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(surface, where, &hDelta, &vDelta, false);
DragMarqueeCorner(window, surface, where, &hDelta, &vDelta, false);
thisRoom->objects[objActive].data.b.bounds.right =
thisRoom->objects[objActive].data.b.bounds.left + hDelta;
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(surface, where, &hDelta, &vDelta, true);
DragMarqueeCorner(window, surface, where, &hDelta, &vDelta, true);
thisRoom->objects[objActive].data.b.bounds.right =
thisRoom->objects[objActive].data.b.bounds.left + hDelta;
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(surface, where, &hDelta);
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(surface, where, &hDelta, &vDelta, false);
DragMarqueeCorner(window, surface, where, &hDelta, &vDelta, false);
if (hDelta > 127)
hDelta = 127;
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(surface, where, &hDelta, &vDelta, false);
DragMarqueeCorner(window, surface, where, &hDelta, &vDelta, false);
if (hDelta < 64)
hDelta = 64;
if (vDelta < 32)
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(surface, where, &hDelta);
DragMarqueeHandle(window, surface, where, &hDelta);
thisRoom->objects[objActive].data.f.length = hDelta;
whoCares = KeepObjectLegal();
InvalWindowRect(mainWindow, &mainWindowRect);
redrawMainWindow = true;
GetThisRoomsObjRects();
ReadyBackground(thisRoom->background, thisRoom->tiles);
DrawThisRoomsObjects();
break;
case kToaster:
case kToaster:
vDelta = thisRoom->objects[objActive].data.g.height;
DragMarqueeHandle(surface, where, &vDelta);
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(surface, where, &vDelta);
DragMarqueeHandle(window, surface, where, &vDelta);
thisRoom->objects[objActive].data.h.length = vDelta;
whoCares = KeepObjectLegal();
break;
@@ -330,13 +332,13 @@ void DragHandle (DrawSurface *surface, Point where)
case kWallWindow:
hDelta = RectWide(&thisRoom->objects[objActive].data.i.bounds);
vDelta = RectTall(&thisRoom->objects[objActive].data.i.bounds);
DragMarqueeCorner(surface, where, &hDelta, &vDelta, false);
DragMarqueeCorner(window, surface, where, &hDelta, &vDelta, false);
thisRoom->objects[objActive].data.i.bounds.right =
thisRoom->objects[objActive].data.i.bounds.left + hDelta;
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,36 +348,39 @@ void DragHandle (DrawSurface *surface, Point where)
fileDirty = true;
UpdateMenus(false);
if (redrawMainWindow)
UpdateMainWindow();
}
#endif
//-------------------------------------------------------------- DragObject
#ifndef COMPILEDEMO
void DragObject (DrawSurface *surface, Point where)
void DragObject (Window *window, DrawSurface *surface, Point where)
{
Rect newRect, wasRect;
short deltaH, deltaV, increment;
char wasState;
Boolean invalAll;
Boolean invalAll = false;
if (objActive == kInitialGliderSelected)
{
wasRect = initialGliderRect;
newRect = initialGliderRect;
DragMarqueeRect(surface, where, &newRect, false, false);
DragMarqueeRect(window, surface, where, &newRect, false, false);
}
else if (objActive == kLeftGliderSelected)
{
wasRect = leftStartGliderDest;
newRect = leftStartGliderDest;
DragMarqueeRect(surface, where, &newRect, false, true);
DragMarqueeRect(window, surface, where, &newRect, false, true);
}
else if (objActive == kRightGliderSelected)
{
wasRect = rightStartGliderDest;
newRect = rightStartGliderDest;
DragMarqueeRect(surface, where, &newRect, false, true);
DragMarqueeRect(window, surface, where, &newRect, false, true);
}
else
{
@@ -412,13 +417,13 @@ void DragObject (DrawSurface *surface, Point where)
case kCopterRt:
case kMousehole:
case kFireplace:
DragMarqueeRect(surface, where, &newRect, true, false);
DragMarqueeRect(window, surface, where, &newRect, true, false);
invalAll = false;
break;
case kDartLf:
case kDartRt:
DragMarqueeRect(surface, where, &newRect, false, true);
DragMarqueeRect(window, surface, where, &newRect, false, true);
invalAll = false;
break;
@@ -439,14 +444,14 @@ void DragObject (DrawSurface *surface, Point where)
case kDeluxeTrans:
case kMirror:
case kWallWindow:
DragMarqueeRect(surface, where, &newRect, false, false);
DragMarqueeRect(window, surface, where, &newRect, false, false);
invalAll = true;
break;
case kCounter:
case kDresser:
case kTrackLight:
DragMarqueeRect(surface, where, &newRect, true, false);
DragMarqueeRect(window, surface, where, &newRect, true, false);
invalAll = true;
break;
@@ -516,7 +521,7 @@ void DragObject (DrawSurface *surface, Point where)
case kFaucet:
case kRug:
case kChimes:
DragMarqueeRect(surface, where, &newRect, false, false);
DragMarqueeRect(window, surface, where, &newRect, false, false);
invalAll = false;
break;
}
@@ -749,23 +754,11 @@ void DragObject (DrawSurface *surface, Point where)
{
}
GetThisRoomsObjRects();
if (invalAll)
InvalWindowRect(mainWindow, &mainWindowRect);
else
{
InvalWindowRect(mainWindow, &wasRect);
if (objActive == kInitialGliderSelected)
InvalWindowRect(mainWindow, &initialGliderRect);
else if (objActive == kLeftGliderSelected)
InvalWindowRect(mainWindow, &leftStartGliderDest);
else if (objActive == kRightGliderSelected)
InvalWindowRect(mainWindow, &rightStartGliderDest);
else
InvalWindowRect(mainWindow, &roomObjectRects[objActive]);
}
ReadyBackground(thisRoom->background, thisRoom->tiles);
DrawThisRoomsObjects();
UpdateMainWindow();
}
#endif
@@ -1140,11 +1133,12 @@ void DeleteObject (void)
thisRoom->numObjects--;
fileDirty = true;
UpdateMenus(false);
InvalWindowRect(mainWindow, &mainWindowRect);
QSetRect(&roomObjectRects[objActive], -1, -1, 0, 0);
DeselectObject();
ReadyBackground(thisRoom->background, thisRoom->tiles);
DrawThisRoomsObjects();
UpdateMainWindow();
#endif
}
@@ -1156,6 +1150,7 @@ void DuplicateObject (void)
Point placePt;
short direction, dist;
Boolean handled;
bool redrawMainWindow = false;
tempObject = thisRoom->objects[objActive];
@@ -1319,7 +1314,7 @@ void DuplicateObject (void)
ReadyBackground(thisRoom->background, thisRoom->tiles);
GetThisRoomsObjRects();
DrawThisRoomsObjects();
InvalWindowRect(mainWindow, &mainWindowRect);
redrawMainWindow = true;
if (handled)
{
@@ -1329,6 +1324,9 @@ void DuplicateObject (void)
else
StartMarquee(&roomObjectRects[objActive]);
}
if (redrawMainWindow)
UpdateMainWindow();
}
//-------------------------------------------------------------- MoveObject
@@ -1663,51 +1661,6 @@ void MoveObject (short whichWay, Boolean shiftDown)
UpdateMenus(false);
GetThisRoomsObjRects();
if (objActive == kInitialGliderSelected)
{
InvalWindowRect(mainWindow, &wasRect);
InvalWindowRect(mainWindow, &initialGliderRect);
}
else if (objActive == kLeftGliderSelected)
{
InvalWindowRect(mainWindow, &wasRect);
InvalWindowRect(mainWindow, &leftStartGliderDest);
}
else if (objActive == kRightGliderSelected)
{
InvalWindowRect(mainWindow, &wasRect);
InvalWindowRect(mainWindow, &rightStartGliderDest);
}
else
{
switch (thisRoom->objects[objActive].what)
{
case kTiki:
case kTable:
case kShelf:
case kCabinet:
case kDeckTable:
case kStool:
case kCounter:
case kDresser:
case kGreaseRt:
case kGreaseLf:
case kSlider:
case kMailboxLf:
case kMailboxRt:
case kTrackLight:
case kMirror:
case kWallWindow:
InvalWindowRect(mainWindow, &mainWindowRect);
break;
default:
InvalWindowRect(mainWindow, &wasRect);
InvalWindowRect(mainWindow, &roomObjectRects[objActive]);
break;
}
}
ReadyBackground(thisRoom->background, thisRoom->tiles);
DrawThisRoomsObjects();
@@ -1727,6 +1680,8 @@ void MoveObject (short whichWay, Boolean shiftDown)
else
StartMarquee(&roomObjectRects[objActive]);
}
UpdateMainWindow();
#endif
}
@@ -2315,10 +2270,7 @@ void DrawThisRoomsObjects (void)
{
if (GetNumberOfLights(thisRoomNumber) <= 0)
{
surface->SetMaskMode(true);
surface->SetPattern8x8(*GetQDGlobalsGray(&dummyPattern));
surface->FillRect(backSrcRect);
surface->SetMaskMode(false);
surface->FillRectWithPattern8x8(backSrcRect, true, *GetQDGlobalsGray(&dummyPattern));
}
for (i = 0; i < kMaxRoomObs; i++)
@@ -2436,7 +2388,7 @@ void DrawThisRoomsObjects (void)
if (!thisRoom->objects[i].data.c.initial)
QOffsetRect(&tempRect, -8, 0);
DrawGreaseRt(&tempRect, thisRoom->objects[i].data.c.length,
thisRoom->objects[i].data.c.initial);
thisRoom->objects[i].data.c.initial, true);
break;
case kGreaseLf:
@@ -2444,7 +2396,7 @@ void DrawThisRoomsObjects (void)
if (!thisRoom->objects[i].data.c.initial)
QOffsetRect(&tempRect, 8, 0);
DrawGreaseLf(&tempRect, thisRoom->objects[i].data.c.length,
thisRoom->objects[i].data.c.initial);
thisRoom->objects[i].data.c.initial, true);
break;
case kFoil:

File diff suppressed because it is too large Load Diff

View File

@@ -967,7 +967,6 @@ void BringSendFrontBack (Boolean bringFront)
fileDirty = true;
UpdateMenus(false);
InvalWindowRect(mainWindow, &mainWindowRect);
DeselectObject();
GetThisRoomsObjRects();
ReadyBackground(thisRoom->background, thisRoom->tiles);
@@ -975,6 +974,8 @@ void BringSendFrontBack (Boolean bringFront)
GenerateRetroLinks();
InitCursor();
UpdateMainWindow();
}
#endif

View File

@@ -8,6 +8,7 @@
#include "PLResources.h"
#include "PLStandardColors.h"
#include "DisplayDeviceManager.h"
#include "Externs.h"
#include "Environ.h"
#include "House.h"
@@ -53,7 +54,6 @@ short batteryTotal, bandsTotal, foilTotal, mortals;
Boolean playing, evenFrame, twoPlayerGame, showFoil, demoGoing;
Boolean doBackground, playerSuicide, phoneBitSet, tvOn;
extern WindowPtr menuWindow;
extern VFileSpec *theHousesSpecs;
extern demoPtr demoData;
extern gameType smallGame;
@@ -66,6 +66,7 @@ extern short numStarsRemaining, numChimes, saidFollow;
extern Boolean quitting, isMusicOn, gameOver, hasMirror, onePlayerLeft;
extern Boolean isPlayMusicIdle, failedMusic, quickerTransitions;
extern Boolean switchedOut;
extern short wasScoreboardTitleMode;
//============================================================== Functions
@@ -77,7 +78,6 @@ void NewGame (short mode)
PLError_t theErr;
Boolean wasPlayMusicPref;
AdjustScoreboardHeight();
gameOver = false;
theMode = kPlayMode;
if (isPlayMusicGame)
@@ -136,14 +136,14 @@ void NewGame (short mode)
DrawSurface *mainWindowSurface = mainWindow->GetDrawSurface();
tempRect = thisMac.screen;
tempRect = thisMac.constrainedScreen;
tempRect.top = tempRect.bottom - 20; // thisMac.menuHigh
mainWindowSurface->FillRect(tempRect);
#ifdef COMPILEQT
if ((thisMac.hasQT) && (hasMovie))
{
SetMovieGWorld(theMovie, &mainWindow->m_surface, nil);
theMovie.m_surface = &mainWindow->m_surface;
}
#endif
@@ -156,7 +156,7 @@ void NewGame (short mode)
// DebugStr("\pIf screen isn't black, exit to shell."); // TEMP TEMP TEMP
DrawLocale();
ResetLocale(false);
RefreshScoreboard(kNormalTitleMode);
// if (quickerTransitions)
// DissBitsChunky(&justRoomsRect);
@@ -195,11 +195,11 @@ void NewGame (short mode)
#ifdef COMPILEQT
if ((thisMac.hasQT) && (hasMovie) && (tvInRoom))
{
SetMovieActive(theMovie, true);
theMovie.m_playing = true;
if (tvOn)
{
StartMovie(theMovie);
MoviesTask(theMovie, 0);
AnimationManager::GetInstance()->RegisterPlayer(&theMovie);
AnimationManager::GetInstance()->RefreshPlayer(&theMovie);
}
}
#endif
@@ -218,8 +218,7 @@ void NewGame (short mode)
if ((thisMac.hasQT) && (hasMovie) && (tvInRoom))
{
tvInRoom = false;
StopMovie(theMovie);
SetMovieActive(theMovie, false);
theMovie.m_playing = false;
}
#endif
@@ -363,12 +362,37 @@ void SetHouseToSavedRoom (void)
ForceThisRoom(smallGame.roomNumber);
}
//-------------------------------------------------------------- HandleGameResolutionChange
void HandleGameResolutionChange(void)
{
FlushResolutionChange();
RecomputeInterfaceRects();
RecreateOffscreens();
CloseMainWindow();
OpenMainWindow();
if (hasMovie)
theMovie.m_surface = &mainWindow->m_surface;
ResetLocale(true);
InitScoreboardMap();
RefreshScoreboard(wasScoreboardTitleMode);
DumpScreenOn(&justRoomsRect);
}
//-------------------------------------------------------------- PlayGame
void PlayGame (void)
{
while ((playing) && (!quitting))
{
if (thisMac.isResolutionDirty)
{
HandleGameResolutionChange();
}
gameFrame++;
evenFrame = !evenFrame;
@@ -399,7 +423,7 @@ void PlayGame (void)
{
#ifdef COMPILEQT
if ((thisMac.hasQT) && (hasMovie) && (tvInRoom) && (tvOn))
MoviesTask(theMovie, 0);
AnimationManager::GetInstance()->RefreshPlayer(&theMovie);
#endif
RenderFrame();
HandleDynamicScoreboard();
@@ -424,7 +448,7 @@ void PlayGame (void)
{
#ifdef COMPILEQT
if ((thisMac.hasQT) && (hasMovie) && (tvInRoom) && (tvOn))
MoviesTask(theMovie, 0);
AnimationManager::GetInstance()->RefreshPlayer(&theMovie);
#endif
RenderFrame();
HandleDynamicScoreboard();
@@ -726,12 +750,12 @@ void RestoreEntireGameScreen (void)
#endif
DrawSurface *surface = mainWindow->GetDrawSurface();
tempRect = thisMac.screen;
tempRect = thisMac.constrainedScreen;
surface->SetForeColor(StdColors::Black());
surface->FillRect(tempRect);
DrawLocale();
ResetLocale(false);
RefreshScoreboard(kNormalTitleMode);
// if (quickerTransitions)
// DissBitsChunky(&justRoomsRect);

View File

@@ -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"
@@ -33,9 +34,7 @@ void CopyRectsQD (void);
Rect work2MainRects[kMaxGarbageRects];
Rect back2WorkRects[kMaxGarbageRects];
Rect shieldRect;
THandle<Rect> mirrorRects;
Point shieldPt;
long nextFrame;
short numWork2Main, numBack2Work;
Boolean hasMirror;
@@ -148,7 +147,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);

View File

@@ -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;
@@ -324,19 +325,12 @@ void ReflectCurrentRoom (Boolean forceMapRedraw)
}
}
GenerateRetroLinks();
DebugPixMap(backSrcMap->m_port.GetPixMap(), "DebugData/EditorSplash1");
UpdateEditWindowTitle();
DebugPixMap(backSrcMap->m_port.GetPixMap(), "DebugData/EditorSplash2");
ReadyBackground(thisRoom->background, thisRoom->tiles);
DebugPixMap(backSrcMap->m_port.GetPixMap(), "DebugData/EditorSplash3");
GetThisRoomsObjRects();
DebugPixMap(backSrcMap->m_port.GetPixMap(), "DebugData/EditorSplash4");
DrawThisRoomsObjects();
DebugPixMap(backSrcMap->m_port.GetPixMap(), "DebugData/EditorSplash5");
PL_NotYetImplemented_TODO("FixMe");
DebugPixMap(backSrcMap->m_port.GetPixMap(), "DebugData/EditorSplash6");
//InvalWindowRect(mainWindow, &mainWindowRect);
UpdateMainWindow();
#endif
}

View File

@@ -42,33 +42,45 @@ extern Boolean shadowVisible, takingTheStairs;
//============================================================== Functions
//-------------------------------------------------------------- DrawLocale
void DrawLocale (void)
void ResetLocale (Boolean soft)
{
short i, roomV;
char wasState;
DrawSurface *wasCPort;
ZeroFlamesAndTheLike();
ZeroDinahs();
KillAllBands();
ZeroMirrorRegion();
ZeroTriggers();
numTempManholes = 0;
FlushAnyTriggerPlaying();
DumpTriggerSound();
tvInRoom = false;
tvWithMovieNumber = -1;
roomV = (*thisHouse)->rooms[thisRoomNumber].floor;
for (i = 0; i < 9; i++)
if (soft)
{
localNumbers[i] = GetNeighborRoomNumber(i);
isStructure[i] = IsRoomAStructure(localNumbers[i]);
RemoveSavedMapsNotInRoom(localNumbers[kCentralRoom]);
ZeroDinahsNotInRoom(localNumbers[kCentralRoom]);
// Clear all dinah indexes, they'll be remapped
for (int i = 0; i < numMasterObjects; i++)
masterObjects[i].dynaNum = -1;
}
ListAllLocalObjects();
wasCPort = GetGraphicsPort();
else
{
ZeroFlamesAndTheLike();
ZeroDinahs();
KillAllBands();
ZeroTriggers();
numTempManholes = 0;
FlushAnyTriggerPlaying();
DumpTriggerSound();
tvInRoom = false;
tvWithMovieNumber = -1;
for (int i = 0; i < 9; i++)
{
localNumbers[i] = GetNeighborRoomNumber(i);
isStructure[i] = IsRoomAStructure(localNumbers[i]);
}
ListAllLocalObjects();
}
ZeroMirrorRegion();
takingTheStairs = false;
DrawSurface *wasCPort = GetGraphicsPort();
const short roomV = (*thisHouse)->rooms[thisRoomNumber].floor;
backSrcMap->SetForeColor(StdColors::Black());
backSrcMap->FillRect(backSrcRect);
@@ -115,14 +127,16 @@ void DrawLocale (void)
numLights = GetNumberOfLights(localNumbers[kCentralRoom]);
DrawRoomBackground(localNumbers[kCentralRoom], kCentralRoom, roomV);
DrawARoomsObjects(kCentralRoom, false);
DrawARoomsObjects(kCentralRoom, soft);
DrawLighting();
if (numNeighbors > 3)
DrawFloorSupport();
RestoreWorkMap();
shadowVisible = IsShadowVisible();
takingTheStairs = false;
if (soft)
RedrawAllGrease();
SetGraphicsPort(wasCPort);
}
@@ -380,12 +394,12 @@ void ReadyLevel (void)
{
tvInRoom = false;
tvWithMovieNumber = -1;
StopMovie(theMovie);
theMovie.m_playing = false;
}
#endif
DetermineRoomOpenings();
DrawLocale();
ResetLocale(false);
InitGarbageRects();
}
@@ -418,9 +432,10 @@ void RedrawRoomLighting (void)
{
DrawRoomBackground(localNumbers[kCentralRoom], kCentralRoom, roomV);
DrawARoomsObjects(kCentralRoom, true);
RedrawAllGrease();
DrawLighting();
UpdateOutletsLighting(localNumbers[kCentralRoom], numLights);
if (numNeighbors > 3)
DrawFloorSupport();
RestoreWorkMap();

View File

@@ -14,7 +14,12 @@
#include "DialogManager.h"
#include "DialogUtils.h"
#include "Externs.h"
#include "HostDisplayDriver.h"
#include "IGpDisplayDriver.h"
#include "RectUtils.h"
#include "PLPopupMenuWidget.h"
#include "PLTimeTaggedVOSEvent.h"
#include "QDPixMap.h"
#include "ResourceCompiledRef.h"
#include "ResourceManager.h"
#include "Utilities.h"
@@ -39,12 +44,13 @@
void UpdateRoomInfoDialog (Dialog *);
void DragMiniTile (DrawSurface *, Point, short *);
void DragMiniTile (Window *, 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 *);
int16_t OriginalArtFilter (Dialog *dialog, const TimeTaggedVOSEvent *evt);
Boolean PictIDExists (short);
short GetFirstPICT (void);
void BitchAboutPICTNotFound (void);
@@ -58,9 +64,11 @@ short tileOver, tempBack, cursorIs;
Boolean originalLeftOpen, originalTopOpen, originalRightOpen, originalBottomOpen;
Boolean originalFloor;
extern Cursor handCursor;
extern IGpCursor *handCursor;
extern short lastBackground;
extern PortabilityLayer::ResourceArchive *houseResFork;
//============================================================== Functions
//-------------------------------------------------------------- UpdateRoomInfoDialog
@@ -71,7 +79,6 @@ void UpdateRoomInfoDialog (Dialog *theDialog)
Rect src, dest;
short i;
DrawDialog(theDialog);
if (tempBack >= kUserBackground)
SetPopUpMenuValue(theDialog, kRoomPopupItem, kOriginalArtworkItem);
else
@@ -81,7 +88,7 @@ void UpdateRoomInfoDialog (Dialog *theDialog)
CopyBits(GetPortBitMapForCopyBits(tileSrcMap),
GetPortBitMapForCopyBits(GetDialogPort(theDialog)),
GetPortBitMapForCopyBits(theDialog->GetWindow()->GetDrawSurface()),
&tileSrcRect, &tileSrc, srcCopy);
/*
CopyBits(&((GrafPtr)tileSrcMap)->portBits,
@@ -96,7 +103,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,
@@ -121,7 +128,7 @@ void UpdateRoomInfoDialog (Dialog *theDialog)
//-------------------------------------------------------------- DragMiniTile
#ifndef COMPILEDEMO
void DragMiniTile (DrawSurface *surface, Point mouseIs, short *newTileOver)
void DragMiniTile (Window *window, DrawSurface *surface, Point mouseIs, short *newTileOver)
{
Rect dragRect;
Point mouseWas;
@@ -142,14 +149,14 @@ void DragMiniTile (DrawSurface *surface, Point mouseIs, short *newTileOver)
mouseWas = mouseIs;
while (WaitMouseUp()) // loop until mouse button let up
{
GetMouse(&mouseIs); // get mouse coords
if (DeltaPoint(mouseWas, mouseIs) != 0L) // the mouse has moved
GetMouse(window, &mouseIs); // get mouse coords
if (mouseWas != mouseIs) // the mouse has moved
{
surface->InvertFrameRect(dragRect, pattern);
QOffsetRect(&dragRect, mouseIs.h - mouseWas.h, 0);
surface->InvertFrameRect(dragRect, pattern);
if (PtInRect(mouseIs, &tileDest)) // is cursor in the drop rect
if (tileDest.Contains(mouseIs)) // is cursor in the drop rect
{
*newTileOver = (mouseIs.h - tileDest.left) / kMiniTileWide;
if (*newTileOver != wasTileOver)
@@ -259,11 +266,11 @@ void HiliteTileOver (DrawSurface *surface, Point mouseIs)
{
short newTileOver;
if (PtInRect(mouseIs, &tileSrc))
if (tileSrc.Contains(mouseIs))
{
if (cursorIs != kHandCursor)
{
SetCursor(&handCursor);
PortabilityLayer::HostDisplayDriver::GetInstance()->SetCursor(handCursor);
cursorIs = kHandCursor;
}
@@ -319,15 +326,14 @@ void HiliteTileOver (DrawSurface *surface, Point mouseIs)
}
surface->SetForeColor(StdColors::Black());
PenNormal();
tileOver = -1;
}
if (PtInRect(mouseIs, &editTETextBox))
if (editTETextBox.Contains(mouseIs))
{
if (cursorIs != kBeamCursor)
{
SetBuiltinCursor(iBeamCursor);
PortabilityLayer::HostDisplayDriver::GetInstance()->SetStandardCursor(EGpStandardCursors::kIBeam);
cursorIs = kBeamCursor;
}
}
@@ -346,134 +352,135 @@ 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;
Window *window = dial->GetWindow();
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 (PtInRect(mouseIs, &tileSrc))
{
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(window, 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);
return -1;
}
}
return -1;
}
#endif
//-------------------------------------------------------------- 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((GrafPtr)roomInfoDialog);
// Fix this later. TEMP
// AddMenuToPopUp(roomInfoDialog, kRoomPopupItem, backgroundsMenu);
SetPort(&roomInfoDialog->GetWindow()->GetDrawSurface()->m_port);
{
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
@@ -497,10 +504,14 @@ void DoRoomInfo (void)
MyDisableControl(roomInfoDialog, kBoundsButton);
leaving = false;
UpdateRoomInfoDialog(roomInfoDialog);
while (!leaving)
{
ModalDialog(RoomFilter, &item);
bool needRedraw = false;
item = roomInfoDialog->ExecuteModal(RoomFilter);
if (item == kOkayButton)
{
@@ -548,8 +559,7 @@ void DoRoomInfo (void)
{
tempBack = newBack;
LoadScaledGraphicCustom(tileSrcMap, tempBack, &tileSrcRect);
InvalWindowRect(roomInfoDialog->GetWindow(), &tileSrc);
InvalWindowRect(roomInfoDialog->GetWindow(), &tileDest);
needRedraw = true;
}
}
else
@@ -576,8 +586,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)
@@ -587,10 +596,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();
@@ -607,133 +618,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);
}
break;
case mouseDown:
mouseIs = event->where;
mouseIs -= dial->GetWindow()->TopLeftCoord();
if (PtInRect(mouseIs, &leftBound))
{
*item = 7;
return(true);
}
else if (PtInRect(mouseIs, &topBound))
{
*item = 8;
return(true);
}
else if (PtInRect(mouseIs, &rightBound))
{
*item = 9;
return(true);
}
else if (PtInRect(mouseIs, &bottomBound))
{
*item = 10;
return(true);
}
else
return(false);
break;
case mouseUp:
return(false);
break;
case updateEvt:
SetPortDialogPort(dial);
UpdateOriginalArt(dial);
EndUpdate(dial->GetWindow());
event->what = nullEvent;
return(false);
break;
return 0;
default:
return(false);
break;
return -1;
}
}
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))
return 7;
else if (topBound.Contains(mouseIs))
return 8;
else if (rightBound.Contains(mouseIs))
return 9;
else if (bottomBound.Contains(mouseIs))
return 10;
else
return -1;
}
return -1;
}
#endif
@@ -780,10 +741,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)
{
@@ -908,18 +871,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

View File

@@ -11,6 +11,7 @@
#include "Externs.h"
#include "Environ.h"
#include "MenuManager.h"
#include "QDPixMap.h"
#include "QDStandardPalette.h"
#include "RectUtils.h"
@@ -41,7 +42,7 @@ Rect badgesBlankRects[4], badgesBadgesRects[4];
Rect badgesDestRects[4];
DrawSurface *boardPSrcMap;
long displayedScore;
short wasScoreboardMode;
short wasScoreboardTitleMode;
Boolean doRollScore;
extern Rect localRoomsDest[], justRoomsRect;
@@ -62,6 +63,7 @@ void MarkScoreboardPortDirty(void)
void RefreshScoreboard (SInt16 mode)
{
wasScoreboardTitleMode = mode;
doRollScore = true;
RefreshRoomTitle(mode);
@@ -406,52 +408,3 @@ void QuickFoilRefresh (Boolean flash)
MarkScoreboardPortDirty();
}
//-------------------------------------------------------------- AdjustScoreboardHeight
void AdjustScoreboardHeight (void)
{
short offset, newMode;
if (numNeighbors == 9)
newMode = kScoreboardHigh;
else
newMode = kScoreboardLow;
if (wasScoreboardMode != newMode)
{
switch (newMode)
{
case kScoreboardHigh: // 9 neighbors
offset = localRoomsDest[kCentralRoom].top;
offset = -offset;
justRoomsRect = workSrcRect;
break;
case kScoreboardLow: // 1 or 3 neighbors
offset = localRoomsDest[kCentralRoom].top;
justRoomsRect = workSrcRect;
justRoomsRect.top = localRoomsDest[kCentralRoom].top;
justRoomsRect.bottom = localRoomsDest[kCentralRoom].bottom;
break;
}
QOffsetRect(&boardDestRect, 0, offset);
QOffsetRect(&boardGQDestRect, 0, offset);
QOffsetRect(&boardPQDestRect, 0, offset);
QOffsetRect(&badgesDestRects[kBatteryBadge], 0, offset);
QOffsetRect(&badgesDestRects[kBandsBadge], 0, offset);
QOffsetRect(&badgesDestRects[kFoilBadge], 0, offset);
QOffsetRect(&badgesDestRects[kHeliumBadge], 0, offset);
wasScoreboardMode = newMode;
}
}
//-------------------------------------------------------------- BlackenScoreboard
void BlackenScoreboard (DrawSurface *surface)
{
UpdateMenuBarWindow(surface);
}

View File

@@ -76,7 +76,7 @@ void UpdateLoadDialog (Dialog *theDialog)
theWindow = theDialog->GetWindow();
DrawSurface *surface = theWindow->GetDrawSurface();
GetWindowBounds(theWindow, kWindowContentRgn, &dialogRect);
dialogRect = theWindow->GetDrawSurface()->m_port.GetRect();
ColorFrameWHRect(theDialog->GetWindow()->GetDrawSurface(), 8, 39, 413, 184, kRedOrangeColor8); // box around files
@@ -229,7 +229,6 @@ int16_t LoadFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
return kScrollDownItem;
case PL_KEY_SPECIAL(kUpArrow):
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
thisHouseIndex -= 4;
if (thisHouseIndex < 0)
{
@@ -243,23 +242,20 @@ int16_t LoadFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
if (thisHouseIndex >= screenCount)
thisHouseIndex -= 4;
}
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
UpdateLoadDialog(dial);
return 0;
case PL_KEY_SPECIAL(kDownArrow):
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
thisHouseIndex += 4;
screenCount = housesFound - housePage;
if (screenCount > kDispFiles)
screenCount = kDispFiles;
if (thisHouseIndex >= screenCount)
thisHouseIndex %= 4;
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
UpdateLoadDialog(dial);
return 0;
case PL_KEY_SPECIAL(kLeftArrow):
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
thisHouseIndex--;
if (thisHouseIndex < 0)
{
@@ -268,19 +264,18 @@ int16_t LoadFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
screenCount = kDispFiles;
thisHouseIndex = screenCount - 1;
}
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
UpdateLoadDialog(dial);
return 0;
case PL_KEY_SPECIAL(kTab):
case PL_KEY_SPECIAL(kRightArrow):
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
thisHouseIndex++;
screenCount = housesFound - housePage;
if (screenCount > kDispFiles)
screenCount = kDispFiles;
if (thisHouseIndex >= screenCount)
thisHouseIndex = 0;
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
UpdateLoadDialog(dial);
return 0;
default:
@@ -308,10 +303,7 @@ int16_t LoadFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
thisHouseIndex = screenCount - 1;
}
if (wasIndex != thisHouseIndex)
{
InvalWindowRect(dial->GetWindow(), &loadHouseRects[wasIndex]);
InvalWindowRect(dial->GetWindow(), &loadHouseRects[thisHouseIndex]);
}
UpdateLoadDialog(dial);
}
return 0;
}

View File

@@ -31,13 +31,16 @@
#define kDisplay1Item 3
#define kDisplay3Item 4
#define kDisplay9Item 5
#define kBorder1Item 8
#define kDoColorFadeItem 9
#define kCurrentDepth 10
#define k256Depth 11
#define k16Depth 12
#define kDispDefault 15
#define kUseQDItem 16
#define kUseScreen2Item 17
//#define kCurrentDepth 10
//#define k256Depth 11
//#define k16Depth 12
#define kBorder2Item 10
#define kBorder3Item 11
#define kDispDefault 12
//#define kUseQDItem 13
//#define kUseScreen2Item 14
#define kSofterItem 4
#define kLouderItem 5
#define kVolNumberItem 7
@@ -894,17 +897,13 @@ void DisplayUpdate (Dialog *theDialog)
DrawDefaultButton(theDialog);
SetDialogItemValue(theDialog, kDoColorFadeItem, (short)wasFade);
SelectFromRadioGroup(theDialog, kCurrentDepth + wasDepthPref,
kCurrentDepth, k16Depth);
// SetDialogItemValue(theDialog, kUseQDItem, (short)wasQD);
SetDialogItemValue(theDialog, kUseScreen2Item, (short)wasScreen2);
ForeColor(redColor);
FrameDisplayIcon(theDialog, StdColors::Red());
ForeColor(blackColor);
FrameDialogItemC(theDialog, 8, kRedOrangeColor8);
FrameDialogItemC(theDialog, 13, kRedOrangeColor8);
FrameDialogItemC(theDialog, 14, kRedOrangeColor8);
FrameDialogItemC(theDialog, kBorder1Item, kRedOrangeColor8);
FrameDialogItemC(theDialog, kBorder2Item, kRedOrangeColor8);
FrameDialogItemC(theDialog, kBorder3Item, kRedOrangeColor8);
}
//-------------------------------------------------------------- DisplayFilter
@@ -961,37 +960,6 @@ int16_t DisplayFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
}
break;
case PL_KEY_SPECIAL(kUpArrow):
switch (wasDepthPref)
{
case kSwitchIfNeeded:
return k16Depth;
case kSwitchTo256Colors:
return kCurrentDepth;
case kSwitchTo16Grays:
return k256Depth;
default:
return -1;
}
break;
case PL_KEY_SPECIAL(kDownArrow):
switch (wasDepthPref)
{
case kSwitchIfNeeded:
return k256Depth;
case kSwitchTo256Colors:
return k16Depth;
case kSwitchTo16Grays:
return kCurrentDepth;
}
break;
case PL_KEY_ASCII('1'):
return kDisplay1Item;
@@ -1008,15 +976,6 @@ int16_t DisplayFilter(Dialog *dial, const TimeTaggedVOSEvent *evt)
FlashDialogButton(dial, kDispDefault);
return kDispDefault;
case PL_KEY_ASCII('R'):
PL_NotYetImplemented_TODO("FixMe"); // GP: This looks like a bug
FlashDialogButton(dial, kUseQDItem);
return kUseScreen2Item;
case PL_KEY_ASCII('U'):
return kUseQDItem;
default:
return -1;
}
@@ -1036,14 +995,8 @@ void DoDisplayPrefs (void)
BringUpDialog(&prefDlg, kDisplayPrefsDialID, nullptr);
if (!thisMac.can8Bit)
{
MyDisableControl(prefDlg, kDoColorFadeItem);
MyDisableControl(prefDlg, k256Depth);
}
if (!thisMac.can4Bit)
MyDisableControl(prefDlg, k16Depth);
if (thisMac.numScreens < 2)
MyDisableControl(prefDlg, kUseScreen2Item);
wasNeighbors = numNeighbors;
wasFade = isDoColorFade;
wasDepthPref = isDepthPref;
@@ -1078,7 +1031,7 @@ void DoDisplayPrefs (void)
break;
case kDisplay3Item:
if (thisMac.screen.right > 512)
if (thisMac.constrainedScreen.right > 512)
{
FrameDisplayIcon(prefDlg, StdColors::White());
numNeighbors = 3;
@@ -1087,7 +1040,7 @@ void DoDisplayPrefs (void)
break;
case kDisplay9Item:
if (thisMac.screen.right > 512)
if (thisMac.constrainedScreen.right > 512)
{
FrameDisplayIcon(prefDlg, StdColors::White());
numNeighbors = 9;
@@ -1100,29 +1053,12 @@ void DoDisplayPrefs (void)
SetDialogItemValue(prefDlg, kDoColorFadeItem, (short)wasFade);
break;
case kCurrentDepth:
case k256Depth:
case k16Depth:
wasDepthPref = itemHit - kCurrentDepth;
SelectFromRadioGroup(prefDlg, itemHit, kCurrentDepth, k16Depth);
break;
case kDispDefault:
FrameDisplayIcon(prefDlg, StdColors::White());
ForeColor(blackColor);
DisplayDefaults();
DisplayUpdate(prefDlg);
break;
case kUseQDItem:
// wasQD = !wasQD;
// SetDialogItemValue(prefDlg, kUseQDItem, (short)wasQD);
break;
case kUseScreen2Item:
wasScreen2 = !wasScreen2;
SetDialogItemValue(prefDlg, kUseScreen2Item, (short)wasScreen2);
break;
}
}

View File

@@ -205,7 +205,7 @@ PLError_t LoadTriggerSound (short soundID)
}
else
{
BlockMove((Byte*)(*theSound), theSoundData[kMaxSounds - 1], soundDataSize);
memcpy(theSoundData[kMaxSounds - 1], (Byte*)(*theSound), soundDataSize);
theSound.Dispose();
}
}
@@ -246,7 +246,7 @@ PLError_t LoadBufferSounds (void)
if (theSoundData[i] == nil)
return (PLErrors::kOutOfMemory);
BlockMove(*theSound, theSoundData[i], soundDataSize);
memcpy(theSoundData[i], *theSound, soundDataSize);
theSound.Dispose();
}

View File

@@ -52,7 +52,6 @@ extern Rect boardPQDestRect, boardGQDestRect, badgesBlankRects[];
extern Rect badgesBadgesRects[], badgesDestRects[];
extern Rect nailSrcRect, sparkleSrc[];
extern Rect pointsSrc[], breadSrc[];
extern short wasScoreboardMode;
//============================================================== Functions
@@ -60,20 +59,22 @@ extern short wasScoreboardMode;
// Any graphics and structures relating to the scoreboard that appears<72>
// across the top of the game are initialized and loaded up here.
void InitScoreboardMap (void)
void InitScoreboardMap(void)
{
Rect bounds;
THandle<BitmapImage> thePicture;
DrawSurface *wasCPort;
PLError_t theErr;
short hOffset;
wasScoreboardMode = kScoreboardHigh;
if (boardSrcMap)
DisposeGWorld(boardSrcMap);
boardSrcRect = houseRect;
ZeroRectCorner(&boardSrcRect);
boardSrcRect.bottom = kScoreboardTall;
theErr = CreateOffScreenGWorld(&boardSrcMap, &boardSrcRect, kPreferredPixelFormat);
if (boardSrcRect.right >= 640)
hOffset = (RectWide(&boardSrcRect) - kMaxViewWidth) / 2;
else
@@ -86,40 +87,50 @@ void InitScoreboardMap (void)
QOffsetRect(&bounds, hOffset, 0);
boardSrcMap->DrawPicture(thePicture, bounds);
thePicture.Dispose();
QSetRect(&badgeSrcRect, 0, 0, 32, 66); // 2144 pixels
theErr = CreateOffScreenGWorld(&badgeSrcMap, &badgeSrcRect, kPreferredPixelFormat);
LoadGraphic(badgeSrcMap, kBadgePictID);
if (!badgeSrcMap)
{
theErr = CreateOffScreenGWorld(&badgeSrcMap, &badgeSrcRect, kPreferredPixelFormat);
LoadGraphic(badgeSrcMap, kBadgePictID);
}
boardDestRect = boardSrcRect;
hOffset = (RectWide(&houseRect) - 640) / 2;
if (hOffset < 0)
hOffset = -128;
QSetRect(&boardTSrcRect, 0, 0, 256, 12); // room title
theErr = CreateOffScreenGWorld(&boardTSrcMap, &boardTSrcRect, kPreferredPixelFormat);
if (!boardTSrcMap)
{
theErr = CreateOffScreenGWorld(&boardTSrcMap, &boardTSrcRect, kPreferredPixelFormat);
boardTSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
}
boardTDestRect = boardTSrcRect;
QOffsetRect(&boardTDestRect, 137 + hOffset, 5);
boardTSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
QSetRect(&boardGSrcRect, 0, 0, 20, 10); // # gliders
theErr = CreateOffScreenGWorld(&boardGSrcMap, &boardGSrcRect, kPreferredPixelFormat);
if (!boardGSrcMap)
{
theErr = CreateOffScreenGWorld(&boardGSrcMap, &boardGSrcRect, kPreferredPixelFormat);
boardGSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
}
boardGDestRect = boardGSrcRect;
QOffsetRect(&boardGDestRect, 526 + hOffset, 5);
boardGSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
QSetRect(&boardPSrcRect, 0, 0, 64, 10); // points
theErr = CreateOffScreenGWorld(&boardPSrcMap, &boardPSrcRect, kPreferredPixelFormat);
if (!boardPSrcMap)
{
theErr = CreateOffScreenGWorld(&boardPSrcMap, &boardPSrcRect, kPreferredPixelFormat);
boardPSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
}
boardPDestRect = boardPSrcRect;
QOffsetRect(&boardPDestRect, 570 + hOffset, 5); // total = 6396 pixels
boardPQDestRect = boardPDestRect;
boardGQDestRect = boardGDestRect;
boardPSrcMap->SetApplicationFont(12, PortabilityLayer::FontFamilyFlag_Bold);
QSetRect(&badgesBlankRects[0], 0, 0, 16, 16); // foil
QOffsetRect(&badgesBlankRects[0], 0, 0);
QSetRect(&badgesBlankRects[1], 0, 0, 16, 16); // rubber bands

View File

@@ -11,6 +11,7 @@
#include "GameOver.h"
#include "MainWindow.h"
#include "Objects.h"
#include "QDManager.h"
#include "RectUtils.h"
#include "ResourceManager.h"
#include "Room.h"
@@ -112,6 +113,34 @@ void InitAngel (void)
LoadGraphic(angelMaskMap, kAngelPictID + 1);
}
//-------------------------------------------------------------- RecreateOffscreens
// Recreates resolution-dependent offscreen work
PLError_t RecreateOffscreens(void)
{
PLError_t theErr;
PortabilityLayer::QDManager::GetInstance()->SetPort(nullptr);
if (workSrcMap)
DisposeGWorld(workSrcMap);
if (backSrcMap)
DisposeGWorld(backSrcMap);
justRoomsRect = houseRect;
ZeroRectCorner(&justRoomsRect);
workSrcRect = houseRect; // Set up work map
ZeroRectCorner(&workSrcRect);
theErr = CreateOffScreenGWorld(&workSrcMap, &workSrcRect, kPreferredPixelFormat);
backSrcRect = houseRect; // Set up background map
ZeroRectCorner(&backSrcRect);
theErr = CreateOffScreenGWorld(&backSrcMap, &backSrcRect, kPreferredPixelFormat);
return PLErrors::kNone;
}
//-------------------------------------------------------------- CreateOffscreens
// All "utility" or "work" offscreen pix/bit maps are created here.
// These would be offscreens that are reused throughout a game - they<65>
@@ -121,17 +150,8 @@ void InitAngel (void)
void CreateOffscreens (void)
{
PLError_t theErr;
justRoomsRect = houseRect;
ZeroRectCorner(&justRoomsRect);
workSrcRect = houseRect; // Set up work map
ZeroRectCorner(&workSrcRect);
theErr = CreateOffScreenGWorld(&workSrcMap, &workSrcRect, kPreferredPixelFormat);
backSrcRect = houseRect; // Set up background map
ZeroRectCorner(&backSrcRect);
theErr = CreateOffScreenGWorld(&backSrcMap, &backSrcRect, kPreferredPixelFormat);
theErr = RecreateOffscreens();
InitScoreboardMap(); SpinCursor(1);
InitGliderMap(); SpinCursor(1);
@@ -268,7 +288,7 @@ void CreatePointers (void)
{
GP_STATIC_ASSERT(sizeof(demoType) == 6);
BlockMove(*tempHandle, demoData, kDemoLength);
memcpy(demoData, *tempHandle, kDemoLength);
tempHandle.Dispose();
}
#endif

View File

@@ -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"
@@ -60,6 +61,7 @@ void FrameSelectedTool (DrawSurface *);
void DrawToolName (DrawSurface *);
void DrawToolTiles (DrawSurface *);
void SwitchToolModes (short);
void KeepWindowInBounds (Window *window);
Rect toolsWindowRect, toolSrcRect, toolTextRect;
@@ -133,7 +135,6 @@ void FrameSelectedTool (DrawSurface *surface)
InsetRect(&theRect, 1, 1);
surface->FrameRect(theRect);
PenNormal();
ForeColor(blackColor);
}
#endif
@@ -192,14 +193,14 @@ void DrawToolTiles (DrawSurface *surface)
void EraseSelectedTool (void)
{
#ifndef COMPILEDEMO
DrawSurface *surface = mainWindow->GetDrawSurface();
DrawSurface *surface = toolsWindow->GetDrawSurface();
Rect theRect;
short toolIcon;
if (toolsWindow == nil)
return;
SetPort((GrafPtr)toolsWindow);
SetPort(&toolsWindow->GetDrawSurface()->m_port);
toolIcon = toolSelected;
if ((toolMode == kBlowerMode) && (toolIcon >= 7))
@@ -269,7 +270,6 @@ void UpdateToolsWindow (void)
return;
DrawSurface *surface = toolsWindow->GetDrawSurface();
DrawControls(toolsWindow);
DkGrayForeColor(surface);
surface->DrawLine(Point::Create(4, 25), Point::Create(112, 25));
@@ -300,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);
}
@@ -320,7 +320,6 @@ void OpenToolsWindow (void)
wm->PutWindowBehind(toolsWindow, wm->GetPutInFrontSentinel());
wm->ShowWindow(toolsWindow);
// FlagWindowFloating(toolsWindow); TEMP - use flaoting windows
HiliteAllWindows();
{
PortabilityLayer::WidgetBasicState state;
@@ -334,6 +333,8 @@ void OpenToolsWindow (void)
classPopUp = PortabilityLayer::PopupMenuWidget::Create(state);
}
toolsWindow->DrawControls();
if (classPopUp == nil)
RedAlert(kErrFailedResourceLoad);
@@ -350,9 +351,13 @@ void OpenToolsWindow (void)
SwitchToolModes(toolMode);
toolSelected = kSelectTool;
KeepWindowInBounds(toolsWindow);
}
UpdateToolsCheckmark(true);
UpdateToolsWindow();
#endif
}
@@ -460,7 +465,7 @@ void SwitchToolModes (short newMode)
void HandleToolsClick (Point wherePt)
{
#ifndef COMPILEDEMO
ControlHandle theControl;
PortabilityLayer::Widget *theControl;
short i, part, newMode, toolIcon;
if (toolsWindow == nil)
@@ -472,21 +477,22 @@ void HandleToolsClick (Point wherePt)
part = FindControl(wherePt, toolsWindow, &theControl);
if ((theControl != nil) && (part != 0))
{
part = TrackControl(theControl, wherePt, (ControlActionUPP)-1L);
part = theControl->Capture(wherePt, nullptr);
if (part != 0)
{
newMode = GetControlValue(theControl);
newMode = theControl->GetState();
if (newMode != toolMode)
{
EraseSelectedTool();
SwitchToolModes(newMode);
UpdateToolsWindow();
}
}
}
else
{
for (i = 0; i < kTotalTools; i++)
if ((PtInRect(wherePt, &toolRects[i])) && (i <= lastTool))
if ((toolRects[i].Contains(wherePt)) && (i <= lastTool))
{
EraseSelectedTool();
toolIcon = i;

Some files were not shown because too many files have changed in this diff Show More